AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
LiveViewControllerPresentationAdapter.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 ALEXA_CLIENT_SDK_LIBIPCSERVERSAMPLEAPP_INCLUDE_IPCSERVERSAMPLEAPP_LIVEVIEWCONTROLLER_LIVEVIEWCONTROLLERPRESENTATIONADAPTER_H_
17 #define ALEXA_CLIENT_SDK_LIBIPCSERVERSAMPLEAPP_INCLUDE_IPCSERVERSAMPLEAPP_LIVEVIEWCONTROLLER_LIVEVIEWCONTROLLERPRESENTATIONADAPTER_H_
18 
19 #include <memory>
20 #include <string>
21 #include <unordered_set>
22 #include <utility>
23 
24 #include <rapidjson/document.h>
25 #include <rapidjson/writer.h>
26 
34 #include <AIP/ASRProfile.h>
43 
44 namespace alexaClientSDK {
45 namespace sampleApplications {
46 namespace ipcServerSampleApp {
47 namespace liveViewController {
48 
59  , public std::enable_shared_from_this<LiveViewControllerPresentationAdapter> {
60 public:
69  static std::shared_ptr<LiveViewControllerPresentationAdapter> create(
70  const std::shared_ptr<ipc::IPCHandlerRegistrationInterface>& ipcHandlerRegistrar,
71  const std::shared_ptr<AplClientBridge>& aplClientBridge);
72 
77  std::shared_ptr<presentationOrchestratorInterfaces::PresentationInterface> presentation) override;
83 
86  void cameraMicrophoneStateChanged(const std::string& message) override;
87  void cameraFirstFrameRendered(const std::string& message) override;
88  void windowIdReport(const std::string& message) override;
90 
93  LiveViewControllerInterface::Response start(
94  std::unique_ptr<LiveViewControllerInterface::StartLiveViewRequest> request) override;
95  LiveViewControllerInterface::Response stop() override;
96  LiveViewControllerInterface::Response setCameraState(
99  bool addObserver(
100  std::weak_ptr<alexaLiveViewControllerInterfaces::LiveViewControllerObserverInterface> observer) override;
101  void removeObserver(
102  std::weak_ptr<alexaLiveViewControllerInterfaces::LiveViewControllerObserverInterface> observer) override;
104 
107  void handleCameraExitRequest() override;
108  void handleChangeCameraMicStateRequest(bool micOn) override;
110 
113  void onStateChanged(State state) override;
114  void onASRProfileChanged(const std::string& profile) override;
116 
119  std::future<bool> notifyOfWakeWord(
120  capabilityAgents::aip::AudioProvider wakeWordAudioProvider,
123  std::string keyword,
124  std::chrono::steady_clock::time_point startOfSpeechTimestamp,
125  std::shared_ptr<const std::vector<char>> KWDMetadata = nullptr) override;
126 
127  std::future<bool> notifyOfTapToTalk(
128  capabilityAgents::aip::AudioProvider tapToTalkAudioProvider,
130  std::chrono::steady_clock::time_point startOfSpeechTimestamp = std::chrono::steady_clock::now()) override;
131 
132  std::future<bool> notifyOfHoldToTalkStart(
133  capabilityAgents::aip::AudioProvider holdToTalkAudioProvider,
134  std::chrono::steady_clock::time_point startOfSpeechTimestamp = std::chrono::steady_clock::now(),
137 
138  std::future<bool> notifyOfHoldToTalkEnd() override;
139 
140  std::future<bool> notifyOfTapToTalkEnd() override;
142 
148  std::shared_ptr<presentationOrchestratorInterfaces::PresentationOrchestratorClientInterface> poClient);
149 
154  void setInteractionManager(std::shared_ptr<common::InteractionManager> interactionManager);
155 
160  void handleSetCameraMicrophoneState(bool enabled);
161 
162 private:
167 
174  void initialize(
175  const std::shared_ptr<ipc::IPCHandlerRegistrationInterface>& ipcHandlerRegistrar,
176  const std::shared_ptr<AplClientBridge>& aplClientBridge);
177 
183  void handleASRProfileChanged(alexaClientSDK::capabilityAgents::aip::ASRProfile profile);
184 
188  void dismissPresentation();
189 
193  void executeDismissPresentation();
194 
198  void executeOnPresentationDismissed();
199 
204  void executeSetCameraUIMicState(bool enabled);
205 
212  void executeNotifyMicrophoneStateChanged(bool enabled);
213 
215  std::shared_ptr<presentationOrchestratorInterfaces::PresentationInterface> m_presentation;
216 
218  std::shared_ptr<presentationOrchestratorInterfaces::PresentationOrchestratorClientInterface>
219  m_presentationOrchestratorClient;
220 
222  extensions::liveView::AplLiveViewExtensionPtr m_aplLiveViewExtension;
223 
225  std::shared_ptr<ipc::LiveViewCameraHandler> m_liveViewCameraIPCHandler;
226 
228  std::shared_ptr<common::InteractionManager> m_interactionManager;
229 
232 
234  std::string m_liveViewCameraWindowId;
235 
237  std::unique_ptr<LiveViewControllerInterface::StartLiveViewRequest> m_startLiveViewRequest;
238 
241 
244 
247 };
248 
249 } // namespace liveViewController
250 } // namespace ipcServerSampleApp
251 } // namespace sampleApplications
252 } // namespace alexaClientSDK
253 #endif // ALEXA_CLIENT_SDK_LIBIPCSERVERSAMPLEAPP_INCLUDE_IPCSERVERSAMPLEAPP_LIVEVIEWCONTROLLER_LIVEVIEWCONTROLLERPRESENTATIONADAPTER_H_
void setInteractionManager(std::shared_ptr< common::InteractionManager > interactionManager)
std::future< bool > notifyOfHoldToTalkStart(capabilityAgents::aip::AudioProvider holdToTalkAudioProvider, std::chrono::steady_clock::time_point startOfSpeechTimestamp=std::chrono::steady_clock::now(), avsCommon::avs::AudioInputStream::Index beginIndex=capabilityAgents::aip::AudioInputProcessor::INVALID_INDEX) override
Pointer to the PresentationInterface presentation association.
static const auto INVALID_INDEX
A reserved Index value which is considered invalid.
Definition: AudioInputProcessor.h:133
void removeObserver(std::weak_ptr< alexaLiveViewControllerInterfaces::LiveViewControllerObserverInterface > observer) override
LiveViewControllerInterface::Response setCameraState(alexaLiveViewControllerInterfaces::CameraState cameraState) override
std::future< bool > notifyOfWakeWord(capabilityAgents::aip::AudioProvider wakeWordAudioProvider, avsCommon::avs::AudioInputStream::Index beginIndex, avsCommon::avs::AudioInputStream::Index endIndex, std::string keyword, std::chrono::steady_clock::time_point startOfSpeechTimestamp, std::shared_ptr< const std::vector< char >> KWDMetadata=nullptr) override
Pointer to the PresentationInterface presentation association.
::std::string string
Definition: gtest-port.h:1097
Single-thread executor implementation.
Definition: Executor.h:45
void onPresentationStateChanged(presentationOrchestratorInterfaces::PresentationRequestToken id, presentationOrchestratorInterfaces::PresentationState newState) override
void onPresentationAvailable(presentationOrchestratorInterfaces::PresentationRequestToken id, std::shared_ptr< presentationOrchestratorInterfaces::PresentationInterface > presentation) override
std::future< bool > notifyOfTapToTalk(capabilityAgents::aip::AudioProvider tapToTalkAudioProvider, avsCommon::avs::AudioInputStream::Index beginIndex=capabilityAgents::aip::AudioInputProcessor::INVALID_INDEX, std::chrono::steady_clock::time_point startOfSpeechTimestamp=std::chrono::steady_clock::now()) override
Pointer to the PresentationInterface presentation association.
std::shared_ptr< AplLiveViewExtension > AplLiveViewExtensionPtr
Definition: AplLiveViewExtension.h:115
Generic implementation of NotifierInterface.
Definition: Notifier.h:38
State
The different states the AudioInputProcessor can be in.
Definition: AudioInputProcessorObserverInterface.h:30
PresentationState
Definition: PresentationTypes.h:48
LiveViewControllerInterface::Response start(std::unique_ptr< LiveViewControllerInterface::StartLiveViewRequest > request) override
}
ASRProfile
Definition: ASRProfile.h:31
static std::shared_ptr< LiveViewControllerPresentationAdapter > create(const std::shared_ptr< ipc::IPCHandlerRegistrationInterface > &ipcHandlerRegistrar, const std::shared_ptr< AplClientBridge > &aplClientBridge)
Index
Index used for setting access.
Definition: StateReportGeneratorTest.cpp:41
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
A state observer for an AudioInputProcessor.
Definition: AudioInputProcessorObserverInterface.h:27
void setPresentationOrchestrator(std::shared_ptr< presentationOrchestratorInterfaces::PresentationOrchestratorClientInterface > poClient)
}
uint64_t PresentationRequestToken
Definition: PresentationTypes.h:25
std::future< bool > notifyOfHoldToTalkEnd() override
Pointer to the PresentationInterface presentation association.
CameraState
Definition: LiveViewControllerTypes.h:108
bool addObserver(std::weak_ptr< alexaLiveViewControllerInterfaces::LiveViewControllerObserverInterface > observer) override
Definition: SpeechInteractionHandlerInterface.h:37
std::future< bool > notifyOfTapToTalkEnd() override
Pointer to the PresentationInterface presentation association.
tuple message
Definition: gtest_output_test.py:331
bool onNavigateBack(presentationOrchestratorInterfaces::PresentationRequestToken id) override
Definition: LiveViewControllerConfiguration.h:29

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