Truxton investigation event get investigation id

From truxwiki.com
Jump to navigation Jump to search

This retrieves the identifier of the investigation this event belongs to.

Syntax

void truxton_investigation_event_get_investigation_id( uint64_t investigation_handle, char * destination_string, size_t max_size );

Parameters

investigation_handle

The handle created by truxton_investigation_create().

destination_string

The string to be written to.

max_size

The maximum number of characters that can be written to destination_string.

Sample

void create_event( void )
{
   uint64_t truxton = truxton_create();

   uint64_t event = truxton_investigation_event_create( truxton );

   truxton_investigation_event_set_id(event , "C229B12A-BDBC-4526-BC91-574FDCE0D650"); 
   truxton_investigation_event_set_investigation_id(event , "01da7796-a010-3685-0000-018902cb3b22");
   truxton_investigation_event_set_color(event , 0xFF9E1B18);
   truxton_investigation_event_set_text(event , "Case Opened");
   truxton_investigation_event_set_status(event , INVESTIGATION_STATUS_OPEN);
   truxton_investigation_event_set_type(event , INVESTIGATION_EVENT_TYPE_STATUS_CHANGE);
   truxton_investigation_event_set_when(event , truxton_time_now());

   if ( truxton_investigation_event_save( event ) == 0 )
   {
      printf( "Cannot save investigation event to the database.\n" );
   }

   char guid[MINIMUM_GUID_STRING_BUFFER_SIZE + 5];

   truxton_investigation_event_get_investigation_id( event, guid, sizeof(guid) );
   printf("Investigation ID: %s\n", guid);

   truxton_investigation_event_destroy(event);
   truxton_destroy( truxton );
}