AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
EqualizerCapabilityAgent.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 ACSDKEQUALIZER_EQUALIZERCAPABILITYAGENT_H_
17 #define ACSDKEQUALIZER_EQUALIZERCAPABILITYAGENT_H_
18 
19 #include <memory>
20 #include <mutex>
21 
22 #include <rapidjson/document.h>
23 
36 
41 
42 namespace alexaClientSDK {
43 namespace acsdkEqualizer {
44 
49  : public std::enable_shared_from_this<EqualizerCapabilityAgent>
55 public:
59  ~EqualizerCapabilityAgent() override = default;
60 
73  static std::shared_ptr<EqualizerCapabilityAgent> create(
74  std::shared_ptr<acsdkEqualizer::EqualizerController> equalizerController,
75  std::shared_ptr<avsCommon::sdkInterfaces::CapabilitiesDelegateInterface> capabilitiesDelegate,
76  std::shared_ptr<acsdkEqualizerInterfaces::EqualizerStorageInterface> equalizerStorage,
77  std::shared_ptr<registrationManager::CustomerDataManagerInterface> customerDataManager,
78  std::shared_ptr<avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface> exceptionEncounteredSender,
79  std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> contextManager,
80  std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface> messageSender);
81 
85  void handleDirectiveImmediately(std::shared_ptr<avsCommon::avs::AVSDirective> directive) override;
86  void preHandleDirective(std::shared_ptr<avsCommon::avs::CapabilityAgent::DirectiveInfo> info) override;
87  void handleDirective(std::shared_ptr<avsCommon::avs::CapabilityAgent::DirectiveInfo> info) override;
88  void cancelDirective(std::shared_ptr<avsCommon::avs::CapabilityAgent::DirectiveInfo> info) override;
90 
93  std::unordered_set<std::shared_ptr<avsCommon::avs::CapabilityConfiguration>> getCapabilityConfigurations() override;
95 
96  // @name RequiresShutdown Functions
98  void doShutdown() override;
100 
103  void clearData() override;
105 
110 
115 
116 private:
129  std::shared_ptr<acsdkEqualizer::EqualizerController> equalizerController,
130  std::shared_ptr<avsCommon::sdkInterfaces::CapabilitiesDelegateInterface> capabilitiesDelegate,
131  std::shared_ptr<acsdkEqualizerInterfaces::EqualizerStorageInterface> equalizerStorage,
132  std::shared_ptr<registrationManager::CustomerDataManagerInterface> customerDataManager,
133  std::shared_ptr<avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface> exceptionEncounteredSender,
134  std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> contextManager,
135  std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface> messageSender);
136 
140  void generateCapabilityConfiguration();
141 
150  void fixConfigurationDesynchronization();
151 
160  bool handleSetBandsDirective(
161  std::shared_ptr<avsCommon::avs::CapabilityAgent::DirectiveInfo> info,
162  rapidjson::Document& document);
163 
172  bool handleAdjustBandsDirective(
173  std::shared_ptr<avsCommon::avs::CapabilityAgent::DirectiveInfo> info,
174  rapidjson::Document& document);
175 
184  bool handleResetBandsDirective(
185  std::shared_ptr<avsCommon::avs::CapabilityAgent::DirectiveInfo> info,
186  rapidjson::Document& document);
187 
196  bool handleSetModeDirective(
197  std::shared_ptr<avsCommon::avs::CapabilityAgent::DirectiveInfo> info,
198  rapidjson::Document& document);
199 
201  std::shared_ptr<acsdkEqualizer::EqualizerController> m_equalizerController;
202 
204  std::shared_ptr<avsCommon::sdkInterfaces::CapabilitiesDelegateInterface> m_capabilitiesDelegate;
205 
207  std::shared_ptr<acsdkEqualizerInterfaces::EqualizerStorageInterface> m_equalizerStorage;
208 
210  std::unordered_set<std::shared_ptr<avsCommon::avs::CapabilityConfiguration>> m_capabilityConfigurations;
211 
213  std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface> m_messageSender;
214 
216  std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> m_contextManager;
217 
220 
222  std::mutex m_storageMutex;
223 };
224 
225 } // namespace acsdkEqualizer
226 } // namespace alexaClientSDK
227 
228 #endif // ACSDKEQUALIZER_EQUALIZERCAPABILITYAGENT_H_
Definition: EqualizerCapabilityAgent.h:48
Definition: CapabilityAgent.h:47
void onEqualizerStateChanged(const acsdkEqualizerInterfaces::EqualizerState &state) override
void handleDirectiveImmediately(std::shared_ptr< avsCommon::avs::AVSDirective > directive) override
void handleDirective(std::shared_ptr< avsCommon::avs::CapabilityAgent::DirectiveInfo > info) override
static std::shared_ptr< EqualizerCapabilityAgent > create(std::shared_ptr< acsdkEqualizer::EqualizerController > equalizerController, std::shared_ptr< avsCommon::sdkInterfaces::CapabilitiesDelegateInterface > capabilitiesDelegate, std::shared_ptr< acsdkEqualizerInterfaces::EqualizerStorageInterface > equalizerStorage, std::shared_ptr< registrationManager::CustomerDataManagerInterface > customerDataManager, std::shared_ptr< avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface > exceptionEncounteredSender, std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface > contextManager, std::shared_ptr< avsCommon::sdkInterfaces::MessageSenderInterface > messageSender)
void preHandleDirective(std::shared_ptr< avsCommon::avs::CapabilityAgent::DirectiveInfo > info) override
Single-thread executor implementation.
Definition: Executor.h:45
void onEqualizerSameStateChanged(const acsdkEqualizerInterfaces::EqualizerState &state) override
Definition: EqualizerControllerListenerInterface.h:27
std::unordered_map< directiveRoutingRule::DirectiveRoutingRule, BlockingPolicy > DirectiveHandlerConfiguration
Definition: DirectiveHandlerConfiguration.h:32
std::unordered_set< std::shared_ptr< avsCommon::avs::CapabilityConfiguration > > getCapabilityConfigurations() override
void cancelDirective(std::shared_ptr< avsCommon::avs::CapabilityAgent::DirectiveInfo > info) override
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
avsCommon::avs::DirectiveHandlerConfiguration getConfiguration() const override

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