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

7 statements  

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

1"""Time with DST characteristic (0x2A11) implementation. 

2 

3Represents the date and time of the next Daylight Saving Time change. 

4Used by Next DST Change Service (0x1807). 

5 

6Based on Bluetooth SIG GATT Specification: 

7- Time with DST: 10 bytes (same structure as Current Time) 

8- Date Time: Year (uint16) + Month + Day + Hours + Minutes + Seconds (7 bytes) 

9- Day of Week: uint8 (1=Monday to 7=Sunday, 0=Unknown) 

10- Fractions256: uint8 (0-255, representing 1/256 fractions of a second) 

11- Adjust Reason: uint8 bitfield (Manual Update, External Reference, Time Zone, DST) 

12""" 

13 

14from __future__ import annotations 

15 

16from .base import BaseCharacteristic 

17from .templates import TimeData, TimeDataTemplate 

18 

19 

20class TimeWithDstCharacteristic(BaseCharacteristic[TimeData]): 

21 """Time with DST characteristic (0x2A11). 

22 

23 Represents the date and time when the next Daylight Saving Time change occurs. 

24 

25 Structure (10 bytes): 

26 - Year: uint16 (1582-9999, 0=unknown) 

27 - Month: uint8 (1-12, 0=unknown) 

28 - Day: uint8 (1-31, 0=unknown) 

29 - Hours: uint8 (0-23) 

30 - Minutes: uint8 (0-59) 

31 - Seconds: uint8 (0-59) 

32 - Day of Week: uint8 (0=unknown, 1=Monday...7=Sunday) 

33 - Fractions256: uint8 (0-255, representing 1/256 fractions of a second) 

34 - Adjust Reason: uint8 bitfield 

35 """ 

36 

37 def __init__(self) -> None: 

38 """Initialize the Time with DST characteristic.""" 

39 super().__init__() 

40 self._template = TimeDataTemplate()