opencard.opt.terminal.protocol
Class T1Block

java.lang.Object
  |
  +--opencard.opt.terminal.protocol.T1Block

public class T1Block
extends java.lang.Object

T1Block represents T1 block (see ISO7816-3)


Field Summary
static int EDC_CRC
          use CRC16 algorithm for EDC byte - not implemented
static int EDC_LDR
          use LDR (XOR) algorithm for EDC byte
static int ERROR_EDC
          indicates EDC error
static int ERROR_NONE
          indicates error free operation
static int ERROR_OTHER
          indicates other error
static int I_BLOCK
          I-block
static int R_BLOCK
          R-block
static int S_ABORT_REQUEST
          S_ABORT_REQUEST
static int S_ABORT_RESPONSE
          S_ABORT_RESPONSE
static int S_BLOCK
          S-block
static int S_IFS_REQUEST
          S_IFS_REQUEST
static int S_IFS_RESPONSE
          S_IFS_RESPONSE
static int S_RESYNCH_REQUEST
          S_RESYNCH_REQUEST
static int S_RESYNCH_RESPONSE
          S_RESYNCH_RESPONSE
static int S_VPP_STATE_ERROR_RESPONSE
          S_VPP_STATE_ERR_RESPONSE
static int S_WTX_REQUEST
          S_WTX_REQUEST
static int S_WTX_RESPONSE
          S_WTX_RESPONSE
 
Constructor Summary
T1Block(byte[] rawBytes, int edcInfo)
          create Block object from raw T1-Block
T1Block(int src, int dest, int pcb, byte[] dat, int edcInfo)
          Constructor
 
Method Summary
 int calcEDC()
          calcEDC calculates the EDC-field according to the used EDC algorithm
 boolean checkEDC()
          checks the correctness of the given EDC byte (true, if EDC is correct)
 byte[] getBlock()
          returns byte array with raw block data
 int getBlockType()
           
 int getControlBits()
          getControlBits returns block-specific controlbits without the blocktype
 byte[] getDATA()
           
 int getDestID()
           
 int getDestinationAddress()
           
 int getEDC()
           
 int getEDCAlgorithm()
           
 int getLEN()
           
 byte getNAD()
           
 byte getPCB()
           
 int getRequestedSequenceNumber()
           
 int getSourceAddress()
           
 int getSourceID()
           
 java.lang.String toString()
          toString returns informations about this block object (not yet optimized)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EDC_LDR

public static final int EDC_LDR
use LDR (XOR) algorithm for EDC byte

EDC_CRC

public static final int EDC_CRC
use CRC16 algorithm for EDC byte - not implemented

ERROR_NONE

public static final int ERROR_NONE
indicates error free operation

ERROR_EDC

public static final int ERROR_EDC
indicates EDC error

ERROR_OTHER

public static final int ERROR_OTHER
indicates other error

S_RESYNCH_REQUEST

public static final int S_RESYNCH_REQUEST
S_RESYNCH_REQUEST

S_RESYNCH_RESPONSE

public static final int S_RESYNCH_RESPONSE
S_RESYNCH_RESPONSE

S_IFS_REQUEST

public static final int S_IFS_REQUEST
S_IFS_REQUEST

S_IFS_RESPONSE

public static final int S_IFS_RESPONSE
S_IFS_RESPONSE

S_ABORT_REQUEST

public static final int S_ABORT_REQUEST
S_ABORT_REQUEST

S_ABORT_RESPONSE

public static final int S_ABORT_RESPONSE
S_ABORT_RESPONSE

S_WTX_REQUEST

public static final int S_WTX_REQUEST
S_WTX_REQUEST

S_WTX_RESPONSE

public static final int S_WTX_RESPONSE
S_WTX_RESPONSE

S_VPP_STATE_ERROR_RESPONSE

public static final int S_VPP_STATE_ERROR_RESPONSE
S_VPP_STATE_ERR_RESPONSE

I_BLOCK

public static final int I_BLOCK
I-block

R_BLOCK

public static final int R_BLOCK
R-block

S_BLOCK

public static final int S_BLOCK
S-block
Constructor Detail

T1Block

public T1Block(int src,
               int dest,
               int pcb,
               byte[] dat,
               int edcInfo)
        throws T1BlockLengthException,
               T1BlockEDCErrorException
Constructor
Parameters:
src - source-address for T1 block
dest - destination-address for T1-Block
pcb - protocol control byte
dat - info data within T1 block set to null for no data available
edcInfo - EDC_LDR (XOR) or EDC_CRC

T1Block

public T1Block(byte[] rawBytes,
               int edcInfo)
        throws T1BlockLengthException,
               T1BlockEDCErrorException
create Block object from raw T1-Block
Method Detail

calcEDC

public int calcEDC()
calcEDC calculates the EDC-field according to the used EDC algorithm

checkEDC

public boolean checkEDC()
checks the correctness of the given EDC byte (true, if EDC is correct)

getBlock

public byte[] getBlock()
returns byte array with raw block data

getBlockType

public int getBlockType()
                 throws T1UnknownBlockException

getNAD

public byte getNAD()

getSourceID

public int getSourceID()

getDestID

public int getDestID()

getPCB

public byte getPCB()

getLEN

public int getLEN()

getDATA

public byte[] getDATA()

getEDC

public int getEDC()

getEDCAlgorithm

public int getEDCAlgorithm()

getControlBits

public int getControlBits()
                   throws T1Exception
getControlBits returns block-specific controlbits without the blocktype

toString

public java.lang.String toString()
toString returns informations about this block object (not yet optimized)
Overrides:
toString in class java.lang.Object

getSourceAddress

public int getSourceAddress()

getDestinationAddress

public int getDestinationAddress()

getRequestedSequenceNumber

public int getRequestedSequenceNumber()
                               throws T1Exception