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

!16873 [翻译完成】#I6QUUP (16518+ 16505+ 16409 +16390+ 16294)

Merge pull request !16873 from Annie_wang/PR16363A
...@@ -3,8 +3,9 @@ ...@@ -3,8 +3,9 @@
The **Bluetooth** module provides classic Bluetooth capabilities and Bluetooth Low Energy (BLE) scan and advertising. The **Bluetooth** module provides classic Bluetooth capabilities and Bluetooth Low Energy (BLE) scan and advertising.
> **NOTE** > **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 APIs provided by this module are no longer maintained since API version 9. You are advised to use [bluetoothManager](js-apis-bluetoothManager.md). > - 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 APIs provided by this module are no longer maintained since API version 9. You are advised to use [bluetoothManager](js-apis-bluetoothManager.md).
...@@ -123,7 +124,7 @@ let state = bluetooth.getState(); ...@@ -123,7 +124,7 @@ let state = bluetooth.getState();
getBtConnectionState(): ProfileConnectionState getBtConnectionState(): ProfileConnectionState
Obtains the profile connection state of this Bluetooth device. Obtains the local profile connection state.
> **NOTE**<br> > **NOTE**<br>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.getBtConnectionState](js-apis-bluetoothManager.md#bluetoothmanagergetbtconnectionstate). > This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.getBtConnectionState](js-apis-bluetoothManager.md#bluetoothmanagergetbtconnectionstate).
...@@ -214,9 +215,9 @@ let result = bluetooth.pairDevice("XX:XX:XX:XX:XX:XX"); ...@@ -214,9 +215,9 @@ let result = bluetooth.pairDevice("XX:XX:XX:XX:XX:XX");
getProfileConnState(profileId: ProfileId): ProfileConnectionState getProfileConnState(profileId: ProfileId): ProfileConnectionState
Obtains the connection state of a profile. Obtains the connection status of a specified profile.
> **NOTE**<br> > **NOTE**
> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.getProfileConnectionState](js-apis-bluetoothManager.md#bluetoothmanagergetprofileconnectionstate). > This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.getProfileConnectionState](js-apis-bluetoothManager.md#bluetoothmanagergetprofileconnectionstate).
**Required permissions**: ohos.permission.USE_BLUETOOTH **Required permissions**: ohos.permission.USE_BLUETOOTH
...@@ -1513,7 +1514,7 @@ Subscribes to the A2DP connection state change events. ...@@ -1513,7 +1514,7 @@ Subscribes to the A2DP connection state change events.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- | | -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | Yes | Event type. The value **connectionStateChange** indicates an A2DP connection state change event.| | type | string | Yes | Event type. The value **connectionStateChange** indicates an A2DP connection state change event.|
| callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | Yes | Callback used to return the A2DP connection state change event. | | callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | Yes | Callback invoked to return the A2DP connection state change event. |
**Return value** **Return value**
...@@ -1546,7 +1547,7 @@ Unsubscribes from the A2DP connection state change events. ...@@ -1546,7 +1547,7 @@ Unsubscribes from the A2DP connection state change events.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- | | -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | Yes | Event type. The value **connectionStateChange** indicates an A2DP connection state change event.| | type | string | Yes | Event type. The value **connectionStateChange** indicates an A2DP connection state change event.|
| callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | No | Callback used to return the A2DP connection state change event. | | callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | No | Callback for the A2DP connection state change event. |
**Return value** **Return value**
...@@ -2141,8 +2142,7 @@ on(type: "characteristicWrite", callback: Callback&lt;CharacteristicWriteReq&gt; ...@@ -2141,8 +2142,7 @@ on(type: "characteristicWrite", callback: Callback&lt;CharacteristicWriteReq&gt;
Subscribes to the characteristic write request events. Subscribes to the characteristic write request events.
> **NOTE**<br> > **NOTE**<br>
> This API is supported since API version 7 and > This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattServer.on('characteristicWrite')](js-apis-bluetoothManager.md#oncharacteristicwrite).
> deprecated since API version 9. You are advised to use [bluetoothManager.GattServer.on('characteristicWrite')](js-apis-bluetoothManager.md#oncharacteristicwrite).
**Required permissions**: ohos.permission.USE_BLUETOOTH **Required permissions**: ohos.permission.USE_BLUETOOTH
...@@ -3198,7 +3198,7 @@ let deviceName = gattClient.getDeviceName().then((data) => { ...@@ -3198,7 +3198,7 @@ let deviceName = gattClient.getDeviceName().then((data) => {
getRssiValue(callback: AsyncCallback&lt;number&gt;): void getRssiValue(callback: AsyncCallback&lt;number&gt;): void
Obtains the RSSI of the remote BLE device. This API uses an asynchronous callback to return the result. It can be used only after a connection is set up by calling [connect](#connect). Obtains the received signal strength indication (RSSI) of the remote BLE device. This API uses an asynchronous callback to return the result. It can be used only after a connection is set up by calling [connect](#connect).
> **NOTE**<br> > **NOTE**<br>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattClientDevice.getRssiValue](js-apis-bluetoothManager.md#getrssivalue). > This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattClientDevice.getRssiValue](js-apis-bluetoothManager.md#getrssivalue).
...@@ -3553,7 +3553,7 @@ Defines the scan configuration parameters. ...@@ -3553,7 +3553,7 @@ Defines the scan configuration parameters.
## ScanDuty<sup>(deprecated)</sup> ## ScanDuty<sup>(deprecated)</sup>
Enumerates the scan modes. Enumerates the scan duty options.
> **NOTE**<br> > **NOTE**<br>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.ScanDuty](js-apis-bluetoothManager.md#scanduty). > This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.ScanDuty](js-apis-bluetoothManager.md#scanduty).
...@@ -3882,7 +3882,7 @@ Enumerates the A2DP playing states. ...@@ -3882,7 +3882,7 @@ Enumerates the A2DP playing states.
## ProfileId<sup>8+</sup><sup>(deprecated)</sup><a name="ProfileId"></a> ## ProfileId<sup>8+</sup><sup>(deprecated)</sup><a name="ProfileId"></a>
Enumerates Bluetooth profiles. API version 9 is added with **PROFILE_HID_HOST** and **PROFILE_PAN_NETWORK**. Enumerates the Bluetooth profiles. API version 9 is added with **PROFILE_HID_HOST** and **PROFILE_PAN_NETWORK**.
> **NOTE**<br> > **NOTE**<br>
> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.ProfileId](js-apis-bluetoothManager.md#profileid). > This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.ProfileId](js-apis-bluetoothManager.md#profileid).
......
...@@ -151,7 +151,7 @@ try { ...@@ -151,7 +151,7 @@ try {
getBtConnectionState(): ProfileConnectionState getBtConnectionState(): ProfileConnectionState
Obtains the profile connection state of this Bluetooth device. Obtains the local profile connection state.
**Required permissions**: ohos.permission.USE_BLUETOOTH **Required permissions**: ohos.permission.USE_BLUETOOTH
...@@ -1385,7 +1385,7 @@ Creates a **GattServer** instance. ...@@ -1385,7 +1385,7 @@ Creates a **GattServer** instance.
| Type | Description | | Type | Description |
| ------------------------- | ------------------------------------ | | ------------------------- | ------------------------------------ |
| [GattServer](#gattserver) | **GattServer** instance created. Before using a method of the server, you must create a **GattSever** instance.| | [GattServer](#gattserver) | **GattServer** instance created. Before using an API of the server, you must create a **GattSever** instance.|
**Example** **Example**
...@@ -1412,7 +1412,7 @@ Creates a **GattClientDevice** instance. ...@@ -1412,7 +1412,7 @@ Creates a **GattClientDevice** instance.
| Type | Description | | Type | Description |
| ------------------------------------- | ------------------------------------ | | ------------------------------------- | ------------------------------------ |
| [GattClientDevice](#gattclientdevice) | **GattClientDevice** instance created. Before using a method of the client, you must create a **GattClientDevice** instance.| | [GattClientDevice](#gattclientdevice) | **GattClientDevice** instance created. Before using an API of the client, you must create a **GattClientDevice** instance.|
**Example** **Example**
...@@ -1714,7 +1714,7 @@ try { ...@@ -1714,7 +1714,7 @@ try {
## A2dpSourceProfile ## A2dpSourceProfile
Before using a method of **A2dpSourceProfile**, you need to create an instance of this class by using the **getProfile()** method. Before using an API of **A2dpSourceProfile**, you need to create an instance of this class by using **getProfile()**.
### connect<a name="a2dp-connect"></a> ### connect<a name="a2dp-connect"></a>
...@@ -1901,7 +1901,7 @@ try { ...@@ -1901,7 +1901,7 @@ try {
## HandsFreeAudioGatewayProfile ## HandsFreeAudioGatewayProfile
Before using a method of **HandsFreeAudioGatewayProfile**, you need to create an instance of this class by using the **getProfile()** method. Before using an API of **HandsFreeAudioGatewayProfile**, you need to create an instance of this class by using **getProfile()**.
### connect<a name="hfp-connect"></a> ### connect<a name="hfp-connect"></a>
...@@ -1994,7 +1994,7 @@ Subscribes to the HFP connection state change events. ...@@ -1994,7 +1994,7 @@ Subscribes to the HFP connection state change events.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- | | -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | Yes | Event type. The value **connectionStateChange** indicates an HFP connection state change event.| | type | string | Yes | Event type. The value **connectionStateChange** indicates an HFP connection state change event. |
| callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | Yes | Callback invoked to return the HFP connection state change event. | | callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | Yes | Callback invoked to return the HFP connection state change event. |
**Example** **Example**
...@@ -2021,7 +2021,7 @@ Unsubscribes from the HFP connection state change events. ...@@ -2021,7 +2021,7 @@ Unsubscribes from the HFP connection state change events.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- | | -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | Yes | Event type. The value **connectionStateChange** indicates an HFP connection state change event.| | type | string | Yes | Event type. The value **connectionStateChange** indicates an HFP connection state change event. |
| callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | No | Callback for the HFP connection state change event. | | callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | No | Callback for the HFP connection state change event. |
**Example** **Example**
...@@ -2136,7 +2136,7 @@ Subscribes to the HidHost connection state change events. ...@@ -2136,7 +2136,7 @@ Subscribes to the HidHost connection state change events.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- | | -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | Yes | Event type. The value **connectionStateChange** indicates a HidHost connection state change event.| | type | string | Yes | Event type. The value **connectionStateChange** indicates a HidHost connection state change event. |
| callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | Yes | Callback invoked to return the HidHost connection state change event. | | callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | Yes | Callback invoked to return the HidHost connection state change event. |
**Example** **Example**
...@@ -2162,7 +2162,7 @@ Unsubscribes from the HidHost connection state change events. ...@@ -2162,7 +2162,7 @@ Unsubscribes from the HidHost connection state change events.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------------- | ---- | --------------------------------------------------------- | | -------- | ----------------------------------------------------- | ---- | --------------------------------------------------------- |
| type | string | Yes | Event type. The value **connectionStateChange** indicates a HidHost connection state change event.| | type | string | Yes | Event type. The value **connectionStateChange** indicates a HidHost connection state change event. |
| callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | No | Callback for the HidHost connection state change event. | | callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | No | Callback for the HidHost connection state change event. |
**Example** **Example**
...@@ -2235,7 +2235,7 @@ Subscribes to the PAN connection state change events. ...@@ -2235,7 +2235,7 @@ Subscribes to the PAN connection state change events.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- | | -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | Yes | Event type. The value **connectionStateChange** indicates an PAN connection state change event. | | type | string | Yes | Event type. The value **connectionStateChange** indicates a PAN connection state change event. |
| callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | Yes | Callback invoked to return the PAN connection state change event. | | callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | Yes | Callback invoked to return the PAN connection state change event. |
**Example** **Example**
...@@ -2261,7 +2261,7 @@ Unsubscribes from the PAN connection state change events. ...@@ -2261,7 +2261,7 @@ Unsubscribes from the PAN connection state change events.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------------- | ---- | --------------------------------------------------------- | | -------- | ----------------------------------------------------- | ---- | --------------------------------------------------------- |
| type | string | Yes | Event type. The value **connectionStateChange** indicates a PAN connection state change event.| | type | string | Yes | Event type. The value **connectionStateChange** indicates a PAN connection state change event. |
| callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | No | Callback for the PAN connection state change event. | | callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | No | Callback for the PAN connection state change event. |
**Example** **Example**
...@@ -2333,17 +2333,6 @@ Obtains the network sharing status. ...@@ -2333,17 +2333,6 @@ Obtains the network sharing status.
| --------------------- | --------------------------------- | | --------------------- | --------------------------------- |
| boolean | Returns **true** if tethering is available over a Bluetooth PAN; return **false** otherwise.| | boolean | Returns **true** if tethering is available over a Bluetooth PAN; return **false** otherwise.|
**Error codes**
For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
| ID| Error Message|
| -------- | ---------------------------- |
|2900001 | Service stopped. |
|2900003 | Bluetooth switch is off. |
|2900004 | Profile is not supported. |
|2900099 | Operation failed. |
**Example** **Example**
```js ```js
...@@ -2358,7 +2347,7 @@ try { ...@@ -2358,7 +2347,7 @@ try {
## GattServer ## GattServer
Implements the Generic Attribute Profile (GATT) server. Before using an API of this class, you need to create a **GattServer** instance using the **createGattServer()** method. Implements the Generic Attribute Profile (GATT) server. Before using an API of this class, you need to create a **GattServer** instance using **createGattServer()**.
### startAdvertising ### startAdvertising
...@@ -2860,7 +2849,7 @@ Subscribes to the descriptor read request events. ...@@ -2860,7 +2849,7 @@ Subscribes to the descriptor read request events.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | --------------------------------- | | -------- | ---------------------------------------- | ---- | --------------------------------- |
| type | string | Yes | Event type. The value **descriptorRead** indicates a descriptor read request event.| | type | string | Yes | Event type. The value **descriptorRead** indicates a descriptor read request event.|
| callback | Callback&lt;[DescriptorReadRequest](#descriptorreadrequest)&gt; | Yes | Callback invoked to return a characteristic read request event from the GATT client. | | callback | Callback&lt;[DescriptorReadRequest](#descriptorreadrequest)&gt; | Yes | Callback invoked to return a descriptor read request event from the GATT client. |
**Example** **Example**
...@@ -3661,7 +3650,7 @@ try { ...@@ -3661,7 +3650,7 @@ try {
on(type: "BLECharacteristicChange", callback: Callback&lt;BLECharacteristic&gt;): void on(type: "BLECharacteristicChange", callback: Callback&lt;BLECharacteristic&gt;): void
Subscribes to the BLE characteristic change events. The client can receive a notification from the server only after the **setNotifyCharacteristicChanged** API is called. Subscribes to the BLE characteristic change events. The client can receive a notification from the server only after **setNotifyCharacteristicChanged** is called.
**Required permissions**: ohos.permission.USE_BLUETOOTH **Required permissions**: ohos.permission.USE_BLUETOOTH
......
...@@ -131,7 +131,7 @@ Sets a session ID for synchronization. Automatic synchronization is performed fo ...@@ -131,7 +131,7 @@ Sets a session ID for synchronization. Automatic synchronization is performed fo
**Error codes** **Error codes**
For details about the error codes, see [Distributed Data Object Error Codes](../errorcodes/errorcode-distributed-dataObject.md). For details about the error codes, see [Distributed Data Object Error Codes](../errorcodes/errorcode-distributed-dataObject.md).
| ID| Error Message| | ID| Error Message|
| -------- | -------- | | -------- | -------- |
...@@ -288,7 +288,7 @@ g_object.off("change"); ...@@ -288,7 +288,7 @@ g_object.off("change");
on(type: 'status', callback: Callback<{ sessionId: string, networkId: string, status: 'online' | 'offline' }>): void on(type: 'status', callback: Callback<{ sessionId: string, networkId: string, status: 'online' | 'offline' }>): void
Subscribes to statue changes of this distributed data object. Subscribes to status changes of this distributed data object.
**System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject **System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject
...@@ -363,7 +363,12 @@ The saved data will be released in the following cases: ...@@ -363,7 +363,12 @@ The saved data will be released in the following cases:
```ts ```ts
g_object.setSessionId("123456"); g_object.setSessionId("123456");
g_object.save("local", (result) => { g_object.save("local", (err, result) => {
if (err) {
console.info("save failed, error code = " + err.code);
console.info("save failed, error message: " + err.message);
return;
}
console.info("save callback"); console.info("save callback");
console.info("save sessionId: " + result.sessionId); console.info("save sessionId: " + result.sessionId);
console.info("save version: " + result.version); console.info("save version: " + result.version);
...@@ -408,8 +413,9 @@ g_object.save("local").then((result) => { ...@@ -408,8 +413,9 @@ g_object.save("local").then((result) => {
console.info("save sessionId " + result.sessionId); console.info("save sessionId " + result.sessionId);
console.info("save version " + result.version); console.info("save version " + result.version);
console.info("save deviceId " + result.deviceId); console.info("save deviceId " + result.deviceId);
}, () => { }).catch((err) => {
console.error("save failed"); console.info("save failed, error code = " + err.code);
console.info("save failed, error message: " + err.message);
}); });
``` ```
...@@ -435,14 +441,24 @@ If the object is stored on another device, the data on the local device will be ...@@ -435,14 +441,24 @@ If the object is stored on another device, the data on the local device will be
```js ```js
g_object.setSessionId("123456"); g_object.setSessionId("123456");
// Save data for persistence. // Save data for persistence.
g_object.save("local", (result) => { g_object.save("local", (err, result) => {
if (err) {
console.info("save failed, error code = " + err.code);
console.info("save failed, error message: " + err.message);
return;
}
console.info("save callback"); console.info("save callback");
console.info("save sessionId " + result.sessionId); console.info("save sessionId: " + result.sessionId);
console.info("save version " + result.version); console.info("save version: " + result.version);
console.info("save deviceId " + result.deviceId); console.info("save deviceId: " + result.deviceId);
}); });
// Delete the persistence data. // Delete the persistence data.
g_object.revokeSave((result) => { g_object.revokeSave((err, result) => {
if (err) {
console.info("revokeSave failed, error code = " + err.code);
console.info("revokeSave failed, error message: " + err.message);
return;
}
console.info("revokeSave callback"); console.info("revokeSave callback");
console.info("revokeSave sessionId " + result.sessionId); console.info("revokeSave sessionId " + result.sessionId);
}); });
...@@ -475,15 +491,17 @@ g_object.save("local").then((result) => { ...@@ -475,15 +491,17 @@ g_object.save("local").then((result) => {
console.info("save sessionId " + result.sessionId); console.info("save sessionId " + result.sessionId);
console.info("save version " + result.version); console.info("save version " + result.version);
console.info("save deviceId " + result.deviceId); console.info("save deviceId " + result.deviceId);
}, () => { }).catch((err) => {
console.error("save failed"); console.info("save failed, error code = " + err.code);
console.info("save failed, error message: " + err.message);
}); });
// Delete the persistence data. // Delete the persistence data.
g_object.revokeSave().then((result) => { g_object.revokeSave().then((result) => {
console.info("revokeSave callback"); console.info("revokeSave callback");
console.info("sessionId" + result.sessionId); console.info("sessionId" + result.sessionId);
}, () => { }).catch((err)=> {
console.error("revokeSave failed"); console.info("revokeSave failed, error code = " + err.code);
console.info("revokeSave failed, error message = " + err.message);
}); });
``` ```
...@@ -612,7 +630,7 @@ Unsubscribes from the data changes of this distributed data object. ...@@ -612,7 +630,7 @@ Unsubscribes from the data changes of this distributed data object.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type to unsubscribe from. The value is **change**, which indicates data changes. | | type | string | Yes| Event type to unsubscribe from. The value is **change**, which indicates data changes.|
| callback | Callback<{ sessionId: string, fields: Array&lt;string&gt; }> | No| Callback for data changes. If this parameter is not specified, all data change callbacks of this distributed data object will be unregistered.<br>**sessionId** indicates the session ID of the distributed data object.<br>**fields** indicates the changed attributes of the distributed data object.| | callback | Callback<{ sessionId: string, fields: Array&lt;string&gt; }> | No| Callback for data changes. If this parameter is not specified, all data change callbacks of this distributed data object will be unregistered.<br>**sessionId** indicates the session ID of the distributed data object.<br>**fields** indicates the changed attributes of the distributed data object.|
...@@ -673,7 +691,7 @@ Unsubscribes from the status change of this distributed data object. ...@@ -673,7 +691,7 @@ Unsubscribes from the status change of this distributed data object.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type to unsubscribe from. The value is **status**, which indicates the status change (online or offline) of the distributed data object. | | type | string | Yes| Event type to unsubscribe from. The value is **status**, which indicates the status change (online or offline) of the distributed data object.|
| callback | Callback<{ sessionId: string, deviceId: string, status: 'online' \| 'offline' }> | No| Callback for status changes. If this parameter is not specified, all status change callbacks of this distributed data object will be unregistered.<br>**sessionId** indicates the session ID of the distributed data object.<br>**deviceId** indicates the device ID of the distributed data object.<br>**status** indicates the object status, which can be online or offline.| | callback | Callback<{ sessionId: string, deviceId: string, status: 'online' \| 'offline' }> | No| Callback for status changes. If this parameter is not specified, all status change callbacks of this distributed data object will be unregistered.<br>**sessionId** indicates the session ID of the distributed data object.<br>**deviceId** indicates the device ID of the distributed data object.<br>**status** indicates the object status, which can be online or offline.|
......
...@@ -3755,7 +3755,7 @@ try { ...@@ -3755,7 +3755,7 @@ try {
sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void
Synchronizes the KV store manually. For details about the synchronization modes of the distributed data service, see [Distributed Data Service Overview](../../database/database-mdds-overview.md). Synchronizes the KV store manually. For details about the synchronization modes of the distributed data service, see [Distributed Data Service Overview](../../database/database-mdds-overview.md).
> **NOTE** > **NOTE**<br/>
> >
> The value of **deviceIds** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications. > The value of **deviceIds** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications.
...@@ -5177,7 +5177,7 @@ sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void ...@@ -5177,7 +5177,7 @@ sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void
Synchronizes the KV store manually. For details about the synchronization modes of the distributed data service, see [Distributed Data Service Overview](../../database/database-mdds-overview.md). Synchronizes the KV store manually. For details about the synchronization modes of the distributed data service, see [Distributed Data Service Overview](../../database/database-mdds-overview.md).
> **NOTE** > **NOTE**<br/>
> >
> The value of **deviceIds** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications. > The value of **deviceIds** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications.
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
The **userIAM.userAuth** module provides user authentication capabilities in identity authentication scenarios, such as device unlocking, payment, and app login. The **userIAM.userAuth** module provides user authentication capabilities in identity authentication scenarios, such as device unlocking, payment, and app login.
> **NOTE**<br> > **NOTE**
>
> The initial APIs of this module are supported since API version 6. 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 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...@@ -399,44 +400,6 @@ try { ...@@ -399,44 +400,6 @@ try {
} }
``` ```
## userIAM_userAuth.getVersion<sup>9+</sup>
getVersion(): number
Obtains the version of this authenticator.
**Required permissions**: ohos.permission.ACCESS_BIOMETRIC
**System capability**: SystemCapability.UserIAM.UserAuth.Core
**Return value**
| Type | Description |
| ------ | ---------------------- |
| number | Authenticator version obtained.|
For details about the error codes, see [User Authentication Error Codes](../errorcodes/errorcode-useriam.md).
**Error codes**
| ID| Error Message|
| -------- | ------- |
| 201 | Permission verification failed. |
| 12500002 | General operation error. |
**Example**
```js
import userIAM_userAuth from '@ohos.userIAM.userAuth';
try {
let version = userIAM_userAuth.getVersion();
console.info("auth version = " + version);
} catch (error) {
console.info("get version failed, error = " + error);
}
```
## userIAM_userAuth.getAvailableStatus<sup>9+</sup> ## userIAM_userAuth.getAvailableStatus<sup>9+</sup>
getAvailableStatus(authType : UserAuthType, authTrustLevel : AuthTrustLevel): void getAvailableStatus(authType : UserAuthType, authTrustLevel : AuthTrustLevel): void
...@@ -535,7 +498,7 @@ getVersion() : number ...@@ -535,7 +498,7 @@ getVersion() : number
Obtains the version of this authenticator. Obtains the version of this authenticator.
> **NOTE**<br> > **NOTE**<br>
> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getVersion](#useriam_userauthgetversion9). > This API is supported since API version 8 and deprecated since API version 9.
**Required permissions**: ohos.permission.ACCESS_BIOMETRIC **Required permissions**: ohos.permission.ACCESS_BIOMETRIC
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册