RDM IC Reader DLL Function Reference Manual: Page: 1 /12

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 12

RDM IC Reader

DLL Function Reference Manual

Page: 1 /12
Contents
1.IC Reader API Function Set.............................................................................................................3
1.1 System Function....................................................................................................................3
1.1.1 API_OpenSocket........................................................................................................3
1.1.2 API_CloseSocket.......................................................................................................3
1.1.3 API_ControlLED.......................................................................................................3
1.1.4 API_ControlBuzzer....................................................................................................4
1.1.5 API_GetVersionNum.................................................................................................4
1.1.6 API_SetDataOutputR232...........................................................................................5
1.1.7 API_MF_SetRequestMode........................................................................................6
1.2 ISO14443 Type-A + Ultralight Function..............................................................................6
1.2.1 API_MF_Read...........................................................................................................6
1.2.2 API_MF_Write...........................................................................................................7
1.2.3 API_MF_Request.......................................................................................................8
1.2.4 API_MF_GET_SNR..................................................................................................9
1.2.5 API_MF_PowerOn....................................................................................................9
1.2.6 API_MF_TransferCMD...........................................................................................10
APPENDIX.......................................................................................................................................11
API Return Value......................................................................................................................11
Return State Words....................................................................................................................11

Page: 2 /12
1.IC Reader API Function Set

1.1 System Function

1.1.1 API_OpenSocket

Name API_OpenSocket
Delcaration SOCKET API_OpenSocket(unsigned char *ip,unsigned int port)
Description Open the socket ip address and set the port for further communication with the
reader.
Input Parameter:
ip — ip address
ip[0-3] 4 Byte ip address
such as ip[0] = 192 ip[1] = 168 ip[2] = 1 ip[3] = 1
port — communicate port
such as 50000
Output Parameter:
none
Return value If function run successfully, then return value is the socket Handle; Other else it
is INVALID_SOCKET(~0).

1.1.2 API_CloseSocket

Name API_CloseSocket
Delcaration int API_CloseSocket(SOCKET s)
Description Close the communication socket. The API_CloseSocket should be called to
release the socket before closing the application program.
Input Parameter:
s — the socket handle
Output Parameter:
none
Return value If function run successfully, then return value is 0;Other else it is 1.

1.1.3 API_ControlLED

Name API_ControlLED

Page: 3 /12
Delcaration int API_ControlLED(SOCKET socketHandle, int DeviceAddress,int mode,
unsigned char freq, unsigned char duration, unsigned char *buffer)
Description Control the working state of the LED(Max is 2 LED)
Iutput Parameter:
socketHandle - the socket handle
DeviceAddress - Reader Address
Range of Reader Address is from 0 to 255
mode — how to control the LED
0: the LED is blinking in Green
1: the LED is blinking in Red
freq — LED time on light(etu is 20ms, Max value is 50(hex))
0x00—0x50
duration — number of times Led on light
such as 0x0A
Output Parameter:
buffer
buffer[0] value is status words.As for the exact meaning, please refere to the
APPENDIX
Return value If function run successfully, then return value is 0;Other else it is not 0, As for
the exact meaning, please refere to the APPENDIX.

1.1.4 API_ControlBuzzer

Name API_ControlBuzzer
Delcaration int API_ControlBuzzer(SOCKET socketHandle, int DeviceAddress,unsigned
char freq, unsigned char duration,unsigned char *buffer)
Description Control the working state of the buzzer(Max is 2 LED)
Iutput Parameter:
socketHandle - the socket handle
DeviceAddress - Reader Address
Range of Reader Address is from 0 to 255
freq — Buzzer time on ringing(etu is 20ms, Max value is 50(hex))
duration — number of times Buzzer on ringing
Output Parameter:
buffer
buffer[0] value is status words.As for the exact meaning, please refere to the
APPENDIX
Return value If function run successfully, then return value is 0;Other else it is not 0, As for
the exact meaning, please refere to the APPENDIX

