Coverage for src/bluetooth_sig/gatt/characteristics/ringer_control_point.py: 92%
13 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"""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):
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 behavior.
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 def encode_value(self, data: RingerControlPointData) -> bytearray:
42 """Encode RingerControlPointData command to bytes.
44 Args:
45 data: RingerControlPointData instance to encode
47 Returns:
48 Encoded bytes representing the ringer control command
50 """
51 return bytearray([data.command.value])
53 # Note: This characteristic is write-only, so decode_value is not implemented
54 # Reading this characteristic is not supported per Bluetooth SIG specification