acs.jni
Class ACR120U

java.lang.Object
  extended by acs.jni.ACR120U

public class ACR120U
extends java.lang.Object

ACR120U JNI Class Package provides the programming interfaces for developer to develop application for ACR120U using Java programming language. The implementation consists of a wrapper DLL developed in C++ and a Java class package that exports the programming interfaces for access to native methods implemented in the DLL.


Field Summary
static short AC_MIFARE_LOGIN_KEYTYPE_A
          This constant field defines the key type to use to login a sector of Mifare card.
static short AC_MIFARE_LOGIN_KEYTYPE_B
          This constant field defines the key type to use to login a sector of Mifare card.
static short AC_MIFARE_LOGIN_KEYTYPE_DEFAULT_A
          This constant field defines the key type to use to login a sector of Mifare card.
static short AC_MIFARE_LOGIN_KEYTYPE_DEFAULT_B
          This constant field defines the key type to use to login a sector of Mifare card.
static short AC_MIFARE_LOGIN_KEYTYPE_DEFAULT_F
          This constant field defines the key type to use to login a sector of Mifare card.
static short AC_MIFARE_LOGIN_KEYTYPE_STORED_A
          This constant field defines the key type to use to login a sector of Mifare card.
static short AC_MIFARE_LOGIN_KEYTYPE_STORED_B
          This constant field defines the key type to use to login a sector of Mifare card.
static short ACR120_USB1
          This constant field defines the instance of ACR120U connected to the USB port.
static short ACR120_USB2
          This constant field defines the instance of ACR120U connected to the USB port.
static short ACR120_USB3
          This constant field defines the instance of ACR120U connected to the USB port.
static short ACR120_USB4
          This constant field defines the instance of ACR120U connected to the USB port.
static short ACR120_USB5
          This constant field defines the instance of ACR120U connected to the USB port.
static short ACR120_USB6
          This constant field defines the instance of ACR120U connected to the USB port.
static short ACR120_USB7
          This constant field defines the instance of ACR120U connected to the USB port.
static short ACR120_USB8
          This constant field defines the instance of ACR120U connected to the USB port.
static short ACR120JNI_ERROR_EXCEPTION_OCCURED
          This constant field defines the error code returned by this JNI class package.
static short ACR120JNI_ERROR_RECV_BUFFER_OVERFLOW
          This constant field defines the error code returned by this JNI class package.
static short ACR120JNI_ERROR_SEND_BUFFER_OVERFLOW
          This constant field defines the error code returned by this JNI class package.
static short ACR120JNI_ERROR_SUCCESS
          This constant field defines the error code returned by this JNI class package.
static int ACR120UJNI_14443_BUFFER_SIZE
          This constant field defines the default buffer size used with ISO-14443 card.
static int ACR120UJNI_DEFAULT_BUFFER_SIZE
          This constant field defines the default buffer size used with Mifare card.
static int ACR120UJNI_MAX_NUM_TAGS
          This constant field defines the maximum number of tags that can be listed using listTags method.
static int ACR120UJNI_MAX_TAG_LENGTH
          This constant field defines the maximum tag length returned by a card.
static int ACR120UJNI_MIFARE_BLOCK_LENGTH
          This constant field defines the block length of Mifare card.
static int ACR120UJNI_MIFARE_KEY_LENGTH
          This constant field defines the maximum key length of Mifare card.
 
