当前位置: 首页>>代码示例>>C++>>正文


C++ DeviceDescriptor::LineReceived方法代码示例

本文整理汇总了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());
  }
}
开发者ID:galippi,项目名称:xcsoar,代码行数:48,代码来源:RunIGCWriter.cpp

示例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());
}
开发者ID:galippi,项目名称:xcsoar,代码行数:35,代码来源:RunDeviceDriver.cpp


注:本文中的DeviceDescriptor::LineReceived方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。