diff --git a/api/@ohos.wifi.d.ts b/api/@ohos.wifi.d.ts index ceba8186e977ef15f7605a703899e2ac5b6584b2..aaf36611e6558f03be1e9f2806c6405d2362860e 100644 --- a/api/@ohos.wifi.d.ts +++ b/api/@ohos.wifi.d.ts @@ -119,6 +119,7 @@ declare namespace wifi { * @since 7 * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.SET_WIFI_INFO + * @deprecated since 9 */ function addUntrustedConfig(config: WifiDeviceConfig): Promise; function addUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback): void; @@ -132,6 +133,7 @@ declare namespace wifi { * @since 7 * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.SET_WIFI_INFO + * @deprecated since 9 */ function removeUntrustedConfig(config: WifiDeviceConfig): Promise; function removeUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback): void; @@ -142,7 +144,9 @@ declare namespace wifi { *

This method adds one configuration at a time. After this configuration is added, * your device will determine whether to connect to the hotspot. * + * @param config - candidate config. * @return Returns {@code networkId} if the configuration is added; returns {@code -1} otherwise. + * * @since 9 * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.SET_WIFI_INFO @@ -154,10 +158,11 @@ declare namespace wifi { * Removes a specified candidate hotspot configuration, only the configration which is added by ourself is allowed * to be removed. * - *

This method removes one configuration at a time. + * @param networkId - Network ID which will be removed. + * @throws {ErrorCode} when failed to remove the hotspot configuration. + * @return {@code true} if the candidate hotspot configuration is removed, returns {@code false} otherwise. * * @since 9 - * @throws {TypedError | Error} when failed to remove the hotspot configuration. * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.SET_WIFI_INFO */ @@ -170,6 +175,7 @@ declare namespace wifi { *

You can obtain only the Wi-Fi configurations you created on your own application. * * @return Returns the list of all existing Wi-Fi configurations you created on your application. + * * @since 9 * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION @@ -182,13 +188,14 @@ declare namespace wifi { * *

This method connect to a configuration at a time. * - * @param {number} networkId - Network ID which will be connected. - * @throws {TypedError | Error} when failed connect to the hotspot configuration + * @param networkId - Network ID which will be connected. + * @throws {ErrCode} if operation is failed. + * @returns {Promise} operation result. * @since 9 * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.SET_WIFI_INFO */ - function connectToCandidateConfig(networkId: number): void; + function connectToCandidateConfig(networkId: number): Promise; /** * Connects to Wi-Fi network. @@ -754,6 +761,28 @@ declare namespace wifi { */ function off(type: "streamChange", callback?: Callback): void; + /** + * Subscribe Wi-Fi device config change events. + * + * @return Returns 0: config is added, 1: config is changed, 2: config is removed. + * @since 9 + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.GET_WIFI_INFO + * @systemapi Hide this for inner system use. + */ + function on(type: "deviceConfigChange", callback: Callback): void; + + /** + * Subscribe Wi-Fi device config change events. + * + * @return Returns 0: config is added, 1: config is changed, 2: config is removed. + * @since 9 + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.GET_WIFI_INFO + * @systemapi Hide this for inner system use. + */ + function off(type: "deviceConfigChange", callback?: Callback): void; + /** * Subscribe Wi-Fi hotspot state change events. *