src.bluetooth_sig.core.parser

Characteristic parsing with dependency-aware batch support.

Provides single and batch characteristic parsing, including topological dependency ordering for multi-characteristic reads. Stateless.

Attributes

Name

Description

T

logger

Classes

Name

Description

CharacteristicParser

Stateless parser for single and batch characteristic data.

Module Contents

class src.bluetooth_sig.core.parser.CharacteristicParser

Stateless parser for single and batch characteristic data.

Handles parse_characteristic (with @overload support), parse_characteristics (batch with dependency ordering), and all private batch helpers.

parse_characteristic(char: type[src.bluetooth_sig.gatt.characteristics.base.BaseCharacteristic[T]], raw_data: bytes | bytearray, ctx: src.bluetooth_sig.types.CharacteristicContext | None = ...) T
parse_characteristic(char: str, raw_data: bytes | bytearray, ctx: src.bluetooth_sig.types.CharacteristicContext | None = ...) Any

Parse a characteristic’s raw data using Bluetooth SIG standards.

Parameters:
  • char – Characteristic class (type-safe) or UUID string (not type-safe).

  • raw_data – Raw bytes from the characteristic (bytes or bytearray)

  • ctx – Optional CharacteristicContext providing device-level info

Returns:

Parsed value. Return type is inferred when passing characteristic class.

Raises:
parse_characteristics(char_data: dict[str, bytes], ctx: src.bluetooth_sig.types.CharacteristicContext | None = None) dict[str, Any]

Parse multiple characteristics at once with dependency-aware ordering.

Parameters:
  • char_data – Dictionary mapping UUIDs to raw data bytes

  • ctx – Optional CharacteristicContext used as the starting context

Returns:

Dictionary mapping UUIDs to parsed values

Raises:
src.bluetooth_sig.core.parser.T
src.bluetooth_sig.core.parser.logger