SmartPos SDK for Android 1.4.1

Public Member Functions | Static Public Member Functions | Static Public Attributes
com.paydevice.smartpos.sdk.smartcard.SmartCardManager Class Reference

Class of SmartCardManager (SmartCard Reader) implement. More...

## Public Member Functions
int | init (Context ctx) throws SmartPosException
| Initialize smartcard reader. More...
int | init (Context ctx, int mode) throws SmartPosException
void | deinit ()
| Deinitialize smartcard reader. More...
void | selectSlot (int slot) throws SmartPosException
| select the slot More...
void | powerOn () throws SmartPosException
| Sets card power on. More...
void | powerOff () throws SmartPosException
| Sets card power off. More...
byte[] | getATR () throws SmartPosException
| Gets the ATR in hex. More...
int | getProtocol () throws SmartPosException
| Gets the protocol(T0,T1) More...
byte[] | getSN () throws SmartPosException
| Gets the serial number. More...
byte[] | sendAPDU (byte[] apdu) throws SmartPosException
| Sends APDU. More...
void | sendAPDU (byte[] apdu, byte[] respone, int[] responeLen) throws SmartPosException
| Sends APDU for long respond data, CLA+INS+P1+P2+Lc+cmd+Le. More...
int | AT24CSeriesCmdRead (int intStartAddr, byte bCardType, int intReadLen, byte[] pReadData, int[] pIntReturnLen)
| read data from the memory card. More...
int | AT24CSeriesCmdWrite (int intStartAddr, byte bCardType, int intWordPageSize, int intWriteLen, byte[] pWriteData)
| writes data to the memory card. More...
int | AT24CxxCmdRead (byte bDeviceAddress, int intStartAddr, int intReadLen, byte[] pReadData, int[] pIntReturnLen)
| read data from the memory card. More...
int | AT24CxxCmdWrite (int intStartAddr, int intWordPageSize, int intWriteLen, byte[] pWriteData)
| writes data to the memory card. More...
int | AT45D041Cmd (byte OPcode, int PageNo, int intStartAddr, int intWriteLen, byte[] pWriteData, int intReadLen, byte[] pReadData, int[] pIntReturnLen)
| reads/write data from/to the card. More...
int | AT88SC1608CmdInitializeAuthentication (byte[] pbHostRand)
| sends INITIALIZE AUTHENTICATION command to the card. More...
int | AT88SC1608CmdReadConfigurationZone (byte bAddress, byte bReadLen, byte[] pReadBuffer, int[] pIntReturnLen)
| reads data from the configuration zone of the card. More...
int | AT88SC1608CmdReadUserZone (byte bAddress, byte bReadLen, byte[] pReadBuffer, int[] pIntReturnLen)
| reads data from the current user zone of the card More...
int | AT88SC1608CmdSetUserZoneAddress (byte bAddress)
| selects the current user zone number. More...
int | AT88SC1608CmdVerifyAuthentication (byte[] pbHostChallenge)
| sends INITIALIZE AUTHENTICATION command to the card. More...
int | AT88SC1608CmdVerifyPassword (byte bZoneNo, boolean bIsReadAccess, byte bPW1, byte bPW2, byte bPW3)
| verifies the read/write password of the selected zone. More...
int | AT88SC1608CmdWriteConfigurationZone (byte bAddress, byte bWriteLen, byte[] pWriteBuffer)
| writes data to the configuration zone of the card. More...
int | AT88SC1608CmdWriteUserZone (byte bAddress, byte bWriteLen, byte[] pWriteBuffer)
| writes data to the current user zone of the card. More...
int | AT88SC102CmdOpBitGetAddr (int[] pIntCurBitAddr)
| gets the current bit address of the card. The smartcard reader self-maintains the current address. The function returns the internal variables of the reader which indicated the current bit address. More...
int | AT88SC102CmdOpBitsGotoAddr (int intTargetAddr)
| makes the card JUMP to the target bit address. provides an easy way to JUMP to any absolute address, no matter forward or backward. does not use RESET operation to reset the address counter, so all the internal flags of the card is not affected after using this function. The smartcard reader self-maintains the address internally, so the caller could safely call this function. More...
int | AT88SC102CmdOpBitsIncAddr (int intBitsIncAddr)
| increases the internal address counter of the card. The unit of the increment is in bit based. Addressing of the AT88SC102 is sequential. Specific bit addresses may be reached by completing a reset, then clocking the device (INC/READ) until the desired address is reached. The AT88SC102 will determine which operations are allowed at specific address locations. These operations are specified in Tables 1 and 2. For instance, to address the issuer zone (IZ), execute a reset operation, then clock the device 16 times. The device now outputs the first bit of the IZ. After the address counter counts up to 1567, the next CLK pulse resets the address to “0. More...
int | AT88SC102CmdOpBitsRead (int intReadLen, byte[] pDataBuffer)
| reads bit data from the card from current address. More...
int | AT88SC102CmdOpBytesComp (int intCompLen, byte[] pDataBuffer)
| sends data to the card for comparison. More...
int | AT88SC102CmdOpBytesIncAddr (int intBytesIncAddr)
| increases the internal address counter of the card. The unit of the increment is in byte based More...
int | AT88SC102CmdOpBytesRead (int intReadLen, byte[] pDataBuffer)
| reads bytes data from the card from current address. More...
int | AT88SC102CmdOpBytesWrite (int intWriteLen, byte[] pDataBuffer)
| writes data to current address of the card. More...
int | AT88SC102CmdOpReset ()
| sends micro operation, RESET, to the card. This operation will reset the internal address to “0”. After the falling edge of RST, the first bit of the fabrication zone (Address 0) will be driven on the I/O contact. The erase flags (E1 and E2) will be reset. More...
int | AT88SC102CmdOpSingleBitErase ()
| sends a erase operation with single bit to logic 1. The address is not changed after calling this function. More...
int | AT88SC102CmdOpSingleBitWrite ()
| sends a write operation with single bit to logic 0. The address is not changed after calling this function. More...
int | AT88SC102CmdOpStandby ()
| sends micro operation, STANDBY, to the card. The device is placed in standby mode when FUS pin = “0” and RST = “1”. The address will not increment when RST is high. More...
int | AT88SC102CmdSetFusPinHigh ()
| drives the FUS pin of the card to high state. Used for personalizing the device. FUS must be high to be able to personalize the device when the issuer fuse is unblown. In Security Level 1, the FUS pin may be forced low to simulate Security Level 2. In Security Level 2, the FUS pin has no function. More...
int | AT88SC102CmdSetFusPinLow ()
| drives the FUS pin of the card to low state. Used for personalizing the device. FUS must be high to be able to personalize the device when the issuer fuse is unblown. In Security Level 1, the FUS pin may be forced low to simulate Security Level 2. In Security Level 2, the FUS pin has no function. More...
int | AT88SC102CmdSetRstPinHigh ()
| drives the RST pin of the card to high state. makes the reader drives RST pin to low. If the previously state of RST pin is high, then the bit address will reset to 0. If the previously state of RST pin is low, then the bit address keep unchanged. The bit address is also auto maintained by the reader internally. More...
int | AT88SC102CmdSetRstPinLow ()
| drives the RST pin of the card to high state. makes the reader drives RST pin to low. If the previously state of RST pin is high, then the bit address will reset to 0. If the previously state of RST pin is low, then the bit address keep unchanged. The bit address is also auto maintained by the reader internally. More...
int | SLE4428CmdRead8Bits (int address, int intReadLen, byte[] pReadData, int[] pIntReturnLen)
| read one byte of data without protect bit from the card. More...
int | SLE4428CmdRead9Bits (int address, int intReadLen, byte[] pReadData, byte[] pReadPB, int[] pIntReturnLen)
| reads data with protect bits from the card. More...
int | SLE4428CmdVerify1stPSC (byte data)
| used to verify the 1st PSC byte. More...
int | SLE4428CmdVerify2ndPSC (byte data)
| used to verify the 2nd PSC byte. More...
int | SLE4428CmdVerifyPSCAndEraseErrorCounter (byte b1stPsc, byte b2ndPsc, int[] pIntErrorReason)
| used to verify the 1st 2nd PSC bytes and erase error counter if the verification is OK. Only apply to SLE4428. More...
int | SLE4428CmdWriteEraseWithoutPB (int address, byte data)
| writes one byte data without protect bit to the card. More...
int | SLE4428CmdWriteEraseWithPB (int address, byte data)
| writes one byte data with protect bit to the card. More...
int | SLE4428CmdWriteErrorCounter (byte data)
| writes error counter to the card. More...
int | SLE4428CmdWritePBWithDataComparison (int address, byte data)
| writes protect bit with data comparison. If the data is the same as the one in the card, the protect bit is written. More...
int | SLE4442CmdCompareVerificationData (byte bAddress, byte bData)
| compares the data with the specified reference byte in the security memory. More...
int | SLE4442CmdReadMainMemory (byte bAddress, byte bReadLen, byte[] pReadData, int[] pReturnLen)
| reads data from the main memory of the card. More...
int | SLE4442CmdReadProtectionMemory (byte bReadLen, byte[] pReadData, int[] pIntReturnLen)
| reads data from the protection memory of the card. More...
int | SLE4442CmdReadSecurityMemory (byte bReadLen, byte[] pReadData, int[] pIntReturnLen)
| reads data from the security memory of the card. More...
int | SLE4442CmdUpdateMainMemory (byte bAddress, byte bData)
| updates one byte data in the main memory of the card. More...
int | SLE4442CmdUpdateSecurityMemory (byte bAddress, byte bData)
| updates one byte data in the main memory of the card. More...
int | SLE4442CmdVerify (int intPinLen, byte[] pPinData)
| Verify the pin of the card. Only apply to SLE4442. More...
int | SLE4442CmdWriteProtectionMemory (byte bAddress, byte bData)
| write one byte data in the protection memory of the card. More...
int | SLE6636CmdAuthentication (byte bKeyNo, byte bClock, byte bWriteLen, byte[] pWChallengeBuf, byte bReadLen, byte[] pReadData, int[] pIntReturnLen)
| send authentication command More...
int | SLE6636CmdReadCounters (byte bReadLen, byte[] pReadData, int[] pIntReturnLen)
| read Counter Area from the card. More...
int | SLE6636CmdReadMemory (byte bAddress, byte bReadMEMLen, byte bReadLen, byte[] pReadData, int[] pIntReturnLen)
| read Memory Area More...
int | SLE6636CmdReload (byte bAddress, byte bReadLen, byte[] pReadData, int[] pIntReturnLen)
| reload(Erase 8 Bits with Carry Operation) . More...
int | SLE6636CmdVerification (byte bTC1, byte bTC2, byte bTC3, byte bReadLen, byte[] pReadData, int[] pIntReturnLen)
int | SLE6636CmdWriteCounter (byte bAddress, byte bWriteData, byte bReadLen, byte[] pReadData, int[] pIntReturnLen)
| write Counter Area to the card. More...
int | SLE6636CmdWriteMemory (int intApduLen, byte bAddress, byte bWriteLen, byte[] pWriteBuffer, byte bReadLen, byte[] pReadData, int[] pIntReturnLen)
| write Memory Area More...

## Static Public Member Functions
static String | errCode2String (int errCode)
| convert error code to string More...

## Static Public Attributes
static final int | SCR_ERR_INIT = 0xf1
static final int | SCR_ERR_DEINIT = 0xf2
static final int | SCR_ERR_NO_INIT = 0xf3
static final int | SCR_ERR_ALREADY_INIT = 0xf4
static final int | SCR_ERR_PARAM = 0xf5
static final int | SCR_ERR_CODE_SUCCESSFUL = SCError.READER_SUCCESSFUL
static final int | SCR_ERR_CODE_TRANSMIT_ERROR = SCError.READER_TRANSMIT_ERROR
static final int | SCR_ERR_CODE_CMD_FAIL = SCError.READER_CMD_FAIL
static final int | SCR_ERR_CODE_CMD_BUSY = SCError.READER_CMD_BUSY
static final int | SCR_ERR_CODE_NOT_SUPPORT = SCError.READER_NOT_SUPPORT
static final int | SCR_ERR_CODE_NO_CARD = SCError.READER_NO_CARD
static final int | SCR_ERR_CODE_MEM_ERROR = SCError.READER_MEM_ERROR
static final int | SCR_ERR_CODE_TIMEOUT = SCError.READER_TIMEOUT
static final int | SCR_ERR_CODE_INVALID_PARAMETER = SCError.READER_INVALID_PARAMETER
static final int | SCR_ERR_CODE_NOT_INITIALIZED = SCError.READER_NOT_INITIALED
static final int | SCR_ERR_CODE_PBOC_FAIL = SCError.READER_PBOC_FAIL
static final int | SCR_ERR_CODE_CARD_INACTIVE = SCError.READER_CARD_INACTIVE
static final int | SCR_ERR_CODE_CARD_LOCKED = SCError.READER_CARD_LOCKED
static final int | SCR_ERR_CODE_DEV_ERR = SCError.READER_DEV_ERR
static final int | SCR_MODE_ISO7816 = Reader.CardModeASYNC
static final int | SCR_MODE_AT24C = Reader.CardModeI2C
static final int | SCR_MODE_SLE4428 = Reader.CardModeSLE4428
static final int | SCR_MODE_SLE4442 = Reader.CardModeSLE4442
static final int | SCR_MODE_AT88SC1608 = Reader.CardModeAT88SC1608
static final int | SCR_MODE_AT45D041 = Reader.CardModeAT45D041
static final int | SCR_MODE_SLE6636 = Reader.CardModeSLE6636
static final int | SCR_MODE_AT88SC102 = Reader.CardModeAT88SC102
static final int | PROTOCOL_T0 = Reader.CCID_PROTOCOL_T0
static final int | PROTOCOL_T1 = Reader.CCID_PROTOCOL_T1
static final int | PROTOCOL_NA = Reader.CCID_PROTOCOL_NA

