src.bluetooth_sig.types.mesh

Bluetooth Mesh protocol types per Bluetooth Mesh Profile Specification.

This module contains types for Bluetooth Mesh protocol structures including beacon types, provisioning PDUs, and mesh network data.

Reference: Bluetooth Mesh Profile Specification v1.1

Attributes

Classes

Name

Description

MeshBeaconType

Mesh beacon types per Bluetooth Mesh Profile 3.10.

MeshCapabilities

Mesh Provisioning Capabilities per Bluetooth Mesh Profile 5.4.1.2.

MeshMessage

Mesh Network PDU message per Bluetooth Mesh Profile 3.4.

ProvisioningBearerData

Provisioning Bearer (PB-ADV) data per Bluetooth Mesh Profile 5.3.

ProvisioningPDUType

Mesh Provisioning PDU types per Bluetooth Mesh Profile 5.4.

SecureNetworkBeacon

Mesh Secure Network Beacon per Bluetooth Mesh Profile 3.10.3.

SecureNetworkBeaconFlags

Secure Network Beacon flags per Bluetooth Mesh Profile 3.10.3.

UnprovisionedDeviceBeacon

Mesh Unprovisioned Device Beacon per Bluetooth Mesh Profile 3.10.2.

Module Contents

class src.bluetooth_sig.types.mesh.MeshBeaconType

Bases: enum.IntEnum

Mesh beacon types per Bluetooth Mesh Profile 3.10.

These identify the type of mesh beacon being broadcast.

SECURE_NETWORK = 1
UNPROVISIONED_DEVICE = 0
class src.bluetooth_sig.types.mesh.MeshCapabilities

Bases: msgspec.Struct

Mesh Provisioning Capabilities per Bluetooth Mesh Profile 5.4.1.2.

This structure describes the device’s provisioning capabilities and is sent in response to a Provisioning Invite PDU.

num_elements

Number of elements supported by the device

algorithms

Supported provisioning algorithms (bitmask)

public_key_type

Supported public key types

static_oob_type

Supported static OOB types

output_oob_size

Maximum size of Output OOB

output_oob_action

Supported Output OOB actions

input_oob_size

Maximum size of Input OOB

input_oob_action

Supported Input OOB actions

encode() bytearray

Encode capabilities to provisioning PDU format.

algorithms: int = 1
input_oob_action: int = 0
input_oob_size: int = 0
num_elements: int = 1
output_oob_action: int = 0
output_oob_size: int = 0
public_key_type: int = 0
static_oob_type: int = 0
class src.bluetooth_sig.types.mesh.MeshMessage

Bases: msgspec.Struct

Mesh Network PDU message per Bluetooth Mesh Profile 3.4.

ivi

IV Index least significant bit

nid

Network ID (7 bits)

ctl

Control message flag

ttl

Time To Live

seq

Sequence number (24 bits)

src

Source address

dst

Destination address

transport_pdu

Encrypted transport PDU

net_mic

Network MIC (32 or 64 bits)

classmethod decode(data: bytes | bytearray) MeshMessage

Decode from Network PDU bytes.

Parameters:

data – Raw Network PDU bytes

Returns:

Parsed MeshMessage

Raises:

ValueError – If data is too short

ctl: bool = False
dst: int = 0
ivi: int = 0
net_mic: bytes = b''
nid: int = 0
seq: int = 0
src: int = 0
transport_pdu: bytes = b''
ttl: int = 0
class src.bluetooth_sig.types.mesh.ProvisioningBearerData

Bases: msgspec.Struct

Provisioning Bearer (PB-ADV) data per Bluetooth Mesh Profile 5.3.

Link identifier (32 bits)

transaction_number

Transaction number

pdu_type

Provisioning PDU type

pdu_data

Raw PDU payload

classmethod decode(data: bytes | bytearray) ProvisioningBearerData

Decode from PB-ADV bytes.

Parameters:

data – Raw PB-ADV bytes

Returns:

Parsed ProvisioningBearerData

Raises:

ValueError – If data is too short

link_id: int = 0
pdu_data: bytes = b''
pdu_type: ProvisioningPDUType
transaction_number: int = 0
class src.bluetooth_sig.types.mesh.ProvisioningPDUType

Bases: enum.IntEnum

Mesh Provisioning PDU types per Bluetooth Mesh Profile 5.4.

These identify the provisioning protocol message type.

