I am trying to connect an Android tablet to a device using NFC and retrieve data from the device.
What i tried
Sending commands, as explained in nfc_device_detection_1.01.pdf (chapter 4)
Android java doc for transceive () mentions
"Applications should not add SoD (length) or EoD (CRC) to the payload, they will be automatically calculated"
So I tried with and without CRC, with and without packet length, but the documentation is unclear if I should leave it empty or I just shouldn't include it.
Another approach I took is following the diagram in chapter 2.2 format_sequence_guidelines_1.1.pdf (the synchronization code followed by the request), but the same results.
Problem
I do not know which command (bytes) to send as an argument to the transceive () method. **
Questions
Someone:
- Is there an example of NFCF exchange?
- is there any additional protocol / command information to be used?
- to know if the NFC tag contains the bytes I need for the command?
The code
transceive () throws an IO exception "The tag was lost."
I believe this is because my command bytes are incorrect (I used a number of different commands).
Last note (I am also tired of putting transceive () in a while loop and closing and connecting the connection every 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); }
Please comment if any additional information is required to receive answers. Thanks.
source share