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

!14000 [翻译完成】#I67371

Merge pull request !14000 from Annie_wang/PR12793
# @ohos.nfc.cardEmulation
# @ohos.nfc.cardEmulation (Standard NFC Card Emulation)
The **cardEmulation** module implements Near-Field Communication (NFC) card emulation. You can use the APIs provided by this module to determine the card emulation type supported and implement Host-based Card Emulation (HCE).
......@@ -16,7 +16,7 @@ import cardEmulation from '@ohos.nfc.cardEmulation';
Enumerates the NFC card emulation types.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.CardEmulation
| Name| Value| Description|
| -------- | -------- | -------- |
......@@ -24,13 +24,24 @@ Enumerates the NFC card emulation types.
| UICC | 1 | Subscriber identity module (SIM) card emulation.|
| ESE | 2 | embedded Secure Element (eSE) emulation.|
## CardType
Enumerates the card emulation application types.
**System capability**: SystemCapability.Communication.NFC.CardEmulation
| Name| Value| Description|
| -------- | -------- | -------- |
| PAYMENT | "payment" | Payment type.|
| OTHER | "other" | Other types. |
## cardEmulation.isSupported
isSupported(feature: number): boolean
Checks whether a certain type of card emulation is supported.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.CardEmulation
**Parameters**
......@@ -44,6 +55,27 @@ Checks whether a certain type of card emulation is supported.
| -------- | -------- |
| boolean | Returns **true** if the card emulation type is supported; returns **false** otherwise.|
## cardEmulation.isDefaultService
isDefaultService(elementName: ElementName, type: CardType): boolean
Checks whether the specified application is of the default payment type.
**System capability**: SystemCapability.Communication.NFC.CardEmulation
**Parameters**
| Name | Type | Mandatory| Description |
| ------- | -------- | ---- | ----------------------- |
| elementName | [ElementName](js-apis-bundleManager-elementName.md#elementname) | Yes| Application description, which includes the bundle name and component name.|
| type | [CardType](#cardtype) | Yes| Application description, which includes the bundle name and component name.|
**Return value**
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the application is the default payment application; returns **false** otherwise.|
## HceService<sup>8+</sup>
Implements HCE, including receiving Application Protocol Data Units (APDUs) from the peer card reader and sending a response. Before using HCE-related APIs, check whether the device supports HCE.
......@@ -56,7 +88,7 @@ Starts HCE, including setting the application to be foreground preferred and dyn
**Required permissions**: ohos.permission.NFC_CARD_EMULATION
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.CardEmulation
**Parameters**
......@@ -72,7 +104,7 @@ Stops HCE, including removing the foreground preferred attribute and releasing t
**Required permissions**: ohos.permission.NFC_CARD_EMULATION
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.CardEmulation
### on<sup>8+</sup>
......@@ -82,14 +114,14 @@ Registers a callback to receive APDUs from the peer card reader.
**Required permissions**: ohos.permission.NFC_CARD_EMULATION
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.CardEmulation
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ----------------------- | ---- | -------------------------------------------- |
| type | string | Yes | Event type to subscribe to. The value is **hceCmd**. |
| callback | AsyncCallback<number[]> | Yes | Callback invoked to return the APDU. Each number in the callback is a hexadecimal number ranging from **0x00** to **0xFF**.|
| callback | AsyncCallback<number[]> | Yes | Callback invoked to return the APDU, which consists of hexadecimal numbers ranging from **0x00** to **0xFF**.|
### sendResponse<sup>8+</sup>
......@@ -99,13 +131,13 @@ Sends a response to the peer card reader.
**Required permissions**: ohos.permission.NFC_CARD_EMULATION
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.CardEmulation
**Parameters**
| Name | Type | Mandatory| Description |
| ------------ | -------- | ---- | -------------------------------------------------- |
| responseApdu | number[] | Yes | Response APDU sent to the peer card reader. Each number of the APDU is a hexadecimal number ranging from **0x00** to **0xFF**.|
| responseApdu | number[] | Yes | Response APDU sent to the peer card reader. The value consists of hexadecimal numbers ranging from **0x00** to **0xFF**.|
**Example**
......@@ -118,6 +150,13 @@ if (!isHceSupported) {
return;
}
var elementName = {
"bundleName": "com.test.cardemulation",
"abilityName": "com.test.cardemulation.MainAbility",
};
var isDefaultService = cardEmulation.isDefaultService(elementName, cardEmulation.CardType.PAYMENT);
console.log('is the app is default service for this card type: ' + isDefaultService);
// The device supports HCE and transimits APDUs with the remote NFC reader.
var hceService = new cardEmulation.HceService();
hceService.startHCE([
......@@ -135,6 +174,6 @@ hceService.on("hceCmd", (err, res) => {
}
})
// Stop HCE when the application exits the NFC card emulation.
// stop HCE when the application exit the nfc card emulation.
hceService.stopHCE();
```
# @ohos.nfc.tag
# @ohos.nfc.tag (Standard NFC Tags)
The **nfcTag** module provides APIs for managing Near-Field Communication (NFC) tags.
......@@ -128,7 +128,7 @@ Obtains an **NfcATag** object, which allows access to the tags that use the NFC-
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -144,7 +144,7 @@ Obtains an **NfcBTag** object, which allows access to the tags that use the NFC-
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -160,7 +160,7 @@ Obtains an **NfcFTag** object, which allows access to the tags that use the NFC-
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -176,7 +176,7 @@ Obtains an **NfcVTag** object, which allows access to the tags that use the NFC-
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -190,7 +190,7 @@ getIsoDep(tagInfo: [TagInfo](#taginfo)): [IsoDepTag](js-apis-nfctech.md#isoDepTa
Obtains an **IsoDepTag** object, which allows access to the tags that use the ISO-DEP technology.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -218,7 +218,7 @@ getNdef(tagInfo: [TagInfo](#taginfo)): [NdefTag](js-apis-nfctech.md#ndeftag9)
Obtains an **NdefTag** object, which allows access to the tags in the NFC Data Exchange Format (NDEF).
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -242,11 +242,11 @@ For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode
## tag.getMifareClassic<sup>9+</sup>
getMifareClassic(tagInfo: [TagInfo](#taginfo)): [MifareClassicTag](js-apis-nfctech.md#mifareclassictag9)
getMifareClassic(tagInfo: [TagInfo](#taginfo)): [MifareClassicTag](js-apis-nfctech.md#mifareclassictag-9)
Obtains a **MifareClassicTag** object, which allows access to the tags that use MIFARE Classic.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -258,7 +258,7 @@ Obtains a **MifareClassicTag** object, which allows access to the tags that use
| **Type**| **Description** |
| ----------------- | ------------------------|
| [MifareClassicTag](js-apis-nfctech.md#mifareclassictag9) | **MifareClassicTag** object obtained.|
| [MifareClassicTag](js-apis-nfctech.md#mifareclassictag-9) | **MifareClassicTag** object obtained.|
**Error codes**
......@@ -274,7 +274,7 @@ getMifareUltralight(tagInfo: [TagInfo](#taginfo)): [MifareUltralightTag](js-apis
Obtains a **MifareUltralightTag** object, which allows access to the tags that use MIFARE Ultralight.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
| Name | Type | Mandatory | Description |
......@@ -301,7 +301,7 @@ getNdefFormatable(tagInfo: [TagInfo](#taginfo)): [NdefFormatableTag](js-apis-nfc
Obtains an **NdefFormatableTag** object, which allows access to the tags that are NDEF formattable.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -323,7 +323,7 @@ getTagInfo(want: [Want](js-apis-app-ability-want.md#Want)): [TagInfo](#taginfo)
Obtains **TagInfo** from **Want**, which is initialized by the NFC service and contains the attributes required by **TagInfo**.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -344,7 +344,7 @@ makeUriRecord(uri: string): [NdefRecord](#ndefrecord9);
Creates an NDEF record based on the specified URI.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -373,7 +373,7 @@ try {
console.log("ndefMessage makeUriRecord ndefRecord: " + ndefRecord);
}
} catch (busiError) {
console.log("ndefMessage makeUriRecord catched busiError: " + busiError);
console.log("ndefMessage makeUriRecord caught busiError: " + busiError);
}
```
......@@ -383,7 +383,7 @@ makeTextRecord(text: string, locale: string): [NdefRecord](#ndefrecord9);
Creates an NDEF record based on the specified text data and encoding type.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -414,7 +414,7 @@ try {
console.log("ndefMessage makeTextRecord ndefRecord: " + ndefRecord);
}
} catch (busiError) {
console.log("ndefMessage makeTextRecord catched busiError: " + busiError);
console.log("ndefMessage makeTextRecord caught busiError: " + busiError);
}
```
......@@ -425,7 +425,7 @@ makeMimeRecord(mimeType: string, mimeData: number[]): [NdefRecord](#ndefrecord9)
Creates an NDEF record based on the specified MIME data and type.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -456,7 +456,7 @@ try {
console.log("ndefMessage makeMimeRecord ndefRecord: " + ndefRecord);
}
} catch (busiError) {
console.log("ndefMessage makeMimeRecord catched busiError: " + busiError);
console.log("ndefMessage makeMimeRecord caught busiError: " + busiError);
}
```
## tag.ndef.makeExternalRecord<sup>9+</sup>
......@@ -465,7 +465,7 @@ makeExternalRecord(domainName: string, type: string, externalData: number[]): [N
Creates an NDEF record based on application-specific data.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -498,7 +498,7 @@ try {
console.log("ndefMessage makeExternalRecord ndefRecord: " + ndefRecord);
}
} catch (busiError) {
console.log("ndefMessage makeExternalRecord catched busiError: " + busiError);
console.log("ndefMessage makeExternalRecord caught busiError: " + busiError);
}
```
......@@ -508,7 +508,7 @@ messageToBytes(ndefMessage: [NdefMessage](js-apis-nfctech.md#ndefmessage9)): num
Converts an NDEF message to bytes.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -540,7 +540,7 @@ try {
let rawData2 = tag.ndef.messageToBytes(ndefMessage);
console.log("ndefMessage messageToBytes rawData2: " + rawData2);
} catch (busiError) {
console.log("ndefMessage messageToBytes catched busiError: " + busiError);
console.log("ndefMessage messageToBytes caught busiError: " + busiError);
}
```
## tag.ndef.createNdefMessage<sup>9+</sup>
......@@ -549,7 +549,7 @@ createNdefMessage(data: number[]): [NdefMessage](js-apis-nfctech.md#ndefmessage9
Creates an NDEF message from raw byte data. The data must comply with the NDEF record format. Otherwise, the NDE record list contained in the **NdefMessage** object will be empty.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -583,7 +583,7 @@ createNdefMessage(ndefRecords: NdefRecord[]): [NdefMessage](js-apis-nfctech.md#n
Creates an NDEF message from the NDEF records list.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -618,7 +618,7 @@ try {
Defines the **TagInfo** object, which provides information about the tag technologies supported by a card.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Required permissions**: ohos.permission.NFC_TAG
......@@ -633,7 +633,7 @@ Defines the **TagInfo** object, which provides information about the tag technol
## NdefRecord<sup>9+</sup>
Defines an NDEF record. For details, see *NFCForum-TS-NDEF_1.0*.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
| **Name**| **Type**| **Readable**| **Writable**| **Description**|
| -------- | -------- | -------- | -------- | -------- |
......@@ -645,7 +645,7 @@ Defines an NDEF record. For details, see *NFCForum-TS-NDEF_1.0*.
## Technology Type Definition
Enumerates the tag technology types.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
| **Name**| **Value**| **Description**|
| -------- | -------- | -------- |
......@@ -662,7 +662,7 @@ Enumerates the tag technology types.
## TnfType<sup>9+</sup>
Enumerates the TNF types. For details, see *NFCForum-TS-NDEF_1.0*.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
| **Name**| **Value**| **Description**|
| -------- | -------- | -------- |
......@@ -677,7 +677,7 @@ Enumerates the TNF types. For details, see *NFCForum-TS-NDEF_1.0*.
## NDEF Record RTD
Enumerates the NDEF record types. For details about the RTD, see *NFCForum-TS-NDEF_1.0*.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
| **Name**| **Value**| **Description**|
| -------- | -------- | -------- |
......@@ -687,7 +687,7 @@ Enumerates the NDEF record types. For details about the RTD, see *NFCForum-TS-ND
## NfcForumType<sup>9+</sup>
Enumerates the NFC Forum tag types.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
| **Name**| **Value**| **Description**|
| -------- | -------- | -------- |
......@@ -700,7 +700,7 @@ Enumerates the NFC Forum tag types.
## MifareClassicType<sup>9+</sup>
Enumerates the MIFARE Classic tag types.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
| **Name**| **Value**| **Description**|
| -------- | -------- | -------- |
......@@ -710,9 +710,9 @@ Enumerates the MIFARE Classic tag types.
| TYPE_PRO | 3 | MIFARE Pro.|
## MifareClassicSize<sup>9+</sup>
Enumerates the sizes of MIFARE Classic tags.
Enumerates the sizes of a MIFARE Classic tag.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
| **Name**| **Value**| **Description**|
| -------- | -------- | -------- |
......@@ -724,7 +724,7 @@ Enumerates the sizes of MIFARE Classic tags.
## MifareUltralightType<sup>9+</sup>
Enumerates the MIFARE Ultralight tag types.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
| **Name**| **Value**| **Description**|
| -------- | -------- | -------- |
......
# nfctech
# nfctech (Standard NFC Technologies)
The **nfctech** module provides APIs for reading and writing tags that use different Near-Field Communication (NFC) technologies.
......@@ -28,7 +28,7 @@ Obtains the SAK value of this NFC-A tag.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -54,7 +54,7 @@ Obtains the ATQA value of this NFC-A tag.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -88,7 +88,7 @@ Obtains the application data of this NFC-B tag.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -114,7 +114,7 @@ Obtains the protocol information of this NFC-B tag.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -148,7 +148,7 @@ Obtains the system code from this NFC-F tag.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -174,7 +174,7 @@ Obtains the PMm (consisting of the IC code and manufacturer parameters) informat
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -208,7 +208,7 @@ Obtains the response flags from this NFC-V tag.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -234,7 +234,7 @@ Obtains the data storage format identifier (DSFID) from this NFC-V tag.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -266,7 +266,7 @@ getHistoricalBytes(): number[]
Obtains the historical bytes for the given tag. This API applies only to the IsoDep cards that use the NFC-A technology.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -290,7 +290,7 @@ getHiLayerResponse(): number[]
Obtains the higher-layer response bytes for the given tag. This API applies only to the IsoDep cards that use the NFC-B technology.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -316,7 +316,7 @@ Checks whether an extended application protocol data unit (APDU) is supported. T
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -367,7 +367,7 @@ Checks whether an extended APDU is supported. This API uses an asynchronous call
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -419,7 +419,7 @@ getNdefRecords(): [tag.NdefRecord](js-apis-nfcTag.md#ndefrecord9)[]
Obtains all NDEF records.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -454,7 +454,7 @@ getNdefTagType(): [tag.NfcForumType](js-apis-nfcTag.md#nfcforumtype9)
Obtains the NDEF tag type.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -478,7 +478,7 @@ getNdefMessage(): [NdefMessage](#ndefmessage9)
Obtains the NDEF message from this NDEF tag.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -501,7 +501,7 @@ isNdefWritable(): boolean;
Check whether this NDEF tag is writable. Before calling the data write API, check whether the write operation is supported.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -527,7 +527,7 @@ Reads the NDEF message from this tag. This API uses a promise to return the resu
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -577,7 +577,7 @@ Reads the NDEF message from this tag. This API uses an asynchronous callback to
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -629,7 +629,7 @@ Writes an NDEF message to this tag. This API uses a promise to return the result
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -682,7 +682,7 @@ Writes an NDEF message to this tag. This API uses an asynchronous callback to re
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -738,7 +738,7 @@ Checks whether this NDEF tag can be set to read-only.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -772,7 +772,7 @@ Sets this NDEF tag to read-only. This API uses a promise to return the result.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Error codes**
......@@ -816,7 +816,7 @@ Sets this NDEF tag to read-only. This API uses an asynchronous callback to retur
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -866,7 +866,7 @@ getNdefTagTypeString(type: [tag.NfcForumType](js-apis-nfcTag.md#nfcforumtype9)):
Converts an NFC Forum Type tag to a string defined in the NFC Forum.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -911,7 +911,7 @@ Authenticates a sector using a key. The sector can be accessed only after the au
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -965,7 +965,7 @@ Authenticates a sector using a key. The sector can be accessed only after the au
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -1021,7 +1021,7 @@ Reads a block (16 bytes) on this tag. This API uses a promise to return the resu
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -1078,7 +1078,7 @@ Reads a block (16 bytes) on this tag. This API uses an asynchronous callback to
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -1132,7 +1132,7 @@ Writes data to a block on this tag. This API uses a promise to return the result
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -1186,7 +1186,7 @@ Writes data to a block on this tag. This API uses an asynchronous callback to re
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -1243,7 +1243,7 @@ Increments a block with data. This API uses a promise to return the result.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -1296,7 +1296,7 @@ Increments a block with data. This API uses an asynchronous callback to return t
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -1352,7 +1352,7 @@ Decrements a block. This API uses a promise to return the result.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -1405,7 +1405,7 @@ Decrements a block. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -1461,7 +1461,7 @@ Transfers data from the temporary register to a block. This API uses a promise t
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -1512,7 +1512,7 @@ Transfers data from the temporary register to a block. This API uses an asynchro
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -1566,7 +1566,7 @@ Restores data in the temporary register from a block. This API uses a promise to
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -1617,7 +1617,7 @@ Restores data in the temporary register from a block. This API uses an asynchron
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -1669,7 +1669,7 @@ getSectorCount(): number
Obtains the number of sectors in this MIFARE Classic tag.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -1693,7 +1693,7 @@ getBlockCountInSector(sectorIndex: number): number
Obtains the number of blocks in a sector.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -1729,7 +1729,7 @@ getType(): [tag.MifareClassicType](js-apis-nfcTag.md#mifareclassictype9)
Obtains the type of this MIFARE Classic tag.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -1753,7 +1753,7 @@ getTagSize(): number
Obtains the size of this tag. For details, see [MifareClassicSize](js-apis-nfcTag.md#mifareclassicsize9).
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -1777,7 +1777,7 @@ isEmulatedTag(): boolean
Checks whether it is an emulated tag.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -1801,7 +1801,7 @@ getBlockIndex(sectorIndex: number): number
Obtains the index of the first block in a sector.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -1835,9 +1835,9 @@ try {
getSectorIndex(blockIndex: number): number
Obtains the index of a sector that holds the specified block.
Obtains the index of the sector that holds the specified block.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -1883,7 +1883,7 @@ Reads four pages (4 bytes per page) from this tag. This API uses a promise to re
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -1941,7 +1941,7 @@ Reads four pages (4 bytes per page) from this tag. This API uses an asynchronous
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -1995,7 +1995,7 @@ Writes one page (4 bytes) of data to this tag. This API uses a promise to return
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -2048,7 +2048,7 @@ Writes one page (4 bytes) of data to this tag. This API uses an asynchronous cal
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -2102,7 +2102,7 @@ getType(): [tag.MifareUltralightType](js-apis-nfcTag.md#mifareultralighttype9)
Obtains the type of this MIFARE Ultralight tag.
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -2136,7 +2136,7 @@ Formats this tag as an NDEF tag, and writes an NDEF message to it. This API uses
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -2190,7 +2190,7 @@ Formats this tag as an NDEF tag, and writes an NDEF message to it. This API uses
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -2245,7 +2245,7 @@ Formats this tag as an NDEF tag, writes an NDEF message to it, and then sets the
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -2299,7 +2299,7 @@ Formats this tag as an NDEF tag, writes an NDEF message to the NDEF tag, and the
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......
# tagSession
# tagSession (Standard NFC Tag Session)
The **tagSession** module provides common APIs for establishing connections and transferring data.
......@@ -28,7 +28,7 @@ Obtains the **tagInfo** object provided by the NFC service when the tag is dispa
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -56,7 +56,7 @@ Connects to this tag. Call this API to set up a connection before reading data f
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -84,7 +84,7 @@ Resets the connection to this tag.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Example**
......@@ -105,7 +105,7 @@ Checks whether the tag is connected.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -133,7 +133,7 @@ Obtains the maximum length of the data that can be sent to this tag.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -160,7 +160,7 @@ Obtains the timeout period for sending data to this tag, in milliseconds.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -188,7 +188,7 @@ Sets the timeout period for sending data to this tag, in milliseconds.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -223,7 +223,7 @@ Sends data to this tag. This API uses a promise to return the result.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......@@ -269,7 +269,7 @@ Sends data to this tag. This API uses an asynchronous callback to return the res
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Core
**System capability**: SystemCapability.Communication.NFC.Tag
**Parameters**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册