Constructor Summary
ACR120U()
           
 
Method Summary
 short close(short hReader)
          Closes the connection to reader.
 short copy(short hReader, byte srcBlock, byte desBlock, int[] pNewValue)
          Copies a value block to another value block of the same sector.
 short dec(short hReader, byte Block, int Value, int[] pNewValue)
          Decrements a value of block by subtracting a value.
 short deselect(short hReader, boolean typeA)
          Requests an Answer-to-Select (ATS) message from the card after calling the Select method.
 short directReceive(short hReader, byte RespectedDataLength, byte[] pReceivedDataLength, byte[] pReceivedData, short TimedOut)
          Receives data to the reader directly.
 short directSend(short hReader, byte DataLength, byte[] pData, byte[] pResponseDataLength, byte[] pResponseData, short TimedOut)
          Sends data to the reader directly.
 byte getCardOpMode()
          Gets the card operation mode of ACR120U device.
 int getCardsSupported()
          Get the supported card type of ACR120U device.
 java.lang.String getClassVersion()
          Gets the version of this JNI wrapper class for ACR120U native methods.
 java.lang.String getFirmwareVersion()
          Get the retrieved firmware version of ACR120U device.
 byte getFWI()
          Gets the FWI timeout value of ACR120U device.
 byte getMifareInterfaceType()
          Get the retrieved interface byte of ACR120U device.
 short inc(short hReader, byte Block, int Value, int[] pNewValue)
          Increments a value of block by adding a value.
 short initBlockNumber(short FrameLength)
          Resets the block number to be used during the ISO14443 part 4 (T=CL) communication.
 short listTags(short hReader, byte[] pNumTagFound, byte[] pTagType, byte[] pTagLength, byte[][] pSN)
          Lists out the serial numbers of all tags, which are in the readable antenna range.
 short login(short hReader, byte Sector, byte KeyType, byte StoredNo, byte[] pKey)
          Performs an authentication to access one sector of the card.
 short multiTagSelect(short hReader, byte TagLength, byte[] SN, byte[] pResultTagType, byte[] pResultTagLength, byte[] pResultSN)
          Selects a TAG with specific serial number.
 short open(short hReaderPort)
          Opens the connection to reader.
 short power(short hReader, byte State)
          turn on or off the antenna power.
 short rATS(short hReader, byte FSDI, byte[] atslen, byte[] ats)
          Requests an Answer-to-Select (ATS) message from the card after calling the Select method.
 short read(short hReader, byte Block, byte[] pBlockData)
          Reads a block.
 short readEEPROM(short hReader, byte RegNo, byte[] pEEPROMData)
          Reads the internal EEPROM of the reader.
 short readRC531Reg(short hReader, byte RegNo, byte[] Value)
          Reads the Mifare register.
 short readUserPort(short hReader, byte[] pUserPortState)
          Reads the state of user port.
 short readValue(short hReader, byte Block, int[] pValueData)
          Reads a value.
 short requestDLLVersion(byte[] pVersionInfoLength, byte[] pVersionInfo)
          Gets the native method DLL version information.
 short reset(short hReader)
          Resets the Mifare chip of the reader and restore factory setting.
 short select(short hReader, byte[] pResultTagType, byte[] pResultTagLength, byte[] pResultSN)
          Selects a single card and returns the card ID (Serial Number).
 int setCardOpMode(byte jCardOpMode)
          Sets the card operation mode retrieved from the ACR120U device.
 int setCardsSupported(int jCardsSupported)
          Sets the supported Mifare card retrieved from the ACR120U device.
 int setFirmwareVersion(java.lang.String jFWVersion)
          Sets the firmware version string retrieved from the ACR120U device.
 int setFWI(byte jFWI)
          Sets the current FWI timeout value retrieved from the ACR120U device.
 int setMifareInterfaceType(byte jMifareInterfaceType)
          Sets the interface type of Mifare card retrieved from the ACR120U device.
 short status(short hReader)
          Retrieves the firmware version and reader status from the reader.
 short txDataTelegram(short hReader, byte SendDataLength, byte[] pSendData, byte[] pReceivedDataLength, byte[] pReceivedData)
          Sends data to the selected card.
 short write(short hReader, byte Block, byte[] pBlockData)
          Writes a block.
 short writeEEPROM(short hReader, byte RegNo, byte EEPROMData)
          Writes the internal EEPROM of the reader.
 short writeMasterKey(short hReader, byte KeyNo, byte[] pKey)
          Writes master keys.
 short writeRC531Reg(short hReader, byte RegNo, byte Value)
          Writes the Mifare register.
 short writeUserPort(short hReader, byte UserPortState)
          Writes the state of user port.
 short writeValue(short hReader, byte Block, int ValueData)
          Writes a value.
 short xchAPDU(short hReader, boolean typeA, short[] xLen, byte[] xData, short[] rLen, byte[] rData)
          Handles the APDU exchange in T=CL protocol.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACR120_USB1

