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 #include "dsoftbus_adapter.h" 17 18 #include "dsoftbus_adapter_impl.h" 19 20 namespace OHOS { 21 namespace Msdp { 22 namespace DeviceStatus { Enable()23int32_t DSoftbusAdapter::Enable() 24 { 25 return DSoftbusAdapterImpl::GetInstance()->Enable(); 26 } 27 Disable()28void DSoftbusAdapter::Disable() 29 { 30 DSoftbusAdapterImpl::GetInstance()->Disable(); 31 } 32 AddObserver(std::shared_ptr<IDSoftbusObserver> observer)33void DSoftbusAdapter::AddObserver(std::shared_ptr<IDSoftbusObserver> observer) 34 { 35 DSoftbusAdapterImpl::GetInstance()->AddObserver(observer); 36 } 37 RemoveObserver(std::shared_ptr<IDSoftbusObserver> observer)38void DSoftbusAdapter::RemoveObserver(std::shared_ptr<IDSoftbusObserver> observer) 39 { 40 DSoftbusAdapterImpl::GetInstance()->RemoveObserver(observer); 41 } 42 OpenSession(const std::string & networkId)43int32_t DSoftbusAdapter::OpenSession(const std::string &networkId) 44 { 45 return DSoftbusAdapterImpl::GetInstance()->OpenSession(networkId); 46 } 47 CloseSession(const std::string & networkId)48void DSoftbusAdapter::CloseSession(const std::string &networkId) 49 { 50 DSoftbusAdapterImpl::GetInstance()->CloseSession(networkId); 51 } 52 SendPacket(const std::string & networkId,NetPacket & packet)53int32_t DSoftbusAdapter::SendPacket(const std::string &networkId, NetPacket &packet) 54 { 55 return DSoftbusAdapterImpl::GetInstance()->SendPacket(networkId, packet); 56 } 57 } // namespace DeviceStatus 58 } // namespace Msdp 59 } // namespace OHOS 60