AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
PeripheralEndpointModeControllerHandler.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_PERIPHERALENDPOINTMODECONTROLLERHANDLER_H_
17 #define ACSDK_SAMPLE_PERIPHERALENDPOINT_PERIPHERALENDPOINTMODECONTROLLERHANDLER_H_
18 
19 #include <list>
20 
23 
24 namespace alexaClientSDK {
25 namespace sampleApplications {
26 namespace common {
27 
33 public:
36 
39 
42 
51  static std::shared_ptr<PeripheralEndpointModeControllerHandler> create(
52  const std::string& endpointName,
53  const std::string& instance);
54 
58  override;
59  std::pair<avsCommon::avs::AlexaResponseType, std::string> setMode(
60  const std::string& mode,
62  std::pair<avsCommon::avs::AlexaResponseType, std::string> adjustMode(
63  int modeDelta,
65  std::pair<
68  getMode() override;
69  bool addObserver(
70  std::shared_ptr<avsCommon::sdkInterfaces::modeController::ModeControllerObserverInterface> observer) override;
71  void removeObserver(
72  const std::shared_ptr<avsCommon::sdkInterfaces::modeController::ModeControllerObserverInterface>& observer)
73  override;
75 
81  void setMode(const std::string& mode);
82 
83 private:
90  PeripheralEndpointModeControllerHandler(const std::string& endpointName, const std::string& instance);
91 
93  std::string m_endpointName;
94 
96  std::string m_instance;
97 
99  std::string m_currentMode;
100 
102  std::vector<std::string> m_modes;
103 
105  std::mutex m_mutex;
106 
108  std::list<std::shared_ptr<avsCommon::sdkInterfaces::modeController::ModeControllerObserverInterface>> m_observers;
109 };
110 
111 } // namespace common
112 } // namespace sampleApplications
113 } // namespace alexaClientSDK
114 
115 #endif // ACSDK_SAMPLE_PERIPHERALENDPOINT_PERIPHERALENDPOINTMODECONTROLLERHANDLER_H_
static std::shared_ptr< PeripheralEndpointModeControllerHandler > create(const std::string &endpointName, const std::string &instance)
AlexaResponseType
Definition: AlexaResponseType.h:30
std::pair< avsCommon::avs::AlexaResponseType, std::string > setMode(const std::string &mode, avsCommon::sdkInterfaces::AlexaStateChangeCauseType cause) override
::std::string string
Definition: gtest-port.h:1097
std::pair< avsCommon::avs::AlexaResponseType, avsCommon::utils::Optional< avsCommon::sdkInterfaces::modeController::ModeControllerInterface::ModeState > > getMode() override
AlexaStateChangeCauseType
Definition: AlexaStateChangeCauseType.h:28
std::vector< std::string > ModeControllerConfiguration
Definition: ModeControllerInterface.h:51
void removeObserver(const std::shared_ptr< avsCommon::sdkInterfaces::modeController::ModeControllerObserverInterface > &observer) override
bool addObserver(std::shared_ptr< avsCommon::sdkInterfaces::modeController::ModeControllerObserverInterface > observer) override
static const std::string MODE_CONTROLLER_MODE_GREEN
The mode &#39;Green&#39; of the controller.
Definition: PeripheralEndpointModeControllerHandler.h:38
avsCommon::sdkInterfaces::modeController::ModeControllerInterface::ModeControllerConfiguration getConfiguration() override
Definition: common.py:1
std::pair< avsCommon::avs::AlexaResponseType, std::string > adjustMode(int modeDelta, avsCommon::sdkInterfaces::AlexaStateChangeCauseType cause) override
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
static const std::string MODE_CONTROLLER_MODE_BLUE
The mode &#39;Blue&#39; of the controller.
Definition: PeripheralEndpointModeControllerHandler.h:41
Definition: PeripheralEndpointModeControllerHandler.h:31
static const std::string MODE_CONTROLLER_MODE_RED
The mode &#39;Red&#39; of the controller.
Definition: PeripheralEndpointModeControllerHandler.h:35

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