Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.javacard.apduio
Class ServerT1Protocol

    java.lang.Object
      com.sun.javacard.apduio.ServerT1Protocol

    public class ServerT1Protocol

extends java.lang.Object

The ServerT1Protocol class maintains the context used in the server side T=1 protocol.

Field Summary
`protected T1Block` | `blockIncoming`
`protected T1Block` | `blockOutgoing`
`protected boolean` | `lastBlockFlag`
`protected int` | `nextBlockDataOffset`
`protected T1Block` | `nextIBlock`
`protected boolean` | `numSeq`
`protected boolean` | `numSeqRcv`
`protected boolean` | `numSeqTx`

Constructor Summary
`ServerT1Protocol(java.io.InputStream in, java.io.OutputStream out)` Constructs a ServerT1Protocol using an InputStream and an OutputStream.

Method Summary
`void` | `addCadServerListener(CadServerListener listener)` Register a new CadServerListener to be notified of state changes.
`void` | `removeCadServerListener(CadServerListener listener)` Remove a CadServerListener from the list of listeners to be notified of state changes.
`void` | `sendATR(byte[] atr)` Wait for a POWER_UP command to be received from the CAD and send the ATR (Answer To Reset) back to the CAD.
`boolean` | `t1Abort()` This method initiates a T=1 abort sequence to indicate the terminal not to send any more incoming data, and be ready for outgoing data.
`short` | `t1GetIFSC()` This method returns the T=1 maximum supported card Information Field block size (IFSC).
`short` | `t1GetIFSD()` This method returns the T=1 maximum supported device Information Field block size (IFSD).
`byte` | `t1GetNAD()` This method returns the T=1 NAD byte for the last block received.
`boolean` | `t1LastBlockReceived()` This method returns true if the last T=1 block in a chain has been received (i.e.
`short` | `t1RcvBlock(byte[] bufferINF, short[] LEN, short offset, short buffSize)` This method receives a T=1 block of data - if none are pending - or copies the data of an already- received block into the APDU buffer at the offset specified.
`short` | `t1SndBlockRcvAck(byte[] buffer, int dataOffset, int dataLength, boolean isLastBlock)` This method sends a T=1 block data in the APDU buffer specified bythe offset and length passed, and waits for acknowledgement transmission, without copying any data that might come along on that transmission.
`boolean` | `t1Wait()` This method initiates a T=1 wait sequence to indicate the terminal that more time is required to process input, and thus avoid a timeout.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### numSeq

    protected boolean numSeq

### numSeqTx

    protected boolean numSeqTx

### numSeqRcv

    protected boolean numSeqRcv

### nextIBlock

    protected T1Block nextIBlock

### nextBlockDataOffset

    protected int nextBlockDataOffset

### blockOutgoing

    protected T1Block blockOutgoing

### blockIncoming

    protected T1Block blockIncoming

### lastBlockFlag

    protected boolean lastBlockFlag

Constructor Detail

### ServerT1Protocol

    public ServerT1Protocol(java.io.InputStream in,
                            java.io.OutputStream out)

  Constructs a ServerT1Protocol using an InputStream and an OutputStream.

  Parameters:
    `in` - The InputStream connected to the CAD.
    `out` - The OutputStream connected to the CAD.

Method Detail

### addCadServerListener

    public void addCadServerListener(CadServerListener listener)

  Register a new CadServerListener to be notified of state changes.

  Parameters:
    `listener` - The listener to register.

### removeCadServerListener

    public void removeCadServerListener(CadServerListener listener)

  Remove a CadServerListener from the list of listeners to be notified of state changes.

  Parameters:
    `listener` - The listener to remove.

### t1SndBlockRcvAck

    public short t1SndBlockRcvAck(byte[] buffer,
                                  int dataOffset,
                                  int dataLength,
                                  boolean isLastBlock)
                           throws T1Exception

  This method sends a T=1 block data in the APDU buffer specified bythe offset and length passed, and waits for acknowledgement transmission, without copying any data that might come along on that transmission. On dual interface cards, the acknowledgement might come from a different interface if the interface is not locked. Only Java Card runtime environment can invoke this method.

  Returns:
    0 on success, other value in error.
  Throws:
    `T1Exception`

### t1RcvBlock

    public short t1RcvBlock(byte[] bufferINF,
                            short[] LEN,
                            short offset,
                            short buffSize)
                     throws T1Exception

  This method receives a T=1 block of data - if none are pending - or copies the data of an already- received block into the APDU buffer at the offset specified. If the data cannot fit into the APDU buffer, the remaining data will be copied the next time this method is called. Only Java Card runtime environment can invoke this method.

  Returns:
    number of bytes received on success, negative values on error.
  Throws:
    `T1Exception`

### t1Abort

    public boolean t1Abort()
                    throws T1Exception

  This method initiates a T=1 abort sequence to indicate the terminal not to send any more incoming data, and be ready for outgoing data. Only Java Card runtime environment can invoke this method.

  Returns:
    0 on success.
  Throws:
    `T1Exception`

### t1Wait

    public boolean t1Wait()
                   throws T1Exception

  This method initiates a T=1 wait sequence to indicate the terminal that more time is required to process input, and thus avoid a timeout. Only Java Card runtime environment can invoke this method.

  Returns:
    0 on success.
  Throws:
    `T1Exception`

### t1GetNAD

    public byte t1GetNAD()

  This method returns the T=1 NAD byte for the last block received. Only Java Card runtime environment can invoke this method.

  Returns:
    T=1 NAD value.

### t1GetIFSC

    public short t1GetIFSC()

  This method returns the T=1 maximum supported card Information Field block size (IFSC). Only Java Card runtime environment can invoke this method.

  Returns:
    T=1 IFSC value.

### t1GetIFSD

    public short t1GetIFSD()

  This method returns the T=1 maximum supported device Information Field block size (IFSD). Only Java Card runtime environment can invoke this method.

  Returns:
    T=1 IFSD value.

### t1LastBlockReceived

    public boolean t1LastBlockReceived()

  This method returns
  true if the last T=1 block in a chain has been received (i.e. block with the M bit set to 1),
  false otherwise. Only Java Card runtime environment can invoke this method.

  Returns:
    true if last block recevied,
    false otherwise.

### sendATR

    public void sendATR(byte[] atr)
                 throws java.io.IOException,
                        T1Exception

  Wait for a POWER_UP command to be received from the CAD and send the ATR (Answer To Reset) back to the CAD. This method must be called prior to any other method in this class.

  Parameters:
    `atr` - The byte array which contains the ATR to send.
  Throws:
    `java.io.IOException` - If an IO error occured while attempting to send the ATR.
    `T1Exception`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.