public static final short ACR120_USB1
This constant field defines the instance of ACR120U connected to the USB port. It is defined as a decimal value of 0.

See Also:
Constant Field Values

ACR120_USB2

public static final short ACR120_USB2
This constant field defines the instance of ACR120U connected to the USB port. It is defined as a decimal value of 1.

See Also:
Constant Field Values

ACR120_USB3

public static final short ACR120_USB3
This constant field defines the instance of ACR120U connected to the USB port. It is defined as a decimal value of 2.

See Also:
Constant Field Values

ACR120_USB4

public static final short ACR120_USB4
This constant field defines the instance of ACR120U connected to the USB port. It is defined as a decimal value of 3.

See Also:
Constant Field Values

ACR120_USB5

public static final short ACR120_USB5
This constant field defines the instance of ACR120U connected to the USB port. It is defined as a decimal value of 4.

See Also:
Constant Field Values

ACR120_USB6

public static final short ACR120_USB6
This constant field defines the instance of ACR120U connected to the USB port. It is defined as a decimal value of 5.

See Also:
Constant Field Values

ACR120_USB7

public static final short ACR120_USB7
This constant field defines the instance of ACR120U connected to the USB port. It is defined as a decimal value of 6.

See Also:
Constant Field Values

ACR120_USB8

public static final short ACR120_USB8
This constant field defines the instance of ACR120U connected to the USB port. It is defined as a decimal value of 7.

See Also:
Constant Field Values

AC_MIFARE_LOGIN_KEYTYPE_A

public static final short AC_MIFARE_LOGIN_KEYTYPE_A
This constant field defines the key type to use to login a sector of Mifare card. It is defined as a hexidecimal value of 0xAA.

See Also:
Constant Field Values

AC_MIFARE_LOGIN_KEYTYPE_B

public static final short AC_MIFARE_LOGIN_KEYTYPE_B
This constant field defines the key type to use to login a sector of Mifare card. It is defined as a hexidecimal value of 0xBB.

See Also:
Constant Field Values

AC_MIFARE_LOGIN_KEYTYPE_DEFAULT_A

public static final short AC_MIFARE_LOGIN_KEYTYPE_DEFAULT_A
This constant field defines the key type to use to login a sector of Mifare card. It is defined as a hexidecimal value of 0xAD.

See Also:
Constant Field Values

AC_MIFARE_LOGIN_KEYTYPE_DEFAULT_B

public static final short AC_MIFARE_LOGIN_KEYTYPE_DEFAULT_B
This constant field defines the key type to use to login a sector of Mifare card. It is defined as a hexidecimal value of 0xBD.

See Also:
Constant Field Values

AC_MIFARE_LOGIN_KEYTYPE_DEFAULT_F

public static final short AC_MIFARE_LOGIN_KEYTYPE_DEFAULT_F
This constant field defines the key type to use to login a sector of Mifare card. It is defined as a hexidecimal value of 0xFD.

See Also:
Constant Field Values

AC_MIFARE_LOGIN_KEYTYPE_STORED_A

public static final short AC_MIFARE_LOGIN_KEYTYPE_STORED_A
This constant field defines the key type to use to login a sector of Mifare card. It is defined as a hexidecimal value of 0xAF.

See Also:
Constant Field Values

AC_MIFARE_LOGIN_KEYTYPE_STORED_B

public static final short AC_MIFARE_LOGIN_KEYTYPE_STORED_B
This constant field defines the key type to use to login a sector of Mifare card. It is defined as a hexidecimal value of 0xBF.

See Also:
Constant Field Values

ACR120UJNI_DEFAULT_BUFFER_SIZE

public static final int ACR120UJNI_DEFAULT_BUFFER_SIZE
This constant field defines the default buffer size used with Mifare card. It is defined as a decimal value of 80.

