Coverage for src / bluetooth_sig / gatt / services / unknown.py: 100%

9 statements  

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

1"""Unknown service implementation for unregistered service UUIDs.""" 

2 

3from __future__ import annotations 

4 

5from ...types import ServiceInfo 

6from ...types.uuid import BluetoothUUID 

7from .base import BaseGattService 

8 

9 

10class UnknownService(BaseGattService): 

11 """Generic service for unknown/unregistered service UUIDs. 

12 

13 This class is used for services discovered at runtime that are not 

14 in the Bluetooth SIG specification or custom registry. It provides 

15 basic functionality while allowing characteristic processing. 

16 """ 

17 

18 # TODO 

19 _is_base_class = True # Exclude from registry validation tests (requires uuid parameter) 

20 

21 def __init__(self, uuid: BluetoothUUID, name: str | None = None) -> None: 

22 """Initialize an unknown service with minimal info. 

23 

24 Args: 

25 uuid: The service UUID 

26 name: Optional custom name (defaults to "Unknown Service (UUID)") 

27 

28 """ 

29 info = ServiceInfo( 

30 uuid=uuid, 

31 name=name or f"Unknown Service ({uuid})", 

32 ) 

33 super().__init__(info=info)