Page: 4 /12
1.1.5 API_GetVersionNum

Name API_GetVersionNum
Delcaration int API_GetVersionNum(SOCKET socketHandle, int DeviceAddress,
char *VersionNum)
Description Get the version of the reader
Iutput Parameter:
socketHandle - the socket handle
DeviceAddress - Reader Address
Range of Reader Address is from 0 to 255
Output Parameter:
buffer
succeed
buffer[0] is the length of the version.
buffer[1-N] is the version
failed
buffer[0] value is status words.As for the exact meaning, please refere
to the APPENDIX
Return value If function run successfully, then return value is 0;Other else it is not 0, As for
the exact meaning, please refere to the APPENDIX

1.1.6 API_SetDataOutputR232

Name API_SetDataOutputR232
Delcaration int API_SetDataOutputR232(SOCKET socketHandle, int DeviceAddress,
unsigned char ControlMode, unsigned char ReadInfo,
unsigned char StartAddress, unsigned char *Key, unsigned char *buffer)
Description Set the configuration of the reader, whether or not auto uploading block or byte
data using Key A or Key B. whether or not auto uploading UID of the Card.
Input Parameter:
socketHandle - the socket handle
DeviceAddress - Reader Address
Range of Reader Address is from 0 to 255
ControlMode — control the output data format
Bit0: Request Mode. 0=Request Idle, 1 = Request All
Bit1: Key Select. Select use KeyA or Key B for Authenticaiton
0=KeyA, 1=KeyB
Bit2: Output format 1= Read Serial Number, 0= Read Data of Block or
Byte
Bit3: Read Mode, 0 = Block, 1 = Byte(when Bit2=1 then Bit3=1)
Bit4: AUTO Mode, 0 = OFF, 1 = ON
Note: When “ControlMode”> 0x1F and “ControlMode”^2=0 And

Page: 5 /12
“ReadInfo” =0XFF And “StartAddress”=0XFF. The Reader
will output UID of the Card.
Auto uploading UID is for Mifare and Ultralight Card
Auto upload Block or Byte are only for Mifare Card
ReadInfo — Information to Read
If Read Mode = 0 then value is the Number of Blocks from 1 to 4
If Read Mode = 1 then the value is:
Bits 4-7: Number of Bytes to Read
Bits 0-3: Start Byte
StartAddress —The Start Address of blocks to be read, not negative
0x00-0xXX (XX depending on the card type)
Key — Key A or B of the card which is 6 bytes.
Output Parameter:
buffer
buffer[0] value is status words.As for the exact meaning, please refere to
the APPENDIX
Return value If function run successfully, then return value is 0;Other else it is not 0, As for
the exact meaning, please refere to the APPENDIX.

1.1.7 API_MF_SetRequestMode

Name API_MF_SetRequestMode
Delcaration int API_MF_SetRequestMode(SOCKET socketHandle, int DeviceAddress,
unsigned char requestmode, unsigned char *buffer)
Description Set the request mode of the reader
Input Parameter:
socketHandle - the socket handle
DeviceAddress - Reader Address
Range of Reader Address is from 0 to 255
requestmode
0x00: forbid auto request card
0x01: allow auto request card
Output Parameter:
buffer
buffer[0] value is status words.As for the exact meaning, please refere to
the APPENDIX
Return value If function run successfully, then return value is 0;Other else it is not 0, As for
the exact meaning, please refere to the APPENDIX .

Page: 6 /12
1.2 ISO14443 Type-A + Ultralight Function

1.2.1 API_MF_Read

