|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectopencard.core.service.SmartCard
public final class SmartCard
The SmartCard object is the point of access to the OpenCard framework for the application. CardServices are accessible through the services of the SmartCard object.
A SmartCard object is always tied to the controlling CardServiceScheduler.
CardService
Constructor Summary | |
---|---|
SmartCard(CardServiceScheduler scheduler,
CardID cid)
Instantiates a SmartCard object that is tied to scheduler. |
Method Summary | |
---|---|
void |
beginMutex()
Gain exclusive access to the card. |
void |
close()
Closes this SmartCard object and signals to OCF that the allocated resources are not any longer required. |
void |
endMutex()
Releases exclusive access to the card. |
protected void |
finalize()
Finalizer: close this SmartCard in case it is still open. |
APDUTracer |
getAPDUTracer()
Return the current APDUTracer |
CardID |
getCardID()
Gets the CardID object representing this smart card. |
CardService |
getCardService(java.lang.Class clazz,
boolean block)
Tries to instantiate a CardService for the smart card that implements class clazz. |
static SmartCard |
getSmartCard(CardTerminalEvent ctEvent)
Deprecated. use getSmartCard(CardTerminalEvent, CardRequest) |
static SmartCard |
getSmartCard(CardTerminalEvent ctEvent,
CardRequest req)
Gets a SmartCard object for a received CardTerminalEvent provided that the CardRequest can be satisfied. |
static SmartCard |
getSmartCard(CardTerminalEvent ctEvent,
CardRequest req,
java.lang.Object lockHandle)
Gets a SmartCard object for a received CardTerminalEvent provided that the CardRequest can be satisfied. |
static java.lang.String |
getVersion()
return version information about OCF It returns a string of the form OCF1.2;IBM Reference Implementation, Build Hudson, 21-May-1999 The first part indicates the API. |
static boolean |
isStarted()
Determines whether the startup process has already been carried out during this session. |
CardID |
reset(boolean warm)
Reset inserted card |
void |
setAPDUTracer(APDUTracer tracer)
Sets the APDU tracer that monitors all APDU to and from the card- |
static void |
shutdown()
Shuts down the entire OpenCard Framework. |
static void |
start()
Initializes the entire OpenCard Framework and is meant to be the first method to be invoked in any application in order to setup OpenCard properly. |
static SmartCard |
waitForCard(CardRequest req)
Waits for a card to be inserted into any of the card terminals attached to the system. |
static SmartCard |
waitForCard(CardRequest req,
java.lang.Object lockHandle)
Waits for a card to be inserted into any of the locked card terminals attached to the system. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SmartCard(CardServiceScheduler scheduler, CardID cid)
scheduler
- The controlling CardServiceScheduler.cid
- The CardID object representing the physical
smart card.Method Detail |
---|
public static java.lang.String getVersion()
OCF1.2;IBM Reference Implementation, Build Hudson, 21-May-1999
The first part indicates the API. It always starts with "OCF", followed by an API version number, and terminate by a semicolon. Currently, this the API version number is simply the OCF release number. When a formal OCF specification becomes available, it would refer to the version of that specification it implements. After the semicolon, vendor specific information is included. The format of the vendor specific information is not specified.
public void beginMutex() throws java.lang.InterruptedException, CardTerminalException
java.lang.InterruptedException
- Thrown when no exclusive access to the card could be gained.
CardTerminalException
- Thrown when the terminal encountered an error.CardService.setCardChannel(opencard.core.service.CardChannel)
,
CardServiceScheduler.allocateCardChannel(java.lang.Object, boolean)
public void close() throws CardTerminalException
CardTerminalException
- Thrown when an error is encountered during cleanup.public void endMutex()
protected void finalize()
finalize
in class java.lang.Object
public CardID getCardID()
public CardService getCardService(java.lang.Class clazz, boolean block) throws java.lang.ClassNotFoundException, CardServiceException
clazz
- The class that the CardService shall implement.block
- If true, indicates that the CardService should run in
blocking mode.
java.lang.ClassNotFoundException
- Thrown when no CardService implementing clazz
exists for this card.
CardServiceException
- Thrown when a service was found but failed to initialize.public static SmartCard getSmartCard(CardTerminalEvent ctEvent) throws CardTerminalException
CardTerminalException
public static SmartCard getSmartCard(CardTerminalEvent ctEvent, CardRequest req) throws CardTerminalException
ctEvent
- The received CardTerminalEvent.req
- A CardRequest object describing the kind of
smart card that we are interested in.
CardTerminalException
public static SmartCard getSmartCard(CardTerminalEvent ctEvent, CardRequest req, java.lang.Object lockHandle) throws CardTerminalException
ctEvent
- The received CardTerminalEvent.req
- A CardRequest object describing the kind of
smart card that we are interested in.lockHandle
- the handle obtained by the lock owner when locking a
slot or terminal.
CardTerminalException
public static boolean isStarted()
public static void shutdown() throws CardTerminalException
CardTerminalException
public static void start() throws OpenCardPropertyLoadingException, java.lang.ClassNotFoundException, CardServiceException, CardTerminalException
java.lang.ClassNotFoundException
- thrown when one of the required classes is not found
OpenCardPropertyLoadingException
- thrown if something goes wrong during the the property loading
process
CardServiceException
CardTerminalException
public static SmartCard waitForCard(CardRequest req) throws CardTerminalException
req
- A CardRequest object describing the kind of
smart card that we are interested in.
CardTerminalException
CardRequest
,
CTListener
,
CTListener.cardInserted(opencard.core.event.CardTerminalEvent)
,
CTListener.cardRemoved(opencard.core.event.CardTerminalEvent)
,
getSmartCard(opencard.core.event.CardTerminalEvent, opencard.core.service.CardRequest)
public static SmartCard waitForCard(CardRequest req, java.lang.Object lockHandle) throws CardTerminalException
req
- A CardRequest object describing the kind of
smart card that we are interested in.lockHandle
- handle obtained by lock owner when locking a terminal. This
parameter is only necessary for locked terminals / slots.
CardTerminalException
CardRequest
,
CTListener
,
CTListener.cardInserted(opencard.core.event.CardTerminalEvent)
,
CTListener.cardRemoved(opencard.core.event.CardTerminalEvent)
,
getSmartCard(opencard.core.event.CardTerminalEvent, opencard.core.service.CardRequest)
public CardID reset(boolean warm) throws CardTerminalException
CardTerminalException
public void setAPDUTracer(APDUTracer tracer)
tracer
- the APDUTracerpublic APDUTracer getAPDUTracer()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |