/* logdir preference name */
final static String logdirPreference = "LOGDIR";
+ /* channel preference name */
+ final static String channelPreference = "CHANNEL";
+
+ /* voice preference name */
+ final static String voicePreference = "VOICE";
+
+ /* callsign preference name */
+ final static String callsignPreference = "CALLSIGN";
+
/* Default logdir is ~/TeleMetrum */
final static String logdirName = "TeleMetrum";
/* Log directory */
static File logdir;
+ /* Telemetry channel */
+ static int channel;
+
+ /* Voice preference */
+ static boolean voice;
+
+ static String callsign;
+
public static void init(Component ui) {
preferences = Preferences.userRoot().node("/org/altusmetrum/altosui");
if (!logdir.exists())
logdir.mkdirs();
}
+
+ channel = preferences.getInt(channelPreference, 0);
+
+ voice = preferences.getBoolean(voicePreference, true);
+
+ callsign = preferences.get(callsignPreference,"N0CALL");
}
static void flush_preferences() {
public static File logdir() {
return logdir;
}
+
+ public static void set_channel(int new_channel) {
+ channel = new_channel;
+ synchronized (preferences) {
+ preferences.putInt(channelPreference, channel);
+ flush_preferences();
+ }
+ }
+
+ public static int channel() {
+ return channel;
+ }
+
+ public static void set_voice(boolean new_voice) {
+ voice = new_voice;
+ synchronized (preferences) {
+ preferences.putBoolean(voicePreference, voice);
+ flush_preferences();
+ }
+ }
+
+ public static boolean voice() {
+ return voice;
+ }
+
+ public static void set_callsign(String new_callsign) {
+ callsign = new_callsign;
+ synchronized(preferences) {
+ preferences.put(callsignPreference, callsign);
+ flush_preferences();
+ }
+ }
+
+ public static String callsign() {
+ return callsign;
+ }
}