AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
PostConnectSynchronizeStateSender.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_SYNCHRONIZESTATESENDER_INCLUDE_SYNCHRONIZESTATESENDER_POSTCONNECTSYNCHRONIZESTATESENDER_H_
17 #define ALEXA_CLIENT_SDK_SYNCHRONIZESTATESENDER_INCLUDE_SYNCHRONIZESTATESENDER_POSTCONNECTSYNCHRONIZESTATESENDER_H_
18 
19 #include <memory>
20 #include <mutex>
21 #include <string>
22 
29 
30 namespace alexaClientSDK {
31 namespace synchronizeStateSender {
32 
39  , public std::enable_shared_from_this<PostConnectSynchronizeStateSender> {
40 public:
48  static std::shared_ptr<PostConnectSynchronizeStateSender> create(
49  std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> contextManager,
50  std::shared_ptr<avsCommon::utils::metrics::MetricRecorderInterface> metricRecorder = nullptr);
51 
56 
59  void onContextAvailable(const std::string& jsonContext) override;
62 
65  unsigned int getOperationPriority() override;
66  bool performOperation(
67  const std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface>& messageSender) override;
68  void abortOperation() override;
70 private:
77  std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> contextManager,
78  std::shared_ptr<avsCommon::utils::metrics::MetricRecorderInterface> metricRecorder);
79 
85  bool fetchContext();
86 
91  bool isStopping();
92 
94  std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> m_contextManager;
95 
97  std::shared_ptr<avsCommon::utils::metrics::MetricRecorderInterface> m_metricRecorder;
98 
100  bool m_isStopping;
101 
103  std::string m_contextString;
104 
106  std::mutex m_mutex;
107 
109  std::shared_ptr<avsCommon::avs::WaitableMessageRequest> m_postConnectRequest;
110 
113 };
114 
115 } // namespace synchronizeStateSender
116 } // namespace alexaClientSDK
117 
118 #endif // ALEXA_CLIENT_SDK_SYNCHRONIZESTATESENDER_INCLUDE_SYNCHRONIZESTATESENDER_POSTCONNECTSYNCHRONIZESTATESENDER_H_
unsigned int getOperationPriority() override
::std::string string
Definition: gtest-port.h:1097
ContextRequestError
Definition: ContextRequesterInterface.h:40
~PostConnectSynchronizeStateSender()
bool performOperation(const std::shared_ptr< avsCommon::sdkInterfaces::MessageSenderInterface > &messageSender) override
static std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > metricRecorder
Metric recorder shared ptr.
Definition: BaseAPLCapabilityAgentTest.cpp:261
static std::shared_ptr< PostConnectSynchronizeStateSender > create(std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface > contextManager, std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > metricRecorder=nullptr)
void onContextAvailable(const std::string &jsonContext) override
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
void onContextFailure(const avsCommon::sdkInterfaces::ContextRequestError error) override
void abortOperation() override
Definition: PostConnectSynchronizeStateSender.h:36
Definition: PostConnectOperationInterface.h:30

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