OpenCard  
 
OCF, the OpenCard Framework is a standard Java framework for working with Smart Cards.  
 

opencard.tests.terminal
Class DirectCommand

java.lang.Object
  |
  +--opencard.core.service.CardService
        |
        +--opencard.tests.terminal.TestBean
              |
              +--opencard.tests.terminal.CommandBean
                    |
                    +--opencard.tests.terminal.DirectCommand

public class DirectCommand
extends CommandBean

DirectCommand defines a simple Select-Command. It is derived from the CommandBean which provide most of the required functionality.

SAMPLE:
DirectCommand command = new DirectCommand();
command.initialize(card);
command.setCommand(new byte[]{(byte)0xB6,(byte)0x42,(byte)0, (byte) 0x40});
command.setId("PCSC-Test11");
command.addExpectedResult(0x9000);
command.execute();

To Do: Parametrisieren der einzlnen Command Parameter CLA, INS, etc. zwecks leichterer Anpassung an andere Karte

Version:
$Id: DirectCommand.java,v 1.1 1999/12/03 09:31:36 damke Exp $
See Also:
CommandBean

Fields inherited from class opencard.tests.terminal.CommandBean
response
 
Fields inherited from class opencard.tests.terminal.TestBean
resultLookup
 
Constructor Summary
DirectCommand()
          Default constructor.
 
Method Summary
protected  CommandAPDU assemble()
          Overwrite this methode from the superclass: The CommandAPDU which has to send to th card shall not be assembled out of the Parameters CLA, INS, P1, P2, P3!
 byte[] getCommand()
          Friendly Method to get the command to be performed on the the card.
protected  void initialize()
          Do some individual initialization for each command subclass.
 void setCommand(byte[] command)
          Friendly Method to set the command to be performed on the the card.
protected  void setCommandBytes()
          define the default values for the command parameters:
 
Methods inherited from class opencard.tests.terminal.CommandBean
execute, getCardType, getCla, getCommandData, getIns, getLe, getMode, getP1, getP2, getResponseData, initialize, resetCardService, setCardService, setCardType, setCla, setCommandData, setIns, setLe, setMode, setP1, setP2, setParameters, toString
 
Methods inherited from class opencard.tests.terminal.TestBean
addExpectedResult, addExpectedResult, addUnexpectedResult, addUnexpectedResult, checkResult, clearResultLookup, getId, getLabel, getResult, getResultString, getTitle, isDetails, lookupResult, lookupResult, setDetails, setId, setLabel, setResult, setResult, setResult
 
Methods inherited from class opencard.core.service.CardService
allocateCardChannel, getCard, getCardChannel, getCHVDialog, initialize, releaseCardChannel, setCardChannel, setCHVDialog
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DirectCommand

public DirectCommand()
Default constructor. Sets a Label for the friendly log-output Since the CommandBeans should be beans, please declare only the default constructor.
Method Detail

setCommandBytes

protected void setCommandBytes()
define the default values for the command parameters:
Overrides:
setCommandBytes in class CommandBean

initialize

protected void initialize()
                   throws TestInitException
Do some individual initialization for each command subclass. This method is called by initialize(Smartcard) Sets the CLA and INS to specify the part of the Command which is identical for all instances.

setCommand

public void setCommand(byte[] command)
Friendly Method to set the command to be performed on the the card. The given command is used directly to assemble a CommandAPDU The Parameters CLA, INS, P1, P2, P3 are ignored (only set for debug trace output)!
Parameters:
command - - the command to be performed!

getCommand

public byte[] getCommand()
Friendly Method to get the command to be performed on the the card.
Returns:
command - the command to be performed!

assemble

protected CommandAPDU assemble()
Overwrite this methode from the superclass: The CommandAPDU which has to send to th card shall not be assembled out of the Parameters CLA, INS, P1, P2, P3! Instead the APDU shall be constructed using the command byte array of this subclass.
Overrides:
assemble in class CommandBean