evothings / cordova-ble

Bluetooth Low Energy plugin for Cordova
http://www.evothings.com/
Apache License 2.0
242 stars 103 forks source link

Test connecting to more than one BLE device concurrently #106

Open ghost opened 8 years ago

ghost commented 8 years ago

Make a test to verify we can connect with more than one BLE device concurrently, document it, example etc.

ghost commented 8 years ago

Issue report from a developer:

"When I try to connect a single SensorTag (CC2650) to the example app (TI SensorTag CC2650 & CC2541 Sensors), it works as expected but when I try to connect more then one, I'm only able to maintain a connection for a mere 20 seconds before they disconnect with Error: 8. Here is the initialization function: function initialiseSensorTag() { // Create SensorTag CC2650 instance. sensortag = evothings.tisensortag.createInstance( evothings.tisensortag.CC2650_BLUETOOTH_SMART) // Uncomment to use SensorTag CC2541. //sensortag = evothings.tisensortag.createInstance( // evothings.tisensortag.CC2541_BLUETOOTH_SMART) // // Here sensors are set up. // // If you wish to use only one or a few sensors, just set up // the ones you wish to use. // // First parameter to sensor function is the callback function. // Several of the sensors take a millisecond update interval // as the second parameter. // sensortag .statusCallback(statusHandler) .errorCallback(errorHandler) .keypressCallback(keypressHandler) .luxometerCallback(function(data){ luxometerHandler(data, 1);}, 100)//Lux is max(1000, interval)

st2 = evothings.tisensortag.createInstance( evothings.tisensortag.CC2650_BLUETOOTH_SMART)

st2 .statusCallback(statusHandler) .errorCallback(errorHandler) .keypressCallback(keypressHandler) .luxometerCallback(function(data){ luxometerHandler(data, 2);}, 100)

st3 = evothings.tisensortag.createInstance( evothings.tisensortag.CC2650_BLUETOOTH_SMART)

st3 .statusCallback(statusHandler) .errorCallback(errorHandler) .keypressCallback(keypressHandler) .luxometerCallback(function(data){ luxometerHandler(data, 3);}, 100)

st4 = evothings.tisensortag.createInstance( evothings.tisensortag.CC2650_BLUETOOTH_SMART)

st4 .statusCallback(statusHandler) .errorCallback(errorHandler) .keypressCallback(keypressHandler) .luxometerCallback(function(data){ luxometerHandler(data, 4);}, 100) }

While testing further I found that my phone (Samsung Galaxy Note 4) was not able to connect to 4 SensorTags at the same time but that same code managed to work on other phones (an iphone 5S & LG Nexus 5X). So it appears that it depends on the central device."