AlexaClientSDK  1.20.1
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
alexaClientSDK::settings Namespace Reference

Namespaces

 storage
 
 test
 
 types
 

Classes

class  CloudControlledSettingProtocol
 
class  DeviceControlledSettingProtocol
 
class  Setting
 
class  SettingCallbackAdapter
 
class  SettingCallbackAdapterInterface
 
class  SettingCallbacks
 
struct  SettingConfiguration
 
class  SettingConnectionObserver
 
struct  SettingEventMetadata
 
class  SettingEventRequestObserver
 
class  SettingEventSender
 
class  SettingEventSenderInterface
 
class  SettingInterface
 
class  SettingObserverInterface
 
class  SettingProtocolInterface
 
class  SettingsManager
 
class  SettingsManagerBuilderBase
 
class  SettingsManagerBuilderBase< settings::SettingsManager< SettingsT... > >
 
class  SharedAVSSettingProtocol
 

Typedefs

using Locale = std::string
 Alias for the locale type. More...
 
using DeviceLocales = std::vector< Locale >
 Alias for locales enabled in the device. More...
 
using WakeWord = std::string
 Alias for the wake word type. More...
 
using WakeWords = std::set< WakeWord >
 Alias for a set of wake words type. More...
 
using DoNotDisturbSetting = SettingInterface< bool >
 Type for do not disturb setting. More...
 
using AlarmVolumeRampSetting = SettingInterface< types::AlarmVolumeRampTypes >
 Forward declaration for AlarmVolumeRamp setting. More...
 
using WakeWordConfirmationSetting = SettingInterface< WakeWordConfirmationSettingType >
 Type for wake word confirmation setting. More...
 
using SpeechConfirmationSetting = SettingInterface< SpeechConfirmationSettingType >
 Type for end of speech confirmation setting. More...
 
using TimeZoneSetting = SettingInterface< std::string >
 Type for time zone setting. More...
 
using WakeWordsSetting = SettingInterface< WakeWords >
 Type for wake words. More...
 
using LocalesSetting = SettingInterface< DeviceLocales >
 Type for locale. More...
 
using NetworkInfoSetting = SettingInterface< types::NetworkInfo >
 Type for network info. More...
 
using DeviceSettingsManager = SettingsManager< DoNotDisturbSetting, AlarmVolumeRampSetting, WakeWordConfirmationSetting, SpeechConfirmationSetting, TimeZoneSetting, WakeWordsSetting, LocalesSetting, NetworkInfoSetting >
 The DeviceSettingsManager will manage all common settings to alexa devices. More...
 
template<typename ValueT >
using IntegralByteType = typename std::enable_if< isIntegralByteType< ValueT >(), ValueT >::type
 
template<typename ValueT >
using EnumOrString = typename std::enable_if< isEnumOrString< ValueT >(), ValueT >::type
 
template<typename ValueT >
using StringCollection = typename std::enable_if< isStringCollection< ValueT >(), ValueT >::type
 
template<typename ValueT >
using OtherTypes = typename std::enable_if< !isEnumOrString< ValueT >() &&!isIntegralByteType< ValueT >() &&!isStringCollection< ValueT >(), ValueT >::type
 

Enumerations

enum  DeviceSettingsIndex {
  DO_NOT_DISTURB, ALARM_VOLUME_RAMP, WAKEWORD_CONFIRMATION, SPEECH_CONFIRMATION,
  TIMEZONE, WAKE_WORDS, LOCALE, NETWORK_INFO
}
 
enum  SettingNotifications {
  SettingNotifications::LOCAL_CHANGE_IN_PROGRESS, SettingNotifications::AVS_CHANGE_IN_PROGRESS, SettingNotifications::LOCAL_CHANGE, SettingNotifications::AVS_CHANGE,
  SettingNotifications::LOCAL_CHANGE_FAILED, SettingNotifications::AVS_CHANGE_FAILED, SettingNotifications::LOCAL_CHANGE_CANCELLED, SettingNotifications::AVS_CHANGE_CANCELLED
}
 
enum  SettingStatus { SettingStatus::NOT_AVAILABLE, SettingStatus::LOCAL_CHANGE_IN_PROGRESS, SettingStatus::AVS_CHANGE_IN_PROGRESS, SettingStatus::SYNCHRONIZED }
 
enum  SpeechConfirmationSettingType { SpeechConfirmationSettingType::NONE, SpeechConfirmationSettingType::TONE }
 
