1 /* 2 * Copyright (c) 2021-2022 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 BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_SERVICES_REMINDER_INCLUDE_REMINDER_TIMER_INFO_H 17 #define BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_SERVICES_REMINDER_INCLUDE_REMINDER_TIMER_INFO_H 18 19 #include "reminder_agent_service.h" 20 #include "itimer_info.h" 21 #include "notification_request.h" 22 #include "reminder_request.h" 23 24 namespace OHOS { 25 namespace Notification { 26 class ReminderTimerInfo : public MiscServices::ITimerInfo { 27 public: 28 enum class ReminderTimerType : uint8_t { 29 REMINDER_TIMER_UNKNOWN = 0, 30 REMINDER_TIMER_LOAD = 1, 31 }; 32 33 public: ReminderTimerInfo()34 ReminderTimerInfo() {}; ~ReminderTimerInfo()35 virtual ~ReminderTimerInfo() {}; 36 37 ReminderTimerInfo(ReminderTimerInfo &other) = delete; 38 ReminderTimerInfo& operator = (const ReminderTimerInfo &other) = delete; 39 SetAction(const std::string & action)40 inline void SetAction(const std::string &action) 41 { 42 action_ = action; 43 } 44 SetPid(const int32_t pid)45 inline void SetPid(const int32_t pid) 46 { 47 pid_ = pid; 48 } 49 SetUid(const int32_t uid)50 inline void SetUid(const int32_t uid) 51 { 52 uid_ = uid; 53 } 54 SetBundleName(const std::string & bundleName)55 inline void SetBundleName(const std::string &bundleName) 56 { 57 bundleName_ = bundleName; 58 } 59 SetReminderTimerType(const ReminderTimerType type)60 inline void SetReminderTimerType(const ReminderTimerType type) 61 { 62 reminderTimerType_ = type; 63 } 64 65 /** 66 * When timing is up, this function will execute as call back. 67 */ 68 void OnTrigger() override; 69 70 /** 71 * Indicates the timing type. 72 */ 73 void SetType(const int32_t &type) override; 74 75 /** 76 * Indicates the repeat policy. 77 */ 78 void SetRepeat(bool repeat) override; 79 80 /** 81 * Indicates the interval time for repeat timing. 82 */ 83 void SetInterval(const uint64_t &interval) override; 84 85 /** 86 * Indicates the want agent information. 87 */ 88 void SetWantAgent(std::shared_ptr<OHOS::AbilityRuntime::WantAgent::WantAgent> wantAgent) override; 89 90 private: 91 std::string action_; 92 int32_t pid_ {-1}; 93 int32_t uid_ {-1}; 94 std::string bundleName_; 95 ReminderTimerType reminderTimerType_ {ReminderTimerType::REMINDER_TIMER_UNKNOWN}; 96 }; 97 } // namespace OHOS 98 } // namespace Notification 99 100 #endif // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_SERVICES_REMINDER_INCLUDE_REMINDER_TIMER_INFO_H 101