src.bluetooth_sig.gatt.characteristics.templates.domain¶
Domain-specific templates that compose scaled templates.
Covers TemperatureTemplate, ConcentrationTemplate, PressureTemplate.
Classes¶
Name | Description |
|---|---|
Template for concentration measurements with configurable resolution. |
|
Template for pressure measurements (uint32, 0.1 Pa resolution). |
|
Template for standard Bluetooth SIG temperature format (sint16, 0.01°C resolution). |
Module Contents¶
- class src.bluetooth_sig.gatt.characteristics.templates.domain.ConcentrationTemplate(resolution: float = 1.0)¶
Bases:
src.bluetooth_sig.gatt.characteristics.templates.base.CodingTemplate[float]Template for concentration measurements with configurable resolution.
Used for environmental sensors like CO2, VOC, particulate matter, etc.
- decode_value(data: bytearray, offset: int = 0, ctx: src.bluetooth_sig.gatt.context.CharacteristicContext | None = None, *, validate: bool = True) float¶
Parse concentration with resolution.
- encode_value(value: float, *, validate: bool = True) bytearray¶
Encode concentration value to bytes.
- classmethod from_letter_method(M: int, d: int, b: int = 0) ConcentrationTemplate¶
Create instance using Bluetooth SIG M, d, b parameters.
- Parameters:
M – Multiplier factor
d – Decimal exponent (10^d)
b – Offset to add to raw value before scaling
- Returns:
ConcentrationTemplate instance
- property extractor: src.bluetooth_sig.gatt.characteristics.utils.extractors.RawExtractor¶
Get extractor from underlying scaled template.
- property translator: src.bluetooth_sig.gatt.characteristics.utils.translators.ValueTranslator[float]¶
Return the linear translator from the underlying scaled template.
- class src.bluetooth_sig.gatt.characteristics.templates.domain.PressureTemplate¶
Bases:
src.bluetooth_sig.gatt.characteristics.templates.base.CodingTemplate[float]Template for pressure measurements (uint32, 0.1 Pa resolution).
- decode_value(data: bytearray, offset: int = 0, ctx: src.bluetooth_sig.gatt.context.CharacteristicContext | None = None, *, validate: bool = True) float¶
Parse pressure in 0.1 Pa resolution (returns Pa).
- property extractor: src.bluetooth_sig.gatt.characteristics.utils.extractors.RawExtractor¶
Get extractor from underlying scaled template.
- property translator: src.bluetooth_sig.gatt.characteristics.utils.translators.ValueTranslator[float]¶
Return the linear translator from the underlying scaled template.
- class src.bluetooth_sig.gatt.characteristics.templates.domain.TemperatureTemplate¶
Bases:
src.bluetooth_sig.gatt.characteristics.templates.base.CodingTemplate[float]Template for standard Bluetooth SIG temperature format (sint16, 0.01°C resolution).
- decode_value(data: bytearray, offset: int = 0, ctx: src.bluetooth_sig.gatt.context.CharacteristicContext | None = None, *, validate: bool = True) float¶
Parse temperature in 0.01°C resolution.
- property extractor: src.bluetooth_sig.gatt.characteristics.utils.extractors.RawExtractor¶
Get extractor from underlying scaled template.
- property translator: src.bluetooth_sig.gatt.characteristics.utils.translators.ValueTranslator[float]¶
Return the linear translator from the underlying scaled template.