get course and speed and extended info from mic-e frames

This commit is contained in:
Jakob Ketterl 2019-08-15 21:46:08 +02:00
parent 3022406f63
commit cc6561bdda
1 changed files with 15 additions and 2 deletions

View File

@ -95,7 +95,7 @@ class AprsParser(object):
# forward some of the ax25 data # forward some of the ax25 data
aprsData = {"source": data["source"], "destination": data["destination"], "path": data["path"]} aprsData = {"source": data["source"], "destination": data["destination"], "path": data["path"]}
if information[0] == 0x1C or information[0] == 0x60: if information[0] == 0x1C or information[0] == ord("`") or information[0] == ord("'"):
aprsData.update(MicEParser().parse(data)) aprsData.update(MicEParser().parse(data))
return aprsData return aprsData
@ -224,8 +224,8 @@ class MicEParser(object):
lat *= -1 lat *= -1
logger.debug(lat) logger.debug(lat)
logger.debug(information) logger.debug(information)
lon = information[1] - 28 lon = information[1] - 28
if ord(destination[4]) >= ord("P"): if ord(destination[4]) >= ord("P"):
lon += 100 lon += 100
@ -243,6 +243,16 @@ class MicEParser(object):
if ord(destination[5]) >= ord("P"): if ord(destination[5]) >= ord("P"):
lon *= -1 lon *= -1
speed = (information[4] - 28) * 10
dc28 = information[5] - 28
speed += int(dc28 / 10)
course = (dc28 % 10) * 100
course += information[6] - 28
if speed >= 800:
speed -= 800
if course >= 400:
course -= 400
comment = information[9:].decode("us-ascii").strip() comment = information[9:].decode("us-ascii").strip()
(comment, altitude) = self.extractAltitude(comment) (comment, altitude) = self.extractAltitude(comment)
@ -253,10 +263,13 @@ class MicEParser(object):
altitude = next((a for a in [altitude, insideAltitude] if a is not None), None) altitude = next((a for a in [altitude, insideAltitude] if a is not None), None)
return { return {
"fix": information[0] == ord("`") or information[0] == 0x1c,
"lat": lat, "lat": lat,
"lon": lon, "lon": lon,
"comment": comment, "comment": comment,
"altitude": altitude, "altitude": altitude,
"speed": speed,
"course": course,
"device": device, "device": device,
"type": "Mic-E", "type": "Mic-E",
"symboltable": chr(information[8]), "symboltable": chr(information[8]),