AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
alexaClientSDK::sampleApplications::common::EndpointFocusAdapter Class Reference

#include <EndpointFocusAdapter.h>

Inheritance diagram for alexaClientSDK::sampleApplications::common::EndpointFocusAdapter:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::sampleApplications::common::EndpointFocusAdapter:
Collaboration graph
[legend]

Public Types

using FocusAcquiredCallback = std::function< void(void)>
 

Public Member Functions

virtual ~EndpointFocusAdapter ()=default
 
void acquireFocus (const std::string &interfaceName, FocusAcquiredCallback callback)
 
ChannelObserverInterface Functions
void onFocusChanged (avsCommon::avs::FocusState focusState, avsCommon::avs::MixingBehavior behavior) override
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::ChannelObserverInterface
virtual ~ChannelObserverInterface ()=default
 

Static Public Member Functions

static std::shared_ptr< EndpointFocusAdaptercreate (std::shared_ptr< avsCommon::sdkInterfaces::FocusManagerInterface > focusManager, std::shared_ptr< presentationOrchestratorInterfaces::PresentationOrchestratorInterface > presentationOrchestrator, std::shared_ptr< presentationOrchestratorInterfaces::PresentationOrchestratorStateTrackerInterface > presentationOrchestratorStateTracker)
 

Detailed Description

Class to handle focus management.

Member Typedef Documentation

◆ FocusAcquiredCallback

Constructor & Destructor Documentation

◆ ~EndpointFocusAdapter()

virtual alexaClientSDK::sampleApplications::common::EndpointFocusAdapter::~EndpointFocusAdapter ( )
virtualdefault

Destructor

Member Function Documentation

◆ acquireFocus()

void alexaClientSDK::sampleApplications::common::EndpointFocusAdapter::acquireFocus ( const std::string &  interfaceName,
FocusAcquiredCallback  callback 
)

Acquire visual and audio focus.

Parameters
interfaceNameThe interface requesting focus.
callbackThe function to be invoked when focus is acquired.

◆ create()

static std::shared_ptr<EndpointFocusAdapter> alexaClientSDK::sampleApplications::common::EndpointFocusAdapter::create ( std::shared_ptr< avsCommon::sdkInterfaces::FocusManagerInterface focusManager,
std::shared_ptr< presentationOrchestratorInterfaces::PresentationOrchestratorInterface presentationOrchestrator,
std::shared_ptr< presentationOrchestratorInterfaces::PresentationOrchestratorStateTrackerInterface presentationOrchestratorStateTracker 
)
static

Create an EndpointFocusAdapter object.

Parameters
focusManagerThe FocusManager, to handle audio focus.
presentationOrchestratorThe PresentationOrchestrator, to dismiss any existing presentations.
presentationOrchestratorStateTrackerThe PresentationOrchestratorStateTracker, to set and release the interface for visual focus.
Returns
A pointer to a new EndpointFocusAdapter object if it succeeds; otherwise, nullptr.

◆ onFocusChanged()

void alexaClientSDK::sampleApplications::common::EndpointFocusAdapter::onFocusChanged ( avsCommon::avs::FocusState  newFocus,
avsCommon::avs::MixingBehavior  behavior 
)
overridevirtual

Used to notify the observer of the Channel of focus changes. Once called, the client should make a user observable change only and return immediately. Any additional work that needs to be done should be done on a separate thread or after returning. "User observable change" here refers to events that the end user of the product can visibly see or hear. For example, Alexa speech or music playing would be examples of user observable changes. Other work, such as database storing, logging, or communicating via network should be done on a different thread. Not doing so could result in delays for other clients trying to access the Channel.

Parameters
newFocusThe new Focus of the channel.
behaviorThe mixingBehavior for the ChannelObserver to take as per the interrupt model
Note
when newFocus is FocusState::FOREGROUND, the MixingBehavior shall be guaranteed to be PRIMARY when newFocus is FocusState::NONE, the MixingBehavior shall be guaranteed to be MUST_STOP

Implements alexaClientSDK::avsCommon::sdkInterfaces::ChannelObserverInterface.


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

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