Coverage for src / bluetooth_sig / gatt / characteristics / ringer_control_point.py: 93%
15 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"""Ringer Control Point characteristic implementation."""
3from __future__ import annotations
5from enum import IntEnum
7import msgspec
9from .base import BaseCharacteristic
12class RingerControlCommand(IntEnum):
13 """Ringer Control Point command values."""
15 SILENT_MODE = 1
16 MUTE_ONCE = 2
17 CANCEL_SILENT_MODE = 3
20class RingerControlPointData(msgspec.Struct, frozen=True, kw_only=True): # pylint: disable=too-few-public-methods
21 """Data for Ringer Control Point characteristic commands."""
23 command: RingerControlCommand
26class RingerControlPointCharacteristic(BaseCharacteristic[RingerControlPointData]):
27 """Ringer Control Point characteristic (0x2A40).
29 org.bluetooth.characteristic.ringer_control_point
31 The Ringer Control Point characteristic defines the Control Point of Ringer.
32 This is a write-only characteristic used to control ringer behaviour.
34 Commands:
35 - 1: Silent Mode (sets ringer to silent)
36 - 2: Mute Once (silences ringer once)
37 - 3: Cancel Silent Mode (sets ringer to normal)
38 - 0, 4-255: Reserved for future use
39 """
41 min_length = 1
42 expected_type = bytes
44 def _encode_value(self, data: RingerControlPointData) -> bytearray:
45 """Encode RingerControlPointData command to bytes.
47 Args:
48 data: RingerControlPointData instance to encode
50 Returns:
51 Encoded bytes representing the ringer control command
53 """
54 return bytearray([data.command.value])
56 # Note: This characteristic is write-only, so decode_value is not implemented
57 # Reading this characteristic is not supported per Bluetooth SIG specification