Hi! That's an interesting thought... Subscribing to E.notify sounds like a great solution.
Bangle.js can't accept more than one incoming connection unfortunately... You'd hope that Python might somehow be able to find the already-connected device, but if not:
I'm not 100% sure if this'll work with iOS, but what about changing the Bangle's MAC address, so the phone thinks it has gone out of range:
// ... to disconnect and allow a connection from your app
NRF.setAddress(NRF.getAddress().slice(0,-1)+"0 random");
NRF.disconnect(); // force a disconnect - Bangle.js should now be at a different address
// ... to disconnect and hopefully have iOS reconnect
NRF.setAddress(NRF.getAddress()+" random");
NRF.disconnect(); // force a disconnect - Bangle.js should now be at a different address
In the example above I'm assuming your Bangle's address didn't already end in 0 - but hopefully you get the idea :)
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! That's an interesting thought... Subscribing to
E.notify
sounds like a great solution.Bangle.js can't accept more than one incoming connection unfortunately... You'd hope that Python might somehow be able to find the already-connected device, but if not:
I'm not 100% sure if this'll work with iOS, but what about changing the Bangle's MAC address, so the phone thinks it has gone out of range:
In the example above I'm assuming your Bangle's address didn't already end in
0
- but hopefully you get the idea :)