ndDiagFrameRecv
- Updated2025-10-07
- 1 minute(s) read
Purpose
Receives a raw CAN frame on the diagnostic CAN ID to check for errors in the transport protocol implementation of an ECU.
Format
long ndDiagFrameRecv(
TD1 *diagRef,
unsigned long timeout,
unsigned char dataOut[],
long *len);
Input
diagRef
Specifies the diagnostic session handle, obtained from ndOpenDiagnosticOnCANFD and passed to subsequent diagnostic functions. Normally, it is not necessary to manually manipulate the elements of this struct.
timeout
Specifies the time to wait for the arrival of a message. If no message arrives within this time, a timeout error is returned. Output
dataOut
Returns an array of up to 8Â bytes of payload data from a CAN frame, or up to 64Â bytes of payload data from a CAN FD frame, received as CAN payload on the diagnostic identifier.
len
On input, len must contain the number of bytes provided for the dataOut buffer. On output, it returns the number of valid data bytes in dataOut.
Return Value
The return value indicates the function call status as a signed 32-bit integer. Zero means the function executed successfully. A negative value specifies an error, which means the function did not perform the expected behavior. A positive value specifies a warning, which means the function performed as expected, but a condition arose that may require attention.
Use the ndStatusToString function to obtain a descriptive string for the return value.
DescriptionndDiagFrameRecv receives an arbitrary raw CAN frame on the diagnostic CAN identifier. For example, you can check the transport protocol implementation of an ECU for correct responses if erroneous protocol requests are issued.