• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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 UPDATE_SERVICE_CACHE_H
17 #define UPDATE_SERVICE_CACHE_H
18 
19 #include "update_helper.h"
20 
21 namespace OHOS {
22 namespace UpdateEngine {
23 class UpdateServiceCache {
24 public:
25     static UpgradeInfo GetUpgradeInfo(BusinessSubType businessSubType);
26     static void SetUpgradeInfo(const UpgradeInfo &upgradeInfo);
27     static uint64_t GetCheckInterval(BusinessSubType businessSubType);
28     static void SetCheckInterval(BusinessSubType businessSubType, uint64_t interval);
29     static uint64_t GetDownloadInterval(BusinessSubType businessSubType);
30     static void SetDownloadInterval(BusinessSubType businessSubType, uint64_t interval);
31     static UpgradeInterval GetUpgradeInterval(BusinessSubType businessSubType);
32     static void SetUpgradeStartTime(BusinessSubType businessSubType, uint64_t time);
33     static void SetUpgradeEndTime(BusinessSubType businessSubType, uint64_t time);
34 
35 private:
36     static bool IsTypelegal(BusinessSubType businessSubType);
37     static bool IsParamType(BusinessSubType businessSubType);
38 
39     static UpgradeInfo upgradeInfo_;
40     static uint64_t checkInterval_;
41     static uint64_t downloadInterval_;
42     static UpgradeInterval upgradeInterval_;
43 
44     static UpgradeInfo paramUpgradeInfo_;
45     static uint64_t paramCheckInterval_;
46     static uint64_t paramDownloadInterval_;
47     static UpgradeInterval paramUpgradeInterval_;
48 };
49 } // namespace UpdateEngine
50 } // namespace OHOS
51 #endif // UPDATE_SERVICE_CACHE_H