1 # Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
3 @page canbus_usecase2 Reading CAN Messages from Raw Data (Binary)
5 @note SW Release Applicability: This tutorial is applicable to modules in both **NVIDIA DriveWorks** and **NVIDIA DRIVE Software** releases.
7 The `dwSensorCAN_processRawData()` and `dwSensorCAN_popMessage()` functions
8 can be used to parse raw can bus data and read the messages in the
11 For details on the CAN sensor module workflow, see @ref canbus_usecase1.
15 The following code shows the general structure of a program reading raw
16 data from the can bus, serializing it and parsing it.
19 dwSensorHandle_t canSensor;
20 dwSAL_createSensor(&canSensor, ..., ...);
22 dwSensor_start(canSensor);
24 const uint8_t *data = nullptr;
29 dwStatus status = DW_NOT_READY;
31 while (status == DW_NOT_READY)
33 dwSensor_readRawData(&data, &size, 1000000, canSensor);
35 status = dwSensorCAN_processRawData(data, size, canSensor);
37 dwSensorSerializer_serializeDataAsync(data, size, ...);
39 dwSensor_returnRawData(data, canSensor);
42 dwCANMessage message{};
43 dwSensorCAN_popMessage(&frame, canSensor);
48 dwSensor_stop(canSensor);
49 dwSAL_releaseSensor(&canSensor);
52 For more details see @ref dwx_record_sample