Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to change the DFU advertising name in application?

Hi, all

I have some questions:

1. Is the DFU advertising name could be stored in the dfu_settings_page?

2. How colud I change the DFU advertising name in the application project ( instead to define in sdk_config.h of DFU project).

I had tried to change the DFU advertising name in the application project as follow, but it seem failed:

NRF_SVCI_ASYNC_FUNC_DEFINE(NRF_DFU_SVCI_SET_ADV_NAME, nrf_dfu_set_adv_name, nrf_dfu_adv_name_t);
static void prepare_for_dfu(void)
{
    static nrf_dfu_adv_name_t dfuAdvName;
    dfuAdvName.crc = 0xFFFFFFFF;
    dfuAdvName.len = strlen(DEVICE_NAME);
    memcpy(dfuAdvName.name, DEVICE_NAME, dfuAdvName.len);
    dfuAdvName.name[dfuAdvName.len] = '\0';
    
    uint32_t err_code = nrf_dfu_set_adv_name(&dfuAdvName);
    if (err_code == NRF_SUCCESS)
    {
    }
    NRF_LOG_INFO("nrf_dfu_set_adv_name %d.", err_code);
}

Thanks in advance!

Parents
  • Hi

    1. No, it shouldn't be a problem having the device name defined in another file (nrf_dfu_settings.h for example). Just add the #define NRF_DFU_BLE_ADV_NAME "DEVICENAME" to where you want it and remove it from the sdk_config.h file of your project.

    2. Alternatively, you can edit the NRF_DFU_BLE_ADV_NAME that is used in the nrf_dfu_ble.c file's gap_params_init() function to just be the device name you want. It is entirely up to you where you define this.

    Best regards,

    Simon

Reply
  • Hi

    1. No, it shouldn't be a problem having the device name defined in another file (nrf_dfu_settings.h for example). Just add the #define NRF_DFU_BLE_ADV_NAME "DEVICENAME" to where you want it and remove it from the sdk_config.h file of your project.

    2. Alternatively, you can edit the NRF_DFU_BLE_ADV_NAME that is used in the nrf_dfu_ble.c file's gap_params_init() function to just be the device name you want. It is entirely up to you where you define this.

    Best regards,

    Simon

Children
Related