The dwSensorGPS_readFrame()
function reads the next available GPS data frame with a given timeout. The function call is blocking, until a GPS frame is available or the timeout is exceeded. Frames read from the sensor do not have to be returned because the messages are copied.
Depending on the particular GPS sensor capabilities, a GPS frame can be only partially filled with data. The dwGPSFlags
are used to indicate which fields in dwGPSFrame
are valid.
Example
The following code shows the general structure of a program reading data from a GPS sensor.
params.
parameters =
"device=/dev/<serial device>,baud=<baudrate>";
while(loop)
{
...
}
A GPS packet containing localization information.
DW_API_PUBLIC dwStatus dwSensorGPS_readFrame(dwGPSFrame *const frame, dwTime_t const timeoutUs, dwSensorHandle_t const sensor)
Reads the next available GPS data frame with a given timeout.
const char8_t * parameters
Array of additional parameters provided to sensor creation.
const char8_t * protocol
Name of the protocol.
DW_API_PUBLIC dwStatus dwSAL_createSensor(dwSensorHandle_t *const sensor, dwSensorParams const params, dwSALHandle_t const sal)
Creates a new sensor managed by the SAL module with the given parameters.
DW_API_PUBLIC dwStatus dwSensor_start(dwSensorHandle_t const sensor)
Starts the sensor previously successfully created with 'dwSAL_createSensor()'.
DW_API_PUBLIC dwStatus dwSensor_stop(dwSensorHandle_t const sensor)
Stops the sensor.
DW_API_PUBLIC dwStatus dwSAL_releaseSensor(dwSensorHandle_t const sensor)
Releases a sensor managed by the SAL module.
struct dwSensorObject * dwSensorHandle_t
Handle representing a sensor.
Holds sets of parameters for sensor creation.
For more details see GPS Location Logger Sample