AlexaClientSDK  1.23.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
MessageRequestObserverInterface.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_MESSAGEREQUESTOBSERVERINTERFACE_H_
17 #define ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_INCLUDE_AVSCOMMON_SDKINTERFACES_MESSAGEREQUESTOBSERVERINTERFACE_H_
18 
19 #include <iostream>
20 
21 namespace alexaClientSDK {
22 namespace avsCommon {
23 namespace sdkInterfaces {
24 
29 public:
33  enum class Status {
35  PENDING,
36 
38  SUCCESS,
39 
42 
45 
48 
51 
53  TIMEDOUT,
54 
57 
60 
63 
65  REFUSED,
66 
68  CANCELED,
69 
71  THROTTLED,
72 
75 
78 
81  };
82 
83  /*
84  * Destructor
85  */
86  virtual ~MessageRequestObserverInterface() = default;
87 
94 
95  /*
96  * Called when a message request has been processed by AVS.
97  *
98  * @param status The status of the response that was received.
99  */
101 
102  /*
103  * Called when an exception is thrown when trying to send a message to AVS.
104  */
105  virtual void onExceptionReceived(const std::string& exceptionMessage) = 0;
106 };
107 
115 inline std::ostream& operator<<(std::ostream& stream, MessageRequestObserverInterface::Status status) {
116  switch (status) {
118  return stream << "PENDING";
120  return stream << "SUCCESS";
122  return stream << "SUCCESS_ACCEPTED";
124  return stream << "SUCCESS_NO_CONTENT";
126  return stream << "NOT_CONNECTED";
128  return stream << "NOT_SYNCHRONIZED";
130  return stream << "TIMEDOUT";
132  return stream << "PROTOCOL_ERROR";
134  return stream << "INTERNAL_ERROR";
136  return stream << "SERVER_INTERNAL_ERROR_V2";
138  return stream << "REFUSED";
140  return stream << "CANCELED";
142  return stream << "THROTTLED";
144  return stream << "INVALID_AUTH";
146  return stream << "CLIENT_ERROR_BAD_REQUEST";
148  return stream << "SERVER_OTHER_ERROR";
149  }
150  return stream << "Unknown MessageRequestObserverInterface::Status";
151 }
152 
153 } // namespace sdkInterfaces
154 } // namespace avsCommon
155 } // namespace alexaClientSDK
156 
157 #endif // ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_INCLUDE_AVSCOMMON_SDKINTERFACES_MESSAGEREQUESTOBSERVERINTERFACE_H_
virtual void onResponseStatusReceived(MessageRequestObserverInterface::Status status)
Definition: MessageRequestObserverInterface.h:93
The send failed due to an internal error on the server which sends code 500.
std::ostream & operator<<(std::ostream &stream, const AudioInputProcessorObserverInterface::State &state)
Definition: AudioInputProcessorObserverInterface.h:86
virtual void onSendCompleted(MessageRequestObserverInterface::Status status)=0
The send failed due to server canceling it before the transmission completed.
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
virtual void onExceptionReceived(const std::string &exceptionMessage)=0
The message was successfully sent but the HTTPReponse had no content.
Status
Definition: MessageRequestObserverInterface.h:33
The send failed because of timeout waiting for AVS response.

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