Aska NFC-9812 Manuale utente

API/SDK Instruction for
UHF Reader
1

Instruction
The API Development Kit is designed for user developing application software conveniently, which provide to
user in the form of dynamic link file.
It supports Visual ++、VB、++ Builder and Delphi platform developing environment. User can correct develop
their application software efficiently by reading this instruction manual.
According to the function features, the API function can be classified into two types function: “reader
management function” and “tag operating function”; Tag operating function can be classified as “public function” and
“tag operating function in specific protocol
2

Function List
-------------------------------------------------------------------------------
Definition of Data Structure
1. TagIds structure definition
2. Gen2TagList structure definition
3. Gen2LockFlags structure definition
Reader management function
1. OpenReader -----------------------------Open the reader
2. loseReader ----------------------------- lose the reader
3. SetBaudRate ----------------------------- onfigure the baud rate between P and reader
4. SetParameter ---------------------------- onfigure reader working parameters
5. GetParameter ----------------- ----------Read the working parameters of reader
6. SetIdmData -------------------------------Write the required ID matching data to reader.
7. GetIdmData-------------------------------Read the ID match data
8. ResetReader -----------------------------Reset the reader
9. GetFirmwareVersion -------------------Read the program version of reader firmware
10. Beep ontrol----------------------------- ontrol the reader buzzer
11. SelectAntenna-------------------------- hoose the working antenna
12. SetWorkAntenna ---------------------- onfigure the working antenna for multi-port reader
13. QueryAntenna -------------------------Query the antenna connecting condition
14.StopRFwork----------------------------- Stop the reader launching power
15. GetTriggerState ------------------------Query reader trigger input state
16. SetRelayState --------------------------Set reader relay action
17. Synchronize -----------------------------Synchronize the reader
18000-6B Tag Operating Function
1. SingleTagIdentify ------------------------Single tag identification
2. SingleTagIdentifyEx---------------------Single tag identifying for multi-port reader
3. MultipleTagIdentify ----------------------Multiple tag identification
4. MultipleTagIdentifyEx-------------------Multiple tags identifying for multi-port reader
5. ReadSingleTag---------------------------Identify single tag and read designated memory data
6. ReadSingleTag0-------------------------Read memory data of designated tag
7. WriteSingleTag---------------------------Identify single tag and write data to designated memory address
8. WriteSingleTag0-------------------------Write parameters to the designated memory address of specific
tag
9. LockTag -----------------------------------Identify single tag, and lock the designated tag memory address
10. LockTag0---------------------------------Lock the designated memory address of specific tag
11. QueryLock-------------------------------Query the locking status of designated memory address
12. QueryLock0 ----------------------------Query the locking status of designated tag memory address
E C GEN2 Tag Operating Function
3

1. InitGen2Tag ------------------------------ Initialize the EP Gen2 tag
2. InitGen2Epc ode----------------------- Initialize the EP code for EP Gen2 tag
3. SingleTagIdentify-------------------------Single tag identification
4. MultipleTagIdentify-----------------------Multiple tag identification
5. Gen2ReadTag---------------------------- Read the memory data of EP Gen2 tag
6. Gen2WriteTag-----------------------------Write data to the memory area of EP Gen2 tag
7. Gen2ReadTagwithEpc--------------------Read the memory data of designated EP Gen2 tag
8. Gen2WriteTagwithEpc---------------------Modify the EP code for designated EP Gen2 tag
9. Gen2ReadTagwithEpcPW--------------- Read the memory data of designated cryptographic tag
10. Gen2WriteTagwithEpcPW-------------- Modify the EP code of designated cryptographic tag
11. Gen2SetAccessPassword--------------Modify the access password for designated tag.
12. Gen2GetAccessPassword--------------Read the access password of designated tag.
13. Gen2SetKillPassword--------------------Modify the kill password for designated tag
14. Gen2GetKillPassword--------------------Read the kill password of designated tag
15. Gen2KillTag---------------------------------Kill the designated tag
16. Gen2LockTag-------------------------------Lock the designated tag
17. Gen2 hangeEAS-------------------------Modify the EAS bit for designated tag
18. Gen2EASAlarm---------------------------Tag alarm
19. Gen2Tag ontentList----------------------List the selected contents of EP Gen2 tag
4

