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 ed87fc10883ce01d77fffcce00ada51dc2facf40..82f32a06d70213d45fb76c013e365563c9685b20 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 c20d64f6b5b7c381db039126c9dc01fb74e4e856..4aa3b6e98bad06d7f87685f90d21f066a72518e8 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.|