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

9 statements  

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

1"""Electric Current characteristic implementation.""" 

2 

3from __future__ import annotations 

4 

5from ...types.units import ElectricalUnit 

6from .base import BaseCharacteristic 

7from .templates import ScaledUint16Template 

8 

9 

10class ElectricCurrentCharacteristic(BaseCharacteristic): 

11 """Electric Current characteristic (0x2AEE). 

12 

13 org.bluetooth.characteristic.electric_current 

14 

15 Electric Current characteristic. 

16 

17 Measures electric current with 0.01 A resolution. 

18 """ 

19 

20 _template = ScaledUint16Template.from_letter_method(M=1, d=-2, b=0) 

21 

22 _manual_unit: str = ElectricalUnit.AMPS.value # Override template's "units" default 

23 

24 # Template configuration 

25 resolution: float = 0.01 # 0.01 A resolution 

26 max_value: float = 655.35 # 65535 * 0.01 A max