Updater#
Functions
-
int updater_init(void)#
Initializes the updater module.
This function initializes the updater module and prepares it for use.
- Returns:
An integer indicating the status of the operation. A return value of 0 indicates success, while any other value indicates an error.
-
int updater_deinit(void)#
Deinitializes the updater module.
This function deinitializes the updater module and releases any resources that were allocated during initialization.
- Returns:
An integer indicating the status of the operation. A return value of 0 indicates success, while any other value indicates an error.
-
int updater_register_event_callback(updater_event_callback_t cb, void *cb_ctx)#
Registers an event callback for the updater module.
This function registers a callback function that will be called when an event occurs in the updater module.
- Parameters:
cb – [in] The callback function to register.
cb_ctx – [in] A pointer to the context that will be passed to the callback function when it is called.
- Returns:
An integer indicating the status of the operation. A return value of 0 indicates success, while any other value indicates an error.
-
int updater_set_runner(updater_runner_t runner, void *ctx)#
Sets the runner for the updater module.
This function sets a runner for the updater module. The runner is a function that will be called when an update request occurs. The context pointer will be passed to the runner function when it is called.
- Parameters:
runner – [in] The runner function to set.
ctx – [in] A pointer to the context that will be passed to the runner function when it is called.
- Returns:
An integer indicating the status of the operation. A return value of 0 indicates success, while any other value indicates an error.
-
int updater_request(const struct updater_param *param, struct downloader *downloader)#
Requests an update using the specified parameters.
This function requests an update using the parameters provided in the updater_param structure and the specified downloader.
Note
If there is an existing update request, it will drop the new request if the update has already started. However, if the existing request is in a pending state (i.e., the retrieve date has not yet been arrived), it will replace the pending request with the new one.
- Parameters:
param – [in] A pointer to the updater_param structure containing the parameters for the update request.
downloader – [in] A pointer to the downloader to use for the update.
- Returns:
An integer indicating the status of the operation. A return value of 0 indicates success, while any other value indicates an error.
-
int updater_process(void)#
Processes the updater module.
This function processes any pending operations in the updater module.
- Returns:
An integer indicating the status of the operation. A return value of 0 indicates success, while any other value indicates an error.
-
bool updater_busy(void)#
Checks if the updater module is busy.
This function checks if the updater module is currently busy with an operation.
- Returns:
A boolean value indicating whether the updater module is busy. A return value of true indicates that the module is busy, while false indicates that it is not.
Typedefs
-
typedef void (*updater_event_callback_t)(updater_event_t event, void *ctx)#
-
typedef void (*updater_runner_t)(void *ctx)#
-
struct updater_param#
- #include <updater.h>
Enums
-
enum updater_event_t#
Values:
-
enumerator UPDATER_EVT_NONE#
-
enumerator UPDATER_EVT_ERROR_PREPARING#
-
enumerator UPDATER_EVT_START_DOWNLOADING#
-
enumerator UPDATER_EVT_DOWNLOADING#
-
enumerator UPDATER_EVT_ERROR_DOWNLOADING#
-
enumerator UPDATER_EVT_ERROR_WRITING#
-
enumerator UPDATER_EVT_ERROR_TIMEOUT#
-
enumerator UPDATER_EVT_DOWNLOADED#
-
enumerator UPDATER_EVT_START_INSTALLING#
-
enumerator UPDATER_EVT_ERROR_INSTALLING#
-
enumerator UPDATER_EVT_REBOOT_REQUIRED#
-
enumerator UPDATER_EVT_INSTALLED#
-
enumerator UPDATER_EVT_ERROR#
-
enumerator UPDATER_EVT_NONE#