X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=ao-tools%2Faltosui%2FAltosConfig.java;h=09e204a9de3e9f7e7077937548d19c886f2db0f7;hb=257e97137325f5dbbd6aa034f20fd6937b67df90;hp=b7474f3b2fa56faea8ee6d14858da68916e064f1;hpb=a6f30fae906bd87dff192c5fd4d10df283f99930;p=fw%2Faltos diff --git a/ao-tools/altosui/AltosConfig.java b/ao-tools/altosui/AltosConfig.java index b7474f3b..09e204a9 100644 --- a/ao-tools/altosui/AltosConfig.java +++ b/ao-tools/altosui/AltosConfig.java @@ -28,20 +28,6 @@ import java.text.*; import java.util.prefs.*; import java.util.concurrent.LinkedBlockingQueue; -import altosui.Altos; -import altosui.AltosSerial; -import altosui.AltosSerialMonitor; -import altosui.AltosRecord; -import altosui.AltosTelemetry; -import altosui.AltosState; -import altosui.AltosDeviceDialog; -import altosui.AltosPreferences; -import altosui.AltosLog; -import altosui.AltosVoice; -import altosui.AltosFlightStatusTableModel; -import altosui.AltosFlightInfoTableModel; -import altosui.AltosConfigUI; - import libaltosJNI.*; public class AltosConfig implements Runnable, ActionListener { @@ -245,10 +231,9 @@ public class AltosConfig implements Runnable, ActionListener { product = new string_ref("unknown"); device = AltosDeviceDialog.show(owner, AltosDevice.product_any); - serial_line = new AltosSerial(); if (device != null) { try { - serial_line.open(device); + serial_line = new AltosSerial(device); if (!device.matchProduct(AltosDevice.product_telemetrum)) remote = true; config_thread = new Thread(this); @@ -259,6 +244,12 @@ public class AltosConfig implements Runnable, ActionListener { device.getPath()), "Cannot open target device", JOptionPane.ERROR_MESSAGE); + } catch (AltosSerialInUseException si) { + JOptionPane.showMessageDialog(owner, + String.format("Device \"%s\" already in use", + device.getPath()), + "Device in use", + JOptionPane.ERROR_MESSAGE); } catch (IOException ee) { JOptionPane.showMessageDialog(owner, device.getPath(),