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

!19767 [翻译完成】#I789MD

Merge pull request !19767 from Annie_wang/PR18562
...@@ -21,11 +21,11 @@ Enumerates the NFC card emulation types. ...@@ -21,11 +21,11 @@ Enumerates the NFC card emulation types.
**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>
...@@ -33,8 +33,8 @@ Enumerates the types of services used by the card emulation application. ...@@ -33,8 +33,8 @@ 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.|
...@@ -51,14 +51,14 @@ Checks whether a certain type of card emulation is supported. ...@@ -51,14 +51,14 @@ Checks whether a certain type of card emulation is supported.
**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>
...@@ -73,8 +73,8 @@ Checks whether HCE is supported. ...@@ -73,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>
...@@ -89,15 +89,15 @@ Checks whether an application is the default application of the specified servic ...@@ -89,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**
...@@ -108,13 +108,11 @@ import cardEmulation from '@ohos.nfc.cardEmulation'; ...@@ -108,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 = {
......
...@@ -48,10 +48,11 @@ Before developing applications related to tag read and write, you must declare N ...@@ -48,10 +48,11 @@ Before developing applications related to tag read and write, you must declare N
} }
``` ```
> **CAUTION**<br> > **CAUTION**<br>
1. The **actions** field is mandatory. It must be **ohos.nfc.tag.action.TAG_FOUND** and cannot be changed. >
2. The **name** field under **metadata** is mandatory. It must be **tag-tech** and cannot be changed. > - The **actions** field is mandatory. It must be **ohos.nfc.tag.action.TAG_FOUND** and cannot be changed.
3. 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 **metadata** is mandatory. It must be **tag-tech** and cannot be changed.
4. The **name** field under **requestPermissions** is mandatory. It must be **ohos.permission.NFC_TAG** 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 **name** field under **requestPermissions** is mandatory. It must be **ohos.permission.NFC_TAG** and cannot be changed.
## **Modules to Import** ## **Modules to Import**
...@@ -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,8 +191,8 @@ Obtains an **NfcBTag** object, which allows access to the tags that use the NFC- ...@@ -190,8 +191,8 @@ 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,8 +242,8 @@ Obtains an **NfcFTag** object, which allows access to the tags that use the NFC- ...@@ -241,8 +242,8 @@ 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,8 +293,8 @@ Obtains an **NfcVTag** object, which allows access to the tags that use the NFC- ...@@ -292,8 +293,8 @@ 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>
...@@ -335,21 +336,21 @@ Obtains an **IsoDepTag** object, which allows access to the tags that use the IS ...@@ -335,21 +336,21 @@ 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>
...@@ -363,21 +364,21 @@ Obtains an **NdefTag** object, which allows access to the tags in the NFC Data E ...@@ -363,21 +364,21 @@ 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>
...@@ -391,21 +392,21 @@ Obtains a **MifareClassicTag** object, which allows access to the tags that use ...@@ -391,21 +392,21 @@ 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>
...@@ -418,21 +419,21 @@ Obtains a **MifareUltralightTag** object, which allows access to the tags that u ...@@ -418,21 +419,21 @@ Obtains a **MifareUltralightTag** object, which allows access to the tags that u
**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>
...@@ -468,13 +469,13 @@ Obtains **TagInfo** from **Want**, which is initialized by the NFC service and c ...@@ -468,13 +469,13 @@ 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,66 +763,66 @@ Defines the **TagInfo** object, which provides information about the tag technol ...@@ -762,66 +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 [tag.TagInfo#technology](#tagtaginfo) instead.| | 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>
...@@ -829,12 +830,12 @@ Enumerates the NFC Forum tag types. ...@@ -829,12 +830,12 @@ 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>
...@@ -842,21 +843,21 @@ Enumerates the MIFARE Classic tag types. ...@@ -842,21 +843,21 @@ 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.|
...@@ -866,9 +867,10 @@ Enumerates the MIFARE Ultralight tag types. ...@@ -866,9 +867,10 @@ 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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册