• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 "distributed_device_profile_client_mock.h"
17 
18 namespace OHOS {
19 namespace DistributedDeviceProfile {
20 
DeviceProfileClientMock()21 DeviceProfileClientMock::DeviceProfileClientMock()
22 {
23     DeviceProfileClientMock::mock_ = this;
24 }
25 
~DeviceProfileClientMock()26 DeviceProfileClientMock::~DeviceProfileClientMock()
27 {
28     DeviceProfileClientMock::mock_ = nullptr;
29 }
30 
GetMock()31 DeviceProfileClientMock *DeviceProfileClientMock::GetMock()
32 {
33     return DeviceProfileClientMock::mock_;
34 }
35 
OnLoadSystemAbilitySuccess(int32_t systemAbilityId,const sptr<IRemoteObject> & remoteObject)36 void DeviceProfileLoadCb::OnLoadSystemAbilitySuccess(int32_t systemAbilityId, const sptr<IRemoteObject> &remoteObject)
37 {
38     (void)systemAbilityId;
39     DeviceProfileClient::GetInstance().LoadSystemAbilitySuccess(remoteObject);
40 }
41 
OnLoadSystemAbilityFail(int32_t systemAbilityId)42 void DeviceProfileLoadCb::OnLoadSystemAbilityFail(int32_t systemAbilityId)
43 {
44     (void)systemAbilityId;
45     DeviceProfileClient::GetInstance().LoadSystemAbilityFail();
46 }
47 
GetInstance()48 DeviceProfileClient &DeviceProfileClient::GetInstance()
49 {
50     static DeviceProfileClient instance;
51     return instance;
52 }
53 
GetDeviceProfileService()54 sptr<IDistributedDeviceProfile> DeviceProfileClient::GetDeviceProfileService()
55 {
56     return nullptr;
57 }
58 
LoadDeviceProfileService()59 sptr<IDistributedDeviceProfile> DeviceProfileClient::LoadDeviceProfileService()
60 {
61     return nullptr;
62 }
63 
ClearDeviceProfileService()64 void DeviceProfileClient::ClearDeviceProfileService()
65 {
66 }
67 
SendSubscribeInfos()68 void DeviceProfileClient::SendSubscribeInfos()
69 {
70     DeviceProfileClientMock::GetMock()->SendSubscribeInfos();
71 }
72 
PutCharacteristicProfile(const CharacteristicProfile & characteristicProfile)73 int32_t DeviceProfileClient::PutCharacteristicProfile(const CharacteristicProfile &characteristicProfile)
74 {
75     return DeviceProfileClientMock::GetMock()->PutCharacteristicProfile(characteristicProfile);
76 }
77 
GetCharacteristicProfile(const std::string & deviceId,const std::string & serviceName,const std::string & characteristicId,CharacteristicProfile & characteristicProfile)78 int32_t DeviceProfileClient::GetCharacteristicProfile(const std::string &deviceId, const std::string &serviceName,
79     const std::string &characteristicId, CharacteristicProfile &characteristicProfile)
80 {
81     return DeviceProfileClientMock::GetMock()->GetCharacteristicProfile(deviceId, serviceName, characteristicId,
82         characteristicProfile);
83 }
84 
SubscribeDeviceProfile(const SubscribeInfo & subscribeInfo)85 int32_t DeviceProfileClient::SubscribeDeviceProfile(const SubscribeInfo &subscribeInfo)
86 {
87     return DeviceProfileClientMock::GetMock()->SubscribeDeviceProfile(subscribeInfo);
88 }
89 
UnSubscribeDeviceProfile(const SubscribeInfo & subscribeInfo)90 int32_t DeviceProfileClient::UnSubscribeDeviceProfile(const SubscribeInfo &subscribeInfo)
91 {
92     return DeviceProfileClientMock::GetMock()->UnSubscribeDeviceProfile(subscribeInfo);
93 }
94 } // namespace DistributedDeviceProfile
95 } // namespace OHOS
96