API for upgrading firmware in user application.
More...
API for upgrading firmware in user application.
typedef void(* iot_dfu_callback_t)(uint32_t result, iot_dfu_evt_t evt) |
IOT DFU module's application callback.
- Parameters
-
[in] | result | Result of the received event. |
[in] | event | Event from IoT DFU module. |
- Return values
-
IoT DFU module's events.
Enumerator |
---|
IOT_DFU_WRITE_COMPLETE |
Write operation finishes with success.
|
IOT_DFU_ERROR |
DFU event indicating that an error occurs during update.
|
uint32_t iot_dfu_file_create |
( |
iot_file_t ** |
pp_file | ) |
|
Function for creating a PStorage IoT File reference for flash operations and setting start address of PStorage File.
- Note
- Application should ensure that correct word sized alignment is given at the beginning and between Application image and Softdevice image while updating them at the same time.
- Parameters
-
[out] | pp_file | Reference to PStorage File. |
- Return values
-
NRF_SUCCESS | on success, an error_code otherwise. |
Function for rebooting device and trigger bootloader to swap the new firmware.
- Note
- Currently the following combinations are allowed:
- Application
- Bootloader
- SoftDevice with Application
- SoftDevice with Bootloader
- Parameters
-
[in] | p_firmware_desc | Description of the firmware. Must have been set to zeros on all unused fields. |
- Returns
- NRF_SUCCESS on success, an error_code otherwise.
Function for validating the CRC of the received image.
- Parameters
-
[in] | p_firmware_desc | Description of the firmware. Must have been set to zeros on all unused fields. |
- Return values
-
NRF_SUCCESS | on success, an error_code otherwise. |
Function for initializing IOT DFU module.
- Note
- The iot_dfu does not hold any state. The application must ensure that only one firmware image is written at once. Remember to register pstorage event handler to allow IoT File module to work.
err_code = softdevice_sys_evt_handler_set(sys_evt_dispatch); APP_ERROR_CHECK(err_code);
static void sys_evt_dispatch(uint32_t sys_evt) { pstorage_sys_event_handler(sys_evt); }
err_code = pstorage_init(); APP_ERROR_CHECK(err_code);
- Parameters
-
[in] | cb | Callback to be called upon IoT file write success and failure, or any IoT DFU error event. |
- Return values
-
NRF_SUCCESS | on success, an error_code otherwise. |