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


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

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


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

示例1:

bool
NMEAParser::GSA(NMEAInputLine &line, NMEAInfo &info)
{
    /*
     * $--GSA,a,a,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x.x,x.x,x.x*hh
     *
     * Field Number:
     *  1) Selection mode
     *         M=Manual, forced to operate in 2D or 3D
     *         A=Automatic, 3D/2D
     *  2) Mode (1 = no fix, 2 = 2D fix, 3 = 3D fix)
     *  3) ID of 1st satellite used for fix
     *  4) ID of 2nd satellite used for fix
     *  ...
     *  14) ID of 12th satellite used for fix
     *  15) PDOP
     *  16) HDOP
     *  17) VDOP
     *  18) checksum
     */

    line.Skip();

    if (line.Read(0) == 1)
        info.location_available.Clear();

    // satellites are in items 4-15 of GSA string (4-15 is 1-indexed)
    for (unsigned i = 0; i < GPSState::MAXSATELLITES; i++)
        info.gps.satellite_ids[i] = line.Read(0);

    info.gps.satellite_ids_available.Update(info.clock);

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

示例2:

bool
VegaDevice::PDVSC(NMEAInputLine &line, gcc_unused NMEAInfo &info)
{
  char responsetype[10];
  line.Read(responsetype, 10);

  char name[80];
  line.Read(name, 80);

  if (StringIsEqual(name, "ERROR"))
    // ignore error responses...
    return true;

  int value = line.Read(0);

  if (StringIsEqual(name, "ToneDeadbandCruiseLow"))
    value = std::max(value, -value);
  if (StringIsEqual(name, "ToneDeadbandCirclingLow"))
    value = std::max(value, -value);

  settings.Lock();
  settings.Set(name, value);
  settings.Unlock();

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

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

示例4:

bool
VegaDevice::PDVSC(NMEAInputLine &line, gcc_unused NMEAInfo &info)
{
  char responsetype[10];
  line.Read(responsetype, 10);

  char name[80];
  line.Read(name, 80);

  if (strcmp(name, "ERROR") == 0)
    // ignore error responses...
    return true;

  int value = line.Read(0);

  if (strcmp(name, "ToneDeadbandCruiseLow") == 0)
    value = std::max(value, -value);
  if (strcmp(name, "ToneDeadbandCirclingLow") == 0)
    value = std::max(value, -value);

  settings_mutex.Lock();
  settings[name] = value;
  settings_mutex.Unlock();

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

示例5:

void
ParsePFLAE(NMEAInputLine &line, FlarmError &error, double clock)
{
    char type[2];
    line.Read(type, ARRAY_SIZE(type));
    if (!StringIsEqual(type, "A"))
        return;

    error.severity = (FlarmError::Severity)
                     line.Read((int)FlarmError::Severity::NO_ERROR);
    error.code = (FlarmError::Code)line.ReadHex(0);

    error.available.Update(clock);
}
开发者ID:ahsparrow,项目名称:xcsoar,代码行数:14,代码来源:StaticParser.cpp

示例6: sizeof

static bool
ReadFilename(NMEAInputLine &line, RecordedFlightInfo &info)
{
  line.Read(info.internal.lx.nano_filename,
            sizeof(info.internal.lx.nano_filename));
  return info.internal.lx.nano_filename[0] != 0;
}
开发者ID:MindMil,项目名称:XCSoar,代码行数:7,代码来源:NanoLogger.cpp

示例7: altitude

// RMN: Volkslogger
// Source data:
// $PGCS,1,0EC0,FFF9,0C6E,02*61
// $PGCS,1,0EC0,FFFA,0C6E,03*18
static bool
vl_PGCS1(NMEAInputLine &line, NMEAInfo &info)
{
  if (line.Read(1) != 1)
    return false;

  /* pressure sensor */
  line.Skip();

  // four characers, hex, barometric altitude
  unsigned u_altitude;
  if (line.ReadHexChecked(u_altitude)) {
    int altitude(u_altitude);
    if (altitude > 60000)
      /* Assuming that altitude has wrapped around.  60 000 m occurs
         at QNH ~2000 hPa */
      altitude -= 65535;

    info.ProvidePressureAltitude(fixed(altitude));
  }

  // ExtractParameter(String,ctemp,3);
  // four characters, hex, constant.  Value 1371 (dec)

  // nSatellites = (int)(min(12,HexStrToDouble(ctemp, NULL)));

  return false;
}
开发者ID:DRIZO,项目名称:xcsoar,代码行数:32,代码来源:Parser.cpp

示例8: PFLAC

  void PFLAC(NMEAInputLine &line) {
    char command[4];
    line.Read(command, ARRAY_SIZE(command));

    if (strcmp(command, "S") == 0)
      PFLAC_S(line);
    else if (strcmp(command, "R") == 0)
      PFLAC_R(line);
  }
开发者ID:MindMil,项目名称:XCSoar,代码行数:9,代码来源:FLARMEmulator.hpp

示例9:

/**
 * Parse the $PLXV0 sentence (LXNav V7).
 */
static bool
PLXV0(NMEAInputLine &line, DeviceSettingsMap<std::string> &settings)
{
  char name[64];
  line.Read(name, ARRAY_SIZE(name));
  if (StringIsEmpty(name))
    return true;

  char type[2];
  line.Read(type, ARRAY_SIZE(type));
  if (type[0] != 'W')
    return true;

  const auto value = line.Rest();

  settings.Lock();
  settings.Set(name, std::string(value.begin(), value.end()));
  settings.Unlock();
  return true;
}
开发者ID:kwtskran,项目名称:XCSoar,代码行数:23,代码来源:Parser.cpp

示例10:

void
ParsePFLAV(NMEAInputLine &line, FlarmVersion &version, fixed clock)
{
  char type[2];
  line.Read(type, ARRAY_SIZE(type));
  if (strcmp(type, "A") != 0)
    return;

  line.Read(version.hardware_version.buffer(),
            version.hardware_version.MAX_SIZE);
  version.hardware_version.CleanASCII();

  line.Read(version.software_version.buffer(),
            version.software_version.MAX_SIZE);
  version.software_version.CleanASCII();

  line.Read(version.obstacle_version.buffer(),
            version.obstacle_version.MAX_SIZE);
  version.obstacle_version.CleanASCII();

  version.available.Update(clock);
}
开发者ID:osteocool,项目名称:XCSoar-1,代码行数:22,代码来源:StaticParser.cpp

示例11:

bool
FlarmDevice::ParsePFLAC(NMEAInputLine &line)
{
  char responsetype[10];
  line.Read(responsetype, 10);

  char name[80];
  line.Read(name, 80);

  if (strcmp(name, "ERROR") == 0)
    // ignore error responses...
    return true;

  char value[256];
  line.Read(value, ARRAY_SIZE(value));

  settings.Lock();
  settings.Set(name, value);
  settings.Unlock();

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

示例12: if

/**
 * Parse the $PLXVC sentence (LXNAV Nano).
 *
 * $PLXVC,<key>,<type>,<values>*<checksum><cr><lf>
 */
static void
PLXVC(NMEAInputLine &line, DeviceInfo &device,
      DeviceInfo &secondary_device,
      DeviceSettingsMap<std::string> &settings)
{
  char key[64];
  line.Read(key, ARRAY_SIZE(key));

  char type[2];
  line.Read(type, ARRAY_SIZE(type));
  if (StringIsEqual(key, "SET") && type[0] == 'A') {
    char name[64];
    line.Read(name, ARRAY_SIZE(name));

    const auto value = line.Rest();
    if (!StringIsEmpty(name)) {
      settings.Lock();
      settings.Set(name, std::string(value.begin(), value.end()));
      settings.Unlock();
    }
  } else if (StringIsEqual(key, "INFO") && type[0] == 'A') {
    ParseNanoInfo(line, device);
  } else if (StringIsEqual(key, "GPSINFO") && type[0] == 'A') {
    /* the LXNAV V7 (firmware >= 2.01) forwards the Nano's INFO
       sentence with the "GPS" prefix */

    char name[64];
    line.Read(name, ARRAY_SIZE(name));

    if (StringIsEqual(name, "LXWP1")) {
      LXWP1(line, secondary_device);
    } else if (StringIsEqual(name, "INFO")) {
      line.Read(type, ARRAY_SIZE(type));
      if (type[0] == 'A')
        ParseNanoInfo(line, secondary_device);
    }
  }
}
开发者ID:kwtskran,项目名称:XCSoar,代码行数:43,代码来源:Parser.cpp

示例13: PFLAC_R

  void PFLAC_R(NMEAInputLine &line) {
    char name[64];
    line.Read(name, ARRAY_SIZE(name));

    auto i = settings.find(name);
    if (i == settings.end())
      return;

    const char *value = i->second.c_str();

    char buffer[512];
    snprintf(buffer, ARRAY_SIZE(buffer), "PFLAC,A,%s,%s", name, value);
    PortWriteNMEA(*port, buffer, *env);
  }
开发者ID:MindMil,项目名称:XCSoar,代码行数:14,代码来源:FLARMEmulator.hpp

示例14: SmallHypot

// $PDVDS,nx,nz,flap,stallratio,netto
static bool
PDVDS(NMEAInputLine &line, NMEAInfo &info)
{
  const int accel_x = line.Read(0), accel_z = line.Read(0);

  fixed mag = SmallHypot(fixed(accel_x), fixed(accel_z));
  info.acceleration.ProvideGLoad(mag / 100, true);

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

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

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

  //hasVega = true;

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

示例15: PFLAC_S

  void PFLAC_S(NMEAInputLine &line) {
    char name[64];
    line.Read(name, ARRAY_SIZE(name));

    const auto value = line.Rest();
    NarrowString<256> value_buffer;
    value_buffer.SetASCII(value.begin(), value.end());

    settings[name] = value_buffer;

    char buffer[512];
    snprintf(buffer, ARRAY_SIZE(buffer), "PFLAC,A,%s,%s", name,
             value_buffer.c_str());
    PortWriteNMEA(*port, buffer, *env);
  }
开发者ID:MindMil,项目名称:XCSoar,代码行数:15,代码来源:FLARMEmulator.hpp


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