X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altoslib%2FAltosTelemetryConfiguration.java;h=b5f0eb4b821893074b99f1d5ad702961c09b090b;hp=e5d444dd2099beadc728addd9fe0a4180d7b49c6;hb=a61217f0a6d0ef48b6471f632c4600255867e831;hpb=5b976a6651f4eb05d30afc08b9e1f27c7e52ae00 diff --git a/altoslib/AltosTelemetryConfiguration.java b/altoslib/AltosTelemetryConfiguration.java index e5d444dd..b5f0eb4b 100644 --- a/altoslib/AltosTelemetryConfiguration.java +++ b/altoslib/AltosTelemetryConfiguration.java @@ -3,7 +3,8 @@ * * 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 @@ -15,41 +16,36 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_2; +package org.altusmetrum.altoslib_12; public class AltosTelemetryConfiguration extends AltosTelemetryStandard { - int device_type; - int flight; - int config_major; - int config_minor; - int apogee_delay; - int main_deploy; - int flight_log_max; - String callsign; - String version; + int device_type() { return uint8(5); } + int flight() { return uint16(6); } + int config_major() { return uint8(8); } + int config_minor() { return uint8(9); } + int apogee_delay() { return uint16(10); } + int main_deploy() { return uint16(12); } + int v_batt() { return uint16(10); } + int flight_log_max() { return uint16(14); } + String callsign() { return string(16, 8); } + String version() { return string(24, 8); } - public AltosTelemetryConfiguration(int[] bytes) { + public AltosTelemetryConfiguration(int[] bytes) throws AltosCRCException { super(bytes); - - device_type = uint8(5); - flight = uint16(6); - config_major = uint8(8); - config_minor = uint8(9); - apogee_delay = uint16(10); - main_deploy = uint16(12); - flight_log_max = uint16(14); - callsign = string(16, 8); - version = string(24, 8); } - public void update_state(AltosState state) { - super.update_state(state); - state.set_device_type(device_type); - state.set_flight(flight); - state.set_config(config_major, config_minor, apogee_delay, main_deploy, flight_log_max); + public void provide_data(AltosDataListener listener, AltosCalData cal_data) { + super.provide_data(listener, cal_data); + cal_data.set_device_type(device_type()); + cal_data.set_flight(flight()); + cal_data.set_config(config_major(), config_minor(), flight_log_max()); + if (device_type() == AltosLib.product_telegps) + listener.set_battery_voltage(AltosConvert.tele_gps_voltage(v_batt())); + else + cal_data.set_flight_params(apogee_delay() / 100.0, main_deploy()); - state.set_callsign(callsign); - state.set_firmware_version(version); + cal_data.set_callsign(callsign()); + cal_data.set_firmware_version(version()); } }