altosui: Simple timeouts don't work with query data
[fw/altos] / altosui / AltosSerial.java
index 8f8f99d7f458088aaa62abf3eb66cff23fb3e7af..cb82a574ed4381d5c87862f2d9de23757dad5afb 100644 (file)
@@ -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);