mirror of
https://gitee.com/openharmony/communication_wifi.git
synced 2024-11-23 23:19:48 +00:00
commit
04686a087a
@ -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);
|
||||
}
|
||||
|
@ -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:
|
||||
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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:
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <string>
|
||||
|
||||
#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
|
@ -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
|
Loading…
Reference in New Issue
Block a user