Ejemplo n.º 1
0
void
IGCWriter::LogPoint(const NMEAInfo& gps_info)
{
    if (!last_valid_point_initialized &&
            ((gps_info.gps_altitude < fixed(-100))
             || (gps_info.baro_altitude < fixed(-100))
             || !gps_info.location_available))
        return;

    IGCFix fix;
    if (!gps_info.location_available) {
        fix = last_valid_point;
        fix.gps_valid = false;
    } else {
        fix.gps_valid = true;
        fix.location = gps_info.location;
        fix.gps_altitude = (int)gps_info.gps_altitude;

        // save last active fix location
        last_valid_point = fix;
        last_valid_point_initialized = true;
    }

    fix.time = gps_info.date_time_utc;
    fix.pressure_altitude =
        gps_info.baro_altitude_available ? (int)gps_info.baro_altitude :
        /* fall back to GPS altitude */
        fix.gps_altitude;

    LogPoint(fix, (int)GetEPE(gps_info.gps), GetSIU(gps_info.gps));
}
Ejemplo n.º 2
0
void
IGCWriter::LogPoint(const NMEA_INFO& gps_info)
{
  char szBRecord[500];
  int iSIU = GetSIU(gps_info);
  fixed dEPE = GetEPE(gps_info);
  LogPoint_GPSPosition p;

  char IsValidFix;

  // if at least one GPS fix comes from the simulator, disable signing
  if (gps_info.gps.Simulator)
    Simulator = true;

  if (!Simulator) {
    const char *p = frecord.update(gps_info.gps.SatelliteIDs,
                                   gps_info.DateTime, gps_info.Time,
                                   gps_info.gps.NAVWarning);
    if (p != NULL)
      writeln(p);
  }

  if (!LastValidPoint.Initialized &&
      ((gps_info.GPSAltitude < fixed(-100))
       || (gps_info.BaroAltitude < fixed(-100))
          || gps_info.gps.NAVWarning))
    return;


  if (gps_info.gps.NAVWarning) {
    IsValidFix = 'V'; // invalid
    p = LastValidPoint;
  } else {
    IsValidFix = 'A'; // Active
    // save last active fix location
    p = LastValidPoint = gps_info;
  }

  char *q = szBRecord;
  sprintf(q, "B%02d%02d%02d",
          gps_info.DateTime.hour, gps_info.DateTime.minute,
          gps_info.DateTime.second);
  q += strlen(q);

  q = igc_format_location(q, p.Location);

  sprintf(q, "%c%05d%05d%03d%02d",
          IsValidFix, (int)gps_info.BaroAltitude, p.GPSAltitude,
          (int)dEPE, iSIU);

  writeln(szBRecord);
}