AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
UIManager.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_SAMPLEAPP_INCLUDE_SAMPLEAPP_UIMANAGER_H_
17 #define ALEXA_CLIENT_SDK_SAMPLEAPP_INCLUDE_SAMPLEAPP_UIMANAGER_H_
18 
19 #include <string>
20 #include <memory>
21 #include <unordered_map>
22 #include <vector>
23 
43 
44 namespace alexaClientSDK {
45 namespace sampleApp {
46 
51 class UIManager
61 public:
63 
71  static std::shared_ptr<UIManager> create(
72  const std::shared_ptr<avsCommon::sdkInterfaces::LocaleAssetsManagerInterface>& localeAssetsManager,
73  const std::shared_ptr<avsCommon::utils::DeviceInfo>& deviceInfo);
74 
77  void onDialogUXStateChanged(DialogUXState state) override;
79 
82  void onConnectionStatusChanged(const Status status, const ChangedReason reason) override;
84 
87  void onSettingChanged(const std::string& key, const std::string& value) override;
89 
97 
100  void onSetIndicator(avsCommon::avs::IndicatorState state) override;
101  void onNotificationReceived() override{};
103 
106  void printMessage(const std::string& message) override;
108 
111  void onAuthStateChange(
115 
121  const std::vector<avsCommon::sdkInterfaces::endpoints::EndpointIdentifier>& addedOrUpdatedEndpoints,
122  const std::vector<avsCommon::sdkInterfaces::endpoints::EndpointIdentifier>& deletedEndpoints) override;
124 
127  void onActiveDeviceConnected(const DeviceAttributes& deviceAttributes) override;
128  void onActiveDeviceDisconnected(const DeviceAttributes& deviceAttributes) override;
130 
134  void printWelcomeScreen();
135 
139  void printHelpScreen();
140 
144  void printLimitedHelp();
145 
151 
155  void printSettingsScreen();
156 
161 
166  void printEndpointModificationError(const std::string& message);
167 
172 
176  void printLocaleScreen();
177 
182 
187 
192 
197 
203 
208 
213 
214 #ifdef ENABLE_PCC
215 
218  void printPhoneControlScreen();
219 
223  void printCallerIdScreen();
224 
228  void printCallIdScreen();
229 #endif
230 
231 #ifdef ENABLE_MCC
232 
235  void printMeetingControlScreen();
236 
240  void printSessionIdScreen();
241 
245  void printCalendarItemsScreen();
246 #endif
247 
248 #ifdef ENABLE_COMMS
249 
252  void printCommsControlScreen();
253 
257  void printDtmfScreen();
258 
262  void printDtmfErrorScreen();
263 
267  void printMuteCallScreen();
268 
272  void printUnmuteCallScreen();
273 #endif
274 
278  void printErrorScreen();
279 
283  void microphoneOff();
284 
285  /*
286  * Prints the state that Alexa is currenty in.
287  */
288  void microphoneOn();
289 
293  void printResetWarning();
294 
298  void printResetConfirmation();
299 
304 
308  void printCommsNotSupported();
309 
316  bool configureSettingsNotifications(std::shared_ptr<settings::DeviceSettingsManager> settingsManager);
317 
322 
327 
332 
336  void printTimeZoneScreen();
337 
341  void printNetworkInfoScreen();
342 
354 
359 
363  void printDiagnosticsScreen();
364 
369 
374  void printAllDeviceProperties(const std::unordered_map<std::string, std::string>& deviceProperties);
375 
380 
386  void printProtocolTrace(const std::string& protocolTrace);
387 
393  void printProtocolTraceFlag(bool enabled);
394 
399 
404 
405 private:
412  UIManager(
413  const std::shared_ptr<avsCommon::sdkInterfaces::LocaleAssetsManagerInterface>& localeAssetsManager,
414  const std::shared_ptr<avsCommon::utils::DeviceInfo>& deviceInfo);
415 
420  void printState();
421 
429  void onBooleanSettingNotification(
430  const std::string& name,
431  bool enable,
432  settings::SettingNotifications notification);
433 
441  void onStringSettingNotification(const std::string& name, bool enable, settings::SettingNotifications notification);
442 
452  template <typename SettingType>
453  void onSettingNotification(const std::string& name, SettingType value, settings::SettingNotifications notification);
454 
461  void setFailureStatus(const std::string& status);
462 
464  DialogUXState m_dialogState;
465 
468 
471 
473  std::shared_ptr<avsCommon::sdkInterfaces::LocaleAssetsManagerInterface> m_localeAssetsManager;
474 
477 
478  // String that holds a failure status message to be displayed when we are in limited mode.
479  std::string m_failureStatus;
480 
481  // Object that manages settings notifications.
482  std::shared_ptr<settings::SettingCallbacks<settings::DeviceSettingsManager>> m_callbacks;
483 
484  // The @c EndpointIdentifier of the default endpoint.
486 };
487 
488 } // namespace sampleApp
489 } // namespace alexaClientSDK
490 
491 #endif // ALEXA_CLIENT_SDK_SAMPLEAPP_INCLUDE_SAMPLEAPP_UIMANAGER_H_
Definition: UIManager.h:51
void printDeviceProtocolTracerScreen()
Definition: UIManager.cpp:1031
void printTimeZoneScreen()
Definition: UIManager.cpp:974
void printNetworkInfoMacPrompt()
Definition: UIManager.cpp:1002
void printReauthorizeConfirmation()
Definition: UIManager.cpp:938
ChangedReason
Definition: ConnectionStatusObserverInterface.h:50
void printDevicePropertiesScreen()
Definition: UIManager.cpp:1018
void microphoneOn()
Definition: UIManager.cpp:1053
void onActiveDeviceDisconnected(const DeviceAttributes &deviceAttributes) override
Definition: UIManager.cpp:1182
void onDialogUXStateChanged(DialogUXState state) override
Definition: UIManager.cpp:634
void onNotificationReceived() override
Definition: UIManager.h:101
void printCommsNotSupported()
Definition: UIManager.cpp:1118
void printNetworkInfoESSIDPrompt()
Definition: UIManager.cpp:986
State
The enum State describes the state of authorization.
Definition: AuthObserverInterface.h:34
Error
The enum Error encodes possible errors which may occur when changing state.
Definition: CapabilitiesDelegateObserverInterface.h:44
Definition: ConnectionStatusObserverInterface.h:31
void printWelcomeScreen()
}
Definition: UIManager.cpp:779
void printNetworkInfoScreen()
Definition: UIManager.cpp:978
void printAudioInjectionHeader()
Definition: UIManager.cpp:792
DialogUXState
The different dialog specific AVS UX states.
Definition: DialogUXStateObserverInterface.h:32
static std::shared_ptr< UIManager > create(const std::shared_ptr< avsCommon::sdkInterfaces::LocaleAssetsManagerInterface > &localeAssetsManager, const std::shared_ptr< avsCommon::utils::DeviceInfo > &deviceInfo)
Definition: UIManager.cpp:591
void onSetIndicator(avsCommon::avs::IndicatorState state) override
Definition: UIManager.cpp:673
void onSettingChanged(const std::string &key, const std::string &value) override
Definition: UIManager.cpp:654
void onSpeakerSettingsChanged(const avsCommon::sdkInterfaces::SpeakerManagerObserverInterface::Source &source, const avsCommon::sdkInterfaces::ChannelVolumeInterface::Type &type, const avsCommon::sdkInterfaces::SpeakerInterface::SpeakerSettings &settings) override
Definition: UIManager.cpp:661
void printProtocolTrace(const std::string &protocolTrace)
Definition: UIManager.cpp:1035
void printResetWarning()
Definition: UIManager.cpp:942
void printWakeWordConfirmationScreen()
Definition: UIManager.cpp:960
void printAudioInjectionScreen()
Definition: UIManager.cpp:1045
void microphoneOff()
Definition: UIManager.cpp:930
Definition: CapabilitiesDelegateObserverInterface.h:29
void printSpeechConfirmationScreen()
Definition: UIManager.cpp:967
void printDiagnosticsScreen()
Definition: UIManager.cpp:1014
void onActiveDeviceConnected(const DeviceAttributes &deviceAttributes) override
Definition: UIManager.cpp:1169
void onAuthStateChange(avsCommon::sdkInterfaces::AuthObserverInterface::State newState, avsCommon::sdkInterfaces::AuthObserverInterface::Error newError) override
Definition: UIManager.cpp:685
bool configureSettingsNotifications(std::shared_ptr< settings::DeviceSettingsManager > settingsManager)
Definition: UIManager.cpp:1129
void printFirmwareVersionControlScreen()
Definition: UIManager.cpp:868
void onCapabilitiesStateChange(avsCommon::sdkInterfaces::CapabilitiesDelegateObserverInterface::State newState, avsCommon::sdkInterfaces::CapabilitiesDelegateObserverInterface::Error newError, const std::vector< avsCommon::sdkInterfaces::endpoints::EndpointIdentifier > &addedOrUpdatedEndpoints, const std::vector< avsCommon::sdkInterfaces::endpoints::EndpointIdentifier > &deletedEndpoints) override
Definition: UIManager.cpp:737
Error
The enum Error encodes possible errors which may occur when changing state.
Definition: AuthObserverInterface.h:48
State
The enum State describes the state of the CapabilitiesDelegate.
Definition: CapabilitiesDelegateObserverInterface.h:32
void printResetConfirmation()
Definition: UIManager.cpp:934
void printHelpScreen()
Definition: UIManager.cpp:783
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
void printNetworkInfoSubnetPrompt()
Definition: UIManager.cpp:998
void printProtocolTraceFlag(bool enabled)
Definition: UIManager.cpp:1039
SettingNotifications
Definition: SettingObserverInterface.h:28
IndicatorState
Definition: IndicatorState.h:30
void printNetworkInfoIpPrompt()
Definition: UIManager.cpp:994
void printEndpointModificationError(const std::string &message)
std::string EndpointIdentifier
Definition: EndpointIdentifier.h:38
void printLocaleScreen()
Definition: UIManager.cpp:838
Source
Indicates whether the source of the call is from an AVS Directive or through a Local API call...
Definition: SpeakerManagerObserverInterface.h:35
void printNetworkInfoDHCPPrompt()
Definition: UIManager.cpp:1006
void printDoNotDisturbScreen()
Definition: UIManager.cpp:953
void printNetworkInfoConnectionTypePrompt()
Definition: UIManager.cpp:982
void printAllDeviceProperties(const std::unordered_map< std::string, std::string > &deviceProperties)
Definition: UIManager.cpp:1022
void printNetworkInfoBSSIDPrompt()
Definition: UIManager.cpp:990
void printNetworkInfoStaticIpPrompt()
Definition: UIManager.cpp:1010
void printSpeakerControlScreen()
Definition: UIManager.cpp:864
void printErrorScreen()
Definition: UIManager.cpp:926
void printLimitedHelp()
Definition: UIManager.cpp:787
void printSettingsScreen()
Definition: UIManager.cpp:796
void onConnectionStatusChanged(const Status status, const ChangedReason reason) override
Definition: UIManager.cpp:644
static const std::string key
The database key to be used by the protocol given the METADATA object.
Definition: SharedAVSSettingProtocolTest.cpp:58
Status
Definition: ConnectionStatusObserverInterface.h:36
void printMessage(const std::string &message) override
Definition: UIManager.cpp:681
void printAudioInjectionFailureMessage()
Definition: UIManager.cpp:1049
void printAlarmVolumeRampScreen()
Definition: UIManager.cpp:946
A dialog specific UX state observer.
Definition: DialogUXStateObserverInterface.h:29
void printVolumeControlScreen()
Definition: UIManager.cpp:872

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