!1672 新增softap连接失败打点

Merge pull request !1672 from lihui/master
This commit is contained in:
openharmony_ci 2023-12-28 13:56:57 +00:00 committed by Gitee
commit 04686a087a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
10 changed files with 25 additions and 1 deletions

View File

@ -25,6 +25,7 @@
#include "wifi_logger.h" #include "wifi_logger.h"
#include "dhcpd_interface.h" #include "dhcpd_interface.h"
#include "wifi_common_util.h" #include "wifi_common_util.h"
#include "wifi_hisysevent.h"
DEFINE_WIFILOG_HOTSPOT_LABEL("WifiApMonitor"); 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); SendMessage(m_selectIfacName, ApStatemachineEvent::CMD_UPDATE_HOTSPOTCONFIG_RESULT, 0, 0, 0);
} else if (state == WIFI_IDL_CBK_CMD_AP_ENABLE) { } else if (state == WIFI_IDL_CBK_CMD_AP_ENABLE) {
SendMessage(m_selectIfacName, ApStatemachineEvent::CMD_UPDATE_HOTSPOTCONFIG_RESULT, 1, 0, 0); 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 { } else {
WIFI_LOGE("Error: Incorrect status code [%{public}d].", state); WIFI_LOGE("Error: Incorrect status code [%{public}d].", state);
} }

View File

@ -329,6 +329,7 @@ static int IdlDealStaApEvent(Context *context, int event)
break; break;
case WIFI_IDL_CBK_CMD_AP_ENABLE: case WIFI_IDL_CBK_CMD_AP_ENABLE:
case WIFI_IDL_CBK_CMD_AP_DISABLE: case WIFI_IDL_CBK_CMD_AP_DISABLE:
case WIFI_IDL_CBK_CMD_AP_STA_PSK_MISMATCH_EVENT:
IdlCbkApStateChange(context, event); IdlCbkApStateChange(context, event);
break; break;
case WIFI_IDL_CBK_CMD_WPA_STATE_CHANGEM: case WIFI_IDL_CBK_CMD_WPA_STATE_CHANGEM:

View File

@ -261,7 +261,8 @@ static int GetApCallbackEvents(int *events, int size)
WIFI_IDL_CBK_CMD_STA_JOIN, WIFI_IDL_CBK_CMD_STA_JOIN,
WIFI_IDL_CBK_CMD_STA_LEAVE, WIFI_IDL_CBK_CMD_STA_LEAVE,
WIFI_IDL_CBK_CMD_AP_ENABLE, 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 max = sizeof(apEvents) / sizeof(apEvents[0]);
int num = 0; int num = 0;

View File

@ -64,6 +64,8 @@ typedef enum WifiIdlEvent {
WIFI_IDL_CBK_CMD_AP_STA_CONNECTED_EVENT, /* STA and AP connected event */ 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_SERV_DISC_REQ_EVENT, /* Service discovery request event */
WIFI_IDL_CBK_CMD_P2P_IFACE_CREATED_EVENT, /* P2P interface created 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; } WifiIdlEvent;
typedef enum WifiHalPortType { typedef enum WifiHalPortType {

View File

@ -235,6 +235,8 @@ void WifiHalCbApState(const char *content, int id)
} else if (strncmp(content, "AP-DISABLED", strlen("AP-DISABLED")) == 0 || } else if (strncmp(content, "AP-DISABLED", strlen("AP-DISABLED")) == 0 ||
strncmp(content, "CTRL-EVENT-TERMINATING", strlen("CTRL-EVENT-TERMINATING")) == 0) { strncmp(content, "CTRL-EVENT-TERMINATING", strlen("CTRL-EVENT-TERMINATING")) == 0) {
event = WIFI_AP_DISABLE_EVENT; 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 { } else {
return; return;
} }

View File

@ -516,6 +516,7 @@ static void DealStaApCallback(int event, Context *context)
case WIFI_STA_LEAVE_EVENT: case WIFI_STA_LEAVE_EVENT:
case WIFI_AP_ENABLE_EVENT: case WIFI_AP_ENABLE_EVENT:
case WIFI_AP_DISABLE_EVENT: case WIFI_AP_DISABLE_EVENT:
case AP_STA_PSK_MISMATH_EVENT:
DealIfaceCbk(event, context); DealIfaceCbk(event, context);
break; break;
case WIFI_SCAN_INFO_NOTIFY_EVENT: case WIFI_SCAN_INFO_NOTIFY_EVENT:

View File

@ -124,6 +124,7 @@ typedef enum WifiHalEvent {
P2P_SERV_DISC_REQ_EVENT, /* Service discovery request event */ P2P_SERV_DISC_REQ_EVENT, /* Service discovery request event */
P2P_IFACE_CREATED_EVENT, /* P2P interface created event */ P2P_IFACE_CREATED_EVENT, /* P2P interface created event */
WIFI_HAL_COMMON_EVENT, /* CHBA recv common event*/ WIFI_HAL_COMMON_EVENT, /* CHBA recv common event*/
AP_STA_PSK_MISMATH_EVENT, /* AP STA possible PSK mismatch event*/
WIFI_HAL_MAX_EVENT, WIFI_HAL_MAX_EVENT,
} WifiHalEvent; } WifiHalEvent;

View File

@ -170,6 +170,8 @@ static void DelCallbackMessage(const char *msg, int id)
if (strncmp(msg, WPA_EVENT_TERMINATING, strlen(WPA_EVENT_TERMINATING)) == 0) { if (strncmp(msg, WPA_EVENT_TERMINATING, strlen(WPA_EVENT_TERMINATING)) == 0) {
g_hostapdHalDevInfo[id].hostapdHalDev->threadRunFlag = 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);
} }
} }

View File

@ -19,6 +19,7 @@
#include <string> #include <string>
#define AP_ERR_CODE 3 #define AP_ERR_CODE 3
#define AP_STA_PSK_MISMATCH_CNT 1
namespace OHOS { namespace OHOS {
namespace Wifi { namespace Wifi {
enum class WifiOperType { enum class WifiOperType {
@ -94,6 +95,8 @@ void WriteP2pAbDisConnectHiSysEvent(int errCode, int failRes);
void WriteSoftApAbDisconnectHiSysEvent(int errorCode); void WriteSoftApAbDisconnectHiSysEvent(int errorCode);
void WriteIsInternetHiSysEvent(bool isInternet); void WriteIsInternetHiSysEvent(bool isInternet);
void WriteSoftApConnectFailHiSysEvent(int errorCnt);
} // namespace Wifi } // namespace Wifi
} // namespace OHOS } // namespace OHOS
#endif #endif

View File

@ -204,5 +204,13 @@ void WriteIsInternetHiSysEvent(bool isInternet)
WriteEvent("WIFI_CHR_EVENT", "EVENT_NAME", "WIFI_KPI_INTERNET", "EVENT_VALUE", writer.write(root)); 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 Wifi
} // namespace OHOS } // namespace OHOS