Class of SamCardManager (Secure Access Module) implement.
More...
|
|
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 |
| |
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
◆ cardClose()
| void com.paydevice.smartpos.sdk.samcard.SamCardManager.cardClose |
( |
int |
slot | ) |
|
power down card, the reader always close card after card removed
- Parameters
-
- Returns
◆ cardDetect()
| int com.paydevice.smartpos.sdk.samcard.SamCardManager.cardDetect |
( |
int |
slot | ) |
|
check if card inserted
- Parameters
-
- 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: