AlexaClientSDK  3.0.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 ACSDK_SAMPLE_ENDPOINT_DEFAULTENDPOINT_DEFAULTENDPOINTTOGGLECONTROLLERHANDLER_H_
17 #define ACSDK_SAMPLE_ENDPOINT_DEFAULTENDPOINT_DEFAULTENDPOINTTOGGLECONTROLLERHANDLER_H_
18 
19 #include <list>
20 
23 
24 namespace alexaClientSDK {
25 namespace sampleApplications {
26 namespace common {
27 
34 public:
41  static std::shared_ptr<DefaultEndpointToggleControllerHandler> create(const std::string& instance);
42 
45  std::pair<avsCommon::avs::AlexaResponseType, std::string> setToggleState(
46  bool state,
48  std::pair<
51  getToggleState() override;
52  bool addObserver(std::shared_ptr<avsCommon::sdkInterfaces::toggleController::ToggleControllerObserverInterface>
53  observer) override;
54  void removeObserver(
55  const std::shared_ptr<avsCommon::sdkInterfaces::toggleController::ToggleControllerObserverInterface>& observer)
56  override;
58 
59 private:
66 
68  std::string m_instance;
69 
71  bool m_currentToggleState;
72 
74  std::mutex m_mutex;
75 
77  std::list<std::shared_ptr<avsCommon::sdkInterfaces::toggleController::ToggleControllerObserverInterface>>
78  m_observers;
79 };
80 
81 } // namespace common
82 } // namespace sampleApplications
83 } // namespace alexaClientSDK
84 
85 #endif // ACSDK_SAMPLE_ENDPOINT_DEFAULTENDPOINT_DEFAULTENDPOINTTOGGLECONTROLLERHANDLER_H_
bool addObserver(std::shared_ptr< avsCommon::sdkInterfaces::toggleController::ToggleControllerObserverInterface > observer) override
static std::shared_ptr< DefaultEndpointToggleControllerHandler > create(const std::string &instance)
AlexaResponseType
Definition: AlexaResponseType.h:30
Definition: DefaultEndpointToggleControllerHandler.h:32
::std::string string
Definition: gtest-port.h:1097
AlexaStateChangeCauseType
Definition: AlexaStateChangeCauseType.h:28
std::pair< avsCommon::avs::AlexaResponseType, avsCommon::utils::Optional< avsCommon::sdkInterfaces::toggleController::ToggleControllerInterface::ToggleState > > getToggleState() override
std::pair< avsCommon::avs::AlexaResponseType, std::string > setToggleState(bool state, avsCommon::sdkInterfaces::AlexaStateChangeCauseType cause) override
void removeObserver(const std::shared_ptr< avsCommon::sdkInterfaces::toggleController::ToggleControllerObserverInterface > &observer) override
Definition: common.py:1
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.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