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_FILEMGMT_CLOUD_SYNC_SERVICE_STUB_H
17 #define OHOS_FILEMGMT_CLOUD_SYNC_SERVICE_STUB_H
18 
19 #include <map>
20 #include "iremote_stub.h"
21 #include "i_cloud_sync_service.h"
22 
23 namespace OHOS::FileManagement::CloudSync {
24 using ServiceInterface = std::function<int32_t(MessageParcel &data, MessageParcel &reply)>;
25 class __attribute__ ((visibility("default"))) CloudSyncServiceStub : public IRemoteStub<ICloudSyncService> {
26 public:
27     CloudSyncServiceStub();
28     virtual ~CloudSyncServiceStub() = default;
29     int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
30 
31 private:
32     std::map<uint32_t, ServiceInterface> opToInterfaceMap_;
33     int32_t HandleUnRegisterCallbackInner(MessageParcel &data, MessageParcel &reply);
34     int32_t HandleRegisterCallbackInner(MessageParcel &data, MessageParcel &reply);
35     int32_t HandleStartSyncInner(MessageParcel &data, MessageParcel &reply);
36     int32_t HandleTriggerSyncInner(MessageParcel &data, MessageParcel &reply);
37     int32_t HandleStopSyncInner(MessageParcel &data, MessageParcel &reply);
38     int32_t HandleResetCursor(MessageParcel &data, MessageParcel &reply);
39     int32_t HandleChangeAppSwitch(MessageParcel &data, MessageParcel &reply);
40     int32_t HandleClean(MessageParcel &data, MessageParcel &reply);
41     int32_t HandleNotifyDataChange(MessageParcel &data, MessageParcel &reply);
42     int32_t HandleNotifyEventChange(MessageParcel &data, MessageParcel &reply);
43     int32_t HandleEnableCloud(MessageParcel &data, MessageParcel &reply);
44     int32_t HandleDisableCloud(MessageParcel &data, MessageParcel &reply);
45     int32_t HandleStartDownloadFile(MessageParcel &data, MessageParcel &reply);
46     int32_t HandleStartFileCache(MessageParcel &data, MessageParcel &reply);
47     int32_t HandleStopDownloadFile(MessageParcel &data, MessageParcel &reply);
48     int32_t HandleStopFileCache(MessageParcel &data, MessageParcel &reply);
49     int32_t HandleRegisterDownloadFileCallback(MessageParcel &data, MessageParcel &reply);
50     int32_t HandleUnregisterDownloadFileCallback(MessageParcel &data, MessageParcel &reply);
51     int32_t HandleUploadAsset(MessageParcel &data, MessageParcel &reply);
52     int32_t HandleDownloadFile(MessageParcel &data, MessageParcel &reply);
53     int32_t HandleDownloadFiles(MessageParcel &data, MessageParcel &reply);
54     int32_t HandleDownloadAsset(MessageParcel &data, MessageParcel &reply);
55     int32_t HandleRegisterDownloadAssetCallback(MessageParcel &data, MessageParcel &reply);
56     int32_t HandleDeleteAsset(MessageParcel &data, MessageParcel &reply);
57     int32_t HandleGetSyncTime(MessageParcel &data, MessageParcel &reply);
58     int32_t HandleCleanCache(MessageParcel &data, MessageParcel &reply);
59 };
60 } // namespace OHOS::FileManagement::CloudSync
61 
62 #endif // OHOS_FILEMGMT_CLOUD_SYNC_SERVICE_STUB_H
63