1/* 2 * Copyright (c) 2023 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/** 17 * @addtogroup Hostapd 18 * @{ 19 * 20 * @brief Provides APIs for the upper-layer WLAN service. 21 * 22 * You can use the APIs to enable or disable a WLAN hotspot, scan for hotspots, connect to a WLAN hotspot, 23 * manage WLAN chips, network devices, and power, and apply for, release, and move network data buffers. 24 * 25 * @since 4.1 26 * @version 1.0 27 */ 28 29/** 30 * @file IHostapdInterface.idl 31 * 32 * @brief Provides APIs to enable or disable a WLAN hotspot, scan for hotspots, connect to or disconnect from a WLAN hotspot, 33 * set the country code, and manage network devices. 34 * 35 * @since 4.1 36 * @version 1.0 37 */ 38 39/** 40 * @brief Defines the package path of the Hostapd module interface. 41 * 42 * @since 4.1 43 * @version 1.0 44 */ 45 46package ohos.hdi.wlan.hostapd.v1_0; 47 48import ohos.hdi.wlan.hostapd.v1_0.HostapdTypes; 49import ohos.hdi.wlan.hostapd.v1_0.IHostapdCallback; 50 51/** 52 * @brief Defines an interface for the upper-layer WLAN service. 53 * 54 * @since 4.1 55 * @version 1.0 56 */ 57 58interface IHostapdInterface { 59 /** 60 * @brief Start AP. 61 * 62 * @param ifName Indicates the NIC name. 63 * @param id - ap id. 64 * 65 * @return Returns <b>0</b> if the operation is successful. 66 * @return Returns a negative value if the operation fails. 67 * 68 * @since 4.1 69 * @version 1.0 70 */ 71 StartAp(); 72 73 /** 74 * @brief Stop AP. 75 * 76 * @param ifName Indicates the NIC name. 77 * @param id - ap id. 78 * 79 * @return Returns <b>0</b> if the operation is successful. 80 * @return Returns a negative value if the operation fails. 81 * 82 * @since 4.1 83 * @version 1.0 84 */ 85 StopAp(); 86 87 /** 88 * @brief Enable AP. 89 * 90 * @param ifName Indicates the NIC name. 91 * @param id - ap id. 92 * 93 * @return Returns <b>0</b> if the operation is successful. 94 * @return Returns a negative value if the operation fails. 95 * 96 * @since 4.1 97 * @version 1.0 98 */ 99 EnableAp([in] String ifName, [in] int id); 100 101 /** 102 * @brief Disable AP. 103 * 104 * @param ifName Indicates the NIC name. 105 * @param id - ap id. 106 * 107 * @return Returns <b>0</b> if the operation is successful. 108 * @return Returns a negative value if the operation fails. 109 * 110 * @since 4.1 111 * @version 1.0 112 */ 113 DisableAp([in] String ifName, [in] int id); 114 115 /** 116 * @brief Set the AP password. 117 * 118 * @param pass - Password. 119 * 120 * @return Returns <b>0</b> if the operation is successful. 121 * @return Returns a negative value if the operation fails. 122 * 123 * @since 4.1 124 * @version 1.0 125 */ 126 SetApPasswd([in] String ifName, [in] String pass, [in]int id); 127 128 /** 129 * @brief Set the AP Name. 130 * 131 * @param name - The SAP SSID. 132 * 133 * @return Returns <b>0</b> if the operation is successful. 134 * @return Returns a negative value if the operation fails. 135 * 136 * @since 4.1 137 * @version 1.0 138 */ 139 SetApName([in] String ifName, [in] String name, [in] int id); 140 141 /** 142 * @brief Set the AP securityType. 143 * 144 * @param securityType - The SAP security type, eg:wpa/wpa_psk etc. 145 * 146 * @return Returns <b>0</b> if the operation is successful. 147 * @return Returns a negative value if the operation fails. 148 * 149 * @since 4.1 150 * @version 1.0 151 */ 152 SetApWpaValue([in] String ifName, [in] int securityType, [in] int id); 153 154 /** 155 * @brief Set the AP bandwith. 156 * 157 * @param band - The SAP bandwith. 158 * 159 * @return Returns <b>0</b> if the operation is successful. 160 * @return Returns a negative value if the operation fails. 161 * 162 * @since 4.1 163 * @version 1.0 164 */ 165 SetApBand([in] String ifName, [in] int band, [in] int id); 166 167 /** 168 * @brief Set the AP need support protocol type. 169 * 170 * @param value - Hostapd config value. 171 * 172 * @return Returns <b>0</b> if the operation is successful. 173 * @return Returns a negative value if the operation fails. 174 * 175 * @since 4.1 176 * @version 1.0 177 */ 178 SetAp80211n([in] String ifName, [in] int value, [in] int id); 179 180 /** 181 * @brief Set AP Wmm mode. 182 * 183 * @param value - Enable or Disable Wmm. 184 * 185 * @return Returns <b>0</b> if the operation is successful. 186 * @return Returns a negative value if the operation fails. 187 * 188 * @since 4.1 189 * @version 1.0 190 */ 191 SetApWmm([in] String ifName, [in] int value, [in] int id); 192 193 /** 194 * @brief Set AP channel. 195 * 196 * @param channel - SAP channel. 197 * 198 * @return Returns <b>0</b> if the operation is successful. 199 * @return Returns a negative value if the operation fails. 200 * 201 * @since 4.1 202 * @version 1.0 203 */ 204 SetApChannel([in] String ifName, [in] int channel, [in] int id); 205 206 /** 207 * @brief Set AP max connection. 208 * 209 * @param maxConn - Set the maximum number of connected devices. 210 * 211 * @return Returns <b>0</b> if the operation is successful. 212 * @return Returns a negative value if the operation fails. 213 * 214 * @since 4.1 215 * @version 1.0 216 */ 217 SetApMaxConn([in] String ifName, [in] int maxConn, [in] int id); 218 219 /** 220 * @brief To set the blocklish filtering in AP mode to prohibit 221 * the MAC address connection. 222 * 223 * @param mac - Blocklisted MAC address. 224 * 225 * @return Returns <b>0</b> if the operation is successful. 226 * @return Returns a negative value if the operation fails. 227 * 228 * @since 4.1 229 * @version 1.0 230 */ 231 SetMacFilter([in] String ifName, [in] String mac, [in] int id); 232 233 /** 234 * @brief To set blocklist filtering in AP mode and delete a specified MAC 235 * address from the blocklist. 236 * 237 * @param mac - Blocklisted MAC address. 238 * 239 * @return Returns <b>0</b> if the operation is successful. 240 * @return Returns a negative value if the operation fails. 241 * 242 * @since 4.1 243 * @version 1.0 244 */ 245 DelMacFilter([in] String ifName, [in] String mac, [in] int id); 246 247 /** 248 * @brief Obtains information about all connected STAs. 249 * 250 * @param infos - Connected STA information array. 251 * @param size - Obtains the size of all sta information arrays and Size of the 252 * obtained sta information array. 253 * 254 * @return Returns <b>0</b> if the operation is successful. 255 * @return Returns a negative value if the operation fails. 256 * 257 * @since 4.1 258 * @version 1.0 259 */ 260 GetStaInfos([in] String ifName, [out] String buf, [in] int size, [in] int id); 261 262 /** 263 * @brief To disconnect the specified STA connection. 264 * 265 * @param mac - Disconnect the specified mac. 266 * 267 * @return Returns <b>0</b> if the operation is successful. 268 * @return Returns a negative value if the operation fails. 269 * 270 * @since 4.1 271 * @version 1.0 272 */ 273 DisassociateSta([in] String ifName, [in] String mac, [in] int id); 274 275 /** 276 * @brief Registers a callback to listen for asynchronous events. 277 * 278 * @param cbFunc Indicates the callback to register. 279 * @param ifName Indicates the NIC name. 280 * 281 * @return Returns <b>0</b> if the operation is successful. 282 * @return Returns a negative value if the operation fails. 283 * 284 * @since 4.1 285 * @version 1.0 286 */ 287 RegisterEventCallback([in] IHostapdCallback cbFunc, [in] String ifName); 288 289 /** 290 * @brief Unregisters a callback. 291 * 292 * @param cbFunc Indicates the callback to unregister. 293 * @param ifName Indicates the NIC name. 294 * 295 * @return Returns <b>0</b> if the operation is successful. 296 * @return Returns a negative value if the operation fails. 297 * 298 * @since 4.1 299 * @version 1.0 300 */ 301 UnregisterEventCallback([in] IHostapdCallback cbFunc, [in] String ifName); 302 303 /** 304 * @brief Used to process cmd of Hostapd 305 * 306 * @param ifName Indicates the NIC name. 307 * @param cmd Indicates command of HostApd from WifiHal 308 * 309 * @return Returns <b>0</b> if the operation is successful. 310 * @return Returns a negative value if the operation fails. 311 * 312 * @since 4.1 313 * @version 1.0 314 */ 315 HostApdShellCmd([in] String ifName, [in] String cmd); 316 } 317