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 #ifndef FILEMANAGEMENT_DFS_SERVICE_SOFTBUS_HANDLER_H 17 #define FILEMANAGEMENT_DFS_SERVICE_SOFTBUS_HANDLER_H 18 19 #include "session.h" 20 #include <map> 21 #include <string> 22 23 namespace OHOS { 24 namespace Storage { 25 namespace DistributedFile { 26 class SoftBusHandler { 27 public: 28 SoftBusHandler(); 29 ~SoftBusHandler(); 30 static SoftBusHandler &GetInstance(); 31 int32_t CreateSessionServer(const std::string &packageName, const std::string &sessionName); 32 int32_t SetFileReceiveListener(const std::string &packageName, 33 const std::string &sessionName, 34 const std::string &dstPath); 35 int32_t SetFileSendListener(const std::string &packageName, const std::string &sessionName); 36 void ChangeOwnerIfNeeded(int sessionId); 37 void CloseSession(int sessionId); 38 39 private: 40 static inline const std::string SERVICE_NAME{"ohos.storage.distributedfile.daemon"}; 41 ISessionListener sessionListener_; 42 IFileReceiveListener fileReceiveListener_; 43 IFileSendListener fileSendListener_; 44 }; 45 } // namespace DistributedFile 46 } // namespace Storage 47 } // namespace OHOS 48 49 #endif // FILEMANAGEMENT_DFS_SERVICE_SOFTBUS_HANDLER_H