![]() |
AlexaClientSDK
3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <SettingInterface.h>

Public Types | |
| using | ValueType = ValueT |
| Define the setting value type. More... | |
| using | ObserverType = SettingObserverInterface< SettingInterface< ValueType > > |
| Define the observer type for this setting. More... | |
Public Member Functions | |
| virtual | ~SettingInterface ()=default |
| virtual SetSettingResult | setLocalChange (const ValueType &value)=0 |
| virtual bool | setAvsChange (const ValueType &value)=0 |
| virtual bool | clearData (const ValueType &value)=0 |
| ValueType | get () const |
| ValueType | getDefault () const |
| bool | addObserver (std::shared_ptr< ObserverType > observer) |
| void | removeObserver (std::shared_ptr< ObserverType > &observer) |
Protected Types | |
| using | GuardedValue = avsCommon::utils::GuardedValue< ValueType > |
Alias for GuardedValue with the templated value ValueType. More... | |
| using | LogEntry = avsCommon::utils::logger::LogEntry |
| Alias to make log entries less verbose. More... | |
Protected Member Functions | |
| SettingInterface (const ValueType &value) | |
| void | notifyObservers (SettingNotifications notification) |
Protected Attributes | |
| std::mutex | m_observerMutex |
| Mutex used to guard observers. More... | |
| std::unordered_set< std::shared_ptr< ObserverType > > | m_observers |
| Set of all observers of this setting. More... | |
| std::conditional< std::is_scalar< ValueType >::value, std::atomic< ValueType >, GuardedValue >::type | m_value |
| The setting value. (is_trivially_copyable is not supported on gcc4.8) More... | |
| const ValueType | m_defaultValue |
| The default setting value. More... | |
Interface for setting objects. Second template argument is used to restrict usage to the types accepted.
The setting implementation only support types that have the following properties:
| ValueT | The setting value type. |
|
protected |
Alias for GuardedValue with the templated value ValueType.
|
protected |
Alias to make log entries less verbose.
| using alexaClientSDK::settings::SettingInterface< ValueT >::ObserverType = SettingObserverInterface<SettingInterface<ValueType> > |
Define the observer type for this setting.
| using alexaClientSDK::settings::SettingInterface< ValueT >::ValueType = ValueT |
Define the setting value type.
|
virtualdefault |
Destructor.
|
protected |
Constructor that initialize m_value with the given value.
|
inline |
Register a setting observer.
The observer will be executed every time the setting value changes or a request fails.
| observer | The connector to register for calling back whenever the setting notifications. |
true if the observer was added, false otherwise.
|
pure virtual |
Clear the data this Setting.
| value | The default value for this setting. |
true if it data is cleared; otherwise. Implemented in alexaClientSDK::diagnostics::test::SettingStub< ValueT >, alexaClientSDK::settings::Setting< ValueT >, and alexaClientSDK::settings::test::SettingStub< SettingT >.
|
inline |
Get the current value of this setting. This will not take into consideration pending set requests.
|
inline |
Get the default value of this setting.
|
protected |
Notifies observers of the status of applying a setting and it's current value.
| notification | The type of notification to send to the observers. |
|
inline |
Remove a setting observer.
| observer | The observer to remove. |
|
pure virtual |
Request to set the managed setting to the given value. This should be used when the request came from AVS.
| value | The target value. |
true if it succeeds to enqueue the request; otherwise. Implemented in alexaClientSDK::diagnostics::test::SettingStub< ValueT >, alexaClientSDK::settings::Setting< ValueT >, and alexaClientSDK::settings::test::SettingStub< SettingT >.
|
pure virtual |
Request to set the managed setting to the given value. Note that this is an asynchronous operation.
| value | The target value. |
Implemented in alexaClientSDK::settings::Setting< ValueT >, alexaClientSDK::diagnostics::test::SettingStub< ValueT >, and alexaClientSDK::settings::test::SettingStub< SettingT >.
|
protected |
The default setting value.
|
protected |
Mutex used to guard observers.
|
protected |
Set of all observers of this setting.
|
protected |
The setting value. (is_trivially_copyable is not supported on gcc4.8)
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0