*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_3;
+package org.altusmetrum.altoslib_12;
import java.text.*;
* g_v GPS vertical speed (integer, cm/sec)
* g_s GPS horizontal speed (integer, cm/sec)
* g_c GPS course (integer, 0-359)
+ * g_pd GPS pdop (integer * 10)
* g_hd GPS hdop (integer * 10)
* g_vd GPS vdop (integer * 10)
* g_he GPS h error (integer)
final static String AO_TELEM_GPS_VERTICAL_SPEED = "g_v";
final static String AO_TELEM_GPS_HORIZONTAL_SPEED = "g_g";
final static String AO_TELEM_GPS_COURSE = "g_c";
+ final static String AO_TELEM_GPS_PDOP = "g_pd";
final static String AO_TELEM_GPS_HDOP = "g_hd";
final static String AO_TELEM_GPS_VDOP = "g_vd";
final static String AO_TELEM_GPS_HERROR = "g_he";
final static String AO_TELEM_SAT_SVID = "s_v";
final static String AO_TELEM_SAT_C_N_0 = "s_c";
+ public int tick;
+ public int serial;
+ public int rssi;
+ public int status;
+
+ public int tick() { return tick; }
+ public int serial() { return serial; }
+
+ public int rssi() { return rssi; }
+ public int status() { return status; }
+
public int version;
public String callsign;
public int flight;
flight = map.get_int(AO_TELEM_FLIGHT, AltosLib.MISSING);
rssi = map.get_int(AO_TELEM_RSSI, AltosLib.MISSING);
state = AltosLib.state(map.get_string(AO_TELEM_STATE, "invalid"));
- tick = map.get_int(AO_TELEM_TICK, 0);
/* raw sensor values */
accel = map.get_int(AO_TELEM_RAW_ACCEL, AltosLib.MISSING);
* Given a hex dump of a legacy telemetry line, construct an AltosRecordTM from that
*/
- int[] bytes;
int adjust;
/*
static final int AO_GPS_DATE_VALID = (1 << 6);
static final int AO_GPS_COURSE_VALID = (1 << 7);
- public AltosTelemetryLegacy(int[] in_bytes) {
- bytes = in_bytes;
+ public AltosTelemetryLegacy(int[] in_bytes) throws AltosCRCException {
+ super(in_bytes);
+
version = 4;
adjust = 0;
} else
serial = uint16(0);
+ rssi = super.rssi();
callsign = string(62, 8);
flight = uint16(2);
state = uint8(4);
}
}
- public void update_state(AltosState state) {
- state.set_tick(tick);
- state.set_state(this.state);
- state.set_flight(flight);
- state.set_serial(serial);
- state.set_rssi(rssi, status);
+ public void provide_data(AltosDataListener listener) {
+ listener.set_serial(serial);
+ listener.set_tick(tick);
+ listener.set_state(this.state);
+ listener.set_flight(flight);
+ listener.set_rssi(rssi, status);
+
+ listener.set_pressure(AltosConvert.barometer_to_pressure(pres));
+
+ AltosCalData cal_data = listener.cal_data();
- state.set_pressure(AltosConvert.barometer_to_pressure(pres));
- state.set_accel_g(accel_plus_g, accel_minus_g);
- state.set_accel(accel);
+ cal_data.set_accel_plus_minus(accel_plus_g, accel_minus_g);
+ listener.set_acceleration(cal_data.acceleration(accel));
if (kalman_height != AltosLib.MISSING)
- state.set_kalman(kalman_height, kalman_speed, kalman_acceleration);
- state.set_temperature(AltosConvert.thermometer_to_temperature(temp));
- state.set_battery_voltage(AltosConvert.cc_battery_to_voltage(batt));
- state.set_apogee_voltage(AltosConvert.cc_ignitor_to_voltage(apogee));
- state.set_main_voltage(AltosConvert.cc_ignitor_to_voltage(main));
+ listener.set_kalman(kalman_height, kalman_speed, kalman_acceleration);
+ listener.set_temperature(AltosConvert.thermometer_to_temperature(temp));
+ listener.set_battery_voltage(AltosConvert.cc_battery_to_voltage(batt));
+ listener.set_apogee_voltage(AltosConvert.cc_igniter_to_voltage(apogee));
+ listener.set_main_voltage(AltosConvert.cc_igniter_to_voltage(main));
if (gps != null)
- state.set_gps(gps, gps_sequence);
+ listener.set_gps(gps);
}
}