Difference between revisions of "Truxton message get truxton"

From truxwiki.com
Jump to navigation Jump to search
(Created page with "This retrieves the handle to the Truxton instance handling this message object. =Syntax= <syntaxhighlight lang="C"> uint64_t truxton_message_get_truxton( uint64_t message_han...")
 
Line 20: Line 20:
 
=Sample=
 
=Sample=
  
<syntaxhighlight lang="C" highlight="8">
+
<syntaxhighlight lang="C" highlight="3">
 
void can_send(uint64_t message_handle)
 
void can_send(uint64_t message_handle)
 
{
 
{

Revision as of 07:44, 13 June 2020

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