You need to sign in or sign up before continuing.
未验证 提交 d46248b1 编写于 作者: O openharmony_ci 提交者: Gitee

!7479 【翻译完成】#I5JG32

Merge pull request !7479 from Annie_wang/PR7245
...@@ -13,6 +13,17 @@ import bluetooth from '@ohos.bluetooth'; ...@@ -13,6 +13,17 @@ import bluetooth from '@ohos.bluetooth';
``` ```
## Required Permissions
ohos.permission.USE_BLUETOOTH
ohos.permission.MANAGE_BLUETOOTH
ohos.permission.DISCOVER_BLUETOOTH
ohos.permission.LOCATION
## bluetooth.enableBluetooth<sup>8+</sup><a name="enableBluetooth"></a> ## bluetooth.enableBluetooth<sup>8+</sup><a name="enableBluetooth"></a>
enableBluetooth(): boolean enableBluetooth(): boolean
...@@ -1697,7 +1708,7 @@ let descV = new Uint8Array(arrayBuffer); ...@@ -1697,7 +1708,7 @@ let descV = new Uint8Array(arrayBuffer);
descV[0] = 11; descV[0] = 11;
let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB',
descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer}; descriptorUuid: '00002902-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer};
descriptors[0] = descriptor; descriptors[0] = descriptor;
// Create characteristics. // Create characteristics.
...@@ -1807,7 +1818,7 @@ let descV = new Uint8Array(arrayBuffer); ...@@ -1807,7 +1818,7 @@ let descV = new Uint8Array(arrayBuffer);
descV[0] = 11; descV[0] = 11;
let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB',
descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer}; descriptorUuid: '00002902-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer};
descriptors[0] = descriptor; descriptors[0] = descriptor;
let arrayBufferC = new ArrayBuffer(8); let arrayBufferC = new ArrayBuffer(8);
...@@ -2387,8 +2398,10 @@ Obtains all services of the remote BLE device. This API uses a promise to return ...@@ -2387,8 +2398,10 @@ Obtains all services of the remote BLE device. This API uses a promise to return
```js ```js
// Promise // Promise
gattClientDevice.getServices().then(result => { let device = bluetooth.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX');
console.info("Got services successfully:" + JSON.stringify(result)); device.connect();
device.getServices().then(result => {
console.info("getServices successfully:" + JSON.stringify(result));
}); });
``` ```
...@@ -2729,7 +2742,7 @@ let descV = new Uint8Array(arrayBuffer); ...@@ -2729,7 +2742,7 @@ let descV = new Uint8Array(arrayBuffer);
descV[0] = 11; descV[0] = 11;
let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB',
descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer}; descriptorUuid: '00002902-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer};
descriptors[0] = descriptor; descriptors[0] = descriptor;
let arrayBufferC = new ArrayBuffer(8); let arrayBufferC = new ArrayBuffer(8);
...@@ -3209,7 +3222,7 @@ Defines the scan filter parameters. ...@@ -3209,7 +3222,7 @@ Defines the scan filter parameters.
| ----------- | ------ | ---- | ---- | ---------------------------------------- | | ----------- | ------ | ---- | ---- | ---------------------------------------- |
| deviceId | string | Yes | Yes | Address of the BLE device to filter, for example, XX:XX:XX:XX:XX:XX. | | 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. | | 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**.| | serviceUuid | string | Yes | Yes | Service UUID of the device to filter, for example, **00001888-0000-1000-8000-00805f9b34fb**.|
## ScanOptions ## ScanOptions
...@@ -3288,7 +3301,7 @@ Defines the BLE advertising parameters. ...@@ -3288,7 +3301,7 @@ Defines the BLE advertising parameters.
| Name | Type | Readable | Writable | Description | | 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).| | interval | number | Yes | Yes | Interval for BLE advertising. The minimum value is **32** slots (20 ms). The maximum value is **16384** 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**. | | 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**. | | connectable | boolean | Yes | Yes | Whether the advertisement is connectable. The default value is **true**. |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册