Android NFC transceiver () uses NFCF Technology (Sony felica)

I'm trying to connect my Android Tablet to a device using NFC and retrieve data from the device

I tried

According to NFC_ device_ detection_ Send the command as described in 1.01.pdf (Chapter 4)

The Android Java DOC of transitional () mentioned

"The application shall not attach SOD (length) or EOD (CRC) to the payload, it will be calculated automatically"

So I try to use and not use CRC, with and without packet data length, but the document is not clear whether I should leave it blank or if I should not include it

Another approach I take is to follow format_ sequence_ guidelines_ 1.1.pdf the chart in Chapter 2.2 (synchronization code followed by request), but the results are the same

problem

I don't know what commands (bytes) to send as arguments to the transceive () method**

problem

Is there anyone:

>Take an example of NFCF communication? > More information about protocols / commands that should be used? > Do you know if the NFC tag contains the number of bytes required by the command?

code

Transitive() throws an IO exception "tag missing"

I believe this is because my command byte is incorrect (I used a series of different commands)

Last comment (I'm also tired of putting transceiver () in a while loop and closing and connecting communication each time)

    String action = intent.getAction();

    if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(action)) {

        Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);

        NfcF nfcf = NfcF.get(tag);

        nfcf.connect();

        byte[] command = new byte[] { (byte) 0x00, (byte) 0x00};

        byte[] response =  nfcf.transceive(command);

     }

If your answer needs any other information, please comment. Thank you

resolvent:

The following is an example function of how to send the "original" command given the target device (tag) IDM, felica command byte and payload:

byte[] rawCmd(NfcF nfcF, byte[] IDm, byte felicaCmd, byte[] payload) throws IOException {
    final int len = payload != null ? payload.length : 0;

    final byte[] cmd = new byte[10 + len];
    cmd[0] = (byte) (10 + len);
    cmd[1] = felicaCmd;
    System.arraycopy(IDm, 0, cmd, 2, IDm.length);

    if (payload != null) {
        System.arraycopy(payload, 0, cmd, 10, payload.length);
    }

    nfcF.transceive(cmd);
}

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>