未验证 提交 b06c4891 编写于 作者: O openharmony_ci 提交者: Gitee

!16167 [翻译完成】I6MRE4 (15914+15955)

Merge pull request !16167 from Annie_wang/PR15866
# @system.bluetooth (Bluetooth)
> **NOTE**<br/>
> **NOTE**
>
> - The APIs of this module are no longer maintained since API version 7. You are advised to use [`@ohos.bluetooth`](js-apis-bluetooth.md).
>
......@@ -19,11 +19,10 @@ import bluetooth from '@system.bluetooth';
Scans for Bluetooth Low Energy (BLE) devices nearby. This operation consumes system resources. Call [bluetooth.stopBLEScan](#bluetoothstopblescanobject) to stop the scan after a BLE device is detected and connected.
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.LOCATION
**System capability**: SystemCapability.Communication.Bluetooth.Lite
**Parameters**
**Table 1** StartBLEScanOptions
| Name| Type| Mandatory| Description|
......@@ -42,7 +41,7 @@ Scans for Bluetooth Low Energy (BLE) devices nearby. This operation consumes sys
console.log('call bluetooth.startBLEScan success.');
},
fail(code, data) {
console.log('call bluetooth.startBLEScan failed, code: ${code}, data: ${data}.');
console.log('call bluetooth.startBLEScan failed, code:' + code + ', data:' + data);
},
complete() {
console.log('call bluetooth.startBLEScan complete.');
......@@ -55,11 +54,10 @@ Scans for Bluetooth Low Energy (BLE) devices nearby. This operation consumes sys
Stops scanning for BLE devices nearby. This API is used with [bluetooth.startBLEScan(OBJECT)](#bluetoothstartblescanobject) in pairs.
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.LOCATION
**System capability**: SystemCapability.Communication.Bluetooth.Lite
**Parameters**
**Table 2** StopBLEScanOptions
| Name| Type| Mandatory| Description|
......@@ -76,7 +74,7 @@ Stops scanning for BLE devices nearby. This API is used with [bluetooth.startBLE
console.log('call bluetooth.stopBLEScan success.');
},
fail(data, code) {
console.log('call bluethooth.stopBLEScan fail, code: ${code}, data: ${data}.');
console.log('call bluethooth.stopBLEScan fail, code:' + code + ', data:' + data);
},
complete() {
console.log('call bluethooth.stopBLEScan complete.');
......@@ -89,8 +87,6 @@ Stops scanning for BLE devices nearby. This API is used with [bluetooth.startBLE
Subscribes to the newly detected BLE device. If this API is called multiple times, the last call takes effect.
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.LOCATION
**System capability**: SystemCapability.Communication.Bluetooth.Lite
**Parameters**
......@@ -122,10 +118,10 @@ Subscribes to the newly detected BLE device. If this API is called multiple time
```
bluetooth.subscribeBLEFound({
success(data) {
console.log('Called bluetooth.subscribeBLEFound successsully, data: ${data}.');
console.log('call bluetooth.subscribeBLEFound success, data: ${data}.');
},
fail(data, code) {
console.log('Failed to call bluetooth.startBLEScan, data: ${data}, code: ${code}.');
console.log('call bluetooth.startBLEScan failed, code:' + code + ', data:' + data);
}
});
```
......@@ -135,8 +131,6 @@ Subscribes to the newly detected BLE device. If this API is called multiple time
Unsubscribes from the newly detected devices.
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.LOCATION
**System capability**: SystemCapability.Communication.Bluetooth.Lite
**Example**
......
# @system.cipher (Cipher Algorithm)
# @system.cipher (Cipher Algorithm)
> **NOTE**
>
> The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>- The APIs provided by this module are deprecated since API version 9. You are advised to use [cryptoFramework-Cipher](js-apis-cryptoFramework.md#Cipher).
## Modules to Import
......@@ -18,9 +18,10 @@ Defines the response to the cipher interface called.
**System capability**: SystemCapability.Security.Cipher
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------ |
| text | string | Yes | Response content.|
| Name| Type | Readable| Writable|Description |
| ------ | ------ | ---- | ---- | ------------ |
| text | string | Yes | No | Response content.|
## CipherRsaOptions
......@@ -74,39 +75,39 @@ Encrypts or decrypts data using RSA.
**Example**
```js
export default {
rsa() {
cipher.rsa({
// Encrypt data.
action: 'encrypt',
// Text to be encrypted.
text: 'hello',
// Base64-encoded public key used for encryption.
key:
'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCx414QSP3RsYWYzf9mkBMiBAXo\n' +
'6S7Lpva1fKlcuVxjoFC1iMnzD4mC0uiL4k5MNi43J64c7dbqi3qAJjdAtuwQ6NZJ\n' +
export default {
rsa() {
cipher.rsa({
// Encrypt data.
action: 'encrypt',
// Text to be encrypted.
text: 'hello',
// Base64-encoded public key used for encryption.
key:
'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCx414QSP3RsYWYzf9mkBMiBAXo\n' +
'6S7Lpva1fKlcuVxjoFC1iMnzD4mC0uiL4k5MNi43J64c7dbqi3qAJjdAtuwQ6NZJ\n' +
'+Enz0RzmVFh/4yk6lmqRzuEFQqhQqSZzaLq6sq2N2G0Sv2Xl3sLvqAfe2HNm2oBw\n' +
'jBpApTJ3TeneOo6Z5QIDAQAB',
success: function(data) {
console.log(`Handling successful:${data.text}`);
},
fail: function(data, code) {
console.log(`### cipher.rsa encryption failed ### ${code}:${data}`);
'jBpApTJ3TeneOo6Z5QIDAQAB',
success: function(data) {
console.log(`handling success:${data.text}`);
},
fail: function(data, code) {
console.log(`### cipher.rsa encrypt fail ### ${code}:${data}`);
},
complete: function() {
console.log(`operation complete!`);
}
});
cipher.rsa({
// Decrypt data.
action: 'decrypt',
// Text to be decrypted, which is binary text encoded in Base64. The decrypted text is "hello".
text:
});
cipher.rsa({
// Decrypt data.
action: 'decrypt',
// Text to be decrypted, which is binary text encoded in Base64. The decrypted text is "hello".
text:
'EPeCFPib6ayKbA0M6oSywARvFZ8dFYfjQv3nY8ikZGtS9UHq2sLPvAfpeIzggSiCxqbWeCftP1XQ\n' +
'Sa+jEpzFlT1qoSTunBbrYzugPTajIJDTg6R1IRsF/J+mmakn0POVPvi4jCo9wqavB324Bx0Wipnc\n' +
'EU5WO0oBHo5l4x6dTpU=',
// Base64-encoded private key used for decryption.
key:
'EU5WO0oBHo5l4x6dTpU=',
// Base64-encoded private key used for decryption.
key:
'MIICXgIBAAKBgQCx414QSP3RsYWYzf9mkBMiBAXo6S7Lpva1fKlcuVxjoFC1iMnz\n' +
'D4mC0uiL4k5MNi43J64c7dbqi3qAJjdAtuwQ6NZJ+Enz0RzmVFh/4yk6lmqRzuEF\n' +
'QqhQqSZzaLq6sq2N2G0Sv2Xl3sLvqAfe2HNm2oBwjBpApTJ3TeneOo6Z5QIDAQAB\n' +
......@@ -118,18 +119,18 @@ export default {
'PKoljdXmJeS6rGgzGibstuHLrP3tcIho4+0CQD3ZFWzF/xq0jxKlrpWhnJuNCRfE\n' +
'oO6e9yNvVA8J/5oEDSOcmqSNIp4+RhbUx8InUxnCG6Ryv5aSFu71pYcKrPkCQQCL\n' +
'RUGcm3ZGTnslduB0knNF+V2ndwzDUQ7P74UXT+PjurTPhujFYiuxCEd6ORVnEOzG\n' +
'M9TORIgdH8MjIbWsGnndAkEAw9yURDaorE8IYPLF2IEn09g1uzvWPs3phDb6smVx\n' +
'M9TORIgdH8MjIbWsGnndAkEAw9yURDaorE8IYPLF2IEn09g1uzvWPs3phDb6smVx\n' +
'8GfqIdUNf+aCG5TZK/kXBF1sqcsi7jXMAf4jBlejVbSVZg==',
success: function(data) {
console.log(`Handling successful:${data.text}`);
},
fail: function(data, code) {
console.log(`### cipher.rsa encryption failed ### ${code}:${data}`);
success: function(data) {
console.log(`handling success:${data.text}`);
},
fail: function(data, code) {
console.log(`### cipher.rsa encrypt fail ### ${code}:${data}`);
},
complete: function() {
console.log(`operation complete!`);
}
});
}
});
}
}
```
......@@ -152,48 +153,48 @@ Encrypts or decrypts data using AES.
**Example**
```js
export default {
aes() {
cipher.aes({
// Encrypt data.
action: 'encrypt',
// Text to be encrypted.
text: 'hello',
export default {
aes() {
cipher.aes({
// Encrypt data.
action: 'encrypt',
// Text to be encrypted.
text: 'hello',
// Base64-encoded key.
key: 'NDM5Qjk2UjAzMEE0NzVCRjlFMkQwQkVGOFc1NkM1QkQ=',
transformation: 'AES/CBC/PKCS5Padding',
ivOffset: '0',
ivLen: '16',
success: function(data) {
console.log(`Handling successful:${data.text}`);
},
fail: function(data, code) {
console.log(`### cipher.rsa encryption failed ### ${code}:${data}`);
key: 'NDM5Qjk2UjAzMEE0NzVCRjlFMkQwQkVGOFc1NkM1QkQ=',
transformation: 'AES/CBC/PKCS5Padding',
ivOffset: '0',
ivLen: '16',
success: function(data) {
console.log(`handling success:${data.text}`);
},
fail: function(data, code) {
console.log(`### cipher.rsa encrypt fail ### ${code}:${data}`);
},
complete: function() {
console.log(`operation complete!`);
}
});
cipher.aes({
// Decrypt data.
action: 'decrypt',
// Text to be decrypted, which is binary text encoded in Base64.
text: '1o0kf2HXwLxHkSh5W5NhzA==',
});
cipher.aes({
// Decrypt data.
action: 'decrypt',
// Text to be decrypted, which is binary text encoded in Base64.
text: '1o0kf2HXwLxHkSh5W5NhzA==',
// Base64-encoded key.
key: 'NDM5Qjk2UjAzMEE0NzVCRjlFMkQwQkVGOFc1NkM1QkQ=',
transformation: 'AES/CBC/PKCS5Padding',
ivOffset: '0',
ivLen: '16',
success: function(data) {
console.log(`Handling successful:${data.text}`);
},
fail: function(data, code) {
console.log(`### cipher.aes encryption failed ### ${code}:${data}`);
key: 'NDM5Qjk2UjAzMEE0NzVCRjlFMkQwQkVGOFc1NkM1QkQ=',
transformation: 'AES/CBC/PKCS5Padding',
ivOffset: '0',
ivLen: '16',
success: function(data) {
console.log(`handling success:${data.text}`);
},
fail: function(data, code) {
console.log(`### cipher.aes encrypt fail ### ${code}:${data}`);
},
complete: function() {
console.log(`operation complete!`);
}
});
});
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册