String name;
AltosFlightReader reader;
int crc_errors;
- AltosStatusTable flightStatus;
- AltosInfoTable flightInfo;
+ AltosFlightDisplay display;
class IdleThread extends Thread {
}
void show(AltosState state, int crc_errors) {
- if (state != null) {
- flightStatus.set(state);
- flightInfo.show(state, crc_errors);
- }
+ if (state != null)
+ display.show(state, crc_errors);
}
public void run() {
idle_thread = new IdleThread();
- flightInfo.clear();
+ display.reset();
try {
for (;;) {
try {
}
}
- public AltosDisplayThread(Frame in_parent, AltosVoice in_voice, AltosStatusTable in_status, AltosInfoTable in_info, AltosFlightReader in_reader) {
+ public AltosDisplayThread(Frame in_parent, AltosVoice in_voice, AltosFlightDisplay in_display, AltosFlightReader in_reader) {
parent = in_parent;
voice = in_voice;
- flightStatus = in_status;
- flightInfo = in_info;
+ display = in_display;
reader = in_reader;
}
}
--- /dev/null
+/*
+ * Copyright © 2010 Keith Packard <keithp@keithp.com>
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+package altosui;
+
+public interface AltosFlightDisplay {
+ void reset();
+
+ void show(AltosState state, int crc_errors);
+}
import java.util.prefs.*;
import java.util.concurrent.LinkedBlockingQueue;
-public class AltosFlightUI extends JFrame {
+public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
String[] statusNames = { "Height (m)", "State", "RSSI (dBm)", "Speed (m/s)" };
Object[][] statusData = { { "0", "pad", "-50", "0" } };
stop_display();
}
+ public void reset() {
+ flightInfo.clear();
+ }
+
+ public void show(AltosState state, int crc_errors) {
+ flightStatus.set(state);
+ flightInfo.show(state, crc_errors);
+ }
+
public AltosFlightUI(AltosVoice in_voice, AltosFlightReader in_reader, final int serial) {
voice = in_voice;
reader = in_reader;
this.setVisible(true);
- thread = new AltosDisplayThread(this, voice, flightStatus, flightInfo, reader);
+ thread = new AltosDisplayThread(this, voice, this, reader);
thread.start();
}
AltosFile.java \
AltosFlash.java \
AltosFlashUI.java \
+ AltosFlightDisplay.java \
AltosFlightInfoTableModel.java \
AltosFlightReader.java \
AltosFlightStatusTableModel.java \