• Hi,

    Which firmware version do you have on the Bangle? This may actually be unrelated to pairing.

    On 2v09 I added increased MTUs, but those require some negotiating and we found that when both devices support larger MTUs you actually needed a delay to let them finish.

    I think Cutting Edge firmwares have this fixed, but maybe the code below will work for you? It just adds a setTimeout

    scan = ()=>{
      NRF.findDevices(devices => {
        for (let device of devices) {
          // Only display devices that advertise a name
            if (device.name) {
              addMenuItem(device);
            }
        }
      }, {timeout:3000,active: true });
    };
    
    addMenuItem = (device)=>{
      console.log(device);
    
      //first attemp of sending the password
      /*device.on('passkeyRequest', function() {
        console.log("passKeyRequested");
        device.sendPasskey("012034");
      });
      */
      //adding a item to the menu, trying to connect when item is pressed
      scanMenu[device.name]= ()=>{
        console.log(device); // is displayed the device
        NRF.connect(device.id)
          .then((g)=>{
            console.log("NRF connection ok!");//is displayed
            var gatt = g;
            console.log(gatt);
            var device = g.device;
            //Second attempt of sending password
            device.on('passkeyRequest', function() {
              console.log("passKeyRequested");
              device.sendPasskey("012034");
            });
    
          gatt.startBonding()
          .then(()=>{
            console.log("bonded", gatt.getSecurityStatus()); //displays : bonded { "connected": true, "encrypted": false, "mitm_protected": false, "bonded": true }
            return new Promise(resolve => setTimeout(resolve, 1000)); // wait 1 sec
         }).then(() => {
            return gatt.getPrimaryService("00000000-3608-4b­ee-bb82-4d09b486bc1f"); //also tried getPrimaryServices()
        //console.log(services);
          })
          .then( (services)=>{
            console.log(services); //
            return services.getCharacteristics();
          })
          .then((chars)=>{
            console.log(chars);
          })
        })
        .catch((error)=>{
          console.log(error);
        });
      };
    
About

Avatar for Gordon @Gordon started