Class CTAPICardTerminal

    • Field Detail

      • requestICC

        public static final byte[] requestICC
      • getStatus

        public static final byte[] getStatus
      • termopened

        protected boolean termopened
      • cardStatus

        protected byte[] cardStatus
      • cardIdTable

        protected CardID[] cardIdTable
      • ctn

        protected char ctn
      • pn

        protected char pn
    • Constructor Detail

      • CTAPICardTerminal

        protected CTAPICardTerminal​(java.lang.String name,
                                    java.lang.String type,
                                    java.lang.String device,
                                    java.lang.String libname)
                             throws CardTerminalException
        Create CTAPICardTerminal object
        Parameters:
        name -
        type -
        device -
        libname -
        Throws:
        CardTerminalException
    • Method Detail

      • open

        public void open()
                  throws CardTerminalException
        Open card terminal connection Called from OCF during startup
        Specified by:
        open in class CardTerminal
        Throws:
        CardTerminalException - thrown in case of initialization-errors (e.g. couldn't setup transfer protocol between CardTerminal and reader).
      • isCardPresent

        public boolean isCardPresent​(int slot)
                              throws CardTerminalException
        Return true is slot contains a card
        Specified by:
        isCardPresent in class CardTerminal
        Parameters:
        slot - Slot number starting at 0
        Returns:
        True if there is a smart card inserted in the slot.
        Throws:
        CardTerminalException - thrown in case of problems getting the status from CardTerminal (or other serious problems in the terminal).
      • getCardID

        public CardID getCardID​(int slot)
                         throws CardTerminalException
        Return ATR for card in slot
        Specified by:
        getCardID in class CardTerminal
        Parameters:
        slot - slot id.
        Returns:
        The ATR response in form of a CardID object or null if no card is present.
        Throws:
        CardTerminalException - Thrown in case of problems in the card terminal.
      • internalReset

        protected CardID internalReset​(int slot,
                                       int ms)
                                throws CardTerminalException
        Reset card in slot and return ATR
        Specified by:
        internalReset in class CardTerminal
        Parameters:
        slot - The slot number of the slot to be resetted.
        ms - To be ignored. If the card does not respond within the time specified for the protocol an exception should be thrown.
        Returns:
        The CardID of the card.
        Throws:
        CardTerminalException - thrown in case of errors during reset
      • internalSendAPDU

        protected ResponseAPDU internalSendAPDU​(int slot,
                                                CommandAPDU capdu,
                                                int ms)
                                         throws CardTerminalException
        Send APDU to card in slot
        Specified by:
        internalSendAPDU in class CardTerminal
        Parameters:
        slot - The slot number of the slot to be resetted.
        capdu - The CommandAPDU to send.
        ms - To be ignored. If the card does not respond within the time specified for the protocol an exception should be thrown.
        Returns:
        A ResponseAPDU.
        Throws:
        CardTerminalException - thrown in case of errors in the CardTerminal (e.g. errors during data exchange)
      • sendTerminalCommand

        public byte[] sendTerminalCommand​(byte[] com)
                                   throws CardTerminalException
        Send a control command to the terminal
        Specified by:
        sendTerminalCommand in interface TerminalCommand
        Parameters:
        com - A byte[] containing the command to be send to the card terminal.
        Returns:
        A byte[] with the result (null if no result is available).
        Throws:
        CardTerminalException - ;
      • getStatus

        public byte[] getStatus()
                         throws CardTerminalException
        Issue STATUS command to query status of card reader slots
        Returns:
        Byte array of slot status as returned by STATUS command
        Throws:
        CardTerminalException