This class is multi-threading safe and can be used by multiple threads concurrently. However, this object keeps track of the card presence state of each of its terminals. Multiple objects should be used if independent calls to waitForChange are required.
Applications can obtain instances of this class by calling TerminalFactory#terminals.
TerminalFactory, CardTerminal
| Modifier and Type | Class and Description |
|---|---|
| public static enum | CardTerminals.
Enumeration of attributes of a CardTerminal. |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public CardTerminal | Returns: the terminal with the specified name or null if no such terminal exists.the terminal name name)Returns the terminal with the specified name or null if no such terminal exists. |
| public List | Returns: an unmodifiable list of all available terminals.Returns an unmodifiable list of all available terminals. |
| public abstract List | Returns: an unmodifiable list of all terminals matching the specified state.the State stateReturns an unmodifiable list of all terminals matching the specified state. |
| public void | |
| public abstract boolean | Returns: false if the method returns due to an expired timeout, true otherwise.if positive, block for up to timeout)timeout
milliseconds; if zero, block indefinitely; must not be negativeWaits for card insertion or removal in any of the terminals of this object or until the timeout expires. |
| CardTerminals | back to summary |
|---|---|
| protected CardTerminals() Constructs a new CardTerminals object. This constructor is called by subclasses only. Application should call TerminalFactory#terminals to obtain a CardTerminals object. | |
| getTerminal | back to summary |
|---|---|
| public CardTerminal getTerminal(String name) Returns the terminal with the specified name or null if no such terminal exists.
| |
| list | back to summary |
|---|---|
| public List Returns an unmodifiable list of all available terminals.
| |
| list | back to summary |
|---|---|
| public abstract List Returns an unmodifiable list of all terminals matching the specified state. If state is If state is
| |
| waitForChange | back to summary |
|---|---|
| public void waitForChange() throws CardException Waits for card insertion or removal in any of the terminals of this object. This call is equivalent to calling waitForChange(0).
| |
| waitForChange | back to summary |
|---|---|
| public abstract boolean waitForChange(long timeout) throws CardException Waits for card insertion or removal in any of the terminals of this object or until the timeout expires. This method examines each CardTerminal of this object.
If a card was inserted into or removed from a CardTerminal since the
previous call to If This method is often used in a loop in combination with
TerminalFactory factory = ...;
CardTerminals terminals = factory.terminals();
while (true) {
for (CardTerminal terminal : terminals.list(CARD_INSERTION)) {
// examine Card in terminal, return if it matches
}
terminals.waitForChange();
}
| |
| Modifier and Type | Field and Description |
|---|---|
| public static final CardTerminals. | ALL
All CardTerminals. |
| public static final CardTerminals. | CARD_ABSENT
CardTerminals in which a card is not present. |
| public static final CardTerminals. | CARD_INSERTION
CardTerminals for which a card insertion was detected during the latest call to waitForChange(). |
| public static final CardTerminals. | CARD_PRESENT
CardTerminals in which a card is present. |
| public static final CardTerminals. | CARD_REMOVAL
CardTerminals for which a card removal was detected during the latest call to waitForChange(). |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static CardTerminals. | |
| public static CardTerminals. |
| ALL | back to summary |
|---|---|
| public static final CardTerminals. All CardTerminals. | |
| CARD_ABSENT | back to summary |
|---|---|
| public static final CardTerminals. CardTerminals in which a card is not present. | |
| CARD_INSERTION | back to summary |
|---|---|
| public static final CardTerminals. CardTerminals for which a card insertion was detected during the latest call to waitForChange(). | |
| CARD_PRESENT | back to summary |
|---|---|
| public static final CardTerminals. CardTerminals in which a card is present. | |
| CARD_REMOVAL | back to summary |
|---|---|
| public static final CardTerminals. CardTerminals for which a card removal was detected during the latest call to waitForChange(). | |
| State | back to summary |
|---|---|
| private State() | |
| valueOf | back to summary |
|---|---|
| public static CardTerminals. | |
| values | back to summary |
|---|---|
| public static CardTerminals. | |