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


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

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


在下文中一共展示了NMEAInputLine::read_checked方法的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.read_checked(i))
    info.settings.ProvideMacCready(fixed(i) / 10, info.clock);

  if (line.read_checked(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.read_checked(i))
    info.settings.ProvideWingLoading(fixed(i) / 10, info.clock);

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

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

示例2: fixed

static bool
LXWP2(NMEAInputLine &line, NMEA_INFO *GPS_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.read_checked(value))
    GPS_INFO->MacCready = value;

  // Ballast
  line.skip();
  /*
  if (line.read_checked(value))
    GPS_INFO->Ballast = value;
  */

  // Bugs
  if (line.read_checked(value))
    GPS_INFO->Bugs = fixed(100) - value;

  return true;
}
开发者ID:hnpilot,项目名称:XCSoar,代码行数:32,代码来源:LX.cpp

示例3:

static bool
LXWP2(NMEAInputLine &line, NMEA_INFO *GPS_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.read_checked(value))
    GPS_INFO->settings.ProvideMacCready(value, GPS_INFO->Time);

  // Ballast
  line.skip();
  /*
  if (line.read_checked(value))
    GPS_INFO->ProvideBallast(value, GPS_INFO->Time);
  */

  // Bugs
  if (line.read_checked(value))
    GPS_INFO->settings.ProvideBugs((fixed(100) - value) / 100, GPS_INFO->Time);

  return true;
}
开发者ID:Mrdini,项目名称:XCSoar,代码行数:32,代码来源:LX.cpp

示例4: if

/**
 * Parses a RMC sentence
 *
 * $--RMC,hhmmss.ss,A,llll.ll,a,yyyyy.yy,a,x.x,x.x,xxxx,x.x,a,m,*hh
 *
 * Field Number:
 *  1) UTC Time
 *  2) Status, V=Navigation receiver warning A=Valid
 *  3) Latitude
 *  4) N or S
 *  5) Longitude
 *  6) E or W
 *  7) Speed over ground, knots
 *  8) Track made good, degrees true
 *  9) Date, ddmmyy
 * 10) Magnetic Variation, degrees
 * 11) E or W
 * 12) FAA mode indicator (NMEA 2.3 and later)
 * 13) Checksum
 * @param String Input string
 * @param params Parameter array
 * @param nparams Number of parameters
 * @param info NMEA_INFO struct to parse into
 * @return Parsing success
 */
bool
NMEAParser::RMC(NMEAInputLine &line, NMEAInfo &info)
{
  fixed ThisTime = line.read(fixed_zero);

  bool gpsValid = !NAVWarn(line.read_first_char());

  GeoPoint location;
  bool valid_location = ReadGeoPoint(line, location);

  GPSState &gps = info.gps;

  fixed speed;
  bool GroundSpeedAvailable = line.read_checked(speed);

  fixed track;
  bool track_available = line.read_checked(track);

  // JMW get date info first so TimeModify is accurate
  if (ReadDate(line, info.date_time_utc))
    info.date_available = true;

  ThisTime = TimeModify(ThisTime, info.date_time_utc, info.date_available);
  ThisTime = TimeAdvanceTolerance(ThisTime);

  if (!TimeHasAdvanced(ThisTime, info))
    return true;

  if (!gpsValid)
    info.location_available.Clear();
  else if (valid_location)
    info.location_available.Update(info.clock);

  if (valid_location)
    info.location = location;

  if (GroundSpeedAvailable) {
    info.ground_speed = Units::ToSysUnit(speed, unKnots);
    info.ground_speed_available.Update(info.clock);
  }

  if (track_available && info.MovementDetected()) {
    // JMW don't update bearing unless we're moving
    info.track = Angle::degrees(track).as_bearing();
    info.track_available.Update(info.clock);
  }

  if (!GGAAvailable) {
    // update SatInUse, some GPS receiver don't emit GGA sentence
    gps.satellites_used = -1;
  }

  info.gps.real = real;
#ifdef ANDROID
  info.gps.android_internal_gps = false;
#endif

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

示例5:

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

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

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

示例6:

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

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

  if (bearing_valid && norm_valid) {
    value_r.bearing = Angle::degrees(bearing);
    value_r.norm = Units::ToSysUnit(norm, unKiloMeterPerHour);
    return true;
  } else
    return false;
}
开发者ID:hnpilot,项目名称:XCSoar,代码行数:15,代码来源:LX.cpp

示例7:

static bool
ReadFixedAndChar(NMEAInputLine &line, fixed &d, char &ch)
{
  bool success = line.read_checked(d);
  ch = line.read_first_char();
  return success;
}
开发者ID:Plantain,项目名称:XCSoar,代码行数:7,代码来源:Parser.cpp

示例8:

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

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

  if (bearing_valid && norm_valid) {
    value_r.bearing = Angle::degrees(bearing);
    value_r.norm = norm / 10;
    return true;
  }

  return false;
}
开发者ID:macsux,项目名称:XCSoar,代码行数:16,代码来源:Parser.cpp

示例9: meters

/*
$PCAID,<1>,<2>,<3>,<4>*hh<CR><LF>
<1> Logged 'L' Last point Logged 'N' Last Point not logged
<2> Barometer Altitude in meters (Leading zeros will be transmitted)
<3> Engine Noise Level
<4> Log Flags
*hh Checksum, XOR of all bytes of the sentence after the ‘$’ and before the ‘*’
*/
static bool
cai_PCAID(NMEAInputLine &line, NMEAInfo &data)
{
  line.skip();

  fixed value;
  if (line.read_checked(value))
    data.ProvidePressureAltitude(value);

  unsigned enl;
  if (line.read_checked(enl)) {
    data.engine_noise_level = enl;
    data.engine_noise_level_available.Update(data.clock);
  }

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

示例10: IAS

static bool
LXWP0(NMEAInputLine &line, NMEA_INFO *GPS_INFO, bool enable_baro)
{
  /*
  $LXWP0,Y,222.3,1665.5,1.71,,,,,,239,174,10.1

   0 loger_stored (Y/N)
   1 IAS (kph) ----> Condor uses TAS!
   2 baroaltitude (m)
   3-8 vario (m/s) (last 6 measurements in last second)
   9 heading of plane
  10 windcourse (deg)
  11 windspeed (kph)
  */

  line.skip();

  fixed airspeed;
  GPS_INFO->AirspeedAvailable = line.read_checked(airspeed);

  fixed alt = line.read(fixed_zero);

  if (GPS_INFO->AirspeedAvailable) {
    GPS_INFO->TrueAirspeed = Units::ToSysUnit(airspeed, unKiloMeterPerHour);
    GPS_INFO->IndicatedAirspeed =
      GPS_INFO->TrueAirspeed / AtmosphericPressure::AirDensityRatio(alt);
  }

  if (enable_baro) {
    GPS_INFO->BaroAltitudeAvailable = true;
    GPS_INFO->BaroAltitude = alt; // ToDo check if QNH correction is needed!
  }

  GPS_INFO->TotalEnergyVarioAvailable =
    line.read_checked(GPS_INFO->TotalEnergyVario);

  line.skip(6);

  GPS_INFO->ExternalWindAvailable = ReadSpeedVector(line, GPS_INFO->wind);

  TriggerVarioUpdate();

  return true;
}
开发者ID:hnpilot,项目名称:XCSoar,代码行数:44,代码来源:LX.cpp

示例11:

/**
 * Parse a "$D" sentence.
 *
 * Example: "$D,+0,100554,+25,18,+31,,0,-356,+25,+11,115,96*6A"
 */
static bool
LeonardoParseD(NMEAInputLine &line, NMEA_INFO &info)
{
    fixed value;

    // 0 = vario [dm/s]
    if (line.read_checked(value))
        info.ProvideTotalEnergyVario(value / 10);

    // 1 = air pressure [Pa]
    if (line.skip() == 0)
        /* short "$C" sentence ends after airspeed */
        return true;

    // 2 = netto vario [dm/s]
    if (line.read_checked(value))
        info.ProvideNettoVario(value / 10);

    // 3 = airspeed [km/h]
    /* XXX is that TAS or IAS? */
    if (line.read_checked(value))
        info.ProvideTrueAirspeed(Units::ToSysUnit(value, unKiloMeterPerHour));

    // 4 = temperature [deg C]
    fixed oat;
    info.TemperatureAvailable = line.read_checked(oat);
    if (info.TemperatureAvailable)
        info.OutsideAirTemperature = Units::ToSysUnit(oat, unGradCelcius);

    // 5 = compass [degrees]
    /* XXX unsupported by XCSoar */

    // 6 = optimal speed [km/h]
    /* XXX unsupported by XCSoar */

    // 7 = equivalent MacCready [cm/s]
    /* XXX unsupported by XCSoar */

    // 8 = wind speed [km/h]
    /* not used here, the "$C" record repeats it together with the
       direction */

    return true;
}
开发者ID:Mrdini,项目名称:XCSoar,代码行数:49,代码来源:Leonardo.cpp

示例12: IAS

static bool
LXWP0(NMEAInputLine &line, NMEA_INFO *GPS_INFO)
{
  /*
  $LXWP0,Y,222.3,1665.5,1.71,,,,,,239,174,10.1

   0 loger_stored (Y/N)
   1 IAS (kph) ----> Condor uses TAS!
   2 baroaltitude (m)
   3-8 vario (m/s) (last 6 measurements in last second)
   9 heading of plane
  10 windcourse (deg)
  11 windspeed (kph)
  */

  fixed value;

  line.skip();

  fixed airspeed;
  bool tas_available = line.read_checked(airspeed);

  fixed alt = fixed_zero;
  if (line.read_checked(alt))
    /* a dump on a LX7007 has confirmed that the LX sends uncorrected
       altitude above 1013.25hPa here */
    GPS_INFO->ProvidePressureAltitude(alt);

  if (tas_available)
    GPS_INFO->ProvideTrueAirspeedWithAltitude(Units::ToSysUnit(airspeed,
                                              unKiloMeterPerHour),
                                              alt);

  if (line.read_checked(value))
    GPS_INFO->ProvideTotalEnergyVario(value);

  line.skip(6);

  SpeedVector wind;
  if (ReadSpeedVector(line, wind))
    GPS_INFO->ProvideExternalWind(wind);

  return true;
}
开发者ID:Mrdini,项目名称:XCSoar,代码行数:44,代码来源:LX.cpp

示例13:

/**
 * $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.read_checked(i))
        info.settings.ProvideMacCready(fixed(i) / 10, info.clock);

    line.skip(4);

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

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

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

示例14:

static bool
GPWIN(NMEAInputLine &line, NMEA_INFO *GPS_INFO)
{
  line.skip(2);

  fixed value;
  if (line.read_checked(value))
    GPS_INFO->ProvidePressureAltitude(value / 10);

  return false;
}
开发者ID:Mrdini,项目名称:XCSoar,代码行数:11,代码来源:PosiGraph.cpp

示例15:

static bool
PZAN4(NMEAInputLine &line, NMEA_INFO *GPS_INFO)
{
  // $PZAN4,1.5,+,20,39,45*cc

  fixed mc;
  if (line.read_checked(mc))
    GPS_INFO->settings.ProvideMacCready(mc, GPS_INFO->Time);

  return true;
}
开发者ID:Mrdini,项目名称:XCSoar,代码行数:11,代码来源:Zander.cpp


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