public abstract class Card
extends java.lang.Object
CardTerminal.connect()
.CardTerminal
Modifier | Constructor and Description |
---|---|
protected |
Card()
Constructs a new Card object.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
beginExclusive()
Requests exclusive access to this card.
|
abstract void |
disconnect(boolean reset)
Disconnects the connection with this card.
|
abstract void |
endExclusive()
Releases the exclusive access previously established using
beginExclusive . |
abstract ATR |
getATR()
Returns the ATR of this card.
|
abstract CardChannel |
getBasicChannel()
Returns the CardChannel for the basic logical channel.
|
abstract java.lang.String |
getProtocol()
Returns the protocol in use for this card.
|
abstract CardChannel |
openLogicalChannel()
Opens a new logical channel to the card and returns it.
|
abstract byte[] |
transmitControlCommand(int controlCode,
byte[] command)
Transmits a control command to the terminal device.
|
protected Card()
This constructor is called by subclasses only. Application should call the CardTerminal.connect() method to obtain a Card object.
public abstract ATR getATR()
public abstract java.lang.String getProtocol()
public abstract CardChannel getBasicChannel()
java.lang.SecurityException
- if a SecurityManager exists and the
caller does not have the required
permissionjava.lang.IllegalStateException
- if this card object has been disposed of
via the disconnect() methodpublic abstract CardChannel openLogicalChannel() throws CardException
MANAGE CHANNEL
command that should use
the format [00 70 00 00 01]
.java.lang.SecurityException
- if a SecurityManager exists and the
caller does not have the required
permissionCardException
- is a new logical channel could not be openedjava.lang.IllegalStateException
- if this card object has been disposed of
via the disconnect() methodpublic abstract void beginExclusive() throws CardException
Once a thread has invoked beginExclusive
, only this
thread is allowed to communicate with this card until it calls
endExclusive
. Other threads attempting communication
will receive a CardException.
Applications have to ensure that exclusive access is correctly
released. This can be achieved by executing
the beginExclusive()
and endExclusive
calls
in a try ... finally
block.
java.lang.SecurityException
- if a SecurityManager exists and the
caller does not have the required
permissionCardException
- if exclusive access has already been set
or if exclusive access could not be establishedjava.lang.IllegalStateException
- if this card object has been disposed of
via the disconnect() methodpublic abstract void endExclusive() throws CardException
beginExclusive
.java.lang.SecurityException
- if a SecurityManager exists and the
caller does not have the required
permissionjava.lang.IllegalStateException
- if the active Thread does not currently have
exclusive access to this card or
if this card object has been disposed of
via the disconnect() methodCardException
- if the operation failedpublic abstract byte[] transmitControlCommand(int controlCode, byte[] command) throws CardException
This can be used to, for example, control terminal functions like a built-in PIN pad or biometrics.
controlCode
- the control code of the commandcommand
- the command datajava.lang.SecurityException
- if a SecurityManager exists and the
caller does not have the required
permissionjava.lang.NullPointerException
- if command is nullCardException
- if the card operation failedjava.lang.IllegalStateException
- if this card object has been disposed of
via the disconnect() methodpublic abstract void disconnect(boolean reset) throws CardException
reset
- whether to reset the card after disconnecting.CardException
- if the card operation failedjava.lang.SecurityException
- if a SecurityManager exists and the
caller does not have the required
permission