altoslib: Add tilt and pyro data to CSV export
[fw/altos] / altoslib / AltosDataListener.java
1 /*
2  * Copyright © 2017 Keith Packard <keithp@keithp.com>
3  *
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.
8  *
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.
13  */
14
15 package org.altusmetrum.altoslib_12;
16
17 public abstract class AltosDataListener {
18
19         private AltosCalData    cal_data = null;
20
21         public double           time = AltosLib.MISSING;
22         public int              state = AltosLib.MISSING;
23         public double           frequency = AltosLib.MISSING;
24
25         public void set_tick(int tick) {
26                 cal_data.set_tick(tick);
27                 set_time(cal_data.time());
28         }
29
30         public AltosCalData cal_data() {
31                 if (cal_data == null)
32                         cal_data = new AltosCalData();
33                 return cal_data;
34         }
35
36         public void set_time(double time) {
37                 if (time != AltosLib.MISSING)
38                         this.time = time;
39         }
40
41         public void set_serial(int serial) {
42                 cal_data().set_serial(serial);
43         }
44
45         public double time() {
46                 return time;
47         }
48
49         public void set_state(int state) {
50                 cal_data().set_state(state);
51                 if (state != AltosLib.MISSING)
52                         this.state = state;
53         }
54
55         public void set_flight(int flight) {
56                 cal_data().set_flight(flight);
57         }
58
59         public void set_frequency(double frequency) {
60                 this.frequency = frequency;
61         }
62
63         /* Called after all records are captured */
64         public void finish() {
65         }
66
67         public abstract void set_rssi(int rssi, int status);
68         public abstract void set_received_time(long received_time);
69
70         public abstract void set_acceleration(double accel);
71         public abstract void set_pressure(double pa);
72         public abstract void set_thrust(double N);
73
74         public abstract void set_kalman(double height, double speed, double accel);
75
76         public abstract void set_temperature(double deg_c);
77         public abstract void set_battery_voltage(double volts);
78
79         public abstract void set_apogee_voltage(double volts);
80         public abstract void set_main_voltage(double volts);
81
82         public abstract void set_gps(AltosGPS gps);
83
84         public abstract void set_orient(double orient);
85         public abstract void set_gyro(double roll, double pitch, double yaw);
86         public abstract void set_accel_ground(double along, double across, double through);
87         public abstract void set_accel(double along, double across, double through);
88         public abstract void set_mag(double along, double across, double through);
89         public abstract void set_pyro_voltage(double volts);
90         public abstract void set_igniter_voltage(double[] voltage);
91         public abstract void set_pyro_fired(int pyro_mask);
92         public abstract void set_companion(AltosCompanion companion);
93
94         public AltosDataListener() {
95         }
96
97         public AltosDataListener(AltosCalData cal_data) {
98                 this.cal_data = cal_data;
99         }
100 }