enum  WakeWordConfirmationSettingType { WakeWordConfirmationSettingType::NONE, WakeWordConfirmationSettingType::TONE }
 

Functions

std::ostream & operator<< (std::ostream &stream, const SettingNotifications &value)
 
std::string settingStatusToString (SettingStatus status)
 
SettingStatus stringToSettingStatus (const std::string &statusString)
 
template<typename ValueT >
static constexpr bool isIntegralByteType ()
 
template<typename ValueT , typename = IntegralByteType<ValueT>>
std::pair< bool, std::string > toSettingString (const IntegralByteType< ValueT > &value)
 
template<typename ValueT , typename = IntegralByteType<ValueT>>
std::pair< bool, ValueT > fromSettingString (const std::string &str, const IntegralByteType< ValueT > &defaultValue)
 
template<typename ValueT >
static constexpr bool isEnumOrString ()
 
template<typename ValueT , typename = EnumOrString<ValueT>>
std::pair< bool, std::string > toSettingString (const ValueT &value)
 
template<typename ValueT , typename = EnumOrString<ValueT>>
std::pair< bool, ValueT > fromSettingString (const std::string &str, const ValueT &defaultValue)
 
template<typename ValueT >
static constexpr bool isStringCollection ()
 
template<typename ValueT , StringCollection< ValueT > * = nullptr>
std::pair< bool, std::string > toSettingString (const StringCollection< ValueT > &value)
 
template<typename ValueT , StringCollection< ValueT > * = nullptr>
std::pair< bool, ValueT > fromSettingString (const std::string &str, const StringCollection< ValueT > &defaultValue)
 
template<typename ValueT >
std::pair< bool, std::string > toSettingString (const OtherTypes< ValueT > &value)
 
template<typename ValueT >
std::pair< bool, ValueT > fromSettingString (const std::string &str, const OtherTypes< ValueT > &defaultValue)
 
SpeechConfirmationSettingType getSpeechConfirmationDefault ()
 
std::ostream & operator<< (std::ostream &stream, const SpeechConfirmationSettingType &value)
 
std::istream & operator>> (std::istream &is, SpeechConfirmationSettingType &value)
 
WakeWordConfirmationSettingType getWakeWordConfirmationDefault ()
 
std::ostream & operator<< (std::ostream &stream, const WakeWordConfirmationSettingType &value)
 
std::istream & operator>> (std::istream &is, WakeWordConfirmationSettingType &value)
 
static const std::string TAG ("CloudControlledSettingProtocol")
 String to identify log entries originating from this file. More...
 
static const std::string TAG ("DeviceControlledSettingProtocol")
 String to identify log entries originating from this file. More...
 
static const std::string TAG ("SettingEventSender")
 String to identify log entries originating from this file. More...
 
static const std::chrono::seconds HTTP_RESPONSE_TIMEOUT (40)
 

Variables

 m_applyFunction {applyValueFn}
 
 m_protocol {std::move(settingProtocol)}
 
constexpr char QUOTE = '"'
 Quote used for json string values. More...
 
static const std::string EMPTY_JSON_LIST = "[]"
 
static const std::vector< int > DEFAULT_RETRY_TABLE
 Table with the retry times on subsequent retries. More...
 
static const std::string INVALID_VALUE = ""
 Protocol should call apply change with an empty string when no value is found in the database. More...
 

Typedef Documentation

◆ AlarmVolumeRampSetting

Forward declaration for AlarmVolumeRamp setting.

◆ DeviceLocales

using alexaClientSDK::settings::DeviceLocales = typedef std::vector<Locale>

Alias for locales enabled in the device.

◆ DeviceSettingsManager

The DeviceSettingsManager will manage all common settings to alexa devices.

◆ DoNotDisturbSetting

Type for do not disturb setting.

◆ EnumOrString

template<typename ValueT >
using alexaClientSDK::settings::EnumOrString = typedef typename std::enable_if<isEnumOrString<ValueT>(), ValueT>::type

Define a valid type for enums and string types.

Template Parameters
ValueTThe value type. This will only be a valid type for enums and string.

◆ IntegralByteType

template<typename ValueT >
using alexaClientSDK::settings::IntegralByteType = typedef typename std::enable_if<isIntegralByteType<ValueT>(), ValueT>::type

Define a valid type for int8_t and uint8_t.

Template Parameters
ValueTThe value type. This will only be a valid type for int8_t or uint8_t.

◆ Locale

using alexaClientSDK::settings::Locale = typedef std::string

Alias for the locale type.

◆ LocalesSetting

Type for locale.

◆ NetworkInfoSetting

Type for network info.

◆ OtherTypes

template<typename ValueT >
using alexaClientSDK::settings::OtherTypes = typedef typename std::enable_if< !isEnumOrString<ValueT>() && !isIntegralByteType<ValueT>() && !isStringCollection<ValueT>(), ValueT>::type

Define a valid type for arithmetic types (except (u)int8_t), and classes.

Template Parameters
ValueTThe value type. This will only be a valid type for arithmetic types (except (u)int8_t), and classes.

◆ SpeechConfirmationSetting

Type for end of speech confirmation setting.

◆ StringCollection

template<typename ValueT >
using alexaClientSDK::settings::StringCollection = typedef typename std::enable_if<isStringCollection<ValueT>(), ValueT>::type

Define a valid type for string collection.

Template Parameters
ValueTThe value type. This will only be a valid type for string collection.

◆ TimeZoneSetting

Type for time zone setting.

◆ WakeWord

using alexaClientSDK::settings::WakeWord = typedef std::string

Alias for the wake word type.

◆ WakeWordConfirmationSetting

Type for wake word confirmation setting.

◆ WakeWords

using alexaClientSDK::settings::WakeWords = typedef std::set<WakeWord>

Alias for a set of wake words type.

◆ WakeWordsSetting

Type for wake words.

Enumeration Type Documentation

◆ DeviceSettingsIndex

Enumerates the settings that are kept inside DeviceSettingsManager.

Note
This enumeration must reflect the order that the settings show up in the DeviceSettingsManager declaration.
Enumerator
DO_NOT_DISTURB 
ALARM_VOLUME_RAMP 
WAKEWORD_CONFIRMATION 
SPEECH_CONFIRMATION 
TIMEZONE 
WAKE_WORDS 
LOCALE 
NETWORK_INFO 

◆ SettingNotifications

Enumerate the type of notifications.

Enumerator
LOCAL_CHANGE_IN_PROGRESS 

The setting that was changed locally is being applied.

AVS_CHANGE_IN_PROGRESS 

The setting that was changed via cloud is being applied.

LOCAL_CHANGE 

Setting value changed due to a local change.

AVS_CHANGE 

Setting value changed due to a change requested via cloud.

LOCAL_CHANGE_FAILED 

Local request failed.

AVS_CHANGE_FAILED 

AVS request failed.

LOCAL_CHANGE_CANCELLED 

Local request cancelled due to a new request.

AVS_CHANGE_CANCELLED 

AVS request cancelled due to a new request.

◆ SettingStatus

Specifies the state of a setting.

Enumerator
NOT_AVAILABLE 

The setting has either not been set and not been persisted in a storage or the setting is in an unknown status.

LOCAL_CHANGE_IN_PROGRESS 

The setting has been set locally but not synchronized with AVS.

AVS_CHANGE_IN_PROGRESS 

AVS request is in progress.

SYNCHRONIZED 

The setting has been set locally and synchronized with AVS.

◆ SpeechConfirmationSettingType

Defines the values for speech confirmation setting.

Enumerator
NONE 

No speech confirmation.

TONE 

A tone will be played for speech confirmation.

◆ WakeWordConfirmationSettingType

Defines the values for wake word confirmation setting.

Enumerator
NONE 

No wake word confirmation.

TONE 

A tone will be played for wake word confirmation.

Function Documentation

◆ fromSettingString() [1/4]

template<typename ValueT , typename = IntegralByteType<ValueT>>
std::pair<bool, ValueT> alexaClientSDK::settings::fromSettingString ( const std::string &  str,
const IntegralByteType< ValueT > &  defaultValue 
)

Convert a string (json format) to (int8_t or uint8_t) setting representation.

Template Parameters
ValueTThe value type (either int8_t or uint8_t).
Parameters
strThe json string that represents the object.
defaultValueIn case the string conversion fails, we'll return this default value.
Returns
A pair where first represents whether the conversion succeeded or not, and the second is the converted value.

◆ fromSettingString() [2/4]

template<typename ValueT , typename = EnumOrString<ValueT>>
std::pair<bool, ValueT> alexaClientSDK::settings::fromSettingString ( const std::string &  str,
const ValueT &  defaultValue 
)

Convert a string (json format) to setting representation for strings and enums.

