Class RemoteTerminal
- java.lang.Object
-
- opencard.core.terminal.CardTerminal
-
- de.cardcontact.opencard.terminal.remoteterminal.RemoteTerminal
-
public class RemoteTerminal extends CardTerminal
-
-
Field Summary
-
Fields inherited from class opencard.core.terminal.CardTerminal
address, name, slots, type
-
-
Constructor Summary
Constructors Constructor Description RemoteTerminal(java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the CardTerminal.CardID
getCardID(int slotID)
Return the answer-to-reset (ATR) response of the card inserted in slot slotID as a CardID.void
initializeSession(RemoteCardSpec rcs)
Called when an initiation messages containing the card ATR is received.protected void
internalCloseSlotChannel(SlotChannel sc)
The internal closeSlotChannel method.protected java.util.Properties
internalFeatures(java.util.Properties features)
The CardTerminal internal features() method to be provided by the concrete implementation.protected CardID
internalReset(int slot, int ms)
The internal reset method to be provided by the concrete implementation.protected ResponseAPDU
internalSendAPDU(int slot, CommandAPDU capdu, int ms)
Process a single Command APDU and return a Response APDU.boolean
isCardPresent(int slotID)
Check whether there is a smart card present in a particular slot.void
open()
Initializes the CardTerminal.RemoteProtocolScript
poll(int timeout)
Poll for a command object.void
put(RemoteProtocolScript resObject)
Put response object into queue.void
sendNotification(int id, java.lang.String message)
Send an asynchronous notification to the clientvoid
sendNotification(int id, java.lang.String message, int ttc)
Send an asynchronous notification to the client-
Methods inherited from class opencard.core.terminal.CardTerminal
addSlots, cardInserted, cardRemoved, closeSlotChannel, enumerateSlots, features, getAddress, getCardID, getName, getSlot, getSlots, getType, internalOpenSlotChannel, internalOpenSlotChannel, internalReset, isCardPresent, isSlotChannelAvailable, isSlotChannelAvailable, openSlotChannel, openSlotChannel, openSlotChannel, reset, reset, reset, sendAPDU, sendAPDU, sendVerifiedCommandAPDU, slots, toString
-
-
-
-
Constructor Detail
-
RemoteTerminal
public RemoteTerminal(java.lang.String name) throws CardTerminalException
- Throws:
CardTerminalException
-
-
Method Detail
-
poll
public RemoteProtocolScript poll(int timeout) throws CardTerminalException
Poll for a command object. Used by remote connection.- Returns:
- the command object (i.e. CommandAPDU, RemoteControl)
- Throws:
CardTerminalException
-
put
public void put(RemoteProtocolScript resObject)
Put response object into queue. Used by remote connection.- Throws:
CardTerminalException
-
getCardID
public CardID getCardID(int slotID) throws CardTerminalException
Description copied from class:CardTerminal
Return 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:
getCardID
in 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.
-
initializeSession
public void initializeSession(RemoteCardSpec rcs) throws CardTerminalException
Called when an initiation messages containing the card ATR is received.- Parameters:
rcs
-- Throws:
CardTerminalException
-
internalFeatures
protected java.util.Properties internalFeatures(java.util.Properties features)
Description copied from class:CardTerminal
The CardTerminal internal features() method to be provided by the concrete implementation. This default implementation just returns the parameter provided. Concrete implementations should override this method.- Overrides:
internalFeatures
in classCardTerminal
- Parameters:
features
- A Properties object that needs to be enhanced with the card terminal specific features.- Returns:
- The enriched Properties object.
-
isCardPresent
public boolean isCardPresent(int slotID) throws CardTerminalException
Description copied from class:CardTerminal
Check whether there is a smart card present in a particular slot.- Specified by:
isCardPresent
in 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 CardTerminalException
Description copied from class:CardTerminal
Initializes 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:
open
in classCardTerminal
- Throws:
CardTerminalException
- thrown in case of initialization-errors (e.g. couldn't setup transfer protocol between CardTerminal and reader).
-
close
public void close() throws CardTerminalException
Description copied from class:CardTerminal
Closes 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:
close
in 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:CardTerminal
The internal reset method to be provided by the concrete implementation.- Specified by:
internalReset
in 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
-
internalSendAPDU
protected ResponseAPDU internalSendAPDU(int slot, CommandAPDU capdu, int ms) throws CardTerminalException
Process a single Command APDU and return a Response APDU. This implementation support queueing of APDUs to combine subsequent APDUs into a script. If the queueable flag is set, then a dummy 9000 is returned and the command is added to a work queue. If queueable is not set, then any previously queued commands and the current command are send to the client. The client can respond with either a list of response APDUs or just the last response APDU, in which case the number of executed commands must match the number command APDUs send. If a list of response APDUs is send, then the number of responses must match the number of commands and no intermediate status word may be other than 9000.- Specified by:
internalSendAPDU
in classCardTerminal
- Parameters:
slot
- the slot channel (deprecated)capdu
- the command APDUms
- timeout (deprecated)- Returns:
- A ResponseAPDU.
- Throws:
CardTerminalException
- thrown in case of errors in the CardTerminal (e.g. errors during data exchange)
-
internalCloseSlotChannel
protected void internalCloseSlotChannel(SlotChannel sc)
Description copied from class:CardTerminal
The internal closeSlotChannel method. internalCloseSlotChannel is executed at the end of closeSlotChannel.- Overrides:
internalCloseSlotChannel
in classCardTerminal
-
sendNotification
public void sendNotification(int id, java.lang.String message, int ttc) throws CardTerminalException
Send an asynchronous notification to the client- Parameters:
id
- the integer status code, < 0 denotes an error, 0 denotes completionmessage
- the message to be sendttc
- the estimated time in seconds to complete this interaction- Throws:
CardTerminalException
-
sendNotification
public void sendNotification(int id, java.lang.String message) throws CardTerminalException
Send an asynchronous notification to the client- Parameters:
id
- the integer status code, < 0 denotes an error, 0 denotes completionmessage
- the message to be send- Throws:
CardTerminalException
-
-