AlexaClientSDK
3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <SettingProtocolInterface.h>
Public Types | |
using | ApplyChangeFunction = std::function< std::pair< bool, std::string >()> |
using | ApplyDbChangeFunction = std::function< std::pair< bool, std::string >(const std::string &dbValue)> |
using | SettingNotificationFunction = std::function< void(SettingNotifications notification)> |
using | RevertChangeFunction = std::function< std::string()> |
Public Member Functions | |
virtual SetSettingResult | localChange (ApplyChangeFunction applyChange, RevertChangeFunction revertChange, SettingNotificationFunction notifyObservers)=0 |
virtual bool | avsChange (ApplyChangeFunction applyChange, RevertChangeFunction revertChange, SettingNotificationFunction notifyObservers)=0 |
virtual bool | restoreValue (ApplyDbChangeFunction applyChange, SettingNotificationFunction notifyObservers)=0 |
virtual bool | clearData ()=0 |
virtual | ~SettingProtocolInterface ()=default |
Interface for the multiple setting management protocols.
The setting protocol should ensure that events are sent to AVS as expected and the setting value is persisted. The setting protocol also MUST only execute one request at a time.
using alexaClientSDK::settings::SettingProtocolInterface::ApplyChangeFunction = std::function<std::pair<bool, std::string>()> |
Callback function type used for applying new values.
using alexaClientSDK::settings::SettingProtocolInterface::ApplyDbChangeFunction = std::function<std::pair<bool, std::string>(const std::string& dbValue)> |
Callback function type used for applying value retrieved from the database.
dbValue | A string representation of the value retrieved from the database. An empty string will be used to indicate that no value was found in the database. |
using alexaClientSDK::settings::SettingProtocolInterface::RevertChangeFunction = std::function<std::string()> |
Callback function type used to revert the last value change.
using alexaClientSDK::settings::SettingProtocolInterface::SettingNotificationFunction = std::function<void(SettingNotifications notification)> |
Callback function type used to notify observers of whether the request succeeded or failed.
notification | The operation result. |
|
virtualdefault |
Destructor.
|
pure virtual |
Implements the protocol for changing a setting value triggered by an AVS directive.
applyChange | Function that can be used to apply the new value. |
revertChange | Function that can be used to revert the change. This function should only be called if the apply change succeeded but some other part of the protocol has failed. |
notifyObservers | Function used to notify the observers of the protocol result. |
true
if the directive was enqueued correctly; false
otherwise. Implemented in alexaClientSDK::settings::SharedAVSSettingProtocol, alexaClientSDK::settings::CloudControlledSettingProtocol, alexaClientSDK::capabilityAgents::doNotDisturb::DNDSettingProtocol, alexaClientSDK::settings::DeviceControlledSettingProtocol, and alexaClientSDK::settings::test::MockSettingProtocol.
|
pure virtual |
Clear the data for this setting.
true
if it data is cleared; otherwise. Implemented in alexaClientSDK::settings::SharedAVSSettingProtocol, alexaClientSDK::settings::CloudControlledSettingProtocol, alexaClientSDK::capabilityAgents::doNotDisturb::DNDSettingProtocol, alexaClientSDK::settings::DeviceControlledSettingProtocol, and alexaClientSDK::settings::test::MockSettingProtocol.
|
pure virtual |
Implements the protocol for changing a setting value through local UI.
applyChange | Function that can be used to apply the new value. |
revertChange | Function that can be used to revert the change. This function should only be called if the apply change succeeded but some other part of the protocol has failed. |
notifyObservers | Function used to notify the observers of the protocol result. |
Implemented in alexaClientSDK::settings::SharedAVSSettingProtocol, alexaClientSDK::settings::CloudControlledSettingProtocol, alexaClientSDK::capabilityAgents::doNotDisturb::DNDSettingProtocol, alexaClientSDK::settings::DeviceControlledSettingProtocol, and alexaClientSDK::settings::test::MockSettingProtocol.
|
pure virtual |
Implements the protocol for restoring a value from the storage.
applyChange | Function that can be used to apply the value restored from the storage. This function will be called with empty string if no value was found in the database. |
notifyObservers | Function used to notify the observers of the protocol result. |
true
if the directive was enqueued correctly; false
otherwise. Implemented in alexaClientSDK::settings::SharedAVSSettingProtocol, alexaClientSDK::settings::CloudControlledSettingProtocol, alexaClientSDK::capabilityAgents::doNotDisturb::DNDSettingProtocol, alexaClientSDK::settings::DeviceControlledSettingProtocol, and alexaClientSDK::settings::test::MockSettingProtocol.
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0