1f1549183Sopenharmony_ci/* 2f1549183Sopenharmony_ci * Copyright (C) 2022 Huawei Device Co., Ltd. 3f1549183Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4f1549183Sopenharmony_ci * you may not use this file except in compliance with the License. 5f1549183Sopenharmony_ci * You may obtain a copy of the License at 6f1549183Sopenharmony_ci * 7f1549183Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8f1549183Sopenharmony_ci * 9f1549183Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10f1549183Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11f1549183Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12f1549183Sopenharmony_ci * See the License for the specific language governing permissions and 13f1549183Sopenharmony_ci * limitations under the License. 14f1549183Sopenharmony_ci */ 15f1549183Sopenharmony_ci 16f1549183Sopenharmony_ci#ifndef OHOS_WIFI_HISYSEVENT_H 17f1549183Sopenharmony_ci#define OHOS_WIFI_HISYSEVENT_H 18f1549183Sopenharmony_ci 19f1549183Sopenharmony_ci#include <string> 20f1549183Sopenharmony_ci 21f1549183Sopenharmony_ci#define AP_ERR_CODE 3 22f1549183Sopenharmony_ci#define AP_STA_PSK_MISMATCH_CNT 1 23f1549183Sopenharmony_ci 24f1549183Sopenharmony_ci#define ENCRYPTION_EVENT 0 25f1549183Sopenharmony_ci#define DECRYPTION_EVENT 1 26f1549183Sopenharmony_ci#define NONE_ENCRYTION_UTIL 2 27f1549183Sopenharmony_ci 28f1549183Sopenharmony_ci#define SOFTAP_MOUDLE_EVENT 0 29f1549183Sopenharmony_ci#define STA_MOUDLE_EVENT 1 30f1549183Sopenharmony_ci 31f1549183Sopenharmony_cinamespace OHOS { 32f1549183Sopenharmony_cinamespace Wifi { 33f1549183Sopenharmony_cienum class WifiOperType { 34f1549183Sopenharmony_ci ENABLE, 35f1549183Sopenharmony_ci DISABLE, 36f1549183Sopenharmony_ci SEMI_ENABLE 37f1549183Sopenharmony_ci}; 38f1549183Sopenharmony_ci 39f1549183Sopenharmony_cienum class WifiConnectionType { 40f1549183Sopenharmony_ci CONNECT, 41f1549183Sopenharmony_ci DISCONNECT 42f1549183Sopenharmony_ci}; 43f1549183Sopenharmony_ci 44f1549183Sopenharmony_ciinline const int HISYS_EVENT_DEFAULT_VALUE = -1; 45f1549183Sopenharmony_ciinline const int HISYS_EVENT_PROTAL_STATE_NOT_PORTAL = 0; 46f1549183Sopenharmony_ciinline const int HISYS_EVENT_PROTAL_STATE_PORTAL_VERIFIED = 1; 47f1549183Sopenharmony_ciinline const int HISYS_EVENT_PROTAL_STATE_PORTAL_UNVERIFIED = 2; 48f1549183Sopenharmony_ci 49f1549183Sopenharmony_ciinline const std::string HISYS_STA_POWER_STATE_CHANGE = "wifiStateChange"; 50f1549183Sopenharmony_ciinline const std::string HISYS_STA_CONN_STATE_CHANGE = "wifiConnectionChange"; 51f1549183Sopenharmony_ciinline const std::string HISYS_STA_SCAN_STATE_CHANGE = "wifiScanStateChange"; 52f1549183Sopenharmony_ciinline const std::string HISYS_STA_RSSI_STATE_CHANGE = "wifiRssiChange"; 53f1549183Sopenharmony_ciinline const std::string HISYS_HOTSPOT_STATE_CHANGE = "hotspotStateChange"; 54f1549183Sopenharmony_ciinline const std::string HISYS_HOTSPOT_STA_JOIN = "hotspotStaJoin"; 55f1549183Sopenharmony_ciinline const std::string HISYS_HOTSPOT_STA_LEAVE = "hotspotStaLeave"; 56f1549183Sopenharmony_ciinline const std::string HISYS_P2P_STATE_CHANGE = "p2pStateChange"; 57f1549183Sopenharmony_ciinline const std::string HISYS_P2P_CONN_STATE_CHANGE = "p2pConnectionChange"; 58f1549183Sopenharmony_ciinline const std::string HISYS_P2P_DEVICE_STATE_CHANGE = "p2pDeviceChange"; 59f1549183Sopenharmony_ciinline const std::string HISYS_P2P_PERSISTENT_GROUP_CHANGE = "p2pPersistentGroupChange"; 60f1549183Sopenharmony_ciinline const std::string HISYS_P2P_PEER_DEVICE_CHANGE = "p2pPeerDeviceChange"; 61f1549183Sopenharmony_ciinline const std::string HISYS_P2P_DISCOVERY_CHANGE = "p2pDiscoveryChange"; 62f1549183Sopenharmony_ci 63f1549183Sopenharmony_ciinline const std::string HISYS_SERVICE_TYPE_STA = "STA"; 64f1549183Sopenharmony_ciinline const std::string HISYS_SERVICE_TYPE_AP = "AP"; 65f1549183Sopenharmony_ciinline const std::string HISYS_SERVICE_TYPE_P2P = "P2P"; 66f1549183Sopenharmony_ci 67f1549183Sopenharmony_civoid WriteWifiStateHiSysEvent(const std::string& serviceType, WifiOperType operType); 68f1549183Sopenharmony_ci 69f1549183Sopenharmony_civoid WriteWifiApStateHiSysEvent(int32_t state); 70f1549183Sopenharmony_ci 71f1549183Sopenharmony_civoid WriteWifiP2pStateHiSysEvent(const std::string& inter, int32_t type, int32_t state); 72f1549183Sopenharmony_ci 73f1549183Sopenharmony_civoid WriteWifiConnectionHiSysEvent(const WifiConnectionType& type, const std::string& pkgName); 74f1549183Sopenharmony_ci 75f1549183Sopenharmony_civoid WriteWifiScanHiSysEvent(const int result, const std::string& pkgName); 76f1549183Sopenharmony_ci 77f1549183Sopenharmony_civoid WriteWifiEventReceivedHiSysEvent(const std::string& eventType, int value); 78f1549183Sopenharmony_ci 79f1549183Sopenharmony_civoid WriteWifiBandHiSysEvent(int band); 80f1549183Sopenharmony_ci 81f1549183Sopenharmony_civoid WriteWifiSignalHiSysEvent(int direction, int txPackets, int rxPackets); 82f1549183Sopenharmony_ci 83f1549183Sopenharmony_civoid WriteWifiOperateStateHiSysEvent(int operateType, int operateState); 84f1549183Sopenharmony_ci 85f1549183Sopenharmony_civoid WriteWifiAbnormalDisconnectHiSysEvent(int errorCode); 86f1549183Sopenharmony_ci 87f1549183Sopenharmony_civoid WriteWifiConnectionInfoHiSysEvent(int networkId); 88f1549183Sopenharmony_ci 89f1549183Sopenharmony_civoid WriteWifiOpenAndCloseFailedHiSysEvent(int operateType, std::string failReason, int apState); 90f1549183Sopenharmony_ci 91f1549183Sopenharmony_civoid WriteSoftApOpenAndCloseFailedEvent(int operateType, std::string failReason); 92f1549183Sopenharmony_ci 93f1549183Sopenharmony_civoid WriteWifiAccessIntFailedHiSysEvent(int operateRes, int failCnt); 94f1549183Sopenharmony_ci 95f1549183Sopenharmony_civoid WriteWifiPnoScanHiSysEvent(int isStartScan, int suspendReason); 96f1549183Sopenharmony_ci 97f1549183Sopenharmony_civoid WriteBrowserFailedForPortalHiSysEvent(int respCode, std::string &server); 98f1549183Sopenharmony_ci 99f1549183Sopenharmony_civoid WriteWifiConnectFailedEventHiSysEvent(int operateType); 100f1549183Sopenharmony_ci 101f1549183Sopenharmony_civoid WriteP2pKpiCountHiSysEvent(int eventType); 102f1549183Sopenharmony_ci 103f1549183Sopenharmony_civoid WriteP2pConnectFailedHiSysEvent(int errCode, int failRes); 104f1549183Sopenharmony_ci 105f1549183Sopenharmony_civoid WriteP2pAbDisConnectHiSysEvent(int errCode, int failRes); 106f1549183Sopenharmony_ci 107f1549183Sopenharmony_civoid WriteSoftApAbDisconnectHiSysEvent(int errorCode); 108f1549183Sopenharmony_ci 109f1549183Sopenharmony_civoid WriteIsInternetHiSysEvent(int isInternet); 110f1549183Sopenharmony_ci 111f1549183Sopenharmony_civoid WriteSoftApConnectFailHiSysEvent(int errorCnt); 112f1549183Sopenharmony_ci 113f1549183Sopenharmony_civoid WriteWifiScanApiFailHiSysEvent(const std::string& pkgName, int failReason); 114f1549183Sopenharmony_ci 115f1549183Sopenharmony_civoid WriteWifiEncryptionFailHiSysEvent(int event, const std::string &maskSsid, 116f1549183Sopenharmony_ci const std::string &keyMgmt, int encryptedModule); 117f1549183Sopenharmony_ci 118f1549183Sopenharmony_civoid WritePortalStateHiSysEvent(int portalState); 119f1549183Sopenharmony_ci 120f1549183Sopenharmony_civoid WriteArpInfoHiSysEvent(uint64_t arpRtt, int arpFailedCount); 121f1549183Sopenharmony_ci 122f1549183Sopenharmony_civoid WriteLinkInfoHiSysEvent(int signalLevel, int rssi, int band, int linkSpeed); 123f1549183Sopenharmony_ci 124f1549183Sopenharmony_civoid WirteConnectTypeHiSysEvent(std::string connectType); 125f1549183Sopenharmony_ci 126f1549183Sopenharmony_civoid WriteWifiWpaStateHiSysEvent(int state); 127f1549183Sopenharmony_ci 128f1549183Sopenharmony_civoid WritePortalAuthExpiredHisysevent(int respCode, int detectNum, time_t connTime, 129f1549183Sopenharmony_ci time_t portalAuthTime, bool isNotificationClicked); 130f1549183Sopenharmony_ci 131f1549183Sopenharmony_civoid WriteWifiSelfcureHisysevent(int type); 132f1549183Sopenharmony_ci} // namespace Wifi 133f1549183Sopenharmony_ci} // namespace OHOS 134f1549183Sopenharmony_ci#endif 135