From db57831d07b44adf5425ac12efd77eac11c6566d Mon Sep 17 00:00:00 2001 From: jackis Date: Mon, 18 Aug 2025 09:27:52 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=93=9D=E7=89=99=E6=96=B0=E5=A2=9ECommonE?= =?UTF-8?q?vent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: jackis --- api/@ohos.commonEventManager.d.ts | 579 ++++++++++++++++++------------ 1 file changed, 351 insertions(+), 228 deletions(-) diff --git a/api/@ohos.commonEventManager.d.ts b/api/@ohos.commonEventManager.d.ts index 4ba551a78f..d022238712 100644 --- a/api/@ohos.commonEventManager.d.ts +++ b/api/@ohos.commonEventManager.d.ts @@ -43,10 +43,10 @@ import { CommonEventPublishData as _CommonEventPublishData } from './commonEvent */ declare namespace commonEventManager { /** - * Publishes a common event. This API uses an asynchronous callback to return the result. + * Publishes an ordered, sticky, or standard common event. * - * @param { string } event - Name of the common event to publish. For details, see System Common Events. - * @param { AsyncCallback } callback - Callback to execute after the event is published. + * @param { string } event - name of the common event. + * @param { AsyncCallback } callback - The callback of publish. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3. Parameter verification failed. * @throws { BusinessError } 1500007 - Failed to send the message to the common event service. @@ -56,10 +56,10 @@ declare namespace commonEventManager { * @since 9 */ /** - * Publishes a common event. This API uses an asynchronous callback to return the result. + * Publishes an ordered, sticky, or standard common event. * - * @param { string } event - Name of the common event to publish. For details, see System Common Events. - * @param { AsyncCallback } callback - Callback to execute after the event is published. + * @param { string } event - name of the common event. + * @param { AsyncCallback } callback - The callback of publish. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3. Parameter verification failed. * @throws { BusinessError } 1500007 - Failed to send the message to the common event service. @@ -70,10 +70,10 @@ declare namespace commonEventManager { * @since 11 */ /** - * Publishes a common event. This API uses an asynchronous callback to return the result. + * Publishes an ordered, sticky, or standard common event. * - * @param { string } event - Name of the common event to publish. For details, see System Common Events. - * @param { AsyncCallback } callback - Callback to execute after the event is published. + * @param { string } event - name of the common event. + * @param { AsyncCallback } callback - The callback of publish. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3. Parameter verification failed. * @throws { BusinessError } 1500007 - Failed to send the message to the common event service. @@ -85,10 +85,10 @@ declare namespace commonEventManager { * @since 12 */ /** - * Publishes a common event. This API uses an asynchronous callback to return the result. + * Publishes an ordered, sticky, or standard common event. * - * @param { string } event - Name of the common event to publish. For details, see System Common Events. - * @param { AsyncCallback } callback - Callback to execute after the event is published. + * @param { string } event - name of the common event. + * @param { AsyncCallback } callback - The callback of publish. * @throws { BusinessError } 1500003 - The common event sending frequency too high. * @throws { BusinessError } 1500007 - Failed to send the message to the common event service. * @throws { BusinessError } 1500008 - Failed to initialize the common event service. @@ -96,17 +96,18 @@ declare namespace commonEventManager { * @syscap SystemCapability.Notification.CommonEvent * @crossplatform * @atomicservice - * @since arkts {'1.1':'20', '1.2':'20'} + * @since 20 * @arkts 1.1&1.2 */ function publish(event: string, callback: AsyncCallback): void; /** - * Publishes a common event. This API uses an asynchronous callback to return the result. + * Publishes an ordered, sticky, or standard common event. * - * @param { string } event - Name of the common event to publish. For details, see System Common Events. - * @param { CommonEventPublishData } options - Attributes of the common event to publish. - * @param { AsyncCallback } callback - Callback used to return the result. + * @param { string } event - name of the common event. + * @param { CommonEventPublishData } options - Indicate the CommonEventPublishData containing the common event + * content and attributes. + * @param { AsyncCallback } callback - The callback of publish. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3. Parameter verification failed. * @throws { BusinessError } 1500007 - Failed to send the message to the common event service. @@ -116,11 +117,12 @@ declare namespace commonEventManager { * @since 9 */ /** - * Publishes a common event. This API uses an asynchronous callback to return the result. + * Publishes an ordered, sticky, or standard common event. * - * @param { string } event - Name of the common event to publish. For details, see System Common Events. - * @param { CommonEventPublishData } options - Attributes of the common event to publish. - * @param { AsyncCallback } callback - Callback used to return the result. + * @param { string } event - name of the common event. + * @param { CommonEventPublishData } options - Indicate the CommonEventPublishData containing the common event + * content and attributes. + * @param { AsyncCallback } callback - The callback of publish. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3. Parameter verification failed. * @throws { BusinessError } 1500007 - Failed to send the message to the common event service. @@ -131,11 +133,12 @@ declare namespace commonEventManager { * @since 11 */ /** - * Publishes a common event. This API uses an asynchronous callback to return the result. + * Publishes an ordered, sticky, or standard common event. * - * @param { string } event - Name of the common event to publish. For details, see System Common Events. - * @param { CommonEventPublishData } options - Attributes of the common event to publish. - * @param { AsyncCallback } callback - Callback used to return the result. + * @param { string } event - name of the common event. + * @param { CommonEventPublishData } options - Indicate the CommonEventPublishData containing the common event + * content and attributes. + * @param { AsyncCallback } callback - The callback of publish. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3. Parameter verification failed. * @throws { BusinessError } 1500007 - Failed to send the message to the common event service. @@ -147,11 +150,12 @@ declare namespace commonEventManager { * @since 12 */ /** - * Publishes a common event. This API uses an asynchronous callback to return the result. + * Publishes an ordered, sticky, or standard common event. * - * @param { string } event - Name of the common event to publish. For details, see System Common Events. - * @param { CommonEventPublishData } options - Attributes of the common event to publish. - * @param { AsyncCallback } callback - Callback used to return the result. + * @param { string } event - name of the common event. + * @param { CommonEventPublishData } options - Indicate the CommonEventPublishData containing the common event + * content and attributes. + * @param { AsyncCallback } callback - The callback of publish. * @throws { BusinessError } 1500003 - The common event sending frequency too high. * @throws { BusinessError } 1500007 - Failed to send the message to the common event service. * @throws { BusinessError } 1500008 - Failed to initialize the common event service. @@ -159,7 +163,7 @@ declare namespace commonEventManager { * @syscap SystemCapability.Notification.CommonEvent * @crossplatform * @atomicservice - * @since arkts {'1.1':'20', '1.2':'20'} + * @since 20 * @arkts 1.1&1.2 */ function publish(event: string, options: CommonEventPublishData, callback: AsyncCallback): void; @@ -172,7 +176,7 @@ declare namespace commonEventManager { * @param { AsyncCallback } callback - The callback of publishAsUser. * @throws { BusinessError } 202 - not system app * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. + *
2. Incorrect parameter types. 3. Parameter verification failed. * @throws { BusinessError } 1500007 - Failed to send the message to the common event service. * @throws { BusinessError } 1500008 - Failed to initialize the common event service. * @throws { BusinessError } 1500009 - Failed to obtain system parameters. @@ -184,7 +188,7 @@ declare namespace commonEventManager { * Publishes an ordered, sticky, or standard common event to a specified user. * * @param { string } event - Specified the names of the common events. - * @param { number } userId - Specified the user to receive the common events. + * @param { int } userId - Specified the user to receive the common events. * @param { AsyncCallback } callback - The callback of publishAsUser. * @throws { BusinessError } 202 - not system app * @throws { BusinessError } 1500003 - The common event sending frequency too high. @@ -193,10 +197,10 @@ declare namespace commonEventManager { * @throws { BusinessError } 1500009 - Failed to obtain system parameters. * @syscap SystemCapability.Notification.CommonEvent * @systemapi - * @since arkts {'1.1':'20', '1.2':'20'} + * @since 20 * @arkts 1.1&1.2 */ - function publishAsUser(event: string, userId: number, callback: AsyncCallback): void; + function publishAsUser(event: string, userId: int, callback: AsyncCallback): void; /** * Publishes an ordered, sticky, or standard common event to a specified user. @@ -204,11 +208,11 @@ declare namespace commonEventManager { * @param { string } event - Specified the names of the common events. * @param { number } userId - Specified the user to receive the common events. * @param { CommonEventPublishData } options - Indicates the CommonEventPublishData containing the common event - * content and attributes. + * content and attributes. * @param { AsyncCallback } callback - The callback of publishAsUser. * @throws { BusinessError } 202 - not system app * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. + *
2. Incorrect parameter types. 3. Parameter verification failed. * @throws { BusinessError } 1500007 - Failed to send the message to the common event service. * @throws { BusinessError } 1500008 - Failed to initialize the common event service. * @throws { BusinessError } 1500009 - Failed to obtain system parameters. @@ -216,13 +220,13 @@ declare namespace commonEventManager { * @systemapi * @since 9 */ - /** + /** * Publishes an ordered, sticky, or standard common event to a specified user. * * @param { string } event - Specified the names of the common events. - * @param { number } userId - Specified the user to receive the common events. + * @param { int } userId - Specified the user to receive the common events. * @param { CommonEventPublishData } options - Indicates the CommonEventPublishData containing the common event - * content and attributes. + * content and attributes. * @param { AsyncCallback } callback - The callback of publishAsUser. * @throws { BusinessError } 202 - not system app * @throws { BusinessError } 1500003 - The common event sending frequency too high. @@ -231,37 +235,39 @@ declare namespace commonEventManager { * @throws { BusinessError } 1500009 - Failed to obtain system parameters. * @syscap SystemCapability.Notification.CommonEvent * @systemapi - * @since arkts {'1.1':'20', '1.2':'20'} + * @since 20 * @arkts 1.1&1.2 */ function publishAsUser( event: string, - userId: number, + userId: int, options: CommonEventPublishData, callback: AsyncCallback ): void; /** - * Creates a subscriber. This API uses an asynchronous callback to return the result. + * Creates a CommonEventSubscriber for the SubscriberInfo. * - * @param { CommonEventSubscribeInfo } subscribeInfo - Subscriber information. - * @param { AsyncCallback } callback - Callback used to return the result. + * @param { CommonEventSubscribeInfo } subscribeInfo - Indicates the information of the subscriber. + * @param { AsyncCallback } callback - The callback is used to return the + * CommonEventSubscriber object. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3. Parameter verification failed. * @syscap SystemCapability.Notification.CommonEvent * @since 9 */ /** - * Creates a subscriber. This API uses an asynchronous callback to return the result. + * Creates a CommonEventSubscriber for the SubscriberInfo. * - * @param { CommonEventSubscribeInfo } subscribeInfo - Subscriber information. - * @param { AsyncCallback } callback - Callback used to return the result. + * @param { CommonEventSubscribeInfo } subscribeInfo - Indicates the information of the subscriber. + * @param { AsyncCallback } callback - The callback is used to return the + * CommonEventSubscriber object. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3. Parameter verification failed. * @syscap SystemCapability.Notification.CommonEvent * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} + * @since arkts{ '1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ function createSubscriber( @@ -270,59 +276,59 @@ declare namespace commonEventManager { ): void; /** - * Creates a subscriber. This API uses a promise to return the result. + * Creates a CommonEventSubscriber for the SubscriberInfo. * - * @param { CommonEventSubscribeInfo } subscribeInfo - Subscriber information. - * @returns { Promise } Promise used to return the result. + * @param { CommonEventSubscribeInfo } subscribeInfo - Indicates the information of the subscriber. + * @returns { Promise } Returns the CommonEventSubscriber object. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3. Parameter verification failed. * @syscap SystemCapability.Notification.CommonEvent * @since 9 */ /** - * Creates a subscriber. This API uses a promise to return the result. + * Creates a CommonEventSubscriber for the SubscriberInfo. * - * @param { CommonEventSubscribeInfo } subscribeInfo - Subscriber information. - * @returns { Promise } Promise used to return the result. + * @param { CommonEventSubscribeInfo } subscribeInfo - Indicates the information of the subscriber. + * @returns { Promise } Returns the CommonEventSubscriber object. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3. Parameter verification failed. * @syscap SystemCapability.Notification.CommonEvent * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} + * @since arkts{ '1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ function createSubscriber(subscribeInfo: CommonEventSubscribeInfo): Promise; /** - * Creates a subscriber. The API returns the result synchronously. + * Creates a CommonEventSubscriber for the SubscriberInfo. * - * @param { CommonEventSubscribeInfo } subscribeInfo - Subscriber information. - * @returns { CommonEventSubscriber } Promise used to return the subscriber object. + * @param { CommonEventSubscribeInfo } subscribeInfo - Indicates the information of the subscriber. + * @returns { CommonEventSubscriber } Returns the CommonEventSubscriber object. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3. Parameter verification failed. * @syscap SystemCapability.Notification.CommonEvent * @since 10 */ /** - * Creates a subscriber. The API returns the result synchronously. + * Creates a CommonEventSubscriber for the SubscriberInfo. * - * @param { CommonEventSubscribeInfo } subscribeInfo - Subscriber information. - * @returns { CommonEventSubscriber } Promise used to return the subscriber object. + * @param { CommonEventSubscribeInfo } subscribeInfo - Indicates the information of the subscriber. + * @returns { CommonEventSubscriber } Returns the CommonEventSubscriber object. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3. Parameter verification failed. * @syscap SystemCapability.Notification.CommonEvent * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} + * @since arkts{ '1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ function createSubscriberSync(subscribeInfo: CommonEventSubscribeInfo): CommonEventSubscriber; /** - * Subscribes to a common event. This API uses an asynchronous callback to return the result. + * Subscribe an ordered, sticky, or standard common event. * - * @param { CommonEventSubscriber } subscriber - Subscriber object. - * @param { AsyncCallback } callback - Callback used to return the result. + * @param { CommonEventSubscriber } subscriber - Indicate the subscriber of the common event. + * @param { AsyncCallback } callback - The callback is used to return the CommonEventData object. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3. Parameter verification failed. * @throws { BusinessError } 801 - capability not supported @@ -332,10 +338,10 @@ declare namespace commonEventManager { * @since 9 */ /** - * Subscribes to a common event. This API uses an asynchronous callback to return the result. + * Subscribe an ordered, sticky, or standard common event. * - * @param { CommonEventSubscriber } subscriber - Subscriber object. - * @param { AsyncCallback } callback - Callback used to return the result. + * @param { CommonEventSubscriber } subscriber - Indicate the subscriber of the common event. + * @param { AsyncCallback } callback - The callback is used to return the CommonEventData object. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3. Parameter verification failed. * @throws { BusinessError } 801 - capability not supported @@ -347,10 +353,10 @@ declare namespace commonEventManager { * @since 11 */ /** - * Subscribes to a common event. This API uses an asynchronous callback to return the result. + * Subscribe an ordered, sticky, or standard common event. * - * @param { CommonEventSubscriber } subscriber - Subscriber object. - * @param { AsyncCallback } callback - Callback used to return the result. + * @param { CommonEventSubscriber } subscriber - Indicate the subscriber of the common event. + * @param { AsyncCallback } callback - The callback is used to return the CommonEventData object. * @throws { BusinessError } 801 - capability not supported * @throws { BusinessError } 1500007 - Failed to send the message to the common event service. * @throws { BusinessError } 1500008 - Failed to initialize the common event service. @@ -358,7 +364,7 @@ declare namespace commonEventManager { * @syscap SystemCapability.Notification.CommonEvent * @crossplatform * @atomicservice - * @since arkts {'1.1':'20', '1.2':'20'} + * @since 20 * @arkts 1.1&1.2 */ function subscribe(subscriber: CommonEventSubscriber, callback: AsyncCallback): void; @@ -383,10 +389,10 @@ declare namespace commonEventManager { function subscribeToEvent(subscriber: CommonEventSubscriber, callback: Callback): Promise; /** - * Unsubscribes from a common event. This API uses an asynchronous callback to return the result. + * Unsubscribe from an ordered, sticky, or standard common event. * - * @param { CommonEventSubscriber } subscriber - Subscriber object. - * @param { AsyncCallback } [callback] - Callback used to return the result. + * @param { CommonEventSubscriber } subscriber - Indicate the subscriber of the common event. + * @param { AsyncCallback } [callback] - The callback of unsubscribe. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3. Parameter verification failed. * @throws { BusinessError } 801 - capability not supported @@ -396,10 +402,10 @@ declare namespace commonEventManager { * @since 9 */ /** - * Unsubscribes from a common event. This API uses an asynchronous callback to return the result. + * Unsubscribe from an ordered, sticky, or standard common event. * - * @param { CommonEventSubscriber } subscriber - Subscriber object. - * @param { AsyncCallback } [callback] - Callback used to return the result. + * @param { CommonEventSubscriber } subscriber - Indicate the subscriber of the common event. + * @param { AsyncCallback } [callback] - The callback of unsubscribe. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3. Parameter verification failed. * @throws { BusinessError } 801 - capability not supported @@ -408,7 +414,7 @@ declare namespace commonEventManager { * @syscap SystemCapability.Notification.CommonEvent * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} + * @since arkts{ '1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ function unsubscribe(subscriber: CommonEventSubscriber, callback?: AsyncCallback): void; @@ -465,8 +471,7 @@ declare namespace commonEventManager { * @throws { BusinessError } 1500008 - Failed to initialize the common event service. * @syscap SystemCapability.Notification.CommonEvent * @systemapi Hide this for inner system use. - * @StageModelOnly - * @since arkts {'1.1':'10', '1.2':'20'} + * @since arkts{ '1.1':'10','1.2':'20'} * @arkts 1.1&1.2 */ function setStaticSubscriberState(enable: boolean, callback: AsyncCallback): void; @@ -483,8 +488,7 @@ declare namespace commonEventManager { * @throws { BusinessError } 1500008 - Failed to initialize the common event service. * @syscap SystemCapability.Notification.CommonEvent * @systemapi Hide this for inner system use. - * @StageModelOnly - * @since arkts {'1.1':'10', '1.2':'20'} + * @since arkts{ '1.1':'10','1.2':'20'} * @arkts 1.1&1.2 */ function setStaticSubscriberState(enable: boolean): Promise; @@ -502,8 +506,7 @@ declare namespace commonEventManager { * @throws { BusinessError } 1500008 - Failed to initialize the common event service. * @syscap SystemCapability.Notification.CommonEvent * @systemapi Hide this for inner system use. - * @StageModelOnly - * @since arkts {'1.1':'12', '1.2':'20'} + * @since arkts{ '1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ function setStaticSubscriberState(enable: boolean, events?: Array): Promise; @@ -525,6 +528,7 @@ declare namespace commonEventManager { * @arkts 1.1&1.2 */ export enum Support { + /** * This commonEvent means when the device is booted or system upgrade completed, and only be sent by system. * This API can be called only by system applications. @@ -533,7 +537,7 @@ declare namespace commonEventManager { * @since arkts {'1.1':'9', '1.2':'20'} * @arkts 1.1&1.2 */ - COMMON_EVENT_BOOT_COMPLETED = 'usual.event.BOOT_COMPLETED', + COMMON_EVENT_BOOT_COMPLETED = 'usual.event.BOOT_COMPLETED' /** * This commonEvent means when the device finnish booting, but still in the locked state. @@ -1020,7 +1024,7 @@ declare namespace commonEventManager { COMMON_EVENT_USER_LOCKING = 'usual.event.USER_LOCKING', /** - * Indicates the target user (i.e the OS acount) is locked. + * Indicates the target user (i.e the OS account) is locked. * This is a protected common event that can only be sent by system. * * @syscap SystemCapability.Notification.CommonEvent @@ -1243,334 +1247,377 @@ declare namespace commonEventManager { * Bluetooth.handsfree.ag.connect.state.update. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 + * @useinstead commonEventManager.Support#COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_CONNECT_STATE_CHANGE */ - COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_CONNECT_STATE_UPDATE = 'usual.event.bluetooth.handsfree.ag.CONNECT_STATE_UPDATE', + COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_CONNECT_STATE_UPDATE = + "usual.event.bluetooth.handsfree.ag.CONNECT_STATE_UPDATE", /** * Bluetooth.handsfree.ag.current.device.update. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 */ - COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_CURRENT_DEVICE_UPDATE = 'usual.event.bluetooth.handsfree.ag.CURRENT_DEVICE_UPDATE', + COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_CURRENT_DEVICE_UPDATE = + "usual.event.bluetooth.handsfree.ag.CURRENT_DEVICE_UPDATE", /** * Bluetooth.handsfree.ag.audio.state.update. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 */ - COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_AUDIO_STATE_UPDATE = 'usual.event.bluetooth.handsfree.ag.AUDIO_STATE_UPDATE', + COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_AUDIO_STATE_UPDATE = + "usual.event.bluetooth.handsfree.ag.AUDIO_STATE_UPDATE", /** * Bluetooth.a2dpsource.connect.state.update. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 + * @useinstead commonEventManager.Support#COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CONNECT_STATE_CHANGE */ - COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CONNECT_STATE_UPDATE = 'usual.event.bluetooth.a2dpsource.CONNECT_STATE_UPDATE', + COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CONNECT_STATE_UPDATE = + "usual.event.bluetooth.a2dpsource.CONNECT_STATE_UPDATE", /** * Bluetooth.a2dpsource.current.device.update. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 */ - COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CURRENT_DEVICE_UPDATE = 'usual.event.bluetooth.a2dpsource.CURRENT_DEVICE_UPDATE', + COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CURRENT_DEVICE_UPDATE = + "usual.event.bluetooth.a2dpsource.CURRENT_DEVICE_UPDATE", /** * Bluetooth.a2dpsource.playing.state.update. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 */ - COMMON_EVENT_BLUETOOTH_A2DPSOURCE_PLAYING_STATE_UPDATE = 'usual.event.bluetooth.a2dpsource.PLAYING_STATE_UPDATE', + COMMON_EVENT_BLUETOOTH_A2DPSOURCE_PLAYING_STATE_UPDATE = + "usual.event.bluetooth.a2dpsource.PLAYING_STATE_UPDATE", /** * Bluetooth.a2dpsource.avrcp.connect.state.update. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 + * @useinstead commonEventManager.Support#COMMON_EVENT_BLUETOOTH_A2DPSOURCE_AVRCP_CONNECT_STATE_CHANGE */ - COMMON_EVENT_BLUETOOTH_A2DPSOURCE_AVRCP_CONNECT_STATE_UPDATE = 'usual.event.bluetooth.a2dpsource.AVRCP_CONNECT_STATE_UPDATE', + COMMON_EVENT_BLUETOOTH_A2DPSOURCE_AVRCP_CONNECT_STATE_UPDATE = + "usual.event.bluetooth.a2dpsource.AVRCP_CONNECT_STATE_UPDATE", /** * Bluetooth.a2dpsource.codec.value.update. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 + * @useinstead commonEventManager.Support#COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CODEC_VALUE_CHANGE */ - COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CODEC_VALUE_UPDATE = 'usual.event.bluetooth.a2dpsource.CODEC_VALUE_UPDATE', + COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CODEC_VALUE_UPDATE = + "usual.event.bluetooth.a2dpsource.CODEC_VALUE_UPDATE", /** * Bluetooth.remotedevice.discovered. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 */ - COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_DISCOVERED = 'usual.event.bluetooth.remotedevice.DISCOVERED', + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_DISCOVERED = + "usual.event.bluetooth.remotedevice.DISCOVERED", /** * Bluetooth.remotedevice.class.value.update. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 */ - COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CLASS_VALUE_UPDATE = 'usual.event.bluetooth.remotedevice.CLASS_VALUE_UPDATE', + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CLASS_VALUE_UPDATE = + "usual.event.bluetooth.remotedevice.CLASS_VALUE_UPDATE", /** * Bluetooth.remotedevice.acl.connected. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 + * @useinstead commonEventManager.Support#COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_STATE_CHANGE */ - COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_CONNECTED = 'usual.event.bluetooth.remotedevice.ACL_CONNECTED', + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_CONNECTED = + "usual.event.bluetooth.remotedevice.ACL_CONNECTED", /** * Bluetooth.remotedevice.acl.disconnected. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 + * @useinstead commonEventManager.Support#COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_STATE_CHANGE */ - COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_DISCONNECTED = 'usual.event.bluetooth.remotedevice.ACL_DISCONNECTED', + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_DISCONNECTED = + "usual.event.bluetooth.remotedevice.ACL_DISCONNECTED", /** * Bluetooth.remotedevice.name.update. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 */ - COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_NAME_UPDATE = 'usual.event.bluetooth.remotedevice.NAME_UPDATE', + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_NAME_UPDATE = + "usual.event.bluetooth.remotedevice.NAME_UPDATE", /** * Bluetooth.remotedevice.pair.state. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 + * @useinstead commonEventManager.Support#COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIR_STATE_CHANGE */ - COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIR_STATE = 'usual.event.bluetooth.remotedevice.PAIR_STATE', + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIR_STATE = + "usual.event.bluetooth.remotedevice.PAIR_STATE", /** * Bluetooth.remotedevice.battery.value.update. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 */ - COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_BATTERY_VALUE_UPDATE = 'usual.event.bluetooth.remotedevice.BATTERY_VALUE_UPDATE', + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_BATTERY_VALUE_UPDATE = + "usual.event.bluetooth.remotedevice.BATTERY_VALUE_UPDATE", /** * Bluetooth.remotedevice.sdp.result. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 */ - COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_SDP_RESULT = 'usual.event.bluetooth.remotedevice.SDP_RESULT', + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_SDP_RESULT = + "usual.event.bluetooth.remotedevice.SDP_RESULT", /** * Bluetooth.remotedevice.uuid.value. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 */ - COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_UUID_VALUE = 'usual.event.bluetooth.remotedevice.UUID_VALUE', + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_UUID_VALUE = + "usual.event.bluetooth.remotedevice.UUID_VALUE", /** * Bluetooth.remotedevice.pairing.req. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 */ - COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIRING_REQ = 'usual.event.bluetooth.remotedevice.PAIRING_REQ', + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIRING_REQ = + "usual.event.bluetooth.remotedevice.PAIRING_REQ", /** * Bluetooth.remotedevice.pairing.cancel. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 */ - COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIRING_CANCEL = 'usual.event.bluetooth.remotedevice.PAIRING_CANCEL', + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIRING_CANCEL = + "usual.event.bluetooth.remotedevice.PAIRING_CANCEL", /** * Bluetooth.remotedevice.connect.req. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 */ - COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_REQ = 'usual.event.bluetooth.remotedevice.CONNECT_REQ', + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_REQ = + "usual.event.bluetooth.remotedevice.CONNECT_REQ", /** * Bluetooth.remotedevice.connect.reply. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 */ - COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_REPLY = 'usual.event.bluetooth.remotedevice.CONNECT_REPLY', + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_REPLY = + "usual.event.bluetooth.remotedevice.CONNECT_REPLY", /** * Bluetooth.remotedevice.connect.cancel. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 */ - COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_CANCEL = 'usual.event.bluetooth.remotedevice.CONNECT_CANCEL', + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_CANCEL = + "usual.event.bluetooth.remotedevice.CONNECT_CANCEL", /** * Bluetooth.handsfreeunit.connect.state.update. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 */ - COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_CONNECT_STATE_UPDATE = 'usual.event.bluetooth.handsfreeunit.CONNECT_STATE_UPDATE', + COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_CONNECT_STATE_UPDATE = + "usual.event.bluetooth.handsfreeunit.CONNECT_STATE_UPDATE", /** * Bluetooth.handsfreeunit.audio.state.update. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 */ - COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AUDIO_STATE_UPDATE = 'usual.event.bluetooth.handsfreeunit.AUDIO_STATE_UPDATE', + COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AUDIO_STATE_UPDATE = + "usual.event.bluetooth.handsfreeunit.AUDIO_STATE_UPDATE", /** * Bluetooth.handsfreeunit.ag.common.event. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 */ - COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AG_COMMON_EVENT = 'usual.event.bluetooth.handsfreeunit.AG_COMMON_EVENT', + COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AG_COMMON_EVENT = + "usual.event.bluetooth.handsfreeunit.AG_COMMON_EVENT", /** * Bluetooth.handsfreeunit.ag.call.state.update. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 */ - COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AG_CALL_STATE_UPDATE = 'usual.event.bluetooth.handsfreeunit.AG_CALL_STATE_UPDATE', + COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AG_CALL_STATE_UPDATE = + "usual.event.bluetooth.handsfreeunit.AG_CALL_STATE_UPDATE", /** * Bluetooth.host.state.update. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 */ - COMMON_EVENT_BLUETOOTH_HOST_STATE_UPDATE = 'usual.event.bluetooth.host.STATE_UPDATE', + COMMON_EVENT_BLUETOOTH_HOST_STATE_UPDATE = + "usual.event.bluetooth.host.STATE_UPDATE", /** * Bluetooth.host.req.discoverable. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 */ - COMMON_EVENT_BLUETOOTH_HOST_REQ_DISCOVERABLE = 'usual.event.bluetooth.host.REQ_DISCOVERABLE', + COMMON_EVENT_BLUETOOTH_HOST_REQ_DISCOVERABLE = + "usual.event.bluetooth.host.REQ_DISCOVERABLE", /** * Bluetooth.host.req.enable. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 */ - COMMON_EVENT_BLUETOOTH_HOST_REQ_ENABLE = 'usual.event.bluetooth.host.REQ_ENABLE', + COMMON_EVENT_BLUETOOTH_HOST_REQ_ENABLE = "usual.event.bluetooth.host.REQ_ENABLE", /** * Bluetooth.host.req.disable. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 */ - COMMON_EVENT_BLUETOOTH_HOST_REQ_DISABLE = 'usual.event.bluetooth.host.REQ_DISABLE', + COMMON_EVENT_BLUETOOTH_HOST_REQ_DISABLE = + "usual.event.bluetooth.host.REQ_DISABLE", /** * Bluetooth.host.scan.mode.update. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 */ - COMMON_EVENT_BLUETOOTH_HOST_SCAN_MODE_UPDATE = 'usual.event.bluetooth.host.SCAN_MODE_UPDATE', + COMMON_EVENT_BLUETOOTH_HOST_SCAN_MODE_UPDATE = + "usual.event.bluetooth.host.SCAN_MODE_UPDATE", /** * Bluetooth.host.discovery.stated. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 */ - COMMON_EVENT_BLUETOOTH_HOST_DISCOVERY_STARTED = 'usual.event.bluetooth.host.DISCOVERY_STARTED', + COMMON_EVENT_BLUETOOTH_HOST_DISCOVERY_STARTED = + "usual.event.bluetooth.host.DISCOVERY_STARTED", /** * Bluetooth.host.discovery.finished. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 */ - COMMON_EVENT_BLUETOOTH_HOST_DISCOVERY_FINISHED = 'usual.event.bluetooth.host.DISCOVERY_FINISHED', + COMMON_EVENT_BLUETOOTH_HOST_DISCOVERY_FINISHED = + "usual.event.bluetooth.host.DISCOVERY_FINISHED", /** * Bluetooth.host.name.update. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 */ - COMMON_EVENT_BLUETOOTH_HOST_NAME_UPDATE = 'usual.event.bluetooth.host.NAME_UPDATE', + COMMON_EVENT_BLUETOOTH_HOST_NAME_UPDATE = + "usual.event.bluetooth.host.NAME_UPDATE", /** * Bluetooth.a2dp.connect.state.update. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 */ - COMMON_EVENT_BLUETOOTH_A2DPSINK_CONNECT_STATE_UPDATE = 'usual.event.bluetooth.a2dpsink.CONNECT_STATE_UPDATE', + COMMON_EVENT_BLUETOOTH_A2DPSINK_CONNECT_STATE_UPDATE = + "usual.event.bluetooth.a2dpsink.CONNECT_STATE_UPDATE", /** * Bluetooth.a2dp.playing.state.update. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 */ - COMMON_EVENT_BLUETOOTH_A2DPSINK_PLAYING_STATE_UPDATE = 'usual.event.bluetooth.a2dpsink.PLAYING_STATE_UPDATE', + COMMON_EVENT_BLUETOOTH_A2DPSINK_PLAYING_STATE_UPDATE = + "usual.event.bluetooth.a2dpsink.PLAYING_STATE_UPDATE", /** * Bluetooth.a2dp.audio.state.update. * * @syscap SystemCapability.Notification.CommonEvent - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @deprecated since 20 */ - COMMON_EVENT_BLUETOOTH_A2DPSINK_AUDIO_STATE_UPDATE = 'usual.event.bluetooth.a2dpsink.AUDIO_STATE_UPDATE', + COMMON_EVENT_BLUETOOTH_A2DPSINK_AUDIO_STATE_UPDATE = + "usual.event.bluetooth.a2dpsink.AUDIO_STATE_UPDATE", /** * Nfc state change. @@ -2450,25 +2497,36 @@ declare namespace commonEventManager { COMMON_EVENT_SPECIAL_CODE = 'common.event.SPECIAL_CODE', /** - * Indicates the action of a common event that audio quality change. - * This is a protected common event that can only be sent by system. - * - * @syscap SystemCapability.Notification.CommonEvent - * @systemapi - * @since arkts {'1.1':'10', '1.2':'20'} - * @arkts 1.1&1.2 - */ + * Indicates the action of a common event that audio quality change. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @systemapi + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ COMMON_EVENT_AUDIO_QUALITY_CHANGE = 'usual.event.AUDIO_QUALITY_CHANGE', /** - * Indicates that the privacy status is changed. - * This is a protected common event that can only be sent by system. - * - * @syscap SystemCapability.Notification.CommonEvent - * @systemapi - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 - */ + * Indicates the action of a common event that bluetooth handsfree ag connection state change. + * To subscribe to this protected common event, your application must have the ohos.permission.ACCESS_BLUETOOTH + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 20 + * @arkts 1.1&1.2 + */ + COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_CONNECT_STATE_CHANGE = + "usual.event.bluetooth.handsfree.ag.CONNECT_STATE_CHANGE", + + /** + * Indicates that the privacy status is changed. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @systemapi + * @since arkts {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ COMMON_EVENT_PRIVACY_STATE_CHANGED = 'usual.event.PRIVACY_STATE_CHANGED', /** @@ -2520,13 +2578,13 @@ declare namespace commonEventManager { * To subscribe to this common event, your application must have the ohos.permission.GET_BUNDLE_RESOURCES * permission. * This is a protected common event, which can be sent only by the system. - * + * * @syscap SystemCapability.Notification.CommonEvent * @systemapi * @since arkts {'1.1':'15', '1.2':'20'} * @arkts 1.1&1.2 */ - COMMON_EVENT_BUNDLE_RESOURCES_CHANGED = 'usual.event.BUNDLE_RESOURCES_CHANGED', + COMMON_EVENT_BUNDLE_RESOURCES_CHANGED = 'usual.event.BUNDLE_RESOURCES_CHANGED', /** * This common event means that datashare is ready. @@ -2555,7 +2613,7 @@ declare namespace commonEventManager { * To subscribe to this common event, your application must have the ohos.permission.START_RESTORE_NOTIFICATION * permission. * This is a protected common event that can only be sent by system. - * + * * @syscap SystemCapability.Notification.CommonEvent * @systemapi * @since arkts {'1.1':'13', '1.2':'20'} @@ -2563,6 +2621,61 @@ declare namespace commonEventManager { */ COMMON_EVENT_RESTORE_START = 'usual.event.RESTORE_START', + /** + * Indicates the action of a common event that bluetooth a2dp source connection state change. + * To subscribe to this protected common event, your application must have the ohos.permission.ACCESS_BLUETOOTH + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 20 + * @arkts 1.1&1.2 + */ + COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CONNECT_STATE_CHANGE = + "usual.event.bluetooth.a2dpsource.CONNECT_STATE_CHANGE", + + /** + * Indicates the action of a common event that bluetooth avrcp connection state change. + * To subscribe to this protected common event, your application must have the ohos.permission.ACCESS_BLUETOOTH + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 20 + * @arkts 1.1&1.2 + */ + COMMON_EVENT_BLUETOOTH_A2DPSOURCE_AVRCP_CONNECT_STATE_CHANGE = + "usual.event.bluetooth.a2dpsource.AVRCP_CONNECT_STATE_CHANGE", + + /** + * Indicates the action of a common event that bluetooth codec change. + * To subscribe to this protected common event, your application must have the ohos.permission.ACCESS_BLUETOOTH + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 20 + * @arkts 1.1&1.2 + */ + COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CODEC_VALUE_CHANGE = + "usual.event.bluetooth.a2dpsource.CODEC_VALUE_CHANGE", + + /** + * Indicates the action of a common event that bluetooth remote device acl state change. + * To subscribe to this protected common event, your application must have the ohos.permission.ACCESS_BLUETOOTH + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 20 + * @arkts 1.1&1.2 + */ + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_STATE_CHANGE = + "usual.event.bluetooth.remotedevice.ACL_STATE_CHANGE", + + /** + * Indicates the action of a common event that bluetooth pair state change. + * To subscribe to this protected common event, your application must have the ohos.permission.ACCESS_BLUETOOTH + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 20 + * @arkts 1.1&1.2 + */ + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIR_STATE_CHANGE = + "usual.event.bluetooth.remotedevice.PAIR_STATE_CHANGE", + /** * Indicates that the managed browser policy is changed. * This is a protected common event that can only be sent by system. @@ -2574,29 +2687,29 @@ declare namespace commonEventManager { COMMON_EVENT_MANAGED_BROWSER_POLICY_CHANGED = 'usual.event.MANAGED_BROWSER_POLICY_CHANGED', /** - * Indicates that the default application is changed. - * To subscribe to this common event, your application must have the ohos.permission.CHANGE_DEFAULT_APPLICATION - * permission. + * This common event means that shortcut has been changed. + * To subscribe to this common event, your application must have the ohos.permission.MANAGE_SHORTCUTS permission. * This is a protected common event that can only be sent by system. * * @syscap SystemCapability.Notification.CommonEvent * @systemapi - * @since arkts {'1.1':'19', '1.2':'20'} + * @since 20 * @arkts 1.1&1.2 */ - COMMON_EVENT_DEFAULT_APPLICATION_CHANGED = 'usual.event.DEFAULT_APPLICATION_CHANGED', + COMMON_EVENT_SHORTCUT_CHANGED = 'usual.event.SHORTCUT_CHANGED', /** - * This common event means that shortcut has been changed. - * To subscribe to this common event, your application must have the ohos.permission.MANAGE_SHORTCUTS permission. + * Indicates that the default application is changed. + * To subscribe to this common event, your application must have the ohos.permission.CHANGE_DEFAULT_APPLICATION + * permission. * This is a protected common event that can only be sent by system. - * + * * @syscap SystemCapability.Notification.CommonEvent * @systemapi - * @since 20 + * @since arkts{ '1.1':'19','1.2':'20'} * @arkts 1.1&1.2 */ - COMMON_EVENT_SHORTCUT_CHANGED = 'usual.event.SHORTCUT_CHANGED', + COMMON_EVENT_DEFAULT_APPLICATION_CHANGED = 'usual.event.DEFAULT_APPLICATION_CHANGED', /** * This common event means that kiosk mode is on. @@ -2637,6 +2750,16 @@ declare namespace commonEventManager { * @arkts 1.1&1.2 */ COMMON_EVENT_CUSTOM_ROAMING_REGION_UPDATED = 'usual.event.CUSTOM_ROAMING_REGION_UPDATED', + + /** + * This common event means a screen capture event occurred in the system. + * This is a protected common event that can only be sent by system. + * @syscap SystemCapability.Notification.CommonEvent + * @systemapi + * @since 20 + * @arkts 1.1&1.2 + */ + COMMON_EVENT_SCREEN_SHARE = 'usual.event.SCREEN_SHARE' } /** @@ -2717,4 +2840,4 @@ declare namespace commonEventManager { export type CommonEventPublishData = _CommonEventPublishData; } -export default commonEventManager; +export default commonEventManager; \ No newline at end of file -- Gitee From 24e8938d81e03cbe0a692c07dff0447d4de42130 Mon Sep 17 00:00:00 2001 From: jackis Date: Mon, 18 Aug 2025 20:15:24 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=93=9D=E7=89=996.0=E9=9C=80=E6=B1=82?= =?UTF-8?q?=E5=90=88=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: jackis --- api/@ohos.bluetooth.ble.d.ts | 14089 +++++++++++++++--------------- api/@ohos.bluetooth.socket.d.ts | 543 +- 2 files changed, 7387 insertions(+), 7245 deletions(-) diff --git a/api/@ohos.bluetooth.ble.d.ts b/api/@ohos.bluetooth.ble.d.ts index 7bd6f01bd1..586978fbbb 100644 --- a/api/@ohos.bluetooth.ble.d.ts +++ b/api/@ohos.bluetooth.ble.d.ts @@ -1,6993 +1,7098 @@ -/* - * Copyright (C) 2023-2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * @kit ConnectivityKit - */ - -import type { AsyncCallback, Callback } from './@ohos.base'; -import type constant from './@ohos.bluetooth.constant'; - -/** - * Provides methods to operate or manage Bluetooth. - * - * @namespace ble - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ -/** - * Provides methods to operate or manage Bluetooth. - * - * @namespace ble - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ -/** - * Provides methods to operate or manage Bluetooth. - * - * @namespace ble - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ -declare namespace ble { - /** - * Indicate the profile connection state. - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Indicate the profile connection state. - * - * @typedef { constant.ProfileConnectionState } ProfileConnectionState - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Indicate the profile connection state. - * - * @typedef { constant.ProfileConnectionState } ProfileConnectionState - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - type ProfileConnectionState = constant.ProfileConnectionState; - - /** - * create a Gatt server instance. - * - * @returns { GattServer } Returns a Gatt server instance {@code GattServer}. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * create a Gatt server instance. - * - * @returns { GattServer } Returns a Gatt server instance {@code GattServer}. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * create a Gatt server instance. - * - * @returns { GattServer } Returns a Gatt server instance {@code GattServer}. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - function createGattServer(): GattServer; - - /** - * create a Gatt client device instance. - * - * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". - * @returns { GattClientDevice } Returns a Gatt client device instance {@code GattClientDevice}. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * create a Gatt client device instance. - * - * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". - * @returns { GattClientDevice } Returns a Gatt client device instance {@code GattClientDevice}. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * create a Gatt client device instance. - * - * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". - * @returns { GattClientDevice } Returns a Gatt client device instance {@code GattClientDevice}. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - function createGattClientDevice(deviceId: string): GattClientDevice; - - /** - * Create a ble scanner instance. Each ble scanner instance can be independently started or stopped. - * - * @returns { BleScanner } Returns the promise object. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 15 - */ - function createBleScanner(): BleScanner; - - /** - * Obtains the list of devices in the connected status. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @returns { Array } Returns the list of device address. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Obtains the list of devices in the connected status. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @returns { Array } Returns the list of device address. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @since 13 - */ - function getConnectedBLEDevices(): Array; - - /** - * Starts scanning for specified BLE devices with filters. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { Array } filters - Indicates the list of filters used to filter out specified devices. - * If you do not want to use filter, set this parameter to {@code null}. - * @param { ScanOptions } options - Indicates the parameters for scanning and if the user does not assign a value, the default value will be used. - * {@link ScanOptions#interval} set to 0, {@link ScanOptions#dutyMode} set to {@link SCAN_MODE_LOW_POWER} - * and {@link ScanOptions#matchMode} set to {@link MATCH_MODE_AGGRESSIVE}. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Starts scanning for specified BLE devices with filters. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { Array } filters - Indicates the list of filters used to filter out specified devices. - * If you do not want to use filter, set this parameter to {@code null}. - * @param { ScanOptions } options - Indicates the parameters for scanning and if the user does not assign a value, the default value will be used. - * {@link ScanOptions#interval} set to 0, {@link ScanOptions#dutyMode} set to {@link SCAN_MODE_LOW_POWER} - * and {@link ScanOptions#matchMode} set to {@link MATCH_MODE_AGGRESSIVE}. - * and {@link ScanOptions#phyType} set to {@link PHY_LE_ALL_SUPPORTED}. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Starts scanning for specified BLE devices with filters. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { Array } filters - Indicates the list of filters used to filter out specified devices. - * If you do not want to use filter, set this parameter to {@code null}. - * @param { ScanOptions } options - Indicates the parameters for scanning and if the user does not assign a value, the default value will be used. - * {@link ScanOptions#interval} set to 0, {@link ScanOptions#dutyMode} set to {@link SCAN_MODE_LOW_POWER} - * and {@link ScanOptions#matchMode} set to {@link MATCH_MODE_AGGRESSIVE}. - * and {@link ScanOptions#phyType} set to {@link PHY_LE_ALL_SUPPORTED}. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - function startBLEScan(filters: Array, options?: ScanOptions): void; - - /** - * Stops BLE scanning. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Stops BLE scanning. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Stops BLE scanning. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - function stopBLEScan(): void; - - /** - * Starts BLE advertising. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { AdvertiseSetting } setting - Indicates the settings for BLE advertising. - * @param { AdvertiseData } advData - Indicates the advertising data. - * @param { AdvertiseData } advResponse - Indicates the scan response associated with the advertising data. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Starts BLE advertising. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { AdvertiseSetting } setting - Indicates the settings for BLE advertising. - * @param { AdvertiseData } advData - Indicates the advertising data. - * @param { AdvertiseData } advResponse - Indicates the scan response associated with the advertising data. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Starts BLE advertising. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { AdvertiseSetting } setting - Indicates the settings for BLE advertising. - * @param { AdvertiseData } advData - Indicates the advertising data. - * @param { AdvertiseData } advResponse - Indicates the scan response associated with the advertising data. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - /** - * Starts BLE advertising. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { AdvertiseSetting } setting - Indicates the settings for BLE advertising. - * @param { AdvertiseData } advData - Indicates the advertising data. - * @param { AdvertiseData } advResponse - Indicates the scan response associated with the advertising data. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900010 - The number of advertising resources reaches the upper limit. - * @throws { BusinessError } 2900099 - Operation failed. - * @throws { BusinessError } 2902054 - The length of the advertising data exceeds the upper limit. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 20 - */ - function startAdvertising(setting: AdvertiseSetting, advData: AdvertiseData, advResponse?: AdvertiseData): void; - - /** - * Stops BLE advertising. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Stops BLE advertising. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Stops BLE advertising. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - function stopAdvertising(): void; - - /** - * Starts BLE advertising. - * The API returns a advertising ID. The ID can be used to temporarily enable or disable this advertising - * using the API {@link enableAdvertising} or {@link disableAdvertising}. - * To completely stop the advertising corresponding to the ID, invoke the API {@link stopAdvertising} with ID. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { AdvertisingParams } advertisingParams - Indicates the params for BLE advertising. - * @param { AsyncCallback } callback - the callback of advertise ID. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 11 - */ - /** - * Starts BLE advertising. - * The API returns a advertising ID. The ID can be used to temporarily enable or disable this advertising - * using the API {@link enableAdvertising} or {@link disableAdvertising}. - * To completely stop the advertising corresponding to the ID, invoke the API {@link stopAdvertising} with ID. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { AdvertisingParams } advertisingParams - Indicates the params for BLE advertising. - * @param { AsyncCallback } callback - the callback of advertise ID. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @since 13 - */ - /** - * Starts BLE advertising. - * The API returns a advertising ID. The ID can be used to temporarily enable or disable this advertising - * using the API {@link enableAdvertising} or {@link disableAdvertising}. - * To completely stop the advertising corresponding to the ID, invoke the API {@link stopAdvertising} with ID. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { AdvertisingParams } advertisingParams - Indicates the params for BLE advertising. - * @param { AsyncCallback } callback - the callback of advertise ID. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900010 - The number of advertising resources reaches the upper limit. - * @throws { BusinessError } 2900099 - Operation failed. - * @throws { BusinessError } 2902054 - The length of the advertising data exceeds the upper limit. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @since 20 - */ - function startAdvertising(advertisingParams: AdvertisingParams, callback: AsyncCallback): void; - - /** - * Starts BLE advertising. - * The API returns a advertising ID. The ID can be used to temporarily enable or disable this advertising - * using the API {@link enableAdvertising} or {@link disableAdvertising}. - * To completely stop the advertising corresponding to the ID, invoke the API {@link stopAdvertising} with ID. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { AdvertisingParams } advertisingParams - Indicates the param for BLE advertising. - * @returns { Promise } Returns the promise object. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 11 - */ - /** - * Starts BLE advertising. - * The API returns a advertising ID. The ID can be used to temporarily enable or disable this advertising - * using the API {@link enableAdvertising} or {@link disableAdvertising}. - * To completely stop the advertising corresponding to the ID, invoke the API {@link stopAdvertising} with ID. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { AdvertisingParams } advertisingParams - Indicates the param for BLE advertising. - * @returns { Promise } Returns the promise object. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @since 13 - */ - /** - * Starts BLE advertising. - * The API returns a advertising ID. The ID can be used to temporarily enable or disable this advertising - * using the API {@link enableAdvertising} or {@link disableAdvertising}. - * To completely stop the advertising corresponding to the ID, invoke the API {@link stopAdvertising} with ID. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { AdvertisingParams } advertisingParams - Indicates the param for BLE advertising. - * @returns { Promise } Returns the promise object. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900010 - The number of advertising resources reaches the upper limit. - * @throws { BusinessError } 2900099 - Operation failed. - * @throws { BusinessError } 2902054 - The length of the advertising data exceeds the upper limit. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @since 20 - */ - function startAdvertising(advertisingParams: AdvertisingParams): Promise; - - /** - * Enable the advertising with a specific ID temporarily. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { AdvertisingEnableParams } advertisingEnableParams - Indicates the params for enable advertising. - * @param { AsyncCallback } callback - the callback result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 11 - */ - /** - * Enable the advertising with a specific ID temporarily. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { AdvertisingEnableParams } advertisingEnableParams - Indicates the params for enable advertising. - * @param { AsyncCallback } callback - the callback result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @throws { BusinessError } 2902055 - Invalid advertising id. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 20 - */ - function enableAdvertising(advertisingEnableParams: AdvertisingEnableParams, callback: AsyncCallback): void; - - /** - * Enable the advertising with a specific ID temporarily. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { AdvertisingEnableParams } advertisingEnableParams - Indicates the params for enable advertising. - * @returns { Promise } Returns the promise object. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 11 - */ - /** - * Enable the advertising with a specific ID temporarily. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { AdvertisingEnableParams } advertisingEnableParams - Indicates the params for enable advertising. - * @returns { Promise } Returns the promise object. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @throws { BusinessError } 2902055 - Invalid advertising id. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 20 - */ - function enableAdvertising(advertisingEnableParams: AdvertisingEnableParams): Promise; - - /** - * Disable the advertising with a specific ID temporarily. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { AdvertisingDisableParams } advertisingDisableParams - Indicates the params for disable advertising. - * @param { AsyncCallback } callback - the callback result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 11 - */ - /** - * Disable the advertising with a specific ID temporarily. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { AdvertisingDisableParams } advertisingDisableParams - Indicates the params for disable advertising. - * @param { AsyncCallback } callback - the callback result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @throws { BusinessError } 2902055 - Invalid advertising id. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 20 - */ - function disableAdvertising(advertisingDisableParams: AdvertisingDisableParams, callback: AsyncCallback): void; - - /** - * Disable the advertising with a specific ID temporarily. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { AdvertisingDisableParams } advertisingDisableParams - Indicates the params for disable advertising. - * @returns { Promise } Returns the promise object. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 11 - */ - /** - * Disable the advertising with a specific ID temporarily. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { AdvertisingDisableParams } advertisingDisableParams - Indicates the params for disable advertising. - * @returns { Promise } Returns the promise object. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @throws { BusinessError } 2902055 - Invalid advertising id. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 20 - */ - function disableAdvertising(advertisingDisableParams: AdvertisingDisableParams): Promise; - - /** - * Stops BLE advertising. - * Completely stop the advertising corresponding to the ID. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { number } advertisingId - Indicates the ID for this BLE advertising. - * @param { AsyncCallback } callback - the callback result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 11 - */ - /** - * Stops BLE advertising. - * Completely stop the advertising corresponding to the ID. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { number } advertisingId - Indicates the ID for this BLE advertising. - * @param { AsyncCallback } callback - the callback result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @since 13 - */ - /** - * Stops BLE advertising. - * Completely stop the advertising corresponding to the ID. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { number } advertisingId - Indicates the ID for this BLE advertising. - * @param { AsyncCallback } callback - the callback result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @throws { BusinessError } 2902055 - Invalid advertising id. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @since 20 - */ - function stopAdvertising(advertisingId: number, callback: AsyncCallback): void; - - /** - * Stops BLE advertising. - * Completely stop the advertising corresponding to the ID. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { number } advertisingId - Indicates the ID for this BLE advertising. - * @returns { Promise } Returns the promise object. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 11 - */ - /** - * Stops BLE advertising. - * Completely stop the advertising corresponding to the ID. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { number } advertisingId - Indicates the ID for this BLE advertising. - * @returns { Promise } Returns the promise object. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @since 13 - */ - /** - * Stops BLE advertising. - * Completely stop the advertising corresponding to the ID. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { number } advertisingId - Indicates the ID for this BLE advertising. - * @returns { Promise } Returns the promise object. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @throws { BusinessError } 2902055 - Invalid advertising id. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @since 20 - */ - function stopAdvertising(advertisingId: number): Promise; - - /** - * Subscribing to advertising state change event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'advertisingStateChange' } type - Type of the advertising state to listen for. - * @param { Callback } callback - Callback used to listen for the advertising state. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 11 - */ - /** - * Subscribing to advertising state change event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'advertisingStateChange' } type - Type of the advertising state to listen for. - * @param { Callback } callback - Callback used to listen for the advertising state. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @since 13 - */ - function on(type: 'advertisingStateChange', callback: Callback): void; - - /** - * Unsubscribe from advertising state change event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'advertisingStateChange' } type - Type of the advertising state to listen for. - * @param { Callback } callback - Callback used to listen for the advertising state. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 11 - */ - /** - * Unsubscribe from advertising state change event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'advertisingStateChange' } type - Type of the advertising state to listen for. - * @param { Callback } callback - Callback used to listen for the advertising state. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @since 13 - */ - function off(type: 'advertisingStateChange', callback?: Callback): void; - - /** - * Subscribe BLE scan result. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for. - * @param { Callback> } callback - Callback used to listen for the scan result event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Subscribe BLE scan result. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for. - * @param { Callback> } callback - Callback used to listen for the scan result event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Subscribe BLE scan result. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for. - * @param { Callback> } callback - Callback used to listen for the scan result event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - function on(type: 'BLEDeviceFind', callback: Callback>): void; - - /** - * Unsubscribe BLE scan result. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for. - * @param { Callback> } callback - Callback used to listen for the scan result event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Unsubscribe BLE scan result. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for. - * @param { Callback> } callback - Callback used to listen for the scan result event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Unsubscribe BLE scan result. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for. - * @param { Callback> } callback - Callback used to listen for the scan result event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - function off(type: 'BLEDeviceFind', callback?: Callback>): void; - - /** - * Manages GATT server. Before calling an Gatt server method, you must use {@link createGattServer} to create an GattServer instance. - * - * @typedef GattServer - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Manages GATT server. Before calling an Gatt server method, you must use {@link createGattServer} to create an GattServer instance. - * - * @typedef GattServer - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Manages GATT server. Before calling an Gatt server method, you must use {@link createGattServer} to create an GattServer instance. - * - * @typedef GattServer - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - interface GattServer { - /** - * Adds a specified service to be hosted. - *

The added service and its characteristics are provided by the local device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { GattService } service - Indicates the service to add. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Adds a specified service to be hosted. - *

The added service and its characteristics are provided by the local device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { GattService } service - Indicates the service to add. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Adds a specified service to be hosted. - *

The added service and its characteristics are provided by the local device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { GattService } service - Indicates the service to add. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - addService(service: GattService): void; - - /** - * Removes a specified service from the list of GATT services provided by this device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { string } serviceUuid - Indicates the UUID of the service to remove. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900004 - Profile not supported. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Removes a specified service from the list of GATT services provided by this device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { string } serviceUuid - Indicates the UUID of the service to remove. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900004 - Profile not supported. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Removes a specified service from the list of GATT services provided by this device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { string } serviceUuid - Indicates the UUID of the service to remove. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900004 - Profile not supported. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - removeService(serviceUuid: string): void; - - /** - * Closes this {@code GattServer} object and unregisters its callbacks. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Closes this {@code GattServer} object and unregisters its callbacks. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Closes this {@code GattServer} object and unregisters its callbacks. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - close(): void; - - /** - * Sends a notification of a change in a specified local characteristic with a asynchronous callback. - *

This method should be called for every BLE peripheral device that has requested notifications. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". - * @param { NotifyCharacteristic } notifyCharacteristic - Indicates the local characteristic that has changed. - * @param { AsyncCallback } callback - Callback used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Sends a notification of a change in a specified local characteristic with a asynchronous callback. - *

This method should be called for every BLE peripheral device that has requested notifications. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". - * @param { NotifyCharacteristic } notifyCharacteristic - Indicates the local characteristic that has changed. - * @param { AsyncCallback } callback - Callback used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Sends a notification of a change in a specified local characteristic with a asynchronous callback. - *

This method should be called for every BLE peripheral device that has requested notifications. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". - * @param { NotifyCharacteristic } notifyCharacteristic - Indicates the local characteristic that has changed. - * @param { AsyncCallback } callback - Callback used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - notifyCharacteristicChanged( - deviceId: string, - notifyCharacteristic: NotifyCharacteristic, - callback: AsyncCallback - ): void; - - /** - * Sends a notification of a change in a specified local characteristic with a asynchronous callback. - *

This method should be called for every BLE peripheral device that has requested notifications. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". - * @param { NotifyCharacteristic } notifyCharacteristic - Indicates the local characteristic that has changed. - * @returns { Promise } Promise used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Sends a notification of a change in a specified local characteristic with a asynchronous callback. - *

This method should be called for every BLE peripheral device that has requested notifications. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". - * @param { NotifyCharacteristic } notifyCharacteristic - Indicates the local characteristic that has changed. - * @returns { Promise } Promise used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Sends a notification of a change in a specified local characteristic with a asynchronous callback. - *

This method should be called for every BLE peripheral device that has requested notifications. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". - * @param { NotifyCharacteristic } notifyCharacteristic - Indicates the local characteristic that has changed. - * @returns { Promise } Promise used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - notifyCharacteristicChanged(deviceId: string, notifyCharacteristic: NotifyCharacteristic): Promise; - - /** - * Sends a response to a specified read or write request to a given BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { ServerResponse } serverResponse - Indicates the response parameters {@link ServerResponse}. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Sends a response to a specified read or write request to a given BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { ServerResponse } serverResponse - Indicates the response parameters {@link ServerResponse}. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Sends a response to a specified read or write request to a given BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { ServerResponse } serverResponse - Indicates the response parameters {@link ServerResponse}. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - sendResponse(serverResponse: ServerResponse): void; - - /** - * Subscribe characteristic read event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'characteristicRead' } type - Type of the characteristic read event to listen for. - * @param { Callback } callback - Callback used to listen for the characteristic read event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Subscribe characteristic read event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'characteristicRead' } type - Type of the characteristic read event to listen for. - * @param { Callback } callback - Callback used to listen for the characteristic read event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Subscribe characteristic read event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'characteristicRead' } type - Type of the characteristic read event to listen for. - * @param { Callback } callback - Callback used to listen for the characteristic read event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - on(type: 'characteristicRead', callback: Callback): void; - - /** - * Unsubscribe characteristic read event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'characteristicRead' } type - Type of the characteristic read event to listen for. - * @param { Callback } callback - Callback used to listen for the characteristic read event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Unsubscribe characteristic read event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'characteristicRead' } type - Type of the characteristic read event to listen for. - * @param { Callback } callback - Callback used to listen for the characteristic read event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Unsubscribe characteristic read event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'characteristicRead' } type - Type of the characteristic read event to listen for. - * @param { Callback } callback - Callback used to listen for the characteristic read event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - off(type: 'characteristicRead', callback?: Callback): void; - - /** - * Subscribe characteristic write event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'characteristicWrite' } type - Type of the characteristic write event to listen for. - * @param { Callback } callback - Callback used to listen for the characteristic write event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Subscribe characteristic write event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'characteristicWrite' } type - Type of the characteristic write event to listen for. - * @param { Callback } callback - Callback used to listen for the characteristic write event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Subscribe characteristic write event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'characteristicWrite' } type - Type of the characteristic write event to listen for. - * @param { Callback } callback - Callback used to listen for the characteristic write event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - on(type: 'characteristicWrite', callback: Callback): void; - - /** - * Unsubscribe characteristic write event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'characteristicWrite' } type - Type of the characteristic write event to listen for. - * @param { Callback } callback - Callback used to listen for the characteristic write event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Unsubscribe characteristic write event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'characteristicWrite' } type - Type of the characteristic write event to listen for. - * @param { Callback } callback - Callback used to listen for the characteristic write event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Unsubscribe characteristic write event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'characteristicWrite' } type - Type of the characteristic write event to listen for. - * @param { Callback } callback - Callback used to listen for the characteristic write event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - off(type: 'characteristicWrite', callback?: Callback): void; - - /** - * Subscribe descriptor read event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'descriptorRead' } type - Type of the descriptor read event to listen for. - * @param { Callback } callback - Callback used to listen for the descriptor read event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Subscribe descriptor read event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'descriptorRead' } type - Type of the descriptor read event to listen for. - * @param { Callback } callback - Callback used to listen for the descriptor read event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Subscribe descriptor read event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'descriptorRead' } type - Type of the descriptor read event to listen for. - * @param { Callback } callback - Callback used to listen for the descriptor read event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - on(type: 'descriptorRead', callback: Callback): void; - - /** - * Unsubscribe descriptor read event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'descriptorRead' } type - Type of the descriptor read event to listen for. - * @param { Callback } callback - Callback used to listen for the descriptor read event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Unsubscribe descriptor read event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'descriptorRead' } type - Type of the descriptor read event to listen for. - * @param { Callback } callback - Callback used to listen for the descriptor read event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Unsubscribe descriptor read event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'descriptorRead' } type - Type of the descriptor read event to listen for. - * @param { Callback } callback - Callback used to listen for the descriptor read event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - off(type: 'descriptorRead', callback?: Callback): void; - - /** - * Subscribe descriptor write event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'descriptorWrite' } type - Type of the descriptor write event to listen for. - * @param { Callback } callback - Callback used to listen for the descriptor write event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Subscribe descriptor write event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'descriptorWrite' } type - Type of the descriptor write event to listen for. - * @param { Callback } callback - Callback used to listen for the descriptor write event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Subscribe descriptor write event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'descriptorWrite' } type - Type of the descriptor write event to listen for. - * @param { Callback } callback - Callback used to listen for the descriptor write event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - on(type: 'descriptorWrite', callback: Callback): void; - - /** - * Unsubscribe descriptor write event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'descriptorWrite' } type - Type of the descriptor write event to listen for. - * @param { Callback } callback - Callback used to listen for the descriptor write event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Unsubscribe descriptor write event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'descriptorWrite' } type - Type of the descriptor write event to listen for. - * @param { Callback } callback - Callback used to listen for the descriptor write event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Unsubscribe descriptor write event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'descriptorWrite' } type - Type of the descriptor write event to listen for. - * @param { Callback } callback - Callback used to listen for the descriptor write event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - off(type: 'descriptorWrite', callback?: Callback): void; - - /** - * Subscribe server connection state changed event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'connectionStateChange' } type - Type of the connection state changed event to listen for. - * @param { Callback } callback - Callback used to listen for the connection state changed event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Subscribe server connection state changed event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'connectionStateChange' } type - Type of the connection state changed event to listen for. - * @param { Callback } callback - Callback used to listen for the connection state changed event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Subscribe server connection state changed event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'connectionStateChange' } type - Type of the connection state changed event to listen for. - * @param { Callback } callback - Callback used to listen for the connection state changed event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - on(type: 'connectionStateChange', callback: Callback): void; - - /** - * Unsubscribe server connection state changed event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'connectionStateChange' } type - Type of the connection state changed event to listen for. - * @param { Callback } callback - Callback used to listen for the connection state changed event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Unsubscribe server connection state changed event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'connectionStateChange' } type - Type of the connection state changed event to listen for. - * @param { Callback } callback - Callback used to listen for the connection state changed event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Unsubscribe server connection state changed event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'connectionStateChange' } type - Type of the connection state changed event to listen for. - * @param { Callback } callback - Callback used to listen for the connection state changed event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - off(type: 'connectionStateChange', callback?: Callback): void; - - /** - * Subscribe mtu changed event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'BLEMtuChange' } type - Type of the mtu changed event to listen for. - * @param { Callback } callback - Callback used to listen for the mtu changed event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Subscribe mtu changed event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'BLEMtuChange' } type - Type of the mtu changed event to listen for. - * @param { Callback } callback - Callback used to listen for the mtu changed event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @since 13 - */ - on(type: 'BLEMtuChange', callback: Callback): void; - - /** - * Unsubscribe mtu changed event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'BLEMtuChange' } type - Type of the mtu changed event to listen for. - * @param { Callback } callback - Callback used to listen for the mtu changed event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Unsubscribe mtu changed event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'BLEMtuChange' } type - Type of the mtu changed event to listen for. - * @param { Callback } callback - Callback used to listen for the mtu changed event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @since 13 - */ - off(type: 'BLEMtuChange', callback?: Callback): void; - } - - /** - * Manages GATT client. Before calling an Gatt client method, you must use {@link createGattClientDevice} to create an GattClientDevice instance. - * - * @typedef GattClientDevice - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Manages GATT client. Before calling an Gatt client method, you must use {@link createGattClientDevice} to create an GattClientDevice instance. - * - * @typedef GattClientDevice - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Manages GATT client. Before calling an Gatt client method, you must use {@link createGattClientDevice} to create an GattClientDevice instance. - * - * @typedef GattClientDevice - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - interface GattClientDevice { - /** - * Connects to a BLE peripheral device. - *

The 'BLEConnectionStateChange' event is subscribed to return the connection state. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Connects to a BLE peripheral device. - *

The 'BLEConnectionStateChange' event is subscribed to return the connection state. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Connects to a BLE peripheral device. - *

The 'BLEConnectionStateChange' event is subscribed to return the connection state. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - connect(): void; - - /** - * Disconnects from or stops an ongoing connection to a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Disconnects from or stops an ongoing connection to a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Disconnects from or stops an ongoing connection to a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - disconnect(): void; - - /** - * Disables a BLE peripheral device. - *

This method unregisters the device and clears the registered callbacks and handles. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Disables a BLE peripheral device. - *

This method unregisters the device and clears the registered callbacks and handles. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Disables a BLE peripheral device. - *

This method unregisters the device and clears the registered callbacks and handles. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - close(): void; - - /** - * Obtains the name of BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { AsyncCallback } callback - Callback used to obtain the device name. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Obtains the name of BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { AsyncCallback } callback - Callback used to obtain the device name. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Obtains the name of BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { AsyncCallback } callback - Callback used to obtain the device name. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - getDeviceName(callback: AsyncCallback): void; - - /** - * Obtains the name of BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @returns { Promise } Returns a string representation of the name if obtained; - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter.Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Obtains the name of BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @returns { Promise } Returns a string representation of the name if obtained; - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter.Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Obtains the name of BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @returns { Promise } Returns a string representation of the name if obtained; - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter.Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - getDeviceName(): Promise; - - /** - * Starts discovering services. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { AsyncCallback> } callback - Callback used to catch the services. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Starts discovering services. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { AsyncCallback> } callback - Callback used to catch the services. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Starts discovering services. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { AsyncCallback> } callback - Callback used to catch the services. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - getServices(callback: AsyncCallback>): void; - - /** - * Starts discovering services. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @returns { Promise> } Returns the list of services {@link GattService} of the BLE peripheral device. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Starts discovering services. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @returns { Promise> } Returns the list of services {@link GattService} of the BLE peripheral device. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Starts discovering services. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @returns { Promise> } Returns the list of services {@link GattService} of the BLE peripheral device. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - getServices(): Promise>; - - /** - * Reads the characteristic of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLECharacteristic } characteristic - Indicates the characteristic to read. - * @param { AsyncCallback } callback - Callback invoked to return the characteristic value read. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2901000 - Read forbidden. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Reads the characteristic of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLECharacteristic } characteristic - Indicates the characteristic to read. - * @param { AsyncCallback } callback - Callback invoked to return the characteristic value read. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2901000 - Read forbidden. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Reads the characteristic of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLECharacteristic } characteristic - Indicates the characteristic to read. - * @param { AsyncCallback } callback - Callback invoked to return the characteristic value read. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2901000 - Read forbidden. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - /** - * Reads the characteristic of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLECharacteristic } characteristic - Indicates the characteristic to read. - * @param { AsyncCallback } callback - Callback invoked to return the characteristic value read. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900011 - The operation is busy. The last operation is not complete. - * @throws { BusinessError } 2900099 - Operation failed. - * @throws { BusinessError } 2901000 - Read forbidden. - * @throws { BusinessError } 2901003 - The connection is not established. - * @throws { BusinessError } 2901004 - The connection is congested. - * @throws { BusinessError } 2901005 - The connection is not encrypted. - * @throws { BusinessError } 2901006 - The connection is not authenticated. - * @throws { BusinessError } 2901007 - The connection is not authorized. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 20 - */ - readCharacteristicValue(characteristic: BLECharacteristic, callback: AsyncCallback): void; - - /** - * Reads the characteristic of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLECharacteristic } characteristic - Indicates the characteristic to read. - * @returns { Promise } - Promise used to return the characteristic value read. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2901000 - Read forbidden. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Reads the characteristic of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLECharacteristic } characteristic - Indicates the characteristic to read. - * @returns { Promise } - Promise used to return the characteristic value read. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2901000 - Read forbidden. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Reads the characteristic of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLECharacteristic } characteristic - Indicates the characteristic to read. - * @returns { Promise } - Promise used to return the characteristic value read. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2901000 - Read forbidden. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - /** - * Reads the characteristic of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLECharacteristic } characteristic - Indicates the characteristic to read. - * @returns { Promise } - Promise used to return the characteristic value read. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900011 - The operation is busy. The last operation is not complete. - * @throws { BusinessError } 2900099 - Operation failed. - * @throws { BusinessError } 2901000 - Read forbidden. - * @throws { BusinessError } 2901003 - The connection is not established. - * @throws { BusinessError } 2901004 - The connection is congested. - * @throws { BusinessError } 2901005 - The connection is not encrypted. - * @throws { BusinessError } 2901006 - The connection is not authenticated. - * @throws { BusinessError } 2901007 - The connection is not authorized. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 20 - */ - readCharacteristicValue(characteristic: BLECharacteristic): Promise; - - /** - * Reads the descriptor of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLEDescriptor } descriptor - Indicates the descriptor to read. - * @param { AsyncCallback } callback - Callback invoked to return the descriptor read. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2901000 - Read forbidden. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Reads the descriptor of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLEDescriptor } descriptor - Indicates the descriptor to read. - * @param { AsyncCallback } callback - Callback invoked to return the descriptor read. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2901000 - Read forbidden. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Reads the descriptor of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLEDescriptor } descriptor - Indicates the descriptor to read. - * @param { AsyncCallback } callback - Callback invoked to return the descriptor read. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2901000 - Read forbidden. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - /** - * Reads the descriptor of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLEDescriptor } descriptor - Indicates the descriptor to read. - * @param { AsyncCallback } callback - Callback invoked to return the descriptor read. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900011 - The operation is busy. The last operation is not complete. - * @throws { BusinessError } 2900099 - Operation failed. - * @throws { BusinessError } 2901000 - Read forbidden. - * @throws { BusinessError } 2901003 - The connection is not established. - * @throws { BusinessError } 2901004 - The connection is congested. - * @throws { BusinessError } 2901005 - The connection is not encrypted. - * @throws { BusinessError } 2901006 - The connection is not authenticated. - * @throws { BusinessError } 2901007 - The connection is not authorized. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 20 - */ - readDescriptorValue(descriptor: BLEDescriptor, callback: AsyncCallback): void; - - /** - * Reads the descriptor of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLEDescriptor } descriptor - Indicates the descriptor to read. - * @returns { Promise } - Promise used to return the descriptor read. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2901000 - Read forbidden. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Reads the descriptor of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLEDescriptor } descriptor - Indicates the descriptor to read. - * @returns { Promise } - Promise used to return the descriptor read. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2901000 - Read forbidden. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Reads the descriptor of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLEDescriptor } descriptor - Indicates the descriptor to read. - * @returns { Promise } - Promise used to return the descriptor read. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2901000 - Read forbidden. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - /** - * Reads the descriptor of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLEDescriptor } descriptor - Indicates the descriptor to read. - * @returns { Promise } - Promise used to return the descriptor read. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900011 - The operation is busy. The last operation is not complete. - * @throws { BusinessError } 2900099 - Operation failed. - * @throws { BusinessError } 2901000 - Read forbidden. - * @throws { BusinessError } 2901003 - The connection is not established. - * @throws { BusinessError } 2901004 - The connection is congested. - * @throws { BusinessError } 2901005 - The connection is not encrypted. - * @throws { BusinessError } 2901006 - The connection is not authenticated. - * @throws { BusinessError } 2901007 - The connection is not authorized. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 20 - */ - readDescriptorValue(descriptor: BLEDescriptor): Promise; - - /** - * Writes the characteristic of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLECharacteristic } characteristic - Indicates the characteristic to write. - * @param { GattWriteType } writeType - Write type of the characteristic. - * @param { AsyncCallback } callback - Callback used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2901001 - Write forbidden. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Writes the characteristic of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLECharacteristic } characteristic - Indicates the characteristic to write. - * @param { GattWriteType } writeType - Write type of the characteristic. - * @param { AsyncCallback } callback - Callback used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2901001 - Write forbidden. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Writes the characteristic of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLECharacteristic } characteristic - Indicates the characteristic to write. - * @param { GattWriteType } writeType - Write type of the characteristic. - * @param { AsyncCallback } callback - Callback used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2901001 - Write forbidden. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - /** - * Writes the characteristic of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLECharacteristic } characteristic - Indicates the characteristic to write. - * @param { GattWriteType } writeType - Write type of the characteristic. - * @param { AsyncCallback } callback - Callback used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900011 - The operation is busy. The last operation is not complete. - * @throws { BusinessError } 2900099 - Operation failed. - * @throws { BusinessError } 2901001 - Write forbidden. - * @throws { BusinessError } 2901003 - The connection is not established. - * @throws { BusinessError } 2901004 - The connection is congested. - * @throws { BusinessError } 2901005 - The connection is not encrypted. - * @throws { BusinessError } 2901006 - The connection is not authenticated. - * @throws { BusinessError } 2901007 - The connection is not authorized. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 20 - */ - writeCharacteristicValue( - characteristic: BLECharacteristic, - writeType: GattWriteType, - callback: AsyncCallback - ): void; - - /** - * Writes the characteristic of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLECharacteristic } characteristic - Indicates the characteristic to write. - * @param { GattWriteType } writeType - Write type of the characteristic. - * @returns { Promise } Promise used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2901001 - Write forbidden. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Writes the characteristic of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLECharacteristic } characteristic - Indicates the characteristic to write. - * @param { GattWriteType } writeType - Write type of the characteristic. - * @returns { Promise } Promise used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2901001 - Write forbidden. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Writes the characteristic of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLECharacteristic } characteristic - Indicates the characteristic to write. - * @param { GattWriteType } writeType - Write type of the characteristic. - * @returns { Promise } Promise used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2901001 - Write forbidden. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - /** - * Writes the characteristic of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLECharacteristic } characteristic - Indicates the characteristic to write. - * @param { GattWriteType } writeType - Write type of the characteristic. - * @returns { Promise } Promise used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900011 - The operation is busy. The last operation is not complete. - * @throws { BusinessError } 2900099 - Operation failed. - * @throws { BusinessError } 2901001 - Write forbidden. - * @throws { BusinessError } 2901003 - The connection is not established. - * @throws { BusinessError } 2901004 - The connection is congested. - * @throws { BusinessError } 2901005 - The connection is not encrypted. - * @throws { BusinessError } 2901006 - The connection is not authenticated. - * @throws { BusinessError } 2901007 - The connection is not authorized. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 20 - */ - writeCharacteristicValue(characteristic: BLECharacteristic, writeType: GattWriteType): Promise; - - /** - * Writes the descriptor of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLEDescriptor } descriptor - Indicates the descriptor to write. - * @param { AsyncCallback } callback - Callback used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2901001 - Write forbidden. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Writes the descriptor of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLEDescriptor } descriptor - Indicates the descriptor to write. - * @param { AsyncCallback } callback - Callback used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2901001 - Write forbidden. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Writes the descriptor of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLEDescriptor } descriptor - Indicates the descriptor to write. - * @param { AsyncCallback } callback - Callback used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2901001 - Write forbidden. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - /** - * Writes the descriptor of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLEDescriptor } descriptor - Indicates the descriptor to write. - * @param { AsyncCallback } callback - Callback used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900011 - The operation is busy. The last operation is not complete. - * @throws { BusinessError } 2900099 - Operation failed. - * @throws { BusinessError } 2901001 - Write forbidden. - * @throws { BusinessError } 2901003 - The connection is not established. - * @throws { BusinessError } 2901004 - The connection is congested. - * @throws { BusinessError } 2901005 - The connection is not encrypted. - * @throws { BusinessError } 2901006 - The connection is not authenticated. - * @throws { BusinessError } 2901007 - The connection is not authorized. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 20 - */ - writeDescriptorValue(descriptor: BLEDescriptor, callback: AsyncCallback): void; - - /** - * Writes the descriptor of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLEDescriptor } descriptor - Indicates the descriptor to write. - * @returns { Promise } Promise used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2901001 - Write forbidden. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Writes the descriptor of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLEDescriptor } descriptor - Indicates the descriptor to write. - * @returns { Promise } Promise used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2901001 - Write forbidden. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Writes the descriptor of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLEDescriptor } descriptor - Indicates the descriptor to write. - * @returns { Promise } Promise used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2901001 - Write forbidden. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - /** - * Writes the descriptor of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLEDescriptor } descriptor - Indicates the descriptor to write. - * @returns { Promise } Promise used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900011 - The operation is busy. The last operation is not complete. - * @throws { BusinessError } 2900099 - Operation failed. - * @throws { BusinessError } 2901001 - Write forbidden. - * @throws { BusinessError } 2901003 - The connection is not established. - * @throws { BusinessError } 2901004 - The connection is congested. - * @throws { BusinessError } 2901005 - The connection is not encrypted. - * @throws { BusinessError } 2901006 - The connection is not authenticated. - * @throws { BusinessError } 2901007 - The connection is not authorized. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 20 - */ - writeDescriptorValue(descriptor: BLEDescriptor): Promise; - - /** - * Get the RSSI value of this BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { AsyncCallback } callback - Callback invoked to return the RSSI, in dBm. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Get the RSSI value of this BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { AsyncCallback } callback - Callback invoked to return the RSSI, in dBm. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Get the RSSI value of this BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { AsyncCallback } callback - Callback invoked to return the RSSI, in dBm. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900011 - The operation is busy. The last operation is not complete. - * @throws { BusinessError } 2900099 - Operation failed. - * @throws { BusinessError } 2901003 - The connection is not established. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 20 - */ - getRssiValue(callback: AsyncCallback): void; - - /** - * Get the RSSI value of this BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @returns { Promise } Returns the RSSI value. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Get the RSSI value of this BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @returns { Promise } Returns the RSSI value. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Get the RSSI value of this BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @returns { Promise } Returns the RSSI value. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900011 - The operation is busy. The last operation is not complete. - * @throws { BusinessError } 2900099 - Operation failed. - * @throws { BusinessError } 2901003 - The connection is not established. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 20 - */ - getRssiValue(): Promise; - - /** - * Set the mtu size of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { number } mtu - The maximum transmission unit. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Set the mtu size of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { number } mtu - The maximum transmission unit. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Set the mtu size of a BLE peripheral device. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { number } mtu - The maximum transmission unit. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - setBLEMtuSize(mtu: number): void; - - /** - * Enables or disables notification of a characteristic when value changed. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. - * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates - * that notification is enabled, and the value {@code false} indicates that indication is disabled. - * @param { AsyncCallback } callback - the callback of setCharacteristicChangeNotification. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Enables or disables notification of a characteristic when value changed. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. - * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates - * that notification is enabled, and the value {@code false} indicates that indication is disabled. - * @param { AsyncCallback } callback - the callback of setCharacteristicChangeNotification. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Enables or disables notification of a characteristic when value changed. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. - * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates - * that notification is enabled, and the value {@code false} indicates that indication is disabled. - * @param { AsyncCallback } callback - the callback of setCharacteristicChangeNotification. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900011 - The operation is busy. The last operation is not complete. - * @throws { BusinessError } 2900099 - Operation failed. - * @throws { BusinessError } 2901003 - The connection is not established. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 20 - */ - setCharacteristicChangeNotification( - characteristic: BLECharacteristic, - enable: boolean, - callback: AsyncCallback - ): void; - - /** - * Enables or disables indication of a characteristic when value changed. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. - * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates - * that indication is enabled, and the value {@code false} indicates that indication is disabled. - * @returns { Promise } Returns the promise object. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Enables or disables indication of a characteristic when value changed. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. - * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates - * that indication is enabled, and the value {@code false} indicates that indication is disabled. - * @returns { Promise } Returns the promise object. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Enables or disables indication of a characteristic when value changed. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. - * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates - * that indication is enabled, and the value {@code false} indicates that indication is disabled. - * @returns { Promise } Returns the promise object. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900011 - The operation is busy. The last operation is not complete. - * @throws { BusinessError } 2900099 - Operation failed. - * @throws { BusinessError } 2901003 - The connection is not established. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 20 - */ - setCharacteristicChangeNotification(characteristic: BLECharacteristic, enable: boolean): Promise; - - /** - * Enables or disables indication of a characteristic when value changed. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. - * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates - * that indication is enabled, and the value {@code false} indicates that indication is disabled. - * @param { AsyncCallback } callback - the callback of setCharacteristicChangeIndication. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Enables or disables indication of a characteristic when value changed. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. - * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates - * that indication is enabled, and the value {@code false} indicates that indication is disabled. - * @param { AsyncCallback } callback - the callback of setCharacteristicChangeIndication. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Enables or disables indication of a characteristic when value changed. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. - * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates - * that indication is enabled, and the value {@code false} indicates that indication is disabled. - * @param { AsyncCallback } callback - the callback of setCharacteristicChangeIndication. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900011 - The operation is busy. The last operation is not complete. - * @throws { BusinessError } 2900099 - Operation failed. - * @throws { BusinessError } 2901003 - The connection is not established. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 20 - */ - setCharacteristicChangeIndication( - characteristic: BLECharacteristic, - enable: boolean, - callback: AsyncCallback - ): void; - - /** - * Enables or disables indication of a characteristic when value changed. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. - * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates - * that indication is enabled, and the value {@code false} indicates that indication is disabled. - * @returns { Promise } Returns the promise object. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Enables or disables indication of a characteristic when value changed. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. - * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates - * that indication is enabled, and the value {@code false} indicates that indication is disabled. - * @returns { Promise } Returns the promise object. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Enables or disables indication of a characteristic when value changed. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. - * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates - * that indication is enabled, and the value {@code false} indicates that indication is disabled. - * @returns { Promise } Returns the promise object. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900011 - The operation is busy. The last operation is not complete. - * @throws { BusinessError } 2900099 - Operation failed. - * @throws { BusinessError } 2901003 - The connection is not established. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 20 - */ - setCharacteristicChangeIndication(characteristic: BLECharacteristic, enable: boolean): Promise; - - /** - * Subscribe characteristic value changed event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'BLECharacteristicChange' } type - Type of the characteristic value changed event to listen for. - * @param { Callback } callback - Callback used to listen for the characteristic value changed event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Subscribe characteristic value changed event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'BLECharacteristicChange' } type - Type of the characteristic value changed event to listen for. - * @param { Callback } callback - Callback used to listen for the characteristic value changed event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - on(type: 'BLECharacteristicChange', callback: Callback): void; - - /** - * Unsubscribe characteristic value changed event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'BLECharacteristicChange' } type - Type of the characteristic value changed event to listen for. - * @param { Callback } callback - Callback used to listen for the characteristic value changed event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Unsubscribe characteristic value changed event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'BLECharacteristicChange' } type - Type of the characteristic value changed event to listen for. - * @param { Callback } callback - Callback used to listen for the characteristic value changed event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - off(type: 'BLECharacteristicChange', callback?: Callback): void; - - /** - * Subscribe client connection state changed event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'BLEConnectionStateChange' } type - Type of the connection state changed event to listen for. - * @param { Callback } callback - Callback used to listen for the connection state changed event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Subscribe client connection state changed event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'BLEConnectionStateChange' } type - Type of the connection state changed event to listen for. - * @param { Callback } callback - Callback used to listen for the connection state changed event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Subscribe client connection state changed event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'BLEConnectionStateChange' } type - Type of the connection state changed event to listen for. - * @param { Callback } callback - Callback used to listen for the connection state changed event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - on(type: 'BLEConnectionStateChange', callback: Callback): void; - - /** - * Unsubscribe client connection state changed event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'BLEConnectionStateChange' } type - Type of the connection state changed event to listen for. - * @param { Callback } callback - Callback used to listen for the connection state changed event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Unsubscribe client connection state changed event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'BLEConnectionStateChange' } type - Type of the connection state changed event to listen for. - * @param { Callback } callback - Callback used to listen for the connection state changed event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Unsubscribe client connection state changed event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'BLEConnectionStateChange' } type - Type of the connection state changed event to listen for. - * @param { Callback } callback - Callback used to listen for the connection state changed event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - off(type: 'BLEConnectionStateChange', callback?: Callback): void; - - /** - * Subscribe mtu changed event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'BLEMtuChange' } type - Type of the mtu changed event to listen for. - * @param { Callback } callback - Callback used to listen for the mtu changed event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Subscribe mtu changed event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'BLEMtuChange' } type - Type of the mtu changed event to listen for. - * @param { Callback } callback - Callback used to listen for the mtu changed event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Subscribe mtu changed event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'BLEMtuChange' } type - Type of the mtu changed event to listen for. - * @param { Callback } callback - Callback used to listen for the mtu changed event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - on(type: 'BLEMtuChange', callback: Callback): void; - - /** - * Unsubscribe mtu changed event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'BLEMtuChange' } type - Type of the mtu changed event to listen for. - * @param { Callback } callback - Callback used to listen for the mtu changed event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Unsubscribe mtu changed event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'BLEMtuChange' } type - Type of the mtu changed event to listen for. - * @param { Callback } callback - Callback used to listen for the mtu changed event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Unsubscribe mtu changed event. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'BLEMtuChange' } type - Type of the mtu changed event to listen for. - * @param { Callback } callback - Callback used to listen for the mtu changed event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - off(type: 'BLEMtuChange', callback?: Callback): void; - } - - /** - * Manages the ble scanner. - * Before calling a ble scanner method, you must use {@link createBleScanner} to create an BleScanner instance. - * - * @typedef BleScanner - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 15 - */ - interface BleScanner { - /** - * Starts scanning for specified BLE devices with filters. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { Array } filters - Indicates the list of filters used to filter out specified devices. - * If you do not want to use filter, set this parameter to {@code null}. - * @param { ScanOptions } options - Indicates the parameters for scanning and if the user does not assign a value, - * the default value will be used. {@link ScanOptions#interval} set to 0, - * and {@link ScanOptions#dutyMode} set to {@link SCAN_MODE_LOW_POWER} - * and {@link ScanOptions#matchMode} set to {@link MATCH_MODE_AGGRESSIVE}. - * and {@link ScanOptions#phyType} set to {@link PHY_LE_ALL_SUPPORTED}. - * and {@link ScanOptions#reportMode} set to {@link ScanReportMode#NORMAL}. - * @returns { Promise } Promise used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900009 - Fails to start scan as it is out of hardware resources. - * @throws { BusinessError } 2900099 - Operation failed. - * @throws { BusinessError } 2902050 - Failed to start scan as Ble scan is already started by the app. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 15 - */ - startScan(filters: Array, options?: ScanOptions): Promise; - /** - * Stops BLE scanning. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @returns { Promise } Promise used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 15 - */ - stopScan(): Promise; - /** - * Subscribe BLE scan result. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for. - * @param { Callback } callback - Callback used to listen for the scan result event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 15 - */ - on(type: 'BLEDeviceFind', callback: Callback): void; - /** - * Unsubscribe BLE scan result. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for. - * @param { Callback } callback - Callback used to listen for the scan result event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 15 - */ - off(type: 'BLEDeviceFind', callback?: Callback): void; - } - - /** - * Describes the Gatt service. - * - * @typedef GattService - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Describes the Gatt service. - * - * @typedef GattService - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Describes the Gatt service. - * - * @typedef GattService - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - interface GattService { - /** - * The UUID of a GattService instance - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The UUID of a GattService instance - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The UUID of a GattService instance - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - serviceUuid: string; - /** - * Indicates whether the GattService instance is primary or secondary. - * - * @type { boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Indicates whether the GattService instance is primary or secondary. - * - * @type { boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Indicates whether the GattService instance is primary or secondary. - * - * @type { boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - isPrimary: boolean; - /** - * The {@link BLECharacteristic} list belongs to this GattService instance - * - * @type { Array } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The {@link BLECharacteristic} list belongs to this GattService instance - * - * @type { Array } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The {@link BLECharacteristic} list belongs to this GattService instance - * - * @type { Array } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - characteristics: Array; - /** - * The list of GATT services contained in the service - * - * @type { ?Array } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The list of GATT services contained in the service - * - * @type { ?Array } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - includeServices?: Array; - } - - /** - * Describes the Gatt characteristic. - * - * @typedef BLECharacteristic - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Describes the Gatt characteristic. - * - * @typedef BLECharacteristic - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Describes the Gatt characteristic. - * - * @typedef BLECharacteristic - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - interface BLECharacteristic { - /** - * The UUID of the {@link GattService} instance to which the characteristic belongs - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The UUID of the {@link GattService} instance to which the characteristic belongs - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The UUID of the {@link GattService} instance to which the characteristic belongs - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - serviceUuid: string; - /** - * The UUID of a BLECharacteristic instance - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The UUID of a BLECharacteristic instance - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The UUID of a BLECharacteristic instance - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - characteristicUuid: string; - /** - * The value of a BLECharacteristic instance - * - * @type { ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The value of a BLECharacteristic instance - * - * @type { ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The value of a BLECharacteristic instance - * - * @type { ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - characteristicValue: ArrayBuffer; - /** - * The list of {@link BLEDescriptor} contained in the characteristic - * - * @type { Array } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The list of {@link BLEDescriptor} contained in the characteristic - * - * @type { Array } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The list of {@link BLEDescriptor} contained in the characteristic - * - * @type { Array } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - descriptors: Array; - /** - * The properties of a BLECharacteristic instance - * - * @type { ?GattProperties } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The properties of a BLECharacteristic instance - * - * @type { ?GattProperties } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The properties of a BLECharacteristic instance - * - * @type { ?GattProperties } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - properties?: GattProperties; - /** - * The characteristic value handle of a BLECharacteristic instance - * - * @type { ?number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 18 - */ - characteristicValueHandle?: number; - - /** - * The permissions of a BLECharacteristic instance. The default value is Readable and Writable. - * - * @type { ?GattPermissions } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 20 - */ - permissions?: GattPermissions; - } - - /** - * Describes the Gatt descriptor. - * - * @typedef BLEDescriptor - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Describes the Gatt descriptor. - * - * @typedef BLEDescriptor - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Describes the Gatt descriptor. - * - * @typedef BLEDescriptor - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - interface BLEDescriptor { - /** - * The UUID of the {@link GattService} instance to which the descriptor belongs - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The UUID of the {@link GattService} instance to which the descriptor belongs - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The UUID of the {@link GattService} instance to which the descriptor belongs - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - serviceUuid: string; - /** - * The UUID of the {@link BLECharacteristic} instance to which the descriptor belongs - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The UUID of the {@link BLECharacteristic} instance to which the descriptor belongs - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The UUID of the {@link BLECharacteristic} instance to which the descriptor belongs - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - characteristicUuid: string; - /** - * The UUID of the BLEDescriptor instance - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The UUID of the BLEDescriptor instance - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The UUID of the BLEDescriptor instance - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - descriptorUuid: string; - /** - * The value of the BLEDescriptor instance - * - * @type { ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The value of the BLEDescriptor instance - * - * @type { ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The value of the BLEDescriptor instance - * - * @type { ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - descriptorValue: ArrayBuffer; - /** - * The descriptor handle of the BLEDescriptor instance - * - * @type { ?number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 18 - */ - descriptorHandle?: number; - - /** - * The permissions of a BLEDescriptor instance. The default value is Readable and Writable. - * - * @type { ?GattPermissions } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 20 - */ - permissions?: GattPermissions; - } - - /** - * Describes the value of the indication or notification sent by the Gatt server. - * - * @typedef NotifyCharacteristic - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Describes the value of the indication or notification sent by the Gatt server. - * - * @typedef NotifyCharacteristic - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Describes the value of the indication or notification sent by the Gatt server. - * - * @typedef NotifyCharacteristic - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - interface NotifyCharacteristic { - /** - * The UUID of the {@link GattService} instance to which the characteristic belongs - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The UUID of the {@link GattService} instance to which the characteristic belongs - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The UUID of the {@link GattService} instance to which the characteristic belongs - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - serviceUuid: string; - /** - * The UUID of a NotifyCharacteristic instance - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The UUID of a NotifyCharacteristic instance - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The UUID of a NotifyCharacteristic instance - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - characteristicUuid: string; - /** - * The value of a NotifyCharacteristic instance - * - * @type { ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The value of a NotifyCharacteristic instance - * - * @type { ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The value of a NotifyCharacteristic instance - * - * @type { ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - characteristicValue: ArrayBuffer; - /** - * Specifies whether to request confirmation from the BLE peripheral device (indication) or - * send a notification. Value {@code true} indicates the former and {@code false} indicates the latter. - * - * @type { boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Specifies whether to request confirmation from the BLE peripheral device (indication) or - * send a notification. Value {@code true} indicates the former and {@code false} indicates the latter. - * - * @type { boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 - */ - confirm: boolean; - } - - /** - * Describes the parameters of the Gatt client's characteristic read request. - * - * @typedef CharacteristicReadRequest - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Describes the parameters of the Gatt client's characteristic read request. - * - * @typedef CharacteristicReadRequest - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Describes the parameters of the Gatt client's characteristic read request. - * - * @typedef CharacteristicReadRequest - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - interface CharacteristicReadRequest { - /** - * Indicates the address of the client that initiates the read request - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Indicates the address of the client that initiates the read request - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Indicates the address of the client that initiates the read request - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - deviceId: string; - /** - * The Id of the read request - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The Id of the read request - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The Id of the read request - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - transId: number; - /** - * Indicates the byte offset of the start position for reading characteristic value - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Indicates the byte offset of the start position for reading characteristic value - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 - */ - offset: number; - /** - * The UUID of a CharacteristicReadRequest instance - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The UUID of a CharacteristicReadRequest instance - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The UUID of a CharacteristicReadRequest instance - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - characteristicUuid: string; - /** - * The UUID of the service to which the characteristic belongs - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The UUID of the service to which the characteristic belongs - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The UUID of the service to which the characteristic belongs - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - serviceUuid: string; - } - - /** - * Describes the parameters of the of the Gatt client's characteristic write request. - * - * @typedef CharacteristicWriteRequest - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Describes the parameters of the of the Gatt client's characteristic write request. - * - * @typedef CharacteristicWriteRequest - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Describes the parameters of the of the Gatt client's characteristic write request. - * - * @typedef CharacteristicWriteRequest - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - interface CharacteristicWriteRequest { - /** - * Indicates the address of the client that initiates the write request - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Indicates the address of the client that initiates the write request - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Indicates the address of the client that initiates the write request - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - deviceId: string; - /** - * The Id of the write request - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The Id of the write request - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The Id of the write request - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - transId: number; - /** - * Indicates the byte offset of the start position for writing characteristic value - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Indicates the byte offset of the start position for writing characteristic value - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 - */ - offset: number; - /** - * Whether this request should be pending for later operation - * - * @type { boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Whether this request should be pending for later operation - * - * @type { boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - isPrepared: boolean; - /** - * Whether the remote client need a response - * - * @type { boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Whether the remote client need a response - * - * @type { boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - needRsp: boolean; - /** - * Indicates the value to be written - * - * @type { ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Indicates the value to be written - * - * @type { ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Indicates the value to be written - * - * @type { ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - value: ArrayBuffer; - /** - * The UUID of a CharacteristicWriteRequest instance - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The UUID of a CharacteristicWriteRequest instance - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The UUID of a CharacteristicWriteRequest instance - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - characteristicUuid: string; - /** - * The UUID of the service to which the characteristic belongs - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The UUID of the service to which the characteristic belongs - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The UUID of the service to which the characteristic belongs - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - serviceUuid: string; - } - - /** - * Describes the parameters of the Gatt client's descriptor read request. - * - * @typedef DescriptorReadRequest - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Describes the parameters of the Gatt client's descriptor read request. - * - * @typedef DescriptorReadRequest - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Describes the parameters of the Gatt client's descriptor read request. - * - * @typedef DescriptorReadRequest - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - interface DescriptorReadRequest { - /** - * Indicates the address of the client that initiates the read request - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Indicates the address of the client that initiates the read request - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Indicates the address of the client that initiates the read request - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - deviceId: string; - /** - * The Id of the read request - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The Id of the read request - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The Id of the read request - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - transId: number; - /** - * Indicates the byte offset of the start position for reading characteristic value - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Indicates the byte offset of the start position for reading characteristic value - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 - */ - offset: number; - /** - * The UUID of a DescriptorReadRequest instance - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The UUID of a DescriptorReadRequest instance - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The UUID of a DescriptorReadRequest instance - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - descriptorUuid: string; - /** - * The UUID of the characteristic to which the descriptor belongs - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The UUID of the characteristic to which the descriptor belongs - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The UUID of the characteristic to which the descriptor belongs - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - characteristicUuid: string; - /** - * The UUID of the service to which the descriptor belongs - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The UUID of the service to which the descriptor belongs - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The UUID of the service to which the descriptor belongs - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - serviceUuid: string; - } - - /** - * Describes the parameters of the Gatt client's characteristic write request. - * - * @typedef DescriptorWriteRequest - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Describes the parameters of the Gatt client's characteristic write request. - * - * @typedef DescriptorWriteRequest - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Describes the parameters of the Gatt client's characteristic write request. - * - * @typedef DescriptorWriteRequest - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - interface DescriptorWriteRequest { - /** - * Indicates the address of the client that initiates the write request - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Indicates the address of the client that initiates the write request - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Indicates the address of the client that initiates the write request - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - deviceId: string; - /** - * The Id of the write request - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The Id of the write request - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The Id of the write request - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - transId: number; - /** - * Indicates the byte offset of the start position for writing characteristic value - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Indicates the byte offset of the start position for writing characteristic value - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 - */ - offset: number; - /** - * Whether this request should be pending for later operation - * - * @type { boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Whether this request should be pending for later operation - * - * @type { boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - isPrepared: boolean; - /** - * Whether the remote client need a response - * - * @type { boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Whether the remote client need a response - * - * @type { boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - needRsp: boolean; - /** - * Indicates the value to be written - * - * @type { ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Indicates the value to be written - * - * @type { ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Indicates the value to be written - * - * @type { ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - value: ArrayBuffer; - /** - * The UUID of a DescriptorWriteRequest instance - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The UUID of a DescriptorWriteRequest instance - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The UUID of a DescriptorWriteRequest instance - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - descriptorUuid: string; - /** - * The UUID of the characteristic to which the descriptor belongs - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The UUID of the characteristic to which the descriptor belongs - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The UUID of the characteristic to which the descriptor belongs - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - characteristicUuid: string; - /** - * The UUID of the service to which the descriptor belongs - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The UUID of the service to which the descriptor belongs - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The UUID of the service to which the descriptor belongs - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - serviceUuid: string; - } - - /** - * Describes the parameters of a response send by the server to a specified read or write request. - * - * @typedef ServerResponse - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Describes the parameters of a response send by the server to a specified read or write request. - * - * @typedef ServerResponse - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Describes the parameters of a response send by the server to a specified read or write request. - * - * @typedef ServerResponse - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - interface ServerResponse { - /** - * Indicates the address of the client to which to send the response - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Indicates the address of the client to which to send the response - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Indicates the address of the client to which to send the response - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - deviceId: string; - /** - * The Id of the write request - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The Id of the write request - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The Id of the write request - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - transId: number; - /** - * Indicates the status of the read or write request, set this parameter to '0' in normal cases - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Indicates the status of the read or write request, set this parameter to '0' in normal cases - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Indicates the status of the read or write request, set this parameter to '0' in normal cases - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - status: number; - /** - * Indicates the byte offset of the start position for reading or writing operation - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Indicates the byte offset of the start position for reading or writing operation - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 - */ - offset: number; - /** - * Indicates the value to be sent - * - * @type { ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Indicates the value to be sent - * - * @type { ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Indicates the value to be sent - * - * @type { ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - value: ArrayBuffer; - } - - /** - * Describes the Gatt profile connection state. - * - * @typedef BLEConnectionChangeState - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Describes the Gatt profile connection state. - * - * @typedef BLEConnectionChangeState - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Describes the Gatt profile connection state. - * - * @typedef BLEConnectionChangeState - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - interface BLEConnectionChangeState { - /** - * Indicates the peer device address - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Indicates the peer device address - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Indicates the peer device address - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - deviceId: string; - /** - * Connection state of the Gatt profile - * - * @type { ProfileConnectionState } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Connection state of the Gatt profile - * - * @type { ProfileConnectionState } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Connection state of the Gatt profile - * - * @type { ProfileConnectionState } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - state: ProfileConnectionState; - /** - * Reason of the disconnection of the gatt connection. - * - * @type { ?GattDisconnectReason } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 20 - */ - reason?: GattDisconnectReason; - } - - /** - * Describes the contents of the scan results. - * - * @typedef ScanResult - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Describes the contents of the scan results. - * - * @typedef ScanResult - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Describes the contents of the scan results. - * - * @typedef ScanResult - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - interface ScanResult { - /** - * Address of the scanned device - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Address of the scanned device - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Address of the scanned device - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - deviceId: string; - /** - * RSSI of the remote device - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * RSSI of the remote device - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * RSSI of the remote device - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - rssi: number; - /** - * The raw data of broadcast packet - * - * @type { ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The raw data of broadcast packet - * - * @type { ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The raw data of broadcast packet - * - * @type { ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - data: ArrayBuffer; - /** - * The local name of the BLE device - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The local name of the BLE device - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The local name of the BLE device - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - deviceName: string; - /** - * Connectable of the remote device - * - * @type { boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Connectable of the remote device - * - * @type { boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Connectable of the remote device - * - * @type { boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - connectable: boolean; - } - - /** - * Describes the contents of the scan report. - * - * @typedef ScanReport - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 15 - */ - interface ScanReport { - /** - * The type of scan report - * - * @type { ScanReportType } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 15 - */ - reportType: ScanReportType; - /** - * Describes the contents of the scan results. - * - * @type { Array } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'15','1.2':'20'} - * @arkts 1.1&1.2 - */ - scanResult: Array; - } - - /** - * Describes the settings for BLE advertising. - * - * @typedef AdvertiseSetting - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Describes the settings for BLE advertising. - * - * @typedef AdvertiseSetting - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Describes the settings for BLE advertising. - * - * @typedef AdvertiseSetting - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - interface AdvertiseSetting { - /** - * Minimum slot value for the advertising interval, which is {@code 32} (20 ms) - * Maximum slot value for the advertising interval, which is {@code 16777215} (10485.759375s) - * Default slot value for the advertising interval, which is {@code 1600} (1s) - * - * @type { ?number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Minimum slot value for the advertising interval, which is {@code 32} (20 ms) - * Maximum slot value for the advertising interval, which is {@code 16777215} (10485.759375s) - * Default slot value for the advertising interval, which is {@code 1600} (1s) - * - * @type { ?number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 - */ - interval?: number; - /** - * Minimum transmission power level for advertising, which is {@code -127} - * Maximum transmission power level for advertising, which is {@code 1} - * Default transmission power level for advertising, which is {@code -7} - * - * @type { ?number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Minimum transmission power level for advertising, which is {@code -127} - * Maximum transmission power level for advertising, which is {@code 1} - * Default transmission power level for advertising, which is {@code -7} - * - * @type { ?number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 - */ - txPower?: number; - /** - * Indicates whether the BLE is connectable, default is {@code true} - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Indicates whether the BLE is connectable, default is {@code true} - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Indicates whether the BLE is connectable, default is {@code true} - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - connectable?: boolean; - } - - /** - * Describes the advertising data. - * - * @typedef AdvertiseData - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Describes the advertising data. - * - * @typedef AdvertiseData - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Describes the advertising data. - * - * @typedef AdvertiseData - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - interface AdvertiseData { - /** - * The specified service UUID list to this advertisement - * - * @type { Array } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The specified service UUID list to this advertisement - * - * @type { Array } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The specified service UUID list to this advertisement - * - * @type { Array } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - serviceUuids: Array; - /** - * The specified manufacturer data list to this advertisement - * - * @type { Array } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The specified manufacturer data list to this advertisement - * - * @type { Array } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The specified manufacturer data list to this advertisement - * - * @type { Array } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - manufactureData: Array; - /** - * The specified service data list to this advertisement - * - * @type { Array } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The specified service data list to this advertisement - * - * @type { Array } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The specified service data list to this advertisement - * - * @type { Array } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - serviceData: Array; - /** - * Indicates whether the device name will be included in the advertisement packet. - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Indicates whether the device name will be included in the advertisement packet. - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Indicates whether the device name will be included in the advertisement packet. - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - includeDeviceName?: boolean; - /** - * Indicates whether the tx power will be included in the advertisement packet. - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 18 - */ - includeTxPower?: boolean; - } - - /** - * Describes the advertising parameters. - * - * @typedef AdvertisingParams - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 11 - */ - /** - * Describes the advertising parameters. - * - * @typedef AdvertisingParams - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - interface AdvertisingParams { - /** - * Indicates the advertising settings. - * - * @type { AdvertiseSetting } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 11 - */ - /** - * Indicates the advertising settings. - * - * @type { AdvertiseSetting } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - advertisingSettings: AdvertiseSetting; - /** - * Indicates the advertising data. - * - * @type { AdvertiseData } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 11 - */ - /** - * Indicates the advertising data. - * - * @type { AdvertiseData } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - advertisingData: AdvertiseData; - /** - * Indicates the advertising response. - * - * @type { ?AdvertiseData } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 11 - */ - /** - * Indicates the advertising response. - * - * @type { ?AdvertiseData } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - advertisingResponse?: AdvertiseData; - /** - * Indicates the duration for advertising continuously. - * The duration, in 10ms unit. Valid range is from 1 (10ms) to 65535 (655,350 ms). - * If this parameter is not specified or is set to 0, advertisement is continuously sent. - * - * @type { ?number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since arkts {'1.1':'11','1.2':'20'} - * @arkts 1.1&1.2 - */ - duration?: number; - } - - /** - * Parameter for dynamically enable advertising. - * - * @typedef AdvertisingEnableParams - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 11 - */ - interface AdvertisingEnableParams { - /** - * Indicates the ID of current advertising. - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 11 - */ - advertisingId: number; - /** - * Indicates the duration for advertising continuously. - * The duration, in 10ms unit. Valid range is from 1 (10ms) to 65535 (655,350 ms). - * If this parameter is not specified or is set to 0, advertise is continuously sent. - * - * @type { ?number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since arkts {'1.1':'11','1.2':'20'} - * @arkts 1.1&1.2 - */ - duration?: number; - } - - /** - * Parameter for dynamically disable advertising. - * - * @typedef AdvertisingDisableParams - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 11 - */ - interface AdvertisingDisableParams { - /** - * Indicates the ID of current advertising. - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 11 - */ - advertisingId: number; - } - - /** - * Advertising state change information. - * - * @typedef AdvertisingStateChangeInfo - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 11 - */ - /** - * Advertising state change information. - * - * @typedef AdvertisingStateChangeInfo - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - interface AdvertisingStateChangeInfo { - /** - * Indicates the ID of current advertising. - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 11 - */ - /** - * Indicates the ID of current advertising. - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @since 13 - */ - advertisingId: number; - /** - * Indicates the advertising state. - * - * @type { AdvertisingState } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 11 - */ - /** - * Indicates the advertising state. - * - * @type { AdvertisingState } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - state: AdvertisingState; - } - - /** - * Describes the manufacturer data. - * - * @typedef ManufactureData - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Describes the manufacturer data. - * - * @typedef ManufactureData - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Describes the manufacturer data. - * - * @typedef ManufactureData - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - interface ManufactureData { - /** - * Indicates the manufacturer ID assigned by Bluetooth SIG - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Indicates the manufacturer ID assigned by Bluetooth SIG - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Indicates the manufacturer ID assigned by Bluetooth SIG - * - * @type { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - manufactureId: number; - /** - * Indicates the manufacturer data to add - * - * @type { ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Indicates the manufacturer data to add - * - * @type { ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Indicates the manufacturer data to add - * - * @type { ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - manufactureValue: ArrayBuffer; - } - - /** - * Describes the service data. - * - * @typedef ServiceData - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Describes the service data. - * - * @typedef ServiceData - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Describes the service data. - * - * @typedef ServiceData - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - interface ServiceData { - /** - * Indicates the UUID of the service data to add - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Indicates the UUID of the service data to add - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Indicates the UUID of the service data to add - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - serviceUuid: string; - /** - * Indicates the service data to add - * - * @type { ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Indicates the service data to add - * - * @type { ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Indicates the service data to add - * - * @type { ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - serviceValue: ArrayBuffer; - } - - /** - * Describes the criteria for filtering scanning results can be set. - * - * @typedef ScanFilter - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Describes the criteria for filtering scanning results can be set. - * - * @typedef ScanFilter - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Describes the criteria for filtering scanning results can be set. - * - * @typedef ScanFilter - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - interface ScanFilter { - /** - * The address of a BLE peripheral device - * - * @type { ?string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The address of a BLE peripheral device - * - * @type { ?string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The address of a BLE peripheral device - * - * @type { ?string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - deviceId?: string; - - /** - * The name of a BLE peripheral device - * - * @type { ?string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The name of a BLE peripheral device - * - * @type { ?string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The name of a BLE peripheral device - * - * @type { ?string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - name?: string; - - /** - * The service UUID of a BLE peripheral device - * - * @type { ?string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The service UUID of a BLE peripheral device - * - * @type { ?string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The service UUID of a BLE peripheral device - * - * @type { ?string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - serviceUuid?: string; - - /** - * Service UUID mask. - * - * @type { ?string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Service UUID mask. - * - * @type { ?string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Service UUID mask. - * - * @type { ?string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - serviceUuidMask?: string; - - /** - * Service solicitation UUID. - * - * @type { ?string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Service solicitation UUID. - * - * @type { ?string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Service solicitation UUID. - * - * @type { ?string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - serviceSolicitationUuid?: string; - - /** - * Service solicitation UUID mask. - * - * @type { ?string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Service solicitation UUID mask. - * - * @type { ?string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Service solicitation UUID mask. - * - * @type { ?string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - serviceSolicitationUuidMask?: string; - - /** - * Service data. - * - * @type { ?ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Service data. - * - * @type { ?ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Service data. - * - * @type { ?ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - serviceData?: ArrayBuffer; - - /** - * Service data mask. - * - * @type { ?ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Service data mask. - * - * @type { ?ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Service data mask. - * - * @type { ?ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - serviceDataMask?: ArrayBuffer; - - /** - * Manufacture id. - * - * @type { ?number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Manufacture id. - * - * @type { ?number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Manufacture id. - * - * @type { ?number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - manufactureId?: number; - - /** - * Manufacture data. - * - * @type { ?ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Manufacture data. - * - * @type { ?ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Manufacture data. - * - * @type { ?ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - manufactureData?: ArrayBuffer; - - /** - * Manufacture data mask. - * - * @type { ?ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Manufacture data mask. - * - * @type { ?ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Manufacture data mask. - * - * @type { ?ArrayBuffer } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - manufactureDataMask?: ArrayBuffer; - } - - /** - * Describes the parameters for scan. - * - * @typedef ScanOptions - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Describes the parameters for scan. - * - * @typedef ScanOptions - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Describes the parameters for scan. - * - * @typedef ScanOptions - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - interface ScanOptions { - /** - * Time of delay for reporting the scan result - * - * @type { ?number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Time of delay for reporting the scan result - * - * @type { ?number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Time of delay for reporting the scan result - * - * @type { ?number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - interval?: number; - /** - * Bluetooth LE scan mode - * - * @type { ?ScanDuty } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Bluetooth LE scan mode - * - * @type { ?ScanDuty } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Bluetooth LE scan mode - * - * @type { ?ScanDuty } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - dutyMode?: ScanDuty; - /** - * Match mode for Bluetooth LE scan filters hardware match - * - * @type { ?MatchMode } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Match mode for Bluetooth LE scan filters hardware match - * - * @type { ?MatchMode } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 - */ - matchMode?: MatchMode; - /** - * Physical Layer used during scan. - * - * @type { ?PhyType } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Physical Layer used during scan. - * - * @type { ?PhyType } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - phyType?: PhyType; - /** - * Report mode used during scan. - * - * @type { ?ScanReportMode } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 15 - */ - reportMode?: ScanReportMode; - } - - /** - * Describes the properties of a gatt characteristic. - * - * @typedef GattProperties - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Describes the properties of a gatt characteristic. - * - * @typedef GattProperties - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Describes the properties of a gatt characteristic. - * - * @typedef GattProperties - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - interface GattProperties { - /** - * Support write property of the characteristic. - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Support write property of the characteristic. - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Support write property of the characteristic. - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - write?: boolean; - /** - * Support write no response property of the characteristic. - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Support write no response property of the characteristic. - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Support write no response property of the characteristic. - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - writeNoResponse?: boolean; - /** - * Support read property of the characteristic. - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Support read property of the characteristic. - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Support read property of the characteristic. - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - read?: boolean; - /** - * Support notify property of the characteristic. - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Support notify property of the characteristic. - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Support notify property of the characteristic. - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - notify?: boolean; - /** - * Support indicate property of the characteristic. - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Support indicate property of the characteristic. - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 - */ - indicate?: boolean; - - /** - * Support broadcast property of the characteristic. - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 20 - */ - broadcast?: boolean; - - /** - * Support authenticated signed write property of the characteristic. - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 20 - */ - authenticatedSignedWrite?: boolean; - - /** - * Support extended properties property of the characteristic. - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 20 - */ - extendedProperties?: boolean; - } - - /** - * The enum of gatt characteristic write type - * - * @enum { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The enum of gatt characteristic write type - * - * @enum { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The enum of gatt characteristic write type - * - * @enum { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - enum GattWriteType { - /** - * Write characteristic with response. - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Write characteristic with response. - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Write characteristic with response. - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - WRITE = 1, - /** - * Write characteristic without response. - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Write characteristic without response. - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Write characteristic without response. - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - WRITE_NO_RESPONSE = 2 - } - - /** - * The enum of scan duty. - * - * @enum { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The enum of scan duty. - * - * @enum { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * The enum of scan duty. - * - * @enum { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - enum ScanDuty { - /** - * low power mode - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * low power mode - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * low power mode - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - SCAN_MODE_LOW_POWER = 0, - /** - * balanced power mode - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * balanced power mode - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * balanced power mode - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - SCAN_MODE_BALANCED = 1, - /** - * Scan using highest duty cycle - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * Scan using highest duty cycle - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Scan using highest duty cycle - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - SCAN_MODE_LOW_LATENCY = 2 - } - - /** - * The enum of BLE match mode. - * - * @enum { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * The enum of BLE match mode. - * - * @enum { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 - */ - enum MatchMode { - /** - * aggressive mode - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * aggressive mode - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 - */ - MATCH_MODE_AGGRESSIVE = 1, - /** - * sticky mode - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - /** - * sticky mode - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 - */ - MATCH_MODE_STICKY = 2 - } - - /** - * The enum of BLE advertising state. - * - * @enum { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 11 - */ - /** - * The enum of BLE advertising state. - * - * @enum { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - enum AdvertisingState { - /** - * advertising started. - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 11 - */ - /** - * advertising started. - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - STARTED = 1, - /** - * advertising temporarily enabled. - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since arkts {'1.1':'11','1.2':'20'} - * @arkts 1.1&1.2 - */ - ENABLED = 2, - /** - * advertising temporarily disabled. - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since arkts {'1.1':'11','1.2':'20'} - * @arkts 1.1&1.2 - */ - DISABLED = 3, - /** - * advertising stopped. - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 11 - */ - /** - * advertising stopped. - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 - */ - STOPPED = 4 - } - - /** - * Phy type used during scan. - * - * @enum { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Phy type used during scan. - * - * @enum { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - enum PhyType { - /** - * Use 1M phy for scanning. - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Use 1M phy for scanning. - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - PHY_LE_1M = 1, - /** - * Use all supported Phys for scanning. - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 12 - */ - /** - * Use all supported Phys for scanning. - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 13 - */ - PHY_LE_ALL_SUPPORTED = 255 - } - - /** - * Report mode used during scan. - * - * @enum { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 15 - */ - enum ScanReportMode { - /** - * In normal mode, the advertisement packet is reported immediately after being scanned. - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 15 - */ - NORMAL = 1, - /** - * Enables the batch mode in which advertisement packets are sent after the interval specified by {@link - * ScanOptions#interval}. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 19 - */ - BATCH = 2, - /** - * In low sensitivity fence mode, the advertisement packets are reported only when they are received for - * the first time and lost for the last time. The reception sensitivity is low. - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 18 - */ - FENCE_SENSITIVITY_LOW = 10, - /** - * In high sensitivity fence mode, the advertisement packets are reported only when they are received for - * the first time and lost for the last time. The reception sensitivity is high. - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 18 - */ - FENCE_SENSITIVITY_HIGH = 11, - } - - /** - * Scan report type used during scan. - * - * @enum { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 15 - */ - enum ScanReportType { - /** - * The found of advertisement packet. - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 15 - */ - ON_FOUND = 1, - /** - * The lost of advertisement packet. - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 15 - */ - ON_LOST = 2, - /** - * The type of advertisement packet reported in batch mode. - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 19 - */ - ON_BATCH = 3, - } - - /** - * The enum of gatt disconnection reasons. - * - * @enum { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 20 - */ - enum GattDisconnectReason { - - /** - * Disconnection due to timeout. - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 20 - */ - CONN_TIMEOUT = 1, - - /** - * The connection is disconnected due to the peer. - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 20 - */ - CONN_TERMINATE_PEER_USER = 2, - - /** - * The connection is disconnected due to the local host. - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 20 - */ - CONN_TERMINATE_LOCAL_HOST = 3, - - /** - * Disconnection due to unknown reason. - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 20 - */ - CONN_UNKNOWN = 4 - } - - /** - * Describes the permission of a att attribute item. - * - * @typedef GattPermissions - * @syscap SystemCapability.Communication.Bluetooth.Core - * @crossplatform - * @atomicservice - * @since 20 - */ - interface GattPermissions { - - /** - * The attribute field has the read permission. - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 20 - */ - read?: boolean; - - /** - * The attribute field has the encrypted read permission. - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 20 - */ - readEncrypted?: boolean; - - /** - * The attribute field has the read permission for encryption authentication. - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 20 - */ - readEncryptedMitm?: boolean; - - /** - * The attribute field has the write permission. - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 20 - */ - write?: boolean; - - /** - * The attribute field has the encrypted write permission. - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 20 - */ - writeEncrypted?: boolean; - - /** - * The attribute field has the write permission for encryption authentication. - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 20 - */ - writeEncryptedMitm?: boolean; - - /** - * The attribute field has the signed write permission. - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 20 - */ - writeSigned?: boolean; - - /** - * The attribute field has the write permission for signature authentication. - * - * @type { ?boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @atomicservice - * @since 20 - */ - writeSignedMitm?: boolean; - } -} - +/* + * Copyright (C) 2023-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * @kit ConnectivityKit + */ + +import type { AsyncCallback, Callback } from './@ohos.base'; +import type constant from './@ohos.bluetooth.constant'; + +/** + * Provides methods to operate or manage Bluetooth. + * + * @namespace ble + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ +/** + * Provides methods to operate or manage Bluetooth. + * + * @namespace ble + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ +/** + * Provides methods to operate or manage Bluetooth. + * + * @namespace ble + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ +declare namespace ble { + /** + * Indicate the profile connection state. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicate the profile connection state. + * + * @typedef { constant.ProfileConnectionState } ProfileConnectionState + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Indicate the profile connection state. + * + * @typedef { constant.ProfileConnectionState } ProfileConnectionState + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + type ProfileConnectionState = constant.ProfileConnectionState; + + /** + * create a Gatt server instance. + * + * @returns { GattServer } Returns a Gatt server instance {@code GattServer}. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * create a Gatt server instance. + * + * @returns { GattServer } Returns a Gatt server instance {@code GattServer}. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * create a Gatt server instance. + * + * @returns { GattServer } Returns a Gatt server instance {@code GattServer}. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + function createGattServer(): GattServer; + + /** + * create a Gatt client device instance. + * + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @returns { GattClientDevice } Returns a Gatt client device instance {@code GattClientDevice}. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * create a Gatt client device instance. + * + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @returns { GattClientDevice } Returns a Gatt client device instance {@code GattClientDevice}. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * create a Gatt client device instance. + * + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @returns { GattClientDevice } Returns a Gatt client device instance {@code GattClientDevice}. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + function createGattClientDevice(deviceId: string): GattClientDevice; + + /** + * Create a ble scanner instance. Each ble scanner instance can be independently started or stopped. + * + * @returns { BleScanner } Returns the promise object. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 15 + */ + function createBleScanner(): BleScanner; + + /** + * Obtains the list of devices in the connected status. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { Array } Returns the list of device address. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Obtains the list of devices in the connected status. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { Array } Returns the list of device address. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @since 13 + */ + function getConnectedBLEDevices(): Array; + + /** + * Obtains the list of devices in the connected status. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BleProfile } profile - The profile in the BLE protocol. + * It is used to obtain the connected devices corresponding to the profile. + * @returns { Array } Returns the list of device address. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 21 + * @arkts 1.1&1.2 + */ + function getConnectedBLEDevices(profile: BleProfile): Array; + + /** + * Starts scanning for specified BLE devices with filters. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { Array } filters - Indicates the list of filters used to filter out specified devices. + * If you do not want to use filter, set this parameter to {@code null}. + * @param { ScanOptions } options - Indicates the parameters for scanning and if the user does not assign a value, + * the default value will be used. {@link ScanOptions#interval} set to 0, + * and {@link ScanOptions#dutyMode} set to {@link SCAN_MODE_LOW_POWER} + * and {@link ScanOptions#matchMode} set to {@link MATCH_MODE_AGGRESSIVE}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Starts scanning for specified BLE devices with filters. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { Array } filters - Indicates the list of filters used to filter out specified devices. + * If you do not want to use filter, set this parameter to {@code null}. + * @param { ScanOptions } options - Indicates the parameters for scanning and if the user does not assign a value, + * the default value will be used. {@link ScanOptions#interval} set to 0, + * and {@link ScanOptions#dutyMode} set to {@link SCAN_MODE_LOW_POWER} + * and {@link ScanOptions#matchMode} set to {@link MATCH_MODE_AGGRESSIVE}. + * and {@link ScanOptions#phyType} set to {@link PHY_LE_ALL_SUPPORTED}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Starts scanning for specified BLE devices with filters. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { Array } filters - Indicates the list of filters used to filter out specified devices. + * If you do not want to use filter, set this parameter to {@code null}. + * @param { ScanOptions } options - Indicates the parameters for scanning and if the user does not assign a value, + * the default value will be used. {@link ScanOptions#interval} set to 0, + * and {@link ScanOptions#dutyMode} set to {@link SCAN_MODE_LOW_POWER} + * and {@link ScanOptions#matchMode} set to {@link MATCH_MODE_AGGRESSIVE}. + * and {@link ScanOptions#phyType} set to {@link PHY_LE_ALL_SUPPORTED}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + function startBLEScan(filters: Array, options?: ScanOptions): void; + + /** + * Starts scanning for specified BLE devices with filters. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { Array | null } filters - Indicates the list of filters used to filter out specified devices. + * If you do not want to use filter, set this parameter to {@code null}. + * @param { ScanOptions } [options] - Indicates the parameters for scanning and if the user does not assign a value, + * the default value will be used. {@link ScanOptions#interval} set to 0, + * {@link ScanOptions#dutyMode} set to {@link SCAN_MODE_LOW_POWER} + * and {@link ScanOptions#matchMode} set to {@link MATCH_MODE_AGGRESSIVE}. + * and {@link ScanOptions#phyType} set to {@link PHY_LE_ALL_SUPPORTED}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + function startBLEScan(filters: Array | null, options?: ScanOptions): void; + + /** + * Stops BLE scanning. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Stops BLE scanning. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Stops BLE scanning. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + function stopBLEScan(): void; + + /** + * Starts BLE advertising. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AdvertiseSetting } setting - Indicates the settings for BLE advertising. + * @param { AdvertiseData } advData - Indicates the advertising data. + * @param { AdvertiseData } advResponse - Indicates the scan response associated with the advertising data. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Starts BLE advertising. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AdvertiseSetting } setting - Indicates the settings for BLE advertising. + * @param { AdvertiseData } advData - Indicates the advertising data. + * @param { AdvertiseData } advResponse - Indicates the scan response associated with the advertising data. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Starts BLE advertising. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AdvertiseSetting } setting - Indicates the settings for BLE advertising. + * @param { AdvertiseData } advData - Indicates the advertising data. + * @param { AdvertiseData } advResponse - Indicates the scan response associated with the advertising data. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + /** + * Starts BLE advertising. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AdvertiseSetting } setting - Indicates the settings for BLE advertising. + * @param { AdvertiseData } advData - Indicates the advertising data. + * @param { AdvertiseData } advResponse - Indicates the scan response associated with the advertising data. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900010 - The number of advertising resources reaches the upper limit. + * @throws { BusinessError } 2900099 - Operation failed. + * @throws { BusinessError } 2902054 - The length of the advertising data exceeds the upper limit. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 20 + */ + function startAdvertising(setting: AdvertiseSetting, advData: AdvertiseData, advResponse?: AdvertiseData): void; + + /** + * Stops BLE advertising. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Stops BLE advertising. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Stops BLE advertising. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + function stopAdvertising(): void; + + /** + * Starts BLE advertising. + * The API returns a advertising ID. The ID can be used to temporarily enable or disable this advertising + * using the API {@link enableAdvertising} or {@link disableAdvertising}. + * To completely stop the advertising corresponding to the ID, invoke the API {@link stopAdvertising} with ID. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AdvertisingParams } advertisingParams - Indicates the params for BLE advertising. + * @param { AsyncCallback } callback - the callback of advertise ID. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + /** + * Starts BLE advertising. + * The API returns a advertising ID. The ID can be used to temporarily enable or disable this advertising + * using the API {@link enableAdvertising} or {@link disableAdvertising}. + * To completely stop the advertising corresponding to the ID, invoke the API {@link stopAdvertising} with ID. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AdvertisingParams } advertisingParams - Indicates the params for BLE advertising. + * @param { AsyncCallback } callback - the callback of advertise ID. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @since 13 + */ + /** + * Starts BLE advertising. + * The API returns a advertising ID. The ID can be used to temporarily enable or disable this advertising + * using the API {@link enableAdvertising} or {@link disableAdvertising}. + * To completely stop the advertising corresponding to the ID, invoke the API {@link stopAdvertising} with ID. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AdvertisingParams } advertisingParams - Indicates the params for BLE advertising. + * @param { AsyncCallback } callback - the callback of advertise ID. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900010 - The number of advertising resources reaches the upper limit. + * @throws { BusinessError } 2900099 - Operation failed. + * @throws { BusinessError } 2902054 - The length of the advertising data exceeds the upper limit. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @since 20 + */ + function startAdvertising(advertisingParams: AdvertisingParams, callback: AsyncCallback): void; + + /** + * Starts BLE advertising. + * The API returns a advertising ID. The ID can be used to temporarily enable or disable this advertising + * using the API {@link enableAdvertising} or {@link disableAdvertising}. + * To completely stop the advertising corresponding to the ID, invoke the API {@link stopAdvertising} with ID. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AdvertisingParams } advertisingParams - Indicates the param for BLE advertising. + * @returns { Promise } Returns the promise object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + /** + * Starts BLE advertising. + * The API returns a advertising ID. The ID can be used to temporarily enable or disable this advertising + * using the API {@link enableAdvertising} or {@link disableAdvertising}. + * To completely stop the advertising corresponding to the ID, invoke the API {@link stopAdvertising} with ID. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AdvertisingParams } advertisingParams - Indicates the param for BLE advertising. + * @returns { Promise } Returns the promise object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @since 13 + */ + /** + * Starts BLE advertising. + * The API returns a advertising ID. The ID can be used to temporarily enable or disable this advertising + * using the API {@link enableAdvertising} or {@link disableAdvertising}. + * To completely stop the advertising corresponding to the ID, invoke the API {@link stopAdvertising} with ID. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AdvertisingParams } advertisingParams - Indicates the param for BLE advertising. + * @returns { Promise } Returns the promise object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900010 - The number of advertising resources reaches the upper limit. + * @throws { BusinessError } 2900099 - Operation failed. + * @throws { BusinessError } 2902054 - The length of the advertising data exceeds the upper limit. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @since 20 + */ + function startAdvertising(advertisingParams: AdvertisingParams): Promise; + + /** + * Enable the advertising with a specific ID temporarily. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AdvertisingEnableParams } advertisingEnableParams - Indicates the params for enable advertising. + * @param { AsyncCallback } callback - the callback result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + /** + * Enable the advertising with a specific ID temporarily. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AdvertisingEnableParams } advertisingEnableParams - Indicates the params for enable advertising. + * @param { AsyncCallback } callback - the callback result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @throws { BusinessError } 2902055 - Invalid advertising id. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 20 + */ + function enableAdvertising(advertisingEnableParams: AdvertisingEnableParams, callback: AsyncCallback): void; + + /** + * Enable the advertising with a specific ID temporarily. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AdvertisingEnableParams } advertisingEnableParams - Indicates the params for enable advertising. + * @returns { Promise } Returns the promise object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + /** + * Enable the advertising with a specific ID temporarily. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AdvertisingEnableParams } advertisingEnableParams - Indicates the params for enable advertising. + * @returns { Promise } Returns the promise object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @throws { BusinessError } 2902055 - Invalid advertising id. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 20 + */ + function enableAdvertising(advertisingEnableParams: AdvertisingEnableParams): Promise; + + /** + * Disable the advertising with a specific ID temporarily. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AdvertisingDisableParams } advertisingDisableParams - Indicates the params for disable advertising. + * @param { AsyncCallback } callback - the callback result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + /** + * Disable the advertising with a specific ID temporarily. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AdvertisingDisableParams } advertisingDisableParams - Indicates the params for disable advertising. + * @param { AsyncCallback } callback - the callback result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @throws { BusinessError } 2902055 - Invalid advertising id. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 20 + */ + function disableAdvertising(advertisingDisableParams: AdvertisingDisableParams, callback: AsyncCallback): void; + + /** + * Disable the advertising with a specific ID temporarily. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AdvertisingDisableParams } advertisingDisableParams - Indicates the params for disable advertising. + * @returns { Promise } Returns the promise object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + /** + * Disable the advertising with a specific ID temporarily. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AdvertisingDisableParams } advertisingDisableParams - Indicates the params for disable advertising. + * @returns { Promise } Returns the promise object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @throws { BusinessError } 2902055 - Invalid advertising id. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 20 + */ + function disableAdvertising(advertisingDisableParams: AdvertisingDisableParams): Promise; + + /** + * Stops BLE advertising. + * Completely stop the advertising corresponding to the ID. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { number } advertisingId - Indicates the ID for this BLE advertising. + * @param { AsyncCallback } callback - the callback result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + /** + * Stops BLE advertising. + * Completely stop the advertising corresponding to the ID. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { number } advertisingId - Indicates the ID for this BLE advertising. + * @param { AsyncCallback } callback - the callback result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @since 13 + */ + /** + * Stops BLE advertising. + * Completely stop the advertising corresponding to the ID. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { number } advertisingId - Indicates the ID for this BLE advertising. + * @param { AsyncCallback } callback - the callback result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @throws { BusinessError } 2902055 - Invalid advertising id. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @since 20 + */ + function stopAdvertising(advertisingId: number, callback: AsyncCallback): void; + + /** + * Stops BLE advertising. + * Completely stop the advertising corresponding to the ID. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { number } advertisingId - Indicates the ID for this BLE advertising. + * @returns { Promise } Returns the promise object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + /** + * Stops BLE advertising. + * Completely stop the advertising corresponding to the ID. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { number } advertisingId - Indicates the ID for this BLE advertising. + * @returns { Promise } Returns the promise object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @since 13 + */ + /** + * Stops BLE advertising. + * Completely stop the advertising corresponding to the ID. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { number } advertisingId - Indicates the ID for this BLE advertising. + * @returns { Promise } Returns the promise object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @throws { BusinessError } 2902055 - Invalid advertising id. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @since 20 + */ + function stopAdvertising(advertisingId: number): Promise; + + /** + * Subscribing to advertising state change event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'advertisingStateChange' } type - Type of the advertising state to listen for. + * @param { Callback } callback - Callback used to listen for the advertising state. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + /** + * Subscribing to advertising state change event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'advertisingStateChange' } type - Type of the advertising state to listen for. + * @param { Callback } callback - Callback used to listen for the advertising state. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @since 13 + */ + function on(type: 'advertisingStateChange', callback: Callback): void; + + /** + * Unsubscribe from advertising state change event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'advertisingStateChange' } type - Type of the advertising state to listen for. + * @param { Callback } callback - Callback used to listen for the advertising state. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + /** + * Unsubscribe from advertising state change event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'advertisingStateChange' } type - Type of the advertising state to listen for. + * @param { Callback } callback - Callback used to listen for the advertising state. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @since 13 + */ + function off(type: 'advertisingStateChange', callback?: Callback): void; + + /** + * Subscribe BLE scan result. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for. + * @param { Callback> } callback - Callback used to listen for the scan result event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Subscribe BLE scan result. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for. + * @param { Callback> } callback - Callback used to listen for the scan result event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Subscribe BLE scan result. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for. + * @param { Callback> } callback - Callback used to listen for the scan result event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + function on(type: 'BLEDeviceFind', callback: Callback>): void; + + /** + * Unsubscribe BLE scan result. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for. + * @param { Callback> } callback - Callback used to listen for the scan result event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Unsubscribe BLE scan result. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for. + * @param { Callback> } callback - Callback used to listen for the scan result event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Unsubscribe BLE scan result. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for. + * @param { Callback> } callback - Callback used to listen for the scan result event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + function off(type: 'BLEDeviceFind', callback?: Callback>): void; + + /** + * Manages GATT server. Before calling an Gatt server method, you must use {@link createGattServer} to create an GattServer instance. + * + * @typedef GattServer + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Manages GATT server. Before calling an Gatt server method, you must use {@link createGattServer} to create an GattServer instance. + * + * @typedef GattServer + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Manages GATT server. Before calling an Gatt server method, you must use {@link createGattServer} to create an GattServer instance. + * + * @typedef GattServer + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + interface GattServer { + /** + * Adds a specified service to be hosted. + *

The added service and its characteristics are provided by the local device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { GattService } service - Indicates the service to add. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Adds a specified service to be hosted. + *

The added service and its characteristics are provided by the local device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { GattService } service - Indicates the service to add. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Adds a specified service to be hosted. + *

The added service and its characteristics are provided by the local device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { GattService } service - Indicates the service to add. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + addService(service: GattService): void; + + /** + * Removes a specified service from the list of GATT services provided by this device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } serviceUuid - Indicates the UUID of the service to remove. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900004 - Profile not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Removes a specified service from the list of GATT services provided by this device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } serviceUuid - Indicates the UUID of the service to remove. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900004 - Profile not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Removes a specified service from the list of GATT services provided by this device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } serviceUuid - Indicates the UUID of the service to remove. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900004 - Profile not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + removeService(serviceUuid: string): void; + + /** + * Closes this {@code GattServer} object and unregisters its callbacks. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Closes this {@code GattServer} object and unregisters its callbacks. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Closes this {@code GattServer} object and unregisters its callbacks. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + close(): void; + + /** + * Sends a notification of a change in a specified local characteristic with a asynchronous callback. + *

This method should be called for every BLE peripheral device that has requested notifications. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @param { NotifyCharacteristic } notifyCharacteristic - Indicates the local characteristic that has changed. + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Sends a notification of a change in a specified local characteristic with a asynchronous callback. + *

This method should be called for every BLE peripheral device that has requested notifications. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @param { NotifyCharacteristic } notifyCharacteristic - Indicates the local characteristic that has changed. + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Sends a notification of a change in a specified local characteristic with a asynchronous callback. + *

This method should be called for every BLE peripheral device that has requested notifications. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @param { NotifyCharacteristic } notifyCharacteristic - Indicates the local characteristic that has changed. + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + notifyCharacteristicChanged( + deviceId: string, + notifyCharacteristic: NotifyCharacteristic, + callback: AsyncCallback + ): void; + + /** + * Sends a notification of a change in a specified local characteristic with a asynchronous callback. + *

This method should be called for every BLE peripheral device that has requested notifications. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @param { NotifyCharacteristic } notifyCharacteristic - Indicates the local characteristic that has changed. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Sends a notification of a change in a specified local characteristic with a asynchronous callback. + *

This method should be called for every BLE peripheral device that has requested notifications. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @param { NotifyCharacteristic } notifyCharacteristic - Indicates the local characteristic that has changed. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Sends a notification of a change in a specified local characteristic with a asynchronous callback. + *

This method should be called for every BLE peripheral device that has requested notifications. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @param { NotifyCharacteristic } notifyCharacteristic - Indicates the local characteristic that has changed. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + notifyCharacteristicChanged(deviceId: string, notifyCharacteristic: NotifyCharacteristic): Promise; + + /** + * Sends a response to a specified read or write request to a given BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { ServerResponse } serverResponse - Indicates the response parameters {@link ServerResponse}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Sends a response to a specified read or write request to a given BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { ServerResponse } serverResponse - Indicates the response parameters {@link ServerResponse}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Sends a response to a specified read or write request to a given BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { ServerResponse } serverResponse - Indicates the response parameters {@link ServerResponse}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + sendResponse(serverResponse: ServerResponse): void; + + /** + * Subscribe characteristic read event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'characteristicRead' } type - Type of the characteristic read event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic read event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Subscribe characteristic read event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'characteristicRead' } type - Type of the characteristic read event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic read event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Subscribe characteristic read event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'characteristicRead' } type - Type of the characteristic read event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic read event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + on(type: 'characteristicRead', callback: Callback): void; + + /** + * Unsubscribe characteristic read event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'characteristicRead' } type - Type of the characteristic read event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic read event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Unsubscribe characteristic read event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'characteristicRead' } type - Type of the characteristic read event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic read event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Unsubscribe characteristic read event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'characteristicRead' } type - Type of the characteristic read event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic read event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + off(type: 'characteristicRead', callback?: Callback): void; + + /** + * Subscribe characteristic write event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'characteristicWrite' } type - Type of the characteristic write event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic write event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Subscribe characteristic write event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'characteristicWrite' } type - Type of the characteristic write event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic write event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Subscribe characteristic write event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'characteristicWrite' } type - Type of the characteristic write event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic write event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + on(type: 'characteristicWrite', callback: Callback): void; + + /** + * Unsubscribe characteristic write event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'characteristicWrite' } type - Type of the characteristic write event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic write event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Unsubscribe characteristic write event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'characteristicWrite' } type - Type of the characteristic write event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic write event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Unsubscribe characteristic write event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'characteristicWrite' } type - Type of the characteristic write event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic write event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + off(type: 'characteristicWrite', callback?: Callback): void; + + /** + * Subscribe descriptor read event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'descriptorRead' } type - Type of the descriptor read event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor read event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Subscribe descriptor read event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'descriptorRead' } type - Type of the descriptor read event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor read event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Subscribe descriptor read event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'descriptorRead' } type - Type of the descriptor read event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor read event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + on(type: 'descriptorRead', callback: Callback): void; + + /** + * Unsubscribe descriptor read event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'descriptorRead' } type - Type of the descriptor read event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor read event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Unsubscribe descriptor read event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'descriptorRead' } type - Type of the descriptor read event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor read event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Unsubscribe descriptor read event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'descriptorRead' } type - Type of the descriptor read event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor read event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + off(type: 'descriptorRead', callback?: Callback): void; + + /** + * Subscribe descriptor write event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'descriptorWrite' } type - Type of the descriptor write event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor write event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Subscribe descriptor write event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'descriptorWrite' } type - Type of the descriptor write event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor write event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Subscribe descriptor write event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'descriptorWrite' } type - Type of the descriptor write event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor write event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + on(type: 'descriptorWrite', callback: Callback): void; + + /** + * Unsubscribe descriptor write event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'descriptorWrite' } type - Type of the descriptor write event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor write event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Unsubscribe descriptor write event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'descriptorWrite' } type - Type of the descriptor write event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor write event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Unsubscribe descriptor write event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'descriptorWrite' } type - Type of the descriptor write event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor write event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + off(type: 'descriptorWrite', callback?: Callback): void; + + /** + * Subscribe server connection state changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'connectionStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Subscribe server connection state changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'connectionStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Subscribe server connection state changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'connectionStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + on(type: 'connectionStateChange', callback: Callback): void; + + /** + * Unsubscribe server connection state changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'connectionStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Unsubscribe server connection state changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'connectionStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Unsubscribe server connection state changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'connectionStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + off(type: 'connectionStateChange', callback?: Callback): void; + + /** + * Subscribe mtu changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEMtuChange' } type - Type of the mtu changed event to listen for. + * @param { Callback } callback - Callback used to listen for the mtu changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Subscribe mtu changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEMtuChange' } type - Type of the mtu changed event to listen for. + * @param { Callback } callback - Callback used to listen for the mtu changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @since arkts{ '1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + on(type: 'BLEMtuChange', callback: Callback): void; + + /** + * Unsubscribe mtu changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEMtuChange' } type - Type of the mtu changed event to listen for. + * @param { Callback } callback - Callback used to listen for the mtu changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Unsubscribe mtu changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEMtuChange' } type - Type of the mtu changed event to listen for. + * @param { Callback } callback - Callback used to listen for the mtu changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @since arkts{ '1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + off(type: 'BLEMtuChange', callback?: Callback): void; + } + + /** + * Manages GATT client. Before calling an Gatt client method, you must use {@link createGattClientDevice} to create an GattClientDevice instance. + * + * @typedef GattClientDevice + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Manages GATT client. Before calling an Gatt client method, you must use {@link createGattClientDevice} to create an GattClientDevice instance. + * + * @typedef GattClientDevice + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Manages GATT client. Before calling an Gatt client method, you must use {@link createGattClientDevice} to create an GattClientDevice instance. + * + * @typedef GattClientDevice + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + interface GattClientDevice { + /** + * Connects to a BLE peripheral device. + *

The 'BLEConnectionStateChange' event is subscribed to return the connection state. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Connects to a BLE peripheral device. + *

The 'BLEConnectionStateChange' event is subscribed to return the connection state. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Connects to a BLE peripheral device. + *

The 'BLEConnectionStateChange' event is subscribed to return the connection state. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + connect(): void; + + /** + * Disconnects from or stops an ongoing connection to a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Disconnects from or stops an ongoing connection to a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Disconnects from or stops an ongoing connection to a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + disconnect(): void; + + /** + * Disables a BLE peripheral device. + *

This method unregisters the device and clears the registered callbacks and handles. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Disables a BLE peripheral device. + *

This method unregisters the device and clears the registered callbacks and handles. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Disables a BLE peripheral device. + *

This method unregisters the device and clears the registered callbacks and handles. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + close(): void; + + /** + * Obtains the name of BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AsyncCallback } callback - Callback used to obtain the device name. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Obtains the name of BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AsyncCallback } callback - Callback used to obtain the device name. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Obtains the name of BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AsyncCallback } callback - Callback used to obtain the device name. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + getDeviceName(callback: AsyncCallback): void; + + /** + * Obtains the name of BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { Promise } Returns a string representation of the name if obtained; + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter.Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Obtains the name of BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { Promise } Returns a string representation of the name if obtained; + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter.Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Obtains the name of BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { Promise } Returns a string representation of the name if obtained; + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter.Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + getDeviceName(): Promise; + + /** + * Starts discovering services. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AsyncCallback> } callback - Callback used to catch the services. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Starts discovering services. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AsyncCallback> } callback - Callback used to catch the services. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Starts discovering services. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AsyncCallback> } callback - Callback used to catch the services. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + getServices(callback: AsyncCallback>): void; + + /** + * Starts discovering services. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { Promise> } Returns the list of services {@link GattService} of the BLE peripheral device. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Starts discovering services. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { Promise> } Returns the list of services {@link GattService} of the BLE peripheral device. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Starts discovering services. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { Promise> } Returns the list of services {@link GattService} of the BLE peripheral device. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + getServices(): Promise>; + + /** + * Reads the characteristic of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to read. + * @param { AsyncCallback } callback - Callback invoked to return the characteristic value read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Reads the characteristic of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to read. + * @param { AsyncCallback } callback - Callback invoked to return the characteristic value read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Reads the characteristic of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to read. + * @param { AsyncCallback } callback - Callback invoked to return the characteristic value read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + /** + * Reads the characteristic of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to read. + * @param { AsyncCallback } callback - Callback invoked to return the characteristic value read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900011 - The operation is busy. The last operation is not complete. + * @throws { BusinessError } 2900099 - Operation failed. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2901003 - The connection is not established. + * @throws { BusinessError } 2901004 - The connection is congested. + * @throws { BusinessError } 2901005 - The connection is not encrypted. + * @throws { BusinessError } 2901006 - The connection is not authenticated. + * @throws { BusinessError } 2901007 - The connection is not authorized. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 20 + */ + readCharacteristicValue(characteristic: BLECharacteristic, callback: AsyncCallback): void; + + /** + * Reads the characteristic of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to read. + * @returns { Promise } - Promise used to return the characteristic value read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Reads the characteristic of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to read. + * @returns { Promise } - Promise used to return the characteristic value read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Reads the characteristic of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to read. + * @returns { Promise } - Promise used to return the characteristic value read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + /** + * Reads the characteristic of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to read. + * @returns { Promise } - Promise used to return the characteristic value read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900011 - The operation is busy. The last operation is not complete. + * @throws { BusinessError } 2900099 - Operation failed. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2901003 - The connection is not established. + * @throws { BusinessError } 2901004 - The connection is congested. + * @throws { BusinessError } 2901005 - The connection is not encrypted. + * @throws { BusinessError } 2901006 - The connection is not authenticated. + * @throws { BusinessError } 2901007 - The connection is not authorized. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 20 + */ + readCharacteristicValue(characteristic: BLECharacteristic): Promise; + + /** + * Reads the descriptor of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to read. + * @param { AsyncCallback } callback - Callback invoked to return the descriptor read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Reads the descriptor of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to read. + * @param { AsyncCallback } callback - Callback invoked to return the descriptor read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Reads the descriptor of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to read. + * @param { AsyncCallback } callback - Callback invoked to return the descriptor read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + /** + * Reads the descriptor of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to read. + * @param { AsyncCallback } callback - Callback invoked to return the descriptor read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900011 - The operation is busy. The last operation is not complete. + * @throws { BusinessError } 2900099 - Operation failed. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2901003 - The connection is not established. + * @throws { BusinessError } 2901004 - The connection is congested. + * @throws { BusinessError } 2901005 - The connection is not encrypted. + * @throws { BusinessError } 2901006 - The connection is not authenticated. + * @throws { BusinessError } 2901007 - The connection is not authorized. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 20 + */ + readDescriptorValue(descriptor: BLEDescriptor, callback: AsyncCallback): void; + + /** + * Reads the descriptor of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to read. + * @returns { Promise } - Promise used to return the descriptor read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Reads the descriptor of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to read. + * @returns { Promise } - Promise used to return the descriptor read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Reads the descriptor of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to read. + * @returns { Promise } - Promise used to return the descriptor read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + /** + * Reads the descriptor of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to read. + * @returns { Promise } - Promise used to return the descriptor read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900011 - The operation is busy. The last operation is not complete. + * @throws { BusinessError } 2900099 - Operation failed. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2901003 - The connection is not established. + * @throws { BusinessError } 2901004 - The connection is congested. + * @throws { BusinessError } 2901005 - The connection is not encrypted. + * @throws { BusinessError } 2901006 - The connection is not authenticated. + * @throws { BusinessError } 2901007 - The connection is not authorized. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 20 + */ + readDescriptorValue(descriptor: BLEDescriptor): Promise; + + /** + * Writes the characteristic of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to write. + * @param { GattWriteType } writeType - Write type of the characteristic. + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901001 - Write forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Writes the characteristic of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to write. + * @param { GattWriteType } writeType - Write type of the characteristic. + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901001 - Write forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Writes the characteristic of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to write. + * @param { GattWriteType } writeType - Write type of the characteristic. + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901001 - Write forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + /** + * Writes the characteristic of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to write. + * @param { GattWriteType } writeType - Write type of the characteristic. + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900011 - The operation is busy. The last operation is not complete. + * @throws { BusinessError } 2900099 - Operation failed. + * @throws { BusinessError } 2901001 - Write forbidden. + * @throws { BusinessError } 2901003 - The connection is not established. + * @throws { BusinessError } 2901004 - The connection is congested. + * @throws { BusinessError } 2901005 - The connection is not encrypted. + * @throws { BusinessError } 2901006 - The connection is not authenticated. + * @throws { BusinessError } 2901007 - The connection is not authorized. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 20 + */ + writeCharacteristicValue( + characteristic: BLECharacteristic, + writeType: GattWriteType, + callback: AsyncCallback + ): void; + + /** + * Writes the characteristic of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to write. + * @param { GattWriteType } writeType - Write type of the characteristic. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901001 - Write forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Writes the characteristic of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to write. + * @param { GattWriteType } writeType - Write type of the characteristic. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901001 - Write forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Writes the characteristic of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to write. + * @param { GattWriteType } writeType - Write type of the characteristic. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901001 - Write forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + /** + * Writes the characteristic of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to write. + * @param { GattWriteType } writeType - Write type of the characteristic. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900011 - The operation is busy. The last operation is not complete. + * @throws { BusinessError } 2900099 - Operation failed. + * @throws { BusinessError } 2901001 - Write forbidden. + * @throws { BusinessError } 2901003 - The connection is not established. + * @throws { BusinessError } 2901004 - The connection is congested. + * @throws { BusinessError } 2901005 - The connection is not encrypted. + * @throws { BusinessError } 2901006 - The connection is not authenticated. + * @throws { BusinessError } 2901007 - The connection is not authorized. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 20 + */ + writeCharacteristicValue(characteristic: BLECharacteristic, writeType: GattWriteType): Promise; + + /** + * Writes the descriptor of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to write. + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901001 - Write forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Writes the descriptor of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to write. + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901001 - Write forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Writes the descriptor of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to write. + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901001 - Write forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + /** + * Writes the descriptor of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to write. + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900011 - The operation is busy. The last operation is not complete. + * @throws { BusinessError } 2900099 - Operation failed. + * @throws { BusinessError } 2901001 - Write forbidden. + * @throws { BusinessError } 2901003 - The connection is not established. + * @throws { BusinessError } 2901004 - The connection is congested. + * @throws { BusinessError } 2901005 - The connection is not encrypted. + * @throws { BusinessError } 2901006 - The connection is not authenticated. + * @throws { BusinessError } 2901007 - The connection is not authorized. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 20 + */ + writeDescriptorValue(descriptor: BLEDescriptor, callback: AsyncCallback): void; + + /** + * Writes the descriptor of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to write. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901001 - Write forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Writes the descriptor of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to write. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901001 - Write forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Writes the descriptor of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to write. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901001 - Write forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + /** + * Writes the descriptor of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to write. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900011 - The operation is busy. The last operation is not complete. + * @throws { BusinessError } 2900099 - Operation failed. + * @throws { BusinessError } 2901001 - Write forbidden. + * @throws { BusinessError } 2901003 - The connection is not established. + * @throws { BusinessError } 2901004 - The connection is congested. + * @throws { BusinessError } 2901005 - The connection is not encrypted. + * @throws { BusinessError } 2901006 - The connection is not authenticated. + * @throws { BusinessError } 2901007 - The connection is not authorized. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 20 + */ + writeDescriptorValue(descriptor: BLEDescriptor): Promise; + + /** + * Get the RSSI value of this BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AsyncCallback } callback - Callback invoked to return the RSSI, in dBm. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Get the RSSI value of this BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AsyncCallback } callback - Callback invoked to return the RSSI, in dBm. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Get the RSSI value of this BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AsyncCallback } callback - Callback invoked to return the RSSI, in dBm. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900011 - The operation is busy. The last operation is not complete. + * @throws { BusinessError } 2900099 - Operation failed. + * @throws { BusinessError } 2901003 - The connection is not established. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 20 + */ + getRssiValue(callback: AsyncCallback): void; + + /** + * Get the RSSI value of this BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { Promise } Returns the RSSI value. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Get the RSSI value of this BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { Promise } Returns the RSSI value. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Get the RSSI value of this BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { Promise } Returns the RSSI value. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900011 - The operation is busy. The last operation is not complete. + * @throws { BusinessError } 2900099 - Operation failed. + * @throws { BusinessError } 2901003 - The connection is not established. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 20 + */ + getRssiValue(): Promise; + + /** + * Set the mtu size of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { number } mtu - The maximum transmission unit. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Set the mtu size of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { number } mtu - The maximum transmission unit. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Set the mtu size of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { int } mtu - The maximum transmission unit. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts{ '1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + setBLEMtuSize(mtu: int): void; + + /** + * Enables or disables notification of a characteristic when value changed. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. + * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates + * that notification is enabled, and the value {@code false} indicates that indication is disabled. + * @param { AsyncCallback } callback - the callback of setCharacteristicChangeNotification. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Enables or disables notification of a characteristic when value changed. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. + * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates + * that notification is enabled, and the value {@code false} indicates that indication is disabled. + * @param { AsyncCallback } callback - the callback of setCharacteristicChangeNotification. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Enables or disables notification of a characteristic when value changed. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. + * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates + * that notification is enabled, and the value {@code false} indicates that indication is disabled. + * @param { AsyncCallback } callback - the callback of setCharacteristicChangeNotification. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900011 - The operation is busy. The last operation is not complete. + * @throws { BusinessError } 2900099 - Operation failed. + * @throws { BusinessError } 2901003 - The connection is not established. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 20 + */ + setCharacteristicChangeNotification( + characteristic: BLECharacteristic, + enable: boolean, + callback: AsyncCallback + ): void; + + /** + * Enables or disables indication of a characteristic when value changed. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. + * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates + * that indication is enabled, and the value {@code false} indicates that indication is disabled. + * @returns { Promise } Returns the promise object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Enables or disables indication of a characteristic when value changed. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. + * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates + * that indication is enabled, and the value {@code false} indicates that indication is disabled. + * @returns { Promise } Returns the promise object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Enables or disables indication of a characteristic when value changed. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. + * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates + * that indication is enabled, and the value {@code false} indicates that indication is disabled. + * @returns { Promise } Returns the promise object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900011 - The operation is busy. The last operation is not complete. + * @throws { BusinessError } 2900099 - Operation failed. + * @throws { BusinessError } 2901003 - The connection is not established. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 20 + */ + setCharacteristicChangeNotification(characteristic: BLECharacteristic, enable: boolean): Promise; + + /** + * Enables or disables indication of a characteristic when value changed. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. + * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates + * that indication is enabled, and the value {@code false} indicates that indication is disabled. + * @param { AsyncCallback } callback - the callback of setCharacteristicChangeIndication. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Enables or disables indication of a characteristic when value changed. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. + * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates + * that indication is enabled, and the value {@code false} indicates that indication is disabled. + * @param { AsyncCallback } callback - the callback of setCharacteristicChangeIndication. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Enables or disables indication of a characteristic when value changed. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. + * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates + * that indication is enabled, and the value {@code false} indicates that indication is disabled. + * @param { AsyncCallback } callback - the callback of setCharacteristicChangeIndication. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900011 - The operation is busy. The last operation is not complete. + * @throws { BusinessError } 2900099 - Operation failed. + * @throws { BusinessError } 2901003 - The connection is not established. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 20 + */ + setCharacteristicChangeIndication( + characteristic: BLECharacteristic, + enable: boolean, + callback: AsyncCallback + ): void; + + /** + * Enables or disables indication of a characteristic when value changed. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. + * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates + * that indication is enabled, and the value {@code false} indicates that indication is disabled. + * @returns { Promise } Returns the promise object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Enables or disables indication of a characteristic when value changed. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. + * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates + * that indication is enabled, and the value {@code false} indicates that indication is disabled. + * @returns { Promise } Returns the promise object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Enables or disables indication of a characteristic when value changed. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. + * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates + * that indication is enabled, and the value {@code false} indicates that indication is disabled. + * @returns { Promise } Returns the promise object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900011 - The operation is busy. The last operation is not complete. + * @throws { BusinessError } 2900099 - Operation failed. + * @throws { BusinessError } 2901003 - The connection is not established. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 20 + */ + setCharacteristicChangeIndication(characteristic: BLECharacteristic, enable: boolean): Promise; + + /** + * Subscribe characteristic value changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLECharacteristicChange' } type - Type of the characteristic value changed event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic value changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Subscribe characteristic value changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLECharacteristicChange' } type - Type of the characteristic value changed event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic value changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + on(type: 'BLECharacteristicChange', callback: Callback): void; + + /** + * Unsubscribe characteristic value changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLECharacteristicChange' } type - Type of the characteristic value changed event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic value changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Unsubscribe characteristic value changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLECharacteristicChange' } type - Type of the characteristic value changed event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic value changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + off(type: 'BLECharacteristicChange', callback?: Callback): void; + + /** + * Subscribe client connection state changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEConnectionStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Subscribe client connection state changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEConnectionStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Subscribe client connection state changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEConnectionStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + on(type: 'BLEConnectionStateChange', callback: Callback): void; + + /** + * Unsubscribe client connection state changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEConnectionStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Unsubscribe client connection state changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEConnectionStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Unsubscribe client connection state changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEConnectionStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + off(type: 'BLEConnectionStateChange', callback?: Callback): void; + + /** + * Subscribe mtu changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEMtuChange' } type - Type of the mtu changed event to listen for. + * @param { Callback } callback - Callback used to listen for the mtu changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Subscribe mtu changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEMtuChange' } type - Type of the mtu changed event to listen for. + * @param { Callback } callback - Callback used to listen for the mtu changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Subscribe mtu changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEMtuChange' } type - Type of the mtu changed event to listen for. + * @param { Callback } callback - Callback used to listen for the mtu changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts{ '1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + on(type: 'BLEMtuChange', callback: Callback): void; + + /** + * Unsubscribe mtu changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEMtuChange' } type - Type of the mtu changed event to listen for. + * @param { Callback } callback - Callback used to listen for the mtu changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Unsubscribe mtu changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEMtuChange' } type - Type of the mtu changed event to listen for. + * @param { Callback } callback - Callback used to listen for the mtu changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Unsubscribe mtu changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEMtuChange' } type - Type of the mtu changed event to listen for. + * @param { Callback } callback - Callback used to listen for the mtu changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts{ '1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + off(type: 'BLEMtuChange', callback?: Callback): void; + } + + /** + * Manages the ble scanner. + * Before calling a ble scanner method, you must use {@link createBleScanner} to create an BleScanner instance. + * + * @typedef BleScanner + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 15 + */ + interface BleScanner { + /** + * Starts scanning for specified BLE devices with filters. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { Array } filters - Indicates the list of filters used to filter out specified devices. + * If you do not want to use filter, set this parameter to {@code null}. + * @param { ScanOptions } options - Indicates the parameters for scanning and if the user does not assign a value, + * the default value will be used. {@link ScanOptions#interval} set to 0, + * and {@link ScanOptions#dutyMode} set to {@link SCAN_MODE_LOW_POWER} + * and {@link ScanOptions#matchMode} set to {@link MATCH_MODE_AGGRESSIVE}. + * and {@link ScanOptions#phyType} set to {@link PHY_LE_ALL_SUPPORTED}. + * and {@link ScanOptions#reportMode} set to {@link ScanReportMode#NORMAL}. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900009 - Fails to start scan as it is out of hardware resources. + * @throws { BusinessError } 2900099 - Operation failed. + * @throws { BusinessError } 2902050 - Failed to start scan as Ble scan is already started by the app. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 15 + */ + startScan(filters: Array, options?: ScanOptions): Promise; + + /** + * Starts scanning for specified BLE devices with filters. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { Array | null } filters - Indicates the list of filters used to filter out specified devices. + * If you do not want to use filter, set this parameter to {@code null}. + * @param { ScanOptions } [options] - Indicates the parameters for scanning and if the user does not assign a value, + * the default value will be used. {@link ScanOptions#interval} set to 0, + * and {@link ScanOptions#dutyMode} set to {@link SCAN_MODE_LOW_POWER} + * and {@link ScanOptions#matchMode} set to {@link MATCH_MODE_AGGRESSIVE}. + * and {@link ScanOptions#phyType} set to {@link PHY_LE_ALL_SUPPORTED}. + * and {@link ScanOptions#reportMode} set to {@link ScanReportMode#NORMAL}. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900009 - Fails to start scan as it is out of hardware resources. + * @throws { BusinessError } 2900099 - Operation failed. + * @throws { BusinessError } 2902050 - Failed to start scan as Ble scan is already started by the app. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + startScan(filters: Array | null, options?: ScanOptions): Promise; + /** + * Stops BLE scanning. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 15 + */ + stopScan(): Promise; + /** + * Subscribe BLE scan result. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for. + * @param { Callback } callback - Callback used to listen for the scan result event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 15 + */ + on(type: 'BLEDeviceFind', callback: Callback): void; + /** + * Unsubscribe BLE scan result. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for. + * @param { Callback } callback - Callback used to listen for the scan result event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 15 + */ + off(type: 'BLEDeviceFind', callback?: Callback): void; + } + + /** + * Describes the Gatt service. + * + * @typedef GattService + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the Gatt service. + * + * @typedef GattService + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Describes the Gatt service. + * + * @typedef GattService + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + interface GattService { + /** + * The UUID of a GattService instance + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of a GattService instance + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The UUID of a GattService instance + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + serviceUuid: string; + /** + * Indicates whether the GattService instance is primary or secondary. + * + * @type { boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates whether the GattService instance is primary or secondary. + * + * @type { boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Indicates whether the GattService instance is primary or secondary. + * + * @type { boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + isPrimary: boolean; + /** + * The {@link BLECharacteristic} list belongs to this GattService instance + * + * @type { Array } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The {@link BLECharacteristic} list belongs to this GattService instance + * + * @type { Array } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The {@link BLECharacteristic} list belongs to this GattService instance + * + * @type { Array } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + characteristics: Array; + /** + * The list of GATT services contained in the service + * + * @type { ?Array } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The list of GATT services contained in the service + * + * @type { ?Array } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + includeServices?: Array; + } + + /** + * Describes the Gatt characteristic. + * + * @typedef BLECharacteristic + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the Gatt characteristic. + * + * @typedef BLECharacteristic + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Describes the Gatt characteristic. + * + * @typedef BLECharacteristic + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + interface BLECharacteristic { + /** + * The UUID of the {@link GattService} instance to which the characteristic belongs + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of the {@link GattService} instance to which the characteristic belongs + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The UUID of the {@link GattService} instance to which the characteristic belongs + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + serviceUuid: string; + /** + * The UUID of a BLECharacteristic instance + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of a BLECharacteristic instance + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The UUID of a BLECharacteristic instance + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + characteristicUuid: string; + /** + * The value of a BLECharacteristic instance + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The value of a BLECharacteristic instance + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The value of a BLECharacteristic instance + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + characteristicValue: ArrayBuffer; + /** + * The list of {@link BLEDescriptor} contained in the characteristic + * + * @type { Array } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The list of {@link BLEDescriptor} contained in the characteristic + * + * @type { Array } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The list of {@link BLEDescriptor} contained in the characteristic + * + * @type { Array } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + descriptors: Array; + /** + * The properties of a BLECharacteristic instance + * + * @type { ?GattProperties } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The properties of a BLECharacteristic instance + * + * @type { ?GattProperties } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The properties of a BLECharacteristic instance + * + * @type { ?GattProperties } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + properties?: GattProperties; + /** + * The permissions of a BLECharacteristic instance. The default value is Readable and Writable. + * + * @type { ?GattPermissions } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 20 + */ + permissions?: GattPermissions; + /** + * The characteristic value handle of a BLECharacteristic instance + * + * @type { ?number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 18 + */ + characteristicValueHandle?: number; + } + + /** + * Describes the Gatt descriptor. + * + * @typedef BLEDescriptor + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the Gatt descriptor. + * + * @typedef BLEDescriptor + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Describes the Gatt descriptor. + * + * @typedef BLEDescriptor + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + interface BLEDescriptor { + /** + * The UUID of the {@link GattService} instance to which the descriptor belongs + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of the {@link GattService} instance to which the descriptor belongs + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The UUID of the {@link GattService} instance to which the descriptor belongs + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + serviceUuid: string; + /** + * The UUID of the {@link BLECharacteristic} instance to which the descriptor belongs + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of the {@link BLECharacteristic} instance to which the descriptor belongs + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The UUID of the {@link BLECharacteristic} instance to which the descriptor belongs + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + characteristicUuid: string; + /** + * The UUID of the BLEDescriptor instance + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of the BLEDescriptor instance + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The UUID of the BLEDescriptor instance + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + descriptorUuid: string; + /** + * The value of the BLEDescriptor instance + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The value of the BLEDescriptor instance + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The value of the BLEDescriptor instance + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + descriptorValue: ArrayBuffer; + /** + * The descriptor handle of the BLEDescriptor instance + * + * @type { ?number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 18 + */ + descriptorHandle?: number; + /** + * The permissions of a BLEDescriptor instance. The default value is Readable and Writable. + * + * @type { ?GattPermissions } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 20 + */ + permissions?: GattPermissions; + } + + /** + * Describes the value of the indication or notification sent by the Gatt server. + * + * @typedef NotifyCharacteristic + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the value of the indication or notification sent by the Gatt server. + * + * @typedef NotifyCharacteristic + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Describes the value of the indication or notification sent by the Gatt server. + * + * @typedef NotifyCharacteristic + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + interface NotifyCharacteristic { + /** + * The UUID of the {@link GattService} instance to which the characteristic belongs + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of the {@link GattService} instance to which the characteristic belongs + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The UUID of the {@link GattService} instance to which the characteristic belongs + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + serviceUuid: string; + /** + * The UUID of a NotifyCharacteristic instance + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of a NotifyCharacteristic instance + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The UUID of a NotifyCharacteristic instance + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + characteristicUuid: string; + /** + * The value of a NotifyCharacteristic instance + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The value of a NotifyCharacteristic instance + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The value of a NotifyCharacteristic instance + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + characteristicValue: ArrayBuffer; + /** + * Specifies whether to request confirmation from the BLE peripheral device (indication) or + * send a notification. Value {@code true} indicates the former and {@code false} indicates the latter. + * + * @type { boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Specifies whether to request confirmation from the BLE peripheral device (indication) or + * send a notification. Value {@code true} indicates the former and {@code false} indicates the latter. + * + * @type { boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + confirm: boolean; + } + + /** + * Describes the parameters of the Gatt client's characteristic read request. + * + * @typedef CharacteristicReadRequest + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the parameters of the Gatt client's characteristic read request. + * + * @typedef CharacteristicReadRequest + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Describes the parameters of the Gatt client's characteristic read request. + * + * @typedef CharacteristicReadRequest + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + interface CharacteristicReadRequest { + /** + * Indicates the address of the client that initiates the read request + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the address of the client that initiates the read request + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Indicates the address of the client that initiates the read request + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + deviceId: string; + /** + * The Id of the read request + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The Id of the read request + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The Id of the read request + * + * @type { int } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts{ '1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + transId: int; + /** + * Indicates the byte offset of the start position for reading characteristic value + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the byte offset of the start position for reading characteristic value + * + * @type { int } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since arkts{ '1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + offset: int; + /** + * The UUID of a CharacteristicReadRequest instance + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of a CharacteristicReadRequest instance + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The UUID of a CharacteristicReadRequest instance + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + characteristicUuid: string; + /** + * The UUID of the service to which the characteristic belongs + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of the service to which the characteristic belongs + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The UUID of the service to which the characteristic belongs + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + serviceUuid: string; + } + + /** + * Describes the parameters of the of the Gatt client's characteristic write request. + * + * @typedef CharacteristicWriteRequest + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the parameters of the of the Gatt client's characteristic write request. + * + * @typedef CharacteristicWriteRequest + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Describes the parameters of the of the Gatt client's characteristic write request. + * + * @typedef CharacteristicWriteRequest + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + interface CharacteristicWriteRequest { + /** + * Indicates the address of the client that initiates the write request + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the address of the client that initiates the write request + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Indicates the address of the client that initiates the write request + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + deviceId: string; + /** + * The Id of the write request + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The Id of the write request + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The Id of the write request + * + * @type { int } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts{ '1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + transId: int; + /** + * Indicates the byte offset of the start position for writing characteristic value + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the byte offset of the start position for writing characteristic value + * + * @type { int } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since arkts{ '1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + offset: int; + /** + * Whether this request should be pending for later operation + * + * @type { boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Whether this request should be pending for later operation + * + * @type { boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + isPrepared: boolean; + /** + * Whether the remote client need a response + * + * @type { boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Whether the remote client need a response + * + * @type { boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + needRsp: boolean; + /** + * Indicates the value to be written + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the value to be written + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Indicates the value to be written + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + value: ArrayBuffer; + /** + * The UUID of a CharacteristicWriteRequest instance + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of a CharacteristicWriteRequest instance + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The UUID of a CharacteristicWriteRequest instance + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + characteristicUuid: string; + /** + * The UUID of the service to which the characteristic belongs + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of the service to which the characteristic belongs + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The UUID of the service to which the characteristic belongs + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + serviceUuid: string; + } + + /** + * Describes the parameters of the Gatt client's descriptor read request. + * + * @typedef DescriptorReadRequest + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the parameters of the Gatt client's descriptor read request. + * + * @typedef DescriptorReadRequest + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Describes the parameters of the Gatt client's descriptor read request. + * + * @typedef DescriptorReadRequest + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + interface DescriptorReadRequest { + /** + * Indicates the address of the client that initiates the read request + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the address of the client that initiates the read request + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Indicates the address of the client that initiates the read request + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + deviceId: string; + /** + * The Id of the read request + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The Id of the read request + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The Id of the read request + * + * @type { int } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts{ '1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + transId: int; + /** + * Indicates the byte offset of the start position for reading characteristic value + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the byte offset of the start position for reading characteristic value + * + * @type { int } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since arkts{ '1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + offset: int; + /** + * The UUID of a DescriptorReadRequest instance + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of a DescriptorReadRequest instance + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The UUID of a DescriptorReadRequest instance + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + descriptorUuid: string; + /** + * The UUID of the characteristic to which the descriptor belongs + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of the characteristic to which the descriptor belongs + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The UUID of the characteristic to which the descriptor belongs + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + characteristicUuid: string; + /** + * The UUID of the service to which the descriptor belongs + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of the service to which the descriptor belongs + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The UUID of the service to which the descriptor belongs + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + serviceUuid: string; + } + + /** + * Describes the parameters of the Gatt client's characteristic write request. + * + * @typedef DescriptorWriteRequest + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the parameters of the Gatt client's characteristic write request. + * + * @typedef DescriptorWriteRequest + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Describes the parameters of the Gatt client's characteristic write request. + * + * @typedef DescriptorWriteRequest + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + interface DescriptorWriteRequest { + /** + * Indicates the address of the client that initiates the write request + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the address of the client that initiates the write request + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Indicates the address of the client that initiates the write request + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + deviceId: string; + /** + * The Id of the write request + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The Id of the write request + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The Id of the write request + * + * @type { int } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts{ '1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + transId: int; + /** + * Indicates the byte offset of the start position for writing characteristic value + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the byte offset of the start position for writing characteristic value + * + * @type { int } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since arkts{ '1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + offset: int; + /** + * Whether this request should be pending for later operation + * + * @type { boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Whether this request should be pending for later operation + * + * @type { boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + isPrepared: boolean; + /** + * Whether the remote client need a response + * + * @type { boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Whether the remote client need a response + * + * @type { boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + needRsp: boolean; + /** + * Indicates the value to be written + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the value to be written + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Indicates the value to be written + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + value: ArrayBuffer; + /** + * The UUID of a DescriptorWriteRequest instance + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of a DescriptorWriteRequest instance + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The UUID of a DescriptorWriteRequest instance + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + descriptorUuid: string; + /** + * The UUID of the characteristic to which the descriptor belongs + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of the characteristic to which the descriptor belongs + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The UUID of the characteristic to which the descriptor belongs + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + characteristicUuid: string; + /** + * The UUID of the service to which the descriptor belongs + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of the service to which the descriptor belongs + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The UUID of the service to which the descriptor belongs + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + serviceUuid: string; + } + + /** + * Describes the parameters of a response send by the server to a specified read or write request. + * + * @typedef ServerResponse + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the parameters of a response send by the server to a specified read or write request. + * + * @typedef ServerResponse + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Describes the parameters of a response send by the server to a specified read or write request. + * + * @typedef ServerResponse + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + interface ServerResponse { + /** + * Indicates the address of the client to which to send the response + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the address of the client to which to send the response + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Indicates the address of the client to which to send the response + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + deviceId: string; + /** + * The Id of the write request + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The Id of the write request + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The Id of the write request + * + * @type { int } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts{ '1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + transId: int; + /** + * Indicates the status of the read or write request, set this parameter to '0' in normal cases + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the status of the read or write request, set this parameter to '0' in normal cases + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Indicates the status of the read or write request, set this parameter to '0' in normal cases + * + * @type { int } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts{ '1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + status: int; + /** + * Indicates the byte offset of the start position for reading or writing operation + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the byte offset of the start position for reading or writing operation + * + * @type { int } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since arkts{ '1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + offset: int; + /** + * Indicates the value to be sent + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the value to be sent + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Indicates the value to be sent + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + value: ArrayBuffer; + } + + /** + * Describes the Gatt profile connection state. + * + * @typedef BLEConnectionChangeState + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the Gatt profile connection state. + * + * @typedef BLEConnectionChangeState + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Describes the Gatt profile connection state. + * + * @typedef BLEConnectionChangeState + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + interface BLEConnectionChangeState { + /** + * Indicates the peer device address + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the peer device address + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Indicates the peer device address + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + deviceId: string; + /** + * Connection state of the Gatt profile + * + * @type { ProfileConnectionState } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Connection state of the Gatt profile + * + * @type { ProfileConnectionState } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Connection state of the Gatt profile + * + * @type { ProfileConnectionState } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + state: ProfileConnectionState; + /** + * Reason of the disconnection of the gatt connection. + * + * @type { ?GattDisconnectReason } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 20 + */ + reason?: GattDisconnectReason; + } + + /** + * The enum of gatt disconnection reasons. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 20 + */ + enum GattDisconnectReason { + /** + * Disconnection due to timeout. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 20 + */ + CONN_TIMEOUT = 1 + /** + * The connection is disconnected due to the peer. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 20 + */ + CONN_TERMINATE_PEER_USER = 2, + /** + * The connection is disconnected due to the local host. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 20 + */ + CONN_TERMINATE_LOCAL_HOST = 3, + /** + * Disconnection due to unknown reason. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 20 + */ + CONN_UNKNOWN = 4 + } + + /** + * Describes the contents of the scan results. + * + * @typedef ScanResult + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the contents of the scan results. + * + * @typedef ScanResult + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Describes the contents of the scan results. + * + * @typedef ScanResult + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + interface ScanResult { + /** + * Address of the scanned device + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Address of the scanned device + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Address of the scanned device + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + deviceId: string; + /** + * RSSI of the remote device + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * RSSI of the remote device + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * RSSI of the remote device + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + rssi: number; + /** + * The raw data of broadcast packet + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The raw data of broadcast packet + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The raw data of broadcast packet + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + data: ArrayBuffer; + /** + * The local name of the BLE device + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The local name of the BLE device + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The local name of the BLE device + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + deviceName: string; + /** + * Connectable of the remote device + * + * @type { boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Connectable of the remote device + * + * @type { boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Connectable of the remote device + * + * @type { boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + connectable: boolean; + } + + /** + * Describes the contents of the scan report. + * + * @typedef ScanReport + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 15 + */ + interface ScanReport { + /** + * The type of scan report + * + * @type { ScanReportType } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 15 + */ + reportType: ScanReportType; + /** + * Describes the contents of the scan results. + * + * @type { Array } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 15 + */ + scanResult: Array; + } + + /** + * Describes the settings for BLE advertising. + * + * @typedef AdvertiseSetting + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the settings for BLE advertising. + * + * @typedef AdvertiseSetting + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Describes the settings for BLE advertising. + * + * @typedef AdvertiseSetting + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + interface AdvertiseSetting { + /** + * Minimum slot value for the advertising interval, which is {@code 32} (20 ms) + * Maximum slot value for the advertising interval, which is {@code 16777215} (10485.759375s) + * Default slot value for the advertising interval, which is {@code 1600} (1s) + * + * @type { ?number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Minimum slot value for the advertising interval, which is {@code 32} (20 ms) + * Maximum slot value for the advertising interval, which is {@code 16777215} (10485.759375s) + * Default slot value for the advertising interval, which is {@code 1600} (1s) + * + * @type { ?int } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since arkts{ '1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + interval?: int; + /** + * Minimum transmission power level for advertising, which is {@code -127} + * Maximum transmission power level for advertising, which is {@code 1} + * Default transmission power level for advertising, which is {@code -7} + * + * @type { ?number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Minimum transmission power level for advertising, which is {@code -127} + * Maximum transmission power level for advertising, which is {@code 1} + * Default transmission power level for advertising, which is {@code -7} + * + * @type { ?int } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since arkts{ '1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + txPower?: int; + /** + * Indicates whether the BLE is connectable, default is {@code true} + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates whether the BLE is connectable, default is {@code true} + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Indicates whether the BLE is connectable, default is {@code true} + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + connectable?: boolean; + } + + /** + * Describes the advertising data. + * + * @typedef AdvertiseData + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the advertising data. + * + * @typedef AdvertiseData + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Describes the advertising data. + * + * @typedef AdvertiseData + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + interface AdvertiseData { + /** + * The specified service UUID list to this advertisement + * + * @type { Array } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The specified service UUID list to this advertisement + * + * @type { Array } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The specified service UUID list to this advertisement + * + * @type { Array } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + serviceUuids: Array; + /** + * The specified manufacturer data list to this advertisement + * + * @type { Array } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The specified manufacturer data list to this advertisement + * + * @type { Array } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The specified manufacturer data list to this advertisement + * + * @type { Array } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + manufactureData: Array; + /** + * The specified service data list to this advertisement + * + * @type { Array } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The specified service data list to this advertisement + * + * @type { Array } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The specified service data list to this advertisement + * + * @type { Array } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + serviceData: Array; + /** + * Indicates whether the device name will be included in the advertisement packet. + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates whether the device name will be included in the advertisement packet. + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Indicates whether the device name will be included in the advertisement packet. + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + includeDeviceName?: boolean; + /** + * Indicates whether the tx power will be included in the advertisement packet. + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 18 + */ + includeTxPower?: boolean; + } + + /** + * Describes the advertising parameters. + * + * @typedef AdvertisingParams + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + /** + * Describes the advertising parameters. + * + * @typedef AdvertisingParams + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + interface AdvertisingParams { + /** + * Indicates the advertising settings. + * + * @type { AdvertiseSetting } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + /** + * Indicates the advertising settings. + * + * @type { AdvertiseSetting } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + advertisingSettings: AdvertiseSetting; + /** + * Indicates the advertising data. + * + * @type { AdvertiseData } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + /** + * Indicates the advertising data. + * + * @type { AdvertiseData } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + advertisingData: AdvertiseData; + /** + * Indicates the advertising response. + * + * @type { ?AdvertiseData } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + /** + * Indicates the advertising response. + * + * @type { ?AdvertiseData } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + advertisingResponse?: AdvertiseData; + /** + * Indicates the duration for advertising continuously. + * The duration, in 10ms unit. Valid range is from 1 (10ms) to 65535 (655,350 ms). + * If this parameter is not specified or is set to 0, advertisement is continuously sent. + * + * @type { ?int } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since arkts{ '1.1':'11','1.2':'20'} + * @arkts 1.1&1.2 + */ + duration?: int; + } + + /** + * Parameter for dynamically enable advertising. + * + * @typedef AdvertisingEnableParams + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + interface AdvertisingEnableParams { + /** + * Indicates the ID of current advertising. + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + advertisingId: number; + /** + * Indicates the duration for advertising continuously. + * The duration, in 10ms unit. Valid range is from 1 (10ms) to 65535 (655,350 ms). + * If this parameter is not specified or is set to 0, advertise is continuously sent. + * + * @type { ?int } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since arkts{ '1.1':'11','1.2':'20'} + * @arkts 1.1&1.2 + */ + duration?: int; + } + + /** + * Parameter for dynamically disable advertising. + * + * @typedef AdvertisingDisableParams + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + interface AdvertisingDisableParams { + /** + * Indicates the ID of current advertising. + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + advertisingId: number; + } + + /** + * Advertising state change information. + * + * @typedef AdvertisingStateChangeInfo + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + /** + * Advertising state change information. + * + * @typedef AdvertisingStateChangeInfo + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + interface AdvertisingStateChangeInfo { + /** + * Indicates the ID of current advertising. + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + /** + * Indicates the ID of current advertising. + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @since 13 + */ + advertisingId: number; + /** + * Indicates the advertising state. + * + * @type { AdvertisingState } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + /** + * Indicates the advertising state. + * + * @type { AdvertisingState } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + state: AdvertisingState; + } + + /** + * Describes the manufacturer data. + * + * @typedef ManufactureData + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the manufacturer data. + * + * @typedef ManufactureData + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Describes the manufacturer data. + * + * @typedef ManufactureData + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + interface ManufactureData { + /** + * Indicates the manufacturer ID assigned by Bluetooth SIG + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the manufacturer ID assigned by Bluetooth SIG + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Indicates the manufacturer ID assigned by Bluetooth SIG + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + manufactureId: number; + /** + * Indicates the manufacturer data to add + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the manufacturer data to add + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Indicates the manufacturer data to add + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + manufactureValue: ArrayBuffer; + } + + /** + * Describes the service data. + * + * @typedef ServiceData + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the service data. + * + * @typedef ServiceData + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Describes the service data. + * + * @typedef ServiceData + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + interface ServiceData { + /** + * Indicates the UUID of the service data to add + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the UUID of the service data to add + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Indicates the UUID of the service data to add + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + serviceUuid: string; + /** + * Indicates the service data to add + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the service data to add + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Indicates the service data to add + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + serviceValue: ArrayBuffer; + } + + /** + * Describes the criteria for filtering scanning results can be set. + * + * @typedef ScanFilter + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the criteria for filtering scanning results can be set. + * + * @typedef ScanFilter + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Describes the criteria for filtering scanning results can be set. + * + * @typedef ScanFilter + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + interface ScanFilter { + /** + * The address of a BLE peripheral device + * + * @type { ?string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The address of a BLE peripheral device + * + * @type { ?string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The address of a BLE peripheral device + * + * @type { ?string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + deviceId?: string; + + /** + * The name of a BLE peripheral device + * + * @type { ?string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The name of a BLE peripheral device + * + * @type { ?string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The name of a BLE peripheral device + * + * @type { ?string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + name?: string; + + /** + * The service UUID of a BLE peripheral device + * + * @type { ?string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The service UUID of a BLE peripheral device + * + * @type { ?string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The service UUID of a BLE peripheral device + * + * @type { ?string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + serviceUuid?: string; + + /** + * Service UUID mask. + * + * @type { ?string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Service UUID mask. + * + * @type { ?string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Service UUID mask. + * + * @type { ?string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + serviceUuidMask?: string; + + /** + * Service solicitation UUID. + * + * @type { ?string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Service solicitation UUID. + * + * @type { ?string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Service solicitation UUID. + * + * @type { ?string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + serviceSolicitationUuid?: string; + + /** + * Service solicitation UUID mask. + * + * @type { ?string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Service solicitation UUID mask. + * + * @type { ?string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Service solicitation UUID mask. + * + * @type { ?string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + serviceSolicitationUuidMask?: string; + + /** + * Service data. + * + * @type { ?ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Service data. + * + * @type { ?ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Service data. + * + * @type { ?ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + serviceData?: ArrayBuffer; + + /** + * Service data mask. + * + * @type { ?ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Service data mask. + * + * @type { ?ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Service data mask. + * + * @type { ?ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + serviceDataMask?: ArrayBuffer; + + /** + * Manufacture id. + * + * @type { ?number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Manufacture id. + * + * @type { ?number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Manufacture id. + * + * @type { ?number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + manufactureId?: number; + + /** + * Manufacture data. + * + * @type { ?ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Manufacture data. + * + * @type { ?ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Manufacture data. + * + * @type { ?ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + manufactureData?: ArrayBuffer; + + /** + * Manufacture data mask. + * + * @type { ?ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Manufacture data mask. + * + * @type { ?ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Manufacture data mask. + * + * @type { ?ArrayBuffer } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + manufactureDataMask?: ArrayBuffer; + } + + /** + * Describes the parameters for scan. + * + * @typedef ScanOptions + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the parameters for scan. + * + * @typedef ScanOptions + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Describes the parameters for scan. + * + * @typedef ScanOptions + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + interface ScanOptions { + /** + * Time of delay for reporting the scan result + * + * @type { ?number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Time of delay for reporting the scan result + * + * @type { ?number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Time of delay for reporting the scan result + * + * @type { ?int } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts{ '1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + interval?: int; + /** + * Bluetooth LE scan mode + * + * @type { ?ScanDuty } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Bluetooth LE scan mode + * + * @type { ?ScanDuty } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Bluetooth LE scan mode + * + * @type { ?ScanDuty } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + dutyMode?: ScanDuty; + /** + * Match mode for Bluetooth LE scan filters hardware match + * + * @type { ?MatchMode } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Match mode for Bluetooth LE scan filters hardware match + * + * @type { ?MatchMode } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + matchMode?: MatchMode; + /** + * Physical Layer used during scan. + * + * @type { ?PhyType } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Physical Layer used during scan. + * + * @type { ?PhyType } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + phyType?: PhyType; + /** + * Report mode used during scan. + * + * @type { ?ScanReportMode } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 15 + */ + reportMode?: ScanReportMode; + } + + /** + * Describes the properties of a gatt characteristic. + * + * @typedef GattProperties + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the properties of a gatt characteristic. + * + * @typedef GattProperties + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Describes the properties of a gatt characteristic. + * + * @typedef GattProperties + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + interface GattProperties { + /** + * Support write property of the characteristic. + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Support write property of the characteristic. + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Support write property of the characteristic. + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + write?: boolean; + /** + * Support write no response property of the characteristic. + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Support write no response property of the characteristic. + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Support write no response property of the characteristic. + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + writeNoResponse?: boolean; + /** + * Support read property of the characteristic. + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Support read property of the characteristic. + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Support read property of the characteristic. + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + read?: boolean; + /** + * Support notify property of the characteristic. + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Support notify property of the characteristic. + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Support notify property of the characteristic. + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + notify?: boolean; + /** + * Support indicate property of the characteristic. + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Support indicate property of the characteristic. + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + indicate?: boolean; + + /** + * Support broadcast property of the characteristic. + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 20 + */ + broadcast?: boolean; + + /** + * Support authenticated signed write property of the characteristic. + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 20 + */ + authenticatedSignedWrite?: boolean; + + /** + * Support extended properties property of the characteristic. + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 20 + */ + extendedProperties?: boolean; + } + + /** + * Describes the permission of a att attribute item. + * + * @typedef GattPermissions + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 20 + */ + interface GattPermissions { + /** + * The attribute field has the read permission. + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 20 + */ + read?: boolean; + + /** + * The attribute field has the encrypted read permission. + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 20 + */ + readEncrypted?: boolean; + + /** + * The attribute field has the read permission for encryption authentication. + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 20 + * @arkts 1.1&1.2 + */ + readEncryptedMitm?: boolean; + + /** + * The attribute field has the write permission. + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 20 + */ + write?: boolean; + + /** + * The attribute field has the encrypted write permission. + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 20 + */ + writeEncrypted?: boolean; + + /** + * The attribute field has the write permission for encryption authentication. + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 20 + */ + writeEncryptedMitm?: boolean; + + /** + * The attribute field has the signed write permission. + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 20 + */ + writeSigned?: boolean; + + /** + * The attribute field has the write permission for signature authentication. + * + * @type { ?boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 20 + */ + writeSignedMitm?: boolean; + } + + /** + * The enum of gatt characteristic write type + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The enum of gatt characteristic write type + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The enum of gatt characteristic write type + * + * @enum { int } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts{ '1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + enum GattWriteType { + /** + * Write characteristic with response. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Write characteristic with response. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Write characteristic with response. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + WRITE = 1 + /** + * Write characteristic without response. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Write characteristic without response. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Write characteristic without response. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + WRITE_NO_RESPONSE = 2 + } + + /** + * The enum of scan duty. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The enum of scan duty. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * The enum of scan duty. + * + * @enum { int } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts{ '1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + enum ScanDuty { + /** + * low power mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * low power mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * low power mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + SCAN_MODE_LOW_POWER = 0 + /** + * balanced power mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * balanced power mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * balanced power mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + SCAN_MODE_BALANCED = 1, + /** + * Scan using highest duty cycle + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Scan using highest duty cycle + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Scan using highest duty cycle + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + SCAN_MODE_LOW_LATENCY = 2 + } + + /** + * The enum of BLE match mode. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The enum of BLE match mode. + * + * @enum { int } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since arkts{ '1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + enum MatchMode { + /** + * aggressive mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * aggressive mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + MATCH_MODE_AGGRESSIVE = 1 + /** + * sticky mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * sticky mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 + */ + MATCH_MODE_STICKY = 2 + } + + /** + * The enum of BLE advertising state. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + /** + * The enum of BLE advertising state. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + enum AdvertisingState { + /** + * advertising started. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + /** + * advertising started. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + STARTED = 1 + /** + * advertising temporarily enabled. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since arkts {'1.1':'11','1.2':'20'} + * @arkts 1.1&1.2 + */ + ENABLED = 2, + /** + * advertising temporarily disabled. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since arkts {'1.1':'11','1.2':'20'} + * @arkts 1.1&1.2 + */ + DISABLED = 3, + /** + * advertising stopped. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + /** + * advertising stopped. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 + */ + STOPPED = 4 + } + + /** + * Phy type used during scan. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Phy type used during scan. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + enum PhyType { + /** + * Use 1M phy for scanning. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Use 1M phy for scanning. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + PHY_LE_1M = 1 + /** + * Use all supported Phys for scanning. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + /** + * Use all supported Phys for scanning. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 13 + */ + PHY_LE_ALL_SUPPORTED = 255 + } + + /** + * Report mode used during scan. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 1 + */ + enum ScanReportMode { + /** + * In normal mode, the advertisement packet is reported immediately after being scanned. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 15 + */ + NORMAL = 1 + /** + * Enables delayed sending of advertising packets in batch mode by the interval specified by {@link + * ScanOptions#interval}. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since arkts{ '1.1':'19','1.2':'20'} + * @arkts 1.1&1.2 + */ + BATCH = 2, + /** + * In low sensitivity fence mode, the advertisement packets are reported only when they are received for + * the first time and lost for the last time. The reception sensitivity is low. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 18 + */ + FENCE_SENSITIVITY_LOW = 10, + /** + * In high sensitivity fence mode, the advertisement packets are reported only when they are received for + * the first time and lost for the last time. The reception sensitivity is high. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 18 + */ + FENCE_SENSITIVITY_HIGH = 11 + } + + /** + * Scan report type used during scan. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 15 + */ + enum ScanReportType { + /** + * The found of advertisement packet. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 15 + */ + ON_FOUND = 1 + /** + * The lost of advertisement packet. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @crossplatform + * @atomicservice + * @since 15 + */ + ON_LOST = 2, + /** + * The type of advertisement packet reported in batch mode. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since arkts{ '1.1':'19','1.2':'20'} + * @arkts 1.1&1.2 + */ + ON_BATCH = 3 + } + + /** + * The Profile of the BLE protocol. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 21 + * @arkts 1.1&1.2 + */ + enum BleProfile { + /** + * Indicates the profile type of the gatt, including gatt client and gatt server. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 21 + * @arkts 1.1&1.2 + */ + GATT = 1 + /** + * Indicates the profile type of the gatt client. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 21 + * @arkts 1.1&1.2 + */ + GATT_CLIENT = 2, + /** + * Indicates the profile type of the gatt server. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 21 + * @arkts 1.1&1.2 + */ + GATT_SERVER = 3 + } +} + export default ble; \ No newline at end of file diff --git a/api/@ohos.bluetooth.socket.d.ts b/api/@ohos.bluetooth.socket.d.ts index c44b7866c5..9040685619 100644 --- a/api/@ohos.bluetooth.socket.d.ts +++ b/api/@ohos.bluetooth.socket.d.ts @@ -1,254 +1,291 @@ -/* - * Copyright (C) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * @kit ConnectivityKit - */ - -import type { AsyncCallback, Callback } from './@ohos.base'; - -/** - * Provides methods to operate or manage bluetooth socket connection. - * - * @namespace socket - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ -declare namespace socket { - /** - * Creates a Bluetooth server listening socket. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { string } name - Indicates the service name. - * @param { SppOptions } options - Indicates the listen parameters. - * @param { AsyncCallback } callback - Callback used to return a server socket ID. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900004 - Profile not supported. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - function sppListen(name: string, options: SppOptions, callback: AsyncCallback): void; - - /** - * Waits for a remote device to connect. - * - * @param { number } serverSocket - Indicates the server socket ID, returned by {@link sppListen}. - * @param { AsyncCallback } callback - Callback used to return a client socket ID. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900004 - Profile not supported. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - function sppAccept(serverSocket: number, callback: AsyncCallback): void; - - /** - * Connects to a remote device over the socket. - * - * @permission ohos.permission.ACCESS_BLUETOOTH - * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". - * @param { SppOptions } options - Indicates the connect parameters {@link SppOptions}. - * @param { AsyncCallback } callback - Callback used to return a client socket ID. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3. Parameter verification failed. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900003 - Bluetooth disabled. - * @throws { BusinessError } 2900004 - Profile not supported. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - function sppConnect(deviceId: string, options: SppOptions, callback: AsyncCallback): void; - - /** - * Obtain the device id in the client socket. - * - * @param { number } clientSocket - Indicates client socket. - * @returns { string } Returns the connected device id - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter types; - * 3. Parameter verification failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 17 - */ - function getDeviceId(clientSocket: number): string; - - /** - * Disables an spp server socket and releases related resources. - * - * @param { number } socket - Indicates the server socket ID, returned by {@link sppListen}. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - function sppCloseServerSocket(socket: number): void; - - /** - * Disables an spp client socket and releases related resources. - * - * @param { number } socket - Indicates the client socket ID, returned by {@link sppAccept} or {@link sppConnect}. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2900001 - Service stopped. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - function sppCloseClientSocket(socket: number): void; - - /** - * Write data through the socket. - * - * @param { number } clientSocket - Indicates the client socket ID, returned by {@link sppAccept} or {@link sppConnect}. - * @param { ArrayBuffer } data - Indicates the data to write. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2901054 - IO error. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - function sppWrite(clientSocket: number, data: ArrayBuffer): void; - - /** - * Subscribe the event reported when data is read from the socket. - * - * @param { 'sppRead' } type - Type of the spp read event to listen for. - * @param { number } clientSocket - Client socket ID, which is obtained by sppAccept or sppConnect. - * @param { Callback } callback - Callback used to listen for the spp read event. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2901054 - IO error. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - function on(type: 'sppRead', clientSocket: number, callback: Callback): void; - - /** - * Unsubscribe the event reported when data is read from the socket. - * - * @param { 'sppRead' } type - Type of the spp read event to listen for. - * @param { number } clientSocket - Client socket ID, which is obtained by sppAccept or sppConnect. - * @param { Callback } callback - Callback used to listen for the spp read event. - * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. - * @throws { BusinessError } 801 - Capability not supported. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - function off(type: 'sppRead', clientSocket: number, callback?: Callback): void; - - /** - * Asynchronous interface for writing data to the socket. - * - * @param { number } clientSocket - Indicates the client socket ID, returned by {@link sppAccept} or {@link sppConnect}. - * @param { ArrayBuffer } data - Indicates the data to write. - * @returns { Promise } Returns the promise object. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2901054 - IO error. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 18 - */ - function sppWriteAsync(clientSocket: number, data: ArrayBuffer): Promise; - - /** - * Asynchronous interface for reading data from the socket. - * - * @param { number } clientSocket - Indicates the client socket ID, returned by {@link sppAccept} or {@link sppConnect}. - * @returns { Promise } Returns the promise object, used to get the spp read data. - * @throws { BusinessError } 801 - Capability not supported. - * @throws { BusinessError } 2901054 - IO error. - * @throws { BusinessError } 2900099 - Operation failed. - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 18 - */ - function sppReadAsync(clientSocket: number): Promise; - - /** - * Describes the spp parameters. - * - * @typedef SppOptions - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - interface SppOptions { - /** - * Indicates the UUID in the SDP record. - * - * @type { string } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - uuid: string; - /** - * Indicates secure channel or not - * - * @type { boolean } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - secure: boolean; - /** - * Spp link type - * - * @type { SppType } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - type: SppType; - } - - /** - * The enum of SPP type. - * - * @enum { number } - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - enum SppType { - /** - * RFCOMM - * - * @syscap SystemCapability.Communication.Bluetooth.Core - * @since 10 - */ - SPP_RFCOMM - } -} - +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * @kit ConnectivityKit + */ + +import type { AsyncCallback, Callback } from './@ohos.base'; +import type baseProfile from './@ohos.bluetooth.baseProfile'; + +/** + * Provides methods to operate or manage bluetooth socket connection. + * + * @namespace socket + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ +declare namespace socket { + /** + * Creates a Bluetooth server listening socket. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } name - Indicates the service name. + * @param { SppOptions } options - Indicates the listen parameters. + * @param { AsyncCallback } callback - Callback used to return a server socket ID. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900004 - Profile not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function sppListen(name: string, options: SppOptions, callback: AsyncCallback): void; + + /** + * Get l2cap socket psm. + * + * @param { number } serverSocket - Indicates the server socket ID, returned by {@link sppListen}. + * @returns { number } Returns the l2cap socket psm + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 20 + * @arkts 1.1&1.2 + */ + function getL2capPsm(serverSocket: number): number; + + /** + * Waits for a remote device to connect. + * + * @param { number } serverSocket - Indicates the server socket ID, returned by {@link sppListen}. + * @param { AsyncCallback } callback - Callback used to return a client socket ID. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900004 - Profile not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function sppAccept(serverSocket: number, callback: AsyncCallback): void; + + /** + * Connects to a remote device over the socket. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @param { SppOptions } options - Indicates the connect parameters {@link SppOptions}. + * @param { AsyncCallback } callback - Callback used to return a client socket ID. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900004 - Profile not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function sppConnect(deviceId: string, options: SppOptions, callback: AsyncCallback): void; + + /** + * Disables an spp server socket and releases related resources. + * + * @param { number } socket - Indicates the server socket ID, returned by {@link sppListen}. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function sppCloseServerSocket(socket: number): void; + + /** + * Disables an spp client socket and releases related resources. + * + * @param { number } socket - Indicates the client socket ID, returned by {@link sppAccept} or {@link sppConnect}. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function sppCloseClientSocket(socket: number): void; + + /** + * Write data through the socket. + * + * @param { number } clientSocket - Indicates the client socket ID, returned by {@link sppAccept} or {@link sppConnect}. + * @param { ArrayBuffer } data - Indicates the data to write. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2901054 - IO error. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function sppWrite(clientSocket: number, data: ArrayBuffer): void; + + /** + * Asynchronous interface for writing data to the socket. + * + * @param { number } clientSocket - Indicates the client socket ID, returned by {@link sppAccept} or {@link sppConnect}. + * @param { ArrayBuffer } data - Indicates the data to write. + * @returns { Promise } Returns the promise object. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2901054 - IO error. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 18 + */ + function sppWriteAsync(clientSocket: number, data: ArrayBuffer): Promise; + + /** + * Asynchronous interface for reading data from the socket. + * + * @param { number } clientSocket - Indicates the client socket ID, returned by {@link sppAccept} or {@link sppConnect}. + * @returns { Promise } Returns the promise object, used to get the spp read data. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2901054 - IO error. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 18 + */ + function sppReadAsync(clientSocket: number): Promise; + + /** + * Obtain the device id in the client socket. + * + * @param { number } clientSocket - Indicates client socket. + * @returns { string } Returns the connected device id + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 17 + */ + function getDeviceId(clientSocket: number): string; + + /** + * Subscribe the event reported when data is read from the socket. + * + * @param { 'sppRead' } type - Type of the spp read event to listen for. + * @param { number } clientSocket - Client socket ID, which is obtained by sppAccept or sppConnect. + * @param { Callback } callback - Callback used to listen for the spp read event. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2901054 - IO error. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function on(type: 'sppRead', clientSocket: number, callback: Callback): void; + + /** + * Unsubscribe the event reported when data is read from the socket. + * + * @param { 'sppRead' } type - Type of the spp read event to listen for. + * @param { number } clientSocket - Client socket ID, which is obtained by sppAccept or sppConnect. + * @param { Callback } callback - Callback used to listen for the spp read event. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function off(type: 'sppRead', clientSocket: number, callback?: Callback): void; + + /** + * Describes the spp parameters. + * + * @typedef SppOptions + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + interface SppOptions { + /** + * Indicates the UUID in the SDP record. + * + * @type { string } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + uuid: string; + /** + * Indicates secure channel or not + * + * @type { boolean } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + secure: boolean; + /** + * Spp link type + * + * @type { SppType } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + type: SppType; + /** + * l2cap protocol service multiplexer + * + * @type { ?number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 20 + * @arkts 1.1&1.2 + */ + psm?: number; + } + + /** + * The enum of SPP type. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + enum SppType { + /** + * RFCOMM + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + SPP_RFCOMM = 0 + /** + * L2CAP of the BR type + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 20 + * @arkts 1.1&1.2 + */ + SPP_L2CAP = 1, + /** + * L2CAP of the BLE type + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 20 + * @arkts 1.1&1.2 + */ + SPP_L2CAP_BLE = 2 + } +} + export default socket; \ No newline at end of file -- Gitee