本文整理汇总了C++中NMEAInputLine::Rest方法的典型用法代码示例。如果您正苦于以下问题:C++ NMEAInputLine::Rest方法的具体用法?C++ NMEAInputLine::Rest怎么用?C++ NMEAInputLine::Rest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NMEAInputLine
的用法示例。
在下文中一共展示了NMEAInputLine::Rest方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PFLAC_S
void PFLAC_S(NMEAInputLine &line) {
char name[64];
line.Read(name, ARRAY_SIZE(name));
const auto value = line.Rest();
NarrowString<256> value_buffer;
value_buffer.SetASCII(value.begin(), value.end());
settings[name] = value_buffer;
char buffer[512];
snprintf(buffer, ARRAY_SIZE(buffer), "PFLAC,A,%s,%s", name,
value_buffer.c_str());
PortWriteNMEA(*port, buffer, *env);
}
示例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:
// PDTSM,duration_ms,"free text"
static bool
PDTSM(NMEAInputLine &line, gcc_unused NMEAInfo &info)
{
/*
int duration = (int)strtol(String, nullptr, 10);
*/
line.Skip();
const auto message = line.Rest();
StaticString<256> buffer;
buffer.SetASCII(message.begin(), message.end());
// todo duration handling
Message::AddMessage(_T("VEGA:"), buffer);
return true;
}
示例4:
/**
* Parse the $PLXV0 sentence (LXNav V7).
*/
static bool
PLXV0(NMEAInputLine &line, DeviceSettingsMap<std::string> &settings)
{
char name[64];
line.Read(name, ARRAY_SIZE(name));
if (StringIsEmpty(name))
return true;
char type[2];
line.Read(type, ARRAY_SIZE(type));
if (type[0] != 'W')
return true;
const auto value = line.Rest();
settings.Lock();
settings.Set(name, std::string(value.begin(), value.end()));
settings.Unlock();
return true;
}
示例5: if
/**
* Parse the $PLXVC sentence (LXNAV Nano).
*
* $PLXVC,<key>,<type>,<values>*<checksum><cr><lf>
*/
static void
PLXVC(NMEAInputLine &line, DeviceInfo &device,
DeviceInfo &secondary_device,
DeviceSettingsMap<std::string> &settings)
{
char key[64];
line.Read(key, ARRAY_SIZE(key));
char type[2];
line.Read(type, ARRAY_SIZE(type));
if (StringIsEqual(key, "SET") && type[0] == 'A') {
char name[64];
line.Read(name, ARRAY_SIZE(name));
const auto value = line.Rest();
if (!StringIsEmpty(name)) {
settings.Lock();
settings.Set(name, std::string(value.begin(), value.end()));
settings.Unlock();
}
} else if (StringIsEqual(key, "INFO") && type[0] == 'A') {
ParseNanoInfo(line, device);
} else if (StringIsEqual(key, "GPSINFO") && type[0] == 'A') {
/* the LXNAV V7 (firmware >= 2.01) forwards the Nano's INFO
sentence with the "GPS" prefix */
char name[64];
line.Read(name, ARRAY_SIZE(name));
if (StringIsEqual(name, "LXWP1")) {
LXWP1(line, secondary_device);
} else if (StringIsEqual(name, "INFO")) {
line.Read(type, ARRAY_SIZE(type));
if (type[0] == 'A')
ParseNanoInfo(line, secondary_device);
}
}
}
示例6:
// PDTSM,duration_ms,"free text"
static bool
PDTSM(NMEAInputLine &line, gcc_unused NMEAInfo &info)
{
/*
int duration = (int)strtol(String, NULL, 10);
*/
line.Skip();
const char *message = line.Rest();
#ifdef _UNICODE
TCHAR buffer[strlen(message)];
if (MultiByteToWideChar(CP_ACP, 0, message, -1,
buffer, ARRAY_SIZE(buffer)) <= 0)
return false;
#else
const char *buffer = message;
#endif
// todo duration handling
Message::AddMessage(_T("VEGA:"), buffer);
return true;
}