Package opencard.core.terminal
Class SlotChannel
- java.lang.Object
-
- opencard.core.terminal.SlotChannel
-
public final class SlotChannel extends java.lang.Object
A 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 void
close()
Close this SlotChannel.APDUTracer
getAPDUTracer()
Return the APDU tracer for this slot channelCardID
getCardID()
Return the CardID object of the inserted smart card.CardTerminal
getCardTerminal()
Return the CardTerminal.java.lang.Object
getLockHandle()
Return the slot owner.java.lang.Object
getScheduler()
Slot
getSlot()
Deprecated.use getSlotNumber(), getCardTerminal() insteadint
getSlotNumber()
Return the slot number of the associated slot.boolean
isOpen()
Check whether this SlotChannel is open.CardID
reset()
Reset the smart card attached to this SlotChannel's slot.CardID
reset(boolean warm)
Reset the smart card attached to this SlotChannel's slot.CardID
reset(int ms)
Deprecated.ResponseAPDU
sendAPDU(CommandAPDU capdu)
Send a CommandAPDU on this SlotChannel.ResponseAPDU
sendAPDU(CommandAPDU capdu, int ms)
Deprecated.void
setAPDUTracer(APDUTracer tracer)
Set a tracer to log all command and response APDUs send over this slot channelvoid
setScheduler(java.lang.Object scheduler)
java.lang.String
toString()
-
-
-
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 CardTerminalException
Close 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:
toString
in 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
-
-