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

9 statements  

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

1"""Longitude characteristic implementation.""" 

2 

3from __future__ import annotations 

4 

5from .base import BaseCharacteristic 

6from .templates import ScaledSint32Template 

7 

8 

9class LongitudeCharacteristic(BaseCharacteristic[float]): 

10 """Longitude characteristic (0x2AAF). 

11 

12 org.bluetooth.characteristic.longitude 

13 

14 Longitude characteristic representing geographic coordinate in degrees. 

15 Encoded as sint32 with scale factor 1e-7 degrees per unit. 

16 """ 

17 

18 # Geographic coordinate constants 

19 DEGREE_SCALING_FACTOR = 1e-7 # 10^-7 degrees per unit 

20 

21 # SIG range not encoded in YAML; enforce spec bounds [-180, 180] degrees. 

22 min_value = -180.0 

23 max_value = 180.0 

24 expected_type = float 

25 

26 _template = ScaledSint32Template(scale_factor=DEGREE_SCALING_FACTOR)