How to add GPS / location in Zephyr?


jantore.guggedal@...
 

Hi,
 
I'm working on a project in Zephyr that will use GPS to get the location of a device. 
Until now the GPS data has been fethed using serial drivers directly, but we're looking into the possibility of using the sensor API to interface with the GPS and make it appear like a "normal" sensor in Zephyr. 
And this is where we run into some issues:
 
The sensor_value data type in the sensor API is for numbers with an integer and a fractional part. A typical GPS sensor provides NMEA strings of various types, and for us it would be useful for the application to receive these strings unparsed.
In many cases it would be fine to get parsed longitude, latitude, altitude and other values using respective channels in the sensor API, but the option to receive the raw data string would still be preferable in our case as we intend to forward it unparsed.
A fair number of channels (~20) would have to be added to the API to be able to get the most detailed data from the GPS sensor that is available in the NMEA strings, but that's perhaps not a problem? 
For the most essential GPS information (latitude, longitude, altitude, speed, heading, time), fewer channels are needed.
We could parse the strings in GPS driver, send the strings over a sensor channel, and then in the application put the data back into a string equal to the original one, but it would be good to not need to do this unncessary processing.
 
  • If using the sensor API, can we get strings from a sensor channel by somehow expanding the current sensor_value data type without breaking existing code? Just adding extra fields to the struct is maybe not a preferable solution?
  • Do you think that GPS fits within the sensor API, or should we look in another direction?
 
We appreciate all feedback on how to approach the task of integrating GPS/location into Zephyr. 
 
Best regards
Jan Tore Guggedal
 

Join devel@lists.zephyrproject.org to automatically receive all group messages.