src.bluetooth_sig.gatt.characteristics.context_lookup

Context lookup mixin for GATT characteristics.

Provides methods to retrieve dependency and sibling characteristics from a CharacteristicContext, extracted from base to keep it focused on core parsing/encoding.

Classes

Name

Description

ContextLookupMixin

Mixin providing context-based characteristic lookup helpers.

Module Contents

class src.bluetooth_sig.gatt.characteristics.context_lookup.ContextLookupMixin

Mixin providing context-based characteristic lookup helpers.

These methods allow a characteristic to resolve its dependencies and siblings from a shared CharacteristicContext at parse/encode time.

get_context_characteristic(ctx: src.bluetooth_sig.gatt.context.CharacteristicContext | None, characteristic_name: src.bluetooth_sig.types.gatt_enums.CharacteristicName | str | type) Any

Find a characteristic in a context by name or class.

Note

Returns Any because the characteristic type is determined at runtime by characteristic_name. For type-safe access, use direct characteristic class instantiation instead of this lookup method.

Parameters:
  • ctx – Context containing other characteristics.

  • characteristic_name – Enum, string name, or characteristic class.

Returns:

Parsed characteristic value if found, None otherwise.