AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
StopTaskTimer.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_UTILS_TEST_AVSCOMMON_UTILS_TIMING_STOPTASKTIMER_H_
17 #define ALEXA_CLIENT_SDK_AVSCOMMON_UTILS_TEST_AVSCOMMON_UTILS_TIMING_STOPTASKTIMER_H_
18 
19 #include <memory>
20 #include <functional>
21 
25 
26 namespace alexaClientSDK {
27 namespace avsCommon {
28 namespace utils {
29 namespace timing {
30 namespace test {
31 
44 public:
47  void start(
48  std::chrono::nanoseconds delay,
49  std::chrono::nanoseconds period,
50  PeriodType periodType,
51  size_t maxCount,
52  std::function<void()> task) override;
53  void stop() override;
54  bool activate() override;
55  bool isActive() const override;
57 
59  StopTaskTimer();
60 
63 
64 private:
66  std::mutex m_taskMutex;
67 
69  std::mutex m_mutex;
70 
72  std::function<void()> m_task;
73 
75  std::unique_ptr<avsCommon::sdkInterfaces::timing::TimerDelegateInterface> m_delegate;
76 };
77 
79 public:
82  bool supportsLowPowerMode() override;
83  std::unique_ptr<avsCommon::sdkInterfaces::timing::TimerDelegateInterface> getTimerDelegate() override;
85 };
86 
87 #endif // ALEXA_CLIENT_SDK_AVSCOMMON_UTILS_TEST_AVSCOMMON_UTILS_TIMING_STOPTASKTIMER_H_
88 
89 } // namespace test
90 } // namespace timing
91 } // namespace utils
92 } // namespace avsCommon
93 } // namespace alexaClientSDK
void start(std::chrono::nanoseconds delay, std::chrono::nanoseconds period, PeriodType periodType, size_t maxCount, std::function< void()> task) override
Definition: StopTaskTimer.cpp:58
bool isActive() const override
Definition: StopTaskTimer.cpp:96
Definition: AmdMetricWrapperTest.cpp:24
A factory for creating TimerDelegateInterface.
Definition: TimerDelegateFactoryInterface.h:29
bool activate() override
Definition: StopTaskTimer.cpp:89
void stop() override
Definition: StopTaskTimer.cpp:76
~StopTaskTimer()
Destructor.
Definition: StopTaskTimer.cpp:53
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
PeriodType
Specifies different ways to apply the period of a recurring task.
Definition: TimerDelegateInterface.h:48
StopTaskTimer()
Constructor.
Definition: StopTaskTimer.cpp:48

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