pub struct Ota<'a, F>where
F: Storage,{ /* private fields */ }
Expand description
This is used to manipulate the OTA-data partition.
This will ever only deal with OTA-0 and OTA-1 since these two slots are supported by the ESP-IDF bootloader.
Implementations§
Source§impl<'a, F> Ota<'a, F>where
F: Storage,
impl<'a, F> Ota<'a, F>where
F: Storage,
Sourcepub fn new(flash: &'a mut FlashRegion<'a, F>) -> Result<Ota<'a, F>, Error>
pub fn new(flash: &'a mut FlashRegion<'a, F>) -> Result<Ota<'a, F>, Error>
Create a Ota instance from the given FlashRegion
§Errors
A crate::partitions::Error::InvalidPartition if the given flash region doesn’t represent a Data/Ota partition or the size is unexpected
Sourcepub fn current_slot(&mut self) -> Result<Slot, Error>
pub fn current_slot(&mut self) -> Result<Slot, Error>
Returns the currently active OTA-slot.
Sourcepub fn set_current_slot(&mut self, slot: Slot) -> Result<(), Error>
pub fn set_current_slot(&mut self, slot: Slot) -> Result<(), Error>
Sets the currently active OTA-slot.
Passing Slot::None will reset the OTA-data
Sourcepub fn set_current_ota_state(
&mut self,
state: OtaImageState,
) -> Result<(), Error>
pub fn set_current_ota_state( &mut self, state: OtaImageState, ) -> Result<(), Error>
Set the OtaImageState of the currently selected slot.
§Errors
A crate::partitions::Error::InvalidState if the currently selected slot is Slot::None
Sourcepub fn current_ota_state(&mut self) -> Result<OtaImageState, Error>
pub fn current_ota_state(&mut self) -> Result<OtaImageState, Error>
Get the OtaImageState of the currently selected slot.
§Errors
A crate::partitions::Error::InvalidState if the currently selected slot is Slot::None