allow antenna information to be sent to pskreporter

This commit is contained in:
Jakob Ketterl 2020-12-10 01:36:09 +01:00
parent fcff9d16ff
commit 2c04d40c53
2 changed files with 28 additions and 7 deletions

View File

@ -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

View File

@ -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