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 64 #define WPA_BLOCK_LIST_CLEAR_EVENT 0x4001 65 66 #define BSSID_LEN 17 67 #define KEY_LEN 128 68 #define SSID_LEN 30 69 #define VALUE_LIMIT_MIN_RSSI (-100) 70 #define VALUE_LIMIT_MAX_RSSI (-55) 71 72 #define NETWORK_SELECTED_BY_THE_USER 1 73 #define NETWORK_SELECTED_FOR_CONNECTION_MANAGEMENT 0 74 75 const int NETWORK_24G_BAND = 1; 76 const int NETWORK_5G_BAND = 2; 77 #define BAND_2_G 1 78 #define BAND_5_G 2 79 80 typedef enum EnumStaNetState { 81 NETWORK_STATE_UNKNOWN, 82 NETWORK_STATE_WORKING, 83 NETWORK_CHECK_PORTAL, 84 NETWORK_STATE_NOWORKING, 85 NETWORK_STATE_BUTT, 86 } StaNetState; 87 88 using NetStateHandler = std::function<void(StaNetState netState, std::string portalUrl)>; 89 } // namespace Wifi 90 } // namespace OHOS 91 #endif /* OHOS_STA_DEFINE_H */ 92