## Detailed Description

Class of SmartCardManager (SmartCard Reader) implement.

## Member Function Documentation

## ◆ AT24CSeriesCmdRead()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.AT24CSeriesCmdRead | ( | int | intStartAddr,
|  | byte | bCardType,
|  | int | intReadLen,
|  | byte[] | pReadData,
|  | int[] | pIntReturnLen
| ) |  |

read data from the memory card.

Parameters

  intStartAddr | The memory address to read from.
  bCardType | The card type.
  intReadLen | Number of bytes to be read from the card.
  pReadData | Pointer to a buffer that receives the data read from the card.
  pIntReturnLen | Pointer to the length, in bytes, of the pReadData parameter and receives the actual number of bytes received from the card.

Returns
  0 for success.

## ◆ AT24CSeriesCmdWrite()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.AT24CSeriesCmdWrite | ( | int | intStartAddr,
|  | byte | bCardType,
|  | int | intWordPageSize,
|  | int | intWriteLen,
|  | byte[] | pWriteData
| ) |  |

writes data to the memory card.

Parameters

  intStartAddr | The memory address to write to.
  bCardType | The card type.
  intWordPageSize | The page size for write operation. This value is depended on the property of the memory card. If the programmer doesn't know it, set it to 0x08.
  intWriteLen | Number of bytes to be written to the card.
  pWriteData | Pointer to the buffer containing the data to be written to the card.

Returns
  0 for success.

## ◆ AT24CxxCmdRead()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.AT24CxxCmdRead | ( | byte | bDeviceAddress,
|  | int | intStartAddr,
|  | int | intReadLen,
|  | byte[] | pReadData,
|  | int[] | pIntReturnLen
| ) |  |

read data from the memory card.

Parameters

  bDeviceAddress | The I2C Device Address. Should set to 0x50.
  intStartAddr | The memory address to read from. Note:The single byte Card,lngStartAddr = 0x7FFF.The double byte Card,lngStartAddr |= 0x8000
  intReadLen | Number of bytes to be read from the card.
  pReadData | Pointer to a buffer that receives the data read from the card.
  pIntReturnLen | Pointer to the length, in bytes, of the pReadData parameter and receives the actual number of bytes received from the card.

