AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Classes | Public Member Functions | Protected Types | Protected Member Functions | List of all members
alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent Class Referenceabstract

#include <BaseAPLCapabilityAgent.h>

Inheritance diagram for alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent:
Collaboration graph
[legend]

Classes

struct  PresentationSessionFieldNames
 

Public Member Functions

 BaseAPLCapabilityAgent (const std::string &avsNamespace, std::shared_ptr< alexaClientSDK::avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface > exceptionSender, std::shared_ptr< alexaClientSDK::avsCommon::utils::metrics::MetricRecorderInterface > metricRecorder, std::shared_ptr< alexaClientSDK::avsCommon::sdkInterfaces::MessageSenderInterface > messageSender, std::shared_ptr< alexaClientSDK::avsCommon::sdkInterfaces::ContextManagerInterface > contextManager, const std::string &APLMaxVersion, std::shared_ptr< alexaClientSDK::aplCapabilityCommonInterfaces::VisualStateProviderInterface > visualStateProvider=nullptr)
 
virtual ~BaseAPLCapabilityAgent ()=default
 
virtual bool initialize ()
 
void setExecutor (const std::shared_ptr< alexaClientSDK::avsCommon::utils::threading::Executor > &executor)
 Tests Facing interfaces. More...
 
CapabilityAgent/DirectiveHandlerInterface Functions

Device SDK Facing Interfaces

void handleDirectiveImmediately (std::shared_ptr< alexaClientSDK::avsCommon::avs::AVSDirective > directive) override
 
void preHandleDirective (std::shared_ptr< DirectiveInfo > info) override
 
void handleDirective (std::shared_ptr< DirectiveInfo > info) override
 
void cancelDirective (std::shared_ptr< DirectiveInfo > info) override
 
alexaClientSDK::avsCommon::avs::DirectiveHandlerConfiguration getConfiguration () const override
 
CapabilityConfigurationInterface Functions
std::unordered_set< std::shared_ptr< alexaClientSDK::avsCommon::avs::CapabilityConfiguration > > getCapabilityConfigurations () override
 
ContextRequesterInterface Functions
void onContextAvailable (const std::string &jsonContext) override
 
void onContextFailure (const alexaClientSDK::avsCommon::sdkInterfaces::ContextRequestError error) override
 
StateProviderInterface Functions
void provideState (const alexaClientSDK::avsCommon::avs::NamespaceAndName &stateProviderName, unsigned int stateRequestToken) override
 
void doShutdown () override
 
APLCapabilityAgentInterface functions
void onActiveDocumentChanged (const aplCapabilityCommonInterfaces::PresentationToken &token, const alexaClientSDK::aplCapabilityCommonInterfaces::PresentationSession &session) override
 
void clearExecuteCommands (const aplCapabilityCommonInterfaces::PresentationToken &token=std::string(), const bool markAsFailed=true) override
 
void sendUserEvent (const aplCapabilityCommonInterfaces::aplEventPayload::UserEvent &eventPayload) override
 
void sendDataSourceFetchRequestEvent (const aplCapabilityCommonInterfaces::aplEventPayload::DataSourceFetch &fetchPayload) override
 
void sendRuntimeErrorEvent (const aplCapabilityCommonInterfaces::aplEventPayload::RuntimeError &errors) override
 
void onVisualContextAvailable (avsCommon::sdkInterfaces::ContextRequestToken requestToken, const aplCapabilityCommonInterfaces::aplEventPayload::VisualContext &context) override
 
void processRenderDocumentResult (const aplCapabilityCommonInterfaces::PresentationToken &token, const bool result, const std::string &error) override
 
void processExecuteCommandsResult (const aplCapabilityCommonInterfaces::PresentationToken &token, aplCapabilityCommonInterfaces::APLCommandExecutionEvent event, const std::string &error) override
 
void recordRenderComplete (const std::chrono::steady_clock::time_point &timestamp) override
 
void proactiveStateReport () override
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::avs::CapabilityAgent
virtual ~CapabilityAgent ()=default
 
