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

13 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-04-03 16:41 +0000

1"""Coding templates for characteristic composition patterns. 

2 

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. 

6 

7All templates follow the CodingTemplate protocol and can be used by both SIG 

8and custom characteristics through composition. 

9 

10Pipeline architecture: 

11 bytes → [Extractor] → raw_int → [Translator] → typed_value 

12 

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""" 

17 

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 Sint32Template, 

30 Uint8Template, 

31 Uint16Template, 

32 Uint24Template, 

33 Uint32Template, 

34 Uint48Template, 

35) 

36from .scaled import ( 

37 PercentageTemplate, 

38 ScaledSint8Template, 

39 ScaledSint16Template, 

40 ScaledSint24Template, 

41 ScaledSint32Template, 

42 ScaledTemplate, 

43 ScaledUint8Template, 

44 ScaledUint16Template, 

45 ScaledUint24Template, 

46 ScaledUint32Template, 

47) 

48from .string import Utf8StringTemplate, Utf16StringTemplate 

49from .time_duration import TimeDurationTemplate, TimeExponentialTemplate 

50 

51__all__ = [ 

52 # Protocol 

53 "CodingTemplate", 

54 "ConcentrationTemplate", 

55 # Enum template 

56 "EnumTemplate", 

57 # Date template 

58 "EpochDateTemplate", 

59 # Flag template 

60 "FlagTemplate", 

61 "Float32Template", 

62 "IEEE11073FloatTemplate", 

63 # Domain-specific templates 

64 "PercentageTemplate", 

65 "PressureTemplate", 

66 "ScaledSint8Template", 

67 "ScaledSint16Template", 

68 "ScaledSint24Template", 

69 "ScaledSint32Template", 

70 # Scaled templates (base + concrete) 

71 "ScaledTemplate", 

72 "ScaledUint8Template", 

73 "ScaledUint16Template", 

74 "ScaledUint24Template", 

75 "ScaledUint32Template", 

76 "Sint8Template", 

77 "Sint16Template", 

78 "Sint32Template", 

79 "TemperatureTemplate", 

80 "TimeData", 

81 "TimeDataTemplate", 

82 # Time-duration templates 

83 "TimeDurationTemplate", 

84 "TimeExponentialTemplate", 

85 # Basic integer templates 

86 "Uint8Template", 

87 "Uint16Template", 

88 "Uint24Template", 

89 "Uint32Template", 

90 "Uint48Template", 

91 # String templates 

92 "Utf8StringTemplate", 

93 "Utf16StringTemplate", 

94 "Vector2DData", 

95 "Vector2DTemplate", 

96 # Data structures 

97 "VectorData", 

98 # Vector templates 

99 "VectorTemplate", 

100]