本文整理汇总了C++中NMEAInputLine::ReadOneChar方法的典型用法代码示例。如果您正苦于以下问题:C++ NMEAInputLine::ReadOneChar方法的具体用法?C++ NMEAInputLine::ReadOneChar怎么用?C++ NMEAInputLine::ReadOneChar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NMEAInputLine
的用法示例。
在下文中一共展示了NMEAInputLine::ReadOneChar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: if
/**
* 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;
}