Callbacks the device application can use to manage the firmware update flow. If your application does not require an implementation of any special logic, FOTA provides a default implementation for the update callbacks. To enable the default implementation, inject the ::FOTA_DEFAULT_APP_IFS define into the application build. More...
Go to the source code of this file.
Functions | |
int | fota_app_on_download_authorization (const manifest_firmware_info_t *candidate_info, fota_component_version_t curr_fw_version) |
int | fota_app_on_install_authorization (void) |
int | fota_app_on_complete (int32_t status) |
void | fota_app_resume (void) |
void | fota_app_authorize (void) |
void | fota_app_reject (int32_t reason) |
void | fota_app_defer (void) |
void | fota_app_postpone_reboot (void) |
void | fota_app_on_download_progress (size_t downloaded_size, size_t current_chunk_size, size_t total_size) |
int | fota_app_on_main_app_verify_install (const fota_header_info_t *expected_header_info) |
int | fota_app_on_install_candidate (const char *candidate_fs_name, const manifest_firmware_info_t *firmware_info) |
int | fota_app_install_main_app (const char *candidate_file_name) |
Callbacks the device application can use to manage the firmware update flow. If your application does not require an implementation of any special logic, FOTA provides a default implementation for the update callbacks. To enable the default implementation, inject the ::FOTA_DEFAULT_APP_IFS define into the application build.
void fota_app_authorize | ( | void | ) |
Authorize Pelion FOTA client to proceed with an update.
FOTA client expects the fota_app_on_download_authorization() and fota_app_on_install_authorization() application callbacks to call this API.
void fota_app_defer | ( | void | ) |
Defer FOTA update.
Stop all operations related to update process. The FOTA client pauses the FOTA process, releases resources and reattempts the update when the device application calls the fota_app_resume() API.
fota_app_on_download_authorization() and fota_app_on_install_authorization() application callbacks may call this API.
int fota_app_install_main_app | ( | const char * | candidate_file_name | ) |
Install main application by overwriting current executable file.
This function overwrites the executable file and relaunches the process. The client expects the fota_app_on_install_candidate() application callback to call this API. It is only available if there is a single main file.
[in] | candidate_file_name | Candidate image file name as found in the file system. |
int fota_app_on_complete | ( | int32_t | status | ) |
Pelion FOTA complete callback to be implemented by the device application.
Should be implemented by the application if it wants to receive a notification that the update process is done/terminated. The update result can be determined based on the status argument.
[in] | status | Pelion FOTA status code. ::FOTA_STATUS_SUCCESS if the update is deployed successfully. |
int fota_app_on_download_authorization | ( | const manifest_firmware_info_t * | candidate_info, |
fota_component_version_t | curr_fw_version | ||
) |
FOTA download authorization callback to be implemented by the device application.
The application must implement this callback if you want the application to authorize the FOTA client to start downloading the candidate image. The client invokes this callback for the first time when the device receives the update manifest from Device Management.
FOTA expects the callback implementation to call one of these APIs:
[in] | candidate_info | Candidate image descriptor. |
[in] | curr_fw_version | Firmware version of the component currently on the device. |
void fota_app_on_download_progress | ( | size_t | downloaded_size, |
size_t | current_chunk_size, | ||
size_t | total_size | ||
) |
Progress bar support for Pelion FOTA update.
The application should implement this API.(Optional) FOTA client calls this API when the download progresses by 5% percent (approximately).
[in] | downloaded_size | Number of bytes already downloaded to the device. |
[in] | current_chunk_size | Size, in bytes, of the currently downloaded chunk. |
[in] | total_size | Total image size in bytes. |
int fota_app_on_install_authorization | ( | void | ) |
Pelion FOTA install authorization callback to be implemented by the device application.
Should be implemented by the application if it wants to authorize FOTA to install the update. The client invokes this callback for the first time when the device fully downloads the update candidate image.
FOTA client expects the callback implementation to call one of these APIs:
int fota_app_on_install_candidate | ( | const char * | candidate_fs_name, |
const manifest_firmware_info_t * | firmware_info | ||
) |
Pelion FOTA install callback to be implemented by application.
FOTA client expects the callback to install the candidate and return ::FOTA_STATUS_SUCCESS or reboot the system.
[in] | candidate_fs_name | Candidate image file name. |
[in] | firmware_info | Parsed update manifest. |
int fota_app_on_main_app_verify_install | ( | const fota_header_info_t * | expected_header_info | ) |
FOTA callback for verifying installation of the main application, to be implemented by the application.
Should be implemented by the application if it has custom logic to verify installation of the main application. If custom logic is not required, FOTA uses the default implementation.
The ::expected_header_info field includes the whole candidate header, including the vendor_data field, which can store vendor-specific data to help verify installation of the main app (for example, a vendor-specific application hash).
[in] | expected_header_info | Expected candidate header information that the client can use to verify the newly installed app. |
void fota_app_postpone_reboot | ( | void | ) |
Postpone device reboot after FOTA update.
For the MAIN mbed-os component, the FOTA client doesn't boot by itself after download is completed. The device application must trigger reboot. After reboot, the bootloader installs the MAIN mbed-os component and completes the FOTA process. For other components: The FOTA client installs the component but doesn't boot itself. The device application must trigger reboot. Only fota_app_on_install_authorization() application callbacks may call this API.
void fota_app_reject | ( | int32_t | reason | ) |
Reject and terminate FOTA update.
fota_app_on_download_authorization() and fota_app_on_install_authorization() application callbacks may call this API.
[in] | reason | Reject reason code. |
void fota_app_resume | ( | void | ) |
Resume Pelion FOTA update.
If the update process is interrupted, the application can call this function to resume the process. This API invokes fota_app_on_download_authorization() CB.