AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | Protected Member Functions | List of all members
alexaClientSDK::acsdkAssets::client::GenericInventory Class Referenceabstract

#include <GenericInventory.h>

Inheritance diagram for alexaClientSDK::acsdkAssets::client::GenericInventory:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::acsdkAssets::client::GenericInventory:
Collaboration graph
[legend]

Public Member Functions

 ~GenericInventory () override
 
const char * getName () const
 
std::shared_ptr< clientInterfaces::ArtifactWrapperInterfaceprepareForSettingChange (const SettingsMap &newSettings)
 
bool commitChange ()
 
void cancelChange ()
 
std::string getArtifactPath ()
 
void setCurrentActivePriority (commonInterfaces::Priority priority)
 
bool isSettingReady (const SettingsMap &setting)
 
- Public Member Functions inherited from alexaClientSDK::acsdkAssets::clientInterfaces::ArtifactUpdateValidator
virtual ~ArtifactUpdateValidator ()=default
 

Protected Member Functions

 GenericInventory (std::string name, std::shared_ptr< clientInterfaces::ArtifactWrapperFactoryInterface > artifactWrapperFactory)
 
virtual std::shared_ptr< commonInterfaces::ArtifactRequestcreateRequest (const SettingsMap &settings)=0
 
virtual bool applyChangesLocked (const std::string &path)=0
 
void cancelChangeLocked ()
 

ArtifactUpdateValidator method

bool validateUpdate (const std::shared_ptr< commonInterfaces::ArtifactRequest > &request, const std::string &newPath) override
 

Detailed Description

A general inventory manager class that is responsible for managing a list of artifacts and maintaining an active artifact. This manager will respond to setting changes by downloading an artifact if one does not exist for the required settings or by preparing one that already exists on the system. This manager will determine the artifact identity based on the request created.

Constructor & Destructor Documentation

◆ ~GenericInventory()

alexaClientSDK::acsdkAssets::client::GenericInventory::~GenericInventory ( )
override

◆ GenericInventory()

alexaClientSDK::acsdkAssets::client::GenericInventory::GenericInventory ( std::string  name,
std::shared_ptr< clientInterfaces::ArtifactWrapperFactoryInterface artifactWrapperFactory 
)
protected

Constructor

Parameters
name- name for the generic inventory
artifactWrapperFactory- factory for creating artifact

Member Function Documentation

◆ applyChangesLocked()

virtual bool alexaClientSDK::acsdkAssets::client::GenericInventory::applyChangesLocked ( const std::string &  path)
protectedpure virtual

A method that attempts to make use of the new artifact to ensure that it is usable.

Parameters
pathto the new artifact that just got downloaded or updated.
Returns
true if the artifact is valid and should be used, false otherwise.

◆ cancelChange()

void alexaClientSDK::acsdkAssets::client::GenericInventory::cancelChange ( )

Will cancel the changes for the new settings that were requested. This cancels any pending download if requested.

◆ cancelChangeLocked()

void alexaClientSDK::acsdkAssets::client::GenericInventory::cancelChangeLocked ( )
protected

Internal call for cancelChange.

◆ commitChange()

bool alexaClientSDK::acsdkAssets::client::GenericInventory::commitChange ( )

Will apply the changes for the new settings after preparations have been completed.

Warning
This must only be called after prepareForSettingChange has been called and the returned artifact has been confirmed. Failing to do so will prevent the settings from being applied.
Returns
weather the commit was successful.

◆ createRequest()

virtual std::shared_ptr<commonInterfaces::ArtifactRequest> alexaClientSDK::acsdkAssets::client::GenericInventory::createRequest ( const SettingsMap settings)
protectedpure virtual

A method that will be responsible for creating an Artifact Request based on the provided settings.

Parameters
settingsused to create the request.
Returns
NULLABLE, new request based on the provided settings.

◆ getArtifactPath()

std::string alexaClientSDK::acsdkAssets::client::GenericInventory::getArtifactPath ( )
Returns
the path of the current active artifact on disk.

◆ getName()

const char* alexaClientSDK::acsdkAssets::client::GenericInventory::getName ( ) const
inline

◆ isSettingReady()

bool alexaClientSDK::acsdkAssets::client::GenericInventory::isSettingReady ( const SettingsMap setting)

Checks to see if an artifact for the provided setting is already available.

◆ prepareForSettingChange()

std::shared_ptr<clientInterfaces::ArtifactWrapperInterface> alexaClientSDK::acsdkAssets::client::GenericInventory::prepareForSettingChange ( const SettingsMap newSettings)

Informs the manager class before applying the settings of the new settings that are going to be active.

Note
This should be called before commit to allow the manager to download the appropriate artifact if needed. The caller needs to check the returned artifact to ensure that it is available before committing.
Parameters
newSettingsthat will be used to identify the request for the new artifact.
Returns
NULLABLE, a pointer to the artifact that is represented by the new settings which can be used to query its state.

◆ setCurrentActivePriority()

void alexaClientSDK::acsdkAssets::client::GenericInventory::setCurrentActivePriority ( commonInterfaces::Priority  priority)

Overrides the current active artifact priority if one exists.

◆ validateUpdate()

bool alexaClientSDK::acsdkAssets::client::GenericInventory::validateUpdate ( const std::shared_ptr< commonInterfaces::ArtifactRequest > &  request,
const std::string &  newPath 
)
inlineoverrideprotectedvirtual

Providing a new path, check to see if the content of the update is valid and usable.

Parameters
newPathof the potential updated artifact.
Returns
true if valid, false otherwise.

Implements alexaClientSDK::acsdkAssets::clientInterfaces::ArtifactUpdateValidator.


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

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0