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';
| 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
| 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.
| 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**.|
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.