com.ibm.opencard.terminal.pcscmig
Class PcscMigCardTerminal
java.lang.Object
|
+--opencard.core.terminal.CardTerminal
|
+--com.ibm.opencard.terminal.pcscmig.PcscMigCardTerminal
- public class PcscMigCardTerminal
- extends CardTerminal
- implements PcscMigConstants, PowerManagementInterface, TerminalCommand, Pollable
Implementation of an OpenCard CardTerminal for PCSC.
- Version:
- $Id: PcscMigCardTerminal.java,v 1.1 1999/12/02 16:06:14 damke Exp $
- See Also:
CardTerminal
|
Constructor Summary |
protected |
PcscMigCardTerminal(java.lang.String name,
java.lang.String type,
java.lang.String address)
Instantiate an PcscMigTerminal. |
|
Method Summary |
protected void |
cardRemoved(int slotID)
Signal to observers that an inserted card was removed. |
void |
close()
Close the connection to the card terminal.
|
protected void |
finalize()
Release driver resources when garbage collected. |
CardID |
getCardID(int slot)
Return the CardID of the presently inserted card. |
CardID |
getCardID(int slot,
int timeout)
Return the CardID of the presently inserted card. |
protected CardID |
internalReset(int slot,
int ms)
Implementation of CardTerminal.internalReset(). |
protected ResponseAPDU |
internalSendAPDU(int slot,
CommandAPDU capdu,
int ms)
The implementation of CardTerminal.internalSendAPDU(). |
boolean |
isCardPresent(int slot)
Check whether there is a smart card present. |
void |
open()
Open the card terminal: We register with the CardTerminalRegistry
as a Pollable card terminal. |
void |
poll()
This method is normally used by the CardTerminalRegistry to
generate the OpenCard events if the Slot implementation does
not support events itself. |
void |
powerDownCard(int slot,
int timeout)
Power power down a card. |
void |
powerUpCard(int slot,
int timeout)
Power up a card. |
byte[] |
sendTerminalCommand(byte[] cmd)
Send control command to terminal. |
protected CardTerminalException |
translatePcscException(PcscException e)
translate the PcscException into CardTerminalException. |
| Methods inherited from class opencard.core.terminal.CardTerminal |
addSlots,
cardInserted,
closeSlotChannel,
enumerateSlots,
features,
getAddress,
getName,
getSlot,
getSlots,
getType,
internalCloseSlotChannel,
internalFeatures,
internalOpenSlotChannel,
internalOpenSlotChannel,
isCardPresent,
isSlotChannelAvailable,
isSlotChannelAvailable,
openSlotChannel,
openSlotChannel,
openSlotChannel,
reset,
reset,
sendAPDU,
sendAPDU,
sendVerifiedCommandAPDU,
slots,
toString |
| Methods inherited from class java.lang.Object |
clone,
equals,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
PcscMigCardTerminal
protected PcscMigCardTerminal(java.lang.String name,
java.lang.String type,
java.lang.String address)
throws CardTerminalException
- Instantiate an PcscMigTerminal.
- Parameters:
name - The user friendly name.type - The terminal type (here "PCSC")address - not used- Throws:
- CardTerminalException - Thrown when a problem occured.
open
public void open()
- Open the card terminal: We register with the CardTerminalRegistry
as a Pollable card terminal.
- Overrides:
- open in class CardTerminal
close
public void close()
throws CardTerminalException
- Close the connection to the card terminal.
Could be used by unregister to free up the resources used by the
terminal.
- Throws:
- CardTerminalException - Thrown if there are problems with closing the
connection
- Overrides:
- close in class CardTerminal
internalReset
protected CardID internalReset(int slot,
int ms)
throws CardTerminalException
- Implementation of CardTerminal.internalReset().
- Overrides:
- internalReset in class CardTerminal
isCardPresent
public boolean isCardPresent(int slot)
throws CardTerminalException
- Check whether there is a smart card present.
- Parameters:
slot - Number of the slot to check (must be 0 for PCSC)- Returns:
- True if there is a smart card inserted in the card
terminals slot.
- Overrides:
- isCardPresent in class CardTerminal
getCardID
public CardID getCardID(int slot)
throws CardTerminalException
- Return the CardID of the presently inserted card. Will returned
the cached card if slot's status has not changed; otherwise it will
really retrieve the CardID.
- Parameters:
slot - slot number- Returns:
- A CardID object representing the inserted smart card.
- Throws:
- CardTerminalException - thrown when problem occured getting the ATR of the card
- Overrides:
- getCardID in class CardTerminal
getCardID
public CardID getCardID(int slot,
int timeout)
throws CardTerminalException
- Return the CardID of the presently inserted card. Will returned
the cached card if slot's status has not changed; otherwise it will
really retrieve the CardID.
- Parameters:
slot - slot numbertimeout - timeout in seconds- Returns:
- A CardID object representing the inserted smart card.
- Throws:
- CardTerminalException - thrown when problem occured getting the ATR of the card
- Overrides:
- getCardID in class CardTerminal
powerUpCard
public void powerUpCard(int slot,
int timeout)
throws CardTerminalException
- Power up a card. If the card was already powered up it is resetted.
- Specified by:
- powerUpCard in interface PowerManagementInterface
- Parameters:
timeout - The time to wait before returning (in s); -1 signals
an indefinite timeout (i.e., wait forever).- Throws:
- CardTerminalException - Thrown when no card is present.
- See Also:
PowerManagementInterface
powerDownCard
public void powerDownCard(int slot,
int timeout)
throws CardTerminalException
- Power power down a card.
- Specified by:
- powerDownCard in interface PowerManagementInterface
- Parameters:
slot - The slot-number of the terminaltimeout - The time to wait before returning (in seconds);
-1 signals an indefinite timeout (i.e., wait
forever).- Throws:
- CardTerminalException - Thrown when no card is present.
- See Also:
PowerManagementInterface
sendTerminalCommand
public byte[] sendTerminalCommand(byte[] cmd)
throws CardTerminalException
- Send control command to terminal.
- Specified by:
- sendTerminalCommand in interface TerminalCommand
- Parameters:
cmd - a byte array containing the command to be send to the card terminal- Returns:
- Response from terminal.
- Throws:
- CardTerminalException - Exception thrown by driver.
- See Also:
TerminalCommand
internalSendAPDU
protected ResponseAPDU internalSendAPDU(int slot,
CommandAPDU capdu,
int ms)
throws CardTerminalException
- The implementation of CardTerminal.internalSendAPDU().
- Parameters:
slot - logical slot numbercapdu - C-APDU to send to the cardms - timeout in ms (not supported, ignored)- Overrides:
- internalSendAPDU in class CardTerminal
cardRemoved
protected void cardRemoved(int slotID)
- Signal to observers that an inserted card was removed.
- Parameters:
slot - slot number- Overrides:
- cardRemoved in class CardTerminal
poll
public void poll()
throws CardTerminalException
- This method is normally used by the CardTerminalRegistry to
generate the OpenCard events if the Slot implementation does
not support events itself.
- Specified by:
- poll in interface Pollable
finalize
protected void finalize()
- Release driver resources when garbage collected.
- Overrides:
- finalize in class java.lang.Object
translatePcscException
protected CardTerminalException translatePcscException(PcscException e)
- translate the PcscException into CardTerminalException.
|