![]()  | 
  
    AlexaClientSDK
    3.0.0
    
   A cross-platform, modular SDK for interacting with the Alexa Voice Service 
   | 
 
#include <DirectiveProcessor.h>
Public Member Functions | |
| DirectiveProcessor (DirectiveRouter *directiveRouter) | |
| ~DirectiveProcessor () | |
| void | setDialogRequestId (const std::string &dialogRequestId) | 
| std::string | getDialogRequestId () | 
| bool | onDirective (std::shared_ptr< avsCommon::avs::AVSDirective > directive) | 
| void | shutdown () | 
| void | disable () | 
| bool | enable () | 
Object to process AVSDirectives that have a non-empty dialogRequestId. 
DirectiveProcessor receives directives via its onDirective() method. The dialogRequestId property of incoming directives is checked against the current dialogRequestId (which is set by setDialogRequestId()). If the AVSDirective's value is not empty and does not match, the AVSDirective is dropped, and onDirective() returns true to indicate that the AVSDirective has been consumed (in this case, because it is not longer relevant). AVSDirective is forwarded to the preHandleDirective() method of whichever DirectiveHandler is registered to handle the AVSDirective. If no DirectiveHandler is registered, the incoming directive is rejected and any directives with the same dialogRequestId that are already queued for handling by the DirectiveProcessor are canceled (because an entire dialog is canceled when the handling of any of its directives fails), and onDirective() returns false to indicate that the unhandled AVDirective was rejected. AVSDirective has been successfully forwarded for preHandling, it is enqueued awaiting its turn to be handled. Handling is accomplished by forwarding the AVSDirective to the handleDirective() method of whichever DirectiveHandler is registered to handle the AVSDirective. The handling of an AVSDirective can be configured as BLOCKING or NON_BLOCKING. If the directive at the head of the handling queue is configured for BLOCKING, the handling of subsequent AVSDirectives is held up until the DirectiveHandler for the BLOCKING AVSDirective indicates that handling has completed or failed. Otherwise handleDirective() is invoked, the AVSDirective is popped from the front of the queue, and processing of queued AVSDirective's continues. | alexaClientSDK::adsl::DirectiveProcessor::DirectiveProcessor | ( | DirectiveRouter * | directiveRouter | ) | 
Constructor.
| directiveRouter | An object used to route directives to their registered handler. | 
| alexaClientSDK::adsl::DirectiveProcessor::~DirectiveProcessor | ( | ) | 
Destructor.
| void alexaClientSDK::adsl::DirectiveProcessor::disable | ( | ) | 
Disable the DirectiveProcessor, queues all outstanding AVSDirectives for cancellation and blocks until the processing of all AVSDirectives has completed. 
| bool alexaClientSDK::adsl::DirectiveProcessor::enable | ( | ) | 
Enable the DirectiveProcessor.
| std::string alexaClientSDK::adsl::DirectiveProcessor::getDialogRequestId | ( | ) | 
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.
| bool alexaClientSDK::adsl::DirectiveProcessor::onDirective | ( | std::shared_ptr< avsCommon::avs::AVSDirective > | directive | ) | 
Queue an AVSDirective for handling by whatever DirectiveHandler was registered to handle it.
| directive | The AVADirective to process.  | 
| void alexaClientSDK::adsl::DirectiveProcessor::setDialogRequestId | ( | const std::string & | dialogRequestId | ) | 
Set the current dialogRequestId. If a new value is specified any AVSDirective's whose pre-handling or handling is already in progress the directive will be cancelled.
| dialogRequestId | The new value for the current dialogRequestId.  | 
| void alexaClientSDK::adsl::DirectiveProcessor::shutdown | ( | ) | 
Shut down the DirectiveProcessor. This queues all outstanding AVSDirectives for cancellation and blocks until the processing of all AVSDirectives has completed. 
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0