Mistake on this page? Email us
fota_component.h File Reference

Functions required for implementing the component update feature. More...

Go to the source code of this file.

Data Structures

struct  fota_component_desc_info_t
 

Typedefs

typedef int(* fota_component_curr_fw_read) (uint8_t *buf, size_t offset, size_t size, size_t *num_read)
 
typedef int(* fota_component_curr_fw_get_digest) (uint8_t *buf)
 
typedef int(* fota_component_verify_install_handler_t) (const char *comp_name, const fota_header_info_t *expected_header_info)
 

Functions

int fota_component_add (const fota_component_desc_info_t *comp_desc, const char *comp_name, const char *comp_semver)
 
int fota_component_version_int_to_semver (fota_component_version_t version, char *sem_ver)
 

Detailed Description

Functions required for implementing the component update feature.

Typedef Documentation

typedef int(* fota_component_curr_fw_get_digest) (uint8_t *buf)

A callback function to get the current firmware digest. Required only if delta update is supported for this component.

Parameters
[out]bufA buffer with the current firmware digest. Make sure the size of the buffer is sufficient to hold the digest.
Returns
::FOTA_STATUS_SUCCESS on success.
typedef int(* fota_component_curr_fw_read) (uint8_t *buf, size_t offset, size_t size, size_t *num_read)

A callback function to read the current firmware. Required only if delta update is supported for this component.

Parameters
[out]bufBuffer with data about the current firmware.
[in]offsetOffset from which to read.
[in]sizeOutput buffer size.
[in]num_readActual size read.
Returns
::FOTA_STATUS_SUCCESS for a successful read operation.
typedef int(* fota_component_verify_install_handler_t) (const char *comp_name, const fota_header_info_t *expected_header_info)

A callback function to verify component installation success. Executed after component installation.

Parameters
[in]component_nameName of the installed component. The same name that was specified as an argument to fota_component_add().
[in]expected_header_infoHeader with expected values for installed components.
Returns
::FOTA_STATUS_SUCCESS on success.

Function Documentation

int fota_component_add ( const fota_component_desc_info_t comp_desc,
const char *  comp_name,
const char *  comp_semver 
)

Component registration. Adds the component to the component database. The function should be called from the ::fota_platform_init_hook() function. The component description should reside in the stack to prevent unnecessary allocations and memory copies.

Parameters
[in]comp_descComponent description with required information.
[in]comp_nameA string value representing the component name to add. Maximum length is ::FOTA_COMPONENT_MAX_NAME_SIZE including NULL termination. Must not start with "%".
[in]comp_semverA string value representing the Semantic Version of the component firmware installed at the factory.
Returns
::FOTA_STATUS_SUCCESS on success.
int fota_component_version_int_to_semver ( fota_component_version_t  version,
char *  sem_ver 
)

Convert internal FOTA library semantic version representation to a human-readable string.

The version in the internal FOTA library representation passed to fota_app_on_download_authorization() and candidate callback APIs.

Parameters
[in]versionInternal version representation. Component description with required information.
[in]sem_ver
Returns
::FOTA_STATUS_SUCCESS on success.