简体   繁体   English

ACR122u卡仿真模式发送PN532命令

[英]ACR122u card-emulation mode send PN532 commands

I just read this answer about how to put my ACR122U in card-emulation mode. 我刚刚看了这个答案如何把我的ACR122U卡模拟模式。 I do understand the purpose but how do you need to send the commands to the ACR122u. 我确实了解目的,但您需要如何将命令发送到ACR122u。

As far as I know FF000000 means: 据我所知FF000000意味着:

  • FF [Class] FF [班级]
  • 00 [INS] 00 [INS]
  • 00 [P1] 00 [P1]
  • 00 [P2] 00 [P2]

I just can't figure out how I can send the actual PN532 command for example: 我只是不知道如何发送实际的PN532命令,例如:

  • FF000000 08 D406 6305 630D 6338 FF000000 08 D406 6305 630D 6338
  • FF000000 11 D408 6302 80 6303 80 6305 xx 630D yy 6338 zz 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!! 提前谢谢了!!

Assuming 08 D406 6305 630D 6338 means 假设08 D406 6305 630D 6338表示

  • 08 [Lc] 08 [Lc]
  • D406 6305 630D 6338 [data] D406 6305 630D 6338 [数据]

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. 您可以省略8因为javac会为您计算字节数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM