DriveWorks SDK Reference
3.0.4260 Release
For Test and Development only

sensors/gps/docs/usecase2.md
Go to the documentation of this file.
1 # Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
2 
3 @page gps_usecase2 Reading GPS data from raw (binary) data.
4 
5 @note SW Release Applicability: This tutorial is applicable to modules in both **NVIDIA DriveWorks** and **NVIDIA DRIVE Software** releases.
6 
7 The `dwSensorGPS_processRawData()` and `dwSensorGPS_popFrame()` functions
8 can be used to parse raw sensor data and read the measurements in the
9 `::dwGPSFrame` format. `dwSensorGPS_processRawData()` copies parsed data,
10 therefore the raw data can be returned after the call.
11 
12 #### Example
13 
14 The following code shows the general structure of a program reading raw
15 data from a sensor, serializing it and parsing it.
16 ```{.cpp}
17 dwSensorHandle_t gpsSensor;
18 dwSAL_createSensor(&gpsSensor, ..., ...);
19 
20 dwSensor_start(gpsSensor);
21 
22 const uint8_t *data = nullptr;
23 size_t size = 0;
24 
25 while(loop)
26 {
27  dwStatus status = DW_NOT_READY;
28 
29  while (status == DW_NOT_READY)
30  {
31  dwSensor_readRawData(&data, &size, 1000000, gpsSensor);
32 
33  status = dwSensorGPS_processRawData(data, size, gpsSensor);
34 
35  dwSensorSerializer_serializeDataAsync(data, size, ...);
36 
37  dwSensor_returnRawData(data, gpsSensor);
38  }
39 
40  dwGPSFrame frame{};
41  dwSensorGPS_popFrame(&frame, gpsSensor);
42 
43  ...
44 }
45 
46 dwSensor_stop(gpsSensor);
47 dwSAL_releaseSensor(&gpsSensor);
48 ```
49 For more details see @ref dwx_record_sample