0 like 0 dislike
106 views
in T10 by Q&A Freshman (102 points)
recategorized by

Hi, i have 6 sam card for test, which I've done is always create 

iccreader = new SmartCardReader(ctx,slot);
iccreader.open();
if(iccreader.powerOn())
    atr = Hex.hexStringToByteArray(iccreader.getATRString());
iccreader.transmit(apdu);

 how to send apdu with specific slot without create new, open and power on?cause speed slows down, maybe like iccreader.transmit(slot,apdu); slot is psam between 6 sam card to use.

Please log in or register to answer this question.

1 Answer

0 like 0 dislike
by Q&A Professional (5.2k points)
The T10 device has 8 PSAM slots and can only work two PSAM slots at the same time. You can use the "SmartCardReader" and "SmartCardReader2" classes. It is worth noting that the number of PSAM slots, it is separated into two groups. PSAM 1/2/5/6 is one group, and PSAM 3/4/7/8 is another group.

For example, if you use the "SmartCardReader" to open the psam1, you can not use the "SmartCardReader2" to open the psam2, because psam1 and psam2 is the same group.
by Q&A Freshman (102 points)
0 0
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();
}
by Q&A Professional (5.2k points)
0 0
The “SmartCardReader” and “SmartCardReader2” are written in the same way
by Q&A Freshman (102 points)
0 0
Can you give a simple code example? switch PSAM still must open and power on.
and  log below ,Does this have an effect too? com.common.service not found

STIUtility RDR-->ICC : 00A4040007D3600100020001
13:39:06.752  4161-4307  System.err              id.co.softorb.transjakarta           W  android.content.pm.PackageManager$NameNotFoundException: Application package com.common.service not found
13:39:06.753  4161-4307                          id.co.softorb.transjakarta           W      at android.app.ContextImpl.createPackageContextAsUser(ContextImpl.java:2525)
13:39:06.753  4161-4307                          id.co.softorb.transjakarta           W      at android.app.ContextImpl.createPackageContext(ContextImpl.java:2490)
13:39:06.753  4161-4307                          id.co.softorb.transjakarta           W      at android.content.ContextWrapper.createPackageContext(ContextWrapper.java:1000)
13:39:06.753  4161-4307                          id.co.softorb.transjakarta           W      at android.content.ContextWrapper.createPackageContext(ContextWrapper.java:1000)
13:39:06.753  4161-4307                          id.co.softorb.transjakarta           W      at com.common.apiutil.reader.SmartCardReader.<init>(SmartCardReader.java:46)
13:39:06.753  4161-4307                          id.co.softorb.transjakarta           W      at id.co.softorb.lib.smartcard.telpo.sam.openSamCard(sam.java:206)
13:39:06.753  4161-4307                          id.co.softorb.transjakarta           W      at id.co.softorb.lib.smartcard.telpo.sam.sendCB(sam.java:158)
13:39:06.753  4161-4307                          id.co.softorb.transjakarta           W      at id.co.softorb.lib.smartcard.telpo.telpo.sendSAM(telpo.java:301)
13:39:06.753  4161-4307                          id.co.softorb.transjakarta           W      at id.co.softorb.lib.passti.model.impl.STIUtility.sendSAM(STIUtility.java:2924)
13:39:06.753  4161-4307                          id.co.softorb.transjakarta           W      at id.co.softorb.lib.passti.model.impl.DKI.DKI_SAM_SelectAID(DKI.java:138)
13:39:06.753  4161-4307                          id.co.softorb.transjakarta           W      at id.co.softorb.lib.passti.model.impl.DKI.deduct(DKI.java:504)
13:39:06.753  4161-4307                          id.co.softorb.transjakarta           W      at id.co.softorb.lib.passti.model.impl.STIUtility.deduct(STIUtility.java:1283)
13:39:06.753  4161-4307                          id.co.softorb.transjakarta           W      at id.co.softorb.library.payment.Prepaid.Deduct(Prepaid.java:296)
13:39:06.753  4161-4307                          id.co.softorb.transjakarta           W      at id.co.softorb.transjakarta.HomeFragment.MainScreen(HomeFragment.java:257)
13:39:06.754  4161-4307                          id.co.softorb.transjakarta           W      at id.co.softorb.transjakarta.HomeFragment.InitiateScreen(HomeFragment.java:232)
13:39:06.754  4161-4307                          id.co.softorb.transjakarta           W      at id.co.softorb.transjakarta.HomeFragment.PrepaidReadyIdle(HomeFragment.java:626)
13:39:06.754  4161-4307                          id.co.softorb.transjakarta           W      at id.co.softorb.library.payment.Prepaid.FindSAM(Prepaid.java:420)
13:39:06.754  4161-4307                          id.co.softorb.transjakarta           W      at id.co.softorb.transjakarta.HomeFragment.PrepaidLibInitSuccess(HomeFragment.java:352)
13:39:06.754  4161-4307                          id.co.softorb.transjakarta           W      at id.co.softorb.library.payment.Prepaid.onDeviceConnected(Prepaid.java:356)
13:39:06.754  4161-4307                          id.co.softorb.transjakarta           W      at id.co.softorb.lib.passti.model.impl.STIUtility.onDeviceConnected(STIUtility.java:2187)
13:39:06.754  4161-4307                          id.co.softorb.transjakarta           W      at id.co.softorb.lib.passti.model.impl.STIUtility.Open(STIUtility.java:2142)
13:39:06.754  4161-4307                          id.co.softorb.transjakarta           W      at id.co.softorb.lib.passti.model.impl.STIUtility.onDeviceConnected(STIUtility.java:2184)
13:39:06.754  4161-4307                          id.co.softorb.transjakarta           W      at id.co.softorb.lib.passti.model.impl.STIUtility.initPOSDevices(STIUtility.java:420)
13:39:06.754  4161-4307                          id.co.softorb.transjakarta           W      at id.co.softorb.lib.passti.model.impl.STIUtility.SetDeviceService(STIUtility.java:468)
13:39:06.754  4161-4307                          id.co.softorb.transjakarta           W      at id.co.softorb.library.payment.Prepaid$1.run(Prepaid.java:470)
13:39:06.754  4161-4307                          id.co.softorb.transjakarta           W      at java.lang.Thread.run(Thread.java:920)


this happens if calling the function  "  iccreader = new SmartCardReader(ctx,SmartCardReader.SLOT_PSAM1);"
lib version : telpoLib_v2.14.20231218.aar
by Q&A Professional (5.2k points)
0 0
"com.common.service not found"
This warning can be ignored and does not affect the use. This is because our AAR package is compatible with other devices. Some of our devices need to install the service apk to use, and your device does not need this service apk.

Related questions

0 like 0 dislike
1 answer 75 views
asked in T10 by bconnhs Q&A Freshman (106 points)
0 like 0 dislike
1 answer 13 views
asked in T10 by AlexEsLa Q&A Freshman (103 points)
0 like 0 dislike
1 answer 55 views
0 like 0 dislike
1 answer 143 views
asked in K20 by James Q&A Professional (5.3k points)
0 like 0 dislike
1 answer 46 views
asked in TPS360 by jason Q&A Expert (11.0k points)
0 like 0 dislike
1 answer 38 views
Welcome to Telpo Q&A,

If you have a technical question ,please ask here, in English.
.
If you have faulty devices need be repaired,please create a issue ticket.

Please inquiry your ticket.

Notice :If you have an urgent question or cannot register account of Q&A, you can contact the online support in below jivochat .

Categories

...