1 /*
2 * Copyright (C) 2021 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 #include "timer_info.h"
17
18 namespace OHOS {
19 namespace MiscServices {
operator ==(const TimerInfo & other) const20 bool TimerInfo::operator==(const TimerInfo &other) const
21 {
22 return this->id == other.id;
23 }
24
Matches(const std::string & packageName) const25 bool TimerInfo::Matches(const std::string &packageName) const
26 {
27 return false;
28 }
29
TimerInfo(uint64_t _id,int _type,std::chrono::milliseconds _when,std::chrono::steady_clock::time_point _whenElapsed,std::chrono::milliseconds _windowLength,std::chrono::steady_clock::time_point _maxWhen,std::chrono::milliseconds _interval,std::function<void (const uint64_t)> _callback,uint32_t _flags,int _uid)30 TimerInfo::TimerInfo(uint64_t _id, int _type,
31 std::chrono::milliseconds _when,
32 std::chrono::steady_clock::time_point _whenElapsed,
33 std::chrono::milliseconds _windowLength,
34 std::chrono::steady_clock::time_point _maxWhen,
35 std::chrono::milliseconds _interval,
36 std::function<void(const uint64_t)> _callback,
37 uint32_t _flags,
38 int _uid)
39 : id {_id},
40 type {_type},
41 origWhen {_when},
42 wakeup {_type == ITimerManager::ELAPSED_REALTIME_WAKEUP || _type == ITimerManager::RTC_WAKEUP},
43 callback {std::move(_callback)},
44 flags {_flags},
45 uid {_uid},
46 when {_when},
47 windowLength {_windowLength},
48 whenElapsed {_whenElapsed},
49 maxWhenElapsed {_maxWhen},
50 expectedWhenElapsed {_whenElapsed},
51 expectedMaxWhenElapsed {_maxWhen},
52 repeatInterval {_interval}
53 {
54 }
55 } // MiscServices
56 } // OHOS