Ota::UpgraderBase Class Referenceabstract

#include <UpgraderBase.h>

Inheritance diagram for Ota::UpgraderBase:
Collaboration diagram for Ota::UpgraderBase:

Public Types

using Partition = Storage::Partition
 

Public Member Functions

virtual ~UpgraderBase ()
 
virtual bool begin (Partition partition, size_t size=0)=0
 Prepares a partition for an upgrade. The preparation is bootloader and architecture dependent. More...
 
virtual size_t write (const uint8_t *buffer, size_t size)=0
 Writes chunk of data to the partition set in begin(). More...
 
virtual bool end ()=0
 Finalizes the partition upgrade. More...
 
virtual bool abort ()
 Aborts a partition upgrade. More...
 
virtual bool setBootPartition (Partition partition, bool save=true)=0
 Sets the default partition from where the application will be booted on next restart. More...
 
virtual Partition getBootPartition ()=0
 Gets information about the partition that is set as the default one to boot. More...
 
virtual Partition getRunningPartition ()=0
 Gets information about the partition from which the current application is running. More...
 
virtual Partition getNextBootPartition (Partition startFrom={})=0
 Gets the next bootable partition that can be used after successful OTA upgrade. More...
 
Storage::Iterator getBootPartitions ()
 Gets information about all bootable partitions. More...
 
uint8_t getSlot (Partition partition)
 Gets slot number for a partition. More...
 

Static Public Attributes

static constexpr uint8_t SLOT_NONE {255}
 

Member Typedef Documentation

◆ Partition

Constructor & Destructor Documentation

◆ ~UpgraderBase()

virtual Ota::UpgraderBase::~UpgraderBase ( )
inlinevirtual

Member Function Documentation

◆ abort()

virtual bool Ota::UpgraderBase::abort ( )
inlinevirtual

Aborts a partition upgrade.

Reimplemented in Ota::IdfUpgrader.

◆ begin()

virtual bool Ota::UpgraderBase::begin ( Partition  partition,
size_t  size = 0 
)
pure virtual

Prepares a partition for an upgrade. The preparation is bootloader and architecture dependent.

Parameters
partition
size
Return values
bool

Implemented in Ota::RbootUpgrader, and Ota::IdfUpgrader.

◆ end()

virtual bool Ota::UpgraderBase::end ( )
pure virtual

Finalizes the partition upgrade.

Implemented in Ota::RbootUpgrader, and Ota::IdfUpgrader.

◆ getBootPartition()

virtual Partition Ota::UpgraderBase::getBootPartition ( )
pure virtual

Gets information about the partition that is set as the default one to boot.

Note
The returned partition can be different than the current running partition.
Return values
partition

Implemented in Ota::IdfUpgrader, and Ota::RbootUpgrader.

◆ getBootPartitions()

Storage::Iterator Ota::UpgraderBase::getBootPartitions ( )
inline

Gets information about all bootable partitions.

Return values
Storage::Iterator

◆ getNextBootPartition()

virtual Partition Ota::UpgraderBase::getNextBootPartition ( Partition  startFrom = {})
pure virtual

Gets the next bootable partition that can be used after successful OTA upgrade.

Parameters
startFrom- optional
Return values
partition

Implemented in Ota::IdfUpgrader, and Ota::RbootUpgrader.

◆ getRunningPartition()

virtual Partition Ota::UpgraderBase::getRunningPartition ( )
pure virtual

Gets information about the partition from which the current application is running.

Note
The returned partition can be different than the default boot partition.
Return values
partition

Implemented in Ota::IdfUpgrader, and Ota::RbootUpgrader.

◆ getSlot()

uint8_t Ota::UpgraderBase::getSlot ( Partition  partition)
inline

Gets slot number for a partition.

Parameters
partition
Return values
uint8_tslot number

◆ setBootPartition()

virtual bool Ota::UpgraderBase::setBootPartition ( Partition  partition,
bool  save = true 
)
pure virtual

Sets the default partition from where the application will be booted on next restart.

Parameters
partition
saveif true the change is persisted on the flash, otherwise it will be valid only for the next boot
Return values
bool

Implemented in Ota::IdfUpgrader, and Ota::RbootUpgrader.

◆ write()

virtual size_t Ota::UpgraderBase::write ( const uint8_t buffer,
size_t  size 
)
pure virtual

Writes chunk of data to the partition set in begin().

Parameters
buffer
size
Return values
size_tactually written bytes

Implemented in Ota::RbootUpgrader, and Ota::IdfUpgrader.

Member Data Documentation

◆ SLOT_NONE

constexpr uint8_t Ota::UpgraderBase::SLOT_NONE {255}
staticconstexpr

The documentation for this class was generated from the following file: