max_ble_hci.constants

Contains HCI constants definitions.

class AddrType(value)[source]

Bases: Enum

BLE-defined peer address types.

PUBLIC = 0

Public device address.

PUBLIC_IDENTITY = 2

Resolvable Private address based on local IRK from resolving list, or public address if no match is found.

Note

For advertising, this value is valid for own device address type only. For connection, this value is valid for both own device address type and connectable peer device address type.

RANDOM = 1

Random device address.

RANDOM_IDENTITY = 3

Resolvable Private address based on local IRK from resolving list, or random address is no match is found.

Note

For advertising, this value is valid for own device address type only. For connection, this value is valid for both own device address type and connectable peer device address type.

class Endian(value)[source]

Bases: Enum

Endian byte-order definitions.

BIG = 'big'

Big endian byte order.

LITTLE = 'little'

Little endian byte order.

MAX_U16 = 65535

Maximum value for a 16-bit unsigned integer.

MAX_U32 = 4294967295

Maximum value for a 32-bit unsigned integer.

MAX_U64 = 18446744073709551615

Maximum value for a 64-bit unsigned integer.

class PayloadOption(value)[source]

Bases: Enum

BLE-definded payload options.

PLD_00000000 = 5

00000000 payload option.

PLD_00001111 = 6

00001111 payload option.

PLD_01010101 = 7

01010101 payload option.

PLD_10101010 = 2

10101010 payload option.

PLD_11110000 = 1

11110000 payload option.

PLD_11111111 = 4

11111111 payload option.

PLD_PRBS15 = 3

PRBS15 payload option.

PLD_PRBS9 = 0

PRBS9 payload option.

class PhyOption(value)[source]

Bases: Enum

BLE-defined PHY options.

PHY_1M = 1

1M PHY option.

PHY_2M = 2

2M PHY option.

PHY_CODED = 3

Generic coded PHY option.

PHY_CODED_S2 = 4

Coded S2 PHY option.

PHY_CODED_S8 = 3

Coded S8 PHY option.

static str_to_enum(phy: str) PhyOption[source]

Convert phy as string to enum

Parameters:

phy (str) – PHY (1M, 2M, S8, S2)

Returns:

PHY option as enum

Return type:

PhyOption

Raises:

ValueError – If PHY option does not exist

static to_mask(phy: PhyOption) Tuple[int, int][source]

Convert list of phy options to PHY preference mask and PHY option mask

Parameters:

phy (PhyOption) – PhyOption Enum

Returns:

PHY preference mask as defined by BLE spec PHY option mask as defined by BLE spec

Return type:

Tuple[int, int]

class PubKeyValidateMode(value)[source]

Bases: Enum

Public key validation modes.

ALT1 = 0

ALT1 validation mode.

ALT2 = 1

ALT2 validation mode.