Template Parameters
ValueTThe value type.
Parameters
strThe json string that represents the object.
defaultValueIn case the string conversion fails, we'll return this default value.
Returns
A pair where first represents whether the conversion succeeded or not, and the second is the converted value.
Note
For enums, we assume the operator>> is defined and the failbit should be set in case of failure to convert from string.

◆ fromSettingString() [3/4]

template<typename ValueT , StringCollection< ValueT > * = nullptr>
std::pair<bool, ValueT> alexaClientSDK::settings::fromSettingString ( const std::string &  str,
const StringCollection< ValueT > &  defaultValue 
)

Convert a string (json format) to the setting representation for a string collection.

Template Parameters
ValueTThe value type.
Parameters
strThe json string that represents the object.
defaultValueIn case the string conversion fails, we'll return this default value.
Returns
A pair where first represents whether the conversion succeeded or not, and the second is the converted value.

◆ fromSettingString() [4/4]

template<typename ValueT >
std::pair<bool, ValueT> alexaClientSDK::settings::fromSettingString ( const std::string &  str,
const OtherTypes< ValueT > &  defaultValue 
)

Convert a string (json format) to setting representation for arithmetic types (except (u)int8_t), and classes.

Template Parameters
ValueTThe value type.
Parameters
strThe json string that represents the object.
defaultValueIn case the string conversion fails, we'll return this default value.
Returns
A pair where first represents whether the conversion succeeded or not, and the second is the converted value.
Note
For classes and structs, we assume the operator>> is defined and the failbit should be set in case of failure to convert from string.

◆ getSpeechConfirmationDefault()

SpeechConfirmationSettingType alexaClientSDK::settings::getSpeechConfirmationDefault ( )
inline

Retrieves the default value of speech confirmation

Returns
The default value speech confirmations setting.

◆ getWakeWordConfirmationDefault()

WakeWordConfirmationSettingType alexaClientSDK::settings::getWakeWordConfirmationDefault ( )
inline

Retrieves the default value of wake word confirmation

Returns
The default value wake word confirmations setting.

◆ HTTP_RESPONSE_TIMEOUT()

static const std::chrono::seconds alexaClientSDK::settings::HTTP_RESPONSE_TIMEOUT ( 40  )
static

A timeout for an HTTP response, for cases MessageRequest failed to call its observers upon completion. Hence, the timeout here is longer than MessageRequestHandler activity timeout.

◆ isEnumOrString()

template<typename ValueT >
static constexpr bool alexaClientSDK::settings::isEnumOrString ( )
static

Test whether the type is either an enum type or string.

Template Parameters
ValueTThe value type to be tested.
Returns
true if the given type is string or enum; false otherwise.

◆ isIntegralByteType()

template<typename ValueT >
static constexpr bool alexaClientSDK::settings::isIntegralByteType ( )
static

Test whether the type is int8_t or uint8_t.

Template Parameters
ValueTThe value type to be tested.
Returns
true if the given type is (u)int8_t; false otherwise.

◆ isStringCollection()

template<typename ValueT >
static constexpr bool alexaClientSDK::settings::isStringCollection ( )
static

Test whether the type is a string collection.

Template Parameters
ValueTThe value type to be tested.
Returns
true if the given type is a string set; false otherwise.

◆ operator<<() [1/3]

std::ostream& alexaClientSDK::settings::operator<< ( std::ostream &  stream,
const SpeechConfirmationSettingType value 
)
inline

Write a SpeechConfirmationSettingType value to the given stream.

Parameters
streamThe stream to write the value to.
valueThe value to write to the stream as a string.
Returns
The stream that was passed in and written to.

◆ operator<<() [2/3]

std::ostream& alexaClientSDK::settings::operator<< ( std::ostream &  stream,
const WakeWordConfirmationSettingType value 
)
inline

Write a WakeWordConfirmationSettingType value to the given stream.

Parameters
streamThe stream to write the value to.
valueThe value to write to the stream as a string.
Returns
The stream that was passed in and written to.

◆ operator<<() [3/3]

std::ostream& alexaClientSDK::settings::operator<< ( std::ostream &  stream,
const SettingNotifications value 
)
inline

Write a SettingNotifications value to the given stream.

Parameters
streamThe stream to write the value to.
valueThe value to write to the stream as a string.
Returns
The stream that was passed in and written to.

◆ operator>>() [1/2]

std::istream& alexaClientSDK::settings::operator>> ( std::istream &  is,
SpeechConfirmationSettingType value 
)
inline

Converts an input string stream value to SpeechConfirmationSettingType.

