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:
parent
28824cb0b2
commit
57f7bc84fc
@ -182,6 +182,12 @@ if __name__ == '__main__':
|
||||
outputs = [] #registry of plugin output functions
|
||||
updates = [] #registry of plugin update functions
|
||||
|
||||
if options.raw is True:
|
||||
rawport = air_modes.modes_raw_server()
|
||||
outputs.append(rawport.output)
|
||||
outputs.append(printraw)
|
||||
updates.append(rawport.add_pending_conns)
|
||||
|
||||
if options.kml is not None:
|
||||
#we spawn a thread to run every 30 seconds (or whatever) to generate KML
|
||||
kmlgen = air_modes.modes_kml(options.kml, my_position) #create a KML generating thread
|
||||
@ -195,12 +201,6 @@ if __name__ == '__main__':
|
||||
if options.no_print is not True:
|
||||
outputs.append(air_modes.modes_output_print(my_position).parse)
|
||||
|
||||
if options.raw is True:
|
||||
rawport = air_modes.modes_raw_server()
|
||||
outputs.append(rawport.output)
|
||||
outputs.append(printraw)
|
||||
updates.append(rawport.add_pending_conns)
|
||||
|
||||
if options.multiplayer is not None:
|
||||
[fghost, fgport] = options.multiplayer.split(':')
|
||||
fgout = air_modes.modes_flightgear(my_position, fghost, int(fgport))
|
||||
|
@ -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)}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user