Skip to main content

AfdxSetTokenString

Valid for: CANoe DE • CANoe:lite DE • CANoe4SW DE • CANoe4SW:lite DE

Function Syntax

long AfdxSetTokenString( long packet, long protocolDesignator[], long tokenDesignator[], long offset, char data[] );

Description

This function copies the string value to the token without terminating “\0”.

Parameters

  • packet: Handle of the message that has been created with AfdxInitPacket.
  • protocolDesignator: Name of the protocol, e.g. “afdx”.
  • tokenDesignator: Name of the token, e.g. “data”.
  • offset: This is the offset from the beginning of the token’s data area. If this is 0, data is copied starting at byte 0 of the token’s data area.
  • data: Data as string.

Return Values

Example

long packetHandle;

// create packet
packetHandle = AfdxInitPacket( "afdx" );

// set afdx payload
AfdxResizeToken( packetHandle, "afdx", "data", 5*8 /*bits*/ );
AfdxSetTokenString( packetHandle, "afdx", "data", "Hello" );

// Complete and send packet
AfdxCompletePacket( packetHandle );
AfdxOutputPacket( packetHandle );

// release packet
AfdxReleasePacket( packetHandle );