blatann.waitables.connection_waitable module

class blatann.waitables.connection_waitable.ConnectionWaitable(ble_device, current_peer, role=BLEGapRoles.periph)

Bases: Waitable

wait(timeout=None, exception_on_timeout=True)

Waits for the asynchronous operation to complete

Warning

If this call times out, it cannot be (successfully) called again as it will clean up all event handlers for the waitable. This is done to remove lingering references to the waitable object through event subscriptions

Parameters:
  • timeout (Optional[float]) – How long to wait, or None to wait indefinitely

  • exception_on_timeout – Flag to either throw an exception on timeout, or instead return None object(s)

Return type:

Peer

Returns:

The result of the asynchronous operation

Raises:

TimeoutError

async as_async(timeout=None, exception_on_timeout=True, loop=None)

Waits for the asynchronous operation to complete that can be ``await``ed in async methods.

Warning

This method is experimental!

Parameters:
  • timeout (Optional[float]) – How long to wait, or None to wait indefinitely

  • exception_on_timeout – Flag to either throw an exception on timeout, or instead return None object(s)

  • loop (Optional[AbstractEventLoop]) – Optional asyncio event loop to use instead of the default one returned by asyncio.get_event_loop()

Return type:

Peer

Returns:

The result of the asynchronous operation

Raises:

TimeoutError

class blatann.waitables.connection_waitable.ClientConnectionWaitable(ble_device, peer)

Bases: ConnectionWaitable

wait(timeout=None, exception_on_timeout=True)

Waits for the asynchronous operation to complete

Warning

If this call times out, it cannot be (successfully) called again as it will clean up all event handlers for the waitable. This is done to remove lingering references to the waitable object through event subscriptions

Parameters:
  • timeout – How long to wait, or None to wait indefinitely

  • exception_on_timeout – Flag to either throw an exception on timeout, or instead return None object(s)

Return type:

Client

Returns:

The result of the asynchronous operation

Raises:

TimeoutError

class blatann.waitables.connection_waitable.PeripheralConnectionWaitable(ble_device, peer)

Bases: ConnectionWaitable

wait(timeout=None, exception_on_timeout=True)

Waits for the asynchronous operation to complete

Warning

If this call times out, it cannot be (successfully) called again as it will clean up all event handlers for the waitable. This is done to remove lingering references to the waitable object through event subscriptions

Parameters:
  • timeout – How long to wait, or None to wait indefinitely

  • exception_on_timeout – Flag to either throw an exception on timeout, or instead return None object(s)

Return type:

Peripheral

Returns:

The result of the asynchronous operation

Raises:

TimeoutError

class blatann.waitables.connection_waitable.DisconnectionWaitable(connected_peer)

Bases: Waitable