bool NMEAParser::ParseLine(const char *string, NMEAInfo &info) { assert(positive(info.clock)); if (string[0] != '$') return false; if (!NMEAChecksum(string)) return false; NMEAInputLine line(string); char type[16]; line.Read(type, 16); if (IsAlphaASCII(type[1]) && IsAlphaASCII(type[2])) { if (StringIsEqual(type + 3, "GSA")) return GSA(line, info); if (StringIsEqual(type + 3, "GLL")) return GLL(line, info); if (StringIsEqual(type + 3, "RMC")) return RMC(line, info); if (StringIsEqual(type + 3, "GGA")) return GGA(line, info); if (StringIsEqual(type + 3, "HDM")) return HDM(line, info); } // if (proprietary sentence) ... if (type[1] == 'P') { // Airspeed and vario sentence if (StringIsEqual(type + 1, "PTAS1")) return PTAS1(line, info); // FLARM sentences if (StringIsEqual(type + 1, "PFLAE")) { ParsePFLAE(line, info.flarm.error, info.clock); return true; } if (StringIsEqual(type + 1, "PFLAV")) { ParsePFLAV(line, info.flarm.version, info.clock); return true; } if (StringIsEqual(type + 1, "PFLAA")) { ParsePFLAA(line, info.flarm.traffic, info.clock); return true; } if (StringIsEqual(type + 1, "PFLAU")) { ParsePFLAU(line, info.flarm.status, info.clock); return true; } // Garmin altitude sentence if (StringIsEqual(type + 1, "PGRMZ")) return RMZ(line, info); return false; } return false; }
BOOL NMEAParser::ParseNMEAString_Internal(TCHAR *String, NMEA_INFO *pGPS) { TCHAR ctemp[MAX_NMEA_LEN]; TCHAR *params[MAX_NMEA_PARAMS]; size_t n_params; n_params = ValidateAndExtract(String, ctemp, MAX_NMEA_LEN, params, MAX_NMEA_PARAMS); if (n_params < 1 || params[0][0] != '$') return FALSE; // if (EnableLogNMEA) 091108 removed LogNMEA and place in calling function // LogNMEA(String); if(params[0][1] == 'P') { //Proprietary String #ifdef DSX if(_tcscmp(params[0] + 1,TEXT("PDSXT"))==0) { return PDSXT(&String[7], params + 1, n_params, pGPS); } #endif if(_tcscmp(params[0] + 1,TEXT("PTAS1"))==0) { return PTAS1(&String[7], params + 1, n_params, pGPS); } // FLARM sentences if(_tcscmp(params[0] + 1,TEXT("PFLAA"))==0) { return PFLAA(&String[7], params + 1, n_params, pGPS); } if(_tcscmp(params[0] + 1,TEXT("PFLAU"))==0) { return PFLAU(&String[7], params + 1, n_params, pGPS); } if(_tcscmp(params[0] + 1,TEXT("PGRMZ"))==0) { return RMZ(&String[7], params + 1, n_params, pGPS); } if(_tcscmp(params[0] + 1,TEXT("PLKAS"))==0) { return PLKAS(&String[7], params + 1, n_params, pGPS); } return FALSE; } if(_tcscmp(params[0] + 3,TEXT("GSA"))==0) { return GSA(&String[7], params + 1, n_params, pGPS); } if(_tcscmp(params[0] + 3,TEXT("GLL"))==0) { // return GLL(&String[7], params + 1, n_params, pGPS); return FALSE; } if(_tcscmp(params[0] + 3,TEXT("RMB"))==0) { //return RMB(&String[7], params + 1, n_params, pGPS); return FALSE; } if(_tcscmp(params[0] + 3,TEXT("RMC"))==0) { return RMC(&String[7], params + 1, n_params, pGPS); } if(_tcscmp(params[0] + 3,TEXT("GGA"))==0) { return GGA(&String[7], params + 1, n_params, pGPS); } if(_tcscmp(params[0] + 3,TEXT("VTG"))==0) { return VTG(&String[7], params + 1, n_params, pGPS); } return FALSE; }