• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "dm_softbus_cache_mock.h"
17 
18 #include "gtest/gtest.h"
19 
20 namespace OHOS {
21 namespace DistributedHardware {
22 DM_IMPLEMENT_SINGLE_INSTANCE(SoftbusCache);
GetUdidByUdidHash(const std::string & udidHash,std::string & udid)23 int32_t SoftbusCache::GetUdidByUdidHash(const std::string &udidHash, std::string &udid)
24 {
25     return DmSoftbusCache::dmSoftbusCache->GetUdidByUdidHash(udidHash, udid);
26 }
27 
GetUdidFromCache(const char * networkId,std::string & udid)28 int32_t SoftbusCache::GetUdidFromCache(const char *networkId, std::string &udid)
29 {
30     return DmSoftbusCache::dmSoftbusCache->GetUdidFromCache(networkId, udid);
31 }
32 
GetNetworkIdFromCache(const std::string & udid,std::string & networkId)33 int32_t SoftbusCache::GetNetworkIdFromCache(const std::string &udid, std::string &networkId)
34 {
35     return DmSoftbusCache::dmSoftbusCache->GetNetworkIdFromCache(udid, networkId);
36 }
37 
GetLocalDeviceInfo(DmDeviceInfo & nodeInfo)38 int32_t SoftbusCache::GetLocalDeviceInfo(DmDeviceInfo &nodeInfo)
39 {
40     return DmSoftbusCache::dmSoftbusCache->GetLocalDeviceInfo(nodeInfo);
41 }
42 
GetUuidFromCache(const char * networkId,std::string & uuid)43 int32_t SoftbusCache::GetUuidFromCache(const char *networkId, std::string &uuid)
44 {
45     return DmSoftbusCache::dmSoftbusCache->GetUuidFromCache(networkId, uuid);
46 }
47 
CheckIsOnline(const std::string & deviceId)48 bool SoftbusCache::CheckIsOnline(const std::string &deviceId)
49 {
50     return DmSoftbusCache::dmSoftbusCache->CheckIsOnline(deviceId);
51 }
52 
GetDeviceInfoFromCache(std::vector<DmDeviceInfo> & deviceInfoList)53 int32_t SoftbusCache::GetDeviceInfoFromCache(std::vector<DmDeviceInfo> &deviceInfoList)
54 {
55     return DmSoftbusCache::dmSoftbusCache->GetDeviceInfoFromCache(deviceInfoList);
56 }
57 
GetDeviceNameFromCache(const std::string & udid,std::string & deviceName)58 int32_t SoftbusCache::GetDeviceNameFromCache(const std::string &udid, std::string &deviceName)
59 {
60     return DmSoftbusCache::dmSoftbusCache->GetDeviceNameFromCache(udid, deviceName);
61 }
62 } // namespace DistributedHardware
63 } // namespace OHOS