diff --git a/en/application-dev/database/database-relational-guidelines.md b/en/application-dev/database/database-relational-guidelines.md index fb5e1b12a5bd99385762706a006335985a65f22a..50d34b56ce3309b953285083d9ce97405e0721d2 100644 --- a/en/application-dev/database/database-relational-guidelines.md +++ b/en/application-dev/database/database-relational-guidelines.md @@ -2,7 +2,7 @@ ## When to Use -On the basis of the SQLite database, the relational database (RDB) allows you to operate data with or without native SQL statements. In OpenHarmony, an RDB is also called RDB store. +A relational database (RDB) store allows you to operate local data with or without native SQL statements based on SQLite. ## Available APIs @@ -11,7 +11,7 @@ For details about RDB APIs, see [Relational Database](../reference/apis/js-apis- ### Creating or Deleting an RDB Store -The following table describes the APIs available for creating and deleting an RDB store. +The table below describes the APIs available for creating and deleting an RDB store. **Table 1** APIs for creating and deleting an RDB store @@ -56,8 +56,8 @@ The RDB provides APIs for inserting, deleting, updating, and querying data in th | Class| API| Description| | -------- | -------- | -------- | - | RdbStore | delete(predicates: RdbPredicates, callback: AsyncCallback<number>):void | Deletes data from the database based on the specified **RdbPredicates** object. This API uses an asynchronous callback to return the result.
- **predicates**: conditions for deleting data.
- **callback**: callback invoked to return the number of rows updated.| - | RdbStore | delete(predicates: RdbPredicates): Promise<number> | Deletes data from the database based on the specified **RdbPredicates** object. This API uses a promise to return the result.
- **predicates**: conditions for deleting data.| + | RdbStore | delete(predicates: RdbPredicates, callback: AsyncCallback<number>):void | Deletes data from the RDB store based on the specified **RdbPredicates** object. This API uses an asynchronous callback to return the result.
- **predicates**: conditions for deleting data.
- **callback**: callback invoked to return the number of rows updated.| + | RdbStore | delete(predicates: RdbPredicates): Promise<number> | Deletes data from the RDB store based on the specified **RdbPredicates** object. This API uses a promise to return the result.
- **predicates**: conditions for deleting data.| - **Querying data** @@ -70,8 +70,8 @@ The RDB provides APIs for inserting, deleting, updating, and querying data in th | Class| API| Description| | -------- | -------- | -------- | - | RdbStore | query(predicates: RdbPredicates, columns: Array, callback: AsyncCallback<ResultSet>): void | Queries data in the RDB store based on the specified **RdbPredicates** object. This API uses a callback to return the result.
- **predicates**: conditions for querying data.
- **columns**: columns to query. If this parameter is not specified, the query applies to all columns.
- **callback**: callback invoked to return the result. If the operation is successful, a **ResultSet** object will be returned.| - | RdbStore | query(predicates: RdbPredicates, columns: Array): Promise<ResultSet> | Queries data in the RDB store based on the specified **RdbPredicates** object. This API uses a promise to return the result.
- **predicates**: conditions for querying data.
- **columns**: columns to query. If this parameter is not specified, the query applies to all columns.| + | RdbStore | query(predicates: RdbPredicates, columns: Array<string>, callback: AsyncCallback<ResultSet>): void | Queries data in the RDB store based on the specified **RdbPredicates** object. This API uses a callback to return the result.
- **predicates**: conditions for querying data.
- **columns**: columns to query. If this parameter is not specified, the query applies to all columns.
- **callback**: callback invoked to return the result. If the operation is successful, a **ResultSet** object will be returned.| + | RdbStore | query(predicates: RdbPredicates, columns?: Array<string>): Promise<ResultSet> | Queries data in the RDB store based on the specified **RdbPredicates** object. This API uses a promise to return the result.
- **predicates**: conditions for querying data.
- **columns**: columns to query. If this parameter is not specified, the query applies to all columns.| | RdbStore | querySql(sql: string, bindArgs: Array<ValueType>, callback: AsyncCallback<ResultSet>):void | Queries data in the RDB store using the specified SQL statement. This API uses a callback to return the result.
- **sql**: SQL statement.
- **bindArgs**: arguments in the SQL statement.
- **callback**: callback invoked to return the result. If the operation is successful, a **ResultSet** object will be returned.| | RdbStore | querySql(sql: string, bindArgs?: Array<ValueType>):Promise<ResultSet> | Queries data in the RDB store using the specified SQL statement. This API uses a promise to return the result.
- **sql**: SQL statement.
- **bindArgs**: arguments in the SQL statement.| @@ -167,7 +167,7 @@ You can obtain the distributed table name for a remote device based on the local **Synchronizing Data Between Devices** -**Table 10** APIs for cross-device data synchronization +**Table 10** APIs for synchronizing data between devices | Class| API| Description| | -------- | -------- | -------- | @@ -251,9 +251,9 @@ You can obtain the distributed table name for a remote device based on the local (1) Create an **RdbPredicates** object to specify query conditions. - (2) Call the query() API to query data. + (2) Call the **query()** API to query data. - (3) Call the resultSet() API to obtain the result. + (3) Call the **resultSet()** API to obtain the result. The sample code is as follows: @@ -283,7 +283,7 @@ You can obtain the distributed table name for a remote device based on the local } ``` - (2) Obtain the application permissions. + (2) Obtain the required permissions. (3) Set the distributed tables. diff --git a/en/application-dev/reference/apis/js-apis-bluetooth.md b/en/application-dev/reference/apis/js-apis-bluetooth.md index 42be84f040bf62367601a1a39c640255b6f16b87..5eacfc8a69610d57abec3afdd0fba6f7addaa30b 100644 --- a/en/application-dev/reference/apis/js-apis-bluetooth.md +++ b/en/application-dev/reference/apis/js-apis-bluetooth.md @@ -201,7 +201,7 @@ Obtains the connection state of a profile. | Name | Type | Mandatory | Description | | --------- | --------- | ---- | ------------------------------------- | -| ProfileId | profileId | Yes | ID of the profile to obtain, for example, **PROFILE_A2DP_SOURCE**.| +| ProfileId | profileId | Yes | ID of the target profile, for example, **PROFILE_A2DP_SOURCE**.| **Return value** @@ -447,7 +447,7 @@ Sets the device pairing confirmation. | Name | Type | Mandatory | Description | | ------ | ------- | ---- | -------------------------------- | -| device | string | Yes | Address of the remote device, for example, XX:XX:XX:XX:XX:XX.| +| 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** @@ -1039,9 +1039,9 @@ let a2dpSrc = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_A2DP_SOURCE); ## bluetooth.getProfile9+ -getProfile(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfile | HidHostProfile +getProfile(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfile | HidHostProfile | PanProfile -Obtains a profile instance. **HidHostProfile** is added in API version 9. +Obtains a profile instance. API version 9 is added with **HidHostProfile** and **PanProfile**. **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -1055,7 +1055,7 @@ Obtains a profile instance. **HidHostProfile** is added in API version 9. | Type | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | -| [A2dpSourceProfile](#A2dpSourceProfile), [HandsFreeAudioGatewayProfile](#HandsFreeAudioGatewayProfile), or [HidHostProfile](#HidHostProfile) | Profile object obtained. **A2dpSourceProfile**, **HandsFreeAudioGatewayProfile**, and **HidHostProfile** are supported.| +| [A2dpSourceProfile](#A2dpSourceProfile), [HandsFreeAudioGatewayProfile](#HandsFreeAudioGatewayProfile), [HidHostProfile](#HidHostProfile), or [PanProfile](#PanProfile)| Profile instance obtained, which can be **A2dpSourceProfile**, **HandsFreeAudioGatewayProfile**, **HidHostProfile**, or **PanProfile**.| **Example** @@ -1344,7 +1344,7 @@ Sets up an Advanced Audio Distribution Profile (A2DP) connection. | Name | Type | Mandatory | Description | | ------ | ------ | ---- | ------- | -| device | string | Yes | Address of the remote device to connect.| +| device | string | Yes | Address of the target device.| **Return value** @@ -1374,7 +1374,7 @@ Disconnects an A2DP connection. | Name | Type | Mandatory | Description | | ------ | ------ | ---- | ------- | -| device | string | Yes | Address of the remote device to disconnect.| +| device | string | Yes | Address of the target device.| **Return value** @@ -1737,6 +1737,162 @@ hidHost.off('connectionStateChange', onReceiveEvent); ``` +## PanProfile + +Before using a method of **PanProfile**, you need to create an instance of this class by using the **getProfile()** method. + + +### disconnect9+ + +disconnect(device: string): boolean + +Disconnects from the Personal Area Network (PAN) service of a device. + +This is a system API. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------ | ------ | ---- | ------- | +| device | string | Yes | Address of the target device.| + +**Return value** + +| Type | Description | +| --------------------- | --------------------------------- | +| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + +**Example** + +```js +let panProfile = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_PAN_NETWORK); +let ret = panProfile.disconnect('XX:XX:XX:XX:XX:XX'); +``` + + +### on('connectionStateChange')9+ + +on(type: "connectionStateChange", callback: Callback<[StateChangeParam](#StateChangeParam)>): void + +Subscribes to the PAN connection state change events. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **connectionStateChange** indicates a PAN connection state change event.| +| callback | Callback<[StateChangeParam](#StateChangeParam)> | Yes | Callback used to return the PAN connection state change event. | + +**Return value** + +No value is returned. + +**Example** + +```js +function onReceiveEvent(data) { + console.info('pan state = '+ JSON.stringify(data)); +} +let panProfile = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_PAN_NETWORK); +panProfile.on('connectionStateChange', onReceiveEvent); +``` + + +### off('connectionStateChange')9+ + +off(type: "connectionStateChange", callback?: Callback<[StateChangeParam](#StateChangeParam)>): void + +Unsubscribes from the PAN connection state change events. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ----------------------------------------------------- | ---- | --------------------------------------------------------- | +| type | string | Yes | Event type. The value **connectionStateChange** indicates a PAN connection state change event.| +| callback | Callback<[StateChangeParam](#StateChangeParam)> | No | Callback used to return the PAN connection state change event. | + +**Return value** + +No value is returned. + +**Example** + +```js +function onReceiveEvent(data) { + console.info('pan state = '+ JSON.stringify(data)); +} +let panProfile = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_PAN_NETWORK); +panProfile.on('connectionStateChange', onReceiveEvent); +panProfile.off('connectionStateChange', onReceiveEvent); +``` + + +### setTethering9+ + +setTethering(value: boolean): boolean + +Sets tethering. + +This is a system API. + +**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------ | ------ | ---- | ------- | +| value | boolean | Yes | Whether to set tethering over a Bluetooth PAN.| + +**Return value** + +| Type | Description | +| --------------------- | --------------------------------- | +| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + +**Example** + +```js +let panProfile = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_PAN_NETWORK); +let ret = panProfile.setTethering(true); +``` + + +### isTetheringOn9+ + +isTetheringOn(): boolean + +Obtains the tethering status. + +This is a system API. + +**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Return value** + +| Type | Description | +| --------------------- | --------------------------------- | +| boolean | Returns **true** if tethering is available over a Bluetooth PAN; return **false** otherwise.| + +**Example** + +```js +let panProfile = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_PAN_NETWORK); +let ret = panProfile.isTetheringOn(); +``` + + ## GattServer Implements the Generic Attribute Profile (GATT) server. Before using a method of this class, you need to create a **GattServer** instance using the **createGattServer()** method. @@ -2346,6 +2502,7 @@ let gattServer = bluetooth.BLE.createGattServer(); gattServer.off("descriptorWrite"); ``` + ### on('connectStateChange') on(type: "connectStateChange", callback: Callback<BLEConnectChangedState>): void @@ -2562,7 +2719,7 @@ gattClientDevice.getServices().then(result => { readCharacteristicValue(characteristic: BLECharacteristic, callback: AsyncCallback<BLECharacteristic>): void -Reads the characteristic value of the specific service of the remote BLE device. This API uses an asynchronous callback to return the result. +Reads the characteristic value of the specific service of the peer BLE device. This API uses an asynchronous callback to return the result. **Required permissions**: ohos.permission.USE_BLUETOOTH @@ -2616,7 +2773,7 @@ device.readCharacteristicValue(characteristic, readCcc); readCharacteristicValue(characteristic: BLECharacteristic): Promise<BLECharacteristic> -Reads the characteristic value of the specific service of the remote BLE device. This API uses a promise to return the result. +Reads the characteristic value of the specific service of the peer BLE device. This API uses a promise to return the result. **Required permissions**: ohos.permission.USE_BLUETOOTH @@ -2663,7 +2820,7 @@ device.readCharacteristicValue(characteristic); readDescriptorValue(descriptor: BLEDescriptor, callback: AsyncCallback<BLEDescriptor>): void -Reads the descriptor contained in the specific characteristic of the remote BLE device. This API uses an asynchronous callback to return the result. +Reads the descriptor contained in the specific characteristic of the peer BLE device. This API uses an asynchronous callback to return the result. **Required permissions**: ohos.permission.USE_BLUETOOTH @@ -2707,7 +2864,7 @@ device.readDescriptorValue(descriptor, readDesc); readDescriptorValue(descriptor: BLEDescriptor): Promise<BLEDescriptor> -Reads the descriptor contained in the specific characteristic of the remote BLE device. This API uses a promise to return the result. +Reads the descriptor contained in the specific characteristic of the peer BLE device. This API uses a promise to return the result. **Required permissions**: ohos.permission.USE_BLUETOOTH @@ -3154,7 +3311,7 @@ Enumerates the scan modes. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name | Default Value | Description | +| Name | Default Value | Description | | ---------------------------------------- | ---- | --------------- | | SCAN_MODE_NONE | 0 | No scan mode. | | SCAN_MODE_CONNECTABLE | 1 | Connectable mode. | @@ -3169,7 +3326,7 @@ Enumerates the pairing states. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name | Default Value | Description | +| Name | Default Value | Description | | ------------------ | ---- | ------ | | BOND_STATE_INVALID | 0 | Invalid pairing.| | BOND_STATE_BONDING | 1 | Pairing. | @@ -3195,7 +3352,7 @@ Enumerates the SPP link types. **System capability**: SystemCapability.Communication.Bluetooth.Core -| Name | Default Value | Description | +| Name | Default Value | Description | | ---------- | ---- | ------------- | | SPP_RFCOMM | 0 | Radio frequency communication (RFCOMM) link type.| diff --git a/en/application-dev/reference/apis/js-apis-cardEmulation.md b/en/application-dev/reference/apis/js-apis-cardEmulation.md index 3f0d063a7e435b2f777f79bb6934aaf8d233e13a..7c65ecbd616c0bd3ea8fb0c7f7b12a06b67533d4 100644 --- a/en/application-dev/reference/apis/js-apis-cardEmulation.md +++ b/en/application-dev/reference/apis/js-apis-cardEmulation.md @@ -1,12 +1,12 @@ # Standard NFC Card Emulation -Implements Near-Field Communication (NFC) card emulation. +The cardEmulation module implements Near-Field Communication (NFC) card emulation. > **NOTE**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. -## **Modules to Import** +## Modules to Import ``` import cardEmulation from '@ohos.nfc.cardEmulation';