Reading GPS Data From Raw (Binary) Data#
The dwSensorGPS_processRawData() and dwSensorGPS_popFrame() functions can be used to parse raw sensor data and read the measurements in
the dwGPSFrame format. dwSensorGPS_processRawData() copies parsed data, therefore the raw data can be returned after the call.
Example#
The following code shows the general structure of a program reading raw data from a sensor, serializing it and parsing it.
dwSensorHandle_t gpsSensor;
dwSAL_createSensor(&gpsSensor, ..., ...);
dwSensor_start(gpsSensor);
const uint8_t *data = nullptr;
size_t size = 0;
while(loop)
{
dwStatus status = DW_NOT_READY;
while (status == DW_NOT_READY)
{
dwSensor_readRawData(&data, &size, 1000000, gpsSensor);
status = dwSensorGPS_processRawData(data, size, gpsSensor);
dwSensorSerializer_serializeDataAsync(data, size, ...);
dwSensor_returnRawData(data, gpsSensor);
}
dwGPSFrame frame{};
dwSensorGPS_popFrame(&frame, gpsSensor);
...
}
dwSensor_stop(gpsSensor);
dwSAL_releaseSensor(&gpsSensor);