16 #ifndef ALEXA_CLIENT_SDK_ACL_INCLUDE_ACL_TRANSPORT_MESSAGEROUTER_H_ 17 #define ALEXA_CLIENT_SDK_ACL_INCLUDE_ACL_TRANSPORT_MESSAGEROUTER_H_ 51 ,
public std::enable_shared_from_this<MessageRouter> {
66 const std::shared_ptr<acsdkShutdownManagerInterfaces::ShutdownNotifierInterface>& shutdownNotifier,
67 const std::shared_ptr<avsCommon::sdkInterfaces::AuthDelegateInterface>& authDelegate,
68 const std::shared_ptr<avsCommon::avs::attachment::AttachmentManagerInterface>& attachmentManager,
69 const std::shared_ptr<TransportFactoryInterface>& transportFactory);
88 std::shared_ptr<avsCommon::sdkInterfaces::AuthDelegateInterface> authDelegate,
89 std::shared_ptr<avsCommon::avs::attachment::AttachmentManagerInterface> attachmentManager,
90 std::shared_ptr<TransportFactoryInterface> transportFactory,
93 std::chrono::milliseconds serverSideDisconnectGracePeriod = DEFAULT_SERVER_SIDE_DISCONNECT_GRACE_PERIOD);
100 void sendMessage(std::shared_ptr<avsCommon::avs::MessageRequest> request)
override;
105 void setObserver(std::shared_ptr<MessageRouterObserverInterface> observer)
override;
108 void onConnected(std::shared_ptr<TransportInterface> transport)
override;
111 std::shared_ptr<TransportInterface> transport,
128 void setConnectionStatusLocked(
142 void notifyObserverOnConnectionStatusChanged(
152 void handleNotifyObserverOnConnectionStatusChanged(
172 void createActiveTransportLocked();
181 void disconnectAllTransportsLocked(
182 std::unique_lock<std::mutex>& lock,
190 std::shared_ptr<MessageRouterObserverInterface> getObserver();
197 void safelyResetActiveTransportLocked();
204 void safelyReleaseTransport(std::shared_ptr<TransportInterface> transport);
207 std::shared_ptr<MessageRouterObserverInterface> m_observer;
213 std::shared_ptr<avsCommon::sdkInterfaces::AuthDelegateInterface> m_authDelegate;
216 std::mutex m_connectionMutex;
234 std::vector<std::shared_ptr<TransportInterface>> m_transports;
237 std::shared_ptr<TransportInterface> m_activeTransport;
240 std::shared_ptr<avsCommon::avs::attachment::AttachmentManagerInterface> m_attachmentManager;
243 std::shared_ptr<TransportFactoryInterface> m_transportFactory;
246 std::shared_ptr<SynchronizedMessageRequestQueue> m_requestQueue;
252 bool m_serverSideDisconnectNotificationPending;
258 const std::chrono::milliseconds m_serverSideReconnectGracePeriod;
272 #endif // ALEXA_CLIENT_SDK_ACL_INCLUDE_ACL_TRANSPORT_MESSAGEROUTER_H_
std::pair< avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::Status, avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::ChangedReason > ConnectionStatus
Alias to a connection status and changed reason pair.
Definition: MessageRouterInterface.h:47
static std::shared_ptr< MessageRouterInterface > createMessageRouterInterface(const std::shared_ptr< acsdkShutdownManagerInterfaces::ShutdownNotifierInterface > &shutdownNotifier, const std::shared_ptr< avsCommon::sdkInterfaces::AuthDelegateInterface > &authDelegate, const std::shared_ptr< avsCommon::avs::attachment::AttachmentManagerInterface > &attachmentManager, const std::shared_ptr< TransportFactoryInterface > &transportFactory)
ChangedReason
Definition: ConnectionStatusObserverInterface.h:50
Definition: MessageRouterInterface.h:40
std::string getAVSGateway() override
void onWakeVerifyConnectivity() override
::std::string string
Definition: gtest-port.h:1097
Single-thread executor implementation.
Definition: Executor.h:45
void doShutdown() override
Definition: TransportObserverInterface.h:30
avsCommon::utils::threading::Executor m_executor
Definition: MessageRouter.h:266
void onDisconnected(std::shared_ptr< TransportInterface > transport, avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::ChangedReason reason) override
MessageRouter(std::shared_ptr< avsCommon::sdkInterfaces::AuthDelegateInterface > authDelegate, std::shared_ptr< avsCommon::avs::attachment::AttachmentManagerInterface > attachmentManager, std::shared_ptr< TransportFactoryInterface > transportFactory, const std::string &avsGateway="", int engineType=avsCommon::sdkInterfaces::ENGINE_TYPE_ALEXA_VOICE_SERVICES, std::chrono::milliseconds serverSideDisconnectGracePeriod=DEFAULT_SERVER_SIDE_DISCONNECT_GRACE_PERIOD)
void onWakeConnectionRetry() override
Definition: MessageConsumerInterface.h:27
void setObserver(std::shared_ptr< MessageRouterObserverInterface > observer) override
Timer to schedule task for delayed and periodic execution.
Definition: Timer.h:39
void sendMessage(std::shared_ptr< avsCommon::avs::MessageRequest > request) override
Definition: MessageRouter.h:47
void onConnected(std::shared_ptr< TransportInterface > transport) override
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
static const std::chrono::milliseconds DEFAULT_SERVER_SIDE_DISCONNECT_GRACE_PERIOD
Amount of time to allow for an automatic reconnect before notifying of a server side disconnect...
Definition: MessageRouter.h:54
ConnectionStatus getConnectionStatus() override
void consumeMessage(const std::string &contextId, const std::string &message) override
void setAVSGateway(const std::string &avsGateway) override
tuple message
Definition: gtest_output_test.py:331
void onServerSideDisconnect(std::shared_ptr< TransportInterface > transport) override
Status
Definition: ConnectionStatusObserverInterface.h:36
static const int ENGINE_TYPE_ALEXA_VOICE_SERVICES
Definition: ConnectionStatusObserverInterface.h:26