コード例 #1
0
/**
 * Parse a "$VMVABD" sentence.
 *
 * Example: "$VMVABD,0000.0,M,0547.0,M,-0.0,,,MS,0.0,KH,22.4,C*65"
 */
static bool
FlytecParseVMVABD(NMEAInputLine &line, NMEA_INFO &info)
{
  fixed value;

  // 0,1 = GPS altitude, unit
  if (line.read_checked_compare(info.GPSAltitude, "M"))
    info.GPSAltitudeAvailable.Update(info.clock);

  // 2,3 = baro altitude, unit
  if (line.read_checked_compare(value, "M"))
    info.ProvideBaroAltitudeTrue(value);

  // 4-7 = integrated vario, unit
  line.skip(4);

  // 8,9 = indicated or true airspeed, unit
  if (line.read_checked_compare(value, "KH"))
    // XXX is that TAS or IAS?  Documentation isn't clear.
    info.ProvideBothAirspeeds(Units::ToSysUnit(value, unKiloMeterPerHour));

  // 10,11 = temperature, unit
  info.TemperatureAvailable =
    line.read_checked_compare(value, "C");
  if (info.TemperatureAvailable)
    info.OutsideAirTemperature = Units::ToSysUnit(value, unGradCelcius);

  return true;
}
コード例 #2
0
ファイル: Leonardo.cpp プロジェクト: Mrdini/XCSoar
/**
 * 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;
}