X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosui%2FAltosScanUI.java;h=419fe9577acc4632ef4b710552277f1583acf994;hb=2f196323a2829f9537f3b339f19478127ffde623;hp=9da1290fd846d342a98ce93d7a2e1e1d92c0e519;hpb=e2b458a448106ba1ab207f0ea6824b56927d8547;p=fw%2Faltos diff --git a/altosui/AltosScanUI.java b/altosui/AltosScanUI.java index 9da1290f..419fe957 100644 --- a/altosui/AltosScanUI.java +++ b/altosui/AltosScanUI.java @@ -20,15 +20,13 @@ package altosui; import java.awt.*; import java.awt.event.*; import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*; import javax.swing.event.*; import java.io.*; import java.util.*; import java.text.*; -import java.util.prefs.*; import java.util.concurrent.*; -import org.altusmetrum.AltosLib.*; +import org.altusmetrum.altoslib_3.*; +import org.altusmetrum.altosuilib_1.*; class AltosScanResult { String callsign; @@ -36,9 +34,9 @@ class AltosScanResult { int flight; AltosFrequency frequency; int telemetry; - + boolean interrupted = false; - + public String toString() { return String.format("%-9.9s serial %-4d flight %-4d (%s %s)", callsign, serial, flight, frequency.toShortString(), Altos.telemetry_name(telemetry)); @@ -78,7 +76,7 @@ class AltosScanResult { } class AltosScanResults extends LinkedList implements ListModel { - + LinkedList listeners = new LinkedList(); void changed(ListDataEvent de) { @@ -109,7 +107,7 @@ class AltosScanResults extends LinkedList implements ListModel public void addListDataListener(ListDataListener l) { listeners.add(l); } - + public void removeListDataListener(ListDataListener l) { listeners.remove(l); } @@ -124,7 +122,7 @@ class AltosScanResults extends LinkedList implements ListModel } public class AltosScanUI - extends AltosDialog + extends AltosUIDialog implements ActionListener { AltosUI owner; @@ -186,13 +184,13 @@ public class AltosScanUI try { for (;;) { try { - AltosRecord record = reader.read(); - if (record == null) + AltosState state = reader.read(); + if (state == null) continue; - if ((record.seen & AltosRecord.seen_flight) != 0) { - final AltosScanResult result = new AltosScanResult(record.callsign, - record.serial, - record.flight, + if (state.flight != AltosLib.MISSING) { + final AltosScanResult result = new AltosScanResult(state.callsign, + state.serial, + state.flight, frequencies[frequency_index], telemetry); Runnable r = new Runnable() { @@ -223,12 +221,12 @@ public class AltosScanUI void set_telemetry() { reader.set_telemetry(telemetry); } - + void set_frequency() throws InterruptedException, TimeoutException { reader.set_frequency(frequencies[frequency_index].frequency); reader.reset(); } - + void next() throws InterruptedException, TimeoutException { reader.set_monitor(false); Thread.sleep(100); @@ -330,7 +328,7 @@ public class AltosScanUI } private boolean open() { - device = AltosDeviceDialog.show(owner, Altos.product_basestation); + device = AltosDeviceUIDialog.show(owner, Altos.product_basestation); if (device == null) return false; try { @@ -404,7 +402,7 @@ public class AltosScanUI scanning_label = new JLabel("Scanning:"); frequency_label = new JLabel(""); telemetry_label = new JLabel(""); - + set_label(); c.fill = GridBagConstraints.HORIZONTAL; @@ -436,7 +434,7 @@ public class AltosScanUI } int y_offset = 3 + (Altos.ao_telemetry_max - Altos.ao_telemetry_min + 1); - + list = new JList(results) { //Subclass JList to workaround bug 4832765, which can cause the //scroll pane to not let the user easily scroll up to the beginning