See Also:
Constant Field Values

ACR120UJNI_14443_BUFFER_SIZE

public static final int ACR120UJNI_14443_BUFFER_SIZE
This constant field defines the default buffer size used with ISO-14443 card. It is defined as a decimal value of 512.

See Also:
Constant Field Values

ACR120UJNI_MAX_NUM_TAGS

public static final int ACR120UJNI_MAX_NUM_TAGS
This constant field defines the maximum number of tags that can be listed using listTags method. It is defined as a decimal value of 4.

See Also:
Constant Field Values

ACR120UJNI_MAX_TAG_LENGTH

public static final int ACR120UJNI_MAX_TAG_LENGTH
This constant field defines the maximum tag length returned by a card. It is defined as a decimal value of 10.

See Also:
Constant Field Values

ACR120UJNI_MIFARE_KEY_LENGTH

public static final int ACR120UJNI_MIFARE_KEY_LENGTH
This constant field defines the maximum key length of Mifare card. It is defined as a decimal value of 6.

See Also:
Constant Field Values

ACR120UJNI_MIFARE_BLOCK_LENGTH

public static final int ACR120UJNI_MIFARE_BLOCK_LENGTH
This constant field defines the block length of Mifare card. It is defined as a decimal value of 16.

See Also:
Constant Field Values

ACR120JNI_ERROR_SUCCESS

public static final short ACR120JNI_ERROR_SUCCESS
This constant field defines the error code returned by this JNI class package. It has the decimal value of 0.

See Also:
Constant Field Values

ACR120JNI_ERROR_SEND_BUFFER_OVERFLOW

public static final short ACR120JNI_ERROR_SEND_BUFFER_OVERFLOW
This constant field defines the error code returned by this JNI class package. It has the decimal value of -5000.

See Also:
Constant Field Values

ACR120JNI_ERROR_RECV_BUFFER_OVERFLOW

public static final short ACR120JNI_ERROR_RECV_BUFFER_OVERFLOW
This constant field defines the error code returned by this JNI class package. It has the decimal value of -5001.

See Also:
Constant Field Values

ACR120JNI_ERROR_EXCEPTION_OCCURED

public static final short ACR120JNI_ERROR_EXCEPTION_OCCURED
This constant field defines the error code returned by this JNI class package. It has the decimal value of -5002.

See Also:
Constant Field Values
Constructor Detail

ACR120U

public ACR120U()
Method Detail

setFirmwareVersion

public int setFirmwareVersion(java.lang.String jFWVersion)
Sets the firmware version string retrieved from the ACR120U device. Reserved for ACR120UJNI.DLL use only. This routine will be called by the native method invoked by status() method.

Parameters:
jFWVersion - the firmware string retrieved from the ACR120U device.
Returns:
0

setMifareInterfaceType

public int setMifareInterfaceType(byte jMifareInterfaceType)
Sets the interface type of Mifare card retrieved from the ACR120U device. Reserved for ACR120UJNI.DLL use only. This routine will be called by the native method invoked by status() method.

Parameters:
jMifareInterfaceType - the interface type retrieved from the ACR120U device.
Returns:
0

setCardsSupported

public int setCardsSupported(int jCardsSupported)
Sets the supported Mifare card retrieved from the ACR120U device. Reserved for ACR120UJNI.DLL use only. This routine will be called by the native method invoked by status() method.

Parameters:
jCardsSupported - the supported card type retrieved from the ACR120U device.
Returns:
0

setCardOpMode

public int setCardOpMode(byte jCardOpMode)
Sets the card operation mode retrieved from the ACR120U device. Reserved for ACR120UJNI.DLL use only. This routine will be called by the native method invoked by status() method. Meaning of this value is yet to be defined.

Parameters:
jCardOpMode - the card operation mode retrieved from the ACR120U device.
Returns:
0

setFWI

public int setFWI(byte jFWI)
Sets the current FWI timeout value retrieved from the ACR120U device. Reserved for ACR120UJNI.DLL use only. This routine will be called by the native method invoked by status() method.

