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:
parent
9153c2ba54
commit
e73d1e9a2d
|
|
@ -43,6 +43,26 @@ from aprslib.parsing.message import *
|
||||||
from aprslib.parsing.telemetry import *
|
from aprslib.parsing.telemetry import *
|
||||||
from aprslib.parsing.weather 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):
|
def _unicode_packet(packet):
|
||||||
# attempt utf-8
|
# attempt utf-8
|
||||||
|
|
@ -138,47 +158,7 @@ def parse(packet):
|
||||||
def _try_toparse_body(packet_type, body, parsed):
|
def _try_toparse_body(packet_type, body, parsed):
|
||||||
result = {}
|
result = {}
|
||||||
|
|
||||||
unsupported_formats = {
|
if packet_type in 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[}':
|
|
||||||
raise UnknownFormat('format is not supported: {0}'.format(unsupported_formats[packet_type]))
|
raise UnknownFormat('format is not supported: {0}'.format(unsupported_formats[packet_type]))
|
||||||
|
|
||||||
# user defined
|
# user defined
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue