ACR122u direct communication no response

柔情痞子 提交于 2019-12-01 11:28:22
S.Pols

Finally, i have the solution. I will answer my own question in case there are other people with the same problem.

The fault was that i only send the message here. With new CommandAPDU() you already define the Class,INS, P1, P2. Besides that you don't need to define the Lc because javac will do this for us. With transmitControlCommand you do need to define the Lc. So with this knowledge the new (working) code is:

List<CardTerminal>  terminals   = null; 
TerminalFactory factory         = TerminalFactory.getDefault();
terminals                       = factory.terminals().list();

CardTerminal terminal   = terminals.get(0);
Card card               = terminal.connect("direct");

CardChannel channel     = card.getBasicChannel();

//Read register
byte[] commandAPDU1     = {(byte)0xFF,0x00,0x00,0x00,0x08,  (byte)0xD4, 0x06, 0x63, 0x05, 0x63, 0x0D, 0x63, 0x38 }; 
byte[] responseAPDU1    = card.transmitControlCommand(IOCTL_SMARTCARD_ACR122_ESCAPE_COMMAND, commandAPDU1 );                

System.out.println(bytesToHex(responseAPDU1) + "...");
//Response: D5070707059000...
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!