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_IDL_IWIFI_STA_IFACE_H 17 #define OHOS_IDL_IWIFI_STA_IFACE_H 18 19 #include <stdbool.h> 20 #include <stdint.h> 21 #include "wifi_error_no.h" 22 #include "i_wifi_event_callback.h" 23 #include "i_wifi_struct.h" 24 #include "wifi_error_no.h" 25 26 #ifdef __cplusplus 27 extern "C" { 28 #endif 29 30 /** 31 * @Description Sets the Wi-Fi event callback function. 32 * 33 * @param callback 34 */ 35 void SetWifiEventCallback(IWifiEventCallback callback); 36 37 /** 38 * @Description Obtains the Wi-Fi event callback structure. 39 * 40 * @return IWifiEventCallback* 41 */ 42 IWifiEventCallback *GetWifiEventCallback(void); 43 44 /** 45 * @Description Obtaining the STA Support Capability. 46 * 47 * @param capabilities 48 * @return WifiErrorNo 49 */ 50 WifiErrorNo GetStaCapabilities(int32_t *capabilities); 51 52 /** 53 * @Description Obtaining the MAC Address of a STA. 54 * 55 * @param mac - Mac address. 56 * @param lenMac - Size of the memory to which the MAC address points. 57 * @return WifiErrorNo 58 */ 59 WifiErrorNo GetDeviceMacAddress(unsigned char *mac, int *lenMac); 60 61 /** 62 * @Description Obtains the frequencies supported by a specified frequency band. 63 * 64 * @param band - Band type. 65 * @param frequencies - Numeric group pointer of the int type. 66 * @param size - Size of the memory to which the frequencies point and the 67 * number of obtained data. 68 * @return WifiErrorNo 69 */ 70 WifiErrorNo GetFrequencies(int32_t band, int *frequencies, int32_t *size); 71 72 /** 73 * @Description Sets the MAC address of the Wi-Fi connection. 74 * 75 * @param mac - Mac address. 76 * @param lenMac - Mac string length. 77 * @return WifiErrorNo 78 */ 79 WifiErrorNo SetAssocMacAddr(unsigned char *mac, int lenMac); 80 81 /** 82 * @Description Sets the MAC address for Wi-Fi scanning. 83 * 84 * @param mac - Mac address. 85 * @param lenMac - Mac string length. 86 * @return WifiErrorNo 87 */ 88 WifiErrorNo SetScanningMacAddress(unsigned char *mac, int lenMac); 89 90 /** 91 * @Description Disconnect the BSSID of the last roaming subscriber. 92 * 93 * @param mac - Mac address. 94 * @param lenMac - Mac string length. 95 * @return WifiErrorNo 96 */ 97 WifiErrorNo DeauthLastRoamingBssid(unsigned char *mac, int lenMac); 98 99 /** 100 * @Description Get total supported feature. 101 * 102 * @param feature 103 * @return WifiErrorNo 104 */ 105 WifiErrorNo GetSupportFeature(long *feature); 106 107 /** 108 * @Description Send instructions to the Wi-Fi driver or chip. 109 * 110 * @param ifname 111 * @param cmdId 112 * @param buf 113 * @param bufSize 114 * @return WifiErrorNo 115 */ 116 WifiErrorNo RunCmd(const char *ifname, int32_t cmdId, unsigned char *buf, int32_t bufSize); 117 118 /** 119 * @Description Set the Wi-Fi transmit power. 120 * 121 * @param power 122 * @return WifiErrorNo 123 */ 124 WifiErrorNo SetWifiTxPower(int32_t power); 125 126 /** 127 * @Description Deleting a Network. 128 * 129 * @param networkId 130 * @return WifiErrorNo 131 */ 132 WifiErrorNo RemoveNetwork(int networkId); 133 134 /** 135 * @Description Add a network. If the network is successfully added, the 136 * HAL returns the network ID. 137 * 138 * @param networkId 139 * @return WifiErrorNo 140 */ 141 WifiErrorNo AddNetwork(int *networkId); 142 143 /** 144 * @Description Enable a network. 145 * 146 * @param networkId 147 * @return WifiErrorNo 148 */ 149 WifiErrorNo EnableNetwork(int networkId); 150 151 /** 152 * @Description Disable a network. 153 * 154 * @param networkId 155 * @return WifiErrorNo 156 */ 157 WifiErrorNo DisableNetwork(int networkId); 158 159 /** 160 * @Description Set the Network object 161 * 162 * @param networkId 163 * @param confs 164 * @param size 165 * @return WifiErrorNo 166 */ 167 WifiErrorNo SetNetwork(int networkId, SetNetworkConfig *confs, int size); 168 169 /** 170 * @Description WpaGetNetwork Info. 171 * 172 * @param confs 173 * @return WifiErrorNo 174 */ 175 WifiErrorNo WpaGetNetwork(GetNetworkConfig *confs); 176 177 /** 178 * @Description Save the network. 179 * 180 * @return WifiErrorNo 181 */ 182 WifiErrorNo SaveNetworkConfig(void); 183 184 /** 185 * @Description Start Scanning. 186 * 187 * @param settings 188 * @return WifiErrorNo 189 */ 190 WifiErrorNo StartScan(const ScanSettings *settings); 191 192 /** 193 * @Description Obtain the scanning result, the caller needs to release the return 194 * pointer if it is not NULL 195 * 196 * @param results 197 * @param size 198 * @return ScanResult pointer 199 */ 200 ScanInfo* GetScanInfos(int *size); 201 202 /** 203 * @Description Initiate PNO scanning. 204 * 205 * @param settings 206 * @return WifiErrorNo 207 */ 208 WifiErrorNo StartPnoScan(const PnoScanSettings *settings); 209 210 /** 211 * @Description Stop PNO Scanning. 212 * 213 * @return WifiErrorNo 214 */ 215 WifiErrorNo StopPnoScan(void); 216 217 /** 218 * @Description Registering the Sta Event Callback. 219 * 220 * @param callback 221 * @return WifiErrorNo 222 */ 223 WifiErrorNo RegisterStaEventCallback(IWifiEventCallback callback); 224 225 /** 226 * @Description Enabling WPS in PBC Mode. 227 * 228 * @param param 229 * @return WifiErrorNo 230 */ 231 WifiErrorNo StartWpsPbcMode(WifiWpsParam *param); 232 233 /** 234 * @Description Enable PIN mode WPS. 235 * 236 * @param param 237 * @param pinCode 238 * @return WifiErrorNo 239 */ 240 WifiErrorNo StartWpsPinMode(WifiWpsParam *param, int *pinCode); 241 242 /** 243 * @Description Close wps. 244 * 245 * @return WifiErrorNo 246 */ 247 WifiErrorNo StopWps(void); 248 249 /** 250 * @Description Obtains the roaming support capability. 251 * 252 * @param capability 253 * @return WifiErrorNo 254 */ 255 WifiErrorNo GetRoamingCapabilities(WifiRoamCapability *capability); 256 257 /** 258 * @Description Setting Roaming Configurations. 259 * 260 * @param blocklist 261 * @param blocksize 262 * @param trustlist 263 * @param trustsize 264 * @return WifiErrorNo 265 */ 266 WifiErrorNo SetRoamConfig(char **blocklist, int blocksize, char **trustlist, int trustsize); 267 268 /** 269 * @Description Wpa_s disable/enable(0/1) automatic reconnection. 270 * 271 * @param enable 272 * @return WifiErrorNo 273 */ 274 WifiErrorNo WpaAutoConnect(int enable); 275 276 /** 277 * @Description Clearing the wpa Blocklist. 278 * 279 * @return WifiErrorNo 280 */ 281 WifiErrorNo WpaBlocklistClear(void); 282 283 /** 284 * @Description Obtaining the Network List. 285 * 286 * @param networkList 287 * @param size 288 * @return WifiErrorNo 289 */ 290 WifiErrorNo GetNetworkList(WifiNetworkInfo *infos, int *size); 291 292 /** 293 * @Description Get current connect signal info, rssi, linkspeed, noise ... 294 * 295 * @param endBssid - peer end bssid, i.e. linked ap's bssid 296 * @param info - signal info 297 * @return WifiErrorNo 298 */ 299 WifiErrorNo GetConnectSignalInfo(const char *endBssid, WpaSignalInfo *info); 300 301 /** 302 * @Description send suspend mode for wpa. 303 * 304 * @param mode: true for suspend, false for resume. 305 * @return WifiErrorNo 306 */ 307 WifiErrorNo SetSuspendMode(bool mode); 308 #ifdef __cplusplus 309 } 310 #endif 311 #endif 312