|
idfxx 1.0.0
Modern C++23 components for ESP-IDF
|
RAII OTA update session. More...
Public Member Functions | |
| update (const partition &part) | |
| Begins an OTA update, erasing the entire partition. | |
| update (const partition &part, size_t image_size) | |
| Begins an OTA update, erasing space for the specified image size. | |
| update (const partition &part, sequential_erase_tag) | |
| Begins an OTA update with sequential (incremental) flash erase. | |
| ~update () | |
| update (const update &)=delete | |
| update & | operator= (const update &)=delete |
| update (update &&other) noexcept | |
| Move constructor. | |
| update & | operator= (update &&other) noexcept |
| Move assignment. | |
| void | set_final_partition (const partition &final_part, bool copy=true) |
| Redirects the validated image to a different final partition. | |
| result< void > | try_set_final_partition (const partition &final_part, bool copy=true) |
| Redirects the validated image to a different final partition. | |
| void | write (const void *data, size_t size) |
| Writes data sequentially to the OTA partition. | |
| void | write (std::span< const uint8_t > data) |
| Writes data sequentially to the OTA partition. | |
| void | write_with_offset (uint32_t offset, const void *data, size_t size) |
| Writes data at a specific offset in the OTA partition. | |
| void | write_with_offset (uint32_t offset, std::span< const uint8_t > data) |
| Writes data at a specific offset in the OTA partition. | |
| result< void > | try_write (const void *data, size_t size) |
| Writes data sequentially to the OTA partition. | |
| result< void > | try_write (std::span< const uint8_t > data) |
| Writes data sequentially to the OTA partition. | |
| result< void > | try_write_with_offset (uint32_t offset, const void *data, size_t size) |
| Writes data at a specific offset in the OTA partition. | |
| result< void > | try_write_with_offset (uint32_t offset, std::span< const uint8_t > data) |
| Writes data at a specific offset in the OTA partition. | |
| void | end () |
| Finalizes the OTA update and validates the written image. | |
| void | abort () |
| Aborts the OTA update and frees associated resources. | |
| result< void > | try_end () |
| Finalizes the OTA update and validates the written image. | |
| result< void > | try_abort () |
| Aborts the OTA update and frees associated resources. | |
Static Public Member Functions | |
| static update | resume (const partition &part, size_t offset) |
| Resumes an interrupted OTA update, erasing all remaining flash. | |
| static update | resume (const partition &part, size_t offset, size_t erase_size) |
| Resumes an interrupted OTA update, erasing the specified amount of flash. | |
| static update | resume (const partition &part, size_t offset, sequential_erase_tag) |
| Resumes an interrupted OTA update with sequential (incremental) flash erase. | |
| static result< update > | make (const partition &part) |
| Begins an OTA update, erasing the entire partition. | |
| static result< update > | make (const partition &part, size_t image_size) |
| Begins an OTA update, erasing space for the specified image size. | |
| static result< update > | make (const partition &part, sequential_erase_tag) |
| Begins an OTA update with sequential (incremental) flash erase. | |
| static result< update > | try_resume (const partition &part, size_t offset) |
| Resumes an interrupted OTA update, erasing all remaining flash. | |
| static result< update > | try_resume (const partition &part, size_t offset, size_t erase_size) |
| Resumes an interrupted OTA update, erasing the specified amount of flash. | |
| static result< update > | try_resume (const partition &part, size_t offset, sequential_erase_tag) |
| Resumes an interrupted OTA update with sequential (incremental) flash erase. | |
RAII OTA update session.
Manages an OTA update operation, including writing firmware data and finalizing the update. The destructor aborts the update if end() has not been called. This type is non-copyable and move-only. A moved-from object must not be used: any operation other than destruction or assignment is undefined behavior.
|
explicit |
Begins an OTA update, erasing the entire partition.
| part | Target partition for the update. |
| std::system_error | on failure. |
|
explicit |
Begins an OTA update, erasing space for the specified image size.
| part | Target partition for the update. |
| image_size | Expected image size in bytes. |
| std::system_error | on failure. |
|
explicit |
Begins an OTA update with sequential (incremental) flash erase.
Flash is erased incrementally as data is written, rather than all at once.
| part | Target partition for the update. |
| std::system_error | on failure. |
| idfxx::ota::update::~update | ( | ) |
|
delete |
|
noexcept |
Move constructor.
Transfers session ownership.
| void idfxx::ota::update::abort | ( | ) |
Aborts the OTA update and frees associated resources.
| std::system_error | on failure. |
| void idfxx::ota::update::end | ( | ) |
Finalizes the OTA update and validates the written image.
After calling end(), the handle is invalidated and the session is complete.
| std::system_error | on failure. |
Begins an OTA update, erasing the entire partition.
| part | Target partition for the update. |
| ota::errc::partition_conflict | if the partition is the currently running partition. |
| ota::errc::rollback_invalid_state | if the running app has not confirmed state. |
|
static |
Begins an OTA update with sequential (incremental) flash erase.
Flash is erased incrementally as data is written, rather than all at once.
| part | Target partition for the update. |
| ota::errc::partition_conflict | if the partition is the currently running partition. |
| ota::errc::rollback_invalid_state | if the running app has not confirmed state. |
|
static |
Begins an OTA update, erasing space for the specified image size.
| part | Target partition for the update. |
| image_size | Expected image size in bytes. |
| idfxx::errc::invalid_arg | if image_size is a reserved sentinel value. |
| ota::errc::partition_conflict | if the partition is the currently running partition. |
| ota::errc::rollback_invalid_state | if the running app has not confirmed state. |
Move assignment.
Aborts any active session before transferring.
Resumes an interrupted OTA update, erasing all remaining flash.
Continues writing to the partition from the specified offset without re-erasing already-written data.
| part | Target partition for the update. |
| offset | Byte offset from which to resume writing. |
| std::system_error | on failure. |
|
static |
Resumes an interrupted OTA update with sequential (incremental) flash erase.
Continues writing to the partition from the specified offset without re-erasing already-written data. Flash is erased incrementally as data is written.
| part | Target partition for the update. |
| offset | Byte offset from which to resume writing. |
| std::system_error | on failure. |
|
static |
Resumes an interrupted OTA update, erasing the specified amount of flash.
Continues writing to the partition from the specified offset without re-erasing already-written data.
| part | Target partition for the update. |
| offset | Byte offset from which to resume writing. |
| erase_size | Amount of flash to erase ahead in bytes. |
| std::system_error | on failure. |
| void idfxx::ota::update::set_final_partition | ( | const partition & | final_part, |
| bool | copy = true |
||
| ) |
Redirects the validated image to a different final partition.
Must be called before the first write(). If copy is true, end() will automatically copy the staging partition to the final partition.
| final_part | The final destination partition. |
| copy | If true, end() copies staging to final automatically. |
| std::system_error | on failure. |
| result< void > idfxx::ota::update::try_abort | ( | ) |
Aborts the OTA update and frees associated resources.
| result< void > idfxx::ota::update::try_end | ( | ) |
Finalizes the OTA update and validates the written image.
After calling try_end(), the handle is invalidated and the session is complete.
| ota::errc::validate_failed | if the image is invalid. |
|
static |
Resumes an interrupted OTA update, erasing all remaining flash.
Continues writing to the partition from the specified offset without re-erasing already-written data.
| part | Target partition for the update. |
| offset | Byte offset from which to resume writing. |
| ota::errc::partition_conflict | if the partition is the currently running partition. |
|
static |
Resumes an interrupted OTA update with sequential (incremental) flash erase.
Continues writing to the partition from the specified offset without re-erasing already-written data. Flash is erased incrementally as data is written.
| part | Target partition for the update. |
| offset | Byte offset from which to resume writing. |
| ota::errc::partition_conflict | if the partition is the currently running partition. |
|
static |
Resumes an interrupted OTA update, erasing the specified amount of flash.
Continues writing to the partition from the specified offset without re-erasing already-written data.
| part | Target partition for the update. |
| offset | Byte offset from which to resume writing. |
| erase_size | Amount of flash to erase ahead in bytes. |
| idfxx::errc::invalid_arg | if erase_size is a reserved sentinel value. |
| ota::errc::partition_conflict | if the partition is the currently running partition. |
| result< void > idfxx::ota::update::try_set_final_partition | ( | const partition & | final_part, |
| bool | copy = true |
||
| ) |
Redirects the validated image to a different final partition.
Must be called before the first write(). If copy is true, end() will automatically copy the staging partition to the final partition.
| final_part | The final destination partition. |
| copy | If true, end() copies staging to final automatically. |
| result< void > idfxx::ota::update::try_write | ( | const void * | data, |
| size_t | size | ||
| ) |
Writes data sequentially to the OTA partition.
| data | Pointer to the data buffer. |
| size | Number of bytes to write. |
| ota::errc::validate_failed | if the first byte contains an invalid image magic byte. |
| result< void > idfxx::ota::update::try_write | ( | std::span< const uint8_t > | data | ) |
Writes data sequentially to the OTA partition.
| data | Data to write. |
| ota::errc::validate_failed | if the first byte contains an invalid image magic byte. |
| result< void > idfxx::ota::update::try_write_with_offset | ( | uint32_t | offset, |
| const void * | data, | ||
| size_t | size | ||
| ) |
Writes data at a specific offset in the OTA partition.
Supports non-contiguous writes. If flash encryption is enabled, data should be 16-byte aligned.
| offset | Offset within the partition. |
| data | Pointer to the data buffer. |
| size | Number of bytes to write. |
| result< void > idfxx::ota::update::try_write_with_offset | ( | uint32_t | offset, |
| std::span< const uint8_t > | data | ||
| ) |
Writes data at a specific offset in the OTA partition.
Supports non-contiguous writes. If flash encryption is enabled, data should be 16-byte aligned.
| offset | Offset within the partition. |
| data | Data to write. |
| void idfxx::ota::update::write | ( | const void * | data, |
| size_t | size | ||
| ) |
Writes data sequentially to the OTA partition.
| data | Pointer to the data buffer. |
| size | Number of bytes to write. |
| std::system_error | on failure. |
| void idfxx::ota::update::write | ( | std::span< const uint8_t > | data | ) |
Writes data sequentially to the OTA partition.
| data | Data to write. |
| std::system_error | on failure. |
| void idfxx::ota::update::write_with_offset | ( | uint32_t | offset, |
| const void * | data, | ||
| size_t | size | ||
| ) |
Writes data at a specific offset in the OTA partition.
Supports non-contiguous writes. If flash encryption is enabled, data should be 16-byte aligned.
| offset | Offset within the partition. |
| data | Pointer to the data buffer. |
| size | Number of bytes to write. |
| std::system_error | on failure. |
| void idfxx::ota::update::write_with_offset | ( | uint32_t | offset, |
| std::span< const uint8_t > | data | ||
| ) |
Writes data at a specific offset in the OTA partition.
Supports non-contiguous writes. If flash encryption is enabled, data should be 16-byte aligned.
| offset | Offset within the partition. |
| data | Data to write. |
| std::system_error | on failure. |