import java.text.*;
import java.util.prefs.*;
import java.util.concurrent.*;
+import org.altusmetrum.AltosLib.*;
class AltosScanResult {
String callsign;
}
public class AltosScanUI
- extends JDialog
+ extends AltosDialog
implements ActionListener
{
AltosUI 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) {
}
void next() throws InterruptedException, TimeoutException {
- reader.serial.set_monitor(false);
+ reader.set_monitor(false);
Thread.sleep(100);
++frequency_index;
if (frequency_index >= frequencies.length ||
}
set_frequency();
set_label();
- reader.serial.set_monitor(true);
+ reader.set_monitor(true);
}
scanning_telemetry |= (1 << Altos.ao_telemetry_standard);
telemetry_boxes[Altos.ao_telemetry_standard - Altos.ao_telemetry_min].setSelected(true);
}
- AltosPreferences.set_scanning_telemetry(scanning_telemetry);
+ AltosUIPreferences.set_scanning_telemetry(scanning_telemetry);
}
if (cmd.equals("monitor")) {
if (device == null)
return false;
try {
- reader = new AltosTelemetryReader(device);
+ reader = new AltosTelemetryReader(new AltosSerial(device));
set_frequency();
set_telemetry();
try {
return true;
} catch (FileNotFoundException ee) {
JOptionPane.showMessageDialog(owner,
- String.format("Cannot open device \"%s\"",
- device.toShortString()),
+ ee.getMessage(),
"Cannot open target device",
JOptionPane.ERROR_MESSAGE);
} catch (AltosSerialInUseException si) {
owner = in_owner;
- frequencies = AltosPreferences.common_frequencies();
+ frequencies = AltosUIPreferences.common_frequencies();
frequency_index = 0;
telemetry = Altos.ao_telemetry_min;
c.gridy = 2;
pane.add(telemetry_label, c);
- int scanning_telemetry = AltosPreferences.scanning_telemetry();
+ int scanning_telemetry = AltosUIPreferences.scanning_telemetry();
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;