本文整理汇总了C++中NMEAInfo::ProvideStaticPressure方法的典型用法代码示例。如果您正苦于以下问题:C++ NMEAInfo::ProvideStaticPressure方法的具体用法?C++ NMEAInfo::ProvideStaticPressure怎么用?C++ NMEAInfo::ProvideStaticPressure使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NMEAInfo
的用法示例。
在下文中一共展示了NMEAInfo::ProvideStaticPressure方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
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;
}
示例2: CelsiusToKelvin
/**
* Parse a "$D" sentence.
*
* Example: "$D,+0,100554,+25,18,+31,,0,-356,+25,+11,115,96*6A"
*/
static bool
LeonardoParseD(NMEAInputLine &line, NMEAInfo &info)
{
double value;
// 0 = vario [dm/s]
if (line.ReadChecked(value))
info.ProvideTotalEnergyVario(value / 10);
if (line.Rest().empty())
/* short "$D" sentence ends after vario */
return true;
// 1 = air pressure [Pa]
if (line.ReadChecked(value))
info.ProvideStaticPressure(AtmosphericPressure::Pascal(value));
// 2 = netto vario [dm/s]
if (line.ReadChecked(value))
info.ProvideNettoVario(value / 10);
// 3 = airspeed [km/h]
/* XXX is that TAS or IAS? */
if (line.ReadChecked(value))
info.ProvideTrueAirspeed(Units::ToSysUnit(value, Unit::KILOMETER_PER_HOUR));
// 4 = temperature [deg C]
double oat;
info.temperature_available = line.ReadChecked(oat);
if (info.temperature_available)
info.temperature = CelsiusToKelvin(oat);
// 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;
}
示例3: strtol
bool
BlueFlyDevice::ParsePRS(const char *content, NMEAInfo &info)
{
// e.g. PRS 17CBA
char *endptr;
long value = strtol(content, &endptr, 16);
if (endptr != content) {
AtmosphericPressure pressure = AtmosphericPressure::Pascal(fixed(value));
kalman_filter.Update(pressure.GetHectoPascal(), fixed(0.25), fixed(0.02));
info.ProvideNoncompVario(ComputeNoncompVario(kalman_filter.GetXAbs(),
kalman_filter.GetXVel()));
info.ProvideStaticPressure(AtmosphericPressure::HectoPascal(kalman_filter.GetXAbs()));
}
return true;
}
示例4: fixed
static bool
LK8EX1(NMEAInputLine &line, NMEAInfo &info)
{
unsigned pressure;
bool pressure_available = (line.ReadChecked(pressure) && pressure != 999999);
if (pressure_available)
info.ProvideStaticPressure(AtmosphericPressure::Pascal(fixed(pressure)));
unsigned altitude;
bool altitude_available = (line.ReadChecked(altitude) && altitude != 99999);
if (altitude_available && !pressure_available)
info.ProvidePressureAltitude(fixed(altitude));
int vario;
if (line.ReadChecked(vario) && vario != 9999)
info.ProvideNoncompVario(fixed(vario) / 100);
int temperature;
if (line.ReadChecked(temperature) && temperature != 99) {
info.temperature = fixed(temperature);
info.temperature_available = true;
}
fixed battery_value;
if (line.ReadChecked(battery_value) &&
(unsigned)(battery_value + fixed(0.5)) != 999) {
if (battery_value > fixed(1000)) {
info.battery_level = battery_value - fixed(1000);
info.battery_level_available.Update(info.clock);
} else {
info.voltage = battery_value;
info.voltage_available.Update(info.clock);
}
}
return true;
}
示例5:
static bool
VARIO(NMEAInputLine &line, NMEAInfo &info)
{
// $VARIO,fPressure,fVario,Bat1Volts,Bat2Volts,BatBank,TempSensor1,TempSensor2*CS
// fVario = the variometer in decimeters per second
// Bat1Volts = the voltage of the battery in bank 1
// Bat2Volts = the voltage of the battery in bank 2
// BatBank = the battery bank in use.
// TempSensor1 = temperature in ºC of external wireless sensor 1
// TempSensor2 = temperature in ºC of external wireless sensor 2
fixed value;
if (line.read_checked(value))
info.ProvideStaticPressure(AtmosphericPressure::HectoPascal(value));
if (line.read_checked(value))
info.ProvideTotalEnergyVario(value / 10);
unsigned battery_bank;
fixed voltage[2];
if (line.read_checked(voltage[0]) &&
line.read_checked(voltage[1]) &&
line.read_checked(battery_bank) &&
battery_bank != 0 &&
battery_bank <= 2) {
info.voltage = voltage[battery_bank - 1];
info.voltage_available.Update(info.clock);
}
if (line.read_checked(value)) {
info.temperature = Units::ToSysUnit(value, unGradCelcius);
info.temperature_available = true;
}
return true;
}
示例6: strtol
bool
FlyNetDevice::ParsePRS(const char *content, NMEAInfo &info)
{
// e.g. _PRS 00017CBA
// The frequency at which the device sends _PRS sentences
static constexpr double frequency = 1 / 0.048;
char *endptr;
long value = strtol(content, &endptr, 16);
if (endptr != content) {
auto pressure = AtmosphericPressure::Pascal(value);
if (info.static_pressure_available) {
// Calculate non-compensated vario value
auto last_pressure = info.static_pressure;
auto alt = AtmosphericPressure::StaticPressureToPressureAltitude(pressure);
auto last_alt = AtmosphericPressure::StaticPressureToPressureAltitude(last_pressure);
auto vario = (alt - last_alt) * frequency;
vario_filter.Update(vario);
auto vario_filtered = vario_filter.Average();
info.ProvideNoncompVario(vario_filtered);
} else {
// Reset filter when the first new pressure sentence is received
vario_filter.Reset();
}
info.ProvideStaticPressure(pressure);
}
return true;
}
示例7: line_copy
/**
* Parse a "$FLYSEN" sentence.
*
* @see http://www.flytec.ch/public/Special%20NMEA%20sentence.pdf
*/
bool
FlytecDevice::ParseFLYSEN(NMEAInputLine &line, NMEAInfo &info)
{
// Detect firmware/sentence version
//
// V or A in field 9 -> 3.31-
// V or A in field 10 -> 3.32+
NMEAInputLine line_copy(line);
line_copy.Skip(8);
bool has_date_field = false;
char validity = line_copy.ReadFirstChar();
if (validity != 'A' && validity != 'V') {
validity = line_copy.ReadFirstChar();
if (validity != 'A' && validity != 'V')
return false;
has_date_field = true;
}
// Date(ddmmyy), 6 Digits (only in firmware version 3.32+)
if (has_date_field)
NMEAParser::ReadDate(line, info.date_time_utc);
// Time(hhmmss), 6 Digits
fixed time;
if (NMEAParser::ReadTime(line, info.date_time_utc, time) &&
!NMEAParser::TimeHasAdvanced(time, last_time, info))
return true;
if (validity == 'V') {
// In case of V (void=not valid) GPS data should not be used.
// GPS altitude, position and speed should be ignored.
line.Skip(7);
} else {
// Latitude(ddmm.mmm), 8 Digits incl. decimal
// N (or S), 1 Digit
// Longitude(dddmm.mmm), 9 Digits inc. decimal
// E (or W), 1 Digit
GeoPoint location;
if (NMEAParser::ReadGeoPoint(line, location)) {
info.location = location;
info.location_available.Update(info.clock);
}
// Track (xxx Deg), 3 Digits
fixed track;
if (line.ReadChecked(track)) {
info.track = Angle::Degrees(track);
info.track_available.Update(info.clock);
}
// Speed over Ground (xxxxx dm/s), 5 Digits
fixed ground_speed;
if (line.ReadChecked(ground_speed)) {
info.ground_speed = ground_speed / 10;
info.ground_speed_available.Update(info.clock);
}
// GPS altitude (xxxxx meter), 5 Digits
fixed gps_altitude;
if (line.ReadChecked(gps_altitude)) {
info.gps_altitude = gps_altitude;
info.gps_altitude_available.Update(info.clock);
}
}
// Validity of 3 D fix A or V, 1 Digit
line.Skip();
// Satellites in Use (0 to 12), 2 Digits
unsigned satellites_used;
if (line.ReadChecked(satellites_used)) {
info.gps.satellites_used = satellites_used;
info.gps.satellites_used_available.Update(info.clock);
}
// Raw pressure (xxxxxx Pa), 6 Digits
fixed pressure;
if (line.ReadChecked(pressure))
info.ProvideStaticPressure(AtmosphericPressure::Pascal(pressure));
// Baro Altitude (xxxxx meter), 5 Digits (-xxxx to xxxxx) (Based on 1013.25hPa)
fixed baro_altitude;
if (line.ReadChecked(baro_altitude))
info.ProvidePressureAltitude(baro_altitude);
// Variometer (xxxx cm/s), 4 or 5 Digits (-9999 to 9999)
fixed vario;
if (line.ReadChecked(vario))
info.ProvideTotalEnergyVario(vario / 100);
//.........这里部分代码省略.........