summaryrefslogtreecommitdiff
path: root/altoslib/AltosLink.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-07-29 19:34:00 -0700
committerKeith Packard <keithp@keithp.com>2012-07-29 19:34:00 -0700
commit0bf21399d3d47d58410df4c6ce89fc20fcd42c89 (patch)
treef1c39fbbc5470e7d5489f6fcef2d0fe5ac2a461e /altoslib/AltosLink.java
parent59588ba34159b27c02e1a886b46497ecfa0cf4d3 (diff)
altosui: Handle Monitor Idle errors better
Deal with missing data by checking for MISSING in more places. Handle serial communication failures during send by reporting back from libaltos. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosLink.java')
-rw-r--r--altoslib/AltosLink.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/altoslib/AltosLink.java b/altoslib/AltosLink.java
index d59e73ba..fd5db7e9 100644
--- a/altoslib/AltosLink.java
+++ b/altoslib/AltosLink.java
@@ -101,15 +101,23 @@ public abstract class AltosLink {
try {
for (;;) {
c = getchar();
- if (Thread.interrupted())
+ if (Thread.interrupted()) {
+ if (debug)
+ System.out.printf("INTERRUPTED\n");
break;
+ }
if (c == ERROR) {
+ if (debug)
+ System.out.printf("ERROR\n");
add_telem (new AltosLine());
add_reply (new AltosLine());
break;
}
- if (c == TIMEOUT)
+ if (c == TIMEOUT) {
+ if (debug)
+ System.out.printf("TIMEOUT\n");
continue;
+ }
if (c == '\r')
continue;
synchronized(this) {
@@ -180,6 +188,14 @@ public abstract class AltosLink {
reply_queue.put (line);
}
+ public void abort_reply() {
+ try {
+ add_telem (new AltosLine());
+ add_reply (new AltosLine());
+ } catch (InterruptedException e) {
+ }
+ }
+
public void add_string(String line) throws InterruptedException {
if (line.startsWith("TELEM") || line.startsWith("VERSION") || line.startsWith("CRC")) {
add_telem(new AltosLine(line));