AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | List of all members
alexaClientSDK::integration::ObservableMessageRequest Class Reference

#include <ObservableMessageRequest.h>

Inheritance diagram for alexaClientSDK::integration::ObservableMessageRequest:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::integration::ObservableMessageRequest:
Collaboration graph
[legend]

Public Member Functions

 ObservableMessageRequest (const std::string &jsonContent, std::shared_ptr< avsCommon::avs::attachment::AttachmentReader > attachmentReader=nullptr)
 
void sendCompleted (avsCommon::sdkInterfaces::MessageRequestObserverInterface::Status status) override
 
void exceptionReceived (const std::string &exceptionMessage) override
 
avsCommon::sdkInterfaces::MessageRequestObserverInterface::Status getSendMessageStatus () const
 
bool waitFor (const avsCommon::sdkInterfaces::MessageRequestObserverInterface::Status, const std::chrono::seconds=std::chrono::seconds(10))
 
bool hasSendCompleted ()
 Function indicating if sendCompleted has been called. More...
 
bool wasExceptionReceived ()
 Function indicating if exceptionReceived has been called. More...
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::avs::MessageRequest
 MessageRequest (const std::string &jsonContent, const std::string &uriPathExtension="", const unsigned int threshold=0, const std::string &streamMetricName="")
 
 MessageRequest (const std::string &jsonContent, const unsigned int threshold, const std::string &streamMetricName)
 
 MessageRequest (const std::string &jsonContent, bool isSerialized, const std::string &uriPathExtension="", std::vector< std::pair< std::string, std::string >> headers={}, MessageRequestResolveFunction resolver=nullptr, const unsigned int threshold=0, const std::string &streamMetricName="")
 
 MessageRequest (const MessageRequest &messageRequest)
 
virtual ~MessageRequest ()
 
void addAttachmentReader (const std::string &name, std::shared_ptr< attachment::AttachmentReader > attachmentReader)
 
std::string getJsonContent () const
 
bool getIsSerialized () const
 
std::string getUriPathExtension () const
 
int attachmentReadersCount () const
 
std::shared_ptr< NamedReadergetAttachmentReader (size_t index) const
 
virtual void responseStatusReceived (avsCommon::sdkInterfaces::MessageRequestObserverInterface::Status status)
 
void addObserver (std::shared_ptr< avsCommon::sdkInterfaces::MessageRequestObserverInterface > observer)
 
void removeObserver (std::shared_ptr< avsCommon::sdkInterfaces::MessageRequestObserverInterface > observer)
 
const std::vector< std::pair< std::string, std::string > > & getHeaders () const
 
bool isResolved () const
 
std::shared_ptr< MessageRequestresolveRequest (const std::string &resolveKey) const
 
unsigned int getStreamBytesThreshold () const
 
std::string getStreamMetricName () const
 

Additional Inherited Members

- Public Types inherited from alexaClientSDK::avsCommon::avs::MessageRequest
using MessageRequestResolveFunction = std::function< bool(const std::shared_ptr< EditableMessageRequest > &req, const std::string &resolveKey)>
 
- Protected Attributes inherited from alexaClientSDK::avsCommon::avs::MessageRequest
std::mutex m_observerMutex
 Mutex to guard access of m_observers. More...
 
std::unordered_set< std::shared_ptr< avsCommon::sdkInterfaces::MessageRequestObserverInterface > > m_observers
 Set of observers of MessageRequestObserverInterface. More...
 
std::string m_jsonContent
 The JSON content to be sent to AVS. More...
 
bool m_isSerialized
 True if sending this message must be serialized with sending other serialized messages. More...
 
std::string m_uriPathExtension
 The path extension to be appended to the base URL when sending. More...
 
std::vector< std::shared_ptr< NamedReader > > m_readers
 The AttachmentReaders of the Attachments data to be sent to AVS. More...
 
std::vector< std::pair< std::string, std::string > > m_headers
 Optional headers to send with this request to AVS. More...
 
MessageRequestResolveFunction m_resolver
 Resolver function to resolve current message request to a valid state. Null if message is already resolved. More...
 
std::string m_streamMetricName
 The name for the stream byte metric. More...
 
unsigned int m_streamBytesThreshold
 The threshold for the number of bytes for when we should record the stream metric. More...
 

Constructor & Destructor Documentation

◆ ObservableMessageRequest()

alexaClientSDK::integration::ObservableMessageRequest::ObservableMessageRequest ( const std::string &  jsonContent,
std::shared_ptr< avsCommon::avs::attachment::AttachmentReader attachmentReader = nullptr 
)

Constructor.

Member Function Documentation

◆ exceptionReceived()

void alexaClientSDK::integration::ObservableMessageRequest::exceptionReceived ( const std::string &  exceptionMessage)
overridevirtual

This function will be called if AVS responds with an exception message to this message request being sent.

Parameters
exceptionMessageThe exception message.

Reimplemented from alexaClientSDK::avsCommon::avs::MessageRequest.

◆ getSendMessageStatus()

avsCommon::sdkInterfaces::MessageRequestObserverInterface::Status alexaClientSDK::integration::ObservableMessageRequest::getSendMessageStatus ( ) const

Utility function to get the status once the message has been sent.

◆ hasSendCompleted()

bool alexaClientSDK::integration::ObservableMessageRequest::hasSendCompleted ( )

Function indicating if sendCompleted has been called.

◆ sendCompleted()

void alexaClientSDK::integration::ObservableMessageRequest::sendCompleted ( avsCommon::sdkInterfaces::MessageRequestObserverInterface::Status  status)
overridevirtual

This is called once the send request has completed. The status parameter indicates success or failure.

Parameters
statusWhether the send request succeeded or failed.

Reimplemented from alexaClientSDK::avsCommon::avs::MessageRequest.

◆ waitFor()

bool alexaClientSDK::integration::ObservableMessageRequest::waitFor ( const avsCommon::sdkInterfaces::MessageRequestObserverInterface::Status  sendMessageStatus,
const std::chrono::seconds  duration = std::chrono::seconds(10) 
)

Function to allow waiting for a particular status back from the component sending the message to AVS.

◆ wasExceptionReceived()

bool alexaClientSDK::integration::ObservableMessageRequest::wasExceptionReceived ( )

Function indicating if exceptionReceived has been called.


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