Ejemplo n.º 1
0
/**
 * Parse a "$D" sentence.
 *
 * Example: "$D,+0,100554,+25,18,+31,,0,-356,+25,+11,115,96*6A"
 */
static bool
LeonardoParseD(NMEAInputLine &line, NMEA_INFO &info)
{
    fixed value;

    // 0 = vario [dm/s]
    if (line.read_checked(value))
        info.ProvideTotalEnergyVario(value / 10);

    // 1 = air pressure [Pa]
    if (line.skip() == 0)
        /* short "$C" sentence ends after airspeed */
        return true;

    // 2 = netto vario [dm/s]
    if (line.read_checked(value))
        info.ProvideNettoVario(value / 10);

    // 3 = airspeed [km/h]
    /* XXX is that TAS or IAS? */
    if (line.read_checked(value))
        info.ProvideTrueAirspeed(Units::ToSysUnit(value, unKiloMeterPerHour));

    // 4 = temperature [deg C]
    fixed oat;
    info.TemperatureAvailable = line.read_checked(oat);
    if (info.TemperatureAvailable)
        info.OutsideAirTemperature = Units::ToSysUnit(oat, unGradCelcius);

    // 5 = compass [degrees]
    /* XXX unsupported by XCSoar */

    // 6 = optimal speed [km/h]
    /* XXX unsupported by XCSoar */

    // 7 = equivalent MacCready [cm/s]
    /* XXX unsupported by XCSoar */

    // 8 = wind speed [km/h]
    /* not used here, the "$C" record repeats it together with the
       direction */

    return true;
}
Ejemplo n.º 2
0
/**
 * Parse a "$C" sentence.
 *
 * Example: "$C,+2025,-7,+18,+25,+29,122,314,314,0,-356,+25,45,T*3D"
 */
static bool
LeonardoParseC(NMEAInputLine &line, NMEA_INFO &info)
{
    fixed value;

    // 0 = altitude [m]
    if (line.read_checked(value))
        info.ProvideBaroAltitudeTrue(value);

    // 1 = vario [dm/s]
    if (line.read_checked(value))
        info.ProvideTotalEnergyVario(value / 10);

    // 2 = airspeed [km/h]
    /* XXX is that TAS or IAS? */
    if (line.read_checked(value))
        info.ProvideTrueAirspeed(Units::ToSysUnit(value, unKiloMeterPerHour));

    // 3 = netto vario [dm/s]
    if (line.read_checked(value))
        info.ProvideNettoVario(value / 10);
    else
        /* short "$C" sentence ends after airspeed */
        return true;

    // 4 = temperature [deg C]
    fixed oat;
    info.TemperatureAvailable = line.read_checked(oat);
    if (info.TemperatureAvailable)
        info.OutsideAirTemperature = Units::ToSysUnit(oat, unGradCelcius);

    // 10 = wind speed [km/h]
    // 11 = wind direction [degrees]
    SpeedVector wind;
    if (ReadSpeedVector(line, wind))
        info.ProvideExternalWind(wind);

    return true;
}
Ejemplo n.º 3
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;
}