2 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
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 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 ///////////////////////////////////////////////////////////////////////////////
18 /// \ingroup tag_PowerService
19 /// \brief This file supports power service hysteresis management.
21 ///////////////////////////////////////////////////////////////////////////////
22 #ifndef POWER_SERVICE_SERVER_INCLUDE_SS_POWER_STATE_HYSTERESIS_H_
23 #define POWER_SERVICE_SERVER_INCLUDE_SS_POWER_STATE_HYSTERESIS_H_
25 #include "ss_power_config.h"
27 class PowerStateHysteresis {
29 PowerStateHysteresis()
31 bzero(&m_tHysteresisInfo, sizeof(m_tHysteresisInfo));
34 virtual ~PowerStateHysteresis() { // LCOV_EXCL_START 14: do it when power off
35 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
38 // LCOV_EXCL_STOP 14: do it when power off
39 explicit PowerStateHysteresis(PowerConfigParams::PowerOffInfo & info) // NOLINT (runtime/references)
41 m_tHysteresisInfo(info) {
43 void set(PowerConfigParams::PowerOffInfo & info) { // NOLINT (runtime/references)
44 m_tHysteresisInfo = info;
46 BOOL getEnabled() const {
47 return m_tHysteresisInfo.hysteresis.enabled;
49 UI_32 getTimeout() const {
50 return m_tHysteresisInfo.hysteresis.timeout;
52 UI_32 getTries() const {
53 return m_tHysteresisInfo.hysteresis.tries;
56 void clearTryCounter() {
59 void bumbTryCounter() {
62 BOOL maxTries() const {
63 if (m_unTries < getTries())
71 PowerConfigParams::PowerOffInfo m_tHysteresisInfo;
74 #endif // POWER_SERVICE_SERVER_INCLUDE_SS_POWER_STATE_HYSTERESIS_H_