Example #1
0
 public LogEntryGPS(LogEntry entry)
 {
     if (entry.HasField("TimeUS"))
     {
         // perhaps it is the old format with GWk and TimeUS
         // "QBIHBcLLeeEefB"
         GPSTime = entry.GetField<UInt64>("TimeUS"); // Q
         //byte Status = entry.GetField<byte>("Status"); // B
         //uint GMS = entry.GetField<UInt32>("GMS"); // I
         ushort GWk = entry.GetField<UInt16>("GWk"); // H
         nSat = entry.GetField<byte>("NSats"); // B
         EPH = (float)entry.GetField<double>("HDop"); // c
         Lat = entry.GetField<double>("Lat"); // L
         Lon = entry.GetField<double>("Lng"); // L
         //double RAlt = entry.GetField<double>("RAlt"); // e
         Alt = (float)entry.GetField<double>("Alt"); // e
         //double spd = entry.GetField<double>("Spd"); // E
         //double gcrs = entry.GetField<float>("GCrs"); // e
         //double vz = entry.GetField<float>("VZ"); // f
         //byte u = entry.GetField<byte>("U"); // B
     }
     else if (entry.HasField("GPSTime"))
     {
         GPSTime = entry.GetField<UInt64>("GPSTime");
         Fix = entry.GetField<byte>("Fix");
         EPH = entry.GetField<float>("EPH");
         EPV = entry.GetField<float>("EPV");
         Lat = (double)entry.GetField<Int32>("Lat") / 1E7;
         Lon = (double)entry.GetField<UInt64>("Lon") / 1E7;
         Alt = entry.GetField<float>("Alt");
         VelN = entry.GetField<float>("VelN");
         VelE = entry.GetField<float>("VelE");
         VelD = entry.GetField<float>("VelD");
         Cog = entry.GetField<float>("Cog");
         nSat = entry.GetField<byte>("nSat");
         SNR = entry.GetField<UInt16>("SNR");
         N = entry.GetField<UInt16>("N");
         J = entry.GetField<UInt16>("J");
     }
     else if (entry.HasField("time_usec"))
     {
         GPSTime = entry.GetField<UInt64>("time_usec") / 1000;
         Fix = entry.GetField<byte>("fix_type");
         EPH = entry.GetField<float>("eph");
         EPV = entry.GetField<float>("epv");
         Lat = (double)entry.GetField<Int32>("lat") / 1E7;
         Lon = (double)entry.GetField<UInt64>("lon") / 1E7;
         Alt = entry.GetField<float>("alt");
         VelN = entry.GetField<float>("Vel");
         Cog = entry.GetField<float>("cog");
         nSat = entry.GetField<byte>("satellites_visible");
     }
 }