void preHandleDirective (std::shared_ptr< AVSDirective > directive, std::unique_ptr< sdkInterfaces::DirectiveHandlerResultInterface > result) override final
 
bool handleDirective (const std::string &messageId) override final
 
void cancelDirective (const std::string &messageId) override final
 
void onDeregistered () override
 
void onFocusChanged (FocusState newFocus, MixingBehavior behavior) override
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::DirectiveHandlerInterface
virtual ~DirectiveHandlerInterface ()=default
 
virtual void handleDirectiveImmediately (std::shared_ptr< avsCommon::avs::AVSDirective > directive)=0
 
virtual void preHandleDirective (std::shared_ptr< avsCommon::avs::AVSDirective > directive, std::unique_ptr< DirectiveHandlerResultInterface > result)=0
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::ChannelObserverInterface
virtual ~ChannelObserverInterface ()=default
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::StateProviderInterface
virtual ~StateProviderInterface ()=default
 
virtual void provideState (const avs::CapabilityTag &stateProviderName, const ContextRequestToken stateRequestToken)
 
virtual bool canStateBeRetrieved ()
 
virtual bool hasReportableStateProperties ()
 
virtual bool shouldQueryState ()
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::ContextRequesterInterface
virtual ~ContextRequesterInterface ()=default
 
virtual void onContextAvailable (const endpoints::EndpointIdentifier &endpointId, const avs::AVSContext &endpointContext, ContextRequestToken requestToken)
 
virtual void onContextFailure (const ContextRequestError error, ContextRequestToken token)
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::utils::RequiresShutdown
 RequiresShutdown (const std::string &name)
 
virtual ~RequiresShutdown ()
 Destructor. More...
 
const std::string & name () const
 
void shutdown ()
 
bool isShutdown () const
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::CapabilityConfigurationInterface
virtual ~CapabilityConfigurationInterface ()=default
 
- Public Member Functions inherited from alexaClientSDK::aplCapabilityCommonInterfaces::APLCapabilityAgentInterface
virtual ~APLCapabilityAgentInterface ()=default
 
- Public Member Functions inherited from alexaClientSDK::notifier::Notifier< aplCapabilityCommonInterfaces::APLCapabilityAgentObserverInterface >
 Notifier ()
 
void addObserver (const std::shared_ptr< aplCapabilityCommonInterfaces::APLCapabilityAgentObserverInterface > &observer) override
 Add an observer. More...
 
void removeObserver (const std::shared_ptr< aplCapabilityCommonInterfaces::APLCapabilityAgentObserverInterface > &observer) override
 Remove an observer. More...
 
void addWeakPtrObserver (const std::weak_ptr< aplCapabilityCommonInterfaces::APLCapabilityAgentObserverInterface > &observer) override
 Add a weak reference to an observer. More...
 
void removeWeakPtrObserver (const std::weak_ptr< aplCapabilityCommonInterfaces::APLCapabilityAgentObserverInterface > &observer) override
 Remove an observer. More...
 
void notifyObservers (std::function< void(const std::shared_ptr< aplCapabilityCommonInterfaces::APLCapabilityAgentObserverInterface > &)> notify) override
 Notify the observers in the order that they were added. More...
 
bool notifyObserversInReverse (std::function< void(const std::shared_ptr< aplCapabilityCommonInterfaces::APLCapabilityAgentObserverInterface > &)> notify) override
 Notify the observers in the reverse order that they were added. More...
 
void setAddObserverFunction (std::function< void(const std::shared_ptr< aplCapabilityCommonInterfaces::APLCapabilityAgentObserverInterface > &)> addObserverFunc) override
 Set a function for notifications on an observer additions. More...
 
- Public Member Functions inherited from alexaClientSDK::notifierInterfaces::NotifierInterface< aplCapabilityCommonInterfaces::APLCapabilityAgentObserverInterface >
virtual ~NotifierInterface ()=default
 

Protected Types

enum  DirectiveType {
  DirectiveType::RENDER_DOCUMENT, DirectiveType::SHOW_DOCUMENT, DirectiveType::EXECUTE_COMMAND, DirectiveType::DYNAMIC_TOKEN_DATA_SOURCE_UPDATE,
  DirectiveType::DYNAMIC_INDEX_DATA_SOURCE_UPDATE, DirectiveType::UNKNOWN
}
 Concrete Implementation Facing Interfaces. More...
 
enum  MetricEvent { MetricEvent::RENDER_DOCUMENT }
 Enumeration of timer metrics events that could be emitted. More...
 
enum  MetricActivity { MetricActivity::ACTIVITY_RENDER_DOCUMENT, MetricActivity::ACTIVITY_RENDER_DOCUMENT_FAIL }
 Enumeration of timer metric activity names that could be emitted. More...
 

Protected Member Functions

virtual alexaClientSDK::avsCommon::avs::DirectiveHandlerConfiguration getAPLDirectiveConfiguration () const =0
 Template Methods to be implemented in Concrete Implementations. More...
 
virtual std::unordered_set< std::shared_ptr< alexaClientSDK::avsCommon::avs::CapabilityConfiguration > > getAPLCapabilityConfigurations (const std::string &APLMaxVersion)=0
 
virtual DirectiveType getDirectiveType (std::shared_ptr< DirectiveInfo > info)=0
 
virtual const std::string & getConfigurationRootKey ()=0
 
virtual const std::string & getMetricDataPointName (MetricEvent event)=0
 
virtual const std::string & getMetricActivityName (MetricActivity activity)=0
 
virtual PresentationSessionFieldNames getPresentationSessionFieldNames ()=0
 
virtual const bool shouldPackPresentationSessionToAvsEvents ()=0
 
void handleUnknownDirective (std::shared_ptr< DirectiveInfo > info)
 
void setHandlingCompleted (std::shared_ptr< DirectiveInfo > info)
 
std::shared_ptr< alexaClientSDK::avsCommon::utils::threading::ExecutorgetExecutor ()
 
- Protected Member Functions inherited from alexaClientSDK::avsCommon::avs::CapabilityAgent
 CapabilityAgent (const std::string &nameSpace, std::shared_ptr< sdkInterfaces::ExceptionEncounteredSenderInterface > exceptionEncounteredSender)
 
virtual std::shared_ptr< DirectiveInfocreateDirectiveInfo (std::shared_ptr< AVSDirective > directive, std::unique_ptr< sdkInterfaces::DirectiveHandlerResultInterface > result)
 
void removeDirective (const std::string &messageId)
 
void sendExceptionEncounteredAndReportFailed (std::shared_ptr< DirectiveInfo > info, const std::string &message, avsCommon::avs::ExceptionErrorType type=avsCommon::avs::ExceptionErrorType::INTERNAL_ERROR)
 
const std::pair< std::string, std::string > buildJsonEventString (const std::string &eventName, const std::string &dialogRequestIdString="", const std::string &payload="{}", const std::string &context="") const
 

Additional Inherited Members

- Protected Attributes inherited from alexaClientSDK::avsCommon::avs::CapabilityAgent
const std::string m_namespace
 The namespace of the capability agent. More...
 
std::shared_ptr< sdkInterfaces::ExceptionEncounteredSenderInterfacem_exceptionEncounteredSender
 Object to use to send exceptionEncountered messages. More...
 

Detailed Description

This base class for an Alexa Presentation Language CapabilityAgent that handles rendering APL documents.

Clients interested in APL events can subscribe themselves as an observer, and the clients will be notified via the Capability Agent Observer interface.

Member Enumeration Documentation

◆ DirectiveType

Concrete Implementation Facing Interfaces.

Directive Types that could be received from AVS

Enumerator
RENDER_DOCUMENT 

Directive contains an APL document to be rendered.

SHOW_DOCUMENT 

Directive indicates that a previously received document should be now displayed.

EXECUTE_COMMAND 

Directive contains one or multiple APL commands to be executed.

DYNAMIC_TOKEN_DATA_SOURCE_UPDATE 

Directive indicates that token should be updated.

DYNAMIC_INDEX_DATA_SOURCE_UPDATE 

Directive indicates that index should be updated.

UNKNOWN 

Unknown directive received.

◆ MetricActivity

Enumeration of timer metric activity names that could be emitted.

Enumerator
ACTIVITY_RENDER_DOCUMENT 

When render document has completed successfully.

ACTIVITY_RENDER_DOCUMENT_FAIL 

When render document fails.

◆ MetricEvent

Enumeration of timer metrics events that could be emitted.

Enumerator
RENDER_DOCUMENT 

Metric to record time-taken to render document.

Constructor & Destructor Documentation

◆ BaseAPLCapabilityAgent()

alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::BaseAPLCapabilityAgent ( const std::string &  avsNamespace,
std::shared_ptr< alexaClientSDK::avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface exceptionSender,
std::shared_ptr< alexaClientSDK::avsCommon::utils::metrics::MetricRecorderInterface metricRecorder,
std::shared_ptr< alexaClientSDK::avsCommon::sdkInterfaces::MessageSenderInterface messageSender,
std::shared_ptr< alexaClientSDK::avsCommon::sdkInterfaces::ContextManagerInterface contextManager,
const std::string &  APLMaxVersion,
std::shared_ptr< alexaClientSDK::aplCapabilityCommonInterfaces::VisualStateProviderInterface visualStateProvider = nullptr 
)

Constructor.

Parameters
avsNamepaceThe AVS namespace interface this CA operations within.
exceptionSenderThe object to use for sending AVS Exception messages.
metricRecorderThe object to use for recording metrics.
messageSenderThe MessageSenderInterface that sends events to AVS.
contextManagerThe ContextManagerInterface used to generate system context for events.
APLMaxVersionThe APL version supported.
visualStateProviderThe VisualStateProviderInterface used to request visual context.

◆ ~BaseAPLCapabilityAgent()

virtual alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::~BaseAPLCapabilityAgent ( )
virtualdefault

Destructor.

Member Function Documentation

◆ cancelDirective()

void alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::cancelDirective ( std::shared_ptr< DirectiveInfo info)
overridevirtual

Cancel an ongoing preHandleDirective() or handleDirective() operation for the AVSDirective in . Once this has been called the CapabilityAgent should not expect to receive further calls regarding this directive.

Note
The implementation of this method MUST be thread-safe.
The implementation of this method MUST return quickly. Failure to do so blocks the processing of subsequent AVSDirectives.
Parameters
infoThe DirectiveInfo instance for the AVSDirective to process.

Implements alexaClientSDK::avsCommon::avs::CapabilityAgent.

◆ clearExecuteCommands()

void alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::clearExecuteCommands ( const aplCapabilityCommonInterfaces::PresentationToken token = std::string(),
const bool  markAsFailed = true 
)
overridevirtual

This function clears last received ExecuteCommands directive (if it's still active) and mark them as failed.

Parameters
tokenThe token. This should be passed in if we are clearing execute commands due to APL-specific trigger (eg. Finish command). This should be left empty if we are clearing due to global triggers (eg. back navigation)
markAsFailedWhether to mark the cleared commands as failed.

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLCapabilityAgentInterface.

◆ doShutdown()

void alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::doShutdown ( )
overridevirtual

Prepares/enables this object to be deleted. This should be the last function called on this object prior to deleting (or resetting) its shared_ptr.

Warning
  • Attempting to call functions on this object after calling shutdown() can result in undefined behavior.
  • Neglecting to call shutdown() on this object can result in resource leaks or other undefined behavior.

Implements alexaClientSDK::avsCommon::utils::RequiresShutdown.

◆ getAPLCapabilityConfigurations()

virtual std::unordered_set<std::shared_ptr<alexaClientSDK::avsCommon::avs::CapabilityConfiguration> > alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::getAPLCapabilityConfigurations ( const std::string &  APLMaxVersion)
protectedpure virtual

Get specific capability configuration for this APL Capability Agent

Implemented in alexaClientSDK::aplCapabilityCommon::test::APLCATest.

◆ getAPLDirectiveConfiguration()

virtual alexaClientSDK::avsCommon::avs::DirectiveHandlerConfiguration alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::getAPLDirectiveConfiguration ( ) const
protectedpure virtual

Template Methods to be implemented in Concrete Implementations.

Get specific directive handler configuration for this APL Capability Agent

Implemented in alexaClientSDK::aplCapabilityCommon::test::APLCATest.

◆ getCapabilityConfigurations()

std::unordered_set<std::shared_ptr<alexaClientSDK::avsCommon::avs::CapabilityConfiguration> > alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::getCapabilityConfigurations ( )
overridevirtual

Returns the configurations of the capability interfaces being implemented.

Returns
A set of CapabilityConfigurations

Implements alexaClientSDK::avsCommon::sdkInterfaces::CapabilityConfigurationInterface.

◆ getConfiguration()

alexaClientSDK::avsCommon::avs::DirectiveHandlerConfiguration alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::getConfiguration ( ) const
overridevirtual

Returns the configuration of the directive handler.

The configuration consists of multiple directive routing rules and their respective blocking policy. The directives will be matched from the most specific rule (with all fields defined) to the least specific rule (which only matches the directive endpointId).

Returns
The avs::DirectiveHandlerConfiguration of the handler.

Implements alexaClientSDK::avsCommon::sdkInterfaces::DirectiveHandlerInterface.

◆ getConfigurationRootKey()

virtual const std::string& alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::getConfigurationRootKey ( )
protectedpure virtual

Get root key for the configuration values in the AVS json configuration

Implemented in alexaClientSDK::aplCapabilityCommon::test::APLCATest.

◆ getDirectiveType()

virtual DirectiveType alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::getDirectiveType ( std::shared_ptr< DirectiveInfo info)
protectedpure virtual

Get DirectiveType from Directive header information

Implemented in alexaClientSDK::aplCapabilityCommon::test::APLCATest.

◆ getExecutor()

std::shared_ptr<alexaClientSDK::avsCommon::utils::threading::Executor> alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::getExecutor ( )
protected

Get the executor used as the worker thread

Returns
The Executor shared_ptr

◆ getMetricActivityName()

virtual const std::string& alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::getMetricActivityName ( MetricActivity  activity)
protectedpure virtual

Given a Metric Activity, provide the metric data point name to publish.

Implemented in alexaClientSDK::aplCapabilityCommon::test::APLCATest.

◆ getMetricDataPointName()

virtual const std::string& alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::getMetricDataPointName ( MetricEvent  event)
protectedpure virtual

Given a Metric Event, provide the metric data point name to publish.

Implemented in alexaClientSDK::aplCapabilityCommon::test::APLCATest.

◆ getPresentationSessionFieldNames()

virtual PresentationSessionFieldNames alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::getPresentationSessionFieldNames ( )
protectedpure virtual

In presentation session part of RenderDocument directives, there are some field names that differ slightly between CAs, the derived class may override this function to provide the field names that represent these fields in the directive.

Implemented in alexaClientSDK::aplCapabilityCommon::test::APLCATest.

◆ handleDirective()

void alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::handleDirective ( std::shared_ptr< DirectiveInfo info)
overridevirtual

Handle the action specified by the AVSDirective in info. The handling of subsequent directives with the same DialogRequestId may be blocked until the DirectiveHandler calls the setSucceeded() method of the DirectiveHandlingResult present in info. If handling of this directive fails setFailed() should be called to indicate a failure.

Note
The implementation of this method MUST be thread-safe.
The implementation of this method MUST return quickly. Failure to do so blocks the processing of subsequent AVSDirectives.
Parameters
infoThe DirectiveInfo instance for the AVSDirective to process.

Implements alexaClientSDK::avsCommon::avs::CapabilityAgent.

◆ handleDirectiveImmediately()

void alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::handleDirectiveImmediately ( std::shared_ptr< alexaClientSDK::avsCommon::avs::AVSDirective directive)
override

◆ handleUnknownDirective()

void alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::handleUnknownDirective ( std::shared_ptr< DirectiveInfo info)
protected

This function handles any unknown directives received.

Parameters
infoThe DirectiveInfo containing the AVSDirective and the DirectiveHandlerResultInterface.

◆ initialize()

virtual bool alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::initialize ( )
virtual

Intialize APL CA based on the configurations

◆ onActiveDocumentChanged()

void alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::onActiveDocumentChanged ( const aplCapabilityCommonInterfaces::PresentationToken token,
const alexaClientSDK::aplCapabilityCommonInterfaces::PresentationSession session 
)
overridevirtual

This function notifies the APL CA that the active document has been replaced.

Note
A change to the active document does not indicate that the previous document was dismissed.
Parameters
tokenThe new active document token
sessionThe new presentation session

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLCapabilityAgentInterface.

◆ onContextAvailable()

void alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::onContextAvailable ( const std::string &  jsonContext)
overridevirtual

This is called by the ContextManager once the context is ready and available.

Deprecated:
This method is being deprecated since it cannot specify the source endpoint.
Note
The ContextRequester should perform minimum processing and return quickly. Otherwise it will block the processing of updating the of other ContextProviders.
Parameters
jsonContextContext information.Context provided is of the format {"context"[{...}, {...}]}

Reimplemented from alexaClientSDK::avsCommon::sdkInterfaces::ContextRequesterInterface.

◆ onContextFailure()

void alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::onContextFailure ( const alexaClientSDK::avsCommon::sdkInterfaces::ContextRequestError  error)
overridevirtual

The contextManager calls this if it is unable to process a getContext request successfully.

Deprecated:
This method is being deprecated since it cannot specify the optional token.
Note
The ContextRequester should perform minimum processing and return quickly. Otherwise it will block the processing of updating the of other ContextProviders.
Parameters
errorThe reason why the getContext request failed.

Reimplemented from alexaClientSDK::avsCommon::sdkInterfaces::ContextRequesterInterface.

◆ onVisualContextAvailable()

void alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::onVisualContextAvailable ( avsCommon::sdkInterfaces::ContextRequestToken  requestToken,
const aplCapabilityCommonInterfaces::aplEventPayload::VisualContext visualContext 
)
overridevirtual

This function is called by the clients to provide the visual context to be passed to AVS.

Parameters
requestTokenThe token of the request for which this function is called. This should match the request token provided in VisualStateProviderInterface
contextThe visual state to be passed to AVS. The caller of this function is responsible to pass the payload as it defined in aplEventPayload::VisualContext

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLCapabilityAgentInterface.

◆ preHandleDirective()

void alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::preHandleDirective ( std::shared_ptr< DirectiveInfo info)
overridevirtual

Notification that a directive has arrived. This notification gives the DirectiveHandler a chance to prepare for handling of an AVSDirective. If an error occurs during the pre-Handling phase and that error should cancel the handling of subsequent AVSDirectives with the same DialogRequestId, the DirectiveHandler should call the setFailed method on the result instance passed in to this call.

Note
The implementation of this method MUST be thread-safe.
The implementation of this method MUST return quickly. Failure to do so blocks the processing of subsequent AVSDirectives.
Parameters
infoThe DirectiveInfo instance for the AVSDirective to process.

Implements alexaClientSDK::avsCommon::avs::CapabilityAgent.

◆ proactiveStateReport()

void alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::proactiveStateReport ( )
overridevirtual

The function notifies the CA to initiate a proactive state report

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLCapabilityAgentInterface.

◆ processExecuteCommandsResult()

void alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::processExecuteCommandsResult ( const aplCapabilityCommonInterfaces::PresentationToken token,
aplCapabilityCommonInterfaces::APLCommandExecutionEvent  event,
const std::string &  error 
)
overridevirtual

Process result of ExecuteCommands directive.

Parameters
tokenrequest token
eventthe command result as defined in APLCommandExecutionEvent
errorerror message provided in case if result is false

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLCapabilityAgentInterface.

◆ processRenderDocumentResult()

void alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::processRenderDocumentResult ( const aplCapabilityCommonInterfaces::PresentationToken token,
const bool  result,
const std::string &  error 
)
overridevirtual

Process result of RenderDocument directive.

Parameters
tokendocument presentationToken.
resultrendering result (true on rendered, false on exception).
errorerror message provided in case if result is false

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLCapabilityAgentInterface.

◆ provideState()

void alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::provideState ( const alexaClientSDK::avsCommon::avs::NamespaceAndName stateProviderName,
unsigned int  stateRequestToken 
)
overridevirtual

A request to a StateProvider to provide the state. The StateProvider should perform minimum processing and return quickly, otherwise it will block the processing of updating the states of other StateProviders. The ContextManager specifies a token which it uses to track the getContext request associated with this provideState request. The stateProviderInterface must use the same token when it updates its state via the setState call.

: The setState method MUST be called from a different thread from where the provideState method is being called from.

Parameters
stateProviderNameThe name of the state provider.
stateRequestTokenThe token to use in the setState call.
Deprecated:
NamespaceAndName is being deprecated. Use the CapabilityMessageIdentifier version instead.

Reimplemented from alexaClientSDK::avsCommon::sdkInterfaces::StateProviderInterface.

◆ recordRenderComplete()

void alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::recordRenderComplete ( const std::chrono::steady_clock::time_point &  timestamp)
overridevirtual

Record the finish event for currently rendering document

Parameters
timestampThe timestamp at which the document was rendered

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLCapabilityAgentInterface.

◆ sendDataSourceFetchRequestEvent()

void alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::sendDataSourceFetchRequestEvent ( const aplCapabilityCommonInterfaces::aplEventPayload::DataSourceFetch payload)
overridevirtual

Send DataSourceFetchRequest to AVS

Parameters
payloadThe DataSourceFetchRequest event payload. The caller of this function is responsible to pass the payload as it defined in aplEventPayload::DataSourceFetch.

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLCapabilityAgentInterface.

◆ sendRuntimeErrorEvent()

void alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::sendRuntimeErrorEvent ( const aplCapabilityCommonInterfaces::aplEventPayload::RuntimeError payload)
overridevirtual

Send RuntimeError to AVS

Parameters
payloadThe RuntimeError event payload. The caller of this function is responsible to pass the payload as it defined in aplEventPayload::RuntimeError.

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLCapabilityAgentInterface.

◆ sendUserEvent()

void alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::sendUserEvent ( const aplCapabilityCommonInterfaces::aplEventPayload::UserEvent payload)
overridevirtual

Send UserEvent to AVS

Parameters
payloadThe UserEvent event payload. The caller of this function is responsible to pass the payload as it defined in aplEventPayload::UserEvent.

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLCapabilityAgentInterface.

◆ setExecutor()

void alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::setExecutor ( const std::shared_ptr< alexaClientSDK::avsCommon::utils::threading::Executor > &  executor)

Tests Facing interfaces.

Set the executor used as the worker thread

Parameters
executorThe Executor to set
Note
This function should only be used for testing purposes. No call to any other method should be done prior to this call.

◆ setHandlingCompleted()

void alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::setHandlingCompleted ( std::shared_ptr< DirectiveInfo info)
protected

Send the handling completed notification and clean up the resources.

Parameters
infoThe DirectiveInfo containing the AVSDirective and the DirectiveHandlerResultInterface.

◆ shouldPackPresentationSessionToAvsEvents()

virtual const bool alexaClientSDK::aplCapabilityCommon::BaseAPLCapabilityAgent::shouldPackPresentationSessionToAvsEvents ( )
protectedpure virtual

Whether AVS events should include presentationSession in their payload.

Implemented in alexaClientSDK::aplCapabilityCommon::test::APLCATest.


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