b.liu | d440f9f | 2025-04-18 10:44:31 +0800 | [diff] [blame^] | 1 | /*-----------------------------------------------------------------------------------------------*/ |
| 2 | /** |
| 3 | @file ql_fwupdate.h |
| 4 | @brief |
| 5 | This file declare OTA upgrade interface |
| 6 | */ |
| 7 | /*-----------------------------------------------------------------------------------------------*/ |
| 8 | |
| 9 | /*------------------------------------------------------------------------------------------------- |
| 10 | Copyright (c) 2018 Quectel Wireless Solution, Co., Ltd. All Rights Reserved. |
| 11 | Quectel Wireless Solution Proprietary and Confidential. |
| 12 | -------------------------------------------------------------------------------------------------*/ |
| 13 | |
| 14 | /*------------------------------------------------------------------------------------------------- |
| 15 | EDIT HISTORY |
| 16 | This section contains comments describing changes made to the file. |
| 17 | Notice that changes are listed in reverse chronological order. |
| 18 | $Header: $ |
| 19 | when who what, where, why |
| 20 | -------- --- ---------------------------------------------------------- |
| 21 | 20211125 Jessie.lei Created . |
| 22 | -------------------------------------------------------------------------------------------------*/ |
| 23 | |
| 24 | |
| 25 | #ifndef QL_FOTA_API_H_ |
| 26 | #define QL_FOTA_API_H_ |
| 27 | |
| 28 | #ifdef __cplusplus |
| 29 | extern "C" { |
| 30 | #endif |
| 31 | |
| 32 | #include <stdbool.h> |
| 33 | #include <stdint.h> |
| 34 | #include <errno.h> |
| 35 | #include "fota_info.h" |
| 36 | |
| 37 | typedef enum |
| 38 | { |
| 39 | E_NO_ERROR=0, |
| 40 | E_FOTA_INIT_FAILED=1, |
| 41 | E_UPDATE_PACKAGE_NOEXIST=2, |
| 42 | E_WRITE_SEG_FAILED=3, |
| 43 | } fota_exit_code_t; |
| 44 | |
| 45 | //-------------------------------------------------------------------------------------------------- |
| 46 | /** |
| 47 | * upgrade info |
| 48 | */ |
| 49 | //-------------------------------------------------------------------------------------------------- |
| 50 | typedef struct |
| 51 | { |
| 52 | unsigned int percentage; ///< the upgrade progress |
| 53 | fota_state_t ota_state; ///< the device ota upgrade status |
| 54 | fota_exit_code_t exit_code; ///< the fota process |
| 55 | } update_info_t; |
| 56 | |
| 57 | |
| 58 | //-------------------------------------------------------------------------------------------------- |
| 59 | /** |
| 60 | * @brief |
| 61 | * This function starts ota upgrade to flash partition. |
| 62 | * @Parameter |
| 63 | * [IN] package_path, the location of quectel_AB_OTA.img. |
| 64 | * @return |
| 65 | * - On success 0 indicate the upgrad is succeed |
| 66 | * - On failure -1 indicate *package_path is invalid or failed to set fota start state. |
| 67 | * Otherwise, it returns a positve number, the exit code of update, one of |
| 68 | * the enum fota_exit_code_t. |
| 69 | */ |
| 70 | //-------------------------------------------------------------------------------------------------- |
| 71 | int ql_abfota_start_update(const char *package_path); |
| 72 | |
| 73 | |
| 74 | //-------------------------------------------------------------------------------------------------- |
| 75 | /** |
| 76 | * @brief |
| 77 | * get the upgrade progress |
| 78 | * @Parameter |
| 79 | * [InOut] upgrade_info, store the fota progress & state info |
| 80 | * @return |
| 81 | * - On success 0 |
| 82 | * - On failure -1 |
| 83 | */ |
| 84 | //-------------------------------------------------------------------------------------------------- |
| 85 | int ql_abfota_get_update_status(update_info_t * update_info); |
| 86 | |
| 87 | #ifdef __cplusplus |
| 88 | } |
| 89 | #endif |
| 90 | |
| 91 | #endif //QL_FOTA_API_H_ |