altoslib: Only open log file when both flight and serial are known
[fw/altos] / altoslib / AltosLog.java
index 7f69bb65afea25e4082f5b1f2e7ae2649914f9e8..ed59ef713eb44cd1a27c58e9cbbdefe5157a81b2 100644 (file)
@@ -15,7 +15,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_2;
 
 import java.io.*;
 import java.text.ParseException;
@@ -84,7 +84,7 @@ public class AltosLog implements Runnable {
                                if (line.line == null)
                                        continue;
                                try {
-                                       AltosTelemetry  telem = new AltosTelemetryLegacy(line.line);
+                                       AltosTelemetry  telem = AltosTelemetry.parse(line.line);
                                        if (state != null)
                                                state = state.clone();
                                        else
@@ -95,7 +95,8 @@ public class AltosLog implements Runnable {
                                                close_log_file();
                                                serial = state.serial;
                                                flight = state.flight;
-                                               open(state);
+                                               if (state.serial != AltosLib.MISSING && state.flight != AltosLib.MISSING)
+                                                       open(state);
                                        }
                                } catch (ParseException pe) {
                                } catch (AltosCRCException ce) {