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

!19412 [翻译完成】#I78EX8

Merge pull request !19412 from Annie_wang/PR18638A
...@@ -17,16 +17,15 @@ import cardEmulation from '@ohos.nfc.cardEmulation'; ...@@ -17,16 +17,15 @@ import cardEmulation from '@ohos.nfc.cardEmulation';
Enumerates the NFC card emulation types. Enumerates the NFC card emulation types.
> **NOTE** > **NOTE**
>
> This parameter is supported since API version 6 and deprecated since API version 9. You are advised to use [hasHceCapability](#hashcecapability9). > This parameter is supported since API version 6 and deprecated since API version 9. You are advised to use [hasHceCapability](#hashcecapability9).
**System capability**: SystemCapability.Communication.NFC.CardEmulation **System capability**: SystemCapability.Communication.NFC.CardEmulation
| Name| 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.|
| ESE | 2 | embedded Secure Element (eSE) emulation.| | ESE | 2 | embedded Secure Element (eSE) emulation. |
## CardType<sup>9+</sup> ## CardType<sup>9+</sup>
...@@ -34,10 +33,10 @@ Enumerates the types of services used by the card emulation application. ...@@ -34,10 +33,10 @@ Enumerates the types of services used by the card emulation application.
**System capability**: SystemCapability.Communication.NFC.CardEmulation **System capability**: SystemCapability.Communication.NFC.CardEmulation
| Name| Value| Description| | Name | Value | Description |
| -------- | -------- | -------- | | ------- | --------- | ----------------- |
| PAYMENT | "payment" | Payment type.| | PAYMENT | "payment" | Payment type.|
| OTHER | "other" | Other types.| | OTHER | "other" | Other types.|
## isSupported ## isSupported
...@@ -46,21 +45,20 @@ isSupported(feature: number): boolean ...@@ -46,21 +45,20 @@ isSupported(feature: number): boolean
Checks whether a certain type of card emulation is supported. Checks whether a certain type of card emulation is supported.
> **NOTE** > **NOTE**
>
> This parameter is supported since API version 6 and deprecated since API version 9. You are advised to use [hasHceCapability](#hashcecapability9). > This parameter is supported since API version 6 and deprecated since API version 9. You are advised to use [hasHceCapability](#hashcecapability9).
**System capability**: SystemCapability.Communication.NFC.CardEmulation **System capability**: SystemCapability.Communication.NFC.CardEmulation
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory | Description |
| ------- | -------- | ---- | ----------------------- | | ------- | ------ | ---- | ---------------------------------------- |
| feature | number | Yes | Card emulation type. For details, see [FeatureType](#featuretype).| | feature | number | Yes | Card emulation type. For details, see [FeatureType](#featuretype).|
**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.|
## hasHceCapability<sup>9+</sup> ## hasHceCapability<sup>9+</sup>
...@@ -75,8 +73,8 @@ Checks whether HCE is supported. ...@@ -75,8 +73,8 @@ Checks whether HCE is supported.
**Return value** **Return value**
| **Type**| **Description**| | **Type** | **Description** |
| -------- | -------- | | ------- | -------------------------------- |
| boolean | Returns **true** if HCE is supported; returns **false** otherwise.| | boolean | Returns **true** if HCE is supported; returns **false** otherwise.|
## isDefaultService<sup>9+</sup> ## isDefaultService<sup>9+</sup>
...@@ -91,15 +89,15 @@ Checks whether an application is the default application of the specified servic ...@@ -91,15 +89,15 @@ Checks whether an application is the default application of the specified servic
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory | Description |
| ------- | -------- | ---- | ----------------------- | | ----------- | ---------------------------------------- | ---- | ----------------------- |
| elementName | [ElementName](js-apis-bundleManager-elementName.md#elementname) | Yes| Application description, which consists of the bundle name and component name.| | elementName | [ElementName](js-apis-bundleManager-elementName.md#elementname) | Yes | Application description, which consists of the bundle name and component name.|
| type | [CardType](#cardtype9) | Yes| Card emulation service type.| | type | [CardType](#cardtype9) | Yes | Card emulation service type. |
**Return value** **Return value**
| **Type**| **Description**| | **Type** | **Description** |
| -------- | -------- | | ------- | ------------------------------------ |
| boolean | Returns **true** if the application is the default payment application; returns **false** otherwise.| | boolean | Returns **true** if the application is the default payment application; returns **false** otherwise.|
**Example** **Example**
...@@ -110,13 +108,11 @@ import cardEmulation from '@ohos.nfc.cardEmulation'; ...@@ -110,13 +108,11 @@ import cardEmulation from '@ohos.nfc.cardEmulation';
var isHceSupported = cardEmulation.isSupported(cardEmulation.FeatureType.HCE); var isHceSupported = cardEmulation.isSupported(cardEmulation.FeatureType.HCE);
if (!isHceSupported) { if (!isHceSupported) {
console.log('this device is not supported for HCE, ignore it.'); console.log('this device is not supported for HCE, ignore it.');
return;
} }
var hasHceCap = cardEmulation.hasHceCapability(); var hasHceCap = cardEmulation.hasHceCapability();
if (!hasHceCap) { if (!hasHceCap) {
console.log('this device hasHceCapability false, ignore it.'); console.log('this device hasHceCapability false, ignore it.');
return;
} }
var elementName = { var elementName = {
......
...@@ -28,6 +28,23 @@ Initializes the active tag chip. ...@@ -28,6 +28,23 @@ Initializes the active tag chip.
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## connectedTag.initialize<sup>9+</sup>
initialize(): void
Initializes the active tag chip.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.ConnectedTag
**Error codes**
For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md).
| ID| Error Message|
| -------- | -------- |
| 3200101 | Connected NFC tag running state is abnormal in service. |
## connectedTag.uninit ## connectedTag.uninit
uninit(): boolean uninit(): boolean
...@@ -44,6 +61,23 @@ Uninitializes the active tag resources. ...@@ -44,6 +61,23 @@ Uninitializes the active tag resources.
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## connectedTag.uninitialize<sup>9+</sup>
uninitialize(): void
Uninitializes the active tag resources.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.ConnectedTag
**Error codes**
For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md).
| ID| Error Message|
| -------- | -------- |
| 3200101 | Connected NFC tag running state is abnormal in service. |
## connectedTag.readNdefTag ## connectedTag.readNdefTag
readNdefTag(): Promise&lt;string&gt; readNdefTag(): Promise&lt;string&gt;
...@@ -72,6 +106,41 @@ connectedTag.readNdefTag().then((data) => { ...@@ -72,6 +106,41 @@ connectedTag.readNdefTag().then((data) => {
}); });
``` ```
## connectedTag.read<sup>9+</sup>
read(): Promise&lt;number[]&gt;
Reads the content of this active tag. This API uses a promise to return the result.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.ConnectedTag
**Return value**
| **Type**| **Description**|
| -------- | -------- |
| Promise&lt;number[]&gt; | Promise used to return the content of the active tag.|
**Error codes**
For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md).
| ID| Error Message|
| -------- | -------- |
| 3200101 | Connected NFC tag running state is abnormal in service. |
**Example**
```js
import connectedTag from '@ohos.connectedTag';
connectedTag.read().then((data) => {
console.log("connectedTag read Promise data = " + data);
}).catch((err)=> {
console.log("connectedTag read Promise err: " + err);
});
```
## connectedTag.readNdefTag ## connectedTag.readNdefTag
readNdefTag(callback: AsyncCallback&lt;string&gt;): void readNdefTag(callback: AsyncCallback&lt;string&gt;): void
...@@ -102,6 +171,43 @@ connectedTag.readNdefTag((err, data)=> { ...@@ -102,6 +171,43 @@ connectedTag.readNdefTag((err, data)=> {
}); });
``` ```
## connectedTag.read<sup>9+</sup>
read(callback: AsyncCallback&lt;number[]&gt;): void
Reads the content of this active tag. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.ConnectedTag
**Parameters**
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;number[]&gt; | Yes| Callback invoked to return the active tag content obtained.|
**Error codes**
For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md).
| ID| Error Message|
| -------- | -------- |
| 3200101 | Connected NFC tag running state is abnormal in service. |
**Example**
```js
import connectedTag from '@ohos.connectedTag';
connectedTag.read((err, data)=> {
if (err) {
console.log("connectedTag read AsyncCallback err: " + err);
} else {
console.log("connectedTag read AsyncCallback data: " + data);
}
});
```
## connectedTag.writeNdefTag ## connectedTag.writeNdefTag
writeNdefTag(data: string): Promise&lt;void&gt; writeNdefTag(data: string): Promise&lt;void&gt;
...@@ -137,6 +243,48 @@ connectedTag.writeNdefTag(rawData).then(() => { ...@@ -137,6 +243,48 @@ connectedTag.writeNdefTag(rawData).then(() => {
}); });
``` ```
## connectedTag.write<sup>9+</sup>
write(data: number[]): Promise&lt;void&gt;
Writes data to this active tag. This API uses a promise to return the result.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.ConnectedTag
**Parameters**
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- |
| data | number[] | Yes| Data to be written to the active tag. The value is a hexadecimal number ranging from 0x00 to 0xFF.|
**Return value**
| **Type**| **Description**|
| -------- | -------- |
| Promise&lt;void&gt; | Promise that returns no value.|
**Error codes**
For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md).
| ID| Error Message|
| -------- | -------- |
| 3200101 | Connected NFC tag running state is abnormal in service. |
**Example**
```js
import connectedTag from '@ohos.connectedTag';
var rawData = [0x01, 0x02, 0x03]; // change it tobe correct.
connectedTag.write(rawData).then(() => {
console.log("connectedTag write NdefTag Promise success.");
}).catch((err)=> {
console.log("connectedTag write NdefTag 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
...@@ -169,6 +317,45 @@ connectedTag.writeNdefTag(rawData, (err)=> { ...@@ -169,6 +317,45 @@ connectedTag.writeNdefTag(rawData, (err)=> {
}); });
``` ```
## connectedTag.write<sup>9+</sup>
write(data: number[], callback: AsyncCallback&lt;void&gt;): void
Writes data to this active tag. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.ConnectedTag
**Parameters**
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- |
| data | number[] | Yes| Data to be written to the active tag. The value is a hexadecimal number ranging from 0x00 to 0xFF.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked to return the active tag content obtained.|
**Error codes**
For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md).
| ID| Error Message|
| -------- | -------- |
| 3200101 | Connected NFC tag running state is abnormal in service. |
**Example**
```js
import connectedTag from '@ohos.connectedTag';
var rawData = [0x01, 0x02, 0x03]; // change it tobe correct.
connectedTag.write(rawData, (err)=> {
if (err) {
console.log("connectedTag write NdefTag AsyncCallback err: " + err);
} else {
console.log("connectedTag write NdefTag AsyncCallback success.");
}
});
```
## connectedTag.on('notify') ## connectedTag.on('notify')
on(type: "notify", callback: Callback&lt;number&gt;): void on(type: "notify", callback: Callback&lt;number&gt;): void
......
...@@ -176,7 +176,7 @@ Unsubscribes from the NFC state changes. The subscriber will not receive NFC sta ...@@ -176,7 +176,7 @@ Unsubscribes from the NFC state changes. The subscriber will not receive NFC sta
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type to unsubscribe from. The value is **nfcStateChange**.| | type | string | Yes| Event type to unsubscribe from. The value is **nfcStateChange**.|
| callback | Callback&lt;[NfcState](#nfcstate)&gt; | No| Callback for the NFC state changes. This parameter can be left blank.| | callback | Callback&lt;[NfcState](#nfcstate)&gt; | No| Callback for the NFC state changes. This parameter can be left blank. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
**Example** **Example**
......
...@@ -53,6 +53,7 @@ Before developing applications related to tag read and write, you must declare N ...@@ -53,6 +53,7 @@ Before developing applications related to tag read and write, you must declare N
> - The **name** field under **metadata** is mandatory. It must be **tag-tech** and cannot be changed. > - The **name** field under **metadata** is mandatory. It must be **tag-tech** and cannot be changed.
> - The **value** field under **metadata** is mandatory. It can be **NfcA**, **NfcB**, **NfcF**, **NfcV**, **IsoDep**, **Ndef**, **MifareClassic**, **MifareUL**, **NdefFormatable** or any of their combinations. Incorrect settings of this field will cause a parsing failure. > - The **value** field under **metadata** is mandatory. It can be **NfcA**, **NfcB**, **NfcF**, **NfcV**, **IsoDep**, **Ndef**, **MifareClassic**, **MifareUL**, **NdefFormatable** or any of their combinations. Incorrect settings of this field will cause a parsing failure.
> - The **name** field under **requestPermissions** is mandatory. It must be **ohos.permission.NFC_TAG** and cannot be changed. > - The **name** field under **requestPermissions** is mandatory. It must be **ohos.permission.NFC_TAG** and cannot be changed.
## **Modules to Import** ## **Modules to Import**
```js ```js
...@@ -98,7 +99,7 @@ onCreate(want, launchParam) { ...@@ -98,7 +99,7 @@ onCreate(want, launchParam) {
if (isNfcATag) { if (isNfcATag) {
var nfcA; var nfcA;
try { try {
nfcA = tag.getNfcATag(taginfo); nfcA = tag.getNfcATag(tagInfo);
} catch (error) { } catch (error) {
console.log("tag.getNfcATag caught error: " + error); console.log("tag.getNfcATag caught error: " + error);
} }
...@@ -109,7 +110,7 @@ onCreate(want, launchParam) { ...@@ -109,7 +110,7 @@ onCreate(want, launchParam) {
if (isIsoDepTag) { if (isIsoDepTag) {
var isoDep; var isoDep;
try { try {
isoDep = tag.getIsoDep(taginfo); isoDep = tag.getIsoDep(tagInfo);
} catch (error) { } catch (error) {
console.log("tag.getIsoDep caught error: " + error); console.log("tag.getIsoDep caught error: " + error);
} }
...@@ -139,8 +140,8 @@ Obtains an **NfcATag** object, which allows access to the tags that use the NFC- ...@@ -139,8 +140,8 @@ Obtains an **NfcATag** object, which allows access to the tags that use the NFC-
**Return value** **Return value**
| **Type**| **Description**| | **Type** | **Description** |
| -------- | -------- | | ------------------------------------- | ------------- |
| [NfcATag](js-apis-nfctech.md#nfcatag) | **NfcATag** object obtained.| | [NfcATag](js-apis-nfctech.md#nfcatag) | **NfcATag** object obtained.|
## tag.getNfcA<sup>9+</sup> ## tag.getNfcA<sup>9+</sup>
...@@ -159,16 +160,16 @@ Obtains an **NfcATag** object, which allows access to the tags that use the NFC- ...@@ -159,16 +160,16 @@ Obtains an **NfcATag** object, which allows access to the tags that use the NFC-
**Return value** **Return value**
| **Type**| **Description**| | **Type** | **Description** |
| -------- | -------- | | ------------------------------------- | ------------- |
| [NfcATag](js-apis-nfctech.md#nfcatag) | **NfcATag** object obtained.| | [NfcATag](js-apis-nfctech.md#nfcatag) | **NfcATag** object obtained.|
**Error codes** **Error codes**
For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md). For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md).
| ID| Error Message| | ID | Error Message |
| ------- | -------| | ------- | ---------------------------------------- |
| 3100201 | Tag running state is abnormal in service. | | 3100201 | Tag running state is abnormal in service. |
## tag.getNfcBTag ## tag.getNfcBTag
...@@ -190,9 +191,9 @@ Obtains an **NfcBTag** object, which allows access to the tags that use the NFC- ...@@ -190,9 +191,9 @@ Obtains an **NfcBTag** object, which allows access to the tags that use the NFC-
**Return value** **Return value**
| **Type**| **Description** | | **Type** | **Description** |
| -------- | ---------------- | | ------------------------------------- | ------------- |
| [NfcBTag](js-apis-nfctech.md#nfcbtag) | **NfcBTag** object obtained.| | [NfcBTag](js-apis-nfctech.md#nfcbtag) | **NfcBTag** object obtained.|
## tag.getNfcB<sup>9+</sup> ## tag.getNfcB<sup>9+</sup>
...@@ -210,16 +211,16 @@ Obtains an **NfcBTag** object, which allows access to the tags that use the NFC- ...@@ -210,16 +211,16 @@ Obtains an **NfcBTag** object, which allows access to the tags that use the NFC-
**Return value** **Return value**
| **Type**| **Description** | | **Type** | **Description** |
| -------- | ---------------- | | ------------------------------------- | ------------- |
| [NfcBTag](js-apis-nfctech.md#nfcbtag) | **NfcBTag** object obtained.| | [NfcBTag](js-apis-nfctech.md#nfcbtag) | **NfcBTag** object obtained.|
**Error codes** **Error codes**
For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md). For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md).
| ID| Error Message| | ID | Error Message |
| ------- | -------| | ------- | ---------------------------------------- |
| 3100201 | Tag running state is abnormal in service. | | 3100201 | Tag running state is abnormal in service. |
## tag.getNfcFTag ## tag.getNfcFTag
...@@ -241,9 +242,9 @@ Obtains an **NfcFTag** object, which allows access to the tags that use the NFC- ...@@ -241,9 +242,9 @@ Obtains an **NfcFTag** object, which allows access to the tags that use the NFC-
**Return value** **Return value**
| **Type**| **Description** | | **Type** | **Description** |
| -------- | ---------------- | | ------------------------------------- | ------------- |
| [NfcFTag](js-apis-nfctech.md#nfcftag) | **NfcFTag** object obtained.| | [NfcFTag](js-apis-nfctech.md#nfcftag) | **NfcFTag** object obtained.|
## tag.getNfcF<sup>9+</sup> ## tag.getNfcF<sup>9+</sup>
...@@ -261,16 +262,16 @@ Obtains an **NfcFTag** object, which allows access to the tags that use the NFC- ...@@ -261,16 +262,16 @@ Obtains an **NfcFTag** object, which allows access to the tags that use the NFC-
**Return value** **Return value**
| **Type**| **Description** | | **Type** | **Description** |
| -------- | ---------------- | | ------------------------------------- | ------------- |
| [NfcFTag](js-apis-nfctech.md#nfcftag) | **NfcFTag** object obtained.| | [NfcFTag](js-apis-nfctech.md#nfcftag) | **NfcFTag** object obtained.|
**Error codes** **Error codes**
For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md). For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md).
| ID| Error Message| | ID | Error Message |
| ------- | -------| | ------- | ---------------------------------------- |
| 3100201 | Tag running state is abnormal in service. | | 3100201 | Tag running state is abnormal in service. |
## tag.getNfcVTag ## tag.getNfcVTag
...@@ -292,9 +293,9 @@ Obtains an **NfcVTag** object, which allows access to the tags that use the NFC- ...@@ -292,9 +293,9 @@ Obtains an **NfcVTag** object, which allows access to the tags that use the NFC-
**Return value** **Return value**
| **Type**| **Description** | | **Type** | **Description** |
| -------- | ---------------- | | ------------------------------------- | ------------- |
| [NfcVTag](js-apis-nfctech.md#nfcvtag) | **NfcVTag** object obtained.| | [NfcVTag](js-apis-nfctech.md#nfcvtag) | **NfcVTag** object obtained.|
## tag.getNfcV<sup>9+</sup> ## tag.getNfcV<sup>9+</sup>
...@@ -312,16 +313,16 @@ Obtains an **NfcVTag** object, which allows access to the tags that use the NFC- ...@@ -312,16 +313,16 @@ Obtains an **NfcVTag** object, which allows access to the tags that use the NFC-
**Return value** **Return value**
| **Type**| **Description** | | **Type** | **Description** |
| -------- | ---------------- | | ------------------------------------- | ------------- |
| [NfcVTag](js-apis-nfctech.md#nfcvtag) | **NfcVTag** object obtained.| | [NfcVTag](js-apis-nfctech.md#nfcvtag) | **NfcVTag** object obtained.|
**Error codes** **Error codes**
For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md). For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md).
| ID| Error Message| | ID | Error Message |
| ------- | -------| | ------- | ---------------------------------------- |
| 3100201 | Tag running state is abnormal in service. | | 3100201 | Tag running state is abnormal in service. |
## tag.getIsoDep<sup>9+</sup> ## tag.getIsoDep<sup>9+</sup>
...@@ -334,22 +335,22 @@ Obtains an **IsoDepTag** object, which allows access to the tags that use the IS ...@@ -334,22 +335,22 @@ Obtains an **IsoDepTag** object, which allows access to the tags that use the IS
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| --------- | ------------------------- | ---- | ---------------------------------------- | | ------- | ------------------- | ---- | ---------------------------------------- |
| taginfo | [TagInfo](#taginfo) | Yes| Tag information including the technology type and related parameters, which are obtained from **tag.getTagInfo(want: Want)**. | | taginfo | [TagInfo](#taginfo) | Yes | Tag information including the technology type and related parameters, which are obtained from **tag.getTagInfo(want: Want)**.|
**Return value** **Return value**
| **Type**| **Description** | | **Type** | **Description** |
| ---------- | ------------------| | ---------------------------------------- | ----------------------------------- |
| [IsoDepTag](js-apis-nfctech.md#isodeptag9) | **IsoDepTag** object obtained.| | [IsoDepTag](js-apis-nfctech.md#isodeptag9) | **IsoDepTag** object obtained.|
**Error codes** **Error codes**
For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md). For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md).
| ID| Error Message| | ID | Error Message |
| ------- | -------| | ------- | ---------------------------------------- |
| 3100201 | Tag running state is abnormal in service. | | 3100201 | Tag running state is abnormal in service. |
## tag.getNdef<sup>9+</sup> ## tag.getNdef<sup>9+</sup>
...@@ -362,27 +363,27 @@ Obtains an **NdefTag** object, which allows access to the tags in the NFC Data E ...@@ -362,27 +363,27 @@ Obtains an **NdefTag** object, which allows access to the tags in the NFC Data E
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| --------- | ------------------------- | ---- | ---------------------------------------- | | ------- | ------------------- | ---- | ---------------------------------------- |
| taginfo | [TagInfo](#taginfo) | Yes | Tag information including the technology type and related parameters, which are obtained from **tag.getTagInfo(want: Want)**. | | taginfo | [TagInfo](#taginfo) | Yes | Tag information including the technology type and related parameters, which are obtained from **tag.getTagInfo(want: Want)**.|
**Return value** **Return value**
| **Type**| **Description** | | **Type** | **Description** |
| ---------| -------------- | | -------------------------------------- | ------------------------------- |
| [NdefTag](js-apis-nfctech.md#ndeftag9) | **NdefTag** object obtained.| | [NdefTag](js-apis-nfctech.md#ndeftag9) | **NdefTag** object obtained.|
**Error codes** **Error codes**
For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md). For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md).
| ID| Error Message| | ID | Error Message |
| ------- | -------| | ------- | ---------------------------------------- |
| 3100201 | Tag running state is abnormal in service. | | 3100201 | Tag running state is abnormal in service. |
## tag.getMifareClassic<sup>9+</sup> ## tag.getMifareClassic<sup>9+</sup>
getMifareClassic(tagInfo: [TagInfo](#taginfo)): [MifareClassicTag](js-apis-nfctech.md#mifareclassictag-9) getMifareClassic(tagInfo: [TagInfo](#taginfo)): [MifareClassicTag](js-apis-nfctech.md#mifareclassictag9)
Obtains a **MifareClassicTag** object, which allows access to the tags that use MIFARE Classic. Obtains a **MifareClassicTag** object, which allows access to the tags that use MIFARE Classic.
...@@ -390,22 +391,22 @@ Obtains a **MifareClassicTag** object, which allows access to the tags that use ...@@ -390,22 +391,22 @@ Obtains a **MifareClassicTag** object, which allows access to the tags that use
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| --------- | ------------------------- | ---- | ---------------------------------------- | | ------- | ------------------- | ---- | ---------------------------------------- |
| taginfo | [TagInfo](#taginfo) | Yes | Tag information including the technology type and related parameters, which are obtained from **tag.getTagInfo(want: Want)**. | | taginfo | [TagInfo](#taginfo) | Yes | Tag information including the technology type and related parameters, which are obtained from **tag.getTagInfo(want: Want)**.|
**Return value** **Return value**
| **Type**| **Description** | | **Type** | **Description** |
| ----------------- | ------------------------| | ---------------------------------------- | ---------------------------------------- |
| [MifareClassicTag](js-apis-nfctech.md#mifareclassictag-9) | **MifareClassicTag** object obtained.| | [MifareClassicTag](js-apis-nfctech.md#mifareclassictag-9) | **MifareClassicTag** object obtained.|
**Error codes** **Error codes**
For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md). For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md).
| ID| Error Message| | ID | Error Message |
| ------- | -------| | ------- | ---------------------------------------- |
| 3100201 | Tag running state is abnormal in service. | | 3100201 | Tag running state is abnormal in service. |
## tag.getMifareUltralight<sup>9+</sup> ## tag.getMifareUltralight<sup>9+</sup>
...@@ -417,22 +418,22 @@ Obtains a **MifareUltralightTag** object, which allows access to the tags that u ...@@ -417,22 +418,22 @@ Obtains a **MifareUltralightTag** object, which allows access to the tags that u
**System capability**: SystemCapability.Communication.NFC.Tag **System capability**: SystemCapability.Communication.NFC.Tag
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| --------- | ------------------------- | ---- | ---------------------------------------- | | ------- | ------------------- | ---- | ---------------------------------------- |
| taginfo | [TagInfo](#taginfo) | Yes | Tag information including the technology type and related parameters, which are obtained from **tag.getTagInfo(want: Want)**. | | taginfo | [TagInfo](#taginfo) | Yes | Tag information including the technology type and related parameters, which are obtained from **tag.getTagInfo(want: Want)**.|
**Return value** **Return value**
| **Type**| **Description** | | **Type** | **Description** |
| -------------------- | ---------------------------| | ---------------------------------------- | ---------------------------------------- |
| [MifareUltralightTag](js-apis-nfctech.md#mifareultralighttag9) | **MifareUltralightTag** object obtained.| | [MifareUltralightTag](js-apis-nfctech.md#mifareultralighttag9) | **MifareUltralightTag** object obtained.|
**Error codes** **Error codes**
For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md). For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md).
| ID| Error Message| | ID | Error Message |
| ------- | -------| | ------- | ---------------------------------------- |
| 3100201 | Tag running state is abnormal in service. | | 3100201 | Tag running state is abnormal in service. |
## tag.getNdefFormatable<sup>9+</sup> ## tag.getNdefFormatable<sup>9+</sup>
...@@ -445,16 +446,16 @@ Obtains an **NdefFormatableTag** object, which allows access to the tags that ar ...@@ -445,16 +446,16 @@ Obtains an **NdefFormatableTag** object, which allows access to the tags that ar
**Return value** **Return value**
| **Type**| **Description** | | **Type** | **Description** |
| ------------------ | --------------------------| | ---------------------------------------- | ---------------------------------------- |
| [NdefFormatableTag](js-apis-nfctech.md#ndefformatabletag) | **NdefFormatableTag** object obtained.| | [NdefFormatableTag](js-apis-nfctech.md#ndefformatabletag) | **NdefFormatableTag** object obtained.|
**Error codes** **Error codes**
For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md). For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md).
| ID| Error Message| | ID | Error Message |
| ------- | -------| | ------- | ---------------------------------------- |
| 3100201 | Tag running state is abnormal in service. | | 3100201 | Tag running state is abnormal in service. |
## tag.getTagInfo<sup>9+</sup> ## tag.getTagInfo<sup>9+</sup>
...@@ -467,14 +468,14 @@ Obtains **TagInfo** from **Want**, which is initialized by the NFC service and c ...@@ -467,14 +468,14 @@ Obtains **TagInfo** from **Want**, which is initialized by the NFC service and c
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| --------- | ------------------------- | ---- | ---------------------------------------- | | ---- | ---------------------------------------- | ---- | --------------------------------- |
| want | [Want](js-apis-app-ability-want.md#Want) | Yes | Data obtained from the parameters of the **onCreate** entry function when an ability is dispatched. | | want | [Want](js-apis-app-ability-want.md#Want) | Yes | Data obtained from the parameters of the **onCreate** entry function when an ability is dispatched.|
**Return value** **Return value**
| **Type**| **Description** | | **Type** | **Description** |
| ------------------ | --------------------------| | ------------------- | --------------------------- |
| [TagInfo](#taginfo) | **TagInfo** object obtained.| | [TagInfo](#taginfo) | **TagInfo** object obtained.|
...@@ -488,14 +489,14 @@ Creates an NDEF record based on the specified URI. ...@@ -488,14 +489,14 @@ Creates an NDEF record based on the specified URI.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory | Description |
| -------- | ----------------------- | ---- | -------------------------------------- | | ---- | ------ | ---- | ---------------------- |
| uri | string | Yes| Data to write to the NDEF record.| | uri | string | Yes | Data to write to the NDEF record.|
**Return value** **Return value**
| **Type**| **Description** | | **Type** | **Description** |
| ------------------ | --------------------------| | -------------------------- | ---------------------------------------- |
| [NdefRecord](#ndefrecord9) | NDEF record created. For details, see *NFCForum-TS-NDEF_1.0*.| | [NdefRecord](#ndefrecord9) | NDEF record created. For details, see *NFCForum-TS-NDEF_1.0*.|
**Example** **Example**
...@@ -527,15 +528,15 @@ Creates an NDEF record based on the specified text data and encoding type. ...@@ -527,15 +528,15 @@ Creates an NDEF record based on the specified text data and encoding type.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory | Description |
| -------- | ----------------------- | ---- | -------------------------------------- | | ------ | ------ | ---- | ------------------------ |
| text | string | Yes | Text to write to the NDEF record.| | text | string | Yes | Text to write to the NDEF record.|
| locale | string | Yes | Encoding mode of the text.| | locale | string | Yes | Encoding mode of the text. |
**Return value** **Return value**
| **Type**| **Description** | | **Type** | **Description** |
| ------------------ | --------------------------| | -------------------------- | ---------------------------------------- |
| [NdefRecord](#ndefrecord9) | NDEF record created. For details, see *NFCForum-TS-NDEF_1.0*.| | [NdefRecord](#ndefrecord9) | NDEF record created. For details, see *NFCForum-TS-NDEF_1.0*.|
**Example** **Example**
...@@ -569,15 +570,15 @@ Creates an NDEF record based on the specified MIME data and type. ...@@ -569,15 +570,15 @@ Creates an NDEF record based on the specified MIME data and type.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory | Description |
| -------- | ----------------------- | ---- | -------------------------------------- | | -------- | -------- | ---- | ---------------------------------------- |
| mimeType | string | Yes | MIME type that complies with RFC rules, for example, **text/plain** or **image/jpeg**.| | mimeType | string | Yes | MIME type that complies with RFC rules, for example, **text/plain** or **image/jpeg**.|
| mimeData | number[] | Yes | MIME data, which consists of hexadecimal numbers ranging from **0x00** to **0xFF**.| | mimeData | number[] | Yes | MIME data, which consists of hexadecimal numbers ranging from **0x00** to **0xFF**. |
**Return value** **Return value**
| **Type**| **Description** | | **Type** | **Description** |
| ------------------ | --------------------------| | -------------------------- | ---------------------------------------- |
| [NdefRecord](#ndefrecord9) | NDEF record created. For details, see *NFCForum-TS-NDEF_1.0*.| | [NdefRecord](#ndefrecord9) | NDEF record created. For details, see *NFCForum-TS-NDEF_1.0*.|
**Example** **Example**
...@@ -609,16 +610,16 @@ Creates an NDEF record based on application-specific data. ...@@ -609,16 +610,16 @@ Creates an NDEF record based on application-specific data.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory | Description |
| -------- | ----------------------- | ---- | -------------------------------------- | | ------------ | -------- | ---- | ----------------------------------- |
| domainName | string | Yes | Bundle name of the application or domain name of the organization that releases the applications.| | domainName | string | Yes | Bundle name of the application or domain name of the organization that releases the applications. |
| type | string | Yes | Type of the application data.| | type | string | Yes | Type of the application data. |
| externalData | number[] | Yes | Application data, which consists of hexadecimal numbers ranging from **0x00** to **0xFF**.| | externalData | number[] | Yes | Application data, which consists of hexadecimal numbers ranging from **0x00** to **0xFF**.|
**Return value** **Return value**
| **Type**| **Description** | | **Type** | **Description** |
| ------------------ | --------------------------| | -------------------------- | ---------------------------------------- |
| [NdefRecord](#ndefrecord9) | NDEF record created. For details, see *NFCForum-TS-NDEF_1.0*.| | [NdefRecord](#ndefrecord9) | NDEF record created. For details, see *NFCForum-TS-NDEF_1.0*.|
**Example** **Example**
...@@ -652,14 +653,14 @@ Converts an NDEF message to bytes. ...@@ -652,14 +653,14 @@ Converts an NDEF message to bytes.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory | Description |
| -------- | ----------------------- | ---- | -------------------------------------- | | ----------- | ---------------------------------------- | ---- | ----------- |
| ndefMessage | [NdefMessage](js-apis-nfctech.md#ndefmessage9) | Yes | NDEF message to convert.| | ndefMessage | [NdefMessage](js-apis-nfctech.md#ndefmessage9) | Yes | NDEF message to convert.|
**Return value** **Return value**
| **Type**| **Description** | | **Type** | **Description** |
| ------------------ | --------------------------| | -------- | ---------------------------------------- |
| number[] | NDEF message in bytes, which consists of hexadecimal numbers ranging from **0x00** to **0xFF**.| | number[] | NDEF message in bytes, which consists of hexadecimal numbers ranging from **0x00** to **0xFF**.|
**Example** **Example**
...@@ -693,14 +694,14 @@ Creates an NDEF message from raw byte data. The data must comply with the NDEF r ...@@ -693,14 +694,14 @@ Creates an NDEF message from raw byte data. The data must comply with the NDEF r
**Parameters** **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type** | **Mandatory**| **Description** |
| -------- | -------- | -------- | -------- | | ------- | -------- | ------ | ---------------------------------------- |
| data | number[] | Yes| Raw byte data, which consists of hexadecimal numbers ranging from **0x00** to **0xFF**. The data must comply with the NDEF record format.| | data | number[] | Yes | Raw byte data, which consists of hexadecimal numbers ranging from **0x00** to **0xFF**. The data must comply with the NDEF record format.|
**Return value** **Return value**
| **Type**| **Description** | | **Type** | **Description** |
| ------------------ | --------------------------| | ---------------------------------------- | ---------------------------------------- |
| [NdefMessage](js-apis-nfctech.md#ndefmessage9) | NDEF message created. For details, see *NFCForum-TS-NDEF_1.0*.| | [NdefMessage](js-apis-nfctech.md#ndefmessage9) | NDEF message created. For details, see *NFCForum-TS-NDEF_1.0*.|
**Example** **Example**
...@@ -727,14 +728,14 @@ Creates an NDEF message from the NDEF records list. ...@@ -727,14 +728,14 @@ Creates an NDEF message from the NDEF records list.
**Parameters** **Parameters**
| **Name**| **Type**| **Mandatory**| **Description**| | **Name** | **Type** | **Mandatory**| **Description** |
| -------- | -------- | -------- | -------- | | ----------- | ---------------------------------------- | ------ | ---------------------------------------- |
| ndefRecords | [NdefRecord](js-apis-nfcTag.md#ndefrecord9)[] | Yes| NDEF record list used to create the NDEF message. For details, see *NFCForum-TS-NDEF_1.0*.| | ndefRecords | [NdefRecord](js-apis-nfcTag.md#ndefrecord9)[] | Yes | NDEF record list used to create the NDEF message. For details, see *NFCForum-TS-NDEF_1.0*.|
**Return value** **Return value**
| **Type**| **Description** | | **Type** | **Description** |
| ------------------ | --------------------------| | ---------------------------------------- | ---------------------------------------- |
| [NdefMessage](js-apis-nfctech.md#ndefmessage9) | NDEF message created. For details, see *NFCForum-TS-NDEF_1.0*.| | [NdefMessage](js-apis-nfctech.md#ndefmessage9) | NDEF message created. For details, see *NFCForum-TS-NDEF_1.0*.|
**Example** **Example**
...@@ -762,67 +763,66 @@ Defines the **TagInfo** object, which provides information about the tag technol ...@@ -762,67 +763,66 @@ Defines the **TagInfo** object, which provides information about the tag technol
**Required permissions**: ohos.permission.NFC_TAG **Required permissions**: ohos.permission.NFC_TAG
| **Name**| **Type**| **Readable**| **Writable**| **Description**| | **Name** | **Type** | **Readable**| **Writable**| **Description** |
| -------- | -------- | -------- | -------- | -------- | | ----------------------------- | ---------------------------------------- | ------ | ------ | ---------------------------------------- |
| uid<sup>9+</sup> | number[] | Yes| No| Tag unique identifier (UID), which consists of hexadecimal numbers ranging from **0x00** to **0xFF**.| | uid<sup>9+</sup> | number[] | Yes | No | Tag unique identifier (UID), which consists of hexadecimal numbers ranging from **0x00** to **0xFF**. |
| technology<sup>9+</sup> | number[] | Yes| No| Supported technologies. Each number is a constant indicating the supported technology.| | technology<sup>9+</sup> | number[] | Yes | No | Supported technologies. Each number is a constant indicating the supported technology. |
| supportedProfiles | number[] | Yes| No| Supported profiles. This parameter is not supported since API version 9. Use [technology](#taginfo).| | supportedProfiles | number[] | Yes | No | Supported profiles. This parameter is not supported since API version 9. Use [tag.TagInfo#technology](#tagtaginfo) instead.|
| extrasData<sup>9+</sup> | [PacMap](js-apis-inner-ability-dataAbilityHelper.md#pacmap)[] | Yes| No| Extended attribute value of the tag technology.<br>**System API**: This is a system API.| | extrasData<sup>9+</sup> | [PacMap](js-apis-inner-ability-dataAbilityHelper.md#pacmap)[] | Yes | No | Extended attribute value of the tag technology.<br>**System API**: This is a system API. |
| tagRfDiscId<sup>9+</sup> | number | Yes| No| ID allocated when the tag is discovered.<br>**System API**: This is a system API.| | tagRfDiscId<sup>9+</sup> | number | Yes | No | ID allocated when the tag is discovered.<br>**System API**: This is a system API. |
| remoteTagService<sup>9+</sup> | [rpc.RemoteObject](js-apis-rpc.md#remoteobject) | Yes| No| Remote object of the NFC service process used for interface communication between the client and the service.<br>**System API**: This is a system API.| | remoteTagService<sup>9+</sup> | [rpc.RemoteObject](js-apis-rpc.md#remoteobject) | Yes | No | Remote object of the NFC service process used for interface communication between the client and the service.<br>**System API**: This is a system API.|
## NdefRecord<sup>9+</sup> ## NdefRecord<sup>9+</sup>
Defines an NDEF record. For details, see *NFCForum-TS-NDEF_1.0*. Defines an NDEF record. For details, see *NFCForum-TS-NDEF_1.0*.
**System capability**: SystemCapability.Communication.NFC.Tag **System capability**: SystemCapability.Communication.NFC.Tag
| **Name**| **Type**| **Readable**| **Writable**| **Description**| | **Name** | **Type** | **Readable**| **Writable**| **Description** |
| -------- | -------- | -------- | -------- | -------- | | ------- | -------- | ------ | ------ | ---------------------------------------- |
| tnf | number | Yes| No| Type name field (TNF) of the NDEF record.| | tnf | number | Yes | No | Type name field (TNF) of the NDEF record. |
| rtdType| number[] | Yes| No| Record type definition (RTD) of the NDEF record. It consists of hexadecimal numbers ranging from **0x00** to **0xFF**.| | rtdType | number[] | Yes | No | Record type definition (RTD) of the NDEF record. It consists of hexadecimal numbers ranging from **0x00** to **0xFF**.|
| id | number[] | Yes| No| NDEF record ID, which consists of hexadecimal numbers ranging from **0x00** to **0xFF**.| | id | number[] | Yes | No | NDEF record ID, which consists of hexadecimal numbers ranging from **0x00** to **0xFF**.|
| payload | number[] | Yes| No| NDEF payload, which consists of hexadecimal numbers ranging from **0x00** to **0xFF**.| | payload | number[] | Yes | No | NDEF payload, which consists of hexadecimal numbers ranging from **0x00** to **0xFF**.|
## Technology Type Definition ## Technology Type Definition
Enumerates the tag technology types. Enumerates the tag technology types.
**System capability**: SystemCapability.Communication.NFC.Tag **System capability**: SystemCapability.Communication.NFC.Tag
| **Name**| **Value**| **Description**| | **Name** | **Value**| **Description** |
| -------- | -------- | -------- | | ---------------------------- | ----- | ------------------------ |
| NFC_A | 1 | NFC-A (ISO 14443-3A).| | NFC_A | 1 | NFC-A (ISO 14443-3A). |
| NFC_B | 2 | NFC-B (ISO 14443-3B).| | NFC_B | 2 | NFC-B (ISO 14443-3B).|
| ISO_DEP | 3 | ISO-DEP (ISO 14443-4).| | ISO_DEP | 3 | ISO-DEP (ISO 14443-4).|
| NFC_F | 4 | NFC-F (JIS 6319-4).| | NFC_F | 4 | NFC-F (JIS 6319-4). |
| NFC_V | 5 | NFC-V (ISO 15693).| | NFC_V | 5 | NFC-V (ISO 15693). |
| NDEF | 6 | NDEF.| | NDEF | 6 | NDEF. |
| NDEF_FORMATABLE<sup>9+</sup> | 7 | NDEF formattable.| | NDEF_FORMATABLE<sup>9+</sup> | 7 | NDEF formattable. |
| MIFARE_CLASSIC | 8 | MIFARE Classic.| | MIFARE_CLASSIC | 8 | MIFARE Classic. |
| MIFARE_ULTRALIGHT | 9 | MIFARE Ultralight.| | MIFARE_ULTRALIGHT | 9 | MIFARE Ultralight. |
## TnfType<sup>9+</sup> ## TnfType<sup>9+</sup>
Enumerates the TNF types. For details, see *NFCForum-TS-NDEF_1.0*. Enumerates the TNF types. For details, see *NFCForum-TS-NDEF_1.0*.
**System capability**: SystemCapability.Communication.NFC.Tag **System capability**: SystemCapability.Communication.NFC.Tag
| **Name**| **Value**| **Description**| | **Name** | **Value**| **Description** |
| -------- | -------- | -------- | | ---------------- | ----- | ---------------------------------------- |
| TNF_EMPTY | 0x0 | Empty.| | TNF_EMPTY | 0x0 | Empty. |
| TNF_WELL_KNOWN | 0x1 | NFC Forum Well Known Type [NFC RTD].| | TNF_WELL_KNOWN | 0x1 | NFC Forum Well Known Type [NFC RTD]. |
| TNF_MEDIA | 0x2 | Media-type as defined in RFC 2046 [RFC 2046].| | TNF_MEDIA | 0x2 | Media-type as defined in RFC 2046 [RFC 2046].|
| TNF_ABSOLUTE_URI | 0x3 | Absolute URI as defined in RFC 3986 [RFC 3986].| | TNF_ABSOLUTE_URI | 0x3 | Absolute URI as defined in RFC 3986 [RFC 3986].|
| TNF_EXT_APP | 0x4 | NFC Forum external type [NFC RTD].| | TNF_EXT_APP | 0x4 | NFC Forum external type [NFC RTD]. |
| TNF_UNKNOWN | 0x5 | Unknown.| | TNF_UNKNOWN | 0x5 | Unknown. |
| TNF_UNCHANGED | 0x6 | Unchanged (see section 2.3.3 in *NFCForum-TS-NDEF_1.0*).| | TNF_UNCHANGED | 0x6 | Unchanged (see section 2.3.3 in *NFCForum-TS-NDEF_1.0*). |
## NDEF Record RTD ## NDEF Record RTD
Enumerates the NDEF record types. For details about the RTD, see *NFCForum-TS-NDEF_1.0*. Enumerates the NDEF record types. For details about the RTD, see *NFCForum-TS-NDEF_1.0*.
**System capability**: SystemCapability.Communication.NFC.Tag **System capability**: SystemCapability.Communication.NFC.Tag
| **Name**| **Value**| **Description**| | **Name** | **Value** | **Description** |
| -------- | -------- | -------- | | --------------------- | ------ | ------------------ |
| RTD_TEXT<sup>9+</sup> | [0x54] | NDEF record of the text type.| | RTD_TEXT<sup>9+</sup> | [0x54] | NDEF record of the text type. |
| RTD_URI<sup>9+</sup> | [0x55] | NDEF record of the URI type.| | RTD_URI<sup>9+</sup> | [0x55] | NDEF record of the URI type.|
## NfcForumType<sup>9+</sup> ## NfcForumType<sup>9+</sup>
...@@ -830,46 +830,47 @@ Enumerates the NFC Forum tag types. ...@@ -830,46 +830,47 @@ Enumerates the NFC Forum tag types.
**System capability**: SystemCapability.Communication.NFC.Tag **System capability**: SystemCapability.Communication.NFC.Tag
| **Name**| **Value**| **Description**| | **Name** | **Value**| **Description** |
| -------- | -------- | -------- | | ---------------- | ----- | ----------------- |
| NFC_FORUM_TYPE_1 | 1 | NFC Forum tag type 1.| | NFC_FORUM_TYPE_1 | 1 | NFC Forum tag type 1. |
| NFC_FORUM_TYPE_2 | 2 | NFC Forum tag type 2.| | NFC_FORUM_TYPE_2 | 2 | NFC Forum tag type 2. |
| NFC_FORUM_TYPE_3 | 3 | NFC Forum tag type 3.| | NFC_FORUM_TYPE_3 | 3 | NFC Forum tag type 3. |
| NFC_FORUM_TYPE_4 | 4 | NFC Forum tag type 4.| | NFC_FORUM_TYPE_4 | 4 | NFC Forum tag type 4. |
| MIFARE_CLASSIC | 101 | MIFARE Classic.| | MIFARE_CLASSIC | 101 | MIFARE Classic.|
## MifareClassicType<sup>9+</sup> ## MifareClassicType<sup>9+</sup>
Enumerates the MIFARE Classic tag types. Enumerates the MIFARE Classic tag types.
**System capability**: SystemCapability.Communication.NFC.Tag **System capability**: SystemCapability.Communication.NFC.Tag
| **Name**| **Value**| **Description**| | **Name** | **Value**| **Description** |
| -------- | -------- | -------- | | ------------ | ----- | ----------------- |
| TYPE_UNKNOWN | 0 | Unknown type.| | TYPE_UNKNOWN | 0 | Unknown type. |
| TYPE_CLASSIC | 1 | MIFARE Classic.| | TYPE_CLASSIC | 1 | MIFARE Classic.|
| TYPE_PLUS | 2 | MIFARE Plus.| | TYPE_PLUS | 2 | MIFARE Plus. |
| TYPE_PRO | 3 | MIFARE Pro.| | TYPE_PRO | 3 | MIFARE Pro. |
## MifareClassicSize<sup>9+</sup> ## MifareClassicSize<sup>9+</sup>
Enumerates the sizes of a MIFARE Classic tag. Enumerates the sizes of a MIFARE Classic tag.
**System capability**: SystemCapability.Communication.NFC.Tag **System capability**: SystemCapability.Communication.NFC.Tag
| **Name**| **Value**| **Description**| | **Name** | **Value**| **Description** |
| -------- | -------- | -------- | | ------------ | ----- | ------------------ |
| MC_SIZE_MINI | 320 | Each tag has 5 sectors, and each sector has 4 blocks.| | MC_SIZE_MINI | 320 | Each tag has 5 sectors, and each sector has 4 blocks. |
| MC_SIZE_1K | 1024 | Each tag has 16 sectors, and each sector has 4 blocks.| | MC_SIZE_1K | 1024 | Each tag has 16 sectors, and each sector has 4 blocks.|
| MC_SIZE_2K | 2048 | Each tag has 32 sectors, and each sector has 4 blocks.| | MC_SIZE_2K | 2048 | Each tag has 32 sectors, and each sector has 4 blocks.|
| MC_SIZE_4K | 4096 | Each tag has 40 sectors, and each sector has 4 blocks.| | MC_SIZE_4K | 4096 | Each tag has 40 sectors, and each sector has 4 blocks.|
## MifareUltralightType<sup>9+</sup> ## MifareUltralightType<sup>9+</sup>
Enumerates the MIFARE Ultralight tag types. Enumerates the MIFARE Ultralight tag types.
**System capability**: SystemCapability.Communication.NFC.Tag **System capability**: SystemCapability.Communication.NFC.Tag
| **Name**| **Value**| **Description**| | **Name** | **Value**| **Description** |
| -------- | -------- | -------- | | ----------------- | ----- | ---------------------- |
| TYPE_UNKNOWN | 0 | Unknown type.| | TYPE_UNKNOWN | 0 | Unknown type. |
| TYPE_ULTRALIGHT | 1 | MIFARE Ultralight.| | TYPE_ULTRALIGHT | 1 | MIFARE Ultralight. |
| TYPE_ULTRALIGHT_C | 2 | MIFARE Ultralight C.| | TYPE_ULTRALIGHT_C | 2 | MIFARE Ultralight C.|
<!--no_check-->
\ No newline at end of file
...@@ -47,3 +47,21 @@ An error occurs when the NFC service executes the tag service logic. ...@@ -47,3 +47,21 @@ An error occurs when the NFC service executes the tag service logic.
3. Connect to the tag and then perform the read and write operations. 3. Connect to the tag and then perform the read and write operations.
4. Touch and read the card again. 4. Touch and read the card again.
5. Exit the app and read the card again. 5. Exit the app and read the card again.
## 3200101
**Error Message**
Connected NFC tag running state is abnormal in service.
**Description**
An error occurs when the service logic of the active NFC tag is executed.
**Possible Causes**
1. The parameter values of the active NFC tag does not match the API called.
2. The active NFC tag chip does not respond within the specified time or returns an error state.
**Solution**
1. Check that the active NFC tag parameters match the API called.
2. Touch and read the card again.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册