- if (device != null) {
- try {
- serial_line = new AltosSerial(device);
- if (!device.matchProduct(AltosDevice.product_telemetrum))
- remote = true;
-
- monitor = new AltosEepromMonitor(frame, Altos.ao_flight_boost, Altos.ao_flight_landed);
- monitor.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if (eeprom_thread != null)
- eeprom_thread.interrupt();
- }
- });
-
- eeprom_thread = new Thread(this);
- start_block = 0;
- end_block = 0xfff;
- eeprom_thread.start();
- } catch (FileNotFoundException ee) {
- JOptionPane.showMessageDialog(frame,
- String.format("Cannot open device \"%s\"",
- device.toShortString()),
- "Cannot open target device",
- JOptionPane.ERROR_MESSAGE);
- } catch (AltosSerialInUseException si) {
- JOptionPane.showMessageDialog(frame,
- String.format("Device \"%s\" already in use",
- device.toShortString()),
- "Device in use",
- JOptionPane.ERROR_MESSAGE);
- } catch (IOException ee) {
- JOptionPane.showMessageDialog(frame,
- device.toShortString(),
- ee.getLocalizedMessage(),
- JOptionPane.ERROR_MESSAGE);
- }
- }
+ public AltosEepromDownload(JFrame given_frame,
+ AltosSerial given_serial_line,
+ boolean given_remote,
+ AltosEepromList given_flights) {
+
+ frame = given_frame;
+ serial_line = given_serial_line;
+ serial_line.set_frame(frame);
+ remote = given_remote;
+ flights = given_flights;
+ success = false;
+
+ monitor = new AltosEepromMonitor(frame, Altos.ao_flight_boost, Altos.ao_flight_landed);
+ monitor.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ if (eeprom_thread != null)
+ eeprom_thread.interrupt();
+ }
+ });