1 /* 2 * Copyright (C) 2021-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_STA_DEFINE_H 17 #define OHOS_STA_DEFINE_H 18 19 #include <functional> 20 #include <string> 21 22 namespace OHOS { 23 namespace Wifi { 24 #define FRIEND_GTEST(test_typename) friend class test_typename##Test 25 26 #define WIFI_SVR_CMD_STA_ENABLE_WIFI 0x2001 27 #define WIFI_SVR_CMD_STA_DISABLE_WIFI 0x2002 28 #define WIFI_SVR_CMD_STA_OPERATIONAL_MODE 0x2003 29 #define WIFI_SVR_CMD_STA_CONNECT_NETWORK 0x2004 30 #define WIFI_SVR_CMD_STA_CONNECT_SAVED_NETWORK 0x2005 31 #define WIFI_SVR_CMD_STA_RECONNECT_NETWORK 0x2006 32 #define WIFI_SVR_CMD_STA_REASSOCIATE_NETWORK 0x2007 33 #define WIFI_SVR_CMD_STA_DISCONNECT 0x2008 34 #define WIFI_SVR_CMD_STA_STARTWPS 0x2009 35 #define WIFI_SVR_CMD_STA_CANCELWPS 0x200A 36 #define WIFI_SVR_COM_STA_START_ROAM 0x200B 37 38 #define WIFI_SVR_CMD_STA_ERROR 0x3001 39 #define WIFI_SVR_CMD_STA_SUP_CONNECTION_EVENT 0x3002 40 #define WIFI_SVR_CMD_STA_SUP_DISCONNECTION_EVENT 0x3003 41 #define WIFI_SVR_CMD_STA_NETWORK_CONNECTION_EVENT 0x3004 42 #define WIFI_SVR_CMD_STA_NETWORK_DISCONNECTION_EVENT 0x3005 43 #define WIFI_SVR_CMD_STA_WPS_START_EVENT 0x3006 44 #define WIFI_SVR_CMD_STA_WPS_CANCEL_EVENT 0x3007 45 #define WIFI_SVR_CMD_STA_WPS_FAILED_EVENT 0x3008 46 #define WIFI_SVR_CMD_STA_WPS_OVERLAP_EVENT 0x3009 47 #define WIFI_SVR_CMD_STA_WPS_TIMEOUT_EVNET 0x300A 48 #define WIFI_SVR_CMD_STA_WPS_WEP_PROHIBITED 0x300B 49 #define WIFI_SVR_CMD_STA_WPS_TKIP_ONLY_PROHIBITED 0x300C 50 #define WIFI_SVR_CMD_STA_WPS_AUTH_FAILURE 0x300D 51 #define WIFI_SVR_CMD_STA_WPS_OVERLAP_ERROR 0x300E 52 #define WIFI_SVR_CMD_STA_SUP_REQUEST_IDENTITY 0x300F 53 #define WIFI_SVR_CMD_STA_SUP_REQUEST_SIM_AUTH 0x3010 54 #define WIFI_SVR_CMD_STA_AUTHENTICATION_FAILURE_EVENT 0x3011 55 #define WIFI_SVR_CMD_STA_REASON_TKIP_ONLY_PROHIBITED 0x3012 56 #define WIFI_SVR_CMD_STA_REASON_WEP_PROHIBITED 0x3013 57 #define WIFI_SVR_CMD_STA_CONFIG_AUTH_FAILURE 0x3014 58 #define WIFI_SVR_CMD_STA_CONFIG_MULTIPLE_PBC_DETECTED 0x3015 59 #define WIFI_SVR_CMD_STA_WPA_STATE_CHANGE_EVENT 0x3016 60 #define WIFI_SVR_CMD_STA_WPA_PASSWD_WRONG_EVENT 0x3017 61 #define WIFI_SVR_CMD_STA_WPA_FULL_CONNECT_EVENT 0x3018 62 #define WIFI_SVR_CMD_STA_WPA_ASSOC_REJECT_EVENT 0x3019 63 #define WIFI_SVR_CMD_STA_BSSID_CHANGED_EVENT 0x301A 64 #define WIFI_SVR_CMD_STA_DHCP_RESULT_NOTIFY_EVENT 0x301B 65 66 #define WPA_BLOCK_LIST_CLEAR_EVENT 0x4001 67 68 #define BSSID_LEN 17 69 #define KEY_LEN 128 70 #define SSID_LEN 30 71 #define VALUE_LIMIT_MIN_RSSI (-100) 72 #define VALUE_LIMIT_MAX_RSSI (-55) 73 74 #define NETWORK_SELECTED_BY_THE_USER 1 75 #define NETWORK_SELECTED_FOR_CONNECTION_MANAGEMENT 0 76 77 const int NETWORK_24G_BAND = 1; 78 const int NETWORK_5G_BAND = 2; 79 #define BAND_2_G 1 80 #define BAND_5_G 2 81 82 typedef enum EnumStaNetState { 83 NETWORK_STATE_UNKNOWN, 84 NETWORK_STATE_WORKING, 85 NETWORK_CHECK_PORTAL, 86 NETWORK_STATE_NOWORKING, 87 NETWORK_STATE_BUTT, 88 } StaNetState; 89 90 using NetStateHandler = std::function<void(StaNetState netState, std::string portalUrl)>; 91 } // namespace Wifi 92 } // namespace OHOS 93 #endif /* OHOS_STA_DEFINE_H */ 94