igc.cc
changeset 11 d927333c8ffe
parent 10 e1abdc480485
child 12 84b0f3ca474a
--- a/igc.cc	Sun Jan 22 16:31:20 2012 +0100
+++ b/igc.cc	Sun Jan 22 17:35:21 2012 +0100
@@ -11,12 +11,24 @@
 		      QString line  = in.readLine();
 		      QString key   = line.section(':', 0, 0);
 		      QString value = line.section(':', 1, 1).simplified();
-		      qDebug() << key << "--" << value;
-		      if (key == "FPLTPILOT") thePilot = value;
-		      if (key == "FGTYGLIDERTYPE") theGlider = value;
+		      if (key.startsWith("FPLT")) thePilot = value;
+		      if (key.startsWith("FGTY")) theGlider = value;
 		      }
 		      break;
-	    case 'B': points << in.readLine(); break;
+	    case 'B': fixes << in.readLine(); break;
 	}
     }
 }
+
+Fix::Fix(const QString &s)
+{
+    int pos = 0;
+    theTime = s.mid(pos, 6); pos += 6;
+    gps.lat = s.mid(pos, 8); pos += 8;
+    gps.lon = s.mid(pos, 9); pos += 9;
+    valid = s.mid(pos, 1); pos += 1;
+    theAlt.press = s.mid(pos, 5).toInt(); pos += 5;
+    theAlt.gps = s.mid(pos, 5).toInt(); pos += 5;
+
+    qDebug() << theAlt.press << " | " << theAlt.gps;
+}