AlexaClientSDK
3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <FocusManager.h>
Classes | |
class | ChannelConfiguration |
Public Member Functions | |
FocusManager (const std::vector< ChannelConfiguration > &channelConfigurations, std::shared_ptr< ActivityTrackerInterface > activityTrackerInterface=nullptr, const std::vector< ChannelConfiguration > &virtualChannelConfigurations=std::vector< ChannelConfiguration >(), std::shared_ptr< interruptModel::InterruptModel > interruptModel=nullptr) | |
bool | acquireChannel (const std::string &channelName, std::shared_ptr< avsCommon::sdkInterfaces::ChannelObserverInterface > channelObserver, const std::string &interfaceName) override |
bool | acquireChannel (const std::string &channelName, std::shared_ptr< avsCommon::sdkInterfaces::FocusManagerInterface::Activity > channelActivity) override |
std::future< bool > | releaseChannel (const std::string &channelName, std::shared_ptr< avsCommon::sdkInterfaces::ChannelObserverInterface > channelObserver) override |
void | stopForegroundActivity () override |
void | stopAllActivities () override |
void | addObserver (const std::shared_ptr< avsCommon::sdkInterfaces::FocusManagerObserverInterface > &observer) override |
void | removeObserver (const std::shared_ptr< avsCommon::sdkInterfaces::FocusManagerObserverInterface > &observer) override |
void | modifyContentType (const std::string &channelName, const std::string &interfaceName, avsCommon::avs::ContentType contentType) override |
Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::FocusManagerInterface | |
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 | addObserver (const std::shared_ptr< avsCommon::sdkInterfaces::FocusManagerObserverInterface > &observer)=0 |
virtual void | removeObserver (const std::shared_ptr< avsCommon::sdkInterfaces::FocusManagerObserverInterface > &observer)=0 |
Static Public Member Functions | |
static const std::vector< FocusManager::ChannelConfiguration > | getDefaultAudioChannels () |
static const std::vector< FocusManager::ChannelConfiguration > | getDefaultVisualChannels () |
Additional Inherited Members | |
Static Public Attributes inherited from alexaClientSDK::avsCommon::sdkInterfaces::FocusManagerInterface | |
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... | |
The 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.
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.
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.
alexaClientSDK::afml::FocusManager::FocusManager | ( | const std::vector< ChannelConfiguration > & | channelConfigurations, |
std::shared_ptr< ActivityTrackerInterface > | activityTrackerInterface = nullptr , |
||
const std::vector< ChannelConfiguration > & | virtualChannelConfigurations = std::vector< ChannelConfiguration >() , |
||
std::shared_ptr< interruptModel::InterruptModel > | interruptModel = nullptr |
||
) |
This constructor creates Channels based on the provided configurations.
channelConfigurations | A vector of channelConfiguration objects that will be used to create the Channels. No two Channels should have the same name or priority. If there are multiple configurations with the same name or priority, the latter Channels with that name or priority will not be created. |
activityTrackerInterface | The interface to notify the activity tracker a vector of channel states that has been updated. |
virtualChannelConfigurations | A vector of channelConfiguration objects that will be used to create the Virtual Channels. No two Channels should have the same name or priority. If there are multiple configurations with the same name or priority, the latter Channels with that name or priority will not be created. |
interruptModel | InterruptModel object that provides MixingBehavior inputs to ChannelObservers upon Focus State Change. |
|
override |
|
override |
|
override |
|
static |
Retrieves the default ChannelConfiguration
for AVS audio channels.
ChannelConfiguration
for AVS audio channels.
|
static |
Retrieves the default ChannelConfiguration
for AVS visual channels.
ChannelConfiguration
for AVS visual channels.
|
overridevirtual |
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 |
Implements alexaClientSDK::avsCommon::sdkInterfaces::FocusManagerInterface.
|
override |
|
override |
|
overridevirtual |
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.
Implements alexaClientSDK::avsCommon::sdkInterfaces::FocusManagerInterface.
|
overridevirtual |
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.
Implements alexaClientSDK::avsCommon::sdkInterfaces::FocusManagerInterface.
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0