Skip to main content

<OnC2xPacket> (Callback)

Valid for: CANoe DE Note
This callback must be implemented in the CAPL program by the user to use the function C2xReceivePacket or the function C2xRegisterCallback for Receive Indications.

Function Syntax

void <OnC2xPacket>( long channel, long dir, long radioChannel, long signalStrength, long signalQuality, long packet );

Description

This callback is called when a registered WLAN packet is received. Within this callback the following functions can be used to retrieve the received packet data: These functions access the payload of the highest interpretable protocol. Offset 0 starts at the beginning of the payload.

Parameters

  • channel: WLAN channel on which the packet was received
  • dir: Direction of the packet
    • 0: Rx
    • 1: Tx
  • radioChannel: Radio channel, i.e. 176 or 180
  • signalStrength: Signal strength of the received packet in [dBm]
  • signalQuality: Signal quality of the received packet
  • packet: Handle of the received packet

Return Values

Example

Node System - PreStart in CAPL Browser
on preStart
{
  C2xReceivePacket( "OnC2xPacket");
}
Node Callback Function in CAPL Browser
void <OnC2xPacket>( long channel, long dir, long radioChannel, long signalStrength, long signalQuality, long packet )
{
  byte rx_data[100];
  long rx_length;
  // get the payload of the packet
  rx_length = C2xGetThisData( 0, elCount(rx_data), rx_data );
  // do something with rx_data
}