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

## de.cardcontact.opencard.terminal.ctapi4ocf
Class CTAPICardTerminal

    java.lang.Object
      opencard.core.terminal.CardTerminal
          de.cardcontact.opencard.terminal.ctapi4ocf.CTAPICardTerminal

All Implemented Interfaces:
  Pollable, TerminalCommand

Direct Known Subclasses:
  CTAPIWithKeyboardCardTerminal

    public class CTAPICardTerminal

extends CardTerminal
implements Pollable, TerminalCommand

Implements a CT-API card terminal for OCF.

Field Summary
`protected CardID[]` | `cardIdTable`
`protected byte[]` | `cardStatus`
`protected cardterminal_api` | `CT`
`protected char` | `ctn`
`static byte[]` | `getStatus`
`protected char` | `pn`
`static byte[]` | `requestICC`
`protected java.lang.Object` | `sync`
`protected boolean` | `termopened`

Fields inherited from class opencard.core.terminal.CardTerminal
`address, name, slots, type`

Constructor Summary
`protected` | `CTAPICardTerminal(java.lang.String name, java.lang.String type, java.lang.String device, java.lang.String libname)` Create CTAPICardTerminal object

Method Summary
`void` | `close()` Close used resources
`CardID` | `getCardID(int slot)` Return ATR for card in slot
`byte[]` | `getStatus()` Issue STATUS command to query status of card reader slots
`protected CardID` | `internalReset(int slot, int ms)` Reset card in slot and return ATR
`protected ResponseAPDU` | `internalSendAPDU(int slot, CommandAPDU capdu, int ms)` Send APDU to card in slot
`boolean` | `isCardPresent(int slot)` Return true is slot contains a card
`void` | `open()` Open card terminal connection Called from OCF during startup
`void` | `poll()` Poll for status change This is called from OCF every second
`byte[]` | `sendTerminalCommand(byte[] com)` Send a control command to the terminal

Methods inherited from class opencard.core.terminal.CardTerminal
`addSlots, cardInserted, cardRemoved, closeSlotChannel, enumerateSlots, features, getAddress, getCardID, getName, getSlot, getSlots, getType, internalCloseSlotChannel, internalFeatures, internalOpenSlotChannel, internalOpenSlotChannel, internalReset, isCardPresent, isSlotChannelAvailable, isSlotChannelAvailable, openSlotChannel, openSlotChannel, openSlotChannel, reset, reset, reset, sendAPDU, sendAPDU, sendVerifiedCommandAPDU, slots, toString`

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

Field Detail

### requestICC

    public static final byte[] requestICC

### getStatus

    public static final byte[] getStatus

### termopened

    protected boolean termopened

### cardStatus

    protected byte[] cardStatus

### cardIdTable

    protected CardID[] cardIdTable

### sync

    protected java.lang.Object sync

### CT

    protected cardterminal_api CT

### ctn

    protected char ctn

### pn

    protected char pn

Constructor Detail

### CTAPICardTerminal

    protected CTAPICardTerminal(java.lang.String name,
                                java.lang.String type,
                                java.lang.String device,
                                java.lang.String libname)
                         throws CardTerminalException

  Create CTAPICardTerminal object

  Parameters:
    `name` -
    `type` -
    `device` -
    `libname` -
  Throws:
    `CardTerminalException`

Method Detail

### open

    public void open()
              throws CardTerminalException

  Open card terminal connection Called from OCF during startup

  Specified by:
    `open` in class `CardTerminal`
  Throws:
    `CardTerminalException` - thrown in case of initialization-errors (e.g. couldn't setup transfer protocol between CardTerminal and reader).

### close

    public void close()
               throws CardTerminalException

  Close used resources

  Specified by:
    `close` in class `CardTerminal`
  Throws:
    `CardTerminalException` - thrown in case of initialization-errors (e.g. couldn't setup transfer protocol between CardTerminal and reader).

### isCardPresent

    public boolean isCardPresent(int slot)
                          throws CardTerminalException

  Return true is slot contains a card

  Specified by:
    `isCardPresent` in class `CardTerminal`
  Parameters:
    `slot` - Slot number starting at 0
  Returns:
    True if there is a smart card inserted in the slot.
  Throws:
    `CardTerminalException` - thrown in case of problems getting the status from CardTerminal (or other serious problems in the terminal).

### getCardID

    public CardID getCardID(int slot)
                     throws CardTerminalException

  Return ATR for card in slot

  Specified by:
    `getCardID` in class `CardTerminal`
  Parameters:
    `slot` - slot id.
  Returns:
    The ATR response in form of a `CardID` object or null if no card is present.
  Throws:
    `CardTerminalException` - Thrown in case of problems in the card terminal.

### internalReset

    protected CardID internalReset(int slot,
                                   int ms)
                            throws CardTerminalException

  Reset card in slot and return ATR

  Specified by:
    `internalReset` in class `CardTerminal`
  Parameters:
    `slot` - The slot number of the slot to be resetted.
    `ms` - To be ignored. If the card does not respond within the time specified for the protocol an exception should be thrown.
  Returns:
    The `CardID` of the card.
  Throws:
    `CardTerminalException` - thrown in case of errors during reset

### internalSendAPDU

    protected ResponseAPDU internalSendAPDU(int slot,
                                            CommandAPDU capdu,
                                            int ms)
                                     throws CardTerminalException

  Send APDU to card in slot

  Specified by:
    `internalSendAPDU` in class `CardTerminal`
  Parameters:
    `slot` - The slot number of the slot to be resetted.
    `capdu` - The `CommandAPDU` to send.
    `ms` - To be ignored. If the card does not respond within the time specified for the protocol an exception should be thrown.
  Returns:
    A `ResponseAPDU`.
  Throws:
    `CardTerminalException` - thrown in case of errors in the CardTerminal (e.g. errors during data exchange)

### poll

    public void poll()
              throws CardTerminalException

  Poll for status change This is called from OCF every second

  Specified by:
    `poll` in interface `Pollable`
  Throws:
    `CardTerminalException` - Thrown when error occurred in poll-mechanism.

### sendTerminalCommand

    public byte[] sendTerminalCommand(byte[] com)
                               throws CardTerminalException

  Send a control command to the terminal

  Specified by:
    `sendTerminalCommand` in interface `TerminalCommand`
  Parameters:
    `com` - A `byte[]` containing the command to be send to the card terminal.
  Returns:
    A `byte[]` with the result (`null` if no result is available).
  Throws:
    `CardTerminalException`

### getStatus

    public byte[] getStatus()
                     throws CardTerminalException

  Issue STATUS command to query status of card reader slots

  Returns:
    Byte array of slot status as returned by STATUS command
  Throws:
    `CardTerminalException`

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