update tell()

pull/52/head
Junzi Sun 5 years ago
parent a683e40c41
commit e2ece806c2

@ -13,12 +13,15 @@ def tell(msg):
print() print()
df = common.df(msg) df = common.df(msg)
icao = common.icao(msg)
_print("Message", msg) _print("Message", msg)
_print("ICAO address", icao)
_print("Downlink Format", df) _print("Downlink Format", df)
if df == 17: if df == 17:
_print("Protocal", "Mode-S Extended Squitter (ADS-B)") _print("Protocal", "Mode-S Extended Squitter (ADS-B)")
tc = common.typecode(msg) tc = common.typecode(msg)
if 1 <= tc <= 4: # callsign if 1 <= tc <= 4: # callsign
callsign = adsb.callsign(msg) callsign = adsb.callsign(msg)
@ -26,14 +29,17 @@ def tell(msg):
_print("Callsign:", callsign) _print("Callsign:", callsign)
if 5 <= tc <= 8: # surface position if 5 <= tc <= 8: # surface position
_print("Type", "Surface movment") _print("Type", "Surface postition")
oe = adsb.oe_flag(msg) oe = adsb.oe_flag(msg)
msgbin = common.hex2bin(msg) msgbin = common.hex2bin(msg)
cprlat = common.bin2int(msgbin[54:71]) / 131072.0 cprlat = common.bin2int(msgbin[54:71]) / 131072.0
cprlon = common.bin2int(msgbin[71:88]) / 131072.0 cprlon = common.bin2int(msgbin[71:88]) / 131072.0
v = adsb.surface_velocity(msg)
_print("CPR format", "Odd" if oe else "Even") _print("CPR format", "Odd" if oe else "Even")
_print("CPR Latitude", cprlat) _print("CPR Latitude", cprlat)
_print("CPR Longitude", cprlon) _print("CPR Longitude", cprlon)
_print("Speed", v[0], "knots")
_print("Track", v[1], "degrees")
if 9 <= tc <= 18: # airborne position if 9 <= tc <= 18: # airborne position
_print("Type", "Airborne position (with barometric altitude)") _print("Type", "Airborne position (with barometric altitude)")

@ -14,6 +14,7 @@ messages = [
"A00004128F39F91A7E27C46ADC21", "A00004128F39F91A7E27C46ADC21",
] ]
print("-" * 70)
for m in messages: for m in messages:
tell(m) tell(m)
print("-" * 50) print("-" * 70)

Loading…
Cancel
Save