Most recent activity
-
- 10 comments
- 767 views
-
-
-
Hi.
I've created Android app that serves Location and Navigation service, Device info, and Time service (standard GATT profiles). LNS has 3 characteristics.
Currently in Bangle JS2 client app I can subscribe to one service, one characteristic.function connection_setup() { NRF.requestDevice({filters:[{namePrefix:"Pixel 4a"}]}).then(function(d) { device = d; console.log("Found device: "+d.name); E.showMessage("Found device"+d.name); return device.gatt.connect(); }).then(function(ga) { gatt = ga; E.showMessage("Connected"); console.log("Connected"); lastReceivedTime = new Date(); return gatt.getPrimaryService("1819"); //How to get another services here? }).then(function(s) { service = s; return service.getCharacteristic("2a67"); //How to get other characteristics here? }).then(function(c) { characteristic = c; characteristic.on('characteristicvaluechanged', (event)=>updateSpeed(event)); return characteristic.startNotifications(); }).then(function() { console.log("Notifications subsribed"); E.showMessage("Notifications subsribed"); }).catch(function(e) { E.showMessage(e.toString(), "ERROR"); console.log(e); }); }
How to subscribe for LNS multiple characteristics, and to Time service, and also query Device info? Each .then() has only one return, I am not getting how to fork or chain it.
-
-
Hi Gordon,
I've loaded the cutting edge build 2v14.64.
Now it shows the devices but fails to device.gatt.connect();
It shows:var device; var gatt; NRF.requestDevice({filters:[{services:["1805"]}]}).then(function(d) { device = d; console.log("Found device: "+d.name); return device.gatt.connect(); }).then(function(ga) { gatt = ga; console.log("Connected"); }).catch(function(e) { console.log(e); });
WARNING: Unknown phy "undefined" Found device: Pixel 4a ERR 0x7 (INVALID_PARAM)
Hmm... well, yes, why not.... I'll try.