Update uplink.py
This commit is contained in:
@@ -43,12 +43,12 @@ def bds(msg):
|
|||||||
RRS = mbytes[2] & 0x0F
|
RRS = mbytes[2] & 0x0F
|
||||||
BDS2 = RRS
|
BDS2 = RRS
|
||||||
elif di == 3:
|
elif di == 3:
|
||||||
RRS = ((mbytes[2] & 0x1) << 4) | ((mbytes[3] & 0xE0) >> 5)
|
RRS = ((mbytes[2] & 0x1) << 3) | ((mbytes[3] & 0xE0) >> 5)
|
||||||
BDS2 = RRS
|
BDS2 = RRS
|
||||||
else:
|
else:
|
||||||
BDS2 = 0 # for other values of DI, the BDS2 is assumed 0 (as per ICAO Annex 10 Vol IV)
|
BDS2 = 0 # for other values of DI, the BDS2 is assumed 0 (as per ICAO Annex 10 Vol IV)
|
||||||
|
|
||||||
return str(BDS1) + str(BDS2)
|
return str(format(BDS1,"X")) + str(format(BDS2,"X"))
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
@@ -154,8 +154,7 @@ def uplink_fields(msg):
|
|||||||
di = ""
|
di = ""
|
||||||
RR = ""
|
RR = ""
|
||||||
RRS = ""
|
RRS = ""
|
||||||
BDS1 = ""
|
BDS = ""
|
||||||
BDS2 = ""
|
|
||||||
if uf(msg) == 11:
|
if uf(msg) == 11:
|
||||||
|
|
||||||
|
|
||||||
@@ -208,8 +207,11 @@ def uplink_fields(msg):
|
|||||||
# SI
|
# SI
|
||||||
SI = (mbytes[2] >> 2) & 0x3F
|
SI = (mbytes[2] >> 2) & 0x3F
|
||||||
IC = "SI" + str(SI)
|
IC = "SI" + str(SI)
|
||||||
RRS = ((mbytes[2] & 0x1) << 4) | ((mbytes[3] & 0xE0) >> 5)
|
RRS = ((mbytes[2] & 0x1) << 3) | ((mbytes[3] & 0xE0) >> 5)
|
||||||
BDS2 = RRS
|
BDS2 = RRS
|
||||||
|
if RR > 15:
|
||||||
|
BDS = str(format(BDS1,"X")) + str(format(BDS2,"X"))
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"DI": di,
|
"DI": di,
|
||||||
"IC": IC,
|
"IC": IC,
|
||||||
@@ -217,5 +219,5 @@ def uplink_fields(msg):
|
|||||||
"PR": PR,
|
"PR": PR,
|
||||||
"RR": RR,
|
"RR": RR,
|
||||||
"RRS": RRS,
|
"RRS": RRS,
|
||||||
"BDS": str(BDS1) + str(BDS2),
|
"BDS": BDS,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user