Fixing TCAS reports. Types 20 and 21 still bomb because apparently MB field is optional -- the only type 20s I see are short packets.

This commit is contained in:
Nick Foster
2012-06-29 09:32:58 -07:00
parent 28824cb0b2
commit 57f7bc84fc
3 changed files with 20 additions and 9 deletions

View File

@@ -182,8 +182,8 @@ class modes_reply(data_field):
11: {"df": (1,5), "ca": (6,3), "aa": (9,24), "pi": (33,24)},
16: {"df": (1,5), "vs": (6,1), "sl": (9,3), "ri": (14,4), "ac": (20,13), "mv": (33,56), "ap": (88,24)},
17: {"df": (1,5), "ca": (6,3), "aa": (9,24), "me": (33,56, me_reply), "pi": (88,24)},
20: {"df": (1,5), "fs": (6,3), "dr": (9,24), "um": (14,6), "ac": (20,13), "mb": (33,56, mb_reply), "ap": (88,24)},
21: {"df": (1,5), "fs": (6,3), "dr": (9,24), "um": (14,6), "id": (20,13), "mb": (33,56, mb_reply), "ap": (88,24)},
20: {"df": (1,5), "fs": (6,3), "dr": (9,5), "um": (14,6), "ac": (20,13), "mb": (33,56, mb_reply), "ap": (88,24)},
21: {"df": (1,5), "fs": (6,3), "dr": (9,5), "um": (14,6), "id": (20,13), "mb": (33,56, mb_reply), "ap": (88,24)},
24: {"df": (1,5), "ke": (6,1), "nd": (7,4), "md": (11,80), "ap": (88,24)}
}

View File

@@ -56,6 +56,8 @@ class modes_output_print(modes_parse.modes_parse):
output += self.print11(data, ecc)
elif msgtype == 17:
output += self.print17(data)
elif msgtype == 20 or msgtype == 21:
output += self.print20(data, ecc)
else:
output += "No handler for message type %i from %x (but it's in modes_parse)" % (msgtype, ecc)
print output
@@ -175,7 +177,11 @@ class modes_output_print(modes_parse.modes_parse):
return retstr
def print20(self, data, ecc):
[fs, dr, um, alt] = self.parse4(data)
msgtype = data["df"]
if(msgtype == 20):
[fs, dr, um, alt] = self.parse4(data)
else:
[fs, dr, um, ident] = self.parse5(data)
mb_fields = data["mb"].get_fields()
bds1 = mb_fields["bds1"]
bds2 = mb_fields["bds2"]
@@ -207,5 +213,10 @@ class modes_output_print(modes_parse.modes_parse):
retstr += " (resolved)"
else:
retstr = "No handler for BDS1 == %i from %x" % (bds1, ecc)
if(msgtype == 20):
retstr += " at %ift" % altitude
else:
retstr += " ident %x" % ident
return retstr