Files
miscservices_time/services/timer/include/timer_manager_interface.h
T
zhutianyi eaba82b1f0 新增逻辑
Signed-off-by: zhutianyi <zhutianyi2@huawei.com>
2022-07-01 14:12:49 +08:00

65 lines
1.9 KiB
C++

/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TIMER_MANAGER_INTERFACE_H
#define TIMER_MANAGER_INTERFACE_H
#include <memory>
#include "want_agent_helper.h"
namespace OHOS {
namespace MiscServices {
struct TimerEntry {
uint64_t id;
int type;
uint64_t windowLength;
uint64_t interval;
int flag;
std::function<void (const uint64_t)> callback;
int uid;
};
class ITimerManager {
public:
enum TimerFlag {
STANDALONE = 1 << 0,
WAKE_FROM_IDLE = 1 << 1,
ALLOW_WHILE_IDLE = 1 << 2,
ALLOW_WHILE_IDLE_UNRESTRICTED = 1 << 3,
IDLE_UNTIL = 1 << 4,
};
enum TimerType {
RTC_WAKEUP = 0,
RTC = 1,
ELAPSED_REALTIME_WAKEUP = 2,
ELAPSED_REALTIME = 3
};
virtual uint64_t CreateTimer(int type, uint64_t windowLength, uint64_t interval, int flag,
std::function<void(const uint64_t)> callback,
int uid) = 0;
virtual bool StartTimer(uint64_t timerNumber, uint64_t triggerTime) = 0;
virtual bool StopTimer(uint64_t timerNumber) = 0;
virtual bool DestroyTimer(uint64_t timerNumber) = 0;
virtual ~ITimerManager() = default;
virtual bool ProxyTimer(int32_t uid, bool isProxy, bool needRetrigger) = 0;
virtual bool ResetAllProxy() = 0;
}; // ITimerManager
} // MiscService
} // OHOS
#endif