CadT0 (Java Card 3 Platform, APDU I/O Library)
Date: 2009-11-05

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 CadT0

    java.lang.Object
      com.sun.javacard.apduio.CadDevice
          com.sun.javacard.apduio.CadT0

Direct Known Subclasses:
  CadT0Client

    public class CadT0

extends CadDevice

The CadT0 class manages the encodes and decodes TLP224 transport level messages between an InputStream and an OutputStream. TLP224 Messages have the following format: <ACK><LN><MESSAGE><LRC>
where:

- <ACK> 0x60, indicating that the previous command or status response was transmitted without error.
- <LN> The length in octets of <MESSAGE>
- <MESSAGE> Is the command or response message.
- <LRC> Is the exclusive-or of the ACK, LN and MESSAGE octets.

Messages are converted from octets to two hexadecimal ASCII characters. An ASCII EOT (0x03) character is then appended to the end of the message.

Field Summary

Fields inherited from class com.sun.javacard.apduio.CadDevice
`_messages, debug, deviceProtocol, in, out, PROTOCOL_PCSC, PROTOCOL_T0, PROTOCOL_T1, PROTOCOL_TCL`

Constructor Summary
`CadT0(java.io.InputStream in, java.io.OutputStream out)` Create a new instance of the CadT0 class using an InputStream and an OutputStream.

Method Summary
`void` | `receiveTLP224Message(TLP224Message msg)` Receive a TLP224 formatted message from the input stream.
`void` | `sendTLP224Message(TLP224Message msg)` Format a TLP224Message and send to the output stream.

Methods inherited from class com.sun.javacard.apduio.CadDevice
`close, getCadClientInstance, getDeviceProtocol, getPCSCClientInstance`

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

Constructor Detail

### CadT0

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

  Create a new instance of the CadT0 class using an InputStream and an OutputStream.

  Parameters:
    `in` - The InputStream to read from.
    `out` - The OutputStream to write to.

Method Detail

### receiveTLP224Message

    public void receiveTLP224Message(TLP224Message msg)
                              throws java.io.IOException,
                                     TLP224Exception

  Receive a TLP224 formatted message from the input stream. This method reads bytes from the input stream until an EOT (0x03) character is received. The resulting message is decoded and stored in the TL224Message msg. In the event of a transmission error, this method will send attempt error recovery by sending a TLP224 NACK message to the sender. Up to 5 retries will be performed.

  Parameters:
    `msg` - The object to store the received message in.
  Throws:
    `TLP224Exception` - If an unrecoverable transmission error occurs.
    `java.io.IOException` - If an error occurs while reading from the input stream.

### sendTLP224Message

    public void sendTLP224Message(TLP224Message msg)
                           throws java.io.IOException

  Format a TLP224Message and send to the output stream. This method formats a TLP224Message into it's ASCII representation and sends the message on the output stream. After the message is completed, an ASCII EOT character is then sent to the output stream.

  Throws:
    `java.io.IOException`

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.