node-poweredup icon indicating copy to clipboard operation
node-poweredup copied to clipboard

Race in _determineLPF2HubType

Open antlai opened this issue 3 years ago • 1 comments

In Android smartphones (with webbluetooth) device.subscribeToCharacteristic() and device.writeToCharacteristic() cannot run concurrently without triggering the error in #131 , i.e., GATT operation failed for unknown reason.

To avoid that, in _determineLPF2HubType we need to await device.subscribeToCharacteristic() before starting device.writeToCharacteristic(). We also need subscribeToCharacteristic() to return the promise returned by startNotifications() (in webbleabstraction.ts)

This seems to have fixed all my connection problems.

It is just four lines changed, I'll submit a pull request...

Thanks for a great library!

Antonio

antlai avatar May 27 '22 21:05 antlai

not helping with #131

vene4ka avatar Jun 02 '23 12:06 vene4ka