AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
PeripheralEndpointToggleControllerHandler.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_PERIPHERALENDPOINT_PERIPHERALENDPOINTTOGGLECONTROLLERHANDLER_H_
17 #define ACSDK_SAMPLE_PERIPHERALENDPOINT_PERIPHERALENDPOINTTOGGLECONTROLLERHANDLER_H_
18 
19 #include <list>
20 
23 
24 namespace alexaClientSDK {
25 namespace sampleApplications {
26 namespace common {
27 
34 public:
43  static std::shared_ptr<PeripheralEndpointToggleControllerHandler> create(
44  const std::string& endpointName,
45  const std::string& instance);
46 
49  std::pair<avsCommon::avs::AlexaResponseType, std::string> setToggleState(
50  bool state,
52  std::pair<
55  getToggleState() override;
56  bool addObserver(std::shared_ptr<avsCommon::sdkInterfaces::toggleController::ToggleControllerObserverInterface>
57  observer) override;
58  void removeObserver(
59  const std::shared_ptr<avsCommon::sdkInterfaces::toggleController::ToggleControllerObserverInterface>& observer)
60  override;
62 
68  void setToggleState(bool toggleState);
69 
70 private:
77  PeripheralEndpointToggleControllerHandler(const std::string& endpointName, const std::string& instance);
78 
80  std::string m_endpointName;
81 
83  std::string m_instance;
84 
86  bool m_currentToggleState;
87 
89  std::mutex m_mutex;
90 
92  std::list<std::shared_ptr<avsCommon::sdkInterfaces::toggleController::ToggleControllerObserverInterface>>
93  m_observers;
94 };
95 
96 } // namespace common
97 } // namespace sampleApplications
98 } // namespace alexaClientSDK
99 
100 #endif // ACSDK_SAMPLE_PERIPHERALENDPOINT_PERIPHERALENDPOINTTOGGLECONTROLLERHANDLER_H_
std::pair< avsCommon::avs::AlexaResponseType, std::string > setToggleState(bool state, avsCommon::sdkInterfaces::AlexaStateChangeCauseType cause) override
AlexaResponseType
Definition: AlexaResponseType.h:30
::std::string string
Definition: gtest-port.h:1097
void removeObserver(const std::shared_ptr< avsCommon::sdkInterfaces::toggleController::ToggleControllerObserverInterface > &observer) override
static std::shared_ptr< PeripheralEndpointToggleControllerHandler > create(const std::string &endpointName, const std::string &instance)
Definition: PeripheralEndpointToggleControllerHandler.h:32
AlexaStateChangeCauseType
Definition: AlexaStateChangeCauseType.h:28
std::pair< avsCommon::avs::AlexaResponseType, avsCommon::utils::Optional< avsCommon::sdkInterfaces::toggleController::ToggleControllerInterface::ToggleState > > getToggleState() override
Definition: common.py:1
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
bool addObserver(std::shared_ptr< avsCommon::sdkInterfaces::toggleController::ToggleControllerObserverInterface > observer) 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