public boolean ConnectToCard() throws NoReaderFoundException, CardException, CardNotPresentException {
        List terminalList = null;
        boolean terminalFound = false;
        try {
            terminalList = GetReaderList();
            terminalFound = true;

        } catch (NoReaderFoundException e) {
            throw e;
        }

        //List numbers of Card readers
        boolean cardFound = false;
        for (int i = 0; i < terminalList.size(); i++) {
            //    System.out.println("Terminal n." + i + " : " + terminalList.get(i));
            m_terminal = (CardTerminal) terminalList.get(i);
            if (!m_terminal.isCardPresent()) {
                throw new CardNotPresentException("No card present");
            } else {
                m_card = m_terminal.connect("*");
                m_channel = m_card.getBasicChannel();
                m_ATR = m_card.getATR().getBytes(); //resets the card
                if (m_card != null) {
                    cardFound = true;
                }
                if (m_card == null) {
                    throw new CardNotPresentException("No card present");
                }
            }
        }

        return cardFound;
    }