AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
DefaultEndpointToggleControllerHandler.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_SAMPLEAPP_INCLUDE_SAMPLEAPP_DEFAULTENDPOINT_DEFAULTENDPOINTTOGGLECONTROLLERHANDLER_H_
17 #define ALEXA_CLIENT_SDK_SAMPLEAPP_INCLUDE_SAMPLEAPP_DEFAULTENDPOINT_DEFAULTENDPOINTTOGGLECONTROLLERHANDLER_H_
18 
19 #include <list>
20 
23 
24 namespace alexaClientSDK {
25 namespace sampleApp {
26 
33 public:
40  static std::shared_ptr<DefaultEndpointToggleControllerHandler> create(const std::string& instance);
41 
44  std::pair<avsCommon::avs::AlexaResponseType, std::string> setToggleState(
45  bool state,
47  std::pair<
50  getToggleState() override;
51  bool addObserver(std::shared_ptr<avsCommon::sdkInterfaces::toggleController::ToggleControllerObserverInterface>
52  observer) override;
53  void removeObserver(
54  const std::shared_ptr<avsCommon::sdkInterfaces::toggleController::ToggleControllerObserverInterface>& observer)
55  override;
57 
58 private:
64  DefaultEndpointToggleControllerHandler(const std::string& instance);
65 
67  std::string m_instance;
68 
70  bool m_currentToggleState;
71 
73  std::mutex m_mutex;
74 
76  std::list<std::shared_ptr<avsCommon::sdkInterfaces::toggleController::ToggleControllerObserverInterface>>
77  m_observers;
78 };
79 
80 } // namespace sampleApp
81 } // namespace alexaClientSDK
82 
83 #endif // ALEXA_CLIENT_SDK_SAMPLEAPP_INCLUDE_SAMPLEAPP_DEFAULTENDPOINT_DEFAULTENDPOINTTOGGLECONTROLLERHANDLER_H_
alexaClientSDK::sampleApp::DefaultEndpointToggleControllerHandler::create
static std::shared_ptr< DefaultEndpointToggleControllerHandler > create(const std::string &instance)
Definition: DefaultEndpointToggleControllerHandler.cpp:59
alexaClientSDK::avsCommon::avs::AlexaResponseType
AlexaResponseType
Definition: AlexaResponseType.h:30
alexaClientSDK::sampleApp::DefaultEndpointToggleControllerHandler::getToggleState
std::pair< avsCommon::avs::AlexaResponseType, avsCommon::utils::Optional< avsCommon::sdkInterfaces::toggleController::ToggleControllerInterface::ToggleState > > getToggleState() override
Definition: DefaultEndpointToggleControllerHandler.cpp:102
alexaClientSDK::avsCommon::sdkInterfaces::AlexaStateChangeCauseType
AlexaStateChangeCauseType
Definition: AlexaStateChangeCauseType.h:28
alexaClientSDK::sampleApp::DefaultEndpointToggleControllerHandler::removeObserver
void removeObserver(const std::shared_ptr< avsCommon::sdkInterfaces::toggleController::ToggleControllerObserverInterface > &observer) override
Definition: DefaultEndpointToggleControllerHandler.cpp:116
alexaClientSDK::sampleApp::DefaultEndpointToggleControllerHandler::addObserver
bool addObserver(std::shared_ptr< avsCommon::sdkInterfaces::toggleController::ToggleControllerObserverInterface > observer) override
Definition: DefaultEndpointToggleControllerHandler.cpp:110
Executor.h
alexaClientSDK::sampleApp::DefaultEndpointToggleControllerHandler::setToggleState
std::pair< avsCommon::avs::AlexaResponseType, std::string > setToggleState(bool state, avsCommon::sdkInterfaces::AlexaStateChangeCauseType cause) override
Definition: DefaultEndpointToggleControllerHandler.cpp:71
alexaClientSDK
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
alexaClientSDK::sampleApp::DefaultEndpointToggleControllerHandler
Definition: DefaultEndpointToggleControllerHandler.h:31
alexaClientSDK::avsCommon::sdkInterfaces::toggleController::ToggleControllerInterface
Definition: ToggleControllerInterface.h:38
ToggleControllerInterface.h
alexaClientSDK::avsCommon::utils::Optional
Definition: Optional.h:32

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