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

ble_advdata_set deprecated

Hello,

I am trying to move the

err_code = ble_advdata_set(&advdata, NULL);

 return err_code;

Looking the documentation the new functions to update the advertisment are:

 ret = ble_advdata_encode(&advdata_, new_advdata.adv_data.p_data, &new_advdata.adv_data.len);
    APP_ERROR_CHECK(ret);
     
        
 ret = sd_ble_gap_adv_set_configure(&(m_advertising).adv_handle, &new_advdata, NULL);
    APP_ERROR_CHECK(ret);

But I don't undestand how use it to modify the 0xFF type data,...

I am trying with a function like this:

uint32_t _ble_update_manuf_specific_data( uint16_t vSize, uint8_t * vData ){
    uint32_t err_code;
        
        ble_gap_adv_data_t     new_advdata;
        ble_advdata_t             adver_data;
    
        memset(&new_advdata, 0, sizeof(new_advdata));
        memset(&adver_data, 0, sizeof(adver_data));
    
        adver_data.name_type                       = BLE_ADVDATA_FULL_NAME;
    adver_data.include_appearance              = true;
    adver_data.flags                           = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
    adver_data.uuids_complete.uuid_cnt         = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
    adver_data.uuids_complete.p_uuids          = m_adv_uuids;
            
        adver_data.p_manuf_specific_data           = &m_manuf_specific_data;
        m_manuf_specific_data.data.p_data         = m_manuf_data_array;
    
        adver_data.p_manuf_specific_data->company_identifier = LULABYTES_ID;
        adver_data.p_manuf_specific_data->data.size                     = vSize;        
        for(uint32_t i = 0; i < vSize; i++){ m_manuf_data_array[i] = vData[i];    }    

          

    err_code = ble_advdata_encode(&adver_data, &(new_advdata->adver_data.p_data), &(new_advdata->adver_data.len));
    APP_ERROR_CHECK(err_code);
    
        err_code = sd_ble_gap_adv_set_configure(&(m_advertising).adv_handle, &new_advdata, NULL);
    APP_ERROR_CHECK(err_code);
    
    return err_code;
}

But it has errors.