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

Advertise for Limited time

Hi,

I have a application that needs to advertise only for 120 seconds and on change in values of accelerometer , it needs to start advertise again. presently i have a application that advertises forever i tried it to change by looking at examples but it doesnt seem to work. Can anyone please help me with this. Thanks.

Parents
  • There is a parameter for advertising timeout in ble_adv_modes_config_t. There is one for "fast" and one for "slow" advertising. For example only having "fast" advertising and no "slow" advertising means the nRF will stop advertising after the timeout parameter for fast.

    Then to restart, in your interrupt handler put ble_advertising_start(ble_adv_mode_t advertising_mode) and if the nRF is not advertising it will and if it is advertising will continue.

  • Thanks for quick reply, i have done those changes and on adv_evt i wrote as

    static void on_adv_evt(ble_adv_evt_t ble_adv_evt) { uint32_t err_code;

    switch (ble_adv_evt)
    {
        case BLE_ADV_EVT_IDLE:
    				SEGGER_RTT_WriteString(0,"Stopped");
    				advertise_flag = 0;
    				break;
        default:
            break;
    }
    

    }

    but it is not printing after 120 seconds also. is there any other changes that i need to make?

Reply Children
No Data
Related