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 # this also uses the receiver_gps setting from above, so make sure it contains a correct locator
pskreporter_enabled = False pskreporter_enabled = False
pskreporter_callsign = "N0CALL" pskreporter_callsign = "N0CALL"
# optional antenna information, uncomment to enable
#pskreporter_antenna_information = "Dipole"
# === Web admin settings === # === Web admin settings ===
# this feature is experimental at the moment. it should not be enabled on shared receivers since it allows remote # 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 return None
def getReceiverInformationHeader(self): 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( return bytes(
# id, length # id
[0x00, 0x03, 0x00, 0x24] [0x00, 0x03]
# length
+ list(length.to_bytes(2, 'big'))
+ Uploader.receieverDelimiter + Uploader.receieverDelimiter
# number of fields # number of fields
+ [0x00, 0x03, 0x00, 0x00] + list(num_fields.to_bytes(2, 'big'))
# padding
+ [0x00, 0x00]
# receiverCallsign # receiverCallsign
+ [0x80, 0x02, 0xFF, 0xFF, 0x00, 0x00, 0x76, 0x8F] + [0x80, 0x02, 0xFF, 0xFF, 0x00, 0x00, 0x76, 0x8F]
# receiverLocator # receiverLocator
+ [0x80, 0x04, 0xFF, 0xFF, 0x00, 0x00, 0x76, 0x8F] + [0x80, 0x04, 0xFF, 0xFF, 0x00, 0x00, 0x76, 0x8F]
# decodingSoftware # decodingSoftware
+ [0x80, 0x08, 0xFF, 0xFF, 0x00, 0x00, 0x76, 0x8F] + [0x80, 0x08, 0xFF, 0xFF, 0x00, 0x00, 0x76, 0x8F]
# antennaInformation
+ (
[0x80, 0x09, 0xFF, 0xFF, 0x00, 0x00, 0x76, 0x8F] if with_antenna else []
)
# padding # padding
+ [0x00, 0x00] + [0x00, 0x00]
) )
def getReceiverInformation(self): def getReceiverInformation(self):
pm = Config.get() pm = Config.get()
callsign = pm["pskreporter_callsign"] bodyFields = [
locator = Locator.fromCoordinates(pm["receiver_gps"]) # callsign
decodingSoftware = "OpenWebRX " + openwebrx_version pm["pskreporter_callsign"],
body = [b for s in [callsign, locator, decodingSoftware] for b in self.encodeString(s)] # 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 = self.pad(body, 4)
body = bytes(Uploader.receieverDelimiter + list((len(body) + 4).to_bytes(2, "big")) + body) body = bytes(Uploader.receieverDelimiter + list((len(body) + 4).to_bytes(2, "big")) + body)
return body return body