ModuleAPI - C - v1.3 - en
ModuleAPI - C - v1.3 - en
2 ENUMERATION.....................................................................................................................................3
READER_ERR...........................................................................................................................................3
REGION_CONF............................................................................................................................................4
MTR_PARAM................................................................................................................................................4
LOCK_OBJ.................................................................................................................................................5
LOCK_TYPE................................................................................................................................................5
CUSTOM CMD TYPE.....................................................................................................................................6
3 STUCTURES.........................................................................................................................................6
TAGINFO.................................................................................................................................................6
NXPCHANGEEASPARA..................................................................................................................................7
NXPEASALARMPARA....................................................................................................................................8
NXPEASALARMRESULT.................................................................................................................................8
ALIENHIGGS3BLOCKREADLOCKPARA..............................................................................................................8
IMPINJM4QTPARA.....................................................................................................................................9
IMPINJM4QTRESULT..................................................................................................................................9
4 FUNCTIONS:.........................................................................................................................................9
6 ERROR HANDLING.............................................................................................................................38
7 THREAD SAFETY...............................................................................................................................39
1 Introduction
2 Enumeration
READER_ERR
typedef enum
connection.
MT_HARDWARE_ALERT_ERR_BY_HIGN_RETURN_LOSS,//High return
antenna and
environment
failed
MT_MAX_ERR_NUM,
SL_Tag Protocol
typedef enum
} SL_TagProtocol;
Region_Conf
typedef enum
Mtr_Param
For setting parameters of reader. For detailed information please check the
Lock_Obj
typedef enum
} Lock_Obj;
Lock_Type
typedef enum
} Lock_Type;
typedef enum
IC
} CustomCmdType;
3 Stuctures
TAGINFO
typedef struct
{
unsigned char ReadCnt; //Number of times of the tags have been read
unsigned int TimeStamp; // The time the tag was read, relative to the
int Phase; //
NXPChangeEASPara
typedef struct
password
to EASAlarm
} NXPChangeEASPara;
NXPEASAlarmPara
typedef struct
unsigned char DR; // Divide Ratio as Per Gen2,only support 0x01 currently
} NXPEASAlarmPara;
NXPEASAlarmResult
typedef struct
EASAlarm instructions.
} NXPEASAlarmResult;
ALIENHiggs3BlockReadLockPara
typedef struct
unsigned char BlkBits; //8 bits and every bit correspond to one user
} ALIENHiggs3BlockReadLockPara;
IMPINJM4QtPara
typedef struct
int CmdType; //0 means read QT control bits; 1 means write QT control bits.
int MemType; //0 means it will use private data profile;1 means it will use
change
int RangeType; //0 means the read range is distant field;1 means the read
} IMPINJM4QtPara;
IMPINJM4QtResult
typedef struct
int MemType; //0 means it will use private data profile;1 means it will use
int RangeType; //0 means the read range is distant field;1 means the
} IMPINJM4QtResult;
4 Functions:
All of the following examples of functions are based on the hypothesis that
the hReader is the handle of reader. All the functions with return value will
InitReader_Notype
Functional description
Parameters
Parameters Description
to user.
or IP address.
Example:
int hReader;
printf(“error in InitReader_Notype\n”);
}
CloseReader
Functional description
Close readers
Parameters
Parameters Description
Example
CloseReader(hReader);
ParamGet
ParamSet
Functional description
The two functions can get and set all the parameters of reader.The key
parameter shows which parameter will be got and set, the type of val parameter
depend on key parameter. See the table below. A parameter of reader will work
le
architecture;1:the M value of
MILLER is 8)
length in bits
antenna
configurations(antid:the
array.
of reader
of reader short
the Fdata
TagFilter_ST as NULL.
MTR_PARAM_TAG_EMBEDEDDA Read data of Embede bank: which bank to read when Write
& Read
TA another bank while dData_ inventory , legal value is
inventory ST 0,1,2,3;
reading
address;
EmbededData_ST as NULL.
weight in Inv_Potl is an
inventory of multiply
protocols)
in potls array.
detected) connectedants.
recommended)
reader
as 250
MTR_PARAM_TAGDATA_UNIQU For the same tag, int Legal value:0,1(0:no matter Write
EBYANT whether it would how many antennas read the tag & Read
be regarded as there would be only one tag
several different record;1: different tag
different tag)
antennas.
different other
bank data
whether consider
these tags as
different tag
data records
DHIGHESTRSSI only record the highest rssi value;1 : not to & Read
frequency, in KHz
saving)
speed)
reader)
reader)
currently.
of these modules.
table below)
Parameter configuration M5e series M6e series slr1100 Ethernet port readers
Gen2Session Yes Yes Yes
Gen2Target Yes Yes Yes
Gen2Qvalue Yes Yes Yes
Working area Yes Yes Yes
gen2encoding Yes ( no Yes No
FMO)
Antenna detection Yes Yes No
transmitting power Yes Yes Yes
Uniqueness of data antenna Yes Yes Yes
Uniqueness of the attachment data Yes Yes Yes
Record the highest Rssi Yes Yes Yes
Frequency hopping table Yes Yes Yes
power saving mode Yes Yes No
Maximum EPC length Yes No No
Gen2 writing mode Yes Yes Yes
Gen2Trai No Yes No
Gen2 backward Scattering rate No Yes No
Counting mode No Yes No
Iso180006b backward Scattering No Yes No
rate
Functional description
Parameters
parameters description
Example
if (SetGPO(hReader, 1, 1) != MT_OK_ERR)
printf(“SetGPO failed\n”);
GetGPI
Functional description
Parameters
parameters Description
int state;
Gen2 tag is divided into four banks which are bank 0 ,bank 1,bank 2 and bank
3. Bank 0 is also called the reserve bank which contains the access password
and the kill password while each password has 32 bits. Bank 1 is called EPC
bank, which contains CRC field ( 16 bits ) , PC field ( 16 bits ) and EPC
field(maximum length is 496 bits and the common length is 96 bits ). Bank 2
also known as TID bank, which contains tag–and vendor-specific data (for
example, a tag serial number). Bank 3 is called user bank , allows user-
specific data storage,different tag IC may has different capacity and lots of
based numbering, which is 16 bits. All the tag operations except inventory
could be set a timeout period. If the operation is finished before the timeout
expires, the function would return before timeout. Otherwise, the function
would block until the timeout expires. Inventory operation can use several
antennas to search tags while for other tag operations like read, write, lock
or kill only one antenna must be specified used for these operations.
For the operations like read, write, lock and kill except inventory, if
there are several tags in the antenna field, the first tag response to the
specific tag, there must be only one tag in the antenna field or setting the
tag filter.
Attention : Do not operate the tag on the antenna ports without antenna
Functional description
Read the EPC code of tags. Please set MTR_PARAM_TAG_INVPOTL parameters before
Parameters
Parameters Description
array
at pTInfo.
Example
int ants[] = {1, 2, 3, 4}
int antcnt = 4;
TAGINFO tags[200];
int tagnum;
printf(“TagInventory failed”);
Attention: the tags buffer in reader can store 200-1000 tags (depend on reader
type).if there are many tags ( more than 1000 ) in the antenna fields, the
parameter timedur should not set to a too large value, this can avoid the
TagInventory_BaseType
Functional description
Read EPC code of tags , this function differs from TagInventory function in
the format of tags information returned by reader, this function does not use
Parameters
Parameters Description
array
bytes ) , EmbededDatalen ( 2
bytes ) , EmbededData ( if
field)
outbuf.
Example
int antcnt = 4;
int tagnum;
MT_OK_ERR)
{
printf(“TagInventory_BaseType failed”);
TagInventory_Raw
Functional description
Read EPC code of tags , but you cannot get any EPC code from this function
except the number of tags read. After calling this function users must
Parameters
Parameters Description
array
tags read.
例子:
int antcnt = 4;
int tagnum;
printf(“TagInventory_Raw failed”);
GetNextTag
Functional description
Get the data of next tag, users could get the number of tags read by calling
Parameters
Parameters Description
example:
TAGINFO tag;
printf(“GetNextTag failed”);
GetTagData
READER_ERR __stdcall GetTagData(int hReader, int ant, unsigned char bank,
unsigned int address, unsigned char blkcnt, unsigned char *data, unsigned char
Functional description
Read data of tag bank. Before calling this function for ISO18000-6b tag
operation the tag filter must be set and the detailed setting should be as
of 18000-6b.
Parameters
Parameters Description
ISO18000-6b tag.
data.
parameter is NULL
Example
Read two blocks of data from the second block of the bank 0(i.e. access
password), and the access password is locked, the access password is
0x12345678.
int ant = 1;
pwd[0] = 0x12;
pwd[1] = 0x34;
pwd[2] = 0x56;
pwd[3] = 0x78;
printf(“GetTagData failed”);
WriteTagData
unsigned int address, unsigned char *data, int datalen, unsigned char
Functional description
Write data into tag bank. Before calling this function for ISO18000-6b tag
operation the tag filter must be set and the detailed setting should be as
of 18000-6b.
Parameters
Parameters Description
hReader Handle of reader
ISO18000-6b tag.
parameter is NULL
Example
access password.
int bank = 3;
int ant = 1;
int addr = 2;
data[0] = 0x11;
data[1] = 0x11;
data[2] = 0x22;
data[3] = 0x22;
data[4] = 0x33;
data[5] = 0x33;
printf(“WriteTagData failed\n”);
}
WriteTagEpc
READER_ERR __stdcall WriteTagEpc(int hReader, int ant, unsigned char *Epc, int
Functional description
Write epc code to EPC bank. The epc code also can be rewritten using
WriteTagEpc would change the PC field of EPC bank while writing epc code. PC
stores the epc length filed (this function may change the length) and this
function does not support tag filter and access password. This function is
Parameters
Parameters Description
Example
epcdata[0] = 0x11;
epcdata[1] = 0x11;
epcdata[2] = 0x22;
epcdata[3] = 0x22;
epcdata[4] = 0x33;
epcdata[5] = 0x33;
epcdata[6] = 0x11;
epcdata[7] = 0x11;
epcdata[8] = 0x22;
epcdata[9] = 0x22;
epcdata[10] = 0x33;
epcdata[11] = 0x33;
printf(“WriteTagEpc failed\n”);
WriteTagEpcEx
Functional description
Do the same thing as WriteTagEpc except for supporting setting tag filter and
Parameters
Parameters Description
parameter is NULL
Example
0x12345678.
pwd[0] = 0x12;
pwd[1] = 0x34;
pwd[2] = 0x56;
pwd[3] = 0x78;
epcdata[0] = 0x11;
epcdata[1] = 0x11;
epcdata[2] = 0x22;
epcdata[3] = 0x22;
epcdata[4] = 0x33;
epcdata[5] = 0x33;
epcdata[6] = 0x11;
epcdata[7] = 0x11;
epcdata[8] = 0x22;
epcdata[9] = 0x22;
epcdata[10] = 0x33;
epcdata[11] = 0x33;
printf(“WriteTagEpcEx failed\n”);
}
LockTag
Functional description
Lock the tag. The following objects are able to be locked: kill
password , access password , EPC bank , TID bank , USER bank. The accesspasswd
parameter cannot be NULL. This function could lock multiple objects of one tag
at the same time. The lock type can be unlock, temporarily lock or permanently
Parameters
Parameters Description
Example
pwd[0] = 0x12;
pwd[0] = 0x34;
pwd[0] = 0x56;
pwd[0] = 0x78;
if (LockTag(hReader, 1,
printf(“LockTag failed\n”);
Lock180006BTag
Functional description
Lock 18000-6b tag. Before calling this function for ISO18000-6b tag operation
the tag filter must be set and the detailed setting should be as follows: bank
Parameters
Parameters Description
Example
TagFilter_ST filter;
filter.bank = 4;
filter.fdata = uid;
filter.flen = 64;
filter.startaddr = 0;
filter.isInvert = 0;
printf(“Lock180006BTag failed\n”);
KillTag
Functional description
Destroy tags. Once the tags was destroyed, they can no longer in use. Before
Parameters
Parameters Description
Example
kpwd[0] = 0x43;
kpwd[0] = 0x21;
kpwd[0] = 0x56;
kpwd[0] = 0x78;
CustomCmd
Functional description
Parameters
Parameters Description
enumeration.
data.
Below is the type of CustomPara and CustomRet with different custom command
Example
NXPChangeEASPara para;
para.AccessPwd[0] = 0;
para.AccessPwd[1] = 0;
para.AccessPwd[2] = 0;
para.AccessPwd[3] = 1;
para.isSet = 1;
para.TimeOut = 500;
printf("CustomCmd failed\n");
filter criteria which allow specifying a bank (ban k1, bank 2, bank 3), a
starting address in the bank and data to be compared in the bank. As for
tag filter has been set, it will work until another tag filter is set or
When executing the inventory operation, users could get another bank data
there is no additional data read. The additional data stores in the member
6 Error Handling
All the API functions with returned value will return MT_OK_ERR on success. If
the return value is MT_IO_ERR it means there are something wrong with network
connection or serial port connection, you should call CloseReader and check
error, and you can do any operation next. As for MT_CMD_NO_TAG_ERR , strictly
speaking, it cannot be called an error, and means there is no tag was found.
cannot be ignored. Some improper operations can cause these errors and hardware
damage. These operations include: transmit power through antenna ports without
and the high return loss caused by metal plate in front of antennas . It would
be best to turn off the reader and check the working condition and working
7 Thread Safety
version of SDK are not thread-safe for the same handle of reader. Users should
make certain that there is no race condition for the API functions calling or