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 #include "sdk_helper.h"
17
18 #include "dfs_error.h"
19
20 namespace OHOS {
21 namespace FileManagement {
22 namespace CloudSync {
23 using namespace std;
24
Init(const int32_t userId,const std::string & bundleName)25 int32_t SdkHelper::Init(const int32_t userId, const std::string &bundleName)
26 {
27 return E_OK;
28 }
29
GetLock(DriveKit::DKLock & lock)30 int32_t SdkHelper::GetLock(DriveKit::DKLock &lock)
31 {
32 return E_OK;
33 }
34
DeleteLock(DriveKit::DKLock & lock)35 void SdkHelper::DeleteLock(DriveKit::DKLock &lock)
36 {
37 return;
38 }
39
FetchRecords(std::shared_ptr<DriveKit::DKContext> context,FetchCondition & cond,DriveKit::DKQueryCursor,FetchRecordsCallback callback)40 int32_t SdkHelper::FetchRecords(std::shared_ptr<DriveKit::DKContext> context, FetchCondition &cond,
41 DriveKit::DKQueryCursor, FetchRecordsCallback callback)
42 {
43 return E_OK;
44 }
45
FetchRecordWithId(std::shared_ptr<DriveKit::DKContext> context,FetchCondition & cond,DriveKit::DKRecordId recordId,FetchRecordCallback callback)46 int32_t SdkHelper::FetchRecordWithId(std::shared_ptr<DriveKit::DKContext> context, FetchCondition &cond,
47 DriveKit::DKRecordId recordId, FetchRecordCallback callback)
48 {
49 return E_OK;
50 }
51
FetchDatabaseChanges(std::shared_ptr<DriveKit::DKContext> context,FetchCondition & cond,DriveKit::DKQueryCursor cursor,FetchDatabaseChangesCallback callback)52 int32_t SdkHelper::FetchDatabaseChanges(std::shared_ptr<DriveKit::DKContext> context, FetchCondition &cond,
53 DriveKit::DKQueryCursor cursor, FetchDatabaseChangesCallback callback)
54 {
55 return E_OK;
56 }
57
CreateRecords(shared_ptr<DriveKit::DKContext> context,vector<DriveKit::DKRecord> & records,std::function<void (std::shared_ptr<DriveKit::DKContext>,std::shared_ptr<const DriveKit::DKDatabase>,std::shared_ptr<const std::map<DriveKit::DKRecordId,DriveKit::DKRecordOperResult>>,const DriveKit::DKError &)> callback)58 int32_t SdkHelper::CreateRecords(shared_ptr<DriveKit::DKContext> context,
59 vector<DriveKit::DKRecord> &records,
60 std::function<void(std::shared_ptr<DriveKit::DKContext>, std::shared_ptr<const DriveKit::DKDatabase>,
61 std::shared_ptr<const std::map<DriveKit::DKRecordId, DriveKit::DKRecordOperResult>>,
62 const DriveKit::DKError &)> callback)
63 {
64 return E_OK;
65 }
DeleteRecords(shared_ptr<DriveKit::DKContext> context,vector<DriveKit::DKRecord> & records,std::function<void (std::shared_ptr<DriveKit::DKContext>,std::shared_ptr<const DriveKit::DKDatabase>,std::shared_ptr<const std::map<DriveKit::DKRecordId,DriveKit::DKRecordOperResult>>,const DriveKit::DKError &)> callback)66 int32_t SdkHelper::DeleteRecords(shared_ptr<DriveKit::DKContext> context,
67 vector<DriveKit::DKRecord> &records,
68 std::function<void(std::shared_ptr<DriveKit::DKContext>, std::shared_ptr<const DriveKit::DKDatabase>,
69 std::shared_ptr<const std::map<DriveKit::DKRecordId, DriveKit::DKRecordOperResult>>,
70 const DriveKit::DKError &)> callback)
71 {
72 return E_OK;
73 }
74
ModifyRecords(shared_ptr<DriveKit::DKContext> context,vector<DriveKit::DKRecord> & records,DriveKit::DKDatabase::ModifyRecordsCallback callback)75 int32_t SdkHelper::ModifyRecords(shared_ptr<DriveKit::DKContext> context,
76 vector<DriveKit::DKRecord> &records, DriveKit::DKDatabase::ModifyRecordsCallback callback)
77 {
78 return E_OK;
79 }
80
DownloadAssets(shared_ptr<DriveKit::DKContext> context,std::vector<DriveKit::DKDownloadAsset> & assetsToDownload,DriveKit::DKAssetPath downLoadPath,DriveKit::DKDownloadId & id,std::function<void (std::shared_ptr<DriveKit::DKContext>,std::shared_ptr<const DriveKit::DKDatabase>,const std::map<DriveKit::DKDownloadAsset,DriveKit::DKDownloadResult> &,const DriveKit::DKError &)> resultCallback,std::function<void (std::shared_ptr<DriveKit::DKContext>,DriveKit::DKDownloadAsset,DriveKit::TotalSize,DriveKit::DownloadSize)> progressCallback)81 int32_t SdkHelper::DownloadAssets(shared_ptr<DriveKit::DKContext> context,
82 std::vector<DriveKit::DKDownloadAsset> &assetsToDownload, DriveKit::DKAssetPath downLoadPath,
83 DriveKit::DKDownloadId &id,
84 std::function<void(std::shared_ptr<DriveKit::DKContext>,
85 std::shared_ptr<const DriveKit::DKDatabase>,
86 const std::map<DriveKit::DKDownloadAsset, DriveKit::DKDownloadResult> &,
87 const DriveKit::DKError &)> resultCallback,
88 std::function<void(std::shared_ptr<DriveKit::DKContext>, DriveKit::DKDownloadAsset,
89 DriveKit::TotalSize, DriveKit::DownloadSize)> progressCallback)
90 {
91 return E_OK;
92 }
93
DownloadAssets(DriveKit::DKDownloadAsset & assetsToDownload)94 int32_t SdkHelper::DownloadAssets(DriveKit::DKDownloadAsset &assetsToDownload)
95 {
96 return E_OK;
97 }
98
CancelDownloadAssets(int32_t id)99 int32_t SdkHelper::CancelDownloadAssets(int32_t id)
100 {
101 return E_OK;
102 }
103
GetStartCursor(DriveKit::DKRecordType recordType,DriveKit::DKQueryCursor & cursor)104 int32_t SdkHelper::GetStartCursor(DriveKit::DKRecordType recordType, DriveKit::DKQueryCursor &cursor)
105 {
106 return E_OK;
107 }
108
GetAssetReadSession(DriveKit::DKRecordType recordType,DriveKit::DKRecordId recordId,DriveKit::DKFieldKey assetKey,DriveKit::DKAssetPath assetPath)109 std::shared_ptr<DriveKit::DKAssetReadSession> SdkHelper::GetAssetReadSession(DriveKit::DKRecordType recordType,
110 DriveKit::DKRecordId recordId,
111 DriveKit::DKFieldKey assetKey,
112 DriveKit::DKAssetPath assetPath)
113 {
114 return nullptr;
115 }
116 }
117 }
118 }