public class CardReader
extends java.lang.Object
implements de.gematik.ti.cardreader.provider.api.ICardReader
The CardReader represent a pcsc card reader with one slot.
| Constructor and Description |
|---|
CardReader(javax.smartcardio.CardTerminal cardTerminal) |
| Modifier and Type | Method and Description |
|---|---|
de.gematik.ti.cardreader.provider.api.card.ICard |
connect()
Establishes a connection to the card with the protocol
*. |
de.gematik.ti.cardreader.provider.api.card.ICard |
connect(java.lang.String protocol)
Establishes a connection to the card.
|
javax.smartcardio.CardTerminal |
getCardTerminal() |
java.lang.String |
getName()
Returns the unique name of this terminal.
|
void |
initialize()
initialize the card reader
|
boolean |
isCardPresent()
Returns whether a card is present in this terminal.
|
boolean |
isInitialized()
Return the current initialisation status
|
java.lang.String |
toString() |
boolean |
waitForCardAbsent(long timeout)
Waits until a card is absent in this terminal or the timeout expires.
|
boolean |
waitForCardPresent(long timeout)
Waits until a card is present in this terminal or the timeout expires.
|
public void initialize()
initialize the card reader
initialize in interface de.gematik.ti.cardreader.provider.api.ICardReaderpublic boolean isInitialized()
Return the current initialisation status
isInitialized in interface de.gematik.ti.cardreader.provider.api.ICardReaderpublic de.gematik.ti.cardreader.provider.api.card.ICard connect(java.lang.String protocol)
throws de.gematik.ti.cardreader.provider.api.card.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.
protocol - - the protocol to use ("T=0", "T=1", or "T=CL"), or "*" to connect using any available protocol.java.lang.NullPointerException - if protocol is null IllegalArgumentException if protocol is an invalid protocol specification CardNotPresentException if no card is present
in this terminal CardException if a connection could not be established using the specified protocol or if a connection has previously been
established using a different protocol SecurityException if a SecurityManager exists and the caller does not have the required permissionde.gematik.ti.cardreader.provider.api.card.CardExceptionpublic de.gematik.ti.cardreader.provider.api.card.ICard connect()
throws de.gematik.ti.cardreader.provider.api.card.CardException
Establishes a connection to the card with the protocol *. If a connection has previously established using the specified protocol, this method returns
the same Card object as the previous call.
connect in interface de.gematik.ti.cardreader.provider.api.ICardReaderjava.lang.NullPointerException - if protocol is null IllegalArgumentException if protocol is an invalid protocol specification CardNotPresentException if no card is present
in this terminal CardException if a connection could not be established using the specified protocol or if a connection has previously been
established using a different protocol SecurityException if a SecurityManager exists and the caller does not have the required permissionde.gematik.ti.cardreader.provider.api.card.CardExceptionpublic java.lang.String getName()
Returns the unique name of this terminal.
getName in interface de.gematik.ti.cardreader.provider.api.ICardReaderpublic boolean isCardPresent()
throws de.gematik.ti.cardreader.provider.api.card.CardException
Returns whether a card is present in this terminal.
isCardPresent in interface de.gematik.ti.cardreader.provider.api.ICardReaderde.gematik.ti.cardreader.provider.api.card.CardException - if the status could not be determinedpublic boolean waitForCardAbsent(long timeout)
throws de.gematik.ti.cardreader.provider.api.card.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 return true. If no card is present in this terminal when this method is called, it returns immediately.
timeout - - if positive, block for up to timeout milliseconds; if zero, block indefinitely; must not be negativejava.lang.IllegalArgumentException - if timeout is negative CardException if the operation failedde.gematik.ti.cardreader.provider.api.card.CardExceptionpublic boolean waitForCardPresent(long timeout)
throws de.gematik.ti.cardreader.provider.api.card.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 return true. If a card is present in this terminal when this method is called, it returns immediately.
timeout - - if positive, block for up to timeout milliseconds; if zero, block indefinitely; must not be negativejava.lang.IllegalArgumentException - if timeout is negative CardException if the operation failedde.gematik.ti.cardreader.provider.api.card.CardExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic javax.smartcardio.CardTerminal getCardTerminal()