AlexaClientSDK  3.0.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 ACSDK_SAMPLE_INTERACTIONMANAGER_UIMANAGER_H_
17 #define ACSDK_SAMPLE_INTERACTIONMANAGER_UIMANAGER_H_
18 
19 #include <string>
20 #include <memory>
21 #include <unordered_map>
22 #include <vector>
23 
44 
45 namespace alexaClientSDK {
46 namespace sampleApplications {
47 namespace common {
48 
53 class UIManager
63 public:
65 
73  static std::shared_ptr<UIManager> create(
74  const std::shared_ptr<avsCommon::sdkInterfaces::LocaleAssetsManagerInterface>& localeAssetsManager,
75  const std::shared_ptr<avsCommon::utils::DeviceInfo>& deviceInfo);
76 
79  void onDialogUXStateChanged(DialogUXState state) override;
81 
84  void onConnectionStatusChanged(const Status status, const ChangedReason reason) override;
86 
89  void onSettingChanged(const std::string& key, const std::string& value) override;
91 
99 
102  void onSetIndicator(avsCommon::avs::IndicatorState state) override;
103  void onNotificationReceived() override{};
105 
108  void printMessage(const std::string& message) override;
110 
113  void onAuthStateChange(
117 
123  const std::vector<avsCommon::sdkInterfaces::endpoints::EndpointIdentifier>& addedOrUpdatedEndpoints,
124  const std::vector<avsCommon::sdkInterfaces::endpoints::EndpointIdentifier>& deletedEndpoints) override;
126 
129  void onActiveDeviceConnected(const DeviceAttributes& deviceAttributes) override;
130  void onActiveDeviceDisconnected(const DeviceAttributes& deviceAttributes) override;
132 
136  void printWelcomeScreen();
137 
141  void printHelpScreen();
142 
146  void printLimitedHelp();
147 
153 
157  void printSettingsScreen();
158 
163 
168  void printEndpointModificationError(const std::string& message);
169 
174 
178  void printLocaleScreen();
179 
184 
189 
194 
199 
205 
210 
215 
216 #ifdef ENABLE_PCC
217 
220  void printPhoneControlScreen();
221 
225  void printCallerIdScreen();
226 
230  void printCallIdScreen();
231 #endif
232 
233 #ifdef ENABLE_MCC
234 
237  void printMeetingControlScreen();
238 
242  void printSessionIdScreen();
243 
247  void printCalendarItemsScreen();
248 #endif
249 
250 #ifdef ENABLE_COMMS
251 
254  void printCommsControlScreen();
255 
259  void printDtmfScreen();
260 
264  void printDtmfErrorScreen();
265 
269  void printMuteCallScreen();
270 
274  void printUnmuteCallScreen();
275 #endif
276 
280  void printErrorScreen();
281 
285  void microphoneOff();
286 
287  /*
288  * Prints the state that Alexa is currenty in.
289  */
290  void microphoneOn();
291 
295  void printResetWarning();
296 
300  void printResetConfirmation();
301 
306 
310  void printCommsNotSupported();
311 
318  bool configureSettingsNotifications(std::shared_ptr<settings::DeviceSettingsManager> settingsManager);
319 
324 
329 
334 
338  void printTimeZoneScreen();
339 
343  void printNetworkInfoScreen();
344 
356 
361 
365  void printDiagnosticsScreen();
366 
371 
376  void printAllDeviceProperties(const std::unordered_map<std::string, std::string>& deviceProperties);
377 
382 
388  void printProtocolTrace(const std::string& protocolTrace);
389 
395  void printProtocolTraceFlag(bool enabled);
396 
401 
406 
411  void setUIAuthNotifier(std::shared_ptr<acsdkSampleApplicationInterfaces::UIAuthNotifierInterface> uiAuthNotifier);
412 
418  std::shared_ptr<acsdkSampleApplicationInterfaces::UIStateAggregatorInterface> uiStateAggregator);
419 
420 private:
427  UIManager(
428  const std::shared_ptr<avsCommon::sdkInterfaces::LocaleAssetsManagerInterface>& localeAssetsManager,
429  const std::shared_ptr<avsCommon::utils::DeviceInfo>& deviceInfo);
430 
435  void printState();
436 
444  void onBooleanSettingNotification(
445  const std::string& name,
446  bool enable,
447  settings::SettingNotifications notification);
448 
456  void onStringSettingNotification(const std::string& name, bool enable, settings::SettingNotifications notification);
457 
467  template <typename SettingType>
468  void onSettingNotification(const std::string& name, SettingType value, settings::SettingNotifications notification);
469 
476  void setFailureStatus(const std::string& status);
477 
479  DialogUXState m_dialogState;
480 
483 
486 
488  std::shared_ptr<avsCommon::sdkInterfaces::LocaleAssetsManagerInterface> m_localeAssetsManager;
489 
492 
493  // String that holds a failure status message to be displayed when we are in limited mode.
494  std::string m_failureStatus;
495 
496  // Object that manages settings notifications.
497  std::shared_ptr<settings::SettingCallbacks<settings::DeviceSettingsManager>> m_callbacks;
498 
499  // The @c EndpointIdentifier of the default endpoint.
501 
503  std::shared_ptr<acsdkSampleApplicationInterfaces::UIStateAggregatorInterface> m_uiStateAggregator;
504 
506  std::shared_ptr<acsdkSampleApplicationInterfaces::UIAuthNotifierInterface> m_uiAuthNotifier;
507 };
508 
509 } // namespace common
510 } // namespace sampleApplications
511 } // namespace alexaClientSDK
512 
513 #endif // ACSDK_SAMPLE_INTERACTIONMANAGER_UIMANAGER_H_
ChangedReason
Definition: ConnectionStatusObserverInterface.h:50
void onDialogUXStateChanged(DialogUXState state) override
::std::string string
Definition: gtest-port.h:1097
void printAllDeviceProperties(const std::unordered_map< std::string, std::string > &deviceProperties)
Single-thread executor implementation.
Definition: Executor.h:45
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
void onAuthStateChange(avsCommon::sdkInterfaces::AuthObserverInterface::State newState, avsCommon::sdkInterfaces::AuthObserverInterface::Error newError) override
Definition: ConnectionStatusObserverInterface.h:31
void onSettingChanged(const std::string &key, const std::string &value) override
void onActiveDeviceDisconnected(const DeviceAttributes &deviceAttributes) override
}
void onSetIndicator(avsCommon::avs::IndicatorState state) override
bool configureSettingsNotifications(std::shared_ptr< settings::DeviceSettingsManager > settingsManager)
static std::shared_ptr< UIManager > create(const std::shared_ptr< avsCommon::sdkInterfaces::LocaleAssetsManagerInterface > &localeAssetsManager, const std::shared_ptr< avsCommon::utils::DeviceInfo > &deviceInfo)
DialogUXState
The different dialog specific AVS UX states.
Definition: DialogUXStateObserverInterface.h:32
void setUIAuthNotifier(std::shared_ptr< acsdkSampleApplicationInterfaces::UIAuthNotifierInterface > uiAuthNotifier)
void printProtocolTrace(const std::string &protocolTrace)
void onConnectionStatusChanged(const Status status, const ChangedReason reason) override
Definition: CapabilitiesDelegateObserverInterface.h:29
void setUIStateAggregator(std::shared_ptr< acsdkSampleApplicationInterfaces::UIStateAggregatorInterface > uiStateAggregator)
void onSpeakerSettingsChanged(const avsCommon::sdkInterfaces::SpeakerManagerObserverInterface::Source &source, const avsCommon::sdkInterfaces::ChannelVolumeInterface::Type &type, const avsCommon::sdkInterfaces::SpeakerInterface::SpeakerSettings &settings) override
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
Definition: common.py:1
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
void printEndpointModificationError(const std::string &message)
SettingNotifications
Definition: SettingObserverInterface.h:28
IndicatorState
Definition: IndicatorState.h:30
type
Definition: upload.py:443
void onNotificationReceived() override
Definition: UIManager.h:103
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
std::string EndpointIdentifier
Definition: EndpointIdentifier.h:38
Source
Indicates whether the source of the call is from an AVS Directive or through a Local API call...
Definition: SpeakerManagerObserverInterface.h:35
void onActiveDeviceConnected(const DeviceAttributes &deviceAttributes) override
}
void printMessage(const std::string &message) override
tuple message
Definition: gtest_output_test.py:331
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
A dialog specific UX state observer.
Definition: DialogUXStateObserverInterface.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