/** disconnect */ public static void disconnect() { try { channel.close(); channel = null; card.disconnect(false); card = null; System.out.println(MSG_INFO_CARD_DISCONNECTED); } catch (Exception e) { // e.printStackTrace(); } }
public void disconnect() throws TokenException { try { myChannel.close(); myCard.disconnect(true); myCard = null; myChannel = null; } catch (Exception ex) { /* * We don't care. */ } }
/** * openChannel * * @param applet * @return Channel * @throws Exception */ private CardChannel openChannel(AppletModel applet) throws Exception { if (channel != null) { try { channel.close(); } catch (Exception e) { // } channel = null; } if (card != null) { try { card.disconnect(true); } catch (Exception e) { // } card = null; } TerminalFactory factory = TerminalFactory.getDefault(); CardTerminals cardterminals = factory.terminals(); try { List<CardTerminal> terminals = cardterminals.list(); System.out.println("Terminals: " + terminals); for (CardTerminal terminal : terminals) { terminal.waitForCardPresent(1000); if (terminal.isCardPresent()) { System.out.println(terminal.getName() + ": Card present!"); card = terminal.connect("*"); channel = card.getBasicChannel(); return channel; } } throw new WolfException(MSG_READER_TIME_OUT); } catch (Exception e) { throw e; } }