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.

See Also:
Slot

Constructor Summary
SlotChannel(CardTerminal terminal, int slotID, java.lang.Object lockHandle)
          Instantiate a SlotChannel.
 
Method Summary
 void close()
          Close this SlotChannel.
 CardID 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() instead
 int getSlotNumber()
          Return the slot number of the associated slot.
 boolean isOpen()
          Check whether this SlotChannel is open. nnn *
 CardID reset()
          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 setScheduler(java.lang.Object scheduler)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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

public ResponseAPDU sendAPDU(CommandAPDU capdu,
                             int ms)
                      throws CardTerminalException
Deprecated.  

getSlot

public Slot getSlot()
Deprecated. use getSlotNumber(), getCardTerminal() instead
Return 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

public CardID reset(int ms)
             throws CardTerminalException
Deprecated.  

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 class java.lang.Object