IsoDep.transceive(Object object) 往 NFC 卡片写入 apdu 指令并接收卡片返回数据;
参考代码:
var frameStr = "00CA0000106810AAAAAAAAAAAAAA310301B20005161A";
//var frameStr = "3004";
var frame = HexUtils.hexToByteArray(frameStr);
console.log(HexUtils.byteArrToHex(frame));
nfcTag.transceive({
data: frame.buffer,
success: res => {
console.log("数据写入成功" + JSON.stringify(res));
console.log("-------" + HexUtils.byteArrToHex(res.data.buffer));
},
fail: error => {
console.log("数据写入失败");
console.log(error);
},
complete: res => {
//this.closeConnect(NFCTab);
}
})
打印日志如下:
数据写入成功{"errno":0,"errMsg":"transceive:ok","data"{},"__wx_dont_hook_sdk_inner_variable_packkeys_otherwise_you_will_regret_and_occur_bug__":["data"]} -------NULL
测试手机华为Mate40E,测试数据满足apdu格式,用android 原生APP测试,发送和接收数据均正常