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

DFU with extra authentication

Hello, I want to put extra authentication when device is preparing for boot loader. I found callback  "ble_dfu_evt_handler". I think inside case  BLE_DFU_EVT_BOOTLOADER_ENTER_PREPARE , I can add that condition like below:

        case BLE_DFU_EVT_BOOTLOADER_ENTER_PREPARE:
        {
            NRF_LOG_INFO("Device is preparing to enter bootloader mode.");
            
            if(authentication_condition != true ){
                stop_DFU_api();
            }{
                // Prevent device from advertising on disconnect.
                ble_adv_modes_config_t config;
                advertising_config_get(&config);
                config.ble_adv_on_disconnect_disabled = true;
                ble_advertising_modes_config_set(&m_advertising, &config);

                // Disconnect all other bonded devices that currently are connected.
                // This is required to receive a service changed indication
                // on bootup after a successful (or aborted) Device Firmware Update.
                uint32_t conn_count = ble_conn_state_for_each_connected(disconnect, NULL);
                NRF_LOG_INFO("Disconnected %d links.", conn_count);
            }
            break;
        }

I am unable to find api to stop DFU process. Please suggest. Also let me know if this is correct way of doing same.

Thanks

Parents Reply Children
No Data
Related