AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
PowerControllerCapabilityAgent.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_CAPABILITYAGENTS_POWERCONTROLLER_INCLUDE_POWERCONTROLLER_POWERCONTROLLERCAPABILITYAGENT_H_
17 #define ALEXA_CLIENT_SDK_CAPABILITYAGENTS_POWERCONTROLLER_INCLUDE_POWERCONTROLLER_POWERCONTROLLERCAPABILITYAGENT_H_
18 
29 
30 namespace alexaClientSDK {
31 namespace capabilityAgents {
32 namespace powerController {
33 
44  , public std::enable_shared_from_this<PowerControllerCapabilityAgent> {
45 public:
49 
64  static std::shared_ptr<PowerControllerCapabilityAgent> create(
65  const EndpointIdentifier& endpointId,
66  std::shared_ptr<avsCommon::sdkInterfaces::powerController::PowerControllerInterface> powerController,
67  std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> contextManager,
68  std::shared_ptr<avsCommon::sdkInterfaces::AlexaInterfaceMessageSenderInterface> responseSender,
69  std::shared_ptr<avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface> exceptionSender,
70  bool isProactivelyReported,
71  bool isRetrievable);
72 
75  void handleDirectiveImmediately(std::shared_ptr<avsCommon::avs::AVSDirective> directive) override;
76  void preHandleDirective(std::shared_ptr<DirectiveInfo> info) override;
77  void handleDirective(std::shared_ptr<DirectiveInfo> info) override;
78  void cancelDirective(std::shared_ptr<DirectiveInfo> info) override;
81 
84  void provideState(
85  const avsCommon::avs::CapabilityTag& stateProviderName,
86  const avsCommon::sdkInterfaces::ContextRequestToken contextRequestToken) override;
87  bool canStateBeRetrieved() override;
88  bool hasReportableStateProperties() override;
90 
97 
101  override;
103 
104 private:
119  const EndpointIdentifier& endpointId,
120  std::shared_ptr<avsCommon::sdkInterfaces::powerController::PowerControllerInterface> powerController,
121  std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> contextManager,
122  std::shared_ptr<avsCommon::sdkInterfaces::AlexaInterfaceMessageSenderInterface> responseSender,
123  std::shared_ptr<avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface> exceptionSender,
124  bool isProactivelyReported,
125  bool isRetrievable);
126 
127  // @name RequiresShutdown Functions
129  void doShutdown() override;
131 
135  bool initialize();
136 
142  void removeDirective(std::shared_ptr<DirectiveInfo> info);
143 
149  void executeSetHandlingCompleted(std::shared_ptr<DirectiveInfo> info);
150 
157  void executeUnknownDirective(std::shared_ptr<DirectiveInfo> info, avsCommon::avs::ExceptionErrorType type);
158 
165  void executeProvideState(
166  const avsCommon::avs::CapabilityTag& stateProviderName,
167  const avsCommon::sdkInterfaces::ContextRequestToken contextRequestToken);
168 
176  void executeSendResponseEvent(
177  const std::shared_ptr<avsCommon::avs::CapabilityAgent::DirectiveInfo> info,
178  const std::pair<avsCommon::avs::AlexaResponseType, std::string> result);
179 
185  avsCommon::avs::CapabilityState buildCapabilityState(const PowerState& powerState);
186 
188  EndpointIdentifier m_endpointId;
189 
191  bool m_isProactivelyReported;
192 
194  bool m_isRetrievable;
195 
197  std::shared_ptr<avsCommon::sdkInterfaces::powerController::PowerControllerInterface> m_powerController;
198 
200  std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> m_contextManager;
201 
203  std::shared_ptr<avsCommon::sdkInterfaces::AlexaInterfaceMessageSenderInterface> m_responseSender;
204 
207 };
208 
209 } // namespace powerController
210 } // namespace capabilityAgents
211 } // namespace alexaClientSDK
212 
213 #endif // ALEXA_CLIENT_SDK_CAPABILITYAGENTS_POWERCONTROLLER_INCLUDE_POWERCONTROLLER_POWERCONTROLLERCAPABILITYAGENT_H_
Definition: CapabilityAgent.h:47
void cancelDirective(std::shared_ptr< DirectiveInfo > info) override
Definition: CapabilityTag.h:32
static std::shared_ptr< PowerControllerCapabilityAgent > create(const EndpointIdentifier &endpointId, std::shared_ptr< avsCommon::sdkInterfaces::powerController::PowerControllerInterface > powerController, std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface > contextManager, std::shared_ptr< avsCommon::sdkInterfaces::AlexaInterfaceMessageSenderInterface > responseSender, std::shared_ptr< avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface > exceptionSender, bool isProactivelyReported, bool isRetrievable)
Single-thread executor implementation.
Definition: Executor.h:45
void provideState(const avsCommon::avs::CapabilityTag &stateProviderName, const avsCommon::sdkInterfaces::ContextRequestToken contextRequestToken) override
void handleDirectiveImmediately(std::shared_ptr< avsCommon::avs::AVSDirective > directive) override
unsigned int ContextRequestToken
Alias for the token used to identify a context request.
Definition: ContextRequestToken.h:23
ExceptionErrorType
Definition: ExceptionErrorType.h:28
AlexaStateChangeCauseType
Definition: AlexaStateChangeCauseType.h:28
avsCommon::sdkInterfaces::endpoints::EndpointIdentifier EndpointIdentifier
Alias to improve readability.
Definition: PowerControllerCapabilityAgent.h:47
void handleDirective(std::shared_ptr< DirectiveInfo > info) override
void onPowerStateChanged(const PowerState &powerState, avsCommon::sdkInterfaces::AlexaStateChangeCauseType cause) override
avsCommon::sdkInterfaces::powerController::PowerControllerObserverInterface::PowerState PowerState
Definition: PowerControllerInterface.h:39
std::unordered_map< directiveRoutingRule::DirectiveRoutingRule, BlockingPolicy > DirectiveHandlerConfiguration
Definition: DirectiveHandlerConfiguration.h:32
Definition: CapabilityState.h:31
void preHandleDirective(std::shared_ptr< DirectiveInfo > info) override
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
type
Definition: upload.py:443
avsCommon::avs::DirectiveHandlerConfiguration getConfiguration() const override
std::string EndpointIdentifier
Definition: EndpointIdentifier.h:38
Definition: CapabilityConfiguration.h:42

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