1 /*
2  * Copyright (c) 2022 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 "device_manager_impl.h"
17 
18 namespace OHOS {
19 namespace DistributedHardware {
20 
GetInstance()21 DeviceManagerImpl &DeviceManagerImpl::GetInstance()
22 {
23     static DeviceManagerImpl instance;
24     return instance;
25 }
26 
InitDeviceManager(const std::string & pkgName,std::shared_ptr<DmInitCallback> dmInitCallback)27 int32_t DeviceManagerImpl::InitDeviceManager(const std::string &pkgName, std::shared_ptr<DmInitCallback> dmInitCallback)
28 {
29     return 0;
30 }
31 
UnInitDeviceManager(const std::string & pkgName)32 int32_t DeviceManagerImpl::UnInitDeviceManager(const std::string &pkgName)
33 {
34     return 0;
35 }
36 
GetTrustedDeviceList(const std::string & pkgName,const std::string & extra,std::vector<DmDeviceInfo> & deviceList)37 int32_t DeviceManagerImpl::GetTrustedDeviceList(const std::string &pkgName, const std::string &extra,
38                                                 std::vector<DmDeviceInfo> &deviceList)
39 {
40     DmDeviceInfo localDevice;
41     memset_s(&localDevice, sizeof(localDevice), 0, sizeof(localDevice));
42     strcpy_s(localDevice.deviceId, sizeof(localDevice.deviceId) - 1, "<localDeviceId>");
43     strcpy_s(localDevice.deviceName, sizeof(localDevice.deviceName) - 1, "<localDeviceName>");
44 
45     DmDeviceInfo remoteDevice;
46     memset_s(&remoteDevice, sizeof(remoteDevice), 0, sizeof(remoteDevice));
47     strcpy_s(remoteDevice.deviceId, sizeof(remoteDevice.deviceId) - 1, "<remoteDeviceId>");
48     strcpy_s(remoteDevice.deviceName, sizeof(remoteDevice.deviceName) - 1, "<remoteDeviceId>");
49 
50     deviceList.clear();
51     deviceList.push_back(localDevice);
52     deviceList.push_back(remoteDevice);
53     return 0;
54 }
55 
GetLocalDeviceInfo(const std::string & pkgName,DmDeviceInfo & info)56 int32_t DeviceManagerImpl::GetLocalDeviceInfo(const std::string &pkgName, DmDeviceInfo &info)
57 {
58     memset_s(&info, sizeof(info), 0, sizeof(info));
59     strcpy_s(info.deviceId, sizeof(info.deviceId) - 1, "<localDeviceId>");
60     strcpy_s(info.deviceName, sizeof(info.deviceName) - 1, "<localDeviceName>");
61     info.deviceTypeId = 0;
62     return 0;
63 }
64 
RegisterDevStateCallback(const std::string & pkgName,const std::string & extra,std::shared_ptr<DeviceStateCallback> callback)65 int32_t DeviceManagerImpl::RegisterDevStateCallback(const std::string &pkgName, const std::string &extra,
66                                                     std::shared_ptr<DeviceStateCallback> callback)
67 {
68     return 0;
69 }
70 
UnRegisterDevStateCallback(const std::string & pkgName)71 int32_t DeviceManagerImpl::UnRegisterDevStateCallback(const std::string &pkgName)
72 {
73     return 0;
74 }
75 
StartDeviceDiscovery(const std::string & pkgName,const DmSubscribeInfo & subscribeInfo,const std::string & extra,std::shared_ptr<DiscoveryCallback> callback)76 int32_t DeviceManagerImpl::StartDeviceDiscovery(const std::string &pkgName, const DmSubscribeInfo &subscribeInfo,
77                                                 const std::string &extra, std::shared_ptr<DiscoveryCallback> callback)
78 {
79     return 0;
80 }
81 
StopDeviceDiscovery(const std::string & pkgName,uint16_t subscribeId)82 int32_t DeviceManagerImpl::StopDeviceDiscovery(const std::string &pkgName, uint16_t subscribeId)
83 {
84     return 0;
85 }
86 
PublishDeviceDiscovery(const std::string & pkgName,const DmPublishInfo & publishInfo,std::shared_ptr<PublishCallback> callback)87 int32_t DeviceManagerImpl::PublishDeviceDiscovery(const std::string &pkgName, const DmPublishInfo &publishInfo,
88     std::shared_ptr<PublishCallback> callback)
89 {
90     return 0;
91 }
92 
UnPublishDeviceDiscovery(const std::string & pkgName,int32_t publishId)93 int32_t DeviceManagerImpl::UnPublishDeviceDiscovery(const std::string &pkgName, int32_t publishId)
94 {
95     return 0;
96 }
97 
AuthenticateDevice(const std::string & pkgName,int32_t authType,const DmDeviceInfo & deviceInfo,const std::string & extra,std::shared_ptr<AuthenticateCallback> callback)98 int32_t DeviceManagerImpl::AuthenticateDevice(const std::string &pkgName, int32_t authType,
99                                               const DmDeviceInfo &deviceInfo, const std::string &extra,
100                                               std::shared_ptr<AuthenticateCallback> callback)
101 {
102     return 0;
103 }
104 
UnAuthenticateDevice(const std::string & pkgName,const DmDeviceInfo & deviceInfo)105 int32_t DeviceManagerImpl::UnAuthenticateDevice(const std::string &pkgName, const DmDeviceInfo &deviceInfo)
106 {
107     return 0;
108 }
109 
RegisterDeviceManagerFaCallback(const std::string & pkgName,std::shared_ptr<DeviceManagerUiCallback> callback)110 int32_t DeviceManagerImpl::RegisterDeviceManagerFaCallback(const std::string &pkgName,
111                                                            std::shared_ptr<DeviceManagerUiCallback> callback)
112 {
113     return 0;
114 }
115 
UnRegisterDeviceManagerFaCallback(const std::string & pkgName)116 int32_t DeviceManagerImpl::UnRegisterDeviceManagerFaCallback(const std::string &pkgName)
117 {
118     return 0;
119 }
120 
VerifyAuthentication(const std::string & pkgName,const std::string & authPara,std::shared_ptr<VerifyAuthCallback> callback)121 int32_t DeviceManagerImpl::VerifyAuthentication(const std::string &pkgName, const std::string &authPara,
122                                                 std::shared_ptr<VerifyAuthCallback> callback)
123 {
124     return 0;
125 }
126 
GetFaParam(const std::string & pkgName,DmAuthParam & dmFaParam)127 int32_t DeviceManagerImpl::GetFaParam(const std::string &pkgName, DmAuthParam &dmFaParam)
128 {
129     return 0;
130 }
131 
SetUserOperation(const std::string & pkgName,int32_t action,const std::string & params)132 int32_t DeviceManagerImpl::SetUserOperation(const std::string &pkgName, int32_t action, const std::string &params)
133 {
134     return 0;
135 }
136 
GetUdidByNetworkId(const std::string & pkgName,const std::string & netWorkId,std::string & udid)137 int32_t DeviceManagerImpl::GetUdidByNetworkId(const std::string &pkgName, const std::string &netWorkId,
138                                               std::string &udid)
139 {
140     return 0;
141 }
142 
GetUuidByNetworkId(const std::string & pkgName,const std::string & netWorkId,std::string & uuid)143 int32_t DeviceManagerImpl::GetUuidByNetworkId(const std::string &pkgName, const std::string &netWorkId,
144                                               std::string &uuid)
145 {
146     return 0;
147 }
148 
RegisterDevStateCallback(const std::string & pkgName,const std::string & extra)149 int32_t DeviceManagerImpl::RegisterDevStateCallback(const std::string &pkgName, const std::string &extra)
150 {
151     return 0;
152 }
153 
UnRegisterDevStateCallback(const std::string & pkgName,const std::string & extra)154 int32_t DeviceManagerImpl::UnRegisterDevStateCallback(const std::string &pkgName, const std::string &extra)
155 {
156     return 0;
157 }
158 
RequestCredential(const std::string & pkgName,const std::string & reqJsonStr,std::string & returnJsonStr)159 int32_t DeviceManagerImpl::RequestCredential(const std::string &pkgName, const std::string &reqJsonStr,
160     std::string &returnJsonStr)
161 {
162     return 0;
163 }
164 
ImportCredential(const std::string & pkgName,const std::string & credentialInfo)165 int32_t DeviceManagerImpl::ImportCredential(const std::string &pkgName, const std::string &credentialInfo)
166 {
167     return 0;
168 }
169 
DeleteCredential(const std::string & pkgName,const std::string & deleteInfo)170 int32_t DeviceManagerImpl::DeleteCredential(const std::string &pkgName, const std::string &deleteInfo)
171 {
172     return 0;
173 }
174 
RegisterCredentialCallback(const std::string & pkgName,std::shared_ptr<CredentialCallback> callback)175 int32_t DeviceManagerImpl::RegisterCredentialCallback(const std::string &pkgName,
176     std::shared_ptr<CredentialCallback> callback)
177 {
178     return 0;
179 }
180 
UnRegisterCredentialCallback(const std::string & pkgName)181 int32_t DeviceManagerImpl::UnRegisterCredentialCallback(const std::string &pkgName)
182 {
183     return 0;
184 }
185 
NotifyEvent(const std::string & pkgName,const int32_t eventId,const std::string & event)186 int32_t DeviceManagerImpl::NotifyEvent(const std::string &pkgName, const int32_t eventId, const std::string &event)
187 {
188     return 0;
189 }
190 
OnDmServiceDied()191 int32_t DeviceManagerImpl::OnDmServiceDied()
192 {
193     return 0;
194 }
195 } // namespace DistributedHardware
196 } // namespace OHOS
197