From 737f0fa7ad45083ed4244f6d66a61e941d334009 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E6=B5=9A=E4=BA=88?= Date: Tue, 22 Jul 2025 04:16:38 +0000 Subject: [PATCH 1/4] add bssid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 孙浚予 --- .../wifi_framework/wifi_manage/wifi_sta/sta_monitor.cpp | 9 ++++++--- .../wifi_framework/wifi_manage/wifi_sta/sta_monitor.h | 4 +++- .../wifi_manage/wifi_sta/Mock/mock_sta_monitor.h | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_monitor.cpp b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_monitor.cpp index 60b3c07be..55e9d1941 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_monitor.cpp +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_monitor.cpp @@ -49,7 +49,7 @@ ErrCode StaMonitor::InitStaMonitor() }, [this](const std::string &reason, const std::string &bssid) { this->OnBssidChangedCallBack(reason, bssid); }, [this](int status, const std::string &ssid) { this->OnWpaStateChangedCallBack(status, ssid); }, - [this]() { this->OnWpaSsidWrongKeyCallBack(); }, + [this](const std::string &bssid) { this->OnWpaSsidWrongKeyCallBack(bssid); }, [this](int status) { this->OnWpsPbcOverlapCallBack(status); }, [this](int status) { this->OnWpsTimeOutCallBack(status); }, [this]() { this->OnWpaAuthTimeOutCallBack(); }, @@ -222,7 +222,7 @@ void StaMonitor::OnWpaStateChangedCallBack(int status, const std::string &ssid) pStaStateMachine->SendMessage(msg); } -void StaMonitor::OnWpaSsidWrongKeyCallBack() +void StaMonitor::OnWpaSsidWrongKeyCallBack(const std::string &bssid) { WIFI_LOGI("OnWpaSsidWrongKeyCallBack"); if (pStaStateMachine == nullptr) { @@ -231,7 +231,10 @@ void StaMonitor::OnWpaSsidWrongKeyCallBack() } /* Notification state machine wpa password wrong event. */ - pStaStateMachine->SendMessage(WIFI_SVR_CMD_STA_WPA_PASSWD_WRONG_EVENT); + InternalMessagePtr msg = pStaStateMachine->CreateMessage(); + msg->SetMessageName(WIFI_SVR_CMD_STA_WPA_PASSWD_WRONG_EVENT); + msg->AddStringMessageBody(bssid); + pStaStateMachine->SendMessage(msg); } void StaMonitor::OnWpaConnectionFullCallBack(int status) diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_monitor.h b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_monitor.h index 44c300c3f..e705ca626 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_monitor.h +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_monitor.h @@ -88,8 +88,10 @@ public: /** * @Description : Callback of the Wpa ssid wrong key event. + * + * @param bssid: bssid of the network [in] */ - void OnWpaSsidWrongKeyCallBack(); + void OnWpaSsidWrongKeyCallBack(const std::string &bssid); /** * @Description : Callback of the Connection Full event. diff --git a/wifi/test/wifi_standard/wifi_framework/wifi_manage/wifi_sta/Mock/mock_sta_monitor.h b/wifi/test/wifi_standard/wifi_framework/wifi_manage/wifi_sta/Mock/mock_sta_monitor.h index 71c8e837c..d90a175c6 100644 --- a/wifi/test/wifi_standard/wifi_framework/wifi_manage/wifi_sta/Mock/mock_sta_monitor.h +++ b/wifi/test/wifi_standard/wifi_framework/wifi_manage/wifi_sta/Mock/mock_sta_monitor.h @@ -31,7 +31,7 @@ public: virtual void OnConnectChangedCallBack(int status, int networkId, const std::string &bssid, int locallyGenerated) = 0; virtual void OnWpaStateChangedCallBack(int status, void *pInstance) = 0; - virtual void OnWpaSsidWrongKeyCallBack(void *pInstance) = 0; + virtual void OnWpaSsidWrongKeyCallBack(const std::string &bssid, void *pInstance) = 0; virtual void OnWpsPbcOverlapCallBack(int status, void *pInstance) = 0; virtual void OnWpsTimeOutCallBack(int status, void *pInstance) = 0; }; @@ -45,7 +45,7 @@ public: MOCK_METHOD4(OnConnectChangedCallBack, void(int status, int networkId, const std::string &bssid, int locallyGenerated)); MOCK_METHOD2(OnWpaStateChangedCallBack, void(int status, void *pInstance)); - MOCK_METHOD2(OnWpaSsidWrongKeyCallBack, void(void *pInstance)); + MOCK_METHOD2(OnWpaSsidWrongKeyCallBack, void(const std::string &bssid, void *pInstance)); MOCK_METHOD2(OnWpsPbcOverlapCallBack, void(int status, void *pInstance)); MOCK_METHOD2(OnWpsTimeOutCallBack, void(int status, void *pInstance)); }; -- Gitee From 3e031545850c6f838dd7c1e80592464ef9d8f4d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E6=B5=9A=E4=BA=88?= Date: Tue, 22 Jul 2025 04:16:50 +0000 Subject: [PATCH 2/4] add bssid2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 孙浚予 --- .../hdi_client/wifi_hdi_wpa_callback.cpp | 44 ++++++++++--------- .../wifi_native/common/wifi_event_callback.h | 2 +- .../wifi_manage/wifi_sta/sta_monitor_test.cpp | 4 +- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/wifi_hdi_wpa_callback.cpp b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/wifi_hdi_wpa_callback.cpp index 27c9d3cff..d377f3643 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/wifi_hdi_wpa_callback.cpp +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/wifi_hdi_wpa_callback.cpp @@ -58,7 +58,7 @@ int32_t OnEventDisconnected(struct IWpaCallback *self, return 1; } uint32_t bssidLen = disconectParam->bssidLen; - char szBssid[WIFI_HDI_STR_MAC_LENGTH +1] = {0}; + char szBssid[WIFI_HDI_STR_MAC_LENGTH + 1] = {0}; if (ConvertMacArr2String(disconectParam->bssid, bssidLen, szBssid, sizeof(szBssid)) != 0) { LOGE("%{public}s: failed to convert mac!", __func__); return 1; @@ -84,7 +84,8 @@ int32_t OnEventDisconnected(struct IWpaCallback *self, g_currentWpaStatus == static_cast(OHOS::Wifi::SupplicantState::FOUR_WAY_HANDSHAKE) && (reasonCode != Wifi80211ReasonCode::WLAN_REASON_IE_IN_4WAY_DIFFERS || !locallyGenerated)) { LOGI("OnEventDisconnected, wrong password"); - cbk.onWpaSsidWrongKey(); + std::string bssid = std::string(szBssid); + cbk.onWpaSsidWrongKey(bssid); OHOS::Wifi::WriteAuthFailHiSysEvent("WRONG_PSWD", reasonCode); } if (cbk.onConnectChanged) { @@ -110,7 +111,7 @@ int32_t OnEventConnected(struct IWpaCallback *self, return 1; } uint32_t bssidLen = connectParam->bssidLen; - char szBssid[WIFI_HDI_STR_MAC_LENGTH +1] = {0}; + char szBssid[WIFI_HDI_STR_MAC_LENGTH + 1] = {0}; if (ConvertMacArr2String(connectParam->bssid, bssidLen, szBssid, sizeof(szBssid)) != 0) { LOGE("%{public}s: failed to convert mac!", __func__); return 1; @@ -142,7 +143,7 @@ int32_t OnEventBssidChanged(struct IWpaCallback *self, } else { LOGE("OnEventBssidChanged: invalid reasonLen:%{public}u", bssidChangedParam->reasonLen); } - char szBssid[WIFI_HDI_STR_MAC_LENGTH +1] = {0}; + char szBssid[WIFI_HDI_STR_MAC_LENGTH + 1] = {0}; if (ConvertMacArr2String(bssidChangedParam->bssid, bssidChangedParam->bssidLen, szBssid, sizeof(szBssid)) != 0) { LOGE("OnEventBssidChanged: failed to convert mac!"); return 1; @@ -212,7 +213,7 @@ int32_t OnEventTempDisabled(struct IWpaCallback *self, ifName); const OHOS::Wifi::WifiEventCallback &cbk = OHOS::Wifi::WifiStaHalInterface::GetInstance().GetCallbackInst(ifName); if (cbk.onWpaSsidWrongKey && reason == "AUTH_FAILED") { - cbk.onWpaSsidWrongKey(); + cbk.onWpaSsidWrongKey(""); } return 0; } @@ -260,7 +261,8 @@ int32_t OnEventAssociateReject(struct IWpaCallback *self, const OHOS::Wifi::WifiEventCallback &cbk = OHOS::Wifi::WifiStaHalInterface::GetInstance().GetCallbackInst(ifName); if (isWrongPwd && cbk.onWpaSsidWrongKey) { LOGI("onWpaConnectionRejectCallBack, wrong password"); - cbk.onWpaSsidWrongKey(); + std::string bssidString = std::string(bssid); + cbk.onWpaSsidWrongKey(bssidString); OHOS::Wifi::WriteAuthFailHiSysEvent(failReason, statusCode); return 0; } @@ -351,7 +353,7 @@ int32_t OnEventAuthTimeout(struct IWpaCallback *self, const char *ifName) if (g_currentWpaStatus == static_cast(OHOS::Wifi::SupplicantState::FOUR_WAY_HANDSHAKE) && cbk.onWpaSsidWrongKey) { LOGI("OnEventAuthTimeout, wrong password"); - cbk.onWpaSsidWrongKey(); + cbk.onWpaSsidWrongKey(""); OHOS::Wifi::WriteAuthFailHiSysEvent("WRONG_PSWD"); return 0; } @@ -477,12 +479,12 @@ int32_t OnEventDeviceFound(struct IWpaCallback *self, if (cbk.onDeviceFound) { OHOS::Wifi::HalP2pDeviceFound cbInfo; uint32_t srcAddressLen = deviceInfoParam->srcAddressLen; - char srcAddress[WIFI_HDI_STR_MAC_LENGTH +1] = {0}; + char srcAddress[WIFI_HDI_STR_MAC_LENGTH + 1] = {0}; ConvertMacArr2String(deviceInfoParam->srcAddress, srcAddressLen, srcAddress, sizeof(srcAddress)); cbInfo.srcAddress = srcAddress; uint32_t p2pDeviceAddressLen = deviceInfoParam->p2pDeviceAddressLen; - char p2pDeviceAddress[WIFI_HDI_STR_MAC_LENGTH +1] = {0}; + char p2pDeviceAddress[WIFI_HDI_STR_MAC_LENGTH + 1] = {0}; ConvertMacArr2String(deviceInfoParam->p2pDeviceAddress, p2pDeviceAddressLen, p2pDeviceAddress, sizeof(p2pDeviceAddress)); cbInfo.p2pDeviceAddress = p2pDeviceAddress; @@ -515,7 +517,7 @@ int32_t OnEventDeviceLost(struct IWpaCallback *self, const OHOS::Wifi::P2pHalCallback &cbk = OHOS::Wifi::WifiP2PHalInterface::GetInstance().GetP2pCallbackInst(); if (cbk.onDeviceLost) { uint32_t p2pDeviceAddressLen = deviceLostParam->p2pDeviceAddressLen; - char p2pDeviceAddress[WIFI_HDI_STR_MAC_LENGTH +1] = {0}; + char p2pDeviceAddress[WIFI_HDI_STR_MAC_LENGTH + 1] = {0}; ConvertMacArr2String(deviceLostParam->p2pDeviceAddress, p2pDeviceAddressLen, p2pDeviceAddress, sizeof(p2pDeviceAddress)); cbk.onDeviceLost(p2pDeviceAddress); @@ -533,7 +535,7 @@ int32_t OnEventGoNegotiationRequest(struct IWpaCallback *self, } const OHOS::Wifi::P2pHalCallback &cbk = OHOS::Wifi::WifiP2PHalInterface::GetInstance().GetP2pCallbackInst(); if (cbk.onGoNegotiationRequest) { - char address[WIFI_HDI_STR_MAC_LENGTH +1] = {0}; + char address[WIFI_HDI_STR_MAC_LENGTH + 1] = {0}; ConvertMacArr2String(goNegotiationRequestParam->srcAddress, goNegotiationRequestParam->srcAddressLen, address, sizeof(address)); @@ -578,17 +580,17 @@ int32_t OnEventInvitationReceived(struct IWpaCallback *self, cbInfo.persistentNetworkId = invitationReceivedParam->persistentNetworkId; cbInfo.operatingFrequency = invitationReceivedParam->operatingFrequency; - char address[WIFI_HDI_STR_MAC_LENGTH +1] = {0}; + char address[WIFI_HDI_STR_MAC_LENGTH + 1] = {0}; ConvertMacArr2String(invitationReceivedParam->srcAddress, invitationReceivedParam->srcAddressLen, address, sizeof(address)); cbInfo.srcAddress = address; - char address1[WIFI_HDI_STR_MAC_LENGTH +1] = {0}; + char address1[WIFI_HDI_STR_MAC_LENGTH + 1] = {0}; ConvertMacArr2String(invitationReceivedParam->goDeviceAddress, invitationReceivedParam->goDeviceAddressLen, address1, sizeof(address1)); cbInfo.goDeviceAddress = address1; - char address2[WIFI_HDI_STR_MAC_LENGTH +1] = {0}; + char address2[WIFI_HDI_STR_MAC_LENGTH + 1] = {0}; ConvertMacArr2String(invitationReceivedParam->bssid, invitationReceivedParam->bssidLen, address2, sizeof(address2)); cbInfo.bssid = address2; @@ -607,7 +609,7 @@ int32_t OnEventInvitationResult(struct IWpaCallback *self, } const OHOS::Wifi::P2pHalCallback &cbk = OHOS::Wifi::WifiP2PHalInterface::GetInstance().GetP2pCallbackInst(); if (cbk.onInvitationResult) { - char address[WIFI_HDI_STR_MAC_LENGTH +1] = {0}; + char address[WIFI_HDI_STR_MAC_LENGTH + 1] = {0}; ConvertMacArr2String(invitationResultParam->bssid, invitationResultParam->bssidLen, address, sizeof(address)); cbk.onInvitationResult(address, invitationResultParam->status); @@ -661,7 +663,7 @@ int32_t OnEventGroupStarted(struct IWpaCallback *self, LOGI("OnEventGroupStarted groupName=%{public}s ssid=%{private}s len=%{public}zu", cbInfo.groupName.c_str(), OHOS::Wifi::SsidAnonymize(cbInfo.ssid).c_str(), cbInfo.ssid.size()); - char address[WIFI_HDI_STR_MAC_LENGTH +1] = {0}; + char address[WIFI_HDI_STR_MAC_LENGTH + 1] = {0}; ConvertMacArr2String(groupStartedParam->goDeviceAddress, groupStartedParam->goDeviceAddressLen, address, sizeof(address)); cbInfo.goDeviceAddress = address; @@ -691,8 +693,8 @@ int32_t OnEventGroupInfoStarted(struct IWpaCallback *self, cbInfo.ssid = (char *)(tempSsid); cbInfo.psk = (char *)(groupStartedParam->psk); cbInfo.passphrase = (char *)(groupStartedParam->passphrase); - char address[WIFI_HDI_STR_MAC_LENGTH +1] = {0}; - char address1[WIFI_HDI_STR_MAC_LENGTH +1] = {0}; + char address[WIFI_HDI_STR_MAC_LENGTH + 1] = {0}; + char address1[WIFI_HDI_STR_MAC_LENGTH + 1] = {0}; ConvertMacArr2String(groupStartedParam->goDeviceAddress, groupStartedParam->goDeviceAddressLen, address, sizeof(address)); ConvertMacArr2String(groupStartedParam->goRandomDeviceAddress, @@ -730,7 +732,7 @@ int32_t OnEventProvisionDiscoveryCompleted(struct IWpaCallback *self, LOGI("OnEventProvisionDiscoveryCompleted provDiscStatusCode=%{public}d", provisionDiscoveryCompletedParam->provDiscStatusCode); uint32_t addressLen = provisionDiscoveryCompletedParam->p2pDeviceAddressLen; - char address[WIFI_HDI_STR_MAC_LENGTH +1] = {0}; + char address[WIFI_HDI_STR_MAC_LENGTH + 1] = {0}; ConvertMacArr2String(provisionDiscoveryCompletedParam->p2pDeviceAddress, addressLen, address, sizeof(address)); @@ -784,7 +786,7 @@ int32_t OnEventServDiscReq(struct IWpaCallback *self, cbInfo.dialogToken = servDiscReqInfoParam->dialogToken; cbInfo.updateIndic = servDiscReqInfoParam->updateIndic; - char address[WIFI_HDI_STR_MAC_LENGTH +1] = {0}; + char address[WIFI_HDI_STR_MAC_LENGTH + 1] = {0}; ConvertMacArr2String(servDiscReqInfoParam->mac, servDiscReqInfoParam->macLen, address, sizeof(address)); cbInfo.mac = address; @@ -810,7 +812,7 @@ int32_t OnEventServDiscResp(struct IWpaCallback *self, if (servDiscRespParam->tlvs != nullptr) { OHOS::Wifi::Char2Vec(servDiscRespParam->tlvs, servDiscRespParam->tlvsLen, tlvList); } - char address[WIFI_HDI_STR_MAC_LENGTH +1] = {0}; + char address[WIFI_HDI_STR_MAC_LENGTH + 1] = {0}; ConvertMacArr2String(servDiscRespParam->srcAddress, servDiscRespParam->srcAddressLen, address, sizeof(address)); cbk.onServiceDiscoveryResponse(address, servDiscRespParam->updateIndicator, tlvList); diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/common/wifi_event_callback.h b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/common/wifi_event_callback.h index e9d11c6b4..1fe94abe1 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/common/wifi_event_callback.h +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/common/wifi_event_callback.h @@ -29,7 +29,7 @@ struct WifiEventCallback { std::function onConnectChanged; std::function onBssidChanged; std::function onWpaStateChanged; - std::function onWpaSsidWrongKey; + std::function onWpaSsidWrongKey; std::function onWpsOverlap; std::function onWpsTimeOut; std::function onWpaAuthTimeout; diff --git a/wifi/test/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_monitor_test.cpp b/wifi/test/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_monitor_test.cpp index 4ff3afadb..d77a80c1e 100644 --- a/wifi/test/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_monitor_test.cpp +++ b/wifi/test/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_monitor_test.cpp @@ -204,13 +204,13 @@ void StaMonitorTest::OnWpaStateChangedCallBackFail1() void StaMonitorTest::OnWpaSsidWrongKeyCallBackSuccess() { - pStaMonitor->OnWpaSsidWrongKeyCallBack(); + pStaMonitor->OnWpaSsidWrongKeyCallBack(""); } void StaMonitorTest::OnWpaSsidWrongKeyCallBackFail() { pStaMonitor->pStaStateMachine = nullptr; - pStaMonitor->OnWpaSsidWrongKeyCallBack(); + pStaMonitor->OnWpaSsidWrongKeyCallBack(""); } void StaMonitorTest::OnWpsPbcOverlapCallBackSuccess() -- Gitee From 77eaa4cb3600df94a6349dfaeb4bcfe479bf9340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E6=B5=9A=E4=BA=88?= Date: Tue, 22 Jul 2025 04:16:57 +0000 Subject: [PATCH 3/4] add bssid3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 孙浚予 --- .../idl_client/unittest/wifi_idl_inner_interface_test.cpp | 6 +++--- .../idl_client/unittest/wifi_sta_hal_interface_test.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wifi/test/wifi_standard/wifi_framework/wifi_manage/idl_client/unittest/wifi_idl_inner_interface_test.cpp b/wifi/test/wifi_standard/wifi_framework/wifi_manage/idl_client/unittest/wifi_idl_inner_interface_test.cpp index 1ad6474c8..1d15c2537 100644 --- a/wifi/test/wifi_standard/wifi_framework/wifi_manage/idl_client/unittest/wifi_idl_inner_interface_test.cpp +++ b/wifi/test/wifi_standard/wifi_framework/wifi_manage/idl_client/unittest/wifi_idl_inner_interface_test.cpp @@ -49,7 +49,7 @@ static void OnWpaStateChangedMock(int status, const std::string &ssid) LOGI("OnWpaStateChangedMock"); } -static void OnWpaSsidWrongKeyMock() +static void OnWpaSsidWrongKeyMock(const std::string &bssid) { LOGI("OnWpaSsidWrongKeyMock"); } @@ -421,7 +421,7 @@ HWTEST_F(WifiIdlInnerInterfaceTest, OnWpaStateChangedTest, TestSize.Level1) EXPECT_EQ(WifiErrorNo::WIFI_HAL_OPT_FAILED, WifiStaHalInterface::GetInstance().RegisterStaEventCallback(callback, ifaceName)); OnWpaStateChanged(status, "test"); - OnWpaSsidWrongKey(); + OnWpaSsidWrongKey(""); OnWpaConnectionFull(status); OnWpaConnectionReject(status); OnWpsOverlap(status); @@ -430,7 +430,7 @@ HWTEST_F(WifiIdlInnerInterfaceTest, OnWpaStateChangedTest, TestSize.Level1) EXPECT_EQ(WifiErrorNo::WIFI_HAL_OPT_FAILED, WifiStaHalInterface::GetInstance().RegisterStaEventCallback(callback, ifaceName)); OnWpaStateChanged(status, "test"); - OnWpaSsidWrongKey(); + OnWpaSsidWrongKey(""); OnWpaConnectionFull(status); OnWpaConnectionReject(status); OnWpsOverlap(status); diff --git a/wifi/test/wifi_standard/wifi_framework/wifi_manage/idl_client/unittest/wifi_sta_hal_interface_test.cpp b/wifi/test/wifi_standard/wifi_framework/wifi_manage/idl_client/unittest/wifi_sta_hal_interface_test.cpp index 8346c5ea0..692511f8f 100644 --- a/wifi/test/wifi_standard/wifi_framework/wifi_manage/idl_client/unittest/wifi_sta_hal_interface_test.cpp +++ b/wifi/test/wifi_standard/wifi_framework/wifi_manage/idl_client/unittest/wifi_sta_hal_interface_test.cpp @@ -33,7 +33,7 @@ void OnWpaStateChanged(int status, const std::string &ssid) LOGD("OnWpaStateChanged status %d, ssid %s", status, ssid.c_str()); } -void OnWpaSsidWrongKey() +void OnWpaSsidWrongKey(const std::string &ssid) { LOGD("OnWpaSsidWrongKey"); } -- Gitee From 714f8659396b42c1d8297d867b6c4cfed4a2bca3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E6=B5=9A=E4=BA=88?= Date: Tue, 22 Jul 2025 12:22:17 +0800 Subject: [PATCH 4/4] add bssid4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 孙浚予 --- .../wifi_manage/wifi_sta/sta_state_machine.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_state_machine.cpp b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_state_machine.cpp index c1f4da0be..8801fafb5 100755 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_state_machine.cpp +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_state_machine.cpp @@ -1298,6 +1298,11 @@ void StaStateMachine::ApLinkingState::HandleStaBssidChangedEvent(InternalMessage void StaStateMachine::ApLinkingState::DealWpaLinkPasswdWrongFailEvent(InternalMessagePtr msg) { + std::string bssid = msg->GetStringFromMessage(); + WIFI_LOGI("ApLinkingState reveived wpa passwd wrong event, bssid:%{public}s.\n", MacAnonymize(bssid).c_str()); + if (bssid != "") { + pStaStateMachine->linkedInfo.bssid = bssid; + } pStaStateMachine->SaveDiscReason(DisconnectedReason::DISC_REASON_WRONG_PWD); pStaStateMachine->SaveLinkstate(ConnState::DISCONNECTED, DetailedState::PASSWORD_ERROR); if (BlockConnectService::GetInstance().IsWrongPassword(pStaStateMachine->targetNetworkId_)) { -- Gitee