AlexaClientSDK  1.25.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_
void exceptionReceived(const std::string &exceptionMessage) override
Definition: ObservableMessageRequest.cpp:76
Definition: MessageRequest.h:40
avsCommon::sdkInterfaces::MessageRequestObserverInterface::Status getSendMessageStatus() const
Definition: ObservableMessageRequest.cpp:62
Definition: ObservableMessageRequest.h:29
bool wasExceptionReceived()
Function indicating if exceptionReceived has been called.
Definition: ObservableMessageRequest.cpp:85
void sendCompleted(avsCommon::sdkInterfaces::MessageRequestObserverInterface::Status status) override
Definition: ObservableMessageRequest.cpp:53
ObservableMessageRequest(const std::string &jsonContent, std::shared_ptr< avsCommon::avs::attachment::AttachmentReader > attachmentReader=nullptr)
Definition: ObservableMessageRequest.cpp:41
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
Status
Definition: MessageRequestObserverInterface.h:33
bool hasSendCompleted()
Function indicating if sendCompleted has been called.
Definition: ObservableMessageRequest.cpp:81
bool waitFor(const avsCommon::sdkInterfaces::MessageRequestObserverInterface::Status, const std::chrono::seconds=std::chrono::seconds(10))
Definition: ObservableMessageRequest.cpp:68

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