pub struct EspOta(/* private fields */);
Implementations§
Source§impl EspOta
impl EspOta
Sourcepub fn new() -> Result<Self, EspError>
pub fn new() -> Result<Self, EspError>
Obtains an instance of EspOta
. Only one instance can exist at a time.
§Errors
Returns an error if EspOta
already exists.
Sourcepub fn get_boot_slot(&self) -> Result<Slot, EspError>
pub fn get_boot_slot(&self) -> Result<Slot, EspError>
Returns the currently configured boot slot.
§Errors
Returns an error if partition table is invalid or a flash read operation failed.
Sourcepub fn get_running_slot(&self) -> Result<Slot, EspError>
pub fn get_running_slot(&self) -> Result<Slot, EspError>
Returns the currently running app slot.
§Errors
Returns an error if no partition is found or flash read operation failed.
Sourcepub fn get_update_slot(&self) -> Result<Slot, EspError>
pub fn get_update_slot(&self) -> Result<Slot, EspError>
Returns the slot of the next OTA app partition to be used for the new firmware.
§Errors
Returns an error if OTA data partition is invalid, or no eligible OTA app slot partition was found.
Sourcepub fn get_last_invalid_slot(&self) -> Result<Option<Slot>, EspError>
pub fn get_last_invalid_slot(&self) -> Result<Option<Slot>, EspError>
Returns the last slot with invalid state (invalid or aborted image).
Sourcepub fn is_factory_reset_supported(&self) -> Result<bool, EspError>
pub fn is_factory_reset_supported(&self) -> Result<bool, EspError>
Returns true if a factory partition is present.
Sourcepub fn factory_reset(&mut self) -> Result<(), EspError>
pub fn factory_reset(&mut self) -> Result<(), EspError>
Sets the boot partition to factory partition.
§Errors
Returns an error if factory partition is not present or boot partition could not be set.
Sourcepub fn initiate_update(&mut self) -> Result<EspOtaUpdate<'_>, EspError>
pub fn initiate_update(&mut self) -> Result<EspOtaUpdate<'_>, EspError>
Initiates the OTA process and returns an instance of EspOtaUpdate
to be used for performing the OTA operations.
§Errors
Returns an error if OTA could not be initiated (OTA partition not found, flash error).
Sourcepub fn mark_running_slot_valid(&mut self) -> Result<(), EspError>
pub fn mark_running_slot_valid(&mut self) -> Result<(), EspError>
Marks the current application as valid.
If rollback is enabled, the application must confirm its operability by calling
mark_running_slot_valid()
function, otherwise the application will be rolled back upon reboot.
Sourcepub fn mark_running_slot_invalid_and_reboot(&mut self) -> EspError
pub fn mark_running_slot_invalid_and_reboot(&mut self) -> EspError
Rolls back to the previously workable app with reboot.
If rollback is successful then device will reset, otherwise the function will return Err
.
If the flash does not have at least one app (except the running app) then rollback is not possible.
§Errors
Returns an error if the rollback was not possible.