● Definition of Data Structure
1. TagIds Structure Definition
typedef struct
{
nsigned char TagType;
nsigned char AntNum;
nsigned char Length;
nsigned char Ids[ID_Length];
}TagIds;
The definition of TagIds Structure is as below:
TagType—Tag type
AntNum—Antenna Serial Number
Length—Byte length of tag ID
Ids— Tag ID value
2. Gen2TagList Structure Definition
typedef struct
{
unsigned char DataMask;
unsigned char EpcLength;
unsigned char TidLength;
unsigned char UserLength;
unsigned char Epc[24];
unsigned char Tid[12];
unsigned char User[64];
}Gen2TagList;
“Gen2TagList” is the required structure for listing EP , TID and USER data at a time.. Its definition as below:
▲DataMask ---The storage area needs to be read, using the bit mask format
D0 is “1” -- Reading the EP code,
D0 is “0 “– Doesn’t reading the EP code
D1 is “1” -- Reading the TID code
5

D1 is “0” -- Doesn’t reading the TID code
D2 is “1” -- Reading the data of User area
D2 is “0” -- Doesn’t reading the data of User area
D3 ~ D7 ---The five bits data are reserved
▲EpcLength-The double-byte length of EP code read (D0 is “1”)
▲TidLength-The double-byte length of TID code read (D1 is “1”)
▲UserLength-The double-byte length of User data read (D2 is “1”)
▲Epc-EP code read
▲Tid-TID code read
▲User-User data read
3、Gen2LockFlags structure definition
typedef struct
{
unsigned char Mask;
unsigned char Action;
}Gen2LockFlag;
typedef struct
{
Gen2LockFlag Kill;
Gen2LockFlag Access;
Gen2LockFlag EP ;
Gen2LockFlag TID;
Gen2LockFlag User;
}Gen2LockFlags;
It stipulates the operating of tag KILL password, A ESS password, EP , TID and locking user area. The definition
of Gen2LockFlag is as below:
Mask-Operating range of locking area
Action-Locking type
Gen2LockFlags structure definition
Kill-Operational definition for locking KILL password
Access-Operational definition for locking Access password
EP -Operational definition for locking EP memory area
TID-Operational definition for locking TID memory area
User-Operational definition for locking USER memory area
6

● Reader Management Function
Reader management function is used to achieve the work of configuring the reader working condition, status
query and function operating by host P .
1. OpenReader
Function prototype: short OpenReader (HANDLE * h om, unsigned char LinkType,char *com_port)
Explanation: Open the reader
Input parameter:
h om-- Handle
LinkType—connecting type between reader and P , “1” for serial port, “2” for network port, “3” for
USB
om_port—It is serial port name when serial port connecting; It is reader’s IP address when network
connecting. It is empty character string or any character string when USB connecting.
Return result: the result is zero, which shows the action is correct, others are wrong.
Explanation:It needs to call ”OpenReader” function before operating the reader
2. CloseReader
Function prototype:short loseReader (HANDLE h om)
Function explanation:close the reader
Input parameter:
h om-- Handle
Return results: the result is zero, which shows the action is correct, others are wrong
Explanation:It need to call loseReader()when quit the application program so as to release system resource.
3. SetBaudRate
Function prototype:short SetBaudRate (HANDLE h om, unsigned short BaudRate)
Function explanation:onfigure the baud rate between P and reader
Input parameter:
BaudRate-configuring BaudRate, the value is 0,1,2,3, 4, the corresponding baudrate is 9600, 19200, 38400,
57600 and 115200bps.
Return results: The result is zero, which shows the action is correct, others are wrong.
Expalination: ”SetBaudRate” function is only suitable for modifying the reader Baudrate when connecting the
reader by RS-232
7

4.Set arameter
Function prototype:short SetParameter(HANDLE h om, unsigned int Addr, unsigned char ount, unsigned char
* Parameter)
Function explanation: configuring the reader working parameters.
Input parameter:
h om-- Handle
Addr-The first working parameter address needs to be configured, range from 2 to 255
value -The working parameters’ value needs to be configured. For details, please refer to the
instruction manual for ReaderSetup.exe
Return results: the result is zero, which shows the action is correct, others are wrong.
Explanation:It’s internal function, usually users no need to use it.
5. Get arameter
Function prototype :short GetParameter(HANDLE h om, unsigned int Addr, unsigned char ount,unsigned
char *Value)
Function explanation:Reading the multiple working parameters of reader
Input parameter:
h om-- Handle
Addr-The first address of working parameters
ount: The number of parameters
value-The return value of reading working parameters
Return results: the result is zero, which shows the action is correct, others are wrong.
Explanation:It’s internal function, usually users no need to use it.
6、SetIdmData
Function prototype :short SetIdmData(HANDLE h om, unsigned char order,unsigned char match_length,
unsigned int count,TagIds *value)
Function explanation:Before using the ID matching function, it’s necessary to call the “SetIdmData” function and
write all the required ID data to the reader.
Input parameter:
h om—Handle
order— Tag ID sort order, 0 for descending order, 1 for ascending order’
match_length—Byte length needs to be matched.
count— The number of tag ID
Value—Tag data. Please refer to the definition of TagIds
Return results: the result is zero, which shows the action is correct, others are wrong
9. GetIdmData
Function prototype:GetIdmData (HANDLE h om, unsigned char * moreFlag,unsigned int *count,TagIds *value)
Function explanation:Read the ID match data in reader
Input parameter:
8

