diff options
| author | Bdale Garbee <bdale@gag.com> | 2012-08-28 23:39:53 -0600 | 
|---|---|---|
| committer | Bdale Garbee <bdale@gag.com> | 2012-08-28 23:39:53 -0600 | 
| commit | 5ed88fb72c3e3ecf3333c700d838667db71cfbdc (patch) | |
| tree | 3b371f563c0f7607f2fe53242673adb352b48514 /altoslib/AltosLink.java | |
| parent | adbe64c5a9402b7c5075a444a12629131b663877 (diff) | |
| parent | 621d0930244f25165d2ac5da596dcc87e253b965 (diff) | |
Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos
Conflicts:
	debian/control
Diffstat (limited to 'altoslib/AltosLink.java')
| -rw-r--r-- | altoslib/AltosLink.java | 22 | 
1 files changed, 19 insertions, 3 deletions
| diff --git a/altoslib/AltosLink.java b/altoslib/AltosLink.java index d59e73ba..415c3c64 100644 --- a/altoslib/AltosLink.java +++ b/altoslib/AltosLink.java @@ -23,7 +23,7 @@ import java.util.concurrent.*;  import java.util.*;  import java.text.*; -public abstract class AltosLink { +public abstract class AltosLink implements Runnable {  	public final static int ERROR = -1;  	public final static int TIMEOUT = -2; @@ -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)); | 
