• The same error is returned when trying to get the primary service of my laptop from bangle js. I implemented a Gattserver solution on my laptop advertsing a costant value (as explained in UWP sample on Microsoft website): the bangle successuflly connects to my laptop but on finding primary services the code run into the same error. I suppose it's not able to find the service even if on scanning BLE devices nearby with relative services it seems to be visible. Here my JS code:

    
    function ReceiveData(d) { 
      g.drawString(d, g.getWidth()/2, g.getHeight()/2); 
    }
    
    
    Bluetooth.on('data', function(d) { 
      g.clear();
      g.setFont("Vector", 10);
      g.setColor(0,255,0);
      setTimeout( () => (g.drawString(Serial.read(), g.getWidth()/2, g.getHeight()/2)), 5000);
      setTimeout( () => (g.drawString('Data received', g.getWidth()/2, g.getHeight()/2)), 2000);
      });
    
    NRF.on('connect', function(addr) {
      g.clear();
      g.setFont("Vector",10);
      g.setColor(255,0,0);
      g.drawString(addr,g.getWidth()/2, g.getHeight()/2);
      g.setFont("Vector",25);
      setTimeout(()=>g.drawString("Connected", g.getWidth()/2, g.getHeight()/2), 3000);
      setTimeout(()=>g.clear(),1000); 
      Connect(macaddress);
    });
    
    NRF.on('disconnect', function(reason) {
      g.clear();
      g.setColor(0,0,255);
      g.drawString("Disconnected", g.getWidth()/2, g.getHeight()/2);
      setTimeout(()=> g.clear(), 1000);
    });
    
    function Scandevices(){
      var devices;
      NRF.findDevices(function(d) {
      devices = d;
      console.log(devices);
      }, {timeout : 2000, filters : [{ manufacturer: "6"}] });
      }
    
    function Connect(){
      NRF.connect(macaddress).then(function(g) {
        gatt = g;
        return gatt.startBonding(); 
        }).then(function(service) {
        try{
            console.log(gatt.getSecurityStatus());
            console.log("Connected");
            return gatt.getPrimaryService(serviceUid).catch(onRejected);
        }
        catch(exception){
          console.log(exception);
        }
          console.log("Service");
          return service.getCharacteristic(characteristcUid).catch(onRejected);}).then(function(characteristic) {
            //console.log(characteristic);
            //console.log("Got:", JSON.stringify(d.buffer));
            });
    }
    
    function onRejected(event){
      console.log('The code run into a problem: '+ event);
    }
    
    
    
    
    // Code
    
    g.setFontAlign(0,0); 
    g.setFont("Vector",25);
    delay = 5000;
    
    var gatt;
    macaddress = "58:74:96:7c:53:b0" + " private-resolvable";
    serviceUid = 'f150e6c7-0db4-4645-ae74-023c39598372';
    characteristicUid = "b952f9c0-218d-42b6-8ee6-4aab35753922";
    
    Scandevices();
    setTimeout(Connect, delay);
    
    
    
    
    
    
    

    After printing "Connected" the error appears!

About

Avatar for Riccardokhm @Riccardokhm started