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


C++ NMEAInputLine::ReadChecked方法代码示例

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


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

示例1: if

/**
 * $PWES1,DD,MM,S,AAA,F,V,LLL,BB*CS<CR><LF>
 */
static bool
PWES1(NMEAInputLine &line, NMEAInfo &info)
{
  line.Skip(); /* device */

  int i;
  if (line.ReadChecked(i))
    info.settings.ProvideMacCready(fixed(i) / 10, info.clock);

  info.switch_state.flight_mode = SwitchState::FlightMode::UNKNOWN;
  if (line.ReadChecked(i)) {
    if (i == 0)
      info.switch_state.flight_mode = SwitchState::FlightMode::CIRCLING;
    else if (i == 1)
      info.switch_state.flight_mode = SwitchState::FlightMode::CRUISE;
  }

  line.Skip(3);

  if (line.ReadChecked(i))
    info.settings.ProvideWingLoading(fixed(i) / 10, info.clock);

  if (line.ReadChecked(i))
    info.settings.ProvideBugs(fixed(100 - i) / 100, info.clock);

  return true;
}
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:30,代码来源:Westerboer.cpp

示例2: if

/**
 * Parse the $PLXVS sentence (LXNav V7).
 *
 * $PLXVS,OAT,mode,voltage *CS<CR><LF>
 *
 * Example: $PLXVS,23.1,0,12.3,*CS<CR><LF>
 *
 * @see http://www.xcsoar.org/trac/raw-attachment/ticket/1666/V7%20dataport%20specification%201.97.pdf
 */
static bool
PLXVS(NMEAInputLine &line, NMEAInfo &info)
{
  fixed temperature;
  if (line.ReadChecked(temperature)) {
    info.temperature = CelsiusToKelvin(temperature);
    info.temperature_available = true;
  }

  int mode;
  info.switch_state.flight_mode = SwitchState::FlightMode::UNKNOWN;
  if (line.ReadChecked(mode)) {
    if (mode == 0)
      info.switch_state.flight_mode = SwitchState::FlightMode::CIRCLING;
    else if (mode == 1)
      info.switch_state.flight_mode = SwitchState::FlightMode::CRUISE;
  }

  fixed voltage;
  if (line.ReadChecked(voltage)) {
    info.voltage = voltage;
    info.voltage_available.Update(info.clock);
  }

  return true;
}
开发者ID:kwtskran,项目名称:XCSoar,代码行数:35,代码来源:Parser.cpp

示例3: wind

static bool
PZAN3(NMEAInputLine &line, NMEAInfo &info)
{
  // old: $PZAN3,+,026,V,321,035,A,321,035,V*cc
  // new: $PZAN3,+,026,A,321,035,V[,A]*cc

  line.Skip(3);

  int direction, speed;
  if (!line.ReadChecked(direction) || !line.ReadChecked(speed))
    return false;

  char okay = line.ReadFirstChar();
  if (okay == 'V') {
    okay = line.ReadFirstChar();
    if (okay == 'V')
      return true;

    if (okay != 'A') {
      line.Skip();
      okay = line.ReadFirstChar();
    }
  }

  if (okay == 'A') {
    SpeedVector wind(Angle::Degrees(direction),
                     Units::ToSysUnit(fixed(speed), Unit::KILOMETER_PER_HOUR));
    info.ProvideExternalWind(wind);
  }

  return true;
}
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:32,代码来源:Zander.cpp

示例4:

static bool
LXWP2(NMEAInputLine &line, NMEAInfo &info)
{
  /*
   * $LXWP2,
   * maccready value, (m/s)
   * ballast, (1.0 - 1.5)
   * bugs, (0 - 100%)
   * polar_a,
   * polar_b,
   * polar_c,
   * audio volume
   */

  fixed value;
  // MacCready value
  if (line.ReadChecked(value))
    info.settings.ProvideMacCready(value, info.clock);

  // Ballast
  if (line.ReadChecked(value))
    info.settings.ProvideBallastOverload(value, info.clock);

  // Bugs
  if (line.ReadChecked(value))
    info.settings.ProvideBugs((fixed(100) - value) / 100, info.clock);

  return true;
}
开发者ID:osteocool,项目名称:XCSoar-1,代码行数:29,代码来源:Parser.cpp

示例5:

static bool
ParsePITV3(NMEAInputLine &line, NMEAInfo &info)
{
  fixed value;

  // bank angle [degrees, positive right]
  if (line.ReadChecked(value)) {
    info.attitude.bank_angle_available.Update(info.clock);
    info.attitude.bank_angle = Angle::Degrees(value);
  }

  // pitch angle [degrees, positive up]
  if (line.ReadChecked(value)) {
    info.attitude.pitch_angle_available.Update(info.clock);
    info.attitude.pitch_angle = Angle::Degrees(value);
  }

  // heading [degrees]
  if (line.ReadChecked(value)) {
    info.attitude.heading_available.Update(info.clock);
    info.attitude.heading = Angle::Degrees(value);
  }

  // IAS [m/s]
  if (line.ReadChecked(value)) {
    info.ProvideIndicatedAirspeed(value);
  }

  // Load factor [g]
  if (line.ReadChecked(value)) {
    info.acceleration.ProvideGLoad(value, true);
  }

  return true;
}
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:35,代码来源:Vaulter.cpp

