AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
InteractionManager.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_INTERACTIONMANAGER_H_
17 #define ACSDK_SAMPLE_INTERACTIONMANAGER_INTERACTIONMANAGER_H_
18 
19 #include <memory>
20 
35 
36 #include "KeywordObserver.h"
37 #include "UIManager.h"
38 
39 #ifdef ENABLE_PCC
40 #include <acsdk/PhoneCallControllerAdapter/PhoneCaller.h>
41 #endif
42 
43 #ifdef ENABLE_MCC
44 #include <acsdk/MeetingClientControllerAdapter/CalendarClient.h>
45 #include <acsdk/MeetingClientControllerAdapter/MeetingClient.h>
46 #endif
47 
48 #ifdef POWER_CONTROLLER
50 #endif
51 
52 #ifdef TOGGLE_CONTROLLER
54 #endif
55 
56 #ifdef RANGE_CONTROLLER
58 #endif
59 
60 #ifdef MODE_CONTROLLER
62 #endif
63 
64 namespace alexaClientSDK {
65 namespace sampleApplications {
66 namespace common {
67 
76 public:
81  std::shared_ptr<defaultClient::DefaultClient> client,
82  std::shared_ptr<applicationUtilities::resources::audio::MicrophoneInterface> micWrapper,
83  std::shared_ptr<UIManager> userInterface,
84 #ifdef ENABLE_PCC
85  std::shared_ptr<phoneCallControllerAdapter::PhoneCaller> phoneCaller,
86 #endif
87 #ifdef ENABLE_MCC
88  std::shared_ptr<meetingClientControllerAdapter::MeetingClient> meetingClient,
89  std::shared_ptr<meetingClientControllerAdapter::CalendarClient> calendarClient,
90 #endif
91  capabilityAgents::aip::AudioProvider holdToTalkAudioProvider,
92  capabilityAgents::aip::AudioProvider tapToTalkAudioProvider,
94 #ifdef POWER_CONTROLLER
95  std::shared_ptr<PeripheralEndpointPowerControllerHandler> powerControllerHandler = nullptr,
96 #endif
97 #ifdef TOGGLE_CONTROLLER
98  std::shared_ptr<PeripheralEndpointToggleControllerHandler> toggleControllerHandler = nullptr,
99 #endif
100 #ifdef RANGE_CONTROLLER
101  std::shared_ptr<PeripheralEndpointRangeControllerHandler> rangeControllerHandler = nullptr,
102 #endif
103 #ifdef MODE_CONTROLLER
104  std::shared_ptr<PeripheralEndpointModeControllerHandler> modeControllerHandler = nullptr,
105 #endif
106  std::shared_ptr<avsCommon::sdkInterfaces::CallManagerInterface> callManager = nullptr,
107  std::shared_ptr<avsCommon::sdkInterfaces::diagnostics::DiagnosticsInterface> diagnostics = nullptr);
108 
112  void begin();
113 
117  void help();
118 
122  void limitedHelp();
123 
131  void microphoneToggle();
132 
136  void holdToggled();
137 
141  void tap();
142 
146  void stopForegroundActivity();
147 
151  void playbackPlay();
152 
156  void playbackPause();
157 
161  void playbackNext();
162 
166  void playbackPrevious();
167 
171  void playbackSkipForward();
172 
176  void playbackSkipBackward();
177 
183  void playbackShuffle(bool action);
184 
190  void playbackLoop(bool action);
191 
197  void playbackRepeat(bool action);
198 
204  void playbackThumbsUp(bool action);
205 
211  void playbackThumbsDown(bool action);
212 
216  void settings();
217 
221  void alarmVolumeRamp();
222 
226  void wakewordConfirmation();
227 
231  void speechConfirmation();
232 
236  void locale();
237 
242  const std::vector<avsCommon::sdkInterfaces::endpoints::EndpointIdentifier>& deletedEndpoints);
243 
244 #ifdef ENABLE_ENDPOINT_CONTROLLERS
245 
248  void endpointModification();
249 
256  bool addEndpoint(const std::string& friendlyName);
257 
265  bool updateEndpoint(
267  const std::string& friendlyName);
268 
272  void addDynamicEndpoint();
273 
277  void modifyDynamicEndpoint();
278 
282  void deleteDynamicEndpoint();
283 
287  void endpointController();
288 #endif
289 
290 #ifdef POWER_CONTROLLER
291 
294  void powerController();
295 
296 #endif
297 #ifdef TOGGLE_CONTROLLER
298 
301  void toggleController();
302 #endif
303 
304 #ifdef MODE_CONTROLLER
305 
308  void modeController();
309 #endif
310 
311 #ifdef RANGE_CONTROLLER
312 
315  void rangeController();
316 #endif
317 
321  void timeZone();
322 
326  void networkInfo();
327 
332  void networkInfoESSIDPrompt();
333  void networkInfoBSSIDPrompt();
334  void networkInfoIpPrompt();
336  void networkInfoMacPrompt();
337  void networkInfoDHCPPrompt();
340 
344  void doNotDisturb();
345 
349  void errorValue();
350 
354  void speakerControl();
355 
359  void firmwareVersionControl();
360 
367 
371  void volumeControl();
372 
377 
382 
391  std::shared_ptr<avsCommon::sdkInterfaces::SpeechInteractionHandlerInterface> holdToTalkHandler);
392 
396  void resetDevice();
397 
401  void confirmResetDevice();
402 
407 
408 #ifdef ENABLE_COMMS
409 
412  void commsControl();
413 
417  void acceptCall();
418 
425 
429  void dtmfControl();
430 
434  void errorDtmf();
435 
439  void stopCall();
440 
444  void muteCallToggle();
445 
449  void muteSelf();
450 
454  void unmuteSelf();
455 
459  void enableVideo();
460 
464  void disableVideo();
465 
466 #endif
467 
471  void onDialogUXStateChanged(DialogUXState newState) override;
472 
476  void onCallStateChange(CallState newState) override;
477 
478 #ifdef ENABLE_PCC
479 
482  void phoneControl();
483 
487  void callId();
488 
492  void callerId();
493 
497  void sendCallActivated(const std::string& callId);
498  void sendCallTerminated(const std::string& callId);
499  void sendCallFailed(const std::string& callId);
500  void sendCallReceived(const std::string& callId, const std::string& callerId);
501  void sendCallerIdReceived(const std::string& callId, const std::string& callerId);
502  void sendInboundRingingStarted(const std::string& callId);
503  void sendOutboundCallRequested(const std::string& callId);
504  void sendOutboundRingingStarted(const std::string& callId);
505  void sendSendDtmfSucceeded(const std::string& callId);
506  void sendSendDtmfFailed(const std::string& callId);
507 
508 #endif
509 
510 #ifdef ENABLE_MCC
511 
514  void meetingControl();
515 
519  void sessionId();
520 
524  void calendarItemsFile();
525 
529  void sendMeetingJoined(const std::string& sessionId);
530  void sendMeetingEnded(const std::string& sessionId);
531  void sendSetCurrentMeetingSession(const std::string& sessionId);
532  void sendClearCurrentMeetingSession();
533  void sendConferenceConfigurationChanged();
534  void sendMeetingClientErrorOccured(const std::string& sessionId);
535  void sendCalendarItemsRetrieved(const std::string& calendarItemsFile);
536  void sendCalendarClientErrorOccured();
537 #endif
538 
542  void setDoNotDisturbMode(bool enable);
543 
547  void setAlarmVolumeRamp(bool enable);
548 
553 
558 
562  void setTimeZone(const std::string& value);
563 
567  void setLocale(const settings::DeviceLocales& value);
568 
574 
579  void setNetworkInfo(const settings::types::NetworkInfo& value);
580 
581 #ifdef POWER_CONTROLLER
582 
587  void setPowerState(const bool powerState);
588 #endif
589 
590 #ifdef TOGGLE_CONTROLLER
591 
596  void setToggleState(const bool toggleState);
597 #endif
598 
599 #ifdef RANGE_CONTROLLER
600 
605  void setRangeValue(const int rangeValue);
606 #endif
607 
608 #ifdef MODE_CONTROLLER
609 
614  void setMode(const std::string mode);
615 #endif
616 
620  void stopMicrophone();
621 
625  void startMicrophone();
626 
630  void diagnosticsControl();
631 
636 
640  void showDeviceProperties();
641 
645  void audioInjectionControl();
646 
659  void injectWavFile(const std::string& absoluteFilePath);
660 
665 
669  void printProtocolTrace();
670 
676  void setProtocolTraceFlag(bool enabled);
677 
681  void clearProtocolTrace();
682 
687 
688 private:
690  std::shared_ptr<defaultClient::DefaultClient> m_client;
691 
693  std::shared_ptr<applicationUtilities::resources::audio::MicrophoneInterface> m_micWrapper;
694 
696  std::shared_ptr<UIManager> m_userInterface;
697 
699  std::shared_ptr<avsCommon::sdkInterfaces::CallManagerInterface> m_callManager;
700 
701 #ifdef ENABLE_PCC
702  std::shared_ptr<phoneCallControllerAdapter::PhoneCaller> m_phoneCaller;
704 #endif
705 
706 #ifdef ENABLE_MCC
707  std::shared_ptr<meetingClientControllerAdapter::MeetingClient> m_meetingClient;
710  std::shared_ptr<meetingClientControllerAdapter::CalendarClient> m_calendarClient;
711 #endif
712 
714  std::shared_ptr<alexaClientSDK::avsCommon::sdkInterfaces::SpeechInteractionHandlerInterface>
715  m_holdToTalkSpeechInteractionHandler;
716 
718  capabilityAgents::aip::AudioProvider m_holdToTalkAudioProvider;
719 
721  capabilityAgents::aip::AudioProvider m_tapToTalkAudioProvider;
722 
724  capabilityAgents::aip::AudioProvider m_wakeWordAudioProvider;
725 
726 #ifdef POWER_CONTROLLER
727  std::shared_ptr<PeripheralEndpointPowerControllerHandler> m_powerControllerHandler;
729 #endif
730 
731 #ifdef TOGGLE_CONTROLLER
732  std::shared_ptr<PeripheralEndpointToggleControllerHandler> m_toggleControllerHandler;
734 #endif
735 
736 #ifdef RANGE_CONTROLLER
737  std::shared_ptr<PeripheralEndpointRangeControllerHandler> m_rangeControllerHandler;
739 #endif
740 
741 #ifdef MODE_CONTROLLER
742  std::shared_ptr<PeripheralEndpointModeControllerHandler> m_modeControllerHandler;
744 #endif
745 
747  bool m_isHoldOccurring;
748 
750  bool m_isTapOccurring;
751 
753  bool m_isCallConnected;
754 
756  bool m_isMicOn;
757 
760 #ifdef ENABLE_ENDPOINT_CONTROLLERS
761  bool m_friendlyNameToggle;
763 #endif
764 
766  std::shared_ptr<avsCommon::sdkInterfaces::diagnostics::DiagnosticsInterface> m_diagnostics;
767 
772 
775  void doShutdown() override;
777 
783  void sendGuiToggleEvent(avsCommon::avs::PlaybackToggle toggleType, bool action);
784 };
785 
786 } // namespace common
787 } // namespace sampleApplications
788 } // namespace alexaClientSDK
789 
790 #endif // ALEXA_CLIENT_SDK_INTERACTIONMANAGER_INCLUDE_ACSDK_SAMPLE_INTERACTIONMANAGER_INTERACTIONMANAGER_H_
void adjustVolume(avsCommon::sdkInterfaces::ChannelVolumeInterface::Type type, int8_t delta)
void overrideHoldToTalkSpeechHandler(std::shared_ptr< avsCommon::sdkInterfaces::SpeechInteractionHandlerInterface > holdToTalkHandler)
void setFirmwareVersion(avsCommon::sdkInterfaces::softwareInfo::FirmwareVersion firmwareVersion)
::std::string string
Definition: gtest-port.h:1097
static const AudioProvider & null()
Definition: AudioProvider.h:171
Single-thread executor implementation.
Definition: Executor.h:45
InteractionManager(std::shared_ptr< defaultClient::DefaultClient > client, std::shared_ptr< applicationUtilities::resources::audio::MicrophoneInterface > micWrapper, std::shared_ptr< UIManager > userInterface, capabilityAgents::aip::AudioProvider holdToTalkAudioProvider, capabilityAgents::aip::AudioProvider tapToTalkAudioProvider, capabilityAgents::aip::AudioProvider wakeWordAudioProvider=capabilityAgents::aip::AudioProvider::null(), std::shared_ptr< avsCommon::sdkInterfaces::CallManagerInterface > callManager=nullptr, std::shared_ptr< avsCommon::sdkInterfaces::diagnostics::DiagnosticsInterface > diagnostics=nullptr)
void setMute(avsCommon::sdkInterfaces::ChannelVolumeInterface::Type type, bool mute)
void onDialogUXStateChanged(DialogUXState newState) override
DialogUXState
The different dialog specific AVS UX states.
Definition: DialogUXStateObserverInterface.h:32
void setWakewordConfirmation(settings::WakeWordConfirmationSettingType value)
CallState
An enumeration representing the state of a call.
Definition: CallStateObserverInterface.h:31
void setNetworkInfo(const settings::types::NetworkInfo &value)
SpeechConfirmationSettingType
Definition: SpeechConfirmationSettingType.h:29
DTMFTone
An enum used to define the characters that dtmf tone can be.
Definition: CallManagerInterface.h:59
void clearCachedEndpointIdentifiers(const std::vector< avsCommon::sdkInterfaces::endpoints::EndpointIdentifier > &deletedEndpoints)
Definition: common.py:1
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
void setSpeechConfirmation(settings::SpeechConfirmationSettingType value)
int32_t FirmwareVersion
Type to use to communicate a firmware version.
Definition: SoftwareInfoSenderObserverInterface.h:29
type
Definition: upload.py:443
std::string EndpointIdentifier
Definition: EndpointIdentifier.h:38
std::vector< Locale > DeviceLocales
Alias for locales enabled in the device.
Definition: DeviceSettingsManager.h:37
WakeWordConfirmationSettingType
Definition: WakeWordConfirmationSettingType.h:29
void injectWavFile(const std::string &absoluteFilePath)
PlaybackToggle
Definition: PlaybackButtons.h:46
void setLocale(const settings::DeviceLocales &value)
A dialog specific UX state observer.
Definition: DialogUXStateObserverInterface.h:29
action
Definition: upload.py:393

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