Parameters:
jFWI - the FWI timeout vale to set.
Returns:
0

getClassVersion

public java.lang.String getClassVersion()
Gets the version of this JNI wrapper class for ACR120U native methods.

Returns:
the version of this class.

getFirmwareVersion

public java.lang.String getFirmwareVersion()
Get the retrieved firmware version of ACR120U device. status() method must be called first.

Returns:
the retrieved firmware string.

getMifareInterfaceType

public byte getMifareInterfaceType()
Get the retrieved interface byte of ACR120U device. status() method must be called first. Possible values are:
0x01Type A
0x02Type B
0x03Type A + Type B

Returns:
the retrieved interface byte.

getCardsSupported

public int getCardsSupported()
Get the supported card type of ACR120U device. status() method must be called first. Meaning of this value is interpreted in bit level:
Bit 0 Mifare Light
Bit 1 Mifare 1K
Bit 2 Mifare 4K
Bit 3 Mifare DESFire
Bit 4 Mifare UltraLight
Bit 5 JCOP30
Bit 6 Shanghai Transport
Bit 7 MPCOS Combi
Bit 8 ISO Type B, Calypso
Bit 9 - Bit 31 To be defined

Returns:
the retrieved supported card type.

getCardOpMode

public byte getCardOpMode()
Gets the card operation mode of ACR120U device. status() method must be called first. Meaning of this value is yet to be defined.

Returns:
the retrieved supported card type.

getFWI

public byte getFWI()
Gets the FWI timeout value of ACR120U device. status() method must be called first. Meaning of this value is yet to be defined.

Returns:
the retrieved supported card type.

open

public short open(short hReaderPort)
Opens the connection to reader. This should be the first method to call before other methods (except RequestDLLVersion). The returned value will be used as the input handle for the other methods (except RequestDLLVersion).

Parameters:
hReaderPort - a 0-based instance number of the ACR120U that is connected to USB port.
Returns:
a value representing the returned handle from the native method.

close

public short close(short hReader)
Closes the connection to reader. This should be the last method to call before other methods (except RequestDLLVersion).

Parameters:
hReader - the USB handle returned by a prior call to open() method.
Returns:
a decimal error code value; 0 = success, <0 = error.

reset

public short reset(short hReader)
Resets the Mifare chip of the reader and restore factory setting.

Parameters:
hReader - the USB handle returned by a prior call to open() method.
Returns:
a decimal error code value; 0 = success, <0 = error.

status

public short status(short hReader)
Retrieves the firmware version and reader status from the reader. After calling this method, application can call getFirmwareVersion(), getMifareInterfaceType(), getCardsSupported(), getCardOpMode() and getFWI() method to retrieve the device status information.

Parameters:
hReader - the USB handle returned by a prior call to open() method.
Returns:
a decimal error code value; 0 = success, <0 = error.

readRC531Reg

public short readRC531Reg(short hReader,
                          byte RegNo,
                          byte[] Value)
Reads the Mifare register.

Parameters:
hReader - the USB handle returned by a prior call to open() method.
RegNo - the register number.
Value - the retrieved value of Mifare register. It is an array of 1 element.
Returns:
a decimal error code value; 0 = success, <0 = error.

writeRC531Reg

public short writeRC531Reg(short hReader,
                           byte RegNo,
                           byte Value)
Writes the Mifare register.

Parameters:
hReader - the USB handle returned by a prior call to open() method.
RegNo - the register number.
Value - the value of Mifare register to write.
Returns:
a decimal error code value; 0 = success, <0 = error.

directSend

public short directSend(short hReader,
                        byte DataLength,
                        byte[] pData,
                        byte[] pResponseDataLength,
                        byte[] pResponseData,
                        short TimedOut)
Sends data to the reader directly. This method is mainly used as a debugging extension to allow sending of data in raw ACR120U command format to the reader.

Parameters:
hReader - the USB handle returned by a prior call to open() method.
DataLength - the length of data to send (maximum 66 bytes).
pData - the data to send.
pResponseDataLength - the length of response data. It is an array of 1 element.
pResponseData - the received data.
TimedOut - The time out constant to wait for the response data (in m-sec).
Returns:
a decimal error code value; 0 = success, <0 = error.

