The **WLAN** module provides basic wireless local area network (WLAN) functions, peer-to-peer (P2P) functions, and WLAN message notification services. It allows applications to communicate with other devices over WLAN.
> **NOTE**
>
> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...
...
@@ -99,7 +97,7 @@ Obtains the scan result. This API uses a promise to return the result.
| **Type**| **Description**|
| -------- | -------- |
| Promise< Array<[WifiScanInfo](#wifiscaninfo)> > | Promise used to return the detected hotspots.|
| Promise< Array<[WifiScanInfo](#wifiscaninfo)> > | Promise used to return the detected hotspots.|
## wifi.getScanInfos
...
...
@@ -253,17 +251,17 @@ Represents the WLAN configuration.
| isHiddenSsid | boolean | Yes| No| Whether the network is hidden.|
| creatorUid | number | Yes| No| ID of the creator.<br>**System API**: This is a system API.|
| disableReason | number | Yes| No| Reason for disabling WLAN.<br>**System API**: This is a system API.|
| disableReason | number | Yes| No| Reason for disabling WLAN.<br>**System API**: This is a system API.|
| netId | number | Yes| No| Network ID.<br>**System API**: This is a system API.|
| randomMacType | number | Yes| No| Random MAC type.<br>**System API**: This is a system API.|
| randomMacAddr | string | Yes| No| Random MAC address.<br>**System API**: This is a system API.|
| ipType | [IpType](#iptype7) | Yes| No| IP address type.<br>**System API**: This is a system API.|
| staticIp | [IpConfig](#ipconfig7) | Yes| No| Static IP address configuration.<br>**System API**: This is a system API.|
| staticIp | [IpConfig](#ipconfig7) | Yes| No| Static IP address configuration.<br>**System API**: This is a system API.|
## IpType<sup>7+</sup>
Enumerate the IP address types.
Enumerates the IP address types.
**System API**: This is a system API.
...
...
@@ -333,7 +331,7 @@ Adds the configuration of an untrusted network. This API uses a promise to retur
| **Type**| **Description**|
| -------- | -------- |
| Promise<boolean> | Promise used to return the result. If the operation is successful, **true** is returned; otherwise, **false** is returned.|
| Promise<boolean> | Promise used to return the result. If the operation is successful, **true** is returned; otherwise, **false** is returned.|
## wifi.addUntrustedConfig<sup>7+</sup>
...
...
@@ -374,7 +372,7 @@ Removes the configuration of an untrusted network. This API uses a promise to re
| **Type**| **Description**|
| -------- | -------- |
| Promise<boolean> | Promise used to return the result. If the operation is successful, **true** is returned; otherwise, **false** is returned.|
| Promise<boolean> | Promise used to return the result. If the operation is successful, **true** is returned; otherwise, **false** is returned.|
## wifi.removeUntrustedConfig<sup>7+</sup>
...
...
@@ -428,7 +426,7 @@ Connects to the specified network.
**System API**: This is a system API.
**Required permissions**: ohos.permission.SET_WIFI_INFO, ohos.permission.SET_WIFI_CONFIG, and ohos.permissio.MANAGE_WIFI_CONNECTION (available only to system applications)
**Required permissions**: ohos.permission.SET_WIFI_INFO, ohos.permission.SET_WIFI_CONFIG, and ohos.permission.MANAGE_WIFI_CONNECTION (available only to system applications)
**System capability**:
SystemCapability.Communication.WiFi.STA
...
...
@@ -553,7 +551,7 @@ Represents the WLAN connection information.
| type | string | Yes| Event type. The value is **wifiStateChange**.|
| callback | Callback<number> | No| Callback for the WLAN state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| callback | Callback<number> | No| Callback for the WLAN state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
**Example**
```js
...
...
@@ -1615,7 +1613,7 @@ Unregisters the WLAN connection state change events.
| type | string | Yes| Event type. The value is **wifiConnectionChange**.|
| callback | Callback<number> | No| Callback for the WLAN connection state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| callback | Callback<number> | No| Callback for the WLAN connection state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
## wifi.on('wifiScanStateChange')<sup>7+</sup>
...
...
@@ -1695,7 +1693,56 @@ Unregisters the RSSI change events.
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **wifiRssiChange**.|
| callback | Callback<number> | No| Callback for the RSSI. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| type | string | Yes| Event type. The value is **streamChange**. |
| callback | Callback<number> | Yes| Callback invoked to return the Wi-Fi stream change, which can be any of the following values:<br>- **0**: No.<br>- **1**: Download.<br>- **2**: Upload.<br>- **3**: Bidirectional. |
| type | string | Yes| Event type. The value is **streamChange**. |
| callback | Callback<number> | Yes| Callback invoked to return the Wi-Fi stream change, which can be any of the following values:<br>- **0**: No.<br>- **1**: Download.<br>- **2**: Upload.<br>- **3**: Bidirectional. |
@@ -1741,6 +1788,105 @@ Unregisters the hotspot state change events.
| type | string | Yes| Event type. The value is **hotspotStateChange**.|
| callback | Callback<number> | No| Callback for the hotspot state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|