本文整理汇总了C++中DeviceDescriptor::LineReceived方法的典型用法代码示例。如果您正苦于以下问题:C++ DeviceDescriptor::LineReceived方法的具体用法?C++ DeviceDescriptor::LineReceived怎么用?C++ DeviceDescriptor::LineReceived使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DeviceDescriptor
的用法示例。
在下文中一共展示了DeviceDescriptor::LineReceived方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
if (argc != 3) {
fprintf(stderr, "Usage: %s DRIVER FILE.IGC\n"
"Where DRIVER is one of:\n", argv[0]);
const TCHAR *name;
for (unsigned i = 0; (name = devRegisterGetName(i)) != NULL; ++i)
_ftprintf(stderr, _T("\t%s\n"), name);
return 1;
}
PathName driver_name(argv[1]);
device.Driver = devGetDriver(driver_name);
if (device.Driver == NULL) {
fprintf(stderr, "No such driver: %s\n", argv[1]);
return 1;
}
NullPort port(*(Port::Handler *)NULL);
device.Com = &port;
device.enable_baro = true;
if (!device.Open()) {
fprintf(stderr, "Failed to open driver: %s\n", argv[1]);
return 1;
}
char buffer[1024];
for (unsigned i = 0; i < 10 &&
fgets(buffer, sizeof(buffer), stdin) != NULL; ++i)
device.LineReceived(buffer);
PathName igc_path(argv[2]);
IGCWriter writer(igc_path, device_blackboard.Basic());
writer.header(device_blackboard.Basic().DateTime,
_T("Manfred Mustermann"), _T("Ventus"),
_T("D-1234"), _T("Foo"), driver_name);
GPSClock log_clock(fixed(1));
while (fgets(buffer, sizeof(buffer), stdin) != NULL) {
device.LineReceived(buffer);
if (log_clock.check_advance(device_blackboard.Basic().Time))
writer.LogPoint(device_blackboard.Basic());
}
}
示例2: main
int main(int argc, char **argv)
{
if (argc != 2) {
fprintf(stderr, "Usage: %s DRIVER\n"
"Where DRIVER is one of:\n", argv[0]);
const TCHAR *name;
for (unsigned i = 0; (name = devRegisterGetName(i)) != NULL; ++i)
_ftprintf(stderr, _T("\t%s\n"), name);
return 1;
}
PathName driver_name(argv[1]);
device.Driver = devGetDriver(driver_name);
if (device.Driver == NULL) {
fprintf(stderr, "No such driver: %s\n", argv[1]);
return 1;
}
NullPort port(*(Port::Handler *)NULL);
device.Com = &port;
device.enable_baro = true;
if (!device.Open()) {
fprintf(stderr, "Failed to open driver: %s\n", argv[1]);
return 1;
}
char buffer[1024];
while (fgets(buffer, sizeof(buffer), stdin) != NULL)
device.LineReceived(buffer);
Dump(device_blackboard.Basic());
}