You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Please can you try this then?

    var advertise = function(options) {
      var d = new Uint8Array([
        0x02, // Number of bytes after first AD structure
        0x01, // BLE_GAP_AD_TYPE_FLAGS
        0x04, // BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED
        0x1A, // Length
        0xFF, // BLE_GAP_AD_TYPE_MANUFACTURER_SPECIFIC_DATA
        0x4C, 0x00, // 0x004C == Apple
        0x02, 0x15, // iBeacon type + length
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,// iBeacon proximity uuid
        0, 0, // major
        0, 0, // minor
        0xc5]); // 2'c complement RSSI at 1 meter distance in dBm
      d.set(9,options.uuid);
      if (options.major!==undefined) d.set(25,[options.major>>8,options.major]);
      if (options.minor!==undefined) d.set(27,[options.minor>>8,options.minor]);
      if (options.rssi!==undefined) d.set(29,[(options.rssi<0)?(options.rssi+256):options.rssi]);
      NRF.setAdvertising(d, {interval:100});
    };
    
    
    advertise({
      uuid : [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // ibeacon uuid
      major : 0x0102, // optional
      minor : 0x0304, // optional
      rssi : -59, // optional RSSI at 1 meter distance in dBm
    });
    

    If so I'll make that into a module

About

Avatar for Gordon @Gordon started