Name API_MF_Read
Delcaration int API_MF_Read(SOCKET socketHandle, int DeviceAddress,
int cardType, unsigned char mode, unsigned char blk_add,
unsigned char num_blk, unsigned char *snr, unsigned char *buffer)
Description read the appointed length data at the appointed station
Input Parameter:
socketHandle - the socket handle
DeviceAddress - Reader Address
Range of Reader Address is from 0 to 255
cardType - card type
0x00 Mifare card
0x01 Ultralight card
mode - reader mode
0x00: Idle mode + Key A
0x01: All mode + Key A
0x02: Idle mode + Key B
0x03: All mode + Key B
blk_add — the starting address of a card to read, not negative
0x00-0xXX (XX depending on the card type)
num_blk — the number of block or page to read
Mifare card: 0x01-0x04
Ultralight card: restricted to 0x01
snr — Key of the card which is 6 byte
Mifare card: Key to check
Ultralight card: Don’t need the paramerter
Output Parameter:
buffer
succeed
Mifare card:
buffer[0]: buffer data length
buffer[1—(N - 16*num_blk byte)]: data of card snr
buffer[(N - 16*num_blk byte)—N]: data of card(16*num_blk byte)
Ultralight card:
buffer[0]: buffer data length
buffer[1—(4*num_blk byte)]: data of card(4*num_blk byte)
buffer[(N - 4*num_blk byte)—N]: data of card snr
failed

Page: 7 /12
buffer[0]: status words,As for the exact meaning, please refere to the
APPENDIX 。
Note:only read blocks in the same sector, see mifare 1 memory organisation
Return value If function run successfully, then return value is 0;Other else it is not 0, As for
the exact meaning, please refere to the APPENDIX.

1.2.2 API_MF_Write

Name API_MF_Write
Delcaration int API_MF_Write(SOCKET socketHandle, int DeviceAddress,
int cardType, unsigned char mode, unsigned char blk_add,
unsigned char num_blk, unsigned char *key, unsigned char *buffer)
Description write the appointed length data at the appointed station
Input Parameter:
socketHandle - the socket handle
DeviceAddress - Reader Address
Range of Reader Address is from 0 to 255
cardType - card type
0x00 Mifare one card
0x01 Ultralight card
mode – write mode
0x00: Idle mode + Key A
0x01: All mode + Key A
0x02: Idle mode + Key B
0x03: All mode + Key B
blk_add — the starting address of a card to write, not negative
0x00-0xXX (XX depending on the card type)
num_blk — the number of block or page to write
Mifare card: 0x01-0x04
Ultralight card: restricted to 0x01
key — Key of the card which is 6 byte
Mifare card: Key to check
Ultralight card: Don’t need the paramerter
buffer — data to write to the card
Mifare card: 16*num_blk byte
Ultralight card: 4*num_blk byte
Output Parameter:
buffer
succeed
buffer[0]: UID data length
buffer[1-N]: UID of N byte (from Low byte to Hight byte )
failed
buffer[0]: status words,As for the exact meaning, please refere to the

Page: 8 /12
APPENDIX 。
Note:only write block in the same sector, see mifare 1 memory organisation
Return value If function run successfully, then return value is 0;Other else it is not 0, As for
the exact meaning, please refere to the APPENDIX .

1.2.3 API_MF_Request

Name API_MF_Request
Delcaration API_MF_Request(SOCKET socketHandle, int DeviceAddress,
unsigned char mode, unsigned char *buffer)
Description Get the card type
Input Parameter:
socketHandle - the socket handle
DeviceAddress - Reader Address
Range of Reader Address is from 0 to 255
mode
0x00: All mode
0x01: Idle mode
Output Parameter:
buffer
succeed
buffer[0-1]: card type of 2 byte
failed
buffer[0]: status words,see appendix。
Return value If function run successfully, then return value is 0;Other else it is not 0, As for
the exact meaning, please refere to the APPENDIX .

1.2.4 API_MF_GET_SNR

Name API_MF_GET_SNR
Delcaration int API_MF_GET_SNR(SOCKET socketHandle, int DeviceAddress, unsigned
char mode,unsigned char cmd,unsigned char *flag, unsigned char *buffer)
Description Read the serial number of a card
Iutput Parameter:
socketHandle - the socket handle
DeviceAddress - Reader Address
Range of Reader Address is from 0 to 255
mode — control how to get the serial number
0x00: All 0x01:Idle
cmd — whether or not halt the card
0x00: not halt 0x01: halt command
Output Parameter:

