altoslib: Create new abstraction underneath AltosState for recording values
[fw/altos] / altoslib / AltosState.java
index 8c3f93f0c0e9481930dcbf195be0a2e02c118c74..6aa77139d62f81f9edd47191b51640a7367ae813 100644 (file)
@@ -24,7 +24,7 @@ package org.altusmetrum.altoslib_11;
 
 import java.io.*;
 
-public class AltosState implements Cloneable {
+public class AltosState extends AltosFlightListener implements Cloneable {
 
        public static final int set_position = 1;
        public static final int set_gps = 2;
@@ -43,9 +43,7 @@ public class AltosState implements Cloneable {
        public double   time;
        public double   prev_time;
        public double   time_change;
-       public int      tick;
        private int     prev_tick;
-       public int      boost_tick;
 
        class AltosValue {
                double  value;
@@ -870,6 +868,8 @@ public class AltosState implements Cloneable {
                        return;
                }
 
+               super.copy(old);
+
                received_time = old.received_time;
                time = old.time;
                time_change = old.time_change;
@@ -1071,11 +1071,6 @@ public class AltosState implements Cloneable {
                }
        }
 
-       public void set_boost_tick(int boost_tick) {
-               if (boost_tick != AltosLib.MISSING)
-                       this.boost_tick = boost_tick;
-       }
-
        public String state_name() {
                return AltosLib.state_name(state);
        }
@@ -1502,23 +1497,10 @@ public class AltosState implements Cloneable {
                return tick != AltosLib.MISSING && serial != AltosLib.MISSING;
        }
 
-       public AltosGPS make_temp_gps(boolean sats) {
-               if (temp_gps == null) {
-                       temp_gps = new AltosGPS(gps);
-               }
-               gps_pending = true;
-               if (sats) {
-                       if (tick != temp_gps_sat_tick)
-                               temp_gps.cc_gps_sat = null;
-                       temp_gps_sat_tick = tick;
-               }
-               return temp_gps;
-       }
-
        public void set_temp_gps() {
                set_gps(temp_gps, gps_sequence + 1);
                gps_pending = false;
-               temp_gps = null;
+               super.set_temp_gps();
        }
 
        public void set_config_data(AltosConfigData config_data) {