AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
EndpointFocusAdapter.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_ENDPOINTFOCUSADAPTER_H_
17 #define ACSDK_SAMPLE_ENDPOINT_ENDPOINTFOCUSADAPTER_H_
18 
19 #include <functional>
20 #include <memory>
21 #include <string>
22 
28 
29 namespace alexaClientSDK {
30 namespace sampleApplications {
31 namespace common {
32 
38  , public std::enable_shared_from_this<EndpointFocusAdapter> {
39 public:
40  using FocusAcquiredCallback = std::function<void(void)>;
50  static std::shared_ptr<EndpointFocusAdapter> create(
51  std::shared_ptr<avsCommon::sdkInterfaces::FocusManagerInterface> focusManager,
52  std::shared_ptr<presentationOrchestratorInterfaces::PresentationOrchestratorInterface> presentationOrchestrator,
53  std::shared_ptr<presentationOrchestratorInterfaces::PresentationOrchestratorStateTrackerInterface>
54  presentationOrchestratorStateTracker);
55 
59  virtual ~EndpointFocusAdapter() = default;
60 
65 
72  void acquireFocus(const std::string& interfaceName, FocusAcquiredCallback callback);
73 
74 private:
84  std::shared_ptr<avsCommon::sdkInterfaces::FocusManagerInterface> focusManager,
85  std::shared_ptr<presentationOrchestratorInterfaces::PresentationOrchestratorInterface> presentationOrchestrator,
86  std::shared_ptr<presentationOrchestratorInterfaces::PresentationOrchestratorStateTrackerInterface>
87  presentationOrchestratorStateTracker);
88 
92  void executeAcquireContentChannel();
93 
97  void executeReleaseContentChannel();
98 
102  void executeAcquireWindow();
103 
107  void executeReleaseWindow();
108 
112  struct FocusAcquireInterfaceAndCallback {
119  FocusAcquireInterfaceAndCallback(std::string interfaceName, FocusAcquiredCallback callback) :
120  interfaceName{std::move(interfaceName)},
121  callback(callback) {
122  }
123 
125  std::string interfaceName;
126 
128  FocusAcquiredCallback callback;
129  };
130 
132  using FocusAcquireInterfaceAndCallbackPtr = std::shared_ptr<FocusAcquireInterfaceAndCallback>;
133 
135  std::shared_ptr<avsCommon::sdkInterfaces::FocusManagerInterface> m_focusManager;
136 
138  std::shared_ptr<presentationOrchestratorInterfaces::PresentationOrchestratorInterface> m_presentationOrchestrator;
139 
141  std::shared_ptr<presentationOrchestratorInterfaces::PresentationOrchestratorStateTrackerInterface>
142  m_presentationOrchestratorStateTracker;
143 
145  FocusAcquireInterfaceAndCallbackPtr m_focusAcquirePtr;
146 
148  std::shared_ptr<avsCommon::utils::threading::Executor> m_executor;
149 };
150 
151 } // namespace common
152 } // namespace sampleApplications
153 } // namespace alexaClientSDK
154 
155 #endif // ACSDK_SAMPLE_ENDPOINT_ENDPOINTFOCUSADAPTER_H_
MixingBehavior
Definition: MixingBehavior.h:25
std::function< void(void)> FocusAcquiredCallback
Definition: EndpointFocusAdapter.h:40
::std::string string
Definition: gtest-port.h:1097
void onFocusChanged(avsCommon::avs::FocusState focusState, avsCommon::avs::MixingBehavior behavior) override
FocusState
Definition: FocusState.h:29
void acquireFocus(const std::string &interfaceName, FocusAcquiredCallback callback)
Definition: common.py:1
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
static std::shared_ptr< EndpointFocusAdapter > create(std::shared_ptr< avsCommon::sdkInterfaces::FocusManagerInterface > focusManager, std::shared_ptr< presentationOrchestratorInterfaces::PresentationOrchestratorInterface > presentationOrchestrator, std::shared_ptr< presentationOrchestratorInterfaces::PresentationOrchestratorStateTrackerInterface > presentationOrchestratorStateTracker)
const T & move(const T &t)
Definition: gtest-port.h:1317

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