diff --git a/services/implementation/include/dependency/softbus/softbus_connector.h b/services/implementation/include/dependency/softbus/softbus_connector.h index 8e294678d0e400ed2a403c83da02f54b56dbd394..900855af774eb05e9fd21df4534ee7486a93a965 100644 --- a/services/implementation/include/dependency/softbus/softbus_connector.h +++ b/services/implementation/include/dependency/softbus/softbus_connector.h @@ -114,6 +114,13 @@ public: * @tc.type: FUNC */ static void JoinLnn(const std::string &deviceId); + + /** + * @tc.name: SoftbusConnector::LeaveLnn + * @tc.desc: delete the current device from the LNN where a specified device resides + * @tc.type: FUNC + */ + static int32_t LeaveLnn(const std::string &networkId); public: SoftbusConnector(); ~SoftbusConnector(); @@ -155,6 +162,7 @@ private: static void ConvertDeviceInfoToDmDevice(const DeviceInfo &deviceInfo, DmDeviceBasicInfo &dmDeviceBasicInfo); static ConnectionAddr *GetConnectAddrByType(DeviceInfo *deviceInfo, ConnectionAddrType type); static void ConvertNodeBasicInfoToDmDevice(const NodeBasicInfo &nodeBasicInfo, DmDeviceInfo &dmDeviceInfo); + static void OnLeaveLNNResult(const char *networkId, int32_t retCode); private: enum PulishStatus { diff --git a/services/implementation/src/authentication/dm_auth_manager.cpp b/services/implementation/src/authentication/dm_auth_manager.cpp index 37290304dd74016379ab42ff6c61974ed9df39bd..16453927d8a51b399d6ade486c9f0e325ed34703 100644 --- a/services/implementation/src/authentication/dm_auth_manager.cpp +++ b/services/implementation/src/authentication/dm_auth_manager.cpp @@ -296,6 +296,11 @@ int32_t DmAuthManager::UnBindDevice(const std::string &pkgName, const std::strin LOGE("Invalid parameter, pkgName is empty."); return ERR_DM_FAILED; } + +#ifdef MINE_HARMONY_HICHAIN + return softbusConnector_->LeaveLnn(udidHash); +#endif + if (authRequestState_!= nullptr || authResponseContext_ != nullptr) { if (isAuthenticateDevice_ && authRequestState_->GetStateType() == AuthState::AUTH_REQUEST_NEGOTIATE_DONE) { LOGI("Stop previous AuthenticateDevice."); diff --git a/services/implementation/src/dependency/softbus/softbus_connector.cpp b/services/implementation/src/dependency/softbus/softbus_connector.cpp index befc8cf1348a29c3b9eb9fd74d979c6e91503aad..8ddf946a3dcfb2fec99f9c17466dca6a1c802855 100644 --- a/services/implementation/src/dependency/softbus/softbus_connector.cpp +++ b/services/implementation/src/dependency/softbus/softbus_connector.cpp @@ -261,6 +261,15 @@ void SoftbusConnector::JoinLnn(const std::string &deviceId) return; } +int32_t SoftbusConnector::LeaveLnn(const std::string &networkId) +{ + int32_t ret = ::LeaveLNN(DM_PKG_NAME, networkId.c_str(), OnLeaveLNNResult); + if (ret != DM_OK) { + LOGE("[SOFTBUS]JoinLNN failed, ret: %d.", ret); + } + return ret; +} + int32_t SoftbusConnector::GetUdidByNetworkId(const char *networkId, std::string &udid) { LOGI("start, networkId: %s.", GetAnonyString(std::string(networkId)).c_str()); @@ -416,6 +425,12 @@ void SoftbusConnector::OnSoftbusJoinLNNResult(ConnectionAddr *addr, const char * LOGD("[SOFTBUS]OnSoftbusJoinLNNResult, result: %d.", result); } +void SoftbusConnector::OnLeaveLNNResult(const char *networkId, int32_t retCode) +{ + (void)networkId; + LOGI("[SOFTBUS]OnLeaveLNNResult, retCode: %d.", retCode); +} + void SoftbusConnector::OnSoftbusDeviceFound(const DeviceInfo *device) { if (device == nullptr) {