pyModeS.common module¶
-
pyModeS.common.
allzeros
(msg)[source]¶ Check if the data bits are all zeros.
- Parameters
msg (String) – 28 bytes hexadecimal message string
- Returns
True or False
- Return type
bool
-
pyModeS.common.
altcode
(msg)[source]¶ Compute the altitude.
Applicable only for DF4 or DF20 message, bit 20-32. credit: @fbyrkjeland
- Parameters
msg (String) – 28 bytes hexadecimal message string
- Returns
altitude in ft
- Return type
int
-
pyModeS.common.
crc
(msg, encode=False)[source]¶ Mode-S Cyclic Redundancy Check.
Detect if bit error occurs in the Mode-S message. When encode option is on, the checksum is generated.
- Parameters
msg (string) – 28 bytes hexadecimal message string
encode (bool) – True to encode the date only and return the checksum
- Returns
message checksum, or partity bits (encoder)
- Return type
int
-
pyModeS.common.
crc_legacy
(msg, encode=False)[source]¶ Mode-S Cyclic Redundancy Check. (Legacy code, 2x slow).
-
pyModeS.common.
floor
(x)[source]¶ Mode-S floor function.
Defined as the greatest integer value k, such that k <= x For example: floor(3.6) = 3 and floor(-3.6) = -4
-
pyModeS.common.
hex2bin
(hexstr)[source]¶ Convert a hexdecimal string to binary string, with zero fillings.
-
pyModeS.common.
icao
(msg)[source]¶ Calculate the ICAO address from an Mode-S message.
Applicable only with DF4, DF5, DF20, DF21 messages.
- Parameters
msg (String) – 28 bytes hexadecimal message string
- Returns
ICAO address in 6 bytes hexadecimal string
- Return type
String
-
pyModeS.common.
idcode
(msg)[source]¶ Compute identity (squawk code).
Applicable only for DF5 or DF21 messages, bit 20-32. credit: @fbyrkjeland
- Parameters
msg (String) – 28 bytes hexadecimal message string
- Returns
squawk code
- Return type
string
-
pyModeS.common.
is_icao_assigned
(icao)[source]¶ Check whether the ICAO address is assigned (Annex 10, Vol 3).