Page 1 of 1

Problems working with Bluetooth/BLE

Posted: 11:14, 19 Oct 2015
by cmag
I have an app that works fine with Android and Evothings 1.2.
I wanted to test it under iOS; with Evothings 1.2 I have a problem with bluetoothSerial.list: it seems that bluetoothSerial is undefined.
With Evothings 2.0.0 Alpha 3, everything seems to still work fine with Android.
With iOS in the following code:

Code: Select all

   
    console.log("START SCAN");
    evothings.ble.startScan(
        function(device) {
            var info;
            if (device.scanRecord) { // NOT on IOS
                console.log("ANDROID SCAN CALLBACK");
                info=app.util.extractAdvertData(atob(device.scanRecord));               
            }
            else if (device.advertisementData) { // ONLY on IOS   
                console.log("IOS SCAN CALLBACK");
                info=app.util.extractAdvertDataIOS(device.advertisementData);
            }
            else { 
                console.log("UNKNOWN SCAN CALLBACK");
            }

The callback is never called; the console log displays:
LOG: Error in Success callbackId: BLE1050944742 : Error: InvalidCharacterError: DOM Exception 5
And on the device I get i dialog saying:
Error in cordova.js : line #307
Invalid character error: DOM exception 5
An invalid or illegal character was specified such as in an XML name

Re: Problems working with Bluetooth/BLE

Posted: 11:27, 19 Oct 2015
by Fredrik
Please try our example "ble-scan". Does it give a similar error? If so, I would guess that you have a strange BLE device nearby, that sends data that cannot be correctly parsed by our plugin.