Chapter 2. API Reference
This function closes the HTTP connection and frees the ESP HTTPS OTA context. This function switches the
boot partition to the OTA partition containing the new firmware image.
Note If this API returns successfully, esp_restart() must be called to boot from the new firmware image
esp_https_ota_finish should not be called after calling esp_https_ota_abort
Return
• ESP_OK: Clean-up successful
• ESP_ERR_INVALID_STATE
• ESP_ERR_INVALID_ARG: Invalid argument
• ESP_ERR_OTA_VALIDATE_FAILED: Invalid app image
Parameters
• [in] https_ota_handle: pointer to esp_https_ota_handle_t structure
esp_err_t esp_https_ota_abort(esp_https_ota_handle_t https_ota_handle)
Clean-up HTTPS OTA Firmware upgrade and close HTTPS connection.
This function closes the HTTP connection and frees the ESP HTTPS OTA context.
Note esp_https_ota_abort should not be called after calling esp_https_ota_finish
Return
• ESP_OK: Clean-up successful
• ESP_ERR_INVALID_STATE: Invalid ESP HTTPS OTA state
• ESP_FAIL: OTA not started
• ESP_ERR_NOT_FOUND: OTA handle not found
• ESP_ERR_INVALID_ARG: Invalid argument
Parameters
• [in] https_ota_handle: pointer to esp_https_ota_handle_t structure
esp_err_t esp_https_ota_get_img_desc(esp_https_ota_handle_t https_ota_handle, esp_app_desc_t
*new_app_info)
Reads app description from image header. The app description provides information like the “Firmware
version”of the image.
Note This API can be called only after esp_https_ota_begin() and before esp_https_ota_perform(). Calling
this API is not mandatory.
Return
• ESP_ERR_INVALID_ARG: Invalid arguments
• ESP_FAIL: Failed to read image descriptor
• ESP_OK: Successfully read image descriptor
Parameters
• [in] https_ota_handle: pointer to esp_https_ota_handle_t structure
• [out] new_app_info: pointer to an allocated esp_app_desc_t structure
int esp_https_ota_get_image_len_read(esp_https_ota_handle_t https_ota_handle)
This function returns OTA image data read so far.
Note This API should be called only if esp_https_ota_perform() has been called atleast once or if
esp_https_ota_get_img_desc has been called before.
Return
• -1 On failure
• total bytes read so far
Parameters
• [in] https_ota_handle: pointer to esp_https_ota_handle_t structure
int esp_https_ota_get_image_size(esp_https_ota_handle_t https_ota_handle)
This function returns OTA image total size.
Note This API should be called after esp_https_ota_begin() has been already called. This can be used to
create some sort of progress indication (in combination with esp_https_ota_get_image_len_read())
Return
• -1 On failure or chunked encoding
• total bytes of image
Parameters
Espressif Systems 829
Submit Document Feedback
Release v4.4