mirror of
https://github.com/bistromath/gr-air-modes.git
synced 2026-03-03 07:44:01 +01:00
Fix error handling for data construct on init.
This commit is contained in:
@@ -51,12 +51,16 @@ class data_field:
|
||||
#done once on init so you don't have to iterate down every time you grab a field
|
||||
def parse(self):
|
||||
fields = {}
|
||||
for field in self.types[self.get_type()]:
|
||||
bits = self.types[self.get_type()][field]
|
||||
if len(bits) == 3:
|
||||
obj = bits[2](self.get_bits(bits[0], bits[1]))
|
||||
fields.update(obj.parse())
|
||||
fields.update({field: self.get_bits(bits[0], bits[1])})
|
||||
mytype = self.get_type()
|
||||
if mytype in self.types:
|
||||
for field in self.types[mytype]:
|
||||
bits = self.types[self.get_type()][field]
|
||||
if len(bits) == 3:
|
||||
obj = bits[2](self.get_bits(bits[0], bits[1]))
|
||||
fields.update(obj.parse())
|
||||
fields.update({field: self.get_bits(bits[0], bits[1])})
|
||||
else:
|
||||
raise NoHandlerError(mytype)
|
||||
return fields
|
||||
|
||||
def get_type(self):
|
||||
|
||||
@@ -32,7 +32,6 @@ class modes_output_print(modes_parse.modes_parse):
|
||||
def parse(self, message):
|
||||
[data, ecc, reference, timestamp] = message.split()
|
||||
|
||||
data = modes_parse.modes_reply(long(data, 16))
|
||||
ecc = long(ecc, 16)
|
||||
reference = float(reference)
|
||||
timestamp = float(timestamp)
|
||||
@@ -45,6 +44,7 @@ class modes_output_print(modes_parse.modes_parse):
|
||||
output = "(%.0f %.10f) " % (refdb, timestamp);
|
||||
|
||||
try:
|
||||
data = modes_parse.modes_reply(long(data, 16))
|
||||
msgtype = data["df"]
|
||||
if msgtype == 0:
|
||||
output += self.print0(data, ecc)
|
||||
|
||||
Reference in New Issue
Block a user