Coverage for src / bluetooth_sig / types / registry / profile_types.py: 100%

16 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-03-18 11:17 +0000

1"""Type definitions for profile and service discovery registries.""" 

2 

3from __future__ import annotations 

4 

5import msgspec 

6 

7 

8class PermittedCharacteristicEntry(msgspec.Struct, frozen=True, kw_only=True): 

9 """A service with its list of permitted characteristic identifiers. 

10 

11 Loaded from profiles_and_services/{ess,uds,imds}/*_permitted_characteristics.yaml. 

12 Each YAML entry maps one service URI to a list of characteristic URIs. 

13 """ 

14 

15 service: str 

16 characteristics: tuple[str, ...] 

17 

18 

19class ProfileLookupEntry(msgspec.Struct, frozen=True, kw_only=True): 

20 """A generic name/value entry from a profile parameter YAML file. 

21 

22 Covers the simple ``{name, value}`` and ``{value, description}`` patterns 

23 found across A2DP codecs, ESL display types, HFP bearer technologies, 

24 AVRCP types, MAP chat states, TDS organisation IDs, and similar files. 

25 

26 Extra fields beyond name/value are stored in *metadata* so that a single 

27 struct can represent all simple-lookup schemas without a per-file class. 

28 """ 

29 

30 name: str 

31 value: int 

32 metadata: dict[str, str] = msgspec.field(default_factory=dict) 

33 

34 

35class AttributeIdEntry(msgspec.Struct, frozen=True, kw_only=True): 

36 """An SDP attribute identifier entry (name + hex value). 

37 

38 Loaded from service_discovery/attribute_ids/*.yaml and 

39 service_discovery/attribute_id_offsets_for_strings.yaml. 

40 """ 

41 

42 name: str 

43 value: int 

44 

45 

46class ProtocolParameterEntry(msgspec.Struct, frozen=True, kw_only=True): 

47 """A protocol parameter entry from service_discovery/protocol_parameters.yaml. 

48 

49 Each entry describes a named parameter for a specific protocol 

50 (e.g. L2CAP PSM, RFCOMM Channel). 

51 """ 

52 

53 protocol: str 

54 name: str 

55 index: int