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

!12777 [翻译完成】#I662OM

Merge pull request !12777 from Annie_wang/PR12476
...@@ -203,15 +203,16 @@ ...@@ -203,15 +203,16 @@
- [@ohos.data.distributedKVStore](js-apis-distributedKVStore.md) - [@ohos.data.distributedKVStore](js-apis-distributedKVStore.md)
- [@ohos.data.preferences](js-apis-data-preferences.md) - [@ohos.data.preferences](js-apis-data-preferences.md)
- [@ohos.data.rdb](js-apis-data-rdb.md) - [@ohos.data.rdb](js-apis-data-rdb.md)
- [@ohos.data.ValuesBucket](js-apis-data-ValuesBucket.md) - [@ohos.data.ValuesBucket](js-apis-data-valuesBucket.md)
- data/rdb/[resultSet](js-apis-data-resultset.md) - data/rdb
- [resultSet](js-apis-data-resultset.md)
- File Management - File Management
- [@ohos.document](js-apis-document.md) - [@ohos.document](js-apis-document.md)
- [@ohos.environment](js-apis-environment.md) - [@ohos.environment](js-apis-environment.md)
- [@ohos.data.fileAccess](js-apis-fileAccess.md) - [@ohos.data.fileAccess](js-apis-fileAccess.md)
- [@ohos.fileExtensionInfo](js-apis-fileExtensionInfo.md) - [@ohos.fileExtensionInfo](js-apis-fileExtensionInfo.md)
- [@ohos.fileio](js-apis-fileio.md) - [@ohos.fileio](js-apis-fileio.md)
- [@ohos.filemanagement.userfile_manager](js-apis-userfilemanager.md) - [@ohos.filemanagement.userFileManager](js-apis-userfilemanager.md)
- [@ohos.multimedia.medialibrary](js-apis-medialibrary.md) - [@ohos.multimedia.medialibrary](js-apis-medialibrary.md)
- [@ohos.securityLabel](js-apis-securityLabel.md) - [@ohos.securityLabel](js-apis-securityLabel.md)
- [@ohos.statfs](js-apis-statfs.md) - [@ohos.statfs](js-apis-statfs.md)
...@@ -240,10 +241,13 @@ ...@@ -240,10 +241,13 @@
- [@ohos.nfc.controller](js-apis-nfcController.md) - [@ohos.nfc.controller](js-apis-nfcController.md)
- [@ohos.nfc.tag](js-apis-nfcTag.md) - [@ohos.nfc.tag](js-apis-nfcTag.md)
- [@ohos.rpc](js-apis-rpc.md) - [@ohos.rpc](js-apis-rpc.md)
- [@ohos.wifiManager (WLAN)](js-apis-wifiManager.md)
- [@ohos.wifiManagerExt](js-apis-wifiManagerExt.md)
- [@ohos.wifi](js-apis-wifi.md) - [@ohos.wifi](js-apis-wifi.md)
- [@ohos.wifiext](js-apis-wifiext.md) - [@ohos.wifiext](js-apis-wifiext.md)
- tag/[nfctech](js-apis-nfctech.md) - tag
- tag/[tagSession](js-apis-tagSession.md) - [nfctech](js-apis-nfctech.md)
- [tagSession](js-apis-tagSession.md)
- Basic Features - Basic Features
- [@ohos.accessibility](js-apis-accessibility.md) - [@ohos.accessibility](js-apis-accessibility.md)
- [@ohos.accessibility.config](js-apis-accessibility-config.md) - [@ohos.accessibility.config](js-apis-accessibility-config.md)
......
# App Account Management # @ohos.account.appAccount
The **appAccount** module provides APIs for adding, deleting, modifying, and querying app account information, and supports inter-app authentication and distributed data synchronization. The **appAccount** module provides APIs for adding, deleting, modifying, and querying app account information, and supports inter-app authentication and distributed data synchronization.
...@@ -3173,7 +3173,7 @@ Set credentials for an app account. This API uses an asynchronous callback to re ...@@ -3173,7 +3173,7 @@ Set credentials for an app account. This API uses an asynchronous callback to re
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------------- | ------------------------- | ---- | ------------- | | -------------- | ------------------------- | ---- | ------------- |
| name | string | Yes | Name of the target app account. | | name | string | Yes | Name of the target app account. |
| credentialType | string | Yes | Type of the credential to delete. | | credentialType | string | Yes | Type of the credential to set. |
| credential | string | Yes | Credential value. | | credential | string | Yes | Credential value. |
| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.| | callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
...@@ -3203,7 +3203,7 @@ Set credentials for an app account. This API uses a promise to return the result ...@@ -3203,7 +3203,7 @@ Set credentials for an app account. This API uses a promise to return the result
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------------- | ------ | ---- | ---------- | | -------------- | ------ | ---- | ---------- |
| name | string | Yes | Name of the target app account. | | name | string | Yes | Name of the target app account. |
| credentialType | string | Yes | Type of the credential to delete.| | credentialType | string | Yes | Type of the credential to set.|
| credential | string | Yes | Credential value.| | credential | string | Yes | Credential value.|
**Return value** **Return value**
...@@ -3576,7 +3576,7 @@ Obtains the credential of an app account. This API uses an asynchronous callback ...@@ -3576,7 +3576,7 @@ Obtains the credential of an app account. This API uses an asynchronous callback
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------------- | --------------------------- | ---- | -------------- | | -------------- | --------------------------- | ---- | -------------- |
| name | string | Yes | Name of the target app account. | | name | string | Yes | Name of the target app account. |
| credentialType | string | Yes | Type of the credential to delete.| | credentialType | string | Yes | Type of the credential to obtain.|
| callback | AsyncCallback<string> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is the credential obtained. Otherwise, **err** is an error object.| | callback | AsyncCallback<string> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is the credential obtained. Otherwise, **err** is an error object.|
**Example** **Example**
...@@ -3606,7 +3606,7 @@ Obtains the credential of an app account. This API uses a promise to return the ...@@ -3606,7 +3606,7 @@ Obtains the credential of an app account. This API uses a promise to return the
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------------- | ------ | ---- | ---------- | | -------------- | ------ | ---- | ---------- |
| name | string | Yes | Name of the target app account. | | name | string | Yes | Name of the target app account. |
| credentialType | string | Yes | Type of the credential to delete.| | credentialType | string | Yes | Type of the credential to obtain.|
**Return value** **Return value**
......
# Bluetooth # @ohos.bluetooth
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**<br> > **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 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.
...@@ -202,7 +203,7 @@ Obtains the connection state of a profile. ...@@ -202,7 +203,7 @@ Obtains the connection state of a profile.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| --------- | --------- | ---- | ------------------------------------- | | --------- | --------- | ---- | ------------------------------------- |
| ProfileId | profileId | Yes | ID of the target profile, for example, **PROFILE_A2DP_SOURCE**.| | ProfileId | profileId | Yes | ID of the profile to obtain, for example, **PROFILE_A2DP_SOURCE**.|
**Return value** **Return value**
...@@ -1280,10 +1281,6 @@ Obtains the connected devices. ...@@ -1280,10 +1281,6 @@ Obtains the connected devices.
**System capability**: SystemCapability.Communication.Bluetooth.Core **System capability**: SystemCapability.Communication.Bluetooth.Core
**Parameters**
No value is returned.
**Return value** **Return value**
| Type | Description | | Type | Description |
...@@ -2695,8 +2692,6 @@ Obtains all services of the remote BLE device. This API uses a promise to return ...@@ -2695,8 +2692,6 @@ Obtains all services of the remote BLE device. This API uses a promise to return
**System capability**: SystemCapability.Communication.Bluetooth.Core **System capability**: SystemCapability.Communication.Bluetooth.Core
**Parameters**
**Return value** **Return value**
| Type | Description | | Type | Description |
...@@ -2830,7 +2825,7 @@ Reads the descriptor contained in the specific characteristic of the remote BLE ...@@ -2830,7 +2825,7 @@ Reads the descriptor contained in the specific characteristic of the remote BLE
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---------- | ---------------------------------------- | ---- | ----------------------- | | ---------- | ---------------------------------------- | ---- | ----------------------- |
| descriptor | [BLEDescriptor](#bledescriptor) | Yes | Descriptor to read. | | descriptor | [BLEDescriptor](#bledescriptor) | Yes | Descriptor to read. |
| callback | AsyncCallback&lt;[BLECharacteristic](#blecharacteristic)&gt; | Yes | Callback invoked to return the descriptor read.| | callback | AsyncCallback&lt;[BLEDescriptor](#bledescriptor)&gt; | Yes | Callback invoked to return the descriptor read.|
**Return value** **Return value**
...@@ -3309,7 +3304,7 @@ Enumerates the scan modes. ...@@ -3309,7 +3304,7 @@ Enumerates the scan modes.
**System capability**: SystemCapability.Communication.Bluetooth.Core **System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Default Value | Description | | Name | Value | Description |
| ---------------------------------------- | ---- | --------------- | | ---------------------------------------- | ---- | --------------- |
| SCAN_MODE_NONE | 0 | No scan mode. | | SCAN_MODE_NONE | 0 | No scan mode. |
| SCAN_MODE_CONNECTABLE | 1 | Connectable mode. | | SCAN_MODE_CONNECTABLE | 1 | Connectable mode. |
...@@ -3324,7 +3319,7 @@ Enumerates the pairing states. ...@@ -3324,7 +3319,7 @@ Enumerates the pairing states.
**System capability**: SystemCapability.Communication.Bluetooth.Core **System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Default Value | Description | | Name | Value | Description |
| ------------------ | ---- | ------ | | ------------------ | ---- | ------ |
| BOND_STATE_INVALID | 0 | Invalid pairing.| | BOND_STATE_INVALID | 0 | Invalid pairing.|
| BOND_STATE_BONDING | 1 | Pairing. | | BOND_STATE_BONDING | 1 | Pairing. |
...@@ -3350,7 +3345,7 @@ Enumerates the SPP link types. ...@@ -3350,7 +3345,7 @@ Enumerates the SPP link types.
**System capability**: SystemCapability.Communication.Bluetooth.Core **System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Default Value | Description | | Name | Value | Description |
| ---------- | ---- | ------------- | | ---------- | ---- | ------------- |
| SPP_RFCOMM | 0 | Radio frequency communication (RFCOMM) link type.| | SPP_RFCOMM | 0 | Radio frequency communication (RFCOMM) link type.|
...@@ -3510,7 +3505,7 @@ Enumerates the profile connection states. ...@@ -3510,7 +3505,7 @@ Enumerates the profile connection states.
**System capability**: SystemCapability.Communication.Bluetooth.Core **System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Default Value | Description | | Name | Value | Description |
| ------------------- | ---- | -------------- | | ------------------- | ---- | -------------- |
| STATE_DISCONNECTED | 0 | Disconnected. | | STATE_DISCONNECTED | 0 | Disconnected. |
| STATE_CONNECTING | 1 | Connecting.| | STATE_CONNECTING | 1 | Connecting.|
...@@ -3558,7 +3553,7 @@ Enumerates the scan duty options. ...@@ -3558,7 +3553,7 @@ Enumerates the scan duty options.
**System capability**: SystemCapability.Communication.Bluetooth.Core **System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Default Value | Description | | Name | Value | Description |
| --------------------- | ---- | ------------ | | --------------------- | ---- | ------------ |
| SCAN_MODE_LOW_POWER | 0 | Low-power mode, which is the default value.| | SCAN_MODE_LOW_POWER | 0 | Low-power mode, which is the default value.|
| SCAN_MODE_BALANCED | 1 | Balanced mode. | | SCAN_MODE_BALANCED | 1 | Balanced mode. |
...@@ -3571,7 +3566,7 @@ Enumerates the hardware match modes of BLE scan filters. ...@@ -3571,7 +3566,7 @@ Enumerates the hardware match modes of BLE scan filters.
**System capability**: SystemCapability.Communication.Bluetooth.Core **System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Default Value | Description | | Name | 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_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. | | MATCH_MODE_STICKY | 2 | Hardware reports the scan result with a higher threshold of signal strength and sightings. |
...@@ -3596,7 +3591,7 @@ Enumerates the Bluetooth states. ...@@ -3596,7 +3591,7 @@ Enumerates the Bluetooth states.
**System capability**: SystemCapability.Communication.Bluetooth.Core **System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Default Value | Description | | Name | Value | Description |
| --------------------- | ---- | ------------------ | | --------------------- | ---- | ------------------ |
| STATE_OFF | 0 | Bluetooth is turned off. | | STATE_OFF | 0 | Bluetooth is turned off. |
| STATE_TURNING_ON | 1 | Bluetooth is being turned on. | | STATE_TURNING_ON | 1 | Bluetooth is being turned on. |
...@@ -3641,7 +3636,7 @@ Defines the content of a BLE advertisement packet. ...@@ -3641,7 +3636,7 @@ Defines the content of a BLE advertisement packet.
| Name | Type | Readable | Writable | Description | | Name | Type | Readable | Writable | Description |
| ---------------- | ------------------- | ---- | ---- | ------------------ | | ---------------- | ------------------- | ---- | ---- | ------------------ |
| manufactureId | Array&lt;string&gt; | Yes | Yes | Manufacturer ID allocated by the Bluetooth SIG.| | manufactureId | number | Yes | Yes | Manufacturer ID allocated by the Bluetooth SIG.|
| manufactureValue | ArrayBuffer | Yes | Yes | Manufacturer data. | | manufactureValue | ArrayBuffer | Yes | Yes | Manufacturer data. |
...@@ -3713,7 +3708,7 @@ Enumerates the major classes of Bluetooth devices. ...@@ -3713,7 +3708,7 @@ Enumerates the major classes of Bluetooth devices.
**System capability**: SystemCapability.Communication.Bluetooth.Core **System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Default Value | Description | | Name | Value | Description |
| ------------------- | ------ | ---------- | | ------------------- | ------ | ---------- |
| MAJOR_MISC | 0x0000 | Miscellaneous device. | | MAJOR_MISC | 0x0000 | Miscellaneous device. |
| MAJOR_COMPUTER | 0x0100 | Computer. | | MAJOR_COMPUTER | 0x0100 | Computer. |
...@@ -3734,7 +3729,7 @@ Enumerates the major and minor classes of Bluetooth devices. ...@@ -3734,7 +3729,7 @@ Enumerates the major and minor classes of Bluetooth devices.
**System capability**: SystemCapability.Communication.Bluetooth.Core **System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Default Value | Description | | Name | Value | Description |
| ---------------------------------------- | ------ | --------------- | | ---------------------------------------- | ------ | --------------- |
| COMPUTER_UNCATEGORIZED | 0x0100 | Unclassified computer. | | COMPUTER_UNCATEGORIZED | 0x0100 | Unclassified computer. |
| COMPUTER_DESKTOP | 0x0104 | Desktop computer. | | COMPUTER_DESKTOP | 0x0104 | Desktop computer. |
...@@ -3830,7 +3825,7 @@ Enumerates the A2DP playing states. ...@@ -3830,7 +3825,7 @@ Enumerates the A2DP playing states.
**System capability**: SystemCapability.Communication.Bluetooth.Core **System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Default Value | Description | | Name | Value | Description |
| ----------------- | ------ | ------- | | ----------------- | ------ | ------- |
| STATE_NOT_PLAYING | 0x0000 | Not playing. | | STATE_NOT_PLAYING | 0x0000 | Not playing. |
| STATE_PLAYING | 0x0001 | Playing.| | STATE_PLAYING | 0x0001 | Playing.|
...@@ -3842,9 +3837,9 @@ Enumerates the Bluetooth profiles. API version 9 is added with **PROFILE_HID_HOS ...@@ -3842,9 +3837,9 @@ Enumerates the Bluetooth profiles. API version 9 is added with **PROFILE_HID_HOS
**System capability**: SystemCapability.Communication.Bluetooth.Core **System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Default Value | Description | | Name | Value | Description |
| -------------------------------- | ------ | --------------- | | -------------------------------- | ------ | --------------- |
| PROFILE_A2DP_SOURCE | 0x0001 | A2DP profile.| | PROFILE_A2DP_SOURCE | 1 | A2DP profile.|
| PROFILE_HANDS_FREE_AUDIO_GATEWAY | 0x0004 | HFP profile. | | PROFILE_HANDS_FREE_AUDIO_GATEWAY | 4 | HFP profile. |
| PROFILE_HID_HOST<sup>9+</sup> | 0x0006 | Human Interface Device (HID) profile. | | PROFILE_HID_HOST<sup>9+</sup> | 6 | Human Interface Device (HID) profile. |
| PROFILE_PAN_NETWORK<sup>9+</sup> | 0x0007 | PAN profile. | | PROFILE_PAN_NETWORK<sup>9+</sup> | 7 | PAN profile. |
# Standard NFC Card Emulation # @ohos.nfc.cardEmulation
The **cardEmulation** module implements Near-Field Communication (NFC) card emulation. You can use the APIs provided by this module to determine the card emulation type supported and implement Host-based Card Emulation (HCE). The **cardEmulation** module implements Near-Field Communication (NFC) card emulation. You can use the APIs provided by this module to determine the card emulation type supported and implement Host-based Card Emulation (HCE).
> **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.
## Modules to Import ## Modules to Import
``` ```
...@@ -18,7 +18,7 @@ Enumerates the NFC card emulation types. ...@@ -18,7 +18,7 @@ Enumerates the NFC card emulation types.
**System capability**: SystemCapability.Communication.NFC.Core **System capability**: SystemCapability.Communication.NFC.Core
| Name| Default Value| Description| | Name| Value| Description|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| HCE | 0 | HCE.| | HCE | 0 | HCE.|
| UICC | 1 | Subscriber identity module (SIM) card emulation.| | UICC | 1 | Subscriber identity module (SIM) card emulation.|
...@@ -30,8 +30,6 @@ isSupported(feature: number): boolean ...@@ -30,8 +30,6 @@ isSupported(feature: number): boolean
Checks whether a certain type of card emulation is supported. Checks whether a certain type of card emulation is supported.
**Required permissions**: ohos.permission.NFC_CARD_EMULATION
**System capability**: SystemCapability.Communication.NFC.Core **System capability**: SystemCapability.Communication.NFC.Core
**Parameters** **Parameters**
...@@ -42,9 +40,9 @@ Checks whether a certain type of card emulation is supported. ...@@ -42,9 +40,9 @@ Checks whether a certain type of card emulation is supported.
**Return value** **Return value**
| **Type**| **Description**| | **Type**| **Description**|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the card emulation type is supported; returns **false** otherwise.| | boolean | Returns **true** if the card emulation type is supported; returns **false** otherwise.|
## HceService<sup>8+</sup> ## HceService<sup>8+</sup>
......
# Active Tag # @ohos.connectedTag
The **connectedTag** module provides methods for using active tags. You can use the APIs provided by this module to initialize the active tag chip and read and write active tags. The **connectedTag** module provides APIs for using active tags. You can use the APIs to initialize the active tag chip and read and write active tags.
> **NOTE**<br> > **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. > 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
``` ```js
import connectedTag from '@ohos.connectedTag'; import connectedTag from '@ohos.connectedTag';
``` ```
## connectedTag.init ## connectedTag.init
init(): boolean init(): boolean
...@@ -23,11 +22,11 @@ Initializes the active tag chip. ...@@ -23,11 +22,11 @@ Initializes the active tag chip.
**System capability**: SystemCapability.Communication.ConnectedTag **System capability**: SystemCapability.Communication.ConnectedTag
- Return value **Return value**
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the initialization is successful; returns **false** otherwise.|
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## connectedTag.uninit ## connectedTag.uninit
...@@ -39,125 +38,136 @@ Uninitializes the active tag resources. ...@@ -39,125 +38,136 @@ Uninitializes the active tag resources.
**System capability**: SystemCapability.Communication.ConnectedTag **System capability**: SystemCapability.Communication.ConnectedTag
- Return value **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.|
## connectedTag.readNdefTag ## connectedTag.readNdefTag
readNdefTag(): Promise&lt;string&gt; readNdefTag(): Promise&lt;string&gt;
Reads the content of this active tag. This method uses a promise to return the result. Reads the content of this active tag. This API uses a promise to return the result.
**Required permissions**: ohos.permission.NFC_TAG **Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.ConnectedTag **System capability**: SystemCapability.Communication.ConnectedTag
- Return value **Return value**
| **Type**| **Description**|
| -------- | -------- |
| Promise&lt;string&gt; | Promise used to return the content of the active tag.|
- Example | **Type**| **Description**|
``` | -------- | -------- |
import connectedTag from '@ohos.connectedTag'; | Promise&lt;string&gt; | Promise used to return the content of the active tag.|
connectedTag.readNdefTag().then(result => { **Example**
console.log("promise recv ndef response: " + result);
}); ```js
``` import connectedTag from '@ohos.connectedTag';
connectedTag.readNdefTag().then((data) => {
console.log("connectedTag readNdefTag Promise data = " + data);
}).catch((err)=> {
console.log("connectedTag readNdefTag Promise err: " + err);
});
```
## connectedTag.readNdefTag ## connectedTag.readNdefTag
readNdefTag(callback: AsyncCallback&lt;string&gt;): void readNdefTag(callback: AsyncCallback&lt;string&gt;): void
Reads the content of this active tag. This method uses an asynchronous callback to return the result. Reads the content of this active tag. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.NFC_TAG **Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.ConnectedTag **System capability**: SystemCapability.Communication.ConnectedTag
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;string&gt; | Yes| Callback invoked to return the active tag content obtained.|
- Example | **Name**| **Type**| **Mandatory**| **Description**|
``` | -------- | -------- | -------- | -------- |
import connectedTag from '@ohos.connectedTag'; | callback | AsyncCallback&lt;string&gt; | Yes| Callback invoked to return the active tag content obtained.|
connectedTag.readNdefTag(result => { **Example**
console.log("callback recv ndef response: " + result);
}); ```js
``` import connectedTag from '@ohos.connectedTag';
connectedTag.readNdefTag((err, data)=> {
if (err) {
console.log("connectedTag readNdefTag AsyncCallback err: " + err);
} else {
console.log("connectedTag readNdefTag AsyncCallback data: " + data);
}
});
```
## connectedTag.writeNdefTag ## connectedTag.writeNdefTag
writeNdefTag(data: string): Promise&lt;void&gt; writeNdefTag(data: string): Promise&lt;void&gt;
Writes data to this active tag. This method uses a promise to return the result. Writes data to this active tag. This API uses a promise to return the result.
**Required permissions**: ohos.permission.NFC_TAG **Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.ConnectedTag **System capability**: SystemCapability.Communication.ConnectedTag
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | **Name**| **Type**| **Mandatory**| **Description**|
| data | string | Yes| Data to write. The maximum length is 1024 bytes.| | -------- | -------- | -------- | -------- |
| data | string | Yes| Data to write. The maximum length is 1024 bytes.|
- Return value
| **Type**| **Description**| **Return value**
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result. This method returns no value.| | **Type**| **Description**|
| -------- | -------- |
- Example | Promise&lt;void&gt; | Promise that returns no value.|
```
import connectedTag from '@ohos.connectedTag'; **Example**
writeNdefTag.write("010203") ```js
.then((value) => { import connectedTag from '@ohos.connectedTag';
// Data is written to the tag.
console.log(`success to write event: ${value}`); var rawData = "010203"; // change it tobe correct.
}).catch((err) => { connectedTag.writeNdefTag(rawData).then(() => {
// Failed to write data to the tag. console.log("connectedTag writeNdefTag Promise success.");
console.error(`failed to write event because ${err.code}`); }).catch((err)=> {
}); console.log("connectedTag writeNdefTag Promise err: " + err);
``` });
```
## connectedTag.writeNdefTag ## connectedTag.writeNdefTag
writeNdefTag(data: string, callback: AsyncCallback&lt;void&gt;): void writeNdefTag(data: string, callback: AsyncCallback&lt;void&gt;): void
Writes data to this active tag. This method uses an asynchronous callback to return the result. Writes data to this active tag. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.NFC_TAG **Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.ConnectedTag **System capability**: SystemCapability.Communication.ConnectedTag
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | **Name**| **Type**| **Mandatory**| **Description**|
| data | string | Yes| Data to write. The maximum length is 1024 bytes.| | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;string&gt; | Yes| Callback invoked to return the active tag content obtained.| | data | string | Yes| Data to write. The maximum length is 1024 bytes.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked to return the active tag content obtained.|
- Example
``` **Example**
import connectedTag from '@ohos.connectedTag';
```js
connectedTag.writeNdefTag("010203", (err, value) => { import connectedTag from '@ohos.connectedTag';
if (err) {
// Failed to write data to the tag. var rawData = "010203"; // change it tobe correct.
console.error(`failed to write event because ${err.code}`); connectedTag.writeNdefTag(rawData, (err)=> {
return; if (err) {
} console.log("connectedTag writeNdefTag AsyncCallback err: " + err);
} else {
// Data is written to the tag. console.log("connectedTag writeNdefTag AsyncCallback success.");
console.log(`success to write event: ${value}`); }
}); });
``` ```
## connectedTag.on('notify') ## connectedTag.on('notify')
...@@ -169,18 +179,12 @@ Registers the NFC field strength state events. ...@@ -169,18 +179,12 @@ Registers the NFC field strength state events.
**System capability**: SystemCapability.Communication.ConnectedTag **System capability**: SystemCapability.Communication.ConnectedTag
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **notify**.|
| callback | Callback&lt;number&gt; | Yes| Callback invoked to return the field strength state.|
- Enumerates the field strength states.
| **Value**| **Description**|
| -------- | -------- |
| 0 | Field off.|
| 1 | Field on.|
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **notify**.|
| callback | Callback&lt;number&gt; | Yes| Callback used to return the [NfcRfType](#nfcrftype).|
## connectedTag.off('notify') ## connectedTag.off('notify')
...@@ -192,36 +196,54 @@ Unregisters the NFC field strength state events. ...@@ -192,36 +196,54 @@ Unregisters the NFC field strength state events.
**System capability**: SystemCapability.Communication.ConnectedTag **System capability**: SystemCapability.Communication.ConnectedTag
- Parameters **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | **Name**| **Type**| **Mandatory**| **Description**|
| type | string | Yes| Event type. The value is **notify**.| | -------- | -------- | -------- | -------- |
| callback | Callback&lt;number&gt; | No| Callback used to return the field strength state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| | type | string | Yes| Event type. The value is **notify**.|
| callback | Callback&lt;number&gt; | No| Callback used to return the field strength state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
- Example
``` **Example**
import connectedTag from '@ohos.connectedTag';
```js
var NFC_RF_NOTIFY = "notify"; import connectedTag from '@ohos.connectedTag';
var recvNfcRfNotifyFunc = result => { // Register the event.
console.info("nfc rf receive state: " + result); connectedTag.on("notify", (err, rfState)=> {
} if (err) {
console.log("connectedTag on Callback err: " + err);
// Register event notification. } else {
connectedTag.on(NFC_RF_NOTIFY, recvNfcRfNotifyFunc); console.log("connectedTag on Callback rfState: " + rfState);
}
// Unregister event notification. });
connectedTag.off(NFC_RF_NOTIFY, recvNfcRfNotifyFunc);
``` var initStatus = connectedTag.init();
console.log("connectedTag init status: " + initStatus);
// Add nfc connecected tag business oprations here...
// connectedTag.writeNdefTag(rawData)
// connectedTag.readNdefTag()
var uninitStatus = connectedTag.uninit();
console.log("connectedTag uninit status: " + uninitStatus);
// Unregister the event.
connectedTag.off("notify", (err, rfState)=> {
if (err) {
console.log("connectedTag off Callback err: " + err);
} else {
console.log("connectedTag off Callback rfState: " + rfState);
}
});
```
## NfcRfType ## NfcRfType
Enumerates the NFC states. Enumerates the NFC field strength states.
**System capability**: SystemCapability.Communication.ConnectedTag **System capability**: SystemCapability.Communication.ConnectedTag
| Name| Default Value| Description| | Name| Value| Description|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| NFC_RF_LEAVE | 0 | Field on.| | NFC_RF_LEAVE | 0 | Field off.|
| NFC_RF_ENTER | 1 | Field on.| | NFC_RF_ENTER | 1 | Field on.|
# Value Bucket # @ohos.data.ValuesBucket
The **ValueBucket** module holds data in key-value (KV) pairs. You can use it to insert data into a database. The **ValueBucket** module holds data in key-value (KV) pairs. You can use it to insert data into a database.
......
# Distributed Account Management # @ohos.account.distributedAccount
The **distributedAccount** module provides APIs for managing distributed accounts, including querying and updating account login status. The **distributedAccount** module provides APIs for managing distributed accounts, including querying and updating account login states.
> **NOTE**<br> > **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 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.
...@@ -49,7 +49,7 @@ Obtains distributed account information. This API uses an asynchronous callback ...@@ -49,7 +49,7 @@ Obtains distributed account information. This API uses an asynchronous callback
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;[DistributedInfo](#distributedinfo)&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **undefined** and data is the distributed account information obtained. Otherwise, **err** is an error object.| | callback | AsyncCallback&lt;[DistributedInfo](#distributedinfo)&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the distributed account information obtained. Otherwise, **err** is an error object.|
**Error codes** **Error codes**
...@@ -124,7 +124,7 @@ Obtains distributed account information. This API uses an asynchronous callback ...@@ -124,7 +124,7 @@ Obtains distributed account information. This API uses an asynchronous callback
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;[DistributedInfo](#distributedinfo)&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **undefined** and data is the distributed account information obtained. Otherwise, **err** is an error object.| | callback | AsyncCallback&lt;[DistributedInfo](#distributedinfo)&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the distributed account information obtained. Otherwise, **err** is an error object.|
**Example** **Example**
```js ```js
...@@ -181,7 +181,7 @@ Sets the distributed account information. This API uses an asynchronous callback ...@@ -181,7 +181,7 @@ Sets the distributed account information. This API uses an asynchronous callback
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| accountInfo | [DistributedInfo](#distributedinfo) | Yes| New distributed account information.| | accountInfo | [DistributedInfo](#distributedinfo) | Yes| Distributed account information to set.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked to return the result. If the distributed account information is set successfully, **err** is **undefined**. Otherwise, **err** is an error object.| | callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked to return the result. If the distributed account information is set successfully, **err** is **undefined**. Otherwise, **err** is an error object.|
**Error codes** **Error codes**
...@@ -219,7 +219,7 @@ Sets the distributed account information. This API uses a promise to return the ...@@ -219,7 +219,7 @@ Sets the distributed account information. This API uses a promise to return the
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| accountInfo | [DistributedInfo](#distributedinfo) | Yes| New distributed account information.| | accountInfo | [DistributedInfo](#distributedinfo) | Yes| Distributed account information to set.|
**Return value** **Return value**
...@@ -322,7 +322,7 @@ Defines distributed OS account information. ...@@ -322,7 +322,7 @@ Defines distributed OS account information.
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| name | string | Yes| Name of the distributed account. It must be a non-null string.| | name | string | Yes| Name of the distributed account. It must be a non-null string.|
| id | string | Yes| UID of the distributed account. It must be a non-null string.| | id | string | Yes| UID of the distributed account. It must be a non-null string.|
| event | string | Yes| Login state of a distributed account. The state can be login, logout, token invalid, or logoff, which correspond to the following strings respectively:<br>-&nbsp;Ohos.account.event.LOGIN<br>-&nbsp;Ohos.account.event.LOGOUT<br>-&nbsp;Ohos.account.event.TOKEN_INVALID<br>-&nbsp;Ohos.account.event.LOGOFF | | event | string | Yes| Login state of the distributed account. The state can be login, logout, token invalid, or logoff, which correspond to the following strings respectively:<br>-&nbsp;Ohos.account.event.LOGIN<br>-&nbsp;Ohos.account.event.LOGOUT<br>-&nbsp;Ohos.account.event.TOKEN_INVALID<br>-&nbsp;Ohos.account.event.LOGOFF |
| nickname<sup>9+</sup> | string | No| Nickname of the distributed account. It must be a non-null string.| | nickname<sup>9+</sup> | string | No| Nickname of the distributed account. It must be a non-null string.|
| avatar<sup>9+</sup> | string | No| Avatar of the distributed account. It must be a non-null string.| | avatar<sup>9+</sup> | string | No| Avatar of the distributed account. It must be a non-null string.|
| scalableData | object | No| Extended information about the distributed account, passed in key-value (KV) pairs.<br>**NOTE**<br>This parameter is reserved and not used in query and update methods.| | scalableData | object | No| Extended information about the distributed account, passed in key-value (KV) pairs.<br>**NOTE**<br>This parameter is reserved and not used in the setters and getters.|
# OS Account Management # @ohos.account.osAccount
The **osAccount** module provides basic capabilities for managing OS accounts, including adding, deleting, querying, setting, subscribing to, and enabling an OS account. The **osAccount** module provides basic capabilities for managing OS accounts, including adding, deleting, querying, setting, subscribing to, and enabling an OS account.
> **NOTE**<br> > **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 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.
...@@ -2708,7 +2709,6 @@ Obtains the constraint source information of an OS account. This API uses a prom ...@@ -2708,7 +2709,6 @@ Obtains the constraint source information of an OS account. This API uses a prom
console.info('queryOsAccountConstraintSourceType exception:' + JSON.stringify(e)); console.info('queryOsAccountConstraintSourceType exception:' + JSON.stringify(e));
} }
``` ```
### isMultiOsAccountEnable<sup>(deprecated)</sup> ### isMultiOsAccountEnable<sup>(deprecated)</sup>
isMultiOsAccountEnable(callback: AsyncCallback&lt;boolean&gt;): void isMultiOsAccountEnable(callback: AsyncCallback&lt;boolean&gt;): void
...@@ -4280,17 +4280,12 @@ Register a PIN inputer. ...@@ -4280,17 +4280,12 @@ Register a PIN inputer.
| ----------| ----------------------- | --- | -------------------------- | | ----------| ----------------------- | --- | -------------------------- |
| inputer | [IInputer](#iinputer8) | Yes | PIN inputer, which is used to obtain the PIN.| | inputer | [IInputer](#iinputer8) | Yes | PIN inputer, which is used to obtain the PIN.|
**Return value**
| Type | Description |
| :------ | :-------------------------------------------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Error codes** **Error codes**
| ID| Error Message | | ID| Error Message |
| -------- | --------------------------- | | -------- | --------------------------- |
| 12300001 | System service exception. | | 12300001 | System service exception. |
| 12300102 | Invalid inputer. |
| 12300103 | Inputer already registered. | | 12300103 | Inputer already registered. |
**Example** **Example**
...@@ -4299,8 +4294,8 @@ Register a PIN inputer. ...@@ -4299,8 +4294,8 @@ Register a PIN inputer.
let password = new Uint8Array([0, 0, 0, 0, 0]); let password = new Uint8Array([0, 0, 0, 0, 0]);
try { try {
let result = pinAuth.registerInputer({ let result = pinAuth.registerInputer({
onGetData: (pinSubType, callback) => { onGetData: (authSubType, callback) => {
callback.onSetData(pinSubType, password); callback.onSetData(authSubType, password);
} }
}); });
console.log('registerInputer result = ' + result); console.log('registerInputer result = ' + result);
...@@ -4327,6 +4322,91 @@ Unregisters this PIN inputer. ...@@ -4327,6 +4322,91 @@ Unregisters this PIN inputer.
pinAuth.unregisterInputer(); pinAuth.unregisterInputer();
``` ```
### InputerManager <sup>10+</sup>
Provides APIs for managing credential inputers.
### registerInputer<sup>10+</sup>
registerInputer(authType: AuthType, inputer: IInputer): void;
Register a credential inputer.
**System API**: This is a system API.
**System capability**: SystemCapability.Account.OsAccount
**Required permissions**: ohos.permission.ACCESS_USER_AUTH_INTERNAL or ohos.permission.MANAGE_USER_IDM
**Parameters**
| Name | Type | Mandatory| Description |
| ----------| ----------------------- | --- | -------------------------- |
| authType | [AuthType](#authtype8) | Yes | Authentication credential type.|
| inputer | [IInputer](#iinputer8) | Yes | Credential inputer to register.|
**Error codes**
| ID| Error Message |
| -------- | --------------------------- |
| 12300001 | System service exception. |
| 12300102 | Invalid authType or inputer. |
| 12300103 | The credential inputer has been registered. |
| 12300106 | Unsupported authType. |
**Example**
```js
let inputerMgr = new account_osAccount.InputerManager();
let authType = account_osAccount.AuthType.DOMAIN;
let password = new Uint8Array([0, 0, 0, 0, 0]);
try {
InputerMgr.registerInputer(authType, {
onGetData: (authSubType, callback) => {
callback.onSetData(authSubType, password);
}
});
console.log('registerInputer success.');
} catch (e) {
console.log('registerInputer exception = ' + JSON.stringify(e));
}
```
### unregisterInputer<sup>10+</sup>
unregisterInputer(authType: AuthType): void;
Unregisters this credential inputer.
**System API**: This is a system API.
**System capability**: SystemCapability.Account.OsAccount
**Required permissions**: ohos.permission.ACCESS_USER_AUTH_INTERNAL or ohos.permission.MANAGE_USER_IDM
**Parameters**
| Name | Type | Mandatory| Description |
| ----------| ----------------------- | --- | -------------------------- |
| authType | [AuthType](#authtype8) | Yes | Authentication credential type.|
**Error codes**
| ID| Error Message |
| -------- | --------------------------- |
| 12300002 | Invalid authType. |
**Example**
```js
let inputerMgr = new account_osAccount.InputerManager();
let authType = account_osAccount.AuthType.DOMAIN;
try {
inputerMgr.unregisterInputer(authType);
console.log('unregisterInputer success.');
} catch(err) {
console.log("unregisterInputer err:" + JSON.stringify(err));
}
```
## UserIdentityManager<sup>8+</sup> ## UserIdentityManager<sup>8+</sup>
Provides APIs for user identity management (IDM). Provides APIs for user identity management (IDM).
...@@ -4456,8 +4536,8 @@ Adds credential information, including the credential type, subtype, and token ( ...@@ -4456,8 +4536,8 @@ Adds credential information, including the credential type, subtype, and token (
let password = new Uint8Array([0, 0, 0, 0, 0, 0]); let password = new Uint8Array([0, 0, 0, 0, 0, 0]);
let pinAuth = new account_osAccount.PINAuth(); let pinAuth = new account_osAccount.PINAuth();
pinAuth.registerInputer({ pinAuth.registerInputer({
onGetData: (pinSubType, callback) => { onGetData: (authSubType, callback) => {
callback.onSetData(pinSubType, password); callback.onSetData(authSubType, password);
} }
}); });
let credentialInfo = { let credentialInfo = {
...@@ -4470,12 +4550,12 @@ Adds credential information, including the credential type, subtype, and token ( ...@@ -4470,12 +4550,12 @@ Adds credential information, including the credential type, subtype, and token (
try { try {
userIDM.addCredential(credentialInfo, { userIDM.addCredential(credentialInfo, {
onResult: (result, extraInfo) => { onResult: (result, extraInfo) => {
console.log('updateCredential result = ' + result); console.log('addCredential result = ' + result);
console.log('updateCredential extraInfo = ' + extraInfo); console.log('addCredential extraInfo = ' + extraInfo);
} }
}); });
} catch (e) { } catch (e) {
console.log('updateCredential exception = ' + JSON.stringify(e)); console.log('addCredential exception = ' + JSON.stringify(e));
} }
}); });
``` ```
...@@ -4520,8 +4600,8 @@ Updates credential information. This API uses a callback to return the result. ...@@ -4520,8 +4600,8 @@ Updates credential information. This API uses a callback to return the result.
token: null token: null
}; };
pinAuth.registerInputer({ pinAuth.registerInputer({
onGetData: (pinSubType, callback) => { onGetData: (authSubType, callback) => {
callback.onSetData(pinSubType, password); callback.onSetData(authSubType, password);
} }
}); });
userIDM.openSession((err, challenge) => { userIDM.openSession((err, challenge) => {
...@@ -4820,7 +4900,7 @@ Provides callbacks for PIN operations. ...@@ -4820,7 +4900,7 @@ Provides callbacks for PIN operations.
### onSetData<sup>8+</sup> ### onSetData<sup>8+</sup>
onSetData: (pinSubType: AuthSubType, data: Uint8Array) => void; onSetData: (authSubType: AuthSubType, data: Uint8Array) => void;
**System API**: This is a system API. **System API**: This is a system API.
...@@ -4832,7 +4912,7 @@ Called to set data in a PIN operation. ...@@ -4832,7 +4912,7 @@ Called to set data in a PIN operation.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------- | ---------------------------------------- | ---- | ----------------------------------------------- | | ---------- | ---------------------------------------- | ---- | ----------------------------------------------- |
| pinSubType | [AuthSubType](#authsubtype8) | Yes | Credential subtype. | | authSubType | [AuthSubType](#authsubtype8) | Yes | Credential subtype. |
| data | Uint8Array | Yes | Data (credential) to set. The data is used for authentication and operations for adding and modifying credentials.| | data | Uint8Array | Yes | Data (credential) to set. The data is used for authentication and operations for adding and modifying credentials.|
**Example** **Example**
...@@ -4840,11 +4920,11 @@ Called to set data in a PIN operation. ...@@ -4840,11 +4920,11 @@ Called to set data in a PIN operation.
let password = new Uint8Array([0, 0, 0, 0, 0, 0]); let password = new Uint8Array([0, 0, 0, 0, 0, 0]);
let passwordNumber = new Uint8Array([1, 2, 3, 4]); let passwordNumber = new Uint8Array([1, 2, 3, 4]);
let inputer = { let inputer = {
onGetData: (pinSubType, callback) => { onGetData: (authSubType, callback) => {
if (pinSubType == account_osAccount.AuthSubType.PIN_NUMBER) { if (authSubType == account_osAccount.AuthSubType.PIN_NUMBER) {
callback.onSetData(pinSubType, passwordNumber); callback.onSetData(authSubType, passwordNumber);
} else { } else {
callback.onSetData(pinSubType, password); callback.onSetData(authSubType, password);
} }
} }
}; };
...@@ -4852,13 +4932,13 @@ Called to set data in a PIN operation. ...@@ -4852,13 +4932,13 @@ Called to set data in a PIN operation.
## IInputer<sup>8+</sup> ## IInputer<sup>8+</sup>
Provides callbacks for the PIN input box. Provides callbacks for credential inputers.
**System API**: This is a system API. **System API**: This is a system API.
### onGetData<sup>8+</sup> ### onGetData<sup>8+</sup>
onGetData: (pinSubType: AuthSubType, callback: IInputData) => void; onGetData: (authSubType: AuthSubType, callback: IInputData) => void;
Called to obtain data. Called to obtain data.
...@@ -4877,11 +4957,11 @@ Called to obtain data. ...@@ -4877,11 +4957,11 @@ Called to obtain data.
let password = new Uint8Array([0, 0, 0, 0, 0, 0]); let password = new Uint8Array([0, 0, 0, 0, 0, 0]);
let passwordNumber = new Uint8Array([1, 2, 3, 4]); let passwordNumber = new Uint8Array([1, 2, 3, 4]);
let inputer = { let inputer = {
onGetData: (pinSubType, callback) => { onGetData: (authSubType, callback) => {
if (pinSubType == account_osAccount.AuthSubType.PIN_NUMBER) { if (authSubType == account_osAccount.AuthSubType.PIN_NUMBER) {
callback.onSetData(pinSubType, passwordNumber); callback.onSetData(authSubType, passwordNumber);
} else { } else {
callback.onSetData(pinSubType, password); callback.onSetData(authSubType, password);
} }
} }
}; };
...@@ -5157,6 +5237,8 @@ Enumerates the authentication credential types. ...@@ -5157,6 +5237,8 @@ Enumerates the authentication credential types.
| ----- | ----- | ---------------- | | ----- | ----- | ---------------- |
| PIN | 1 | PIN authentication.| | PIN | 1 | PIN authentication.|
| FACE | 2 | Facial authentication.| | FACE | 2 | Facial authentication.|
| FINGERPRINT<sup>10+</sup> | 4 | Fingerprint authentication.|
| DOMAIN<sup>10+</sup> | 1024 | Domain authentication.|
## AuthSubType<sup>8+</sup> ## AuthSubType<sup>8+</sup>
...@@ -5170,9 +5252,10 @@ Enumerates the authentication credential subtypes. ...@@ -5170,9 +5252,10 @@ Enumerates the authentication credential subtypes.
| ---------- | ----- | ------------------ | | ---------- | ----- | ------------------ |
| PIN_SIX | 10000 | Six-digit PIN. | | PIN_SIX | 10000 | Six-digit PIN. |
| PIN_NUMBER | 10001 | Custom PIN.| | PIN_NUMBER | 10001 | Custom PIN.|
| PIN_MIXED | 10002 | Custom mixed credential.| | PIN_MIXED | 10002 | Custom mixed credentials.|
| FACE_2D | 20000 | 2D face credential. | | FACE_2D | 20000 | 2D face credential. |
| FACE_3D | 20001 | 3D face credential. | | FACE_3D | 20001 | 3D face credential. |
| DOMAIN_MIXED<sup>10+</sup> | 10240001 | Mixed domain authentication credentials. |
## AuthTrustLevel<sup>8+</sup> ## AuthTrustLevel<sup>8+</sup>
......
# RPC # @ohos.rpc
The **RPC** module implements communication between processes, including inter-process communication (IPC) on a single device and remote procedure call (RPC) between processes on difference devices. IPC is implemented based on the Binder driver, and RPC is based on the DSoftBus driver. The **RPC** module implements communication between processes, including inter-process communication (IPC) on a single device and remote procedure call (RPC) between processes on difference devices. IPC is implemented based on the Binder driver, and RPC is based on the DSoftBus driver.
> **NOTE**<br> > **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 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.
>
> This module supports return of error codes since API version 9. > This module supports return of error codes since API version 9.
...@@ -24,7 +26,7 @@ The APIs of this module return exceptions since API version 9. The following tab ...@@ -24,7 +26,7 @@ The APIs of this module return exceptions since API version 9. The following tab
| ------------------------------------- | ------- | --------------------------------------------- | | ------------------------------------- | ------- | --------------------------------------------- |
| CHECK_PARAM_ERROR | 401 | Parameter check failed. | | CHECK_PARAM_ERROR | 401 | Parameter check failed. |
| OS_MMAP_ERROR | 1900001 | Failed to call mmap. | | OS_MMAP_ERROR | 1900001 | Failed to call mmap. |
| OS_IOCTL_ERROR | 1900002 | Failed to execute **ioctl** with the shared memory file descriptor.| | OS_IOCTL_ERROR | 1900002 | Failed to call **ioctl** with the shared memory file descriptor.|
| WRITE_TO_ASHMEM_ERROR | 1900003 | Failed to write data to the shared memory. | | WRITE_TO_ASHMEM_ERROR | 1900003 | Failed to write data to the shared memory. |
| READ_FROM_ASHMEM_ERROR | 1900004 | Failed to read data from the shared memory. | | READ_FROM_ASHMEM_ERROR | 1900004 | Failed to read data from the shared memory. |
| ONLY_PROXY_OBJECT_PERMITTED_ERROR | 1900005 | This operation is allowed only on the proxy object. | | ONLY_PROXY_OBJECT_PERMITTED_ERROR | 1900005 | This operation is allowed only on the proxy object. |
...@@ -123,7 +125,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode ...@@ -123,7 +125,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode
readRemoteObject(): IRemoteObject readRemoteObject(): IRemoteObject
Reads a remote object from **MessageSequence**. You can use this API to deserialize the **MessageSequence** object to generate an **IRemoteObject**. The remote object is read in the order in which it is written to this **MessageSequence** object. Reads the remote object from **MessageSequence**. You can use this API to deserialize the **MessageSequence** object to generate an **IRemoteObject**. The remote object is read in the order in which it is written to this **MessageSequence** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
...@@ -405,7 +407,7 @@ Obtains the read position of this **MessageSequence** object. ...@@ -405,7 +407,7 @@ Obtains the read position of this **MessageSequence** object.
| Type| Description| | Type| Description|
| ------ | ------ | | ------ | ------ |
| number | Current read position of the **MessageSequence** object.| | number | Read position obtained.|
**Example** **Example**
...@@ -427,7 +429,7 @@ Obtains the write position of this **MessageSequence** object. ...@@ -427,7 +429,7 @@ Obtains the write position of this **MessageSequence** object.
| Type| Description| | Type| Description|
| ------ | ----- | | ------ | ----- |
| number | Current write position of the **MessageSequence** object.| | number | Write position obtained.|
**Example** **Example**
...@@ -504,7 +506,7 @@ Moves the write pointer to the specified position. ...@@ -504,7 +506,7 @@ Moves the write pointer to the specified position.
writeByte(val: number): void writeByte(val: number): void
Writes a Byte value to this **MessageSequence** object. Writes a byte value to this **MessageSequence** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
...@@ -538,7 +540,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode ...@@ -538,7 +540,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode
readByte(): number readByte(): number
Reads the Byte value from this **MessageSequence** object. Reads the byte value from this **MessageSequence** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
...@@ -2856,7 +2858,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode ...@@ -2856,7 +2858,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode
readFileDescriptor(): number readFileDescriptor(): number
Reads a file descriptor from this **MessageSequence** object. Reads the file descriptor from this **MessageSequence** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
...@@ -4017,7 +4019,7 @@ Writes a string to this **MessageParcel** object. ...@@ -4017,7 +4019,7 @@ Writes a string to this **MessageParcel** object.
readString(): string readString(): string
Reads a string from this **MessageParcel** object. Reads the string from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
......
# NFC Tag Session # tagSession
The **tagSession** module provides common APIs for establishing connections and transferring data. The **tagSession** module provides common APIs for establishing connections and transferring data.
> **NOTE**<br> > **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 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.
## **Modules to Import** ## **Modules to Import**
...@@ -15,17 +16,15 @@ import tag from '@ohos.nfc.tag'; ...@@ -15,17 +16,15 @@ import tag from '@ohos.nfc.tag';
Provides common APIs for establishing connections and transferring data. **tagSession** is the base class of all [NFC tag technologies](js-apis-nfctech.md). Provides common APIs for establishing connections and transferring data. **tagSession** is the base class of all [NFC tag technologies](js-apis-nfctech.md).
A child class instance is required to access the following interfaces. You can use **get**XX**Tag()** to obtain a child class instance. A child class instance is required to access the following interfaces. You can use **get**XXX() to obtain a child class instance.
The specific API varies with the NFC tag technology in use. For details, see [NFC Tags](js-apis-nfcTag.md). The specific API varies with the NFC tag technology in use. For details, see [NFC Tags](js-apis-nfcTag.md).
### tagSession.connectTag ### tagSession.getTagInfo
connectTag(): boolean;
Connects to this tag. getTagInfo(): tag.TagInfo
Call this API to set up a connection before reading data from or writing data to a tag. Obtains the **tagInfo** object provided by the NFC service when the tag is dispatched.
**Required permissions**: ohos.permission.NFC_TAG **Required permissions**: ohos.permission.NFC_TAG
...@@ -35,23 +34,25 @@ Call this API to set up a connection before reading data from or writing data to ...@@ -35,23 +34,25 @@ Call this API to set up a connection before reading data from or writing data to
| **Type**| **Description** | | **Type**| **Description** |
| ------------------ | --------------------------| | ------------------ | --------------------------|
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | TagInfo | **Taginfo** object obtained.|
**Example** **Example**
```js ```js
import tag from '@ohos.nfc.tag'; import tag from '@ohos.nfc.tag';
// tagInfo is an object given by the NFC service when a tag is dispatched. // tagInfo is an object provided by the NFC service when a tag is dispatched.
let isNfcConnected = tag.getXXXTag(taginfo).connectTag(); // getXXX can be getIsoDep, getNdef, getMifareClassic, or any other getter for NFC tags.
console.log("isNfcConnected:" +isNfcConnected);
let tagInfo = tag.getIsoDep(tagInfo).getTagInfo();
console.log("tag tagInfo: " + tagInfo);
``` ```
### tagSession.reset() ### tagSession.connectTag
reset(): void connectTag(): boolean;
Resets the connection to this tag and restores the default timeout duration for writing data to the tag. Connects to this tag. Call this API to set up a connection before reading data from or writing data to a tag.
**Required permissions**: ohos.permission.NFC_TAG **Required permissions**: ohos.permission.NFC_TAG
...@@ -68,9 +69,32 @@ Resets the connection to this tag and restores the default timeout duration for ...@@ -68,9 +69,32 @@ Resets the connection to this tag and restores the default timeout duration for
```js ```js
import tag from '@ohos.nfc.tag'; import tag from '@ohos.nfc.tag';
// tagInfo is an object given by the NFC service when a tag is dispatched. // tagInfo is an object provided by the NFC service when a tag is dispatched.
let reset = tag.getXXXTag(taginfo).reset(); // getXXX can be getIsoDep, getNdef, getMifareClassic, or any other getter for NFC tags.
console.log("reset:" +reset);
let connectStatus = tag.getIsoDep(tagInfo).connectTag();
console.log("connectStatus: " + connectStatus);
```
### tagSession.reset()
reset(): void
Resets the connection to this tag.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**Example**
```js
import tag from '@ohos.nfc.tag';
// tagInfo is an object provided by the NFC service when a tag is dispatched.
// getXXX can be getIsoDep, getNdef, getMifareClassic, or any other getter for NFC tags.
tag.getIsoDep(tagInfo).reset();
``` ```
### tagSession.isTagConnected ### tagSession.isTagConnected
...@@ -94,16 +118,18 @@ Checks whether the tag is connected. ...@@ -94,16 +118,18 @@ Checks whether the tag is connected.
```js ```js
import tag from '@ohos.nfc.tag'; import tag from '@ohos.nfc.tag';
// tagInfo is an object given by the NFC service when a tag is dispatched. // tagInfo is an object provided by the NFC service when a tag is dispatched.
let isTagConnected = tag.getXXXTag(taginfo).isTagConnected(); // getXXX can be getIsoDep, getNdef, getMifareClassic, or any other getter for NFC tags.
console.log("isTagConnected:" +isTagConnected);
let isTagConnected = tag.getIsoDep(tagInfo).isTagConnected();
console.log("isTagConnected: " + isTagConnected);
``` ```
### tagSession.getMaxSendLength ### tagSession.getMaxSendLength
getMaxSendLength(): number getMaxSendLength(): number
Obtains the maximum length of the data that can be sent to the tag. Obtains the maximum length of the data that can be sent to this tag.
**Required permissions**: ohos.permission.NFC_TAG **Required permissions**: ohos.permission.NFC_TAG
...@@ -113,14 +139,167 @@ Obtains the maximum length of the data that can be sent to the tag. ...@@ -113,14 +139,167 @@ Obtains the maximum length of the data that can be sent to the tag.
| **Type**| **Description** | | **Type**| **Description** |
| ------------------ | --------------------------| | ------------------ | --------------------------|
| number | Maximum data length obtained.| | number | Maximum data length obtained. The value cannot be a negative number.|
**Example**
```js
import tag from '@ohos.nfc.tag';
// tagInfo is an object provided by the NFC service when a tag is dispatched.
// getXXX can be getIsoDep, getNdef, getMifareClassic, or any other getter for NFC tags.
let maxSendLen = tag.getIsoDep(tagInfo).getMaxSendLength();
console.log("tag maxSendLen: " + maxSendLen);
```
### tagSession.getSendDataTimeout
getSendDataTimeout(): number
Obtains the timeout period for sending data to this tag, in milliseconds.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**Return value**
| **Type**| **Description** |
| ------------------ | --------------------------|
| number | Timeout period obtained, in milliseconds. The value cannot be a negative number.|
**Example**
```js
import tag from '@ohos.nfc.tag';
// tagInfo is an object provided by the NFC service when a tag is dispatched.
// getXXX can be getIsoDep, getNdef, getMifareClassic, or any other getter for NFC tags.
let sendDataTimeout = tag.getIsoDep(tagInfo).getSendDataTimeout();
console.log("tag sendDataTimeout: " + sendDataTimeout);
```
### tagSession.setSendDataTimeout
setSendDataTimeout(timeout: number): boolean
Sets the timeout period for sending data to this tag, in milliseconds.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ----------------------- | ---- | -------------------------------------- |
| timeout | number | Yes| Timeout period to set, in milliseconds. The value cannot be a negative number.|
**Return value**
| **Type**| **Description** |
| ------------------ | --------------------------|
| boolean | Returns **true** if the timeout period is set successfully; returns **false** otherwise.|
**Example**
```js
import tag from '@ohos.nfc.tag';
// tagInfo is an object provided by the NFC service when a tag is dispatched.
// getXXX can be getIsoDep, getNdef, getMifareClassic, or any other getter for NFC tags.
let timeoutMs = 700; // Change it as required.
let setStatus = tag.getIsoDep(tagInfo).setSendDataTimeout(timeoutMs);
console.log("tag setSendDataTimeout setStatus: " + setStatus);
```
### tagSession.sendData
sendData(data: number[]): Promise<number[]>
Sends data to this tag. This API uses a promise to return the result.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ----------------------- | ---- | -------------------------------------- |
| data | number[] | Yes| Data to send. The data consists of hexadecimal numbers ranging from **0x00** to **0xFF**.|
**Return value**
| **Type**| **Description** |
| ------------------ | --------------------------|
| Promise<number[]> | Promise used to return the response from the tag. The response consists of hexadecimal numbers ranging from **0x00** to **0xFF**.|
**Example**
```js
import tag from '@ohos.nfc.tag';
// tagInfo is an object provided by the NFC service when a tag is dispatched.
// getXXX can be getIsoDep, getNdef, getMifareClassic, or any other getter for NFC tags.
// Connect to the tag if it is not connected.
if (!tag.getIsoDep(tagInfo).isTagConnected()) {
if (!tag.getIsoDep(tagInfo).connectTag()) {
console.log("tagSession connectTag failed.");
return;
}
}
let cmdData = [0x01, 0x02, 0x03, 0x04]; // Change it as required.
tag.getIsoDep(tagInfo).sendData(cmdData).then((response) => {
console.log("tagSession sendData Promise response: " + response);
}).catch((err)=> {
console.log("tagSession sendData Promise err: " + err);
});
```
### tagSession.sendData
sendData(data: number[], callback: AsyncCallback<number[]>): void
Sends data to this tag. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ----------------------- | ---- | -------------------------------------- |
| data | number[] | Yes| Data to send. The data consists of hexadecimal numbers ranging from **0x00** to **0xFF**.|
| callback | AsyncCallback<number[]> | Yes| Callback invoked to return the response from the tag. The response consists of hexadecimal numbers ranging from **0x00** to **0xFF**.|
**Example** **Example**
```js ```js
import tag from '@ohos.nfc.tag'; import tag from '@ohos.nfc.tag';
// tagInfo is an object given by the NFC service when a tag is dispatched. // tagInfo is an object provided by the NFC service when a tag is dispatched.
let mazSendLen = tag.getXXXTag(taginfo).getMaxSendLength(); // getXXX can be getIsoDep, getNdef, getMifareClassic, or any other getter for NFC tags.
console.log("mazSendLen:" +mazSendLen);
// Connect to the tag if it is not connected.
if (!tag.getIsoDep(tagInfo).isTagConnected()) {
if (!tag.getIsoDep(tagInfo).connectTag()) {
console.log("tagSession connectTag failed.");
return;
}
}
let cmdData = [0x01, 0x02, 0x03, 0x04]; // Change it as required.
tag.getIsoDep(tagInfo).sendData(cmdData, (err, response)=> {
if (err) {
console.log("tagSession sendData AsyncCallback err: " + err);
} else {
console.log("tagSession sendData AsyncCallback response: " + response);
}
});
``` ```
# WLAN Extension Interface
This **wifiext** module provides WLAN extension interfaces for non-universal products.
> **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.
The APIs described in this document are used only for non-universal products, such as routers.
## Modules to Import
```js
import wifiManagerExt from '@ohos.wifiManagerExt';
```
## wifiext.enableHotspot
enableHotspot(): boolean;
Enables the WLAN hotspot.
**Required permissions**: ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
**Return value**
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## wifiext.disableHotspot
disableHotspot(): boolean;
Disables the WLAN hotspot.
**Required permissions**: ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
**Return value**
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## wifiext.getSupportedPowerModel
getSupportedPowerModel(): Promise&lt;Array&lt;PowerModel&gt;&gt;
Obtains the supported power models. This API uses a promise to return the result.
**Required permissions**: ohos.permission.GET_WIFI_INFO
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;Array&lt;[PowerModel](#powermodel)&gt;&gt; | Promise used to return the power models obtained.|
## PowerModel
Enumerates the power models.
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
| Name| Value| Description|
| -------- | -------- | -------- |
| SLEEPING | 0 | Sleeping|
| GENERAL | 1 | General|
| THROUGH_WALL | 2 | Through_wall|
## wifiext.getSupportedPowerModel
getSupportedPowerModel(callback: AsyncCallback&lt;Array&lt;PowerModel&gt;&gt;): void
Obtains the supported power models. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.GET_WIFI_INFO
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;Array&lt;[PowerModel](#powermodel)&gt;&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is 0 and **data** is the power models obtained. If **err** is not **0**, an error has occurred.|
## wifiext.getPowerModel
getPowerModel(): Promise&lt;PowerModel&gt;
Obtains the power model. This API uses a promise to return the result.
**Required permissions**: ohos.permission.GET_WIFI_INFO
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;[PowerModel](#powermodel)&gt; | Promise used to return the power model obtained.|
## wifiext.getPowerModel
getPowerModel(callback: AsyncCallback&lt;PowerModel&gt;): void
Obtains the power model. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.GET_WIFI_INFO
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;[PowerModel](#powermodel)&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the power model obtained. If **err** is not **0**, an error has occurred.|
## wifiext.setPowerModel
setPowerModel(model: PowerModel) : boolean;
Sets the power model.
**Required permissions**: ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| model | [PowerModel](#powermodel) | Yes| Power model to set.|
**Return value**
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册