acs.jni
Class ACR120S

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

public class ACR120S
extends java.lang.Object

ACR120S JNI Class Package provides the programming interfaces for developer to develop application for ACR120S 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_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_COM_BAUDRATE_115200
          This constant field defines the COM baudrate of ACR120S used to communicate with PC.
static short ACR120_COM_BAUDRATE_19200
          This constant field defines the COM baudrate of ACR120S used to communicate with PC.
static short ACR120_COM_BAUDRATE_38400
          This constant field defines the COM baudrate of ACR120S used to communicate with PC.
static short ACR120_COM_BAUDRATE_57600
          This constant field defines the COM baudrate of ACR120S used to communicate with PC.
static short ACR120_COM_BAUDRATE_9600
          This constant field defines the COM baudrate of ACR120S used to communicate with PC.
static short ACR120_COM1
          This constant field defines the instance of ACR120S connected to the COM port.
static short ACR120_COM2
          This constant field defines the instance of ACR120S connected to the COM port.
static short ACR120_COM3
          This constant field defines the instance of ACR120S connected to the COM port.
static short ACR120_COM4
          This constant field defines the instance of ACR120S connected to the COM port.
static short ACR120_COM5
          This constant field defines the instance of ACR120S connected to the COM port.
static short ACR120_COM6
          This constant field defines the instance of ACR120S connected to the COM port.
static short ACR120_COM7
          This constant field defines the instance of ACR120S connected to the COM port.
static short ACR120_COM8
          This constant field defines the instance of ACR120S connected to the COM 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 ACR120SJNI_14443_BUFFER_SIZE
          This constant field defines the default buffer size used with ISO-14443 card.
static int ACR120SJNI_DEFAULT_BUFFER_SIZE
          This constant field defines the default buffer size used with Mifare card.
static int ACR120SJNI_MAX_NUM_TAGS
          This constant field defines the maximum number of tags that can be listed using listTags method.
static int ACR120SJNI_MAX_TAG_LENGTH
          This constant field defines the maximum tag length returned by a card.
static int ACR120SJNI_MIFARE_BLOCK_LENGTH
          This constant field defines the block length of Mifare card.
static int ACR120SJNI_MIFARE_KEY_LENGTH
          This constant field defines the maximum key length of Mifare card.
static short TAG_ISO_TYPEB
          This constant field defines the type of the contactless card.
static short TAG_JCOP30
          This constant field defines the type of the contactless card.
static short TAG_MIFARE_1K
          This constant field defines the type of the contactless card.
static short TAG_MIFARE_4K
          This constant field defines the type of the contactless card.
static short TAG_MIFARE_DESFIRE
          This constant field defines the type of the contactless card.
static short TAG_MIFARE_LIGHT
          This constant field defines the type of the contactless card.
static short TAG_MIFARE_ULTRALIGHT
          This constant field defines the type of the contactless card.
static short TAG_MPCOS_COMBI
          This constant field defines the type of the contactless card.
static short TAG_SHANGHAI_TRANSPORT
          This constant field defines the type of the contactless card.
 
