1 /* 2 * Copyright (C) 2021 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_HAL_STRUCT_H 17 #define OHOS_WIFI_HAL_STRUCT_H 18 19 #include "wifi_hal_define.h" 20 #include <stdbool.h> 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 typedef struct WifiChip { 26 int chip; 27 } WifiChip; 28 29 typedef struct WifiIface { 30 int index; 31 int type; 32 char name[WIFI_IFACE_NAME_MAXLEN]; 33 char macAddr[WIFI_MAC_LENGTH + 1]; 34 } WifiIface; 35 36 typedef enum ScanStyle { 37 SCAN_TYPE_LOW_SPAN = 0, 38 SCAN_TYPE_LOW_POWER = 1, 39 SCAN_TYPE_HIGH_ACCURACY = 2, 40 SCAN_TYPE_PNO = 3, 41 SCAN_TYPE_INVALID = 0XFF 42 } ScanStyle; 43 44 typedef struct ScanSettings { 45 int freqSize; 46 int *freqs; 47 int hiddenSsidSize; 48 char **hiddenSsid; 49 ScanStyle scanStyle; 50 51 /* Only available for PNO scan */ 52 int savedPnoSsidSize; 53 char **savedPnoSsid; 54 int pnoScanInterval; 55 int minPnoRssi2Dot4Ghz; 56 int minPnoRssi5Ghz; 57 int isStartPnoScan; 58 } ScanSettings; 59 60 typedef struct ScanInfoElem { 61 unsigned int id; 62 char *content; 63 int size; 64 } ScanInfoElem; 65 66 typedef enum AntEnum { 67 NETWORK_PRIVATE = 0, 68 NETWORK_PRIVATEWITHGUEST = 1, 69 NETWORK_CHARGEABLEPUBLIC = 2, 70 NETWORK_FREEPUBLIC = 3, 71 NETWORK_PERSONAL = 4, 72 NETWORK_EMERGENCYONLY = 5, 73 NETWORK_RESVD6 = 6, 74 NETWORK_RESVD7 = 7, 75 NETWORK_RESVD8 = 8, 76 NETWORK_RESVD9 = 9, 77 NETWORK_RESVD10 = 10, 78 NETWORK_RESVD11 = 11, 79 NETWORK_RESVD12 = 12, 80 NETWORK_RESVD13 = 13, 81 NETWORK_TESTOREXPERIMENTAL = 14, 82 NETWORK_WILDCARD = 15, 83 NETWORK_ANT_INVALID = 16 84 } Ant; 85 86 typedef struct ScanInfo { 87 char ssid[WIFI_SSID_LENGTH]; 88 char bssid[WIFI_BSSID_LENGTH]; 89 int freq; 90 int channelWidth; 91 int centerFrequency0; 92 int centerFrequency1; 93 ScanInfoElem *infoElems; 94 int ieSize; 95 int64_t features; 96 int siglv; 97 char flags[WIFI_SCAN_INFO_CAPABILITY_LENGTH]; 98 int64_t timestamp; 99 Ant ant; 100 int isVhtInfoExist; 101 int isHtInfoExist; 102 int isHeInfoExist; 103 int isErpExist; 104 int maxRates; 105 int extMaxRates; 106 bool isHiLinkNetwork; 107 } ScanInfo; 108 109 typedef struct WifiNetworkInfo { 110 int id; 111 char ssid[WIFI_SSID_LENGTH]; 112 char bssid[WIFI_BSSID_LENGTH]; 113 char flags[WIFI_NETWORK_FLAGS_LENGTH]; 114 } WifiNetworkInfo; 115 116 typedef struct PnoScanSettings { 117 int scanInterval; 118 int minRssi2Dot4Ghz; 119 int minRssi5Ghz; 120 int freqSize; 121 int *freqs; 122 int hiddenSsidSize; 123 char **hiddenSsid; 124 int savedSsidSize; 125 char **savedSsid; 126 } PnoScanSettings; 127 128 typedef struct HostapdConfig { 129 char ssid[WIFI_SSID_LENGTH]; 130 int32_t ssidLen; 131 char preSharedKey[WIFI_AP_PASSWORD_LENGTH]; 132 int32_t preSharedKeyLen; 133 int32_t securityType; 134 int32_t band; 135 int32_t channel; 136 int32_t maxConn; 137 } HostapdConfig; 138 139 typedef struct SetNetworkConfig { 140 DeviceConfigType cfgParam; /* Setting parameters. */ 141 char cfgValue[WIFI_NETWORK_CONFIG_VALUE_LENGTH]; /* Parameter value. */ 142 } SetNetworkConfig; 143 144 typedef struct GetNetworkConfig { 145 int networkId; 146 char param[WIFI_NETWORK_CONFIG_NAME_LENGTH]; 147 char value[WIFI_NETWORK_CONFIG_VALUE_LENGTH]; 148 } GetNetworkConfig; 149 150 typedef struct WifiWpsParam { 151 int anyFlag; 152 int multiAp; 153 char bssid[WIFI_BSSID_LENGTH]; 154 char pinCode[WIFI_PIN_CODE_LENGTH + 1]; 155 } WifiWpsParam; 156 157 typedef struct WifiRoamCapability { 158 int maxBlocklistSize; 159 int maxTrustlistSize; 160 } WifiRoamCapability; 161 162 typedef struct WpaSignalInfo { 163 int signal; /* RSSI */ 164 int txrate; /* Bitrate */ 165 int rxrate; /* Bitrate */ 166 int noise; 167 int frequency; 168 int txPackets; 169 int rxPackets; 170 int snr; 171 int chload; 172 int ulDelay; 173 int txBytes; 174 int rxBytes; 175 int txFailed; 176 } WpaSignalInfo; 177 #ifdef __cplusplus 178 } 179 #endif 180 #endif