better decoding

This commit is contained in:
Jakob Ketterl 2019-08-11 18:13:12 +02:00
parent fe84a39097
commit e5dffc3d9f

View File

@ -103,6 +103,7 @@ class KissClient(object):
logger.debug(data) logger.debug(data)
def parseCoordinates(raw): def parseCoordinates(raw):
# TODO parse N/S and E/W
return { return {
"lat": int(raw[0:2]) + float(raw[2:7]) / 60, "lat": int(raw[0:2]) + float(raw[2:7]) / 60,
"lon": int(raw[9:12]) + float(raw[12:17]) / 60 "lon": int(raw[9:12]) + float(raw[12:17]) / 60
@ -119,13 +120,15 @@ class KissClient(object):
coords["comment"] = data[27:] coords["comment"] = data[27:]
return coords return coords
elif data[0] == "@": elif data[0] == "@":
# TODO CSE, SPD, BRG, 90Q, comments
if data[26] == "$":
# MOBILE # MOBILE
return parseCoordinates(data[8:26]) # TODO CSE, SPD, BRG, 90Q, comments
elif data[26] == "\\": if data[26] == "\\":
# DF # DF
return parseCoordinates(data[8:26]) return parseCoordinates(data[8:26])
coords = parseCoordinates(data[8:26])
coords["symbol"] = data[26]
coords["comment"] = data[27:]
return coords
return {} return {}
def extractCallsign(self, input): def extractCallsign(self, input):