From e391d5209e85dbb1246bda5e51a6b3091ec77c65 Mon Sep 17 00:00:00 2001 From: wujie <1255071198@qq.com> Date: Wed, 28 Dec 2022 16:55:56 +0800 Subject: [PATCH] fix: Remove the unimplemented interface in the api document Signed-off-by: wujie <1255071198@qq.com> --- .../reference/apis/js-apis-cardEmulation.md | 85 +------------------ 1 file changed, 1 insertion(+), 84 deletions(-) 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 46d0485bb5..cf66358043 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-cardEmulation.md +++ b/zh-cn/application-dev/reference/apis/js-apis-cardEmulation.md @@ -68,7 +68,7 @@ isDefaultService(elementName: ElementName, type: CardType): boolean | 参数名 | 类型 | 必填 | 说明 | | ------- | -------- | ---- | ----------------------- | | elementName | [ElementName](js-apis-bundleManager-elementName.md#elementname) | 是 | 应用的描述,由Bundle名称和组件名称组成。 | -| type | [CardType](#cardtype) | 是 | 应用的描述,由Bundle名称和组件名称组成。 | +| type | [CardType](#cardtype) | 是 | 支付类型。 | **返回值:** @@ -76,69 +76,6 @@ isDefaultService(elementName: ElementName, type: CardType): boolean | -------- | -------- | | boolean | true: 是默认支付应用, false: 不是默认支付应用。| -## HceService8+ - -提供HCE卡模拟的实现,主要包括接收对端读卡设备的APDU数据,并响应APDU数据到对端读卡设备。使用HCE相关接口前,必须先判断设备是否支持HCE卡模拟能力。 - -### startHCE8+ - -startHCE(aidList: string[]): boolean - -启动HCE业务功能。包括设置当前应用为前台优先,动态注册AID列表。 - -**需要权限:** ohos.permission.NFC_CARD_EMULATION - -**系统能力:** SystemCapability.Communication.NFC.CardEmulation - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------- | -------- | ---- | ----------------------- | -| aidList | string[] | 是 | 动态注册卡模拟的AID列表。 | - -### stopHCE8+ - -stopHCE(): boolean - -停止HCE业务功能。包括退出当前应用前台优先,释放动态注册的AID列表。 - -**需要权限:** ohos.permission.NFC_CARD_EMULATION - -**系统能力:** SystemCapability.Communication.NFC.CardEmulation - -### 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数据到对端读卡设备。 - -**需要权限:** ohos.permission.NFC_CARD_EMULATION - -**系统能力:** SystemCapability.Communication.NFC.CardEmulation - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------------ | -------- | ---- | -------------------------------------------------- | -| responseApdu | number[] | 是 | 发送到对端读卡设备的符合APDU协议的数据,每个number十六进制表示,范围是0x00~0xFF。 | - **示例:** ```js @@ -156,25 +93,5 @@ var elementName = { }; var isDefaultService = cardEmulation.isDefaultService(elementName, cardEmulation.CardType.PAYMENT); console.log('is the app is default service for this card type: ' + isDefaultService); - -// device supports HCE, transimit APDU with remote nfc reader. -var hceService = new cardEmulation.HceService(); -hceService.startHCE([ - "F0010203040506", "A0000000041010" -]); - -hceService.on("hceCmd", (err, res) => { - if(err.data === 0) { - console.log('callback => Operation hceCmd succeeded. Data: ' + JSON.stringify(res)); - hceService.sendResponse([0x00,0xa4,0x04,0x00, - 0x0e,0x32,0x50,0x41,0x59,0x2e,0x53,0x59,0x53,0x2e,0x44,0x44, - 0x46,0x30,0x31,0x00]); - } else { - console.log('callback => Operation hceCmd failed. Cause: ' + err.data); - } -}) - -// stop HCE when the application exit the nfc card emulation. -hceService.stopHCE(); ``` -- GitLab