41 #define OTA_LIB_VERSION "OTA_LIB_2.0.0.7" 44 #define MAX_CONSECUTIVE_OTA_ERRORS 5 48 #define MAX_URL_SIZE 512 49 #define NET_BUF_SIZE 1440 52 #define OTA_BLOCK_SIZE 7800 56 uint8_t Buff[OTA_BLOCK_SIZE];
64 typedef void (*OTA_eventHandler) (
void *);
66 #define MAX_SERVER_NAME 64 67 #define MAX_VENDOR_TOKEN_SIZE 96 68 #define VERSION_STR_SIZE 14 76 uint32_t SecuredConnection;
77 uint8_t ServerName[MAX_SERVER_NAME];
78 uint8_t VendorToken[MAX_VENDOR_TOKEN_SIZE];
83 uint8_t CurrentVersion[VERSION_STR_SIZE+1];
84 uint8_t NewVersion[VERSION_STR_SIZE+1];
92 EXTLIB_OTA_SET_OPT_SERVER_INFO = 0,
93 EXTLIB_OTA_SET_OPT_FILE_SERVER_URL,
94 EXTLIB_OTA_SET_OPT_VENDOR_ID,
95 EXTLIB_OTA_SET_OPT_ACCEPT_UPDATE,
96 EXTLIB_OTA_SET_OPT_DECLINE_UPDATE,
97 EXTLIB_OTA_SET_OPT_IMAGE_COMMIT,
98 EXTLIB_OTA_SET_OPT_IMAGE_ROLLBACK,
99 EXTLIB_OTA_GET_OPT_IS_ACTIVE,
100 EXTLIB_OTA_GET_OPT_VERSIONS,
101 EXTLIB_OTA_GET_OPT_IS_PENDING_COMMIT
108 #define OTA_RUN_STATUS_DOWNLOAD_DONE (104L) 109 #define OTA_RUN_STATUS_CHECK_OLDER_VERSION (103L) 110 #define OTA_RUN_STATUS_CHECK_NEWER_VERSION (102L) 111 #define OTA_RUN_STATUS_NO_UPDATES (101L) 112 #define OTA_RUN_STATUS_OK (0L) 114 #define OTA_RUN_STATUS_CONTINUE (+20001L) 115 #define OTA_RUN_STATUS_CONTINUE_WARNING_FAILED_CONNECT_OTA_SERVER (+20002L) 116 #define OTA_RUN_STATUS_CONTINUE_WARNING_FAILED_RECV_APPEND (+20003L) 117 #define OTA_RUN_STATUS_CONTINUE_WARNING_FAILED_REQ_OTA_DIR (+20004L) 118 #define OTA_RUN_STATUS_CONTINUE_WARNING_FAILED_REQ_FILE_URL (+20005L) 119 #define OTA_RUN_STATUS_CONTINUE_WARNING_FAILED_CONNECT_FILE_SERVER (+20006L) 120 #define OTA_RUN_STATUS_CONTINUE_WARNING_FAILED_REQ_FILE_CONTENT (+20007L) 121 #define OTA_RUN_STATUS_CONTINUE_WARNING_FAILED_FILE_HDR (+20008L) 122 #define OTA_RUN_STATUS_CONTINUE_WARNING_FAILED_DOWNLOAD_AND_SAVE (+20009L) 124 #define OTA_RUN_ERROR_NO_SERVER_NO_VENDOR (-21001L) 125 #define OTA_RUN_ERROR_UNEXPECTED_STATE (-21002L) 126 #define OTA_RUN_ERROR_CONSECUTIVE_OTA_ERRORS (-21003L) 127 #define OTA_RUN_ERROR_SECURITY_ALERT (-21004L) 130 #define OTA_STATUS_OK (0L) 131 #define OTA_OPT_ERROR_WRONG_STATE (-20601L) 132 #define OTA_OPT_ERROR_COMMIT (-20602L) 133 #define OTA_OPT_ERROR_ROLLBACK (-20603L) 134 #define OTA_OPT_ERROR_OPTION_CODE (-20604L) 135 #define OTA_OPT_ERROR_VENDOR_DIR_SIZE (-20605L) 136 #define OTA_INIT_ERROR (-20701L) 175 int16_t
OTA_init(OTA_runningMode runningMode,
OTA_memBlock* pMemBlock, OTA_eventHandler eventHandler);
260 int16_t
OTA_set(OTA_option option, int32_t optionLen, uint8_t *pOptionVal, int32_t flags);
298 int16_t
OTA_get(OTA_option option, int32_t *pOptionLen, uint8_t *pOptionVal);
int16_t OTA_set(OTA_option option, int32_t optionLen, uint8_t *pOptionVal, int32_t flags)
Set OTA command/parameter.
int16_t OTA_get(OTA_option option, int32_t *pOptionLen, uint8_t *pOptionVal)
Get the current OTA status.
int16_t OTA_run()
Run the OTA App state machine.
int16_t OTA_init(OTA_runningMode runningMode, OTA_memBlock *pMemBlock, OTA_eventHandler eventHandler)
Initialize the OTA application.