src.bluetooth_sig.core.query

Characteristic and service query engine.

Provides read-only lookup and metadata retrieval for characteristics and services using the SIG registries. Stateless — no mutable state.

Attributes

Name

Description

logger

Classes

Name

Description

CharacteristicQueryEngine

Stateless query engine for characteristic and service metadata.

Module Contents

class src.bluetooth_sig.core.query.CharacteristicQueryEngine

Stateless query engine for characteristic and service metadata.

Provides all read-only lookup operations: supports, get_value_type, get_*_info_*, list_supported_*, get_service_characteristics, get_sig_info_*.

get_characteristic_info_by_name(name: src.bluetooth_sig.types.gatt_enums.CharacteristicName) src.bluetooth_sig.types.CharacteristicInfo | None

Get characteristic info by enum name.

Parameters:

name – CharacteristicName enum

Returns:

CharacteristicInfo if found, None otherwise

get_characteristic_info_by_uuid(uuid: str) src.bluetooth_sig.types.CharacteristicInfo | None

Get information about a characteristic by UUID.

Parameters:

uuid – The characteristic UUID (16-bit short form or full 128-bit)

Returns:

CharacteristicInfo with metadata or None if not found

get_characteristic_uuid_by_name(name: src.bluetooth_sig.types.gatt_enums.CharacteristicName) src.bluetooth_sig.types.uuid.BluetoothUUID | None

Get the UUID for a characteristic name enum.

Parameters:

name – CharacteristicName enum

Returns:

Characteristic UUID or None if not found

get_characteristics_info_by_uuids(uuids: list[str]) dict[str, src.bluetooth_sig.types.CharacteristicInfo | None]

Get information about multiple characteristics by UUID.

Parameters:

uuids – List of characteristic UUIDs

Returns:

Dictionary mapping UUIDs to CharacteristicInfo (or None if not found)

get_service_characteristics(service_uuid: str) list[src.bluetooth_sig.gatt.characteristics.base.BaseCharacteristic[Any]]

Get the characteristic instances associated with a service.

Instantiates each required characteristic class from the service definition and returns the live objects.

Parameters:

service_uuid – The service UUID

Returns:

List of BaseCharacteristic instances for this service’s required characteristics.

get_service_info_by_name(name: str | src.bluetooth_sig.gatt.services.ServiceName) src.bluetooth_sig.types.ServiceInfo | None

Get service info by name or enum instead of UUID.

Parameters:

name – Service name string or ServiceName enum

Returns:

ServiceInfo if found, None otherwise

get_service_info_by_uuid(uuid: str) src.bluetooth_sig.types.ServiceInfo | None

Get information about a service by UUID.

Parameters:

uuid – The service UUID

Returns:

ServiceInfo with metadata or None if not found

get_service_uuid_by_name(name: str | src.bluetooth_sig.gatt.services.ServiceName) src.bluetooth_sig.types.uuid.BluetoothUUID | None

Get the UUID for a service name or enum.

Parameters:

name – Service name or enum

Returns:

Service UUID or None if not found

get_sig_info_by_name(name: str) src.bluetooth_sig.types.SIGInfo | None

Get Bluetooth SIG information for a characteristic or service by name.

Parameters:

name – Characteristic or service name

Returns:

CharacteristicInfo or ServiceInfo if found, None otherwise

get_sig_info_by_uuid(uuid: str) src.bluetooth_sig.types.SIGInfo | None

Get Bluetooth SIG information for a UUID.

Parameters:

uuid – UUID string (with or without dashes)

Returns:

CharacteristicInfo or ServiceInfo if found, None otherwise

get_value_type(uuid: str) type | str | None

Get the expected Python type for a characteristic.

Parameters:

uuid – The characteristic UUID (16-bit short form or full 128-bit)

Returns:

Python type if characteristic is found, None otherwise

list_supported_characteristics() dict[str, str]

List all supported characteristics with their names and UUIDs.

Returns:

Dictionary mapping characteristic names to UUIDs

list_supported_services() dict[str, str]

List all supported services with their names and UUIDs.

Returns:

Dictionary mapping service names to UUIDs

supports(uuid: str) bool

Check if a characteristic UUID is supported.

Parameters:

uuid – The characteristic UUID to check

Returns:

True if the characteristic has a parser/encoder, False otherwise

src.bluetooth_sig.core.query.logger