JMRTD 0.4.5

net.sourceforge.scuba.smartcards
Class TerminalCardService

java.lang.Object
  extended by net.sourceforge.scuba.smartcards.CardService
      extended by net.sourceforge.scuba.smartcards.TerminalCardService
All Implemented Interfaces:
Serializable

public class TerminalCardService
extends CardService

Card service implementation for sending APDUs to a terminal using the JSR 268 (javax.smartcardio.*) classes available in Java SDK 6.0 and higher.

Version:
$Revision$
Author:
Martijn Oostdijk (martijno@cs.ru.nl)
See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.sourceforge.scuba.smartcards.CardService
listeners, SESSION_STARTED_STATE, SESSION_STOPPED_STATE, state
 
Constructor Summary
TerminalCardService(CardTerminal terminal)
          Constructs a new card service.
 
Method Summary
 void close()
          Closes the session with the card.
 CardTerminal getTerminal()
          The terminal used by this service.
 boolean isOpen()
           
 void open()
          Opens a session with the card.
 String toString()
          Produces a textual representation of this service.
 ResponseAPDU transmit(CommandAPDU ourCommandAPDU)
          Sends an APDU to the card.
 
Methods inherited from class net.sourceforge.scuba.smartcards.CardService
addAPDUListener, notifyExchangedAPDU, removeAPDUListener, setListenersState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TerminalCardService

public TerminalCardService(CardTerminal terminal)
Constructs a new card service.

Parameters:
terminal - the card terminal to connect to
Method Detail

open

public void open()
          throws CardServiceException
Description copied from class: CardService
Opens a session with the card. Selects a reader. Connects to the card. Notifies any interested apduListeners.

Specified by:
open in class CardService
Throws:
CardServiceException

isOpen

public boolean isOpen()
Specified by:
isOpen in class CardService

transmit

public ResponseAPDU transmit(CommandAPDU ourCommandAPDU)
                      throws CardServiceException
Sends an APDU to the card.

Specified by:
transmit in class CardService
Parameters:
ourCommandAPDU - the command apdu to send
Returns:
the response from the card, including the status word
Throws:
CardServiceException - - if the card operation failed

close

public void close()
Closes the session with the card.

Specified by:
close in class CardService

getTerminal

public CardTerminal getTerminal()
The terminal used by this service.

Returns:
a terminal

toString

public String toString()
Produces a textual representation of this service.

Overrides:
toString in class Object
Returns:
a textual representation of this service

JMRTD 0.4.5