Coverage for src/bluetooth_sig/gatt/characteristics/voltage.py: 100%
10 statements
« prev ^ index » next coverage.py v7.11.0, created at 2025-10-30 00:10 +0000
« prev ^ index » next coverage.py v7.11.0, created at 2025-10-30 00:10 +0000
1"""Voltage characteristic implementation."""
3from __future__ import annotations
5from ...types.units import ElectricalUnit
6from ..constants import UINT16_MAX
7from .base import BaseCharacteristic
8from .templates import ScaledUint16Template
11class VoltageCharacteristic(BaseCharacteristic):
12 """Voltage characteristic (0x2B18).
14 org.bluetooth.characteristic.voltage
16 Voltage characteristic.
18 Measures voltage with 1/64 V resolution.
19 """
21 _template = ScaledUint16Template(scale_factor=1 / 64, offset=0)
23 _manual_unit: str = ElectricalUnit.VOLTS.value # Override template's "units" default
25 # Template configuration
26 resolution: float = 1 / 64 # 1/64 V resolution
27 max_value: float = UINT16_MAX / 64 # ~1024 V max