Set the connected flag when connecting/disconnecting from a service.

This commit is contained in:
Fabio Manganiello 2023-03-19 12:56:31 +01:00
parent 9d66b63266
commit 40f81b105f
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -174,6 +174,7 @@ class LegacyManager(BaseBluetoothManager):
raise AssertionError(f'Connection to {device} timed out') from e raise AssertionError(f'Connection to {device} timed out') from e
dev.connected = True dev.connected = True
conn.service.connected = True
self.notify(BluetoothDeviceConnectedEvent, dev) self.notify(BluetoothDeviceConnectedEvent, dev)
yield conn yield conn
@ -183,6 +184,7 @@ class LegacyManager(BaseBluetoothManager):
self._connections.pop(conn.key, None) self._connections.pop(conn.key, None)
dev.connected = False dev.connected = False
conn.service.connected = False
self.notify(BluetoothDeviceDisconnectedEvent, dev) self.notify(BluetoothDeviceDisconnectedEvent, dev)
@override @override