/* * Copyright (C) 2014 -2019 Netease * */ #ifndef ESP_MSG_CTRL_H #define ESP_MSG_CTRL_H #define MSG_CONTROL_CMD_QUEUE_SIZE 5 #define MSG_CONTROL_CMD_DELAY 2 #define MSG_CONTROL_CMD_OTA_INFO 1 #define MSG_CONTROL_CMD_OTA_START 2 #define MSG_CONTROL_CMD_OTA_SEGDOWNLOAD 3 #define MSG_CONTROL_CMD_OTA_SEGREAD 4 #define MSG_CONTROL_CMD_OTA_QUIT 5 #define MSG_CONTROL_CMD_BIGDATA_SEQ 6 #define MSG_CONTROL_RESULT_SUCCESS 0 #define MSG_CONTROL_RESULT_FAILED 1 #define MSG_MAX_MD5_LEN 32 struct cmd_struct { uint32 cmd; void *param; }; struct OTA_Info_Report { uint32_t bin_size; uint32_t seg_size; uint8_t segment; uint8_t type; char md5[MSG_MAX_MD5_LEN]; uint32_t version; }; struct OTA_Start_Cmd { uint8_t type; }; struct OTA_Start_Rsp { uint8_t type; uint8_t result; }; struct OTA_SegDownload_Cmd { uint8_t seg_num; uint32_t seg_size; }; struct OTA_SegDownload_Rsp { uint8_t result; uint32_t seg_size; }; struct OTA_SegRead_Cmd { uint32_t offset; uint32_t length; }; struct OTA_SegRead_Rsp { uint8_t result; uint8_t *read_buffer; uint32_t read_len; }; struct OTA_Quit_Cmd { uint8_t dummy; }; struct OTA_Quit_Rsp { uint8_t result; }; struct BIGDATA_DataSeq_Cmd { uint8_t dummy; }; struct BIGDATA_DataSeq_Rsp { uint8_t result; }; uint32_t MSG_ctrl_cmd_put(uint32_t cmd, void *param); uint32_t MSG_ctrl_cmd_get(uint32_t *cmd, void **param); uint32_t MSG_ctrl_cmd_process(void *pclient); uint32_t MSG_ctrl_cmd_initial(void); uint32_t MSG_ctrl_rsp_OTAInfo(uint8_t type, void *pArgs); uint32_t MSG_ctrl_rsp_start(uint8_t type, uint8_t result); uint32_t MSG_ctrl_rsp_download(uint8_t type, uint8_t result, uint32_t seg_size); uint32_t MSG_ctrl_rsp_read(uint8_t type, uint8_t result, uint8_t *data, uint32_t len); uint32_t MSG_ctrl_rsp_quit(uint8_t type, uint8_t result); uint32_t MSG_ctrl_rsp_DataSeq(uint8_t result); #endif