I'm getting a tag lost exception when sending SELECT PPSE command using the tag's transceive method.
The intent is passed to readTag
and the method is getting the tag from the intent but calling the transceive method for the SELECT PPSE command APDU results in a tag lost exception instead of getting the Response APDU message:
public void readTag(Intent intent) {
String action = intent.getAction();
if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(action)) {
System.out.println("Got the tag");
Tag tagFromIntent = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
NfcA mfc = NfcA.get(tagFromIntent);
System.out.println(mfc);
try {
mfc.connect();
System.out.println(mfc.getTag());
System.out.println(mfc.getClass());
byte[] ATQA = mfc.getAtqa();
System.out.println(getHexString(ATQA));
System.out.println(mfc.getMaxTransceiveLength());
mfc.setTimeout(500000);
String value = "00A404000e325041592e5359532e444446303100"; //PPSE APDU value
String hex = value.toString();
byte[] data = HexToByte(hex);
byte[] response = mfc.transceive(data); //sending request
System.out.println(getHexString(response));
mfc.close();
} catch(Exception e) {
Toast.makeText(getBaseContext(), e.getMessage(),
Toast.LENGTH_SHORT).show();
}
}
}