Mbed library to handle GPS data reception and parsing
Dependents: GPS_U-blox_NEO-6M_Code
Features
- All positionning parameters are contained into a global data structure.
- Automatic nema string parsing and data structure update.
- GSA,GGA,VTG and RMC
- Convert latitude and longitude to decimal value.
- Converts latittude,longitude and altitude to ECEF coordinates.
Planed developement
- Test library for RTOS use.
- Complete the nema parsing decoders (couple of parameters are not parsed yet and not present in the data structure).
- Add conversion tool to get ENU coordinates.
Diff: utils/GPSUtils.hpp
- Revision:
- 2:72ac4d7044a7
- Parent:
- 1:fade122a76a8
- Child:
- 3:20f8faf2ad18
diff -r fade122a76a8 -r 72ac4d7044a7 utils/GPSUtils.hpp --- a/utils/GPSUtils.hpp Mon Apr 06 17:41:43 2015 +0000 +++ b/utils/GPSUtils.hpp Sun Feb 14 05:55:38 2016 +0000 @@ -15,11 +15,41 @@ //298.257223563 #define WGS84_E 0.081819190842621 - /* Source of information about nema sentences : http://www.gpsinformation.org/dale/nmea.htm */ +int CheckForHeader(char* DataToCheck, char* RefData,int datasize); +int IdentifyGPSMessage(message& GPSMessageToIdentify) +{ + if(CheckForHeader(GPSMessageToIdentify.data,GPS_CMD_GPGGA,6)) + { + return GPS_GPGGAR; + } + else if(CheckForHeader(GPSMessageToIdentify.data,GPS_CMD_GPVTG,6)) + { + return GPS_GPVTGR; + } + else if(CheckForHeader(GPSMessageToIdentify.data,GPS_CMD_GPGSA,6)) + { + return GPS_GPGSAR; + } + else if(CheckForHeader(GPSMessageToIdentify.data,GPS_CMD_GPRMC,6)) + { + return GPS_GPRMCR; + } + return 0; +} + +int CheckForHeader(char* DataToCheck, char* RefData,int datasize) +{ + int NumberOfMatchingElements = memcmp(DataToCheck,RefData,datasize); + + if(NumberOfMatchingElements==0) + return 1; + return 0; +} + void DecodeMessage(message& msg,GPSInfo& data) {