From b41f5fb93af22412fe2fe8f70e3f778066e898bf Mon Sep 17 00:00:00 2001 From: guoxiadi Date: Tue, 1 Jul 2025 15:29:10 +0800 Subject: [PATCH] notify dialog result Signed-off-by: guoxiadi --- .../js-apis-bluetooth-access-sys.md | 45 ++++++++++ .../js-apis-bluetooth-access.md | 88 +++++++++++++++++++ 2 files changed, 133 insertions(+) diff --git a/zh-cn/application-dev/reference/apis-connectivity-kit/js-apis-bluetooth-access-sys.md b/zh-cn/application-dev/reference/apis-connectivity-kit/js-apis-bluetooth-access-sys.md index f4bfdebbb62..6d655215ea9 100644 --- a/zh-cn/application-dev/reference/apis-connectivity-kit/js-apis-bluetooth-access-sys.md +++ b/zh-cn/application-dev/reference/apis-connectivity-kit/js-apis-bluetooth-access-sys.md @@ -191,4 +191,49 @@ try { } ``` +## access.notifyDialogResult20+ + +notifyDialogResult(notifyDialogResultParams: NotifyDialogResultParams): Promise; + +通知蓝牙开关弹框的结果。使用Promise异步回调。 + +**系统接口**:此接口为系统接口。 + +**需要权限**:ohos.permission.ACCESS_BLUETOOTH 和 ohos.permission.MANAGE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core + +**返回值:** + +| 类型 | 说明 | +| ------------------- | -------------------------------------- | +| Promise<void> | Promise对象。无返回结果的Promise对象。 | + +**错误码**: + +以下错误码的详细介绍请参见[通用错误码说明文档](../errorcode-universal.md)和[蓝牙服务子系统错误码](errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ----------------------------------------------------------- | +| 201 | Permission denied. | +| 202 | Non-system applications are not allowed to use system APIs. | +| 801 | Capability not supported. | +| 2900001 | Service stopped. | +| 2900099 | Operation failed. | + +**示例:** + +```js +import { AsyncCallback, BusinessError } from '@kit.BasicServicesKit'; +try { + let notifyDialogResultParams: access.NotifyDialogResultParams = { + "dialogType": 0, + "dialogResult": true, + }; + access.notifyDialogResult(notifyDialogResultParams); +} catch (err) { + console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); +} +``` + diff --git a/zh-cn/application-dev/reference/apis-connectivity-kit/js-apis-bluetooth-access.md b/zh-cn/application-dev/reference/apis-connectivity-kit/js-apis-bluetooth-access.md index 4f3db0f121a..bbf6fdecb82 100644 --- a/zh-cn/application-dev/reference/apis-connectivity-kit/js-apis-bluetooth-access.md +++ b/zh-cn/application-dev/reference/apis-connectivity-kit/js-apis-bluetooth-access.md @@ -48,6 +48,50 @@ try { } ``` +## access.enableBluetoothAsync20+ + +enableBluetoothAsync(): Promise; + +开启蓝牙。使用Promise异步回调。 + +**需要权限**:ohos.permission.ACCESS_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core + +**返回值:** + +| 类型 | 说明 | +| ------------------- | -------------------------------------- | +| Promise<void> | Promise对象。无返回结果的Promise对象。 | + +**错误码**: + +以下错误码的详细介绍请参见[通用错误码说明文档](../errorcode-universal.md)和[蓝牙服务子系统错误码](errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | -------------------------- | +| 201 | Permission denied. | +| 801 | Capability not supported. | +| 2900001 | Service stopped. | +| 2900013 | The user does not respond. | +| 2900014 | User refuse the action. | +| 2900099 | Operation failed. | + +**示例:** + +```js +import { AsyncCallback, BusinessError } from '@kit.BasicServicesKit'; +try { + access.enableBluetoothAsync().then(() => { + console.info('enableBluetoothAsync'); + }, (error: BusinessError) => { + console.error('enableBluetoothAsync: errCode:' + error.code + ',errMessage' + error.message); + }) + +} catch (err) { + console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); +} +``` ## access.disableBluetooth @@ -83,6 +127,50 @@ try { } ``` +## access.disableBluetoothAsync20+ + +disableBluetoothAsync(): Promise; + +关闭蓝牙。使用Promise异步回调。 + +**需要权限**:ohos.permission.ACCESS_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core + +**返回值:** + +| 类型 | 说明 | +| ------------------- | -------------------------------------- | +| Promise<void> | Promise对象。无返回结果的Promise对象。 | + +**错误码**: + +以下错误码的详细介绍请参见[通用错误码说明文档](../errorcode-universal.md)和[蓝牙服务子系统错误码](errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | -------------------------- | +| 201 | Permission denied. | +| 801 | Capability not supported. | +| 2900001 | Service stopped. | +| 2900013 | The user does not respond. | +| 2900014 | User refuse the action. | +| 2900099 | Operation failed. | + +**示例:** + +```js +import { AsyncCallback, BusinessError } from '@kit.BasicServicesKit'; +try { + access.disableBluetoothAsync().then(() => { + console.info('disableBluetoothAsync'); + }, (error: BusinessError) => { + console.error('disableBluetoothAsync: errCode:' + error.code + ',errMessage' + error.message); + }) + +} catch (err) { + console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); +} +``` ## access.getState -- Gitee