src.bluetooth_sig.gatt.descriptors.base

Base class for GATT descriptors.

Attributes

Name

Description

logger

Classes

Name

Description

BaseDescriptor

Base class for all GATT descriptors.

RangeDescriptorMixin

Mixin for descriptors that provide min/max value validation.

Module Contents

class src.bluetooth_sig.gatt.descriptors.base.BaseDescriptor

Bases: abc.ABC

Base class for all GATT descriptors.

Automatically resolves UUID and name from Bluetooth SIG registry. Provides parsing capabilities for descriptor values.

_descriptor_name

Optional explicit descriptor name for registry lookup.

_writable

Whether this descriptor type supports write operations. Override to True in writable descriptor subclasses (CCCD, SCCD).

Note

Most descriptors are read-only per Bluetooth SIG specification. Some like CCCD (0x2902) and SCCD (0x2903) support writes.

is_writable() bool

Check if descriptor type supports write operations.

Returns:

True if descriptor type supports writes, False otherwise.

Note

Only checks descriptor type, not runtime permissions or security. Example writable descriptors (CCCD, SCCD) override _writable = True.

parse_value(data: bytes) src.bluetooth_sig.types.DescriptorData

Parse raw descriptor data into structured format.

Parameters:

data – Raw bytes from the descriptor read

Returns:

DescriptorData object with parsed value and metadata

property info: src.bluetooth_sig.types.DescriptorInfo

Get the descriptor information.

property name: str

Get the descriptor name.

property uuid: src.bluetooth_sig.types.uuid.BluetoothUUID

Get the descriptor UUID.

class src.bluetooth_sig.gatt.descriptors.base.RangeDescriptorMixin

Mixin for descriptors that provide min/max value validation.

get_max_value(data: bytes) int | float

Get the maximum valid value.

Parameters:

data – Raw descriptor data

Returns:

Maximum valid value for the characteristic

get_min_value(data: bytes) int | float

Get the minimum valid value.

Parameters:

data – Raw descriptor data

Returns:

Minimum valid value for the characteristic

is_value_in_range(data: bytes, value: int | float) bool

Check if a value is within the valid range.

Parameters:
  • data – Raw descriptor data

  • value – Value to check

Returns:

True if value is within [min_value, max_value] range

src.bluetooth_sig.gatt.descriptors.base.logger