AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
PreviewAlexaClient.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 ACSDKPREVIEWALEXACLIENT_PREVIEWALEXACLIENT_H_
17 #define ACSDKPREVIEWALEXACLIENT_PREVIEWALEXACLIENT_H_
18 
19 #include <fstream>
20 #include <map>
21 #include <memory>
22 #include <tuple>
23 #include <unordered_map>
24 #include <utility>
25 #include <vector>
26 
36 #include <SampleApp/GuiRenderer.h>
39 
40 #ifdef AUTH_MANAGER
43 #endif
44 
45 #ifdef KWD
47 #endif
48 
49 #ifdef GSTREAMER_MEDIA_PLAYER
51 #elif defined(ANDROID_MEDIA_PLAYER)
53 #endif
54 
55 namespace alexaClientSDK {
56 namespace acsdkPreviewAlexaClient {
57 
59 static constexpr const char* SAMPLE_APP_CONFIG_KEY("sampleApp");
60 
72 public:
83  static std::unique_ptr<PreviewAlexaClient> create(
84  std::shared_ptr<alexaClientSDK::sampleApp::ConsoleReader> consoleReader,
85  const std::vector<std::string>& configFiles,
86  const std::string& logLevel = "",
87  std::shared_ptr<avsCommon::sdkInterfaces::diagnostics::DiagnosticsInterface> diagnostics = nullptr);
88 
95 
96 #ifdef DIAGNOSTICS
97 
104  bool initiateRestart();
105 #endif
106 
109 
110 private:
121  bool initialize(
122  std::shared_ptr<alexaClientSDK::sampleApp::ConsoleReader> consoleReader,
123  const std::vector<std::string>& configFiles,
124  const std::string& logLevel,
125  std::shared_ptr<avsCommon::sdkInterfaces::diagnostics::DiagnosticsInterface> diagnostics);
126 
136  std::shared_ptr<avsCommon::sdkInterfaces::ApplicationMediaInterfaces> createApplicationMediaPlayer(
137  const std::shared_ptr<avsCommon::sdkInterfaces::HTTPContentFetcherInterfaceFactoryInterface>&
138  httpContentFetcherFactory,
139  bool enableEqualizer,
140  const std::string& name,
141  bool enableLiveMode = false);
142 
143 #ifdef ENABLE_ENDPOINT_CONTROLLERS
144 
152  bool addControllersToDefaultEndpoint(
153  std::shared_ptr<avsCommon::sdkInterfaces::endpoints::EndpointBuilderInterface> defaultEndpointBuilder);
154 
162  bool addControllersToPeripheralEndpoint(
163  std::shared_ptr<avsCommon::sdkInterfaces::endpoints::EndpointBuilderInterface> peripheralEndpointBuilder);
164 #endif
165  std::shared_ptr<acsdkShutdownManagerInterfaces::ShutdownManagerInterface> m_shutdownManager;
167 
169  std::shared_ptr<avsCommon::avs::initialization::AlexaClientSDKInit> m_sdkInit;
170 
172  std::shared_ptr<sampleApp::InteractionManager> m_interactionManager;
173 
175  std::shared_ptr<sampleApp::UserInputManager> m_userInputManager;
176 
178  std::shared_ptr<sampleApp::GuiRenderer> m_guiRenderer;
179 
181  std::vector<std::shared_ptr<avsCommon::utils::RequiresShutdown>> m_shutdownRequiredList;
182 
183 #ifdef ENABLE_COMMS_AUDIO_PROXY
184  std::shared_ptr<avsCommon::utils::mediaPlayer::MediaPlayerInterface> m_commsMediaPlayer;
186 #endif
187 
188 #ifdef ENABLE_PCC
189  std::shared_ptr<avsCommon::utils::mediaPlayer::MediaPlayerInterface> m_phoneMediaPlayer;
191 #endif
192 
194  std::shared_ptr<avsCommon::sdkInterfaces::CapabilitiesDelegateInterface> m_capabilitiesDelegate;
195 
197  std::shared_ptr<avsCommon::utils::mediaPlayer::MediaPlayerInterface> m_ringtoneMediaPlayer;
198 
200  std::shared_ptr<acsdkKWDImplementations::AbstractKeywordDetector> m_keywordDetector;
201 
202 #if defined(ANDROID_MEDIA_PLAYER) || defined(ANDROID_MICROPHONE)
203  std::shared_ptr<applicationUtilities::androidUtilities::AndroidSLESEngine> m_openSlEngine;
205 #endif
206 
207 #ifdef POWER_CONTROLLER
208  std::shared_ptr<sampleApp::PeripheralEndpointPowerControllerHandler> m_peripheralEndpointPowerHandler;
210 #endif
211 
212 #ifdef TOGGLE_CONTROLLER
213  std::shared_ptr<sampleApp::PeripheralEndpointToggleControllerHandler> m_peripheralEndpointToggleHandler;
215 #endif
216 
217 #ifdef RANGE_CONTROLLER
218  std::shared_ptr<sampleApp::PeripheralEndpointRangeControllerHandler> m_peripheralEndpointRangeHandler;
220 #endif
221 
222 #ifdef MODE_CONTROLLER
223  std::shared_ptr<sampleApp::PeripheralEndpointModeControllerHandler> m_peripheralEndpointModeHandler;
225 #endif
226 
227 #ifdef AUTH_MANAGER
228  std::shared_ptr<acsdkAuthorization::AuthorizationManager> m_authManager;
230 
232  std::shared_ptr<acsdkAuthorization::lwa::LWAAuthorizationAdapter> m_lwaAdapter;
233 #endif
234 };
235 
236 } // namespace acsdkPreviewAlexaClient
237 } // namespace alexaClientSDK
238 
239 #endif // ACSDKPREVIEWALEXACLIENT_PREVIEWALEXACLIENT_H_
alexaClientSDK::acsdkPreviewAlexaClient::PreviewAlexaClient
Definition: PreviewAlexaClient.h:71
alexaClientSDK::acsdkPreviewAlexaClient::PreviewAlexaClient::~PreviewAlexaClient
~PreviewAlexaClient()
Destructor which manages the SampleApplication shutdown sequence.
Definition: PreviewAlexaClient.cpp:695
alexaClientSDK::acsdkPreviewAlexaClient::SAMPLE_APP_CONFIG_KEY
static constexpr const char * SAMPLE_APP_CONFIG_KEY("sampleApp")
Key for the root node value containing configuration values for SampleApp.
AbstractKeywordDetector.h
GuiRenderer.h
DiagnosticsInterface.h
SampleApplicationReturnCodes.h
LWAAuthorizationAdapter.h
ShutdownManagerInterface.h
ConsolePrinter.h
MediaPlayer.h
alexaClientSDK
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
alexaClientSDK::acsdkPreviewAlexaClient::PreviewAlexaClient::create
static std::unique_ptr< PreviewAlexaClient > create(std::shared_ptr< alexaClientSDK::sampleApp::ConsoleReader > consoleReader, const std::vector< std::string > &configFiles, const std::string &logLevel="", std::shared_ptr< avsCommon::sdkInterfaces::diagnostics::DiagnosticsInterface > diagnostics=nullptr)
Definition: PreviewAlexaClient.cpp:673
AlexaClientSDKInit.h
alexaClientSDK::sampleApp::SampleAppReturnCode
SampleAppReturnCode
Definition: SampleApplicationReturnCodes.h:24
CapabilitiesDelegateInterface.h
UserInputManager.h
AndroidSLESMediaPlayer.h
ApplicationMediaInterfaces.h
alexaClientSDK::acsdkPreviewAlexaClient::PreviewAlexaClient::run
sampleApp::SampleAppReturnCode run()
Definition: PreviewAlexaClient.cpp:691
ExternalMediaPlayer.h
ConsoleReader.h
ChannelVolumeInterface.h
AuthorizationManager.h

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