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 #include "reminder_timer_info.h" 17 18 #include "ans_log_wrapper.h" 19 #include "reminder_data_manager.h" 20 21 using namespace OHOS::EventFwk; 22 using namespace OHOS::HiviewDFX; 23 namespace OHOS { 24 namespace Notification { SetType(const int & _type)25void ReminderTimerInfo::SetType(const int &_type) 26 { 27 type = _type; 28 } 29 SetRepeat(bool _repeat)30void ReminderTimerInfo::SetRepeat(bool _repeat) 31 { 32 repeat = _repeat; 33 } 34 SetInterval(const uint64_t & _interval)35void ReminderTimerInfo::SetInterval(const uint64_t &_interval) 36 { 37 interval = _interval; 38 } 39 SetWantAgent(std::shared_ptr<OHOS::AbilityRuntime::WantAgent::WantAgent> _wantAgent)40void ReminderTimerInfo::SetWantAgent(std::shared_ptr<OHOS::AbilityRuntime::WantAgent::WantAgent> _wantAgent) 41 { 42 wantAgent = _wantAgent; 43 } 44 OnTrigger()45void ReminderTimerInfo::OnTrigger() 46 { 47 ANSR_LOGI("Timing is arrivelled[%{public}d].", static_cast<int32_t>(reminderTimerType_)); 48 switch (reminderTimerType_) { 49 case ReminderTimerType::REMINDER_TIMER_LOAD: { 50 auto manager = ReminderDataManager::GetInstance(); 51 if (manager == nullptr) { 52 return; 53 } 54 manager->OnLoadReminderEvent(); 55 break; 56 } 57 case ReminderTimerType::REMINDER_TIMER_UNKNOWN: 58 break; 59 default: 60 break; 61 } 62 } 63 } 64 } 65