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

5 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-04-03 16:41 +0000

1"""Time Accuracy characteristic implementation.""" 

2 

3from __future__ import annotations 

4 

5from .base import BaseCharacteristic 

6from .templates import ScaledUint8Template 

7 

8 

9class TimeAccuracyCharacteristic(BaseCharacteristic[float]): 

10 """Time Accuracy characteristic (0x2A12). 

11 

12 org.bluetooth.characteristic.time_accuracy 

13 

14 Represents the accuracy (drift) of time information in seconds. 

15 M=1, d=0, b=-3 → scale factor 1/8 (0.125s per raw unit). 

16 Valid range: 0-253 raw (0s to 31.625s). 

17 Raw 254 = drift > 31.625s, raw 255 = unknown. 

18 

19 Raises: 

20 SpecialValueDetectedError: If raw value is a sentinel (e.g. 0xFE, 0xFF). 

21 """ 

22 

23 _template = ScaledUint8Template.from_letter_method(M=1, d=0, b=-3)