List of usage examples for javax.smartcardio CardTerminal waitForCardPresent
public abstract boolean waitForCardPresent(long timeout) throws CardException;
From source file:davmail.util.ClientCertificateTest.java
public void testCardReaders() throws CardException { for (CardTerminal terminal : TerminalFactory.getDefault().terminals().list()) { System.out.println("Card terminal: " + terminal.getName() + " " + (terminal.isCardPresent() ? "Card present" : "No card")); terminal.waitForCardPresent(10); if (terminal.isCardPresent()) { Card c = null;/*from w ww .j a v a2s .c o m*/ try { c = terminal.connect("T=0"); } catch (Exception e) { // failover c = terminal.connect("T=1"); } ATR atr = c.getATR(); byte[] bytes = atr.getBytes(); System.out.print("card:"); for (byte b : bytes) { System.out.print(" " + Integer.toHexString(b & 0xff)); } System.out.println(); } } }