AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
PingHandler.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_ACL_INCLUDE_ACL_TRANSPORT_PINGHANDLER_H_
17 #define ALEXA_CLIENT_SDK_ACL_INCLUDE_ACL_TRANSPORT_PINGHANDLER_H_
18 
19 #include <memory>
20 
24 
26 
30 namespace alexaClientSDK {
31 namespace acl {
32 
34  : public acl::ExchangeHandler
37  , public std::enable_shared_from_this<PingHandler> {
38 public:
47  static std::shared_ptr<PingHandler> create(
48  std::shared_ptr<ExchangeHandlerContextInterface> context,
49  const std::string& authToken,
50  const std::shared_ptr<avsCommon::utils::power::PowerResource>& powerResource = nullptr);
51 
55  ~PingHandler();
56 
57 private:
66  std::shared_ptr<ExchangeHandlerContextInterface> context,
67  const std::string& authToken,
68  const std::shared_ptr<avsCommon::utils::power::PowerResource>& powerResource);
69 
73  void reportPingAcknowledged();
74 
77  std::vector<std::string> getRequestHeaderLines() override;
78  avsCommon::utils::http2::HTTP2SendDataResult onSendData(char* bytes, size_t size) override;
80 
83  bool onReceiveResponseCode(long responseCode) override;
84  bool onReceiveHeaderLine(const std::string& line) override;
85  avsCommon::utils::http2::HTTP2ReceiveDataStatus onReceiveData(const char* bytes, size_t size) override;
86  void onResponseFinished(avsCommon::utils::http2::HTTP2ResponseFinishedStatus status) override;
88 
90  bool m_wasPingAcknowledgedReported;
91 
93  long m_responseCode;
94 
96  std::shared_ptr<avsCommon::utils::power::PowerResource> m_powerResource;
97 };
98 
99 } // namespace acl
100 } // namespace alexaClientSDK
101 
102 #endif // ALEXA_CLIENT_SDK_ACL_INCLUDE_ACL_TRANSPORT_PINGHANDLER_H_
::std::string string
Definition: gtest-port.h:1097
Definition: PingHandler.h:33
HTTP2ResponseFinishedStatus
Definition: HTTP2ResponseFinishedStatus.h:29
Definition: ExchangeHandler.h:31
static std::shared_ptr< PingHandler > create(std::shared_ptr< ExchangeHandlerContextInterface > context, const std::string &authToken, const std::shared_ptr< avsCommon::utils::power::PowerResource > &powerResource=nullptr)
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
HTTP2ReceiveDataStatus
Definition: HTTP2ReceiveDataStatus.h:28

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