Returns
  0 for success.

## ◆ AT24CxxCmdWrite()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.AT24CxxCmdWrite | ( | int | intStartAddr,
|  | int | intWordPageSize,
|  | int | intWriteLen,
|  | byte[] | pWriteData
| ) |  |

writes data to the memory card.

Parameters

  intStartAddr | The memory address to write to. Note:The single byte Card,lngStartAddr = 0x7FFF.The double byte Card,lngStartAddr |= 0x8000
  intWordPageSize | The page size for write operation. This value is depended on the property of the memory card. If the programmer doesn't know it, set it to 0x08.
  intWriteLen | Number of bytes to be written to the card.
  pWriteData | Pointer to the buffer containing the data to be written to the card.

Returns
  0 for success.

## ◆ AT45D041Cmd()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.AT45D041Cmd | ( | byte | OPcode,
|  | int | PageNo,
|  | int | intStartAddr,
|  | int | intWriteLen,
|  | byte[] | pWriteData,
|  | int | intReadLen,
|  | byte[] | pReadData,
|  | int[] | pIntReturnLen
| ) |  |

reads/write data from/to the card.

Parameters

  OPcode | The AT45D041 command code
  PageNo | The page number to access.
  intStartAddr | The memory address in the buffer or memory.
  intWriteLen | Number of bytes to be written to the card.
  pWriteData | Pointer to the buffer containing the data to be written to the card.
  intReadLen | Number of bytes to be read from the card.
  pReadData | Pointer to a buffer that receives the data read from the card.
  pIntReturnLen | Number of bytes which is actually received data from the card.

Returns
  0 for success.

## ◆ AT88SC102CmdOpBitGetAddr()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.AT88SC102CmdOpBitGetAddr | ( | int[] | pIntCurBitAddr | ) |

gets the current bit address of the card. The smartcard reader self-maintains the current address. The function returns the internal variables of the reader which indicated the current bit address.

Parameters

  pIntCurBitAddr | Pointer to the current bit address of the card.

Returns
  0 for success.

## ◆ AT88SC102CmdOpBitsGotoAddr()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.AT88SC102CmdOpBitsGotoAddr | ( | int | intTargetAddr | ) |

makes the card JUMP to the target bit address. provides an easy way to JUMP to any absolute address, no matter forward or backward. does not use RESET operation to reset the address counter, so all the internal flags of the card is not affected after using this function. The smartcard reader self-maintains the address internally, so the caller could safely call this function.

Parameters

  intTargetAddr | The target bit address to be reached.

Returns
  0 for success.

## ◆ AT88SC102CmdOpBitsIncAddr()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.AT88SC102CmdOpBitsIncAddr | ( | int | intBitsIncAddr | ) |

increases the internal address counter of the card. The unit of the increment is in bit based. Addressing of the AT88SC102 is sequential. Specific bit addresses may be reached by completing a reset, then clocking the device (INC/READ) until the desired address is reached. The AT88SC102 will determine which operations are allowed at specific address locations. These operations are specified in Tables 1 and 2. For instance, to address the issuer zone (IZ), execute a reset operation, then clock the device 16 times. The device now outputs the first bit of the IZ. After the address counter counts up to 1567, the next CLK pulse resets the address to “0.

Parameters

  intBitsIncAddr | The numbers of bit address to be incremented. If the bit address reaches the boundary, 1568, then the card internally reset the bit address to 0.

Returns
  0 for success.

## ◆ AT88SC102CmdOpBitsRead()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.AT88SC102CmdOpBitsRead | ( | int | intReadLen,
|  | byte[] | pDataBuffer
| ) |  |

reads bit data from the card from current address.

Parameters

  intReadLen | Number of bits to be read from the card.
  pDataBuffer | Pointer to the buffer that receives the data read from the card. One byte only contains one bit data, so the buffer size should be intReadLen byte size

Returns
  0 for success.

## ◆ AT88SC102CmdOpBytesComp()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.AT88SC102CmdOpBytesComp | ( | int | intCompLen,
|  | byte[] | pDataBuffer
| ) |  |

sends data to the card for comparison.

Parameters

  intCompLen | Number of bytes to be compared in the card.
  pDataBuffer | Pointer to the buffer that contains the data to be compared in the card.

Returns

## ◆ AT88SC102CmdOpBytesIncAddr()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.AT88SC102CmdOpBytesIncAddr | ( | int | intBytesIncAddr | ) |

increases the internal address counter of the card. The unit of the increment is in byte based

Parameters

  intBytesIncAddr | The numbers of bytes address to be incremented. If the bit address reaches the boundary, 1568, then the card internally reset the bit address to 0.

Returns
  0 for success.

## ◆ AT88SC102CmdOpBytesRead()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.AT88SC102CmdOpBytesRead | ( | int | intReadLen,
|  | byte[] | pDataBuffer
| ) |  |

reads bytes data from the card from current address.

Parameters

  intReadLen | Number of bytes to be read from the card.
  pDataBuffer | Pointer to the buffer that receives the data read from the card.

Returns
  0 for success.

## ◆ AT88SC102CmdOpBytesWrite()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.AT88SC102CmdOpBytesWrite | ( | int | intWriteLen,
|  | byte[] | pDataBuffer
| ) |  |

