- MifareClassic.transceive读数据返回data为什么为空?
//和卡建立连接 mc.connect({ success: function(res) { console.log("连接卡成功: " + JSON.stringify(res)) //验证密码A指令 var keyaBs = [0x60, 0x04, 0xAE, 0x38, 0x40, 0x39, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]; //把字节数组转成ArrayBuffer var keyaArray = new Uint8Array(keyaBs.map(function (bs) { return bs; })); var keyaBuffer = keyaArray.buffer; //验证密码A mc.transceive({ data:keyaBuffer, success:function(res){ console.error("验证密码A" + "成功" + res.errMsg); var arr = [0x30, 1] var arrayBuffer = new Int8Array(arr).buffer var u8 = new Uint8Array(arrayBuffer) for(var i = 0; i < u8.length; i ++) { console.log(u8[i]) } //发送指令 mc.transceive({ data: arrayBuffer, success: function(res) { console.log("transceive返回: " + JSON.stringify(res)) }, fail: function(e) { console.log("transceive异常: " + JSON.stringify(e)) } }); }, fail:function(res){ console.error("验证密码A" + "失败" + res.errMsg); }, complete:function(res){ console.error("验证密码A" + "状态" + res.errMsg); } }); }, fail: function(e) { console.log("和卡连接异常: " + JSON.stringify(e)) } }) 结果:transceive返回: {"errMsg":"transceive:ok","data":{}}
2021-01-29 - 微信小程序MifareClassic可以验证扇区密码吗?
MifareClassic.transceive(Object object)发送数据 对于MifareClassic的分块读写 指令 0x30 + 块号 可以用于读取某个块的数据指令 0xA0 + 块号 + 待写入数据 可以用于往某个块写入数据没有填写扇区密码的参数
2021-01-26