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

Advertising update SDK15

Hello everyone,

I would like to update my advertising data on the fly but actually it doesn't work. Some posts talk about this behaviour but no real answers.

Here's my code :

static void update_advertising_data (uint8_t* p_user_data,uint8_t len_user_data){
    
    ble_advdata_manuf_data_t manuf_specific_data;
    ble_advdata_t advdata;

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

    manuf_specific_data.company_identifier = APP_COMPANY_IDENTIFIER;
    manuf_specific_data.data.p_data = (uint8_t *) p_user_data;
    manuf_specific_data.data.size   = len_user_data;

    // Build and set advertising data.
    memset(&advdata, 0, sizeof(advdata));

    advdata.name_type             = BLE_ADVDATA_FULL_NAME;
    //advdata.short_name_len        = strlen(DEVICE_NAME)-3;
    advdata.flags                 = BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED;
    advdata.p_manuf_specific_data = &manuf_specific_data;
        
    uint32_t err_code = ble_advdata_encode(&advdata, m_adv_data2.adv_data.p_data ,&m_adv_data2.adv_data.len);//m_adv_data.adv_data.p_data, &m_adv_data.adv_data.len);
    APP_ERROR_CHECK(err_code);

    err_code = sd_ble_gap_adv_set_configure(&m_adv_handle, &m_adv_data2, NULL);
    APP_ERROR_CHECK(err_code);
}

I see that and I need to respect that :

In order to update advertising data while advertising, new advertising buffers must be provided. => I use a new buffer (m_adv_data2)

Provide a pointer to an existing advertising handle to configure an existing advertising set => I KEEP THE SAME HANDLE SINCE THE BEGINNING

When this function is used to update advertising data while advertising,this parameter must be NULL. => sd_ble_gap_adv_set_configure PARAMETER 3 IS SET TO NULL

The result is an error and no data updated ...

The error I get is the following : sd_ble_gap_adv_set_configure(&m_adv_handle, &m_adv_data2, NULL); return => 0X08

Hope anyone could help me.

Kind regards,
Sylvain.

Parents Reply Children
Related