src.bluetooth_sig.gatt.characteristics.le_gatt_security_levels

LE GATT Security Levels characteristic (0x2BF5).

BT Core Spec v6.0, Vol 3, Part C, Section 12.7:

The Attribute Value is a sequence of Security Level Requirements, each with the type uint8[2]. Each Security Level Requirement consists of a Security Mode field followed by a Security Level field.

The Security Mode and Security Level shall be expressed as the same number as used in their definitions; e.g., mode 1 is represented as 0x01 and level 4 is represented as 0x04.

Security modes and levels defined in Section 10.2:
Mode 1 (encryption-based):

Level 1: No security (no authentication, no encryption) Level 2: Unauthenticated pairing with encryption Level 3: Authenticated pairing with encryption Level 4: Authenticated LE Secure Connections pairing with 128-bit encryption

Mode 2 (data signing):

Level 1: Unauthenticated pairing with data signing Level 2: Authenticated pairing with data signing

Mode 3 (broadcast isochronous):

Level 1: No security (no authentication, no encryption) Level 2: Use of unauthenticated Broadcast_Code Level 3: Use of authenticated Broadcast_Code

Classes

Name

Description

LEGATTSecurityLevelsCharacteristic

LE GATT Security Levels characteristic (0x2BF5).

LESecurityMode

LE security modes (BT Core Spec v6.0, Vol 3, Part C, Section 10.2).

LESecurityModeLevel

Combined security mode+level values for LE GATT Security Levels.

SecurityLevelRequirement

A single security level requirement (mode, level) pair.

Module Contents

class src.bluetooth_sig.gatt.characteristics.le_gatt_security_levels.LEGATTSecurityLevelsCharacteristic(info: src.bluetooth_sig.types.CharacteristicInfo | None = None, validation: src.bluetooth_sig.gatt.characteristics.characteristic_meta.ValidationConfig | None = None)

Bases: src.bluetooth_sig.gatt.characteristics.base.BaseCharacteristic[list[SecurityLevelRequirement]]

LE GATT Security Levels characteristic (0x2BF5).

org.bluetooth.characteristic.le_gatt_security_levels

Sequence of (security_mode, security_level) pairs indicating the highest security requirements of the GATT server on an LE connection.

min_length: int = 2
class src.bluetooth_sig.gatt.characteristics.le_gatt_security_levels.LESecurityMode

Bases: enum.IntEnum

LE security modes (BT Core Spec v6.0, Vol 3, Part C, Section 10.2).

BROADCAST_ISOCHRONOUS = 3
DATA_SIGNING = 2
ENCRYPTION = 1
class src.bluetooth_sig.gatt.characteristics.le_gatt_security_levels.LESecurityModeLevel

Bases: enum.IntEnum

Combined security mode+level values for LE GATT Security Levels.

Each value encodes (mode << 8 | level) for unique identification. The raw wire mode/level bytes can be recovered via the mode and level properties.

BT Core Spec v6.0, Vol 3, Part C, Section 10.2.

classmethod from_mode_level(mode: int, level: int) LESecurityModeLevel

Construct from raw mode and level bytes.

MODE1_AUTH_ENCRYPTION = 259
MODE1_AUTH_SC_ENCRYPTION = 260
MODE1_NO_SECURITY = 257
MODE1_UNAUTH_ENCRYPTION = 258
MODE2_AUTH_SIGNING = 514
MODE2_UNAUTH_SIGNING = 513
MODE3_AUTH_BROADCAST_CODE = 771
MODE3_NO_SECURITY = 769
MODE3_UNAUTH_BROADCAST_CODE = 770
property security_level: int

The security level number within the mode.

property security_mode: LESecurityMode

The LE security mode number.

class src.bluetooth_sig.gatt.characteristics.le_gatt_security_levels.SecurityLevelRequirement

Bases: msgspec.Struct

A single security level requirement (mode, level) pair.

level: int
mode: int
property mode_level: LESecurityModeLevel

Combined mode+level enum value.