提交 b47d0ace 编写于 作者: A Annie_wang

update docs

Signed-off-by: NAnnie_wang <annie.wangli@huawei.com>
上级 0a9ce317
# WLAN # WLAN
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/> > **NOTE**<br>
> 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. > 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.
...@@ -16,13 +16,11 @@ isWifiActive(): boolean ...@@ -16,13 +16,11 @@ isWifiActive(): boolean
Checks whether the WLAN is activated. Checks whether the WLAN is activated.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.STA
SystemCapability.Communication.WiFi.STA
- Return value **Return value**
| **Type**| **Description**| | **Type**| **Description**|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the WLAN is activated; returns **false** otherwise.| | boolean | Returns **true** if the WLAN is activated; returns **false** otherwise.|
...@@ -34,13 +32,11 @@ scan(): boolean ...@@ -34,13 +32,11 @@ scan(): boolean
Starts a scan for WLAN. Starts a scan for WLAN.
- Required permissions: **Required permissions**: ohos.permission.SET_WIFI_INFO and ohos.permission.LOCATION
ohos.permission.SET_WIFI_INFO and ohos.permission.LOCATION
- System capability: **System capability**: SystemCapability.Communication.WiFi.STA
SystemCapability.Communication.WiFi.STA
- Return value **Return value**
| **Type**| **Description**| | **Type**| **Description**|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the scan is successful; returns **false** otherwise.| | boolean | Returns **true** if the scan is successful; returns **false** otherwise.|
...@@ -52,13 +48,11 @@ getScanInfos(): Promise&lt;Array&lt;WifiScanInfo&gt;&gt; ...@@ -52,13 +48,11 @@ getScanInfos(): Promise&lt;Array&lt;WifiScanInfo&gt;&gt;
Obtains the scan result. This method uses a promise to return the result. Obtains the scan result. This method uses a promise to return the result.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO, ohos.permission.GET_WIFI_PEERS_MAC, or ohos.permission.LOCATION
ohos.permission.GET_WIFI_INFO, ohos.permission.GET_WIFI_PEERS_MAC, or ohos.permission.LOCATION
- System capability: **System capability**: SystemCapability.Communication.WiFi.STA
SystemCapability.Communication.WiFi.STA
- Return value **Return value**
| **Type**| **Description**| | **Type**| **Description**|
| -------- | -------- | | -------- | -------- |
| Promise&lt;&nbsp;Array&lt;[WifiScanInfo](#wifiscaninfo)&gt;&nbsp;&gt; | Promise used to return the scan result, which is a list of hotspots detected.| | Promise&lt;&nbsp;Array&lt;[WifiScanInfo](#wifiscaninfo)&gt;&nbsp;&gt; | Promise used to return the scan result, which is a list of hotspots detected.|
...@@ -70,18 +64,16 @@ getScanInfos(callback: AsyncCallback&lt;Array&lt;WifiScanInfo&gt;&gt;): void ...@@ -70,18 +64,16 @@ getScanInfos(callback: AsyncCallback&lt;Array&lt;WifiScanInfo&gt;&gt;): void
Obtains the scan result. This method uses an asynchronous callback to return the result. Obtains the scan result. This method uses an asynchronous callback to return the result.
- Required permissions: **Required permissions**: at least one of ohos.permission.GET_WIFI_INFO, ohos.permission.GET_WIFI_PEERS_MAC, and ohos.permission.LOCATION
ohos.permission.GET_WIFI_INFO, ohos.permission.GET_WIFI_PEERS_MAC, or ohos.permission.LOCATION
- System capability: **System capability**: SystemCapability.Communication.WiFi.STA
SystemCapability.Communication.WiFi.STA
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;&nbsp;Array&lt;[WifiScanInfo](#wifiscaninfo)&gt;&gt; | Yes| Callback invoked to return the result, which is a list of hotspots detected.| | callback | AsyncCallback&lt;&nbsp;Array&lt;[WifiScanInfo](#wifiscaninfo)&gt;&gt; | Yes| Callback invoked to return the result, which is a list of hotspots detected.|
- Example **Example**
```js ```js
import wifi from '@ohos.wifi'; import wifi from '@ohos.wifi';
...@@ -160,18 +152,18 @@ addUntrustedConfig(config: WifiDeviceConfig): Promise&lt;boolean&gt; ...@@ -160,18 +152,18 @@ addUntrustedConfig(config: WifiDeviceConfig): Promise&lt;boolean&gt;
Adds untrusted WLAN configuration. This method uses a promise to return the result. Adds untrusted WLAN configuration. This method uses a promise to return the result.
- Required permissions: **Required permissions**:
ohos.permission.SET_WIFI_INFO ohos.permission.SET_WIFI_INFO
- System capability: **System capability**:
SystemCapability.Communication.WiFi.STA SystemCapability.Communication.WiFi.STA
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| config | [WifiDeviceConfig](#WifiDeviceConfig) | Yes| WLAN configuration to add.| | config | [WifiDeviceConfig](#WifiDeviceConfig) | Yes| WLAN configuration to add.|
- Return value **Return value**
| **Type**| **Description**| | **Type**| **Description**|
| -------- | -------- | | -------- | -------- |
| Promise&lt;boolean&gt; | Promise used to return the operation result. The value **true** indicates that the operation is successful; **false** indicates the opposite.| | Promise&lt;boolean&gt; | Promise used to return the operation result. The value **true** indicates that the operation is successful; **false** indicates the opposite.|
...@@ -182,7 +174,7 @@ Represents the WLAN configuration. ...@@ -182,7 +174,7 @@ Represents the WLAN configuration.
| **Name**| **Type**| **Readable/Writable**| **Description**| | **Name**| **Type**| **Readable/Writable**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| ssid | string | Read only| Hotspot service set identifier (SSID), in UTF-8 format.| | ssid | string | Read only| Hotspot SSID, in UTF-8 format.|
| bssid | string | Read only| BSSID of the hotspot.| | bssid | string | Read only| BSSID of the hotspot.|
| preSharedKey | string | Read only| Private key of the hotspot.| | preSharedKey | string | Read only| Private key of the hotspot.|
| isHiddenSsid | boolean | Read only| Whether to hide the network.| | isHiddenSsid | boolean | Read only| Whether to hide the network.|
...@@ -195,13 +187,11 @@ addUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback&lt;boolean& ...@@ -195,13 +187,11 @@ addUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback&lt;boolean&
Adds untrusted WLAN configuration. This method uses an asynchronous callback to return the result. Adds untrusted WLAN configuration. This method uses an asynchronous callback to return the result.
- Required permissions: **Required permissions**: ohos.permission.SET_WIFI_INFO
ohos.permission.SET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.STA
SystemCapability.Communication.WiFi.STA
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| config | [WifiDeviceConfig](#WifiDeviceConfig) | Yes| WLAN configuration to add.| | config | [WifiDeviceConfig](#WifiDeviceConfig) | Yes| WLAN configuration to add.|
...@@ -214,18 +204,16 @@ removeUntrustedConfig(config: WifiDeviceConfig): Promise&lt;boolean&gt; ...@@ -214,18 +204,16 @@ removeUntrustedConfig(config: WifiDeviceConfig): Promise&lt;boolean&gt;
Removes untrusted WLAN configuration. This method uses a promise to return the result. Removes untrusted WLAN configuration. This method uses a promise to return the result.
- Required permissions: **Required permissions**: ohos.permission.SET_WIFI_INFO
ohos.permission.SET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.STA
SystemCapability.Communication.WiFi.STA
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| config | [WifiDeviceConfig](#WifiDeviceConfig) | Yes| WLAN configuration to remove.| | config | [WifiDeviceConfig](#WifiDeviceConfig) | Yes| WLAN configuration to remove.|
- Return value **Return value**
| **Type**| **Description**| | **Type**| **Description**|
| -------- | -------- | | -------- | -------- |
| Promise&lt;boolean&gt; | Promise used to return the operation result. The value **true** indicates that the operation is successful; **false** indicates the opposite.| | Promise&lt;boolean&gt; | Promise used to return the operation result. The value **true** indicates that the operation is successful; **false** indicates the opposite.|
...@@ -237,13 +225,11 @@ removeUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback&lt;boole ...@@ -237,13 +225,11 @@ removeUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback&lt;boole
Removes untrusted WLAN configuration. This method uses an asynchronous callback to return the result. Removes untrusted WLAN configuration. This method uses an asynchronous callback to return the result.
- Required permissions: **Required permissions**: ohos.permission.SET_WIFI_INFO
ohos.permission.SET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.STA
SystemCapability.Communication.WiFi.STA
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| config | [WifiDeviceConfig](#WifiDeviceConfig) | Yes| WLAN configuration to remove.| | config | [WifiDeviceConfig](#WifiDeviceConfig) | Yes| WLAN configuration to remove.|
...@@ -256,19 +242,17 @@ getSignalLevel(rssi: number, band: number): number ...@@ -256,19 +242,17 @@ getSignalLevel(rssi: number, band: number): number
Obtains the WLAN signal strength. Obtains the WLAN signal strength.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.STA
SystemCapability.Communication.WiFi.STA
- **Parameters** **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| rssi | number | Yes| Signal strength of the hotspot, in dBm.| | rssi | number | Yes| Signal strength of the hotspot, in dBm.|
| band | number | Yes| Frequency band of the WLAN AP.| | band | number | Yes| Frequency band of the WLAN AP.|
- Return value **Return value**
| **Type**| **Description**| | **Type**| **Description**|
| -------- | -------- | | -------- | -------- |
| number | Signal strength obtained. The value range is [0,&nbsp;4].| | number | Signal strength obtained. The value range is [0,&nbsp;4].|
...@@ -280,13 +264,11 @@ getLinkedInfo(): Promise&lt;WifiLinkedInfo&gt; ...@@ -280,13 +264,11 @@ getLinkedInfo(): Promise&lt;WifiLinkedInfo&gt;
Obtains WLAN connection information. This method uses a promise to return the result. Obtains WLAN connection information. This method uses a promise to return the result.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.STA
SystemCapability.Communication.WiFi.STA
- Return value **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;[WifiLinkedInfo](#WifiLinkedInfo)&gt; | Promise used to return the WLAN connection information obtained.| | Promise&lt;[WifiLinkedInfo](#WifiLinkedInfo)&gt; | Promise used to return the WLAN connection information obtained.|
...@@ -298,18 +280,16 @@ getLinkedInfo(callback: AsyncCallback&lt;WifiLinkedInfo&gt;): void ...@@ -298,18 +280,16 @@ getLinkedInfo(callback: AsyncCallback&lt;WifiLinkedInfo&gt;): void
Obtains WLAN connection information. This method uses a callback to return the result. Obtains WLAN connection information. This method uses a callback to return the result.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.STA
SystemCapability.Communication.WiFi.STA
- Parameters **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;[WifiLinkedInfo](#WifiLinkedInfo)&gt; | Yes| Callback invoked to return the WLAN connection information obtained.| | callback | AsyncCallback&lt;[WifiLinkedInfo](#WifiLinkedInfo)&gt; | Yes| Callback invoked to return the WLAN connection information obtained.|
- Example **Example**
```js ```js
import wifi from '@ohos.wifi'; import wifi from '@ohos.wifi';
...@@ -342,7 +322,7 @@ Represents the WLAN connection information. ...@@ -342,7 +322,7 @@ Represents the WLAN connection information.
| linkSpeed | number | Read only| Speed of the WLAN AP.| | linkSpeed | number | Read only| Speed of the WLAN AP.|
| frequency | number | Read only| Frequency of the WLAN AP.| | frequency | number | Read only| Frequency of the WLAN AP.|
| isHidden | boolean | Read only| Whether the WLAN AP is hidden.| | isHidden | boolean | Read only| Whether the WLAN AP is hidden.|
| isRestricted | boolean | Read only| Whether data volume is restricted at the WLAN AP.| | isRestricted | boolean | Read only| Whether to restrict data volume at the WLAN AP.|
| macAddress | string | Read only| MAC address of the device.| | macAddress | string | Read only| MAC address of the device.|
| ipAddress | number | Read only| IP address of the device that sets up the WLAN connection.| | ipAddress | number | Read only| IP address of the device that sets up the WLAN connection.|
| connState | [ConnState](#ConnState) | Read only| WLAN connection state.| | connState | [ConnState](#ConnState) | Read only| WLAN connection state.|
...@@ -370,13 +350,11 @@ isConnected(): boolean ...@@ -370,13 +350,11 @@ isConnected(): boolean
Checks whether the WLAN is connected. Checks whether the WLAN is connected.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.STA
SystemCapability.Communication.WiFi.STA
- Return value **Return value**
| **Type**| **Description**| | **Type**| **Description**|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the WLAN is connected; returns **false** otherwise.| | boolean | Returns **true** if the WLAN is connected; returns **false** otherwise.|
...@@ -388,35 +366,35 @@ isFeatureSupported(featureId: number): boolean ...@@ -388,35 +366,35 @@ isFeatureSupported(featureId: number): boolean
Checks whether the device supports the specified WLAN feature. Checks whether the device supports the specified WLAN feature.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.Core
SystemCapability.Communication.WiFi.Core
**Parameters**
- **Parameters**
| **Name**| **Type**| Mandatory| **Description**| | **Name**| **Type**| Mandatory| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| featureId | number | Yes| Feature ID.| | featureId | number | Yes| Feature ID.|
- Return value **Return value**
| **Type**| **Description**| | **Type**| **Description**|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the feature is supported; returns **false** otherwise.| | boolean | Returns **true** if the feature is supported; returns **false** otherwise.|
- Enumerates the WLAN features. **Feature IDs**
| Value| Description|
| -------- | -------- | | Value| Description|
| 0x0001 | WLAN infrastructure mode| | -------- | -------- |
| 0x0002 | 5 GHz bandwidth| | 0x0001 | WLAN infrastructure mode|
| 0x0004 | Generic Advertisement Service (GAS)/Access Network Query Protocol (ANQP) feature| | 0x0002 | 5 GHz bandwidth|
| 0x0008 | Wi-Fi Direct| | 0x0004 | Generic Advertisement Service (GAS)/Access Network Query Protocol (ANQP) feature|
| 0x0010 | SoftAP| | 0x0008 | Wi-Fi Direct|
| 0x0040 | Wi-Fi AWare| | 0x0010 | SoftAP|
| 0x8000 | WLAN AP/STA concurrency| | 0x0040 | Wi-Fi AWare|
| 0x8000000 | WPA3 Personal (WPA-3 SAE)| | 0x8000 | WLAN AP/STA concurrency|
| 0x10000000 | WPA3-Enterprise&nbsp;Suite-B | | 0x8000000 | WPA3 Personal (WPA-3 SAE)|
| 0x20000000 | Enhanced open feature| | 0x10000000 | WPA3-Enterprise&nbsp;Suite-B |
| 0x20000000 | Enhanced open feature|
## wifi.getIpInfo<sup>7+</sup> ## wifi.getIpInfo<sup>7+</sup>
...@@ -425,13 +403,11 @@ getIpInfo(): IpInfo ...@@ -425,13 +403,11 @@ getIpInfo(): IpInfo
Obtains IP information. Obtains IP information.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.STA
SystemCapability.Communication.WiFi.STA
- Return value **Return value**
| **Type**| **Description**| | **Type**| **Description**|
| -------- | -------- | | -------- | -------- |
| [IpInfo](#IpInfo) | IP information obtained.| | [IpInfo](#IpInfo) | IP information obtained.|
...@@ -458,13 +434,11 @@ getCountryCode(): string ...@@ -458,13 +434,11 @@ getCountryCode(): string
Obtains the country code. Obtains the country code.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.Core
SystemCapability.Communication.WiFi.Core
- Return value **Return value**
| **Type**| **Description**| | **Type**| **Description**|
| -------- | -------- | | -------- | -------- |
| string | Country code obtained.| | string | Country code obtained.|
...@@ -476,13 +450,11 @@ getP2pLinkedInfo(): Promise&lt;WifiP2pLinkedInfo&gt; ...@@ -476,13 +450,11 @@ getP2pLinkedInfo(): Promise&lt;WifiP2pLinkedInfo&gt;
Obtains peer-to-peer (P2P) connection information. This method uses a promise to return the result. Obtains peer-to-peer (P2P) connection information. This method uses a promise to return the result.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.P2P
SystemCapability.Communication.WiFi.P2P
- Return value **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;[WifiP2pLinkedInfo](#WifiP2pLinkedInfo)&gt; | Promise used to return the P2P connection information obtained.| | Promise&lt;[WifiP2pLinkedInfo](#WifiP2pLinkedInfo)&gt; | Promise used to return the P2P connection information obtained.|
...@@ -494,13 +466,11 @@ getP2pLinkedInfo(callback: AsyncCallback&lt;WifiP2pLinkedInfo&gt;): void ...@@ -494,13 +466,11 @@ getP2pLinkedInfo(callback: AsyncCallback&lt;WifiP2pLinkedInfo&gt;): void
Obtains P2P connection information. This method uses a callback to return the result. Obtains P2P connection information. This method uses a callback to return the result.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.P2P
SystemCapability.Communication.WiFi.P2P
- Parameters **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;[WifiP2pLinkedInfo](#WifiP2pLinkedInfo)&gt; | Yes| Callback used to return the P2P connection information obtained.| | callback | AsyncCallback&lt;[WifiP2pLinkedInfo](#WifiP2pLinkedInfo)&gt; | Yes| Callback used to return the P2P connection information obtained.|
...@@ -533,13 +503,11 @@ getCurrentGroup(): Promise&lt;WifiP2pGroupInfo&gt; ...@@ -533,13 +503,11 @@ getCurrentGroup(): Promise&lt;WifiP2pGroupInfo&gt;
Obtains the current P2P group information. This method uses a promise to return the result. Obtains the current P2P group information. This method uses a promise to return the result.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION
ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION
- System capability: **System capability**: SystemCapability.Communication.WiFi.P2P
SystemCapability.Communication.WiFi.P2P
- Return value **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;[WifiP2pGroupInfo](#WifiP2pGroupInfo)&gt; | Promise used to return the P2P group information obtained.| | Promise&lt;[WifiP2pGroupInfo](#WifiP2pGroupInfo)&gt; | Promise used to return the P2P group information obtained.|
...@@ -551,13 +519,11 @@ getCurrentGroup(callback: AsyncCallback&lt;WifiP2pGroupInfo&gt;): void ...@@ -551,13 +519,11 @@ getCurrentGroup(callback: AsyncCallback&lt;WifiP2pGroupInfo&gt;): void
Obtains the P2P group information. This method uses an asynchronous callback to return the result. Obtains the P2P group information. This method uses an asynchronous callback to return the result.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION
ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION
- System capability: **System capability**: SystemCapability.Communication.WiFi.P2P
SystemCapability.Communication.WiFi.P2P
- Parameters **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;[WifiP2pGroupInfo](#WifiP2pGroupInfo)&gt; | Yes| Callback used to return the P2P group information obtained.| | callback | AsyncCallback&lt;[WifiP2pGroupInfo](#WifiP2pGroupInfo)&gt; | Yes| Callback used to return the P2P group information obtained.|
...@@ -610,13 +576,11 @@ getP2pPeerDevices(): Promise&lt;WifiP2pDevice[]&gt; ...@@ -610,13 +576,11 @@ getP2pPeerDevices(): Promise&lt;WifiP2pDevice[]&gt;
Obtains the list of peer devices in a P2P connection. This method uses a promise to return the result. Obtains the list of peer devices in a P2P connection. This method uses a promise to return the result.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION
ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION
- System capability: **System capability**: SystemCapability.Communication.WiFi.P2P
SystemCapability.Communication.WiFi.P2P
- Return value **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;[WifiP2pDevice[]](#WifiP2pDevice)&gt; | Promise used to return the peer device list obtained.| | Promise&lt;[WifiP2pDevice[]](#WifiP2pDevice)&gt; | Promise used to return the peer device list obtained.|
...@@ -628,13 +592,11 @@ getP2pPeerDevices(callback: AsyncCallback&lt;WifiP2pDevice[]&gt;): void ...@@ -628,13 +592,11 @@ getP2pPeerDevices(callback: AsyncCallback&lt;WifiP2pDevice[]&gt;): void
Obtains the list of peer devices in a P2P connection. This method uses an asynchronous callback to return the result. Obtains the list of peer devices in a P2P connection. This method uses an asynchronous callback to return the result.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION
ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION
- System capability: **System capability**: SystemCapability.Communication.WiFi.P2P
SystemCapability.Communication.WiFi.P2P
- Parameters **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;[WifiP2pDevice[]](#WifiP2pDevice)&gt; | Yes| Callback used to return the peer device list obtained.| | callback | AsyncCallback&lt;[WifiP2pDevice[]](#WifiP2pDevice)&gt; | Yes| Callback used to return the peer device list obtained.|
...@@ -646,18 +608,17 @@ createGroup(config: WifiP2PConfig): boolean; ...@@ -646,18 +608,17 @@ createGroup(config: WifiP2PConfig): boolean;
Creates a P2P group. Creates a P2P group.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
**System capability**: SystemCapability.Communication.WiFi.P2P
- System capability: **Parameters**
SystemCapability.Communication.WiFi.P2P
- **Parameters**
| **Name**| **Type**| Mandatory| **Description**| | **Name**| **Type**| Mandatory| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| config | [WifiP2PConfig](#WifiP2PConfig) | Yes| Group configuration.| | config | [WifiP2PConfig](#WifiP2PConfig) | Yes| Group configuration.|
- Return value **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -691,13 +652,11 @@ removeGroup(): boolean; ...@@ -691,13 +652,11 @@ removeGroup(): boolean;
Removes a P2P group. Removes a P2P group.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.P2P
SystemCapability.Communication.WiFi.P2P
- Return value **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -709,24 +668,23 @@ p2pConnect(config: WifiP2PConfig): boolean; ...@@ -709,24 +668,23 @@ p2pConnect(config: WifiP2PConfig): boolean;
Sets up a P2P connection. Sets up a P2P connection.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION
ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION
- System capability: **System capability**: SystemCapability.Communication.WiFi.P2P
SystemCapability.Communication.WiFi.P2P
**Parameters**
- **Parameters**
| **Name**| **Type**| Mandatory| **Description**| | **Name**| **Type**| Mandatory| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| config | [WifiP2PConfig](#WifiP2PConfig) | Yes| Connection configuration.| | config | [WifiP2PConfig](#WifiP2PConfig) | Yes| Connection configuration.|
- Return value **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
- Example **Example**
```js ```js
import wifi from '@ohos.wifi'; import wifi from '@ohos.wifi';
...@@ -799,13 +757,11 @@ p2pCancelConnect(): boolean; ...@@ -799,13 +757,11 @@ p2pCancelConnect(): boolean;
Cancels this P2P connection. Cancels this P2P connection.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.P2P
SystemCapability.Communication.WiFi.P2P
- Return value **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -817,13 +773,11 @@ startDiscoverDevices(): boolean; ...@@ -817,13 +773,11 @@ startDiscoverDevices(): boolean;
Starts to discover devices. Starts to discover devices.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION
ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION
- System capability: **System capability**: SystemCapability.Communication.WiFi.P2P
SystemCapability.Communication.WiFi.P2P
- Return value **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -835,13 +789,11 @@ stopDiscoverDevices(): boolean; ...@@ -835,13 +789,11 @@ stopDiscoverDevices(): boolean;
Stops discovering devices. Stops discovering devices.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.P2P
SystemCapability.Communication.WiFi.P2P
- Return value **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -853,25 +805,24 @@ on(type: "wifiStateChange", callback: Callback&lt;number&gt;): void ...@@ -853,25 +805,24 @@ on(type: "wifiStateChange", callback: Callback&lt;number&gt;): void
Registers the WLAN state change events. Registers the WLAN state change events.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.STA
SystemCapability.Communication.WiFi.STA
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **wifiStateChange**.| | type | string | Yes| Event type. The value is **wifiStateChange**.|
| callback | Callback&lt;number&gt; | Yes| Callback invoked to return the WLAN state.| | callback | Callback&lt;number&gt; | Yes| Callback invoked to return the WLAN state.|
- Enumerates the WLAN states. **WLAN states**
| **Value**| **Description**|
| -------- | -------- | | **Value**| **Description**|
| 0 | Deactivated| | -------- | -------- |
| 1 | Activated| | 0 | Deactivated|
| 2 | Activating| | 1 | Activated|
| 3 | Deactivating| | 2 | Activating|
| 3 | Deactivating|
## wifi.off('wifiStateChange')<sup>7+</sup> ## wifi.off('wifiStateChange')<sup>7+</sup>
...@@ -880,19 +831,17 @@ off(type: "wifiStateChange", callback?: Callback&lt;number&gt;): void ...@@ -880,19 +831,17 @@ off(type: "wifiStateChange", callback?: Callback&lt;number&gt;): void
Unregisters the WLAN state change events. Unregisters the WLAN state change events.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.STA
SystemCapability.Communication.WiFi.STA
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **wifiStateChange**.| | type | string | Yes| Event type. The value is **wifiStateChange**.|
| callback | Callback&lt;number&gt; | No| Callback used to return the WLAN state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| | callback | Callback&lt;number&gt; | 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 **Example**
```js ```js
import wifi from '@ohos.wifi'; import wifi from '@ohos.wifi';
...@@ -915,23 +864,22 @@ on(type: "wifiConnectionChange", callback: Callback&lt;number&gt;): void ...@@ -915,23 +864,22 @@ on(type: "wifiConnectionChange", callback: Callback&lt;number&gt;): void
Registers the WLAN connection state change events. Registers the WLAN connection state change events.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.STA
SystemCapability.Communication.WiFi.STA
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **wifiConnectionChange**.| | type | string | Yes| Event type. The value is **wifiConnectionChange**.|
| callback | Callback&lt;number&gt; | Yes| Callback invoked to return the WLAN connection state.| | callback | Callback&lt;number&gt; | Yes| Callback invoked to return the WLAN connection state.|
- Enumerates the WLAN connection states. **WLAN connection states**
| **Value**| **Description**|
| -------- | -------- | | **Value**| **Description**|
| 0 | Disconnected| | -------- | -------- |
| 1 | Connected| | 0 | Disconnected|
| 1 | Connected|
## wifi.off('wifiConnectionChange')<sup>7+</sup> ## wifi.off('wifiConnectionChange')<sup>7+</sup>
...@@ -940,17 +888,15 @@ off(type: "wifiConnectionChange", callback?: Callback&lt;number&gt;): void ...@@ -940,17 +888,15 @@ off(type: "wifiConnectionChange", callback?: Callback&lt;number&gt;): void
Unregisters the WLAN connection state change events. Unregisters the WLAN connection state change events.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.STA
SystemCapability.Communication.WiFi.STA
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **wifiConnectionChange**.| | type | string | Yes| Event type. The value is **wifiConnectionChange**.|
| callback | Callback&lt;number&gt; | No| Callback used to report the WLAN connection state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| | callback | Callback&lt;number&gt; | 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> ## wifi.on('wifiScanStateChange')<sup>7+</sup>
...@@ -959,23 +905,22 @@ on(type: "wifiScanStateChange", callback: Callback&lt;number&gt;): void ...@@ -959,23 +905,22 @@ on(type: "wifiScanStateChange", callback: Callback&lt;number&gt;): void
Registers the WLAN scan state change events. Registers the WLAN scan state change events.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.STA
SystemCapability.Communication.WiFi.STA
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **wifiScanStateChange**.| | type | string | Yes| Event type. The value is **wifiScanStateChange**.|
| callback | Callback&lt;number&gt; | Yes| Callback invoked to return the WLAN scan state.| | callback | Callback&lt;number&gt; | Yes| Callback invoked to return the WLAN scan state.|
- Enumerates the WLAN scan states. **WLAN scan states**
| **Value**| **Description**|
| -------- | -------- | | **Value**| **Description**|
| 0 | Scan failed| | -------- | -------- |
| 1 | Scan successful| | 0 | Scan failed|
| 1 | Scan successful|
## wifi.off('wifiScanStateChange')<sup>7+</sup> ## wifi.off('wifiScanStateChange')<sup>7+</sup>
...@@ -984,13 +929,11 @@ off(type: "wifiScanStateChange", callback?: Callback&lt;number&gt;): void ...@@ -984,13 +929,11 @@ off(type: "wifiScanStateChange", callback?: Callback&lt;number&gt;): void
Unregisters the WLAN scan state change events. Unregisters the WLAN scan state change events.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.STA
SystemCapability.Communication.WiFi.STA
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -1002,15 +945,13 @@ Unregisters the WLAN scan state change events. ...@@ -1002,15 +945,13 @@ Unregisters the WLAN scan state change events.
on(type: "wifiRssiChange", callback: Callback&lt;number&gt;): void on(type: "wifiRssiChange", callback: Callback&lt;number&gt;): void
Registers the RSSI state change events. Registers the RSSI change events.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.STA
SystemCapability.Communication.WiFi.STA
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **wifiRssiChange**.| | type | string | Yes| Event type. The value is **wifiRssiChange**.|
...@@ -1021,15 +962,13 @@ Registers the RSSI state change events. ...@@ -1021,15 +962,13 @@ Registers the RSSI state change events.
off(type: "wifiRssiChange", callback?: Callback&lt;number&gt;): void off(type: "wifiRssiChange", callback?: Callback&lt;number&gt;): void
Unregisters the RSSI state change events. Unregisters the RSSI change events.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.STA
SystemCapability.Communication.WiFi.STA
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **wifiRssiChange**.| | type | string | Yes| Event type. The value is **wifiRssiChange**.|
...@@ -1042,25 +981,24 @@ on(type: "hotspotStateChange", callback: Callback&lt;number&gt;): void ...@@ -1042,25 +981,24 @@ on(type: "hotspotStateChange", callback: Callback&lt;number&gt;): void
Registers the hotspot state change events. Registers the hotspot state change events.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.AP.Core
SystemCapability.Communication.WiFi.AP.Core
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **hotspotStateChange**.| | type | string | Yes| Event type. The value is **hotspotStateChange**.|
| callback | Callback&lt;number&gt; | Yes| Callback invoked to return the hotspot state.| | callback | Callback&lt;number&gt; | Yes| Callback invoked to return the hotspot state.|
- Enumerates the hotspot states. **Hotspot states**
| **Value**| **Description**|
| -------- | -------- | | **Value**| **Description**|
| 0 | Deactivated| | -------- | -------- |
| 1 | Activated| | 0 | Deactivated|
| 2 | Activating| | 1 | Activated|
| 3 | Deactivating| | 2 | Activating|
| 3 | Deactivating|
## wifi.off('hotspotStateChange')<sup>7+</sup> ## wifi.off('hotspotStateChange')<sup>7+</sup>
...@@ -1069,13 +1007,11 @@ off(type: "hotspotStateChange", callback?: Callback&lt;number&gt;): void ...@@ -1069,13 +1007,11 @@ off(type: "hotspotStateChange", callback?: Callback&lt;number&gt;): void
Unregisters the hotspot state change events. Unregisters the hotspot state change events.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.AP.Core
SystemCapability.Communication.WiFi.AP.Core
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **hotspotStateChange**.| | type | string | Yes| Event type. The value is **hotspotStateChange**.|
...@@ -1086,28 +1022,27 @@ Unregisters the hotspot state change events. ...@@ -1086,28 +1022,27 @@ Unregisters the hotspot state change events.
on(type: "p2pStateChange", callback: Callback&lt;number&gt;): void on(type: "p2pStateChange", callback: Callback&lt;number&gt;): void
Registers the P2P status change events. Registers the P2P state change events.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.P2P
SystemCapability.Communication.WiFi.P2P
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **p2pStateChange**.| | type | string | Yes| Event type. The value is **p2pStateChange**.|
| callback | Callback&lt;number&gt; | Yes| Callback invoked to return the P2P state.| | callback | Callback&lt;number&gt; | Yes| Callback invoked to return the P2P state.|
- Enumerates the P2P states. **P2P states**
| **Value**| **Description**|
| -------- | -------- | | **Value**| **Description**|
| 1 | Available| | -------- | -------- |
| 2 | Opening| | 1 | Available|
| 3 | Opened| | 2 | Opening|
| 4 | Closing| | 3 | Opened|
| 5 | Closed| | 4 | Closing|
| 5 | Closed|
## wifi.off('p2pStateChange')<sup>8+</sup> ## wifi.off('p2pStateChange')<sup>8+</sup>
...@@ -1115,13 +1050,11 @@ off(type: "p2pStateChange", callback?: Callback&lt;number&gt;): void ...@@ -1115,13 +1050,11 @@ off(type: "p2pStateChange", callback?: Callback&lt;number&gt;): void
Unregisters the P2P state change events. Unregisters the P2P state change events.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.P2P
SystemCapability.Communication.WiFi.P2P
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **p2pStateChange**.| | type | string | Yes| Event type. The value is **p2pStateChange**.|
...@@ -1134,13 +1067,11 @@ on(type: "p2pConnectionChange", callback: Callback&lt;WifiP2pLinkedInfo&gt;): vo ...@@ -1134,13 +1067,11 @@ on(type: "p2pConnectionChange", callback: Callback&lt;WifiP2pLinkedInfo&gt;): vo
Registers the P2P connection state change events. Registers the P2P connection state change events.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.P2P
SystemCapability.Communication.WiFi.P2P
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **p2pConnectionChange**.| | type | string | Yes| Event type. The value is **p2pConnectionChange**.|
...@@ -1153,13 +1084,11 @@ off(type: "p2pConnectionChange", callback?: Callback&lt;WifiP2pLinkedInfo&gt;): ...@@ -1153,13 +1084,11 @@ off(type: "p2pConnectionChange", callback?: Callback&lt;WifiP2pLinkedInfo&gt;):
Unregisters the P2P connection state change events. Unregisters the P2P connection state change events.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.P2P
SystemCapability.Communication.WiFi.P2P
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **p2pConnectionChange**.| | type | string | Yes| Event type. The value is **p2pConnectionChange**.|
...@@ -1172,13 +1101,11 @@ on(type: "p2pDeviceChange", callback: Callback&lt;WifiP2pDevice&gt;): void ...@@ -1172,13 +1101,11 @@ on(type: "p2pDeviceChange", callback: Callback&lt;WifiP2pDevice&gt;): void
Registers the P2P device state change events. Registers the P2P device state change events.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION
ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION
- System capability: **System capability**: SystemCapability.Communication.WiFi.P2P
SystemCapability.Communication.WiFi.P2P
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **p2pDeviceChange**.| | type | string | Yes| Event type. The value is **p2pDeviceChange**.|
...@@ -1191,13 +1118,11 @@ off(type: "p2pDeviceChange", callback?: Callback&lt;WifiP2pDevice&gt;): void ...@@ -1191,13 +1118,11 @@ off(type: "p2pDeviceChange", callback?: Callback&lt;WifiP2pDevice&gt;): void
Unregisters the P2P device state change events. Unregisters the P2P device state change events.
- Required permissions: **Required permissions**: ohos.permission.LOCATION
ohos.permission.LOCATION
- System capability: **System capability**: SystemCapability.Communication.WiFi.P2P
SystemCapability.Communication.WiFi.P2P
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **p2pDeviceChange**.| | type | string | Yes| Event type. The value is **p2pDeviceChange**.|
...@@ -1210,13 +1135,11 @@ on(type: "p2pPeerDeviceChange", callback: Callback&lt;WifiP2pDevice[]&gt;): void ...@@ -1210,13 +1135,11 @@ on(type: "p2pPeerDeviceChange", callback: Callback&lt;WifiP2pDevice[]&gt;): void
Registers the P2P peer device state change events. Registers the P2P peer device state change events.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION
ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION
- System capability: **System capability**: SystemCapability.Communication.WiFi.P2P
SystemCapability.Communication.WiFi.P2P
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **p2pPeerDeviceChange**.| | type | string | Yes| Event type. The value is **p2pPeerDeviceChange**.|
...@@ -1229,13 +1152,11 @@ off(type: "p2pPeerDeviceChange", callback?: Callback&lt;WifiP2pDevice[]&gt;): vo ...@@ -1229,13 +1152,11 @@ off(type: "p2pPeerDeviceChange", callback?: Callback&lt;WifiP2pDevice[]&gt;): vo
Unregisters the P2P peer device state change events. Unregisters the P2P peer device state change events.
- Required permissions: **Required permissions**: ohos.permission.LOCATION
ohos.permission.LOCATION
- System capability: **System capability**: SystemCapability.Communication.WiFi.P2P
SystemCapability.Communication.WiFi.P2P
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **p2pPeerDeviceChange**.| | type | string | Yes| Event type. The value is **p2pPeerDeviceChange**.|
...@@ -1248,13 +1169,11 @@ on(type: "p2pPersistentGroupChange", callback: Callback&lt;void&gt;): void ...@@ -1248,13 +1169,11 @@ on(type: "p2pPersistentGroupChange", callback: Callback&lt;void&gt;): void
Registers the P2P persistent group state change events. Registers the P2P persistent group state change events.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.P2P
SystemCapability.Communication.WiFi.P2P
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **p2pPersistentGroupChange**.| | type | string | Yes| Event type. The value is **p2pPersistentGroupChange**.|
...@@ -1267,13 +1186,11 @@ off(type: "p2pPersistentGroupChange", callback?: Callback&lt;void&gt;): void ...@@ -1267,13 +1186,11 @@ off(type: "p2pPersistentGroupChange", callback?: Callback&lt;void&gt;): void
Unregisters the P2P persistent group state change events. Unregisters the P2P persistent group state change events.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.P2P
SystemCapability.Communication.WiFi.P2P
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **p2pPersistentGroupChange**.| | type | string | Yes| Event type. The value is **p2pPersistentGroupChange**.|
...@@ -1286,23 +1203,22 @@ on(type: "p2pDiscoveryChange", callback: Callback&lt;number&gt;): void ...@@ -1286,23 +1203,22 @@ on(type: "p2pDiscoveryChange", callback: Callback&lt;number&gt;): void
Registers the P2P discovered device state change events. Registers the P2P discovered device state change events.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.P2P
SystemCapability.Communication.WiFi.P2P
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **p2pDiscoveryChange**.| | type | string | Yes| Event type. The value is **p2pDiscoveryChange**.|
| callback | Callback&lt;number&gt; | Yes| Callback invoked to return the state of the P2P discovered device.| | callback | Callback&lt;number&gt; | Yes| Callback invoked to return the state of the P2P discovered device.|
- Enumerates the states of P2P discovered devices. **P2P discovered device states**
| **Value**| **Description**|
| -------- | -------- | | **Value**| **Description**|
| 0 | Initial state| | -------- | -------- |
| 1 | Discovered| | 0 | Initial state|
| 1 | Discovered|
## wifi.off('p2pDiscoveryChange')<sup>8+</sup> ## wifi.off('p2pDiscoveryChange')<sup>8+</sup>
...@@ -1311,13 +1227,11 @@ off(type: "p2pDiscoveryChange", callback?: Callback&lt;number&gt;): void ...@@ -1311,13 +1227,11 @@ off(type: "p2pDiscoveryChange", callback?: Callback&lt;number&gt;): void
Unregisters the P2P discovered device state change events. Unregisters the P2P discovered device state change events.
- Required permissions: **Required permissions**: ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability: **System capability**: SystemCapability.Communication.WiFi.P2P
SystemCapability.Communication.WiFi.P2P
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **p2pDiscoveryChange**.| | type | string | Yes| Event type. The value is **p2pDiscoveryChange**.|
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册