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()23 int32_t DSoftbusAdapter::Enable()
24 {
25 return DSoftbusAdapterImpl::GetInstance()->Enable();
26 }
27
Disable()28 void DSoftbusAdapter::Disable()
29 {
30 DSoftbusAdapterImpl::GetInstance()->Disable();
31 }
32
AddObserver(std::shared_ptr<IDSoftbusObserver> observer)33 void DSoftbusAdapter::AddObserver(std::shared_ptr<IDSoftbusObserver> observer)
34 {
35 DSoftbusAdapterImpl::GetInstance()->AddObserver(observer);
36 }
37
RemoveObserver(std::shared_ptr<IDSoftbusObserver> observer)38 void DSoftbusAdapter::RemoveObserver(std::shared_ptr<IDSoftbusObserver> observer)
39 {
40 DSoftbusAdapterImpl::GetInstance()->RemoveObserver(observer);
41 }
42
OpenSession(const std::string & networkId)43 int32_t DSoftbusAdapter::OpenSession(const std::string &networkId)
44 {
45 return DSoftbusAdapterImpl::GetInstance()->OpenSession(networkId);
46 }
47
CloseSession(const std::string & networkId)48 void DSoftbusAdapter::CloseSession(const std::string &networkId)
49 {
50 DSoftbusAdapterImpl::GetInstance()->CloseSession(networkId);
51 }
52
CloseAllSessions()53 void DSoftbusAdapter::CloseAllSessions()
54 {
55 DSoftbusAdapterImpl::GetInstance()->CloseAllSessions();
56 }
57
SendPacket(const std::string & networkId,NetPacket & packet)58 int32_t DSoftbusAdapter::SendPacket(const std::string &networkId, NetPacket &packet)
59 {
60 return DSoftbusAdapterImpl::GetInstance()->SendPacket(networkId, packet);
61 }
62
SendParcel(const std::string & networkId,Parcel & parcel)63 int32_t DSoftbusAdapter::SendParcel(const std::string &networkId, Parcel &parcel)
64 {
65 return DSoftbusAdapterImpl::GetInstance()->SendParcel(networkId, parcel);
66 }
67 } // namespace DeviceStatus
68 } // namespace Msdp
69 } // namespace OHOS
70