2 * Copyright © 2017 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
15 package org.altusmetrum.altoslib_11;
17 public abstract class AltosFlightListener {
25 int temp_gps_sat_tick;
27 /* AltosEepromRecord */
28 public void set_boost_tick(int boost_tick) {
29 if (boost_tick != AltosLib.MISSING)
30 this.boost_tick = boost_tick;
33 public void set_tick(int tick) {
34 if (tick != AltosLib.MISSING)
38 public double time() {
39 if (tick == AltosLib.MISSING)
40 return AltosLib.MISSING;
44 public double boost_time() {
45 if (boost_tick == AltosLib.MISSING)
46 return AltosLib.MISSING;
47 return boost_tick / 100.0;
50 /* AltosEepromRecordFull */
52 public abstract void set_state(int state);
53 public abstract void set_ground_accel(double ground_accel);
54 public void set_flight(int flight) {
55 if (flight != AltosLib.MISSING)
62 public abstract void set_accel(double accel);
63 public abstract void set_accel_g(double accel_plus_g, double accel_minus_g);
64 public abstract void set_pressure(double pa);
66 public abstract void set_temperature(double deg_c);
67 public abstract void set_battery_voltage(double volts);
69 public abstract void set_apogee_voltage(double volts);
70 public abstract void set_main_voltage(double volts);
72 public void set_temp_gps() {
76 public boolean gps_pending() {
77 return temp_gps != null;
80 public AltosGPS make_temp_gps(boolean sats) {
81 if (temp_gps == null) {
82 temp_gps = new AltosGPS();
85 if (tick != temp_gps_sat_tick)
86 temp_gps.cc_gps_sat = null;
87 temp_gps_sat_tick = tick;
92 public abstract void set_ground_pressure(double ground_pressure);
93 public abstract void set_accel_ground(double along, double across, double through);
94 public abstract void set_gyro_zero(double roll, double pitch, double yaw);
95 public abstract void set_ms5607(int pres_val, int temp_val);
96 public abstract void check_imu_wrap(AltosIMU imu);
97 public abstract void set_imu(AltosIMU imu);
98 public abstract void set_mag(AltosMag mag);
99 public abstract void set_pyro_voltage(double volts);
100 public abstract void set_ignitor_voltage(double[] voltage);
101 public abstract void set_pyro_fired(int pyro_mask);
103 public void copy(AltosFlightListener old) {
106 boost_tick = old.boost_tick;
107 temp_gps = old.temp_gps;
108 temp_gps_sat_tick = old.temp_gps_sat_tick;
112 flight = AltosLib.MISSING;
113 tick = AltosLib.MISSING;
114 boost_tick = AltosLib.MISSING;
115 temp_gps_sat_tick = AltosLib.MISSING;