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

11 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2025-10-30 00:10 +0000

1"""CO2 Concentration characteristic implementation.""" 

2 

3from __future__ import annotations 

4 

5from ...types.gatt_enums import ValueType 

6from .base import BaseCharacteristic 

7from .templates import ConcentrationTemplate 

8 

9 

10class CO2ConcentrationCharacteristic(BaseCharacteristic): 

11 r"""Carbon Dioxide concentration characteristic (0x2B8C). 

12 

13 YAML registry name uses LaTeX subscript form ("CO\\textsubscript{2} Concentration"). 

14 We restore explicit `_characteristic_name` so UUID resolution succeeds because 

15 the automatic CamelCase splitter cannot derive the LaTeX form from the class name. 

16 

17 Represents carbon dioxide concentration in parts per million (ppm) 

18 with a resolution of 1 ppm. 

19 """ 

20 

21 # Explicit YAML/registry name (contains LaTeX markup not derivable heuristically) 

22 _characteristic_name = "CO\\textsubscript{2} Concentration" 

23 

24 _template = ConcentrationTemplate() 

25 

26 _manual_value_type: ValueType | str | None = ValueType.INT 

27 _manual_unit: str | None = "ppm" # Override template's "ppm" default 

28 

29 # Template configuration 

30 resolution: float = 1.0 

31 max_value: int | float | None = 65533.0 # Exclude special values 0xFFFE and 0xFFFF