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

## amlib.ccid
Class Reader

    java.lang.Object
      amlib.ccid.Reader

    public class Reader

extends java.lang.Object

Field Summary
`static int` | `CardModeASYNC`
`static int` | `CardModeAT45D041`
`static int` | `CardModeAT88SC`
`static int` | `CardModeAT88SC102`
`static int` | `CardModeI2C`
`static int` | `CardModeINPHONE`
`static int` | `CardModeSLE4428`
`static int` | `CardModeSLE4442`
`static int` | `CardModeSLE6636`
`static int` | `CCID_POWEROFF`
`static int` | `CCID_POWERON`
`static byte` | `CCID_PROTOCOL_NA`
`static byte` | `CCID_PROTOCOL_T0`
`static byte` | `CCID_PROTOCOL_T1`
`static byte` | `SLOT_STATUS_CARD_ABSENT`
`static byte` | `SLOT_STATUS_CARD_ACTIVE`
`static byte` | `SLOT_STATUS_CARD_INACTIVE`

Constructor Summary
`Reader(HardwareInterface Dev)` Constructor
`Reader(HardwareInterface Dev, byte slot)`

Method Summary
`int` | `close()` To close communication with ICC.
`int` | `connect()` To connect to ICC.
`void` | `destroy()` To clean held member in Reader. class members will be reset to null
`int` | `escape(byte[] pTxBuf, int txLen, byte[] pRxBuf, int[] pRxLen)` Send Escape command to ICC
`byte[]` | `getAtr()` Gets the ATR bytes in hex
`java.lang.String` | `getAtrString()` Gets the ATR string.
`int` | `getCardStatus(byte[] pStatus)` Gets Card Status
`int` | `getCmdFailCode()` To get the CCID slot error and slot status registers of last CCID command
`HardwareInterface` | `getCurrentDev()` To get the current HardwareInterface instance nested in class Reader
`int` | `getProtocol(byte[] pProtocol)` To get the active protocol.
`int` | `getSN(byte[] pSN, byte[] pSNLength)` To get Serial Number.
`int` | `setPower(int power)` To set Card Power
`void` | `setSlot(byte slot)` To set the slot number of Reader
`int` | `switchMode(byte mode)` To switch to different card mode
`int` | `transmit(byte[] pTxBuf, int txLen, byte[] pRxBuf, int[] pRxLen)` Transmits APDU

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

Field Detail

### CCID_POWERON

    public static final int CCID_POWERON

See Also:
  Constant Field Values

### CCID_POWEROFF

    public static final int CCID_POWEROFF

See Also:
  Constant Field Values

### SLOT_STATUS_CARD_ACTIVE

    public static final byte SLOT_STATUS_CARD_ACTIVE

See Also:
  Constant Field Values

### SLOT_STATUS_CARD_INACTIVE

    public static final byte SLOT_STATUS_CARD_INACTIVE

See Also:
  Constant Field Values

### SLOT_STATUS_CARD_ABSENT

    public static final byte SLOT_STATUS_CARD_ABSENT

See Also:
  Constant Field Values

### CCID_PROTOCOL_T0

    public static final byte CCID_PROTOCOL_T0

See Also:
  Constant Field Values

### CCID_PROTOCOL_T1

    public static final byte CCID_PROTOCOL_T1

See Also:
  Constant Field Values

### CCID_PROTOCOL_NA

    public static final byte CCID_PROTOCOL_NA

See Also:
  Constant Field Values

### CardModeASYNC

    public static final int CardModeASYNC

See Also:
  Constant Field Values

### CardModeI2C

    public static final int CardModeI2C

See Also:
  Constant Field Values

### CardModeSLE4428

    public static final int CardModeSLE4428

See Also:
  Constant Field Values

### CardModeSLE4442

    public static final int CardModeSLE4442

See Also:
  Constant Field Values

### CardModeAT88SC

    public static final int CardModeAT88SC

See Also:
  Constant Field Values

### CardModeINPHONE

    public static final int CardModeINPHONE

See Also:
  Constant Field Values

### CardModeAT45D041

    public static final int CardModeAT45D041

See Also:
  Constant Field Values

### CardModeSLE6636

    public static final int CardModeSLE6636

See Also:
  Constant Field Values

### CardModeAT88SC102

    public static final int CardModeAT88SC102

See Also:
  Constant Field Values

Constructor Detail

