DriveWorks SDK Reference
4.0.0 Release
For Test and Development only

src/dw/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 The `dwSensorGPS_processRawData()` and `dwSensorGPS_popFrame()` functions
6 can be used to parse raw sensor data and read the measurements in the
7 `::dwGPSFrame` format. `dwSensorGPS_processRawData()` copies parsed data,
8 therefore the raw data can be returned after the call.
9 
10 #### Example
11 
12 The following code shows the general structure of a program reading raw
13 data from a sensor, serializing it and parsing it.
14 ```{.cpp}
15 dwSensorHandle_t gpsSensor;
16 dwSAL_createSensor(&gpsSensor, ..., ...);
17 
18 dwSensor_start(gpsSensor);
19 
20 const uint8_t *data = nullptr;
21 size_t size = 0;
22 
23 while(loop)
24 {
25  dwStatus status = DW_NOT_READY;
26 
27  while (status == DW_NOT_READY)
28  {
29  dwSensor_readRawData(&data, &size, 1000000, gpsSensor);
30 
31  status = dwSensorGPS_processRawData(data, size, gpsSensor);
32 
33  dwSensorSerializer_serializeDataAsync(data, size, ...);
34 
35  dwSensor_returnRawData(data, gpsSensor);
36  }
37 
38  dwGPSFrame frame{};
39  dwSensorGPS_popFrame(&frame, gpsSensor);
40 
41  ...
42 }
43 
44 dwSensor_stop(gpsSensor);
45 dwSAL_releaseSensor(&gpsSensor);
46 ```
47 For more details see @ref dwx_record_sample