本文整理汇总了C++中NMEAParser::ParseLine方法的典型用法代码示例。如果您正苦于以下问题:C++ NMEAParser::ParseLine方法的具体用法?C++ NMEAParser::ParseLine怎么用?C++ NMEAParser::ParseLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NMEAParser
的用法示例。
在下文中一共展示了NMEAParser::ParseLine方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fixed
static void
TestTasman()
{
NMEAParser parser;
NMEAInfo nmea_info;
nmea_info.Reset();
nmea_info.clock = fixed(1);
ok1(parser.ParseLine("$PTAS1,200,200,02426,000*25", nmea_info));
ok1(nmea_info.total_energy_vario_available);
ok1(equals(nmea_info.total_energy_vario, fixed(0)));
ok1(nmea_info.pressure_altitude_available);
ok1(equals(nmea_info.pressure_altitude, Units::ToSysUnit(fixed(426), Unit::FEET)));
ok1(nmea_info.airspeed_available);
ok1(equals(nmea_info.true_airspeed, fixed(0)));
ok1(parser.ParseLine("$PTAS1,234,000,00426,062*26", nmea_info));
ok1(nmea_info.total_energy_vario_available);
ok1(equals(nmea_info.total_energy_vario, Units::ToSysUnit(fixed(3.4), Unit::KNOTS)));
ok1(nmea_info.pressure_altitude_available);
ok1(equals(nmea_info.pressure_altitude, Units::ToSysUnit(fixed(-1574), Unit::FEET)));
ok1(nmea_info.airspeed_available);
ok1(equals(nmea_info.true_airspeed, Units::ToSysUnit(fixed(62), Unit::KNOTS)));
}
示例2: main
int main(int argc, char **argv)
{
NarrowString<1024> usage;
usage = "DRIVER\n\n"
"Where DRIVER is one of:";
{
const DeviceRegister *driver;
for (unsigned i = 0; (driver = GetDriverByIndex(i)) != nullptr; ++i) {
WideToUTF8Converter driver_name(driver->name);
usage.AppendFormat("\n\t%s", (const char *)driver_name);
}
}
Args args(argc, argv, usage);
tstring driver_name = args.ExpectNextT();
args.ExpectEnd();
driver = FindDriverByName(driver_name.c_str());
if (driver == nullptr) {
_ftprintf(stderr, _T("No such driver: %s\n"), driver_name.c_str());
return 1;
}
DeviceConfig config;
config.Clear();
NullPort port;
Device *device = driver->CreateOnPort != nullptr
? driver->CreateOnPort(config, port)
: nullptr;
NMEAParser parser;
NMEAInfo data;
data.Reset();
char buffer[1024];
while (fgets(buffer, sizeof(buffer), stdin) != nullptr) {
StripRight(buffer);
if (device == nullptr || !device->ParseNMEA(buffer, data))
parser.ParseLine(buffer, data);
}
Dump(data);
return EXIT_SUCCESS;
}