node-poweredup
node-poweredup copied to clipboard
Race in _determineLPF2HubType
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
not helping with #131