Truxton investigation event get status

From truxwiki.com
Jump to navigation Jump to search

This retrieves the status of the investigation event.

Syntax

uint64_t truxton_investigation_event_get_status( uint64_t event_handle );

Parameters

event_handle

The handle created by truxton_investigation_create().

Return value

The status of the event.

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" );
   }

   uint64_t value = truxton_investigation_event_get_status( event_handle );
   printf("Status: %" PRIu64 "\n", value);

   truxton_investigation_event_destroy(event);
   truxton_destroy( truxton );
}

Note, the PRIu64 in the sample code above is the new standard way of formatting a 64-bit integer in C. Over the years, different compilers on different operating systems used different format specifiers for things, these PRI macros, along with some tricky string concatenation the compilers perform for you, allow you to maintain a single code base without a bunch of macro magic.