Page: 9 /12
flag — flag about card number
0x00: one card 0x01:more than one card
buffer
succeed
buffer[0] is the length of the card number.
buffer[1-N] is the serial number (from low byte to high byte)
failed
buffer[0] value is status words.As for the exact meaning, please refere
to the APPENDIX
Return value If function run successfully, then return value is 0;Other else it is not 0, As for
the exact meaning, please refere to the APPENDIX

1.2.5 API_MF_PowerOn

Name API_MF_PowerOn
Delcaration int API_MF_PowerOn(SOCKET socketHandle, int DeviceAddress,
unsigned char mode, unsigned char cmd, unsigned char *buffer)
Description Enter into ISO14443 protocol -4 layer, get the ATS of the CPU card
Note: Must forbid auto request card first using the
API_MF_SetRequestMode.After sent APDU command using
API_MF_TransferCMD, please allow the auto request card using
API_MF_SetRequestMode.
Input Parameter:
socketHandle - the socket handle
DeviceAddress - Reader Address
Range of Reader Address is from 0 to 255
mode
0x00: All mode
0x01: Idle mode
cmd whether halt after poweron
0x00: None
0x01: Halt
Output Parameter:
buffer
succeed
buffer[0] is the length of ATS Data.
buffer[1-N] is the ATS Data
failed
buffer[0] value is status words.As for the exact meaning, please refere to
the APPENDIX
Return value If function run successfully, then return value is 0;Other else it is not 0, As for
the exact meaning, please refere to the APPENDIX .

Page: 10 /12
1.2.6 API_MF_TransferCMD

Name API_MF_TransferCMD
Delcaration int API_MF_TransferCMD(SOCKET socketHandle, int DeviceAddress,
unsigned char mode, unsigned char cmdlength, unsigned char *cmd ,
unsigned char *returnlen , unsigned char *buffer)
Description Send APDU data to ISO14443 Type A CPU card
Note: Must Send PowerOn using API_MF_PowerOn first, then send this
command.
Input Parameter:
socketHandle - the socket handle
DeviceAddress - Reader Address
Range of Reader Address is from 0 to 255
mode
0x00: Not CRC
0x01: Include CRC
cmdlength
length of the APDU command in byte
cmd
context of command
Output Parameter:
returnlen
return length of the data
buffer
succeed
buffer[0-N] is the Data of the card
failed
buffer[0] value is status words.As for the exact meaning, please refere to
the APPENDIX
Return value If function run successfully, then return value is 0;Other else it is not 0, As for
the exact meaning, please refere to the APPENDIX .

APPENDIX

API Return Value

Return Description

Page: 11 /12
0x00 Command OK. ( success)
0x02 checksum error
0x03 Send error
0x04 time out reply
0x05 Reader Address mismath
0x06 Connection gracefully closed
0x07 check sum error
0x08 SOCKET_ERROR
0x0A the parameter value out of range

Return State Words

Status Description
0x00 Command OK. ( success)
0x01 Command FAILURE(see error code)
0x80 SET OK.
0x81 SET FAILURE
0x82 Reader reply time out error
0x83 the card do not exist
0x84 the data is error
0x85 the authentication failure
0x86 Unknown Internal Error
0x87 Unknown error
0x89 The parameter of the command or the Format of the command Erro
0x8A Error in the initial
0x8B Error UID in the Anticoll
0x8C Passwords error
0x8f Reader received unknown command
0x90 card could not support this command
0x91 command format have a mistake
0x92 command could not support OPTION form
0x93 inputed block is inexistence.
0x94 inputed block had been locked
0x95 ocked the block is not successful
0x96 write card operation is not successful
0x89 Flag error in the ISO14443 TypeA

Page: 12 /12

You might also like