com.cryptware.jscapi
Class Reader

java.lang.Object
  extended by com.cryptware.jscapi.Reader

public class Reader
extends java.lang.Object

Implements a smart card reader
A PC/SC smart card reader is uniquely identified by a name

Author:
Ugo Chirico

Field Summary
static int INFINITE
          Infinite timeout in WaitForSmartCard events
 
Method Summary
 void addReaderListener(ReaderListener readerListener)
           
 SmartCard connect()
          Connects to the smart card using default shared mode and default protocol
 SmartCard connect(java.lang.String desiredProtocol)
          Connect to the smart card using the given protocol
 java.lang.String getName()
           
 SmartCard getSmartCard()
           
 boolean isEnableEvents()
           
 boolean isSmartCardPresent()
          Check's the presence of the smart card in the reader
 void removeReaderListener(ReaderListener readerListener)
           
 void setEnableEvents(boolean enable)
          Enables/Disables smart card insertion/removal events
 boolean WaitForSmartCardInserted()
          Stops execution and waits for smart card insertion
 boolean WaitForSmartCardInserted(int timeout)
          Stops execution and waits for smart card insertion
 boolean WaitForSmartCardRemoved()
          Stops execution and waits for smart card removal
 boolean WaitForSmartCardRemoved(int timeout)
          Stops execution and waits for smart card removal
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INFINITE

public static final int INFINITE
Infinite timeout in WaitForSmartCard events

See Also:
Constant Field Values
Method Detail

getName

public java.lang.String getName()
Returns:
the name of this reader as registered in operating system database

addReaderListener

public void addReaderListener(ReaderListener readerListener)
Parameters:
readerListener -

removeReaderListener

public void removeReaderListener(ReaderListener readerListener)
Parameters:
readerListener -

isSmartCardPresent

public boolean isSmartCardPresent()
Check's the presence of the smart card in the reader

Returns:
true if the smart card is present

connect

public SmartCard connect()
Connects to the smart card using default shared mode and default protocol

Returns:
a connected SmartCard object

connect

public SmartCard connect(java.lang.String desiredProtocol)
Connect to the smart card using the given protocol

Parameters:
desiredProtocol -
Returns:
a connected SmartCard object

getSmartCard

public SmartCard getSmartCard()
Returns:
Returns the connected Smart Card if any or null otherwise

WaitForSmartCardInserted

public boolean WaitForSmartCardInserted()
Stops execution and waits for smart card insertion

Returns:
true if the smart card is inserted

WaitForSmartCardInserted

public boolean WaitForSmartCardInserted(int timeout)
Stops execution and waits for smart card insertion

Parameters:
timeout -
Returns:
true if the smart card is inserted

WaitForSmartCardRemoved

public boolean WaitForSmartCardRemoved()
Stops execution and waits for smart card removal

Returns:
true if the smart card is removed

WaitForSmartCardRemoved

public boolean WaitForSmartCardRemoved(int timeout)
Stops execution and waits for smart card removal

Parameters:
timeout -
Returns:
true if the smart card is removed

setEnableEvents

public void setEnableEvents(boolean enable)
Enables/Disables smart card insertion/removal events

Parameters:
enable -

isEnableEvents

public boolean isEnableEvents()
Returns:
true if the events are enabled