add some type information; fix string offsets
This commit is contained in:
parent
6b93973d9b
commit
765f075576
12
owrx/aprs.py
12
owrx/aprs.py
@ -103,8 +103,7 @@ class AprsParser(object):
|
|||||||
}
|
}
|
||||||
|
|
||||||
if information[0] == 0x1c or information[0] == 0x60:
|
if information[0] == 0x1c or information[0] == 0x60:
|
||||||
parser = MicEParser()
|
aprsData.update(MicEParser().parse(data))
|
||||||
aprsData.update(parser.parse(data))
|
|
||||||
return aprsData
|
return aprsData
|
||||||
|
|
||||||
information = information.decode('us-ascii')
|
information = information.decode('us-ascii')
|
||||||
@ -123,9 +122,11 @@ class AprsParser(object):
|
|||||||
def parseRegularAprsData(self, information):
|
def parseRegularAprsData(self, information):
|
||||||
if self.hasCompressedCoordinatesx(information):
|
if self.hasCompressedCoordinatesx(information):
|
||||||
aprsData = self.parseCompressedCoordinates(information[0:10])
|
aprsData = self.parseCompressedCoordinates(information[0:10])
|
||||||
|
aprsData["type"] = "compressed"
|
||||||
aprsData["comment"] = information[10:]
|
aprsData["comment"] = information[10:]
|
||||||
else:
|
else:
|
||||||
aprsData = self.parseUncompressedCoordinates(information[0:19])
|
aprsData = self.parseUncompressedCoordinates(information[0:19])
|
||||||
|
aprsData["type"] = "regular"
|
||||||
aprsData["comment"] = information[19:]
|
aprsData["comment"] = information[19:]
|
||||||
return aprsData
|
return aprsData
|
||||||
|
|
||||||
@ -151,13 +152,13 @@ class MicEParser(object):
|
|||||||
def extractDevice(self, comment):
|
def extractDevice(self, comment):
|
||||||
if comment[0] == ">":
|
if comment[0] == ">":
|
||||||
if comment[-1] == "=":
|
if comment[-1] == "=":
|
||||||
return comment[1:], {"manufacturer": "Kenwood", "device": "TH-D72"}
|
return comment[1:-1], {"manufacturer": "Kenwood", "device": "TH-D72"}
|
||||||
if comment[-1] == "^":
|
if comment[-1] == "^":
|
||||||
return comment[1:], {"manufacturer": "Kenwood", "device": "TH-D74"}
|
return comment[1:-1], {"manufacturer": "Kenwood", "device": "TH-D74"}
|
||||||
return comment[1:], {"manufacturer": "Kenwood", "device": "TH-D7A"}
|
return comment[1:], {"manufacturer": "Kenwood", "device": "TH-D7A"}
|
||||||
if comment[0] == "]":
|
if comment[0] == "]":
|
||||||
if comment[-1] == "=":
|
if comment[-1] == "=":
|
||||||
return comment[1:], {"manufacturer": "Kenwood", "device": "TM-D710"}
|
return comment[1:-1], {"manufacturer": "Kenwood", "device": "TM-D710"}
|
||||||
return comment[1:], {"manufacturer": "Kenwood", "device": "TM-D700"}
|
return comment[1:], {"manufacturer": "Kenwood", "device": "TM-D700"}
|
||||||
if comment[0] == "`" or comment[0] == "'":
|
if comment[0] == "`" or comment[0] == "'":
|
||||||
if comment[-2] == "_":
|
if comment[-2] == "_":
|
||||||
@ -245,4 +246,5 @@ class MicEParser(object):
|
|||||||
"comment": comment,
|
"comment": comment,
|
||||||
"altitude": altitude,
|
"altitude": altitude,
|
||||||
"device": device,
|
"device": device,
|
||||||
|
"type": "Mic-E",
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user