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 ()
 
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< StorageTargetRHandleGetStoredTarget (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...
 

Detailed Description

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

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

◆ CampaignAccept()

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.

Definition at line 86 of file aktualizr.cc.

◆ CampaignCheck()

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
Data about available campaigns.

Definition at line 84 of file aktualizr.cc.

◆ CheckUpdates()

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

◆ Download()

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

Download targets.

Parameters
updatesVector of targets to download as provided by CheckUpdates.
Returns
Information about download results.

Definition at line 92 of file aktualizr.cc.

◆ GetStoredTarget()

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.

Parameters
filenameName of the binary in the storage
Returns
Handle to the stored binary. nullptr if none is found.

Definition at line 108 of file aktualizr.cc.

◆ Install()

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

Install targets.

Parameters
updatesVector of targets to install as provided by CheckUpdates or Download.
Returns
Information about installation results.

Definition at line 96 of file aktualizr.cc.

◆ Pause()

PauseResult Aktualizr::Pause ( )

Pause a download current in progress.

Returns
Information about pause results.

Definition at line 100 of file aktualizr.cc.

◆ Resume()

PauseResult Aktualizr::Resume ( )

Resume a paused download.

Returns
Information about resume results.

Definition at line 102 of file aktualizr.cc.

◆ RunForever()

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.

◆ SendDeviceData()

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.

◆ 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 104 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 48 of file aktualizr.cc.


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