Coverage for src / bluetooth_sig / gatt / characteristics / report_map.py: 85%
13 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"""Report Map characteristic implementation."""
3from __future__ import annotations
5import msgspec
7from ..context import CharacteristicContext
8from .base import BaseCharacteristic
11class ReportMapData(msgspec.Struct, frozen=True):
12 """Parsed data from Report Map characteristic.
14 Attributes:
15 data: Report map data bytes (up to 512 octets)
16 """
18 data: bytes
21class ReportMapCharacteristic(BaseCharacteristic[ReportMapData]):
22 """Report Map characteristic (0x2A4B).
24 org.bluetooth.characteristic.report_map
26 Report Map characteristic.
27 """
29 min_length = 1
30 expected_type = bytes
32 def _decode_value(self, data: bytearray, ctx: CharacteristicContext | None = None) -> ReportMapData:
33 """Parse report map data.
35 Args:
36 data: Raw bytearray from BLE characteristic.
37 ctx: Optional context.
39 Returns:
40 ReportMapData containing the report map bytes.
41 """
42 return ReportMapData(data=bytes(data))
44 def _encode_value(self, data: ReportMapData) -> bytearray:
45 """Encode report map back to bytes.
47 Args:
48 data: ReportMapData instance to encode
50 Returns:
51 Encoded bytes
52 """
53 return bytearray(data.data)