bool OpenVarioDevice::POV(NMEAInputLine &line, NMEAInfo &info) { /* * Type definitions: * * E: TE vario in m/s * P: static pressure in hPa * Q: dynamic pressure in Pa * R: total pressure in hPa * S: true airspeed in km/h * T: temperature in deg C */ while (!line.IsEmpty()) { char type = line.ReadOneChar(); if (type == '\0') break; fixed value; if (!line.ReadChecked(value)) break; switch (type) { case 'E': { info.ProvideTotalEnergyVario(value); break; } case 'P': { AtmosphericPressure pressure = AtmosphericPressure::HectoPascal(value); info.ProvideStaticPressure(pressure); break; } case 'Q': { AtmosphericPressure pressure = AtmosphericPressure::Pascal(value); info.ProvideDynamicPressure(pressure); break; } case 'R': { AtmosphericPressure pressure = AtmosphericPressure::HectoPascal(value); info.ProvidePitotPressure(pressure); break; } case 'S': { value = Units::ToSysUnit(value, Unit::KILOMETER_PER_HOUR); info.ProvideTrueAirspeed(value); break; } case 'T': { info.temperature = CelsiusToKelvin(value); info.temperature_available = true; break; } } } return true; }
/** * Parses unsigned floating-point deviation angle value in degrees. * and applies deviation sign from following E/W char */ static bool ReadVariation(NMEAInputLine &line, Angle &value_r) { fixed value; if (!line.ReadChecked(value)) return false; char ch = line.ReadOneChar(); if (ch == 'W') value = -value; else if (ch != 'E') return false; value_r = Angle::Degrees(value); return true; }
static bool ReadLongitude(NMEAInputLine &line, Angle &value_r) { Angle value; if (!ReadGeoAngle(line, value)) return false; char ch = line.ReadOneChar(); if (ch == 'W') value.Flip(); else if (ch != 'E') return false; value_r = value; return true; }