Add failed callback

This commit is contained in:
Jesse Hills 2022-09-28 12:06:20 +13:00
parent 86512bc607
commit 0c5d109951
No known key found for this signature in database
GPG Key ID: BEAAE804EFD8E83A

View File

@ -447,6 +447,7 @@ class APIClient:
self,
address: int,
on_bluetooth_connection_state: Callable[[bool, int], None],
on_bluetooth_connection_failed: Callable[[], None],
timeout: float = 10.0,
) -> Callable[[], None]:
self._check_authenticated()
@ -458,6 +459,8 @@ class APIClient:
resp = BluetoothDeviceConnection.from_pb(msg)
if address == resp.address:
on_bluetooth_connection_state(resp.connected, resp.mtu)
if resp.failed:
on_bluetooth_connection_failed()
assert self._connection is not None
await self._connection.send_message_callback_response(