4 posts / 0 new
Last post
dhirajp15
Offline
Last seen:2 years 2 months ago
加入:2016-06-08 15:26
Advertising timeout

Hi Dialog,
I am using ble_app_barebone example with Da14583 module, I want to advertise for 1min and then stop till button press, I have created a timer using app_easy_timer() function that works for me.I now want to ask that instead of creating a timer can i just modify the user_default_hnd_conf in user_config.h as:
.adv_scenario=DEF_ADV_WITH_TIMEOUT,
.advertise_period=MS_TO_TIMERUNITS(6000),
I am using all other settings as it is from ble_app_barbone example and tried out doing the above changes but the device advertise forever.What else should I change to stop advertising after 1sec?

Device:
MT_dialog
Offline
Last seen:2 months 3 weeks ago
Staff
加入:2015-06-08 11:34
Hi dhirajp15,

Hi dhirajp15,

By defining the DEF_ADV_WITH_TIMEOUT does exactly the same thing, it triggers a timer with the delay declared in the .advertise_period and then starts advertising but this is the default advertising procedure and the barebone doesn't follow the default advertising procedure since the default callback has been replaced with the user_app_adv_start() function. This means that the DEF_ADV_WITH_TIMEOUT isn't taken into account when the barebone starts advertising. In order to have this functionallity you should replace the user_app_adv_start() with the default_advertise_operation() function. Also have in mind that this configuration when stops advertising it will call the user_app_adv_undirect_complete() function which will restart the advertising. So most probably even if you replace the functions that i ve mentioned you should comment out the user_app_adv_start() function that is located in the user_app_adv_undirect_complete() in order for your device stop advertise.

Thanks MT_dialog

dhirajp15
Offline
Last seen:2 years 2 months ago
加入:2016-06-08 15:26
Hi MT_Dialog,

Hi MT_Dialog,
I did the above changes but the device stops advertising within a second, i think it is because in user_config.h
user_undirected_advertise_conf:
/// Advertise interval
.intv = 1600, // 100ms (160*0.625ms)
if i increase this will it help, and can i make it to advertise for a minute?

MT_dialog
Offline
Last seen:2 months 3 weeks ago
Staff
加入:2015-06-08 11:34
Hi dhirajp15,

Hi dhirajp15,

The .intv member of the user_undirected_advertise_conf will increase the interval between the advertising events, and not the amount of the advertising time. If you ve done the above changes you should also change the .advertise_period=MS_TO_TIMERUNITS(x) of the user_default_hnd_conf. This is the delay parameter and determines how long the advertising procedure lasts before the timer cancels advertising.

Thanks MT_dialog