src.bluetooth_sig.registry.uuids.units

Registry for Bluetooth SIG unit UUID metadata.

Loads unit definitions from the Bluetooth SIG units.yaml specification, providing UUID-to-name-to-symbol resolution. Used primarily for: - Resolving org.bluetooth.unit.* identifiers from GSS YAML files - Converting unit IDs to human-readable SI symbols for display

Note: This is distinct from the domain enums in types/units.py which provide type-safe unit representations for decoded characteristic data. The symbols derived here match those enum values for consistency.

Attributes

Name

Description

units_registry

Classes

Name

Description

UnitsRegistry

Registry for Bluetooth SIG unit UUIDs.

Module Contents

class src.bluetooth_sig.registry.uuids.units.UnitsRegistry

Bases: bluetooth_sig.registry.base.BaseUUIDRegistry[bluetooth_sig.types.registry.units.UnitInfo]

Registry for Bluetooth SIG unit UUIDs.

get_all_units() list[bluetooth_sig.types.registry.units.UnitInfo]

Get all registered units.

Returns:

List of all UnitInfo objects

get_unit_info(uuid: str | bluetooth_sig.types.uuid.BluetoothUUID) bluetooth_sig.types.registry.units.UnitInfo | None

Get unit information by UUID.

Parameters:

uuid – 16-bit UUID as string (with or without 0x) or BluetoothUUID

Returns:

UnitInfo object, or None if not found

get_unit_info_by_id(unit_id: str) bluetooth_sig.types.registry.units.UnitInfo | None

Get unit information by ID.

Parameters:

unit_id – Unit ID (e.g., “org.bluetooth.unit.celsius”)

Returns:

UnitInfo object, or None if not found

get_unit_info_by_name(name: str) bluetooth_sig.types.registry.units.UnitInfo | None

Get unit information by name.

Parameters:

name – Unit name (case-insensitive)

Returns:

UnitInfo object, or None if not found

is_unit_uuid(uuid: str | bluetooth_sig.types.uuid.BluetoothUUID) bool

Check if a UUID is a registered unit UUID.

Parameters:

uuid – UUID to check

Returns:

True if the UUID is a unit UUID, False otherwise

src.bluetooth_sig.registry.uuids.units.units_registry