src.bluetooth_sig.registry.core.namespace_description

Namespace Description registry for CPF descriptor description field resolution.

The CPF (Characteristic Presentation Format) descriptor has a description field that, when namespace=0x01 (Bluetooth SIG), can be resolved to human-readable names like “first”, “left”, “front”, etc.

Used during CPF descriptor parsing to provide description_name resolution.

Attributes

Classes

Name

Description

NamespaceDescriptionRegistry

Registry for Bluetooth SIG namespace description values with lazy loading.

Module Contents

class src.bluetooth_sig.registry.core.namespace_description.NamespaceDescriptionRegistry

Bases: bluetooth_sig.registry.base.BaseGenericRegistry[bluetooth_sig.types.registry.namespace.NamespaceDescriptionInfo]

Registry for Bluetooth SIG namespace description values with lazy loading.

This registry loads namespace description definitions from the official Bluetooth SIG assigned_numbers YAML file (namespace.yaml), enabling resolution of CPF description field values to human-readable names.

The description field in CPF is a 16-bit value that, when namespace=0x01 (Bluetooth SIG Assigned Numbers), can be resolved to names like: - 0x0001 → “first” - 0x010D → “left” - 0x010E → “right” - 0x0102 → “top”

Examples

>>> from bluetooth_sig.registry.core.namespace_description import namespace_description_registry
>>> info = namespace_description_registry.get_description_info(0x010D)
>>> info.name
'left'
get_all_descriptions() dict[int, bluetooth_sig.types.registry.namespace.NamespaceDescriptionInfo]

Get all registered namespace descriptions (lazy loads on first call).

Returns:

Dictionary mapping description values to NamespaceDescriptionInfo objects

get_description_by_name(name: str) bluetooth_sig.types.registry.namespace.NamespaceDescriptionInfo | None

Get description info by name (lazy loads on first call).

Parameters:

name – Description name (case-insensitive, e.g., “left”, “first”)

Returns:

NamespaceDescriptionInfo object, or None if not found

get_description_info(value: int) bluetooth_sig.types.registry.namespace.NamespaceDescriptionInfo | None

Get description info by value (lazy loads on first call).

Parameters:

value – The description value (e.g., 0x010D for “left”)

Returns:

NamespaceDescriptionInfo object, or None if not found

is_known_description(value: int) bool

Check if description value is known (lazy loads on first call).

Parameters:

value – The description value to check

Returns:

True if the description is registered, False otherwise

resolve_description_name(value: int) str | None

Resolve a description value to its string name.

Convenience method for CPF parsing that returns the description name directly, or None if unknown.

Parameters:

value – The description value to resolve

Returns:

Description name string (e.g., “left”, “first”), or None if unknown

src.bluetooth_sig.registry.core.namespace_description.logger
src.bluetooth_sig.registry.core.namespace_description.namespace_description_registry