Constructor Summary
ACR120S()
           
 
Method Summary
 short close(short hReader)
          Closes the connection to reader.
 short copy(short hReader, byte stationID, byte srcBlock, byte desBlock, int[] pNewValue)
          Copies a value block to another value block of the same sector.
 short dec(short hReader, byte stationID, byte Block, int Value, int[] pNewValue)
          Decrements a value of block by subtracting a value.
 short deselect(short hReader, byte stationID, boolean typeA)
          Requests an Answer-to-Select (ATS) message from the card after calling the Select method.
 short getID(short hReader, byte[] pNumID, byte[] pStationID)
          Gets the station ID's for all reader modules on the RS485 bus.
 short inc(short hReader, byte stationID, 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 stationID, byte[] pNumTagFound, boolean[] pHaveTag, byte[] pTAG, byte[] pSN)
          Lists out the serial numbers of all tags, which are in the readable antenna range.
 short login(short hReader, byte stationID, byte Sector, byte KeyType, byte StoredNo, byte[] pKey)
          Performs an authentication to access one sector of the card.
 short multiTagSelect(short hReader, byte stationID, byte[] SN, boolean[] pHaveTag, byte[] pTAG, byte[] pResultSN)
          Selects a TAG with specific serial number.
 short open(short hReaderPort, short Baudrate)
          Opens the connection to reader.
 short power(short hReader, byte stationID, boolean State)
          turn on or off the antenna power.
 short rATS(short hReader, byte stationID, byte FSDI, boolean typeA, byte[] atslen, byte[] ats)
          Requests an Answer-to-Select (ATS) message from the card after calling the Select method.
 short read(short hReader, byte stationID, byte Block, byte[] pBlockData)
          Reads a block.
 short readEEPROM(short hReader, byte stationID, byte RegNo, byte[] pEEPROMData)
          Reads the internal EEPROM of the reader.
 short readRC531Reg(short hReader, byte stationID, byte RegNo, byte[] Value)
          Reads the Mifare register.
 short readUserPort(short hReader, byte stationID, byte[] pUserPortState)
          Reads the state of user port.
 short readValue(short hReader, byte stationID, byte Block, int[] pValueData)
          Reads a value.
 short requestDLLVersion(byte[] pVersionInfoLength, byte[] pVersionInfo)
          Gets the native method DLL version information.
 short requestVersionInfo(short hReader, byte stationID, byte[] pVersionInfoLen, byte[] pVersionInfo)
          Gets the reader's firmware version information.
 short reset(short hReader, byte stationID)
          Resets the Mifare chip of the reader and restore factory setting.
 short select(short hReader, byte stationID, boolean[] pHaveTag, byte[] pTAG, byte[] pSN)
          Selects a single card and returns the card ID (Serial Number).
 short txDataTelegram(short hReader, byte stationID, byte SendDataLength, boolean bParity, boolean bOddParity, boolean bCRCGen, boolean bCRCCheck, boolean bCryptoInactive, byte bitFrame, byte[] pSendData, byte[] pReceivedDataLength, byte[] pReceivedData)
          Sends data to the selected card.
 short write(short hReader, byte stationID, byte Block, byte[] pBlockData)
          Writes a block.
 short writeEEPROM(short hReader, byte stationID, byte RegNo, byte EEPROMData)
          Writes the internal EEPROM of the reader.
 short writeMasterKey(short hReader, byte stationID, byte KeyNo, byte[] pKey)
          Writes master keys.
 short writeRC531Reg(short hReader, byte stationID, byte RegNo, byte Value)
          Writes the Mifare register.
 short writeUserPort(short hReader, byte stationID, byte UserPortState)
          Writes the state of user port.
 short writeValue(short hReader, byte stationID, byte Block, int ValueData)
          Writes a value.
 short xchAPDU(short hReader, byte stationID, 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_COM1

public static final short ACR120_COM1
This constant field defines the instance of ACR120S connected to the COM port. It is defined as a decimal value of 0.

See Also:
Constant Field Values

ACR120_COM2

public static final short ACR120_COM2
This constant field defines the instance of ACR120S connected to the COM port. It is defined as a decimal value of 1.

See Also:
Constant Field Values

ACR120_COM3

public static final short ACR120_COM3
This constant field defines the instance of ACR120S connected to the COM port. It is defined as a decimal value of 2.

See Also:
Constant Field Values

ACR120_COM4

public static final short ACR120_COM4
This constant field defines the instance of ACR120S connected to the COM port. It is defined as a decimal value of 3.

See Also:
Constant Field Values

ACR120_COM5

public static final short ACR120_COM5
This constant field defines the instance of ACR120S connected to the COM port. It is defined as a decimal value of 4.

See Also:
Constant Field Values

ACR120_COM6

public static final short ACR120_COM6
This constant field defines the instance of ACR120S connected to the COM port. It is defined as a decimal value of 5.

See Also:
Constant Field Values

ACR120_COM7

public static final short ACR120_COM7
This constant field defines the instance of ACR120S connected to the COM port. It is defined as a decimal value of 6.

See Also:
Constant Field Values

ACR120_COM8

public static final short ACR120_COM8
This constant field defines the instance of ACR120S connected to the COM port. It is defined as a decimal value of 7.

See Also:
Constant Field Values

ACR120_COM_BAUDRATE_9600

public static final short ACR120_COM_BAUDRATE_9600
This constant field defines the COM baudrate of ACR120S used to communicate with PC. It is defined as a decimal value of 0.

See Also:
Constant Field Values

ACR120_COM_BAUDRATE_19200

public static final short ACR120_COM_BAUDRATE_19200
This constant field defines the COM baudrate of ACR120S used to communicate with PC. It is defined as a decimal value of 1.

See Also:
Constant Field Values

ACR120_COM_BAUDRATE_38400

public static final short ACR120_COM_BAUDRATE_38400
This constant field defines the COM baudrate of ACR120S used to communicate with PC. It is defined as a decimal value of 2.

See Also:
Constant Field Values

ACR120_COM_BAUDRATE_57600

public static final short ACR120_COM_BAUDRATE_57600
This constant field defines the COM baudrate of ACR120S used to communicate with PC. It is defined as a decimal value of 3.

See Also:
Constant Field Values

ACR120_COM_BAUDRATE_115200

public static final short ACR120_COM_BAUDRATE_115200
This constant field defines the COM baudrate of ACR120S used to communicate with PC. It is defined as a decimal value of 4.

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 decimal value of 0.

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 decimal value of 1.

See Also:
Constant Field Values

AC_MIFARE_LOGIN_KEYTYPE_F

public static final short AC_MIFARE_LOGIN_KEYTYPE_F
This constant field defines the key type to use to login a sector of Mifare card. It is defined as a decimal value of 2.

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 decimal value of 3.

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 decimal value of 4.

See Also:
Constant Field Values

TAG_MIFARE_LIGHT

public static final short TAG_MIFARE_LIGHT
This constant field defines the type of the contactless card. It is defined as a hexidecimal value.

See Also:
Constant Field Values

TAG_MIFARE_1K

public static final short TAG_MIFARE_1K
This constant field defines the type of the contactless card. It is defined as a hexidecimal value.

See Also:
Constant Field Values

TAG_MIFARE_4K

public static final short TAG_MIFARE_4K
This constant field defines the type of the contactless card. It is defined as a hexidecimal value.

See Also:
Constant Field Values

TAG_MIFARE_DESFIRE

public static final short TAG_MIFARE_DESFIRE
This constant field defines the type of the contactless card. It is defined as a hexidecimal value.

See Also:
Constant Field Values

TAG_MIFARE_ULTRALIGHT

public static final short TAG_MIFARE_ULTRALIGHT
This constant field defines the type of the contactless card. It is defined as a hexidecimal value.

See Also:
Constant Field Values

TAG_JCOP30

public static final short TAG_JCOP30
This constant field defines the type of the contactless card. It is defined as a hexidecimal value.

See Also:
Constant Field Values

TAG_SHANGHAI_TRANSPORT

public static final short TAG_SHANGHAI_TRANSPORT
This constant field defines the type of the contactless card. It is defined as a hexidecimal value.

See Also:
Constant Field Values

TAG_MPCOS_COMBI

public static final short TAG_MPCOS_COMBI
This constant field defines the type of the contactless card. It is defined as a hexidecimal value.

See Also:
Constant Field Values

TAG_ISO_TYPEB

public static final short TAG_ISO_TYPEB
This constant field defines the type of the contactless card. It is defined as a hexidecimal value.

See Also:
Constant Field Values

ACR120SJNI_DEFAULT_BUFFER_SIZE

public static final int ACR120SJNI_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

ACR120SJNI_14443_BUFFER_SIZE

public static final int ACR120SJNI_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

ACR120SJNI_MAX_NUM_TAGS

public static final int ACR120SJNI_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

ACR120SJNI_MAX_TAG_LENGTH

public static final int ACR120SJNI_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

ACR120SJNI_MIFARE_KEY_LENGTH

public static final int ACR120SJNI_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

ACR120SJNI_MIFARE_BLOCK_LENGTH

public static final int ACR120SJNI_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

ACR120S

public ACR120S()
Method Detail

open

public short open(short hReaderPort,
                  short Baudrate)
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 ACR120S that is connected to COM port.
Baudrate - a 0-based index to set the communication speed between PC COM port and ACR120S.

Possible values:

ACR120_COM_BAUDRATE_96009600 bps
ACR120_COM_BAUDRATE_1920019200 bps
ACR120_COM_BAUDRATE_3840038400 bps
ACR120_COM_BAUDRATE_5760057600 bps
ACR120_COM_BAUDRATE_115200115200 bps
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 COM 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,
                   byte stationID)
