Package opencard.core.terminal
Class SlotChannel
- java.lang.Object
-
- opencard.core.terminal.SlotChannel
-
public final class SlotChannel extends java.lang.ObjectA SlotChannel serves a dual purpose: It is a gate object providing access to the smart card and, in addition, is used to send and receive APDUs and generally interact with the card.- Author:
- Dirk Husemann (hud@zurich.ibm.com), Peter Trommler (trp@zurich.ibm.com)
- See Also:
Slot
-
-
Constructor Summary
Constructors Constructor Description SlotChannel(CardTerminal terminal, int slotID, java.lang.Object lockHandle)Instantiate a SlotChannel.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclose()Close this SlotChannel.APDUTracergetAPDUTracer()Return the APDU tracer for this slot channelCardIDgetCardID()Return the CardID object of the inserted smart card.CardTerminalgetCardTerminal()Return the CardTerminal.java.lang.ObjectgetLockHandle()Return the slot owner.java.lang.ObjectgetScheduler()SlotgetSlot()Deprecated.use getSlotNumber(), getCardTerminal() insteadintgetSlotNumber()Return the slot number of the associated slot.booleanisOpen()Check whether this SlotChannel is open.CardIDreset()Reset the smart card attached to this SlotChannel's slot.CardIDreset(boolean warm)Reset the smart card attached to this SlotChannel's slot.CardIDreset(int ms)Deprecated.ResponseAPDUsendAPDU(CommandAPDU capdu)Send a CommandAPDU on this SlotChannel.ResponseAPDUsendAPDU(CommandAPDU capdu, int ms)Deprecated.voidsetAPDUTracer(APDUTracer tracer)Set a tracer to log all command and response APDUs send over this slot channelvoidsetScheduler(java.lang.Object scheduler)java.lang.StringtoString()
-
-
-
Constructor Detail
-
SlotChannel
public SlotChannel(CardTerminal terminal, int slotID, java.lang.Object lockHandle)
Instantiate a SlotChannel.- Parameters:
terminal- The terminal to which the slot belongs.slotID- The number of the slot to which this SlotChannel is attached.lockHandle- the owner who holds a lock on the slot
-
-
Method Detail
-
getScheduler
public java.lang.Object getScheduler()
-
setScheduler
public void setScheduler(java.lang.Object scheduler)
-
sendAPDU
public ResponseAPDU sendAPDU(CommandAPDU capdu) throws CardTerminalException
Send a CommandAPDU on this SlotChannel.- Parameters:
capdu- The CommandAPDU to send.- Throws:
CardTerminalException- Thrown when terminal.sendAPDU failed.
-
sendAPDU
@Deprecated public ResponseAPDU sendAPDU(CommandAPDU capdu, int ms) throws CardTerminalException
Deprecated.- Throws:
CardTerminalException
-
getSlot
@Deprecated public Slot getSlot()
Deprecated.use getSlotNumber(), getCardTerminal() insteadReturn the Slot object associated with this SlotChannel .
-
getSlotNumber
public int getSlotNumber()
Return the slot number of the associated slot.
-
getCardTerminal
public CardTerminal getCardTerminal()
Return the CardTerminal.- Returns:
- The CardTerminal instance owning this SlotChannel.
-
getLockHandle
public java.lang.Object getLockHandle()
Return the slot owner.- Returns:
- The Thread object that holds a lock for this slot or null if the slot is not locked.
-
reset
@Deprecated public CardID reset(int ms) throws CardTerminalException
Deprecated.- Throws:
CardTerminalException
-
reset
public CardID reset(boolean warm) throws CardTerminalException
Reset the smart card attached to this SlotChannel's slot.- Parameters:
warm- Perform warm reset if true- Returns:
- The CardID of the attached card.
- Throws:
CardTerminalException- Thrown when terminal.reset failed.
-
reset
public CardID reset() throws CardTerminalException
Reset the smart card attached to this SlotChannel's slot.- Returns:
- The CardID of the attached card.
- Throws:
CardTerminalException- Thrown when terminal.reset failed.
-
isOpen
public boolean isOpen()
Check whether this SlotChannel is open. nnn *- Returns:
- True if it is; false otherwise.
-
close
public void close() throws CardTerminalExceptionClose this SlotChannel. Once a SlotChannel is closed, it cannot be used any longer.- Throws:
CardTerminalException- Thrown when terminal.closeSlotChannel failed.
-
getCardID
public CardID getCardID() throws CardTerminalException
Return the CardID object of the inserted smart card.- Returns:
- The CardID of the inserted smart card.
- Throws:
CardTerminalException- Thrown when terminal.getCardID failed.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
setAPDUTracer
public void setAPDUTracer(APDUTracer tracer)
Set a tracer to log all command and response APDUs send over this slot channel- Parameters:
tracer- the APDU tracer
-
getAPDUTracer
public APDUTracer getAPDUTracer()
Return the APDU tracer for this slot channel- Returns:
- the APDU tracer
-
-