Hello,
I'm using the nrf52DK for the chip nrf52832 with nrf connect SDK v2.6.1
I want to implement an advertising timeout say 5 minutes. How can I achieve that? any example code would be nice.
Thanks for the help.
Hello,
I'm using the nrf52DK for the chip nrf52832 with nrf connect SDK v2.6.1
I want to implement an advertising timeout say 5 minutes. How can I achieve that? any example code would be nice.
Thanks for the help.
Hello,
You can stop the advertising with bt_le_adv_stop()
after 5 minutes has passed. To do that you can create a timer and stop the advertising when the timer finishes. See Timers for documenation and code examples.
Does this cover your use-case? If not, please describe it in more detail and we can help you to find a solution.
You can also refer to Bluetooth Low Energy Fundamentals Lesson 2 to for a hands-on learning experience on Bluetooth LE advertising.
Best regards,
Maria
Hello,
You can stop the advertising with bt_le_adv_stop()
after 5 minutes has passed. To do that you can create a timer and stop the advertising when the timer finishes. See Timers for documenation and code examples.
Does this cover your use-case? If not, please describe it in more detail and we can help you to find a solution.
You can also refer to Bluetooth Low Energy Fundamentals Lesson 2 to for a hands-on learning experience on Bluetooth LE advertising.
Best regards,
Maria
Hello,
Thanks for your reply.
I'm looking more towards the options of "BT_LE_AD_LIMITED" where we could define advertising timeout as a parameter. I'm currently migrating from "NRF5 SDK" hence, I am unsure if this above option is very efficient or if I should go towards the first option you suggested using timers!
let me know.
Sorry for the late reply, you should be able to use BT_LE_AD_LIMITED in the advertising flag and have the CONFIG_BT_LIM_ADV_TIMEOUT being set to timeout value in your prj.conf. This should work as reported by some of our customers but in case it did not, it should be quite simple to add a timer with a callback and a timeout. In the timeout callback handler just call bt_le_adv_stop to stop the advertisement.
Thanks for your response.
your recommendation of CONFIG_BT_LIM_ADV_TIMEOUT with BT_LE_AD_LIMITED works great if the timeout is within 3 minutes.
But for my requirement of 5-minute timeout, I think the only option is to use the timer recommendation method. I shall do it & shall update the ticket later in the coming weeks.
The default timer example which you had given at the above link works. Thanks