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

Committer:
chris215
Date:
2016-02-16
Revision:
5:8a73e34b3978
Parent:
3:20f8faf2ad18

File content as of revision 5:8a73e34b3978:

#include "mbed.h"
#include "mbedGPSDefs.h"
#include "DecodersUtils.h"

void DecodeGPGSA(char * tokenStr,GPSInfo& data)
{
    int parameterCount = 0;
    char *rest; // to point to the rest of the string after token extraction.
    char *token; // to point to the actual token returned.
    char *ptr = tokenStr; // make q point to start of hello.
    //token = strtok_r(ptr, ",",&rest);
    token = strtok_single(ptr, ",");
    while (token != NULL)
    {
        //Debuging.printf("DEBUG ... PARAM_CNT:%d\n",parameterCount);
        if(parameterCount == 1)
            data.mode = *token;
            
        if(parameterCount == 2){
            data.fix = atoi(token);
        }
            
        if(parameterCount == (3 + data.TrackedSatCnt)){
            data.PDOP = atof(token);
            //Debuging.printf("DEBUG ... PDOP:%f\n",data.PDOP);
        }   
        if(parameterCount == (3 + data.TrackedSatCnt + 1)){
            data.HDOP = atof(token);
            //printf("DEBUG ... HDOP:%f\n",data.HDOP);
        }
        if(parameterCount == (3 + data.TrackedSatCnt + 2)){
            data.VDOP = atof(token);
            //printf("DEBUG ... VDOP:%f\n",data.VDOP);
        }
        parameterCount++;
        ptr = rest; // rest contains the left over part..assign it to ptr.
        //token = strtok_r(ptr, ",",&rest);
        token = strtok_single(NULL, ",");
    }
}