AlexaClientSDK
3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <ToggleControllerCapabilityAgent.h>
Public Types | |
using | EndpointIdentifier = avsCommon::sdkInterfaces::endpoints::EndpointIdentifier |
Alias to improve readability. More... | |
using | ToggleState = avsCommon::sdkInterfaces::toggleController::ToggleControllerInterface::ToggleState |
Static Public Member Functions | |
static std::shared_ptr< ToggleControllerCapabilityAgent > | create (const EndpointIdentifier &endpointId, const std::string &instance, const avsCommon::sdkInterfaces::toggleController::ToggleControllerAttributes &toggleControllerAttributes, std::shared_ptr< avsCommon::sdkInterfaces::toggleController::ToggleControllerInterface > toggleController, std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface > contextManager, std::shared_ptr< avsCommon::sdkInterfaces::AlexaInterfaceMessageSenderInterface > responseSender, std::shared_ptr< avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface > exceptionSender, bool isProactivelyReported, bool isRetrievable, bool isNonControllable=false) |
Additional Inherited Members | |
Protected Member Functions inherited from alexaClientSDK::avsCommon::avs::CapabilityAgent | |
CapabilityAgent (const std::string &nameSpace, std::shared_ptr< sdkInterfaces::ExceptionEncounteredSenderInterface > exceptionEncounteredSender) | |
virtual std::shared_ptr< DirectiveInfo > | createDirectiveInfo (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 |
Protected Attributes inherited from alexaClientSDK::avsCommon::avs::CapabilityAgent | |
const std::string | m_namespace |
The namespace of the capability agent. More... | |
std::shared_ptr< sdkInterfaces::ExceptionEncounteredSenderInterface > | m_exceptionEncounteredSender |
Object to use to send exceptionEncountered messages. More... | |
The ToggleControllerCapabilityAgent
is responsible for handling Alexa.ToggleController directives and calls the ToggleControllerInterface
APIs.
This class implements a CapabilityAgent
that handles the Alexa.ToggleContoller
Interface.
using alexaClientSDK::capabilityAgents::toggleController::ToggleControllerCapabilityAgent::EndpointIdentifier = avsCommon::sdkInterfaces::endpoints::EndpointIdentifier |
Alias to improve readability.
using alexaClientSDK::capabilityAgents::toggleController::ToggleControllerCapabilityAgent::ToggleState = avsCommon::sdkInterfaces::toggleController::ToggleControllerInterface::ToggleState |
|
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.
AVSDirectives
.info | The DirectiveInfo instance for the AVSDirective to process. |
Implements alexaClientSDK::avsCommon::avs::CapabilityAgent.
|
overridevirtual |
Returns whether the provider can be queried for its state / properties. If not, the provider is omitted from the context altogether. ContextManager will not query or report its state.
Reimplemented from alexaClientSDK::avsCommon::sdkInterfaces::StateProviderInterface.
|
static |
Create an instance of ToggleControllerCapabilityAgent
.
endpointId | A endpoint to which this capability is associated. |
instance | A unique non-empty instance name identifying a toggle controller in endpoint. |
toggleControllerAttributes | Used to populate the discovery message. |
toggleController | An interface that this object will use to perform the toggle operations. |
contextManager | An interface to which this object will send property state updates. |
responseSender | An interface that this object will use to send the reponse to AVS. |
exceptionSender | An interface to report exceptions to AVS. |
isProactivelyReported | Whether the toggle state property change is proactively reported to Alexa in a change report. |
isRetrievable | Whether the toggle state property can be retrieved when Alexa sends a state report request to the endpoint. |
isNonControllable | Whether the toggle state can be controlled or not. This must be false for the toggle state to be controllable. Default is false . |
nullptr
if the inputs are invalid, else a new instance of ToggleControllerCapabilityAgent
. avsCommon::avs::CapabilityConfiguration alexaClientSDK::capabilityAgents::toggleController::ToggleControllerCapabilityAgent::getCapabilityConfiguration | ( | ) |
Get the capability configuration for this agent.
|
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).
avs::DirectiveHandlerConfiguration
of the handler. Implements alexaClientSDK::avsCommon::sdkInterfaces::DirectiveHandlerInterface.
|
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.
AVSDirectives
.info | The DirectiveInfo instance for the AVSDirective to process. |
Implements alexaClientSDK::avsCommon::avs::CapabilityAgent.
|
overridevirtual |
Handle the action specified AVSDirective
. Once this has been called the DirectiveHandler
should not expect to receive further calls regarding this directive.
AVSDirectives
. ExceptionEncountered
message should be sent to AVS.directive | The directive to handle. |
Implements alexaClientSDK::avsCommon::sdkInterfaces::DirectiveHandlerInterface.
|
overridevirtual |
Returns whether the provider has Reportable State Properties.
Reimplemented from alexaClientSDK::avsCommon::sdkInterfaces::StateProviderInterface.
|
overridevirtual |
Notifies the change in the toggle state of the endpoint.
toggleState | The toggle state specified using ToggleState . |
cause | The cause for this change specified using AlexaStateChangeCauseType . |
Implements alexaClientSDK::avsCommon::sdkInterfaces::toggleController::ToggleControllerObserverInterface.
|
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.
AVSDirectives
.info | The DirectiveInfo instance for the AVSDirective to process. |
Implements alexaClientSDK::avsCommon::avs::CapabilityAgent.
|
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.
stateProviderIdentifier | The identifier of the state provider. |
stateRequestToken | The token to use in the setState call. |
Reimplemented from alexaClientSDK::avsCommon::sdkInterfaces::StateProviderInterface.
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0