Difference between revisions of "Truxton usb destroy"

From truxwiki.com
Jump to navigation Jump to search
(Created page with "This destroys a USB object. =Syntax= <source lang="C"> void truxton_usb_destroy( uint64_t usb_handle ); </source> =Parameters= ==<code>usb_handle</code>== The handle to the...")
 
 
(One intermediate revision by the same user not shown)
Line 9: Line 9:
 
==<code>usb_handle</code>==
 
==<code>usb_handle</code>==
 
The handle to the USB object.
 
The handle to the USB object.
This handle comes from calling <code>[[truxton_usb_create]]()</code>, <code>[[truxton_child_file_create_usb]]()</code>, <code>[[truxton_file_create_usb]]()</code>,
+
This handle comes from calling <code>[[truxton_usb_create]]()</code>, <code>[[truxton_child_file_create_usb]]()</code>, or <code>[[truxton_file_create_usb]]()</code>.
  
 
=Sample=
 
=Sample=
<source lang="C" line highlight="9">
+
<source lang="C" highlight="19">
 
void add_thumb_drive( uint64_t truxton, uint64_t media, uint64_t child_file, uint64_t when )
 
void add_thumb_drive( uint64_t truxton, uint64_t media, uint64_t child_file, uint64_t when )
 
{
 
{

Latest revision as of 09:38, 25 January 2021

This destroys a USB object.

Syntax

void truxton_usb_destroy( uint64_t usb_handle );

Parameters

usb_handle

The handle to the USB object. This handle comes from calling truxton_usb_create(), truxton_child_file_create_usb(), or truxton_file_create_usb().

Sample

void add_thumb_drive( uint64_t truxton, uint64_t media, uint64_t child_file, uint64_t when )
{
   char media_id[ 65 ];
   char file_id[ 65 ];
   
   truxton_media_get_id( media, media_id, sizeof( media_id ) );
   truxton_child_file_get_id( child_file, file_id, sizeof( file_id ) );

   uint64_t usb = truxton_usb_create( truxton );

   truxton_usb_set_file_id( usb, file_id );
   truxton_usb_set_media_id( usb, media_id );
   truxton_usb_set_when( usb, when );
   truxton_usb_set_vendor_id( usb, 0x8EC );
   truxton_usb_set_product_id( usb, 0x16 );

   // Commit the data to the database
   truxton_usb_save( url );
   truxton_usb_destroy( url );
}