public class RFCardInterface
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
RFCardInterface.NotifyEvent |
Modifier and Type | Field and Description |
---|---|
static int |
CONTACTLESS_CARD_EVENT_COMM_ERROR |
static int |
CONTACTLESS_CARD_EVENT_FOUND_CARD |
static int |
CONTACTLESS_CARD_EVENT_TIME_OUT |
static int |
CONTACTLESS_CARD_EVENT_USER_CANCEL |
static int |
CONTACTLESS_CARD_MODE_AUTO |
static int |
CONTACTLESS_CARD_MODE_TYPE_A |
static int |
CONTACTLESS_CARD_MODE_TYPE_B |
static int |
CONTACTLESS_CARD_MODE_TYPE_C |
static int |
EVENT_NONE |
static boolean |
isCallBackCalled |
static RFCardInterface.NotifyEvent |
notifyEvent |
static java.lang.Object |
object
初始化的参数
|
static int |
RC500_COMMON_CMD_GET_READER_VERSION |
static int |
RC500_COMMON_CMD_RF_CONTROL |
Constructor and Description |
---|
RFCardInterface() |
Modifier and Type | Method and Description |
---|---|
static int |
attach(byte[] byteArrayATR)
Attach the target before transmitting apdu command In
this process, the target(card) is activated and return ATR.
|
static void |
callBack(int nEvent,
byte[] nData)
Call back method, called by driver.
|
static void |
clear()
clear the notify event from callback.
|
static int |
close()
Close the contactless card reader.
|
static int |
decrement(int nSectorIndex,
int nBlockIndex,
int value)
Decrement value to a block, using it with the API :
hal_contactless_card_mc_restore and hal_contactless_card_mc_transfer
|
static int |
detach()
Detach the target.
|
static int |
increment(int nSectorIndex,
int nBlockIndex,
int value)
Increment value to a block, using it with the API :
hal_contactless_card_mc_restore and hal_contactless_card_mc_transfer
|
static boolean |
isOpened()
Contactless card reader is Opened return Boolean
|
static void |
notifyCancel() |
static int |
open()
Open the contactless card reader.
|
static int |
queryInfo(int[] pHasMoreCards,
int[] pCardType)
Query the number and type of cards on the contactless card reader.
|
static int |
read(int nSectorIndex,
int nBlockIndex,
byte[] pDataBuffer,
int nDataBufferLength)
Read data only for MiFare one card.
|
static int |
readValue(int nSectorIndex,
int nBlockIndex,
byte[] pValue,
int nValueBufLength,
byte[] pAddrData)
Read value from a block
|
static int |
restore(int nSectorIndex,
int nBlockIndex)
Read the value to the temporary from the block
|
static int |
searchBegin(int nCardMode,
int nFlagSearchAll,
int nTimeout_MS)
语义代表通知非接设备开始寻卡, Start searching the contactless1 card If you set the
nCardMode is auto, reader will try to activate card in type A, type B and
type successively; If you set the nCardMode is type A, type B, or type C,
reader only try to activate card in the specified way.
|
static int |
searchEnd()
Stop the process of searching card.
|
static int |
sendControlCommand(int nCmdID,
byte[] byteArrayCmdData,
int nDataLength)
Send control command.
|
static int |
touch()
Deprecated.
Check whether this is a card on the rfcard reader
return value : == 0 : no card
>0 : find a card
<0 : error code
|
static int |
transfer(int nSectorIndex,
int nBlockIndex)
Save the value to the block from temporary buffer
|
static int |
transmit_level3(byte[] byteArrayAPDU,
int nAPDULength,
byte[] byteArrayResponse,
int nOptionValue)
Transmit command of level 3 and get the response
|
static int |
transmit(byte[] byteArrayAPDU,
int nAPDULength,
byte[] byteArrayResponse)
Transmit APDU command and get the response
|
static int |
verify(int nSectorIndex,
int nPinType,
byte[] strPin,
int nPinLength)
Verify pin for MiFare one card, and do authentication for ultralight C card.
|
static void |
waitForCardPresent(int nCardMode,
int nFlagSearchAll,
int nTimeout_MS) |
static int |
write(int nSectorIndex,
int nBlockIndex,
byte[] pData,
int nDataLength)
Write data only for MiFare one card.
|
static int |
writeValue(int nSectorIndex,
int nBlockIndex,
int pValue,
int nValueLength,
byte pAddrData)
Write value to a block.
|
public static int CONTACTLESS_CARD_MODE_AUTO
public static int CONTACTLESS_CARD_MODE_TYPE_A
public static int CONTACTLESS_CARD_MODE_TYPE_B
public static int CONTACTLESS_CARD_MODE_TYPE_C
public static int RC500_COMMON_CMD_GET_READER_VERSION
public static int RC500_COMMON_CMD_RF_CONTROL
public static final int CONTACTLESS_CARD_EVENT_FOUND_CARD
public static final int CONTACTLESS_CARD_EVENT_TIME_OUT
public static final int CONTACTLESS_CARD_EVENT_COMM_ERROR
public static final int CONTACTLESS_CARD_EVENT_USER_CANCEL
public static final int EVENT_NONE
public static java.lang.Object object
public static RFCardInterface.NotifyEvent notifyEvent
public static boolean isCallBackCalled
public static int open()
public static boolean isOpened()
public static int close()
public static int searchBegin(int nCardMode, int nFlagSearchAll, int nTimeout_MS)
nCardMode
- : handle of this card reader
possible value :
CONTACTLESS_CARD_MODE_AUTO = 0 CONTACTLESS_CARD_MODE_TYPE_A = 1;
CONTACTLESS_CARD_MODE_TYPE_B = 2; CONTACTLESS_CARD_MODE_TYPE_C = 3;nFlagSearchAll
- : 0 : signal user if we find one card in the field,
1 : signal user only we find all card in the field。nTimeout_MS
- : time out in milliseconds. if nTimeout_MS is less
then zero, the searching process is infinite.public static int searchEnd()
public static int attach(byte[] byteArrayATR)
byteArrayATR:
- ATR buffer, if you set it null, you can not get the
data.public static int detach()
public static int transmit(byte[] byteArrayAPDU, int nAPDULength, byte[] byteArrayResponse)
byteArrayAPDU
- : command of APDU。nAPDULength
- : length of command of APDU。byteArrayResponse
- : response of command of APDU。public static int transmit_level3(byte[] byteArrayAPDU, int nAPDULength, byte[] byteArrayResponse, int nOptionValue)
byteArrayAPDU
- : command of APDU。nAPDULength
- : length of command of APDU.byteArrayResponse
- : response of command of APDU。nOptionValue
- : reserved for future, must be set to zero。public static int sendControlCommand(int nCmdID, byte[] byteArrayCmdData, int nDataLength)
nCmdID
- : id of command.byteArrayCmdData
- : data associated with command, if no data, you
can set it NULL.nDataLength
- : data length of command.public static int verify(int nSectorIndex, int nPinType, byte[] strPin, int nPinLength)
nSectorIndex
- : sector index.nPinType
- : 0 : Key A 1 : Key B 2 : TDEA type (for ultralight C).strPin
- : password of this pin.nPinLength
- : length of password.public static int read(int nSectorIndex, int nBlockIndex, byte[] pDataBuffer, int nDataBufferLength)
nSectorIndex
- : sector index。nBlockIndex
- : block index。pDataBuffer
- : data buffer。nDataBufferLength
- : buffer length return value.public static int write(int nSectorIndex, int nBlockIndex, byte[] pData, int nDataLength)
nSectorIndex
- : sector index.nBlockIndex
- : block index.pData
- : data.nDataLength
- : data length.public static int queryInfo(int[] pHasMoreCards, int[] pCardType)
nHandle
- : handle of this card readerpHasMoreCards
- : 0 : only one PICC in the
field 0x0A : more cards in the field(type A) 0x0B : more
cards in the field(type B) 0xAB : more cards in the
field(type A and type B)pCardType
- : CONTACTLESS_CARD_TYPE_A_CPU
0x0000 CONTACTLESS_CARD_TYPE_B_CPU 0x0100
CONTACTLESS_CARD_TYPE_A_CLASSIC_MINI 0x0001
CONTACTLESS_CARD_TYPE_A_CLASSIC_1K 0x0002
CONTACTLESS_CARD_TYPE_A_CLASSIC_4K 0x0003
CONTACTLESS_CARD_TYPE_A_UL_64 0x0004
CONTACTLESS_CARD_TYPE_A_UL_192 0x0005
CONTACTLESS_CARD_TYPE_A_MP_2K_SL1 0x0006
CONTACTLESS_CARD_TYPE_A_MP_4K_SL1 0x0007
CONTACTLESS_CARD_TYPE_A_MP_2K_SL2 0x0008
CONTACTLESS_CARD_TYPE_A_MP_4K_SL2 0x0009
CONTACTLESS_CARD_UNKNOWN 0x00FF.public static int readValue(int nSectorIndex, int nBlockIndex, byte[] pValue, int nValueBufLength, byte[] pAddrData)
public static int writeValue(int nSectorIndex, int nBlockIndex, int pValue, int nValueLength, byte pAddrData)
nSectorIndex
- : sector index.nBlockIndex
- : block index.pValue
- : data for saving value. LSB, 4bytes.nValueBufLength
- : must be 4.pAddrData
- : one byte, for saving a user data.public static int increment(int nSectorIndex, int nBlockIndex, int value)
nSectorIndex
- : sector indexnBlockIndex
- : block indexpValue
- : buffer for saving value. LSB, 4bytespublic static int decrement(int nSectorIndex, int nBlockIndex, int value)
nSectorIndex
- : sector indexnBlockIndex
- : block indexvalue
- : buffer for saving value. LSB, 4bytespublic static int transfer(int nSectorIndex, int nBlockIndex)
nSectorIndex
- : sector indexnBlockIndex
- : block index return value : >= 0.public static int restore(int nSectorIndex, int nBlockIndex)
nSectorIndex
- : sector index。nBlockIndex
- : block index return value : >= 0。public static int touch()
public static void callBack(int nEvent, byte[] nData)
nEvent:
- event id is CONTACTLESS_CARD_EVENT_FOUND_CARD
;CONTACTLESS_CARD_EVENT_TIME_OUT
;CONTACTLESS_CARD_EVENT_COMM_ERROR
;CONTACTLESS_CARD_EVENT_USER_CANCEL
;nData
- public static void waitForCardPresent(int nCardMode, int nFlagSearchAll, int nTimeout_MS) throws java.lang.InterruptedException
java.lang.InterruptedException
public static void notifyCancel()
public static void clear()