![]() |
AlexaClientSDK
3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <FocusManagerInterface.h>
Classes | |
class | Activity |
Public Member Functions | |
virtual | ~FocusManagerInterface ()=default |
Destructor. More... | |
virtual bool | acquireChannel (const std::string &channelName, std::shared_ptr< avsCommon::sdkInterfaces::ChannelObserverInterface > channelObserver, const std::string &interfaceName)=0 |
virtual bool | acquireChannel (const std::string &channelName, std::shared_ptr< avsCommon::sdkInterfaces::FocusManagerInterface::Activity > channelActivity)=0 |
virtual std::future< bool > | releaseChannel (const std::string &channelName, std::shared_ptr< avsCommon::sdkInterfaces::ChannelObserverInterface > channelObserver)=0 |
virtual void | stopForegroundActivity ()=0 |
virtual void | stopAllActivities ()=0 |
virtual void | addObserver (const std::shared_ptr< avsCommon::sdkInterfaces::FocusManagerObserverInterface > &observer)=0 |
virtual void | removeObserver (const std::shared_ptr< avsCommon::sdkInterfaces::FocusManagerObserverInterface > &observer)=0 |
virtual void | modifyContentType (const std::string &channelName, const std::string &interfaceName, avsCommon::avs::ContentType contentType)=0 |
Static Public Attributes | |
static constexpr const char * | DIALOG_CHANNEL_NAME = "Dialog" |
The default Dialog Channel name. More... | |
static constexpr unsigned int | DIALOG_CHANNEL_PRIORITY = 100 |
The default dialog Channel priority. More... | |
static constexpr const char * | COMMUNICATIONS_CHANNEL_NAME = "Communications" |
The default Communications Channel name. More... | |
static constexpr unsigned int | COMMUNICATIONS_CHANNEL_PRIORITY = 150 |
The default Communications Channel priority. More... | |
static constexpr const char * | ALERT_CHANNEL_NAME = "Alert" |
The default Alert Channel name. More... | |
static constexpr unsigned int | ALERT_CHANNEL_PRIORITY = 200 |
The default Alert Channel priority. More... | |
static constexpr const char * | CONTENT_CHANNEL_NAME = "Content" |
The default Content Channel name. More... | |
static constexpr unsigned int | CONTENT_CHANNEL_PRIORITY = 300 |
The default Content Channel priority. More... | |
static constexpr const char * | VISUAL_CHANNEL_NAME = "Visual" |
The default Visual Channel name. More... | |
static constexpr unsigned int | VISUAL_CHANNEL_PRIORITY = 100 |
The default Visual Channel priority. More... | |
A FocusManager takes requests to acquire and release Channels and updates the focuses of other Channels based on their priorities so that the invariant that there can only be one Foreground Channel is held. The following operations are provided:
acquire Channel - clients should call the acquireChannel() method, passing in the name of the Channel they wish to acquire, a pointer to the observer that they want to be notified once they get focus, and a unique interface name. clients could alternatively construct an Activity
object and pass that along with the channel name to acquire the channel.
release Channel - clients should call the releaseChannel() method, passing in the name of the Channel and the observer of the Channel they wish to release.
stop foreground Channel - clients should call the stopForegroundActivity() method.
stop all activities - client should call stopAllActivities
All of these methods will notify the observer of the Channel of focus changes via an asynchronous callback to the ChannelObserverInterface##onFocusChanged() method, at which point the client should make a user observable change based on the focus it receives.
|
virtualdefault |
Destructor.
|
pure virtual |
This method will acquire the channel and grant the appropriate focus to it and other channels if needed. The caller will be notified via an ChannelObserverInterface##onFocusChanged() call to the channelObserver
when it can start the activity.
channelName | The name of the Channel to acquire. |
channelObserver | The observer that will be acquiring the Channel and be notified of focus changes. |
interfaceName | The name of the AVS interface occupying the Channel. This should be unique and represents the name of the AVS interface using the Channel. The name of the AVS interface is used by the ActivityTracker to send Context to AVS. |
true
if the Channel can be acquired and false
otherwise.
|
pure virtual |
This method will acquire the channel and grant the appropriate focus to it and other channels if needed. The caller will be notified via an ChannelObserverInterface##onFocusChanged() call to the channelObserver
when it can start the activity.
channelName | The name of the Channel to acquire. |
channelActivity | Activity object associated with the Channel. |
true
if the Channel can be acquired and false
otherwise.
|
pure virtual |
Add an observer to the focus manager.
observer | The observer to add. |
|
pure virtual |
This function allows ChannelObservers to modify the ContentType rendering on their associated Activity This will cause the focus manager to reconsult the interruptModel in order to determine the new MixingBehavior for all backgrounded channels.
channelName | the channel associated with the ChannelObserver |
interfaceName | the interface name associated with the ChannelObserver |
contentType | the new content type |
Implemented in alexaClientSDK::afml::FocusManager.
|
pure virtual |
This method will release the Channel and notify the observer of the Channel, if the observer is the same as the observer passed in the acquireChannel call, to stop via ChannelObserverInterface##onFocusChanged(). If the Channel to release is the current foreground focused Channel, it will also notify the next highest priority Channel via an ChannelObserverInterface##onFocusChanged() callback that it has gained foreground focus.
channelName | The name of the Channel to release. |
channelObserver | The observer to be released from the Channel. |
std::future<bool>
which will contain true
if the Channel can be released and false
otherwise.
|
pure virtual |
Remove an observer from the focus manager.
observer | The observer to remove. |
|
pure virtual |
This method will request to stop all active channels. This will be performed asynchronously, and so, if at the time performing the stop, the channel is owned by another interface, this channel won't get stopped.
Implemented in alexaClientSDK::afml::FocusManager.
|
pure virtual |
This method will request that the currently foregrounded Channel activity be stopped, if there is one. This will be performed asynchronously, and so, if at the time of processing, the activity has stopped for any reason, then no stop will be performed. If something was stopped, the next highest priority active Channel will be brought to the foreground.
Implemented in alexaClientSDK::afml::FocusManager.
|
static |
The default Alert Channel name.
|
static |
The default Alert Channel priority.
|
static |
The default Communications Channel name.
|
static |
The default Communications Channel priority.
|
static |
The default Content Channel name.
|
static |
The default Content Channel priority.
|
static |
The default Dialog Channel name.
|
static |
The default dialog Channel priority.
|
static |
The default Visual Channel name.
|
static |
The default Visual Channel priority.
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0