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

#define APP_ADV_DURATION 18000 Or 0?

I am using now SDK 15.0 and the value of APP_ADV_DURATION  is set to 18000 (180 sec)

But I saw that fromSDK15.2, it is recommended to change the value to 0 in order to get continuous advertisement

Does it mean that in SDK15.0 with 18000, the advertisement stops?  if not, is there any other side effect?

I tried to switch to 15.2, but it looks like there are many changes (long set of errors) - is there a document that explains how to migrate? 

  • Hello,

    Does it mean that in SDK15.0 with 18000, the advertisement stops?  if not, is there any other side effect?

    Yes. That causes the advertisements will stop after 180 seconds, and the device will go to sleep to conserve power.

    If you don't want your advertisements to time out, and your device to go to sleep, you can set the advertising duration (APP_ADV_DURATION) to 0. Note that you also need to change the advertising flag from BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC:MODE to BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE.

    In the ble_app_uart example, that means changing the line:

    init.advdata.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;

    to

    init.advdata.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;

    Note that when the advertisement never times out, the device will not go to sleep to conserve power. Except from this, there are no changes that I can think of.

    Best regards,

    Edvin

  • hi edvin yeah it work fine , can you explain how does it work when we make to 0 

  • Hi

    Setting APP_ADV_DURATION to 0 will disable the advertising timeout entirely, and it will keep advertising "indefinitely".

    Best regards,

    Simon

Related