Hi! I'm just going to move this to the Bluetooth section of the forum - I think it makes more sense there...
I've realised that the Bangle.js 1 I have often doesn't find the BLE device
Were you connected to Blueooth to the Bangle at the time you did this? Because usually when you're connected you're in high speed mode so sending packets to the Bangle every 7.5ms - this makes it hard for it to scan for advertisements as reliably because
connection multiple peripherals at the same time is not possible
Yes. You can have one connection IN and one connection OUT at the same time, but that's it.
the callback I register for characteristicvaluechanged has no idea which BLE device
Just define a variable in the connect function, like:
I'm seeking an example of robustly maintaining a connection to a BLE device
When you first get the device, register device.on('gattserverdisconnected', ...) and that should help you detect when the connection fails, and hopefully do a reconnect (wait ~1 sec first just in case)
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi! I'm just going to move this to the Bluetooth section of the forum - I think it makes more sense there...
Were you connected to Blueooth to the Bangle at the time you did this? Because usually when you're connected you're in high speed mode so sending packets to the Bangle every 7.5ms - this makes it hard for it to scan for advertisements as reliably because
Yes. You can have one connection IN and one connection OUT at the same time, but that's it.
Just define a variable in the
connect
function, like:When you first get the device, register
device.on('gattserverdisconnected', ...)
and that should help you detect when the connection fails, and hopefully do a reconnect (wait ~1 sec first just in case)