[chirp_devel] issue #967 - add aprs beacon and message parsing

Angus Ainslie
Sun Dec 28 09:51:01 PST 2014


issue #967 - add aprs beacon and message parsing

The FT1DR stores the APRS messages and beacons in the clone.
This patch displays those messages in the settings tab.

diff -r c3dacbee3ecf -r 3e008f702ad9 chirp/ft1d.py
--- a/chirp/ft1d.py     Sat Dec 27 23:16:48 2014 -0700
+++ b/chirp/ft1d.py     Sun Dec 28 10:41:55 2014 -0700
@@ -16,6 +16,7 @@

  import os
  import re
+import string

  from chirp import chirp_common, yaesu_clone, directory
  from chirp import bitwise
@@ -317,19 +318,19 @@

  #seekto 0x%04X;
  struct {
-  u8 dst_callsign[6];
-  u8 dst_callsign_ssid;
-  u8 src_callsign[6];
-  u8 src_callsign_ssid;
-  u8 path_and_body[%d];
+  char dst_callsign[9];
+  char path[30];
+  u16 flags;
+  u8 seperator;
+  char body[%d];
  } aprs_beacon_pkt[%d];

  #seekto 0x137c4;
  struct {
-  u8 unknown0;
-  u8 dst_callsign[6];
+  u8 flag;
+  char dst_callsign[6];
    u8 dst_callsign_ssid;
-  u8 path_and_body[66];
+  char path_and_body[66];
    u8 unknown[70];
  } aprs_message_pkt[60];

@@ -515,7 +516,7 @@
      _mem_params = (0xFECA, # APRS beacon metadata address.
                     60,     # Number of beacons stored.
                     0x1064A, # APRS beacon content address.
-                   162,    # Length of beacon data stored.
+                   134,    # Length of beacon data stored.
                     60)     # Number of beacons stored.
      _has_vibrate = False
      _has_af_dual = True
@@ -944,6 +945,54 @@

          return menu

+    def _get_aprs_msgs(self):
+        menu = RadioSettingGroup("aprs_msg", "APRS Messages")
+        aprs_msg = self._memobj.aprs_message_pkt
+
+        for index in range( 0, 60 ):
+            if aprs_msg[index].flag != 255 :
+                val = RadioSettingValueString(0, 9,
+                    str(aprs_msg[index].dst_callsign).rstrip("\xFF") + 
"-%d" % aprs_msg[index].dst_callsign_ssid )
+                rs = RadioSetting("aprs_msg.dst_callsign%d" % index, 
"Dst Callsign %d" % index, val)
+                menu.append(rs)
+
+                val = RadioSettingValueString(0, 66,
+                    str(aprs_msg[index].path_and_body).rstrip("\xFF"))
+                rs = RadioSetting("aprs_msg.path_and_body%d" % index, 
"Body", val)
+                menu.append(rs)
+
+        return menu
+
+    def _get_aprs_beacons(self):
+        menu = RadioSettingGroup("aprs_beacons", "APRS Beacons")
+        aprs_beacon = self._memobj.aprs_beacon_pkt
+
+        for index in range( 0, 60 ):
+            # There is probably a more pythonesque way to do this
+            if int( aprs_beacon[index].dst_callsign[0] ) != 255 :
+                #print "DST callsign %s %d %s" % ( 
aprs_beacon[index].dst_callsign, aprs_beacon[index].dst_callsign[0],  
list( str( aprs_beacon[index].dst_callsign )))
+                val = RadioSettingValueString(0, 9,
+                    str(aprs_beacon[index].dst_callsign).rstrip("\xFF") 
)
+                rs = RadioSetting("aprs_beacon.dst_callsign%d" % index, 
"DST Callsign %d" % index, val)
+                menu.append(rs)
+
+                path = str( aprs_beacon[index].path ).replace( "\x00", 
" " )
+                path = ''.join(c for c in path if c in 
string.printable).strip()
+                path = str( path ).replace( "\xE0", "*" )
+                #print "path %s %s" % ( path, list(path) )
+                val = RadioSettingValueString(0, 32, path)
+                rs = RadioSetting("aprs_beacon.path%d" % index, 
"Digipath", val)
+                menu.append(rs)
+
+                body = str( aprs_beacon[index].body ).rstrip("\xFF")
+                checksum = body[-2:]
+                body = ''.join(s for s in body[:-2] if s in 
string.printable).replace( "\x0d", " " )
+                val = RadioSettingValueString(0, 134, body.strip())
+                rs = RadioSetting("aprs_beacon.body%d" % index, "Body", 
val)
+                menu.append(rs)
+
+        return menu
+
      def _get_aprs_rx_settings(self):
          menu = RadioSettingGroup("aprs_rx", "APRS Receive")
          aprs = self._memobj.aprs
@@ -1378,6 +1427,8 @@
                                  self._get_aprs_rx_settings(),
                                  self._get_aprs_tx_settings(),
                                  self._get_aprs_smartbeacon(),
+                                self._get_aprs_msgs(),
+                                self._get_aprs_beacons(),
                                  self._get_dtmf_settings(),
                                  self._get_misc_settings(),
                                  self._get_scan_settings())




More information about the chirp_devel mailing list