Class JCOPSimCardTerminal
- java.lang.Object
-
- opencard.core.terminal.CardTerminal
-
- de.cardcontact.opencard.terminal.jcopsim.JCOPSimCardTerminal
-
public class JCOPSimCardTerminal extends CardTerminal
Class implementing a JCOP simulation card terminal- Author:
- Frank Thater (info@cardcontact.de)
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_SOCKET_TIMEOUT-
Fields inherited from class opencard.core.terminal.CardTerminal
address, name, slots, type
-
-
Constructor Summary
Constructors Constructor Description JCOPSimCardTerminal(java.lang.String name, java.lang.String type, java.lang.String address, java.lang.String host, int port, int timeout)Constructor for JCOPSimCardTerminal
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the CardTerminal.voidconnect()CardIDgetCardID(int slotID)Return the answer-to-reset (ATR) response of the card inserted in slot slotID as a CardID.protected voidinternalCloseSlotChannel(SlotChannel sc)The internal closeSlotChannel method.protected CardIDinternalReset(int slot, int ms)The internal reset method to be provided by the concrete implementation.protected ResponseAPDUinternalSendAPDU(int slot, CommandAPDU capdu, int ms)The internalSendAPDU method to be provided by the concrete implementation.booleanisCardPresent(int slotID)Check whether there is a smart card present in a particular slot.voidopen()Initializes the CardTerminal.-
Methods inherited from class opencard.core.terminal.CardTerminal
addSlots, cardInserted, cardRemoved, closeSlotChannel, enumerateSlots, features, getAddress, getCardID, getName, getSlot, getSlots, getType, internalFeatures, internalOpenSlotChannel, internalOpenSlotChannel, internalReset, isCardPresent, isSlotChannelAvailable, isSlotChannelAvailable, openSlotChannel, openSlotChannel, openSlotChannel, reset, reset, reset, sendAPDU, sendAPDU, sendVerifiedCommandAPDU, slots, toString
-
-
-
-
Field Detail
-
DEFAULT_SOCKET_TIMEOUT
public static final int DEFAULT_SOCKET_TIMEOUT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JCOPSimCardTerminal
public JCOPSimCardTerminal(java.lang.String name, java.lang.String type, java.lang.String address, java.lang.String host, int port, int timeout) throws CardTerminalExceptionConstructor for JCOPSimCardTerminal- Parameters:
name- Friendly name of the terminaltype- Type of the card terminaladdress- Identifier for the driver to locate the terminalhost- Host of the remote terminal simulationport- Port number of the remote terminal simulationtimeout-- Throws:
CardTerminalException
-
-
Method Detail
-
getCardID
public CardID getCardID(int slotID) throws CardTerminalException
Description copied from class:CardTerminalReturn the answer-to-reset (ATR) response of the card inserted in slot slotID as a CardID. Before calling this method the caller should make sure that a card is present, otherwise null may be returned.This call should NOT block if no card is present.
- Specified by:
getCardIDin classCardTerminal- Parameters:
slotID- slot id.- Returns:
- The ATR response in form of a CardID object or null if no card is present.
- Throws:
CardTerminalException- Thrown in case of problems in the card terminal.
-
isCardPresent
public boolean isCardPresent(int slotID) throws CardTerminalExceptionDescription copied from class:CardTerminalCheck whether there is a smart card present in a particular slot.- Specified by:
isCardPresentin classCardTerminal- Parameters:
slotID- slot to check for a card.- Returns:
- True if there is a smart card inserted in the slot.
- Throws:
CardTerminalException- thrown in case of problems getting the status from CardTerminal (or other serious problems in the terminal).
-
open
public void open() throws CardTerminalExceptionDescription copied from class:CardTerminalInitializes the CardTerminal. Implementations of this method must carry out all steps required to set the concrete terminal into a proper state. After invoking this method it should be possible to communicate with the terminal properly.- Specified by:
openin classCardTerminal- Throws:
CardTerminalException- thrown in case of initialization-errors (e.g. couldn't setup transfer protocol between CardTerminal and reader).
-
connect
public void connect() throws CardTerminalException- Throws:
CardTerminalException
-
close
public void close() throws CardTerminalExceptionDescription copied from class:CardTerminalCloses the CardTerminal. Implementations of this method must carry out all steps required to close the concrete terminal and free resources held by it.- Specified by:
closein classCardTerminal- Throws:
CardTerminalException- thrown in case of initialization-errors (e.g. couldn't setup transfer protocol between CardTerminal and reader).
-
internalReset
protected CardID internalReset(int slot, int ms) throws CardTerminalException
Description copied from class:CardTerminalThe internal reset method to be provided by the concrete implementation.- Specified by:
internalResetin classCardTerminal- Parameters:
slot- The slot number of the slot to be resetted.ms- To be ignored. If the card does not respond within the time specified for the protocol an exception should be thrown.- Returns:
- The CardID of the card.
- Throws:
CardTerminalException- thrown in case of errors during reset
-
internalCloseSlotChannel
protected void internalCloseSlotChannel(SlotChannel sc)
Description copied from class:CardTerminalThe internal closeSlotChannel method. internalCloseSlotChannel is executed at the end of closeSlotChannel.- Overrides:
internalCloseSlotChannelin classCardTerminal
-
internalSendAPDU
protected ResponseAPDU internalSendAPDU(int slot, CommandAPDU capdu, int ms) throws CardTerminalException
Description copied from class:CardTerminalThe internalSendAPDU method to be provided by the concrete implementation.- Specified by:
internalSendAPDUin classCardTerminal- Parameters:
slot- The slot number of the slot to be resetted.capdu- The CommandAPDU to send.ms- To be ignored. If the card does not respond within the time specified for the protocol an exception should be thrown.- Returns:
- A ResponseAPDU.
- Throws:
CardTerminalException- thrown in case of errors in the CardTerminal (e.g. errors during data exchange)
-
-