directReceive

public short directReceive(short hReader,
                           byte RespectedDataLength,
                           byte[] pReceivedDataLength,
                           byte[] pReceivedData,
                           short TimedOut)
Receives data to the reader directly. This method is mainly used as a debugging extension in pair with DirectSend method.

Parameters:
hReader - the USB handle returned by a prior call to open() method.
RespectedDataLength - the expected length of data to receive (maximum 64 bytes).
pReceivedDataLength - the length of data actually received. It is an array of 1 element.
pReceivedData - the received data.
TimedOut - The time out constant to wait for the response data (in m-sec).
Returns:
a decimal error code value; 0 = success, <0 = error.

requestDLLVersion

public short requestDLLVersion(byte[] pVersionInfoLength,
                               byte[] pVersionInfo)
Gets the native method DLL version information.

Parameters:
pVersionInfoLength - the length of the returned native method DLL version string. It is an array of 1 element.
pVersionInfo - native method DLL version string.
Returns:
a decimal error code value; 0 = success, <0 = error.

readEEPROM

public short readEEPROM(short hReader,
                        byte RegNo,
                        byte[] pEEPROMData)
Reads the internal EEPROM of the reader.

Parameters:
hReader - the USB handle returned by a prior call to open() method.
RegNo - the register number.
pEEPROMData - the received value of EEPROM register. It is an array of 1 element.
Returns:
a decimal error code value; 0 = success, <0 = error.

writeEEPROM

public short writeEEPROM(short hReader,
                         byte RegNo,
                         byte EEPROMData)
Writes the internal EEPROM of the reader.

Parameters:
hReader - the USB handle returned by a prior call to open() method.
RegNo - the register number.
EEPROMData - the value of EEPROM register to write.
Returns:
a decimal error code value; 0 = success, <0 = error.

readUserPort

public short readUserPort(short hReader,
                          byte[] pUserPortState)
Reads the state of user port.

Parameters:
hReader - the USB handle returned by a prior call to open() method.
pUserPortState - the received port state. It is an array of 1 element.

Meaning of this value is interpreted in bit level:

Bit 0Not used
Bit 1Buzzer (0=OFF; 1=ON)
Bit 2Not used
Bit 3Not used
Bit 4Not used
Bit 5Not used
Bit 6LED (0=OFF; 1=ON)
Bit 7Not used
Returns:
a decimal error code value; 0 = success, <0 = error.

writeUserPort

public short writeUserPort(short hReader,
                           byte UserPortState)
Writes the state of user port.

Parameters:
hReader - the USB handle returned by a prior call to open() method.
UserPortState - the port state to write.
Returns:
a decimal error code value; 0 = success, <0 = error.

select

public short select(short hReader,
                    byte[] pResultTagType,
                    byte[] pResultTagLength,
                    byte[] pResultSN)
Selects a single card and returns the card ID (Serial Number).

Parameters:
hReader - the USB handle returned by a prior call to open() method.
pResultTagType - the type of the selected Tag. It is an array of 1 element.
pResultTagLength - the length of the selected Tag. It is an array of 1 element.
pResultSN - the ID (Serial Number) of the selected card. The ID may be 4, 7 or 10 bytes long.
Returns:
a decimal error code value; 0 = success, <0 = error.

power

public short power(short hReader,
                   byte State)
turn on or off the antenna power.

Parameters:
hReader - the USB handle returned by a prior call to open() method.
State - the state of the antenna power, 0 = OFF; 1 = ON.
Returns:
a decimal error code value; 0 = success, <0 = error.

login

public short login(short hReader,
                   byte Sector,
                   byte KeyType,
                   byte StoredNo,
                   byte[] pKey)
Performs an authentication to access one sector of the card. Only one sector can be accessed at a time.

