mirror of
https://github.com/meshcore-dev/meshcore_py.git
synced 2026-04-20 22:13:49 +00:00
add safeguard for other kind of addresses
This commit is contained in:
parent
336f2f3d68
commit
790f25498c
1 changed files with 3 additions and 1 deletions
|
|
@ -58,11 +58,13 @@ class BLEConnection:
|
|||
self.client = BleakClient(self.device, disconnected_callback=self.handle_disconnect)
|
||||
else:
|
||||
|
||||
def match_meshcore_device(_: BLEDevice, adv: AdvertisementData):
|
||||
def match_meshcore_device(d: BLEDevice, adv: AdvertisementData):
|
||||
"""Filter to match MeshCore devices."""
|
||||
if adv.local_name and adv.local_name.startswith("MeshCore"):
|
||||
if self.address is None or self.address in adv.local_name:
|
||||
return True
|
||||
if d and d.address == self.address:
|
||||
return True
|
||||
return False
|
||||
|
||||
if self.address is None or ":" not in self.address:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue