Coverage for src / bluetooth_sig / gatt / characteristics / next_track_object_id.py: 100%

16 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-04-03 16:41 +0000

1"""Next Track Object ID characteristic (0x2B9E).""" 

2 

3from __future__ import annotations 

4 

5from ...types.gatt_enums import CharacteristicRole 

6from ..constants import UINT48_MAX 

7from ..context import CharacteristicContext 

8from .base import BaseCharacteristic 

9from .utils import DataParser 

10 

11 

12class NextTrackObjectIdCharacteristic(BaseCharacteristic[int]): 

13 """Next Track Object ID characteristic (0x2B9E). 

14 

15 org.bluetooth.characteristic.next_track_object_id 

16 

17 OTS object ID for the next track. 

18 """ 

19 

20 _manual_role = CharacteristicRole.INFO 

21 expected_length: int = 6 

22 min_length: int = 6 

23 min_value = 0 

24 max_value = UINT48_MAX 

25 

26 def _decode_value(self, data: bytearray, ctx: CharacteristicContext | None = None, *, validate: bool = True) -> int: 

27 """Parse next track object ID (uint48).""" 

28 return DataParser.parse_int48(data, 0, signed=False) 

29 

30 def _encode_value(self, data: int) -> bytearray: 

31 """Encode next track object ID to bytes.""" 

32 return DataParser.encode_int48(data, signed=False)