AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
SettingObserverInterface.h
Go to the documentation of this file.
1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0/
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 #ifndef ALEXA_CLIENT_SDK_SETTINGS_INCLUDE_SETTINGS_SETTINGOBSERVERINTERFACE_H_
16 #define ALEXA_CLIENT_SDK_SETTINGS_INCLUDE_SETTINGS_SETTINGOBSERVERINTERFACE_H_
17 
18 #include <functional>
19 #include <memory>
20 #include <ostream>
21 
22 namespace alexaClientSDK {
23 namespace settings {
24 
36  AVS_CHANGE,
45 };
46 
54 inline std::ostream& operator<<(std::ostream& stream, const SettingNotifications& value) {
55  switch (value) {
57  stream << "LOCAL_CHANGE_IN_PROGRESS";
58  return stream;
60  stream << "AVS_CHANGE_IN_PROGRESS";
61  return stream;
63  stream << "LOCAL_CHANGE";
64  return stream;
66  stream << "AVS_CHANGE";
67  return stream;
69  stream << "LOCAL_CHANGE_FAILED";
70  return stream;
72  stream << "AVS_CHANGE_FAILED";
73  return stream;
75  stream << "LOCAL_CHANGE_CANCELLED";
76  return stream;
78  stream << "AVS_CHANGE_CANCELLED";
79  return stream;
80  }
81 
82  stream.setstate(std::ios_base::failbit);
83  return stream;
84 }
85 
91 template <typename SettingT>
93 public:
97  virtual ~SettingObserverInterface() = default;
98 
106  virtual void onSettingNotification(
107  const typename SettingT::ValueType& value,
108  SettingNotifications notification) = 0;
109 
111  friend SettingT;
112 };
113 
114 } // namespace settings
115 } // namespace alexaClientSDK
116 
117 #endif // ALEXA_CLIENT_SDK_SETTINGS_INCLUDE_SETTINGS_SETTINGOBSERVERINTERFACE_H_
friend SettingT
Only objects from SettingT can call the value change notification.
Definition: SettingObserverInterface.h:111
The setting that was changed locally is being applied.
The setting that was changed via cloud is being applied.
Setting value changed due to a local change.
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
SettingNotifications
Definition: SettingObserverInterface.h:28
std::ostream & operator<<(std::ostream &stream, const SettingNotifications &value)
Definition: SettingObserverInterface.h:54
Definition: SettingObserverInterface.h:92
Setting value changed due to a change requested via cloud.

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