CAEN RFID API User Manual User Manual Revision n.
Scope of Manual The goal of this user manual is to provide the basic information to work with CAEN RFID readers. The CAENRFID is a basic library to support an easy communication with different reader types. Change Document Record Date 14 Jul 2010 14 Jan 2011 Revision 01 02 20 Sep 2012 03 02 May 2013 04 Changes Initial release.
Index Scope of Manual ................................................................................................................................................ 2 Change Document Record ................................................................................................................................. 2 Index............................................................................................................................................... 3 List of Tables .....................
1 Introduction This Chapter gives basic information about the SDK architecture.
Overview This guide describes the model, design concepts and the Application Software Interface (API) offered by CAEN RFID for the development of software for use, integrate and control CAEN RFID readers and accessories. CAEN RFID provides a Software Development Kit (SDK) that includes APIs for the most common programming languages: Java, .NET (C# and Visual Basic) and Visual C/C++. In details, the SDK package contains: a .
Up to the current revision, the API handles four Logical Source (called “Source_0”, “Source_1”, “Source_2”, “Source_3”) and four Read Points (called “Ant0”, “Ant1”, “Ant2”, “Ant3”) and the default configuration is that each LogicalSource contains only one different ReadPoint; in the future this could change and the number of Logical Sources and Read Points could be different depending on the model of the RFID reader.
2 Getting Started This chapter describes the minimum steps a programmer should follow in order to operate with a CAEN RFID reader using the API.
The minimum steps a programmer should follow in order to operate with a CAEN RFID reader using the API are the following: Open a connection with the reader Configuration of the logical source (optional if the default configuration is fine) Detection of tags and other operations on the tags Close the connection with the reader. Here below a simple but complete code snippet showing the minimum required lines of code to detect RFID tags using a CAEN RFID reader and the CAEN RFID API.
3 Basic Operations This chapter shows the most common operations that a programmer can perform using a CAEN RFID reader and the CAEN RFID API. All the example will be shown in the C# language; the Visual Basic, Java and C version are omitted since they differ only at syntax level.
Importing the libraries The current version of .Net and Visual C libraries have been developed using Microsoft Visual Studio 2005 and the Java library has been developed using Oracle Netbeans 6.8. Methods to import the libraries in the application developer's projects strongly depend on the Integrated Development Environment (IDE), please refer to the documentation of the IDE in use for instructions.
Setting the power level Most of the CAEN RFID readers allow to regulate the emitted power. This setting is useful in order to limit the read range of the reader, to limit the power as stated by the local regulations or for adapt the power depending on the antenna characteristics. The API provides two methods, one for setting the power (SetPower) and one for getting the current power level (GetPower).
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.
Optimizing the inventory process EPC Class1 Gen2 protocol defines a set of parameters useful for the optimization of the tags' detection, in the current paragraph we give a brief explanation of the most useful ones and we show how to work with those parameters using the CAEN RFID API.
Here below a code sample where the Q value is set to 3 before to start the inventory process: using using using using using System; System.Collections.Generic; System.Linq; System.Text; com.caen.RFIDLibrary; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { CAENRFIDReader MyReader = new CAENRFIDReader(); MyReader.Connect(CAENRFIDPort.CAENRFID_RS232, "COM3"); CAENRFIDLogicalSource MySource = MyReader.GetSource("Source_0"); MySource.
Sessions When a tag is singulated by the “slotted ALOHA” algorithm described in the previous paragraph, it switches automatically from an internal state A to another internal state B. In the EPC C1G2 terminology these states are called “target A” and “target B” respectively; for our purposes we can refer to target A as the non-inventoried state and to target B as the inventoried state: singulation makes therefore switch a tag from the non-inventoried state to the inventoried state.
Here below a code sample where the session S1 is used during the inventory process: using using using using using System; System.Collections.Generic; System.Linq; System.Text; com.caen.RFIDLibrary; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { CAENRFIDReader MyReader = new CAENRFIDReader(); MyReader.Connect(CAENRFIDPort.CAENRFID_RS232, "COM3"); CAENRFIDLogicalSource MySource = MyReader.GetSource("Source_0"); MySource.SetSession_EPC_C1G2(CAENRFIDLogicalSourceConstants.
Reading and writing Gen2 tags Gen2 tags contains a memory with the following structure: LSB ... MSB 10h TID [15:00] 1Fh 00h TID [31:16] 0Fh MSB USER Bank 10 TID LSB EPC [15:0] ... Bank 11 Bank 01 20h EPC [N:N-15] 2Fh 10h PC [15:00] 1Fh 00h CRC-16 [15:00] 0Fh EPC Bank 00 LSB ...
Here below a code sample of reading/writing data from/to the user memory: using using using using using System; System.Collections.Generic; System.Linq; System.Text; com.caen.RFIDLibrary; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { CAENRFIDReader MyReader = new CAENRFIDReader(); MyReader.Connect(CAENRFIDPort.CAENRFID_RS232, "COM3"); CAENRFIDLogicalSource MySource = MyReader.GetSource("Source_0"); CAENRFIDTag[] MyTags = MySource.InventoryTag(); if (MyTags.
Locking Gen2 tags The EPCGlobal Class1 Gen2 protocol provides a mechanism to lock temporarily or permanently blocks of tag's memory. The user can lock an entire memory bank with the only exception of the Reserved memory bank where it is allowed to lock independently the Access Password and the Kill Password.
Here below a code example of the LockTag_EPC_C1G2 method utilization. using using using using using System; System.Collections.Generic; System.Linq; System.Text; com.caen.RFIDLibrary; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { CAENRFIDReader MyReader = new CAENRFIDReader(); MyReader.Connect(CAENRFIDPort.CAENRFID_RS232, "COM3"); CAENRFIDLogicalSource MySource = MyReader.GetSource("Source_0"); CAENRFIDTag[] MyTags = MySource.InventoryTag(); if (MyTags.
Handling General purpose Inputs/Ouputs (GPIOs) Almost all CAEN RFID readers are provided along with some programmable GPIOs (for further details on GPIOs for a specific CAEN reader please refer to the correspondent reader's manual). On each GPIO you can perform two basic operations: Selects its direction (INPUT, OUTPUT). Sets its value (HIGH, LOW). GPIO direction can be set and read by means of a 4 byte long bitmask used in conjunction with the GetIODirection and SetIODirection methods.