SmartPos SDK for Android 1.4.1

Public Member Functions | Static Public Attributes
com.paydevice.smartpos.sdk.samcard.SamCardManager Class Reference

Class of SamCardManager (Secure Access Module) implement. More...

## Public Member Functions
int | init ()
| initialize card reader More...
void | deinit ()
| de-initialize card reader More...
int | cardOpen (int slot, int config, byte[] atr)
| power up and reset card More...
void | cardClose (int slot)
| power down card, the reader always close card after card removed More...
int | cardDetect (int slot)
| check if card inserted More...
int | cardExchange (int slot, byte[] command, int cmdLen, byte[] response, int respLen, int timeoutMs)
void | enableDebugLog (boolean enable)
| enable lowlevel debug log, default disabled More...

## Static Public Attributes
static final int | CARD_SEND_MAX_LEN = 8208
static final int | CARD_RESP_MAX_LEN = 8194
static final int | CARD_TYPE_T0 = 0
static final int | CARD_TYPE_T1 = 1
static final int | CARD_SLOT_1 = 1
static final int | CARD_SLOT_2 = 2
static final int | CARD_PARAMS_DEFAULT = 0
static final int | CARD_VOLTAGE_1V8 = (1<<0)
static final int | CARD_VOLTAGE_3V0 = (2<<0)
static final int | CARD_VOLTAGE_5V0 = (3<<0)
static final int | CARD_PPS_NOSUPPORT = (0<<2)
static final int | CARD_PPS_SUPPORT = (1<<2)
static final int | CARD_PPS_ENFORCE = (2<<2)
static final int | CARD_BPS_9600 = (0<<4)
static final int | CARD_BPS_19200 = (1<<4)
static final int | CARD_BPS_38400 = (2<<4)
static final int | CARD_EMV_SPEC = (0<<6)
static final int | CARD_ISO_SPEC = (1<<6)
static final int | CARD_NOCHECK_SPEC = (2<<6)
static final int | ERR_NODEV = -1000
static final int | ERR_PARAM = -1001
static final int | ERR_NOINIT = -1002
static final int | ERR_SLOT = -1003
static final int | ERR_WRITE = -1004
static final int | ERR_READ = -1005
static final int | ERR_OOM = -1006
static final int | ERR_RESPONSE = -1007
static final int | ERR_RESPONSE_SUM = -1008
static final int | ERR_CARD_DETECT = -1010
static final int | ERR_CARD_OPEN = -1011
static final int | ERR_CARD_EXCHANGE = -1012

## Detailed Description

Class of SamCardManager (Secure Access Module) implement.

    operation flow:
        init()       //required once
          ↓
     cardDetect()    //optional
          ↓
      cardOpen()     //invoke once
          ↓
    cardExchange()   //loop invoke to complete the transaction
          ↓
     cardClose()     //invoke once
          ↓
       deinit()      //invoke once

## Member Function Documentation

## ◆ cardClose()

void com.paydevice.smartpos.sdk.samcard.SamCardManager.cardClose | ( | int | slot | ) |

power down card, the reader always close card after card removed

Parameters

  slot | card slot

Returns

## ◆ cardDetect()

int com.paydevice.smartpos.sdk.samcard.SamCardManager.cardDetect | ( | int | slot | ) |

check if card inserted

Parameters

  slot | card slot

Returns
  0 is card inserted, otherwise error code

## ◆ cardExchange()

int com.paydevice.smartpos.sdk.samcard.SamCardManager.cardExchange | ( | int | slot,
|  | byte[] | command,
|  | int | cmdLen,
|  | byte[] | response,
|  | int | respLen,
|  | int | timeoutMs
| ) |  |

Parameters

  slot | card slot
  command | APDU command
  cmdLen | APDU command length
  response | APDU response
  respLen | APDU response length
  timeoutMs | APDU response timeout in millisecond

Returns
  response length, otherwise is error

      response format:
      1.data + sw1 + sw2   example: send '00 84 00 00 04' response '3F A5 81 62 90 00'. data field='3F A5 81 62' and sw1=90,sw2=00
      2.sw1 + sw2          example: response '6E 00'. no data field and sw1=6E,sw2=00
      sometimes the card response is '61 XX', means normal processing.
      more data bytes are available (XX indicates a number of extra data bytes still available by subsequent GET RESPONSE).
      for details to see ISO7816-3 section 12.2.1 and ISO7816-4 section 7.6.1
      timeout:
      response speed limited by read and card. the more larger response, the longer timeout.

## ◆ cardOpen()

int com.paydevice.smartpos.sdk.samcard.SamCardManager.cardOpen | ( | int | slot,
|  | int | config,
|  | byte[] | atr
| ) |  |

power up and reset card

Parameters

  slot | card slot
  config | special card config, bit0-1 is card voltage, bit2-3 is pps config, bit4-5 is card bps, bit6-7 is card spec
  atr | card ATR(Answer To Reset) byte array, format is 2byte lenght(MSB) + ATR bytes

Returns
  0 is card protocl T=0, 1 is card protocl T=1, otherwise error code

## ◆ deinit()

void com.paydevice.smartpos.sdk.samcard.SamCardManager.deinit | ( |  | ) |

de-initialize card reader

Returns

## ◆ enableDebugLog()

void com.paydevice.smartpos.sdk.samcard.SamCardManager.enableDebugLog | ( | boolean | enable | ) |

enable lowlevel debug log, default disabled

Parameters

  enable | true is enable, false is disable

Returns

## ◆ init()

int com.paydevice.smartpos.sdk.samcard.SamCardManager.init | ( |  | ) |

initialize card reader

Returns
  0 is success, otherwise error code

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

- src/com/paydevice/smartpos/sdk/samcard/SamCardManager.java