VitroIO SDK
Software development kit for Vitro Shard.
Loading...
Searching...
No Matches
vitroio::sdk::impl::UpgradeController Class Reference

Class is responsible for handling upgrade data. More...

#include <upgrade_controller.h>

Inheritance diagram for vitroio::sdk::impl::UpgradeController:
Collaboration diagram for vitroio::sdk::impl::UpgradeController:

Public Types

typedef Callback< void()> OnNewFirmwareAvailableCallback
 Type defines signature of the callback function which is to be called when the new firmware will be available. More...
 

Public Member Functions

 UpgradeController (FlashInterface *flash, FirmwareId fwId, Version fwVersion, OnNewFirmwareAvailableCallback callback, EventQueue *eventQueue)
 Constructor. More...
 
 ~UpgradeController ()
 Destructor. More...
 
bool isValid () const
 Function allows to check whether the controller is in valid state. More...
 
void configure (FlashSpace flashSpace)
 Function configures the controller. More...
 
void processData (const uint8_t *data, uint32_t size)
 Function processes upgrade data. More...
 

Detailed Description

Class is responsible for handling upgrade data.

Member Typedef Documentation

◆ OnNewFirmwareAvailableCallback

Type defines signature of the callback function which is to be called when the new firmware will be available.

Constructor & Destructor Documentation

◆ UpgradeController()

vitroio::sdk::impl::UpgradeController::UpgradeController ( FlashInterface flash,
FirmwareId  fwId,
Version  fwVersion,
OnNewFirmwareAvailableCallback  callback,
EventQueue *  eventQueue 
)
explicit

Constructor.

@detials There is not guarantee that the object is in valid state. User should call isValid() method to determine if the object was initialized successfully. When the object is in invalid state, the behaviour is undefined.

Parameters
flashPointer to FlashInterface object
fwIdid if firmware
fwVersionCurrent firmware version
callbackCallback that is to be called when new firmware is available
eventQueueExternal event queue for storing controller events

◆ ~UpgradeController()

vitroio::sdk::impl::UpgradeController::~UpgradeController ( )

Destructor.

Member Function Documentation

◆ configure()

void vitroio::sdk::impl::UpgradeController::configure ( FlashSpace  flashSpace)

Function configures the controller.

Function allows to set parameters that can be not known during instantiation of the controller. The controller must be configured before usage.

Parameters
flashSpaceSpecifies flash memory space for a new firmware

◆ isValid()

bool vitroio::sdk::impl::UpgradeController::isValid ( ) const

Function allows to check whether the controller is in valid state.

Note
This method should be called always after creation of the object.
Returns
Function returns true if the object is valid or false otherwise.

◆ processData()

void vitroio::sdk::impl::UpgradeController::processData ( const uint8_t *  data,
uint32_t  size 
)

Function processes upgrade data.

Parameters
dataPointer to buffer with new upgrade data
sizeSize of buffer with upgrade data