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


C++ NMEAInfo::MovementDetected方法代码示例

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


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

示例1: 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

示例2: if

bool
NMEAParser::RMC(NMEAInputLine &line, NMEAInfo &info)
{
    /*
     * $--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
     */

    fixed this_time;
    if (!ReadTime(line, info.date_time_utc, this_time))
        return true;

    bool gps_valid = !NAVWarn(line.ReadFirstChar());

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

    fixed speed;
    bool ground_speed_available = line.ReadChecked(speed);

    Angle track;
    bool track_available = ReadBearing(line, track);

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

    Angle variation;
    bool variation_available = ReadVariation(line, variation);

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

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

    if (valid_location)
        info.location = location;

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

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

    if (!variation_available)
        info.variation_available.Clear();
    else if (variation_available) {
        info.variation = variation;
        info.variation_available.Update(info.clock);
    }

    info.gps.real = real;
#if defined(ANDROID) || defined(__APPLE__)
    info.gps.nonexpiring_internal_gps = false;
#endif

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


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