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


C++ Port::SetRxTimeout方法代码示例

本文整理汇总了C++中Port::SetRxTimeout方法的典型用法代码示例。如果您正苦于以下问题:C++ Port::SetRxTimeout方法的具体用法?C++ Port::SetRxTimeout怎么用?C++ Port::SetRxTimeout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Port的用法示例。


在下文中一共展示了Port::SetRxTimeout方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: EWMicroRecorderPrintf

bool
EWMicroRecorderDevice::Declare(const Declaration *decl)
{
  // Must have at least two, max 12 waypoints
  if (decl->size() < 2 || decl->size() > 12)
    return false;

  port->StopRxThread();

  port->SetRxTimeout(500);                     // set RX timeout to 500[ms]

  if (!TryConnect())
    return false;

  port->Write('\x18');         // start to upload file
  port->Write(user_data);
  EWMicroRecorderPrintf(port, _T("%-15s %s\r\n"),
               _T("Pilot Name:"), decl->PilotName);
  EWMicroRecorderPrintf(port, _T("%-15s %s\r\n"),
               _T("Competition ID:"), decl->AircraftRego);
  EWMicroRecorderPrintf(port, _T("%-15s %s\r\n"),
               _T("Aircraft Type:"), decl->AircraftType);
  port->Write("Description:      Declaration\r\n");

  for (unsigned i = 0; i < 11; i++) {
    if (i+1>= decl->size()) {
      EWMicroRecorderPrintf(port, _T("%-17s %s\r\n"),
               _T("TP LatLon:"), _T("0000000N00000000E TURN POINT\r\n"));
    } else {
      const Waypoint &wp = decl->waypoints[i];
      if (i == 0) {
        EWMicroRecorderWriteWayPoint(port, wp, _T("Take Off LatLong:"));
        EWMicroRecorderWriteWayPoint(port, wp, _T("Start LatLon:"));
      } else if (i + 1 < decl->size()) {
        EWMicroRecorderWriteWayPoint(port, wp, _T("TP LatLon:"));
      }
    }
  }

  const Waypoint &wp = decl->waypoints[decl->size() - 1];
  EWMicroRecorderWriteWayPoint(port, wp, _T("Finish LatLon:"));
  EWMicroRecorderWriteWayPoint(port, wp, _T("Land LatLon:"));

  port->Write('\x03');         // finish sending user file

  bool success = ExpectStringWait(port, "uploaded successfully");

  port->Write("!!\r\n");         // go back to NMEA mode

  port->SetRxTimeout(0);                       // clear timeout
  port->StartRxThread();                       // restart RX thread

  return success;
}
开发者ID:hnpilot,项目名称:XCSoar,代码行数:54,代码来源:EWMicroRecorder.cpp

示例2: Connect

bool
LX::CommandMode(Port &port, OperationEnvironment &env)
{
  /* switch to command mode, first attempt */
  port.Write(SYN);

  /* now flush all of the remaining input */
  port.SetRxTimeout(10);
  port.FullFlush(20);

  /* the port is clean now; try the SYN/ACK procedure up to three
     times */
  return port.SetRxTimeout(500) &&
    (Connect(port, env) || Connect(port, env) || Connect(port, env)) &&
    /* ... and configure the timeout */
    port.SetRxTimeout(5000);
}
开发者ID:davidswelt,项目名称:XCSoar,代码行数:17,代码来源:Protocol.cpp

示例3: DeclareInternal

bool
AltairProDevice::Declare(const struct Declaration &declaration,
                         OperationEnvironment &env)
{
  port->SetRxTimeout(500); // set RX timeout to 500[ms]

  bool result = DeclareInternal(declaration);

  return result;
}
开发者ID:macsux,项目名称:XCSoar,代码行数:10,代码来源:AltairPro.cpp

示例4: DeclareInner

