• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2025-2025 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 NET_STATS_SYSTEM_TIMER_H
17 #define NET_STATS_SYSTEM_TIMER_H
18 
19 #include "itimer_info.h"
20 #include "time_service_client.h"
21 #include "timer.h"
22 #include <cstdint>
23 #include <functional>
24 #include <string>
25 #include <sys/time.h>
26 #include <vector>
27 
28 namespace OHOS {
29 namespace NetManagerStandard {
30 class NetmanagerSysTimer : public MiscServices::ITimerInfo {
31 public:
32     NetmanagerSysTimer();
33     NetmanagerSysTimer(bool repeat, uint64_t interval, bool isExact = false);
34     virtual ~NetmanagerSysTimer();
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     int32_t GetTodayMidnightTimestamp(int hour, int min, int sec);
42 
43 private:
44     std::function<void()> callBack_ = nullptr;
45 };
46 
47 } // namespace NetManagerStandard
48 } // namespace OHOS
49 #endif // NET_STATS_SYSTEM_TIMER_H