writes data to current address of the card.

Parameters

  intWriteLen | Number of bytes to be written to the card.
  pDataBuffer | Pointer to the buffer that contains the data to be written to the card.

Returns

## ◆ AT88SC102CmdOpReset()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.AT88SC102CmdOpReset | ( |  | ) |

sends micro operation, RESET, to the card. This operation will reset the internal address to “0”. After the falling edge of RST, the first bit of the fabrication zone (Address 0) will be driven on the I/O contact. The erase flags (E1 and E2) will be reset.

Returns
  0 for success.

## ◆ AT88SC102CmdOpSingleBitErase()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.AT88SC102CmdOpSingleBitErase | ( |  | ) |

sends a erase operation with single bit to logic 1. The address is not changed after calling this function.

Returns
  0 for success.

## ◆ AT88SC102CmdOpSingleBitWrite()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.AT88SC102CmdOpSingleBitWrite | ( |  | ) |

sends a write operation with single bit to logic 0. The address is not changed after calling this function.

Returns
  0 for success.

## ◆ AT88SC102CmdOpStandby()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.AT88SC102CmdOpStandby | ( |  | ) |

sends micro operation, STANDBY, to the card. The device is placed in standby mode when FUS pin = “0” and RST = “1”. The address will not increment when RST is high.

Returns
  0 for success.

## ◆ AT88SC102CmdSetFusPinHigh()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.AT88SC102CmdSetFusPinHigh | ( |  | ) |

drives the FUS pin of the card to high state. Used for personalizing the device. FUS must be high to be able to personalize the device when the issuer fuse is unblown. In Security Level 1, the FUS pin may be forced low to simulate Security Level 2. In Security Level 2, the FUS pin has no function.

Returns
  0 for success.

## ◆ AT88SC102CmdSetFusPinLow()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.AT88SC102CmdSetFusPinLow | ( |  | ) |

drives the FUS pin of the card to low state. Used for personalizing the device. FUS must be high to be able to personalize the device when the issuer fuse is unblown. In Security Level 1, the FUS pin may be forced low to simulate Security Level 2. In Security Level 2, the FUS pin has no function.

Returns
  0 for success.

## ◆ AT88SC102CmdSetRstPinHigh()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.AT88SC102CmdSetRstPinHigh | ( |  | ) |

drives the RST pin of the card to high state. makes the reader drives RST pin to low. If the previously state of RST pin is high, then the bit address will reset to 0. If the previously state of RST pin is low, then the bit address keep unchanged. The bit address is also auto maintained by the reader internally.

Returns
  0 for success.

## ◆ AT88SC102CmdSetRstPinLow()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.AT88SC102CmdSetRstPinLow | ( |  | ) |

drives the RST pin of the card to high state. makes the reader drives RST pin to low. If the previously state of RST pin is high, then the bit address will reset to 0. If the previously state of RST pin is low, then the bit address keep unchanged. The bit address is also auto maintained by the reader internally.

Returns
  0 for success.

## ◆ AT88SC1608CmdInitializeAuthentication()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.AT88SC1608CmdInitializeAuthentication | ( | byte[] | pbHostRand | ) |

sends INITIALIZE AUTHENTICATION command to the card.

Parameters

  pbHostRand | Pointer to the buffer containing the 8 bytes data of host random numbers.

Returns
  0 for success.

## ◆ AT88SC1608CmdReadConfigurationZone()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.AT88SC1608CmdReadConfigurationZone | ( | byte | bAddress,
|  | byte | bReadLen,
|  | byte[] | pReadBuffer,
|  | int[] | pIntReturnLen
| ) |  |

reads data from the configuration zone of the card.

Parameters

  bAddress | The memory address in the configuration zone to read from.
  bReadLen | Number of bytes to be read from the card.
  pReadBuffer | Pointer to a buffer that receives the data read from the card.
  pIntReturnLen | Number of bytes which is actually received data from the card.

Returns
  0 for success.

## ◆ AT88SC1608CmdReadUserZone()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.AT88SC1608CmdReadUserZone | ( | byte | bAddress,
|  | byte | bReadLen,
|  | byte[] | pReadBuffer,
|  | int[] | pIntReturnLen
| ) |  |

reads data from the current user zone of the card

Parameters

  bAddress | The memory address in the current user zone to read from.
  bReadLen | Number of bytes to be read from the card.
  pReadBuffer | Pointer to a buffer that receives the data read from the card.
  pIntReturnLen | Number of bytes which is actually received data from the card.

Returns
  0 for success.

## ◆ AT88SC1608CmdSetUserZoneAddress()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.AT88SC1608CmdSetUserZoneAddress | ( | byte | bAddress | ) |

selects the current user zone number.

Parameters

  bAddress | The user zone number to be selected. This value is between 0 to 7. Other value will be rejected.

Returns
  0 for success.

## ◆ AT88SC1608CmdVerifyAuthentication()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.AT88SC1608CmdVerifyAuthentication | ( | byte[] | pbHostChallenge | ) |

sends INITIALIZE AUTHENTICATION command to the card.

Parameters

  pbHostChallenge | Pointer to the buffer containing the 8 bytes data of host random numbers.

Returns
  0 for success.

