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.
 
std::future< result::CampaignCheckCampaignCheck ()
 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< result::UpdateCheckCheckUpdates ()
 Fetch Uptane metadata and check for updates. More...
 
std::future< result::DownloadDownload (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< result::InstallInstall (const std::vector< Uptane::Target > &updates)
 Install targets. More...
 
result::Pause Pause ()
 Pause the library operations. More...
 
result::Pause Resume ()
 Resume the library operations. More...
 
void UptaneCycle ()
 Synchronously run an uptane cycle: check for updates, download any new targets, install them, and send a manifest back to the server.
 
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 64 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< result::CampaignCheck > 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< result::UpdateCheck > 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< result::Download > 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 176 of file aktualizr.cc.

◆ Install()

std::future< result::Install > 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()

result::Pause Aktualizr::Pause ( )

Pause the library operations.

In progress target downloads will be paused and API calls will be deferred.

Returns
Information about pause results.

Definition at line 152 of file aktualizr.cc.

◆ Resume()

result::Pause Aktualizr::Resume ( )

Resume the library operations.

Target downloads will resume and API calls during pause state will execute in fifo order.

Returns
Information about resume results.

Definition at line 162 of file aktualizr.cc.

◆ RunForever()

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

Asynchronously run aktualizr indefinitely until Shutdown is called.

Returns
Empty std::future object

Definition at line 79 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 172 of file aktualizr.cc.


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