Aktualizr
C++ SOTA Client
|
This class provides the main APIs necessary for launching and controlling libaktualizr. More...
#include <aktualizr.h>
Public Member Functions | |
Aktualizr (Config &config) | |
Aktualizr requires a configuration object. More... | |
Aktualizr (const Aktualizr &)=delete | |
Aktualizr & | operator= (const Aktualizr &)=delete |
void | Initialize () |
int | RunForever () |
Run aktualizr indefinitely until Shutdown is called. More... | |
void | Shutdown () |
Asynchronously shut aktualizr down if it is running indefinitely with the Full RunningMode. | |
CampaignCheckResult | CampaignCheck () |
Check for campaigns. More... | |
void | CampaignAccept (const std::string &campaign_id) |
Accept a campaign for the current device. More... | |
void | SendDeviceData () |
Send local device data to the server. More... | |
UpdateCheckResult | CheckUpdates () |
Fetch Uptane metadata and check for updates. More... | |
DownloadResult | Download (const std::vector< Uptane::Target > &updates) |
Download targets. More... | |
std::unique_ptr< StorageTargetRHandle > | GetStoredTarget (const std::string &filename) |
Get target downloaded in Download call. More... | |
InstallResult | Install (const std::vector< Uptane::Target > &updates) |
Install targets. More... | |
PauseResult | Pause () |
Pause a download current in progress. More... | |
PauseResult | Resume () |
Resume a paused download. More... | |
void | UptaneCycle () |
Synchronously run an uptane cycle. More... | |
void | AddSecondary (const std::shared_ptr< Uptane::SecondaryInterface > &secondary) |
Add new secondary to aktualizr. More... | |
boost::signals2::connection | SetSignalHandler (std::function< void(std::shared_ptr< event::BaseEvent >)> &handler) |
Provide a function to receive event notifications. More... | |
This class provides the main APIs necessary for launching and controlling libaktualizr.
Definition at line 20 of file aktualizr.h.
|
explicit |
Aktualizr requires a configuration object.
Examples can be found in the config directory.
Definition at line 14 of file aktualizr.cc.
void Aktualizr::AddSecondary | ( | const std::shared_ptr< Uptane::SecondaryInterface > & | secondary | ) |
Add new secondary to aktualizr.
Must be called before Initialize.
secondary | An object to perform installation on a secondary ECU. |
Definition at line 78 of file aktualizr.cc.
void Aktualizr::CampaignAccept | ( | const std::string & | campaign_id | ) |
Accept a campaign for the current device.
Campaigns are a concept outside of Uptane, and allow for user approval of updates before the contents of the update are known.
campaign_id | Campaign ID as provided by CampaignCheck. |
Definition at line 86 of file aktualizr.cc.
CampaignCheckResult Aktualizr::CampaignCheck | ( | ) |
Check for campaigns.
Campaigns are a concept outside of Uptane, and allow for user approval of updates before the contents of the update are known.
Definition at line 84 of file aktualizr.cc.
UpdateCheckResult Aktualizr::CheckUpdates | ( | ) |
Fetch Uptane metadata and check for updates.
This collects a client manifest, PUTs it to the director, updates the Uptane metadata (including root and targets), and then checks the metadata for target updates.
Definition at line 90 of file aktualizr.cc.
DownloadResult Aktualizr::Download | ( | const std::vector< Uptane::Target > & | updates | ) |
Download targets.
updates | Vector of targets to download as provided by CheckUpdates. |
Definition at line 92 of file aktualizr.cc.
std::unique_ptr< StorageTargetRHandle > Aktualizr::GetStoredTarget | ( | const std::string & | filename | ) |
Get target downloaded in Download call.
Returned target is guaranteed to be verified and up-to-date according to the Uptane metadata downloaded in CheckUpdates call.
filename | Name of the binary in the storage |
Definition at line 108 of file aktualizr.cc.
InstallResult Aktualizr::Install | ( | const std::vector< Uptane::Target > & | updates | ) |
Install targets.
updates | Vector of targets to install as provided by CheckUpdates or Download. |
Definition at line 96 of file aktualizr.cc.
PauseResult Aktualizr::Pause | ( | ) |
Pause a download current in progress.
Definition at line 100 of file aktualizr.cc.
PauseResult Aktualizr::Resume | ( | ) |
Resume a paused download.
Definition at line 102 of file aktualizr.cc.
int Aktualizr::RunForever | ( | ) |
Run aktualizr indefinitely until Shutdown is called.
Intended to be used with the Full RunningMode setting. You may want to run this on its own thread.
Definition at line 69 of file aktualizr.cc.
void Aktualizr::SendDeviceData | ( | ) |
Send local device data to the server.
This includes network status, installed packages, hardware etc.
Definition at line 88 of file aktualizr.cc.
boost::signals2::connection Aktualizr::SetSignalHandler | ( | std::function< void(std::shared_ptr< event::BaseEvent >)> & | handler | ) |
Provide a function to receive event notifications.
handler | a function that can receive event objects. |
Definition at line 104 of file aktualizr.cc.
void Aktualizr::UptaneCycle | ( | ) |
Synchronously run an uptane cycle.
Behaviour depends on the configured running mode (full cycle, check and download or check and install)
Definition at line 48 of file aktualizr.cc.