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 |
|---|---|
Classes¶
Name | Description |
|---|---|
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:
Length validation (pre-decode)
Raw integer extraction (little-endian per Bluetooth spec)
Special value detection (sentinel values like 0x8000)
Value decoding (via template or subclass
_decode_value)Range validation (post-decode)
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
CharacteristicContextfor dependency-aware parsing.validate – Whether to run validation stages.
- Returns:
Parsed value of type T.
- Raises:
SpecialValueDetectedError – If a sentinel value is detected.
CharacteristicParseError – If parsing or validation fails.
- src.bluetooth_sig.gatt.characteristics.pipeline.parse_pipeline.T¶