set_common_frequencies(new_frequencies);
}
+ static LinkedList<AltosUnitsListener> units_listeners;
+
public static boolean imperial_units() {
synchronized(backend) {
return AltosConvert.imperial_units;
backend.putBoolean(unitsPreference, imperial_units);
flush_preferences();
}
+ if (units_listeners != null) {
+ for (AltosUnitsListener l : units_listeners) {
+ l.units_changed(imperial_units);
+ }
+ }
+ }
+
+ public static void register_units_listener(AltosUnitsListener l) {
+ synchronized(backend) {
+ if (units_listeners == null)
+ units_listeners = new LinkedList<AltosUnitsListener>();
+ units_listeners.add(l);
+ }
+ }
+
+ public static void unregister_units_listener(AltosUnitsListener l) {
+ synchronized(backend) {
+ units_listeners.remove(l);
+ }
}
}
--- /dev/null
+/*
+ * Copyright © 2012 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 org.altusmetrum.AltosLib;
+
+public interface AltosUnitsListener {
+ public void units_changed(boolean imperial_units);
+}
$(SRC)/AltosTelemetryRecordSensor.java \
$(SRC)/AltosTelemetryRecordMegaSensor.java \
$(SRC)/AltosTelemetryRecordMegaData.java \
+ $(SRC)/AltosUnitsListener.java \
$(SRC)/AltosMs5607.java \
$(SRC)/AltosIMU.java \
$(SRC)/AltosMag.java \