Parameters:
hReader - the USB handle returned by a prior call to open() method.
Sector - the sector number to login.
KeyType - the type of key.
StoredNo - the stored number of key if key type = AC_MIFARE_LOGIN_KEYTYPE_STORED_A or AC_MIFARE_LOGIN_KEYTYPE_STORED_B.
pKey - the login key if KeyType = AC_MIFARE_LOGIN_KEYTYPE_A or AC_MIFARE_LOGIN_KEYTYPE_B. It is an array of ACR120UJNI_MIFARE_KEY_LENGTH (6) elements.
Returns:
a decimal error code value; 0 = success, <0 = error.

listTags

public short listTags(short hReader,
                      byte[] pNumTagFound,
                      byte[] pTagType,
                      byte[] pTagLength,
                      byte[][] pSN)
Lists out the serial numbers of all tags, which are in the readable antenna range.

Parameters:
hReader - the USB handle returned by a prior call to open() method.
pNumTagFound - the number of tags listed. It is an array of 1 element.
pTagType - the type of tag. It is an array of ACR120UJNI_MAX_NUM_TAGS (4) elements.
pTagLength - the length of the serial number. It is an array of ACR120UJNI_MAX_NUM_TAGS (4) elements.
pSN - the serial numbers of the cards. It is a 2D array of the size, pSN[4][10].
Returns:
a decimal error code value; 0 = success, <0 = error.

read

public short read(short hReader,
                  byte Block,
                  byte[] pBlockData)
Reads a block.

Parameters:
hReader - the USB handle returned by a prior call to open() method.
Block - the block number to read.
pBlockData - the data that was read. It is an array of ACR120UJNI_MIFARE_BLOCK_LENGTH (16) elements.
Returns:
a decimal error code value; 0 = success, <0 = error.

readValue

public short readValue(short hReader,
                       byte Block,
                       int[] pValueData)
Reads a value.

Parameters:
hReader - the USB handle returned by a prior call to open() method.
Block - the block number to read.
pValueData - the value to read. It is an array of 1 element.
Returns:
a decimal error code value; 0 = success, <0 = error.

write

public short write(short hReader,
                   byte Block,
                   byte[] pBlockData)
Writes a block.

Parameters:
hReader - the USB handle returned by a prior call to open() method.
Block - the block number to write.
pBlockData - the data to write. It is an array of ACR120UJNI_MIFARE_BLOCK_LENGTH (16) elements.
Returns:
a decimal error code value; 0 = success, <0 = error.

writeValue

public short writeValue(short hReader,
                        byte Block,
                        int ValueData)
Writes a value.

Parameters:
hReader - the USB handle returned by a prior call to open() method.
Block - the block number to write.
ValueData - the value to write.
Returns:
a decimal error code value; 0 = success, <0 = error.

writeMasterKey

public short writeMasterKey(short hReader,
                            byte KeyNo,
                            byte[] pKey)
Writes master keys.

Parameters:
hReader - the USB handle returned by a prior call to open() method.
KeyNo - the master key number.
pKey - the key to write. It is an array of ACR120UJNI_MIFARE_KEY_LENGTH (6).
Returns:
a decimal error code value; 0 = success, <0 = error.

inc

public short inc(short hReader,
                 byte Block,
                 int Value,
                 int[] pNewValue)
Increments a value of block by adding a value.

Parameters:
hReader - the USB handle returned by a prior call to open() method.
Block - the block number.
Value - the value added to the block value.
pNewValue - the updated value after increment. It is an array of 1 element.
Returns:
a decimal error code value; 0 = success, <0 = error.

dec

public short dec(short hReader,
                 byte Block,
                 int Value,
                 int[] pNewValue)
Decrements a value of block by subtracting a value.

Parameters:
hReader - the USB handle returned by a prior call to open() method.
Block - the block number.
Value - the value subtracted from the block value.
pNewValue - the updated value after decrement. It is an array of 1 element.
Returns:
a decimal error code value; 0 = success, <0 = error.

copy

public short copy(short hReader,
                  byte srcBlock,
                  byte desBlock,
                  int[] pNewValue)
Copies a value block to another value block of the same sector.