Parameters
streamThe string stream to retrieve the value from.
[out]valueThe value to write to.
Returns
The stream that was passed in.

◆ operator>>() [2/2]

std::istream& alexaClientSDK::settings::operator>> ( std::istream &  is,
WakeWordConfirmationSettingType value 
)
inline

Converts an input string stream value to WakeWordConfirmationSettingType.

Parameters
streamThe string stream to retrieve the value from.
[out]valueThe value to write to.
Returns
The stream that was passed in.

◆ settingStatusToString()

std::string alexaClientSDK::settings::settingStatusToString ( SettingStatus  status)
inline

This function converts the provided SettingStatus to a string.

Parameters
statusThe SettingStatus to convert to a string.
Returns
The string conversion of the SettingStatus.

◆ stringToSettingStatus()

SettingStatus alexaClientSDK::settings::stringToSettingStatus ( const std::string &  statusString)
inline

This function parses a string and converts it to its corresponding SettingStatus.

Parameters
statusStringThe string to be converted to SettingStatus.
Returns
The SettingStatus corresponding to the string provided.

◆ TAG() [1/3]

static const std::string alexaClientSDK::settings::TAG ( "DeviceControlledSettingProtocol"  )
static

String to identify log entries originating from this file.

◆ TAG() [2/3]

static const std::string alexaClientSDK::settings::TAG ( "CloudControlledSettingProtocol"  )
static

String to identify log entries originating from this file.

◆ TAG() [3/3]

static const std::string alexaClientSDK::settings::TAG ( "SettingEventSender"  )
static

String to identify log entries originating from this file.

◆ toSettingString() [1/4]

template<typename ValueT , typename = IntegralByteType<ValueT>>
std::pair<bool, std::string> alexaClientSDK::settings::toSettingString ( const IntegralByteType< ValueT > &  value)

Convert a setting that is either a int8_t or uint8_t to a string (json format) representation.

Template Parameters
ValueTThe value type (either int8_t or uint8_t).
Parameters
valueThe value to be converted.
Returns
A pair where first represents whether the conversion succeeded or not, and the second is the converted string.

◆ toSettingString() [2/4]

template<typename ValueT , typename = EnumOrString<ValueT>>
std::pair<bool, std::string> alexaClientSDK::settings::toSettingString ( const ValueT &  value)

Convert a setting that is either a enum or string to a json format string representation.

Template Parameters
ValueTThe value type.
Parameters
valueThe value to be converted.
Returns
A pair where first represents whether the conversion succeeded or not, and the second is the converted string.
Note
For enums, we assume the operator<< is defined and the failbit should be set in case of failure to convert to string.

◆ toSettingString() [3/4]

template<typename ValueT , StringCollection< ValueT > * = nullptr>
std::pair<bool, std::string> alexaClientSDK::settings::toSettingString ( const StringCollection< ValueT > &  value)

Convert a setting that is a string collection to a json format string representation.

Template Parameters
ValueTThe value type.
Parameters
valueThe value to be converted.
Returns
A pair where first represents whether the conversion succeeded or not, and the second is the converted string.

◆ toSettingString() [4/4]

template<typename ValueT >
std::pair<bool, std::string> alexaClientSDK::settings::toSettingString ( const OtherTypes< ValueT > &  value)

Convert a setting that is either arithmetic types (except (u)int8_t), and classes to a json format representation.

Template Parameters
ValueTThe value type.
Parameters
valueThe value to be converted.
Returns
A pair where first represents whether the conversion succeeded or not, and the second is the converted string.
Note
For classes, we assume the operator<< is defined and the failbit should be set in case of failure to convert to string.

Variable Documentation

◆ DEFAULT_RETRY_TABLE

const std::vector<int> alexaClientSDK::settings::DEFAULT_RETRY_TABLE
static
Initial value:
= {
1000,
2000,
4000,
10000,
30000,
}

Table with the retry times on subsequent retries.

◆ EMPTY_JSON_LIST

const std::string alexaClientSDK::settings::EMPTY_JSON_LIST = "[]"
static

◆ INVALID_VALUE

const std::string alexaClientSDK::settings::INVALID_VALUE = ""
static

Protocol should call apply change with an empty string when no value is found in the database.

◆ m_applyFunction

alexaClientSDK::settings::m_applyFunction {applyValueFn}

◆ m_protocol

alexaClientSDK::settings::m_protocol {std::move(settingProtocol)}

◆ QUOTE

constexpr char alexaClientSDK::settings::QUOTE = '"'

Quote used for json string values.

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