Coverage for src / bluetooth_sig / gatt / characteristics / alert_level.py: 100%
12 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-01-11 20:14 +0000
« prev ^ index » next coverage.py v7.13.1, created at 2026-01-11 20:14 +0000
1"""Alert Level characteristic implementation."""
3from __future__ import annotations
5from enum import IntEnum
7from .base import BaseCharacteristic
8from .templates import EnumTemplate
11class AlertLevel(IntEnum):
12 """Alert level values as defined by Bluetooth SIG.
14 Values:
15 NO_ALERT: No alert (0x00)
16 MILD_ALERT: Mild alert (0x01)
17 HIGH_ALERT: High alert (0x02)
18 """
20 NO_ALERT = 0x00
21 MILD_ALERT = 0x01
22 HIGH_ALERT = 0x02
25class AlertLevelCharacteristic(BaseCharacteristic[int]):
26 """Alert Level characteristic (0x2A06).
28 org.bluetooth.characteristic.alert_level
30 The Alert Level characteristic defines the level of alert and is
31 used by services such as Immediate Alert (0x1802), Link Loss (0x1803),
32 and Phone Alert Status (0x180E).
34 Valid values:
35 - 0x00: No Alert
36 - 0x01: Mild Alert
37 - 0x02: High Alert
38 - 0x03-0xFF: Reserved for Future Use
40 Spec: Bluetooth SIG GATT Specification Supplement, Alert Level
41 """
43 _template = EnumTemplate.uint8(AlertLevel)
45 # YAML has no range constraint; enforce valid enum bounds.
46 min_value: int = AlertLevel.NO_ALERT # 0
47 max_value: int = AlertLevel.HIGH_ALERT # 2