src.bluetooth_sig.registry.gss

GSS (GATT Service Specification) registry.

This module provides a registry for Bluetooth SIG GSS YAML files, extracting characteristic specifications with field metadata including units, resolutions, value ranges, and presence conditions.

Classes

Name

Description

GssRegistry

Registry for GSS (GATT Service Specification) characteristic definitions.

Functions

Name

Description

get_gss_registry(→ GssRegistry)

Return the process-wide gss_registry singleton instance.

Module Contents

class src.bluetooth_sig.registry.gss.GssRegistry

Bases: bluetooth_sig.registry.base.BaseGenericRegistry[bluetooth_sig.types.registry.gss_characteristic.GssCharacteristicSpec]

Registry for GSS (GATT Service Specification) characteristic definitions.

Parses Bluetooth SIG GSS YAML files and extracts typed characteristic specifications with full field metadata. Implements singleton pattern with thread-safe lazy loading.

Example::

registry = GssRegistry.get_instance() spec = registry.get_spec(“Battery Level”) if spec:

for field in spec.structure:

print(f”{field.python_name}: {field.unit_id}”)

extract_info_from_gss(char_data: dict[str, Any]) tuple[str | None, type | None]

Extract unit and python_type from GSS characteristic structure.

Parameters:

char_data – Raw characteristic data from YAML

Returns:

Tuple of (unit_symbol, python_type) or (None, None) if not found

get_all_specs() dict[str, bluetooth_sig.types.registry.gss_characteristic.GssCharacteristicSpec]

Get all loaded GSS specifications.

Returns:

Dictionary of all specifications keyed by name and ID

get_spec(identifier: str) bluetooth_sig.types.registry.gss_characteristic.GssCharacteristicSpec | None

Get a GSS specification by name or ID.

Parameters:

identifier – Characteristic name or ID (case-insensitive)

Returns:

GssCharacteristicSpec if found, None otherwise

src.bluetooth_sig.registry.gss.get_gss_registry() GssRegistry

Return the process-wide gss_registry singleton instance.