protected abstract class SCActivity.SCThread
extends java.lang.Thread
| Modifier | Constructor and Description |
|---|---|
protected |
SCThread() |
| Modifier and Type | Method and Description |
|---|---|
void |
abort()
Not relevant to subclasses.
|
protected Card |
ConnectCard(java.lang.String CardClass,
byte PreferredProtocols) |
protected Card |
ConnectCard(java.lang.String CardClass,
int Slot,
byte PreferredProtocols)
Establishes the connection to the card in the reader and get the card instance implemented by user.
|
void |
run()
Not relevant to subclasses.
|
protected void |
RunCommands()
Subclasses should override this method for performing card operations to
be done.
|
protected void |
WaitCardInserted()
method to wait card inserted event.
|
protected void |
WaitCardRemoved()
method to wait card removed event.
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yieldpublic final void run()
run in interface java.lang.Runnablerun in class java.lang.Threadprotected final Card ConnectCard(java.lang.String CardClass, int Slot, byte PreferredProtocols) throws SCException
CardClass - card class name to be created. ex: "com.infothink.smartcard.EMVCard"Slot - Default Slot = 0, You can connect other slots if your reader support multi-slotsPreferredProtocols - A bitmask of acceptable protocols for the connection. Possible values may be combined with the OR operation:
Card.PROTOCOL_T0, Card.PROTOCOL_T1 and Card.PROTOCOL_ANYCard.IdentifyCard(byte[]).SCExceptionprotected final Card ConnectCard(java.lang.String CardClass, byte PreferredProtocols) throws SCException
SCExceptionprotected void WaitCardInserted()
throws SCException
SCException - smart card exception, check the message to see the exception detailWaitCardRemoved()protected void WaitCardRemoved()
throws SCException
SCException - smart card exception, check the message to see the exception detailWaitCardInserted()protected void RunCommands()
throws SCException
Error message SCActivity.Events.RUN_COMMANDS_ERROR will be send to SCActivity.handleSCMessage(Message) method
if any exception thrown. Also client can handle the exception itself by try{} catch{}.
Typically, this will be the main logic of the application, sending the card APUD commands and getting the responds.
example:
@Override
protected void RunCommands() throws SCException {
EMVCard card = (EMVCard)ConnectCard("com.infothink.smartcard.EMVCard", Card.PROTOCOL_ANY);
if (card == null) {
ShowMessage("please insert card");
return;
}
....
do all card commands, ex:
card.SelectPSE();
card.SelectApplication();
card.initiateApplication();
....
card.Disconnect();
}
SCExceptionConnectCard(String CardClass, byte PreferredProtocols);public final void abort()
Copyright © 2025. All rights reserved.