This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

cordova app to watch data from bluetooth low energy like nRF UART App

I need to do an hybrid app like nRF UART App but with cordova. i can connect and disconnect, but i don't know how to catch the data every time the ble send.

i'm using this plugin github.com/.../cordova-plugin-ble-central it's a Nordic Semicondutor that send the temperature every 3 seconds. it's gona be a function to an intel XDK app. here is the code that i think it should read the data:

ble.read(device_id, "6E400001-B5A3-F393-E0A9-E50E24DCCA9E", "6E400002-B5A3-F393-E0A9-E50E24DCCA9E", function(data){ data = (typeof(data)=="object")? JSON.stringify(data): data; document.getElementById('listitens').innerHTML += data; }, fail);

i tried another service_uuid, characteristic_uuid, but when call the sucess function, just return embty object, when it connected, returnd this object:

JSON.parse('{"characteristics":[{"characteristic":"2a00","service":"1800","properties":["Read","Write"]},{"characteristic":"2a01","service":"1800","properties":["Read"]},{"characteristic":"2a04","service":"1800","properties":["Read"]},{"descriptors":[{"uuid":"2902"}],"characteristic":"2a05","service":"1801","properties":["Indicate"]},{"characteristic":"6e400002-b5a3-f393-e0a9-e50e24dcca9e","service":"6e400001-b5a3-f393-e0a9-e50e24dcca9e","properties":["WriteWithoutResponse","Write"]},{"descriptors":[{"uuid":"2902"}],"characteristic":"6e400003-b5a3-f393-e0a9-e50e24dcca9e","service":"6e400001-b5a3-f393-e0a9-e50e24dcca9e","properties":["Notify"]}],"advertising":{},"id":"E3:F4:15:74:BA:94","services":["1800","1801","6e400001-b5a3-f393-e0a9-e50e24dcca9e"],"rssi":-61,"name":"BLE UART"}');

does anyone have an idea? thanks a lot

*sorry but i could not ident the code.

Related