how to set up fast/slow adv and timeout in NCS?

In SDK, I set up fast / slow adv and timeout like this:

nit.config.ble_adv_fast_enabled = true; //false
init.config.ble_adv_fast_interval = APP_ADV_INTERVAL;//APP_ADV_FAST_INTERVAL; //;
init.config.ble_adv_fast_timeout = APP_ADV_DURATION;//APP_ADV_FAST_TIMEOUT; //;
init.config.ble_adv_slow_enabled = true;
init.config.ble_adv_slow_interval = APP_ADV_SLOW_INTERVAL;
init.config.ble_adv_slow_timeout = APP_ADV_SLOW_TIMEOUT;

How do we enable fast / slow adv in NCS, and how to set up timeout of fast adv so it turns into slow adv mode?

Thanks,

  • Hello,

    I just want to start of by mentioning that all of this is described well in the BLE Fundementals course. Lesson 2 might especially be interesting to you.

    You can change the advertising interval using for instance:

    static struct bt_le_adv_param *adv_param = BT_LE_ADV_PARAM(BT_LE_ADV_OPT_NONE, [minimum adv interval], [maximum adv interval], NULL);

    In NCS you can create a max and a min, so that in case it does not have time to reach the min value it can delay it until the max times out. Though unfortunately you do not have any timeouts per se, when using normal advertising. You would have to timeout this manually by for instance using a work queue, and then change the advertising parameters (how this can be done is described in the NCS fundamentals course I think).

    Though interestingly, timeout is a thing when using the extended advertising api. And extended advertising api can be used without extended advertising, so theoretically I think you can do what you want using that.

    Either way, I would recommend going through the BLE fundamentals course.

    Regards,

    Elfving

  • Thanks. Yes I did see the min and max settings. I just didn't know how to timeout it. 

Related