Resets the Mifare chip of the reader and restore factory setting.

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

readRC531Reg

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

Parameters:
hReader - the COM handle returned by a prior call to open() method.
stationID - the StationID of ACR120 reader.
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 stationID,
                           byte RegNo,
                           byte Value)
Writes the Mifare register.

Parameters:
hReader - the COM handle returned by a prior call to open() method.
stationID - the StationID of ACR120 reader.
RegNo - the register number.
Value - the value of Mifare register to write.
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 stationID,
                        byte RegNo,
                        byte[] pEEPROMData)
Reads the internal EEPROM of the reader.

Parameters:
hReader - the COM handle returned by a prior call to open() method.
stationID - the StationID of ACR120 reader.
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 stationID,
                         byte RegNo,
                         byte EEPROMData)
Writes the internal EEPROM of the reader.

Parameters:
hReader - the COM handle returned by a prior call to open() method.
stationID - the StationID of ACR120 reader.
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 stationID,
                          byte[] pUserPortState)
Reads the state of user port.

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

Possible values:

0x00Relay/LED and Buzzer OFF
0x01Relay/LED ON, Buzzer OFF
0x02Relay/LED OFF, Buzzer ON
0x03Relay/LED and Buzzer ON
Returns:
a decimal error code value; 0 = success, <0 = error.

