Skip to main content

C2xGetTokenBitString

Open topic with navigation CAPL Functions » Car2x » C2xGetTokenBitString

Function Syntax

long C2xGetTokenBitString( long packet, char protocolDesignator[], char tokenDesignator[], long bufferSize, byte buffer[]); // form 1
long C2xGetTokenBitString( long packet, char protocolDesignator[], char tokenDesignator[], long bufferSize, char buffer[]); // form 2

Description

This function gets the bit string value of a token.

Parameters

  • packet: Handle of a packet that has been created with C2xInitPacket
  • protocolDesignator: Name of the protocol, e.g. userDefinedPayload
  • tokenDesignator: Name of the token, e.g. bitString
  • bufferSize: Size of the buffer in bits
  • buffer: Buffer in which the data is copied

Return Values

Example

byte brakePedalActive(long channel, longdir, longradioChannel, long signalStrength, long sigQuality, long packet)
{
  byte accelerationControl[1];

  if (C2xGetTokenBitString(packet, "CAM", "cam.camParameters.highFrequencyContainer.basicVehicleContainerHighFrequency.accelerationControl", 7, accelerationControl))
  {
    return accelerationControl[0] & 0x80;
  }
  return 0;
}