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

#include <DirectiveSequencerInterface.h>

Inheritance diagram for alexaClientSDK::avsCommon::sdkInterfaces::DirectiveSequencerInterface:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::avsCommon::sdkInterfaces::DirectiveSequencerInterface:
Collaboration graph
[legend]

Public Member Functions

 DirectiveSequencerInterface (const std::string &name)
 
virtual ~DirectiveSequencerInterface ()=default
 
virtual bool addDirectiveHandler (std::shared_ptr< DirectiveHandlerInterface > handler)=0
 
virtual bool removeDirectiveHandler (std::shared_ptr< DirectiveHandlerInterface > handler)=0
 
virtual void setDialogRequestId (const std::string &dialogRequestId)=0
 
virtual std::string getDialogRequestId ()=0
 
virtual bool onDirective (std::shared_ptr< avsCommon::avs::AVSDirective > directive)=0
 
virtual void disable ()=0
 
virtual void enable ()=0
 
- 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
 

Additional Inherited Members

- Protected Member Functions inherited from alexaClientSDK::avsCommon::utils::RequiresShutdown
virtual void doShutdown ()=0
 

Detailed Description

Interface for sequencing and handling a stream of AVSDirective instances.

Customers of this interface specify a mapping of AVSDirectives specified by (namespace, name) pairs to instances of the AVSDirectiveHandlerInterface via calls to setDirectiveHandlers(). Changes to this mapping can be made at any time by specifying a new mapping. Customers pass AVSDirectives in to this interface for processing via calls to onDirective(). AVSDirectives are processed in the order that they are received. AVSDirectives with a non-empty dialogRequestId value are filtered by the DirectiveSequencer's current dialogRequestId value (specified by calls to setDialogRequestId()). Only AVSDirectives with a dialogRequestId that is empty or which matches the last setting of the dialogRequestId are handled. All others are ignored. Specifying a new DialogRequestId value while AVSDirectives are already being handled will cancel the handling of AVSDirectives that have the previous DialogRequestId and whose handling has not completed.

Constructor & Destructor Documentation

◆ DirectiveSequencerInterface()

alexaClientSDK::avsCommon::sdkInterfaces::DirectiveSequencerInterface::DirectiveSequencerInterface ( const std::string &  name)
inline

Constructor.

Parameters
nameThe name of the class or object which requires shutdown calls. Used in log messages when problems are detected in shutdown or destruction sequences.

◆ ~DirectiveSequencerInterface()

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

Destructor.

Member Function Documentation

◆ addDirectiveHandler()

virtual bool alexaClientSDK::avsCommon::sdkInterfaces::DirectiveSequencerInterface::addDirectiveHandler ( std::shared_ptr< DirectiveHandlerInterface handler)
pure virtual

Add the specified handler as a handler for its specified routing rule and policy. If any of the mappings fail, the entire call is refused.

Note
If the handler provides rules that matches multiple directives, then DirectiveSequencer will look first for a handler whose configuration is an exact match. If no exact match is found, then the directive will be sent to the wildcard handler with the most specific rule. See DirectiveRoutingRule.h for more information on the rules available.
Parameters
handlerThe handler to add.
Returns
Whether the handler was added.

◆ disable()

virtual void alexaClientSDK::avsCommon::sdkInterfaces::DirectiveSequencerInterface::disable ( )
pure virtual

Disable the DirectiveSequencer.

Note
While disabled the DirectiveSequencer should not be able to handle directives.

Implemented in alexaClientSDK::adsl::DirectiveSequencer.

◆ enable()

virtual void alexaClientSDK::avsCommon::sdkInterfaces::DirectiveSequencerInterface::enable ( )
pure virtual

Enable the DirectiveSequencer.

Implemented in alexaClientSDK::adsl::DirectiveSequencer.

◆ getDialogRequestId()

virtual std::string alexaClientSDK::avsCommon::sdkInterfaces::DirectiveSequencerInterface::getDialogRequestId ( )
pure virtual

Returns the dialogRequestId currently in use for Directive handling. This may be the empty string if Directives have either experienced errors, or have been cancelled.

Returns
dialogRequestId The current dialog request id.

Implemented in alexaClientSDK::adsl::DirectiveSequencer, alexaClientSDK::adsl::test::MockDirectiveSequencer, and alexaClientSDK::avsCommon::sdkInterfaces::test::MockDirectiveSequencer.

◆ onDirective()

virtual bool alexaClientSDK::avsCommon::sdkInterfaces::DirectiveSequencerInterface::onDirective ( std::shared_ptr< avsCommon::avs::AVSDirective directive)
pure virtual

Sequence the handling of an AVSDirective. The actual handling is done by whichever DirectiveHandler is associated with the most specific routing rule.

Parameters
directiveThe AVSDirective to handle.
Returns
Whether or not the directive was accepted.

Implemented in alexaClientSDK::adsl::DirectiveSequencer.

◆ removeDirectiveHandler()

virtual bool alexaClientSDK::avsCommon::sdkInterfaces::DirectiveSequencerInterface::removeDirectiveHandler ( std::shared_ptr< DirectiveHandlerInterface handler)
pure virtual

Remove the specified handler's mapping of DirectiveRoutingRule to BlockingPolicy values. If the handler's configurations are unable to be removed, the entire operation is refused.

Parameters
handlerThe handler to remove.
Returns
Whether the handler was removed.

◆ setDialogRequestId()

virtual void alexaClientSDK::avsCommon::sdkInterfaces::DirectiveSequencerInterface::setDialogRequestId ( const std::string &  dialogRequestId)
pure virtual

Set the current DialogRequestId. This value can be set at any time. Setting this value causes a DirectiveSequencer to drop unhandled AVSDirectives with different (and non-empty) DialogRequestId values. AVSDirectives with a differing dialogRequestId value and whose pre-handling or handling is already in progress will be cancelled.

Parameters
dialogRequestIdThe new value for the current DialogRequestId.

Implemented in alexaClientSDK::adsl::DirectiveSequencer, alexaClientSDK::adsl::test::MockDirectiveSequencer, and alexaClientSDK::avsCommon::sdkInterfaces::test::MockDirectiveSequencer.


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