• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef FOUNDATION_APPEXECFWK_SERVICES_FORMMGR_INCLUDE_FORM_TIMER_TASK_H
16 #define FOUNDATION_APPEXECFWK_SERVICES_FORMMGR_INCLUDE_FORM_TIMER_TASK_H
17 
18 namespace OHOS {
19 namespace AppExecFwk {
20 /**
21  * @enum UpdateType
22  * Update type.
23  */
24 enum UpdateType {
25     TYPE_INTERVAL_CHANGE,
26     TYPE_ATTIME_CHANGE,
27     TYPE_INTERVAL_TO_ATTIME,
28     TYPE_ATTIME_TO_INTERVAL,
29     TYPE_INTERVAL_ONCE,
30 };
31 /**
32  * @class FormTimer
33  * form timer task.
34  */
35 class FormTimer {
36 public:
37     int64_t formId;
38     int64_t period;
39     int hour;
40     int min;
41     bool isUpdateAt;
42     int64_t refreshTime;
43     bool isEnable = true;
44     bool isCountTimer = false;
45     UpdateType type = UpdateType::TYPE_INTERVAL_CHANGE;
46 
FormTimer()47     FormTimer()
48     {
49         formId = -1;
50         period = -1;
51         hour = -1;
52         min = -1;
53         isUpdateAt = false;
54         isCountTimer = false;
55         refreshTime = 0;
56         type = UpdateType::TYPE_INTERVAL_CHANGE;
57     }
58 
FormTimer(int64_t id,bool countTimer)59     FormTimer(int64_t id, bool countTimer)
60     {
61         formId = id;
62         period = -1;
63         hour = -1;
64         min = -1;
65         isUpdateAt = false;
66         isCountTimer = countTimer;
67         refreshTime = 0;
68         type = UpdateType::TYPE_INTERVAL_CHANGE;
69     }
70 
FormTimer(int64_t id,long repeatTime)71     FormTimer(int64_t id, long repeatTime)
72     {
73         formId = id;
74         period = repeatTime;
75         hour = -1;
76         min = -1;
77         isUpdateAt = false;
78         isCountTimer = true;
79         refreshTime = 0;
80         type = UpdateType::TYPE_INTERVAL_CHANGE;
81     }
82 
FormTimer(int64_t id,int hourTime,int minTime)83     FormTimer(int64_t id, int hourTime, int minTime)
84     {
85         formId = id;
86         hour = hourTime;
87         min = minTime;
88         period = -1;
89         isUpdateAt = true;
90         isCountTimer = false;
91         refreshTime = 0;
92         type = UpdateType::TYPE_INTERVAL_CHANGE;
93     }
~FormTimer(void)94     ~FormTimer(void){
95     }
96 };
97 /**
98  * @class UpdateAtItem
99  * Update item at time.
100  */
101 class UpdateAtItem {
102 public:
103     int updateAtTime = -1;
104     FormTimer refreshTask;
105 };
106 /**
107  * @class DynamicRefreshItem
108  * Dynamic refresh item.
109  */
110 class DynamicRefreshItem {
111 public:
112     int64_t formId = 0L;
113     int64_t settedTime = -1L;
114 
DynamicRefreshItem()115     DynamicRefreshItem(){}
116 
DynamicRefreshItem(int64_t id,int64_t time)117     DynamicRefreshItem(int64_t id, int64_t time)
118     {
119         formId = id;
120         settedTime = time;
121     }
~DynamicRefreshItem(void)122     ~DynamicRefreshItem(void){
123     }
124 };
125 /**
126  * @struct LimitInfo
127  * Limit info about a form.
128  */
129 struct LimitInfo {
130     int refreshCount = 0;
131     bool isReported = false;
132     bool remindFlag = false;
133 };
134 
135 /**
136  * @struct FormTimerCfg
137  * Form timer config info.
138  */
139 struct FormTimerCfg {
140     bool enableUpdate = false;
141     int64_t updateDuration = 0L;
142     int updateAtHour = -1;
143     int updateAtMin = -1;
144 };
145 
146 }  // namespace AppExecFwk
147 }  // namespace OHOS
148 #endif // FOUNDATION_APPEXECFWK_SERVICES_FORMMGR_INCLUDE_FORM_TIMER_TASK_H
149