RS232 Library
RS232 Library
1. imprint(Revision V1.00).
3、System Commands
3.01 HANDLE API_OpenComm(
char *com,
int Baudrate);
Description
Open the comm port and set the baud rate for further communication with the reader.
Example
Com Character pointer to C string of the name of the serial port where the reader is
connected. (e.g. COM1, COM2, COM3, COM4)
Baudrate The communication baud rate of serial port
(Possible values : 9600, 19200, 38400, 57600, 115200).
Output Parameter
none
Return value:
HANDLE , succeed to open the serial port handle
if you open it succeed, the return value is the serial port handle.
if you open it unsuccessfull, the return value is 0.
Description
Close the communication port. The API_CloseComm ( ) should be called to release the
serial port before closing the application program.
Output Parameter
None
Return value:
0 :closed the serial port in the handle
-1 :inpurted the handle value is 0, it couldn't close.
Description: set the new address for reader,the reader back to the setting address
Input Parameter Description
Output Paramete
If Command success
*buffer the read date(It means you have set the new address in this function)
If Command Failure
*buffer System Error/Status Codes(You can consult the 2.2)
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE
Description:
set up the baud rate between the reader and PC communication. the baud rate will
If Command success
*buffer, new baud rate(It means set new baud rate code in this function)
(0x00 – 9600 bps,0x01 – 19200 bps,0x02 – 38400 bps,0x03 – 57600 bps,0x04 – 115200 bps)
If Command Failure
*buffer System Error/Status Codes(You can consult the 2.2)
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE
Description:
Output Paramete:
If Command Failure
*buffer System Error/Status Codes(You can consult the 2.2)
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE
Description:
read one byte reader address and 8 byte serial number which be supplied by
manufactory
Output Paramete:
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE
Description:
the reader consist of 4 blocks(each block less than 120 byte),the user data space in
all 480 byte. the user could base the requirement to deposited the relevant userinfo
into the reader.
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE
Description:
Read the date from the reader, the reader consist of 4 blocks
Output Paramete:
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE
Description:
read reader version number
Output Paramete:
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE
Description: the work state of set light,include,light Cyc and repeating times
Output Paramete:
*buffer If Command Failure,then buffer [0] 为 is error code.
If Command success ,then buffer [0] is 0x80
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE
Description: the work state of setting buzzer,include buzzer work Cyc and repeating times
Output Paramete:
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE
Output Paramete:
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE
Description::test card quantity, single or much more, and then return the card number within 4
byte(if there are many cards, the only return one of card number
Output Paramete:
If Command success
Status the checked card number(0x00 means have checked a single card,0x01
means have checked more cards
*snr 4 byte card number(snr[0..3])
If Command Failure
*snr System Error/Status Codes(You can consult the 2.2)
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE
Description:
Select card, make the card as been select stat…
Output Paramete:
Status checked card numbe
*snr 4 byte card number4(snr[0..3])
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE
Description:
select card,make the card as been break off
Output Paramete:
None.
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE
Description:
read the appointed length date at the appointed station
Output Paramete:
If Command success
*snr, 4 byte card number
*buffer, the read date (the fact number is: num_blk*16)
If Command Failure
buffer[0] System Error/Status Codes(You can consult the 2.2)
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE
Description:
Read-in date At appoint station
Output Paramete:
If Command success
snr[0..3], four byte card number
If Command Failure
buffer[0] System Error/Status Codes(You can consult the 2.2)
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE
4.2.3 int API_PCDInitVal(
HANDLE commHandle,
int DeviceAddress,
unsigned char mode,
unsigned char SectNum,
unsigned char *snr,
int value);
Description:
Initialize card
Output Paramete:
If Command success
snr[0..3] 4 byte card number
If Command Failure
snr[0] System Error/Status Codes(You can consult the 2.2)
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE
Description:
Output Paramete:
If Command success
snr[0..3], 4 byte card number
value[0..3] date bunch after 4 byte work
If Command Failure
snr[0] System Error/Status Codes(You can consult the 2.2)
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE
Description:
Output Paramete:
If Command success
snr[0..3], 4 byte card number
value[0..3] the date bunch after 4 byte work
If Command Failure
snr[0] System Error/Status Codes(You can consult the 2.2)
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE
Description:
Return 1byte single card or numerous card sign,4 byte card number.
Output Paramete:
If Command success
snr[0], 1 byte single card or numerous
value[0..3] return 4 byte card number
If Command Failure
snr [0] System Error/Status Codes(You can consult the 2.2)
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE
Description:
According the selected mode to send the date
Output Paramete:
If Command success
carddata[0..N], incept the return date
If Command Failure
carddata[0] System Error/Status Codes(You can consult the 2.2)
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE
Description: this order perform REQB order of ISO14443B, get PUPI code of the card
Output Paramete:
If Command success
*buffer, the date bunch after card reposition (ATQB)
buffer[0] card reposition date length
buffer[0..N] the date after work(ATQB)
If Command Failure
buffer[0] System Error/Status Codes(You can consult the 2.2)
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE
Output Paramete:
If Command success
Buffer[0..N], the date of card return(ATQB)
If Command Failure
buffer[0] System Error/Status Codes(You can consult the 2.2)
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE
Description:
this order perform ATTRIB of ISO14443B, distribute a sign for CID to the know card
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE
Description:
This order performation integration REQUEST AND ATTRIB order of ISO14443B,use one order
to make card reposition.
Output Paramete:
If Command success
buffer[0..3], return to 4 byte serial number of the worked card
If Command Failure
buffer[0] System Error/Status Codes(You can consult the 2.2)
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE
Description:
ISO14443 remit order, any effect order and date can be transfer by this order
Output Paramete:
If Command success
buffer[0..N] the date which returned from the card
If Command Failure
buffer[0] System Error/Status Codes(You can consult the 2.2)
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE
6 ISO15693 COMMANDS
Description:
This order is to get all the card’s serial number which in the reading card district(the getable
card number is relate to the output rate of the module antenna, commonly can read 2~6 card
within anticollision)
Output Paramete:
Description:
It’s for reading 1 and numerous fan value. If need to read the safe digit of every block, make
Option flag of FLAGS as 1 ,means FLAG=0x42,every fan will return 5 byte, include one byte show
safe state and 4 byte block content, here the most can read 12 block, IF FLAG=02,will only return 4
byte block content, here the most can read 63 block.
Output Paramete:
If : Command success (return 0x00)
*buffer return date
buffer[0] return flag
buffer[1..N] Data
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE, the error code is 2.2
Description: make writting work to every block(every time only can write one block)
Output Paramete:
If : Command success (return 0x00)
*buffer return date
buffer[0] return flag
buffer[1..N] Data
If : Command Failure (return 0x01)
buffer[0] System Error/Status Codes(You can consult the 2.2)
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE, the error code is:2.2
Description: for lock block content, caution : this process can not in reverse(can not unlock) the
content can not revise when the block be locked.
Output Paramete:
If : Command success (return 0x00),
buffer[0] return 0x80 ,means work ok.,
If : Command Failure (return 0x01)
buffer[0] System Error/Status Codes(You can consult the 2.2)
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE, the error code is:2.2
Description:
This order is to make the card to sleep sate, must use the address mode if the sent date is
same to the card serial number, after this work finish, the card will be sleep, otherwise the
state will not change.
Output Paramete:
If : Command success (return 0x00)
buffer[0] return 0x80,means work ok.
If : Command Failure (return 0x01)
buffer[0] System Error/Status Codes(You can consult the 2.2)
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE, the error code is:2.2
Description:
This order must use address mode, if the sent date is same to the card serial number,
after the work ok, the card will be selected, otherwise the state will not change
Output Paramete:
If : Command success (return 0x00)
buffer[0] return to 0x80,means work ok
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE, the error code is 2.2
Description:
After the work ok, the card will return to Ready state .
Output Paramete:
If : Command success (return 0x00)
buffer[0] return 0x80,means work ok
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE, the error code is:
6.8 int WriteAFI(
HANDLE commHandle,
int DeviceAddress,
unsigned char flags,
unsigned char afi,
unsigned char *uid,
unsigned char *buffer );
Description:
Write AFI to the card .
Output Paramete:
If : Command success (return 0x00)
buffer[0] return 0x80,means work ok
If : Command Failure (return 0x01)
buffer[0] System Error/Status Codes(You can consult the 2.2)
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE, the error code is:2.2
Description:
For lock AFI of the card, after lock AFI can not change
Output Paramete:
If : Command success (return 0x00),
buffer[0] return 0x80,means work ok
If : Command Failure (return 0x01)
buffer[0] System Error/Status Codes(You can consult the 2.2)
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE, the error code is:2.2
Description:
Write DSFID to the card
Output Paramete:
If : Command success (return 0x00),
buffer[0] return 0x80,means work ok
If : Command Failure (return 0x01)
buffer[0] System Error/Status Codes(You can consult the 2.2)
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE, the error code is:
Description:
For lock DSFID of the card, after lock, DSFID can not change
Output Paramete:
If : Command success (return 0x00),
buffer[0] return 0x80,means work ok
If : Command Failure (return 0x01)
buffer[0] System Error/Status Codes(You can consult the 2.2)
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE, the error code is:2.2
Description:
For get the particular message of the card, the fact content please refer to ISO15693
agreement date.
Output Paramete:
If : Command success (return 0x00),
Then Buffer [0]: Flags
Buffer[1]: INFO Flags
Buffer[2..9]: UID
Buffer[10]: DSFID
Buffer[11]: AFI
Buffer[12..N]: Other fields
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE, the error code is:2.2
Description: for get the date of every safe state block of the card
Output Paramete:
If : Command success (return 0x00),
*pBuffer return value
pBuffer [0] return flags pBuffer [1..N] Block security status (the safe state of block)
If : Command Failure (return 0x01)
pBuffer[0] System Error/Status Codes(You can consult the 2.2)
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE, the error code is:2.2
Description: a currency order, the user can use this order to make kinds of handle to the card
Output Paramete:
If : Command success (return 0x00),
*buffer return data
buffer [0..N] the date return from the card
Return value:
0x00 Command OK. ( success)
0x01 Command FAILURE, the error code is:2.2