Is there a way to enable/disable BLE connectivity dynamically?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

We have a project where we'd like our BLE advertising device to only be connectable under certain circumstances (i.e. external stimuli).  Something along the lines of "push this button, and the device will be connectable for 30 seconds" would be perfect.  I'm sure there's an example of this someplace, but I'm having a difficult time identifying it.  Could anyone point me towards one?

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
SayaniS_66
Moderator
Moderator
Moderator
10 likes received First like received

Hi,

To make the peripheral device advertise for 30sec, you can change the timeout value in the BLE component customiser to 30 secs. Initially, the device will be in disconnected state. On switch press, an interrupt will be triggered which will make the peripheral device start connectable advertisement for 30 secs. If the device is in connected state and switch is pressed, then the device will be disconnected first and then start connectable advertisement again for 30 secs.

I am attaching the project for your reference.

-Sayani.

View solution in original post

0 Likes
1 Reply
lock attach
Attachments are accessible only for community members.
SayaniS_66
Moderator
Moderator
Moderator
10 likes received First like received

Hi,

To make the peripheral device advertise for 30sec, you can change the timeout value in the BLE component customiser to 30 secs. Initially, the device will be in disconnected state. On switch press, an interrupt will be triggered which will make the peripheral device start connectable advertisement for 30 secs. If the device is in connected state and switch is pressed, then the device will be disconnected first and then start connectable advertisement again for 30 secs.

I am attaching the project for your reference.

-Sayani.

0 Likes