the process switch psam can use like this ? or Can I get an sample code?
public SmartCardReader iccreader;
public SmartCardReader2 iccreader2;
int initPsam(Context ctx)
{
iccreader = new SmartCardReader(ctx,SmartCardReader.SLOT_PSAM1);
iccreader2 = new SmartCardReader2(ctx,SmartCardReader.SLOT_PSAM3);
}
int openPsam(int slot)
{
if (slot == 1 || slot == 2 || slot == 5 || slot == 6) {
iccreader = new SmartCardReader(ctx,slot);
iccreader.open();
if (iccreader.powerOn())
String atr = iccreader.getATRString();
else
return NOT_OK;
}
else
{
iccreader2 = new SmartCardReader2(ctx,slot);
iccreader2.open();
if (iccreader2.powerOn())
String atr = iccreader2.getATRString();
else
return NOT_OK;
}
return OK;
}
public byte[] sendApdu(int slot, byte[] apdu) {
byte[] apdu_ret = new byte[0];
if (slot == 1 || slot == 2 || slot == 5 || slot == 6)
apdu_ret = iccreader.transmit(apdu);
else
apdu_ret = iccreader2.transmit(apdu);
return apdu_ret;
}
void detectcard()
{
while(){
if nfc detect card
go to select Psam aid
sendApdu(slot,apdu); // if nfc card A use slot 1, if nfc card b use slot 2 etc..
}
}
flow is()
{
initPsam(ctx);
openPsam(slot); // open until 8 psam
detectcard();
}