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

#include <MessageRequestHandler.h>

Inheritance diagram for alexaClientSDK::acl::MessageRequestHandler:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::acl::MessageRequestHandler:
Collaboration graph
[legend]

Public Member Functions

 ~MessageRequestHandler () override
 
HTTP2MimeRequestSourceInterface methods
avsCommon::utils::http2::HTTP2GetMimeHeadersResult getMimePartHeaderLines () override
 
std::vector< std::string > getRequestHeaderLines () override
 
avsCommon::utils::http2::HTTP2SendDataResult onSendMimePartData (char *bytes, size_t size) override
 
MimeResponseStatusHandlerInterface
void onActivity () override
 
bool onReceiveResponseCode (long responseCode) override
 
void onResponseFinished (avsCommon::utils::http2::HTTP2ResponseFinishedStatus status, const std::string &nonMimeBody) override
 
- Public Member Functions inherited from alexaClientSDK::acl::ExchangeHandler
 ExchangeHandler (std::shared_ptr< ExchangeHandlerContextInterface > context, const std::string &authToken)
 
virtual ~ExchangeHandler ()=default
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::utils::http2::HTTP2MimeRequestSourceInterface
virtual ~HTTP2MimeRequestSourceInterface ()=default
 
- Public Member Functions inherited from alexaClientSDK::acl::MimeResponseStatusHandlerInterface
virtual ~MimeResponseStatusHandlerInterface ()=default
 

Static Public Member Functions

static std::shared_ptr< MessageRequestHandlercreate (std::shared_ptr< ExchangeHandlerContextInterface > context, const std::string &authToken, std::shared_ptr< avsCommon::avs::MessageRequest > messageRequest, std::shared_ptr< MessageConsumerInterface > messageConsumer, std::shared_ptr< avsCommon::avs::attachment::AttachmentManagerInterface > attachmentManager, std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > metricRecorder, std::shared_ptr< avsCommon::sdkInterfaces::EventTracerInterface > eventTracer=nullptr, const std::shared_ptr< avsCommon::utils::power::PowerResource > &powerResource=nullptr)
 

Additional Inherited Members

- Protected Attributes inherited from alexaClientSDK::acl::ExchangeHandler
std::shared_ptr< ExchangeHandlerContextInterfacem_context
 The HTTP2Transport instance for which this exchange is to be performed. More...
 
const std::string m_authToken
 The auth token used to make the request. More...
 
const std::string m_authHeader
 The AVS authorization header to send in the request. More...
 

Detailed Description

Handle an HTTP2 request and response for a specific MessageRequest.

Constructor & Destructor Documentation

◆ ~MessageRequestHandler()

alexaClientSDK::acl::MessageRequestHandler::~MessageRequestHandler ( )
override

Destructor.

Member Function Documentation

◆ create()

std::shared_ptr< MessageRequestHandler > alexaClientSDK::acl::MessageRequestHandler::create ( std::shared_ptr< ExchangeHandlerContextInterface context,
const std::string &  authToken,
std::shared_ptr< avsCommon::avs::MessageRequest messageRequest,
std::shared_ptr< MessageConsumerInterface messageConsumer,
std::shared_ptr< avsCommon::avs::attachment::AttachmentManagerInterface attachmentManager,
std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface metricRecorder,
std::shared_ptr< avsCommon::sdkInterfaces::EventTracerInterface eventTracer = nullptr,
const std::shared_ptr< avsCommon::utils::power::PowerResource > &  powerResource = nullptr 
)
static

Create a MessageRequestHandler and send the message request.

Parameters
contextThe ExchangeContext in which this MessageRequest handler will operate.
authTokenThe token to use to authorize the request.
messageRequestThe MessageRequest to send.
messageConsumerWhere to send messages.
attachmentManagerWhere to get attachments to write to.
metricRecorderThe metric recorder.
eventTracerThe object to trace events sent to AVS.
powerResourceThe optional PowerResource to prevent device from going into LPM.
Returns
A new MessageRequestHandler or nullptr if the operation fails.

◆ getMimePartHeaderLines()

HTTP2GetMimeHeadersResult alexaClientSDK::acl::MessageRequestHandler::getMimePartHeaderLines ( )
overridevirtual

Get the header lines that should be output with the next mime part. This will be called once before onSendMimePartData() is called for the first mime part and after each call to onSendMimePartData() that returns HTTP2SendDataResult.status == COMPLETE.

Note
Calls to this method may block network operations for the associated instance of HTTP2ConnectionInterface, so they should return quickly.
Returns
An HTTP2GetMimeHeadersResult specifying the status of the operation and a vector of header lines if the status was CONTINUE.

Implements alexaClientSDK::avsCommon::utils::http2::HTTP2MimeRequestSourceInterface.

◆ getRequestHeaderLines()

std::vector< std::string > alexaClientSDK::acl::MessageRequestHandler::getRequestHeaderLines ( )
overridevirtual

Get the header lines that should be output with this HTTP2 request.

Note
Calls to this method may block network operations for the associated instance of HTTP2ConnectionInterface, so they should return quickly.
Returns
The header lines that should be output with this request.

Implements alexaClientSDK::avsCommon::utils::http2::HTTP2MimeRequestSourceInterface.

◆ onActivity()

void alexaClientSDK::acl::MessageRequestHandler::onActivity ( )
overridevirtual

Notification of network activity between this client and AVS. (this is used to detect sustained inactivity requiring the send of a ping).

Implements alexaClientSDK::acl::MimeResponseStatusHandlerInterface.

◆ onReceiveResponseCode()

bool alexaClientSDK::acl::MessageRequestHandler::onReceiveResponseCode ( long  responseCode)
overridevirtual

Notification that an HTTP response code was returned for the request.

Note
Calls to this method may block network operations for the associated instance of HTTP2ConnectionInterface, so they should return quickly.
Parameters
responseCodeThe response code received for the request.
Returns
Whether receipt of the response should continue.

Implements alexaClientSDK::acl::MimeResponseStatusHandlerInterface.

◆ onResponseFinished()

void alexaClientSDK::acl::MessageRequestHandler::onResponseFinished ( avsCommon::utils::http2::HTTP2ResponseFinishedStatus  status,
const std::string &  nonMimeBody 
)
overridevirtual

Notification that the request/response cycle has finished and no further notifications will be provided.

Note
Calls to this method may block network operations for the associated instance of HTTP2ConnectionInterface, so they should return quickly.
Parameters
statusThe status included in the response.
nonMimeBodyThe body of the reply (for non HTTPResponseCode::SUCCESS_OK responses)

Implements alexaClientSDK::acl::MimeResponseStatusHandlerInterface.

◆ onSendMimePartData()

HTTP2SendDataResult alexaClientSDK::acl::MessageRequestHandler::onSendMimePartData ( char *  bytes,
size_t  size 
)
overridevirtual

Notification to copy data to be mime encoded in to an HTTP2 request.

Note
Calls to this method may block network operations for the associated instance of HTTP2ConnectionInterface, so they should return quickly.
Parameters
bytesThe buffer to receive the bytes to send.
sizeThe max number of bytes to copy.
Returns
Result indicating the disposition of the operation and number of bytes copied.
See also
HTTPSendMimePartDataResult.

Implements alexaClientSDK::avsCommon::utils::http2::HTTP2MimeRequestSourceInterface.


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