diff options
Diffstat (limited to 'ao-tools')
| -rw-r--r-- | ao-tools/altosui/AltosDisplayThread.java | 16 | ||||
| -rw-r--r-- | ao-tools/altosui/AltosFlightDisplay.java | 24 | ||||
| -rw-r--r-- | ao-tools/altosui/AltosFlightUI.java | 13 | ||||
| -rw-r--r-- | ao-tools/altosui/Makefile.am | 1 | 
4 files changed, 42 insertions, 12 deletions
diff --git a/ao-tools/altosui/AltosDisplayThread.java b/ao-tools/altosui/AltosDisplayThread.java index b15472ed..957ac0d6 100644 --- a/ao-tools/altosui/AltosDisplayThread.java +++ b/ao-tools/altosui/AltosDisplayThread.java @@ -36,8 +36,7 @@ public class AltosDisplayThread extends Thread {  	String			name;  	AltosFlightReader	reader;  	int			crc_errors; -	AltosStatusTable	flightStatus; -	AltosInfoTable		flightInfo; +	AltosFlightDisplay	display;  	class IdleThread extends Thread { @@ -182,10 +181,8 @@ public class AltosDisplayThread extends Thread {  	}  	void show(AltosState state, int crc_errors) { -		if (state != null) { -			flightStatus.set(state); -			flightInfo.show(state, crc_errors); -		} +		if (state != null) +			display.show(state, crc_errors);  	}  	public void run() { @@ -197,7 +194,7 @@ public class AltosDisplayThread extends Thread {  		idle_thread = new IdleThread(); -		flightInfo.clear(); +		display.reset();  		try {  			for (;;) {  				try { @@ -235,11 +232,10 @@ public class AltosDisplayThread extends Thread {  		}  	} -	public AltosDisplayThread(Frame in_parent, AltosVoice in_voice, AltosStatusTable in_status, AltosInfoTable in_info, AltosFlightReader in_reader) { +	public AltosDisplayThread(Frame in_parent, AltosVoice in_voice, AltosFlightDisplay in_display, AltosFlightReader in_reader) {  		parent = in_parent;  		voice = in_voice; -		flightStatus = in_status; -		flightInfo = in_info; +		display = in_display;  		reader = in_reader;  	}  } diff --git a/ao-tools/altosui/AltosFlightDisplay.java b/ao-tools/altosui/AltosFlightDisplay.java new file mode 100644 index 00000000..d18d1d1f --- /dev/null +++ b/ao-tools/altosui/AltosFlightDisplay.java @@ -0,0 +1,24 @@ +/* + * Copyright © 2010 Keith Packard <keithp@keithp.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +package altosui; + +public interface AltosFlightDisplay { +	void reset(); + +	void show(AltosState state, int crc_errors); +} diff --git a/ao-tools/altosui/AltosFlightUI.java b/ao-tools/altosui/AltosFlightUI.java index 84ba9dca..11fc2442 100644 --- a/ao-tools/altosui/AltosFlightUI.java +++ b/ao-tools/altosui/AltosFlightUI.java @@ -28,7 +28,7 @@ import java.text.*;  import java.util.prefs.*;  import java.util.concurrent.LinkedBlockingQueue; -public class AltosFlightUI extends JFrame { +public class AltosFlightUI extends JFrame implements AltosFlightDisplay {  	String[] statusNames = { "Height (m)", "State", "RSSI (dBm)", "Speed (m/s)" };  	Object[][] statusData = { { "0", "pad", "-50", "0" } }; @@ -62,6 +62,15 @@ public class AltosFlightUI extends JFrame {  		stop_display();  	} +	public void reset() { +		flightInfo.clear(); +	} + +	public void show(AltosState state, int crc_errors) { +		flightStatus.set(state); +		flightInfo.show(state, crc_errors); +	} +  	public AltosFlightUI(AltosVoice in_voice, AltosFlightReader in_reader, final int serial) {  		voice = in_voice;  		reader = in_reader; @@ -117,7 +126,7 @@ public class AltosFlightUI extends JFrame {  		this.setVisible(true); -		thread = new AltosDisplayThread(this, voice, flightStatus, flightInfo, reader); +		thread = new AltosDisplayThread(this, voice, this, reader);  		thread.start();  	} diff --git a/ao-tools/altosui/Makefile.am b/ao-tools/altosui/Makefile.am index 2322b93f..ccb88ed1 100644 --- a/ao-tools/altosui/Makefile.am +++ b/ao-tools/altosui/Makefile.am @@ -28,6 +28,7 @@ altosui_JAVA = \  	AltosFile.java \  	AltosFlash.java \  	AltosFlashUI.java \ +	AltosFlightDisplay.java \  	AltosFlightInfoTableModel.java \  	AltosFlightReader.java \  	AltosFlightStatusTableModel.java \  | 
