opencard.opt.terminal.protocol
Class T1Protocol
java.lang.Object
|
+--opencard.opt.terminal.protocol.T1Protocol
- Direct Known Subclasses:
- GemplusBlockProtocol
- public abstract class T1Protocol
- extends java.lang.Object
T1Protocol is a small subset of the T1 block protocol.
NOTE: T1Protocol IS NOT IN FINAL STATE!!!!!!!!!!!!!!!
- chaining is not supported
- EDC-byte calculation only with LDR (XORed), CRC is not provided.
see ISO7816_3P9
- Version:
- $Id: T1Protocol.java,v 1.3 1999/11/03 12:37:19 damke Exp $
|
Constructor Summary |
T1Protocol(int stdHostAddress,
int stdRemoteAddress,
int timeout)
Constructor with specification of the host- and remoteaddress |
|
Method Summary |
void |
close()
close
should be called to deinitialize the object |
protected abstract T1Block |
exchangeData(T1Block sendBlock)
exchangeData
responsible for the real data-transfer. |
int |
getBlockWaitingTime()
getBlockWaitingTime returns the currently used block waiting time in milliseconds. |
int |
getHostAddress()
getHostAddress |
int |
getRecvSequenceCounter()
getRecvSequenceCounter |
int |
getRemoteAddress()
getRemoteAddress |
int |
getSendSequenceCounter()
getSendSequenceCounter |
void |
incRecvSequenceCounter()
incRecvSequenceCounter |
void |
incSendSequenceCounter()
incSendSequenceCounter |
protected T1Block |
internalTransmit(int retryCount,
T1Block dataBlock)
internalTransmit
exchanges blocks with T1 protocol handling. |
protected boolean |
isBlockComplete(byte[] rawBytes,
int len)
|
void |
open()
open
should be called after creating a new object of this class.
|
void |
setBlockWaitingTime(int timeout)
setBlockWaitingTime sets the block waiting time in milliseconds. |
void |
setRecvSequenceCounter(int val)
setRecvSequenceCounter |
void |
setSendSequenceCounter(int val)
setSendSequenceCounter |
byte[] |
transmit(byte[] sendData)
transmit
sends the data to the terminal and waits for result until timeout is reached.
transmit handles a subset of T1 error-recognition and -recovering.
|
byte[] |
transmit(int remoteAddress,
byte[] sendData)
transmit
sends the data to the terminal and waits for result until timeout is reached.
transmit handles a subset of T1 error-recognition and -recovering.
|
byte[] |
transmit(int hostAddress,
int remoteAddress,
byte[] sendData)
transmit
sends the data to the terminal and waits for result until timeout is reached.
transmit handles a subset of T1 error-recognition and -recovering. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
T1Protocol
public T1Protocol(int stdHostAddress,
int stdRemoteAddress,
int timeout)
- Constructor with specification of the host- and remoteaddress
open
public void open()
throws T1Exception
- open
should be called after creating a new object of this class.
open sends S-BLOCK(RESYNCH REQUEST) and waits for S-BLOCK(RESYNCH RESPONSE).
- Throws:
- T1Exception - thrown when error occured.
close
public void close()
- close
should be called to deinitialize the object
getBlockWaitingTime
public int getBlockWaitingTime()
- getBlockWaitingTime returns the currently used block waiting time in milliseconds.
setBlockWaitingTime
public void setBlockWaitingTime(int timeout)
- setBlockWaitingTime sets the block waiting time in milliseconds.
getHostAddress
public int getHostAddress()
- getHostAddress
getRemoteAddress
public int getRemoteAddress()
- getRemoteAddress
getSendSequenceCounter
public int getSendSequenceCounter()
- getSendSequenceCounter
setSendSequenceCounter
public void setSendSequenceCounter(int val)
- setSendSequenceCounter
incSendSequenceCounter
public void incSendSequenceCounter()
- incSendSequenceCounter
getRecvSequenceCounter
public int getRecvSequenceCounter()
- getRecvSequenceCounter
setRecvSequenceCounter
public void setRecvSequenceCounter(int val)
- setRecvSequenceCounter
incRecvSequenceCounter
public void incRecvSequenceCounter()
- incRecvSequenceCounter
transmit
public byte[] transmit(byte[] sendData)
throws T1IOException,
T1TimeoutException,
T1Exception
- transmit
sends the data to the terminal and waits for result until timeout is reached.
transmit handles a subset of T1 error-recognition and -recovering.
transmit uses the standard host- and remote-addresses (configured by constructor)
- Parameters:
sendData - data for the terminal- Throws:
- T1IOException - thrown when IO error occurs (send- or receivemethods)
- T1TimeoutException - thrown when timeout limit reached for transmitting data
transmit
public byte[] transmit(int remoteAddress,
byte[] sendData)
throws T1IOException,
T1TimeoutException,
T1Exception
- transmit
sends the data to the terminal and waits for result until timeout is reached.
transmit handles a subset of T1 error-recognition and -recovering.
transmit uses the standard host- and remote-addresses (configured by constructor)
- Parameters:
remoteAddress - sendData - data for the terminal- Throws:
- T1IOException - thrown when IO error occurs (send- or receivemethods)
- T1TimeoutException - thrown when timeout limit reached for transmitting data
transmit
public byte[] transmit(int hostAddress,
int remoteAddress,
byte[] sendData)
throws T1IOException,
T1TimeoutException,
T1Exception
- transmit
sends the data to the terminal and waits for result until timeout is reached.
transmit handles a subset of T1 error-recognition and -recovering.
- Parameters:
hostAddress - remoteAddress - use another remote-address as previously given by constructor.sendData - data for the terminal- Throws:
- T1IOException - thrown when IO error occurs (send- or receivemethods)
- T1TimeoutException - thrown when timeout limit reached for transmitting data
isBlockComplete
protected boolean isBlockComplete(byte[] rawBytes,
int len)
internalTransmit
protected T1Block internalTransmit(int retryCount,
T1Block dataBlock)
throws T1Exception
- internalTransmit
exchanges blocks with T1 protocol handling.
- Parameters:
retryCount - number of retries left for transmitting data
if retryCount = 0 reached, transfer faileddataBlock - application data block.- Throws:
- T1Execption - thrown when error occurred.
exchangeData
protected abstract T1Block exchangeData(T1Block sendBlock)
throws T1IOException,
T1TimeoutException,
T1BlockLengthException,
T1UnknownBlockException,
T1BlockEDCErrorException
- exchangeData
responsible for the real data-transfer.
- Parameters:
sendBlock - the T1-block with the send-data inside.- Throws:
- T1TimeoutException - thrown when time is elapsed receiving a T1-block
- T1BlockLengthException - thrown when difference detected between calculated and received block length
- T1UnknownBlockException - thrown when blocktype could not be recognized
- T1BlockEDCErrorException - thrown when error detection code differs from the calculated value
|