问题
I just read this answer about how to put my ACR122U in card-emulation mode. I do understand the purpose but how do you need to send the commands to the ACR122u.
As far as I know FF000000 means:
- FF [Class]
- 00 [INS]
- 00 [P1]
- 00 [P2]
I just can't figure out how I can send the actual PN532 command for example:
- FF000000 08 D406 6305 630D 6338
- FF000000 11 D408 6302 80 6303 80 6305 xx 630D yy 6338 zz
I have come this far:
TerminalFactory factory = TerminalFactory.getDefault();
List<CardTerminal> terminals;
try {
terminals = factory.terminals().list();
CardTerminal terminal = terminals.get(0);
Card card = terminal.connect("*");
CardChannel channel = card.getBasicChannel();
byte[] command = {???};
CommandAPDU command1 = new CommandAPDU(0xFF,0x00,0x00,0x00, command);
ResponseAPDU response1 = channel.transmit(command1);
System.out.println(bytesToHex(response1.getBytes()));
} catch (CardException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
I appreciate your help!
Many thanks in advance!!
回答1:
Assuming 08 D406 6305 630D 6338 means
- 08 [Lc]
- D406 6305 630D 6338 [data]
It would look like this:
byte[] command = new byte[8] { (byte) 0xD4, 0x06, 0x63, 0x05, 0x63, 0x0D, 0x63, 0x38 };
You can leave out the the 8
since javac will count the bytes for you.
来源:https://stackoverflow.com/questions/24726444/acr122u-card-emulation-mode-send-pn532-commands