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

10 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2025-10-30 00:10 +0000

1"""Elevation characteristic implementation.""" 

2 

3from __future__ import annotations 

4 

5from ...types.gatt_enums import ValueType 

6from ...types.units import LengthUnit 

7from .base import BaseCharacteristic 

8from .templates import ScaledSint24Template 

9 

10 

11class ElevationCharacteristic(BaseCharacteristic): 

12 """Elevation characteristic (0x2A6C). 

13 

14 org.bluetooth.characteristic.elevation 

15 

16 Elevation characteristic. 

17 

18 Represents the elevation relative to sea level unless otherwise 

19 specified in the service. 

20 

21 Format: sint24 (3 bytes) with 0.01 meter resolution. 

22 """ 

23 

24 _template = ScaledSint24Template(scale_factor=0.01) 

25 

26 _manual_value_type: ValueType | str | None = "float" # Override YAML int type since decode_value returns float 

27 _manual_unit: str | None = LengthUnit.METERS.value # Override template's "units" default 

28 resolution: float = 0.01