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

15 statements  

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

1"""Time Source characteristic implementation.""" 

2 

3from __future__ import annotations 

4 

5from enum import IntEnum 

6 

7from .base import BaseCharacteristic 

8from .templates import EnumTemplate 

9 

10 

11class TimeSource(IntEnum): 

12 """Time source enumeration. 

13 

14 Indicates the type of time source used for reference time. 

15 """ 

16 

17 UNKNOWN = 0 

18 NETWORK_TIME_PROTOCOL = 1 # NTP, SNTP 

19 GPS = 2 # GPS, Galileo, GLONASS, BeiDou 

20 RADIO_TIME_SIGNAL = 3 # Atomic clock synchronized through RF 

21 MANUAL = 4 # Manually set time 

22 ATOMIC_CLOCK = 5 # Legacy, usually same as RADIO_TIME_SIGNAL 

23 CELLULAR_NETWORK = 6 # GSM, CDMA, 4G 

24 NOT_SYNCHRONIZED = 7 

25 

26 

27class TimeSourceCharacteristic(BaseCharacteristic[int]): 

28 """Time Source characteristic (0x2A13). 

29 

30 org.bluetooth.characteristic.time_source 

31 

32 Indicates the source of the time information as an 8-bit enumeration. 

33 """ 

34 

35 _template = EnumTemplate.uint8(TimeSource)