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

10 statements  

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

1"""Altitude characteristic implementation.""" 

2 

3from __future__ import annotations 

4 

5from .base import BaseCharacteristic 

6from .templates import ScaledSint16Template 

7 

8 

9class AltitudeCharacteristic(BaseCharacteristic[float]): 

10 """Altitude characteristic (0x2AB3). 

11 

12 org.bluetooth.characteristic.altitude 

13 

14 Altitude characteristic. 

15 """ 

16 

17 # Validation attributes 

18 # Manual overrides required as Bluetooth SIG registry doesn't provide unit/value type 

19 _manual_unit = "m" 

20 _manual_value_type = "float" 

21 # SIG spec: sint16, resolution 0.1 m → fixed 2-byte payload 

22 # No GSS YAML available, so set explicit length from spec 

23 expected_length = 2 

24 min_length = 2 

25 max_length = 2 

26 _template = ScaledSint16Template(scale_factor=0.1)