From ac9b1086c097145b133653127dc111e911a4fc8d Mon Sep 17 00:00:00 2001 From: wujie <1255071198@qq.com> Date: Tue, 22 Aug 2023 10:34:57 +0800 Subject: [PATCH] Docs: [nfc] consistency check between md and dts documents Signed-off-by: wujie <1255071198@qq.com> --- .../reference/apis/js-apis-cardEmulation.md | 176 ++++++++++++++++++ .../reference/apis/js-apis-nfcTag.md | 2 +- .../reference/apis/js-apis-nfctech.md | 14 ++ 3 files changed, 191 insertions(+), 1 deletion(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-cardEmulation.md b/zh-cn/application-dev/reference/apis/js-apis-cardEmulation.md index 3a236c4223..ef778465d2 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-cardEmulation.md +++ b/zh-cn/application-dev/reference/apis/js-apis-cardEmulation.md @@ -100,6 +100,182 @@ isDefaultService(elementName: ElementName, type: CardType): boolean | ------- | ------------------------------------ | | boolean | true: 是默认支付应用, false: 不是默认支付应用。 | +## HceService8+ + +提供HCE卡模拟的实现,主要包括接收对端读卡设备的APDU数据,并响应APDU数据到对端读卡设备。使用HCE相关接口前,必须先判断设备是否支持HCE卡模拟能力。暂不支持使用,仅做接口声明。 + +### startHCE8+ + +startHCE(aidList: string[]): boolean + +启动HCE业务功能。包括设置当前应用为前台优先,动态注册AID列表。暂不支持使用,仅做接口声明。 + +> **说明:** +> 从 API version 8 开始支持,从 API version 9 开始废弃,建议使用[start](#start9)替代。 + +**需要权限:** ohos.permission.NFC_CARD_EMULATION + +**系统能力:** SystemCapability.Communication.NFC.CardEmulation + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | -------- | ---- | ----------------------- | +| aidList | string[] | 是 | 动态注册卡模拟的AID列表。 | + +### start9+ + +start(elementName: ElementName, aidList: string[]): void + +启动HCE业务功能。包括设置当前应用为前台优先,动态注册AID列表。暂不支持使用,仅做接口声明。 + +**需要权限:** ohos.permission.NFC_CARD_EMULATION + +**系统能力:** SystemCapability.Communication.NFC.CardEmulation + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | -------- | ---- | ----------------------- | +| elementName | ElementName | 是 | 服务能力的元素名称。 | +| aidList | string[] | 是 | 动态注册卡模拟的AID列表。 | + +**错误码:** + +以下错误码的详细介绍请参见[NFC错误码](../errorcodes/errorcode-nfc.md)。 + +| 错误码ID | 错误信息| +| ------- | -------| +| 3100301 | Card emulation running state is abnormal in service. | + +### stopHCE8+ + +stopHCE(): boolean + +停止HCE业务功能。包括退出当前应用前台优先,释放动态注册的AID列表。暂不支持使用,仅做接口声明。 + +> **说明:** +> 从 API version 8 开始支持,从 API version 9 开始废弃,建议使用[stop](#stop)替代。 + +**需要权限:** ohos.permission.NFC_CARD_EMULATION + +**系统能力:** SystemCapability.Communication.NFC.CardEmulation + +### stop9+ + +stop(elementName: ElementName): void; + +停止HCE业务功能。包括退出当前应用前台优先,释放动态注册的AID列表。暂不支持使用,仅做接口声明。 + +**需要权限:** ohos.permission.NFC_CARD_EMULATION + +**系统能力:** SystemCapability.Communication.NFC.CardEmulation + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | -------- | ---- | ----------------------- | +| elementName | ElementName | 是 | 服务能力的元素名称。 | + +**错误码:** + +以下错误码的详细介绍请参见[NFC错误码](../errorcodes/errorcode-nfc.md)。 + +| 错误码ID | 错误信息| +| ------- | -------| +| 3100301 | Card emulation running state is abnormal in service. | + +### on8+ + +on(type: "hceCmd", callback: AsyncCallback): void; + +订阅回调,用于接收对端读卡设备发送的APDU数据。暂不支持使用,仅做接口声明。 + +**需要权限:** ohos.permission.NFC_CARD_EMULATION + +**系统能力:** SystemCapability.Communication.NFC.CardEmulation + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | -------------------------------------------- | +| type | string | 是 | 固定填"hceCmd"字符串。 | +| callback | AsyncCallback | 是 | 订阅的事件回调,入参是符合APDU协议的数据,每个number十六进制表示,范围是0x00~0xFF。 | + +### sendResponse8+ + +sendResponse(responseApdu: number[]): void; + +发送APDU数据到对端读卡设备。暂不支持使用,仅做接口声明。 + +> **说明:** +> 从 API version 8 开始支持,从 API version 9 开始废弃,建议使用[transmit](#transmit9)替代。 + +**需要权限:** ohos.permission.NFC_CARD_EMULATION + +**系统能力:** SystemCapability.Communication.NFC.CardEmulation + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------------ | -------- | ---- | -------------------------------------------------- | +| responseApdu | number[] | 是 | 发送到对端读卡设备的符合APDU协议的数据,每个number十六进制表示,范围是0x00~0xFF。 | + +### transmit9+ + +transmit(response: number[]): Promise; + +发送APDU数据到对端读卡设备。暂不支持使用,仅做接口声明。 + +**需要权限:** ohos.permission.NFC_CARD_EMULATION + +**系统能力:** SystemCapability.Communication.NFC.CardEmulation + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------------ | -------- | ---- | -------------------------------------------------- | +| responseApdu | number[] | 是 | 发送到对端读卡设备的符合APDU协议的数据,每个number十六进制表示,范围是0x00~0xFF。 | + +**返回值:** + +| **类型** | **说明** | +| ------- | -------------------------------------- | +| Promise | 表示异步回调完成。 | + +**错误码:** + +以下错误码的详细介绍请参见[NFC错误码](../errorcodes/errorcode-nfc.md)。 + +| 错误码ID | 错误信息| +| ------- | -------| +| 3100301 | Card emulation running state is abnormal in service. | + +### transmit9+ + +transmit(response: number[], callback: AsyncCallback): void; + +发送APDU数据到对端读卡设备。暂不支持使用,仅做接口声明。 + +**需要权限:** ohos.permission.NFC_CARD_EMULATION + +**系统能力:** SystemCapability.Communication.NFC.CardEmulation + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | -------- | ---- | ----------------------- | +| responseApdu | number[] | 是 | 发送到对端读卡设备的符合APDU协议的数据,每个number十六进制表示,范围是0x00~0xFF。 | +| callback | AsyncCallback | 是 | 回调函数void | + +**错误码:** + +以下错误码的详细介绍请参见[NFC错误码](../errorcodes/errorcode-nfc.md)。 + +| 错误码ID | 错误信息| +| ------- | -------| +| 3100301 | Card emulation running state is abnormal in service. | + **示例:** ```js diff --git a/zh-cn/application-dev/reference/apis/js-apis-nfcTag.md b/zh-cn/application-dev/reference/apis/js-apis-nfcTag.md index a094d8e76a..67f609219f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-nfcTag.md +++ b/zh-cn/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/zh-cn/application-dev/reference/apis/js-apis-nfctech.md b/zh-cn/application-dev/reference/apis/js-apis-nfctech.md index 122d4992bf..0c2388bd8c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-nfctech.md +++ b/zh-cn/application-dev/reference/apis/js-apis-nfctech.md @@ -2188,6 +2188,13 @@ format(message: [NdefMessage](#ndefmessage9), callback: AsyncCallback\): v | ------------------ | --------------------------| | callback: AsyncCallback\ | 回调函数。 | +**错误码:** + +以下错误码的详细介绍请参见[NFC错误码](../errorcodes/errorcode-nfc.md)。 + +| 错误码ID | 错误信息| +| ------- | -------| +| 3100201 | Tag running state is abnormal in service. | **示例:** @@ -2297,6 +2304,13 @@ formatReadOnly(message: [NdefMessage](#ndefmessage9), callback: AsyncCallback\ | 回调函数。 | +**错误码:** + +以下错误码的详细介绍请参见[NFC错误码](../errorcodes/errorcode-nfc.md)。 + +| 错误码ID | 错误信息| +| ------- | -------| +| 3100201 | Tag running state is abnormal in service. | **示例:** -- GitLab