AlexaClientSDK
3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <SettingsManager.h>
Public Types | |
template<size_t index> | |
using | SettingType = typename std::tuple_element< index, std::tuple< SettingsT... > >::type |
The setting type kept at index position. More... | |
template<size_t index> | |
using | ValueType = typename SettingType< index >::ValueType |
Define the value type for setting kept on position index . More... | |
template<size_t index> | |
using | ObserverType = typename SettingType< index >::ObserverType |
Define the observer type for setting kept on position index . More... | |
template<typename SettingT > | |
using | SettingPointerType = std::shared_ptr< SettingT > |
Define the shared_ptr type for the given SettingT . More... | |
using | SettingConfigurations = std::tuple< SettingConfiguration< SettingsT >... > |
The tuple holding the settings configuration. More... | |
Public Member Functions | |
SettingsManager (std::shared_ptr< registrationManager::CustomerDataManagerInterface > dataManager, SettingConfigurations settingConfigurations) | |
SettingsManager (std::shared_ptr< registrationManager::CustomerDataManagerInterface > dataManager) | |
virtual | ~SettingsManager ()=default |
template<size_t index> | |
SetSettingResult | setValue (const ValueType< index > &value) |
template<size_t index> | |
std::pair< bool, ValueType< index > > | getValue (const ValueType< index > &defaultValue=ValueType< index >()) const |
template<size_t index> | |
std::string | getJsonValue () const |
template<size_t index> | |
bool | addObserver (std::shared_ptr< ObserverType< index >> observer) |
template<size_t index> | |
void | removeObserver (std::shared_ptr< ObserverType< index >> observer) |
template<size_t index> | |
bool | addSetting (std::shared_ptr< SettingType< index >> setting) |
template<size_t index> | |
void | removeSetting (std::shared_ptr< SettingType< index >> setting) |
template<size_t index> | |
bool | hasSetting () |
SettingConfigurations | getConfigurations () const |
template<size_t index> | |
std::shared_ptr< SettingType< index > > | getSetting () const |
template<size_t index> | |
std::pair< bool, typename SettingsManager< SettingsT... >::template ValueType< index > > | getValue (const ValueType< index > &defaultValue) const |
template<size_t index> | |
std::shared_ptr< typename SettingsManager< SettingsT... >::template SettingType< index > > | getSetting () const |
CustomerDataHandler Functions | |
void | clearData () override |
Public Member Functions inherited from alexaClientSDK::registrationManager::CustomerDataHandler | |
CustomerDataHandler (const std::shared_ptr< registrationManager::CustomerDataManagerInterface > &dataManager) | |
virtual | ~CustomerDataHandler () |
Public Member Functions inherited from alexaClientSDK::registrationManager::CustomerDataHandlerInterface | |
virtual | ~CustomerDataHandlerInterface ()=default |
Static Public Attributes | |
static constexpr size_t | NUMBER_OF_SETTINGS {sizeof...(SettingsT)} |
The number of settings supported by this manager. More... | |
The SettingsManager
is responsible for managing settings.
using alexaClientSDK::settings::SettingsManager< SettingsT >::ObserverType = typename SettingType<index>::ObserverType |
Define the observer type for setting kept on position index
.
using alexaClientSDK::settings::SettingsManager< SettingsT >::SettingConfigurations = std::tuple<SettingConfiguration<SettingsT>...> |
The tuple holding the settings configuration.
using alexaClientSDK::settings::SettingsManager< SettingsT >::SettingPointerType = std::shared_ptr<SettingT> |
Define the shared_ptr type for the given SettingT
.
using alexaClientSDK::settings::SettingsManager< SettingsT >::SettingType = typename std::tuple_element<index, std::tuple<SettingsT...> >::type |
The setting type kept at index
position.
using alexaClientSDK::settings::SettingsManager< SettingsT >::ValueType = typename SettingType<index>::ValueType |
Define the value type for setting kept on position index
.
alexaClientSDK::settings::SettingsManager< SettingsT >::SettingsManager | ( | std::shared_ptr< registrationManager::CustomerDataManagerInterface > | dataManager, |
SettingConfigurations | settingConfigurations | ||
) |
Settings manager constructor.
dataManager | A dataManager object that will track the CustomerDataHandler. |
settingConfigurations | The tuple holding the settings configuration. |
alexaClientSDK::settings::SettingsManager< SettingsT >::SettingsManager | ( | std::shared_ptr< registrationManager::CustomerDataManagerInterface > | dataManager | ) |
Settings manager constructor.
dataManager | A dataManager object that will track the CustomerDataHandler. |
|
virtualdefault |
SettingsManager destructor.
bool alexaClientSDK::settings::SettingsManager< SettingsT >::addObserver | ( | std::shared_ptr< ObserverType< index >> | observer | ) |
Register an observer for a given setting.
index | The index of the target setting. |
observer | The setting observer. |
true
if it succeed to add the observer, false
otherwise. bool alexaClientSDK::settings::SettingsManager< SettingsT >::addSetting | ( | std::shared_ptr< SettingType< index >> | setting | ) |
Register a new setting to be managed.
index | The index of the target setting. |
setting | The setting object. |
true
if it succeeds; false
if manager already has a setting object from the same type.
|
overridevirtual |
Reset any internal state that may be associated with a particular user.
Implements alexaClientSDK::registrationManager::CustomerDataHandlerInterface.
std::tuple< SettingConfiguration< SettingsT >... > alexaClientSDK::settings::SettingsManager< SettingsT >::getConfigurations | ( | ) | const |
Gets the settings configuration.
std::string alexaClientSDK::settings::SettingsManager< SettingsT >::getJsonValue | ( | ) | const |
Get a json representation of the current setting value.
index | The index of the target setting. |
std::shared_ptr<SettingType<index> > alexaClientSDK::settings::SettingsManager< SettingsT >::getSetting | ( | ) | const |
Gets the setting for the given index
.
index | The setting index. |
index
if the setting has been built; nullptr
otherwise. build()
has been called. std::shared_ptr<typename SettingsManager<SettingsT...>::template SettingType<index> > alexaClientSDK::settings::SettingsManager< SettingsT >::getSetting | ( | ) | const |
std::pair<bool, ValueType<index> > alexaClientSDK::settings::SettingsManager< SettingsT >::getValue | ( | const ValueType< index > & | defaultValue = ValueType< index >() | ) | const |
Get the current value of this setting. This will not take into consideration pending set
requests.
index | The index of the target setting. |
defaultValue | The value to be returned in case the setting does not exist. |
std::pair<bool, typename SettingsManager<SettingsT...>::template ValueType<index> > alexaClientSDK::settings::SettingsManager< SettingsT >::getValue | ( | const ValueType< index > & | defaultValue | ) | const |
bool alexaClientSDK::settings::SettingsManager< SettingsT >::hasSetting | ( | ) |
Checks if a setting is available.
index | The index of the target setting. |
true
if the setting is available, false
otherwise. void alexaClientSDK::settings::SettingsManager< SettingsT >::removeObserver | ( | std::shared_ptr< ObserverType< index >> | observer | ) |
Unregister an observer for a given setting.
index | The index of the target setting. |
observer | The setting observer. |
void alexaClientSDK::settings::SettingsManager< SettingsT >::removeSetting | ( | std::shared_ptr< SettingType< index >> | setting | ) |
Unregister a new setting to be managed.
index | The index of the target setting. |
setting | The setting object. |
SetSettingResult alexaClientSDK::settings::SettingsManager< SettingsT >::setValue | ( | const ValueType< index > & | value | ) |
Enqueue request to set the given settings represented by id
to the given value
.
index | The index of the target setting. |
value | The set value. |
|
static |
The number of settings supported by this manager.
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0