diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/ap_monitor.cpp b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/ap_monitor.cpp index e9f2c4a7b..1bb294f2d 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/ap_monitor.cpp +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/ap_monitor.cpp @@ -25,6 +25,7 @@ #include "wifi_logger.h" #include "dhcpd_interface.h" #include "wifi_common_util.h" +#include "wifi_hisysevent.h" DEFINE_WIFILOG_HOTSPOT_LABEL("WifiApMonitor"); @@ -72,6 +73,8 @@ void ApMonitor::OnHotspotStateEvent(int state) const SendMessage(m_selectIfacName, ApStatemachineEvent::CMD_UPDATE_HOTSPOTCONFIG_RESULT, 0, 0, 0); } else if (state == WIFI_IDL_CBK_CMD_AP_ENABLE) { SendMessage(m_selectIfacName, ApStatemachineEvent::CMD_UPDATE_HOTSPOTCONFIG_RESULT, 1, 0, 0); + } else if (state == WIFI_IDL_CBK_CMD_AP_STA_PSK_MISMATCH_EVENT) { + WriteSoftApConnectFailHiSysEvent(AP_STA_PSK_MISMATCH_CNT); } else { WIFI_LOGE("Error: Incorrect status code [%{public}d].", state); } diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/idl_client/idl_interface/i_wifi.c b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/idl_client/idl_interface/i_wifi.c index a976767b7..eea5c34e2 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/idl_client/idl_interface/i_wifi.c +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/idl_client/idl_interface/i_wifi.c @@ -329,6 +329,7 @@ static int IdlDealStaApEvent(Context *context, int event) break; case WIFI_IDL_CBK_CMD_AP_ENABLE: case WIFI_IDL_CBK_CMD_AP_DISABLE: + case WIFI_IDL_CBK_CMD_AP_STA_PSK_MISMATCH_EVENT: IdlCbkApStateChange(context, event); break; case WIFI_IDL_CBK_CMD_WPA_STATE_CHANGEM: diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/idl_client/idl_interface/i_wifi_hotspot_iface.c b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/idl_client/idl_interface/i_wifi_hotspot_iface.c index 6bf264968..e1b68adcf 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/idl_client/idl_interface/i_wifi_hotspot_iface.c +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/idl_client/idl_interface/i_wifi_hotspot_iface.c @@ -261,7 +261,8 @@ static int GetApCallbackEvents(int *events, int size) WIFI_IDL_CBK_CMD_STA_JOIN, WIFI_IDL_CBK_CMD_STA_LEAVE, WIFI_IDL_CBK_CMD_AP_ENABLE, - WIFI_IDL_CBK_CMD_AP_DISABLE + WIFI_IDL_CBK_CMD_AP_DISABLE, + WIFI_IDL_CBK_CMD_AP_STA_PSK_MISMATCH_EVENT }; int max = sizeof(apEvents) / sizeof(apEvents[0]); int num = 0; diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/idl_client/wifi_idl_define.h b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/idl_client/wifi_idl_define.h index cdcf949fe..9e8a8d1fe 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/idl_client/wifi_idl_define.h +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/idl_client/wifi_idl_define.h @@ -64,6 +64,8 @@ typedef enum WifiIdlEvent { WIFI_IDL_CBK_CMD_AP_STA_CONNECTED_EVENT, /* STA and AP connected event */ WIFI_IDL_CBK_CMD_P2P_SERV_DISC_REQ_EVENT, /* Service discovery request event */ WIFI_IDL_CBK_CMD_P2P_IFACE_CREATED_EVENT, /* P2P interface created event */ + WIFI_IDL_CBK_CMD_STA_AP_TEMP_EVENT, + WIFI_IDL_CBK_CMD_AP_STA_PSK_MISMATCH_EVENT, /* AP STA possible PSK mismatch event*/ } WifiIdlEvent; typedef enum WifiHalPortType { diff --git a/wifi/services/wifi_standard/wifi_hal/wifi_hal_callback.c b/wifi/services/wifi_standard/wifi_hal/wifi_hal_callback.c index 2525a0732..79fb62a0a 100644 --- a/wifi/services/wifi_standard/wifi_hal/wifi_hal_callback.c +++ b/wifi/services/wifi_standard/wifi_hal/wifi_hal_callback.c @@ -235,6 +235,8 @@ void WifiHalCbApState(const char *content, int id) } else if (strncmp(content, "AP-DISABLED", strlen("AP-DISABLED")) == 0 || strncmp(content, "CTRL-EVENT-TERMINATING", strlen("CTRL-EVENT-TERMINATING")) == 0) { event = WIFI_AP_DISABLE_EVENT; + } else if (strncmp(content, "AP-STA-POSSIBLE-PSK-MISMATCH ", strlen("AP-STA-POSSIBLE-PSK-MISMATCH ")) == 0) { + event = AP_STA_PSK_MISMATH_EVENT; } else { return; } diff --git a/wifi/services/wifi_standard/wifi_hal/wifi_hal_crpc_server.c b/wifi/services/wifi_standard/wifi_hal/wifi_hal_crpc_server.c index 499178a26..1a4d2f9af 100644 --- a/wifi/services/wifi_standard/wifi_hal/wifi_hal_crpc_server.c +++ b/wifi/services/wifi_standard/wifi_hal/wifi_hal_crpc_server.c @@ -516,6 +516,7 @@ static void DealStaApCallback(int event, Context *context) case WIFI_STA_LEAVE_EVENT: case WIFI_AP_ENABLE_EVENT: case WIFI_AP_DISABLE_EVENT: + case AP_STA_PSK_MISMATH_EVENT: DealIfaceCbk(event, context); break; case WIFI_SCAN_INFO_NOTIFY_EVENT: diff --git a/wifi/services/wifi_standard/wifi_hal/wifi_hal_define.h b/wifi/services/wifi_standard/wifi_hal/wifi_hal_define.h index 3b590933b..384d35526 100644 --- a/wifi/services/wifi_standard/wifi_hal/wifi_hal_define.h +++ b/wifi/services/wifi_standard/wifi_hal/wifi_hal_define.h @@ -124,6 +124,7 @@ typedef enum WifiHalEvent { P2P_SERV_DISC_REQ_EVENT, /* Service discovery request event */ P2P_IFACE_CREATED_EVENT, /* P2P interface created event */ WIFI_HAL_COMMON_EVENT, /* CHBA recv common event*/ + AP_STA_PSK_MISMATH_EVENT, /* AP STA possible PSK mismatch event*/ WIFI_HAL_MAX_EVENT, } WifiHalEvent; diff --git a/wifi/services/wifi_standard/wifi_hal/wifi_hal_module/hostapd_hal/wifi_hostapd_hal.c b/wifi/services/wifi_standard/wifi_hal/wifi_hal_module/hostapd_hal/wifi_hostapd_hal.c index 838573203..f81f32ae1 100644 --- a/wifi/services/wifi_standard/wifi_hal/wifi_hal_module/hostapd_hal/wifi_hostapd_hal.c +++ b/wifi/services/wifi_standard/wifi_hal/wifi_hal_module/hostapd_hal/wifi_hostapd_hal.c @@ -170,6 +170,8 @@ static void DelCallbackMessage(const char *msg, int id) if (strncmp(msg, WPA_EVENT_TERMINATING, strlen(WPA_EVENT_TERMINATING)) == 0) { g_hostapdHalDevInfo[id].hostapdHalDev->threadRunFlag = 0; } + } else if (strncmp(msg, AP_STA_POSSIBLE_PSK_MISMATCH, strlen(AP_STA_POSSIBLE_PSK_MISMATCH)) == 0) { + WifiHalCbApState(msg, id); } } diff --git a/wifi/utils/inc/wifi_hisysevent.h b/wifi/utils/inc/wifi_hisysevent.h index bc312eecf..cbf60ce6c 100644 --- a/wifi/utils/inc/wifi_hisysevent.h +++ b/wifi/utils/inc/wifi_hisysevent.h @@ -19,6 +19,7 @@ #include #define AP_ERR_CODE 3 +#define AP_STA_PSK_MISMATCH_CNT 1 namespace OHOS { namespace Wifi { enum class WifiOperType { @@ -94,6 +95,8 @@ void WriteP2pAbDisConnectHiSysEvent(int errCode, int failRes); void WriteSoftApAbDisconnectHiSysEvent(int errorCode); void WriteIsInternetHiSysEvent(bool isInternet); + +void WriteSoftApConnectFailHiSysEvent(int errorCnt); } // namespace Wifi } // namespace OHOS #endif \ No newline at end of file diff --git a/wifi/utils/src/wifi_hisysevent.cpp b/wifi/utils/src/wifi_hisysevent.cpp index e174a807e..99b04f6b4 100644 --- a/wifi/utils/src/wifi_hisysevent.cpp +++ b/wifi/utils/src/wifi_hisysevent.cpp @@ -204,5 +204,13 @@ void WriteIsInternetHiSysEvent(bool isInternet) WriteEvent("WIFI_CHR_EVENT", "EVENT_NAME", "WIFI_KPI_INTERNET", "EVENT_VALUE", writer.write(root)); } +void WriteSoftApConnectFailHiSysEvent(int errorCnt) +{ + WIFI_LOGE("WriteSoftApConnectFailHiSysEvent errorCnt=%{public}d", errorCnt); + Json::Value root; + Json::FastWriter writer; + root["ERROR_CODE"] = errorCnt; + WriteEvent("WIFI_CHR_EVENT", "EVENT_NAME", "SOFT_AP_CONNECT_FAILD", "EVENT_VALUE", writer.write(root)); +} } // namespace Wifi } // namespace OHOS \ No newline at end of file