1 /*
2 * Copyright (c) 2024 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 #ifndef FILEMANAGEMENT_DFS_SERVICE_EVENTHANDLE_DAEMON_EVENT_H
16 #define FILEMANAGEMENT_DFS_SERVICE_EVENTHANDLE_DAEMON_EVENT_H
17 
18 #include "asset/asset_obj.h"
19 #include "asset/i_asset_send_callback.h"
20 #include "block_object.h"
21 #include "hmdfs_info.h"
22 #include "i_daemon.h"
23 
24 namespace OHOS {
25 namespace Storage {
26 namespace DistributedFile {
27 typedef enum {
28     DEAMON_EXECUTE_PUSH_ASSET = 1,
29     DEAMON_EXECUTE_REQUEST_SEND_FILE,
30     DEAMON_EXECUTE_PREPARE_SESSION,
31 } DaemonEventType;
32 
33 struct PushAssetData {
PushAssetDataPushAssetData34     PushAssetData(int32_t userId, const sptr<AssetObj> &assetObj)
35         : userId_(userId), assetObj_(assetObj)
36     {
37     }
38 
39     int32_t userId_;
40     const sptr<AssetObj> assetObj_;
41 };
42 
43 struct RequestSendFileData {
RequestSendFileDataRequestSendFileData44     RequestSendFileData(const std::string &srcUri,
45                         const std::string &dstPath,
46                         const std::string &dstDeviceId,
47                         const std::string &sessionName,
48                         const std::shared_ptr<BlockObject<int32_t>> &requestSendFileBlock)
49         : srcUri_(srcUri),
50           dstPath_(dstPath),
51           dstDeviceId_(dstDeviceId),
52           sessionName_(sessionName),
53           requestSendFileBlock_(requestSendFileBlock)
54     {
55     }
56 
57     const std::string srcUri_;
58     const std::string dstPath_;
59     const std::string dstDeviceId_;
60     const std::string sessionName_;
61     const std::shared_ptr<BlockObject<int32_t>> requestSendFileBlock_;
62 };
63 
64 struct PrepareSessionData {
PrepareSessionDataPrepareSessionData65     PrepareSessionData(const std::string &srcUri,
66                        const std::string &physicalPath,
67                        const std::string &sessionName,
68                        const sptr<IDaemon> daemon,
69                        HmdfsInfo &info,
70                        const std::shared_ptr<BlockObject<int32_t>> &prepareSessionBlock)
71         : srcUri_(srcUri),
72           physicalPath_(physicalPath),
73           sessionName_(sessionName),
74           daemon_(daemon),
75           info_(info),
76           prepareSessionBlock_(prepareSessionBlock)
77     {
78     }
79 
80     const std::string srcUri_;
81     const std::string physicalPath_;
82     const std::string sessionName_;
83     const sptr<IDaemon> daemon_;
84     HmdfsInfo &info_;
85     const std::shared_ptr<BlockObject<int32_t>> prepareSessionBlock_;
86 };
87 
88 } // namespace DistributedFile
89 } // namespace Storage
90 } // namespace OHOS
91 
92 #endif // FILEMANAGEMENT_DFS_SERVICE_EVENTHANDLE_DAEMON_EVENT_H
93