AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
PeripheralEndpointPowerControllerHandler.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_PERIPHERALENDPOINTPOWERCONTROLLERHANDLER_H_
17 #define ACSDK_SAMPLE_PERIPHERALENDPOINT_PERIPHERALENDPOINTPOWERCONTROLLERHANDLER_H_
18 
19 #include <list>
20 
23 
24 namespace alexaClientSDK {
25 namespace sampleApplications {
26 namespace common {
27 
33 public:
40  static std::shared_ptr<PeripheralEndpointPowerControllerHandler> create(const std::string& endpointName);
41 
44  std::pair<avsCommon::avs::AlexaResponseType, std::string> setPowerState(
45  bool state,
47  std::pair<
50  getPowerState() override;
51  bool addObserver(
52  std::shared_ptr<avsCommon::sdkInterfaces::powerController::PowerControllerObserverInterface> observer) override;
53  void removeObserver(
54  const std::shared_ptr<avsCommon::sdkInterfaces::powerController::PowerControllerObserverInterface>& observer)
55  override;
57 
63  void setPowerState(bool powerState);
64 
65 private:
71 
73  std::string m_endpointName;
74 
76  bool m_currentPowerState;
77 
79  std::mutex m_mutex;
80 
82  std::list<std::shared_ptr<avsCommon::sdkInterfaces::powerController::PowerControllerObserverInterface>> m_observers;
83 };
84 
85 } // namespace common
86 } // namespace sampleApplications
87 } // namespace alexaClientSDK
88 
89 #endif // ACSDK_SAMPLE_PERIPHERALENDPOINT_PERIPHERALENDPOINTPOWERCONTROLLERHANDLER_H_
static std::shared_ptr< PeripheralEndpointPowerControllerHandler > create(const std::string &endpointName)
AlexaResponseType
Definition: AlexaResponseType.h:30
::std::string string
Definition: gtest-port.h:1097
AlexaStateChangeCauseType
Definition: AlexaStateChangeCauseType.h:28
bool addObserver(std::shared_ptr< avsCommon::sdkInterfaces::powerController::PowerControllerObserverInterface > observer) override
void removeObserver(const std::shared_ptr< avsCommon::sdkInterfaces::powerController::PowerControllerObserverInterface > &observer) override
std::pair< avsCommon::avs::AlexaResponseType, std::string > setPowerState(bool state, avsCommon::sdkInterfaces::AlexaStateChangeCauseType cause) override
Definition: PeripheralEndpointPowerControllerHandler.h:31
Definition: common.py:1
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
std::pair< avsCommon::avs::AlexaResponseType, avsCommon::utils::Optional< avsCommon::sdkInterfaces::powerController::PowerControllerInterface::PowerState > > getPowerState() 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