CAPABILITIES = 1
COMPLETE = 8
CONFIRMATION = 5
DATA = 7
FAILED = 9
INPUT_COMPLETE = 4
INVITE = 0
PUBLIC_KEY = 3
RANDOM = 6
START = 2
class src.bluetooth_sig.types.mesh.SecureNetworkBeacon

Bases: msgspec.Struct

Mesh Secure Network Beacon per Bluetooth Mesh Profile 3.10.3.

This beacon is broadcast by provisioned nodes to announce network presence and IV index.

network_id

8-byte Network ID derived from network key

iv_index

Current IV Index

key_refresh_flag

Key Refresh Flag

iv_update_flag

IV Update Flag

authentication_value

8-byte authentication value

classmethod decode(data: bytes | bytearray) SecureNetworkBeacon

Decode from beacon bytes.

Parameters:

data – Raw beacon bytes (without beacon type byte)

Returns:

Parsed SecureNetworkBeacon

Raises:

ValueError – If data is too short

encode() bytearray

Encode to beacon format.

Returns:

Encoded beacon bytes

Raises:

ValueError – If network_id is not 8 bytes

authentication_value: bytes = b''
iv_index: int = 0
iv_update_flag: bool = False
key_refresh_flag: bool = False
network_id: bytes
class src.bluetooth_sig.types.mesh.SecureNetworkBeaconFlags

Bases: enum.IntFlag

Secure Network Beacon flags per Bluetooth Mesh Profile 3.10.3.

These flags are combined in the beacon’s flags byte.

IV_UPDATE = 2
KEY_REFRESH = 1
NONE = 0
class src.bluetooth_sig.types.mesh.UnprovisionedDeviceBeacon

Bases: msgspec.Struct

Mesh Unprovisioned Device Beacon per Bluetooth Mesh Profile 3.10.2.

This beacon is broadcast by unprovisioned devices to announce their presence and provisioning capabilities.

device_uuid

16-byte device UUID

oob_info

OOB information flags

uri_hash

Optional 4-byte URI hash

classmethod decode(data: bytes | bytearray) UnprovisionedDeviceBeacon

Decode from beacon bytes.

Parameters:

data – Raw beacon bytes (without beacon type byte)

Returns:

Parsed UnprovisionedDeviceBeacon

Raises:

ValueError – If data is too short

encode() bytearray

Encode to beacon format.

Returns:

Encoded beacon bytes

Raises:

ValueError – If device_uuid is not 16 bytes

device_uuid: bytes
oob_info: int = 0
uri_hash: bytes | None = None
src.bluetooth_sig.types.mesh.ACCESS_MESSAGE_MIC_LENGTH = 4
src.bluetooth_sig.types.mesh.ALGORITHM_FIPS_P256 = 1
src.bluetooth_sig.types.mesh.AUTHENTICATION_VALUE_LENGTH = 8
src.bluetooth_sig.types.mesh.CONTROL_MESSAGE_MIC_LENGTH = 8
src.bluetooth_sig.types.mesh.DEVICE_UUID_LENGTH = 16
src.bluetooth_sig.types.mesh.MESH_MESSAGE_CTL_MASK = 128
src.bluetooth_sig.types.mesh.MESH_MESSAGE_IVI_MASK = 128
src.bluetooth_sig.types.mesh.MESH_MESSAGE_MIN_LENGTH = 9
src.bluetooth_sig.types.mesh.MESH_MESSAGE_NID_MASK = 127
src.bluetooth_sig.types.mesh.MESH_MESSAGE_TTL_MASK = 127
src.bluetooth_sig.types.mesh.NETWORK_ID_LENGTH = 8
src.bluetooth_sig.types.mesh.NETWORK_KEY_LENGTH = 16
src.bluetooth_sig.types.mesh.OOB_INFO_LENGTH = 2
src.bluetooth_sig.types.mesh.PB_ADV_MIN_LENGTH = 6
src.bluetooth_sig.types.mesh.PUBLIC_KEY_TYPE_NONE = 0
src.bluetooth_sig.types.mesh.STATIC_OOB_TYPE_NONE = 0
src.bluetooth_sig.types.mesh.UNPROVISIONED_BEACON_MIN_LENGTH = 18
src.bluetooth_sig.types.mesh.UNPROVISIONED_BEACON_WITH_HASH_LENGTH = 22
src.bluetooth_sig.types.mesh.URI_HASH_LENGTH = 4