altoslib, altosui, telegps: Add configuration support for APRS offset
[fw/altos] / altoslib / AltosConfigData.java
index 29ce033df4b4f297d7d6cc57e9eed74502758cde..3c5f6c06678977f6a7790c850e125a543dbc0611 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_13;
+package org.altusmetrum.altoslib_14;
 
 import java.util.*;
 import java.text.*;
@@ -78,6 +78,7 @@ public class AltosConfigData {
        public int              aprs_interval;
        public int              aprs_ssid;
        public int              aprs_format;
+       public int              aprs_offset;
 
        /* HAS_BEEP */
        public int              beep;
@@ -200,7 +201,10 @@ public class AltosConfigData {
                case AltosLib.AO_LOG_FORMAT_TELEMETRUM:
                case AltosLib.AO_LOG_FORMAT_TELEMEGA:
                case AltosLib.AO_LOG_FORMAT_TELEMEGA_3:
+               case AltosLib.AO_LOG_FORMAT_TELEMEGA_4:
                        return 4095 - value;
+               case AltosLib.AO_LOG_FORMAT_EASYMEGA_2:
+                       return -value;
                default:
                        return AltosLib.MISSING;
                }
@@ -293,6 +297,7 @@ public class AltosConfigData {
                aprs_interval = AltosLib.MISSING;
                aprs_ssid = AltosLib.MISSING;
                aprs_format = AltosLib.MISSING;
+               aprs_offset = AltosLib.MISSING;
 
                beep = AltosLib.MISSING;
 
@@ -462,6 +467,7 @@ public class AltosConfigData {
                try { aprs_interval = get_int(line, "APRS interval:"); } catch (Exception e) {}
                try { aprs_ssid = get_int(line, "APRS SSID:"); } catch (Exception e) {}
                try { aprs_format = get_int(line, "APRS format:"); } catch (Exception e) {}
+               try { aprs_offset = get_int(line, "APRS offset:"); } catch (Exception e) {}
 
                /* HAS_BEEP */
                try { beep = get_int(line, "Beeper setting:"); } catch (Exception e) {}
@@ -561,6 +567,8 @@ public class AltosConfigData {
                        return false;
                if (product.startsWith("TeleMetrum-v2"))
                        return false;
+               if (product.startsWith("TeleMetrum-v3"))
+                       return false;
                if (product.startsWith("EasyMega"))
                        return false;
                return true;
@@ -585,6 +593,10 @@ public class AltosConfigData {
                if (product != null) {
                        if (product.startsWith("EasyMega-v2"))
                                return true;
+                       if (product.startsWith("TeleMetrum-v3"))
+                               return true;
+                       if (product.startsWith("TeleMega-v4"))
+                               return true;
                }
                throw new AltosUnknownProduct(product);
        }
@@ -593,6 +605,10 @@ public class AltosConfigData {
                if (product != null) {
                        if (product.startsWith("EasyMega-v2"))
                                return AltosAdxl375.X_AXIS;
+                       if (product.startsWith("TeleMetrum-v3"))
+                               return AltosAdxl375.X_AXIS;
+                       if (product.startsWith("TeleMega-v4"))
+                               return AltosAdxl375.X_AXIS;
                }
                throw new AltosUnknownProduct(product);
        }
@@ -648,6 +664,8 @@ public class AltosConfigData {
                        aprs_ssid = source.aprs_ssid();
                if (aprs_format != AltosLib.MISSING)
                        aprs_format = source.aprs_format();
+               if (aprs_offset != AltosLib.MISSING)
+                       aprs_offset = source.aprs_offset();
 
                /* HAS_BEEP */
                if (beep != AltosLib.MISSING)
@@ -705,6 +723,7 @@ public class AltosConfigData {
                dest.set_aprs_interval(aprs_interval);
                dest.set_aprs_ssid(aprs_ssid);
                dest.set_aprs_format(aprs_format);
+               dest.set_aprs_offset(aprs_offset);
                dest.set_beep(beep);
                dest.set_tracker_motion(tracker_motion);
                dest.set_tracker_interval(tracker_interval);
@@ -809,6 +828,8 @@ public class AltosConfigData {
                        link.printf("c S %d\n", aprs_ssid);
                if (aprs_format != AltosLib.MISSING)
                        link.printf("c C %d\n", aprs_format);
+               if (aprs_offset != AltosLib.MISSING)
+                       link.printf("c O %d\n", aprs_offset);
 
                /* HAS_BEEP */
                if (beep != AltosLib.MISSING)