Coverage for src / bluetooth_sig / types / registry / descriptor_types.py: 90%
20 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-01-11 20:14 +0000
« prev ^ index » next coverage.py v7.13.1, created at 2026-01-11 20:14 +0000
1"""Data types for Bluetooth SIG descriptors."""
3from __future__ import annotations
5from typing import Any
7import msgspec
9from bluetooth_sig.types.base_types import SIGInfo
10from bluetooth_sig.types.uuid import BluetoothUUID
13class DescriptorInfo(SIGInfo):
14 """Information about a Bluetooth descriptor."""
16 # Descriptors may have structured data parsing requirements
17 has_structured_data: bool = False
18 data_format: str = "" # e.g., "uint16", "struct", etc.
21class DescriptorData(msgspec.Struct, kw_only=True):
22 """Parsed descriptor data with validation results."""
24 info: DescriptorInfo
25 value: Any | None = None
26 raw_data: bytes = b""
27 parse_success: bool = False
28 error_message: str = ""
30 @property
31 def name(self) -> str:
32 """Get the descriptor name from info."""
33 return self.info.name
35 @property
36 def uuid(self) -> BluetoothUUID:
37 """Get the descriptor UUID from info."""
38 return self.info.uuid