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.
Decoders/GPVTGdecoder.hpp@0:0c1aa5906cef, 2014-08-06 (annotated)
- Committer:
- chris215
- Date:
- Wed Aug 06 01:37:39 2014 +0000
- Revision:
- 0:0c1aa5906cef
- Child:
- 3:20f8faf2ad18
Renamed library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chris215 | 0:0c1aa5906cef | 1 | #include "mbed.h" |
chris215 | 0:0c1aa5906cef | 2 | #include "mbedGPSDefs.h" |
chris215 | 0:0c1aa5906cef | 3 | |
chris215 | 0:0c1aa5906cef | 4 | void DecodeGPVTG(char * tokenStr,GPSInfo& data) |
chris215 | 0:0c1aa5906cef | 5 | { |
chris215 | 0:0c1aa5906cef | 6 | int parameterCount = 0; |
chris215 | 0:0c1aa5906cef | 7 | char *rest; // to point to the rest of the string after token extraction. |
chris215 | 0:0c1aa5906cef | 8 | char *token; // to point to the actual token returned. |
chris215 | 0:0c1aa5906cef | 9 | char *ptr = tokenStr; // make q point to start of hello. |
chris215 | 0:0c1aa5906cef | 10 | token = strtok_r(ptr, ",",&rest); |
chris215 | 0:0c1aa5906cef | 11 | while (token != NULL) |
chris215 | 0:0c1aa5906cef | 12 | { |
chris215 | 0:0c1aa5906cef | 13 | if(parameterCount == 1) |
chris215 | 0:0c1aa5906cef | 14 | data.TrueTrack = atof(token); |
chris215 | 0:0c1aa5906cef | 15 | |
chris215 | 0:0c1aa5906cef | 16 | if(parameterCount == 3) |
chris215 | 0:0c1aa5906cef | 17 | data.MagneticTrack = atof(token); |
chris215 | 0:0c1aa5906cef | 18 | |
chris215 | 0:0c1aa5906cef | 19 | if(parameterCount == 5) |
chris215 | 0:0c1aa5906cef | 20 | data.GroundSpeedN = atof(token); |
chris215 | 0:0c1aa5906cef | 21 | |
chris215 | 0:0c1aa5906cef | 22 | if(parameterCount == 7) |
chris215 | 0:0c1aa5906cef | 23 | data.GroundSpeedK = atof(token); |
chris215 | 0:0c1aa5906cef | 24 | |
chris215 | 0:0c1aa5906cef | 25 | parameterCount++; |
chris215 | 0:0c1aa5906cef | 26 | ptr = rest; // rest contains the left over part..assign it to ptr. |
chris215 | 0:0c1aa5906cef | 27 | token = strtok_r(ptr, ",",&rest); |
chris215 | 0:0c1aa5906cef | 28 | } |
chris215 | 0:0c1aa5906cef | 29 | } |