From 55890b59c3d327cb7af8a7167af2647b15b440de Mon Sep 17 00:00:00 2001 From: liujiaojiao Date: Sun, 25 Jun 2023 14:40:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=A3=E4=B8=80?= =?UTF-8?q?=E8=87=B4=E6=80=A7=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liujiaojiao --- .../reference/apis/js-apis-wifiManager.md | 68 ++++++++++++++----- .../reference/apis/js-apis-wifiManagerExt.md | 18 ++--- 2 files changed, 60 insertions(+), 26 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-wifiManager.md b/zh-cn/application-dev/reference/apis/js-apis-wifiManager.md index ed87fc1088..82f32a06d7 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-wifiManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-wifiManager.md @@ -1708,6 +1708,55 @@ get5GChannelList(): Array<number> console.error("failed:" + JSON.stringify(error)); } ``` +## wifi.getDisconnectedReason10+ + +getDisconnectedReason(): DisconnectedReason + +获取最近一次断连原因 + +**系统接口:** 此接口为系统接口。 + +**需要权限:** ohos.permission.GET_WIFI_INFO 和 ohos.permission.GET_WIFI_CONFIG + +**系统能力:** SystemCapability.Communication.WiFi.STA + +**错误码:** + +以下错误码的详细介绍请参见[WIFI错误码](../errorcodes/errorcode-wifi.md)。 + +| **错误码ID** | **错误信息** | + | -------- | -------- | +| 2601000 | Operation failed.| + +**返回值:** + +| **类型** | **说明** | +| -------- | -------- | +| [DisconnectedReason](#DisconnectedReason10) | 最近断开的原因 | + +**示例:** +```js + import wifiManager from '@ohos.wifiManager'; + + try { + let disconnectedReason = wifiManager.getDisconnectedReason(); + console.info("disconnectedReason:" + disconnectedReason); + }catch(error){ + console.error("failed:" + JSON.stringify(error)); + } +``` + +## DisconnectedReason 10+ + +表示wifi断开原因的枚举。 + +**系统能力:** SystemCapability.Communication.WiFi.STA + +| 名称 | 值 | 说明 | +| -------- | -------- | -------- | +| DISC_REASON_DEFAULT | 0 | 默认原因。 | +| DISC_REASON_WRONG_PWD | 1 | 密码错误。 | +| DISC_REASON_CONNECTION_FULL | 2 | 路由器的连接数已达到最大数量限制。 | ## wifi.enableHotspot9+ @@ -2132,23 +2181,6 @@ getCurrentP2pGroup(callback: AsyncCallback<WifiP2pGroupInfo>): void | **错误码ID** | **错误信息** | | -------- | -------- | | 2801000 | Operation failed.| - -**示例:** -``` - import wifi from '@ohos.wifiManager'; - - wifi.getCurrentP2pGroup((err, data) => { - if (err) { - console.error("get current P2P group error"); - return; - } - console.info("get current P2P group: " + JSON.stringify(data)); - }); - - wifi.getCurrentP2pGroup().then(data => { - console.info("get current P2P group: " + JSON.stringify(data)); - }); -``` **示例:** ```js @@ -2302,6 +2334,8 @@ getP2pLocalDevice(callback: AsyncCallback<WifiP2pDevice>): void | -------- | -------- | -------- | -------- | | callback | AsyncCallback<[WifiP2pDevice](#wifip2pdevice9)> | 是 | 回调函数。当操作成功时,err为0,data表示本端设备信息。如果error为非0,表示处理出现错误。 | +**错误码:** + | **错误码ID** | **错误信息** | | -------- | -------- | | 2801000 | Operation failed.| diff --git a/zh-cn/application-dev/reference/apis/js-apis-wifiManagerExt.md b/zh-cn/application-dev/reference/apis/js-apis-wifiManagerExt.md index c20d64f6b5..4aa3b6e98b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-wifiManagerExt.md +++ b/zh-cn/application-dev/reference/apis/js-apis-wifiManagerExt.md @@ -26,7 +26,7 @@ enableHotspot(): void; 以下错误码的详细介绍请参见[WIFI错误码](../errorcodes/errorcode-wifi.md)。 -| **类型** | **说明** | +| **错误码ID** | **错误信息** | | -------- | -------- | | 2701000 | Operation failed.| @@ -44,7 +44,7 @@ disableHotspot(): void; 以下错误码的详细介绍请参见[WIFI错误码](../errorcodes/errorcode-wifi.md)。 -| **类型** | **说明** | +| **错误码ID** | **错误信息** | | -------- | -------- | | 2701000 | Operation failed.| @@ -68,11 +68,11 @@ getSupportedPowerMode(): Promise<Array<PowerMode>> 以下错误码的详细介绍请参见[WIFI错误码](../errorcodes/errorcode-wifi.md)。 -| **类型** | **说明** | +| **错误码ID** | **错误信息** | | -------- | -------- | | 2701000 | Operation failed.| -## PowerMode +## PowerMode9+ 表示功率模式的枚举。 @@ -105,7 +105,7 @@ getSupportedPowerMode(callback: AsyncCallback<Array<PowerMode>>): vo 以下错误码的详细介绍请参见[WIFI错误码](../errorcodes/errorcode-wifi.md)。 -| **类型** | **说明** | +| **错误码ID** | **错误信息** | | -------- | -------- | | 2701000 | Operation failed.| @@ -129,7 +129,7 @@ getPowerMode(): Promise<PowerMode> 以下错误码的详细介绍请参见[WIFI错误码](../errorcodes/errorcode-wifi.md)。 -| **类型** | **说明** | +| **错误码ID** | **错误信息** | | -------- | -------- | | 2701000 | Operation failed.| @@ -153,13 +153,13 @@ getPowerMode(callback: AsyncCallback<PowerMode>): void 以下错误码的详细介绍请参见[WIFI错误码](../errorcodes/errorcode-wifi.md)。 -| **类型** | **说明** | +| **错误码ID** | **错误信息** | | -------- | -------- | | 2701000 | Operation failed.| ## wifiext.setPowerMode9+ -setPowerMode(model: PowerMode) : boolean; +setPowerMode(model: PowerMode) : void; 设置功率模式。 @@ -177,6 +177,6 @@ setPowerMode(model: PowerMode) : boolean; 以下错误码的详细介绍请参见[WIFI错误码](../errorcodes/errorcode-wifi.md)。 -| **类型** | **说明** | +| **错误码ID** | **错误信息** | | -------- | -------- | | 2701000 | Operation failed.| -- GitLab