• I'm working on implementing ANCS (Apple Notification Service) on the Puck so that when my iPhone gets an alert its sent over BLE to the puck. I've had some success using the nRF toolbox on my Android phone to connect to the iPhone and I can see alerts coming over. Therefore I know the iPhone side is working.

    However I can't seem to implement it on the puck, from what I can tell I first need to bond the Puck to the iPhone and then I can connect to the ANCS service and subscribe to the Notification Service.
    However the puck doesn't seem to be able to initiate a connection to the iPhone let alone get as far as bonding, I've tried both discovering the device and then connecting as well as responding to an incomming connection, both of which the NRF.connect fails with a connection timeout.
    I'm using a serial console now so that the pucks BLE device is free to connect to the iPhone and I can debug on the console, code is below,

    var devices;
    var ios;
    
    //Discover BLE Devices
    NRF.findDevices(function(d) {
      devices = d;
      console.log(devices);
    }, 5000);
        
    
    // Find one with the ANCS Service
    for (var i = 0; i < devices.length; i++) {
        if (devices[i].services.indexOf("7905f431-b­5ce-4e33-a455-4b1e122d00d0") != -1){
          ios = devices[i];
        }         
    }
    
    //Bond to it
    ios.gatt.connect().then(function(g) {
      gatt = g;
      console.log("connected");
      return gatt.startBonding();
    }).then(function() {
      console.log("bonded", gatt.getSecurityStatus());
      LED2.set();
      gatt.disconnect();
    }).catch(function(e) {
        LED1.set();
        console.log("ERROR",e);
    });
    
    
About

Avatar for sammachin @sammachin started