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 16 #ifndef DFS_FILETRANSFER_CALLBACK_H 17 #define DFS_FILETRANSFER_CALLBACK_H 18 19 #include "filetransfer_callback_stub.h" 20 21 namespace OHOS { 22 namespace Storage { 23 namespace DistributedFile { 24 class DfsFileTransferCallback : public FileTransferCallbackStub { 25 public: 26 enum { 27 DFS_FILE_TRANS_NO_ERROR = 0, 28 DFS_FILE_TRANS_ERROR = -1, 29 }; 30 31 DfsFileTransferCallback(); 32 virtual ~DfsFileTransferCallback() override; 33 int32_t SessionOpened(const std::string &cid) override; 34 int32_t SessionClosed(const std::string &cid) override; 35 int32_t SendFinished(const std::string &cid, std::string fileName) override; 36 int32_t SendError(const std::string &cid) override; 37 int32_t ReceiveFinished(const std::string &cid, const std::string &fileName, uint32_t num) override; 38 int32_t ReceiveError(const std::string &cid) override; 39 int32_t WriteFile(int32_t fd, const std::string &fileName) override; 40 }; 41 } // namespace DistributedFile 42 } // namespace Storage 43 } // namespace OHOS 44 #endif // DFS_FILETRANSFER_CALLBACK_H