mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
docs: Update esp_https_ota docs to have information about OTA events
This commit is contained in:
parent
25eb1f0c6e
commit
83896d877a
@ -22,17 +22,6 @@ 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, /*!< OTA started */
|
||||
|
@ -68,6 +68,67 @@ To perform OTA upgrades with Pre-Encrypted Firmware, please enable :ref:`CONFIG_
|
||||
|
||||
Example that performs OTA upgrade with Pre-Encrypted Firmware: :example:`system/ota/pre_encrypted_ota`.
|
||||
|
||||
OTA System Events
|
||||
-----------------
|
||||
|
||||
ESP HTTPS OTA has various events for which a handler can be triggered by :doc:`the Event Loop library <../system/esp_event>` when the particular event occurs. The handler has to be registered using :cpp:func:`esp_event_handler_register`. This helps in event handling for ESP HTTPS OTA.
|
||||
:cpp:enum:`esp_https_ota_event_t` has all the events which can happen when performing OTA upgrade using ESP HTTPS OTA.
|
||||
|
||||
Event Handler Example
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. highlight:: c
|
||||
|
||||
::
|
||||
|
||||
/* Event handler for catching system events */
|
||||
static void event_handler(void* arg, esp_event_base_t event_base,
|
||||
int32_t event_id, void* event_data)
|
||||
{
|
||||
if (event_base == ESP_HTTPS_OTA_EVENT) {
|
||||
switch (event_id) {
|
||||
case ESP_HTTPS_OTA_START:
|
||||
ESP_LOGI(TAG, "OTA started");
|
||||
break;
|
||||
case ESP_HTTPS_OTA_CONNECTED:
|
||||
ESP_LOGI(TAG, "Connected to server");
|
||||
break;
|
||||
case ESP_HTTPS_OTA_GET_IMG_DESC:
|
||||
ESP_LOGI(TAG, "Reading Image Description");
|
||||
break;
|
||||
case ESP_HTTPS_OTA_VERIFY_CHIP_ID:
|
||||
ESP_LOGI(TAG, "Verifying chip id of new image: %d", *(esp_chip_id_t *)event_data);
|
||||
break;
|
||||
case ESP_HTTPS_OTA_DECRYPT_CB:
|
||||
ESP_LOGI(TAG, "Callback to decrypt function");
|
||||
break;
|
||||
case ESP_HTTPS_OTA_WRITE_FLASH:
|
||||
ESP_LOGD(TAG, "Writing to flash: %d written", *(int *)event_data);
|
||||
break;
|
||||
case ESP_HTTPS_OTA_UPDATE_BOOT_PARTITION:
|
||||
ESP_LOGI(TAG, "Boot partition updated. Next Partition: %d", *(esp_partition_subtype_t *)event_data);
|
||||
break;
|
||||
case ESP_HTTPS_OTA_FINISH:
|
||||
ESP_LOGI(TAG, "OTA finish");
|
||||
break;
|
||||
case ESP_HTTPS_OTA_ABORT:
|
||||
ESP_LOGI(TAG, "OTA abort");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Expected data type for different ESP HTTPS OTA events in the system event loop:
|
||||
- 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``
|
||||
|
||||
API Reference
|
||||
-------------
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user