esp_https_ota.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright 2017-2018 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. // http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. // Unless required by applicable law or agreed to in writing, software
  9. // distributed under the License is distributed on an "AS IS" BASIS,
  10. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. // See the License for the specific language governing permissions and
  12. // limitations under the License.
  13. #pragma once
  14. #include <esp_http_client.h>
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. /**
  19. * @brief HTTPS OTA Firmware upgrade.
  20. *
  21. * This function performs HTTPS OTA Firmware upgrade
  22. *
  23. * @param[in] config pointer to esp_http_client_config_t structure.
  24. *
  25. * @note For secure HTTPS updates, the `cert_pem` member of `config`
  26. * structure must be set to the server certificate.
  27. *
  28. * @return
  29. * - ESP_OK: OTA data updated, next reboot will use specified partition.
  30. * - ESP_FAIL: For generic failure.
  31. * - ESP_ERR_OTA_VALIDATE_FAILED: Invalid app image
  32. * - ESP_ERR_NO_MEM: Cannot allocate memory for OTA operation.
  33. * - ESP_ERR_FLASH_OP_TIMEOUT or ESP_ERR_FLASH_OP_FAIL: Flash write failed.
  34. * - For other return codes, refer OTA documentation in esp-idf's app_update component.
  35. */
  36. esp_err_t esp_https_ota(const esp_http_client_config_t *config);
  37. #ifdef __cplusplus
  38. }
  39. #endif