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

6 statements  

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

1"""Noise (Sound Pressure Level) characteristic implementation. 

2 

3Per Bluetooth SIG specification (UUID 0x2BE4): 

4- Data type: uint8 (1 byte) 

5- Unit: decibel SPL with 1 dB resolution 

6- Range: 0-253 dB 

7- Special values: 0xFE (≥254 dB), 0xFF (unknown) 

8""" 

9 

10from __future__ import annotations 

11 

12from .base import BaseCharacteristic 

13from .templates import Uint8Template 

14 

15 

16class NoiseCharacteristic(BaseCharacteristic[int]): 

17 """Noise characteristic (0x2BE4) - Sound pressure level measurement. 

18 

19 Represents sound pressure level in decibels (dB SPL) per SIG specification. 

20 Uses uint8 format with 1 dB resolution. 

21 """ 

22 

23 _template = Uint8Template() 

24 _manual_unit: str | None = "dB SPL"