### Reader

    public Reader(HardwareInterface Dev)
           throws java.lang.IllegalArgumentException

  Constructor

  Parameters:
    `Dev` - HardwareInterface object which has been initialed
  Throws:
    `java.lang.IllegalArgumentException`
  See Also:
    `HardwareInterface`

### Reader

    public Reader(HardwareInterface Dev,
                  byte slot)
           throws java.lang.IllegalArgumentException

Throws:
  `java.lang.IllegalArgumentException`

Method Detail

### setSlot

    public void setSlot(byte slot)

  To set the slot number of Reader

  Parameters:
    `slot` - slot number to manipulate.

### connect

    public int connect()

  To connect to ICC. Calls this method before communication with ICC.

  Returns:
    READER_SUCCESSFUL or other error code
  See Also:
    `Error`

### setPower

    public int setPower(int power)

  To set Card Power

  Parameters:
    `power` - CCID_POWERON or CCID_POWEROFF
  Returns:
    READER_SUCCESSFUL or other error code
  See Also:
    `Error`

### close

    public int close()

  To close communication with ICC. After this method is used, uses connect() before resuming the communication.
  This method will power off the ICC

  Returns:
    READER_SUCCESSFUL or other error code
  See Also:
    `Error`

### destroy

    public void destroy()

  To clean held member in Reader. class members will be reset to null

### transmit

    public int transmit(byte[] pTxBuf,
                        int txLen,
                        byte[] pRxBuf,
                        int[] pRxLen)

  Transmits APDU

  Parameters:
    `pTxBuf` - The data block to sent to the ICC. ( abData field in command PC_to_RDR_XfrBlock 0x6F)
    `txLen` - The length of pTxBuf
    `pRxBuf` - The adData field in received packet. Refer to RDR_to_PC_DataBlock in ICC spec.
    `pRxLen` - One byte array to specify received data length in pRxBuf
  Returns:
    READER_SUCCESSFUL or other error code
  See Also:
    `Error`

### escape

    public int escape(byte[] pTxBuf,
                      int txLen,
                      byte[] pRxBuf,
                      int[] pRxLen)

  Send Escape command to ICC

  Parameters:
    `pTxBuf` - The data block sent to the ICC. ( abData field in command PC_to_RDR_Escape 0x6b)
    `txLen` - The length of pTxBuf
    `pRxBuf` - The adData field in received packet. Refer to RDR_to_PC_Escape in ICC spec
    `pRxLen` - One byte array to specify received data length in pRxBuf
  Returns:
    READER_SUCCESSFUL or other error code
  See Also:
    `Error`

### getAtr

    public byte[] getAtr()

  Gets the ATR bytes in hex

  Returns:
    ATR bytes array

### getAtrString

    public java.lang.String getAtrString()

  Gets the ATR string.

  Returns:
    ATR String

### getCardStatus

    public int getCardStatus(byte[] pStatus)

  Gets Card Status

  Parameters:
    `pStatus` - One byte array to get Card status.
    pStatus[0] could be SLOT_STATUS_CARD_ACTIVE, SLOT_STATUS_CARD_INACTIVE
    or SLOT_STATUS_CARD_ABSENT.
  Returns:
    READER_SUCCESSFUL or other error code
  See Also:
    `Error`

### getCmdFailCode

    public int getCmdFailCode()

  To get the CCID slot error and slot status registers of last CCID command

  Returns:
    0x0000EESS where EE is bError and SS is bStatus. Refer to CCID spec. 6.2.6

### getCurrentDev

    public HardwareInterface getCurrentDev()

  To get the current HardwareInterface instance nested in class Reader

  Returns:
    class HardwareInterface
  See Also:
    `HardwareInterface`

### getProtocol

    public int getProtocol(byte[] pProtocol)

  To get the active protocol.

  Parameters:
    `pProtocol` - one byte array. Its value could be CCID_PROTOCOL_T0, CCID_PROTOCOL_T1 or CCID_PROTOCOL_NA
  Returns:
    READER_SUCCESSFUL or other error code
  See Also:
    `Error`

### getSN

    public int getSN(byte[] pSN,
                     byte[] pSNLength)

  To get Serial Number.

  Parameters:
    `pSN` - bytes array to store serial number.
    `pSNLength` - one byte array to indicate length of serial number. when method returns, it denotes the actual length of serial number.
  Returns:
    READER_SUCCESSFUL or other error code
  See Also:
    `Error`

### switchMode

    public int switchMode(byte mode)

  To switch to different card mode

  Parameters:
    `mode` - mode to switch
  Returns:
    READER_SUCCESSFUL or other error code
  See Also:
    `Error`

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