Files
pyModeS/pyModeS/decoder/bds/bds10.py
Junzi Sun 2046b1de07 speedup (#59)
* remove unused functions

* cythonize common

* add bds05

* separate cleanly cython and python, bds05, bds06, modulo issues

* bds08

* bds09

* optimisations in bds09

* "make" things easier

* clean up useless stuff

* add make options

* fix hidden altitude() call

* minor updates to C code

* update tests

* update benchmark

* consolidation

* update clean script

* reduce complexity and change default type to str

Co-authored-by: Xavier Olive <1360812+xoolive@users.noreply.github.com>
2020-02-26 00:16:48 +01:00

54 lines
1.1 KiB
Python

# ------------------------------------------
# BDS 1,0
# Data link capability report
# ------------------------------------------
from __future__ import absolute_import, print_function, division
from pyModeS.decoder.common import hex2bin, bin2int, data, allzeros
def is10(msg):
"""Check if a message is likely to be BDS code 1,0
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
bool: True or False
"""
if allzeros(msg):
return False
d = hex2bin(data(msg))
# first 8 bits must be 0x10
if d[0:8] != "00010000":
return False
# bit 10 to 14 are reserved
if bin2int(d[9:14]) != 0:
return False
# overlay capability conflict
if d[14] == "1" and bin2int(d[16:23]) < 5:
return False
if d[14] == "0" and bin2int(d[16:23]) > 4:
return False
return True
def ovc10(msg):
"""Return the overlay control capability
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
int: Whether the transponder is OVC capable
"""
d = hex2bin(data(msg))
return int(d[14])