DriveWorks SDK Reference
4.0.0 Release
For Test and Development only

Reading CAN Messages from Raw Data (Binary)

The dwSensorCAN_processRawData() and dwSensorCAN_popMessage() functions can be used to parse raw can bus data and read the messages in the dwCANMessage format.

For details on the CAN sensor module workflow, see Receiving and Sending Data.


The following code shows the general structure of a program reading raw data from the can bus, serializing it and parsing it.

dwSensorHandle_t canSensor;
dwSAL_createSensor(&canSensor, ..., ...);
const uint8_t *data = nullptr;
size_t size = 0;
dwStatus status = DW_NOT_READY;
while (status == DW_NOT_READY)
dwSensor_readRawData(&data, &size, 1000000, canSensor);
status = dwSensorCAN_processRawData(data, size, canSensor);
dwSensor_returnRawData(data, canSensor);
dwCANMessage message{};
dwSensorCAN_popMessage(&frame, canSensor);

For more details see Simple Sensor Recording Sample