esp_https_ota: Send data to event handler

This commit is contained in:
Harshit Malpani
2022-11-02 14:48:43 +05:30
parent 784089bf09
commit a80dfe85bc
3 changed files with 57 additions and 41 deletions

View File

@@ -10,28 +10,43 @@
#include <bootloader_common.h>
#include "esp_app_desc.h"
#include <sdkconfig.h>
#include "esp_event.h"
#include "esp_partition.h"
#ifdef __cplusplus
extern "C" {
#endif
ESP_EVENT_DECLARE_BASE(ESP_HTTPS_OTA_EVENT);
/**
* @brief Events generated by OTA process
*
* @note Expected data type for different OTA events:
* - ESP_HTTPS_OTA_START : NULL
* - ESP_HTTPS_OTA_CONNECTED : NULL
* - ESP_HTTPS_OTA_GET_IMG_DESC : NULL
* - ESP_HTTPS_OTA_VERIFY_CHIP_ID : esp_chip_id_t
* - ESP_HTTPS_OTA_DECRYPT_CB : NULL
* - ESP_HTTPS_OTA_WRITE_FLASH : int
* - ESP_HTTPS_OTA_UPDATE_BOOT_PARTITION : esp_partition_subtype_t
* - ESP_HTTPS_OTA_FINISH : NULL
* - ESP_HTTPS_OTA_ABORT : NULL
*/
typedef enum {
ESP_HTTPS_OTA_START,
ESP_HTTPS_OTA_CONNECTED,
ESP_HTTPS_OTA_GET_IMG_DESC,
ESP_HTTPS_OTA_VERIFY_CHIP_ID,
ESP_HTTPS_OTA_DECRYPT_CB,
ESP_HTTPS_OTA_WRITE_FLASH,
ESP_HTTPS_OTA_UPDATE_BOOT_PARTITION,
ESP_HTTPS_OTA_FINISH,
ESP_HTTPS_OTA_ABORT,
ESP_HTTPS_OTA_START, /*!< OTA started */
ESP_HTTPS_OTA_CONNECTED, /*!< Connected to server */
ESP_HTTPS_OTA_GET_IMG_DESC, /*!< Read app description from image header */
ESP_HTTPS_OTA_VERIFY_CHIP_ID, /*!< Verify chip id of new image */
ESP_HTTPS_OTA_DECRYPT_CB, /*!< Callback to decrypt function */
ESP_HTTPS_OTA_WRITE_FLASH, /*!< Flash write operation */
ESP_HTTPS_OTA_UPDATE_BOOT_PARTITION, /*!< Boot partition update after successful ota update */
ESP_HTTPS_OTA_FINISH, /*!< OTA finished */
ESP_HTTPS_OTA_ABORT, /*!< OTA aborted */
} esp_https_ota_event_t;
typedef void *esp_https_ota_handle_t;
typedef esp_err_t(*http_client_init_cb_t)(esp_http_client_handle_t);