Add support for type 16 Long Special Surveillance packets. Not tested with real data.

This commit is contained in:
Nick Foster 2012-10-17 18:28:39 -07:00
parent 5f89eba234
commit 7dba7f4cc3
3 changed files with 48 additions and 17 deletions

View File

@ -134,7 +134,7 @@ int air_modes_slicer::work(int noutput_items,
slice_result_t slice_result = slicer(in[i+j*2], in[i+j*2+1], rx_packet.reference_level); slice_result_t slice_result = slicer(in[i+j*2], in[i+j*2+1], rx_packet.reference_level);
if(slice_result.decision) pkt_hdr += 1 << (4-j); if(slice_result.decision) pkt_hdr += 1 << (4-j);
} }
if(pkt_hdr == 17 or pkt_hdr == 20 or pkt_hdr == 21) rx_packet.type = Long_Packet; if(pkt_hdr == 16 or pkt_hdr == 17 or pkt_hdr == 20 or pkt_hdr == 21) rx_packet.type = Long_Packet;
else rx_packet.type = Short_Packet; else rx_packet.type = Short_Packet;
int packet_length = (rx_packet.type == framer_packet_type(Short_Packet)) ? 56 : 112; int packet_length = (rx_packet.type == framer_packet_type(Short_Packet)) ? 56 : 112;

View File

@ -55,8 +55,8 @@ class output_print(air_modes.parse):
output += self.print11(data, ecc) output += self.print11(data, ecc)
elif msgtype == 17: elif msgtype == 17:
output += self.print17(data) output += self.print17(data)
elif msgtype == 20 or msgtype == 21: elif msgtype == 20 or msgtype == 21 or msgtype == 16:
output += self.print20(data, ecc) output += self.printTCAS(data, ecc)
else: else:
output += "No handler for message type %i from %x (but it's in modes_parse)" % (msgtype, ecc) output += "No handler for message type %i from %x (but it's in modes_parse)" % (msgtype, ecc)
return output return output
@ -184,12 +184,18 @@ class output_print(air_modes.parse):
return retstr return retstr
def print20(self, data, ecc): def printTCAS(self, data, ecc):
msgtype = data["df"] msgtype = data["df"]
if(msgtype == 20): if msgtype == 20 or msgtype == 16:
#type 16 does not have fs, dr, um but we get alt here
[fs, dr, um, alt] = self.parse4(data) [fs, dr, um, alt] = self.parse4(data)
else: elif msgtype == 21:
[fs, dr, um, ident] = self.parse5(data) [fs, dr, um, ident] = self.parse5(data)
if msgtype == 16:
bds1 = data["vds1"]
bds2 = data["vds2"]
else:
bds1 = data["bds1"] bds1 = data["bds1"]
bds2 = data["bds2"] bds2 = data["bds2"]
@ -206,6 +212,10 @@ class output_print(air_modes.parse):
elif bds1 == 3: elif bds1 == 3:
retstr = "Type %i TCAS report from %x: " % (msgtype, ecc) retstr = "Type %i TCAS report from %x: " % (msgtype, ecc)
tti = data["tti"] tti = data["tti"]
if msgtype == 16:
(resolutions, complements, rat, mte) = self.parse_TCAS_CRM(data)
retstr += "advised: %s complement: %s" % (resolutions, complements)
else:
if tti == 1: if tti == 1:
(resolutions, complements, rat, mte, threat_id) = self.parseMB_TCAS_threatid(data) (resolutions, complements, rat, mte, threat_id) = self.parseMB_TCAS_threatid(data)
retstr += "threat ID: %x advised: %s complement: %s" % (threat_id, resolutions, complements) retstr += "threat ID: %x advised: %s complement: %s" % (threat_id, resolutions, complements)
@ -221,7 +231,7 @@ class output_print(air_modes.parse):
else: else:
retstr = "No handler for BDS1 == %i from %x" % (bds1, ecc) retstr = "No handler for BDS1 == %i from %x" % (bds1, ecc)
if(msgtype == 20): if(msgtype == 20 or msgtype == 16):
retstr += " at %ift" % alt retstr += " at %ift" % alt
else: else:
retstr += " ident %x" % ident retstr += " ident %x" % ident

View File

@ -193,6 +193,22 @@ class mb_reply(data_field):
# "vds": (33,8), "vds1": (33,4), "vds2": (37,4) # "vds": (33,8), "vds1": (33,4), "vds2": (37,4)
# } # }
class mv_reply(data_field):
offset = 33
types = { "ara": (41,14), "mte": (60,1), "rac": (55,4), "rat": (59,1),
"vds": (33,8), "vds1": (33,4), "vds2": (37,4)
}
def get_type(self):
vds1 = self.get_bits(33,4)
vds2 = self.get_bits(37,4)
if vds1 not in (3,) or vds2 not in (0,):
raise NoHandlerError(bds1)
return int(vds1)
def get_numbits(self):
return 56
#the whole Mode S packet type #the whole Mode S packet type
class modes_reply(data_field): class modes_reply(data_field):
types = { 0: {"df": (1,5), "vs": (6,1), "cc": (7,1), "sl": (9,3), "ri": (14,4), "ac": (20,13), "ap": (33,24)}, types = { 0: {"df": (1,5), "vs": (6,1), "cc": (7,1), "sl": (9,3), "ri": (14,4), "ac": (20,13), "ap": (33,24)},
@ -404,3 +420,8 @@ class parse:
(resolutions, complements) = self.parseMB_TCAS_resolutions(data) (resolutions, complements) = self.parseMB_TCAS_resolutions(data)
threat_alt = decode_alt(data["tida"], True) threat_alt = decode_alt(data["tida"], True)
return (resolutions, complements, data["rat"], data["mte"], threat_alt, data["tidr"], data["tidb"]) return (resolutions, complements, data["rat"], data["mte"], threat_alt, data["tidr"], data["tidb"])
#type 16 Coordination Reply Message
def parse_TCAS_CRM(self, data):
(resolutions, complements) = self.parseMB_TCAS_resolutions(data)
return (resolutions, complements, data["rat"], data["mte"])