!2375 fix:modify wifi lnn ble discovery report online

Merge pull request !2375 from michael4096/master
This commit is contained in:
openharmony_ci 2022-09-23 02:22:42 +00:00 committed by Gitee
commit fc00b40397
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 6 additions and 6 deletions

View File

@ -70,7 +70,7 @@ int32_t LnnGetLnnRelation(const char *id, IdCategory type, uint8_t *relation, ui
int32_t LnnSetDLConnCapability(const char *networkId, uint64_t connCapability); int32_t LnnSetDLConnCapability(const char *networkId, uint64_t connCapability);
int32_t LnnSetDLNodeAddr(const char *id, IdCategory type, const char *addr); int32_t LnnSetDLNodeAddr(const char *id, IdCategory type, const char *addr);
int32_t LnnGetAllAuthSeq(const char *udid, int64_t *authSeq, uint32_t num); int32_t LnnGetAllAuthSeq(const char *udid, int64_t *authSeq, uint32_t num);
const NodeInfo *LnnGetOnlineNodeByUdidHash(const char *recvUdidHash, DiscoveryType discType); const NodeInfo *LnnGetOnlineNodeByUdidHash(const char *recvUdidHash);
void LnnRefreshDeviceOnlineStateAndDevIdInfo(const char *pkgName, DeviceInfo *device, void LnnRefreshDeviceOnlineStateAndDevIdInfo(const char *pkgName, DeviceInfo *device,
const InnerDeviceInfoAddtions *addtions); const InnerDeviceInfoAddtions *addtions);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -1432,7 +1432,7 @@ int32_t LnnInitDistributedLedger(void)
return SOFTBUS_OK; return SOFTBUS_OK;
} }
const NodeInfo *LnnGetOnlineNodeByUdidHash(const char *recvUdidHash, DiscoveryType discType) const NodeInfo *LnnGetOnlineNodeByUdidHash(const char *recvUdidHash)
{ {
int32_t i; int32_t i;
int32_t infoNum = 0; int32_t infoNum = 0;
@ -1452,8 +1452,8 @@ const NodeInfo *LnnGetOnlineNodeByUdidHash(const char *recvUdidHash, DiscoveryTy
} }
for (i = 0; i < infoNum; ++i) { for (i = 0; i < infoNum; ++i) {
const NodeInfo *nodeInfo = LnnGetNodeInfoById(info[i].networkId, CATEGORY_NETWORK_ID); const NodeInfo *nodeInfo = LnnGetNodeInfoById(info[i].networkId, CATEGORY_NETWORK_ID);
if (nodeInfo == NULL || !LnnHasDiscoveryType(nodeInfo, discType)) { if (nodeInfo == NULL) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_INFO, "node online not have discType:%d", discType); SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_INFO, "nodeInfo is null.");
continue; continue;
} }
if (GenerateStrHashAndConvertToHexString((const unsigned char *)nodeInfo->deviceInfo.deviceUdid, if (GenerateStrHashAndConvertToHexString((const unsigned char *)nodeInfo->deviceInfo.deviceUdid,
@ -1476,7 +1476,7 @@ static void RefreshDeviceInfoByDevId(DeviceInfo *device, const InnerDeviceInfoAd
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "RefreshDeviceInfoDevId parameter error"); SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "RefreshDeviceInfoDevId parameter error");
return; return;
} }
const NodeInfo *nodeInfo = LnnGetOnlineNodeByUdidHash(device->devId, DISCOVERY_TYPE_BLE); const NodeInfo *nodeInfo = LnnGetOnlineNodeByUdidHash(device->devId);
if (nodeInfo == NULL) { if (nodeInfo == NULL) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "device udidhash:%s is not online", device->devId); SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "device udidhash:%s is not online", device->devId);
return; return;
@ -1492,7 +1492,7 @@ static void RefreshDeviceOnlineStateInfo(DeviceInfo *device, const InnerDeviceIn
device->isOnline = LnnGetOnlineStateById(device->devId, CATEGORY_UDID); device->isOnline = LnnGetOnlineStateById(device->devId, CATEGORY_UDID);
} }
if (addtions->medium == BLE) { if (addtions->medium == BLE) {
device->isOnline = ((LnnGetOnlineNodeByUdidHash(device->devId, DISCOVERY_TYPE_BLE)) != NULL) ? true : false; device->isOnline = ((LnnGetOnlineNodeByUdidHash(device->devId)) != NULL) ? true : false;
} }
} }