AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
ObservableMessageRequest.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_INTEGRATION_INCLUDE_INTEGRATION_OBSERVABLEMESSAGEREQUEST_H_
17 #define ALEXA_CLIENT_SDK_INTEGRATION_INCLUDE_INTEGRATION_OBSERVABLEMESSAGEREQUEST_H_
18 
19 #include <atomic>
20 #include <chrono>
21 #include <condition_variable>
22 #include <mutex>
23 
25 
26 namespace alexaClientSDK {
27 namespace integration {
28 
30 public:
35  const std::string& jsonContent,
36  std::shared_ptr<avsCommon::avs::attachment::AttachmentReader> attachmentReader = nullptr);
37 
39 
40  void exceptionReceived(const std::string& exceptionMessage) override;
41 
46 
50  bool waitFor(
52  const std::chrono::seconds = std::chrono::seconds(10));
54  bool hasSendCompleted();
56  bool wasExceptionReceived();
57 
58 private:
62  mutable std::mutex m_mutex;
64  std::condition_variable m_wakeTrigger;
66  std::atomic<bool> m_sendCompleted;
68  std::atomic<bool> m_exceptionReceived;
69 };
70 
71 } // namespace integration
72 } // namespace alexaClientSDK
73 
74 #endif // ALEXA_CLIENT_SDK_INTEGRATION_INCLUDE_INTEGRATION_OBSERVABLEMESSAGEREQUEST_H_
alexaClientSDK::integration::ObservableMessageRequest::getSendMessageStatus
avsCommon::sdkInterfaces::MessageRequestObserverInterface::Status getSendMessageStatus() const
Definition: ObservableMessageRequest.cpp:62
alexaClientSDK::integration::ObservableMessageRequest::wasExceptionReceived
bool wasExceptionReceived()
Function indicating if exceptionReceived has been called.
Definition: ObservableMessageRequest.cpp:85
alexaClientSDK::integration::ObservableMessageRequest::exceptionReceived
void exceptionReceived(const std::string &exceptionMessage) override
Definition: ObservableMessageRequest.cpp:76
MessageRequest.h
alexaClientSDK::integration::ObservableMessageRequest::sendCompleted
void sendCompleted(avsCommon::sdkInterfaces::MessageRequestObserverInterface::Status status) override
Definition: ObservableMessageRequest.cpp:53
alexaClientSDK::integration::ObservableMessageRequest
Definition: ObservableMessageRequest.h:29
alexaClientSDK::avsCommon::avs::MessageRequest
Definition: MessageRequest.h:40
alexaClientSDK
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
alexaClientSDK::integration::ObservableMessageRequest::ObservableMessageRequest
ObservableMessageRequest(const std::string &jsonContent, std::shared_ptr< avsCommon::avs::attachment::AttachmentReader > attachmentReader=nullptr)
Definition: ObservableMessageRequest.cpp:41
alexaClientSDK::integration::ObservableMessageRequest::hasSendCompleted
bool hasSendCompleted()
Function indicating if sendCompleted has been called.
Definition: ObservableMessageRequest.cpp:81
alexaClientSDK::integration::ObservableMessageRequest::waitFor
bool waitFor(const avsCommon::sdkInterfaces::MessageRequestObserverInterface::Status, const std::chrono::seconds=std::chrono::seconds(10))
Definition: ObservableMessageRequest.cpp:68
alexaClientSDK::avsCommon::sdkInterfaces::MessageRequestObserverInterface::Status
Status
Definition: MessageRequestObserverInterface.h:33

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