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

#include <DirectiveHandlerInterface.h>

Inheritance diagram for alexaClientSDK::avsCommon::sdkInterfaces::DirectiveHandlerInterface:
Inheritance graph
[legend]

Public Member Functions

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
 
virtual bool handleDirective (const std::string &messageId)=0
 
virtual void cancelDirective (const std::string &messageId)=0
 
virtual void onDeregistered ()=0
 
virtual avs::DirectiveHandlerConfiguration getConfiguration () const =0
 

Detailed Description

Interface for handling AVSDirectives. For each AVSDirective received, implementations of this interface should expect either a single call to handleDirectiveImmediately() or a call to preHandleDirective() followed by a call to handleDirective() unless cancelDirective() is called first. cancelDirective() may also be called after handleDirective().

Note
The implementation of the methods of this interface MUST be thread-safe.
The implementation of the methods of this interface MUST return quickly. Failure to do so blocks the processing of subsequent AVSDirectives.

Constructor & Destructor Documentation

◆ ~DirectiveHandlerInterface()

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

Destructor.

Member Function Documentation

◆ cancelDirective()

virtual void alexaClientSDK::avsCommon::sdkInterfaces::DirectiveHandlerInterface::cancelDirective ( const std::string &  messageId)
pure virtual

Cancel an ongoing preHandleDirective() or handleDirective() operation for the specified AVSDirective. Once this has been called the DirectiveHandler 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
messageIdThe message ID of a directive previously passed to preHandleDirective().

Implemented in alexaClientSDK::avsCommon::avs::CapabilityAgent, alexaClientSDK::integration::test::TestDirectiveHandler, and alexaClientSDK::avsCommon::avs::test::TestDirectiveHandler.

◆ getConfiguration()

virtual avs::DirectiveHandlerConfiguration alexaClientSDK::avsCommon::sdkInterfaces::DirectiveHandlerInterface::getConfiguration ( ) const
pure virtual

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.

Implemented in alexaClientSDK::avsCommon::test::MockCapabilityAgent, alexaClientSDK::capabilityAgents::aip::AudioInputProcessor, alexaClientSDK::acsdkBluetooth::Bluetooth, alexaClientSDK::capabilityAgents::externalMediaPlayer::ExternalMediaPlayer, alexaClientSDK::acsdkAudioPlayer::AudioPlayer, alexaClientSDK::acsdkAlerts::AlertsCapabilityAgent, alexaClientSDK::acsdkNotifications::NotificationsCapabilityAgent, alexaClientSDK::capabilityAgents::speechSynthesizer::SpeechSynthesizer, alexaClientSDK::capabilityAgents::mrm::MRMCapabilityAgent, alexaClientSDK::capabilityAgents::modeController::ModeControllerCapabilityAgent, alexaClientSDK::capabilityAgents::rangeController::RangeControllerCapabilityAgent, alexaClientSDK::capabilityAgents::templateRuntime::TemplateRuntime, alexaClientSDK::capabilityAgents::speakerManager::SpeakerManager, alexaClientSDK::capabilityAgents::toggleController::ToggleControllerCapabilityAgent, alexaClientSDK::capabilityAgents::equalizer::EqualizerCapabilityAgent, alexaClientSDK::capabilityAgents::system::SoftwareInfoSender, alexaClientSDK::capabilityAgents::interactionModel::InteractionModelCapabilityAgent, alexaClientSDK::capabilityAgents::doNotDisturb::DoNotDisturbCapabilityAgent, alexaClientSDK::capabilityAgents::powerController::PowerControllerCapabilityAgent, alexaClientSDK::capabilityAgents::system::ReportStateHandler, alexaClientSDK::integration::test::TestDirectiveHandler, alexaClientSDK::capabilityAgents::alexa::AlexaInterfaceCapabilityAgent, alexaClientSDK::capabilityAgents::system::TimeZoneHandler, alexaClientSDK::capabilityAgents::system::UserInactivityMonitor, alexaClientSDK::capabilityAgents::apiGateway::ApiGatewayCapabilityAgent, alexaClientSDK::capabilityAgents::system::LocaleHandler, alexaClientSDK::capabilityAgents::system::RevokeAuthorizationHandler, and alexaClientSDK::avsCommon::avs::test::TestDirectiveHandler.

◆ handleDirective()

virtual bool alexaClientSDK::avsCommon::sdkInterfaces::DirectiveHandlerInterface::handleDirective ( const std::string &  messageId)
pure virtual

Handle the action specified by the directive identified by messageId. The handling of subsequent directives with the same DialogRequestId may be blocked until the DirectiveHandler calls the setSucceeded() method of the DirectiveHandlingResult instance passed in to the preHandleDirective() call for the directive specified by messageId. If handling of this directive fails such that subsequent directives with the same DialogRequestId should be cancelled, this DirectiveHandler should instead call setFailed() to indicate a failure.

Note
If this operation fails, an ExceptionEncountered message should be sent to AVS.
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
messageIdThe message ID of a directive previously passed to preHandleDirective().
Returns
false when messageId is not recognized, else true. Any errors related to handling of a valid messageId should be reported using DirectiveHandlerResultInterface::setFailed().

Implemented in alexaClientSDK::avsCommon::avs::CapabilityAgent, alexaClientSDK::integration::test::TestDirectiveHandler, and alexaClientSDK::avsCommon::avs::test::TestDirectiveHandler.

◆ handleDirectiveImmediately()

virtual void alexaClientSDK::avsCommon::sdkInterfaces::DirectiveHandlerInterface::handleDirectiveImmediately ( std::shared_ptr< avsCommon::avs::AVSDirective directive)
pure virtual

Handle the action specified AVSDirective. Once this has been called the DirectiveHandler 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.
If this operation fails, an ExceptionEncountered message should be sent to AVS.
Parameters
directiveThe directive to handle.

◆ onDeregistered()

virtual void alexaClientSDK::avsCommon::sdkInterfaces::DirectiveHandlerInterface::onDeregistered ( )
pure virtual

◆ preHandleDirective()

virtual void alexaClientSDK::avsCommon::sdkInterfaces::DirectiveHandlerInterface::preHandleDirective ( std::shared_ptr< avsCommon::avs::AVSDirective directive,
std::unique_ptr< DirectiveHandlerResultInterface result 
)
pure virtual

Notification that a directive has arrived. This notification gives the DirectiveHandler a chance to prepare for handling the directive. For example, the DirectiveHandler might use this notification to start downloading an asset that will be required when it becomes time to actually handle the directive. The DirectiveHandler will be notified when it should start the actual handling of the directive by a subsequent call to handleDirective(). 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
If this operation fails, an ExceptionEncountered message should be sent to AVS.
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
directiveThe directive to pre-handle.
resultAn object to receive the result of the operation.

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

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