summaryrefslogtreecommitdiff
path: root/altosui/AltosSerial.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-08-02 18:01:52 -0700
committerKeith Packard <keithp@keithp.com>2011-08-02 18:03:37 -0700
commit3cc2eed6cdafe788a8617ab45c6664077e76411e (patch)
treeb30bcf2aee916c26c55e76d6a3bc3902c893fcb5 /altosui/AltosSerial.java
parent37c41c962ea4631e62307a57d2ce6572b87fd743 (diff)
altosui: Simple timeouts don't work with query data
To get the query to come back, it's best to abort and retry the command, other wise the command may have been lost to the previous connection. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosui/AltosSerial.java')
-rw-r--r--altosui/AltosSerial.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/altosui/AltosSerial.java b/altosui/AltosSerial.java
index 8f8f99d7..cb82a574 100644
--- a/altosui/AltosSerial.java
+++ b/altosui/AltosSerial.java
@@ -233,12 +233,14 @@ public class AltosSerial implements Runnable {
abort = false;
timeout_started = false;
for (;;) {
+ System.out.printf("timeout %d\n", timeout);
AltosLine line = reply_queue.poll(timeout, TimeUnit.MILLISECONDS);
if (line != null) {
stop_timeout_dialog();
--in_reply;
return line.line;
}
+ System.out.printf("no line remote %b can_cancel %b\n", remote, can_cancel);
if (!remote || !can_cancel || check_timeout()) {
--in_reply;
return null;
@@ -246,6 +248,14 @@ public class AltosSerial implements Runnable {
}
}
+ public String get_reply_no_dialog(int timeout) throws InterruptedException, TimeoutException {
+ flush_output();
+ AltosLine line = reply_queue.poll(timeout, TimeUnit.MILLISECONDS);
+ if (line != null)
+ return line.line;
+ return null;
+ }
+
public void add_monitor(LinkedBlockingQueue<AltosLine> q) {
set_monitor(true);
monitors.add(q);