diff --git a/config_webrx.py b/config_webrx.py index e6d6970..427e4dc 100644 --- a/config_webrx.py +++ b/config_webrx.py @@ -341,6 +341,8 @@ aprs_symbols_path = "/usr/share/aprs-symbols/png" # this also uses the receiver_gps setting from above, so make sure it contains a correct locator pskreporter_enabled = False pskreporter_callsign = "N0CALL" +# optional antenna information, uncomment to enable +#pskreporter_antenna_information = "Dipole" # === Web admin settings === # this feature is experimental at the moment. it should not be enabled on shared receivers since it allows remote diff --git a/owrx/pskreporter.py b/owrx/pskreporter.py index 5ecf599..662b2a7 100644 --- a/owrx/pskreporter.py +++ b/owrx/pskreporter.py @@ -168,28 +168,47 @@ class Uploader(object): return None def getReceiverInformationHeader(self): + pm = Config.get() + with_antenna = "pskreporter_antenna_information" in pm and pm["pskreporter_antenna_information"] is not None + num_fields = 4 if with_antenna else 3 + length = 12 + num_fields * 8 return bytes( - # id, length - [0x00, 0x03, 0x00, 0x24] + # id + [0x00, 0x03] + # length + + list(length.to_bytes(2, 'big')) + Uploader.receieverDelimiter # number of fields - + [0x00, 0x03, 0x00, 0x00] + + list(num_fields.to_bytes(2, 'big')) + # padding + + [0x00, 0x00] # receiverCallsign + [0x80, 0x02, 0xFF, 0xFF, 0x00, 0x00, 0x76, 0x8F] # receiverLocator + [0x80, 0x04, 0xFF, 0xFF, 0x00, 0x00, 0x76, 0x8F] # decodingSoftware + [0x80, 0x08, 0xFF, 0xFF, 0x00, 0x00, 0x76, 0x8F] + # antennaInformation + + ( + [0x80, 0x09, 0xFF, 0xFF, 0x00, 0x00, 0x76, 0x8F] if with_antenna else [] + ) # padding + [0x00, 0x00] ) def getReceiverInformation(self): pm = Config.get() - callsign = pm["pskreporter_callsign"] - locator = Locator.fromCoordinates(pm["receiver_gps"]) - decodingSoftware = "OpenWebRX " + openwebrx_version - body = [b for s in [callsign, locator, decodingSoftware] for b in self.encodeString(s)] + bodyFields = [ + # callsign + pm["pskreporter_callsign"], + # locator + Locator.fromCoordinates(pm["receiver_gps"]), + # decodingSoftware + "OpenWebRX " + openwebrx_version, + ] + if "pskreporter_antenna_information" in pm and pm["pskreporter_antenna_information"] is not None: + bodyFields += [pm["pskreporter_antenna_information"]] + body = [b for s in bodyFields for b in self.encodeString(s)] body = self.pad(body, 4) body = bytes(Uploader.receieverDelimiter + list((len(body) + 4).to_bytes(2, "big")) + body) return body