Aktualizr
C++ SOTA Client
Public Member Functions | List of all members
Aktualizr Class Reference

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
 
Aktualizroperator= (const Aktualizr &)=delete
 
void Initialize ()
 
std::future< void > RunForever ()
 Asynchronously run aktualizr indefinitely until Shutdown is called. More...
 
void Shutdown ()
 Asynchronously shut aktualizr down if it is running indefinitely with the Full RunningMode.
 
std::future< CampaignCheckResultCampaignCheck ()
 Check for campaigns. More...
 
std::future< void > CampaignAccept (const std::string &campaign_id)
 Accept a campaign for the current device. More...
 
std::future< void > SendDeviceData ()
 Send local device data to the server. More...
 
std::future< UpdateCheckResultCheckUpdates ()
 Fetch Uptane metadata and check for updates. More...
 
std::future< DownloadResultDownload (const std::vector< Uptane::Target > &updates)
 Download targets. More...
 
std::unique_ptr< StorageTargetRHandleGetStoredTarget (const Uptane::Target &target)
 Get target downloaded in Download call. More...
 
std::future< InstallResultInstall (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...
 

Detailed Description

This class provides the main APIs necessary for launching and controlling libaktualizr.

Definition at line 52 of file aktualizr.h.

Constructor & Destructor Documentation

◆ Aktualizr()

Aktualizr::Aktualizr ( Config config)
explicit

Aktualizr requires a configuration object.

Examples can be found in the config directory.

Definition at line 14 of file aktualizr.cc.

Member Function Documentation

◆ AddSecondary()

void Aktualizr::AddSecondary ( const std::shared_ptr< Uptane::SecondaryInterface > &  secondary)

Add new secondary to aktualizr.

Must be called before Initialize.

Parameters
secondaryAn object to perform installation on a secondary ECU.

Definition at line 91 of file aktualizr.cc.

◆ CampaignAccept()

std::future< 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.

Parameters
campaign_idCampaign ID as provided by CampaignCheck.
Returns
Empty std::future object

Definition at line 109 of file aktualizr.cc.

◆ CampaignCheck()

std::future< 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.

Returns
std::future object with data about available campaigns.

Definition at line 102 of file aktualizr.cc.

◆ CheckUpdates()

std::future< 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.

Returns
Information about available updates.

Definition at line 129 of file aktualizr.cc.

◆ Download()

std::future< DownloadResult > Aktualizr::Download ( const std::vector< Uptane::Target > &  updates)

Download targets.

Parameters
updatesVector of targets to download as provided by CheckUpdates.
Returns
std::future object with information about download results.

Definition at line 136 of file aktualizr.cc.

◆ GetStoredTarget()

std::unique_ptr< StorageTargetRHandle > Aktualizr::GetStoredTarget ( const Uptane::Target target)

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.

Parameters
targetTarget object matching the desired target in the storage.
Returns
Handle to the stored binary. nullptr if none is found.

Definition at line 160 of file aktualizr.cc.

◆ Install()

std::future< InstallResult > Aktualizr::Install ( const std::vector< Uptane::Target > &  updates)

Install targets.

Parameters
updatesVector of targets to install as provided by CheckUpdates or Download.
Returns
std::future object with information about installation results.

Definition at line 144 of file aktualizr.cc.

◆ Pause()

PauseResult Aktualizr::Pause ( )

Pause a download current in progress.

Returns
Information about pause results.

Definition at line 152 of file aktualizr.cc.

◆ Resume()

PauseResult Aktualizr::Resume ( )

Resume a paused download.

Returns
Information about resume results.

Definition at line 154 of file aktualizr.cc.

◆ RunForever()

std::future< void > Aktualizr::RunForever ( )

Asynchronously run aktualizr indefinitely until Shutdown is called.

Intended to be used with the Full RunningMode setting.

Returns
Empty std::future object

Definition at line 80 of file aktualizr.cc.

◆ SendDeviceData()

std::future< void > Aktualizr::SendDeviceData ( )

Send local device data to the server.

This includes network status, installed packages, hardware etc.

Returns
Empty std::future object

Definition at line 119 of file aktualizr.cc.

◆ SetSignalHandler()

boost::signals2::connection Aktualizr::SetSignalHandler ( std::function< void(std::shared_ptr< event::BaseEvent >)> &  handler)

Provide a function to receive event notifications.

Parameters
handlera function that can receive event objects.
Returns
a signal connection object, which can be disconnected if desired.

Definition at line 156 of file aktualizr.cc.

◆ UptaneCycle()

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 59 of file aktualizr.cc.


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