Coverage for src / bluetooth_sig / gatt / characteristics / templates / __init__.py: 100%
13 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-03-18 11:17 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-03-18 11:17 +0000
1"""Coding templates for characteristic composition patterns.
3This package provides reusable coding template classes that can be composed into
4characteristics via dependency injection. Templates are pure coding strategies
5that do NOT inherit from BaseCharacteristic.
7All templates follow the CodingTemplate protocol and can be used by both SIG
8and custom characteristics through composition.
10Pipeline architecture:
11 bytes → [Extractor] → raw_int → [Translator] → typed_value
13Templates that handle single-field data expose `extractor` and `translator`
14properties for pipeline access. Complex templates (multi-field, variable-length)
15keep monolithic decode/encode since there's no single raw value to intercept.
16"""
18from .base import CodingTemplate
19from .composite import TimeDataTemplate, Vector2DTemplate, VectorTemplate
20from .data_structures import TimeData, Vector2DData, VectorData
21from .domain import ConcentrationTemplate, PressureTemplate, TemperatureTemplate
22from .enum import EnumTemplate
23from .epoch_date import EpochDateTemplate
24from .flag import FlagTemplate
25from .ieee_float import Float32Template, IEEE11073FloatTemplate
26from .numeric import (
27 Sint8Template,
28 Sint16Template,
29 Uint8Template,
30 Uint16Template,
31 Uint24Template,
32 Uint32Template,
33 Uint48Template,
34)
35from .scaled import (
36 PercentageTemplate,
37 ScaledSint8Template,
38 ScaledSint16Template,
39 ScaledSint24Template,
40 ScaledSint32Template,
41 ScaledTemplate,
42 ScaledUint8Template,
43 ScaledUint16Template,
44 ScaledUint24Template,
45 ScaledUint32Template,
46)
47from .string import Utf8StringTemplate, Utf16StringTemplate
48from .time_duration import TimeDurationTemplate, TimeExponentialTemplate
50__all__ = [
51 # Protocol
52 "CodingTemplate",
53 "ConcentrationTemplate",
54 # Enum template
55 "EnumTemplate",
56 # Date template
57 "EpochDateTemplate",
58 # Flag template
59 "FlagTemplate",
60 "Float32Template",
61 "IEEE11073FloatTemplate",
62 # Domain-specific templates
63 "PercentageTemplate",
64 "PressureTemplate",
65 "ScaledSint8Template",
66 "ScaledSint16Template",
67 "ScaledSint24Template",
68 "ScaledSint32Template",
69 # Scaled templates (base + concrete)
70 "ScaledTemplate",
71 "ScaledUint8Template",
72 "ScaledUint16Template",
73 "ScaledUint24Template",
74 "ScaledUint32Template",
75 "Sint8Template",
76 "Sint16Template",
77 "TemperatureTemplate",
78 "TimeData",
79 "TimeDataTemplate",
80 # Time-duration templates
81 "TimeDurationTemplate",
82 "TimeExponentialTemplate",
83 # Basic integer templates
84 "Uint8Template",
85 "Uint16Template",
86 "Uint24Template",
87 "Uint32Template",
88 "Uint48Template",
89 # String templates
90 "Utf8StringTemplate",
91 "Utf16StringTemplate",
92 "Vector2DData",
93 "Vector2DTemplate",
94 # Data structures
95 "VectorData",
96 # Vector templates
97 "VectorTemplate",
98]