|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--opencard.core.terminal.CardTerminal
The CardTerminal class represents a physical card terminal. It is
assumed that a certain card terminal provides (at least one) slot for a
smart card or a transceiver for a contactless smart card. Please NOTE that
throughout OpenCard Framework inserting or removing a card may
equally well mean that a connection between a contactless card and a transceiver
was established or ended respectively.
Depending on the features of the specific card terminal a concrete
implementation might also implement additional, optional, interfaces (as found in
opencard.opt.terminal.
Similar to the PCSC smart card specification we assume that the card terminal will automatically power up the smart card and retrieve the ATR response (available through cardID() as a CardID object).
CardTerminal objects are created by a CardTerminalFactory and registered in the CardTerminalRegistry. To get an enumeration of the available CardTerminals invoke CardTerminalRegistry.getCardTerminals ().
CardTerminalRegistry
,
CardTerminalFactory
,
CardID
Field Summary | |
protected java.lang.String |
address
|
protected java.lang.String |
name
Useful information about this card terminal: the name, the type, and the address (usually meaning the COM port) as registered with the CardTerminalRegistry. |
protected java.util.Vector |
slots
Deprecated. |
protected java.lang.String |
type
|
Constructor Summary | |
protected |
CardTerminal(java.lang.String name,
java.lang.String type,
java.lang.String address)
Instantiates a CardTerminal object. |
Method Summary | |
protected void |
addSlots(int numberOfSlots)
Add Slots to the CardTerminal. |
protected void |
cardInserted(int slotID)
Notify listeners that a card was inserted into a slot of this terminal. (utility method). |
protected void |
cardRemoved(int slotID)
Notify listeners that a card was removed from a slot of this terminal. (utility method). |
abstract void |
close()
Closes the CardTerminal. |
void |
closeSlotChannel(SlotChannel sc)
Closes a SlotChannel. |
java.util.Enumeration |
enumerateSlots()
Deprecated. |
java.util.Properties |
features()
Query the card terminal about its features. Each feature is represented by a property. |
java.lang.String |
getAddress()
Return the address of this CardTerminal. |
abstract CardID |
getCardID(int slotID)
Return the answer-to-reset (ATR) response of the card inserted in slot slotID as a CardID. |
CardID |
getCardID(int slotID,
int ms)
Deprecated. |
java.lang.String |
getName()
Return the name associated with this CardTerminal. |
Slot |
getSlot(int slotID)
Deprecated. |
int |
getSlots()
Return the number of slots belonging to this CardTerminal object. |
java.lang.String |
getType()
Return the type of this CardTerminal. |
protected void |
internalCloseSlotChannel(SlotChannel sc)
The internal closeSlotChannel method. |
protected java.util.Properties |
internalFeatures(java.util.Properties features)
The CardTerminal internal features() method to be provided by the concrete implementation. |
protected void |
internalOpenSlotChannel(int slotID)
The internal openSlotChannel method. |
protected void |
internalOpenSlotChannel(int slotID,
java.lang.Object lockHandle)
The internal openSlotChannel method for locked terminals (default implementation). |
protected abstract CardID |
internalReset(int slot,
int ms)
The internal reset method to be provided by the concrete implementation. |
protected abstract ResponseAPDU |
internalSendAPDU(int slot,
CommandAPDU capdu,
int ms)
The internalSendAPDU method to be provided by the concrete implementation. |
abstract boolean |
isCardPresent(int slotID)
Check whether there is a smart card present in a particular slot. |
boolean |
isCardPresent(Slot slot)
Deprecated. use isCardPresent(int) instead |
boolean |
isSlotChannelAvailable(int slotID)
Check whether a SlotChannel is available for a particular slot. |
boolean |
isSlotChannelAvailable(Slot slot)
Deprecated. use isSlotChannelAvailable(int) instead |
abstract void |
open()
Initializes the CardTerminal. |
SlotChannel |
openSlotChannel(int slotID)
Open a SlotChannel on Slot number slotID. |
SlotChannel |
openSlotChannel(int slotID,
java.lang.Object lockHandle)
Open a SlotChannel on Slot number slotID. |
SlotChannel |
openSlotChannel(Slot slot)
Deprecated. use openSlotChannel(int) instead |
CardID |
reset(SlotChannel sc)
Reset a smart card inserted in a slot. |
CardID |
reset(SlotChannel sc,
int ms)
Deprecated. use reset(SlotChannel) |
ResponseAPDU |
sendAPDU(SlotChannel sc,
CommandAPDU capdu)
Send a CommandAPDU on a slot. |
ResponseAPDU |
sendAPDU(SlotChannel sc,
CommandAPDU capdu,
int ms)
Deprecated. |
ResponseAPDU |
sendVerifiedCommandAPDU(SlotChannel chann,
CommandAPDU capdu,
CHVControl vc,
int ms)
default implementation for deprecated method in interface VerifiedAPDUInterface. |
Slot[] |
slots()
|
java.lang.String |
toString()
Returns a printable representation of this CardTerminal object. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected java.util.Vector slots
protected final java.lang.String name
protected final java.lang.String type
protected final java.lang.String address
Constructor Detail |
protected CardTerminal(java.lang.String name, java.lang.String type, java.lang.String address)
name
- The user friendly name.type
- The terminal type.address
- An identifier for the driver to locate the terminal.Method Detail |
public java.util.Enumeration enumerateSlots()
public final java.util.Properties features()
Each feature is represented by a property. The standard features are
public java.lang.String getAddress()
public abstract CardID getCardID(int slotID) throws CardTerminalException
This call should NOT block if no card is present.
slotID
- slot id.public CardID getCardID(int slotID, int ms) throws CardTerminalException
public java.lang.String getName()
public Slot getSlot(int slotID) throws java.lang.IndexOutOfBoundsException
public java.lang.String getType()
public Slot[] slots()
public int getSlots()
public abstract boolean isCardPresent(int slotID) throws CardTerminalException
slotID
- slot to check for a card.public boolean isCardPresent(Slot slot) throws CardTerminalException
public boolean isSlotChannelAvailable(int slotID)
slotID
- The slot to check.public boolean isSlotChannelAvailable(Slot slot)
public abstract void open() throws CardTerminalException
public abstract void close() throws CardTerminalException
public final SlotChannel openSlotChannel(int slotID) throws InvalidSlotChannelException, java.lang.IndexOutOfBoundsException, CardTerminalException
slotID
- The number of the slot for which a SlotChannel
is requested.public final SlotChannel openSlotChannel(int slotID, java.lang.Object lockHandle) throws InvalidSlotChannelException, java.lang.IndexOutOfBoundsException, CardTerminalException
slotID
- The number of the slot for which a SlotChannel
is requested.handle
- trust ticket obtained from locking the terminalpublic final SlotChannel openSlotChannel(Slot slot) throws InvalidSlotChannelException, java.lang.IndexOutOfBoundsException, CardTerminalException
public final void closeSlotChannel(SlotChannel sc) throws InvalidSlotChannelException, CardTerminalException
sc
- The SlotChannel to close.public final CardID reset(SlotChannel sc, int ms) throws InvalidSlotChannelException, CardTerminalException
public final CardID reset(SlotChannel sc) throws InvalidSlotChannelException, CardTerminalException
sc
- The open SlotChannel attached to the slot.internalReset(int, int)
public final ResponseAPDU sendAPDU(SlotChannel sc, CommandAPDU capdu) throws InvalidSlotChannelException, CardTerminalException
sc
- The open SlotChannel attached to the slot.capdu
- The CommandAPDU to send.public final ResponseAPDU sendAPDU(SlotChannel sc, CommandAPDU capdu, int ms) throws InvalidSlotChannelException, CardTerminalException
public java.lang.String toString()
protected void addSlots(int numberOfSlots) throws CardTerminalException
numberOfSlots
- The number of slots to add.protected void cardRemoved(int slotID)
slot
- slot number of the slot where a card was removedprotected void cardInserted(int slotID)
slot
- slot number of the slot where a card was insertedprotected java.util.Properties internalFeatures(java.util.Properties features)
features
- A Properties object that needs to be enhanced
with the card terminal specific features.protected void internalOpenSlotChannel(int slotID) throws CardTerminalException
slotID
- The number of the slot for which a SlotChannel is requested.protected void internalOpenSlotChannel(int slotID, java.lang.Object lockHandle) throws CardTerminalException
slotID
- The number of the slot for which a SlotChannel is requested.lockHandle
- the trust ticket that the lock owner obtained when locking the terminal
or slotprotected void internalCloseSlotChannel(SlotChannel sc) throws CardTerminalException
SlotChannel
- The SlotChannel to close.protected abstract CardID internalReset(int slot, int ms) throws CardTerminalException
slot
- The slot number of the slot to be resetted.ms
- To be ignored. If the card does not respond within the time
specified for the protocol an exception should be thrown.protected abstract ResponseAPDU internalSendAPDU(int slot, CommandAPDU capdu, int ms) throws CardTerminalException
slot
- The slot number of the slot to be resetted.capdu
- The CommandAPDU to send.ms
- To be ignored. If the card does not respond within the time
specified for the protocol an exception should be thrown.public ResponseAPDU sendVerifiedCommandAPDU(SlotChannel chann, CommandAPDU capdu, CHVControl vc, int ms) throws CardTerminalException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |