AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
DevicePropertyAggregator.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 
16 #ifndef ALEXA_CLIENT_SDK_DIAGNOSTICS_INCLUDE_DIAGNOSTICS_DEVICEPROPERTYAGGREGATOR_H_
17 #define ALEXA_CLIENT_SDK_DIAGNOSTICS_INCLUDE_DIAGNOSTICS_DEVICEPROPERTYAGGREGATOR_H_
18 
19 #include <condition_variable>
20 #include <memory>
21 #include <mutex>
22 #include <string>
23 #include <unordered_map>
24 
29 
30 namespace alexaClientSDK {
31 namespace diagnostics {
32 
38  , public std::enable_shared_from_this<DevicePropertyAggregator> {
39 public:
45  static std::shared_ptr<DevicePropertyAggregator> create();
46 
50  std::unordered_map<std::string, std::string> getAllDeviceProperties() override;
51  void setContextManager(std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> contextManager) override;
52  void setDeviceSettingsManager(std::shared_ptr<settings::DeviceSettingsManager> settingManager) override;
53  void initializeVolume(std::shared_ptr<avsCommon::sdkInterfaces::SpeakerManagerInterface> speakerManager) override;
55 
58  void onAlertStateChange(const AlertObserverInterface::AlertInfo& alertInfo) override;
60 
63  virtual void onAuthStateChange(AuthObserverInterface::State newState, AuthObserverInterface::Error error) override;
65 
68  void onPlayerActivityChanged(avsCommon::avs::PlayerActivity state, const Context& context) override;
70 
73  void onConnectionStatusChanged(const Status status, const ChangedReason reason) override;
75 
78  void onContextAvailable(const std::string& jsonContext) override;
81 
85  void onNotificationReceived() override;
87 
91  const Source& source,
95 
98  void onDialogUXStateChanged(DialogUXState newState) override;
100 
103  void onRangeChanged(
107 
110  void onPowerStateChanged(
114 
115 private:
120 
126  avsCommon::utils::Optional<std::string> getDeviceContextJson();
132  avsCommon::utils::Optional<std::string> getDeviceSetting(const std::string& propertyKey);
137  std::unordered_map<std::string, std::string> getSyncDeviceProperties();
138 
143  void initializeAsyncPropertyMap();
144 
152  void updateSpeakerSettingsInPropertyMap(
155 
158 
160  std::unordered_map<std::string, std::string> m_asyncPropertyMap;
161 
163  std::mutex m_deviceContextMutex;
164 
167 
169  std::condition_variable m_contextWakeTrigger;
170 
172  std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> m_contextManager;
173 
175  std::shared_ptr<settings::DeviceSettingsManager> m_deviceSettingsManager;
176 };
177 
178 } // namespace diagnostics
179 } // namespace alexaClientSDK
180 
181 #endif // ALEXA_CLIENT_SDK_DIAGNOSTICS_INCLUDE_DIAGNOSTICS_DEVICEPROPERTYAGGREGATOR_H_
void onSetIndicator(avsCommon::avs::IndicatorState state) override
void onSpeakerSettingsChanged(const Source &source, const avsCommon::sdkInterfaces::ChannelVolumeInterface::Type &type, const avsCommon::sdkInterfaces::SpeakerInterface::SpeakerSettings &settings) override
ChangedReason
Definition: ConnectionStatusObserverInterface.h:50
void onAlertStateChange(const AlertObserverInterface::AlertInfo &alertInfo) override
::std::string string
Definition: gtest-port.h:1097
ContextRequestError
Definition: ContextRequesterInterface.h:40
Single-thread executor implementation.
Definition: Executor.h:45
void setContextManager(std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface > contextManager) override
void onRangeChanged(const avsCommon::sdkInterfaces::rangeController::RangeControllerObserverInterface::RangeState &rangeState, avsCommon::sdkInterfaces::AlexaStateChangeCauseType cause) override
The context of the AudioPlayer when the observer is notified of the PlayerActivity state change...
Definition: AudioPlayerObserverInterface.h:39
AlexaStateChangeCauseType
Definition: AlexaStateChangeCauseType.h:28
void onPlayerActivityChanged(avsCommon::avs::PlayerActivity state, const Context &context) override
void initializeVolume(std::shared_ptr< avsCommon::sdkInterfaces::SpeakerManagerInterface > speakerManager) override
DialogUXState
The different dialog specific AVS UX states.
Definition: DialogUXStateObserverInterface.h:32
avsCommon::utils::Optional< std::string > getDeviceProperty(const std::string &propertyKey) override
void onDialogUXStateChanged(DialogUXState newState) override
void onContextAvailable(const std::string &jsonContext) override
void setDeviceSettingsManager(std::shared_ptr< settings::DeviceSettingsManager > settingManager) override
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
std::unordered_map< std::string, std::string > getAllDeviceProperties() override
IndicatorState
Definition: IndicatorState.h:30
type
Definition: upload.py:443
Definition: DevicePropertyAggregator.h:36
static std::shared_ptr< DevicePropertyAggregator > create()
Source
Indicates whether the source of the call is from an AVS Directive or through a Local API call...
Definition: SpeakerManagerObserverInterface.h:35
void onConnectionStatusChanged(const Status status, const ChangedReason reason) override
virtual void onAuthStateChange(AuthObserverInterface::State newState, AuthObserverInterface::Error error) override
void onContextFailure(const avsCommon::sdkInterfaces::ContextRequestError error) override
PlayerActivity
Identifies the player state.
Definition: PlayerActivity.h:27
void onPowerStateChanged(const avsCommon::sdkInterfaces::powerController::PowerControllerObserverInterface::PowerState &powerState, avsCommon::sdkInterfaces::AlexaStateChangeCauseType cause) override
Status
Definition: ConnectionStatusObserverInterface.h:36

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