public String toString() {
return String.format("%-9.9s serial %-4d flight %-4d (%s %s)",
callsign, serial, flight, frequency.toShortString(), Altos.telemetry_name(telemetry));
public String toString() {
return String.format("%-9.9s serial %-4d flight %-4d (%s %s)",
callsign, serial, flight, frequency.toShortString(), Altos.telemetry_name(telemetry));
- for (AltosScanResult old : this)
- if (old.equals(r))
+ int i = 0;
+ for (AltosScanResult old : this) {
+ if (old.equals(r)) {
+ if (!old.up_to_date(r))
+ changed (new ListDataEvent(this,
+ ListDataEvent.CONTENTS_CHANGED,
+ i, i));
- ListDataEvent de = new ListDataEvent(this,
- ListDataEvent.INTERVAL_ADDED,
- this.size() - 2, this.size() - 1);
- for (ListDataListener l : listeners)
- l.contentsChanged(de);
+ changed(new ListDataEvent(this,
+ ListDataEvent.INTERVAL_ADDED,
+ this.size() - 2, this.size() - 1));
void scan_exception(Exception e) {
if (e instanceof FileNotFoundException) {
JOptionPane.showMessageDialog(owner,
void scan_exception(Exception e) {
if (e instanceof FileNotFoundException) {
JOptionPane.showMessageDialog(owner,
- String.format("Cannot open device \"%s\"",
- device.toShortString()),
+ ((FileNotFoundException) e).getMessage(),
"Cannot open target device",
JOptionPane.ERROR_MESSAGE);
} else if (e instanceof AltosSerialInUseException) {
"Cannot open target device",
JOptionPane.ERROR_MESSAGE);
} else if (e instanceof AltosSerialInUseException) {
- 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() {
frequencies[frequency_index],
telemetry);
Runnable r = new Runnable() {
void set_frequency() throws InterruptedException, TimeoutException {
reader.set_frequency(frequencies[frequency_index].frequency);
void set_frequency() throws InterruptedException, TimeoutException {
reader.set_frequency(frequencies[frequency_index].frequency);
scanning_telemetry |= (1 << Altos.ao_telemetry_standard);
telemetry_boxes[Altos.ao_telemetry_standard - Altos.ao_telemetry_min].setSelected(true);
}
scanning_telemetry |= (1 << Altos.ao_telemetry_standard);
telemetry_boxes[Altos.ao_telemetry_standard - Altos.ao_telemetry_min].setSelected(true);
}
return true;
} catch (FileNotFoundException ee) {
JOptionPane.showMessageDialog(owner,
return true;
} catch (FileNotFoundException ee) {
JOptionPane.showMessageDialog(owner,
"Cannot open target device",
JOptionPane.ERROR_MESSAGE);
} catch (AltosSerialInUseException si) {
"Cannot open target device",
JOptionPane.ERROR_MESSAGE);
} catch (AltosSerialInUseException si) {
scanning_label = new JLabel("Scanning:");
frequency_label = new JLabel("");
telemetry_label = new JLabel("");
scanning_label = new JLabel("Scanning:");
frequency_label = new JLabel("");
telemetry_label = new JLabel("");
telemetry_boxes = new JCheckBox[Altos.ao_telemetry_max - Altos.ao_telemetry_min + 1];
for (int k = Altos.ao_telemetry_min; k <= Altos.ao_telemetry_max; k++) {
int j = k - Altos.ao_telemetry_min;
telemetry_boxes = new JCheckBox[Altos.ao_telemetry_max - Altos.ao_telemetry_min + 1];
for (int k = Altos.ao_telemetry_min; k <= Altos.ao_telemetry_max; k++) {
int j = k - Altos.ao_telemetry_min;
c.gridy = 3 + j;
pane.add(telemetry_boxes[j], c);
telemetry_boxes[j].setActionCommand("telemetry");
c.gridy = 3 + j;
pane.add(telemetry_boxes[j], c);
telemetry_boxes[j].setActionCommand("telemetry");
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
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