| Promise< Array<[WifiScanInfo](#wifiscaninfo)> > | Promise used to return the scan result, which is a list of hotspots detected.|
| **Type**| **Description**|
| -------- | -------- |
| Promise< Array<[WifiScanInfo](#wifiscaninfo)> > | Promise used to return the hotspots detected.|
| callback | AsyncCallback< Array<[WifiScanInfo](#wifiscaninfo)>> | Yes| Callback invoked to return the result, which is a list of hotspots detected.|
| config | [WifiDeviceConfig](#WifiDeviceConfig) | Yes| WLAN configuration to add.|
**Return value**
| **Type**| **Description**|
| -------- | -------- |
| Promise<boolean> | Promise used to return the operation result. The value **true** indicates that the operation is successful; **false** indicates the opposite.|
| **Type**| **Description**|
| -------- | -------- |
| Promise<boolean> | Promise used to return the operation result. The value **true** indicates that the operation is successful; **false** indicates the opposite.|
## WifiDeviceConfig
...
...
@@ -174,120 +176,120 @@ Represents the WLAN configuration.
| config | [WifiDeviceConfig](#WifiDeviceConfig) | Yes| WLAN configuration to add.|
| callback | AsyncCallback<boolean> | Yes| Promise used to return the operation result. The value **true** indicates that the operation is successful; **false** indicates the opposite.|
| config | [WifiDeviceConfig](#WifiDeviceConfig) | Yes| WLAN configuration to add.|
| callback | AsyncCallback<boolean> | Yes| Callback used to return the operation result. The value **true** indicates that the operation is successful; **false** indicates the opposite.|
| Promise<boolean> | Promise used to return the operation result. The value **true** indicates that the operation is successful; **false** indicates the opposite.|
| **Type**| **Description**|
| -------- | -------- |
| Promise<boolean> | Promise used to return the operation result. The value **true** indicates that the operation is successful; **false** indicates the opposite.|
| config | [WifiDeviceConfig](#WifiDeviceConfig) | Yes| WLAN configuration to remove.|
| callback | AsyncCallback<boolean> | Yes| Promise used to return the operation result. The value **true** indicates that the operation is successful; **false** indicates the opposite.|
| callback | AsyncCallback<boolean> | Yes| Callback used to return the operation result. The value **true** indicates that the operation is successful; **false** indicates the opposite.|
## wifi.getSignalLevel
getSignalLevel(rssi: number, band: number): number
| callback | AsyncCallback< Array<[WifiP2pGroupInfo](#WifiP2pGroupInfo)>> | Yes| Callback invoked to return the P2P group information obtained.|
## WifiP2pGroupInfo<sup>8+</sup>
...
...
@@ -574,33 +605,63 @@ Enumerates the device states.
| type | string | Yes| Event type. The value is **wifiStateChange**.|
| callback | Callback<number> | No| Callback used to return the WLAN state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| type | string | Yes| Event type. The value is **wifiStateChange**.|
| callback | Callback<number> | No| Callback used to return the WLAN state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
**Example**
```js
...
...
@@ -850,10 +911,10 @@ Unregisters the WLAN state change events.
console.info("Receive power state change event: "+result);
}
// Register event
// Register an event.
wifi.on(WIFI_POWER_STATE,recvPowerNotifyFunc);
// Unregister event
// Unregister an event.
wifi.off(WIFI_POWER_STATE,recvPowerNotifyFunc);
```
...
...
@@ -869,10 +930,10 @@ Registers the WLAN connection state change events.
| type | string | Yes| Event type. The value is **wifiConnectionChange**.|
| callback | Callback<number> | No| Callback used to return the WLAN connection state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| type | string | Yes| Event type. The value is **wifiConnectionChange**.|
| callback | Callback<number> | No| Callback used to return 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>
...
...
@@ -910,10 +971,10 @@ Registers the WLAN scan state change events.
| type | string | Yes| Event type. The value is **wifiRssiChange**.|
| callback | Callback<number> | No| Callback used to return the RSSI, in dBm. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| type | string | Yes| Event type. The value is **wifiRssiChange**.|
| callback | Callback<number> | No| Callback used to return the RSSI, in dBm. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
## wifi.on('hotspotStateChange')<sup>7+</sup>
...
...
@@ -986,10 +1047,10 @@ Registers the hotspot state change events.
| type | string | Yes| Event type. The value is **hotspotStateChange**.|
| callback | Callback<number> | No| Callback used to return the hotspot state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| type | string | Yes| Event type. The value is **hotspotStateChange**.|
| callback | Callback<number> | No| Callback used to return the hotspot state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
## wifi.on('p2pStateChange')<sup>8+</sup>
...
...
@@ -1029,10 +1090,10 @@ Registers the P2P state change events.
| type | string | Yes| Event type. The value is **p2pStateChange**.|
| callback | Callback<number> | No| Callback used to return the P2P state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| type | string | Yes| Event type. The value is **p2pStateChange**.|
| callback | Callback<number> | No| Callback used to return the P2P state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
## wifi.on('p2pConnectionChange')<sup>8+</sup>
...
...
@@ -1072,10 +1133,10 @@ Registers the P2P connection state change events.
| type | string | Yes| Event type. The value is **p2pConnectionChange**.|
| callback | Callback<[WifiP2pLinkedInfo](#WifiP2pLinkedInfo)> | No| Callback used to return the P2P connection state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| type | string | Yes| Event type. The value is **p2pConnectionChange**.|
| callback | Callback<[WifiP2pLinkedInfo](#WifiP2pLinkedInfo)> | No| Callback used to return the P2P connection state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
## wifi.on('p2pDeviceChange')<sup>8+</sup>
...
...
@@ -1106,10 +1167,10 @@ Registers the P2P device state change events.
| type | string | Yes| Event type. The value is **p2pDeviceChange**.|
| callback | Callback<[WifiP2pDevice](#WifiP2pDevice)> | No| Callback used to return the P2P device state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| type | string | Yes| Event type. The value is **p2pDeviceChange**.|
| callback | Callback<[WifiP2pDevice](#WifiP2pDevice)> | No| Callback used to return the P2P device state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
## wifi.on('p2pPeerDeviceChange')<sup>8+</sup>
...
...
@@ -1140,10 +1201,10 @@ Registers the P2P peer device state change events.
| type | string | Yes| Event type. The value is **p2pPeerDeviceChange**.|
| callback | Callback<[WifiP2pDevice[]](#WifiP2pDevice)> | No| Callback used to return the P2P peer device state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| type | string | Yes| Event type. The value is **p2pPeerDeviceChange**.|
| callback | Callback<[WifiP2pDevice[]](#WifiP2pDevice)> | No| Callback used to return the P2P peer device state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| type | string | Yes| Event type. The value is **p2pPersistentGroupChange**.|
| callback | Callback<void> | No| Callback used to return the P2P persistent group state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| type | string | Yes| Event type. The value is **p2pPersistentGroupChange**.|
| callback | Callback<void> | No| Callback used to return the P2P persistent group state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| type | string | Yes| Event type. The value is **p2pDiscoveryChange**.|
| callback | Callback<number> | No| Callback used to return the state of the P2P discovered device. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| type | string | Yes| Event type. The value is **p2pDiscoveryChange**.|
| callback | Callback<number> | No| Callback used to return the P2P device discovery state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|