• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef OHOS_WIFI_HISYSEVENT_H
17 #define OHOS_WIFI_HISYSEVENT_H
18 
19 #include <string>
20 
21 #define AP_ERR_CODE 3
22 #define AP_STA_PSK_MISMATCH_CNT 1
23 namespace OHOS {
24 namespace Wifi {
25 enum class WifiOperType {
26     ENABLE,
27     DISABLE
28 };
29 
30 enum class WifiConnectionType {
31     CONNECT,
32     DISCONNECT
33 };
34 
35 const int HISYS_EVENT_DEFAULT_VALUE = -1;
36 
37 const std::string HISYS_STA_POWER_STATE_CHANGE = "wifiStateChange";
38 const std::string HISYS_STA_CONN_STATE_CHANGE = "wifiConnectionChange";
39 const std::string HISYS_STA_SCAN_STATE_CHANGE = "wifiScanStateChange";
40 const std::string HISYS_STA_RSSI_STATE_CHANGE = "wifiRssiChange";
41 const std::string HISYS_HOTSPOT_STATE_CHANGE = "hotspotStateChange";
42 const std::string HISYS_HOTSPOT_STA_JOIN = "hotspotStaJoin";
43 const std::string HISYS_HOTSPOT_STA_LEAVE = "hotspotStaLeave";
44 const std::string HISYS_P2P_STATE_CHANGE = "p2pStateChange";
45 const std::string HISYS_P2P_CONN_STATE_CHANGE = "p2pConnectionChange";
46 const std::string HISYS_P2P_DEVICE_STATE_CHANGE = "p2pDeviceChange";
47 const std::string HISYS_P2P_PERSISTENT_GROUP_CHANGE = "p2pPersistentGroupChange";
48 const std::string HISYS_P2P_PEER_DEVICE_CHANGE = "p2pPeerDeviceChange";
49 const std::string HISYS_P2P_DISCOVERY_CHANGE = "p2pDiscoveryChange";
50 
51 const std::string HISYS_SERVICE_TYPE_STA = "STA";
52 const std::string HISYS_SERVICE_TYPE_AP = "AP";
53 const std::string HISYS_SERVICE_TYPE_P2P = "P2P";
54 
55 void WriteWifiStateHiSysEvent(const std::string& serviceType, WifiOperType operType);
56 
57 void WriteWifiApStateHiSysEvent(int32_t state);
58 
59 void WriteWifiP2pStateHiSysEvent(const std::string& inter, int32_t type, int32_t state);
60 
61 void WriteWifiConnectionHiSysEvent(const WifiConnectionType& type, const std::string& pkgName);
62 
63 void WriteWifiScanHiSysEvent(const int result, const std::string& pkgName);
64 
65 void WriteWifiEventReceivedHiSysEvent(const std::string& eventType, int value);
66 
67 void WriteWifiBandHiSysEvent(int band);
68 
69 void WriteWifiSignalHiSysEvent(int direction, int txPackets, int rxPackets);
70 
71 void WriteWifiOperateStateHiSysEvent(int operateType, int operateState);
72 
73 void WriteWifiAbnormalDisconnectHiSysEvent(int errorCode);
74 
75 void WriteWifiConnectionInfoHiSysEvent(int networkId);
76 
77 void WriteWifiOpenAndCloseFailedHiSysEvent(int operateType, std::string failReason, int apState);
78 
79 void WriteSoftApOpenAndCloseFailedEvent(int operateType, std::string failReason);
80 
81 void WriteWifiAccessIntFailedHiSysEvent(int operateRes, int failCnt);
82 
83 void WriteWifiPnoScanHiSysEvent(int isStartScan, int suspendReason);
84 
85 void WriteBrowserFailedForPortalHiSysEvent(int respCode, std::string &server);
86 
87 void WriteWifiConnectFailedEventHiSysEvent(int operateType);
88 
89 void WriteP2pKpiCountHiSysEvent(int eventType);
90 
91 void WriteP2pConnectFailedHiSysEvent(int errCode, int failRes);
92 
93 void WriteP2pAbDisConnectHiSysEvent(int errCode, int failRes);
94 
95 void WriteSoftApAbDisconnectHiSysEvent(int errorCode);
96 
97 void WriteIsInternetHiSysEvent(int isInternet);
98 
99 void WriteSoftApConnectFailHiSysEvent(int errorCnt);
100 
101 void WriteWifiScanApiFailHiSysEvent(const std::string& pkgName, int failReason);
102 }  // namespace Wifi
103 }  // namespace OHOS
104 #endif