summaryrefslogtreecommitdiff
path: root/altoslib/AltosState.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-11-15 16:03:32 -0800
committerKeith Packard <keithp@keithp.com>2014-11-15 16:03:32 -0800
commit60edcfe410e7fa848813d6c1ed8dc9808887d041 (patch)
treebfb98fbc2806d9c76d0eab1fb348a0b7976c753a /altoslib/AltosState.java
parent4d4fee0b0091a1b6257a06f62b1078778cdb417f (diff)
altoslib: Make AltosState serializable
This involved making every class it references serializable as well Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosState.java')
-rw-r--r--altoslib/AltosState.java24
1 files changed, 13 insertions, 11 deletions
diff --git a/altoslib/AltosState.java b/altoslib/AltosState.java
index 830e95f3..5be008b7 100644
--- a/altoslib/AltosState.java
+++ b/altoslib/AltosState.java
@@ -21,7 +21,9 @@
package org.altusmetrum.altoslib_5;
-public class AltosState implements Cloneable {
+import java.io.*;
+
+public class AltosState implements Cloneable, Serializable {
public static final int set_position = 1;
public static final int set_gps = 2;
@@ -43,7 +45,7 @@ public class AltosState implements Cloneable {
private int prev_tick;
public int boost_tick;
- class AltosValue {
+ class AltosValue implements Serializable{
double value;
double prev_value;
private double max_value;
@@ -179,9 +181,9 @@ public class AltosState implements Cloneable {
}
}
- class AltosCValue {
+ class AltosCValue implements Serializable {
- class AltosIValue extends AltosValue {
+ class AltosIValue extends AltosValue implements Serializable {
boolean can_max() {
return c_can_max();
}
@@ -312,7 +314,7 @@ public class AltosState implements Cloneable {
ground_altitude.set_measured(a, time);
}
- class AltosGpsGroundAltitude extends AltosValue {
+ class AltosGpsGroundAltitude extends AltosValue implements Serializable {
void set(double a, double t) {
super.set(a, t);
pad_alt = value();
@@ -336,7 +338,7 @@ public class AltosState implements Cloneable {
gps_ground_altitude.set(a, time);
}
- class AltosGroundPressure extends AltosCValue {
+ class AltosGroundPressure extends AltosCValue implements Serializable {
void set_filtered(double p, double time) {
computed.set_filtered(p, time);
if (!is_measured())
@@ -359,7 +361,7 @@ public class AltosState implements Cloneable {
ground_pressure.set_measured(pressure, time);
}
- class AltosAltitude extends AltosCValue {
+ class AltosAltitude extends AltosCValue implements Serializable {
private void set_speed(AltosValue v) {
if (!acceleration.is_measured() || !ascent)
@@ -381,7 +383,7 @@ public class AltosState implements Cloneable {
private AltosAltitude altitude;
- class AltosGpsAltitude extends AltosValue {
+ class AltosGpsAltitude extends AltosValue implements Serializable {
private void set_gps_height() {
double a = value();
@@ -464,7 +466,7 @@ public class AltosState implements Cloneable {
return gps_speed.max();
}
- class AltosPressure extends AltosValue {
+ class AltosPressure extends AltosValue implements Serializable {
void set(double p, double time) {
super.set(p, time);
if (state == AltosLib.ao_flight_pad)
@@ -534,7 +536,7 @@ public class AltosState implements Cloneable {
return AltosLib.MISSING;
}
- class AltosSpeed extends AltosCValue {
+ class AltosSpeed extends AltosCValue implements Serializable {
boolean can_max() {
return state < AltosLib.ao_flight_fast || state == AltosLib.ao_flight_stateless;
@@ -588,7 +590,7 @@ public class AltosState implements Cloneable {
return AltosLib.MISSING;
}
- class AltosAccel extends AltosCValue {
+ class AltosAccel extends AltosCValue implements Serializable {
boolean can_max() {
return state < AltosLib.ao_flight_fast || state == AltosLib.ao_flight_stateless;