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

8 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-01-11 20:14 +0000

1"""Voltage characteristic implementation.""" 

2 

3from __future__ import annotations 

4 

5from ...types.units import ElectricalUnit 

6from .base import BaseCharacteristic 

7from .templates import ScaledUint16Template 

8 

9 

10class VoltageCharacteristic(BaseCharacteristic[float]): 

11 """Voltage characteristic (0x2B18). 

12 

13 org.bluetooth.characteristic.voltage 

14 

15 Voltage characteristic. 

16 

17 Measures voltage with 1/64 V resolution. 

18 """ 

19 

20 _template = ScaledUint16Template(scale_factor=1 / 64, offset=0) 

21 

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

23 

24 # Template configuration 

25 resolution: float = 1 / 64 # 1/64 V resolution