mirror of
https://github.com/meshcore-dev/meshcore_py.git
synced 2026-04-20 22:13:49 +00:00
remove the use of set_disconnected_callback
This commit is contained in:
parent
047f33f9e9
commit
932a491986
2 changed files with 4 additions and 3 deletions
|
|
@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|||
|
||||
[project]
|
||||
name = "meshcore"
|
||||
version = "2.1.0"
|
||||
version = "2.1.1"
|
||||
authors = [
|
||||
{ name="Florent de Lamotte", email="florent@frizoncorrea.fr" },
|
||||
{ name="Alex Wolden", email="awolden@gmail.com" },
|
||||
|
|
|
|||
|
|
@ -51,10 +51,11 @@ class BLEConnection:
|
|||
|
||||
if self.client:
|
||||
logger.debug("Using pre-configured BleakClient.")
|
||||
# If a client is already provided, ensure its disconnect callback is set
|
||||
assert isinstance(self.client, BleakClient)
|
||||
self.client.set_disconnected_callback(self.handle_disconnect)
|
||||
self.address = self.client.address
|
||||
# If a client is provided it surely does not have disconnect callback
|
||||
# so recreate it as set_disconnected_callback can't be used anymore ...
|
||||
self.client = BleakClient(self.address, disconnected_callback=self.handle_disconnect)
|
||||
elif self.device:
|
||||
logger.debug("Directly using a passed device.")
|
||||
self.client = BleakClient(self.device, disconnected_callback=self.handle_disconnect)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue