From b3e3e5b317ebd45deea7cfef617cc44a6020bc9c Mon Sep 17 00:00:00 2001 From: annie_wangli Date: Thu, 24 Mar 2022 11:01:46 +0800 Subject: [PATCH] update docs Signed-off-by: annie_wangli --- .../reference/apis/js-apis-bluetooth.md | 1268 ++++++++--------- 1 file changed, 631 insertions(+), 637 deletions(-) diff --git a/en/application-dev/reference/apis/js-apis-bluetooth.md b/en/application-dev/reference/apis/js-apis-bluetooth.md index 68c2baef53..ece4817740 100644 --- a/en/application-dev/reference/apis/js-apis-bluetooth.md +++ b/en/application-dev/reference/apis/js-apis-bluetooth.md @@ -2,7 +2,7 @@ > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. -> +> > The Bluetooth module provides Classic Bluetooth capabilities and Bluetooth Low Energy (BLE) scan and advertising. @@ -24,8 +24,6 @@ ohos.permission.DISCOVER_BLUETOOTH ohos.permission.LOCATION - - ## bluetooth.enableBluetooth8+ enableBluetooth(): boolean @@ -38,8 +36,8 @@ Enables Bluetooth. **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ------- | ------------------------ | | boolean | Returns **true** if Bluetooth is enabled; returns **false** otherwise.| **Example** @@ -61,8 +59,8 @@ Disables Bluetooth. **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ------- | ------------------------ | | boolean | Returns **true** if Bluetooth is disabled; returns **false** otherwise.| **Example** @@ -84,8 +82,8 @@ Obtains the name of the local Bluetooth device. **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ------ | --------- | | string | Name of the local Bluetooth device obtained.| **Example** @@ -107,8 +105,8 @@ Obtains the Bluetooth state. **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| --------------------------------- | --------- | | [BluetoothState](#bluetoothstate) | Bluetooth state obtained.| **Example** @@ -130,8 +128,8 @@ Obtains the profile connection state of this Bluetooth device. **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ---------------------------------------- | ------------------- | | [ProfileConnectionState](#profileconnectionstate) | Profile connection state obtained.| **Example** @@ -153,14 +151,14 @@ Sets the name of the local Bluetooth device. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| name | string | Yes| Bluetooth device name to set. It cannot exceed 248 characters.| +| Name | Type | Mandatory | Description | +| ---- | ------ | ---- | --------------------- | +| name | string | Yes | Bluetooth name to set. It cannot exceed 248 bytes.| **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ------- | ------------------------------ | | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** @@ -182,14 +180,14 @@ Initiates Bluetooth pairing. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| deviceId | string | Yes| Address of the remote device to pair, for example, XX:XX:XX:XX:XX:XX.| +| Name | Type | Mandatory | Description | +| -------- | ------ | ---- | ----------------------------------- | +| deviceId | string | Yes | Address of the remote device to pair, for example, XX:XX:XX:XX:XX:XX.| **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ------- | -------------------------- | | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** @@ -212,14 +210,14 @@ Obtains the connection status of a profile. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| ProfileId | profileId | Yes| ID of the target profile, for example, **PROFILE_A2DP_SOURCE**.| +| Name | Type | Mandatory | Description | +| --------- | --------- | ---- | ------------------------------------- | +| ProfileId | profileId | Yes | ID of the target profile, for example, **PROFILE_A2DP_SOURCE**.| **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ---------------------------------------- | ------------- | | [ProfileConnectionState](#ProfileConnectionState) | Profile connection state obtained.| **Example** @@ -241,14 +239,14 @@ Cancels a paired remote device. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| deviceId | string | Yes| Address of the remote device to cancel, for example, XX:XX:XX:XX:XX:XX.| +| Name | Type | Mandatory | Description | +| -------- | ------ | ---- | ------------------------------------- | +| deviceId | string | Yes | Address of the remote device to cancel, for example, XX:XX:XX:XX:XX:XX.| **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ------- | -------------------------- | | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** @@ -270,14 +268,14 @@ Obtains the name of the remote Bluetooth device. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| deviceId | string | Yes| Address of the target remote device, for example, XX:XX:XX:XX:XX:XX.| +| Name | Type | Mandatory | Description | +| -------- | ------ | ---- | --------------------------------- | +| deviceId | string | Yes | Address of the target remote device, for example, XX:XX:XX:XX:XX:XX.| **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ------ | ------------- | | string | Device name (a string) obtained.| **Example** @@ -299,14 +297,14 @@ Obtains the type of the remote Bluetooth device. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| deviceId | string | Yes| Address of the target remote device, for example, XX:XX:XX:XX:XX:XX.| +| Name | Type | Mandatory | Description | +| -------- | ------ | ---- | --------------------------------- | +| deviceId | string | Yes | Address of the target remote device, for example, XX:XX:XX:XX:XX:XX.| **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| --------------------------- | -------- | | [DeviceClass](#deviceclass) | Type of a remote device obtained.| **Example** @@ -328,8 +326,8 @@ Obtains the Bluetooth pairing list. **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ------------------- | ------------- | | Array<string> | List of the addresses of the paired Bluetooth devices.| **Example** @@ -351,15 +349,15 @@ Sets the Bluetooth scan mode so that the device can be discovered by a remote de **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| mode | [ScanMode](#scanmode) | Yes| Bluetooth scan mode to set.| -| duration | number | Yes| Duration (in seconds) in which the device can be discovered. The value **0** indicates unlimited time.| +| Name | Type | Mandatory | Description | +| -------- | --------------------- | ---- | ---------------------------- | +| mode | [ScanMode](#scanmode) | Yes | Bluetooth scan mode to set. | +| duration | number | Yes | Duration (in seconds) in which the device can be discovered. The value **0** indicates unlimited time.| **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ------- | -------------------------- | | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** @@ -382,8 +380,8 @@ Obtains the Bluetooth scan mode. **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| --------------------- | ------- | | [ScanMode](#scanmode) | Bluetooth scan mode obtained.| **Example** @@ -405,8 +403,8 @@ Starts Bluetooth scan to discover remote devices. **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ------- | -------------------------- | | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** @@ -433,8 +431,8 @@ Stops Bluetooth scan. **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ------- | -------------------------- | | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** @@ -456,15 +454,15 @@ Sets the device pairing confirmation. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| device | string | Yes| Address of the target remote device, for example, XX:XX:XX:XX:XX:XX.| -| accept | boolean | Yes| Whether to accept the pairing request. The value **true** means to accept the pairing request, and the value **false** means the opposite.| +| Name | Type | Mandatory | Description | +| ------ | ------- | ---- | -------------------------------- | +| device | string | Yes | Address of the target remote device, for example, XX:XX:XX:XX:XX:XX.| +| accept | boolean | Yes | Whether to accept the pairing request. The value **true** means to accept the pairing request, and the value **false** means the opposite. | **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ------- | ---------------------------- | | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** @@ -491,10 +489,10 @@ Subscribes to the Bluetooth device discovery events. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **bluetoothDeviceFind** indicates an event reported when a Bluetooth device is discovered.| -| callback | Callback<Array<string>> | Yes| Callback invoked to return the discovered devices. You need to implement this callback.| +| Name | Type | Mandatory | Description | +| -------- | ----------------------------------- | ---- | -------------------------------------- | +| type | string | Yes | Event type. The value **bluetoothDeviceFind** indicates an event reported when a Bluetooth device is discovered.| +| callback | Callback<Array<string>> | Yes | Callback invoked to return the discovered devices. You need to implement this callback. | **Return value** @@ -522,10 +520,10 @@ Unsubscribes from the Bluetooth device discovery events. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **bluetoothDeviceFind** indicates an event reported when a Bluetooth device is discovered.| -| callback | Callback<Array<string>> | No| Callback used to report the discovered devices. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| +| Name | Type | Mandatory | Description | +| -------- | ----------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **bluetoothDeviceFind** indicates an event reported when a Bluetooth device is discovered. | +| callback | Callback<Array<string>> | No | Callback used to report the discovered devices. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| **Return value** @@ -554,10 +552,10 @@ Subscribes to the pairing request events of the remote Bluetooth device. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **pinRequired** indicates a pairing request event.| -| callback | Callback<[PinRequiredParam](#pinrequiredparam)> | Yes| Callback invoked to return the pairing request. You need to implement this callback.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | -------------------------------- | +| type | string | Yes | Event type. The value **pinRequired** indicates a pairing request event. | +| callback | Callback<[PinRequiredParam](#pinrequiredparam)> | Yes | Callback invoked to return the pairing request. You need to implement this callback.| **Return value** @@ -585,10 +583,10 @@ Unsubscribes from the pairing request events of the remote Bluetooth device. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **pinRequired** indicates a pairing request event.| -| callback | Callback<[PinRequiredParam](#pinrequiredparam)> | No| Callback used to report the Bluetooth pairing request. The input parameter is the pairing request parameter. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **pinRequired** indicates a pairing request event. | +| callback | Callback<[PinRequiredParam](#pinrequiredparam)> | No | Callback used to report the Bluetooth pairing request. The input parameter is the pairing request parameter. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| **Return value** @@ -617,10 +615,10 @@ Subscribes to the Bluetooth pairing state change events. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **bondStateChange** indicates a Bluetooth pairing state change event.| -| callback | Callback<[BondStateParam](#bondstate)> | Yes| Callback invoked to return the pairing state. You need to implement this callback.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ------------------------------------ | +| type | string | Yes | Event type. The value **bondStateChange** indicates a Bluetooth pairing state change event.| +| callback | Callback<[BondStateParam](#bondstate)> | Yes | Callback invoked to return the pairing state. You need to implement this callback. | **Return value** @@ -648,10 +646,10 @@ Unsubscribes from the Bluetooth pairing state change events. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **bondStateChange** indicates a Bluetooth pairing state change event.| -| callback | Callback<[BondStateParam](#bondstate)> | No| Callback used to report the change of the Bluetooth pairing state. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **bondStateChange** indicates a Bluetooth pairing state change event. | +| callback | Callback<[BondStateParam](#bondstate)> | No | Callback used to report the change of the Bluetooth pairing state. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| **Return value** @@ -680,10 +678,10 @@ Subscribes to the Bluetooth connection state change events. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **stateChange** indicates a Bluetooth connection state change event.| -| callback | Callback<[BluetoothState](#bluetoothstate)> | Yes| Callback invoked to return the Bluetooth connection state. You need to implement this callback.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | -------------------------------- | +| type | string | Yes | Event type. The value **stateChange** indicates a Bluetooth connection state change event. | +| callback | Callback<[BluetoothState](#bluetoothstate)> | Yes | Callback invoked to return the Bluetooth connection state. You need to implement this callback.| **Return value** @@ -711,10 +709,10 @@ Unsubscribes from the Bluetooth connection state change events. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **stateChange** indicates a Bluetooth connection state change event.| -| callback | Callback<[BluetoothState](#bluetoothstate)> | No| Callback used to report the Bluetooth connection state. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **stateChange** indicates a Bluetooth connection state change event. | +| callback | Callback<[BluetoothState](#bluetoothstate)> | No | Callback used to report the Bluetooth connection state. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| **Return value** @@ -743,11 +741,11 @@ Creates a server listening socket. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| name | string | Yes| Name of the service.| -| option | [SppOption](#sppoption) | Yes| Serial port profile (SPP) listening configuration.| -| callback | AsyncCallback<number> | Yes| Callback invoked to return the server socket ID.| +| Name | Type | Mandatory | Description | +| -------- | --------------------------- | ---- | ----------------------- | +| name | string | Yes | Name of the service. | +| option | [SppOption](#sppoption) | Yes | Serial port profile (SPP) listening configuration. | +| callback | AsyncCallback<number> | Yes | Callback invoked to return the server socket ID.| **Example** @@ -776,10 +774,10 @@ Listens for a connection to be made to this socket from the client and accepts i **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| serverSocket | number | Yes| Server socket ID.| -| callback | AsyncCallback<number> | Yes| Callback invoked to return the client socket ID.| +| Name | Type | Mandatory | Description | +| ------------ | --------------------------- | ---- | ----------------------- | +| serverSocket | number | Yes | Server socket ID. | +| callback | AsyncCallback<number> | Yes | Callback invoked to return the client socket ID.| **Example** @@ -809,11 +807,11 @@ Initiates an SPP connection to a remote device from the client. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| device | string | Yes| Address of the remote device, for example, XX:XX:XX:XX:XX:XX.| -| option | [SppOption](#sppoption) | Yes| Configuration for connecting to the SPP client.| -| callback | AsyncCallback<number> | Yes| Callback invoked to return the client socket ID.| +| Name | Type | Mandatory | Description | +| -------- | --------------------------- | ---- | ------------------------------ | +| device | string | Yes | Address of the remote device, for example, XX:XX:XX:XX:XX:XX.| +| option | [SppOption](#sppoption) | Yes | Configuration for connecting to the SPP client. | +| callback | AsyncCallback<number> | Yes | Callback invoked to return the client socket ID. | **Example** @@ -842,9 +840,9 @@ Closes the listening socket of the server. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| socket | number | Yes| ID of the listening socket on the server. The ID is obtained by **sppListen**.| +| Name | Type | Mandatory | Description | +| ------ | ------ | ---- | --------------- | +| socket | number | Yes | ID of the listening socket on the server. The ID is obtained by **sppListen**.| **Example** @@ -863,10 +861,10 @@ Closes the client socket. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| Name| Type| Mandatory| Description| -| socket | number | Yes| Client socket ID, which is obtained by **sppAccept** or **sppConnect**.| +| Name | Type | Mandatory | Description | +| ------ | ------ | ---- | ------------- | +| Name | Type | Mandatory | Description | +| socket | number | Yes | Client socket ID, which is obtained by **sppAccept** or **sppConnect**.| **Example** @@ -885,17 +883,16 @@ Writes data to the remote device through the socket. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| clientSocket | number | Yes| Client socket ID, which is obtained by **sppAccept** or **sppConnect**.| -| data | ArrayBuffer | Yes| Data to write.| +| Name | Type | Mandatory | Description | +| ------------ | ----------- | ---- | ------------- | +| clientSocket | number | Yes | Client socket ID, which is obtained by **sppAccept** or **sppConnect**.| +| data | ArrayBuffer | Yes | Data to write. | **Return value** -| | | -| -------- | -------- | -| Type | Description | -| boolean | Returns **true** if the operation is successful; returns **false** otherwise. | +| Type | Description | +| ------- | ------------------------- | +| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** @@ -922,11 +919,11 @@ Subscribes to the SPP read request events. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **sppRead** indicates an SPP read request event.| -| clientSocket | number | Yes| Client socket ID, which is obtained by **sppAccept** or **sppConnect**.| -| callback | Callback<ArrayBuffer> | Yes| Callback invoked to return the data read.| +| Name | Type | Mandatory | Description | +| ------------ | --------------------------- | ---- | -------------------------- | +| type | string | Yes | Event type. The value **sppRead** indicates an SPP read request event.| +| clientSocket | number | Yes | Client socket ID, which is obtained by **sppAccept** or **sppConnect**. | +| callback | Callback<ArrayBuffer> | Yes | Callback invoked to return the data read. | **Return value** @@ -953,11 +950,11 @@ Unsubscribes from the SPP read request events. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **sppRead** indicates an SPP read request event.| -| clientSocket | number | Yes| Client socket ID, which is obtained by **sppAccept** or **sppConnect**.| -| callback | Callback<ArrayBuffer> | No| Callback used to report an SPP read request event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| +| Name | Type | Mandatory | Description | +| ------------ | --------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **sppRead** indicates an SPP read request event. | +| clientSocket | number | Yes | Client socket ID, which is obtained by **sppAccept** or **sppConnect**. | +| callback | Callback<ArrayBuffer> | No | Callback used to report an SPP read request event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| **Return value** @@ -980,21 +977,20 @@ Obtains a profile object. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| ProfileId | profileId | Yes| ID of the target profile, for example, **PROFILE_A2DP_SOURCE**.| +| Name | Type | Mandatory | Description | +| --------- | --------- | ---- | ------------------------------------- | +| ProfileId | profileId | Yes | ID of the target profile, for example, **PROFILE_A2DP_SOURCE**.| **Return value** -| | | -| -------- | -------- | -| Type | Description | -| A2dpSourceProfile or HandsFreeAudioGatewayProfile | Profile object obtained. Only **A2dpSourceProfile** and **HandsFreeAudioGatewayProfile** are supported. | +| Type | Description | +| ---------------------------------------- | ---------------------------------------- | +| A2dpSourceProfile or HandsFreeAudioGatewayProfile| Profile object obtained. Only **A2dpSourceProfile** and **HandsFreeAudioGatewayProfile** are supported.| **Example** ```js -A2dpSourceProfile a2dpSrc = bluetooth.getProfile(PROFILE_A2DP_SOURCE); +let a2dpSrc = bluetooth.getProfile(PROFILE_A2DP_SOURCE); ``` @@ -1010,8 +1006,8 @@ Creates a **GattServer** instance. **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ------------------------- | ------------------------------------ | | [GattServer](#gattserver) | **GattServer** instance created. Before using a method of the server, you must create a **GattSever** instance.| **Example** @@ -1031,14 +1027,14 @@ Creates a **GattClientDevice** instance. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| deviceId | string | Yes| Address of the remote device, for example, XX:XX:XX:XX:XX:XX.| +| Name | Type | Mandatory | Description | +| -------- | ------ | ---- | ------------------------------------ | +| deviceId | string | Yes | Address of the remote device, for example, XX:XX:XX:XX:XX:XX.| **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ------------------------------------- | ------------------------------------ | | [GattClientDevice](#gattclientdevice) | **GattClientDevice** instance created. Before using a method of the client, you must create a **GattClientDevice** instance.| **Example** @@ -1060,8 +1056,8 @@ Obtains the BLE devices connected to this device. **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ------------------- | ------------------- | | Array<string> | Addresses of the BLE devices connected to this device.| **Example** @@ -1083,10 +1079,10 @@ Starts a BLE scan. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| filters | Array<[ScanFilter](#scanfilter)> | Yes| Criteria for filtering the scan result. Set this parameter to **null** if you do not want to filter the scan result.| -| options | [ScanOptions](#scanoptions) | No| Scan options.| +| Name | Type | Mandatory | Description | +| ------- | -------------------------------------- | ---- | ----------------------------------- | +| filters | Array<[ScanFilter](#scanfilter)> | Yes | Criteria for filtering the scan result. Set this parameter to **null** if you do not want to filter the scan result.| +| options | [ScanOptions](#scanoptions) | No | Scan options. | **Return value** @@ -1147,10 +1143,10 @@ Subscribe to the BLE device discovery events. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **BLEDeviceFind** indicates an event reported when a BLE device is discovered.| -| callback | Callback<Array<[ScanResult](#scanresult)>> | Yes| Callback invoked to return the discovered devices. You need to implement this callback.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ----------------------------------- | +| type | string | Yes | Event type. The value **BLEDeviceFind** indicates an event reported when a BLE device is discovered. | +| callback | Callback<Array<[ScanResult](#scanresult)>> | Yes | Callback invoked to return the discovered devices. You need to implement this callback.| **Return value** @@ -1178,10 +1174,10 @@ Unsubscribes from the BLE device discovery events. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **BLEDeviceFind** indicates an event reported when a BLE device is discovered.| -| callback | Callback<Array<[ScanResult](#scanresult)>> | No| Callback used to report the discovered devices. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **BLEDeviceFind** indicates an event reported when a BLE device is discovered. | +| callback | Callback<Array<[ScanResult](#scanresult)>> | No | Callback used to report the discovered devices. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| **Return value** @@ -1219,9 +1215,9 @@ No value is returned. **Return value** -| | | -| -------- | -------- | -| Type | Description | +| | | +| ------------------- | ------------- | +| Type | Description | | Array<string> | List of addresses of the connected devices. | @@ -1237,15 +1233,15 @@ Obtains the connection status of the profile. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| device | string | Yes| Address of the remote device.| +| Name | Type | Mandatory | Description | +| ------ | ------ | ---- | ------- | +| device | string | Yes | Address of the remote device.| | **Return value** -| | | -| -------- | -------- | +| | | +| ---------------------------------------- | --------------- | | Type | Description | | [ProfileConnectionState](#profileconnectionState) | Profile connection state obtained. | @@ -1267,23 +1263,23 @@ Sets up an Advanced Audio Distribution Profile (A2DP) connection. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| device | string | Yes| Address of the remote device.| +| Name | Type | Mandatory | Description | +| ------ | ------ | ---- | ------- | +| device | string | Yes | Address of the remote device.| | **Return value** -| | | -| -------- | -------- | +| | | +| ------- | ------------------- | | Type | Description | | boolean | Returns **true** if the operation is successful; returns **false** otherwise. | **Example** ```js -A2dpSourceProfile a2dpSrc = bluetooth.getProfile(PROFILE_A2DP_SOURCE); -boolean ret = a2dpSrc.connect('XX:XX:XX:XX:XX:XX'); +let a2dpSrc = bluetooth.getProfile(PROFILE_A2DP_SOURCE) +let ret = a2dpSrc.connect('XX:XX:XX:XX:XX:XX'); ``` @@ -1299,23 +1295,23 @@ Disconnects an A2DP connection. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| device | string | Yes| Address of the remote device.| +| Name | Type | Mandatory | Description | +| ------ | ------ | ---- | ------- | +| device | string | Yes | Address of the remote device.| | **Return value** -| | | -| -------- | -------- | +| | | +| ------- | ------------------- | | Type | Description | | boolean | Returns **true** if the operation is successful; returns **false** otherwise. | **Example** ```js -A2dpSourceProfile a2dpSrc = bluetooth.getProfile(PROFILE_A2DP_SOURCE); -boolean ret = a2dpSrc.disconnect('XX:XX:XX:XX:XX:XX'); +let a2dpSrc = bluetooth.getProfile(PROFILE_A2DP_SOURCE); +let boolean ret = a2dpSrc.disconnect('XX:XX:XX:XX:XX:XX'); ``` @@ -1329,10 +1325,10 @@ Subscribes to the A2DP connection status change events. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **connectionStateChange** indicates an A2DP connection state change event.| -| callback | Callback<[StateChangeParam](#StateChangeParam)> | Yes| Callback invoked to return the A2DP connection state change event.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **connectionStateChange** indicates an A2DP connection state change event.| +| callback | Callback<[StateChangeParam](#StateChangeParam)> | Yes | Callback invoked to return the A2DP connection state change event. | **Return value** @@ -1358,10 +1354,10 @@ Unsubscribes from the A2DP connection status change events. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **connectionStateChange** indicates an A2DP connection state change event.| -| callback | Callback<[StateChangeParam](#StateChangeParam)> | Yes| Callback invoked to return the A2DP connection state change event.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **connectionStateChange** indicates an A2DP connection state change event.| +| callback | Callback<[StateChangeParam](#StateChangeParam)> | Yes | Callback invoked to return the A2DP connection state change event. | **Return value** @@ -1387,22 +1383,22 @@ Obtains the playing status of a device. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| device | string | Yes| Address of the remote device.| +| Name | Type | Mandatory | Description | +| ------ | ------ | ---- | ------- | +| device | string | Yes | Address of the remote device.| **Return value** -| | | -| -------- | -------- | +| | | +| ----------------------------- | ---------- | | Type | Description | | [PlayingState](#PlayingState) | Playing status obtained. | **Example** ```js -A2dpSourceProfile a2dpSrc = bluetooth.getProfile(PROFILE_A2DP_SOURCE); -PlayingState state = a2dpSrc.getPlayingState('XX:XX:XX:XX:XX:XX'); +let a2dpSrc = bluetooth.getProfile(PROFILE_A2DP_SOURCE); +let state = a2dpSrc.getPlayingState('XX:XX:XX:XX:XX:XX'); ``` @@ -1423,23 +1419,23 @@ Sets up a Hands-free Profile (HFP) connection of a device. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| device | string | Yes| Address of the remote device.| +| Name | Type | Mandatory | Description | +| ------ | ------ | ---- | ------- | +| device | string | Yes | Address of the remote device.| | **Return value** -| | | -| -------- | -------- | +| | | +| ------- | ------------------- | | Type | Description | | boolean | Returns **true** if the operation is successful; returns **false** otherwise. | **Example** ```js -HandsFreeAudioGatewayProfile hfpAg = bluetooth.getProfile(PROFILE_HANDS_FREE_AUDIO_GATEWAY); -boolean ret = hfpAg.connect('XX:XX:XX:XX:XX:XX'); +let hfpAg = bluetooth.getProfile(PROFILE_HANDS_FREE_AUDIO_GATEWAY); +let ret = hfpAg.connect('XX:XX:XX:XX:XX:XX'); ``` @@ -1447,7 +1443,7 @@ boolean ret = hfpAg.connect('XX:XX:XX:XX:XX:XX'); disconnect(device: string): boolean -Sets up a Hands-free Profile (HFP) connection of a device. +Disconnects the HFP connection of a device. **Required permissions**: ohos.permission.DISCOVER_BLUETOOTH @@ -1455,23 +1451,22 @@ Sets up a Hands-free Profile (HFP) connection of a device. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| device | string | Yes| Address of the remote device.| +| Name | Type | Mandatory | Description | +| ------ | ------ | ---- | ------- | +| device | string | Yes | Address of the remote device.| | **Return value** -| | | -| -------- | -------- | -| Type | Description | -| boolean | Returns **true** if the operation is successful; returns **false** otherwise. | +| Type | Description | +| ------- | ------------------- | +| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** ```js -HandsFreeAudioGatewayProfile hfpAg = bluetooth.getProfile(PROFILE_HANDS_FREE_AUDIO_GATEWAY); -boolean ret = hfpAg.disconnect('XX:XX:XX:XX:XX:XX'); +let hfpAg = bluetooth.getProfile(PROFILE_HANDS_FREE_AUDIO_GATEWAY); +let ret = hfpAg.disconnect('XX:XX:XX:XX:XX:XX'); ``` @@ -1485,10 +1480,10 @@ Subscribes to the HFP connection status change events. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **connectionStateChange** indicates an A2DP connection state change event.| -| callback | Callback<[StateChangeParam](#StateChangeParam)> | Yes| Callback invoked to return the A2DP connection state change event.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **connectionStateChange** indicates an A2DP connection state change event.| +| callback | Callback<[StateChangeParam](#StateChangeParam)> | Yes | Callback invoked to return the A2DP connection state change event. | **Return value** @@ -1514,10 +1509,10 @@ Unsubscribes from the HFP connection status change events. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **connectionStateChange** indicates an A2DP connection state change event.| -| callback | Callback<[StateChangeParam](#StateChangeParam)> | Yes| Callback invoked to return the A2DP connection state change event.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **connectionStateChange** indicates an A2DP connection state change event.| +| callback | Callback<[StateChangeParam](#StateChangeParam)> | Yes | Callback invoked to return the A2DP connection state change event. | **Return value** @@ -1550,11 +1545,11 @@ Starts BLE advertising. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| setting | [AdvertiseSetting](#advertisesetting) | Yes| Settings related to BLE advertising.| -| advData | [AdvertiseData](#advertisedata) | Yes| Content of the BLE advertisement packet.| -| advResponse | [AdvertiseData](#advertisedata) | No| Response to the BLE scan request.| +| Name | Type | Mandatory | Description | +| ----------- | ------------------------------------- | ---- | -------------- | +| setting | [AdvertiseSetting](#advertisesetting) | Yes | Settings related to BLE advertising. | +| advData | [AdvertiseData](#advertisedata) | Yes | Content of the BLE advertisement packet. | +| advResponse | [AdvertiseData](#advertisedata) | No | Response to the BLE scan request.| **Return value** @@ -1639,14 +1634,14 @@ Adds a service to this GATT server. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| service | [GattService](#gattservice) | Yes| Service to add. Settings related to BLE advertising.| +| Name | Type | Mandatory | Description | +| ------- | --------------------------- | ---- | ------------------------ | +| service | [GattService](#gattservice) | Yes | Service to add. Settings related to BLE advertising.| **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ------- | -------------------------- | | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** @@ -1698,14 +1693,14 @@ Removes a service from this GATT server. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| serviceUuid | string | Yes| Universally unique identifier (UUID) of the service to remove, for example, **00001810-0000-1000-8000-00805F9B34FB**.| +| Name | Type | Mandatory | Description | +| ----------- | ------ | ---- | ---------------------------------------- | +| serviceUuid | string | Yes | Universally unique identifier (UUID) of the service to remove, for example, **00001810-0000-1000-8000-00805F9B34FB**.| **Return value** -| | | -| -------- | -------- | +| | | +| ------- | -------------------------- | | Type | Description | | boolean | Returns **true** if the operation is successful; returns **false** otherwise. | @@ -1747,15 +1742,15 @@ Notifies the connected client device when a characteristic value changes. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| deviceId | string | Yes| Address of the client that receives notifications, for example, XX:XX:XX:XX:XX:XX.| -| notifyCharacteristic | [NotifyCharacteristic](#notifycharacteristic) | Yes| New characteristic value.| +| Name | Type | Mandatory | Description | +| -------------------- | ---------------------------------------- | ---- | --------------------------------------- | +| deviceId | string | Yes | Address of the client that receives notifications, for example, XX:XX:XX:XX:XX:XX.| +| notifyCharacteristic | [NotifyCharacteristic](#notifycharacteristic) | Yes | New characteristic value. | **Return value** -| | | -| -------- | -------- | +| | | +| ------- | ------------------------ | | Type | Description | | boolean | Returns **true** if the operation is successful; returns **false** otherwise. | @@ -1781,14 +1776,14 @@ Sends a response to a read or write request from the GATT client. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| serverResponse | [ServerResponse](#serverresponse) | Yes| Response returned by the GATT server.| +| Name | Type | Mandatory | Description | +| -------------- | --------------------------------- | ---- | --------------- | +| serverResponse | [ServerResponse](#serverresponse) | Yes | Response returned by the GATT server.| **Return value** -| | | -| -------- | -------- | +| | | +| ------- | -------------------------- | | Type | Description | | boolean | Returns **true** if the operation is successful; returns **false** otherwise. | @@ -1829,10 +1824,10 @@ Subscribes to the characteristic read request events. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **characteristicRead** indicates a characteristic read request event.| -| callback | Callback<[CharacteristicReadReq](#characteristicreadreq)> | Yes| Callback invoked to return a characteristic read request from the GATT client.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ------------------------------------- | +| type | string | Yes | Event type. The value **characteristicRead** indicates a characteristic read request event.| +| callback | Callback<[CharacteristicReadReq](#characteristicreadreq)> | Yes | Callback invoked to return a characteristic read request from the GATT client. | **Return value** @@ -1877,10 +1872,10 @@ Unsubscribes from the characteristic read request events. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **characteristicRead** indicates a characteristic read request event.| -| callback | Callback<[CharacteristicReadReq](#characteristicreadreq)> | No| Callback used to report a characteristic read request event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **characteristicRead** indicates a characteristic read request event. | +| callback | Callback<[CharacteristicReadReq](#characteristicreadreq)> | No | Callback used to report a characteristic read request event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| **Return value** @@ -1906,10 +1901,10 @@ Subscribes to the characteristic write request events. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **characteristicWrite** indicates a characteristic write request event.| -| callback | Callback<[DescriptorWriteReq](#descriptorwritereq)> | Yes| Callback invoked to return a characteristic write request from the GATT client.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | -------------------------------------- | +| type | string | Yes | Event type. The value **characteristicWrite** indicates a characteristic write request event.| +| callback | Callback<[DescriptorWriteReq](#descriptorwritereq)> | Yes | Callback invoked to return a characteristic write request from the GATT client. | **Return value** @@ -1957,10 +1952,10 @@ Unsubscribes from the characteristic write request events. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **characteristicWrite** indicates a characteristic write request event.| -| callback | Callback<[CharacteristicWriteReq](#characteristicwritereq)> | No| Callback used to report a characteristic write request event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **characteristicWrite** indicates a characteristic write request event. | +| callback | Callback<[CharacteristicWriteReq](#characteristicwritereq)> | No | Callback used to report a characteristic write request event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| **Return value** @@ -1986,10 +1981,10 @@ Subscribes to the descriptor read request events. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **descriptorRead** indicates a descriptor read request event.| -| callback | Callback<[DescriptorReadReq](#descriptorreadreq)> | Yes| Callback invoked to return a characteristic read request from the GATT client.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | --------------------------------- | +| type | string | Yes | Event type. The value **descriptorRead** indicates a descriptor read request event.| +| callback | Callback<[DescriptorReadReq](#descriptorreadreq)> | Yes | Callback invoked to return a characteristic read request from the GATT client. | **Return value** @@ -2034,10 +2029,10 @@ Unsubscribes from the descriptor read request events. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **descriptorRead** indicates a descriptor read request event.| -| callback | Callback<[DescriptorReadReq](#descriptorreadreq)> | No| Callback used to report a descriptor read request event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **descriptorRead** indicates a descriptor read request event. | +| callback | Callback<[DescriptorReadReq](#descriptorreadreq)> | No | Callback used to report a descriptor read request event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| **Return value** @@ -2063,10 +2058,10 @@ Subscribes to the descriptor write request events. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **descriptorWrite** indicates a descriptor write request event.| -| callback | Callback<[DescriptorWriteReq](#descriptorwritereq)> | Yes| Callback invoked to return a characteristic write request from the GATT client.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------- | +| type | string | Yes | Event type. The value **descriptorWrite** indicates a descriptor write request event.| +| callback | Callback<[DescriptorWriteReq](#descriptorwritereq)> | Yes | Callback invoked to return a characteristic write request from the GATT client. | **Return value** @@ -2114,10 +2109,10 @@ Unsubscribes from the descriptor write request events. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **descriptorWrite** indicates a descriptor write request event.| -| callback | Callback<[DescriptorWriteReq](#descriptorwritereq)> | No| Callback used to report a descriptor read request event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **descriptorWrite** indicates a descriptor write request event. | +| callback | Callback<[DescriptorWriteReq](#descriptorwritereq)> | No | Callback used to report a descriptor write request event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| **Return value** @@ -2143,10 +2138,10 @@ Subscribes to the BLE connection state change events. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **connectStateChange** indicates a BLE connection state change event.| -| callback | Callback<[BLEConnectChangedState](#bleconnectchangedstate)> | Yes| Callback invoked to return the BLE connection state.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **connectStateChange** indicates a BLE connection state change event.| +| callback | Callback<[BLEConnectChangedState](#bleconnectchangedstate)> | Yes | Callback invoked to return the BLE connection state. | **Return value** @@ -2177,10 +2172,10 @@ Unsubscribes from the BLE connection state change events. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **connectStateChange** indicates a BLE connection state change event.| -| callback | Callback<[BLEConnectChangedState](#bleconnectchangedstate)> | No| Callback used to report the BLE connection state. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **connectStateChange** indicates a BLE connection state change event.| +| callback | Callback<[BLEConnectChangedState](#bleconnectchangedstate)> | No | Callback used to report the BLE connection state. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| **Return value** @@ -2211,8 +2206,8 @@ Initiates a connection to the remote BLE device. **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ------- | ------------------------- | | boolean | Returns **true** if the connection is successful; returns **false** otherwise.| **Example** @@ -2235,8 +2230,8 @@ Disconnects from the remote BLE device. **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ------- | ---------------------------- | | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** @@ -2259,8 +2254,8 @@ Closes this GATT client to unregister it from the protocol stack. After this met **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ------- | -------------------------- | | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** @@ -2285,9 +2280,9 @@ Obtains all services of the remote BLE device. This method uses an asynchronous **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<Array<[GattService](#gattservice)>> | Yes| Callback invoked to return the services obtained.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ------------------------ | +| callback | AsyncCallback<Array<[GattService](#gattservice)>> | Yes | Callback invoked to return the services obtained.| **Return value** @@ -2329,8 +2324,8 @@ Obtains all services of the remote BLE device. This method uses a promise to ret **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ---------------------------------------- | --------------------------- | | Promise<Array<[GattService](#gattservice)>> | Promise used to return the services obtained.| **Example** @@ -2360,10 +2355,10 @@ Reads the characteristic value of the specific service of the remote BLE device. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| characteristic | [BLECharacteristic](#blecharacteristic) | Yes| Characteristic value to read.| -| callback | AsyncCallback<[BLECharacteristic](#blecharacteristic)> | Yes| Callback invoked to return the characteristic value read.| +| Name | Type | Mandatory | Description | +| -------------- | ---------------------------------------- | ---- | ----------------------- | +| characteristic | [BLECharacteristic](#blecharacteristic) | Yes | Characteristic value to read. | +| callback | AsyncCallback<[BLECharacteristic](#blecharacteristic)> | Yes | Callback invoked to return the characteristic value read.| **Return value** @@ -2414,14 +2409,14 @@ Reads the characteristic value of the specific service of the remote BLE device. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| characteristic | [BLECharacteristic](#blecharacteristic) | Yes| Characteristic value to read.| +| Name | Type | Mandatory | Description | +| -------------- | --------------------------------------- | ---- | -------- | +| characteristic | [BLECharacteristic](#blecharacteristic) | Yes | Characteristic value to read.| **Return value** -| | | -| -------- | -------- | +| | | +| ---------------------------------------- | -------------------------- | | Type | Description | | Promise<[BLECharacteristic](#blecharacteristic)> | Promise used to return the characteristic value read. | @@ -2461,10 +2456,10 @@ Reads the descriptor contained in the specific characteristic of the remote BLE **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| descriptor | [BLEDescriptor](#bledescriptor) | Yes| Descriptor to read.| -| callback | AsyncCallback<[BLECharacteristic](#blecharacteristic)> | Yes| Callback invoked to return the descriptor read.| +| Name | Type | Mandatory | Description | +| ---------- | ---------------------------------------- | ---- | ----------------------- | +| descriptor | [BLEDescriptor](#bledescriptor) | Yes | Descriptor to read. | +| callback | AsyncCallback<[BLECharacteristic](#blecharacteristic)> | Yes | Callback invoked to return the descriptor read.| **Return value** @@ -2505,14 +2500,14 @@ Reads the descriptor contained in the specific characteristic of the remote BLE **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| descriptor | [BLEDescriptor](#bledescriptor) | Yes| Descriptor to read.| +| Name | Type | Mandatory | Description | +| ---------- | ------------------------------- | ---- | -------- | +| descriptor | [BLEDescriptor](#bledescriptor) | Yes | Descriptor to read.| **Return value** -| | | -| -------- | -------- | +| | | +| ---------------------------------------- | -------------------------- | | Type | Description | | Promise<[BLEDescriptor](#bledescriptor)> | Promise used to return the descriptor read. | @@ -2542,14 +2537,14 @@ Writes a characteristic value to the remote BLE device. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| characteristic | [BLECharacteristic](#blecharacteristic) | Yes| Binary value and other parameters of the BLE device characteristic.| +| Name | Type | Mandatory | Description | +| -------------- | --------------------------------------- | ---- | ------------------- | +| characteristic | [BLECharacteristic](#blecharacteristic) | Yes | Binary value and other parameters of the BLE device characteristic.| **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ------- | --------------------------- | | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** @@ -2592,14 +2587,14 @@ Writes binary data to the specific descriptor of the remote BLE device. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| descriptor | [BLEDescriptor](#bledescriptor) | Yes| Binary value and other parameters of the BLE device descriptor.| +| Name | Type | Mandatory | Description | +| ---------- | ------------------------------- | ---- | ------------------ | +| descriptor | [BLEDescriptor](#bledescriptor) | Yes | Binary value and other parameters of the BLE device descriptor.| **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ------- | --------------------------- | | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** @@ -2633,14 +2628,14 @@ Sets the maximum transmission unit (MTU) that can be transmitted between the GAT **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| mtu | number | Yes| MTU to set, which ranges from 22 to 512 bytes.| +| Name | Type | Mandatory | Description | +| ---- | ------ | ---- | -------------- | +| mtu | number | Yes | MTU to set, which ranges from 22 to 512 bytes.| **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ------- | ---------------------------- | | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** @@ -2663,15 +2658,15 @@ Sets the function of notifying the GATT client when the characteristic value of **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| characteristic | [BLECharacteristic](#blecharacteristic) | Yes| BLE characteristic to listen for.| -| enable | boolean | Yes| Whether to enable the notify function. The value **true** means to enable the notify function, and the value **false** means the opposite.| +| Name | Type | Mandatory | Description | +| -------------- | --------------------------------------- | ---- | ----------------------------- | +| characteristic | [BLECharacteristic](#blecharacteristic) | Yes | BLE characteristic to listen for. | +| enable | boolean | Yes | Whether to enable the notify function. The value **true** means to enable the notify function, and the value **false** means the opposite.| **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ------- | ------------------------- | | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** @@ -2694,10 +2689,10 @@ Subscribes to the BLE characteristic change events. The client can receive a not **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **BLECharacteristicChange** indicates a characteristic value change event.| -| callback | Callback<[BLECharacteristic](#blecharacteristic)> | Yes| Callback invoked to return the characteristic value changes.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **BLECharacteristicChange** indicates a characteristic value change event.| +| callback | Callback<[BLECharacteristic](#blecharacteristic)> | Yes | Callback invoked to return the characteristic value changes. | **Return value** @@ -2728,10 +2723,10 @@ Unsubscribes from the BLE characteristic change events. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **BLECharacteristicChange** indicates a characteristic value change event.| -| callback | Callback<[BLECharacteristic](#blecharacteristic)> | No| Callback used to report the characteristic value. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **BLECharacteristicChange** indicates a characteristic value change event.| +| callback | Callback<[BLECharacteristic](#blecharacteristic)> | No | Callback used to report the characteristic value. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| **Return value** @@ -2757,10 +2752,10 @@ Subscribes to the BLE connection state change events. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **BLEConnectionStateChange** indicates a BLE connection state change event.| -| callback | Callback<[BLEConnectChangedState](#bleconnectchangedstate)> | Yes| Callback invoked to return the BLE connection state.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **BLEConnectionStateChange** indicates a BLE connection state change event.| +| callback | Callback<[BLEConnectChangedState](#bleconnectchangedstate)> | Yes | Callback invoked to return the BLE connection state. | **Return value** @@ -2790,10 +2785,10 @@ Unsubscribes from the BLE connection state change events. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **BLEConnectionStateChange** indicates a BLE connection state change event.| -| callback | Callback<[BLEConnectChangedState](#bleconnectchangedstate)> | No| Callback used to report the BLE connection state. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **BLEConnectionStateChange** indicates a BLE connection state change event.| +| callback | Callback<[BLEConnectChangedState](#bleconnectchangedstate)> | No | Callback used to report the BLE connection state. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| **Return value** @@ -2819,9 +2814,9 @@ Obtains the name of the remote BLE device. This method uses an asynchronous call **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<string> | Yes| Callback invoked to return the remote BLE device name obtained.| +| Name | Type | Mandatory | Description | +| -------- | --------------------------- | ---- | ------------------------------- | +| callback | AsyncCallback<string> | Yes | Callback invoked to return the remote BLE device name obtained.| **Return value** @@ -2851,8 +2846,8 @@ Obtains the name of the remote BLE device. This method uses a promise to return **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| --------------------- | ---------------------------------- | | Promise<string> | Promise used to return the remote BLE device name.| **Example** @@ -2879,9 +2874,9 @@ Obtains the received signal strength indication (RSSI) of the remote BLE device. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<number> | Yes| Callback invoked to return the RSSI, in dBm.| +| Name | Type | Mandatory | Description | +| -------- | --------------------------- | ---- | ------------------------------ | +| callback | AsyncCallback<number> | Yes | Callback invoked to return the RSSI, in dBm.| **Return value** @@ -2912,8 +2907,8 @@ Obtains the RSSI of the remote BLE device. This method uses a promise to return **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| --------------------- | --------------------------------- | | Promise<number> | Promise used to return the RSSI, in dBm.| **Example** @@ -2932,14 +2927,14 @@ Enumerates the scan modes. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Default Value| Description| -| -------- | -------- | -------- | -| SCAN_MODE_NONE | 0 | No scan mode.| -| SCAN_MODE_CONNECTABLE | 1 | Connectable mode.| -| SCAN_MODE_GENERAL_DISCOVERABLE | 2 | General discoverable mode.| -| SCAN_MODE_LIMITED_DISCOVERABLE | 3 | Limited discoverable mode.| -| SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE | 4 | General connectable and discoverable mode.| -| SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE | 5 | Limited connectable and discoverable mode.| +| Name | Default Value | Description | +| ---------------------------------------- | ---- | --------------- | +| SCAN_MODE_NONE | 0 | No scan mode. | +| SCAN_MODE_CONNECTABLE | 1 | Connectable mode. | +| SCAN_MODE_GENERAL_DISCOVERABLE | 2 | General discoverable mode. | +| SCAN_MODE_LIMITED_DISCOVERABLE | 3 | Limited discoverable mode. | +| SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE | 4 | General connectable and discoverable mode.| +| SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE | 5 | Limited connectable and discoverable mode.| ## BondState8+ @@ -2947,11 +2942,11 @@ Enumerates the pairing states. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Default Value| Description| -| -------- | -------- | -------- | -| BOND_STATE_INVALID | 0 | Invalid pairing.| -| BOND_STATE_BONDING | 1 | Pairing.| -| BOND_STATE_BONDED | 2 | Paired.| +| Name | Default Value | Description | +| ------------------ | ---- | ------ | +| BOND_STATE_INVALID | 0 | Invalid pairing.| +| BOND_STATE_BONDING | 1 | Pairing. | +| BOND_STATE_BONDED | 2 | Paired. | ## SppOption8+ @@ -2960,11 +2955,11 @@ Defines the SPP configuration parameters. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| uuid | string | Yes| Yes| UUID of the SPP.| -| secure | boolean | Yes| Yes| Whether it is a secure channel.| -| type | [SppType](#spptype) | Yes| Yes| Type of the SPP link.| +| Name | Type | Readable | Writable | Description | +| ------ | ------------------- | ---- | ---- | ----------- | +| uuid | string | Yes | Yes | UUID of the SPP.| +| secure | boolean | Yes | Yes | Whether it is a secure channel. | +| type | [SppType](#spptype) | Yes | Yes | Type of the SPP link. | ## SppType8+ @@ -2973,9 +2968,9 @@ Enumerates the SPP link types. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Default Value| Description| -| -------- | -------- | -------- | -| SPP_RFCOMM | 0 | Radio frequency communication (RFCOMM) link type.| +| Name | Default Value | Description | +| ---------- | ---- | ------------- | +| SPP_RFCOMM | 0 | Radio frequency communication (RFCOMM) link type.| ## GattService @@ -2984,12 +2979,12 @@ Defines the GATT service API parameters. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| serviceUuid | string | Yes| Yes| UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.| -| isPrimary | boolean | Yes| Yes| Whether the service is a primary service. The value **true** means a primary service.| -| characteristics | Array<[BLECharacteristic](#blecharacteristic)> | Yes| Yes| List of characteristics of the service.| -| includeServices | Array<[GattService](#gattservice)> | Yes| Yes| Services on which the service depends.| +| Name | Type | Readable | Writable | Description | +| --------------- | ---------------------------------------- | ---- | ---- | ---------------------------------------- | +| serviceUuid | string | Yes | Yes | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.| +| isPrimary | boolean | Yes | Yes | Whether the service is a primary service. The value **true** means a primary service. | +| characteristics | Array<[BLECharacteristic](#blecharacteristic)> | Yes | Yes | List of characteristics of the service. | +| includeServices | Array<[GattService](#gattservice)> | Yes | Yes | Services on which the service depends. | ## BLECharacteristic @@ -2998,12 +2993,12 @@ Defines the characteristic API parameters. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| serviceUuid | string | Yes| Yes| UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.| -| characteristicUuid | string | Yes| Yes| UUID of the characteristic, for example, **00002a11-0000-1000-8000-00805f9b34fb**.| -| characteristicValue | ArrayBuffer | Yes| Yes| Binary value of the characteristic.| -| descriptors | Array<[BLEDescriptor](#bledescriptor)> | Yes| Yes| List of descriptors of the characteristic.| +| Name | Type | Readable | Writable | Description | +| ------------------- | ---------------------------------------- | ---- | ---- | ---------------------------------------- | +| serviceUuid | string | Yes | Yes | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.| +| characteristicUuid | string | Yes | Yes | UUID of the characteristic, for example, **00002a11-0000-1000-8000-00805f9b34fb**.| +| characteristicValue | ArrayBuffer | Yes | Yes | Binary value of the characteristic. | +| descriptors | Array<[BLEDescriptor](#bledescriptor)> | Yes | Yes | List of descriptors of the characteristic. | ## BLEDescriptor @@ -3012,12 +3007,12 @@ Defines the descriptor API parameters. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| serviceUuid | string | Yes| Yes| UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.| -| characteristicUuid | string | Yes| Yes| UUID of the characteristic, for example, **00002a11-0000-1000-8000-00805f9b34fb**.| -| descriptorUuid | string | Yes| Yes| UUID of the descriptor, for example, **00002902-0000-1000-8000-00805f9b34fb**.| -| descriptorValue | ArrayBuffer | Yes| Yes| Binary value of the descriptor.| +| Name | Type | Readable | Writable | Description | +| ------------------ | ----------- | ---- | ---- | ---------------------------------------- | +| serviceUuid | string | Yes | Yes | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.| +| characteristicUuid | string | Yes | Yes | UUID of the characteristic, for example, **00002a11-0000-1000-8000-00805f9b34fb**.| +| descriptorUuid | string | Yes | Yes | UUID of the descriptor, for example, **00002902-0000-1000-8000-00805f9b34fb**.| +| descriptorValue | ArrayBuffer | Yes | Yes | Binary value of the descriptor. | ## NotifyCharacteristic @@ -3026,12 +3021,12 @@ Defines the parameters in the notifications sent when the server characteristic **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| serviceUuid | string | Yes| Yes| UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.| -| characteristicUuid | string | Yes| Yes| UUID of the characteristic, for example, **00002a11-0000-1000-8000-00805f9b34fb**.| -| characteristicValue | ArrayBuffer | Yes| Yes| Binary value of the characteristic.| -| confirm | boolean | Yes| Yes| Whether the notification needs to be confirmed by the remote end. For a notification, set it to **true**. In this case, the remote end must confirm the receipt of the notification. For an indication, set it to **false**. In this case, the remote end does not need to confirm the receipt of the notification.| +| Name | Type | Readable | Writable | Description | +| ------------------- | ----------- | ---- | ---- | ---------------------------------------- | +| serviceUuid | string | Yes | Yes | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.| +| characteristicUuid | string | Yes | Yes | UUID of the characteristic, for example, **00002a11-0000-1000-8000-00805f9b34fb**.| +| characteristicValue | ArrayBuffer | Yes | Yes | Binary value of the characteristic. | +| confirm | boolean | Yes | Yes | Whether the notification needs to be confirmed by the remote end. For a notification, set it to **true**. In this case, the remote end must confirm the receipt of the notification. For an indication, set it to **false**. In this case, the remote end does not need to confirm the receipt of the notification.| ## CharacteristicReadReq @@ -3040,13 +3035,13 @@ Defines the parameters of the **CharacteristicReadReq** event received by the se **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| deviceId | string | Yes| No| Address of the remote device that sends the **CharacteristicReadReq** event, for example, XX:XX:XX:XX:XX:XX.| -| transId | number | Yes| No| Transmission ID of the read request. The response returned by the server must use the same transmission ID.| -| offset | number | Yes| No| Position from which the characteristic value is read. For example, **k** means to read from the kth byte. The response returned by the server must use the same offset.| -| characteristicUuid | string | Yes| No| UUID of the characteristic, for example, **00002a11-0000-1000-8000-00805f9b34fb**.| -| serviceUuid | string | Yes| No| UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.| +| Name | Type | Readable | Writable | Description | +| ------------------ | ------ | ---- | ---- | ---------------------------------------- | +| deviceId | string | Yes | No | Address of the remote device that sends the **CharacteristicReadReq** event, for example, XX:XX:XX:XX:XX:XX.| +| transId | number | Yes | No | Transmission ID of the read request. The response returned by the server must use the same transmission ID. | +| offset | number | Yes | No | Position from which the characteristic value is read. For example, **k** means to read from the kth byte. The response returned by the server must use the same offset.| +| characteristicUuid | string | Yes | No | UUID of the characteristic, for example, **00002a11-0000-1000-8000-00805f9b34fb**.| +| serviceUuid | string | Yes | No | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.| ## CharacteristicWriteReq @@ -3055,15 +3050,14 @@ Defines the parameters of the **CharacteristicWriteReq** event received by the s **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| deviceId | string | Yes| No| Address of the remote device that sends the **CharacteristicWriteReq** event, for example, XX:XX:XX:XX:XX:XX.| -| transId | number | Yes| No| Transmission ID of the write request. The response returned by the server must use the same transmission ID.| -| offset | number | Yes| No| Start position for writing the characteristic value. For example, **k** means to write from the kth byte. The response returned by the server must use the same offset.| -| descriptorUuid | string | Yes| No| UUID of the descriptor, for example, **00002902-0000-1000-8000-00805f9b34fb**.| -| characteristicUuid | string | Yes| No| UUID of the characteristic, for example, **00002a11-0000-1000-8000-00805f9b34fb**.| -| serviceUuid | string | Yes| No| UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.| - +| Name | Type | Readable | Writable | Description | +| ------------------ | ------ | ---- | ---- | ---------------------------------------- | +| deviceId | string | Yes | No | Address of the remote device that sends the **CharacteristicWriteReq** event, for example, XX:XX:XX:XX:XX:XX.| +| transId | number | Yes | No | Transmission ID of the write request. The response returned by the server must use the same transmission ID. | +| offset | number | Yes | No | Start position for writing the characteristic value. For example, **k** means to write from the kth byte. The response returned by the server must use the same offset.| +| descriptorUuid | string | Yes | No | UUID of the descriptor, for example, **00002902-0000-1000-8000-00805f9b34fb**.| +| characteristicUuid | string | Yes | No | UUID of the characteristic, for example, **00002a11-0000-1000-8000-00805f9b34fb**.| +| serviceUuid | string | Yes | No | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.| ## DescriptorReadReq @@ -3071,14 +3065,14 @@ Defines the parameters of the **DescriptorReadReq** event received by the server **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| deviceId | string | Yes| No| Address of the remote device that sends a **DescriptorReadReq** event, for example, XX:XX:XX:XX:XX:XX.| -| transId | number | Yes| No| Transmission ID of the read request. The response returned by the server must use the same transmission ID.| -| offset | number | Yes| No| Position from which the descriptor is read. For example, **k** means to read from the kth byte. The response returned by the server must use the same offset.| -| descriptorUuid | string | Yes| No| UUID of the descriptor, for example, **00002902-0000-1000-8000-00805f9b34fb**.| -| characteristicUuid | string | Yes| No| UUID of the characteristic, for example, **00002a11-0000-1000-8000-00805f9b34fb**.| -| serviceUuid | string | Yes| No| UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.| +| Name | Type | Readable | Writable | Description | +| ------------------ | ------ | ---- | ---- | ---------------------------------------- | +| deviceId | string | Yes | No | Address of the remote device that sends a **DescriptorReadReq** event, for example, XX:XX:XX:XX:XX:XX.| +| transId | number | Yes | No | Transmission ID of the read request. The response returned by the server must use the same transmission ID. | +| offset | number | Yes | No | Position from which the descriptor is read. For example, **k** means to read from the kth byte. The response returned by the server must use the same offset.| +| descriptorUuid | string | Yes | No | UUID of the descriptor, for example, **00002902-0000-1000-8000-00805f9b34fb**.| +| characteristicUuid | string | Yes | No | UUID of the characteristic, for example, **00002a11-0000-1000-8000-00805f9b34fb**.| +| serviceUuid | string | Yes | No | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.| ## DescriptorWriteReq @@ -3087,17 +3081,17 @@ Defines the parameters of the **DescriptorWriteReq** event received by the serve **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| deviceId | string | Yes| No| Address of the remote device that sends a **DescriptorWriteReq** event, for example, XX:XX:XX:XX:XX:XX.| -| transId | number | Yes| No| Transmission ID of the write request. The response returned by the server must use the same transmission ID.| -| offset | number | Yes| No| Start position for writing the descriptor. For example, **k** means to write from the kth byte. The response returned by the server must use the same offset.| -| isPrep | boolean | Yes| No| Whether the write request is executed immediately.| -| needRsp | boolean | Yes| No| Whether to send a response to the GATT client.| -| value | ArrayBuffer | Yes| No| Binary value of the descriptor to write.| -| descriptorUuid | string | Yes| No| UUID of the descriptor, for example, **00002902-0000-1000-8000-00805f9b34fb**.| -| characteristicUuid | string | Yes| No| UUID of the characteristic, for example, **00002a11-0000-1000-8000-00805f9b34fb**.| -| serviceUuid | string | Yes| No| UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.| +| Name | Type | Readable | Writable | Description | +| ------------------ | ----------- | ---- | ---- | ---------------------------------------- | +| deviceId | string | Yes | No | Address of the remote device that sends a **DescriptorWriteReq** event, for example, XX:XX:XX:XX:XX:XX.| +| transId | number | Yes | No | Transmission ID of the write request. The response returned by the server must use the same transmission ID. | +| offset | number | Yes | No | Start position for writing the descriptor. For example, **k** means to write from the kth byte. The response returned by the server must use the same offset.| +| isPrep | boolean | Yes | No | Whether the write request is executed immediately. | +| needRsp | boolean | Yes | No | Whether to send a response to the GATT client. | +| value | ArrayBuffer | Yes | No | Binary value of the descriptor to write. | +| descriptorUuid | string | Yes | No | UUID of the descriptor, for example, **00002902-0000-1000-8000-00805f9b34fb**.| +| characteristicUuid | string | Yes | No | UUID of the characteristic, for example, **00002a11-0000-1000-8000-00805f9b34fb**.| +| serviceUuid | string | Yes | No | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.| ## ServerResponse @@ -3106,13 +3100,13 @@ Defines the parameters of the server's response to the GATT client's read/write **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| deviceId | string | Yes| No| Address of the remote device, for example, XX:XX:XX:XX:XX:XX.| -| transId | number | Yes| No| Transmission ID of the request. The value must be the same as the ID carried in the read/write request received.| -| status | number | Yes| No| Response state. Set this parameter to **0**, which indicates a normal response.| -| offset | number | Yes| No| Start read/write position. The value must be the same as the offset carried in the read/write request.| -| value | ArrayBuffer | Yes| No| Binary data in the response.| +| Name | Type | Readable | Writable | Description | +| -------- | ----------- | ---- | ---- | -------------------------------------- | +| deviceId | string | Yes | No | Address of the remote device, for example, XX:XX:XX:XX:XX:XX. | +| transId | number | Yes | No | Transmission ID of the request. The value must be the same as the ID carried in the read/write request received. | +| status | number | Yes | No | Response state. Set this parameter to **0**, which indicates a normal response. | +| offset | number | Yes | No | Start read/write position. The value must be the same as the offset carried in the read/write request.| +| value | ArrayBuffer | Yes | No | Binary data in the response. | ## BLEConnectChangedState @@ -3121,10 +3115,10 @@ Defines the parameters of **BLEConnectChangedState**. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| deviceId | string | Yes| No| Address of the remote device, for example, XX:XX:XX:XX:XX:XX.| -| state | [ProfileConnectionState](#profileconnectionState) | Yes| Yes| BLE connection state.| +| Name | Type | Readable | Writable | Description | +| -------- | ---------------------------------------- | ---- | ---- | -------------------------------- | +| deviceId | string | Yes | No | Address of the remote device, for example, XX:XX:XX:XX:XX:XX.| +| state | [ProfileConnectionState](#profileconnectionState) | Yes | Yes | BLE connection state. | ## ProfileConnectionState @@ -3133,12 +3127,12 @@ Enumerates the profile connection states. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Default Value| Description| -| -------- | -------- | -------- | -| STATE_DISCONNECTED | 0 | Disconnected.| -| STATE_CONNECTING | 1 | Connecting.| -| STATE_CONNECTED | 2 | Connected.| -| STATE_DISCONNECTING | 3 | Disconnecting.| +| Name | Default Value | Description | +| ------------------- | ---- | -------------- | +| STATE_DISCONNECTED | 0 | Disconnected. | +| STATE_CONNECTING | 1 | Connecting.| +| STATE_CONNECTED | 2 | Connected. | +| STATE_DISCONNECTING | 3 | Disconnecting.| ## ScanFilter @@ -3147,11 +3141,11 @@ Defines the scan filter parameters. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| deviceId | string | Yes| Yes| Address of the BLE device to filter, for example, XX:XX:XX:XX:XX:XX.| -| name | string | Yes| Yes| Name of the BLE device to filter.| -| serviceUuid | string | Yes| Yes| UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.| +| Name | Type | Readable | Writable | Description | +| ----------- | ------ | ---- | ---- | ---------------------------------------- | +| deviceId | string | Yes | Yes | Address of the BLE device to filter, for example, XX:XX:XX:XX:XX:XX. | +| name | string | Yes | Yes | Name of the BLE device to filter. | +| serviceUuid | string | Yes | Yes | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.| ## ScanOptions @@ -3160,11 +3154,11 @@ Defines the scan configuration parameters. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| interval | number | Yes| Yes| Delay in reporting the scan result. The default value is **0**.| -| dutyMode | [ScanDuty](#scanduty) | Yes| Yes| Scan duty. The default value is **SCAN_MODE_LOW_POWER**.| -| matchMode | [MatchMode](#matchmode) | Yes| Yes| Hardware filtering match mode. The default value is **MATCH_MODE_AGGRESSIVE**.| +| Name | Type | Readable | Writable | Description | +| --------- | ----------------------- | ---- | ---- | -------------------------------------- | +| interval | number | Yes | Yes | Delay in reporting the scan result. The default value is **0**. | +| dutyMode | [ScanDuty](#scanduty) | Yes | Yes | Scan duty. The default value is **SCAN_MODE_LOW_POWER**. | +| matchMode | [MatchMode](#matchmode) | Yes | Yes | Hardware filtering match mode. The default value is **MATCH_MODE_AGGRESSIVE**.| ## ScanDuty @@ -3173,11 +3167,11 @@ Enumerates the scan duty options. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Default Value| Description| -| -------- | -------- | -------- | -| SCAN_MODE_LOW_POWER | 0 | Low-power mode, which is the default value.| -| SCAN_MODE_BALANCED | 1 | Balanced mode.| -| SCAN_MODE_LOW_LATENCY | 2 | Low-latency mode.| +| Name | Default Value | Description | +| --------------------- | ---- | ------------ | +| SCAN_MODE_LOW_POWER | 0 | Low-power mode, which is the default value.| +| SCAN_MODE_BALANCED | 1 | Balanced mode. | +| SCAN_MODE_LOW_LATENCY | 2 | Low-latency mode. | ## MatchMode @@ -3186,10 +3180,10 @@ Enumerates the hardware match modes of BLE scan filters. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Default Value| Description| -| -------- | -------- | -------- | -| MATCH_MODE_AGGRESSIVE | 1 | Hardware reports the scan result with a lower threshold of signal strength and few number of matches in a duration. This is the default value.| -| MATCH_MODE_STICKY | 2 | Hardware reports the scan result with a higher threshold of signal strength and sightings.| +| Name | Default Value | Description | +| --------------------- | ---- | ---------------------------------------- | +| MATCH_MODE_AGGRESSIVE | 1 | Hardware reports the scan result with a lower threshold of signal strength and few number of matches in a duration. This is the default value.| +| MATCH_MODE_STICKY | 2 | Hardware reports the scan result with a higher threshold of signal strength and sightings. | ## ScanResult @@ -3198,11 +3192,11 @@ Defines the scan result. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| deviceId | string | Yes| No| Address of the scanned device, for example, XX:XX:XX:XX:XX:XX.| -| rssi | number | Yes| No| RSSI of the device.| -| data | ArrayBuffer | Yes| No| Advertisement packets sent by the device.| +| Name | Type | Readable | Writable | Description | +| -------- | ----------- | ---- | ---- | ---------------------------------- | +| deviceId | string | Yes | No | Address of the scanned device, for example, XX:XX:XX:XX:XX:XX.| +| rssi | number | Yes | No | RSSI of the device. | +| data | ArrayBuffer | Yes | No | Advertisement packets sent by the device. | ## BluetoothState @@ -3211,15 +3205,15 @@ Enumerates the Bluetooth states. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Default Value| Description| -| -------- | -------- | -------- | -| STATE_OFF | 0 | Bluetooth is turned off.| -| STATE_TURNING_ON | 1 | Bluetooth is being turned on.| -| STATE_ON | 2 | Bluetooth is turned on.| -| STATE_TURNING_OFF | 3 | Bluetooth is being turned off.| -| STATE_BLE_TURNING_ON | 4 | The LE-only mode is being turned on for Bluetooth.| -| STATE_BLE_ON | 5 | Bluetooth is in LE-only mode.| -| STATE_BLE_TURNING_OFF | 6 | The LE-only mode is being turned off for Bluetooth.| +| Name | Default Value | Description | +| --------------------- | ---- | ------------------ | +| STATE_OFF | 0 | Bluetooth is turned off. | +| STATE_TURNING_ON | 1 | Bluetooth is being turned on. | +| STATE_ON | 2 | Bluetooth is turned on. | +| STATE_TURNING_OFF | 3 | Bluetooth is being turned off. | +| STATE_BLE_TURNING_ON | 4 | The LE-only mode is being turned on for Bluetooth.| +| STATE_BLE_ON | 5 | Bluetooth is in LE-only mode. | +| STATE_BLE_TURNING_OFF | 6 | The LE-only mode is being turned off for Bluetooth.| ## AdvertiseSetting @@ -3228,11 +3222,11 @@ Defines the BLE advertising parameters. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| interval | number | Yes| Yes| Interval for BLE advertising. The minimum value is **32** slots (20 ms). The maximum value is **16777215** slots. The default value is **1600** slots (1s).| -| txPower | number | Yes| Yes| Transmit power, in dBm. The value range is –127 to 1. The default value is **–7**.| -| connectable | boolean | Yes| Yes| Whether the advertisement is connectable. The default value is **true**.| +| Name | Type | Readable | Writable | Description | +| ----------- | ------- | ---- | ---- | ---------------------------------------- | +| interval | number | Yes | Yes | Interval for BLE advertising. The minimum value is **32** slots (20 ms). The maximum value is **16777215** slots. The default value is **1600** slots (1s).| +| txPower | number | Yes | Yes | Transmit power, in dBm. The value range is -127 to 1. The default value is **-7**. | +| connectable | boolean | Yes | Yes | Whether the advertisement is connectable. The default value is **true**. | ## AdvertiseData @@ -3241,11 +3235,11 @@ Defines the content of a BLE advertisement packet. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| serviceUuids | Array<string> | Yes| Yes| List of service UUIDs to broadcast.| -| manufactureData | Array<[ManufactureData](#manufacturedata)> | Yes| Yes| List of manufacturers to broadcast.| -| serviceData | Array<[ServiceData](#servicedata)> | Yes| Yes| List of service data to broadcast.| +| Name | Type | Readable | Writable | Description | +| --------------- | ---------------------------------------- | ---- | ---- | --------------------------- | +| serviceUuids | Array<string> | Yes | Yes | List of service UUIDs to broadcast.| +| manufactureData | Array<[ManufactureData](#manufacturedata)> | Yes | Yes | List of manufacturers to broadcast. | +| serviceData | Array<[ServiceData](#servicedata)> | Yes | Yes | List of service data to broadcast. | ## ManufactureData @@ -3254,10 +3248,10 @@ Defines the content of a BLE advertisement packet. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| manufactureId | Array<string> | Yes| Yes| Manufacturer ID allocated by the Bluetooth SIG.| -| manufactureValue | ArrayBuffer | Yes| Yes| Manufacturer data.| +| Name | Type | Readable | Writable | Description | +| ---------------- | ------------------- | ---- | ---- | ------------------ | +| manufactureId | Array<string> | Yes | Yes | Manufacturer ID allocated by the Bluetooth SIG.| +| manufactureValue | ArrayBuffer | Yes | Yes | Manufacturer data. | ## ServiceData @@ -3266,10 +3260,10 @@ Defines the service data contained in an advertisement packet. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| serviceUuid | string | Yes| Yes| Service UUID.| -| serviceValue | ArrayBuffer | Yes| Yes| Service data.| +| Name | Type | Readable | Writable | Description | +| ------------ | ----------- | ---- | ---- | ---------- | +| serviceUuid | string | Yes | Yes | Service UUID.| +| serviceValue | ArrayBuffer | Yes | Yes | Service data. | ## PinRequiredParam8+ @@ -3278,10 +3272,10 @@ Defines the pairing request parameters. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| deviceId | string | Yes| No| ID of the device to pair.| -| pinCode | string | Yes| No| Key for the device pairing.| +| Name | Type | Readable | Writable | Description | +| -------- | ------ | ---- | ---- | ----------- | +| deviceId | string | Yes | No | ID of the device to pair.| +| pinCode | string | Yes | No | Key for the device pairing. | ## StateChangeParam8+ @@ -3290,10 +3284,10 @@ Defines the profile state change parameters. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| deviceId | string | Yes| No| Address of a Bluetooth device.| -| state | [ProfileConnectionState](#ProfileConnectionState) | Yes| No| Profile connection state of the device.| +| Name | Type | Readable | Writable | Description | +| -------- | ---------------------------------------- | ---- | ---- | ------------------- | +| deviceId | string | Yes | No | Address of a Bluetooth device. | +| state | [ProfileConnectionState](#ProfileConnectionState) | Yes | No | Profile connection state of the device.| ## DeviceClass8+ @@ -3302,11 +3296,11 @@ Defines the class of a Bluetooth device. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| majorClass | [MajorClass](#majorclass) | Yes| No| Major classes of Bluetooth devices.| -| majorMinorClass | [MajorMinorClass](#majorminorclass) | Yes| No| Major and minor classes of Bluetooth devices.| -| classOfDevice | number | Yes| No| Class of the device.| +| Name | Type | Readable | Writable | Description | +| --------------- | ----------------------------------- | ---- | ---- | ---------------- | +| majorClass | [MajorClass](#majorclass) | Yes | No | Major classes of Bluetooth devices. | +| majorMinorClass | [MajorMinorClass](#majorminorclass) | Yes | No | Major and minor classes of Bluetooth devices.| +| classOfDevice | number | Yes | No | Class of the device. | @@ -3316,19 +3310,19 @@ Enumerates the major classes of Bluetooth devices. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Default Value| Description| -| -------- | -------- | -------- | -| MAJOR_MISC | 0x0000 | Miscellaneous device.| -| MAJOR_COMPUTER | 0x0100 | Computer.| -| MAJOR_PHONE | 0x0200 | Mobile phone.| -| MAJOR_NETWORKING | 0x0300 | Network device.| -| MAJOR_AUDIO_VIDEO | 0x0400 | Audio or video device.| -| MAJOR_PERIPHERAL | 0x0500 | Peripheral device.| -| MAJOR_IMAGING | 0x0600 | Imaging device.| -| MAJOR_WEARABLE | 0x0700 | Wearable device.| -| MAJOR_TOY | 0x0800 | Toy.| -| MAJOR_HEALTH | 0x0900 | Health device.| -| MAJOR_UNCATEGORIZED | 0x1F00 | Unclassified device.| +| Name | Default Value | Description | +| ------------------- | ------ | ---------- | +| MAJOR_MISC | 0x0000 | Miscellaneous device. | +| MAJOR_COMPUTER | 0x0100 | Computer. | +| MAJOR_PHONE | 0x0200 | Mobile phone. | +| MAJOR_NETWORKING | 0x0300 | Network device. | +| MAJOR_AUDIO_VIDEO | 0x0400 | Audio or video device.| +| MAJOR_PERIPHERAL | 0x0500 | Peripheral device. | +| MAJOR_IMAGING | 0x0600 | Imaging device. | +| MAJOR_WEARABLE | 0x0700 | Wearable device. | +| MAJOR_TOY | 0x0800 | Toy. | +| MAJOR_HEALTH | 0x0900 | Health device. | +| MAJOR_UNCATEGORIZED | 0x1F00 | Unclassified device. | ## MajorMinorClass8+ @@ -3337,94 +3331,94 @@ Enumerates the major and minor classes of Bluetooth devices. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Default Value| Description| -| -------- | -------- | -------- | -| COMPUTER_UNCATEGORIZED | 0x0100 | Unclassified computer.| -| COMPUTER_DESKTOP | 0x0104 | Desktop computer.| -| COMPUTER_SERVER | 0x0108 | Server.| -| COMPUTER_LAPTOP | 0x010C | Laptop.| -| COMPUTER_HANDHELD_PC_PDA | 0x0110 | Hand-held computer.| -| COMPUTER_PALM_SIZE_PC_PDA | 0x0114 | Palmtop computer.| -| COMPUTER_WEARABLE | 0x0118 | Wearable computer.| -| COMPUTER_TABLET | 0x011C | Tablet.| -| PHONE_UNCATEGORIZED | 0x0200 | Unclassified mobile phone.| -| PHONE_CELLULAR | 0x0204 | Portable phone.| -| PHONE_CORDLESS | 0x0208 | Cordless phone.| -| PHONE_SMART | 0x020C | Smartphone.| -| PHONE_MODEM_OR_GATEWAY | 0x0210 | Modem or gateway phone.| -| PHONE_ISDN | 0x0214 | ISDN phone.| -| NETWORK_FULLY_AVAILABLE | 0x0300 | Device with network fully available.| -| NETWORK_1_TO_17_UTILIZED | 0x0320 | Device used on network 1 to 17.| -| NETWORK_17_TO_33_UTILIZED | 0x0340 | Device used on network 17 to 33.| -| NETWORK_33_TO_50_UTILIZED | 0x0360 | Device used on network 33 to 50.| -| NETWORK_60_TO_67_UTILIZED | 0x0380 | Device used on network 60 to 67.| -| NETWORK_67_TO_83_UTILIZED | 0x03A0 | Device used on network 67 to 83.| -| NETWORK_83_TO_99_UTILIZED | 0x03C0 | Device used on network 83 to 99.| -| NETWORK_NO_SERVICE | 0x03E0 | Device without network service -| AUDIO_VIDEO_UNCATEGORIZED | 0x0400 | Unclassified audio or video device.| -| AUDIO_VIDEO_WEARABLE_HEADSET | 0x0404 | Wearable audio or video headset.| -| AUDIO_VIDEO_HANDSFREE | 0x0408 | Hands-free audio or video device.| -| AUDIO_VIDEO_MICROPHONE | 0x0410 | Audio or video microphone.| -| AUDIO_VIDEO_LOUDSPEAKER | 0x0414 | Audio or video loudspeaker.| -| AUDIO_VIDEO_HEADPHONES | 0x0418 | Audio or video headphones.| -| AUDIO_VIDEO_PORTABLE_AUDIO | 0x041C | Portable audio or video device.| -| AUDIO_VIDEO_CAR_AUDIO | 0x0420 | In-vehicle audio or video device.| -| AUDIO_VIDEO_SET_TOP_BOX | 0x0424 | Audio or video STB device.| -| AUDIO_VIDEO_HIFI_AUDIO | 0x0428 | High-fidelity speaker device.| -| AUDIO_VIDEO_VCR| 0x042C | Video cassette recording (VCR) device.| -| AUDIO_VIDEO_VIDEO_CAMERA | 0x0430 | Camera.| -| AUDIO_VIDEO_CAMCORDER | 0x0434 | Camcorder| -| AUDIO_VIDEO_VIDEO_MONITOR | 0x0438 | Audio or video monitor.| -| AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER | 0x043C | Video display or loudspeaker.| -| AUDIO_VIDEO_VIDEO_CONFERENCING | 0x0440 | Video conferencing device.| -| AUDIO_VIDEO_VIDEO_GAMING_TOY | 0x0448 | Audio or video gaming toy.| -| PERIPHERAL_NON_KEYBOARD_NON_POINTING | 0x0500 | Non-keyboard or non-pointing peripheral device.| -| PERIPHERAL_KEYBOARD | 0x0540 | Keyboard device.| -| PERIPHERAL_POINTING_DEVICE | 0x0580 | Pointing peripheral device.| -| PERIPHERAL_KEYBOARD_POINTING| 0x05C0 | Keyboard pointing device.| -| PERIPHERAL_UNCATEGORIZED | 0x0500 | Unclassified peripheral device.| -| PERIPHERAL_JOYSTICK | 0x0504 | Peripheral joystick.| -| PERIPHERAL_GAMEPAD | 0x0508 | Peripheral game pad| -| PERIPHERAL_REMOTE_CONTROL | 0x05C0 | Peripheral remote control device| -| PERIPHERAL_SENSING_DEVICE | 0x0510 | Peripheral sensing device.| -| PERIPHERAL_DIGITIZER_TABLET | 0x0514 | Peripheral digitizer tablet.| -| PERIPHERAL_CARD_READER | 0x0518 | Peripheral card reader.| -| PERIPHERAL_DIGITAL_PEN | 0x051C | Peripheral digital pen.| -| PERIPHERAL_SCANNER_RFID | 0x0520 | Peripheral RFID scanner.| -| PERIPHERAL_GESTURAL_INPUT | 0x0522 | Gesture input device.| -| IMAGING_UNCATEGORIZED | 0x0600 | Unclassified imaging device.| -| IMAGING_DISPLAY | 0x0610 | Imaging display device.| -| IMAGING_CAMERA | 0x0620 | Imaging camera device.| -| IMAGING_SCANNER | 0x0640 | Imaging scanner.| -| IMAGING_PRINTER | 0x0680 | Imaging printer.| -| WEARABLE_UNCATEGORIZED | 0x0700 | Unclassified wearable device.| -| WEARABLE_WRIST_WATCH | 0x0704 | Smart watch.| -| WEARABLE_PAGER | 0x0708 | Wearable pager.| -| WEARABLE_JACKET | 0x070C | Smart jacket.| -| WEARABLE_HELMET | 0x0710 | Wearable helmet.| -| WEARABLE_GLASSES | 0x0714 | Wearable glasses.| -| TOY_UNCATEGORIZED | 0x0800 | Unclassified toy.| -| TOY_ROBOT| 0x0804 | Toy robot.| -| TOY_VEHICLE | 0x0808 | Toy vehicle.| -| TOY_DOLL_ACTION_FIGURE | 0x080C | Humanoid toy doll.| -| TOY_CONTROLLER | 0x0810 | Toy controller.| -| TOY_GAME | 0x0814 | Toy gaming device.| -| HEALTH_UNCATEGORIZED | 0x0900 | Unclassified health devices.| -| HEALTH_BLOOD_PRESSURE | 0x0904 | Blood pressure device.| -| HEALTH_THERMOMETER | 0x0908 | Thermometer| -| HEALTH_WEIGHING | 0x090C | Body scale.| -| HEALTH_GLUCOSE | 0x0910 | Blood glucose monitor.| -| HEALTH_PULSE_OXIMETER | 0x0914 | Pulse oximeter.| -| HEALTH_PULSE_RATE | 0x0918 | Heart rate monitor.| -| HEALTH_DATA_DISPLAY | 0x091C | Health data display.| -| HEALTH_STEP_COUNTER | 0x0920 | Step counter.| -| HEALTH_BODY_COMPOSITION_ANALYZER | 0x0924 | Body composition analyzer.| -| HEALTH_PEAK_FLOW_MOITOR | 0x0928 | Hygrometer.| -| HEALTH_MEDICATION_MONITOR | 0x092C | Medication monitor.| -| HEALTH_KNEE_PROSTHESIS | 0x0930 | Prosthetic knee.| -| HEALTH_ANKLE_PROSTHESIS | 0x0934 | Prosthetic ankle.| -| HEALTH_GENERIC_HEALTH_MANAGER | 0x0938 | Generic health management device.| -| HEALTH_PERSONAL_MOBILITY_DEVICE | 0x093C | Personal mobility device.| +| Name | Default Value | Description | +| ---------------------------------------- | ------ | --------------- | +| COMPUTER_UNCATEGORIZED | 0x0100 | Unclassified computer. | +| COMPUTER_DESKTOP | 0x0104 | Desktop computer. | +| COMPUTER_SERVER | 0x0108 | Server. | +| COMPUTER_LAPTOP | 0x010C | Laptop. | +| COMPUTER_HANDHELD_PC_PDA | 0x0110 | Hand-held computer. | +| COMPUTER_PALM_SIZE_PC_PDA | 0x0114 | Palmtop computer. | +| COMPUTER_WEARABLE | 0x0118 | Wearable computer. | +| COMPUTER_TABLET | 0x011C | Tablet. | +| PHONE_UNCATEGORIZED | 0x0200 | Unclassified mobile phone. | +| PHONE_CELLULAR | 0x0204 | Portable phone. | +| PHONE_CORDLESS | 0x0208 | Cordless phone. | +| PHONE_SMART | 0x020C | Smartphone. | +| PHONE_MODEM_OR_GATEWAY | 0x0210 | Modem or gateway phone.| +| PHONE_ISDN | 0x0214 | ISDN phone. | +| NETWORK_FULLY_AVAILABLE | 0x0300 | Device with network fully available. | +| NETWORK_1_TO_17_UTILIZED | 0x0320 | Device used on network 1 to 17. | +| NETWORK_17_TO_33_UTILIZED | 0x0340 | Device used on network 17 to 33. | +| NETWORK_33_TO_50_UTILIZED | 0x0360 | Device used on network 33 to 50. | +| NETWORK_60_TO_67_UTILIZED | 0x0380 | Device used on network 60 to 67. | +| NETWORK_67_TO_83_UTILIZED | 0x03A0 | Device used on network 67 to 83. | +| NETWORK_83_TO_99_UTILIZED | 0x03C0 | Device used on network 83 to 99. | +| NETWORK_NO_SERVICE | 0x03E0 | Device without network service | +| AUDIO_VIDEO_UNCATEGORIZED | 0x0400 | Unclassified audio or video device. | +| AUDIO_VIDEO_WEARABLE_HEADSET | 0x0404 | Wearable audio or video headset. | +| AUDIO_VIDEO_HANDSFREE | 0x0408 | Hands-free audio or video device. | +| AUDIO_VIDEO_MICROPHONE | 0x0410 | Audio or video microphone. | +| AUDIO_VIDEO_LOUDSPEAKER | 0x0414 | Audio or video loudspeaker. | +| AUDIO_VIDEO_HEADPHONES | 0x0418 | Audio or video headphones. | +| AUDIO_VIDEO_PORTABLE_AUDIO | 0x041C | Portable audio or video device. | +| AUDIO_VIDEO_CAR_AUDIO | 0x0420 | In-vehicle audio or video device. | +| AUDIO_VIDEO_SET_TOP_BOX | 0x0424 | Audio or video STB device. | +| AUDIO_VIDEO_HIFI_AUDIO | 0x0428 | High-fidelity speaker device. | +| AUDIO_VIDEO_VCR | 0x042C | Video cassette recording (VCR) device. | +| AUDIO_VIDEO_VIDEO_CAMERA | 0x0430 | Camera. | +| AUDIO_VIDEO_CAMCORDER | 0x0434 | Camcorder | +| AUDIO_VIDEO_VIDEO_MONITOR | 0x0438 | Audio or video monitor. | +| AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER | 0x043C | Video display or loudspeaker. | +| AUDIO_VIDEO_VIDEO_CONFERENCING | 0x0440 | Video conferencing device. | +| AUDIO_VIDEO_VIDEO_GAMING_TOY | 0x0448 | Audio or video gaming toy. | +| PERIPHERAL_NON_KEYBOARD_NON_POINTING | 0x0500 | Non-keyboard or non-pointing peripheral device. | +| PERIPHERAL_KEYBOARD | 0x0540 | Keyboard device. | +| PERIPHERAL_POINTING_DEVICE | 0x0580 | Pointing peripheral device. | +| PERIPHERAL_KEYBOARD_POINTING | 0x05C0 | Keyboard pointing device. | +| PERIPHERAL_UNCATEGORIZED | 0x0500 | Unclassified peripheral device. | +| PERIPHERAL_JOYSTICK | 0x0504 | Peripheral joystick. | +| PERIPHERAL_GAMEPAD | 0x0508 | Peripheral game pad | +| PERIPHERAL_REMOTE_CONTROL | 0x05C0 | Peripheral remote control device | +| PERIPHERAL_SENSING_DEVICE | 0x0510 | Peripheral sensing device. | +| PERIPHERAL_DIGITIZER_TABLET | 0x0514 | Peripheral digitizer tablet.| +| PERIPHERAL_CARD_READER | 0x0518 | Peripheral card reader. | +| PERIPHERAL_DIGITAL_PEN | 0x051C | Peripheral digital pen. | +| PERIPHERAL_SCANNER_RFID | 0x0520 | Peripheral RFID scanner. | +| PERIPHERAL_GESTURAL_INPUT | 0x0522 | Gesture input device. | +| IMAGING_UNCATEGORIZED | 0x0600 | Unclassified imaging device. | +| IMAGING_DISPLAY | 0x0610 | Imaging display device. | +| IMAGING_CAMERA | 0x0620 | Imaging camera device. | +| IMAGING_SCANNER | 0x0640 | Imaging scanner. | +| IMAGING_PRINTER | 0x0680 | Imaging printer. | +| WEARABLE_UNCATEGORIZED | 0x0700 | Unclassified wearable device. | +| WEARABLE_WRIST_WATCH | 0x0704 | Smart watch. | +| WEARABLE_PAGER | 0x0708 | Wearable pager. | +| WEARABLE_JACKET | 0x070C | Smart jacket. | +| WEARABLE_HELMET | 0x0710 | Wearable helmet. | +| WEARABLE_GLASSES | 0x0714 | Wearable glasses. | +| TOY_UNCATEGORIZED | 0x0800 | Unclassified toy. | +| TOY_ROBOT | 0x0804 | Toy robot. | +| TOY_VEHICLE | 0x0808 | Toy vehicle. | +| TOY_DOLL_ACTION_FIGURE | 0x080C | Humanoid toy doll. | +| TOY_CONTROLLER | 0x0810 | Toy controller. | +| TOY_GAME | 0x0814 | Toy gaming device. | +| HEALTH_UNCATEGORIZED | 0x0900 | Unclassified health devices. | +| HEALTH_BLOOD_PRESSURE | 0x0904 | Blood pressure device. | +| HEALTH_THERMOMETER | 0x0908 | Thermometer | +| HEALTH_WEIGHING | 0x090C | Body scale. | +| HEALTH_GLUCOSE | 0x0910 | Blood glucose monitor. | +| HEALTH_PULSE_OXIMETER | 0x0914 | Pulse oximeter. | +| HEALTH_PULSE_RATE | 0x0918 | Heart rate monitor. | +| HEALTH_DATA_DISPLAY | 0x091C | Health data display. | +| HEALTH_STEP_COUNTER | 0x0920 | Step counter. | +| HEALTH_BODY_COMPOSITION_ANALYZER | 0x0924 | Body composition analyzer. | +| HEALTH_PEAK_FLOW_MOITOR | 0x0928 | Hygrometer. | +| HEALTH_MEDICATION_MONITOR | 0x092C | Medication monitor. | +| HEALTH_KNEE_PROSTHESIS | 0x0930 | Prosthetic knee. | +| HEALTH_ANKLE_PROSTHESIS | 0x0934 | Prosthetic ankle. | +| HEALTH_GENERIC_HEALTH_MANAGER | 0x0938 | Generic health management device. | +| HEALTH_PERSONAL_MOBILITY_DEVICE | 0x093C | Personal mobility device. | ## PlayingState8+ @@ -3433,10 +3427,10 @@ Enumerates the A2DP playing states. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Default Value| Description| -| -------- | -------- | -------- | -| STATE_NOT_PLAYING | 0x0000 | Not playing.| -| STATE_PLAYING | 0x0001 | Playing.| +| Name | Default Value | Description | +| ----------------- | ------ | ------- | +| STATE_NOT_PLAYING | 0x0000 | Not playing. | +| STATE_PLAYING | 0x0001 | Playing.| ## ProfileId8+ @@ -3445,7 +3439,7 @@ Enumerates the Bluetooth profile IDs. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name| Default Value| Description| -| -------- | -------- | -------- | -| PROFILE_A2DP_SOURCE | 0x0001 | A2DP profile.| -| PROFILE_HANDS_FREE_AUDIO_GATEWAY | 0x0004 | HFP profile.| +| Name | Default Value | Description | +| -------------------------------- | ------ | --------------- | +| PROFILE_A2DP_SOURCE | 0x0001 | A2DP profile.| +| PROFILE_HANDS_FREE_AUDIO_GATEWAY | 0x0004 | HFP profile. | -- GitLab