bool
EWDevice::Declare(const struct Declaration *decl, OperationEnvironment &env)
{
  port->StopRxThread();

  lLastBaudrate = port->SetBaudrate(9600L);    // change to IO Mode baudrate

  port->SetRxTimeout(500);                     // set RX timeout to 500[ms]

  bool success = DeclareInner(decl, env);

  port->Write("NMEA\r\n"); // switch to NMEA mode

  port->SetBaudrate(lLastBaudrate);            // restore baudrate

  port->SetRxTimeout(0);                       // clear timeout
  port->StartRxThread();                       // restart RX thread

  return success;
}
开发者ID:Mrdini,项目名称:XCSoar,代码行数:20,代码来源:EW.cpp

示例5: DeclareInner

bool
EWMicroRecorderDevice::Declare(const Declaration &declaration,
                               OperationEnvironment &env)
{
  // Must have at least two, max 12 waypoints
  if (declaration.size() < 2 || declaration.size() > 12)
    return false;

  /* during tests, the EW has taken up to one second to respond to
     the command \x18 */
  port->SetRxTimeout(2500);

  bool success = DeclareInner(*port, declaration, env);

  port->Write("!!\r\n");         // go back to NMEA mode

  return success;
}
开发者ID:joachimwieland,项目名称:xcsoar-jwieland,代码行数:18,代码来源:EWMicroRecorder.cpp

示例6: sizeof

static bool
DeclareInner(Port &port, const Declaration &declaration,
             gcc_unused OperationEnvironment &env)
{
  using CAI302::UploadShort;
  unsigned size = declaration.Size();

  port.SetRxTimeout(500);

  env.SetProgressRange(6 + size);
  env.SetProgressPosition(0);

  CAI302::CommandModeQuick(port);
  if (!CAI302::UploadMode(port) || env.IsCancelled())
    return false;

  port.SetRxTimeout(1500);

  CAI302::PilotMeta pilot_meta;
  if (!CAI302::UploadPilotMeta(port, pilot_meta) || env.IsCancelled())
    return false;

  env.SetProgressPosition(1);

  CAI302::Pilot pilot;
  if (!CAI302::UploadPilot(port, 0, pilot) || env.IsCancelled())
    return false;

  env.SetProgressPosition(2);

  CAI302::PolarMeta polar_meta;
  if (!CAI302::UploadPolarMeta(port, polar_meta) || env.IsCancelled())
    return false;

  env.SetProgressPosition(3);

  CAI302::Polar polar;
  if (!CAI302::UploadPolar(port, polar) || env.IsCancelled())
    return false;

  env.SetProgressPosition(4);

  if (!CAI302::DownloadMode(port) || env.IsCancelled())
    return false;

  char GliderType[13], GliderID[13];
  convert_string(GliderType, sizeof(GliderType), declaration.aircraft_type);
  convert_string(GliderID, sizeof(GliderID), declaration.aircraft_registration);

  convert_string(pilot.name, sizeof(pilot.name), declaration.pilot_name);
  if (!CAI302::DownloadPilot(port, pilot) || env.IsCancelled())
    return false;

  env.SetProgressPosition(5);

  convert_string(polar.glider_type, sizeof(polar.glider_type),
                 declaration.aircraft_type);
  convert_string(polar.glider_id, sizeof(polar.glider_id),
                 declaration.aircraft_registration);
  if (!CAI302::DownloadPolar(port, polar) || env.IsCancelled())
    return false;

  env.SetProgressPosition(6);

  for (unsigned i = 0; i < size; ++i) {
    if (!cai302DeclAddWaypoint(port, i, declaration.GetWaypoint(i)) ||
        env.IsCancelled())
      return false;

    env.SetProgressPosition(7 + i);
  }

  port.SetRxTimeout(1500); // D,255 takes more than 800ms
  return CAI302::DeclareSave(port);
}
开发者ID:davidswelt,项目名称:XCSoar,代码行数:75,代码来源:Declare.cpp


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