DriveWorks SDK Reference
4.0.0 Release
For Test and Development only

src/dw/sensors/gps/docs/usecase1.md
Go to the documentation of this file.
1 # Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
2 
3 @page gps_usecase1 Reading GPS data from sensor
4 
5 The `dwSensorGPS_readFrame()` function reads the next available GPS data
6 frame with a given timeout. The function call is blocking, until a GPS
7 frame is available or the timeout is exceeded. Frames read from the sensor
8 do not have to be returned because the messages are copied.
9 
10 Depending on the particular GPS sensor capabilities, a GPS frame can be
11 only partially filled with data. The `::dwGPSFlags` are used to indicate
12 which fields in `dwGPSFrame` are valid.
13 
14 #### Example
15 
16 The following code shows the general structure of a program reading data
17 from a GPS sensor.
18 ```{.cpp}
19 dwSensorParams params;
20 params.protocol = "gps.uart";
21 params.parameters = "device=/dev/<serial device>,baud=<baudrate>";
22 
23 dwSensorHandle_t gpsSensor;
24 dwSAL_createSensor(&gpsSensor, params, ...);
25 
26 dwSensor_start(gpsSensor);
27 
28 while(loop)
29 {
30  dwGPSFrame frame;
31  dwSensorGPS_readFrame(&frame, 50000, gpsSensor);
32  ...
33 }
34 
35 dwSensor_stop(gpsSensor);
36 dwSAL_releaseSensor(&gpsSensor);
37 ```
38 For more details see @ref dwx_gps_loc_sample