altosdroid: cal_data is no longer public from AltosState
authorKeith Packard <keithp@keithp.com>
Wed, 28 Jun 2017 04:33:36 +0000 (21:33 -0700)
committerKeith Packard <keithp@keithp.com>
Wed, 28 Jun 2017 04:33:36 +0000 (21:33 -0700)
Use cal_data() method instead.

Signed-off-by: Keith Packard <keithp@keithp.com>
altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java
altosdroid/src/org/altusmetrum/AltosDroid/AltosMapOffline.java
altosdroid/src/org/altusmetrum/AltosDroid/AltosVoice.java
altosdroid/src/org/altusmetrum/AltosDroid/TabPad.java
altosdroid/src/org/altusmetrum/AltosDroid/TelemetryService.java

index f648142..924ab4c 100644 (file)
@@ -70,9 +70,9 @@ class SavedState {
                        locked = state.gps.locked;
                else
                        locked = false;
-               callsign = state.cal_data.callsign;
-               serial = state.cal_data.serial;
-               flight = state.cal_data.flight;
+               callsign = state.cal_data().callsign;
+               serial = state.cal_data().serial;
+               flight = state.cal_data().flight;
                rssi = state.rssi;
        }
 }
@@ -484,20 +484,20 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener,
                                                                     state.gps.alt);
                        }
 
-                       if (saved_state == null || !same_string(saved_state.callsign, state.cal_data.callsign)) {
-                               mCallsignView.setText(state.cal_data.callsign);
+                       if (saved_state == null || !same_string(saved_state.callsign, state.cal_data().callsign)) {
+                               mCallsignView.setText(state.cal_data().callsign);
                        }
-                       if (saved_state == null || state.cal_data.serial != saved_state.serial) {
-                               if (state.cal_data.serial == AltosLib.MISSING)
+                       if (saved_state == null || state.cal_data().serial != saved_state.serial) {
+                               if (state.cal_data().serial == AltosLib.MISSING)
                                        mSerialView.setText("");
                                else
-                                       mSerialView.setText(String.format("%d", state.cal_data.serial));
+                                       mSerialView.setText(String.format("%d", state.cal_data().serial));
                        }
-                       if (saved_state == null || state.cal_data.flight != saved_state.flight) {
-                               if (state.cal_data.flight == AltosLib.MISSING)
+                       if (saved_state == null || state.cal_data().flight != saved_state.flight) {
+                               if (state.cal_data().flight == AltosLib.MISSING)
                                        mFlightView.setText("");
                                else
-                                       mFlightView.setText(String.format("%d", state.cal_data.flight));
+                                       mFlightView.setText(String.format("%d", state.cal_data().flight));
                        }
                        if (saved_state == null || state.state() != saved_state.state) {
                                if (state.state() == AltosLib.ao_flight_stateless) {
index 9909ba7..2a728cf 100644 (file)
@@ -477,11 +477,11 @@ public class AltosMapOffline extends View implements ScaleGestureDetector.OnScal
                                if (t_state.gps != null) {
                                        AltosLatLon     latlon = new AltosLatLon(t_state.gps.lat, t_state.gps.lon);
                                        rocket.set_position(latlon, t_state.received_time);
-                                       if (state.cal_data.serial == serial)
+                                       if (state.cal_data().serial == serial)
                                                there = latlon;
                                }
                                if (state != null)
-                                       rocket.set_active(state.cal_data.serial == serial);
+                                       rocket.set_active(state.cal_data().serial == serial);
                        }
                }
                if (receiver != null) {
index b85f027..fedfdb5 100644 (file)
@@ -294,7 +294,7 @@ public class AltosVoice {
                int     tell_serial = last_tell_serial;
 
                if (state != null)
-                       tell_serial = state.cal_data.serial;
+                       tell_serial = state.cal_data().serial;
 
                if (tell_serial != last_tell_serial)
                        reset_last();
index 6fdd39d..ba5afba 100644 (file)
@@ -191,7 +191,7 @@ public class TabPad extends AltosDroidTab {
                                ignite_lights[i].set(voltage >= AltosLib.ao_igniter_good, voltage == AltosLib.MISSING);
                        }
 
-                       if (state.cal_data.flight != 0) {
+                       if (state.cal_data().flight != 0) {
                                if (state.state() <= AltosLib.ao_flight_pad)
                                        data_logging_view.setText("Ready to record");
                                else if (state.state() < AltosLib.ao_flight_landed)
@@ -201,7 +201,7 @@ public class TabPad extends AltosDroidTab {
                        } else {
                                data_logging_view.setText("Storage full");
                        }
-                       data_logging_lights.set(state.cal_data.flight != 0, state.cal_data.flight == AltosLib.MISSING);
+                       data_logging_lights.set(state.cal_data().flight != 0, state.cal_data().flight == AltosLib.MISSING);
 
                        if (state.gps != null) {
                                int soln = state.gps.nsat;
index f976e05..caf288a 100644 (file)
@@ -263,7 +263,7 @@ public class TelemetryService extends Service implements AltosIdleMonitorListene
                        state = telemetry_state.states.get(telem.serial());
                else
                        state = new AltosState(new AltosCalData());
-               telem.provide_data(state, state.cal_data);
+               telem.provide_data(state);
                telemetry_state.states.put(telem.serial(), state);
                telemetry_state.quiet = false;
                if (state != null) {
@@ -628,7 +628,7 @@ public class TelemetryService extends Service implements AltosIdleMonitorListene
 
                                AltosDebug.debug("recovered old state serial %d flight %d",
                                                 serial,
-                                                saved_state.cal_data.flight);
+                                                saved_state.cal_data().flight);
                                if (saved_state.gps != null)
                                        AltosDebug.debug("\tposition %f,%f",
                                                         saved_state.gps.lat,
@@ -702,7 +702,7 @@ public class TelemetryService extends Service implements AltosIdleMonitorListene
 
        /* AltosIdleMonitorListener */
        public void update(AltosState state, AltosListenerState listener_state) {
-               telemetry_state.states.put(state.cal_data.serial, state);
+               telemetry_state.states.put(state.cal_data().serial, state);
                telemetry_state.receiver_battery = listener_state.battery;
                send_to_clients();
        }