示例6: if

/**
 * $PWES1,DD,MM,S,AAA,F,V,LLL,BB*CS<CR><LF>
 */
static bool
PWES1(NMEAInputLine &line, NMEAInfo &info)
{
  line.Skip(); /* device */

  int i;
  if (line.ReadChecked(i))
    info.settings.ProvideMacCready(fixed(i) / 10, info.clock);

  if (line.ReadChecked(i)) {
    if (i == 0) {
      info.switch_state.flight_mode = SwitchInfo::FlightMode::CIRCLING;
      info.switch_state.speed_command = false;
      info.switch_state_available = true;
    } else if (i == 1) {
      info.switch_state.flight_mode = SwitchInfo::FlightMode::CRUISE;
      info.switch_state.speed_command = true;
      info.switch_state_available = true;
    }
  }

  line.Skip(3);

  if (line.ReadChecked(i))
    info.settings.ProvideWingLoading(fixed(i) / 10, info.clock);

  if (line.ReadChecked(i))
    info.settings.ProvideBugs(fixed(100 - i) / 100, info.clock);

  return true;
}
开发者ID:osteocool,项目名称:XCSoar-1,代码行数:34,代码来源:Westerboer.cpp

示例7: fixed

static bool
PTFRS(NMEAInputLine &line, NMEAInfo &info)
{
    // $PTFRS,1,0,0,0,0,0,0,0,5,1,10,0,3,1338313437,0,0,0,,,2*4E
    //
    // $PTFRS,<sealed>,<downloadmode>,<event>,<neartp>,<sealing>,<baromode>,
    //        <decllock>,<newrecavail>,<enl>,<rpm>,<interval>,<error>,<timbase>,
    //        <time>,<secpower>,<secpowerint>,<usup>,<ulit>,
    //        <chargerstate>,<antstate>*CS<CR><LF>

    line.Skip(8);

    unsigned enl;
    if (line.ReadChecked(enl)) {
        info.engine_noise_level = enl;
        info.engine_noise_level_available.Update(info.clock);
    }

    line.Skip(7);

    unsigned supply_voltage;
    if (line.ReadChecked(supply_voltage) && supply_voltage != 0) {
        info.voltage = fixed(supply_voltage) / 1000;
        info.voltage_available.Update(info.clock);
    }

    return true;
}
开发者ID:kedder,项目名称:xcsoar,代码行数:28,代码来源:AltairPro.cpp

示例8:

static bool
ParseAPENV1(NMEAInputLine &line, NMEAInfo &info)
{
  // $APENV1,IAS,Altitude,0,0,0,VerticalSpeed,

  int ias;
  if (!line.ReadChecked(ias)) return false;

  int altitude;
  if (!line.ReadChecked(altitude)) return false;

  line.Skip();
  line.Skip();
  line.Skip();

  // In ft/min, quality of this is limited, do not use for the time being
  int vs;
  if (!line.ReadChecked(vs)) return false;

  auto sys_alt = Units::ToSysUnit(fixed(altitude), Unit::FEET);
  info.ProvidePressureAltitude(sys_alt);
  info.ProvideIndicatedAirspeedWithAltitude(Units::ToSysUnit(fixed(ias), Unit::KNOTS), sys_alt);

  return true;
}
开发者ID:kwtskran,项目名称:XCSoar,代码行数:25,代码来源:LevilAHRS_G.cpp

示例9: fixed

static bool
PDVVT(NMEAInputLine &line, NMEAInfo &info)
{
  int value;
  info.temperature_available = line.ReadChecked(value);
  if (info.temperature_available)
    info.temperature = fixed(value) / 10;

  info.humidity_available = line.ReadChecked(info.humidity);

  return true;
}
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:12,代码来源:Parser.cpp

示例10: fixed

static bool
PZAN2(NMEAInputLine &line, NMEAInfo &info)
{
  fixed vtas, wnet;

  if (line.ReadChecked(vtas))
    info.ProvideTrueAirspeed(Units::ToSysUnit(vtas, Unit::KILOMETER_PER_HOUR));

  if (line.ReadChecked(wnet))
    info.ProvideTotalEnergyVario((wnet - fixed(10000)) / 100);

  return true;
}
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:13,代码来源:Zander.cpp

示例11: if

