esp_idf_svc::ota

Struct EspOta

Source
pub struct EspOta(/* private fields */);

Implementations§

Source§

impl EspOta

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn get_last_invalid_slot(&self) -> Result<Option<Slot>, EspError>

Returns the last slot with invalid state (invalid or aborted image).

Source

pub fn is_factory_reset_supported(&self) -> Result<bool, EspError>

Returns true if a factory partition is present.

Source

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.

Source

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).

Source

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.

Source

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.

Trait Implementations§

Source§

impl Debug for EspOta

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for EspOta

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl ErrorType for EspOta

Source§

type Error = EspIOError

Error type of all the IO operations on this type.
Source§

impl Ota for EspOta

Source§

type Update<'a> = EspOtaUpdate<'a> where Self: 'a

Source§

fn get_boot_slot(&self) -> Result<Slot, Self::Error>

Source§

fn get_running_slot(&self) -> Result<Slot, Self::Error>

Source§

fn get_update_slot(&self) -> Result<Slot, Self::Error>

Source§

fn is_factory_reset_supported(&self) -> Result<bool, Self::Error>

Source§

fn factory_reset(&mut self) -> Result<(), Self::Error>

Source§

fn initiate_update(&mut self) -> Result<Self::Update<'_>, Self::Error>

Source§

fn mark_running_slot_valid(&mut self) -> Result<(), Self::Error>

Source§

fn mark_running_slot_invalid_and_reboot(&mut self) -> Self::Error

Auto Trait Implementations§

§

impl Freeze for EspOta

§

impl RefUnwindSafe for EspOta

§

impl Send for EspOta

§

impl Sync for EspOta

§

impl Unpin for EspOta

§

impl UnwindSafe for EspOta

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.