NRF.setAdvertising 'name' and 'iBeacon'

Posted on
  • var ibeacon = require("ble_ibeacon");
    var uuid = "2F3E43C7-8400-44B5-B385-1E6BB411A3BE";
    
    function uuidStringToArray(uuid) {
      uuid = uuid.replace(/-/g, ""); // remove dashes
      let uuidArray = [];
      for (let i = 0; i < uuid.length; i += 2) {
        uuidArray.push(parseInt(uuid.substring(i­, i + 2), 16));
      }
      return uuidArray;
    }
    
    NRF.setAdvertising([
      ibeacon.get({
        uuid : uuidStringToArray(uuid),
        major : 2,
        minor : 1,
        rssi : -59
      }),
      {name: "PuckHub"}
    ], {interval:200});
    
    

    I'm having trouble advertising a custom name and iBeacon information on my puck.js. do you have any suggestions for me? the iBeacon information works but the name does not change...

  • It's a bit counter-intuitive, but you need the name in the second argument, so:

    NRF.setAdvertising([
      ibeacon.get({
        uuid : uuidStringToArray(uuid),
        major : 2,
        minor : 1,
        rssi : -59
      }),
      {}
    ], {interval:200,name: "PuckHub"});
    
  • Thank you!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

NRF.setAdvertising 'name' and 'iBeacon'

Posted by Avatar for user149221 @user149221

Actions