bool ubloxNMEA::parsePUBX_00( char chr ) { bool ok = true; switch (fieldIndex) { case 1: // The first field is actually a message subtype if (chrCount == 0) ok = (chr == '0'); else if (chrCount == 1) { switch (chr) { #if defined(NMEAGPS_PARSE_PUBX_00) | defined(NMEAGPS_RECOGNIZE_ALL) case '0': break; #endif #if defined(NMEAGPS_PARSE_PUBX_04) | defined(NMEAGPS_RECOGNIZE_ALL) case '4': nmeaMessage = (nmea_msg_t) PUBX_04; break; #endif default : ok = false; } } else // chrCount > 1 ok = (chr == ','); break; #ifdef NMEAGPS_PARSE_PUBX_00 case 2: return parseTime( chr ); PARSE_LOC(3); case 7: return parseAlt( chr ); case 8: return parseFix( chr ); case 11: return parseSpeed( chr ); // kph! case 12: return parseHeading( chr ); case 15: return parseHDOP( chr ); case 16: return parseVDOP( chr ); case 18: return parseSatellites( chr ); #endif } return ok; } // parsePUBX_00
bool ubloxNMEA::parsePUBX_00( char chr ) { bool ok = true; switch (fieldIndex) { case 1: // The first field is actually a message subtype if (chrCount == 0) ok = (chr == '0'); else if (chrCount == 1) { switch (chr) { #if defined(NMEAGPS_PARSE_PUBX_00) | defined(NMEAGPS_RECOGNIZE_ALL) case '0': break; #endif #if defined(NMEAGPS_PARSE_PUBX_04) | defined(NMEAGPS_RECOGNIZE_ALL) case '4': nmeaMessage = (nmea_msg_t) PUBX_04; break; #endif default : ok = false; } } else // chrCount > 1 ok = (chr == ','); break; #ifdef NMEAGPS_PARSE_PUBX_00 case 2: return parseTime( chr ); PARSE_LOC(3); case 7: return parseAlt( chr ); case 8: return parseFix( chr ); case 9: // use Horizontal accuracy for both lat and lon errors #if defined(GPS_FIX_LAT_ERR) ok = parse_lat_err( chr ); #if defined(GPS_FIX_LON_ERR) // When the lat_err field is finished, // copy it to the lon_err field. if (chr == ',') { m_fix.valid.lon_err = m_fix.valid.lat_err; if (m_fix.valid.lon_err) m_fix.lon_err_cm = m_fix.lat_err_cm; } #endif #elif defined(GPS_FIX_LON_ERR) ok = parse_lon_err( chr ); #endif break; case 10: return parse_alt_err( chr ); // vertical accuracy case 11: #ifdef GPS_FIX_SPEED ok = parseSpeed( chr ); // PUBX,00 provides speed in km/h! if ((chr == ',') && m_fix.valid.speed) { uint32_t kph = m_fix.spd.int32_000(); uint32_t nmiph = (kph * 1000) / gps_fix::M_PER_NMI; m_fix.spd.whole = nmiph / 1000; m_fix.spd.frac = (nmiph - m_fix.spd.whole*1000); // Convert to Nautical Miles/Hour } #endif break; case 12: return parseHeading( chr ); case 13: return parseVelocityDown( chr ); case 15: return parseHDOP( chr ); case 16: return parseVDOP( chr ); case 18: return parseSatellites( chr ); #endif } return ok; } // parsePUBX_00