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

9 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-03-18 11:17 +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 # SIG spec: sint16, resolution 0.1 m → fixed 2-byte payload 

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

22 expected_length = 2 

23 min_length = 2 

24 max_length = 2 

25 _template = ScaledSint16Template(scale_factor=0.1)