## ◆ AT88SC1608CmdVerifyPassword()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.AT88SC1608CmdVerifyPassword | ( | byte | bZoneNo,
|  | boolean | bIsReadAccess,
|  | byte | bPW1,
|  | byte | bPW2,
|  | byte | bPW3
| ) |  |

verifies the read/write password of the selected zone.

Parameters

  bZoneNo | The zone number.
  bIsReadAccess | TRUE for read password. FALSE for write password.
  bPW1 | Password 1.
  bPW2 | Password 2.
  bPW3 | Password 3.

Returns
  0 for success.

## ◆ AT88SC1608CmdWriteConfigurationZone()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.AT88SC1608CmdWriteConfigurationZone | ( | byte | bAddress,
|  | byte | bWriteLen,
|  | byte[] | pWriteBuffer
| ) |  |

writes data to the configuration zone of the card.

Parameters

  bAddress | The memory address in the current user zone to write to.
  bWriteLen | Number of bytes to be written to the card.
  pWriteBuffer | Pointer to the buffer containing the data to be written to the card.

Returns
  0 for success.

## ◆ AT88SC1608CmdWriteUserZone()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.AT88SC1608CmdWriteUserZone | ( | byte | bAddress,
|  | byte | bWriteLen,
|  | byte[] | pWriteBuffer
| ) |  |

writes data to the current user zone of the card.

Parameters

  bAddress | The memory address in the current user zone to write to.
  bWriteLen | Number of bytes to be written to the card.
  pWriteBuffer | Pointer to the buffer containing the data to be written to the card.

Returns
  0 for success.

## ◆ deinit()

void com.paydevice.smartpos.sdk.smartcard.SmartCardManager.deinit | ( |  | ) |

Deinitialize smartcard reader.

Returns

## ◆ errCode2String()

static String com.paydevice.smartpos.sdk.smartcard.SmartCardManager.errCode2String | ( | int | errCode | ) |
| static

convert error code to string

Parameters

  errCode | error code

Returns
  error code string

## ◆ getATR()

byte [] com.paydevice.smartpos.sdk.smartcard.SmartCardManager.getATR | ( |  | ) | throws SmartPosException

Gets the ATR in hex.

Returns
  ART bytes array

## ◆ getProtocol()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.getProtocol | ( |  | ) | throws SmartPosException

Gets the protocol(T0,T1)

Returns
  PROTOCOL_T0,PROTOCOL_T1 or PROTOCOL_NA(fail)

## ◆ getSN()

byte [] com.paydevice.smartpos.sdk.smartcard.SmartCardManager.getSN | ( |  | ) | throws SmartPosException

Gets the serial number.

Returns
  bytes array of serial number

## ◆ init()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.init | ( | Context | ctx | ) | throws SmartPosException

Initialize smartcard reader.

Parameters

  ctx | Android Context

Returns
  slot count(1 or 2)

## ◆ powerOff()

void com.paydevice.smartpos.sdk.smartcard.SmartCardManager.powerOff | ( |  | ) | throws SmartPosException

Sets card power off.

Returns

## ◆ powerOn()

void com.paydevice.smartpos.sdk.smartcard.SmartCardManager.powerOn | ( |  | ) | throws SmartPosException

Sets card power on.

Returns

## ◆ selectSlot()

void com.paydevice.smartpos.sdk.smartcard.SmartCardManager.selectSlot | ( | int | slot | ) | throws SmartPosException

select the slot

Parameters

  slot | 0,1

Returns

## ◆ sendAPDU() [1/2]

byte [] com.paydevice.smartpos.sdk.smartcard.SmartCardManager.sendAPDU | ( | byte[] | apdu | ) | throws SmartPosException

Sends APDU.

Parameters

  apdu | apdu byte array

Returns
  apdu respond byte array

## ◆ sendAPDU() [2/2]

void com.paydevice.smartpos.sdk.smartcard.SmartCardManager.sendAPDU | ( | byte[] | apdu,
|  | byte[] | respone,
|  | int[] | responeLen
| ) |  | throws SmartPosException

Sends APDU for long respond data, CLA+INS+P1+P2+Lc+cmd+Le.

Parameters

  apdu | apdu byte array

Returns
  apdu respond byte array

## ◆ SLE4428CmdRead8Bits()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.SLE4428CmdRead8Bits | ( | int | address,
|  | int | intReadLen,
|  | byte[] | pReadData,
|  | int[] | pIntReturnLen
| ) |  |

read one byte of data without protect bit from the card.

Parameters

  address | The memory address to read from the card.
  intReadLen | Number of bytes to be read from the card.
  pReadData | Pointer to a buffer that receives the data read from the card.
  pIntReturnLen | Pointer to a number of bytes which is actually received data from the card.

Returns
  0 for success.

## ◆ SLE4428CmdRead9Bits()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.SLE4428CmdRead9Bits | ( | int | address,
|  | int | intReadLen,
|  | byte[] | pReadData,
|  | byte[] | pReadPB,
|  | int[] | pIntReturnLen
| ) |  |

reads data with protect bits from the card.

Parameters

  address | The memory address to read from the card.
  intReadLen | Number of bytes to be read from the card.
  pReadData | Pointer to a buffer that receives the data read from the card.
  pReadPB | Point to the buffer that receives the protect bits read from the card. Each protect bit occupies one byte space This buffer size is the same as pReadData. The values in the buffer are 0x00 or 0x01.
  pIntReturnLen | Pointer to the length, in bytes, of the pReadData parameter and receives the actual number of bytes received from the card

