diff options
Diffstat (limited to 'altosui/AltosPreferences.java')
| -rw-r--r-- | altosui/AltosPreferences.java | 25 | 
1 files changed, 25 insertions, 0 deletions
| diff --git a/altosui/AltosPreferences.java b/altosui/AltosPreferences.java index d4df4e16..5f827655 100644 --- a/altosui/AltosPreferences.java +++ b/altosui/AltosPreferences.java @@ -34,6 +34,9 @@ class AltosPreferences {  	/* channel preference name */  	final static String channelPreferenceFormat = "CHANNEL-%d"; +	/* telemetry format preference name */ +	final static String telemetryPreferenceFormat = "TELEMETRY-%d"; +  	/* voice preference name */  	final static String voicePreference = "VOICE"; @@ -61,6 +64,9 @@ class AltosPreferences {  	/* Channel (map serial to channel) */  	static Hashtable<Integer, Integer> channels; +	/* Telemetry (map serial to telemetry format) */ +	static Hashtable<Integer, Integer> telemetries; +  	/* Voice preference */  	static boolean voice; @@ -94,6 +100,8 @@ class AltosPreferences {  		channels = new Hashtable<Integer,Integer>(); +		telemetries = new Hashtable<Integer,Integer>(); +  		voice = preferences.getBoolean(voicePreference, true);  		callsign = preferences.get(callsignPreference,"N0CALL"); @@ -189,6 +197,23 @@ class AltosPreferences {  		return channel;  	} +	public static void set_telemetry(int serial, int new_telemetry) { +		telemetries.put(serial, new_telemetry); +		synchronized (preferences) { +			preferences.putInt(String.format(telemetryPreferenceFormat, serial), new_telemetry); +			flush_preferences(); +		} +	} + +	public static int telemetry(int serial) { +		if (telemetries.containsKey(serial)) +			return telemetries.get(serial); +		int telemetry = preferences.getInt(String.format(telemetryPreferenceFormat, serial), +						   Altos.ao_telemetry_full); +		telemetries.put(serial, telemetry); +		return telemetry; +	} +  	public static void set_voice(boolean new_voice) {  		voice = new_voice;  		synchronized (preferences) { | 
