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 #include "ddp_adapter.h"
17
18 #include "ddp_adapter_impl.h"
19 #include "devicestatus_define.h"
20
21 namespace OHOS {
22 namespace Msdp {
23 namespace DeviceStatus {
24 namespace {
25 constexpr HiviewDFX::HiLogLabel LABEL { LOG_CORE, MSDP_DOMAIN_ID, "DDPAdapter" };
26 } // namespace
27
DDPAdapter()28 DDPAdapter::DDPAdapter()
29 {
30 ddp_ = std::make_shared<DDPAdapterImpl>();
31 }
32
AddObserver(std::shared_ptr<IDeviceProfileObserver> observer)33 void DDPAdapter::AddObserver(std::shared_ptr<IDeviceProfileObserver> observer)
34 {
35 CALL_DEBUG_ENTER;
36 ddp_->AddObserver(observer);
37 }
38
RemoveObserver(std::shared_ptr<IDeviceProfileObserver> observer)39 void DDPAdapter::RemoveObserver(std::shared_ptr<IDeviceProfileObserver> observer)
40 {
41 CALL_DEBUG_ENTER;
42 ddp_->RemoveObserver(observer);
43 }
44
AddWatch(const std::string & networkId)45 void DDPAdapter::AddWatch(const std::string &networkId)
46 {
47 CALL_DEBUG_ENTER;
48 ddp_->AddWatch(networkId);
49 }
50
RemoveWatch(const std::string & networkId)51 void DDPAdapter::RemoveWatch(const std::string &networkId)
52 {
53 CALL_DEBUG_ENTER;
54 ddp_->RemoveWatch(networkId);
55 }
56
GetProperty(const std::string & networkId,const std::string & name,bool & value)57 int32_t DDPAdapter::GetProperty(const std::string &networkId, const std::string &name, bool &value)
58 {
59 CALL_DEBUG_ENTER;
60 return ddp_->GetProperty(networkId, name, value);
61 }
62
GetProperty(const std::string & networkId,const std::string & name,int32_t & value)63 int32_t DDPAdapter::GetProperty(const std::string &networkId, const std::string &name, int32_t &value)
64 {
65 CALL_DEBUG_ENTER;
66 return ddp_->GetProperty(networkId, name, value);
67 }
68
GetProperty(const std::string & networkId,const std::string & name,std::string & value)69 int32_t DDPAdapter::GetProperty(const std::string &networkId, const std::string &name, std::string &value)
70 {
71 CALL_DEBUG_ENTER;
72 return ddp_->GetProperty(networkId, name, value);
73 }
74
SetProperty(const std::string & name,bool value)75 int32_t DDPAdapter::SetProperty(const std::string &name, bool value)
76 {
77 CALL_DEBUG_ENTER;
78 return ddp_->SetProperty(name, value);
79 }
80
SetProperty(const std::string & name,int32_t value)81 int32_t DDPAdapter::SetProperty(const std::string &name, int32_t value)
82 {
83 CALL_DEBUG_ENTER;
84 return ddp_->SetProperty(name, value);
85 }
86
SetProperty(const std::string & name,const std::string & value)87 int32_t DDPAdapter::SetProperty(const std::string &name, const std::string &value)
88 {
89 CALL_DEBUG_ENTER;
90 return ddp_->SetProperty(name, value);
91 }
92 } // namespace DeviceStatus
93 } // namespace Msdp
94 } // namespace OHOS
95