Notifications work. And this is the code in apache-cordova:
ID="80:EA:CA:00:3E:4E";
document.addEventListener('deviceready', onDeviceReady, false);
function onDeviceReady() {
// Cordova is now initialized. Have fun!
setTimeout(__ =>{
ble.scan([], 5, device=> console.log(JSON.stringify(device)), failure=> console.log('FAILURE: ',failure));
},2500);
setTimeout(__ =>{
ble.connect(ID, device=> console.log(JSON.stringify(device)), failure=> console.log('FAILURE: ',failure));
},5000)
document.getElementById('deviceready').classList.add('ready');
setTimeout(__ =>{
var onData = function(buffer) {
// Decode the ArrayBuffer into a typed Array based on the data you expect
var data = new Uint8Array(buffer);
console.log("Galileo data: " , JSON.stringify(data));
}
ble.startNotification(ID, "0783b03e-8535-b5a0-7140-a304d2495cb7", "0783b03e-8535-b5a0-7140-a304d2495cb8", onData, failure=> console.log('FAILURE: ',failure));
},10000);
}
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I made an apache-cordova app, and I got this object in connect method:
Notifications work. And this is the code in apache-cordova:
Do you have an idea?