• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 I_FILETRANSFER_CALLBACK_H
16 #define I_FILETRANSFER_CALLBACK_H
17 
18 #include <string>
19 
20 #include "iremote_broker.h"
21 
22 namespace OHOS {
23 namespace Storage {
24 namespace DistributedFile {
25 class IFileTransferCallback : public IRemoteBroker {
26 public:
27     virtual ~IFileTransferCallback() = default;
28 public:
29     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Storage.DistributedFile.IFileTransferCallback");
30     enum {
31         ON_SEND_FINISHED = 0,
32         ON_SEND_ERROR,
33         ON_RECEIVE_FINISHED,
34         ON_RECEIVE_ERROR,
35         ON_SESSION_OPENED,
36         ON_SESSION_CLOSED,
37         ON_WRITE_FILE
38     };
39     // define the error code
40     enum {
41         DFS_CALLBACK_SUCCESS = 0,
42         DFS_CALLBACK_REMOTE_ADDRESS_IS_NULL,
43         DFS_CALLBACK_DESCRIPTOR_IS_EMPTY,
44         DFS_CALLBACK_WRITE_REPLY_FAIL,
45         DFS_CALLBACK_WRITE_REMOTE_OBJECT_FAIL,
46         DFS_CALLBACK_WRITE_DESCRIPTOR_TOKEN_FAIL,
47         DFS_CALLBACK_ERR_SET_FD_FAIL
48     };
49 public:
50     virtual int32_t SendFinished(const std::string &cid, std::string fileName) = 0;
51     virtual int32_t SendError(const std::string &cid) = 0;
52     virtual int32_t ReceiveFinished(const std::string &cid, const std::string &fileName, uint32_t num) = 0;
53     virtual int32_t ReceiveError(const std::string &cid) = 0;
54     virtual int32_t SessionOpened(const std::string &cid) = 0;
55     virtual int32_t SessionClosed(const std::string &cid) = 0;
56     virtual int32_t WriteFile(int32_t fd, const std::string &fileName) = 0;
57 };
58 } // namespace DistributedFile
59 } // namespace Storage
60 } // namespace OHOS
61 #endif // I_FILETRANSFER_CALLBACK_H