• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 OHOS_DISTRIBUTED_DATA_CLOUD_CLOUD_SERVICE_H
17 #define OHOS_DISTRIBUTED_DATA_CLOUD_CLOUD_SERVICE_H
18 #include <cstdint>
19 #include <map>
20 #include <string>
21 namespace OHOS::CloudData {
22 class CloudService {
23 public:
24     enum TransId : int32_t {
25         TRANS_HEAD,
26         TRANS_ENABLE_CLOUD = TRANS_HEAD,
27         TRANS_DISABLE_CLOUD,
28         TRANS_CHANGE_APP_SWITCH,
29         TRANS_CLEAN,
30         TRANS_NOTIFY_DATA_CHANGE,
31         TRANS_BUTT,
32     };
33     enum Action : int32_t {
34         CLEAR_CLOUD_INFO,
35         CLEAR_CLOUD_DATA_AND_INFO,
36         CLEAR_CLOUD_BUTT
37     };
38 
39     enum Switch : int32_t {
40         SWITCH_ON,
41         SWITCH_OFF
42     };
43 
44     enum Status : int32_t {
45         SUCCESS = 0,
46         ERROR,
47         INVALID_ARGUMENT,
48         SERVER_UNAVAILABLE,
49         FEATURE_UNAVAILABLE,
50         NOT_SUPPORT,
51         CLOUD_DISABLE,
52         CLOUD_DISABLE_SWITCH,
53         IPC_ERROR,
54         IPC_PARCEL_ERROR,
55         PERMISSION_DENIED,
56         CLOUD_CONFIG_PERMISSION_DENIED
57     };
58 
59     virtual ~CloudService() = default;
60     virtual int32_t EnableCloud(const std::string &id, const std::map<std::string, int32_t> &switches) = 0;
61     virtual int32_t DisableCloud(const std::string &id) = 0;
62     virtual int32_t ChangeAppSwitch(const std::string &id, const std::string &bundleName, int32_t appSwitch) = 0;
63     virtual int32_t Clean(const std::string &id, const std::map<std::string, int32_t> &actions) = 0;
64     virtual int32_t NotifyDataChange(const std::string &id, const std::string &bundleName) = 0;
65 
66     inline static constexpr const char *SERVICE_NAME = "cloud";
67 };
68 } // namespace OHOS::CloudData
69 #endif // OHOS_DISTRIBUTED_DATA_CLOUD_CLOUD_SERVICE_H
70