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

!17426 [翻译完成】#I6S0V9

Merge pull request !17426 from Annie_wang/PR16676
......@@ -118,8 +118,8 @@ if (!hasHceCap) {
}
var elementName = {
"bundleName": "com.test.cardemulation",
"abilityName": "com.test.cardemulation.MainAbility",
"bundleName": "com.example.myapplication",
"abilityName": "EntryAbility",
};
var isDefaultService = cardEmulation.isDefaultService(elementName, cardEmulation.CardType.PAYMENT);
console.log('is the app is default service for this card type: ' + isDefaultService);
......
......@@ -32,6 +32,7 @@ isNfcAvailable(): boolean
Checks whether the device supports NFC.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use canIUse("SystemCapability.Communication.NFC.Core").
**System capability**: SystemCapability.Communication.NFC.Core
......@@ -50,6 +51,7 @@ openNfc(): boolean
Opens NFC.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [enableNfc](#controllerenablenfc9).
**Required permissions**: ohos.permission.MANAGE_SECURE_SETTINGS
......@@ -64,9 +66,9 @@ Opens NFC.
## controller.enableNfc<sup>9+</sup>
enableNfc(): boolean
enableNfc(): void
Opens NFC.
Enables NFC.
**Required permissions**: ohos.permission.MANAGE_SECURE_SETTINGS
......@@ -87,6 +89,7 @@ closeNfc(): boolean
Closes NFC.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [disableNfc](#controllerdisablenfc9).
**Required permissions**: ohos.permission.MANAGE_SECURE_SETTINGS
......@@ -101,9 +104,9 @@ Closes NFC.
## controller.disableNfc<sup>9+</sup>
disableNfc(): boolean
disableNfc(): void
Closes NFC.
Disables NFC.
**Required permissions**: ohos.permission.MANAGE_SECURE_SETTINGS
......@@ -172,7 +175,7 @@ Unsubscribes from the NFC state changes. The subscriber will not receive NFC sta
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type to unsubscribe from. The value is **nfcStateChange**.|
| type | string | Yes| Event type to unsubscribe from. The value is **nfcStateChange**.|
| callback | Callback&lt;[NfcState](#nfcstate)&gt; | No| Callback for the NFC state changes. This parameter can be left blank.|
**Example**
......@@ -180,7 +183,7 @@ Unsubscribes from the NFC state changes. The subscriber will not receive NFC sta
```js
import controller from '@ohos.nfc.controller';
// Register the callback to receive NFC state change notifications.
// Register a callback to receive the NFC state change notification.
controller.on("nfcStateChange", (err, nfcState)=> {
if (err) {
console.log("controller on callback err: " + err);
......@@ -189,7 +192,7 @@ controller.on("nfcStateChange", (err, nfcState)=> {
}
});
// Open NFC. Require permission: ohos.permission.MANAGE_SECURE_SETTINGS.
// Open NFC. The ohos.permission.MANAGE_SECURE_SETTINGS permission is required.
if (!controller.isNfcOpen()) {
var ret = controller.openNfc();
console.log("controller openNfc ret: " + ret);
......@@ -203,7 +206,7 @@ try {
console.log("controller enableNfc busiError: " + busiError);
}
// Close NFC. Require permission: ohos.permission.MANAGE_SECURE_SETTINGS.
// Close NFC. The ohos.permission.MANAGE_SECURE_SETTINGS permission is required.
if (controller.isNfcOpen()) {
var ret = controller.closeNfc();
console.log("controller closeNfc ret: " + ret);
......
......@@ -96,7 +96,7 @@ Connects to this tag. Call this API to set up a connection before reading data f
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. |
......@@ -154,7 +154,7 @@ Resets the connection to this tag.
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. |
......@@ -183,8 +183,6 @@ Checks whether the tag is connected.
> **NOTE**
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [tagSession.isConnected](#tagsessionisconnected9).
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -211,8 +209,6 @@ isConnected(): boolean
Checks whether the tag is connected.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.NFC.Tag
**Return value**
......@@ -287,7 +283,7 @@ Obtains the maximum length of the data that can be sent to this tag.
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. |
......@@ -357,7 +353,7 @@ Obtains the timeout period for sending data to this tag, in milliseconds.
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. |
......@@ -419,7 +415,7 @@ console.log("tag setSendDataTimeout setStatus: " + setStatus);
setTimeout(timeout: number): void
Obtains the timeout period for sending data to this tag, in milliseconds.
Sets the timeout period for sending data to this tag, in milliseconds.
**Required permissions**: ohos.permission.NFC_TAG
......@@ -435,7 +431,7 @@ Obtains the timeout period for sending data to this tag, in milliseconds.
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. |
......@@ -555,7 +551,7 @@ tag.getIsoDep(tagInfo).sendData(cmdData, (err, response)=> {
transmit(data: number[]): Promise<number[]>
Sends data to this tag. This API uses a promise to return the result.
Transmits data to this tag. This API uses a promise to return the result.
**Required permissions**: ohos.permission.NFC_TAG
......@@ -565,7 +561,7 @@ Sends data to this tag. This API uses a promise to return the result.
| Name | Type | Mandatory| Description |
| -------- | ----------------------- | ---- | -------------------------------------- |
| data | number[] | Yes| Data to send. The data consists of hexadecimal numbers ranging from **0x00** to **0xFF**.|
| data | number[] | Yes| Data to transmit. The data consists of hexadecimal numbers ranging from **0x00** to **0xFF**. |
**Return value**
......@@ -577,7 +573,7 @@ Sends data to this tag. This API uses a promise to return the result.
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. |
......@@ -616,7 +612,7 @@ try {
transmit(data: number[], callback: AsyncCallback<number[]>): void
Sends data to this tag. This API uses an asynchronous callback to return the result.
Transmits data to this tag. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.NFC_TAG
......@@ -626,14 +622,14 @@ Sends data to this tag. This API uses an asynchronous callback to return the res
| Name | Type | Mandatory| Description |
| -------- | ----------------------- | ---- | -------------------------------------- |
| data | number[] | Yes| Data to send. The data consists of hexadecimal numbers ranging from **0x00** to **0xFF**.|
| data | number[] | Yes| Data to transmit. The data consists of hexadecimal numbers ranging from **0x00** to **0xFF**. |
| callback | AsyncCallback<number[]> | Yes| Callback invoked to return the response from the tag. The response consists of hexadecimal numbers ranging from **0x00** to **0xFF**.|
**Error codes**
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. |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册