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
e79aafe29a
commit
3c82d6463e
|
|
@ -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,45 +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',
|
||||
}
|
||||
# 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[':
|
||||
if packet_type in unsupported_formats:
|
||||
raise UnknownFormat('format is not supported: {0}'.format(unsupported_formats[packet_type]))
|
||||
|
||||
# 3rd party traffic
|
||||
|
|
|
|||
Loading…
Reference in New Issue