src.bluetooth_sig.gatt.characteristics.pipeline.parse_pipeline

Parse pipeline for GATT characteristic values.

Orchestrates the multi-stage parsing process: length validation → raw integer extraction → special value detection → value decoding → range/type validation.

Attributes

Name

Description

T

Classes

Name

Description

ParsePipeline

Multi-stage parse pipeline for characteristic values.

Module Contents

class src.bluetooth_sig.gatt.characteristics.pipeline.parse_pipeline.ParsePipeline(char: Any, validator: src.bluetooth_sig.gatt.characteristics.pipeline.validation.CharacteristicValidator)

Multi-stage parse pipeline for characteristic values.

Stages:
  1. Length validation (pre-decode)

  2. Raw integer extraction (little-endian per Bluetooth spec)

  3. Special value detection (sentinel values like 0x8000)

  4. Value decoding (via template or subclass _decode_value)

  5. Range validation (post-decode)

  6. Type validation

Uses a back-reference to the owning characteristic for: - _decode_value() dispatch (Template Method pattern) - Metadata access (name, uuid, _template, _spec) - Special value resolver

run(data: bytes | bytearray, ctx: Any | None = None, validate: bool = True) Any

Execute the full parse pipeline.

Parameters:
  • data – Raw bytes from BLE read.

  • ctx – Optional CharacteristicContext for dependency-aware parsing.

  • validate – Whether to run validation stages.

Returns:

Parsed value of type T.

Raises:
src.bluetooth_sig.gatt.characteristics.pipeline.parse_pipeline.T