You are reading a single comment by @dave and its replies. Click here to read the full conversation.
  • Thanks very much Gordon.

    I gave it a go but had mixed results. Using the code above the iBeacon worked as expected, but nRF Connect on my iPhone showed the Service Data from the NRF.setAdvertising call alternated on and off. I.e. as nRF Connect scanned, the ServiceData would alternately display the correct advertisement data (e.g. <0x181A...) and 'N/A'.

    I didn't see that behaviour when the iBeacon data was sent in the scan response previously.

    I tried turning on the advertising option in NRF.setServices to get iBeacon, Service Data and services simultaneously e.g.

    services = {....}
    
      options = {
          advertise: ['180A','180F','181A','87100001-703F-4AEE-A323-9AE013D98E93'],
          uart: true,
      };
    
    function onInit() {
    
      NRF.setAdvertising([
          require("ble_ibeacon").get({
              uuid : beaconUUID,    // iBeacon uuid
              major : beaconMajor,  // optional
              minor : beaconMinor,  // optional
              rssi : -59            // optional RSSI at 1 meter distance in dBm
          }),
          {
              0x1815 : [button.single, button.long],
              0x180F : [metrics.battery],
              0x1809 : [metrics.temperature],
              0x181A : [metrics.light]
          }],{ interval : 375 });
    
        try {
          NRF.setServices(services, options);
        } catch(err) {
          // This always seem to throw BLE error 4 for some reason.
          console.log(err);
        }
    
    }
    

    iBeacon worked ok, service data still blinked in and out in nRF Connect and only one of the 4 services in the options.advertise array was shown in ServiceUUID in nRF Connect. Connecting to the Puck in nRF Connect only showed the Nordic UART service, not any of the other defined services.

    Interestingly, the 'LightBlue Explorer' app on the iPhone showed the correct services, but connecting still also only listed the Nordic UART service.

    I also tried reversing the order of the NRF.setServices and NRF.setAdvertising calls but it made no difference.

About

Avatar for dave @dave started