Coverage for src / bluetooth_sig / gatt / characteristics / device_time_feature.py: 100%
21 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"""Device Time Feature characteristic (0x2B8E).
3Per DTS v1.0 Table 3.2, the characteristic contains:
4 E2E_CRC (uint16, conditional) + DT_Features (uint16, mandatory).
6The DT_Features field is 2 octets (uint16). Bits 0-12 are defined in
7Table 3.3. Bits 13-15 are Reserved for Future Use.
9References:
10 Bluetooth SIG Device Time Service v1.0, Table 3.2, Table 3.3
11"""
13from __future__ import annotations
15from enum import IntFlag
17from .base import BaseCharacteristic
18from .templates import FlagTemplate
21class DeviceTimeFeatureFlags(IntFlag):
22 """DT_Features bitfield — DTS v1.0 Table 3.3.
24 Each bit indicates whether the corresponding service feature is supported.
25 Bits 13-15 are Reserved for Future Use.
26 """
28 E2E_CRC = 0x0001 # Bit 0
29 TIME_CHANGE_LOGGING = 0x0002 # Bit 1
30 BASE_TIME_SECOND_FRACTIONS = 0x0004 # Bit 2
31 TIME_OR_DATE_DISPLAYED_TO_USER = 0x0008 # Bit 3
32 DISPLAYED_FORMATS = 0x0010 # Bit 4
33 DISPLAYED_FORMATS_CHANGEABLE = 0x0020 # Bit 5
34 SEPARATE_USER_TIMELINE = 0x0040 # Bit 6
35 AUTHORIZATION_REQUIRED = 0x0080 # Bit 7
36 RTC_DRIFT_TRACKING = 0x0100 # Bit 8
37 EPOCH_YEAR_1900 = 0x0200 # Bit 9
38 EPOCH_YEAR_2000 = 0x0400 # Bit 10
39 PROPOSE_NON_LOGGED_TIME_ADJUSTMENT_LIMIT = 0x0800 # Bit 11
40 RETRIEVE_ACTIVE_TIME_ADJUSTMENTS = 0x1000 # Bit 12
43class DeviceTimeFeatureCharacteristic(BaseCharacteristic[DeviceTimeFeatureFlags]):
44 """Device Time Feature characteristic (0x2B8E).
46 org.bluetooth.characteristic.device_time_feature
48 Describes the features supported by the Device Time Service.
49 The DT_Features field is 2 octets (uint16). When the E2E-CRC feature
50 is not supported, the characteristic contains only DT_Features (2 octets).
51 """
53 expected_length: int = 2
54 _template = FlagTemplate.uint16(DeviceTimeFeatureFlags)