周BUG
周BUG
  • 发布:2019-07-26 15:53
  • 更新:2019-07-26 15:53
  • 阅读:1065

NFC写IC卡的,执行成功就是卡里没数据,本人新手请教各位老大。UNIAPP开发的

分类:uni-app
NFC

writeData:function(intent){
var intent = this.main.getIntent();
if(intent.getAction()=="android.nfc.action.TECH_DISCOVERED"){
var tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
var mfc=MifareClassic.get(tag);
try{
mfc.connect();
this.ICUID=this.ByteArrayToHexString(tag.getId());
var cmdBytes=this.HexStringToByteArray(this.keyVal);
var auth=false;
var text="1383838384380000";
var textBytes = plus.android.invoke(text,"getBytes");
console.log(textBytes);
auth=invoke(mfc,"authenticateSectorWithKeyA",parseInt(1),cmdBytes);
mfc.writeBlock(2, textBytes);
mfc.close();


console.log打印结果:49,51,56,51,56,51,56,51,56,52,51,56,48,48,48,48

2019-07-26 15:53 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复