Moved unsupported format list to larger scope, use the dictionary keys

to test if a packet is in the unsupported list.
This commit is contained in:
Bill Mitchell 2018-02-08 14:55:05 -06:00
parent 9153c2ba54
commit e73d1e9a2d
1 changed files with 21 additions and 41 deletions

View File

@ -43,6 +43,26 @@ from aprslib.parsing.message import *
from aprslib.parsing.telemetry 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',
'}':'3rd party traffic'
}
def _unicode_packet(packet):
# attempt utf-8
@ -138,47 +158,7 @@ def parse(packet):
def _try_toparse_body(packet_type, body, parsed):
result = {}
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',
'}':'3rd party traffic'
}
# 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
# } - 3rd party traffic
if packet_type in '#$%)*<?T[}':
if packet_type in unsupported_formats:
raise UnknownFormat('format is not supported: {0}'.format(unsupported_formats[packet_type]))
# user defined