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
Testing out the develop branch. BleakClientDotNet.connect() throws BleakDotNetTaskError because GetGattServicesAsync() in BleakClientDotNet.get_services() returns GattCommunicationStatus.Unreachable.
This seems to be a timing issue. For some reason, GetGattServicesAsync returns before it actually connects to the device. If I add a delay before calling GetGattServicesAsync, it works more reliably. It also seems to work if I add a retry instead of a delay.
asyncdefGetGattServicesAsync():
returnawaitwrap_IAsyncOperation(
IAsyncOperation[GattDeviceServicesResult](
self._requester.GetGattServicesAsync()
),
return_type=GattDeviceServicesResult,
loop=self.loop,
)
services_result=awaitGetGattServicesAsync()
ifservices_result==GattCommunicationStatus.Unreachable:
# one retry because Windows is goofyservices_result=awaitGetGattServicesAsync()
ifservices_result.Status!=GattCommunicationStatus.Success:
raiseBleakDotNetTaskError("Could not get GATT services.")
This thread lead me to this thread which got me wondering if this behavior has something to do with needing a single threaded apartment on Windows.
The text was updated successfully, but these errors were encountered:
Might this be an effect of the BluetoothLEAdvertisementWatcher discovery change? Or maybe even the FromBluetoothAddressAsync change? Have you experienced the same problems prior to this change?
I did notice that during the discovery phase and reading of manufacturer data, my test device stopped blinking (which it does to signal that it is possible to connect to). Does Windows create a connection during the reading of the manufacturer data which interferes with the services detecting later on?
I think one of my library users experiences the same problem - he reported that if he just comments out the exception (I'm not using discovered services anyways) - everything works.
Description
Testing out the develop branch.
BleakClientDotNet.connect()
throwsBleakDotNetTaskError
becauseGetGattServicesAsync()
inBleakClientDotNet.get_services()
returnsGattCommunicationStatus.Unreachable
.This seems to be a timing issue. For some reason,
GetGattServicesAsync
returns before it actually connects to the device. If I add a delay before callingGetGattServicesAsync
, it works more reliably. It also seems to work if I add a retry instead of a delay.This thread lead me to this thread which got me wondering if this behavior has something to do with needing a single threaded apartment on Windows.
The text was updated successfully, but these errors were encountered: