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::adsl::DirectiveRouter Class Reference

#include <DirectiveRouter.h>

Inheritance diagram for alexaClientSDK::adsl::DirectiveRouter:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::adsl::DirectiveRouter:
Collaboration graph
[legend]

Public Member Functions

 DirectiveRouter (std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > metricRecorder=nullptr)
 
bool addDirectiveHandler (std::shared_ptr< avsCommon::sdkInterfaces::DirectiveHandlerInterface > handler)
 
bool removeDirectiveHandler (std::shared_ptr< avsCommon::sdkInterfaces::DirectiveHandlerInterface > handler)
 
bool handleDirectiveImmediately (std::shared_ptr< avsCommon::avs::AVSDirective > directive)
 
bool preHandleDirective (std::shared_ptr< avsCommon::avs::AVSDirective > directive, std::unique_ptr< avsCommon::sdkInterfaces::DirectiveHandlerResultInterface > result)
 
bool handleDirective (const std::shared_ptr< avsCommon::avs::AVSDirective > &directive)
 
bool cancelDirective (std::shared_ptr< avsCommon::avs::AVSDirective > directive)
 
avsCommon::avs::BlockingPolicy getPolicy (const std::shared_ptr< avsCommon::avs::AVSDirective > &directive)
 
- 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

Detailed Description

Class to maintain a mapping from NamespaceAndName to HandlerAndPolicy, and to invoke DirectiveHandlerInterface methods on the DirectiveHandler registered for a given AVSDirective.

Constructor & Destructor Documentation

◆ DirectiveRouter()

alexaClientSDK::adsl::DirectiveRouter::DirectiveRouter ( std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface metricRecorder = nullptr)

Constructor.

Parameters
metricRecorderThe metric recorder.

Member Function Documentation

◆ addDirectiveHandler()

bool alexaClientSDK::adsl::DirectiveRouter::addDirectiveHandler ( std::shared_ptr< avsCommon::sdkInterfaces::DirectiveHandlerInterface handler)

Add mappings from handler's directives to BlockingPolicy values, gotten through the handler's getConfiguration() method. If a mapping for any of the specified directives already exists the entire call is refused.

Parameters
handlerThe handler to add.
Returns
Whether the handler was added.

◆ cancelDirective()

bool alexaClientSDK::adsl::DirectiveRouter::cancelDirective ( std::shared_ptr< avsCommon::avs::AVSDirective directive)

Invoke cancelDirective() on the handler registered for the given AVSDirective.

Parameters
directiveThe directive to be handled.
Returns
Whether or not the handler was invoked.

◆ getPolicy()

BlockingPolicy alexaClientSDK::adsl::DirectiveRouter::getPolicy ( const std::shared_ptr< avsCommon::avs::AVSDirective > &  directive)

Get the policy associated with the given directive.

Parameters
directiveThe directive for which the policy is required.
Returns
The corresponding BlockingPolicy value for the directive.

◆ handleDirective()

bool alexaClientSDK::adsl::DirectiveRouter::handleDirective ( const std::shared_ptr< avsCommon::avs::AVSDirective > &  directive)

Invoke handleDirective() on the handler registered for the given AVSDirective.

Parameters
directiveThe directive to be handled.
Returns
true if the the registered handler returned true. false if there was no registered handler or the registered handler returned false (indicating that the directive was not recognized.

◆ handleDirectiveImmediately()

bool alexaClientSDK::adsl::DirectiveRouter::handleDirectiveImmediately ( std::shared_ptr< avsCommon::avs::AVSDirective directive)

Invoke handleDirectiveImmediately() on the handler registered for the given AVSDirective.

Parameters
directiveThe directive to be handled immediately.
Returns
Whether or not the handler was invoked.

◆ preHandleDirective()

bool alexaClientSDK::adsl::DirectiveRouter::preHandleDirective ( std::shared_ptr< avsCommon::avs::AVSDirective directive,
std::unique_ptr< avsCommon::sdkInterfaces::DirectiveHandlerResultInterface result 
)

Invoke preHandleDirective() on the handler registered for the given AVSDirective.

Parameters
directiveThe directive to be preHandled.
resultA result object to receive notification about the completion (or failure) of handling the AVSDirective.
Returns
Whether or not the handler was invoked.

◆ removeDirectiveHandler()

bool alexaClientSDK::adsl::DirectiveRouter::removeDirectiveHandler ( std::shared_ptr< avsCommon::sdkInterfaces::DirectiveHandlerInterface handler)

Remove the specified mappings from NamespaceAndName values to BlockingPolicy values, gotten through the handler's getConfiguration() method. If any of the specified mappings do not match an existing mapping, the entire operation is refused.

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

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

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