src.bluetooth_sig.gatt.characteristics.elapsed_time

Elapsed Time characteristic implementation.

Implements the Elapsed Time characteristic (0x2BF2).

Structure (from GSS YAML - org.bluetooth.characteristic.elapsed_time):

Flags (uint8, 1 byte) – interpretation flags Time Value (uint48, 6 bytes) – counter in time-resolution units Time Sync Source Type (uint8, 1 byte) – sync source enum TZ/DST Offset (sint8, 1 byte) – combined offset in 15-minute units

Note: The GSS YAML identifier is elapsed_time but the UUID registry identifier is current_elapsed_time (0x2BF2). File is named to match the UUID registry for auto-discovery.

Flag bits:

0: Tick counter (0=time of day, 1=relative counter) 1: UTC (0=local time, 1=UTC) — meaningless for tick counter 2-3: Time resolution (00=1s, 01=100ms, 10=1ms, 11=100µs) 4: TZ/DST offset used (0=not used, 1=used) 5: Current timeline (0=not current, 1=current) 6-7: Reserved

References

Bluetooth SIG Generic Sensor Service org.bluetooth.characteristic.elapsed_time (GSS YAML)

Classes

Name

Description

ElapsedTimeCharacteristic

Elapsed Time characteristic (0x2BF2).

ElapsedTimeData

Parsed data from Current Elapsed Time characteristic.

ElapsedTimeFlags

Flags for the Elapsed Time characteristic.

TimeResolution

Time resolution values (bits 2-3 of flags).

Module Contents

class src.bluetooth_sig.gatt.characteristics.elapsed_time.ElapsedTimeCharacteristic(info: src.bluetooth_sig.types.CharacteristicInfo | None = None, validation: src.bluetooth_sig.gatt.characteristics.characteristic_meta.ValidationConfig | None = None)

Bases: src.bluetooth_sig.gatt.characteristics.base.BaseCharacteristic[ElapsedTimeData]

Elapsed Time characteristic (0x2BF2).

Reports the current time of a clock or tick counter.

Read/indicate format: 11 bytes (9-byte Elapsed Time struct + Clock Status + Clock Capabilities). Write format: 9 bytes (Elapsed Time struct only).

expected_type
max_length: int = 11
min_length: int = 9
class src.bluetooth_sig.gatt.characteristics.elapsed_time.ElapsedTimeData

Bases: msgspec.Struct

Parsed data from Current Elapsed Time characteristic.

flags

Interpretation flags.

time_value

Counter value in the resolution defined by flags.

time_resolution

Resolution of the time value.

is_tick_counter

True if time_value is a relative counter.

is_utc

True if time_value reports UTC (only meaningful if not tick counter).

tz_dst_used

True if tz_dst_offset is meaningful.

is_current_timeline

True if time stamp is from the current timeline.

sync_source_type

Time synchronisation source type.

tz_dst_offset

Combined TZ/DST offset from UTC in 15-minute units.

clock_needs_set

Server requests client to set the clock (Clock Status bit 0).

clock_applies_dst

Clock autonomously updates DST offset (Clock Capabilities bit 0).

clock_manages_tz

Clock autonomously updates TZ offset (Clock Capabilities bit 1).

clock_applies_dst: bool = False
clock_manages_tz: bool = False
clock_needs_set: bool = False
flags: ElapsedTimeFlags
is_current_timeline: bool
is_tick_counter: bool
is_utc: bool
sync_source_type: src.bluetooth_sig.gatt.characteristics.reference_time_information.TimeSource
time_resolution: TimeResolution
time_value: int
tz_dst_offset: int
tz_dst_used: bool
class src.bluetooth_sig.gatt.characteristics.elapsed_time.ElapsedTimeFlags

Bases: enum.IntFlag

Flags for the Elapsed Time characteristic.

CURRENT_TIMELINE = 32
TICK_COUNTER = 1
TZ_DST_USED = 16
UTC = 2
class src.bluetooth_sig.gatt.characteristics.elapsed_time.TimeResolution

Bases: enum.IntEnum

Time resolution values (bits 2-3 of flags).

HUNDRED_MICROSECONDS = 3
HUNDRED_MILLISECONDS = 1
ONE_MILLISECOND = 2
ONE_SECOND = 0