kopia lustrzana https://github.com/glidernet/python-ogn-client
Fixes #25
rodzic
8857a31e78
commit
384f0edc7e
|
@ -74,8 +74,9 @@ def parse_comment(aprs_comment, dstcall="APRS", aprs_type="position"):
|
||||||
if rc_data:
|
if rc_data:
|
||||||
rc_data.update({'beacon_type': 'receiver_beacon'})
|
rc_data.update({'beacon_type': 'receiver_beacon'})
|
||||||
return rc_data
|
return rc_data
|
||||||
|
else:
|
||||||
raise OgnParseError(aprs_comment)
|
return {'user_comment': aprs_comment,
|
||||||
|
'beacon_type': 'receiver_beacon'}
|
||||||
elif dstcall == "OGFLR":
|
elif dstcall == "OGFLR":
|
||||||
ac_data = parse_aircraft_beacon(aprs_comment)
|
ac_data = parse_aircraft_beacon(aprs_comment)
|
||||||
ac_data.update({'beacon_type': 'aircraft_beacon'})
|
ac_data.update({'beacon_type': 'aircraft_beacon'})
|
||||||
|
@ -117,4 +118,4 @@ def parse_comment(aprs_comment, dstcall="APRS", aprs_type="position"):
|
||||||
ac_data.update({'beacon_type': 'spot_beacon'})
|
ac_data.update({'beacon_type': 'spot_beacon'})
|
||||||
return ac_data
|
return ac_data
|
||||||
else:
|
else:
|
||||||
raise ValueError("dstcall {} unknown".format(dstcall))
|
raise OgnParseError("No parser for dstcall {} found. APRS comment: {}".format(dstcall, aprs_comment))
|
||||||
|
|
|
@ -63,6 +63,13 @@ class TestStringMethods(unittest.TestCase):
|
||||||
with self.assertRaises(AprsParseError):
|
with self.assertRaises(AprsParseError):
|
||||||
parse("Lachens>APRS,TCPIwontbeavalidstring")
|
parse("Lachens>APRS,TCPIwontbeavalidstring")
|
||||||
|
|
||||||
|
def test_v026_chile(self):
|
||||||
|
# receiver beacons from chile have a APRS position message with a pure user comment
|
||||||
|
raw_message = "VITACURA1>APRS,TCPIP*,qAC,GLIDERN4:/201146h3322.79SI07034.80W&/A=002329 Vitacura Municipal Aerodrome, Club de Planeadores Vitacura"
|
||||||
|
message = parse(raw_message)
|
||||||
|
|
||||||
|
self.assertEqual(message['user_comment'], "Vitacura Municipal Aerodrome, Club de Planeadores Vitacura")
|
||||||
|
|
||||||
@mock.patch('ogn.parser.parse_module.createTimestamp')
|
@mock.patch('ogn.parser.parse_module.createTimestamp')
|
||||||
def test_default_reference_date(self, createTimestamp_mock):
|
def test_default_reference_date(self, createTimestamp_mock):
|
||||||
valid_aprs_string = "Lachens>APRS,TCPIP*,qAC,GLIDERN2:/165334h4344.70NI00639.19E&/A=005435 v0.2.1 CPU:0.3 RAM:1764.4/2121.4MB NTP:2.8ms/+4.9ppm +47.0C RF:+0.70dB"
|
valid_aprs_string = "Lachens>APRS,TCPIP*,qAC,GLIDERN2:/165334h4344.70NI00639.19E&/A=005435 v0.2.1 CPU:0.3 RAM:1764.4/2121.4MB NTP:2.8ms/+4.9ppm +47.0C RF:+0.70dB"
|
||||||
|
|
|
@ -22,5 +22,6 @@ CNF3a>APRS,TCPIP*,qAC,GLIDERN3:>042143h v0.2.5.ARM CPU:0.6 RAM:514.6/970.8MB NTP
|
||||||
VITACURA2>APRS,TCPIP*,qAC,GLIDERN3:/042136h3322.81SI07034.95W&/A=002345 v0.2.5.ARM CPU:0.3 RAM:695.0/970.5MB NTP:0.6ms/-5.7ppm +51.5C RF:+0-0.0ppm/+1.32dB
|
VITACURA2>APRS,TCPIP*,qAC,GLIDERN3:/042136h3322.81SI07034.95W&/A=002345 v0.2.5.ARM CPU:0.3 RAM:695.0/970.5MB NTP:0.6ms/-5.7ppm +51.5C RF:+0-0.0ppm/+1.32dB
|
||||||
VITACURA2>APRS,TCPIP*,qAC,GLIDERN3:>042136h v0.2.5.ARM CPU:0.3 RAM:695.0/970.5MB NTP:0.6ms/-5.7ppm +52.1C 0/0Acfts[1h] RF:+0-0.0ppm/+1.32dB/+2.1dB@10km[193897]/+9.0dB@10km[10/20]
|
VITACURA2>APRS,TCPIP*,qAC,GLIDERN3:>042136h v0.2.5.ARM CPU:0.3 RAM:695.0/970.5MB NTP:0.6ms/-5.7ppm +52.1C 0/0Acfts[1h] RF:+0-0.0ppm/+1.32dB/+2.1dB@10km[193897]/+9.0dB@10km[10/20]
|
||||||
#
|
#
|
||||||
# since 0.2.6 the ogn comment of a receiver beacon is just optional
|
# since 0.2.6 the ogn comment of a receiver beacon is just optional, it also can be a user comment
|
||||||
Ulrichamn>APRS,TCPIP*,qAC,GLIDERN1:/085616h5747.30NI01324.77E&/A=001322
|
Ulrichamn>APRS,TCPIP*,qAC,GLIDERN1:/085616h5747.30NI01324.77E&/A=001322
|
||||||
|
ROBLE3>APRS,TCPIP*,qAC,GLIDERN4:/200022h3258.58SI07100.78W&/A=007229 Contact: achanes@manquehue.net, brito.felipe@gmail.com
|
||||||
|
|
Ładowanie…
Reference in New Issue