This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Temporaily Stopping Advertising

Our product has a legacy interface and for security reasons I want to allow users to disable or enable the BLE via this legacy interface.

My approach to this was to disable or enable advertising. Is this the correct approach? What happens if a connection is active?

  • Peripherals stop advertising on a connection and under 4.0 of the spec a peripheral could only have one master. I'm not sure where the spec is at at the moment, it may have eased (or be easing) up where a peripheral could have more than one master and so would be allowed to continue advertising even in a connection. But it would be application controlled anyway. With Nordic's BLE UART example, on connection the peripheral stops advertising. So if you were to disable advertising in a connection so it wouldn't restart upon the connection closing it wouldn't affect the connection. If you wanted to also disable any connections while at the same time as disabling advertising you could call sd_ble_gap_disconnect() which should close out the connection. Your peripheral wouldn't be discoverable/connectable until it recommenced advertising again which sounds like what you are after.

  • Only you can answer this question as it's your application. What does your application need to happen if a connection is active when the interface is disabled? You have two choices, you can leave it connected or you can close the connection. Do whichever of those is correct for your own security scenario.

    And yes you probably want to turn off connectable advertising, if you are advertising connectably, which you currently won't be if you are in connection (you'll be not advertising at all or advertising non-connectably) but that may be different in the future if you allow multiple connections when the softdevice allows that. Whether you continue to advertise non-connectably is also up to your application's requirements.

  • RK,

    Thanks for the thoughts. I hadn't considered making the device non-connectable. I was only thinking of disabling advertising.

Related