mirror of
https://gitee.com/openharmony/communication_wifi.git
synced 2024-11-27 09:12:20 +00:00
新增chr打点
Signed-off-by: l30052082 <lihui410@huawei.com>
This commit is contained in:
parent
6c758f9597
commit
3844ba59bc
@ -58,6 +58,24 @@ WIFI_ABDISCONNECT:
|
||||
PUBLIC_ESS_COUNT: {type: INT32, desc: public ess count}
|
||||
SUB_ERROR_CODE: {type: STRING, desc: sub error code}
|
||||
|
||||
WIFI_OPEN_AND_CLOSE_FAILED:
|
||||
__BASE: {type: FAULT, level: MINOR, desc: Wifi open and close failed event}
|
||||
OPEN_FAIL: {type: STRING, desc: open wifi fail}
|
||||
CLOSE_FAIL: {type: STRING, desc: close wifi fail}
|
||||
FAIL_REASON: {type: STRING, desc: fail reason}
|
||||
IS_AP_OPEN: {type: INT32, desc: is ap open}
|
||||
|
||||
SOFTAP_OPEN_AND_CLOSE_FAILED:
|
||||
__BASE: {type: FAULT, level: MINOR, desc: soft ap open and close failed event}
|
||||
OPEN_FAIL: {type: STRING, desc: open soft ap fail}
|
||||
CLOSE_FAIL: {type: STRING, desc: close soft ap fail}
|
||||
FAIL_REASON: {type: STRING, desc: fail reason}
|
||||
|
||||
WIFI_ACCESS_INTERNET_FAILED:
|
||||
__BASE: {type: FAULT, level: MINOR, desc: Wifi access internet failed event}
|
||||
ARP_FAIL_CNT: {type: STRING, desc: arp fail cnt}
|
||||
NET_STATE: {type: STRING, desc: http network fail}
|
||||
|
||||
WIFI_CHR_EVENT:
|
||||
__BASE: {type: STATISTIC, level: MINOR, desc: Wifi chr event}
|
||||
EVENT_NAME: {type: STRING, desc: event name}
|
||||
|
@ -20,6 +20,8 @@
|
||||
namespace OHOS {
|
||||
namespace Wifi {
|
||||
|
||||
#define SFOT_AP_TIME_OUT 10000
|
||||
|
||||
#define CMD_WIFI_TOGGLED 0x1
|
||||
#define CMD_SOFTAP_TOGGLED 0x2
|
||||
#define CMD_SCAN_ALWAYS_MODE_CHANGED 0x3
|
||||
@ -30,6 +32,9 @@ namespace Wifi {
|
||||
#define CMD_AP_START 0x8
|
||||
#define CMD_AIRPLANE_TOGGLED 0x9
|
||||
|
||||
#define CMD_AP_START_TIME 0x10
|
||||
#define CMD_AP_STOP_TIME 0x11
|
||||
|
||||
#define CONCRETE_CMD_START 0x101
|
||||
#define CONCRETE_CMD_SWITCH_TO_CONNECT_MODE 0x102
|
||||
#define CONCRETE_CMD_SWITCH_TO_SCAN_ONLY_MODE 0x103
|
||||
@ -60,6 +65,11 @@ enum class ConcreteManagerRole {
|
||||
ROLE_CLIENT_MIX,
|
||||
};
|
||||
|
||||
enum class SoftApperateType {
|
||||
OPEN_SOFT_AP_FAILED = 0,
|
||||
CLOSE_SOFT_AP_FAILED = 1,
|
||||
};
|
||||
|
||||
} // namespace Wifi
|
||||
} // namespace OHOS
|
||||
#endif
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "wifi_settings.h"
|
||||
#include "wifi_msg.h"
|
||||
#include "wifi_system_timer.h"
|
||||
#include "wifi_hisysevent.h"
|
||||
#ifdef HAS_BATTERY_MANAGER_PART
|
||||
#include "battery_srv_client.h"
|
||||
#endif
|
||||
@ -106,6 +107,7 @@ bool WifiControllerMachine::DisableState::ExecuteStateMsg(InternalMessage *msg)
|
||||
if (msg->GetParam1()) {
|
||||
int id = msg->GetParam2();
|
||||
pWifiControllerMachine->MakeSoftapManager(SoftApManager::Role::ROLE_SOFTAP, id);
|
||||
pWifiControllerMachine->StartTimer(CMD_AP_START_TIME, SFOT_AP_TIME_OUT);
|
||||
pWifiControllerMachine->SwitchState(pWifiControllerMachine->pEnableState);
|
||||
}
|
||||
break;
|
||||
@ -175,10 +177,12 @@ bool WifiControllerMachine::EnableState::ExecuteStateMsg(InternalMessage *msg)
|
||||
pWifiControllerMachine->HandleConcreteStop(msg->GetParam1());
|
||||
break;
|
||||
case CMD_AP_START:
|
||||
pWifiControllerMachine->StopTimer(CMD_AP_START_TIME);
|
||||
HandleApStart(msg->GetParam1());
|
||||
break;
|
||||
case CMD_AP_STOPPED:
|
||||
case CMD_AP_START_FAILURE:
|
||||
pWifiControllerMachine->StopTimer(CMD_AP_STOP_TIME);
|
||||
pWifiControllerMachine->StopSoftapCloseTimer();
|
||||
pWifiControllerMachine->HandleSoftapStop(msg->GetParam1());
|
||||
break;
|
||||
@ -189,6 +193,12 @@ bool WifiControllerMachine::EnableState::ExecuteStateMsg(InternalMessage *msg)
|
||||
pWifiControllerMachine->HandleAirplaneClose();
|
||||
}
|
||||
break;
|
||||
case CMD_AP_START_TIME:
|
||||
WriteSoftApOpenAndCloseFailedEvent(static_cast<int>(SoftApperateType::OPEN_SOFT_AP_FAILED), "TIME_OUT");
|
||||
break;
|
||||
case CMD_AP_STOP_TIME:
|
||||
WriteSoftApOpenAndCloseFailedEvent(static_cast<int>(SoftApperateType::CLOSE_SOFT_AP_FAILED), "TIME_OUT");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -544,6 +554,7 @@ void WifiControllerMachine::EnableState::HandleSoftapToggleChangeInEnabledState(
|
||||
}
|
||||
if (pWifiControllerMachine->SoftApIdExit(id)) {
|
||||
pWifiControllerMachine->StopSoftapManager(id);
|
||||
pWifiControllerMachine->StartTimer(CMD_AP_STOP_TIME, SFOT_AP_TIME_OUT);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1242,6 +1242,9 @@ void WifiManager::DealStaOpenRes(OperateResState state, int instId)
|
||||
}
|
||||
if ((state == OperateResState::OPEN_WIFI_FAILED) || (state == OperateResState::OPEN_WIFI_DISABLED)) {
|
||||
WIFI_LOGE("DealStaOpenRes:wifi open failed!");
|
||||
WifiOprMidState apstate = WifiConfigCenter::GetInstance().GetApMidState(instId);
|
||||
WriteWifiOpenAndCloseFailedHiSysEvent(static_cast<int>(OperateResState::OPEN_WIFI_FAILED), "TIME_OUT",
|
||||
static_cast<int>(apstate));
|
||||
WifiConfigCenter::GetInstance().SetWifiMidState(WifiOprMidState::OPENING, WifiOprMidState::CLOSED, instId);
|
||||
DealStaCloseRes(state, instId);
|
||||
return;
|
||||
@ -1302,6 +1305,9 @@ void WifiManager::DealStaCloseRes(OperateResState state, int instId)
|
||||
}
|
||||
if (state == OperateResState::CLOSE_WIFI_FAILED) {
|
||||
WIFI_LOGI("DealStaCloseRes: broadcast wifi close failed event!");
|
||||
WifiOprMidState apstate = WifiConfigCenter::GetInstance().GetApMidState(instId);
|
||||
WriteWifiOpenAndCloseFailedHiSysEvent(static_cast<int>(OperateResState::CLOSE_WIFI_FAILED), "TIME_OUT",
|
||||
static_cast<int>(apstate));
|
||||
WifiManager::GetInstance().ForceStopWifi(instId);
|
||||
cbMsg.msgData = static_cast<int>(WifiState::UNKNOWN);
|
||||
WifiInternalEventDispatcher::GetInstance().AddBroadCastMsg(cbMsg);
|
||||
|
@ -67,6 +67,12 @@ void WriteWifiOperateStateHiSysEvent(int operateType, int operateState);
|
||||
void WriteWifiAbnormalDisconnectHiSysEvent(int errorCode);
|
||||
|
||||
void WriteWifiConnectionInfoHiSysEvent(int networkId);
|
||||
|
||||
void WriteWifiOpenAndCloseFailedHiSysEvent(int operateType, std::string failReason, int apState);
|
||||
|
||||
void WriteSoftApOpenAndCloseFailedEvent(int operateType, std::string failReason);
|
||||
|
||||
void WriteWifiAccessIntFailedHiSysEvent(int operateRes, int failCnt);
|
||||
} // namespace Wifi
|
||||
} // namespace OHOS
|
||||
#endif
|
@ -86,5 +86,35 @@ void WriteWifiConnectionInfoHiSysEvent(int networkId)
|
||||
root["NETWORK_ID"] = networkId;
|
||||
WriteEvent("WIFI_CHR_EVENT", "EVENT_NAME", "WIFI_CONNECTION_INFO", "EVENT_VALUE", writer.write(root));
|
||||
}
|
||||
|
||||
void WriteWifiOpenAndCloseFailedHiSysEvent(int operateType, std::string failReason, int apState)
|
||||
{
|
||||
Json::Value root;
|
||||
Json::FastWriter writer;
|
||||
root["OPERATE_TYPE"] = operateType;
|
||||
root["FAIL_REASON"] = failReason;
|
||||
root["AP_STATE"] = apState;
|
||||
WriteEvent("WIFI_CHR_EVENT", "EVENT_NAME", "WIFI_OPEN_AND_CLOSE_FAILED", "EVENT_VALUE", writer.write(root));
|
||||
}
|
||||
|
||||
void WriteSoftApOpenAndCloseFailedEvent(int operateType, std::string failReason)
|
||||
{
|
||||
WIFI_LOGE("WriteSoftApOpenAndCloseFailedEvent operateType=%{public}d", operateType);
|
||||
Json::Value root;
|
||||
Json::FastWriter writer;
|
||||
root["OPERATE_TYPE"] = operateType;
|
||||
root["FAIL_REASON"] = failReason;
|
||||
WriteEvent("WIFI_CHR_EVENT", "EVENT_NAME", "SOFTAP_OPEN_AND_CLOSE_FAILED", "EVENT_VALUE", writer.write(root));
|
||||
}
|
||||
|
||||
void WriteWifiAccessIntFailedHiSysEvent(int operateRes, int failCnt)
|
||||
{
|
||||
Json::Value root;
|
||||
Json::FastWriter writer;
|
||||
root["OPERATE_TYPE"] = operateRes;
|
||||
root["FAIL_CNT"] = failCnt;
|
||||
WriteEvent("WIFI_CHR_EVENT", "EVENT_NAME", "WIFI_ACCESS_INTERNET_FAILED", "EVENT_VALUE", writer.write(root));
|
||||
}
|
||||
|
||||
} // namespace Wifi
|
||||
} // namespace OHOS
|
Loading…
Reference in New Issue
Block a user