Class 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 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)
      • getSlot

        @Deprecated
        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​(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.
      • 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
      • 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