S.Pols
S.Pols

Reputation: 3434

ACR122u card-emulation mode send PN532 commands

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:

I just can't figure out how I can send the actual PN532 command for example:

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!!

Upvotes: 0

Views: 1537

Answers (1)

npostavs
npostavs

Reputation: 5027

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.

Upvotes: 1

Related Questions