diff options
| author | Keith Packard <keithp@keithp.com> | 2013-02-10 14:17:04 -0800 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2013-02-10 14:17:04 -0800 | 
| commit | c2701ae646124f0668c5f2d1df3fc80f0075a9d7 (patch) | |
| tree | 6b29d8d8f76ed58b13cd3d0796fcca5889731767 /altoslib/AltosIdleMonitor.java | |
| parent | cc0ea39fee73417ecd69c020d9eca723ebb2cf65 (diff) | |
altosui: Interrupt MonitorIdle when changing frequency/callsign
When switching radio parameters, the local device needs to have the
parameters switched, so interrupt the current operation and start
over, the frequency and callsign will be set the next time through.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosIdleMonitor.java')
| -rw-r--r-- | altoslib/AltosIdleMonitor.java | 19 | 
1 files changed, 19 insertions, 0 deletions
| diff --git a/altoslib/AltosIdleMonitor.java b/altoslib/AltosIdleMonitor.java index 6b20b3f1..f2f75bbb 100644 --- a/altoslib/AltosIdleMonitor.java +++ b/altoslib/AltosIdleMonitor.java @@ -27,6 +27,7 @@ public class AltosIdleMonitor extends Thread {  	AltosState		state;  	boolean			remote;  	double			frequency; +	String			callsign;  	AltosState		previous_state;  	AltosConfigData		config_data;  	AltosGPS		gps; @@ -87,6 +88,7 @@ public class AltosIdleMonitor extends Thread {  		try {  			if (remote) {  				link.set_radio_frequency(frequency); +				link.set_callsign(callsign);  				link.start_remote();  			} else  				link.flush_input(); @@ -126,12 +128,29 @@ public class AltosIdleMonitor extends Thread {  	public void set_frequency(double in_frequency) {  		frequency = in_frequency; +		link.abort_reply(); +	} + +	public void set_callsign(String in_callsign) { +		callsign = in_callsign; +		link.abort_reply();  	}  	public void post_state() {  		listener.update(state);  	} +	public void abort() { +		if (isAlive()) { +			interrupt(); +			link.abort_reply(); +			try { +				join(); +			} catch (InterruptedException ie) { +			} +		} +	} +  	public void run() {  		try {  			for (;;) { | 
