![]() |
AlexaClientSDK
1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <HTTP2Transport.h>
Classes | |
struct | Configuration |
Public Member Functions | |
void | addObserver (std::shared_ptr< TransportObserverInterface > transportObserver) |
void | removeObserver (std::shared_ptr< TransportObserverInterface > observer) |
std::shared_ptr< avsCommon::utils::http2::HTTP2ConnectionInterface > | getHTTP2Connection () |
TransportInterface methods. | |
bool | connect () override |
void | disconnect () override |
bool | isConnected () override |
void | onRequestEnqueued () override |
void | onWakeConnectionRetry () override |
void | onWakeVerifyConnectivity () override |
MessageSenderInterface methods. | |
HTTP2Transport uses sendMessage to handle the post-connect state only. | |
void | sendMessage (std::shared_ptr< avsCommon::avs::MessageRequest > request) override |
PostConnectObserverInterface methods. | |
void | onPostConnected () override |
void | onUnRecoverablePostConnectFailure () override |
AuthObserverInterface methods | |
void | onAuthStateChange (avsCommon::sdkInterfaces::AuthObserverInterface::State newState, avsCommon::sdkInterfaces::AuthObserverInterface::Error error) override |
RequiresShutdown methods. | |
void | doShutdown () override |
{ ExchangeHandlerContextInterface methods. | |
void | onDownchannelConnected () override |
void | onDownchannelFinished () override |
void | onMessageRequestSent (const std::shared_ptr< avsCommon::avs::MessageRequest > &request) override |
void | onMessageRequestTimeout () override |
void | onMessageRequestAcknowledged (const std::shared_ptr< avsCommon::avs::MessageRequest > &request) override |
void | onMessageRequestFinished () override |
void | onPingRequestAcknowledged (bool success) override |
void | onPingTimeout () override |
void | onActivity () override |
void | onForbidden (const std::string &authToken="") override |
std::shared_ptr< avsCommon::utils::http2::HTTP2RequestInterface > | createAndSendRequest (const avsCommon::utils::http2::HTTP2RequestConfig &cfg) override |
std::string | getAVSGateway () override |
HTTP2ConnectionObserverInterface methods. | |
void | onGoawayReceived () override |
![]() | |
TransportInterface () | |
TransportInterface (const TransportInterface &rhs)=delete | |
TransportInterface & | operator= (const TransportInterface &rhs)=delete |
virtual | ~TransportInterface ()=default |
![]() | |
RequiresShutdown (const std::string &name) | |
virtual | ~RequiresShutdown () |
Destructor. More... | |
const std::string & | name () const |
void | shutdown () |
bool | isShutdown () const |
![]() | |
virtual | ~PostConnectObserverInterface ()=default |
![]() | |
virtual | ~AuthObserverInterface ()=default |
![]() | |
virtual | ~HTTP2ConnectionObserverInterface ()=default |
![]() | |
virtual | ~ExchangeHandlerContextInterface ()=default |
Static Public Member Functions | |
static std::shared_ptr< HTTP2Transport > | create (std::shared_ptr< avsCommon::sdkInterfaces::AuthDelegateInterface > authDelegate, const std::string &avsGateway, std::shared_ptr< avsCommon::utils::http2::HTTP2ConnectionInterface > http2Connection, std::shared_ptr< MessageConsumerInterface > messageConsumer, std::shared_ptr< avsCommon::avs::attachment::AttachmentManagerInterface > attachmentManager, std::shared_ptr< TransportObserverInterface > transportObserver, std::shared_ptr< PostConnectFactoryInterface > postConnectFactory, std::shared_ptr< SynchronizedMessageRequestQueue > sharedRequestQueue, Configuration configuration=Configuration(), std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > metricRecorder=nullptr, std::shared_ptr< avsCommon::sdkInterfaces::EventTracerInterface > eventTracer=nullptr) |
Additional Inherited Members | |
![]() | |
enum | State { State::UNINITIALIZED, State::REFRESHED, State::EXPIRED, State::UNRECOVERABLE_ERROR, State::AUTHORIZING } |
The enum State describes the state of authorization. More... | |
enum | Error { Error::SUCCESS, Error::UNKNOWN_ERROR, Error::AUTHORIZATION_FAILED, Error::UNAUTHORIZED_CLIENT, Error::SERVER_ERROR, Error::INVALID_REQUEST, Error::INVALID_VALUE, Error::AUTHORIZATION_EXPIRED, Error::UNSUPPORTED_GRANT_TYPE, Error::INVALID_CODE_PAIR, Error::AUTHORIZATION_PENDING, Error::SLOW_DOWN, Error::INTERNAL_ERROR, Error::INVALID_CBL_CLIENT_ID } |
The enum Error encodes possible errors which may occur when changing state. More... | |
Class to create and manage an HTTP/2 connection to AVS.
void alexaClientSDK::acl::HTTP2Transport::addObserver | ( | std::shared_ptr< TransportObserverInterface > | transportObserver | ) |
Method to add a TransportObserverInterface instance.
transportObserver | The observer instance to add. |
|
overridevirtual |
Initiate a connection to AVS. This function may operate asynchronously, meaning its return value does not imply a successful connection, but that an attempt to connect has been successfully started. This function may not be thread-safe.
Implements alexaClientSDK::acl::TransportInterface.
|
static |
A function that creates a HTTP2Transport object.
authDelegate | The AuthDelegate implementation. |
avsGateway | The URL for the AVS gateway of this object. |
http2Connection | Instance of HTTP2ConnectionInterface with which to perform HTTP2 operations. |
messageConsumer | The MessageConsumerInterface to pass messages to. |
attachmentManager | The attachment manager that manages the attachments. |
transportObserver | The observer of the new instance of TransportInterface. |
postConnectFactory | The object used to create PostConnectInterface instances. |
sharedRequestQueue | Request queue shared by all instances of HTTPTransportInterface. |
configuration | An optional configuration to specify HTTP2/2 connection settings. |
metricRecorder | The metric recorder. |
eventTracer | The object used to trace events sent to AVS. |
|
overridevirtual |
Create an HTTP2Request for this HTTP2Transport.
cfg | The configuration object which defines the request. |
Implements alexaClientSDK::acl::ExchangeHandlerContextInterface.
|
overridevirtual |
Disconnect from AVS. This function may not be thread-safe.
Implements alexaClientSDK::acl::TransportInterface.
|
overridevirtual |
Prepares/enables this object to be deleted. This should be the last function called on this object prior to deleting (or resetting) its shared_ptr.
Implements alexaClientSDK::avsCommon::utils::RequiresShutdown.
|
overridevirtual |
Get AVS gateway to send request to.
Implements alexaClientSDK::acl::ExchangeHandlerContextInterface.
std::shared_ptr< HTTP2ConnectionInterface > alexaClientSDK::acl::HTTP2Transport::getHTTP2Connection | ( | ) |
Get the HTTP2ConnectionInterface instance being used by this HTTP2Transport.
|
overridevirtual |
Returns whether this object is currently connected to AVS.
Implements alexaClientSDK::acl::TransportInterface.
|
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::ExchangeHandlerContextInterface.
|
overridevirtual |
Notification that an authorization state has changed.
newState | The new state of the authorization token. |
error | The error associated to the state change. |
Implements alexaClientSDK::avsCommon::sdkInterfaces::AuthObserverInterface.
|
overridevirtual |
Notification that the downchannel has been established.
Implements alexaClientSDK::acl::ExchangeHandlerContextInterface.
|
overridevirtual |
Notification that the downchannel has failed to be established or has disconnected.
Implements alexaClientSDK::acl::ExchangeHandlerContextInterface.
|
overridevirtual |
Notification that a request received a FORBIDDEN (403) response.
authToken | The auth token used for the forbidden request or an empty string if the token is not specified. |
Implements alexaClientSDK::acl::ExchangeHandlerContextInterface.
|
overridevirtual |
Notify that a GOAWAY frame has been received.
Implements alexaClientSDK::avsCommon::utils::http2::HTTP2ConnectionObserverInterface.
|
overridevirtual |
Notification that sending a MessageRequest
has failed or been acknowledged by AVS (this is used to indicate it is okay to send the next message).
Implements alexaClientSDK::acl::ExchangeHandlerContextInterface.
|
overridevirtual |
Notification tht a message request has finished it's exchange with AVS.
Implements alexaClientSDK::acl::ExchangeHandlerContextInterface.
|
overridevirtual |
Notification that an MessageRequest
has been sent.
Implements alexaClientSDK::acl::ExchangeHandlerContextInterface.
|
overridevirtual |
Notification that sending a message request timed out.
Implements alexaClientSDK::acl::ExchangeHandlerContextInterface.
|
overridevirtual |
Notification that sending a ping to AVS has failed or been acknowledged by AVS.
success | Whether the ping was acknowledged successfully. |
Implements alexaClientSDK::acl::ExchangeHandlerContextInterface.
|
overridevirtual |
Notification that a ping request timed out.
Implements alexaClientSDK::acl::ExchangeHandlerContextInterface.
|
overridevirtual |
|
overridevirtual |
A message request has been added to the shared synchronized queue and is ready to be read.
Implements alexaClientSDK::acl::TransportInterface.
|
overridevirtual |
Called when a PostConnect object failed to complete the post-connect processing.
Implements alexaClientSDK::acl::PostConnectObserverInterface.
|
overridevirtual |
This method is a hint to retry connecting (if not connected).
Implements alexaClientSDK::acl::TransportInterface.
|
overridevirtual |
This method is a hint to verify that there is a valid connection ot AVS.
Implements alexaClientSDK::acl::TransportInterface.
void alexaClientSDK::acl::HTTP2Transport::removeObserver | ( | std::shared_ptr< TransportObserverInterface > | observer | ) |
Method to remove a TransportObserverInterface instance.
observer | The observer instance to remove. |
|
override |
AlexaClientSDK 1.26.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0