diff --git a/en/application-dev/reference/apis/js-apis-cardEmulation.md b/en/application-dev/reference/apis/js-apis-cardEmulation.md index 946ebd2f881fe66a7ec6b0afc8e308d254a6f68c..59bfac2a827d240ed0ffe39fb3a99e5d35bab9b9 100644 --- a/en/application-dev/reference/apis/js-apis-cardEmulation.md +++ b/en/application-dev/reference/apis/js-apis-cardEmulation.md @@ -100,6 +100,182 @@ Checks whether an application is the default application of the specified servic | ------- | ------------------------------------ | | boolean | Returns **true** if the application is the default payment application; returns **false** otherwise.| +## HceService8+ + +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. This API is used only for declaration and cannot be used currently. + +### startHCE8+ + +startHCE(aidList: string[]): boolean + +Starts HCE, including setting the application to be foreground preferred and dynamically registering the application identifier (AID) list. This API is used only for declaration and cannot be used currently. + +> **NOTE** +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [start](#start9). + +**Required permissions**: ohos.permission.NFC_CARD_EMULATION + +**System capability**: SystemCapability.Communication.NFC.CardEmulation + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | -------- | ---- | ----------------------- | +| aidList | string[] | Yes | AID list to register.| + +### start9+ + +start(elementName: ElementName, aidList: string[]): void + +Starts HCE, including setting the application to be foreground preferred and dynamically registering the application identifier (AID) list. This API is used only for declaration and cannot be used currently. + +**Required permissions**: ohos.permission.NFC_CARD_EMULATION + +**System capability**: SystemCapability.Communication.NFC.CardEmulation + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | -------- | ---- | ----------------------- | +| elementName | ElementName | Yes | Element name of a service capability.| +| aidList | string[] | Yes | AID list to register.| + +**Error codes** + +For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md). + +| ID| Error Message | +| ------- | -------| +| 3100301 | Card emulation running state is abnormal in service. | + +### stopHCE8+ + +stopHCE(): boolean + +Stops HCE, including removing the foreground preferred attribute and releasing the dynamically registered AID list. This API is used only for declaration and cannot be used currently. + +> **NOTE** +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [stop](#stop). + +**Required permissions**: ohos.permission.NFC_CARD_EMULATION + +**System capability**: SystemCapability.Communication.NFC.CardEmulation + +### stop9+ + +stop(elementName: ElementName): void; + +Stops HCE, including removing the foreground preferred attribute and releasing the dynamically registered AID list. This API is used only for declaration and cannot be used currently. + +**Required permissions**: ohos.permission.NFC_CARD_EMULATION + +**System capability**: SystemCapability.Communication.NFC.CardEmulation + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | -------- | ---- | ----------------------- | +| elementName | ElementName | Yes | Element name of a service capability.| + +**Error codes** + +For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md). + +| ID| Error Message | +| ------- | -------| +| 3100301 | Card emulation running state is abnormal in service. | + +### on8+ + +on(type: "hceCmd", callback: AsyncCallback): void; + +Registers a callback to receive APDUs from the peer card reader. This API is used only for declaration and cannot be used currently. + +**Required permissions**: ohos.permission.NFC_CARD_EMULATION + +**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 | Yes | Callback invoked to return the APDU, which consists of hexadecimal numbers ranging from **0x00** to **0xFF**.| + +### sendResponse8+ + +sendResponse(responseApdu: number[]): void; + +Sends a response to the peer card reader. This API is used only for declaration and cannot be used currently. + +> **NOTE** +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [transmit](#transmit9). + +**Required permissions**: ohos.permission.NFC_CARD_EMULATION + +**System capability**: SystemCapability.Communication.NFC.CardEmulation + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------------ | -------- | ---- | -------------------------------------------------- | +| responseApdu | number[] | Yes | Response APDU sent to the peer card reader. The value consists of hexadecimal numbers ranging from **0x00** to **0xFF**.| + +### transmit9+ + +transmit(response: number[]): Promise\; + +Sends a response to the peer card reader. This API is used only for declaration and cannot be used currently. + +**Required permissions**: ohos.permission.NFC_CARD_EMULATION + +**System capability**: SystemCapability.Communication.NFC.CardEmulation + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------------ | -------- | ---- | -------------------------------------------------- | +| responseApdu | number[] | Yes | Response APDU sent to the peer card reader. The value consists of hexadecimal numbers ranging from **0x00** to **0xFF**.| + +**Return value** + +| **Type** | **Description** | +| ------- | -------------------------------------- | +| Promise\ | Promise that returns no value.| + +**Error codes** + +For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md). + +| ID| Error Message | +| ------- | -------| +| 3100301 | Card emulation running state is abnormal in service. | + +### transmit9+ + +transmit(response: number[], callback: AsyncCallback\): void; + +Sends a response to the peer card reader. This API is used only for declaration and cannot be used currently. + +**Required permissions**: ohos.permission.NFC_CARD_EMULATION + +**System capability**: SystemCapability.Communication.NFC.CardEmulation + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | -------- | ---- | ----------------------- | +| responseApdu | number[] | Yes | Response APDU sent to the peer card reader. The value consists of hexadecimal numbers ranging from **0x00** to **0xFF**.| +| callback | AsyncCallback\ | Yes | Callback that returns no value.| + +**Error codes** + +For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md). + +| ID| Error Message | +| ------- | -------| +| 3100301 | Card emulation running state is abnormal in service. | + **Example** ```js diff --git a/en/application-dev/reference/apis/js-apis-nfcTag.md b/en/application-dev/reference/apis/js-apis-nfcTag.md index 07e68bebed8fd58bbf29a1bb6d800b8a5710821c..c5b1ea381c93742da1cb1daa80f31561debe2b35 100644 --- a/en/application-dev/reference/apis/js-apis-nfcTag.md +++ b/en/application-dev/reference/apis/js-apis-nfcTag.md @@ -525,7 +525,7 @@ import tag from '@ohos.nfc.tag'; let elementName = null; let discTech = [tag.NFC_A, tag.NFC_B]; // replace with the tech(s) that is needed by foreground ability -function foregroundCb(err, taginfo) { +function foregroundCb(err, tagInfo) { if (!err) { console.log("foreground callback: tag found tagInfo = ", JSON.stringify(tagInfo)); } else { diff --git a/en/application-dev/reference/apis/js-apis-nfctech.md b/en/application-dev/reference/apis/js-apis-nfctech.md index b4f4905ccc0b3a6310f74ea700d16b3e6df519ea..60036f27371e1cc70b17f2bb7dbf61d169a75e62 100644 --- a/en/application-dev/reference/apis/js-apis-nfctech.md +++ b/en/application-dev/reference/apis/js-apis-nfctech.md @@ -1863,7 +1863,7 @@ The following describes the unique APIs of **MifareUltralightTag**. readMultiplePages(pageIndex: number): Promise\ -Reads four pages (4 bytes per page) from this tag. This API uses a promise to return the result. +Reads four pages of data (4 bytes per page) from this tag. This API uses a promise to return the result. **Required permissions**: ohos.permission.NFC_TAG @@ -1921,7 +1921,7 @@ try { readMultiplePages(pageIndex: number, callback: AsyncCallback\): void -Reads four pages (4 bytes per page) from this tag. This API uses an asynchronous callback to return the result. +Reads four pages of data (4 bytes per page) from this tag. This API uses an asynchronous callback to return the result. **Required permissions**: ohos.permission.NFC_TAG @@ -2188,6 +2188,13 @@ Formats this tag as an NDEF tag, and writes an NDEF message to it. This API uses | ------------------ | --------------------------| | callback: AsyncCallback\ | Callback invoked to return the result.| +**Error codes** + +For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md). + +| ID| Error Message| +| ------- | -------| +| 3100201 | Tag running state is abnormal in service. | **Example** @@ -2297,6 +2304,13 @@ Formats this tag as an NDEF tag, writes an NDEF message to the NDEF tag, and the | ------------------ | --------------------------| | callback: AsyncCallback\ | Callback invoked to return the result.| +**Error codes** + +For details about the error codes, see [NFC Error Codes](../errorcodes/errorcode-nfc.md). + +| ID| Error Message| +| ------- | -------| +| 3100201 | Tag running state is abnormal in service. | **Example** diff --git a/en/application-dev/reference/apis/js-apis-secureElement.md b/en/application-dev/reference/apis/js-apis-secureElement.md index daa96f217bdcc86ffcd76fde5b8a7d08b2a3a966..fed469b3a874ea2a82aacb8fcbbf5b2ab70ea35d 100644 --- a/en/application-dev/reference/apis/js-apis-secureElement.md +++ b/en/application-dev/reference/apis/js-apis-secureElement.md @@ -261,7 +261,7 @@ For details about error codes, see [SE Error Codes](../errorcodes/errorcode-se.m | ID| Error Message | | -------- | -------------------------------- | -| 3300101 | Illegal service state exception. | +| 3300101 | IllegalStateError, service state exception. | **Example** @@ -302,8 +302,8 @@ For details about error codes, see [SE Error Codes](../errorcodes/errorcode-se.m | ID| Error Message | | -------- | -------------------------------- | -| 3300101 | Illegal service state exception. | -| 3300104 | Secure element IO exception. | +| 3300101 | IllegalStateError, service state exception. | +| 3300104 | IOError, there is a communication problem to the reader or the SE. | **Example** @@ -340,7 +340,7 @@ For details about error codes, see [SE Error Codes](../errorcodes/errorcode-se.m | ID| Error Message | | -------- | -------------------------------- | -| 3300101 | Illegal service state exception. | +| 3300101 | IllegalStateError, service state exception. | **Example** @@ -413,7 +413,7 @@ For details about error codes, see [SE Error Codes](../errorcodes/errorcode-se.m | ID| Error Message | | -------- | -------------------------------- | -| 3300101 | Illegal service state exception. | +| 3300101 | IllegalStateError, service state exception. | **Example** @@ -456,7 +456,7 @@ For details about error codes, see [SE Error Codes](../errorcodes/errorcode-se.m | ID| Error Message | | -------- | -------------------------------- | -| 3300101 | Illegal service state exception. | +| 3300101 | IllegalStateError, service state exception. | **Example** @@ -526,7 +526,7 @@ For details about error codes, see [SE Error Codes](../errorcodes/errorcode-se.m | ID| Error Message | | -------- | -------------------------------- | -| 3300101 | Illegal service state exception. | +| 3300101 | IllegalStateError, service state exception. | **Example** @@ -570,10 +570,10 @@ For details about error codes, see [SE Error Codes](../errorcodes/errorcode-se.m | ID| Error Message | | -------- | -------------------------------- | -| 3300101 | Illegal service state exception. | -| 3300102 | No such element exception. | -| 3300103 | Illegal access rule exception. | -| 3300104 | Secure element IO exception. | +| 3300101 | IllegalStateError, an attempt is made to use an SE session that has been closed. | +| 3300102 | NoSuchElementError, the AID on the SE is not available or cannot be selected. | +| 3300103 | SecurityError, the calling application cannot be granted access to this AID or the default applet on this session. | +| 3300104 | IOError, there is a communication problem to the reader or the SE. | **Example** @@ -619,10 +619,10 @@ For details about error codes, see [SE Error Codes](../errorcodes/errorcode-se.m | ID| Error Message | | -------- | -------------------------------- | -| 3300101 | Illegal service state exception. | -| 3300102 | No such element exception. | -| 3300103 | Illegal access rule exception. | -| 3300104 | Secure element IO exception. | +| 3300101 | IllegalStateError, an attempt is made to use an SE session that has been closed. | +| 3300102 | NoSuchElementError, the AID on the SE is not available or cannot be selected. | +| 3300103 | SecurityError, the calling application cannot be granted access to this AID or the default applet on this session. | +| 3300104 | IOError, there is a communication problem to the reader or the SE. | **Example** @@ -675,10 +675,10 @@ For details about error codes, see [SE Error Codes](../errorcodes/errorcode-se.m | ID| Error Message | | -------- | -------------------------------- | -| 3300101 | Illegal service state exception. | -| 3300102 | No such element exception. | -| 3300103 | Illegal access rule exception. | -| 3300104 | Secure element IO exception. | +| 3300101 | IllegalStateError, an attempt is made to use an SE session that has been closed. | +| 3300102 | NoSuchElementError, the AID on the SE is not available or cannot be selected. | +| 3300103 | SecurityError, the calling application cannot be granted access to this AID or the default applet on this session. | +| 3300104 | IOError, there is a communication problem to the reader or the SE. | **Example** @@ -726,10 +726,10 @@ For details about error codes, see [SE Error Codes](../errorcodes/errorcode-se.m | ID| Error Message | | -------- | -------------------------------- | -| 3300101 | Illegal service state exception. | -| 3300102 | No such element exception. | -| 3300103 | Illegal access rule exception. | -| 3300104 | Secure element IO exception. | +| 3300101 | IllegalStateError, an attempt is made to use an SE session that has been closed. | +| 3300102 | NoSuchElementError, the AID on the SE is not available or cannot be selected. | +| 3300103 | SecurityError, the calling application cannot be granted access to this AID or the default applet on this session. | +| 3300104 | IOError, there is a communication problem to the reader or the SE. | **Example** @@ -782,10 +782,10 @@ For details about error codes, see [SE Error Codes](../errorcodes/errorcode-se.m | ID| Error Message | | -------- | -------------------------------- | -| 3300101 | Illegal service state exception. | -| 3300102 | No such element exception. | -| 3300103 | Illegal access rule exception. | -| 3300104 | Secure element IO exception. | +| 3300101 | IllegalStateError, an attempt is made to use an SE session that has been closed. | +| 3300102 | NoSuchElementError, the AID on the SE is not available or cannot be selected. | +| 3300103 | SecurityError, the calling application cannot be granted access to this AID or the default applet on this session. | +| 3300104 | IOError, there is a communication problem to the reader or the SE. | **Example** @@ -831,10 +831,10 @@ For details about error codes, see [SE Error Codes](../errorcodes/errorcode-se.m | ID| Error Message | | -------- | -------------------------------- | -| 3300101 | Illegal service state exception. | -| 3300102 | No such element exception. | -| 3300103 | Illegal access rule exception. | -| 3300104 | Secure element IO exception. | +| 3300101 | IllegalStateError, an attempt is made to use an SE session that has been closed. | +| 3300102 | NoSuchElementError, the AID on the SE is not available or cannot be selected. | +| 3300103 | SecurityError, the calling application cannot be granted access to this AID or the default applet on this session. | +| 3300104 | IOError, there is a communication problem to the reader or the SE. | **Example** @@ -887,10 +887,10 @@ For details about error codes, see [SE Error Codes](../errorcodes/errorcode-se.m | ID| Error Message | | -------- | -------------------------------- | -| 3300101 | Illegal service state exception. | -| 3300102 | No such element exception. | -| 3300103 | Illegal access rule exception. | -| 3300104 | Secure element IO exception. | +| 3300101 | IllegalStateError, an attempt is made to use an SE session that has been closed. | +| 3300102 | NoSuchElementError, the AID on the SE is not available or cannot be selected. | +| 3300103 | SecurityError, the calling application cannot be granted access to this AID or the default applet on this session. | +| 3300104 | IOError, there is a communication problem to the reader or the SE. | **Example** @@ -947,10 +947,10 @@ For details about error codes, see [SE Error Codes](../errorcodes/errorcode-se.m | ID| Error Message | | -------- | -------------------------------- | -| 3300101 | Illegal service state exception. | -| 3300102 | No such element exception. | -| 3300103 | Illegal access rule exception. | -| 3300104 | Secure element IO exception. | +| 3300101 | IllegalStateError, an attempt is made to use an SE session that has been closed. | +| 3300102 | NoSuchElementError, the AID on the SE is not available or cannot be selected. | +| 3300103 | SecurityError, the calling application cannot be granted access to this AID or the default applet on this session. | +| 3300104 | IOError, there is a communication problem to the reader or the SE. | **Example** @@ -1176,9 +1176,9 @@ For details about error codes, see [SE Error Codes](../errorcodes/errorcode-se.m | ID| Error Message | | -------- | -------------------------------- | -| 3300101 | Illegal service state exception. | -| 3300103 | Illegal access rule exception. | -| 3300104 | Secure element IO exception. | +| 3300101 | IllegalStateError, an attempt is made to use an SE session or channel that has been closed. | +| 3300103 | SecurityError, the command is filtered by the security policy. | +| 3300104 | IOError, there is a communication problem to the reader or the SE. | **Example** @@ -1228,9 +1228,9 @@ For details about error codes, see [SE Error Codes](../errorcodes/errorcode-se.m | ID| Error Message | | -------- | -------------------------------- | -| 3300101 | Illegal service state exception. | -| 3300103 | Illegal access rule exception. | -| 3300104 | Secure element IO exception. | +| 3300101 | IllegalStateError, an attempt is made to use an SE session or channel that has been closed. | +| 3300103 | SecurityError, the command is filtered by the security policy. | +| 3300104 | IOError, there is a communication problem to the reader or the SE. | **Example** diff --git a/en/application-dev/reference/errorcodes/errorcode-se.md b/en/application-dev/reference/errorcodes/errorcode-se.md index adafce2852253a434ef9f1d40ef860cea9a43832..329346808d82b736e36754813613f2b29c1ff8fa 100644 --- a/en/application-dev/reference/errorcodes/errorcode-se.md +++ b/en/application-dev/reference/errorcodes/errorcode-se.md @@ -8,7 +8,7 @@ **Error Message** -Illegal service state exception. +IllegalStateError, an attempt is made to use an SE session that has been closed. **Description** @@ -28,7 +28,7 @@ The SecureElement (SE) service is abnormal. **Error Message** -No such element exception. +NoSuchElementError, the AID on the SE is not available or cannot be selected. **Description** @@ -48,7 +48,7 @@ The SE is unavailable. **Error Message** -Illegal access rule exception. +SecurityError, the calling application cannot be granted access to this AID or the default applet on this session. **Description** @@ -67,7 +67,7 @@ The access rule cannot be obtained. **Error Message** -Secure element IO exception. +IOError, there is a communication problem to the reader or the SE. **Description**