X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altosui%2FAltosPreferences.java;fp=altosui%2FAltosPreferences.java;h=5f82765569dae85f0a69211c41bc0d1ed04b119f;hp=d4df4e163efecaf18462fc0f49fce012564f138a;hb=7f5b5848ad6ef5c808638a29c3dc0101b56ed11e;hpb=f3e68341f6f5daaf26dd162e4f9a06c29988986a 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 channels; + /* Telemetry (map serial to telemetry format) */ + static Hashtable telemetries; + /* Voice preference */ static boolean voice; @@ -94,6 +100,8 @@ class AltosPreferences { channels = new Hashtable(); + telemetries = new Hashtable(); + 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) {