User's Manual

CAEN RFID API User Manual
12
Inventorying RFID tags
The fundamental operation of a UHF RFID system is the inventory of the population of tags inside the reading zone of
the reader's antennas. This operation, for the Gen2 protocol as for other UHF protocols, consists of a sequence of
commands and replies exchanged between the reader and the tags, typically with stringent timings between them.
CAEN RFID readers hide the complexity of the inventory algorithm implementing the algorithm in the firmware and
providing a macro command as interface for the user.
The CAEN RFID API provides methods in order to activate the inventory process, the simplest method that just tries to
collect all the tags inside the reading zone, a more complex one with a list of options and a method to start a cycle of
inventories.
In the simplest form the inventory process can be activated simply by calling the InventoryTag method of the
CAENRFIDLogicalSource class. This method has no parameters at all and returns an array of CAENRFIDTag objects once
a complete run of the inventory algorithm is performed inside the reader (a CAENRFIDTag object is a software
representation of the physical tag carrying the data associated to it like the EPC code, its length, the type of the tag and
others). For a code sample look at the Getting Started pag. 8 of this manual.
A more complete version of the InventoryTag methods takes parameters for filtering tags and to activate some
optional features. The parameters used to filter the tags that have to be detected are: the memory bank (Bank), the
mask (Mask), the length of the mask (MaskLength) and the start address (Position) for the matching. Using those
parameters a Gen2 Select command is issued before starting the inventory process in order to match only the
interesting tags. In the matching process the Mask parameter is compared to the memory bank content starting from
the address Position for MaskLength bits. Only the matching tags will be involved in the inventory process and returned
back to the user by the InventoryTag method.
The user can also choose the result of the matching mechanism, i.e. can choose to return the matching tags, the not
matching tags or all the tags (ignoring indeed the filter). This setting can be changed using the SetSelected_EPC_C1G2
method of the CAENRFIDLogicalSource class; possible values for its only parameter are:
EPC_C1G2_SELECTED_YES: for matching tags;
EPC_C1G2_SELECTED_NO: for non-matching tags;
EPC_C1G2_SELECTED_ALL: for all tags (no filter).
An additional parameter (Flags) permits to activate special features of the inventory process, it is a bit mask where only
the 5 less significant bits are used.
Bit 0 enables (1) or disables (0) the Return Signal Strength Indicator (RSSI) reading for each tag for those readers
supporting it.
Bit 1 enables (1) or disables (0) the so called framed mode: if the framed mode is not enabled (default behavior) all the
tags collected during the inventory process are stored into the reader's memory and returned back to the user at the
end of the process. With the framed mode enabled as soon as a tag is detected is returned immediately to the user.
This behavior results in a better responsiveness of the application especially with large population of tags and it is
suggested when a small embedded reader with limited memory is used. It is mandatory to enable the framed bit when
the continuous mode is enabled (see next bit description).
Bit 2 enables (1) or disables (0) the continuous mode: when this bit is enabled the reader implements internally a cycle
of inventories. The number of executed inventories is determined by the ReadCycle parameter that can be set with the
SetReadCycle method of the CAENRFIDLogicalSource class. When ReadCycle is 0 the cycle is repeated indefinitely until
an abort command is sent to the reader.
Bit 3 enables (1) or disable(0) the compact data mode: when this flag is enabled, the inventory method will return back
to the caller only the EPC code of the tag and all the other information like the timestamp and the type of the tag are
filled with fake values. This flag is useful when it is necessary to reduce the data exchanged on the host interface,
typically when the interface is slow (low baud rate serial interfaces).
Bit 4 enables (1) or disables (0) the readout of the TID during the inventory process.
A further option is to use an event-based inventory handling that means start a continuous and autonomous
inventorying getting immediately the control of the thread flow to the caller. All the readings will be received by the
application as software events. The user needs to define an event handler that will take care of handling the data
coming from the tags.
InventoryTag, EventInventoryTag and InventoryAbort methods are members of the CAENRFIDLogicalSource class.