未验证 提交 32445386 编写于 作者: K king_he 提交者: Gitee

update en/application-dev/reference/apis/js-apis-connectedTag.md.

Signed-off-by: Nking_he <6384784@qq.com>
上级 8fa5632e
# Active Tag
> ![icon-note.gif](public_sys-resources/icon-note.gif)**NOTE**<br/>
> **NOTE**<br>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
......@@ -22,9 +22,9 @@ Initializes the active tag chip.
**System capability**: SystemCapability.Communication.ConnectedTag
- Return value
| **Type**| **Description**|
| **Type** | **Description** |
| -------- | -------- |
| boolean | Returns **true** if the initialization is successful; returns **false** otherwise.|
| boolean | Returns **true** if the initialization is successful; returns **false** otherwise. |
## connectedTag.uninit
......@@ -38,9 +38,9 @@ Uninitializes the active tag resources.
**System capability**: SystemCapability.Communication.ConnectedTag
- Return value
| **Type**| **Description**|
| **Type** | **Description** |
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| boolean | Returns **true** if the operation is successful; returns **false** otherwise. |
## connectedTag.readNdefTag
......@@ -54,9 +54,9 @@ Reads the content of this active tag. This method uses a promise to return the r
**System capability**: SystemCapability.Communication.ConnectedTag
- Return value
| **Type**| **Description**|
| **Type** | **Description** |
| -------- | -------- |
| Promise&lt;string&gt; | Promise used to return the content of the active tag.|
| Promise&lt;string&gt; | Promise used to return the content of the active tag. |
- Example
```
......@@ -78,9 +78,9 @@ Reads the content of this active tag. This method uses an asynchronous callback
**System capability**: SystemCapability.Communication.ConnectedTag
- Parameters
| **Name**| **Type**| **Mandatory**| **Description**|
| **Name** | **Type** | **Mandatory** | **Description** |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;string&gt; | Yes| Callback invoked to return the active tag content obtained.|
| callback | AsyncCallback&lt;string&gt; | Yes | Callback invoked to return the active tag content obtained. |
- Example
```
......@@ -102,14 +102,14 @@ Writes data to this active tag. This method uses a promise to return the result.
**System capability**: SystemCapability.Communication.ConnectedTag
- Parameters
| **Name**| **Type**| **Mandatory**| **Description**|
| **Name** | **Type** | **Mandatory** | **Description** |
| -------- | -------- | -------- | -------- |
| data | string | Yes| Data to write. The maximum length is 1024 bytes.|
| data | string | Yes | Data to write. The maximum length is 1024 bytes. |
- Return value
| **Type**| **Description**|
| **Type** | **Description** |
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result. This method returns no value.|
| Promise&lt;void&gt; | Promise used to return the result. This method returns no value. |
- Example
```
......@@ -136,10 +136,10 @@ Writes data to this active tag. This method uses an asynchronous callback to ret
**System capability**: SystemCapability.Communication.ConnectedTag
- Parameters
| **Name**| **Type**| **Mandatory**| **Description**|
| **Name** | **Type** | **Mandatory** | **Description** |
| -------- | -------- | -------- | -------- |
| data | string | Yes| Data to write. The maximum length is 1024 bytes.|
| callback | AsyncCallback&lt;string&gt; | Yes| Callback invoked to return the operation result.|
| data | string | Yes | Data to write. The maximum length is 1024 bytes. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback invoked to return the operation result. |
- Example
```
......@@ -168,13 +168,13 @@ Registers the NFC field strength state events.
**System capability**: SystemCapability.Communication.ConnectedTag
- Parameters
| **Name**| **Type**| **Mandatory**| **Description**|
| **Name** | **Type** | **Mandatory** | **Description** |
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **notify**.|
| callback | Callback&lt;number&gt; | Yes| Callback invoked to return the field strength state.|
| type | string | Yes | Event type. The value is **notify**. |
| callback | Callback&lt;number&gt; | Yes | Callback invoked to return the field strength state. |
- Enumerates the field strength states.
| **Value**| **Description**|
| **Value** | **Description** |
| -------- | -------- |
| 0 | Field off. |
| 1 | Field on. |
......@@ -191,10 +191,10 @@ Unregisters the NFC field strength state events.
**System capability**: SystemCapability.Communication.ConnectedTag
- Parameters
| **Name**| **Type**| **Mandatory**| **Description**|
| **Name** | **Type** | **Mandatory** | **Description** |
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **notify**.|
| callback | Callback&lt;number&gt; | No| Callback used to return the field strength state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| type | string | Yes | Event type. The value is **notify**. |
| callback | Callback&lt;number&gt; | No | Callback used to return the field strength state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered. |
- Example
```
......@@ -206,10 +206,10 @@ Unregisters the NFC field strength state events.
console.info("nfc rf receive state: " + result);
}
// Register event
// Register event notification
connectedTag.on(NFC_RF_NOTIFY, recvNfcRfNotifyFunc);
// Unregister event
// Unregister event notification
connectedTag.off(NFC_RF_NOTIFY, recvNfcRfNotifyFunc);
```
......@@ -217,7 +217,7 @@ Unregisters the NFC field strength state events.
Enumerates the NFC states.
| Name| Default Value| Description|
| -------- | -------- | -------- |
| NFC_RF_LEAVE | 0 | Field off. |
| NFC_RF_ENTER | 1 | Field on. |
| Name | Default Value | Description |
| -------- | -------- | -------- |
| NFC_RF_LEAVE | 0 | Field off. |
| NFC_RF_ENTER | 1 | Field on. |
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册