Merge branch 'wsmitchell3-dev'; Close #43
This commit is contained in:
commit
a3e205f001
|
|
@ -44,6 +44,25 @@ from aprslib.parsing.telemetry import *
|
|||
from aprslib.parsing.thirdparty import *
|
||||
from aprslib.parsing.weather import *
|
||||
|
||||
unsupported_formats = {
|
||||
'#':'raw weather report',
|
||||
'$':'raw gps',
|
||||
'%':'agrelo',
|
||||
'&':'reserved',
|
||||
'(':'unused',
|
||||
')':'item report',
|
||||
'*':'complete weather report',
|
||||
'+':'reserved',
|
||||
'-':'unused',
|
||||
'.':'reserved',
|
||||
'<':'station capabilities',
|
||||
'?':'general query format',
|
||||
'T':'telemetry report',
|
||||
'[':'maidenhead locator beacon',
|
||||
'\\':'unused',
|
||||
']':'unused',
|
||||
'^':'unused',
|
||||
}
|
||||
|
||||
def _unicode_packet(packet):
|
||||
# attempt utf-8
|
||||
|
|
@ -139,27 +158,8 @@ def parse(packet):
|
|||
def _try_toparse_body(packet_type, body, parsed):
|
||||
result = {}
|
||||
|
||||
# NOT SUPPORTED FORMATS
|
||||
#
|
||||
# # - raw weather report
|
||||
# $ - raw gps
|
||||
# % - agrelo
|
||||
# & - reserved
|
||||
# ( - unused
|
||||
# ) - item report
|
||||
# * - complete weather report
|
||||
# + - reserved
|
||||
# - - unused
|
||||
# . - reserved
|
||||
# < - station capabilities
|
||||
# ? - general query format
|
||||
# T - telemetry report
|
||||
# [ - maidenhead locator beacon
|
||||
# \ - unused
|
||||
# ] - unused
|
||||
# ^ - unused
|
||||
if packet_type in '#$%)*<?T[':
|
||||
raise UnknownFormat("format is not supported")
|
||||
if packet_type in unsupported_formats:
|
||||
raise UnknownFormat("Format is not supported: '{}' {}".format(packet_type, unsupported_formats[packet_type]))
|
||||
|
||||
# 3rd party traffic
|
||||
elif packet_type == '}':
|
||||
|
|
|
|||
|
|
@ -65,8 +65,8 @@ class ParseTestCase(unittest.TestCase):
|
|||
self.fail("empty status packet shouldn't raise exception")
|
||||
|
||||
def test_unsupported_formats_raising(self):
|
||||
with self.assertRaises(UnknownFormat):
|
||||
for packet_type in '#$%)*,<?T[_{':
|
||||
for packet_type in parsing.unsupported_formats:
|
||||
with self.assertRaises(UnknownFormat):
|
||||
packet = "A>B:%saaa" % packet_type
|
||||
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in New Issue