You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hi,
I am developing an app that tries to auto-reconnect whenever it looses connections. I've done this by binding on the 'devicedisconnected' event, just before the connect routine (Javascript).
In devices with android >= 4.4.4, SOMETIMES, the app misses to emit that event, so the reconnect procedure has to be made manually. same behaviour on ios 8.3
here is the code
connectDevice : function(dev)
{
console.log("connecting device:" + dev.deviceName);
dev.addEventListener('devicedisconnected', DG.onDeviceDisconnected);
dev.addEventListener('deviceconnected', DG.onDeviceConnected);
BTMod.connectDevice(dev, DG.receiveDataCallback);
},
//this ain't going to be called on disconnect event (from BluetoothSerialService)
onDeviceDisconnected : function()
{
console.log('DG.onDeviceDisconnected ' + DG.connectionError);
hi,
I am developing an app that tries to auto-reconnect whenever it looses connections. I've done this by binding on the 'devicedisconnected' event, just before the connect routine (Javascript).
In devices with android >= 4.4.4, SOMETIMES, the app misses to emit that event, so the reconnect procedure has to be made manually. same behaviour on ios 8.3
here is the code
connectDevice : function(dev)
{
console.log("connecting device:" + dev.deviceName);
dev.addEventListener('devicedisconnected', DG.onDeviceDisconnected);
dev.addEventListener('deviceconnected', DG.onDeviceConnected);
BTMod.connectDevice(dev, DG.receiveDataCallback);
},
//this ain't going to be called on disconnect event (from BluetoothSerialService)
onDeviceDisconnected : function()
{
console.log('DG.onDeviceDisconnected ' + DG.connectionError);
//BTMod
connectDevice : function(dev, rxCallback)
{
var secure = false; //FIXME set to true
var connectSuccess = function()
{
console.log(BTMod.connectedDevice.deviceName + " connected successfully!");
BTMod.connectedDevice.rfcommSubscribe(rxCallback);
};
here is some logs:
06-08 14:22:57.819: E/BluetoothSerialService(20718): disconnected
06-08 14:22:57.819: E/BluetoothSerialService(20718): java.io.IOException: bt socket closed, read return: -1
06-08 14:22:57.819: E/BluetoothSerialService(20718): at android.bluetooth.BluetoothSocket.read(BluetoothSocket.java:435)
06-08 14:22:57.819: E/BluetoothSerialService(20718): at android.bluetooth.BluetoothInputStream.read(BluetoothInputStream.java:96)
06-08 14:22:57.819: E/BluetoothSerialService(20718): at java.io.InputStream.read(InputStream.java:162)
06-08 14:22:57.819: E/BluetoothSerialService(20718): at org.bcsphere.bluetooth.BluetoothSerialService$ConnectedThread.run(BluetoothSerialService.java:586)
06-08 14:22:57.821: I/BluetoothSerial(20718): BluetoothSerialService.STATE_NONE
06-08 14:22:57.822: I/chromium(20718): [INFO:CONSOLE(1478)] "rfcommWrite - bc.jswAPHCdMAAQDWiME=", source: file:///android_asset/www/plugins/org/www/org.bcsphere/bc.js (1478)
06-08 14:22:57.844: I/chromium(20718): [INFO:CONSOLE(173)] "sending data: {"0":192,"1":3,"2":199,"3":9,"4":211,"5":0,"6":1,"7":0,"8":214,"9":136,"10":193}", source: file:///android_asset/www/js/bluetooth.js (173)
06-08 14:22:57.846: I/chromium(20718): [INFO:CONSOLE(177)] "Error while sending data!{"1":"there is no connection on device:00:07:80:25:BE:53"}", source: file:///android_asset/www/js/bluetooth.js (177)
The text was updated successfully, but these errors were encountered: