Enabling and disabling Ibeacon/advertisement through events in a disconnected state

Ok, so I'm using the Metawear to detect orientation changes and notify an intel edison of the moment via ble advertisement packets. This part of the project works well! I'm successfully reading the packets on the edison and I'm able to see all advertised data. So moving forward i would like to only send ble advertisements when the Metawear detects an orientation change, then immediately disable advertisements. so, heres what I've tried:

[accelerometerMMA8452Q.orientationEvent programCommandsToRunOnEvent:^{;

  device.name = @On;

  [device.iBeacon setBeaconOn:YES];

  device.name = @Off;

  [device.iBeacon setBeaconOn:NO];

  [accelerometerMMA8452Q.orientationEvent eraseCommandsToRunOnEvent];


I've not shown it but this is wrapped within a connection to a handler and ends with a disconnect from the handler

unfortunately this never seems to disable advertisement 


  • Stephen, our iOS developer, is still on vacation at the moment.  I will let him know about your post when he's back.
  • The MetaWear always advertises regardless of iBeacon state.  When iBeacon is on it changes the contents of the ad packet, but even with iBeacon off it will still advertise the default MetaWear service.

    However, we are working on a feature that will give you exactly what you want.  It lets you advertise for only a predefined number of seconds before stopping advertising, and then you could use an orientationEvent to programmatically restart advertisement (for N seconds, then it will shut off automatically).  Stay tuned for the next release!
  • We do have the ability to disable advertisement now, but I'm not sure its the best idea for your use case.  Consider that with BLE, the central doing the scanning will never see every ad packet because it only turns on the radio for small bursts of time looking for packets.  You can't guarantee that the peripherals ad will always hit your central with its radio on.  So by sending out only 1 packet, it will likely be missed most of the time.

    That being said, you can opt to only advertise for some N number of seconds (1-180), using the following
    self.device.settings.advertisingTimeout = 1;

    Then you can program the orientation event to restart advertising:
    [accelerometerMMA8452Q.orientationEvent programCommandsToRunOnEventAsync:^{
        [self.device.settings startAdvertisementAsync];

    If you ever get locked out of your device, you can always press the button to manually restart advertising!

This discussion has been closed.