From e9f1b0e0ea059260bdf431934a59ee7f53c53020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B2=E6=99=93=E6=99=93?= Date: Mon, 27 May 2024 19:33:33 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A7=A3=E7=BB=91?= =?UTF-8?q?=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 史晓晓 --- .../dependency/softbus/softbus_connector.h | 8 ++++++++ .../src/authentication/dm_auth_manager.cpp | 5 +++++ .../src/dependency/softbus/softbus_connector.cpp | 15 +++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/services/implementation/include/dependency/softbus/softbus_connector.h b/services/implementation/include/dependency/softbus/softbus_connector.h index 8e294678..f5e1804b 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); + 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 37290304..e214ff9e 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 befc8cf1..44631ce8 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, 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) { -- Gitee From 87ab52763a5d14b1b0de572871f8c78183195bf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B2=E6=99=93=E6=99=93?= Date: Mon, 27 May 2024 20:31:12 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 史晓晓 --- .../include/dependency/softbus/softbus_connector.h | 2 +- services/implementation/src/authentication/dm_auth_manager.cpp | 2 +- .../implementation/src/dependency/softbus/softbus_connector.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/services/implementation/include/dependency/softbus/softbus_connector.h b/services/implementation/include/dependency/softbus/softbus_connector.h index f5e1804b..900855af 100644 --- a/services/implementation/include/dependency/softbus/softbus_connector.h +++ b/services/implementation/include/dependency/softbus/softbus_connector.h @@ -162,7 +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); - void OnLeaveLNNResult(const char *networkId, int32_t retCode); + 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 e214ff9e..16453927 100644 --- a/services/implementation/src/authentication/dm_auth_manager.cpp +++ b/services/implementation/src/authentication/dm_auth_manager.cpp @@ -298,7 +298,7 @@ int32_t DmAuthManager::UnBindDevice(const std::string &pkgName, const std::strin } #ifdef MINE_HARMONY_HICHAIN - return SoftbusConnector->LeaveLnn(udidHash); + return softbusConnector_->LeaveLnn(udidHash); #endif if (authRequestState_!= nullptr || authResponseContext_ != nullptr) { diff --git a/services/implementation/src/dependency/softbus/softbus_connector.cpp b/services/implementation/src/dependency/softbus/softbus_connector.cpp index 44631ce8..f4e70d65 100644 --- a/services/implementation/src/dependency/softbus/softbus_connector.cpp +++ b/services/implementation/src/dependency/softbus/softbus_connector.cpp @@ -263,7 +263,7 @@ void SoftbusConnector::JoinLnn(const std::string &deviceId) int32_t SoftbusConnector::LeaveLnn(const std::string &networkId) { - int32_t ret = ::LeaveLnn(DM_PKG_NAME, networkId, OnLeaveLNNResult); + int32_t ret = :LeaveLNN(DM_PKG_NAME, networkId, OnLeaveLNNResult); if (ret != DM_OK) { LOGE("[SOFTBUS]JoinLNN failed, ret: %d.", ret); } -- Gitee From 22b73a26f09d7f028c9a3451059a799a761bc642 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B2=E6=99=93=E6=99=93?= Date: Mon, 27 May 2024 20:32:31 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 史晓晓 --- .../implementation/src/dependency/softbus/softbus_connector.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/implementation/src/dependency/softbus/softbus_connector.cpp b/services/implementation/src/dependency/softbus/softbus_connector.cpp index f4e70d65..f8908bc5 100644 --- a/services/implementation/src/dependency/softbus/softbus_connector.cpp +++ b/services/implementation/src/dependency/softbus/softbus_connector.cpp @@ -263,7 +263,7 @@ void SoftbusConnector::JoinLnn(const std::string &deviceId) int32_t SoftbusConnector::LeaveLnn(const std::string &networkId) { - int32_t ret = :LeaveLNN(DM_PKG_NAME, networkId, OnLeaveLNNResult); + int32_t ret = :LeaveLNN(DM_PKG_NAME, networkId.c_str(), OnLeaveLNNResult); if (ret != DM_OK) { LOGE("[SOFTBUS]JoinLNN failed, ret: %d.", ret); } -- Gitee From 2d3ee80c04a743a7b2af6fc3829b6772fbf96aa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B2=E6=99=93=E6=99=93?= Date: Mon, 27 May 2024 20:52:36 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 史晓晓 --- .../implementation/src/dependency/softbus/softbus_connector.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/implementation/src/dependency/softbus/softbus_connector.cpp b/services/implementation/src/dependency/softbus/softbus_connector.cpp index f8908bc5..8ddf946a 100644 --- a/services/implementation/src/dependency/softbus/softbus_connector.cpp +++ b/services/implementation/src/dependency/softbus/softbus_connector.cpp @@ -263,7 +263,7 @@ void SoftbusConnector::JoinLnn(const std::string &deviceId) int32_t SoftbusConnector::LeaveLnn(const std::string &networkId) { - int32_t ret = :LeaveLNN(DM_PKG_NAME, networkId.c_str(), OnLeaveLNNResult); + int32_t ret = ::LeaveLNN(DM_PKG_NAME, networkId.c_str(), OnLeaveLNNResult); if (ret != DM_OK) { LOGE("[SOFTBUS]JoinLNN failed, ret: %d.", ret); } -- Gitee