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

12 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-01-11 20:14 +0000

1"""Protocol Mode characteristic implementation.""" 

2 

3from __future__ import annotations 

4 

5from enum import IntEnum 

6 

7from .base import BaseCharacteristic 

8from .templates import EnumTemplate 

9 

10 

11class ProtocolMode(IntEnum): 

12 """Protocol Mode values.""" 

13 

14 BOOT_PROTOCOL = 0 

15 REPORT_PROTOCOL = 1 

16 

17 

18class ProtocolModeCharacteristic(BaseCharacteristic[int]): 

19 """Protocol Mode characteristic (0x2A4E). 

20 

21 org.bluetooth.characteristic.protocol_mode 

22 

23 Protocol Mode characteristic. 

24 """ 

25 

26 _template = EnumTemplate.uint8(ProtocolMode) 

27 

28 # SIG spec: uint8 enumerated mode value → fixed 1-byte payload; no GSS YAML 

29 expected_length = 1 

30 min_length = 1 

31 max_length = 1