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

16 statements  

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

1"""Body Sensor Location characteristic implementation.""" 

2 

3from __future__ import annotations 

4 

5from enum import IntEnum 

6 

7from .base import BaseCharacteristic 

8from .templates import EnumTemplate 

9 

10 

11class BodySensorLocation(IntEnum): 

12 """Body sensor location enumeration (0x2A38).""" 

13 

14 OTHER = 0 

15 CHEST = 1 

16 WRIST = 2 

17 FINGER = 3 

18 HAND = 4 

19 EAR_LOBE = 5 

20 FOOT = 6 

21 

22 

23class BodySensorLocationCharacteristic(BaseCharacteristic[int]): 

24 """Body Sensor Location characteristic (0x2A38). 

25 

26 Represents the location of a sensor on the human body. 

27 Used primarily with heart rate and other health monitoring devices. 

28 

29 Spec: Bluetooth SIG Assigned Numbers, Body Sensor Location characteristic 

30 """ 

31 

32 _template = EnumTemplate.uint8(BodySensorLocation) 

33 

34 # YAML has no range constraint; enforce valid enum bounds. 

35 min_value: int = BodySensorLocation.OTHER # 0 

36 max_value: int = BodySensorLocation.FOOT # 6