Returns
  0 for success.

## ◆ SLE4428CmdVerify1stPSC()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.SLE4428CmdVerify1stPSC | ( | byte | data | ) |

used to verify the 1st PSC byte.

Parameters

  data | The 1st PSC byte to be verified. attempt. Therefore, there are max 8 attempts.

Returns
  0 for success.

## ◆ SLE4428CmdVerify2ndPSC()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.SLE4428CmdVerify2ndPSC | ( | byte | data | ) |

used to verify the 2nd PSC byte.

Parameters

  data | The 2nd PSC byte to be verified. attempt. Therefore, there are max 8 attempts.

Returns
  0 for success.

## ◆ SLE4428CmdVerifyPSCAndEraseErrorCounter()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.SLE4428CmdVerifyPSCAndEraseErrorCounter | ( | byte | b1stPsc,
|  | byte | b2ndPsc,
|  | int[] | pIntErrorReason
| ) |  |

used to verify the 1st 2nd PSC bytes and erase error counter if the verification is OK. Only apply to SLE4428.

Parameters

  b1stPsc | The 1st PSC byte to be verified.
  b2ndPsc | The 2nd PSC byte to be verified.
  pIntErrorReason | Specify the error code if the function fails.

Returns
  0 for success.

## ◆ SLE4428CmdWriteEraseWithoutPB()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.SLE4428CmdWriteEraseWithoutPB | ( | int | address,
|  | byte | data
| ) |  |

writes one byte data without protect bit to the card.

Parameters

  address | The memory address to write to the card.
  data | The written data.

Returns
  0 for success.

## ◆ SLE4428CmdWriteEraseWithPB()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.SLE4428CmdWriteEraseWithPB | ( | int | address,
|  | byte | data
| ) |  |

writes one byte data with protect bit to the card.

Parameters

  address | The memory address to write to the card.
  data | The written data.

Returns
  0 for success.

## ◆ SLE4428CmdWriteErrorCounter()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.SLE4428CmdWriteErrorCounter | ( | byte | data | ) |

writes error counter to the card.

Parameters

  data | The error counter. It is in bitmap format. Each bit presents one available attempt. Therefore, there are max 8 attempts.

Returns
  0 for success.

## ◆ SLE4428CmdWritePBWithDataComparison()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.SLE4428CmdWritePBWithDataComparison | ( | int | address,
|  | byte | data
| ) |  |

writes protect bit with data comparison. If the data is the same as the one in the card, the protect bit is written.

Parameters

  address | The memory address to write to the card.
  data | The written data.

Returns
  0 for success.

## ◆ SLE4442CmdCompareVerificationData()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.SLE4442CmdCompareVerificationData | ( | byte | bAddress,
|  | byte | bData
| ) |  |

compares the data with the specified reference byte in the security memory.

Parameters

  bAddress | The security memory address whose value is to be compared. bAddress is 1, 2, or 3.
  bData | The compared data.

Returns
  0 for success.

## ◆ SLE4442CmdReadMainMemory()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.SLE4442CmdReadMainMemory | ( | byte | bAddress,
|  | byte | bReadLen,
|  | byte[] | pReadData,
|  | int[] | pReturnLen
| ) |  |

reads data from the main memory of the card.

Parameters

  bAddress | The memory address to read from.
  bReadLen | Number of bytes to be read from the card.
  pReadData | Pointer to a buffer that receives the data read from the card.
  pReturnLen | Pointer to the length, in bytes, of the pReadData parameter and receives the actual number of bytes received from the card

Returns
  0 for success.

## ◆ SLE4442CmdReadProtectionMemory()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.SLE4442CmdReadProtectionMemory | ( | byte | bReadLen,
|  | byte[] | pReadData,
|  | int[] | pIntReturnLen
| ) |  |

reads data from the protection memory of the card.

Parameters

  bReadLen | Number of bytes to be read from the card. This byte should be set to 4.
  pReadData | Pointer to a buffer that receives the data read from the protection memory of the card.
  pIntReturnLen | Pointer to the length, in bytes, of the pReadData parameter and receives the actual number of bytes received from the card

Returns
  0 for success.

## ◆ SLE4442CmdReadSecurityMemory()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.SLE4442CmdReadSecurityMemory | ( | byte | bReadLen,
|  | byte[] | pReadData,
|  | int[] | pIntReturnLen
| ) |  |

reads data from the security memory of the card.

Parameters

  bReadLen | Number of bytes to be read from the card. This byte should be set to 4.
  pReadData | Pointer to a buffer that receives the data read from the the security memory of the card.
  pIntReturnLen | Pointer to the length, in bytes, of the pReadData parameter and receives the actual number of bytes received from the card.

Returns

## ◆ SLE4442CmdUpdateMainMemory()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.SLE4442CmdUpdateMainMemory | ( | byte | bAddress,
|  | byte | bData
| ) |  |

updates one byte data in the main memory of the card.

Parameters

  bAddress | The main memory address to update
  bData | The updated data.

Returns
  0 for success.

## ◆ SLE4442CmdUpdateSecurityMemory()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.SLE4442CmdUpdateSecurityMemory | ( | byte | bAddress,
|  | byte | bData
| ) |  |

updates one byte data in the main memory of the card.

Parameters

  bAddress | The security memory address to update
  bData | The updated data.

Returns
  0 for success.