writeUserPort

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

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

select

public short select(short hReader,
                    byte stationID,
                    boolean[] pHaveTag,
                    byte[] pTAG,
                    byte[] pSN)
Selects a single card and returns the card ID (Serial Number).

Parameters:
hReader - the COM handle returned by a prior call to open() method.
stationID - the StationID of ACR120 reader.
pHaveTag - the output variable that indicates whether TAG type identification is returned: (TRUE) or (FALSE).
pTAG - the list of TAG type identification. If pHaveTag is FALSE, this is an array of serial number length of the cards detected. If pHaveTag is TRUE, this is an array of TAG type. The corresponding serial number length could then be determined from the TAG type.
pSN - 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 stationID,
                   boolean State)
turn on or off the antenna power.

Parameters:
hReader - the COM handle returned by a prior call to open() method.
stationID - the StationID of ACR120 reader.
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 stationID,
                   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 COM handle returned by a prior call to open() method.
stationID - the StationID of ACR120 reader.
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 ACR120SJNI_MIFARE_KEY_LENGTH (6) elements.
Returns:
a decimal error code value; 0 = success, <0 = error.

listTags

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

Parameters:
hReader - the COM handle returned by a prior call to open() method.
stationID - the StationID of ACR120 reader.
pNumTagFound - the number of tags listed. It is an array of 1 element.
pHaveTag - the output variable that indicates whether TAG type identification is returned: (TRUE) or (FALSE).
pTAG - the list of TAG type identification. If pHaveTag is FALSE, this is an array of serial number length of the cards detected. If pHaveTag is TRUE, this is an array of TAG type. The corresponding serial number length could then be determined from the TAG type.
pSN - the serial numbers of the cards. The ID may be 4, 7 or 10 bytes long.
Returns:
a decimal error code value; 0 = success, <0 = error.

