提交 e391d520 编写于 作者: W wujie

fix: Remove the unimplemented interface in the api document

Signed-off-by: Nwujie <1255071198@qq.com>
上级 e51dc84d
......@@ -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: 是默认支付应用,&nbsp;false: 不是默认支付应用。|
## HceService<sup>8+</sup>
提供HCE卡模拟的实现,主要包括接收对端读卡设备的APDU数据,并响应APDU数据到对端读卡设备。使用HCE相关接口前,必须先判断设备是否支持HCE卡模拟能力。
### startHCE<sup>8+</sup>
startHCE(aidList: string[]): boolean
启动HCE业务功能。包括设置当前应用为前台优先,动态注册AID列表。
**需要权限:** ohos.permission.NFC_CARD_EMULATION
**系统能力:** SystemCapability.Communication.NFC.CardEmulation
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------- | -------- | ---- | ----------------------- |
| aidList | string[] | 是 | 动态注册卡模拟的AID列表。 |
### stopHCE<sup>8+</sup>
stopHCE(): boolean
停止HCE业务功能。包括退出当前应用前台优先,释放动态注册的AID列表。
**需要权限:** ohos.permission.NFC_CARD_EMULATION
**系统能力:** SystemCapability.Communication.NFC.CardEmulation
### on<sup>8+</sup>
on(type: "hceCmd", callback: AsyncCallback<number[]>): void;
订阅回调,用于接收对端读卡设备发送的APDU数据。
**需要权限:** ohos.permission.NFC_CARD_EMULATION
**系统能力:** SystemCapability.Communication.NFC.CardEmulation
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------- | ---- | -------------------------------------------- |
| type | string | 是 | 固定填"hceCmd"字符串。 |
| callback | AsyncCallback<number[]> | 是 | 订阅的事件回调,入参是符合APDU协议的数据,每个number十六进制表示,范围是0x00~0xFF。 |
### sendResponse<sup>8+</sup>
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();
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册