AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Classes | Public Member Functions | List of all members
alexaClientSDK::afml::Channel Class Reference

#include <Channel.h>


struct  State

Public Member Functions

 Channel (const std::string &name, const unsigned int priority, bool isVirtual=false)
const std::string & getName () const
unsigned int getPriority () const
bool setFocus (avsCommon::avs::FocusState focus, avsCommon::avs::MixingBehavior behavior, bool forceUpdate=false)
void setPrimaryActivity (std::shared_ptr< avsCommon::sdkInterfaces::FocusManagerInterface::Activity > activity)
bool releaseActivity (std::shared_ptr< avsCommon::sdkInterfaces::ChannelObserverInterface > observer)
bool releaseActivity (const std::string &interfaceName)
bool isActive ()
bool operator> (const Channel &rhs) const
std::string getInterface () const
Channel::State getState () const
std::vector< Channel::StategetActivityUpdates ()
std::shared_ptr< avsCommon::sdkInterfaces::FocusManagerInterface::ActivitygetPrimaryActivity ()
std::shared_ptr< avsCommon::sdkInterfaces::FocusManagerInterface::ActivitygetActivity (const std::string &interfaceName)
std::vector< std::string > getInterfaceList () const

Detailed Description

A Channel represents a focusable layer with a priority, allowing the observer which has acquired the Channel to understand focus changes. A Channel can be acquired by multiple Activities, but only a single Activity can be the primary activity. All other Activities that are not the primary Activity will be backgrounded.

A Channel can optionally be virtual. Activity changes will not be captured for virtual channels.

Constructor & Destructor Documentation

◆ Channel()

alexaClientSDK::afml::Channel::Channel ( const std::string &  name,
const unsigned int  priority,
bool  isVirtual = false 

Constructs a new Channel object with the provided priority.

nameThe channel's name.
priorityThe priority of the channel.
isVirtualbool to indicate if this channel is a virtual channel.
refer to the class level doc on virtual channel paramter.


Member Function Documentation

◆ getActivity()

std::shared_ptr< FocusManagerInterface::Activity > alexaClientSDK::afml::Channel::getActivity ( const std::string &  interfaceName)

Gets the activity associated with a given interfaceName.

interfaceNameinterface name associated with the activity being searched
activity associated with
interfaceName,nullptrif not found.

◆ getActivityUpdates()

std::vector< Channel::State > alexaClientSDK::afml::Channel::getActivityUpdates ( )

Returns a list of Channel::State updates. This API will internally clear the stored updates when called.

vector containing all Channel::State Updates

◆ getInterface()

std::string alexaClientSDK::afml::Channel::getInterface ( ) const

Returns the name of the interface of the Primary Activity occupying the Channel.

The name of the AVS interface.

◆ getInterfaceList()

std::vector< std::string > alexaClientSDK::afml::Channel::getInterfaceList ( ) const

Retrieve vector of interfaces of all Activites on the Channel.

◆ getName()

const std::string & alexaClientSDK::afml::Channel::getName ( ) const

Returns the name of a channel.

The channel's name.

◆ getPrimaryActivity()

std::shared_ptr< FocusManagerInterface::Activity > alexaClientSDK::afml::Channel::getPrimaryActivity ( )

Returns the primary activity associated with this channel

the primary activity associated with the channel.

◆ getPriority()

unsigned int alexaClientSDK::afml::Channel::getPriority ( ) const

Returns the priority of a Channel.

The Channel priority.

◆ getState()

Channel::State alexaClientSDK::afml::Channel::getState ( ) const

Returns the State of the Channel.

The State.

◆ isActive()

bool alexaClientSDK::afml::Channel::isActive ( )

Returns if channel is active. A Channel is considered active if there is any Activity on the Channel.

true if Channel is active, false otherwise.

◆ operator>()

bool alexaClientSDK::afml::Channel::operator> ( const Channel rhs) const

Compares this Channel and another Channel and checks which is higher priority. A Channel is considered higher priority than another Channel if its m_priority is lower than the other Channel's.

rhsThe Channel to compare with this Channel.

◆ releaseActivity() [1/2]

bool alexaClientSDK::afml::Channel::releaseActivity ( std::shared_ptr< avsCommon::sdkInterfaces::ChannelObserverInterface observer)

Activity to be released by observer.

observerChannel Observer to release.
true if Activity was found and released, false otherwise.

◆ releaseActivity() [2/2]

bool alexaClientSDK::afml::Channel::releaseActivity ( const std::string &  interfaceName)

Activity to be released by interface.

interfaceNameThe interface name of the Activity to release.

◆ setFocus()

bool alexaClientSDK::afml::Channel::setFocus ( avsCommon::avs::FocusState  focus,
avsCommon::avs::MixingBehavior  behavior,
bool  forceUpdate = false 

Updates the focus and notifies all activities associated with the Channel of the focus change. If FocusState is FOREGROUND, then the most recent Activity added to the Channel will be moved to foreground state, and all other Activites will remain in background state. This method does not return until the ChannelObserverInterface##onFocusChanged() callbacks to all the associated activities return. If the focus is NONE, the Activity will be removed from the Channel.

the MixingBehavior should pertain to the primary Activity for the Channel.
focusThe focus of the Channel.
behaviorThe MixingBehavior of the Channel.
forceUpdatebool to indicate if the operation must be forced (irrespective of focus/behavior change).
true if focus changed, else false.

◆ setPrimaryActivity()

void alexaClientSDK::afml::Channel::setPrimaryActivity ( std::shared_ptr< avsCommon::sdkInterfaces::FocusManagerInterface::Activity activity)

Set the Primary Activity on the Channel given the Activity Object. The function must be called after the correct FocusState of the Channel is set. Any other Activities on the Channel will be moved to the background state.

activityActivity to be set as Primary Activity.

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

AlexaClientSDK 1.26.0 - Copyright 2016-2021, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0