read

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

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

readValue

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

Parameters:
hReader - the COM handle returned by a prior call to open() method.
stationID - the StationID of ACR120 reader.
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 stationID,
                   byte Block,
                   byte[] pBlockData)
Writes a block.

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

writeValue

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

Parameters:
hReader - the COM handle returned by a prior call to open() method.
stationID - the StationID of ACR120 reader.
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 stationID,
                            byte KeyNo,
                            byte[] pKey)
Writes master keys.

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

inc

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

Parameters:
hReader - the COM handle returned by a prior call to open() method.
stationID - the StationID of ACR120 reader.
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 stationID,
                 byte Block,
                 int Value,
                 int[] pNewValue)
Decrements a value of block by subtracting a value.

Parameters:
hReader - the COM handle returned by a prior call to open() method.
stationID - the StationID of ACR120 reader.
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 stationID,
                  byte srcBlock,
                  byte desBlock,
                  int[] pNewValue)
Copies a value block to another value block of the same sector.

Parameters:
hReader - the COM handle returned by a prior call to open() method.
stationID - the StationID of ACR120 reader.
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.

getID

public short getID(short hReader,
                   byte[] pNumID,
                   byte[] pStationID)
Gets the station ID's for all reader modules on the RS485 bus.

Parameters:
hReader - the COM handle returned by a prior call to open() method.
pNumID - the number of station ID retured.
pStationID - the list of station ID returned.
Returns:
a decimal error code value; 0 = success, <0 = error.

multiTagSelect

public short multiTagSelect(short hReader,
                            byte stationID,
                            byte[] SN,
                            boolean[] pHaveTag,
                            byte[] pTAG,
                            byte[] pResultSN)
Selects a TAG with specific serial number.

Parameters:
hReader - the COM handle returned by a prior call to open() method.
stationID - the StationID of ACR120 reader.
SN - the serial number of the Tag to be selected. It is a short array of ACR120SJNI_MAX_TAG_LENGTH (10) elements.
pHaveTag - the output variable that indicates whether TAG type identification is returned: (TRUE) or (FALSE).
pTAG - the TAG type identification of selected TAG.
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 stationID,
                            byte SendDataLength,
                            boolean bParity,
                            boolean bOddParity,
                            boolean bCRCGen,
                            boolean bCRCCheck,
                            boolean bCryptoInactive,
                            byte bitFrame,
                            byte[] pSendData,
                            byte[] pReceivedDataLength,
                            byte[] pReceivedData)
Sends data to the selected card.

Parameters:
hReader - the COM handle returned by a prior call to open() method.
stationID - the StationID of ACR120 reader.
SendDataLength - the length of the data to send.
bParity - TRUE if parity generation is enabled.
bOddParity - TRUE if parity is odd. Otherwise, it's even.
bCRCGen - TRUE if CRC generation for transmission is enabled.
bCRCCheck - TRUE if CRC checking for receiving is enabled.
bCryptoInactive - TRUE if Crypto unit is deactivated before transmission start.
bitFrame - bit framing (number of bits from last byte transmitted).
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.

requestVersionInfo

public short requestVersionInfo(short hReader,
                                byte stationID,
                                byte[] pVersionInfoLen,
                                byte[] pVersionInfo)
Gets the reader's firmware version information.

Parameters:
hReader - the COM handle returned by a prior call to open() method.
stationID - the StationID of ACR120 reader.
pVersionInfoLen - the length of the ACR120 firmware version string.
pVersionInfo - the ACR120 firmware version string.
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,
                     byte stationID,
                     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 COM handle returned by a prior call to open() method.
stationID - the StationID of ACR120 reader.
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 stationID,
                  byte FSDI,
                  boolean typeA,
                  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 COM handle returned by a prior call to open() method.
stationID - the StationID of ACR120 reader.
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,
                      byte stationID,
                      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 COM handle returned by a prior call to open() method.
stationID - the StationID of ACR120 reader.
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.