This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Change the advertise interval in runtime

I need change the interval in runtime, so I call a function with the interval as the parameter advertising_init (interval ) every time that I will change. This function define the structure and set the interval:

static void advertising_init(uint16_t adv_interval_ms) 
{

    uint32_t                 err_code;
    ble_advdata_t            advdata;
    ble_advdata_manuf_data_t adv_manuf_data;
    uint8_array_t            adv_manuf_data_array;

    adv_manuf_data_array.p_data = m_adv_data;
    adv_manuf_data_array.size = m_adv_size;
    adv_manuf_data.company_identifier = 0xFF00;
    adv_manuf_data.data = adv_manuf_data_array;

    memset(&advdata, 0, sizeof(advdata));

    advdata.name_type               = BLE_ADVDATA_FULL_NAME;
    advdata.include_appearance      = false;
    advdata.flags                   = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
    advdata.p_manuf_specific_data   = &adv_manuf_data;

    ble_adv_modes_config_t options = {0};
    options.ble_adv_fast_enabled  = BLE_ADV_FAST_ENABLED;
    options.ble_adv_fast_interval = adv_interval_ms;

    err_code = ble_advertising_init(&advdata, NULL, &options, on_adv_evt, NULL);
    OUR_ERROR_CHECK(err_code, 0x1C);
}

But it is not work

Parents Reply Children
No Data
Related