java.lang.Object
javax.smartcardio.CardTerminal
de.gematik.smartcards.pcsc.Ifd

public final class Ifd extends CardTerminal
Class extending CardTerminal.
Author:
gematik
See Also:
  • Method Details

    • getName

      public String getName()
      Returns the unique name of this terminal.
      Specified by:
      getName in class CardTerminal
      Returns:
      the unique name of this terminal.
      See Also:
    • connect

      public Card connect(String protocol) throws CardException
      Establishes a connection to the card.

      If a connection has previously established using the specified protocol, this method returns the same Card object as the previous call.

      Notes on implementation:

      1. Currently only protocol "T=1" is supported by this implementation. Other values for protocol will cause an IllegalArgumentException.
      Specified by:
      connect in class CardTerminal
      Parameters:
      protocol - the protocol to use ("T=0", "T=1", or "T=CL"), or "*" to connect using any available protocol
      Returns:
      the card the connection has been established with
      Throws:
      IllegalArgumentException - if protocol is an invalid protocol specification
      CardNotPresentException - if no card is present in this terminal
      CardException - if
      1. a connection could not be established using the specified protocol
      2. connection has previously been established using a different protocol
      SecurityException - if a SecurityManager exists and the caller does not have the required permission
      See Also:
    • isCardPresent

      public boolean isCardPresent() throws CardException
      Returns whether a card is present in this terminal.
      Specified by:
      isCardPresent in class CardTerminal
      Returns:
      whether a card is present in this terminal.
      Throws:
      CardException - if the status could not be determined
      See Also:
    • toString

      public String toString()
      Returns String representation.
      Overrides:
      toString in class Object
      Returns:
      "PC/SC IFD " + getName()
    • waitForCardPresent

      public boolean waitForCardPresent(long timeout) throws CardException
      Waits until a card is present in this terminal or the timeout expires.

      If the method returns due to an expired timeout, it returns false. Otherwise, it returns true.

      If a card is present in this terminal when this method is called, it returns immediately.

      Specified by:
      waitForCardPresent in class CardTerminal
      Parameters:
      timeout - if positive, block for up to timeout milliseconds; if zero, block indefinitely; must not be negative
      Returns:
      false if the method returns due to an expired timeout, true otherwise.
      Throws:
      IllegalArgumentException - if timeout is negative
      CardException - if the operation failed
      See Also:
    • waitForCardAbsent

      public boolean waitForCardAbsent(long timeout) throws CardException
      Waits until a card is absent in this terminal or the timeout expires.

      If the method returns due to an expired timeout, it returns false. Otherwise, it returns true.

      If no card is present in this terminal when this method is called, it returns immediately.

      Specified by:
      waitForCardAbsent in class CardTerminal
      Parameters:
      timeout - if positive, block for up to timeout milliseconds; if zero, block indefinitely; must not be negative
      Returns:
      false if the method returns due to an expired timeout, true otherwise.
      Throws:
      IllegalArgumentException - if timeout is negative
      CardException - if the operation failed
      See Also: