AlexaClientSDK  1.20.1
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Classes | Public Member Functions | Static Public Attributes | List of all members
alexaClientSDK::avsCommon::sdkInterfaces::FocusManagerInterface Class Referenceabstract

#include <FocusManagerInterface.h>

Inheritance diagram for alexaClientSDK::avsCommon::sdkInterfaces::FocusManagerInterface:
Inheritance graph
[legend]

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ~FocusManagerInterface()

virtual alexaClientSDK::avsCommon::sdkInterfaces::FocusManagerInterface::~FocusManagerInterface ( )
virtualdefault

Destructor.

Member Function Documentation

◆ acquireChannel() [1/2]

virtual bool alexaClientSDK::avsCommon::sdkInterfaces::FocusManagerInterface::acquireChannel ( const std::string &  channelName,
std::shared_ptr< avsCommon::sdkInterfaces::ChannelObserverInterface channelObserver,
const std::string &  interfaceName 
)
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.

Parameters
channelNameThe name of the Channel to acquire.
channelObserverThe observer that will be acquiring the Channel and be notified of focus changes.
interfaceNameThe 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.
Returns
Returns true if the Channel can be acquired and false otherwise.

Implemented in alexaClientSDK::afml::FocusManager.

◆ acquireChannel() [2/2]

virtual bool alexaClientSDK::avsCommon::sdkInterfaces::FocusManagerInterface::acquireChannel ( const std::string &  channelName,
std::shared_ptr< avsCommon::sdkInterfaces::FocusManagerInterface::Activity channelActivity 
)
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.

Parameters
channelNameThe name of the Channel to acquire.
channelActivityActivity object associated with the Channel.
Returns
Returns true if the Channel can be acquired and false otherwise.

Implemented in alexaClientSDK::afml::FocusManager.

◆ addObserver()

virtual void alexaClientSDK::avsCommon::sdkInterfaces::FocusManagerInterface::addObserver ( const std::shared_ptr< avsCommon::sdkInterfaces::FocusManagerObserverInterface > &  observer)
pure virtual

Add an observer to the focus manager.

Parameters
observerThe observer to add.

Implemented in alexaClientSDK::afml::FocusManager.

◆ modifyContentType()

virtual void alexaClientSDK::avsCommon::sdkInterfaces::FocusManagerInterface::modifyContentType ( const std::string &  channelName,
const std::string &  interfaceName,
avsCommon::avs::ContentType  contentType 
)
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.

Parameters
channelNamethe channel associated with the ChannelObserver
interfaceNamethe interface name associated with the ChannelObserver
contentTypethe new content type

Implemented in alexaClientSDK::afml::FocusManager.

◆ releaseChannel()

virtual std::future<bool> alexaClientSDK::avsCommon::sdkInterfaces::FocusManagerInterface::releaseChannel ( const std::string &  channelName,
std::shared_ptr< avsCommon::sdkInterfaces::ChannelObserverInterface channelObserver 
)
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.

Parameters
channelNameThe name of the Channel to release.
channelObserverThe observer to be released from the Channel.
Returns
std::future<bool> which will contain true if the Channel can be released and false otherwise.

Implemented in alexaClientSDK::afml::FocusManager.

◆ removeObserver()

virtual void alexaClientSDK::avsCommon::sdkInterfaces::FocusManagerInterface::removeObserver ( const std::shared_ptr< avsCommon::sdkInterfaces::FocusManagerObserverInterface > &  observer)
pure virtual

Remove an observer from the focus manager.

Parameters
observerThe observer to remove.

Implemented in alexaClientSDK::afml::FocusManager.

◆ stopAllActivities()

virtual void alexaClientSDK::avsCommon::sdkInterfaces::FocusManagerInterface::stopAllActivities ( )
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.

◆ stopForegroundActivity()

virtual void alexaClientSDK::avsCommon::sdkInterfaces::FocusManagerInterface::stopForegroundActivity ( )
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.

Member Data Documentation

◆ ALERT_CHANNEL_NAME

constexpr const char* alexaClientSDK::avsCommon::sdkInterfaces::FocusManagerInterface::ALERT_CHANNEL_NAME = "Alert"
static

The default Alert Channel name.

◆ ALERT_CHANNEL_PRIORITY

constexpr unsigned int alexaClientSDK::avsCommon::sdkInterfaces::FocusManagerInterface::ALERT_CHANNEL_PRIORITY = 200
static

The default Alert Channel priority.

◆ COMMUNICATIONS_CHANNEL_NAME

constexpr const char* alexaClientSDK::avsCommon::sdkInterfaces::FocusManagerInterface::COMMUNICATIONS_CHANNEL_NAME = "Communications"
static

The default Communications Channel name.

◆ COMMUNICATIONS_CHANNEL_PRIORITY

constexpr unsigned int alexaClientSDK::avsCommon::sdkInterfaces::FocusManagerInterface::COMMUNICATIONS_CHANNEL_PRIORITY = 150
static

The default Communications Channel priority.

◆ CONTENT_CHANNEL_NAME

constexpr const char* alexaClientSDK::avsCommon::sdkInterfaces::FocusManagerInterface::CONTENT_CHANNEL_NAME = "Content"
static

The default Content Channel name.

◆ CONTENT_CHANNEL_PRIORITY

constexpr unsigned int alexaClientSDK::avsCommon::sdkInterfaces::FocusManagerInterface::CONTENT_CHANNEL_PRIORITY = 300
static

The default Content Channel priority.

◆ DIALOG_CHANNEL_NAME

constexpr const char* alexaClientSDK::avsCommon::sdkInterfaces::FocusManagerInterface::DIALOG_CHANNEL_NAME = "Dialog"
static

The default Dialog Channel name.

◆ DIALOG_CHANNEL_PRIORITY

constexpr unsigned int alexaClientSDK::avsCommon::sdkInterfaces::FocusManagerInterface::DIALOG_CHANNEL_PRIORITY = 100
static

The default dialog Channel priority.

◆ VISUAL_CHANNEL_NAME

constexpr const char* alexaClientSDK::avsCommon::sdkInterfaces::FocusManagerInterface::VISUAL_CHANNEL_NAME = "Visual"
static

The default Visual Channel name.

◆ VISUAL_CHANNEL_PRIORITY

constexpr unsigned int alexaClientSDK::avsCommon::sdkInterfaces::FocusManagerInterface::VISUAL_CHANNEL_PRIORITY = 100
static

The default Visual Channel priority.


The documentation for this class was generated from the following file:

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