/* firmware directory preference name */
final static String firmwaredirPreference = "FIRMWARE";
+ /* serial debug preference name */
+ final static String serialDebugPreference = "SERIAL-DEBUG";
+
/* Default logdir is ~/TeleMetrum */
final static String logdirName = "TeleMetrum";
/* Log directory */
static File logdir;
+ /* Map directory -- hangs of logdir */
+ static File mapdir;
+
/* Channel (map serial to channel) */
static Hashtable<Integer, Integer> channels;
/* Firmware directory */
static File firmwaredir;
+ /* Serial debug */
+ static boolean serial_debug;
+
public static void init(Component ui) {
preferences = Preferences.userRoot().node("/org/altusmetrum/altosui");
if (!logdir.exists())
logdir.mkdirs();
}
+ mapdir = new File(logdir, "maps");
+ if (!mapdir.exists())
+ mapdir.mkdirs();
channels = new Hashtable<Integer,Integer>();
firmwaredir = new File(firmwaredir_string);
else
firmwaredir = null;
+
+ serial_debug = preferences.getBoolean(serialDebugPreference, false);
+ AltosSerial.set_debug(serial_debug);
}
static void flush_preferences() {
public static void set_logdir(File new_logdir) {
logdir = new_logdir;
+ mapdir = new File(logdir, "maps");
+ if (!mapdir.exists())
+ mapdir.mkdirs();
synchronized (preferences) {
preferences.put(logdirPreference, logdir.getPath());
flush_preferences();
return logdir;
}
+ public static File mapdir() {
+ return mapdir;
+ }
+
public static void set_channel(int serial, int new_channel) {
channels.put(serial, new_channel);
synchronized (preferences) {
public static File firmwaredir() {
return firmwaredir;
}
+
+ public static void set_serial_debug(boolean new_serial_debug) {
+ serial_debug = new_serial_debug;
+ AltosSerial.set_debug(serial_debug);
+ synchronized (preferences) {
+ preferences.putBoolean(serialDebugPreference, serial_debug);
+ flush_preferences();
+ }
+ }
+
+ public static boolean serial_debug() {
+ return serial_debug;
+ }
}