static bool
PDSWC(NMEAInputLine &line, NMEAInfo &info, Vega::VolatileData &volatile_data)
{
  unsigned value;
  if (line.ReadChecked(value) &&
      info.settings.ProvideMacCready(fixed(value) / 10, info.clock))
    volatile_data.mc = value;

  auto &switches = info.switch_state;
  auto &vs = switches.vega;
  vs.inputs = line.ReadHex(0);
  vs.outputs = line.ReadHex(0);

  if (vs.GetFlapLanding())
    switches.flap_position = SwitchState::FlapPosition::LANDING;
  else if (vs.GetFlapZero())
    switches.flap_position = SwitchState::FlapPosition::NEUTRAL;
  else if (vs.GetFlapNegative())
    switches.flap_position = SwitchState::FlapPosition::NEGATIVE;
  else if (vs.GetFlapPositive())
    switches.flap_position = SwitchState::FlapPosition::POSITIVE;
  else
    switches.flap_position = SwitchState::FlapPosition::UNKNOWN;

  if (vs.GetUserSwitchMiddle())
    switches.user_switch = SwitchState::UserSwitch::MIDDLE;
  else if (vs.GetUserSwitchUp())
    switches.user_switch = SwitchState::UserSwitch::UP;
  else if (vs.GetUserSwitchDown())
    switches.user_switch = SwitchState::UserSwitch::DOWN;
  else
    switches.user_switch = SwitchState::UserSwitch::UNKNOWN;

  if (vs.GetAirbrakeLocked())
    switches.airbrake_state = SwitchState::AirbrakeState::LOCKED;
  else if (vs.GetAirbrakeNotLocked())
    switches.airbrake_state = SwitchState::AirbrakeState::NOT_LOCKED;
  else
    switches.airbrake_state = SwitchState::AirbrakeState::UNKNOWN;

  switches.flight_mode = vs.GetCircling()
    ? SwitchState::FlightMode::CIRCLING
    : SwitchState::FlightMode::CRUISE;

  if (line.ReadChecked(value)) {
    info.voltage = fixed(value) / 10;
    info.voltage_available.Update(info.clock);
  }

  return true;
}
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:51,代码来源:Parser.cpp

示例12:

static bool
ReadSpeedVector(NMEAInputLine &line, SpeedVector &value_r)
{
  double norm, bearing;

  bool norm_valid = line.ReadChecked(norm);
  bool bearing_valid = line.ReadChecked(bearing);

  if (bearing_valid && norm_valid) {
    value_r.norm = Units::ToSysUnit(norm, Unit::KILOMETER_PER_HOUR);
    value_r.bearing = Angle::Degrees(bearing);
    return true;
  } else
    return false;
}
开发者ID:MaxPower-No1,项目名称:XCSoar,代码行数:15,代码来源:Leonardo.cpp

示例13:

static bool
LXWP3(NMEAInputLine &line, NMEAInfo &info)
{
  /*
   * $LXWP3,
   * altioffset
   * scmode
   * variofil
   * tefilter
   * televel
   * varioavg
   * variorange
   * sctab
   * sclow
   * scspeed
   * SmartDiff
   * glider name
   * time offset
   */

  fixed value;

  // Altitude offset -> QNH
  if (line.ReadChecked(value)) {
    value = Units::ToSysUnit(-value, Unit::FEET);
    auto qnh = AtmosphericPressure::PressureAltitudeToStaticPressure(value);
    info.settings.ProvideQNH(qnh, info.clock);
  }

  return true;
}
开发者ID:kwtskran,项目名称:XCSoar,代码行数:31,代码来源:Parser.cpp

示例14: fixed

bool
NMEAParser::ReadTime(NMEAInputLine &line, BrokenTime &broken_time,
                     fixed &time_of_day_s)
{
    fixed value;
    if (!line.ReadChecked(value))
        return false;

    // Calculate Hour
    auto hours = value / 10000;
    broken_time.hour = (int)hours;

    // Calculate Minute
    auto mins = value / 100;
    mins = mins - fixed(broken_time.hour) * 100;
    broken_time.minute = (int)mins;

    // Calculate Second
    auto secs = value - fixed(broken_time.hour * 10000 +
                              broken_time.minute * 100);
    broken_time.second = (int)secs;

    time_of_day_s = secs + fixed(broken_time.minute * 60 + broken_time.hour * 3600);
    return true;
}
开发者ID:ThomasXBMC,项目名称:XCSoar,代码行数:25,代码来源:Parser.cpp

示例15: SmallHypot

// $PDVDS,nx,nz,flap,stallratio,netto
static bool
PDVDS(NMEAInputLine &line, NMEAInfo &info)
{
  fixed AccelX = line.Read(fixed_zero);
  fixed AccelZ = line.Read(fixed_zero);

  fixed mag = SmallHypot(AccelX, AccelZ);
  info.acceleration.ProvideGLoad(fixed(mag) / 100, true);

  /*
  double flap = line.Read(0.0);
  */
  line.Skip();

  info.stall_ratio = line.Read(fixed_zero);
  info.stall_ratio_available.Update(info.clock);

  fixed value;
  if (line.ReadChecked(value))
    info.ProvideNettoVario(value / 10);

  //hasVega = true;

  return true;
}
开发者ID:alon,项目名称:xcsoar,代码行数:26,代码来源:Parser.cpp


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