1 /* 2 * Copyright (c) 2024-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef STARTUP_DELAY_STATE_COLLECTION_H 17 #define STARTUP_DELAY_STATE_COLLECTION_H 18 19 #include "istate_collection.h" 20 #include "thermal_timer.h" 21 22 namespace OHOS { 23 namespace PowerMgr { 24 25 class StartupDelayStateCollection : public IStateCollection { 26 public: 27 enum { 28 NON_STARTUP_DELAY_STATE = 0, 29 STARTUP_DELAY_STATE, 30 }; 31 StartupDelayStateCollection() = default; 32 ~StartupDelayStateCollection() = default; 33 bool Init() override; 34 bool InitParam(std::string& params) override; 35 std::string GetState() override; 36 virtual bool DecideState(const std::string& value) override; 37 bool StartDelayTimer(); 38 void StopDelayTimer(); 39 void ResetState(); 40 virtual void SetState(const std::string& stateValue) override; 41 42 #ifndef THERMAL_OBSERVER_UT_TEST 43 private: 44 #endif 45 int32_t state_ {NON_STARTUP_DELAY_STATE}; 46 std::string params_; 47 std::mutex mutex_; 48 uint64_t delayTime_ {0}; 49 uint64_t delayTimerId_ {0}; 50 }; 51 } // namespace PowerMgr 52 } // namespace OHOS 53 #endif // STARTUP_DELAY_STATE_COLLECTION_H 54