## ◆ SLE4442CmdVerify()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.SLE4442CmdVerify | ( | int | intPinLen,
|  | byte[] | pPinData
| ) |  |

Verify the pin of the card. Only apply to SLE4442.

Parameters

  intPinLen | The length of pin data.
  pPinData | The data of pin buffer.

Returns
  0 for success.

## ◆ SLE4442CmdWriteProtectionMemory()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.SLE4442CmdWriteProtectionMemory | ( | byte | bAddress,
|  | byte | bData
| ) |  |

write one byte data in the protection memory of the card.

Parameters

  bAddress | The protection memory address to be written.
  bData | The written data.

Returns
  0 for success.

## ◆ SLE6636CmdAuthentication()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.SLE6636CmdAuthentication | ( | byte | bKeyNo,
|  | byte | bClock,
|  | byte | bWriteLen,
|  | byte[] | pWChallengeBuf,
|  | byte | bReadLen,
|  | byte[] | pReadData,
|  | int[] | pIntReturnLen
| ) |  |

send authentication command

Parameters

  bKeyNo | Specifies the number of Key(0x01 or 0x02).
  bClock | Specifies the clock.
  bWriteLen | Specifies the data length of challenge data.
  pWChallengeBuf | Pointer to the buffer that to be challenge.
  bReadLen | Specifies the buffer length to read from the card.
  pReadData | Pointer to the buffer that receives the data.
  pIntReturnLen | Pointer to the variable that receives the number of bytes read.

Returns
  0 for success.

## ◆ SLE6636CmdReadCounters()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.SLE6636CmdReadCounters | ( | byte | bReadLen,
|  | byte[] | pReadData,
|  | int[] | pIntReturnLen
| ) |  |

read Counter Area from the card.

Parameters

  bReadLen | Specifies the buffer length to read from the card. It should be set to 8.
  pReadData | Pointer to the buffer that receives the data.
  pIntReturnLen | Pointer to the variable that receives the number of bytes read.

Returns
  0 for success.

## ◆ SLE6636CmdReadMemory()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.SLE6636CmdReadMemory | ( | byte | bAddress,
|  | byte | bReadMEMLen,
|  | byte | bReadLen,
|  | byte[] | pReadData,
|  | int[] | pIntReturnLen
| ) |  |

read Memory Area

Parameters

  bAddress | Specifies the address to read from memory area.
  bReadMEMLen | Specifies the number of bytes to read from the memory.
  bReadLen | Specifies the buffer length to be read from the card.
  pReadData | Pointer to the buffer that receives the data.
  pIntReturnLen | Pointer to the variable that receives the number of bytes read.

Returns
  0 for success.

## ◆ SLE6636CmdReload()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.SLE6636CmdReload | ( | byte | bAddress,
|  | byte | bReadLen,
|  | byte[] | pReadData,
|  | int[] | pIntReturnLen
| ) |  |

reload(Erase 8 Bits with Carry Operation) .

Parameters

  bAddress | Specifies the address to reload.
  bReadLen | Specifies the buffer length to read from the card
  pReadData | Pointer to the buffer that receives the data.
  pIntReturnLen | Pointer to the variable that receives the number of bytes read.

Returns
  0 for success.

## ◆ SLE6636CmdVerification()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.SLE6636CmdVerification | ( | byte | bTC1,
|  | byte | bTC2,
|  | byte | bTC3,
|  | byte | bReadLen,
|  | byte[] | pReadData,
|  | int[] | pIntReturnLen
| ) |  |

Parameters

  bTC1 |
  bTC2 |
  bTC3 |
  bReadLen | Specifies the buffer length to read from the card .
  pReadData | Pointer to the buffer that receives the data.
  pIntReturnLen | Pointer to the variable that receives the number of bytes read.

Returns
  0 for success.

## ◆ SLE6636CmdWriteCounter()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.SLE6636CmdWriteCounter | ( | byte | bAddress,
|  | byte | bWriteData,
|  | byte | bReadLen,
|  | byte[] | pReadData,
|  | int[] | pIntReturnLen
| ) |  |

write Counter Area to the card.

Parameters

  bAddress | Specifies address to write to counter area.
  bWriteData | Specifies the data to write to counter area.
  bReadLen | Specifies the buffer length to read from the card.
  pReadData | Pointer to the buffer that receives the data.
  pIntReturnLen | Pointer to the variable that receives the number of bytes read.

Returns
  0 for success.

## ◆ SLE6636CmdWriteMemory()

int com.paydevice.smartpos.sdk.smartcard.SmartCardManager.SLE6636CmdWriteMemory | ( | int | intApduLen,
|  | byte | bAddress,
|  | byte | bWriteLen,
|  | byte[] | pWriteBuffer,
|  | byte | bReadLen,
|  | byte[] | pReadData,
|  | int[] | pIntReturnLen
| ) |  |

write Memory Area

Parameters

  intApduLen | Should set to 0.
  bAddress | Specifies the address to write to memory area.
  bWriteLen | Specifies the number of bytes to write to memory area.
  pWriteBuffer | Pointer to the buffer containing the data to be written to the card.
  bReadLen | Specifies the buffer length to be read from the card.
  pReadData | Pointer to the buffer that receives the data.
  pIntReturnLen | Pointer to the variable that receives the number of bytes read.

Returns
  0 for success.

The documentation for this class was generated from the following file:

- src/com/paydevice/smartpos/sdk/smartcard/SmartCardManager.java