Change advertisement interval of a BLE peripheral using SDK 5.0.4

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
2 posts / 0 new
Last post
dhrishi
Offline
Last seen:3 years 3 months ago
加入:2017-02-10 09:56
Change advertisement interval of a BLE peripheral using SDK 5.0.4

Hi,

We are using DA14580 in peripheral mode.
We need to implement an use case, wherein an accessory first advertises with 20 msec interval for 10 sec and then restarts (stops and starts) advertisement with interval 1.25 sec.

With the current implementation of ble_app_peripheral, I see that the interval is to be given in user_config.h through intv_min and intv_max parameters as a part of static const struct and advertisement is started using user_app_adv_start. Does that mean that I cannot change these values (intv_min and intv_max) at any other time?
If no, what is the right way in which the above usecase can be implemented.

Thanks,
Hrishikesh

Device:
STS_Dialog (not verified)
Hi,

Hi,

In the first circle of advertising the interval is given by the standard values which you can change them in the value that you want. After that when the advertising stops and starts again, you simply can use the callback of the kind of advertising you want to use(undirected-non connectable etc.) and in this function give the values you want in the interval through the pointer that is returned by the app_easy_gap_undirected_advertise_get_active. In our case in user_app_adv_undirect_complete, the code is below:

void user_app_adv_undirect_complete(uint8_t status)

{

// If advertising was canceled then update advertising data and start advertising again

如果(= = GAP_ER地位R_CANCELED)

{

// Schedule the next advertising data update

struct gapm_start_advertise_cmd* cmd;

cmd = app_easy_gap_undirected_advertise_get_active();

cmd->intv_min = 2000 ;

cmd->intv_max = 2000;

app_easy_gap_undirected_advertise_start();

}

}

Thanks,

STS_Dialog.