• 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.

About

Avatar for Mark_M @Mark_M started