src.bluetooth_sig.core.async_context

Async context manager for device parsing sessions.

Attributes

Name

Description

T

Classes

Name

Description

AsyncParsingSession

Async context manager for parsing sessions.

Module Contents

class src.bluetooth_sig.core.async_context.AsyncParsingSession(translator: src.bluetooth_sig.core.translator.BluetoothSIGTranslator, ctx: src.bluetooth_sig.types.CharacteristicContext | None = None)

Async context manager for parsing sessions.

Maintains parsing context across multiple async operations.

Example:

async with AsyncParsingSession() as session:
    result1 = await session.parse("2A19", data1)
    result2 = await session.parse("2A6E", data2)
    # Context automatically shared between parses
async parse(char: type[src.bluetooth_sig.gatt.characteristics.base.BaseCharacteristic[T]], data: bytes) T
async parse(char: str | src.bluetooth_sig.types.uuid.BluetoothUUID, data: bytes) Any

Parse characteristic with accumulated context.

Parameters:
  • char – Characteristic class (type-safe) or UUID string/BluetoothUUID (not type-safe).

  • data – Raw bytes

Returns:

Parsed characteristic value. Return type is inferred when passing characteristic class.

context = None
results: dict[str, Any]
translator
src.bluetooth_sig.core.async_context.T