setAdvertising: Multiple packets Issue

Posted on
  • Hi,

    I'm trying to use a collection of pucks as both iBeacons and to report sensor information. I use them to automate lights, heating and track our position in the house. My implementation is rather hacky at the moment. I'm trying to refactor the code but I'm struggling to utilise setAdvertising as shown in the examples across the documentation.

    In the two examples shown below I'm led to believe I can send both iBeacon and sensor readouts in sequential packets.

      {0x180F : [Puck.getBatteryPercentage()]}, // normal advertising, with battery %
      require("ble_ibeacon").get(...), // iBeacon
      require("ble_eddystone").get(...), // eddystone
      {} // this will add a 'normal' advertising packet showing name/etc  
      ], {interval:100});

    I'm using Noble on a RPi to pick up the broadcasts and the reason I post both examples is because the first does not work for me at all. If any packet exists before the iBeacon package then I don't seem to pick anything up.

    I have more success with the second example code but Noble only seems to pick up the iBeacon broadcast and not the temperature. If I drop the iBeacon require then the temperature broadcast is picked up as expected.

    The actual code I want to run is a little more involved, and didn't work, which led me to use the basic examples exactly as shown above just to make sure I was on the right track, but I can't get them to work. To be clear I've limited the code to exactly the code above and am having no success.

    Am I missing something? Really I'm looking for reassurance that something isn't broken at a deeper level than I can fix/understand. If it's my setup then I can investigate further but fear at this stage I might be wasting my time.

    Deeply greatful to anyone who replies or has any ideas of something I can try.



  • Hi! Please can you try flashing one of the 'cutting edge' builds of Espruino from¬≠master/ and see if you have any more success?

    I noticed something similar a week or two ago and what it seems was happening was that Espruino was skipping over one advertising message each time. It worked if you had 3 like the example (or an odd number), but if you had 2 (or an even number) then it'd continually skip over the even-numbered messages.

    It's now fixed and it'll be in 2v02 when that's released, so if you had 2v01 or before it'd have the problem.

  • Hi Gordon,

    Typically my tests probably always included an even number of messages. I flashed to .69 and it works now as expected.

    Thank you for your help!


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

setAdvertising: Multiple packets Issue

Posted by Avatar for user98419 @user98419