projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Mark master branch as past the 1.5 point
[fw/altos]
/
altosui
/
AltosIgniteUI.java
diff --git
a/altosui/AltosIgniteUI.java
b/altosui/AltosIgniteUI.java
index 9d063702a3c1112b458e63801cbe45059774a69b..15a81e57e37a5fd604142123d776e378aed3c1f1 100644
(file)
--- a/
altosui/AltosIgniteUI.java
+++ b/
altosui/AltosIgniteUI.java
@@
-24,8
+24,8
@@
import java.io.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
-import org.altusmetrum.altoslib_
3
.*;
-import org.altusmetrum.altosuilib_
1
.*;
+import org.altusmetrum.altoslib_
5
.*;
+import org.altusmetrum.altosuilib_
3
.*;
public class AltosIgniteUI
extends AltosUIDialog
public class AltosIgniteUI
extends AltosUIDialog
@@
-39,6
+39,7
@@
public class AltosIgniteUI
javax.swing.Timer timer;
JButton close;
ButtonGroup group;
javax.swing.Timer timer;
JButton close;
ButtonGroup group;
+ Boolean opened;
int npyro;
int npyro;
@@
-110,6
+111,7
@@
public class AltosIgniteUI
class IgniteHandler implements Runnable {
AltosIgnite ignite;
JFrame owner;
class IgniteHandler implements Runnable {
AltosIgnite ignite;
JFrame owner;
+ AltosLink link;
void send_exception(Exception e) {
final Exception f_e = e;
void send_exception(Exception e) {
final Exception f_e = e;
@@
-123,9
+125,7
@@
public class AltosIgniteUI
public void run () {
try {
public void run () {
try {
- AltosSerial serial = new AltosSerial(device);
- serial.set_frame(owner);
- ignite = new AltosIgnite(serial,
+ ignite = new AltosIgnite(link,
!device.matchProduct(Altos.product_altimeter));
} catch (Exception e) {
!device.matchProduct(Altos.product_altimeter));
} catch (Exception e) {
@@
-172,8
+172,9
@@
public class AltosIgniteUI
}
}
}
}
- public IgniteHandler(JFrame in_owner) {
+ public IgniteHandler(JFrame in_owner
, AltosLink in_link
) {
owner = in_owner;
owner = in_owner;
+ link = in_link;
}
}
}
}
@@
-307,8
+308,10
@@
public class AltosIgniteUI
}
void close() {
}
void close() {
- send_command("quit");
- timer.stop();
+ if (opened) {
+ send_command("quit");
+ timer.stop();
+ }
setVisible(false);
dispose();
}
setVisible(false);
dispose();
}
@@
-382,12
+385,20
@@
public class AltosIgniteUI
command_queue = new LinkedBlockingQueue<String>();
reply_queue = new LinkedBlockingQueue<String>();
command_queue = new LinkedBlockingQueue<String>();
reply_queue = new LinkedBlockingQueue<String>();
+ opened = false;
device = AltosDeviceUIDialog.show(owner, Altos.product_any);
if (device != null) {
device = AltosDeviceUIDialog.show(owner, Altos.product_any);
if (device != null) {
- IgniteHandler handler = new IgniteHandler(owner);
+ try {
+ AltosSerial serial = new AltosSerial(device);
+ serial.set_frame(owner);
+ IgniteHandler handler = new IgniteHandler(owner, serial);
Thread t = new Thread(handler);
t.start();
Thread t = new Thread(handler);
t.start();
+ opened = true;
return true;
return true;
+ } catch (Exception ex) {
+ ignite_exception(ex);
+ }
}
return false;
}
}
return false;
}
@@
-475,7
+486,7
@@
public class AltosIgniteUI
pane.add(close, c);
close.addActionListener(this);
close.setActionCommand("close");
pane.add(close, c);
close.addActionListener(this);
close.setActionCommand("close");
-
+
pack();
setLocationRelativeTo(owner);
pack();
setLocationRelativeTo(owner);