I'm currently experimenting with the BLE module and I'm experiencing some problems recovering from a master initiated disconnect and then resuming advertising. If I call writeLocalValue and the master disconnects (presumably before the data is sent) then I'll get notified of the disconnect, but I won't be able to startAdvertising again and eventually the tessel will crash with a packet transmission error. If I'm not sending a packet, disconnect and reconnect works fine.
Here is the code I am working on (it uses the ultrasonic module I was working on recently):
My scenario is an Automatic Tank Gauge so I probably won't be sampling every second like I am in this example, that is just for debugging but it is possible that this would occur especially since I only plan on measuring distance when a master is connected.
Anyway - here is the error that eventually brings down the Tessel:
Error: Packet Timeout...
at _new ([string "colony-init.lua"]:1)
at <anonymous> (/app/node_modules/ble-ble113a/lib/messenger.js:358)
at _xpcall ([C]:-1)
at callback (/app/node_modules/ble-ble113a/lib/messenger.js:357)
at popMatchingResponsePacket (/app/node_modules/ble-ble113a/lib/messenger.js:391)
at func (/app/node_modules/ble-ble113a/lib/messenger.js:353)
at <anonymous> ([string "colony-js.lua"]:1)
at <anonymous> (/app/node_modules/ble-ble113a/lib/messenger.js:343)