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

7 statements  

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

1"""Illuminance characteristic implementation.""" 

2 

3from __future__ import annotations 

4 

5from .base import BaseCharacteristic 

6from .templates import ScaledUint24Template 

7 

8# pylint: disable=duplicate-code 

9# Justification: This file follows the standard BLE characteristic base class pattern, 

10# which is intentionally duplicated across multiple characteristic implementations. 

11# These patterns are required by Bluetooth SIG specifications and represent legitimate 

12# code duplication for protocol compliance. 

13 

14 

15class IlluminanceCharacteristic(BaseCharacteristic): 

16 """Illuminance characteristic (0x2AFB). 

17 

18 Measures light intensity in lux (lumens per square meter). 

19 Uses uint24 (3 bytes) with 0.01 lux resolution. 

20 """ 

21 

22 _template = ScaledUint24Template(scale_factor=0.01, offset=0) 

23 

24 _manual_unit: str = "lx" # Override template's "units" default 

25 resolution: float = 0.01