![]() |
AlexaClientSDK
3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <SharedAVSSettingProtocol.h>
Public Member Functions | |
void | connectionStatusChangeCallback (bool isConnected) |
~SharedAVSSettingProtocol () | |
SettingProtocolInterface methods. | |
SetSettingResult | localChange (ApplyChangeFunction applyChange, RevertChangeFunction revertChange, SettingNotificationFunction notifyObservers) override |
bool | avsChange (ApplyChangeFunction applyChange, RevertChangeFunction revertChange, SettingNotificationFunction notifyObservers) override |
bool | restoreValue (ApplyDbChangeFunction applyChange, SettingNotificationFunction notifyObservers) override |
bool | clearData () override |
![]() | |
virtual | ~SettingProtocolInterface ()=default |
Static Public Member Functions | |
static std::unique_ptr< SharedAVSSettingProtocol > | create (const SettingEventMetadata &metadata, std::shared_ptr< SettingEventSenderInterface > eventSender, std::shared_ptr< storage::DeviceSettingStorageInterface > settingStorage, std::shared_ptr< avsCommon::sdkInterfaces::AVSConnectionManagerInterface > connectionManager, const std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > &metricRecorder, bool isDefaultCloudAuthoritative=false) |
Additional Inherited Members | |
![]() | |
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()> |
Implement the logic of shared setting protocol. In the shared setting protocol, a change to the setting value can be originated by an AVS or device UI request.
alexaClientSDK::settings::SharedAVSSettingProtocol::~SharedAVSSettingProtocol | ( | ) |
Destructor. Deregisters from connection notifications.
|
overridevirtual |
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. Implements alexaClientSDK::settings::SettingProtocolInterface.
|
overridevirtual |
Clear the data for this setting.
true
if it data is cleared; otherwise. Implements alexaClientSDK::settings::SettingProtocolInterface.
void alexaClientSDK::settings::SharedAVSSettingProtocol::connectionStatusChangeCallback | ( | bool | isConnected | ) |
The callback method to be called whenever there is a change in connection status.
isConnected | If true, indicates that the device is connected to AVS, otherwise false. |
|
static |
Create a shared protocol object.
metadata | The setting metadata used to generate a unique database key. |
eventSender | Object used to send events to avs in order to report changes to the device. |
settingStorage | The setting storage object. |
connectionManager | An AVSConnectionManagerInterface instance to listen for connection status updates. |
metricRecorder | The MetricRecorderInterface to record metrics. |
isDefaultCloudAuthoritative | Indicates if the default value for the setting should be cloud authoritative or not. If it is, for the first time when the setting is created, the default value of the setting will be sent to AVS using a report event. If it is not cloud authoritative, then the default value of the setting will be sent to AVS using a changed event. |
SharedAVSSettingProtocol
object if it succeeds; nullptr
otherwise.
|
overridevirtual |
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. |
Implements alexaClientSDK::settings::SettingProtocolInterface.
|
overridevirtual |
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. Implements alexaClientSDK::settings::SettingProtocolInterface.
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0