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;
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));
}
class AltosScanResults extends LinkedList<AltosScanResult> implements ListModel {
-
+
LinkedList<ListDataListener> listeners = new LinkedList<ListDataListener>();
void changed(ListDataEvent de) {
public void addListDataListener(ListDataListener l) {
listeners.add(l);
}
-
+
public void removeListDataListener(ListDataListener l) {
listeners.remove(l);
}
}
public class AltosScanUI
- extends AltosDialog
+ extends AltosUIDialog
implements ActionListener
{
AltosUI owner;
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() {
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);
}
private boolean open() {
- device = AltosDeviceDialog.show(owner, Altos.product_basestation);
+ device = AltosDeviceUIDialog.show(owner, Altos.product_basestation);
if (device == null)
return false;
try {
scanning_label = new JLabel("Scanning:");
frequency_label = new JLabel("");
telemetry_label = new JLabel("");
-
+
set_label();
c.fill = GridBagConstraints.HORIZONTAL;
}
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