From 6ef93e84947a539f9d22a62e630197aa296221c5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AD=99=E6=B5=9A=E4=BA=88?=
Date: Wed, 6 Aug 2025 10:59:46 +0800
Subject: [PATCH 1/4] add overload
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: 孙浚予
---
api/@ohos.wifiManager.d.ts | 763 +++++++++++++++++++++++++++++++------
1 file changed, 640 insertions(+), 123 deletions(-)
diff --git a/api/@ohos.wifiManager.d.ts b/api/@ohos.wifiManager.d.ts
index 32577605a6..8125e78e82 100644
--- a/api/@ohos.wifiManager.d.ts
+++ b/api/@ohos.wifiManager.d.ts
@@ -601,7 +601,7 @@ declare namespace wifiManager {
*/
function getSignalLevel(rssi: int, band: int): int;
- /**
+ /**
* Obtain connection information about the Wi-Fi connection. If does't have the permission of ohos.permission.GET_WIFI_PEERS_MAC, return random bssid.
* @permission ohos.permission.GET_WIFI_INFO
* @returns { Promise } Returns Wi-Fi linked information.
@@ -624,11 +624,26 @@ declare namespace wifiManager {
* @syscap SystemCapability.Communication.WiFi.STA
* @crossplatform
* @atomicservice
- * @since arkts {'1.1':'12', '1.2':'20'}
- * @arkts 1.1&1.2
+ * @since 12
*/
function getLinkedInfo(): Promise;
-
+
+ /**
+ * Obtain connection information about the Wi-Fi connection. If does't have the permission of ohos.permission.GET_WIFI_PEERS_MAC, return random bssid.
+ * @permission ohos.permission.GET_WIFI_INFO
+ * @returns { Promise } Returns Wi-Fi linked information.
+ * @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2501000 - Operation failed.
+ * @throws {BusinessError} 2501001 - Wi-Fi STA disabled.
+ * @syscap SystemCapability.Communication.WiFi.STA
+ * @crossplatform
+ * @atomicservice
+ * @since 20
+ * @arkts 1.2
+ */
+ function getLinkedInfoReturnsPromise(): Promise;
+
/**
* Obtain multiple Wi-Fi connection information when Wi-Fi linked in MLO(Muti-Link Operation) state.
* If does't have the permission of ohos.permission.GET_WIFI_PEERS_MAC, return random bssid.
@@ -657,6 +672,7 @@ declare namespace wifiManager {
* @syscap SystemCapability.Communication.WiFi.STA
* @since 9
*/
+
/**
* Obtain connection information about the Wi-Fi connection.
* @permission ohos.permission.GET_WIFI_INFO
@@ -669,11 +685,33 @@ declare namespace wifiManager {
* @throws {BusinessError} 2501001 - Wi-Fi STA disabled.
* @syscap SystemCapability.Communication.WiFi.STA
* @crossplatform
- * @since arkts {'1.1':'12', '1.2':'20'}
- * @arkts 1.1&1.2
+ * @since 12
*/
function getLinkedInfo(callback: AsyncCallback): void;
+ /**
+ * Obtain connection information about the Wi-Fi connection.
+ * @permission ohos.permission.GET_WIFI_INFO
+ * @param { AsyncCallback } callback - Indicates callback of function.
+ * @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified.
+ * 2. Incorrect parameter types.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2501000 - Operation failed.
+ * @throws {BusinessError} 2501001 - Wi-Fi STA disabled.
+ * @syscap SystemCapability.Communication.WiFi.STA
+ * @crossplatform
+ * @since 20
+ * @arkts 1.2
+ */
+ function getLinkedInfoWithCallback(callback: AsyncCallback): void;
+
+ /**
+ * @since 20
+ * @arkts 1.2
+ */
+ overload getLinkedInfo { getLinkedInfoReturnsPromise, getLinkedInfoWithCallback };
+
/**
* Obtain connection information about the Wi-Fi connection.this apireturns the result syncchronously.
* If does't have the permission of ohos.permission.GET_WIFI_PEERS_MAC, return random bssid.
@@ -1596,7 +1634,7 @@ declare namespace wifiManager {
* When the service exits, call off(type: 'wifiStateChange', callback?: Callback<number>) to unregister the callback registered.
* @permission ohos.permission.GET_WIFI_INFO
* @param { 'wifiStateChange' } type - event name.
- * @param { Callback } callback - the callback of on, 0: inactive, 1: active, 2: activating, 3: de-activating
+ * @param { Callback } callback - the callback of on, 0: inactive, 1: active, 2: activating, 3: de-activating
* @throws {BusinessError} 201 - Permission denied.
* @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
@@ -1605,10 +1643,26 @@ declare namespace wifiManager {
* @syscap SystemCapability.Communication.WiFi.STA
* @crossplatform
* @atomicservice
- * @since arkts {'1.1':'12', '1.2':'20'}
- * @arkts 1.1&1.2
+ * @since 12
+ */
+ function on(type: 'wifiStateChange', callback: Callback): void;
+
+ /**
+ * Subscribe Wi-Fi status change events.
+ * When the service exits, call off(type: 'wifiStateChange', callback?: Callback<int>) to unregister the callback registered.
+ * @permission ohos.permission.GET_WIFI_INFO
+ * @param { 'wifiStateChange' } type - event name.
+ * @param { Callback } callback - the callback of on, 0: inactive, 1: active, 2: activating, 3: de-activating
+ * @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2501000 - Operation failed.
+ * @syscap SystemCapability.Communication.WiFi.STA
+ * @crossplatform
+ * @atomicservice
+ * @since 20
+ * @arkts 1.2
*/
- function on(type: 'wifiStateChange', callback: Callback): void;
+ function onWifiStateChange(type: 'wifiStateChange', callback: Callback): void;
/**
* Unsubscribe Wi-Fi status change events.
@@ -1632,7 +1686,7 @@ declare namespace wifiManager {
* All callback functions will be deregistered If there is no specific callback parameter.
* @permission ohos.permission.GET_WIFI_INFO
* @param { 'wifiStateChange' } type - event name.
- * @param { Callback } callback - the callback of off
+ * @param { Callback } callback - the callback of off
* @throws {BusinessError} 201 - Permission denied.
* @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
@@ -1641,10 +1695,27 @@ declare namespace wifiManager {
* @syscap SystemCapability.Communication.WiFi.STA
* @crossplatform
* @atomicservice
- * @since arkts {'1.1':'12', '1.2':'20'}
- * @arkts 1.1&1.2
+ * @since 12
+ */
+ function off(type: 'wifiStateChange', callback?: Callback): void;
+
+ /**
+ * Unsubscribe Wi-Fi status change events.
+ *
+ * All callback functions will be deregistered If there is no specific callback parameter.
+ * @permission ohos.permission.GET_WIFI_INFO
+ * @param { 'wifiStateChange' } type - event name.
+ * @param { Callback } callback - the callback of off
+ * @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2501000 - Operation failed.
+ * @syscap SystemCapability.Communication.WiFi.STA
+ * @crossplatform
+ * @atomicservice
+ * @since 20
+ * @arkts 1.2
*/
- function off(type: 'wifiStateChange', callback?: Callback): void;
+ function offWifiStateChange(type: 'wifiStateChange', callback?: Callback): void;
/**
* Subscribe Wi-Fi connection change events.
@@ -1666,7 +1737,7 @@ declare namespace wifiManager {
* When the service exits, call off(type: 'wifiConnectionChange', callback?: Callback<number>) to unregister the callback registered.
* @permission ohos.permission.GET_WIFI_INFO
* @param { 'wifiConnectionChange' } type - event name.
- * @param { Callback } callback - the callback of on, 0: disconnected, 1: connected
+ * @param { Callback } callback - the callback of on, 0: disconnected, 1: connected
* @throws {BusinessError} 201 - Permission denied.
* @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
@@ -1675,10 +1746,26 @@ declare namespace wifiManager {
* @syscap SystemCapability.Communication.WiFi.STA
* @crossplatform
* @atomicservice
- * @since arkts {'1.1':'12', '1.2':'20'}
- * @arkts 1.1&1.2
+ * @since 12
+ */
+ function on(type: 'wifiConnectionChange', callback: Callback): void;
+
+ /**
+ * Subscribe Wi-Fi connection change events.
+ * When the service exits, call off(type: 'wifiConnectionChange', callback?: Callback<int>) to unregister the callback registered.
+ * @permission ohos.permission.GET_WIFI_INFO
+ * @param { 'wifiConnectionChange' } type - event name.
+ * @param { Callback } callback - the callback of on, 0: disconnected, 1: connected
+ * @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2501000 - Operation failed.
+ * @syscap SystemCapability.Communication.WiFi.STA
+ * @crossplatform
+ * @atomicservice
+ * @since 20
+ * @arkts 1.2
*/
- function on(type: 'wifiConnectionChange', callback: Callback): void;
+ function onWifiConnectionChange(type: 'wifiConnectionChange', callback: Callback): void;
/**
* Unsubscribe Wi-Fi connection change events.
@@ -1700,7 +1787,7 @@ declare namespace wifiManager {
* All callback functions will be deregistered If there is no specific callback parameter.
* @permission ohos.permission.GET_WIFI_INFO
* @param { 'wifiConnectionChange' } type - event name.
- * @param { Callback } callback - the callback of off
+ * @param { Callback } callback - the callback of off
* @throws {BusinessError} 201 - Permission denied.
* @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
@@ -1709,10 +1796,26 @@ declare namespace wifiManager {
* @syscap SystemCapability.Communication.WiFi.STA
* @crossplatform
* @atomicservice
- * @since arkts {'1.1':'12', '1.2':'20'}
- * @arkts 1.1&1.2
+ * @since 12
+ */
+ function off(type: 'wifiConnectionChange', callback?: Callback): void;
+
+ /**
+ * Unsubscribe Wi-Fi connection change events.
+ * All callback functions will be deregistered If there is no specific callback parameter.
+ * @permission ohos.permission.GET_WIFI_INFO
+ * @param { 'wifiConnectionChange' } type - event name.
+ * @param { Callback } callback - the callback of off
+ * @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2501000 - Operation failed.
+ * @syscap SystemCapability.Communication.WiFi.STA
+ * @crossplatform
+ * @atomicservice
+ * @since 20
+ * @arkts 1.2
*/
- function off(type: 'wifiConnectionChange', callback?: Callback): void;
+ function offWifiConnectionChange(type: 'wifiConnectionChange', callback?: Callback): void;
/**
* Subscribe Wi-Fi scan status change events.
@@ -1734,7 +1837,7 @@ declare namespace wifiManager {
* When the service exits, call off(type: 'wifiScanStateChange', callback?: Callback<number>) to unregister the callback registered.
* @permission ohos.permission.GET_WIFI_INFO
* @param { 'wifiScanStateChange' } type - event name.
- * @param { Callback } callback - the callback of on, 0: scan fail, 1: scan success
+ * @param { Callback } callback - the callback of on, 0: scan fail, 1: scan success
* @throws {BusinessError} 201 - Permission denied.
* @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
@@ -1742,10 +1845,25 @@ declare namespace wifiManager {
* @throws {BusinessError} 2501000 - Operation failed.
* @syscap SystemCapability.Communication.WiFi.STA
* @atomicservice
- * @since arkts {'1.1':'12', '1.2':'20'}
- * @arkts 1.1&1.2
+ * @since 12
*/
- function on(type: 'wifiScanStateChange', callback: Callback): void;
+ function on(type: 'wifiScanStateChange', callback: Callback): void;
+
+ /**
+ * Subscribe Wi-Fi scan status change events.
+ * When the service exits, call off(type: 'wifiScanStateChange', callback?: Callback<int>) to unregister the callback registered.
+ * @permission ohos.permission.GET_WIFI_INFO
+ * @param { 'wifiScanStateChange' } type - event name.
+ * @param { Callback } callback - the callback of on, 0: scan fail, 1: scan success
+ * @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2501000 - Operation failed.
+ * @syscap SystemCapability.Communication.WiFi.STA
+ * @atomicservice
+ * @since 20
+ * @arkts 1.2
+ */
+ function onWifiScanStateChange(type: 'wifiScanStateChange', callback: Callback): void;
/**
* Unsubscribe Wi-Fi scan status change events.
@@ -1767,7 +1885,7 @@ declare namespace wifiManager {
* All callback functions will be deregistered If there is no specific callback parameter.
* @permission ohos.permission.GET_WIFI_INFO
* @param { 'wifiScanStateChange' } type - event name.
- * @param { Callback } callback - the callback of off
+ * @param { Callback } callback - the callback of off
* @throws {BusinessError} 201 - Permission denied.
* @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
@@ -1775,27 +1893,72 @@ declare namespace wifiManager {
* @throws {BusinessError} 2501000 - Operation failed.
* @syscap SystemCapability.Communication.WiFi.STA
* @atomicservice
- * @since arkts {'1.1':'12', '1.2':'20'}
- * @arkts 1.1&1.2
+ * @since 12
+ */
+ function off(type: 'wifiScanStateChange', callback?: Callback): void;
+
+ /**
+ * Unsubscribe Wi-Fi scan status change events.
+ * All callback functions will be deregistered If there is no specific callback parameter.
+ * @permission ohos.permission.GET_WIFI_INFO
+ * @param { 'wifiScanStateChange' } type - event name.
+ * @param { Callback } callback - the callback of off
+ * @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2501000 - Operation failed.
+ * @syscap SystemCapability.Communication.WiFi.STA
+ * @atomicservice
+ * @since 20
+ * @arkts 1.2
*/
- function off(type: 'wifiScanStateChange', callback?: Callback): void;
+ function offWifiScanStateChange(type: 'wifiScanStateChange', callback?: Callback): void;
/**
* Subscribe Wi-Fi rssi change events.
* When the service exits, call off(type: 'wifiRssiChange', callback?: Callback<number>) to unregister the callback registered.
* @permission ohos.permission.GET_WIFI_INFO
* @param { 'wifiRssiChange' } type - event name.
+ * @param { Callback } callback - the callback of on
+ * @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
+ * 2. Incorrect parameter types.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2501000 - Operation failed.
+ * @syscap SystemCapability.Communication.WiFi.STA
+ * @since 9
+ */
+ function on(type: 'wifiRssiChange', callback: Callback): void;
+
+ /**
+ * Subscribe Wi-Fi rssi change events.
+ * When the service exits, call off(type: 'wifiRssiChange', callback?: Callback<int>) to unregister the callback registered.
+ * @permission ohos.permission.GET_WIFI_INFO
+ * @param { 'wifiRssiChange' } type - event name.
* @param { Callback } callback - the callback of on
* @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2501000 - Operation failed.
+ * @syscap SystemCapability.Communication.WiFi.STA
+ * @since 20
+ * @arkts 1.2
+ */
+ function onWifiRssiChange(type: 'wifiRssiChange', callback: Callback): void;
+
+ /**
+ * Unsubscribe Wi-Fi rssi change events.
+ * All callback functions will be deregistered If there is no specific callback parameter.
+ * @permission ohos.permission.GET_WIFI_INFO
+ * @param { 'wifiRssiChange' } type - event name.
+ * @param { Callback } callback - the callback of off
+ * @throws {BusinessError} 201 - Permission denied.
* @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* @throws {BusinessError} 801 - Capability not supported.
* @throws {BusinessError} 2501000 - Operation failed.
* @syscap SystemCapability.Communication.WiFi.STA
- * @since arkts {'1.1':'9', '1.2':'20'}
- * @arkts 1.1&1.2
+ * @since 9
*/
- function on(type: 'wifiRssiChange', callback: Callback): void;
+ function off(type: 'wifiRssiChange', callback?: Callback): void;
/**
* Unsubscribe Wi-Fi rssi change events.
@@ -1804,15 +1967,30 @@ declare namespace wifiManager {
* @param { 'wifiRssiChange' } type - event name.
* @param { Callback } callback - the callback of off
* @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2501000 - Operation failed.
+ * @syscap SystemCapability.Communication.WiFi.STA
+ * @since 20
+ * @arkts 1.2
+ */
+ function offWifiRssiChange(type: 'wifiRssiChange', callback?: Callback): void;
+
+ /**
+ * Subscribe Wi-Fi stream change events.
+ * @permission ohos.permission.MANAGE_WIFI_CONNECTION
+ * @param { 'streamChange' } type - event name.
+ * @param { Callback } callback - the callback of on, 1: stream down, 2: stream up, 3: stream bidirectional
+ * @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
* @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* @throws {BusinessError} 801 - Capability not supported.
* @throws {BusinessError} 2501000 - Operation failed.
* @syscap SystemCapability.Communication.WiFi.STA
- * @since arkts {'1.1':'9', '1.2':'20'}
- * @arkts 1.1&1.2
+ * @systemapi Hide this for inner system use.
+ * @since 9
*/
- function off(type: 'wifiRssiChange', callback?: Callback): void;
+ function on(type: 'streamChange', callback: Callback): void;
/**
* Subscribe Wi-Fi stream change events.
@@ -1821,16 +1999,32 @@ declare namespace wifiManager {
* @param { Callback } callback - the callback of on, 1: stream down, 2: stream up, 3: stream bidirectional
* @throws {BusinessError} 201 - Permission denied.
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2501000 - Operation failed.
+ * @syscap SystemCapability.Communication.WiFi.STA
+ * @systemapi Hide this for inner system use.
+ * @since 20
+ * @arkts 1.2
+ */
+ function onStreamChange(type: 'streamChange', callback: Callback): void;
+
+ /**
+ * Unsubscribe Wi-Fi stream change events.
+ * All callback functions will be deregistered If there is no specific callback parameter.
+ * @permission ohos.permission.MANAGE_WIFI_CONNECTION
+ * @param { 'streamChange' } type - event name.
+ * @param { Callback } callback - the callback of off
+ * @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
* @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* @throws {BusinessError} 801 - Capability not supported.
* @throws {BusinessError} 2501000 - Operation failed.
* @syscap SystemCapability.Communication.WiFi.STA
* @systemapi Hide this for inner system use.
- * @since arkts {'1.1':'9', '1.2':'20'}
- * @arkts 1.1&1.2
+ * @since 9
*/
- function on(type: 'streamChange', callback: Callback): void;
+ function off(type: 'streamChange', callback?: Callback): void;
/**
* Unsubscribe Wi-Fi stream change events.
@@ -1840,22 +2034,20 @@ declare namespace wifiManager {
* @param { Callback } callback - the callback of off
* @throws {BusinessError} 201 - Permission denied.
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
- * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
- * 2. Incorrect parameter types.
* @throws {BusinessError} 801 - Capability not supported.
* @throws {BusinessError} 2501000 - Operation failed.
* @syscap SystemCapability.Communication.WiFi.STA
* @systemapi Hide this for inner system use.
- * @since arkts {'1.1':'9', '1.2':'20'}
- * @arkts 1.1&1.2
+ * @since 20
+ * @arkts 1.2
*/
- function off(type: 'streamChange', callback?: Callback): void;
+ function offStreamChange(type: 'streamChange', callback?: Callback): void;
/**
* Subscribe Wi-Fi device config change events.
* @permission ohos.permission.GET_WIFI_INFO
* @param { 'deviceConfigChange' } type - event name.
- * @param { Callback } callback - the callback of on, 0: config is added, 1: config is changed, 2: config is removed.
+ * @param { Callback } callback - the callback of on, 0: config is added, 1: config is changed, 2: config is removed.
* @throws {BusinessError} 201 - Permission denied.
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
* @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
@@ -1864,62 +2056,122 @@ declare namespace wifiManager {
* @throws {BusinessError} 2501000 - Operation failed.
* @syscap SystemCapability.Communication.WiFi.STA
* @systemapi Hide this for inner system use.
- * @since arkts {'1.1':'9', '1.2':'20'}
- * @arkts 1.1&1.2
+ * @since 9
*/
- function on(type: 'deviceConfigChange', callback: Callback): void;
+ function on(type: 'deviceConfigChange', callback: Callback): void;
/**
* Subscribe Wi-Fi device config change events.
* @permission ohos.permission.GET_WIFI_INFO
* @param { 'deviceConfigChange' } type - event name.
- * @param { Callback } callback - the callback of off, 0: config is added, 1: config is changed, 2: config is removed.
+ * @param { Callback } callback - the callback of on, 0: config is added, 1: config is changed, 2: config is removed.
* @throws {BusinessError} 201 - Permission denied.
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
- * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
- * 2. Incorrect parameter types.
* @throws {BusinessError} 801 - Capability not supported.
* @throws {BusinessError} 2501000 - Operation failed.
* @syscap SystemCapability.Communication.WiFi.STA
* @systemapi Hide this for inner system use.
- * @since arkts {'1.1':'9', '1.2':'20'}
- * @arkts 1.1&1.2
+ * @since 20
+ * @arkts 1.2
*/
- function off(type: 'deviceConfigChange', callback?: Callback): void;
+ function onDeviceConfigChange(type: 'deviceConfigChange', callback: Callback): void;
/**
- * Subscribe Wi-Fi hotspot state change events.
- * When the service exits, call off(type: 'hotspotStateChange', callback?: Callback<number>) to unregister the callback registered.
+ * Subscribe Wi-Fi device config change events.
* @permission ohos.permission.GET_WIFI_INFO
- * @param { 'hotspotStateChange' } type - event name.
- * @param { Callback } callback - the callback of on, 0: inactive, 1: active, 2: activating, 3: de-activating
+ * @param { 'deviceConfigChange' } type - event name.
+ * @param { Callback } callback - the callback of off, 0: config is added, 1: config is changed, 2: config is removed.
* @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
* @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* @throws {BusinessError} 801 - Capability not supported.
- * @throws {BusinessError} 2601000 - Operation failed.
- * @syscap SystemCapability.Communication.WiFi.AP.Core
- * @since arkts {'1.1':'9', '1.2':'20'}
- * @arkts 1.1&1.2
+ * @throws {BusinessError} 2501000 - Operation failed.
+ * @syscap SystemCapability.Communication.WiFi.STA
+ * @systemapi Hide this for inner system use.
+ * @since 9
*/
- function on(type: 'hotspotStateChange', callback: Callback): void;
+ function off(type: 'deviceConfigChange', callback?: Callback): void;
/**
- * Unsubscribe Wi-Fi hotspot state change events.
- * All callback functions will be deregistered If there is no specific callback parameter.
+ * Subscribe Wi-Fi device config change events.
+ * @permission ohos.permission.GET_WIFI_INFO
+ * @param { 'deviceConfigChange' } type - event name.
+ * @param { Callback } callback - the callback of off, 0: config is added, 1: config is changed, 2: config is removed.
+ * @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2501000 - Operation failed.
+ * @syscap SystemCapability.Communication.WiFi.STA
+ * @systemapi Hide this for inner system use.
+ * @since 20
+ * @arkts 1.2
+ */
+ function offDeviceConfigChange(type: 'deviceConfigChange', callback?: Callback): void;
+
+ /**
+ * Subscribe Wi-Fi hotspot state change events.
+ * When the service exits, call off(type: 'hotspotStateChange', callback?: Callback<number>) to unregister the callback registered.
* @permission ohos.permission.GET_WIFI_INFO
* @param { 'hotspotStateChange' } type - event name.
- * @param { Callback } callback - the callback of off
+ * @param { Callback } callback - the callback of on, 0: inactive, 1: active, 2: activating, 3: de-activating
* @throws {BusinessError} 201 - Permission denied.
* @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* @throws {BusinessError} 801 - Capability not supported.
* @throws {BusinessError} 2601000 - Operation failed.
* @syscap SystemCapability.Communication.WiFi.AP.Core
- * @since arkts {'1.1':'9', '1.2':'20'}
- * @arkts 1.1&1.2
+ * @since 9
*/
- function off(type: 'hotspotStateChange', callback?: Callback): void;
+ function on(type: 'hotspotStateChange', callback: Callback): void;
+
+ /**
+ * Subscribe Wi-Fi hotspot state change events.
+ * When the service exits, call off(type: 'hotspotStateChange', callback?: Callback<int>) to unregister the callback registered.
+ * @permission ohos.permission.GET_WIFI_INFO
+ * @param { 'hotspotStateChange' } type - event name.
+ * @param { Callback } callback - the callback of on, 0: inactive, 1: active, 2: activating, 3: de-activating
+ * @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2601000 - Operation failed.
+ * @syscap SystemCapability.Communication.WiFi.AP.Core
+ * @since 20
+ * @arkts 1.2
+ */
+ function onHotspotStateChange(type: 'hotspotStateChange', callback: Callback): void;
+
+ /**
+ * Unsubscribe Wi-Fi hotspot state change events.
+ * All callback functions will be deregistered If there is no specific callback parameter.
+ * @permission ohos.permission.GET_WIFI_INFO
+ * @param { 'hotspotStateChange' } type - event name.
+ * @param { Callback } callback - the callback of off
+ * @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
+ * 2. Incorrect parameter types.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2601000 - Operation failed.
+ * @syscap SystemCapability.Communication.WiFi.AP.Core
+ * @since 9
+ */
+ function off(type: 'hotspotStateChange', callback?: Callback): void;
+
+ /**
+ * Unsubscribe Wi-Fi hotspot state change events.
+ * All callback functions will be deregistered If there is no specific callback parameter.
+ * @permission ohos.permission.GET_WIFI_INFO
+ * @param { 'hotspotStateChange'} type - event name.
+ * @param { Callback } callback - the callback of off
+ * @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2601000 - Operation failed.
+ * @syscap SystemCapability.Communication.WiFi.AP.Core
+ * @since 20
+ * @arkts 1.2
+ */
+ function offHotspotStateChange(type: 'hotspotStateChange', callback?: Callback): void;
/**
* Subscribe Wi-Fi hotspot sta join events.
@@ -1928,17 +2180,32 @@ declare namespace wifiManager {
* @param { Callback } callback - the callback of on
* @throws {BusinessError} 201 - Permission denied.
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
- * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified.
+ * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* @throws {BusinessError} 801 - Capability not supported.
* @throws {BusinessError} 2601000 - Operation failed.
* @syscap SystemCapability.Communication.WiFi.AP.Core
* @systemapi Hide this for inner system use.
- * @since arkts {'1.1':'9', '1.2':'20'}
- * @arkts 1.1&1.2
+ * @since 9
*/
function on(type: 'hotspotStaJoin', callback: Callback): void;
+ /**
+ * Subscribe Wi-Fi hotspot sta join events.
+ * @permission ohos.permission.MANAGE_WIFI_HOTSPOT
+ * @param { 'hotspotStaJoin' } type - event name.
+ * @param { Callback } callback - the callback of on
+ * @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2601000 - Operation failed.
+ * @syscap SystemCapability.Communication.WiFi.AP.Core
+ * @systemapi Hide this for inner system use.
+ * @since 20
+ * @arkts 1.2
+ */
+ function onHotspotStaJoin(type: 'hotspotStaJoin', callback: Callback): void;
+
/**
* Unsubscribe Wi-Fi hotspot sta join events.
* All callback functions will be deregistered If there is no specific callback parameter.
@@ -1947,7 +2214,7 @@ declare namespace wifiManager {
* @param { Callback } callback - the callback of off
* @throws {BusinessError} 201 - Permission denied.
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
- * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified.
+ * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* @throws {BusinessError} 801 - Capability not supported.
* @throws {BusinessError} 2601000 - Operation failed.
@@ -1958,6 +2225,23 @@ declare namespace wifiManager {
*/
function off(type: 'hotspotStaJoin', callback?: Callback): void;
+ /**
+ * Unsubscribe Wi-Fi hotspot sta join events.
+ * All callback functions will be deregistered If there is no specific callback parameter.
+ * @permission ohos.permission.MANAGE_WIFI_HOTSPOT
+ * @param { 'hotspotStaJoin' } type - event name.
+ * @param { Callback } callback - the callback of off
+ * @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2601000 - Operation failed.
+ * @syscap SystemCapability.Communication.WiFi.AP.Core
+ * @systemapi Hide this for inner system use.
+ * @since 20
+ * @arkts 1.2
+ */
+ function offHotspotStaJoin(type: 'hotspotStaJoin', callback?: Callback): void;
+
/**
* Subscribe Wi-Fi hotspot sta leave events.
* @permission ohos.permission.MANAGE_WIFI_HOTSPOT
@@ -1965,18 +2249,32 @@ declare namespace wifiManager {
* @param { Callback } callback - the callback of on
* @throws {BusinessError} 201 - Permission denied.
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
- * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified.
+ * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* @throws {BusinessError} 801 - Capability not supported.
* @throws {BusinessError} 2601000 - Operation failed.
* @syscap SystemCapability.Communication.WiFi.AP.Core
-
* @systemapi Hide this for inner system use.
- * @since arkts {'1.1':'9', '1.2':'20'}
- * @arkts 1.1&1.2
+ * @since 9
*/
function on(type: 'hotspotStaLeave', callback: Callback): void;
+ /**
+ * Subscribe Wi-Fi hotspot sta leave events.
+ * @permission ohos.permission.MANAGE_WIFI_HOTSPOT
+ * @param { 'hotspotStaLeave' } type - event name.
+ * @param { Callback } callback - the callback of on
+ * @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2601000 - Operation failed.
+ * @syscap SystemCapability.Communication.WiFi.AP.Core
+ * @systemapi Hide this for inner system use.
+ * @since 20
+ * @arkts 1.2
+ */
+ function onHotspotStaLeave(type: 'hotspotStaLeave', callback: Callback): void;
+
/**
* Unsubscribe Wi-Fi hotspot sta leave events.
* @permission ohos.permission.MANAGE_WIFI_HOTSPOT
@@ -1990,43 +2288,85 @@ declare namespace wifiManager {
* @throws {BusinessError} 2601000 - Operation failed.
* @syscap SystemCapability.Communication.WiFi.AP.Core
* @systemapi Hide this for inner system use.
- * @since arkts {'1.1':'9', '1.2':'20'}
- * @arkts 1.1&1.2
+ * @since 9
*/
function off(type: 'hotspotStaLeave', callback?: Callback): void;
+ /**
+ * Unsubscribe Wi-Fi hotspot sta leave events.
+ * @permission ohos.permission.MANAGE_WIFI_HOTSPOT
+ * @param { 'hotspotStaLeave' } type - event name.
+ * @param { Callback } callback - the callback of off
+ * @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2601000 - Operation failed.
+ * @syscap SystemCapability.Communication.WiFi.AP.Core
+ * @systemapi Hide this for inner system use.
+ * @since 20
+ * @arkts 1.2
+ */
+ function offHotspotStaLeave(type: 'hotspotStaLeave', callback?: Callback): void;
+
/**
* Subscribe P2P status change events.
* When the service exits, call off(type: 'p2pStateChange', callback?: Callback<number>) to unregister the callback registered.
* @permission ohos.permission.GET_WIFI_INFO
* @param { 'p2pStateChange' } type - event name.
- * @param { Callback } callback - the callback of on, 1: idle, 2: starting, 3:started, 4: closing, 5: closed
+ * @param { Callback } callback - the callback of on, 1: idle, 2: starting, 3:started, 4: closing, 5: closed
* @throws {BusinessError} 201 - Permission denied.
* @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* @throws {BusinessError} 801 - Capability not supported.
* @throws {BusinessError} 2801000 - Operation failed.
* @syscap SystemCapability.Communication.WiFi.P2P
- * @since arkts {'1.1':'9', '1.2':'20'}
- * @arkts 1.1&1.2
+ * @since 9
+ */
+ function on(type: 'p2pStateChange', callback: Callback): void;
+
+ /**
+ * Subscribe P2P status change events.
+ * When the service exits, call off(type: 'p2pStateChange', callback?: Callback<int>) to unregister the callback registered.
+ * @permission ohos.permission.GET_WIFI_INFO
+ * @param { 'p2pStateChange' } type - event name.
+ * @param { Callback } callback - the callback of on, 1: idle, 2: starting, 3:started, 4: closing, 5: closed
+ * @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2801000 - Operation failed.
+ * @syscap SystemCapability.Communication.WiFi.P2P
+ * @since 20
+ * @arkts 1.2
*/
- function on(type: 'p2pStateChange', callback: Callback): void;
+ function onP2pStateChange(type: 'p2pStateChange', callback: Callback): void;
/**
* Unsubscribe P2P status change events.
* @permission ohos.permission.GET_WIFI_INFO
* @param { 'p2pStateChange' } type - event name.
- * @param { Callback } callback - the callback of off
+ * @param { Callback } callback - the callback of off
* @throws {BusinessError} 201 - Permission denied.
* @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* @throws {BusinessError} 801 - Capability not supported.
* @throws {BusinessError} 2801000 - Operation failed.
* @syscap SystemCapability.Communication.WiFi.P2P
- * @since arkts {'1.1':'9', '1.2':'20'}
- * @arkts 1.1&1.2
+ * @since 9
+ */
+ function off(type: 'p2pStateChange', callback?: Callback): void;
+
+ /**
+ * Unsubscribe P2P status change events.
+ * @permission ohos.permission.GET_WIFI_INFO
+ * @param { 'p2pStateChange' } type - event name.
+ * @param { Callback } callback - the callback of off
+ * @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2801000 - Operation failed.
+ * @syscap SystemCapability.Communication.WiFi.P2P
+ * @since 20
+ * @arkts 1.2
*/
- function off(type: 'p2pStateChange', callback?: Callback): void;
+ function offP2pStateChange(type: 'p2pStateChange', callback?: Callback): void;
/**
* Subscribe P2P connection change events.
@@ -2035,32 +2375,59 @@ declare namespace wifiManager {
* @param { 'p2pConnectionChange' } type - event name.
* @param { Callback } callback - the callback of on
* @throws {BusinessError} 201 - Permission denied.
- * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified.
+ * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* @throws {BusinessError} 801 - Capability not supported.
* @throws {BusinessError} 2801000 - Operation failed.
* @syscap SystemCapability.Communication.WiFi.P2P
- * @since arkts {'1.1':'9', '1.2':'20'}
- * @arkts 1.1&1.2
+ * @since 9
*/
function on(type: 'p2pConnectionChange', callback: Callback): void;
+ /**
+ * Subscribe P2P connection change events.
+ * When the service exits, call off(type: 'p2pConnectionChange', callback?: Callback<WifiP2pLinkedInfo>) to unregister the callback registered.
+ * @permission ohos.permission.GET_WIFI_INFO
+ * @param { 'p2pConnectionChange' } type - event name.
+ * @param { Callback } callback - the callback of on
+ * @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2801000 - Operation failed.
+ * @syscap SystemCapability.Communication.WiFi.P2P
+ * @since 20
+ * @arkts 1.2
+ */
+ function onP2pConnectionChange(type: 'p2pConnectionChange', callback: Callback): void;
+
/**
* Unsubscribe P2P connection change events.
* @permission ohos.permission.GET_WIFI_INFO
* @param { 'p2pConnectionChange' } type - event name.
* @param { Callback } callback - the callback of off
* @throws {BusinessError} 201 - Permission denied.
- * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified.
+ * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* @throws {BusinessError} 801 - Capability not supported.
* @throws {BusinessError} 2801000 - Operation failed.
* @syscap SystemCapability.Communication.WiFi.P2P
- * @since arkts {'1.1':'9', '1.2':'20'}
- * @arkts 1.1&1.2
+ * @since 9
*/
function off(type: 'p2pConnectionChange', callback?: Callback): void;
+ /**
+ * Unsubscribe P2P connection change events.
+ * @permission ohos.permission.GET_WIFI_INFO
+ * @param { 'p2pConnectionChange' } type - event name.
+ * @param { Callback } callback - the callback of off
+ * @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2801000 - Operation failed.
+ * @syscap SystemCapability.Communication.WiFi.P2P
+ * @since 20
+ * @arkts 1.2
+ */
+ function offP2pConnectionChange(type: 'p2pConnectionChange', callback?: Callback): void;
+
/**
* Subscribe P2P local device change events.
* When the service exits, call off(type: 'p2pDeviceChange', callback?: Callback<WifiP2pDevice>) to unregister the callback registered.
@@ -2068,7 +2435,7 @@ declare namespace wifiManager {
* @param { 'p2pDeviceChange' } type - event name.
* @param { Callback } callback - the callback of on
* @throws {BusinessError} 201 - Permission denied.
- * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified.
+ * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* @throws {BusinessError} 801 - Capability not supported.
* @throws {BusinessError} 2801000 - Operation failed.
@@ -2082,23 +2449,37 @@ declare namespace wifiManager {
* @param { 'p2pDeviceChange' } type - event name.
* @param { Callback } callback - the callback of on
* @throws {BusinessError} 201 - Permission denied.
- * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified.
+ * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* @throws {BusinessError} 801 - Capability not supported.
* @throws {BusinessError} 2801000 - Operation failed.
* @syscap SystemCapability.Communication.WiFi.P2P
- * @since arkts {'1.1':'10', '1.2':'20'}
- * @arkts 1.1&1.2
+ * @since 10
*/
function on(type: 'p2pDeviceChange', callback: Callback): void;
+ /**
+ * Subscribe P2P local device change events.
+ * When the service exits, call off(type: 'p2pDeviceChange', callback?: Callback<WifiP2pDevice>) to unregister the callback registered.
+ * @permission ohos.permission.GET_WIFI_INFO
+ * @param { 'p2pDeviceChange' } type - event name.
+ * @param { Callback } callback - the callback of on
+ * @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2801000 - Operation failed.
+ * @syscap SystemCapability.Communication.WiFi.P2P
+ * @since 20
+ * @arkts 1.2
+ */
+ function onP2pDeviceChange(type: 'p2pDeviceChange', callback: Callback): void;
+
/**
* Unsubscribe P2P local device change events.
* @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
* @param { 'p2pDeviceChange' } type - event name.
* @param { Callback } callback - the callback of off
* @throws {BusinessError} 201 - Permission denied.
- * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified.
+ * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* @throws {BusinessError} 801 - Capability not supported.
* @throws {BusinessError} 2801000 - Operation failed.
@@ -2110,16 +2491,28 @@ declare namespace wifiManager {
* @param { 'p2pDeviceChange' } type - event name.
* @param { Callback } callback - the callback of off
* @throws {BusinessError} 201 - Permission denied.
- * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified.
+ * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* @throws {BusinessError} 801 - Capability not supported.
* @throws {BusinessError} 2801000 - Operation failed.
* @syscap SystemCapability.Communication.WiFi.P2P
- * @since arkts {'1.1':'10', '1.2':'20'}
- * @arkts 1.1&1.2
+ * @since 10
*/
function off(type: 'p2pDeviceChange', callback?: Callback): void;
+ /**
+ * Unsubscribe P2P local device change events.
+ * @param { 'p2pDeviceChange' } type - event name.
+ * @param { Callback } callback - the callback of off
+ * @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2801000 - Operation failed.
+ * @syscap SystemCapability.Communication.WiFi.P2P
+ * @since 20
+ * @arkts 1.2
+ */
+ function offP2pDeviceChange(type: 'p2pDeviceChange', callback?: Callback): void;
+
/**
* Subscribe P2P peer device change events.
* When the service exits, call off(type: 'p2pPeerDeviceChange', callback?: Callback<WifiP2pDevice[]>) to unregister the callback registered.
@@ -2127,7 +2520,7 @@ declare namespace wifiManager {
* @param { 'p2pPeerDeviceChange' } type - event name.
* @param { Callback } callback - the callback of on
* @throws {BusinessError} 201 - Permission denied.
- * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified.
+ * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* @throws {BusinessError} 801 - Capability not supported.
* @throws {BusinessError} 2801000 - Operation failed.
@@ -2141,23 +2534,37 @@ declare namespace wifiManager {
* @param { 'p2pPeerDeviceChange' } type - event name.
* @param { Callback } callback - the callback of on
* @throws {BusinessError} 201 - Permission denied.
- * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified.
+ * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* @throws {BusinessError} 801 - Capability not supported.
* @throws {BusinessError} 2801000 - Operation failed.
* @syscap SystemCapability.Communication.WiFi.P2P
- * @since arkts {'1.1':'10', '1.2':'20'}
- * @arkts 1.1&1.2
+ * @since 10
*/
function on(type: 'p2pPeerDeviceChange', callback: Callback): void;
+ /**
+ * Subscribe P2P peer device change events.
+ * When the service exits, call off(type: 'p2pPeerDeviceChange', callback?: Callback<WifiP2pDevice[]>) to unregister the callback registered.
+ * @permission ohos.permission.GET_WIFI_INFO
+ * @param { 'p2pPeerDeviceChange' } type - event name.
+ * @param { Callback } callback - the callback of on
+ * @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2801000 - Operation failed.
+ * @syscap SystemCapability.Communication.WiFi.P2P
+ * @since 20
+ * @arkts 1.2
+ */
+ function onP2pPeerDeviceChange(type: 'p2pPeerDeviceChange', callback: Callback): void;
+
/**
* Unsubscribe P2P peer device change events.
* @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
* @param { 'p2pPeerDeviceChange' } type - event name.
* @param { Callback } callback - the callback of off
* @throws {BusinessError} 201 - Permission denied.
- * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified.
+ * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* @throws {BusinessError} 801 - Capability not supported.
* @throws {BusinessError} 2801000 - Operation failed.
@@ -2169,16 +2576,28 @@ declare namespace wifiManager {
* @param { 'p2pPeerDeviceChange' } type - event name.
* @param { Callback } callback - the callback of off
* @throws {BusinessError} 201 - Permission denied.
- * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified.
+ * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* @throws {BusinessError} 801 - Capability not supported.
* @throws {BusinessError} 2801000 - Operation failed.
* @syscap SystemCapability.Communication.WiFi.P2P
- * @since arkts {'1.1':'10', '1.2':'20'}
- * @arkts 1.1&1.2
+ * @since 10
*/
function off(type: 'p2pPeerDeviceChange', callback?: Callback): void;
+ /**
+ * Unsubscribe P2P peer device change events.
+ * @param { 'p2pPeerDeviceChange' } type - event name.
+ * @param { Callback } callback - the callback of off
+ * @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2801000 - Operation failed.
+ * @syscap SystemCapability.Communication.WiFi.P2P
+ * @since 20
+ * @arkts 1.2
+ */
+ function offP2pPeerDeviceChange(type: 'p2pPeerDeviceChange', callback?: Callback): void;
+
/**
* Subscribe P2P persistent group change events.
* When the service exits, call off(type: 'p2pPersistentGroupChange', callback?: Callback<void>) to unregister the callback registered.
@@ -2186,64 +2605,162 @@ declare namespace wifiManager {
* @param { 'p2pPersistentGroupChange' } type - event name.
* @param { Callback } callback - the callback of on
* @throws {BusinessError} 201 - Permission denied.
- * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified.
+ * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* @throws {BusinessError} 801 - Capability not supported.
* @throws {BusinessError} 2801000 - Operation failed.
* @syscap SystemCapability.Communication.WiFi.P2P
- * @since arkts {'1.1':'9', '1.2':'20'}
- * @arkts 1.1&1.2
+ * @since 9
*/
function on(type: 'p2pPersistentGroupChange', callback: Callback): void;
+ /**
+ * Subscribe P2P persistent group change events.
+ * When the service exits, call off(type: 'p2pPersistentGroupChange', callback?: Callback<void>) to unregister the callback registered.
+ * @permission ohos.permission.GET_WIFI_INFO
+ * @param { 'p2pPersistentGroupChange' } type - event name.
+ * @param { Callback } callback - the callback of on
+ * @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2801000 - Operation failed.
+ * @syscap SystemCapability.Communication.WiFi.P2P
+ * @since 20
+ * @arkts 1.2
+ */
+ function onP2pPersistentGroupChange(type: 'p2pPersistentGroupChange', callback: Callback): void;
+
/**
* Unsubscribe P2P persistent group change events.
* @permission ohos.permission.GET_WIFI_INFO
* @param { 'p2pPersistentGroupChange' } type - event name.
* @param { Callback } callback - the callback of off
* @throws {BusinessError} 201 - Permission denied.
- * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified.
+ * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* @throws {BusinessError} 801 - Capability not supported.
* @throws {BusinessError} 2801000 - Operation failed.
* @syscap SystemCapability.Communication.WiFi.P2P
- * @since arkts {'1.1':'9', '1.2':'20'}
- * @arkts 1.1&1.2
+ * @since 9
*/
function off(type: 'p2pPersistentGroupChange', callback?: Callback): void;
+ /**
+ * Unsubscribe P2P persistent group change events.
+ * @permission ohos.permission.GET_WIFI_INFO
+ * @param { 'p2pPersistentGroupChange' } type - event name.
+ * @param { Callback } callback - the callback of off
+ * @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2801000 - Operation failed.
+ * @syscap SystemCapability.Communication.WiFi.P2P
+ * @since 20
+ * @arkts 1.2
+ */
+ function offP2pPersistentGroupChange(type: 'p2pPersistentGroupChange', callback?: Callback): void;
+
/**
* Subscribe P2P discovery events.
* When the service exits, call off(type: 'p2pDiscoveryChange', callback?: Callback<number>) to unregister the callback registered.
* @permission ohos.permission.GET_WIFI_INFO
* @param { 'p2pDiscoveryChange' } type - event name.
- * @param { Callback } callback - the callback of on
+ * @param { Callback } callback - the callback of on
* @throws {BusinessError} 201 - Permission denied.
* @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* @throws {BusinessError} 801 - Capability not supported.
* @throws {BusinessError} 2801000 - Operation failed.
* @syscap SystemCapability.Communication.WiFi.P2P
- * @since arkts {'1.1':'9', '1.2':'20'}
- * @arkts 1.1&1.2
+ * @since 9
+ */
+ function on(type: 'p2pDiscoveryChange', callback: Callback): void;
+
+ /**
+ * Subscribe P2P discovery events.
+ * When the service exits, call off(type: 'p2pDiscoveryChange', callback?: Callback<int>) to unregister the callback registered.
+ * @permission ohos.permission.GET_WIFI_INFO
+ * @param { 'p2pDiscoveryChange' } type - event name.
+ * @param { Callback } callback - the callback of on
+ * @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2801000 - Operation failed.
+ * @syscap SystemCapability.Communication.WiFi.P2P
+ * @since 20
+ * @arkts 1.2
*/
- function on(type: 'p2pDiscoveryChange', callback: Callback): void;
+ function onP2pDiscoveryChange(type: 'p2pDiscoveryChange', callback: Callback): void;
/**
* Unsubscribe P2P discovery events.
* @permission ohos.permission.GET_WIFI_INFO
* @param { 'p2pDiscoveryChange' } type - event name.
- * @param { Callback } callback - the callback of off
+ * @param { Callback } callback - the callback of off
* @throws {BusinessError} 201 - Permission denied.
* @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* @throws {BusinessError} 801 - Capability not supported.
* @throws {BusinessError} 2801000 - Operation failed.
* @syscap SystemCapability.Communication.WiFi.P2P
- * @since arkts {'1.1':'9', '1.2':'20'}
- * @arkts 1.1&1.2
+ * @since 9
+ */
+ function off(type: 'p2pDiscoveryChange', callback?: Callback): void;
+
+ /**
+ * Unsubscribe P2P discovery events.
+ * @permission ohos.permission.GET_WIFI_INFO
+ * @param { 'p2pDiscoveryChange' } type - event name.
+ * @param { Callback } callback - the callback of off
+ * @throws {BusinessError} 201 - Permission denied.
+ * @throws {BusinessError} 801 - Capability not supported.
+ * @throws {BusinessError} 2801000 - Operation failed.
+ * @syscap SystemCapability.Communication.WiFi.P2P
+ * @since 20
+ * @arkts 1.2
*/
- function off(type: 'p2pDiscoveryChange', callback?: Callback): void;
+ function offP2pDiscoveryChange(type: 'p2pDiscoveryChange', callback?: Callback): void;
+
+ /**
+ * @since 20
+ * @arkts 1.2
+ */
+ overload on {
+ onWifiStateChange,
+ onWifiConnectionChange,
+ onWifiScanStateChange,
+ onWifiRssiChange,
+ onStreamChange,
+ onDeviceConfigChange,
+ onHotspotStateChange,
+ onHotspotStaJoin,
+ onHotspotStaLeave,
+ onP2pStateChange,
+ onP2pConnectionChange,
+ onP2pDeviceChange,
+ onP2pPeerDeviceChange,
+ onP2pPersistentGroupChange,
+ onP2pDiscoveryChange
+ };
+
+ /**
+ * @since 20
+ * @arkts 1.2
+ */
+ overload off {
+ offWifiStateChange,
+ offWifiConnectionChange,
+ offWifiScanStateChange,
+ offWifiRssiChange,
+ offStreamChange,
+ offDeviceConfigChange,
+ offHotspotStateChange,
+ offHotspotStaJoin,
+ offHotspotStaLeave,
+ offP2pStateChange,
+ offP2pConnectionChange,
+ offP2pDeviceChange,
+ offP2pPeerDeviceChange,
+ offP2pPersistentGroupChange,
+ offP2pDiscoveryChange
+ };
/**
* Wi-Fi device address( mac / bssid ) type.
--
Gitee
From 9ee878737eb0be8718503a338b2ef5366fcedd72 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AD=99=E6=B5=9A=E4=BA=88?=
Date: Wed, 6 Aug 2025 11:17:20 +0800
Subject: [PATCH 2/4] overload bugfix
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: 孙浚予
---
api/@ohos.wifiManager.d.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/api/@ohos.wifiManager.d.ts b/api/@ohos.wifiManager.d.ts
index 8125e78e82..1691343898 100644
--- a/api/@ohos.wifiManager.d.ts
+++ b/api/@ohos.wifiManager.d.ts
@@ -601,7 +601,7 @@ declare namespace wifiManager {
*/
function getSignalLevel(rssi: int, band: int): int;
- /**
+ /**
* Obtain connection information about the Wi-Fi connection. If does't have the permission of ohos.permission.GET_WIFI_PEERS_MAC, return random bssid.
* @permission ohos.permission.GET_WIFI_INFO
* @returns { Promise } Returns Wi-Fi linked information.
--
Gitee
From d9d653cd332d5024a798d50eed73a0471238daa7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AD=99=E6=B5=9A=E4=BA=88?=
Date: Wed, 6 Aug 2025 16:43:35 +0800
Subject: [PATCH 3/4] delete 401
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: 孙浚予
---
api/@ohos.wifiManager.d.ts | 2 --
1 file changed, 2 deletions(-)
diff --git a/api/@ohos.wifiManager.d.ts b/api/@ohos.wifiManager.d.ts
index 1691343898..adea268434 100644
--- a/api/@ohos.wifiManager.d.ts
+++ b/api/@ohos.wifiManager.d.ts
@@ -694,8 +694,6 @@ declare namespace wifiManager {
* @permission ohos.permission.GET_WIFI_INFO
* @param { AsyncCallback } callback - Indicates callback of function.
* @throws {BusinessError} 201 - Permission denied.
- * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified.
- * 2. Incorrect parameter types.
* @throws {BusinessError} 801 - Capability not supported.
* @throws {BusinessError} 2501000 - Operation failed.
* @throws {BusinessError} 2501001 - Wi-Fi STA disabled.
--
Gitee
From ed5453a047189c3b85d4082cd36ab5d040833d99 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AD=99=E6=B5=9A=E4=BA=88?=
Date: Wed, 6 Aug 2025 17:29:41 +0800
Subject: [PATCH 4/4] 401 fix
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: 孙浚予
---
api/@ohos.wifiManager.d.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/api/@ohos.wifiManager.d.ts b/api/@ohos.wifiManager.d.ts
index adea268434..58f1af8677 100644
--- a/api/@ohos.wifiManager.d.ts
+++ b/api/@ohos.wifiManager.d.ts
@@ -2280,7 +2280,7 @@ declare namespace wifiManager {
* @param { Callback } callback - the callback of off
* @throws {BusinessError} 201 - Permission denied.
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
- * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified.
+ * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* @throws {BusinessError} 801 - Capability not supported.
* @throws {BusinessError} 2601000 - Operation failed.
--
Gitee