Difference between revisions of "Truxton message get truxton"

From truxwiki.com
Jump to navigation Jump to search
 
Line 2: Line 2:
  
 
=Syntax=
 
=Syntax=
<syntaxhighlight lang="C">
+
<source lang="C">
 
uint64_t truxton_message_get_truxton( uint64_t message_handle );
 
uint64_t truxton_message_get_truxton( uint64_t message_handle );
</syntaxhighlight>
+
</source>
  
 
=Parameters=
 
=Parameters=
Line 20: Line 20:
 
=Sample=
 
=Sample=
  
<syntaxhighlight lang="C" highlight="3">
+
<source lang="C" highlight="3">
void can_send(uint64_t message_handle)
+
void can_send( uint64_t message_handle )
 
{
 
{
 
   if ( truxton_message_get_truxton( message_handle ) == 0 )
 
   if ( truxton_message_get_truxton( message_handle ) == 0 )
Line 32: Line 32:
 
   }   
 
   }   
 
}
 
}
</syntaxhighlight>
+
</source>

Latest revision as of 12:40, 9 February 2021

This retrieves the handle to the Truxton instance handling this message object.

Syntax

uint64_t truxton_message_get_truxton( uint64_t message_handle );

Parameters

message_handle

The handle to a message created by the truxton_message_create call.

Return value

A non-zero value on success, zero on failure.

Remarks

This allows you to call any API that requires a handle to the Truxton object. Many times, in code, you are given one type of thing but need another. Should you find yourself in a situation where you were given file handle and you need to do something at the Truxton level, you can get the handle you need.

Sample

void can_send( uint64_t message_handle )
{
   if ( truxton_message_get_truxton( message_handle ) == 0 )
   {
      printf( "Cannot send this message.\n" );
   }
   else
   {
      printf( "Sending this message is possible.\n" );
   }   
}