src.bluetooth_sig.gatt.characteristics.templates.composite

Composite multi-field templates for time and vector data.

Covers TimeDataTemplate, VectorTemplate, and Vector2DTemplate. These templates handle multi-field structures and do NOT expose extractor/translator since there is no single raw value to intercept.

Classes

Name

Description

TimeDataTemplate

Template for Bluetooth SIG time data parsing (10 bytes).

Vector2DTemplate

Template for 2D vector measurements (x, y float32 components).

VectorTemplate

Template for 3D vector measurements (x, y, z float32 components).

Module Contents

class src.bluetooth_sig.gatt.characteristics.templates.composite.TimeDataTemplate

Bases: src.bluetooth_sig.gatt.characteristics.templates.base.CodingTemplate[src.bluetooth_sig.gatt.characteristics.templates.data_structures.TimeData]

Template for Bluetooth SIG time data parsing (10 bytes).

Used for Current Time and Time with DST characteristics. Structure: Date Time (7 bytes) + Day of Week (1) + Fractions256 (1) + Adjust Reason (1)

decode_value(data: bytearray, offset: int = 0, ctx: src.bluetooth_sig.gatt.context.CharacteristicContext | None = None, *, validate: bool = True) src.bluetooth_sig.gatt.characteristics.templates.data_structures.TimeData

Parse time data from bytes.

encode_value(value: src.bluetooth_sig.gatt.characteristics.templates.data_structures.TimeData, *, validate: bool = True) bytearray

Encode time data to bytes.

ADJUST_REASON_MAX = 255
DAY_OF_WEEK_MAX = 7
FRACTIONS256_MAX = 255
LENGTH = 10
property data_size: int

10 bytes.

Type:

Size

class src.bluetooth_sig.gatt.characteristics.templates.composite.Vector2DTemplate

Bases: src.bluetooth_sig.gatt.characteristics.templates.base.CodingTemplate[src.bluetooth_sig.gatt.characteristics.templates.data_structures.Vector2DData]

Template for 2D vector measurements (x, y float32 components).

decode_value(data: bytearray, offset: int = 0, ctx: src.bluetooth_sig.gatt.context.CharacteristicContext | None = None, *, validate: bool = True) src.bluetooth_sig.gatt.characteristics.templates.data_structures.Vector2DData

Parse 2D vector data.

encode_value(value: src.bluetooth_sig.gatt.characteristics.templates.data_structures.Vector2DData, *, validate: bool = True) bytearray

Encode 2D vector data to bytes.

property data_size: int

8 bytes (2 x float32).

Type:

Size

class src.bluetooth_sig.gatt.characteristics.templates.composite.VectorTemplate

Bases: src.bluetooth_sig.gatt.characteristics.templates.base.CodingTemplate[src.bluetooth_sig.gatt.characteristics.templates.data_structures.VectorData]

Template for 3D vector measurements (x, y, z float32 components).

decode_value(data: bytearray, offset: int = 0, ctx: src.bluetooth_sig.gatt.context.CharacteristicContext | None = None, *, validate: bool = True) src.bluetooth_sig.gatt.characteristics.templates.data_structures.VectorData

Parse 3D vector data.

encode_value(value: src.bluetooth_sig.gatt.characteristics.templates.data_structures.VectorData, *, validate: bool = True) bytearray

Encode 3D vector data to bytes.

property data_size: int

12 bytes (3 x float32).

Type:

Size