| /*-----------------------------------------------------------------------------------------------*/ |
| /** |
| @file ql_fwupdate.h |
| @brief |
| This file declare OTA upgrade interface |
| */ |
| /*-----------------------------------------------------------------------------------------------*/ |
| |
| /*------------------------------------------------------------------------------------------------- |
| Copyright (c) 2018 Quectel Wireless Solution, Co., Ltd. All Rights Reserved. |
| Quectel Wireless Solution Proprietary and Confidential. |
| -------------------------------------------------------------------------------------------------*/ |
| |
| /*------------------------------------------------------------------------------------------------- |
| EDIT HISTORY |
| This section contains comments describing changes made to the file. |
| Notice that changes are listed in reverse chronological order. |
| $Header: $ |
| when who what, where, why |
| -------- --- ---------------------------------------------------------- |
| 20211125 Jessie.lei Created . |
| -------------------------------------------------------------------------------------------------*/ |
| |
| |
| #ifndef QL_FOTA_API_H_ |
| #define QL_FOTA_API_H_ |
| |
| #ifdef __cplusplus |
| extern "C" { |
| #endif |
| |
| #include <stdbool.h> |
| #include <stdint.h> |
| #include <errno.h> |
| #include "fota_info.h" |
| |
| typedef enum |
| { |
| E_NO_ERROR=0, |
| E_FOTA_INIT_FAILED=1, |
| E_UPDATE_PACKAGE_NOEXIST=2, |
| E_WRITE_SEG_FAILED=3, |
| } fota_exit_code_t; |
| |
| //-------------------------------------------------------------------------------------------------- |
| /** |
| * upgrade info |
| */ |
| //-------------------------------------------------------------------------------------------------- |
| typedef struct |
| { |
| unsigned int percentage; ///< the upgrade progress |
| fota_state_t ota_state; ///< the device ota upgrade status |
| fota_exit_code_t exit_code; ///< the fota process |
| } update_info_t; |
| |
| |
| //-------------------------------------------------------------------------------------------------- |
| /** |
| * @brief |
| * This function starts ota upgrade to flash partition. |
| * @Parameter |
| * [IN] package_path, the location of quectel_AB_OTA.img. |
| * @return |
| * - On success 0 indicate the upgrad is succeed |
| * - On failure -1 indicate *package_path is invalid or failed to set fota start state. |
| * Otherwise, it returns a positve number, the exit code of update, one of |
| * the enum fota_exit_code_t. |
| */ |
| //-------------------------------------------------------------------------------------------------- |
| int ql_abfota_start_update(const char *package_path); |
| |
| |
| //-------------------------------------------------------------------------------------------------- |
| /** |
| * @brief |
| * get the upgrade progress |
| * @Parameter |
| * [InOut] upgrade_info, store the fota progress & state info |
| * @return |
| * - On success 0 |
| * - On failure -1 |
| */ |
| //-------------------------------------------------------------------------------------------------- |
| int ql_abfota_get_update_status(update_info_t * update_info); |
| |
| #ifdef __cplusplus |
| } |
| #endif |
| |
| #endif //QL_FOTA_API_H_ |