|
idfxx 1.0.0
Modern C++23 components for ESP-IDF
|
Classes | |
| class | app_description |
| Application description from a firmware image. More... | |
| class | error_category |
| Error category for OTA errors. More... | |
| struct | sequential_erase_tag |
| Tag type for sequential (incremental) flash erase mode. More... | |
| class | update |
| RAII OTA update session. More... | |
Enumerations | |
| enum class | errc : esp_err_t { partition_conflict = 0x1501 , select_info_invalid = 0x1502 , validate_failed = 0x1503 , small_sec_ver = 0x1504 , rollback_failed = 0x1505 , rollback_invalid_state = 0x1506 } |
| Error codes for OTA operations. More... | |
| enum class | image_state : uint32_t { new_image = 0x0U , pending_verify = 0x1U , valid = 0x2U , invalid = 0x3U , aborted = 0x4U , undefined = 0xFFFFFFFFU } |
| OTA image state. More... | |
Functions | |
| void | set_boot_partition (const partition &part) |
| Sets the boot partition for the next reboot. | |
| partition | boot_partition () |
| Returns the currently configured boot partition. | |
| partition | running_partition () |
| Returns the partition of the currently running application. | |
| partition | next_update_partition (const partition *start_from=nullptr) |
| Returns the next OTA app partition to write an update to. | |
| result< void > | try_set_boot_partition (const partition &part) |
| Sets the boot partition for the next reboot. | |
| result< partition > | try_boot_partition () |
| Returns the currently configured boot partition. | |
| result< partition > | try_running_partition () |
| Returns the partition of the currently running application. | |
| result< partition > | try_next_update_partition (const partition *start_from=nullptr) |
| Returns the next OTA app partition to write an update to. | |
| app_description | partition_description (const partition &part) |
| Returns the application description from a partition. | |
| result< app_description > | try_partition_description (const partition &part) |
| Returns the application description from a partition. | |
| void | mark_valid () |
| Marks the running app as valid, cancelling any pending rollback. | |
| void | mark_invalid_and_rollback () |
| Marks the running app as invalid and triggers a rollback with reboot. | |
| image_state | partition_state (const partition &part) |
| Returns the OTA image state for a partition. | |
| result< void > | try_mark_valid () |
| Marks the running app as valid, cancelling any pending rollback. | |
| result< void > | try_mark_invalid_and_rollback () |
| Marks the running app as invalid and triggers a rollback with reboot. | |
| result< image_state > | try_partition_state (const partition &part) |
| Returns the OTA image state for a partition. | |
| bool | rollback_possible () |
| Checks whether a rollback to a previous firmware is possible. | |
| partition | last_invalid_partition () |
| Returns the last partition with invalid state. | |
| result< partition > | try_last_invalid_partition () |
| Returns the last partition with invalid state. | |
| void | erase_last_boot_app_partition () |
| Erases the previous boot application partition and its OTA data. | |
| void | invalidate_inactive_ota_data_slot () |
| Invalidates the OTA data slot for the last boot application partition. | |
| result< void > | try_erase_last_boot_app_partition () |
| Erases the previous boot application partition and its OTA data. | |
| result< void > | try_invalidate_inactive_ota_data_slot () |
| Invalidates the OTA data slot for the last boot application partition. | |
| size_t | app_partition_count () |
| Returns the number of OTA app partitions in the partition table. | |
| const error_category & | ota_category () noexcept |
| Returns a reference to the OTA error category singleton. | |
| std::error_code | make_error_code (errc e) noexcept |
| Creates an error code from an idfxx::ota::errc value. | |
| std::unexpected< std::error_code > | ota_error (esp_err_t e) |
| Creates an unexpected error from an ESP-IDF error code, mapping to OTA error codes where possible. | |
Variables | |
| constexpr sequential_erase_tag | sequential_erase {} |
| Tag value for sequential (incremental) flash erase mode. | |
|
strong |
Error codes for OTA operations.
|
strong |
OTA image state.
Describes the lifecycle state of a firmware image in the OTA data partition.
| size_t idfxx::ota::app_partition_count | ( | ) |
Returns the number of OTA app partitions in the partition table.
| partition idfxx::ota::boot_partition | ( | ) |
Returns the currently configured boot partition.
| std::system_error | with idfxx::errc::not_found if not available. |
| void idfxx::ota::erase_last_boot_app_partition | ( | ) |
Erases the previous boot application partition and its OTA data.
Call after the current app has been marked valid.
| std::system_error | on failure. |
| void idfxx::ota::invalidate_inactive_ota_data_slot | ( | ) |
Invalidates the OTA data slot for the last boot application partition.
Erases the OTA data slot without erasing the partition contents.
| std::system_error | on failure. |
| partition idfxx::ota::last_invalid_partition | ( | ) |
Returns the last partition with invalid state.
Returns the last partition with state image_state::invalid or image_state::aborted.
| std::system_error | with idfxx::errc::not_found if no invalid partition exists. |
|
inlinenoexcept |
Creates an error code from an idfxx::ota::errc value.
Definition at line 791 of file ota.hpp.
References ota_category().
| void idfxx::ota::mark_invalid_and_rollback | ( | ) |
Marks the running app as invalid and triggers a rollback with reboot.
On success this function reboots the device and does not return.
| std::system_error | on failure. |
| void idfxx::ota::mark_valid | ( | ) |
Marks the running app as valid, cancelling any pending rollback.
| std::system_error | on failure. |
Returns the next OTA app partition to write an update to.
Finds the next partition round-robin, starting from the current running partition.
| start_from | If not null, use this partition as the starting point instead of the running partition. |
| std::system_error | with idfxx::errc::not_found if no eligible partition exists. |
|
noexcept |
Returns a reference to the OTA error category singleton.
Referenced by make_error_code().
| std::unexpected< std::error_code > idfxx::ota::ota_error | ( | esp_err_t | e | ) |
Creates an unexpected error from an ESP-IDF error code, mapping to OTA error codes where possible.
Converts the ESP-IDF error code to an OTA-specific error code if a mapping exists, otherwise falls back to the default IDFXX error category.
| e | The ESP-IDF error code. |
| app_description idfxx::ota::partition_description | ( | const partition & | part | ) |
Returns the application description from a partition.
| part | An application partition to read from. |
| std::system_error | on failure. |
| image_state idfxx::ota::partition_state | ( | const partition & | part | ) |
Returns the OTA image state for a partition.
| part | The partition to query. |
| std::system_error | on failure. |
| bool idfxx::ota::rollback_possible | ( | ) |
Checks whether a rollback to a previous firmware is possible.
| partition idfxx::ota::running_partition | ( | ) |
Returns the partition of the currently running application.
| std::system_error | with idfxx::errc::not_found if not available. |
Sets the boot partition for the next reboot.
| part | Partition containing the app image to boot. |
| std::system_error | on failure. |
Returns the currently configured boot partition.
| idfxx::errc::not_found | if the partition table is invalid or a flash read failed. |
Erases the previous boot application partition and its OTA data.
Call after the current app has been marked valid.
Invalidates the OTA data slot for the last boot application partition.
Erases the OTA data slot without erasing the partition contents.
Returns the last partition with invalid state.
Returns the last partition with state image_state::invalid or image_state::aborted.
| idfxx::errc::not_found | if no invalid partition exists. |
Marks the running app as invalid and triggers a rollback with reboot.
On success this function reboots the device and does not return.
| ota::errc::rollback_failed | if no valid firmware exists for rollback. |
Marks the running app as valid, cancelling any pending rollback.
Returns the next OTA app partition to write an update to.
Finds the next partition round-robin, starting from the current running partition.
| start_from | If not null, use this partition as the starting point instead of the running partition. |
| idfxx::errc::not_found | if no eligible partition exists. |
| result< app_description > idfxx::ota::try_partition_description | ( | const partition & | part | ) |
Returns the application description from a partition.
| part | An application partition to read from. |
| idfxx::errc::not_found | if the partition does not contain a valid app descriptor. |
| result< image_state > idfxx::ota::try_partition_state | ( | const partition & | part | ) |
Returns the OTA image state for a partition.
| part | The partition to query. |
Returns the partition of the currently running application.
| idfxx::errc::not_found | if no partition is found or a flash read failed. |
Sets the boot partition for the next reboot.
| part | Partition containing the app image to boot. |
| ota::errc::validate_failed | if the partition contains an invalid app image. |
|
inlineconstexpr |
Tag value for sequential (incremental) flash erase mode.