本文整理汇总了C++中NMEAInputLine类的典型用法代码示例。如果您正苦于以下问题:C++ NMEAInputLine类的具体用法?C++ NMEAInputLine怎么用?C++ NMEAInputLine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NMEAInputLine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FlytecParseVMVABD
/**
* Parse a "$VMVABD" sentence.
*
* Example: "$VMVABD,0000.0,M,0547.0,M,-0.0,,,MS,0.0,KH,22.4,C*65"
*/
static bool
FlytecParseVMVABD(NMEAInputLine &line, NMEA_INFO &info)
{
fixed value;
// 0,1 = GPS altitude, unit
if (line.read_checked_compare(info.GPSAltitude, "M"))
info.GPSAltitudeAvailable.Update(info.clock);
// 2,3 = baro altitude, unit
if (line.read_checked_compare(value, "M"))
info.ProvideBaroAltitudeTrue(value);
// 4-7 = integrated vario, unit
line.skip(4);
// 8,9 = indicated or true airspeed, unit
if (line.read_checked_compare(value, "KH"))
// XXX is that TAS or IAS? Documentation isn't clear.
info.ProvideBothAirspeeds(Units::ToSysUnit(value, unKiloMeterPerHour));
// 10,11 = temperature, unit
info.TemperatureAvailable =
line.read_checked_compare(value, "C");
if (info.TemperatureAvailable)
info.OutsideAirTemperature = Units::ToSysUnit(value, unGradCelcius);
return true;
}
示例2: FlytecParseVMVABD
/**
* Parse a "$VMVABD" sentence.
*
* Example: "$VMVABD,0000.0,M,0547.0,M,-0.0,,,MS,0.0,KH,22.4,C*65"
*/
static bool
FlytecParseVMVABD(NMEAInputLine &line, NMEA_INFO &info, bool enable_baro)
{
fixed value;
// 0,1 = GPS altitude, unit
line.read_checked_compare(info.GPSAltitude, "M");
// 2,3 = baro altitude, unit
bool available = line.read_checked_compare(value, "M");
if (enable_baro) {
if (available)
info.BaroAltitude = value;
info.BaroAltitudeAvailable = available;
}
// 4-7 = integrated vario, unit
line.skip(4);
// 8,9 = indicated or true airspeed, unit
info.AirspeedAvailable = line.read_checked_compare(value, "KH");
if (info.AirspeedAvailable) {
// XXX is that TAS or IAS? Documentation isn't clear.
info.TrueAirspeed = Units::ToSysUnit(value, unKiloMeterPerHour);
info.IndicatedAirspeed = info.TrueAirspeed;
}
// 10,11 = temperature, unit
info.TemperatureAvailable =
line.read_checked_compare(value, "C");
if (info.TemperatureAvailable)
info.OutsideAirTemperature = Units::ToSysUnit(value, unGradCelcius);
return true;
}
示例3: ParseAPENV1
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;
}
示例4: LXWP2
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;
}
示例5: LXWP2
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;
}
示例6:
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;
}
示例7: PLXVS
/**
* 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;
}
示例8: ParsePITV3
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;
}
示例9: ReadFixedAndChar
static bool
ReadFixedAndChar(NMEAInputLine &line, fixed &d, char &ch)
{
bool success = line.ReadChecked(d);
ch = line.ReadFirstChar();
return success;
}
示例10: PDVDS
// $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);
int mag = (int)hypot(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.read_checked(value))
info.ProvideNettoVario(value / 10);
//hasVega = true;
return true;
}
示例11: PTFRS
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;
}
示例12: FlytecParseVMVABD
/**
* Parse a "$VMVABD" sentence.
*
* Example: "$VMVABD,0000.0,M,0547.0,M,-0.0,,,MS,0.0,KH,22.4,C*65"
*/
static bool
FlytecParseVMVABD(NMEAInputLine &line, NMEAInfo &info)
{
fixed value;
// 0,1 = GPS altitude, unit
if (line.ReadCheckedCompare(info.gps_altitude, "M"))
info.gps_altitude_available.Update(info.clock);
// 2,3 = baro altitude, unit
if (line.ReadCheckedCompare(value, "M"))
info.ProvideBaroAltitudeTrue(value);
// 4-7 = integrated vario, unit
line.Skip(4);
// 8,9 = indicated or true airspeed, unit
if (line.ReadCheckedCompare(value, "KH"))
// XXX is that TAS or IAS? Documentation isn't clear.
info.ProvideBothAirspeeds(Units::ToSysUnit(value, Unit::KILOMETER_PER_HOUR));
// 10,11 = temperature, unit
info.temperature_available =
line.ReadCheckedCompare(value, "C");
if (info.temperature_available)
info.temperature = CelsiusToKelvin(value);
return true;
}
示例13: LXWP2
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;
}
示例14: if
/**
* Parses a GLL sentence
*
* $--GLL,llll.ll,a,yyyyy.yy,a,hhmmss.ss,a,m,*hh
*
* Field Number:
* 1) Latitude
* 2) N or S (North or South)
* 3) Longitude
* 4) E or W (East or West)
* 5) Universal Time Coordinated (UTC)
* 6) Status A - Data Valid, V - Data Invalid
* 7) FAA mode indicator (NMEA 2.3 and later)
* 8) 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::GLL(NMEAInputLine &line, NMEAInfo &info)
{
GeoPoint location;
bool valid_location = ReadGeoPoint(line, location);
fixed ThisTime = TimeModify(line.read(fixed_zero), info.date_time_utc,
info.date_available);
ThisTime = TimeAdvanceTolerance(ThisTime);
bool gpsValid = !NAVWarn(line.read_first_char());
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;
info.gps.real = real;
#ifdef ANDROID
info.gps.android_internal_gps = false;
#endif
return true;
}
示例15: vl_PGCS1
// 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;
}