Hi Gordon,
Thanks for getting back to me.
So I've narrowed the problem to different behaviour between using the Web BT library on MacOS verses on iOS with the WebBLE app.
Turns out that this code works on MacOS but does nothing on iOS:
connection.device.ongattserverdisconnected = event => {
console.log(`${connection.device.name} disconnected. Reconnecting...`)
connection.reconnect(c => console.log('Reconnected'))
}
So now I've changed over to this instead which does work the same on both platforms:
connection.on('close', event => {
...
Reconnection works as expected on MacOS but never works on iOS. The error that is returned immediately upon calling connection.reconnect
is this:
<BLE> ERROR: Premature cancellation.
This causes the close event to trigger again so the reconnect method is called a second time, for which the following error is returned:
<BLE> ERROR: No known device for device transaction Transaction(id: 287, key: device:connectGATT)
Do you have any idea how I can successfully reconnect the device from iOS?
Thanks
Hi Gordon,
Thanks for getting back to me.
So I've narrowed the problem to different behaviour between using the Web BT library on MacOS verses on iOS with the WebBLE app.
Turns out that this code works on MacOS but does nothing on iOS:
So now I've changed over to this instead which does work the same on both platforms:
Reconnection works as expected on MacOS but never works on iOS. The error that is returned immediately upon calling
connection.reconnect
is this:This causes the close event to trigger again so the reconnect method is called a second time, for which the following error is returned:
Do you have any idea how I can successfully reconnect the device from iOS?
Thanks