- device = AltosDeviceDialog.show(owner, Altos.product_any);
- if (device != null) {
- try {
- reader = new AltosTelemetryReader(device);
- set_channel();
- set_monitor();
- handler = new TelemetryHandler();
- thread = new Thread(handler);
- thread.start();
- return true;
- } catch (Exception e) {
- scan_exception(e);
- }
+ device = AltosDeviceDialog.show(owner, Altos.product_basestation);
+ if (device == null)
+ return false;
+ try {
+ reader = new AltosTelemetryReader(device);
+ reader.serial.set_channel(channel);
+ reader.serial.set_telemetry(monitors[monitor]);
+ handler = new TelemetryHandler();
+ thread = new Thread(handler);
+ thread.start();
+ return true;
+ } catch (FileNotFoundException ee) {
+ JOptionPane.showMessageDialog(owner,
+ String.format("Cannot open device \"%s\"",
+ device.toShortString()),
+ "Cannot open target device",
+ JOptionPane.ERROR_MESSAGE);
+ } catch (AltosSerialInUseException si) {
+ JOptionPane.showMessageDialog(owner,
+ String.format("Device \"%s\" already in use",
+ device.toShortString()),
+ "Device in use",
+ JOptionPane.ERROR_MESSAGE);
+ } catch (IOException ee) {
+ JOptionPane.showMessageDialog(owner,
+ device.toShortString(),
+ "Unkonwn I/O error",
+ JOptionPane.ERROR_MESSAGE);