Parser and error-handling changes.

This commit is contained in:
Nick Foster 2012-07-07 11:04:49 -07:00
parent b4cafe0384
commit 8439e0e5f3
3 changed files with 10 additions and 5 deletions

View File

@ -227,7 +227,7 @@ if __name__ == '__main__':
for out in outputs:
try:
out(msg.to_string())
except ADSBError:
except air_modes.ADSBError:
pass
elif runner.done:

View File

@ -75,9 +75,14 @@ class data_field:
def get_bits(self, *args):
startbit = args[0]
num = args[1]
bits = 0
try:
bits = (self.data \
>> (self.get_numbits() - startbit - num + self.offset)) \
& ((1 << num) - 1)
except ValueError:
#pass
print "Got short packet but expected long retrieving bits (%i, %i) with type %i" % (startbit, num, self.get_type())
return bits
class bds09_reply(data_field):

View File

@ -217,7 +217,7 @@ class modes_output_print(modes_parse.modes_parse):
retstr = "No handler for BDS1 == %i from %x" % (bds1, ecc)
if(msgtype == 20):
retstr += " at %ift" % altitude
retstr += " at %ift" % alt
else:
retstr += " ident %x" % ident