+ if (remote)
+ serial_line.printf("~");
+ serial_line.close();
+ }
+
+ public AltosEeprom(JFrame given_frame) {
+ frame = given_frame;
+ device = AltosDeviceDialog.show(frame, null);
+ serial_line = new AltosSerial();
+ remote = false;
+
+ if (device != null) {
+ try {
+ serial_line.open(device);
+ if (!device.getProduct().startsWith("TeleMetrum"))
+ remote = true;
+ eeprom_thread = new Thread(this);
+ eeprom_thread.start();
+ } catch (FileNotFoundException ee) {
+ JOptionPane.showMessageDialog(frame,
+ String.format("Cannot open device \"%s\"",
+ device.getPath()),
+ "Cannot open target device",
+ JOptionPane.ERROR_MESSAGE);
+ } catch (IOException ee) {
+ JOptionPane.showMessageDialog(frame,
+ device.getPath(),
+ ee.getLocalizedMessage(),
+ JOptionPane.ERROR_MESSAGE);
+ }
+ }