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 16 #ifndef DSOFTBUS_ADAPTER_H 17 #define DSOFTBUS_ADAPTER_H 18 19 #include "nocopyable.h" 20 21 #include "i_dsoftbus_adapter.h" 22 23 namespace OHOS { 24 namespace Msdp { 25 namespace DeviceStatus { 26 class DSoftbusAdapter final : public IDSoftbusAdapter { 27 public: 28 DSoftbusAdapter() = default; 29 ~DSoftbusAdapter() = default; 30 DISALLOW_COPY_AND_MOVE(DSoftbusAdapter); 31 32 int32_t Enable() override; 33 void Disable() override; 34 35 void AddObserver(std::shared_ptr<IDSoftbusObserver> observer) override; 36 void RemoveObserver(std::shared_ptr<IDSoftbusObserver> observer) override; 37 38 int32_t OpenSession(const std::string &networkId) override; 39 void CloseSession(const std::string &networkId) override; 40 void CloseAllSessions() override; 41 42 int32_t SendPacket(const std::string &networkId, NetPacket &packet) override; 43 int32_t SendParcel(const std::string &networkId, Parcel &parcel) override; 44 int32_t BroadcastPacket(NetPacket &packet) override; 45 bool HasSessionExisted(const std::string &networkId) override; 46 }; 47 } // namespace DeviceStatus 48 } // namespace Msdp 49 } // namespace OHOS 50 #endif // DSOFTBUS_ADAPTER_H 51