Parameters:
hReader - the USB handle returned by a prior call to open() method.
srcBlock - the source block number.
desBlock - the destination block number.
pNewValue - the updated value of desBlock after copy. It is an array of 1 element.
Returns:
a decimal error code value; 0 = success, <0 = error.

multiTagSelect

public short multiTagSelect(short hReader,
                            byte TagLength,
                            byte[] SN,
                            byte[] pResultTagType,
                            byte[] pResultTagLength,
                            byte[] pResultSN)
Selects a TAG with specific serial number.

Parameters:
hReader - the USB handle returned by a prior call to open() method.
TagLength - the length of the serial number of the Tag to be selected. The length may be 4, 7 or 10.
SN - the serial number of the Tag to be selected. It is a short array of ACR120UJNI_MAX_TAG_LENGTH (10) elements.
pResultTagType - the type of selected Tag. It is an array of 1 element.
pResultTagLength - the length of the serial number of the selected Tag. The length may be 4, 7 or 10.
pResultSN - the serial number of the selected TAG.
Returns:
a decimal error code value; 0 = success, <0 = error.

txDataTelegram

public short txDataTelegram(short hReader,
                            byte SendDataLength,
                            byte[] pSendData,
                            byte[] pReceivedDataLength,
                            byte[] pReceivedData)
Sends data to the selected card.

Parameters:
hReader - the USB handle returned by a prior call to open() method.
SendDataLength - the length of the data to send.
pSendData - the data to send.
pReceivedDataLength - the length of the received data. It is an array of 1 element.
pReceivedData - the data received from card.
Returns:
a decimal error code value; 0 = success, <0 = error.

initBlockNumber

public short initBlockNumber(short FrameLength)
Resets the block number to be used during the ISO14443 part 4 (T=CL) communication. This function also sets the frame length of the Card (PICC). By default the frame length is to 16. The frame length of the card is reported by the ATS in type A and the ATQB in type B cards.

Parameters:
FrameLength - an index to a maximum frame size which the card can accept.
Returns:
a decimal error code value; 0 = success, <0 = error.

xchAPDU

public short xchAPDU(short hReader,
                     boolean typeA,
                     short[] xLen,
                     byte[] xData,
                     short[] rLen,
                     byte[] rData)
Handles the APDU exchange in T=CL protocol. This routine will handle the Frame Waiting Time Extension (WTX) and chaining for long messages.

Parameters:
hReader - the USB handle returned by a prior call to open() method.
typeA - a value indicating the card type, TRUE for type A cards, FALSE for type B cards.
xLen - a pointer to the location storing the length of the data to transmit, in bytes.
xData - a pointer to the transmit data storage.
rLen - a pointer to the location storing the length of the data received, in bytes.
rData - a pointer to the receive data storage.
Returns:
a decimal error code value; 0 = success, <0 = error.

rATS

public short rATS(short hReader,
                  byte FSDI,
                  byte[] atslen,
                  byte[] ats)
Requests an Answer-to-Select (ATS) message from the card after calling the Select method. It tells the card how many bytes the reader can handle in a frame and also gets the operation parameters of the card when communicating in ISO14443 mode. This function is only valid for ISO14443 type A cards.

Parameters:
hReader - the USB handle returned by a prior call to open() method.
FSDI - an index to a maximum frame size which the reader can accept. The value should not exceed 4, i.e. 48 bytes.
atslen - a pointer to the location storing the length of the ATS received.
ats - a pointer to the ATS received.
Returns:
a decimal error code value; 0 = success, <0 = error.

deselect

public short deselect(short hReader,
                      boolean typeA)
Requests an Answer-to-Select (ATS) message from the card after calling the Select method. It tells the card how many bytes the reader can handle in a frame and also gets the operation parameters of the card when communicating in ISO14443 mode. This function is only valid for ISO14443 type A cards.

Parameters:
hReader - the USB handle returned by a prior call to open() method.
typeA - a Boolean value indicates the card type, TRUE for type A cards, FALSE for type B cards.
Returns:
a decimal error code value; 0 = success, <0 = error.