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/GPGSAdecoder.hpp@5:8a73e34b3978, 2016-02-16 (annotated)
- Committer:
- chris215
- Date:
- Tue Feb 16 02:57:35 2016 +0000
- Revision:
- 5:8a73e34b3978
- Parent:
- 3:20f8faf2ad18
Function renaming. Adding gps update calls.
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 | 3:20f8faf2ad18 | 3 | #include "DecodersUtils.h" |
chris215 | 0:0c1aa5906cef | 4 | |
chris215 | 0:0c1aa5906cef | 5 | void DecodeGPGSA(char * tokenStr,GPSInfo& data) |
chris215 | 0:0c1aa5906cef | 6 | { |
chris215 | 0:0c1aa5906cef | 7 | int parameterCount = 0; |
chris215 | 0:0c1aa5906cef | 8 | char *rest; // to point to the rest of the string after token extraction. |
chris215 | 0:0c1aa5906cef | 9 | char *token; // to point to the actual token returned. |
chris215 | 0:0c1aa5906cef | 10 | char *ptr = tokenStr; // make q point to start of hello. |
chris215 | 3:20f8faf2ad18 | 11 | //token = strtok_r(ptr, ",",&rest); |
chris215 | 3:20f8faf2ad18 | 12 | token = strtok_single(ptr, ","); |
chris215 | 0:0c1aa5906cef | 13 | while (token != NULL) |
chris215 | 0:0c1aa5906cef | 14 | { |
chris215 | 2:72ac4d7044a7 | 15 | //Debuging.printf("DEBUG ... PARAM_CNT:%d\n",parameterCount); |
chris215 | 0:0c1aa5906cef | 16 | if(parameterCount == 1) |
chris215 | 0:0c1aa5906cef | 17 | data.mode = *token; |
chris215 | 0:0c1aa5906cef | 18 | |
chris215 | 0:0c1aa5906cef | 19 | if(parameterCount == 2){ |
chris215 | 0:0c1aa5906cef | 20 | data.fix = atoi(token); |
chris215 | 0:0c1aa5906cef | 21 | } |
chris215 | 0:0c1aa5906cef | 22 | |
chris215 | 0:0c1aa5906cef | 23 | if(parameterCount == (3 + data.TrackedSatCnt)){ |
chris215 | 0:0c1aa5906cef | 24 | data.PDOP = atof(token); |
chris215 | 2:72ac4d7044a7 | 25 | //Debuging.printf("DEBUG ... PDOP:%f\n",data.PDOP); |
chris215 | 0:0c1aa5906cef | 26 | } |
chris215 | 0:0c1aa5906cef | 27 | if(parameterCount == (3 + data.TrackedSatCnt + 1)){ |
chris215 | 0:0c1aa5906cef | 28 | data.HDOP = atof(token); |
chris215 | 0:0c1aa5906cef | 29 | //printf("DEBUG ... HDOP:%f\n",data.HDOP); |
chris215 | 0:0c1aa5906cef | 30 | } |
chris215 | 0:0c1aa5906cef | 31 | if(parameterCount == (3 + data.TrackedSatCnt + 2)){ |
chris215 | 0:0c1aa5906cef | 32 | data.VDOP = atof(token); |
chris215 | 0:0c1aa5906cef | 33 | //printf("DEBUG ... VDOP:%f\n",data.VDOP); |
chris215 | 0:0c1aa5906cef | 34 | } |
chris215 | 0:0c1aa5906cef | 35 | parameterCount++; |
chris215 | 0:0c1aa5906cef | 36 | ptr = rest; // rest contains the left over part..assign it to ptr. |
chris215 | 3:20f8faf2ad18 | 37 | //token = strtok_r(ptr, ",",&rest); |
chris215 | 3:20f8faf2ad18 | 38 | token = strtok_single(NULL, ","); |
chris215 | 0:0c1aa5906cef | 39 | } |
chris215 | 0:0c1aa5906cef | 40 | } |