Coverage for src / bluetooth_sig / gatt / characteristics / altitude.py: 100%
9 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-03 16:41 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-03 16:41 +0000
1"""Altitude characteristic implementation."""
3from __future__ import annotations
5from .base import BaseCharacteristic
6from .templates import ScaledUint16Template
9class AltitudeCharacteristic(BaseCharacteristic[float]):
10 """Altitude characteristic (0x2AB3).
12 org.bluetooth.characteristic.altitude
14 Altitude above the WGS84 ellipsoid.
15 """
17 # Validation attributes
18 # Manual overrides required as Bluetooth SIG registry doesn't provide unit/value type
19 _manual_unit = "m"
20 # IPS spec §3.7: uint16; x = h_dm + 1000 where h_dm is altitude in decimetres.
21 # Decoded value (metres) = (x - 1000) x 0.1 -> scale_factor=0.1, offset=-1000.
22 # 0xFFFF (65535) means "not configured".
23 expected_length = 2
24 min_length = 2
25 max_length = 2
26 _template = ScaledUint16Template(scale_factor=0.1, offset=-1000)