AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
SampleApplication.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_SAMPLEAPPLICATION_H_
17 #define ALEXA_CLIENT_SDK_LIBIPCSERVERSAMPLEAPP_INCLUDE_IPCSERVERSAMPLEAPP_SAMPLEAPPLICATION_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 
37 
38 #include "ConsolePrinter.h"
40 
42 
43 #ifdef KWD
45 #endif
46 
47 #ifdef GSTREAMER_MEDIA_PLAYER
49 #elif defined(UWP_BUILD)
50 #include <SSSDKCommon/TestMediaPlayer.h>
51 #endif // GSTREAMER_MEDIA_PLAYER
52 
54 
56 #include "GUI/GUIClient.h"
57 #include "GUI/GUIManager.h"
60 
61 namespace alexaClientSDK {
62 namespace sampleApplications {
63 namespace ipcServerSampleApp {
64 
67 public:
77  static std::unique_ptr<SampleApplication> create(
78  const std::vector<std::string>& configFiles,
79  const std::string& logLevel = "",
80  std::shared_ptr<avsCommon::sdkInterfaces::diagnostics::DiagnosticsInterface> diagnostics = nullptr);
81 
88 
91 #ifdef UWP_BUILD
92  std::shared_ptr<gui::GUIClient> getGUIClient() {
93  return m_guiClient;
94  }
95 
96  std::shared_ptr<gui::GUIManager> getGUIManager() {
97  return m_guiManager;
98  }
99 #endif
100 
109  const std::shared_ptr<avsCommon::sdkInterfaces::HTTPContentFetcherInterfaceFactoryInterface>&
110  httpContentFetcherFactory,
111  const std::shared_ptr<defaultClient::EqualizerRuntimeSetup> equalizerRuntimeSetup);
112 
118  public:
126  const std::string& playerId,
128  };
129 
136  public:
144  const std::string& playerId,
146  };
147 
148 private:
158  bool initialize(
159  const std::vector<std::string>& configFiles,
160  const std::string& logLevel,
161  std::shared_ptr<avsCommon::sdkInterfaces::diagnostics::DiagnosticsInterface> diagnostics);
162 
172  std::shared_ptr<avsCommon::sdkInterfaces::ApplicationMediaInterfaces> createApplicationMediaPlayer(
173  const std::shared_ptr<avsCommon::sdkInterfaces::HTTPContentFetcherInterfaceFactoryInterface>&
174  httpContentFetcherFactory,
175  bool enableEqualizer,
176  const std::string& name,
177  bool enableLiveMode = false);
178 
180  std::shared_ptr<acsdkShutdownManagerInterfaces::ShutdownManagerInterface> m_shutdownManager;
181 
183  std::shared_ptr<avsCommon::avs::initialization::AlexaClientSDKInit> m_sdkInit;
184 
186  std::shared_ptr<sdkClient::SDKClientRegistry> m_clientRegistry;
187 
189  std::shared_ptr<defaultClient::DefaultClient> m_defaultClient;
190 
192  std::shared_ptr<common::InteractionManager> m_interactionManager;
193 
195  std::shared_ptr<gui::GUIClient> m_guiClient;
196 
198  std::shared_ptr<gui::GUIManager> m_guiManager;
199 
201  std::shared_ptr<AplClientBridge> m_aplClientBridge;
202 
204  std::shared_ptr<gui::GUIActivityEventNotifier> m_activityEventNotifier;
205 
207  std::shared_ptr<ipc::TemplateRuntimeHandler> m_templateRuntimeIPCHandler;
208 
210  std::shared_ptr<ipc::AlexaCaptionsHandler> m_alexaCaptionIPCHandler;
211 
213  std::unordered_map<std::string, std::shared_ptr<avsCommon::utils::mediaPlayer::MediaPlayerInterface>>
214  m_externalMusicProviderMediaPlayersMap;
215 
217  std::unordered_map<std::string, std::shared_ptr<avsCommon::sdkInterfaces::SpeakerInterface>>
218  m_externalMusicProviderSpeakersMap;
219 
221  std::vector<std::shared_ptr<avsCommon::utils::RequiresShutdown>> m_shutdownRequiredList;
222 
224  std::shared_ptr<avsCommon::utils::mediaPlayer::MediaPlayerInterface> m_speakMediaPlayer;
225 
227  std::vector<std::shared_ptr<avsCommon::utils::mediaPlayer::MediaPlayerInterface>> m_audioMediaPlayerPool;
228 
230  std::shared_ptr<avsCommon::utils::mediaPlayer::MediaPlayerInterface> m_alertsMediaPlayer;
231 
233  std::shared_ptr<avsCommon::utils::mediaPlayer::MediaPlayerInterface> m_notificationsMediaPlayer;
234 
236  std::shared_ptr<avsCommon::utils::mediaPlayer::MediaPlayerInterface> m_bluetoothMediaPlayer;
237 
239  std::shared_ptr<avsCommon::utils::mediaPlayer::MediaPlayerInterface> m_systemSoundMediaPlayer;
240 
241 #ifdef ENABLE_COMMS_AUDIO_PROXY
242  std::shared_ptr<avsCommon::utils::mediaPlayer::MediaPlayerInterface> m_commsMediaPlayer;
244 #endif
245 
247  std::shared_ptr<capabilitiesDelegate::CapabilitiesDelegate> m_capabilitiesDelegate;
248 
250  std::shared_ptr<avsCommon::utils::mediaPlayer::MediaPlayerInterface> m_ringtoneMediaPlayer;
251 
253  static std::unordered_map<std::string, avsCommon::sdkInterfaces::ChannelVolumeInterface::Type>
254  m_playerToSpeakerTypeMap;
255 
258 
259 #ifdef KWD
260  std::shared_ptr<acsdkKWDImplementations::AbstractKeywordDetector> m_keywordDetector;
262 #endif
263 
265  std::shared_ptr<acsdkAuthorization::AuthorizationManager> m_authManager;
266 
268  std::shared_ptr<acsdkAuthorization::lwa::LWAAuthorizationAdapter> m_lwaAdapter;
269 
270  std::string decodeHexToAscii(const std::string hexString);
271 };
272 
273 } // namespace ipcServerSampleApp
274 } // namespace sampleApplications
275 } // namespace alexaClientSDK
276 
277 #endif // ALEXA_CLIENT_SDK_LIBIPCSERVERSAMPLEAPP_INCLUDE_IPCSERVERSAMPLEAPP_SAMPLEAPPLICATION_H_
AdapterRegistration(const std::string &playerId, acsdkExternalMediaPlayer::ExternalMediaPlayer::AdapterCreateFunction createFunction)
::std::string string
Definition: gtest-port.h:1097
std::shared_ptr< acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterInterface >(*)(std::shared_ptr< alexaClientSDK::avsCommon::utils::metrics::MetricRecorderInterface >, std::shared_ptr< avsCommon::utils::mediaPlayer::MediaPlayerInterface > mediaPlayer, std::shared_ptr< avsCommon::sdkInterfaces::ChannelVolumeInterface > speaker, std::shared_ptr< avsCommon::sdkInterfaces::SpeakerManagerInterface > speakerManager, std::shared_ptr< avsCommon::sdkInterfaces::MessageSenderInterface > messageSender, std::shared_ptr< avsCommon::sdkInterfaces::FocusManagerInterface > focusManager, std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface > contextManager, std::shared_ptr< acsdkExternalMediaPlayerInterfaces::ExternalMediaPlayerInterface > externalMediaPlayer) AdapterCreateFunction
Definition: ExternalMediaPlayer.h:103
static std::unique_ptr< SampleApplication > create(const std::vector< std::string > &configFiles, const std::string &logLevel="", std::shared_ptr< avsCommon::sdkInterfaces::diagnostics::DiagnosticsInterface > diagnostics=nullptr)
bool createMediaPlayersForAdapters(const std::shared_ptr< avsCommon::sdkInterfaces::HTTPContentFetcherInterfaceFactoryInterface > &httpContentFetcherFactory, const std::shared_ptr< defaultClient::EqualizerRuntimeSetup > equalizerRuntimeSetup)
Class to manage the top-level components of the AVS Client Application.
Definition: SampleApplication.h:66
std::unordered_map< std::string, AdapterCreateFunction > AdapterCreationMap
Definition: ExternalMediaPlayer.h:106
~SampleApplication()
Destructor which manages the SampleApplication shutdown sequence.
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
SampleAppReturnCode
Definition: SampleApplicationReturnCodes.h:25

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