Coverage for src / bluetooth_sig / gatt / characteristics / current_track_object_id.py: 100%
16 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-03 16:41 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-03 16:41 +0000
1"""Current Track Object ID characteristic (0x2B9D)."""
3from __future__ import annotations
5from ...types.gatt_enums import CharacteristicRole
6from ..constants import UINT48_MAX
7from ..context import CharacteristicContext
8from .base import BaseCharacteristic
9from .utils import DataParser
12class CurrentTrackObjectIdCharacteristic(BaseCharacteristic[int]):
13 """Current Track Object ID characteristic (0x2B9D).
15 org.bluetooth.characteristic.current_track_object_id
17 OTS object ID for the current track.
18 """
20 _manual_role = CharacteristicRole.INFO
21 expected_length: int = 6
22 min_length: int = 6
23 min_value = 0
24 max_value = UINT48_MAX
26 def _decode_value(self, data: bytearray, ctx: CharacteristicContext | None = None, *, validate: bool = True) -> int:
27 """Parse current track object ID (uint48)."""
28 return DataParser.parse_int48(data, 0, signed=False)
30 def _encode_value(self, data: int) -> bytearray:
31 """Encode current track object ID to bytes."""
32 return DataParser.encode_int48(data, signed=False)