h om—Handle
moreFlag-Mark for unfinished ID match data
count -The number of expected ID matching data when calling this function. It also refers to the
number of actual ID matching data read when function returns
Value—Tag data. Please refer to the definition of TagIds
Return results: the result is zero, which shows the action is correct, others are wrong
8. ResetReader
Function prototype:short ResetReader(HANDLE h om)
Function explanation: Reset the reader
Input parameter:
h om-- Handle
Return results: the result is zero, which shows the action is correct, others are wrong
9. GetFirmwareVersion
Function prototype:short GetFirmwareVersion (HANDLE h om, Version * version)
Function explanation:Read the program version of reader firmware.
Input parameter:
h om-- Handle
Version-value of firmware program, please refers to the Version data structure
Return results: the result is zero, which shows the action is correct, others are wrong.
10、BeepControl
Function prototype:short Beep ontrol(HANDLE h om, unsigned char ontrolType)
Function explanation:ontrol the reader buzzer
Input parameter:
h om—Handle
ontrolType— controlling type of buzzer, defined as: 1 start buzzer; 2, stop the buzzer; 3. start the
buzzer and automatically stop the buzzer.
Return results: the result is zero, which shows the action is correct, others are wrong.
Explanation:User can control the buzzer action by calling this function.
11、SelectAntenna
Function prototype:short SelectAntenna(HANDLE h om, unsigned char AntennaNum)
Function explanation: hoose the working antenna
Input parameter:
h om—Handle
AntennaNum-the selected working antenna
Return results: the result is zero, which shows the action is correct, others are wrong.
Explanation: it’s only used for multi-ports reader(NF -9812,NF -9814 etc.). User can operate the designated
antenna and do reading, writing, kill operating for specific tag. This function is not valid for single ports reader.
9

12、SetWorkAntenna
Function prototype:short SetWorkAntenna (HANDLE h om, unsigned char Antenna)
Function explanation:onfigure the working antenna(channel) for multi-port reader
Input parameter:
h om—Handle
Antenna— onfigured antenna, bit mask mode, If D0-D7 is ‘1’, which indicates antena1~8
can work. If it’s zero, the corresponding antenna doesn’t work.
Return results: the result is zero, which shows the action is correct, others are wrong.
Explanation:It’s internal function, usually users no need to use it.
13. QueryAntenna
Function prototype:short QueryAntenna(HANDLE h om, unsigned char * Antenna)
Function explanation:Query the antenna connecting condition(For multi-port reader)
Input parameter:
h om—Handle
Antenna-Mark of antenna connecting condition, If D0-D7 bit is “1”, ndicate the corresponding antenna
connect to reader. If it’s”0”, it means the antenna doesn't connect with reader
Return results: the result is zero, which shows the action is correct, others are wrong.
Explanation:It’s internal function, usually users no need to use it.
14、StopRFwork
Function prototype:short StopRFwork(HANDLE h om)
Function explanation:stop the reader launching power
Input parameter:
h om— Handle
Return results: the result is zero, which shows the action is correct, others are wrong.
15、GetTriggerState
Function prototype:short GetTriggerState(HANDLE h om)
Function explanation:Query reader trigger input state.
Input parameter:
h om— Handle
Return results: The returning results is trigger input state, using bit mark encoding, the minimum significance bit
“D0” indicates the state of trigger 1, If the value is“0”, it means the trigger is invalid, if it’s “1”, the trigger is valid; “D1”
indicates the state of trigger 2, there is no definition for “D2-D7”
16、SetRelayState
Function prototype:short SetRelayState(HANDLE h om, unsigned char Mask, unsigned char State)
Function explanation:.Set reader relay action
Input parameter:
h om— Handle
1
0
Questo manuale è adatto per i seguenti modelli
1
Indice
Altri manuali Aska Modulatore


















