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

Can we change the advertise interval while runing? 51822, SDK 11

51822

SDK11

Can we change the advertise interval after 51822 started? I need to change the interval to lower / higher based on the user phone. For example, if its IOS I will set the interval longer to save current. If its android, I will set the interval shorter to speed up ble connection. After the first time ble connected, based on the phone I will write a special value for different interval to the board service, and then the board to change the interval accordingly. My question is, can I change the interval and how to do that while the nRF devices running. 

Thanks,

  • Hi,

    Yes, there is no need to reset the nRF in order to change advertising interval. The advertising interval is part of the configuration struct (ble_gap_adv_params_t) that you pass to sd_ble_gap_adv_start() if you use the SoftDevice API directly.

    If you use the advertising module, this allows you to configure a few advertising intervals (fast and slow), but does not have API to update it. You could modify the module to allow you to update it though, or as a hack, you could remove static from m_adv_modes_config in ble_advertising.c, and declare it as an extern in your code, and set m_adv_modes_config.ble_adv_directed_slow_timeout and/or m_adv_modes_config.ble_adv_fast_interval the new values before you start advertising with ble_advertising_start(). This is of course not very clean but demonstrates how you can do it.

Related