Alexa Auto SDK  2.0.0
AlexaClient.h
1 /*
2  * Copyright 2017-2019 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 AACE_ALEXA_ALEXA_CLIENT_H
17 #define AACE_ALEXA_ALEXA_CLIENT_H
18 
19 #include "AACE/Core/PlatformInterface.h"
20 #include "AlexaEngineInterfaces.h"
21 
24 namespace aace {
25 namespace alexa {
26 
31 protected:
32  AlexaClient() = default;
33 
34 public:
35  virtual ~AlexaClient();
36 
40  enum class DialogState {
41 
45  IDLE,
46 
50  LISTENING,
51 
55  EXPECTING,
56 
61  THINKING,
62 
66  SPEAKING
67  };
68 
78  virtual void dialogStateChanged( DialogState state ) {}
79 
82 
89  virtual void authStateChanged( AuthState state, AuthError error ) {}
90 
94  enum class ConnectionStatus {
95 
99  DISCONNECTED,
100 
104  PENDING,
105 
109  CONNECTED
110  };
111 
116 
120  NONE,
121 
125  SUCCESS,
126 
130  UNRECOVERABLE_ERROR,
131 
135  ACL_CLIENT_REQUEST,
136 
140  ACL_DISABLED,
141 
145  DNS_TIMEDOUT,
146 
150  CONNECTION_TIMEDOUT,
151 
155  CONNECTION_THROTTLED,
156 
160  INVALID_AUTH,
161 
165  PING_TIMEDOUT,
166 
170  WRITE_TIMEDOUT,
171 
175  READ_TIMEDOUT,
176 
180  FAILURE_PROTOCOL_ERROR,
181 
185  INTERNAL_ERROR,
186 
190  SERVER_INTERNAL_ERROR,
191 
195  SERVER_SIDE_DISCONNECT,
196 
200  SERVER_ENDPOINT_CHANGED
201  };
202 
210 };
211 
212 inline std::ostream& operator<<(std::ostream& stream, const AlexaClient::DialogState& state) {
213  switch (state) {
215  stream << "IDLE";
216  break;
218  stream << "LISTENING";
219  break;
221  stream << "EXPECTING";
222  break;
224  stream << "THINKING";
225  break;
227  stream << "SPEAKING";
228  break;
229  }
230  return stream;
231 }
232 
233 inline std::ostream& operator<<(std::ostream& stream, const AlexaClient::ConnectionStatus& status) {
234  switch (status) {
236  stream << "DISCONNECTED";
237  break;
239  stream << "PENDING";
240  break;
242  stream << "CONNECTED";
243  break;
244  }
245  return stream;
246 }
247 
248 inline std::ostream& operator<<(std::ostream& stream, const AlexaClient::ConnectionChangedReason& reason) {
249  switch (reason) {
251  stream << "NONE";
252  break;
254  stream << "SUCCESS";
255  break;
257  stream << "UNRECOVERABLE_ERROR";
258  break;
260  stream << "ACL_CLIENT_REQUEST";
261  break;
263  stream << "ACL_DISABLED";
264  break;
266  stream << "DNS_TIMEDOUT";
267  break;
269  stream << "CONNECTION_TIMEDOUT";
270  break;
272  stream << "CONNECTION_THROTTLED";
273  break;
275  stream << "INVALID_AUTH";
276  break;
278  stream << "PING_TIMEDOUT";
279  break;
281  stream << "WRITE_TIMEDOUT";
282  break;
284  stream << "READ_TIMEDOUT";
285  break;
287  stream << "FAILURE_PROTOCOL_ERROR";
288  break;
290  stream << "INTERNAL_ERROR";
291  break;
293  stream << "SERVER_INTERNAL_ERROR";
294  break;
296  stream << "SERVER_SIDE_DISCONNECT";
297  break;
299  stream << "SERVER_ENDPOINT_CHANGED";
300  break;
301  }
302  return stream;
303 }
304 
305 } // aace::alexa
306 } // aace
307 
308 #endif // AACE_ALEXA_ALEXA_CLIENT_H
ConnectionStatus
Definition: AlexaClient.h:94
AuthState
Definition: AlexaEngineInterfaces.h:201
Definition: PlatformInterface.h:29
AuthError
Definition: AlexaEngineInterfaces.h:227
DialogState
Definition: AlexaClient.h:40
Definition: AddressBook.h:26
Definition: AlexaClient.h:30
virtual void dialogStateChanged(DialogState state)
Definition: AlexaClient.h:78
virtual void connectionStatusChanged(ConnectionStatus status, ConnectionChangedReason reason)
Definition: AlexaClient.h:209
virtual void authStateChanged(AuthState state, AuthError error)
Definition: AlexaClient.h:89
ConnectionChangedReason
Definition: AlexaClient.h:115

Alexa Auto SDK 2.0.0 - Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0