CAPL Script

GetCANMessage

Syntax

longGetCANMessage(this, message * msg);

Function

This function can only be called inside of anon PDUhandler. The function will return in its second parameter the CAN (or CAN-FD) frame, the PDU was contained.

Parameters

this Handle to the currently handled (received) PDU object.

msg

Reference to amessage objectthat will contain the overall received message data and information.

Return Values

0: Data access successful.

-1: Wrong bus type; CAN message is not available.

-2: Message does not support this info.

-3: The PDU object is invalid.

-4: PDU is not of Rx type.

-5: Parameter too small (e.g. array has too less bytes)

-6: Message or PDU is not available (any more)

on PDU PDU_A{message * aMsg_01;long result;result = GetCANMessage(this, aMsg_01); // PDU is assumed to be sent on CANif (result == 0){write("Received PDU 'PDU_A' in message with CAN ID %lu", aMsg_01.ID);}else{write("Error accessing PDU!");}}

on PDU | GetFrFrame | GetEthernetPacket | GetPDUsTPIPv6SrcAddr | GetPDUsTPIPv6DstAddr | GetPDUsTPIPv4SrcAddr | GetPDUsTPIPv4DstAddr | GetPDUsTPUDPSrcPort | GetPDUsTPUDPDstPort | GetPDUsTPTCPSrcPort | GetPDUsTPTCPDstPort