altosui: Complete split out of separate java library
[fw/altos] / altosui / AltosDataPointReader.java
index 4335421c21a96922e0ef0f3bf6f3026efcdcfb3f..821b0771b7f7101ee200dd358822b34958020a3c 100644 (file)
@@ -9,6 +9,7 @@ import java.text.ParseException;
 import java.lang.UnsupportedOperationException;
 import java.util.NoSuchElementException;
 import java.util.Iterator;
+import org.altusmetrum.AltosLib.*;
 
 class AltosDataPointReader implements Iterable<AltosDataPoint> {
     Iterator<AltosRecord> iter;
@@ -59,6 +60,7 @@ class AltosDataPointReader implements Iterable<AltosDataPoint> {
             public double battery_voltage() { return record.battery_voltage(); }
             public double drogue_voltage() { return record.drogue_voltage(); }
             public double main_voltage() { return record.main_voltage(); }
+           public boolean has_accel() { return has_accel; }
         };
     }
 
@@ -68,10 +70,14 @@ class AltosDataPointReader implements Iterable<AltosDataPoint> {
                 throw new UnsupportedOperationException(); 
             }
             public boolean hasNext() {
+               if (record != null && record.state == Altos.ao_flight_landed)
+                   return false;
                 return iter.hasNext();
             }
             public AltosDataPoint next() {
-                read_next_record();
+               do {
+                   read_next_record();
+               } while (record.time < -1.0 && hasNext());
                 return current_dp();
             }
         };