JMRTD 0.4.5

net.sourceforge.scuba.smartcards
Class CardManager

java.lang.Object
  extended by net.sourceforge.scuba.smartcards.CardManager

public class CardManager
extends Object

Manages all card terminals. This is the source of card insertion and removal events. Ideally this should be the only place where low level CardService instances (such as TerminalCardService) are created.

Version:
$Revision$
Author:
Martijn Oostdijk (martijn.oostdijk@gmail.com), Wojciech Mostowski (woj@cs.ru.nl)

Method Summary
 void addAPDUListener(APDUListener l)
          Adds a listener.
 void addCardTerminalListener(CardTerminalListener l)
          Adds a listener.
 void addTerminal(CardTerminal terminal, boolean isPolling)
          Adds a terminal.
 int addTerminals(TerminalFactory factory, boolean isPolling)
          Adds the terminals produced by factory.
static CardManager getInstance()
          Gets the card manager.
 CardService getService(CardTerminal terminal)
          Gets the service associated with terminal (or null if we are not polling terminal).
 List<CardTerminal> getTerminals()
          Gets a list of terminals.
 boolean isPolling()
          Deprecated. Use isPolling(CardTerminal).
 boolean isPolling(CardTerminal terminal)
          Whether we are polling terminal.
 void removeAPDUListener(APDUListener l)
          Removes a listener.
 void removeCardTerminalListener(CardTerminalListener l)
          Removes a listener.
 void startPolling(CardTerminal terminal)
          Starts polling terminal (if not already doing so).
 void stopPolling(CardTerminal terminal)
          Stops polling terminal.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

startPolling

public void startPolling(CardTerminal terminal)
Starts polling terminal (if not already doing so).

Parameters:
terminal - a card terminal

stopPolling

public void stopPolling(CardTerminal terminal)
Stops polling terminal.

Parameters:
terminal - a card terminal

isPolling

public boolean isPolling(CardTerminal terminal)
Whether we are polling terminal.

Parameters:
terminal - a card terminal
Returns:
a boolean

getService

public CardService getService(CardTerminal terminal)
Gets the service associated with terminal (or null if we are not polling terminal).

Parameters:
terminal - a card terminal
Returns:
a card service or null

isPolling

public boolean isPolling()
Deprecated. Use isPolling(CardTerminal).

Whether the card manager is running.

Returns:
a boolean indicating whether the card manager is running.

addTerminals

public int addTerminals(TerminalFactory factory,
                        boolean isPolling)
Adds the terminals produced by factory.

Parameters:
factory -
Returns:
the number of terminals added

addTerminal

public void addTerminal(CardTerminal terminal,
                        boolean isPolling)
Adds a terminal.

Parameters:
terminal - the card terminal to add
isPolling - whether we should immediately start polling this terminal

addCardTerminalListener

public void addCardTerminalListener(CardTerminalListener l)
Adds a listener.

Parameters:
l - the listener to add

removeCardTerminalListener

public void removeCardTerminalListener(CardTerminalListener l)
Removes a listener.

Parameters:
l - the listener to remove

addAPDUListener

public void addAPDUListener(APDUListener l)
Adds a listener.

Parameters:
l - the listener to add

removeAPDUListener

public void removeAPDUListener(APDUListener l)
Removes a listener.

Parameters:
l - the listener to remove

getTerminals

public List<CardTerminal> getTerminals()
Gets a list of terminals.

Returns:
a list of terminals

toString

public String toString()
Overrides:
toString in class Object

getInstance

public static CardManager getInstance()
Gets the card manager. By default only PC/SC terminals are added, use addTerminals(TerminalFactory,boolean) to add additional terminals.

Returns:
the card manager

JMRTD 0.4.5