1 /* 2 * Copyright (C) 2021-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 #ifndef DHCP_SYSTEM_TIMER_H 16 #define DHCP_SYSTEM_TIMER_H 17 18 #ifndef OHOS_ARCH_LITE 19 #include <cstdint> 20 #include <functional> 21 #include <string> 22 #include <sys/time.h> 23 #include <vector> 24 #include "time_service_client.h" 25 #include "itimer_info.h" 26 #include "timer.h" 27 28 namespace OHOS { 29 namespace DHCP { 30 class DhcpSysTimer : public MiscServices::ITimerInfo { 31 public: 32 DhcpSysTimer(); 33 DhcpSysTimer(bool repeat, uint64_t interval, bool isNoWakeUp, bool isIdle = false); 34 virtual ~DhcpSysTimer(); 35 void OnTrigger() override; 36 void SetType(const int &type) override; 37 void SetRepeat(bool repeat) override; 38 void SetInterval(const uint64_t &interval) override; 39 void SetWantAgent(std::shared_ptr<OHOS::AbilityRuntime::WantAgent::WantAgent> _wantAgent) override; 40 void SetCallbackInfo(const std::function<void()> &callBack); 41 private: 42 std::function<void()> callBack_ = nullptr; 43 }; 44 } // namespace DHCP 45 } // namespace OHOS 46 #endif 47 #endif