![]() |
AlexaClientSDK
3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <AlexaInterfaceMessageSender.h>
Public Member Functions | |
~AlexaInterfaceMessageSender () | |
ContextManagerObserverInterface methods | |
void | onStateChanged (const avsCommon::avs::CapabilityTag &identifier, const avsCommon::avs::CapabilityState &state, const avsCommon::sdkInterfaces::AlexaStateChangeCauseType cause) override |
ContextRequesterInterface methods | |
void | onContextAvailable (const std::string &endpointId, const avsCommon::avs::AVSContext &endpointContext, avsCommon::sdkInterfaces::ContextRequestToken token) override |
void | onContextFailure (const avsCommon::sdkInterfaces::ContextRequestError error, avsCommon::sdkInterfaces::ContextRequestToken token) override |
MessageRequestObserverInterface methods | |
void | onSendCompleted (avsCommon::sdkInterfaces::MessageRequestObserverInterface::Status status) override |
void | onExceptionReceived (const std::string &exceptionMessage) override |
AlexaInterfaceMessageSenderInternalInterface methods | |
virtual bool | sendStateReportEvent (const std::string &instance, const std::string &correlationToken, const avsCommon::avs::AVSMessageEndpoint &endpoint) override |
virtual bool | sendResponseEvent (const std::string &instance, const std::string &correlationToken, const avsCommon::avs::AVSMessageEndpoint &endpoint, const std::string &jsonPayload="{}") override |
virtual bool | sendResponseEvent (const std::string &instance, const std::string &correlationToken, const avsCommon::avs::AVSMessageEndpoint &endpoint, const std::string &responseNamespace, const std::string &responseName, const std::string &jsonPayload="{}") override |
virtual bool | sendErrorResponseEvent (const std::string &instance, const std::string &correlationToken, const avsCommon::avs::AVSMessageEndpoint &endpoint, const ErrorResponseType errorType, const std::string &errorMessage="") override |
bool | sendErrorResponseEvent (const std::string &instance, const std::string &correlationToken, const avsCommon::avs::AVSMessageEndpoint &endpoint, const std::string &responseNamespace, const std::string &jsonPayload="{}") override |
virtual bool | sendDeferredResponseEvent (const std::string &instance, const std::string &correlationToken, const int estimatedDeferralInSeconds=0) override |
![]() | |
virtual | ~ContextManagerObserverInterface ()=default |
![]() | |
virtual | ~ContextRequesterInterface ()=default |
virtual void | onContextAvailable (const std::string &jsonContext) |
virtual void | onContextFailure (const ContextRequestError error) |
![]() | |
RequiresShutdown (const std::string &name) | |
virtual | ~RequiresShutdown () |
Destructor. More... | |
const std::string & | name () const |
void | shutdown () |
bool | isShutdown () const |
Static Public Member Functions | |
static std::shared_ptr< AlexaInterfaceMessageSender > | createAlexaInterfaceMessageSender (const std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface > &contextManager, const std::shared_ptr< avsCommon::sdkInterfaces::MessageSenderInterface > &messageSender, const std::shared_ptr< acsdkShutdownManagerInterfaces::ShutdownNotifierInterface > &shutdownNotifier) |
static std::shared_ptr< AlexaInterfaceMessageSenderInternalInterface > | createAlexaInterfaceMessageSenderInternalInterface (const std::shared_ptr< AlexaInterfaceMessageSender > &messageSender) |
static std::shared_ptr< AlexaInterfaceMessageSender > | create (std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface > contextManager, std::shared_ptr< avsCommon::sdkInterfaces::MessageSenderInterface > messageSender) |
Additional Inherited Members |
Implementation of AlexaInterfaceMessageSenderInterface and AlexaInterfaceMessageSenderInternalInterface. This class implementes centralized messaging for any AlexaInterface capability that needs to send AlexaInterface events.
alexaClientSDK::capabilityAgents::alexa::AlexaInterfaceMessageSender::~AlexaInterfaceMessageSender | ( | ) |
Destructor.
|
static |
Factory method to create a AlexaInterfaceMessageSender
.
contextManager | Interface to access AVS state. |
messageSender | Interface to send events to AVS. |
AlexaInterfaceMessageSender
on success, nullptr
otherwise.
|
static |
Factory method to create a AlexaInterfaceMessageSender
.
contextManager | Interface to access AVS state. |
connectionManager | Interface to send events to AVS. |
shutdownNotifier | Interface to notify of shutdown. |
AlexaInterfaceMessageSender
on success, nullptr
otherwise.
|
static |
Factory method to forward an instance of AlexaInterfaceMessageSender
to AlexaInterfaceMessageSenderInternalInterface
.
messageSender | The instance to forward. |
AlexaInterfaceMessageSenderInternalInterface
.
|
overridevirtual |
This is called by the ContextManager once the context is ready and available.
ContextRequester
should perform minimum processing and return quickly. Otherwise it will block the processing of updating the of other ContextProviders
.endpointId | The ID used to identify the endpoint to which this context belong. |
endpointContext | The state of all capabilities related to the given endpoint. |
requestToken | Token used to identify a specific context request. |
Reimplemented from alexaClientSDK::avsCommon::sdkInterfaces::ContextRequesterInterface.
|
overridevirtual |
The contextManager calls this if it is unable to process a getContext
request successfully.
ContextRequester
should perform minimum processing and return quickly. Otherwise it will block the processing of updating the of other ContextProviders
. error | The reason why the getContext request failed. |
requestToken | Token used to identify a specific context request. |
Reimplemented from alexaClientSDK::avsCommon::sdkInterfaces::ContextRequesterInterface.
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
Notifies the observer that a change of state has been proactively reported.
identifier | Identifies the source of the state change. |
state | The new state. |
cause | The reason for the state change. |
Implements alexaClientSDK::avsCommon::sdkInterfaces::ContextManagerObserverInterface.
|
overridevirtual |
Send an Alexa.DeferredResponse event. The message is enqueued for sending and this method returns immediately (non-blocking).
instance | The instance ID of the responding capability. |
correlationToken | The correlation token from the directive to which we are responding. |
estimatedDeferralInSeconds | number of seconds until the response is expected. |
Implements alexaClientSDK::avsCommon::sdkInterfaces::AlexaInterfaceMessageSenderInterface.
|
overridevirtual |
Send an Alexa.ErrorResponse event. The message is enqueued for sending and this method returns immediately (non-blocking).
instance | The instance ID of the responding capability. |
correlationToken | The correlation token from the directive to which we are responding. |
endpoint | The AVSMessageEndpoint to identify the endpoint related to this event. |
errorType | the error type. |
errorMessage | a string containing the error message (optional). |
Implements alexaClientSDK::avsCommon::sdkInterfaces::AlexaInterfaceMessageSenderInterface.
|
overridevirtual |
Send an error response event for namespace and name. The message is enqueued for sending and this method returns immediately (non-blocking).
instance | The instance ID of the responding capability. |
correlationToken | The correlation token from the directive to which we are responding. |
endpoint | The AVSMessageEndpoint to identify the endpoint related to this event. |
responseNamespace | a string containing the namespace for this response. |
jsonPayload | a payload containing the error type and message (optional). |
Implements alexaClientSDK::avsCommon::sdkInterfaces::AlexaInterfaceMessageSenderInterface.
|
overridevirtual |
Send an Alexa.Response event. Since these events require context, the event will be enqueued and this method will return immediately (non-blocking). The message will be sent once context has been received from ContextManager.
instance | The instance ID of the responding capability. |
correlationToken | The correlation token from the directive to which we are responding. |
endpoint | The AVSMessageEndpoint to identify the endpoint related to this event. |
jsonPayload | a JSON string representing the payload for the response event (optional). |
Implements alexaClientSDK::avsCommon::sdkInterfaces::AlexaInterfaceMessageSenderInterface.
|
overridevirtual |
Send an Response event. Since these events require context, the event will be enqueued and this method will return immediately (non-blocking). The message will be sent once context has been received from ContextManager.
instance | The instance ID of the responding capability. |
correlationToken | The correlation token from the directive to which we are responding. |
endpoint | The AVSMessageEndpoint to identify the endpoint related to this event. |
responseNamespace | The namespace of response event |
responseName | The name of response event |
jsonPayload | a JSON string representing the payload for the response event (optional). |
Implements alexaClientSDK::avsCommon::sdkInterfaces::AlexaInterfaceMessageSenderInterface.
|
overridevirtual |
Send an Alexa.StateReport event. Since these events require context, the event will be enqueued and this method will return immediately. The event will be sent once context has been received from ContextManager.
instance | The instance ID of the responding capability. |
correlationToken | The correlation token from the directive to which we are responding. |
endpoint | The AVSMessageEndpoint to identify the endpoint related to this event. |
Implements alexaClientSDK::capabilityAgents::alexa::AlexaInterfaceMessageSenderInternalInterface.
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0