public class SmartCardInterface
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
SmartCardInterface.NotifyEvent |
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_SLOT |
static int |
EVENT_CANCEL |
static int |
EVENT_ERROR |
static int |
EVENT_INSERT_CARD |
static int |
EVENT_NONE |
static int |
EVENT_REMOVE_CARD |
static boolean |
isCardPresent |
static int[] |
LOGICAL_ID |
static int[] |
LOGICAL_ID_Q1 |
static int |
MAX_NUMBER |
static SmartCardInterface.NotifyEvent |
notifyEvent |
static java.lang.Object |
objAbsent |
static java.lang.Object |
objPresent |
static int |
SLOT_INDEX_NONE |
static java.lang.String |
TAG |
Constructor and Description |
---|
SmartCardInterface() |
Modifier and Type | Method and Description |
---|---|
static void |
callBack(int slotIndex,
int eventID)
Call back method, called by driver.
|
static void |
clear()
对于得到的通知事件,用完后即丢弃
|
static int |
close(int handle)
The function initialize the smart card reader.
|
static void |
notifyCancel() |
static int |
open(int nSlotIndex)
The function open the specified card.
|
static int |
powerOff(int handle)
Power off the smart card in the slot opened before.
|
static int |
powerOn(int handle,
byte[] byteArrayATR,
SmartCardSlotInfo info)
Power on the smart card in the slot opened before.
|
static int |
queryMaxNumber()
The function query the max the slot in this smart card reader.
|
static int |
queryPresence(int nSlotIndex)
The function query whether the smart card is not existent Attention : not
every slot can support this function.
|
static int |
read(int handle,
int nAreaType,
byte[] byteArryData,
int nStartAddress)
This function is responsible for reading data from memory card
|
static int |
setCardInfo(int handle,
int nBuadrate,
int nVoltage)
Set PSAM card baudrate and validate.
|
static int |
setSlotInfo(int handle,
SmartCardSlotInfo info)
The function set the slot control information
|
static int |
touch(int handle)
Deprecated.
Check whether this is a card on the smart card reader
return value : == 0 : no card
>0 : find a card
<0 : error code
|
static int |
transmit(int handle,
byte[] byteArrayAPDU,
byte[] byteArrayResponse)
The function sends a command Application Protocol Data Unit(APDU) to a card and retrieve the response APDU, plus the status words SW1 and SW2.
|
static int |
verify_extend(int handle,
byte[] byteArrayAPDU,
int nAddress)
Verification of data, for AT88SC102 card
|
static int |
verify(int handle,
byte[] byteArrayAPDU)
Verification of data
|
static void |
waitForCardAbsent(int timeout) |
static void |
waitForCardPresent(int timeout) |
static int |
write(int handle,
int nAreaType,
byte[] byteArryData,
int nStartAddress)
This function is responsible for writing data to memory card.
|
public static final java.lang.String TAG
public static final int[] LOGICAL_ID
public static final int[] LOGICAL_ID_Q1
public static final int MAX_NUMBER
public static final int DEFAULT_SLOT
public static final int EVENT_INSERT_CARD
public static final int EVENT_REMOVE_CARD
public static final int EVENT_ERROR
public static final int EVENT_CANCEL
public static final int EVENT_NONE
public static final int SLOT_INDEX_NONE
public static java.lang.Object objPresent
public static java.lang.Object objAbsent
public static SmartCardInterface.NotifyEvent notifyEvent
public static boolean isCardPresent
public static int queryMaxNumber()
public static int queryPresence(int nSlotIndex)
nSlotIndex
- : Slot index, from 0 to ( MAX_SUPPORT_SLOT - 1 )public static int open(int nSlotIndex)
nSlotIndex
- : Slot index, from 0 to (MAX_SUPPORT_SLOT - 1).public static int close(int handle)
handle
- : returned from method of open.public static int setCardInfo(int handle, int nBuadrate, int nVoltage)
handle
- returned from method of open。nBuadrate
- value is 9600 or 38400.nVoltage
- value is 1, 2, 3 means 1.8v, 3v, 5v.public static int powerOn(int handle, byte[] byteArrayATR, SmartCardSlotInfo info)
Handle
- : returned from method of open.byteArrayATR
- : ATRinfo
- : card informationpublic static int powerOff(int handle)
handle
- : return from method of openpublic static int setSlotInfo(int handle, SmartCardSlotInfo info)
Handle
- :return from method of openinfo
- :SmartCardSlotInfopublic static int transmit(int handle, byte[] byteArrayAPDU, byte[] byteArrayResponse)
Handle
- : return from method of openbyteArrayAPDU
- : command of APDUbyteArrayResponse
- : response of command of APDUpublic static int read(int handle, int nAreaType, byte[] byteArryData, int nStartAddress)
handle,
- return from method of open.nAreaType,
- area type : 0 : main memory, 1 :
protected memory 2 : security memorybyteArryData
- : data buffernStartAddress
- : starting addresspublic static int write(int handle, int nAreaType, byte[] byteArryData, int nStartAddress)
handle,
- return from method of open.nAreaType,
- area type : 0 : main memory, 1 :
protected memory 2 : security memory。byteArryData
- : data buffer。nStartAddress
- : starting address。public static int verify(int handle, byte[] byteArrayAPDU)
handle,
- return from method of openbyteArrayAPDU
- : data bufferpublic static int verify_extend(int handle, byte[] byteArrayAPDU, int nAddress)
handle
- : return from method of openbyteArrayAPDU
- : data buffernAddress:
- 1. 80 Security Code。
2. 688 Application Zone 1 Erase Key.
3. 1248 Application Zone 2 Erase Key。public static int touch(int handle)
public static void callBack(int slotIndex, int eventID)
nEvent
- nData
- public static void notifyCancel()
public static void waitForCardPresent(int timeout) throws java.lang.InterruptedException
java.lang.InterruptedException
public static void waitForCardAbsent(int timeout) throws java.lang.InterruptedException
java.lang.InterruptedException
public static void clear()