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 OHOS_FILEMGMT_I_CLOUD_SYNC_SERVICE_H
17 #define OHOS_FILEMGMT_I_CLOUD_SYNC_SERVICE_H
18 
19 #include <map>
20 
21 #include "iremote_broker.h"
22 
23 #include "cloud_sync_common.h"
24 
25 namespace OHOS::FileManagement::CloudSync {
26 class ICloudSyncService : public IRemoteBroker {
27 public:
28     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Filemanagement.Dfs.ICloudSyncService")
29 
30     virtual int32_t UnRegisterCallbackInner(const std::string &bundleName = "") = 0;
31     virtual int32_t RegisterCallbackInner(const sptr<IRemoteObject> &remoteObject,
32                                           const std::string &bundleName = "") = 0;
33     virtual int32_t StartSyncInner(bool forceFlag, const std::string &bundleName = "") = 0;
34     virtual int32_t TriggerSyncInner(const std::string &bundleName, const int32_t &userId) = 0;
35     virtual int32_t StopSyncInner(const std::string &bundleName = "", bool forceFlag = false) = 0;
36     virtual int32_t ResetCursor(const std::string &bundleName = "") = 0;
37     virtual int32_t ChangeAppSwitch(const std::string &accoutId, const std::string &bundleName, bool status) = 0;
38     virtual int32_t Clean(const std::string &accountId, const CleanOptions &cleanOptions) = 0;
39     virtual int32_t NotifyDataChange(const std::string &accoutId, const std::string &bundleName) = 0;
40     virtual int32_t NotifyEventChange(int32_t userId, const std::string &eventId, const std::string &extraData) = 0;
41     virtual int32_t EnableCloud(const std::string &accoutId, const SwitchDataObj &switchData) = 0;
42     virtual int32_t DisableCloud(const std::string &accoutId) = 0;
43     virtual int32_t StartDownloadFile(const std::string &path) = 0;
44     virtual int32_t StartFileCache(const std::vector<std::string> &pathVec,
45                                    int64_t &downloadId,
46                                    std::bitset<FIELD_KEY_MAX_SIZE> fieldkey = FIELDKEY_CONTENT,
47                                    bool isCallbackValid = false,
48                                    const sptr<IRemoteObject> &downloadCallback = nullptr) = 0;
49     virtual int32_t StopDownloadFile(const std::string &path, bool needClean = false) = 0;
50     virtual int32_t StopFileCache(const int64_t &downloadId,  bool needClean = false) = 0;
51     virtual int32_t RegisterDownloadFileCallback(const sptr<IRemoteObject> &downloadCallback) = 0;
52     virtual int32_t UnregisterDownloadFileCallback() = 0;
53     virtual int32_t UploadAsset(const int32_t userId, const std::string &request, std::string &result) = 0;
54     virtual int32_t DownloadFile(const int32_t userId, const std::string &bundleName, AssetInfoObj &assetInfoObj) = 0;
55     virtual int32_t DownloadFiles(const int32_t userId,
56                                   const std::string &bundleName,
57                                   const std::vector<AssetInfoObj> &assetInfoObj,
58                                   std::vector<bool> &assetResultMap) = 0;
59     virtual int32_t DownloadAsset(const uint64_t taskId,
60                                   const int32_t userId,
61                                   const std::string &bundleName,
62                                   const std::string &networkId,
63                                   AssetInfoObj &assetInfoObj) = 0;
64     virtual int32_t RegisterDownloadAssetCallback(const sptr<IRemoteObject> &remoteObject) = 0;
65     virtual int32_t DeleteAsset(const int32_t userId, const std::string &uri) = 0;
66     virtual int32_t GetSyncTimeInner(int64_t &syncTime, const std::string &bundleName = "") = 0;
67     virtual int32_t CleanCacheInner(const std::string &uri) = 0;
68 };
69 } // namespace OHOS::FileManagement::CloudSync
70 
71 #endif // OHOS_FILEMGMT_I_CLOUD_SYNC_SERVICE_H
72