altoslib: Make sure AltosFlightSeries is filled in before use
[fw/altos] / altoslib / AltosTelemetrySatellite.java
index 6897f0e6d4273e740a51ad98e2773d0c0072197b..72ddd964747597360f2f227557bb98aeb5fdc7ee 100644 (file)
 package org.altusmetrum.altoslib_11;
 
 public class AltosTelemetrySatellite extends AltosTelemetryStandard {
-       int             channels;
-       AltosGPSSat[]   sats;
+       int             channels() { return uint8(5); }
 
-       public AltosTelemetrySatellite(int[] bytes) {
-               super(bytes);
+       AltosGPSSat[]   sats() {
+               int             channels = channels();
+               AltosGPSSat[]   sats = null;
 
-               channels = uint8(5);
                if (channels > 12)
                        channels = 12;
                if (channels == 0)
@@ -38,14 +37,19 @@ public class AltosTelemetrySatellite extends AltosTelemetryStandard {
                                sats[i] = new AltosGPSSat(svid, c_n_1);
                        }
                }
+               return sats;
+       }
+
+       public AltosTelemetrySatellite(int[] bytes) throws AltosCRCException {
+               super(bytes);
        }
 
-       public void update_state(AltosState state) {
-               super.update_state(state);
+       public void provide_data(AltosDataListener listener, AltosCalData cal_data) {
+               super.provide_data(listener, cal_data);
 
-               AltosGPS        gps = state.make_temp_gps(true);
+               AltosGPS        gps = new AltosGPS();
 
-               gps.cc_gps_sat = sats;
-               state.set_temp_gps();
+               gps.cc_gps_sat = sats();
+               listener.set_gps(gps);
        }
 }