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 FILETRANSFER_CALLBACK_STUB_H 16 #define FILETRANSFER_CALLBACK_STUB_H 17 18 #include <map> 19 20 #include "iremote_stub.h" 21 #include "i_filetransfer_callback.h" 22 23 namespace OHOS { 24 namespace Storage { 25 namespace DistributedFile { 26 class FileTransferCallbackStub : public IRemoteStub<IFileTransferCallback> { 27 public: 28 FileTransferCallbackStub(); 29 virtual ~FileTransferCallbackStub(); 30 31 int32_t OnRemoteRequest( 32 uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; 33 34 private: 35 using NotifyCallbackFunc = int32_t (FileTransferCallbackStub::*)(MessageParcel &, MessageParcel &); 36 37 private: 38 int32_t CmdOnSessionOpened(MessageParcel &data, MessageParcel &reply); 39 int32_t CmdOnSessionClosed(MessageParcel &data, MessageParcel &reply); 40 int32_t CmdOnSendFinished(MessageParcel &data, MessageParcel &reply); 41 int32_t CmdOnSendError(MessageParcel &data, MessageParcel &reply); 42 int32_t CmdOnReceiveFinished(MessageParcel &data, MessageParcel &reply); 43 int32_t CmdOnReceiveError(MessageParcel &data, MessageParcel &reply); 44 int32_t CmdWriteFile(MessageParcel &data, MessageParcel &reply); 45 private: 46 std::map<uint32_t, NotifyCallbackFunc> memberFuncMap_; 47 }; 48 } // namespace DistributedFile 49 } // namespace Storage 50 } // namespace OHOS 51 #endif // FILETRANSFER_CALLBACK_STUB_H