AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
ConnectionStatusObserverInterface.h
Go to the documentation of this file.
1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0/
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 
16 #ifndef ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_INCLUDE_AVSCOMMON_SDKINTERFACES_CONNECTIONSTATUSOBSERVERINTERFACE_H_
17 #define ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_INCLUDE_AVSCOMMON_SDKINTERFACES_CONNECTIONSTATUSOBSERVERINTERFACE_H_
18 
19 #include <iostream>
20 #include <vector>
21 
22 namespace alexaClientSDK {
23 namespace avsCommon {
24 namespace sdkInterfaces {
25 
26 static const int ENGINE_TYPE_ALEXA_VOICE_SERVICES = 1;
27 
32 public:
36  enum class Status {
39 
41  PENDING,
42 
44  CONNECTED
45  };
46 
50  enum class ChangedReason {
52  NONE,
53 
55  SUCCESS,
56 
59 
62 
65 
68 
71 
74 
77 
80 
83 
86 
89 
92 
95 
98 
101  };
102 
107  EngineConnectionStatus(const int connectEngineType, ChangedReason connectReason, Status connectStatus) :
108  engineType{connectEngineType},
109  reason{connectReason},
110  status{connectStatus} {
111  }
112  // The engine type
114  // Reason for connection state change
116  // State of connection
118  };
119 
123  virtual ~ConnectionStatusObserverInterface() = default;
124 
131  virtual void onConnectionStatusChanged(const Status status, const ChangedReason reason) = 0;
132 
142  const Status status,
143  const std::vector<EngineConnectionStatus>& engineStatuses){};
144 };
145 
153 inline std::ostream& operator<<(std::ostream& stream, ConnectionStatusObserverInterface::Status status) {
154  switch (status) {
156  stream << "DISCONNECTED";
157  break;
159  stream << "PENDING";
160  break;
162  stream << "CONNECTED";
163  break;
164  }
165  return stream;
166 }
167 
175 inline std::ostream& operator<<(std::ostream& stream, ConnectionStatusObserverInterface::ChangedReason reason) {
176  switch (reason) {
178  stream << "NONE";
179  break;
181  stream << "SUCCESS";
182  break;
184  stream << "UNRECOVERABLE_ERROR";
185  break;
187  stream << "ACL_CLIENT_REQUEST";
188  break;
190  stream << "ACL_DISABLED";
191  break;
193  stream << "DNS_TIMEDOUT";
194  break;
196  stream << "CONNECTION_TIMEDOUT";
197  break;
199  stream << "CONNECTION_THROTTLED";
200  break;
202  stream << "INVALID_AUTH";
203  break;
205  stream << "PING_TIMEDOUT";
206  break;
208  stream << "WRITE_TIMEDOUT";
209  break;
211  stream << "READ_TIMEDOUT";
212  break;
214  stream << "FAILURE_PROTOCOL_ERROR";
215  break;
217  stream << "INTERNAL_ERROR";
218  break;
220  stream << "SERVER_INTERNAL_ERROR";
221  break;
223  stream << "SERVER_SIDE_DISCONNECT";
224  break;
226  stream << "SERVER_ENDPOINT_CHANGED";
227  break;
228  }
229  return stream;
230 }
231 
232 } // namespace sdkInterfaces
233 } // namespace avsCommon
234 } // namespace alexaClientSDK
235 
236 #endif // ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_INCLUDE_AVSCOMMON_SDKINTERFACES_CONNECTIONSTATUSOBSERVERINTERFACE_H_
alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::EngineConnectionStatus::EngineConnectionStatus
EngineConnectionStatus(const int connectEngineType, ChangedReason connectReason, Status connectStatus)
Definition: ConnectionStatusObserverInterface.h:107
alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface
Definition: ConnectionStatusObserverInterface.h:31
alexaClientSDK::avsCommon::sdkInterfaces::operator<<
std::ostream & operator<<(std::ostream &stream, const AudioInputProcessorObserverInterface::State &state)
Definition: AudioInputProcessorObserverInterface.h:86
alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::ChangedReason::CONNECTION_THROTTLED
@ CONNECTION_THROTTLED
The connection attempt failed due to excessive load on the server.
alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::EngineConnectionStatus
Definition: ConnectionStatusObserverInterface.h:103
alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::ChangedReason::ACL_CLIENT_REQUEST
@ ACL_CLIENT_REQUEST
The connection status changed due to the client interacting with the Connection public api.
alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::EngineConnectionStatus::status
Status status
Definition: ConnectionStatusObserverInterface.h:117
alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::Status::CONNECTED
@ CONNECTED
ACL is connected to AVS.
alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::onConnectionStatusChanged
virtual void onConnectionStatusChanged(const Status status, const std::vector< EngineConnectionStatus > &engineStatuses)
Definition: ConnectionStatusObserverInterface.h:141
alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::ChangedReason
ChangedReason
Definition: ConnectionStatusObserverInterface.h:50
alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::ChangedReason::READ_TIMEDOUT
@ READ_TIMEDOUT
There was a timeout reading from AVS.
alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::EngineConnectionStatus::reason
ChangedReason reason
Definition: ConnectionStatusObserverInterface.h:115
alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::ChangedReason::ACL_DISABLED
@ ACL_DISABLED
The connection attempt failed due to the Connection object being disabled.
alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::ChangedReason::UNRECOVERABLE_ERROR
@ UNRECOVERABLE_ERROR
The status changed due to an error from which there is no recovery.
alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::ChangedReason::SUCCESS
@ SUCCESS
The status changed to due to a successful operation.
alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::~ConnectionStatusObserverInterface
virtual ~ConnectionStatusObserverInterface()=default
alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::Status::PENDING
@ PENDING
ACL is attempting to establish a connection to AVS.
alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::Status::DISCONNECTED
@ DISCONNECTED
ACL is not connected to AVS.
alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::onConnectionStatusChanged
virtual void onConnectionStatusChanged(const Status status, const ChangedReason reason)=0
alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::ChangedReason::SERVER_SIDE_DISCONNECT
@ SERVER_SIDE_DISCONNECT
The server asked the client to reconnect.
alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::ChangedReason::WRITE_TIMEDOUT
@ WRITE_TIMEDOUT
There was a timeout writing to AVS.
alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::ChangedReason::SERVER_ENDPOINT_CHANGED
@ SERVER_ENDPOINT_CHANGED
The server endpoint has changed.
alexaClientSDK
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::ChangedReason::CONNECTION_TIMEDOUT
@ CONNECTION_TIMEDOUT
The connection attempt failed due to timeout.
alexaClientSDK::avsCommon::sdkInterfaces::ENGINE_TYPE_ALEXA_VOICE_SERVICES
static const int ENGINE_TYPE_ALEXA_VOICE_SERVICES
Definition: ConnectionStatusObserverInterface.h:26
alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::ChangedReason::INTERNAL_ERROR
@ INTERNAL_ERROR
There was an internal error within ACL.
alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::Status
Status
Definition: ConnectionStatusObserverInterface.h:36
alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::ChangedReason::PING_TIMEDOUT
@ PING_TIMEDOUT
There was a timeout sending a ping request.
alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::ChangedReason::DNS_TIMEDOUT
@ DNS_TIMEDOUT
The connection attempt failed due to DNS resolution timeout.
alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::ChangedReason::FAILURE_PROTOCOL_ERROR
@ FAILURE_PROTOCOL_ERROR
There was an underlying protocol error.
alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::ChangedReason::SERVER_INTERNAL_ERROR
@ SERVER_INTERNAL_ERROR
There was an internal error on the server.
alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::EngineConnectionStatus::engineType
int engineType
Definition: ConnectionStatusObserverInterface.h:113
alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::ChangedReason::NONE
@ NONE
The non-reason, to be used when no reason is specified (i.e. the 'unset' value).
alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::ChangedReason::INVALID_AUTH
@ INVALID_AUTH
The access credentials provided to ACL were invalid.

AlexaClientSDK 1.26.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0