コード例 #1
0
bool
EWMicroRecorderDevice::ParseNMEA(const char *String, NMEA_INFO &info)
{
  if (!VerifyNMEAChecksum(String))
    return false;

  NMEAInputLine line(String);
  char type[16];
  line.read(type, 16);

  if (strcmp(type, "$PGRMZ") == 0) {
    fixed value;

    /* The normal Garmin $PGRMZ line contains the "true" barometric
       altitude above MSL (corrected with QNH), but EWMicroRecorder
       differs here slightly: it emits the uncorrected barometric
       altitude.  That is the only reason why we catch this sentence
       in the driver instead of letting the generic class NMEAParser
       do it. */
    if (ReadAltitude(line, value))
      info.ProvidePressureAltitude(value);

    return true;
  } else
    return false;
}
コード例 #2
0
/**
 * Parse a "$FLYSEN" sentence.
 *
 * @see http://www.flytec.ch/public/Special%20NMEA%20sentence.pdf
 */
static bool
FlytecParseFLYSEN(NMEAInputLine &line, NMEA_INFO &info)
{
  fixed value;

  //  Time(hhmmss),   6 Digits
  line.skip();

  //  Latitude(ddmm.mmm),   8 Digits incl. decimal
  //  N (or S),   1 Digit
  line.skip(2);

  //  Longitude(dddmm.mmm),   9 Digits inc. decimal
  //  E (or W),   1 Digit
  line.skip(2);

  //  Track (xxx Deg),   3 Digits
  //  Speed over Ground (xxxxx cm/s)        5 Digits
  //  GPS altitude (xxxxx meter),           5 Digits
  line.skip(3);

  //  Validity of 3 D fix A or V,           1 Digit
  char validity = line.read_first_char();
  if (validity != 'A' && validity != 'V') {
    validity = line.read_first_char();
    if (validity != 'A' && validity != 'V')
      return false;
  }

  //  Satellites in Use (0 to 12),          2 Digits
  line.skip();

  //  Raw pressure (xxxxxx Pa),  6 Digits
  if (line.read_checked(value))
    info.ProvideStaticPressure(value / 100);

  //  Baro Altitude (xxxxx meter),          5 Digits (-xxxx to xxxxx) (Based on 1013.25hPa)
  if (line.read_checked(value))
    info.ProvidePressureAltitude(value);

  //  Variometer (xxxx cm/s),   4 or 5 Digits (-9999 to 9999)
  if (line.read_checked(value))
    info.ProvideTotalEnergyVario(value / 100);

  //  true airspeed (xxxxx cm/s),           5 Digits (0 to 99999cm/s = 3600km/h)
  if (line.read_checked(value))
    info.ProvideTrueAirspeed(value / 100);

  //  Airspeed source P or V,   1 Digit P= pitot, V = Vane wheel
  //  Temp. PCB (xxx °C),   3 Digits
  //  Temp. Balloon Envelope (xxx °C),      3 Digits
  //  Battery Capacity Bank 1 (0 to 100%)   3 Digits
  //  Battery Capacity Bank 2 (0 to 100%)   3 Digits
  //  Dist. to WP (xxxxxx m),   6 Digits (Max 200000m)
  //  Bearing (xxx Deg),   3 Digits
  //  Speed to fly1 (MC0 xxxxx cm/s),       5 Digits
  //  Speed to fly2 (McC. xxxxx cm/s)       5 Digits
  //  Keypress Code (Experimental empty to 99)     2 Digits

  return true;
}