You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been trying to make a BT connection to a BLE device which uses "just works" to connect.
But when trying to bond to the device i'm getting a pop-up on the bottom right corner from windows. With the text "click to add a device". When clicking on this pop-up mt BT settings will open and a seperate pop-up wille open with "unknown device", "bonding failed".
What I Did
This is the code i use at the moment.
asyncdefscan_for_devices(self, timeout=5.0):
"""Scan for available BLE devices and return a list of device names and MAC addresses."""devices=awaitBleakScanner.discover(timeout=timeout)
return [(device.name, device.address) fordeviceindevicesifdevice.name]
asyncdefconnect_to_device(self, mac_address):
"""Connect to the selected device by its MAC address."""self.client=BleakClient(mac_address)
try:
awaitself.client.connect()
self.connected_device=mac_addressprint(f"Connected to {mac_address}")
returnTrueexceptExceptionase:
print(f"Failed to connect to {mac_address}: {e}")
returnFalse
One of my findings where that this issue is only on windows. MacOS has no trouble with the pairing/bonding using this code.
Also i found out this issue does not occur when bonding has already been done before using another app e.g. "Bluetooth LE Explorer"
Logs
Failed to connect to {mac_adress}: [WinError -2147483629] object has been closed
orignial:
Failed to connect to {mac_adress}: [WinError -2147483629] Het object is gesloten
Let me know if i can add any extra information if needed.
Thanks in advance.
The text was updated successfully, but these errors were encountered:
Description
I've been trying to make a BT connection to a BLE device which uses "just works" to connect.
But when trying to bond to the device i'm getting a pop-up on the bottom right corner from windows. With the text "click to add a device". When clicking on this pop-up mt BT settings will open and a seperate pop-up wille open with "unknown device", "bonding failed".
What I Did
This is the code i use at the moment.
One of my findings where that this issue is only on windows. MacOS has no trouble with the pairing/bonding using this code.
Also i found out this issue does not occur when bonding has already been done before using another app e.g. "Bluetooth LE Explorer"
Logs
orignial:
Let me know if i can add any extra information if needed.
Thanks in advance.
The text was updated successfully, but these errors were encountered: