Reply To: Trying to read DESFire EV1 Card, requires Authentication.

Forum MIFARE SDK Trying to read DESFire EV1 Card, requires Authentication. Reply To: Trying to read DESFire EV1 Card, requires Authentication.

Re: Trying to read DESFire EV1 Card, requires Authentication.

22. March 2016 at 15:44
Cesar, Did you find any solution for this?

I am still struggling with this.

@Override
public void onDESFireCardDetected(final IDESFireEV1 objDESFire) {

if(mCardType == EnumCardType.EnumDESFireEV1 && mIsPerformingCardOperations){
//Already Some Operations are happening in the same card, discard the callback
Log.d(TAG, "----- Already Some Operations are happening in the same card, discard the callback: " + mCardType.toString());
return;
}
mIsPerformingCardOperations = true;
mCardType = EnumCardType.EnumDESFireEV1;

mDESFire =objDESFire;
/* Insert your logic here by commenting the function call below. */
try {
mDESFire.getReader().close();
mDESFire.getReader().connect();
showMessage("DESFire EV1 Found", 't');

}catch (Throwable t) {
t.printStackTrace();
showMessage("Unknown Error Tap Again!", 't');
}
mIsPerformingCardOperations = false;
}

The Code on top works but then all functions are very limited for mDESFire object.
If I change declaration ->
private IDESFireEV1 mDESFire; to private DESFireEV1 mDESFire; and "final IDESFireEV1 objDESFire" to "final DESFireEV1 objDESFire" then function on top cant be @Override and then it wont trigger when DESFire card found. So what is the solution that I cant use functions under DESFireEV1 (com.nxp.nfclib.desfire)? I am working with sample app and lib is "nxpnfclib".


For IDESFireEV1 (com.nxp.nfcliblite.cards) there is only these functions:

public interface IDESFireEV1 {
String TAG = "DESFire_LITE";
void writeNDEF(byte[] var1, NdefMessage var2) throws SmartCardException;
NdefMessage readNDEF(byte[] var1);
void updatePICCMasterKey(byte[] var1, byte[] var2) throws SmartCardException;
void authenticate(byte[] var1, byte[] var2, byte[] var3) throws SmartCardException;
void personalize(byte[] var1, byte[] var2, byte[] var3) throws SmartCardException;
void updateApplicationMasterKey(byte[] var1, byte[] var2, byte[] var3, byte[] var4) throws SmartCardException;
void write(byte[] var1) throws SmartCardException;
byte[] read(int var1) throws SmartCardException;
CardDetails getCardDetails() throws SmartCardException;
void format(byte[] var1) throws SmartCardException;
byte[] getUID() throws SmartCardException;
IReader getReader();
Type getType();
+ 1  |  - 0