Get Started with RFID Development in Java

ybase iAnywhere’s RFID Anywhere is a middleware software platform built on the .NET platform that simplifies every phase of radio frequency identification (RFID) projects, including development, deployment, and ultimately the management of highly distributed, multi-site networks. RFID Anywhere manages the interfaces with RFID readers and printers, as well as bar code equipment, sensors, and controllers. As a result, developers can focus on writing business logic, not low-level device or network interfaces.

It provides a service-oriented architecture where multiple applications can consume processed data, letting organizations get the most out of RFID investments by allowing them to leverage the same RFID hardware to fuel any number of departmental or enterprise applications.

RFID Anywhere supports a broad array of readers, tag formats, and protocols, and can be deployed to the edge of the network, reducing the flow of data across the network and enabling real-time responses to RFID event data.

RFID Anywhere insulates developers and systems integrators from the wide variety of low-level hardware interfaces, industry standards, and protocols in the RFID space. Processed data can easily be integrated into enterprise applications through a variety of transports. Its plug-and-play architecture not only provides support for current hardware, standards, and protocols, but makes it easy to support new standards when they emerge without requiring a new product release or complete reinstall.

Developers and systems integrators will benefit from included tools, centralized network management, and easy to use interfaces, allowing for easy development and maintenance of powerful RFID solutions.

Obtaining RFID Anywhere
You can purchase RFID Anywhere at. http://eshop.sybase.com/eshop. Alternatively, to receive the developer’s edition of RFID Anywhere, you can register to become an RFID Anywhere Insider. Finally, you can find general information for RFID Anywhere at http://www.ianywhere.com/products/rfid_anywhere.html.

The Sample Application

Because of RFID Anywhere’s simulation environment, you don’t need to have RFID hardware to run the sample application or experiment with RFID technology.

I’ve modified the Enterprise Application used in the Inventory Tracker demo supplied with the RFID Anywhere toolkit to provide a demo application for this article. The demo takes advantage of the simulation environment of RFID Anywhere to simulate actual RFID device events, so you don’t need to have RFID hardware to run the demo or experiment with RFID technology.

The Inventory Tracker demo retrieves business-context information from a “secondary” XML file, SecondarySource.xml, which contains mappings of raw tag data to actual manufacturer and product names. The Inventory Tracker demo reads the secondary source file and provides the mapped results to the Enterprise Application in the form of custom XML reports. The Enterprise Application demo listens on port 10001 for these reports to be transmitted via the TCP messaging connector.

Before you build the sample RFID application, though, you should understand what the various RFID Anywhere components are, what they do, and how they work together to provide a complete foundation upon which you can build applications.

RFID Anywhere Components
RFID Anywhere isn’t a single technology, but rather a collection of components that work together to simplify development. This section provides an overview of the various components. Hardware Connectors installed in RFID Anywhere provide the interface to physical hardware devices. Each connector uses native, low-level hardware interfaces to communicate with a specific piece of hardware. Connectors expose configuration properties, send hardware commands, and receive data from these hardware devices. Each specific piece of hardware that RFID Anywhere supports has its own unique connector that can be installed in RFID Anywhere.

Controllers expose the functionality necessary to support a specific family of devices such as RFID readers, bar code scanners, RFID printers, or sensors. The functionality exposed by a given controller is common to all devices in the family of hardware that the controller supports. For example, the RFID reader connector captures and delivers RFID tag events and exposes triggers to allow business logic to control the readers. Business logic running in RFID Anywhere interacts with controllers, allowing a single application to seamlessly aggregate and use data from multiple pieces of hardware.

The RFID Network Simulator takes the place of actual physical devices for developing and testing business logic. By simulating the a series of device events with a definable set of values, formats, and protocols, developers can check special cases and perform load testing without acquiring and installing physical RFID hardware. Using this simulation environment, organizations can perform hardware investigation and decision making in parallel with software and business logic development tasks.

Custom Business Modules are edge-processing components written with the .NET platform. Business modules get built and deployed to RFID Anywhere and perform the following primary tasks:

  • Connecting to controllers to receive events such as RFID tag reads
  • Issuing read triggers to hardware to begin collecting information
  • Responding to hardware events and errors
  • Querying and updating secondary sources such as databases and other applications
  • Sending processed information to enterprise systems through messaging connectors

Report Engine MP provides a development model that allows developers and integrators to process raw RFID data by enabling the simple creation of XML reports based on the activity of tags from multiple protocols. These XML reports can then be fed into other enterprise systems by using RFID Anywhere’s messaging connectors.

While the ALE standard enables the generation of XML reports for tag activity, it is limited in that it can only generate these reports from Electronic Product Code (EPC) tags. RFID Anywhere’s Report Engine MP addresses this by enabling the creation of XML reports based on tag activity for both EPC and International Standards Organization (ISO) tags. The Report Engine MP decodes the tags of various protocols for the creation of consolidated reports.

Application Level Events (ALE) Engine
RFID Anywhere includes an Application Level Events (ALE) engine to provide another means for developers and integrators to process raw RFID data. ALE is a standard defined by EPCGlobal, Inc. that specifies the simple creation of standard XML reports based on the tag activity of EPC tags. You can then feed these XML reports into other enterprise systems using RFID Anywhere’s messaging connectors. Other ALE-driven applications can also define, subscribe to, and receive these XML reports through Web services.

 
Figure 1. ALE Cycles: The figure shows how a physical reader’s read cycles map to application-level events and reports.

ALE exposes data in the form of periodic, XML-based, event cycle reports. An event cycle is simply a series of hardware read cycles; each event cycle message summarizes the tag activity during the read cycles that preceded it. The messages are the smallest unit of interaction between the ALE protocol and other applications.

Figure 1 illustrates how a physical reader’s read cycles map to configured ALE event-cycles and to resulting reports that will be sent to and consumed by an enterprise application. The references to EPC1 through EPC5 represent 5 EPC tags that are read by the physical RFID hardware during each read cycle.

When a report is generated and sent to an enterprise application over one of RFID Anywhere’s messaging connectors, it is up to the application to add additional business value to the data contained in the report.

Understanding the RFID Anywhere ALE implementation
The ALE implementation in RFID Anywhere consists of several key components:

  • The hardware connectors, which communicate with the readers
  • The RFID ALE Protocol business module, which collects raw data from hardware controllers
  • The ALE Event Cycle connectors, which define and validate event cycle messages for the ALE business module
  • Messaging connectors, which deliver messages to enterprise applications for processing

RFID Anywhere also exposes ALE functionality over Web services.

Messaging Connectors
The messaging connectors included with RFID Anywhere abstract low-level aspects of messaging protocols such as TCP and SMTP and enable RFID Anywhere components to send processed information to enterprise systems or other components. RFID Anywhere includes a number of messaging connectors including File Messaging, MSMQ, QAnywhere, SMTP, TCP, UDP, and Web services. These connectors can be added and configured from the Administrator Console.

 
Figure 2. RFID Anywhere Component Relationships: The figure illustrates the relationships between the messaging connectors, enterprise applications and the RFID Anywhere components.

You can use the Administrator Console described in the next section to specify a list of messaging connectors through which to send data to define where reports or business module output should be sent. By doing this, business logic running in RFID Anywhere can communicate with a wide variety of enterprise applications.

Figure 2 points out the main components of the RFID Anywhere framework and the relationships between each. In particular, the figure illustrates the relationships between the messaging connectors, enterprise applications, and the RFID Anywhere components.

Administrator Console
The RFID Anywhere Administrator Console is a Web-based administration tool that you can use to access the components of the RFID Anywhere system and perform the following tasks:

  • Start, edit, restart, stop, and remove instances of local services using the Services Manager
  • View and set host system properties and settings for specific services using the Properties Manager
  • Access the monitoring and provisioning functions of RFID Anywhere
  • Add and manage managed systems in an RFID Anywhere network
  • Add new instances of service types
  • Edit local security and domain security

Installing RFID Anywhere
Perform the following steps to install and run RFID Anywhere 2.0.1 on your computer:

  • Install MSMQ Messaging Service (if it is not already installed).
  • Install Microsoft Internet Information Services (IIS) (if it is not already installed).
  • Install the Microsoft .NET Framework 1.1 SP1 and enable ASP.NET.
  • Install Microsoft Web Services Extensions (WSE) 2.0 SP3 for Microsoft .NET (if it is not already installed).
  • Install RFID Anywhere 2.x core files.
  • Install RFID Anywhere 2.0.1 updates.
  • Ensure that all required Windows services are running. To do that, open the Control Panel by choosing Start > Settings > Control Panel. Double-click Administrative Tools, and double-click Services. Ensure that the following services have a status of Started, and that their Startup Type is set to Automatic:
  • IIS Admin?used to manage the Web site
  • Message Queuing?used internally by RFID Anywhere and by the MSMQ messaging connector
  • World Wide Web Publishing?used to host the Administrator Console and Web services.
  • Start the RFID Anywhere service: From the Start menu, choose Programs > RFID Anywhere > Start Service. The RFID Anywhere Service starts running on the computer. This service is named rnservice and launches the process iAnywhere.RfidNet.RunTime.exe, which is visible from the Windows Task Manager.
RFID Anywhere’s simulation environment uses simulated data to feed raw RFID data to business logic in exactly the same way as raw data coming from a reader.

Building an RFID Demo Application
I’ve modified the Enterprise Application used in the Inventory Tracker demo supplied with the RFID Anywhere toolkit to provide a demo application for this article. The demo uses RFID Anywhere simulation environment to simulate actual RFID device events, so you don’t need to have RFID hardware to run the demo or experiment with RFID technology. But you do need to create a simulated network, as described in the following section.

Creating a Simulated RFID Network
RFID Anywhere’s RFID Network Simulator takes the place of physical devices for developing and testing business logic. By simulating a series of device events with a definable set of values, formats, and protocols, developers can check special cases and perform load testing without acquiring and installing physical RFID hardware.

 
Figure 3. Architecture of RFID Anywhere Application: The figure shows the various components of a completed RFID Anywhere application.

You accomplish all this using the RFID Simulator Data Editor and RFID Multiprotocol Simulator connector?an RFID Anywhere component that uses simulated data to feed raw RFID data into business logic in exactly the same way as raw data coming from a reader. Figure 3 shows the components and interactions found in a typical RFID Anywhere simulated environment:

The Inventory Tracker demo retrieves business-context information from a “secondary” XML file, in this case, a file called SecondarySource.xml, which contains mappings of raw tag data to actual manufacturer and product names. The Inventory Tracker demo reads the secondary source file and provides the mapped results to the Enterprise Application in the form of custom XML reports. The Enterprise Application demo listens on port 10001 for incoming reports transmitted via the TCP messaging connector.

Creating Simulation Data
To get started, you need to create some simulated data. To do that, you enter tag activity-timeline scenario information into the RFID Simulator Data Editor. You save the entered data as .smt files that the RFID Simulator connector can import and use within RFID Anywhere.

  1. To start the RFID Simulator Data Editor, choose Start > Programs > RFID Anywhere > RFID Simulator Data Editor. The RFID Simulator Data Editor should appear (see Figure 4). RFID Anywhere’s simulation environment groups tags according to time, so tags that appear at the same time and remain for the same duration would be part of one group.
  2. First, you’ll create a group of tags for Time 0. From the Session menu, choose New to create a new session. From the Groups menu, choose New and then EPC to create the first group of tags (Time 0 in the tag activity timeline).
  3. Enter T0 in the Name field, and enter 2 in the Quantity field. Select “Enter Tags Manually” in the Creation Mode section. Ensure that the “Increment tags per session” checkbox is cleared.
  4. Choose “EPC_SGTIN96” from the “Type” dropdown list in the Encoding section and choose “SIX” from the “Partition” dropdown list. An SGTIN96-encoded tag has four fields: filter, company prefix, item reference, and serial number. Therefore:
     
    Figure 4. RFID Simulator Data Editor: The figure shows the RFID Simulator Data Editor after defining two tags.
    • In the Value column of the Filter row in the template, enter 1.
    • In the Value column of the CompanyPrefix row, enter 1.
    • In the Value column of the ItemReference row, enter 2.
    • In the Value column of the SerialNumber row, enter 5.
    • In the Increment column of the SerialNumber row, select the checkbox. This indicates that 5 is the starting serial number, and other tags from this template have unique incremented serial numbers. Here, for example, the two tags you’re creating will have serial numbers 5 and 6.
  5. Choose “RFID Anywhere DPP” from the DPP dropdown list to use RFID Anywhere’s default Data Protocol Processor for EPC tags.
  6. Click the “Create Tags” button to generate the tags and add them to the group. Once created, these tags appear in the Tags window on the right side of the RFID Simulator Data Editor (see Figure 4).
  7. Repeat the preceding steps for all desired times.
  8. To add this group of tags to the simulator session, choose Add from the Groups menu. The “Session Items” dialog will appear (see Figure 5).
  9.  
    Figure 5. Session Items Dialog: The figure shows the session item settings for the sample application.
  10. In the “Start Interval” field of the Session Items dialog enter “0:0” to indicate that this group of tags appears immediately when the simulation starts. In the “Life Time” field, enter 0:10 to indicate that this group of tags will remain in the simulated reader’s read zone for 10 seconds. After 10 seconds, the next group of tags in the sequence will appear.
  11. Make sure that RFID Anywhere DPP is selected in the “DPP:” dropdown list.
  12. Make sure that iAnywhere.RfidNet.Rfid.Tags.RFIDTagEPC_Class0 is selected in the “Class to generate:” dropdown list (see Figure 5).
  13. Click OK, and then save your session by choosing Save from the Session menu. Use the resulting dialog to save the file you’ve created with an extension of .smt to a directory of your choosing.
  14. Exit the RFID Simulator Data Editor by selecting Exit from the Session menu.

Configuring the RFID Multiprotocol Connector
Before you begin using the RFID Anywhere simulated environment with the tags you have created, you must create an RFID Multiprotocol Simulator connector. The RFID Multiprotocol Simulator connector simulates the appearance of tags defined using the RFID Simulator Data Editor. The connector feeds simulated RFID data into RFID Anywhere via the RFID Multiprotocol Reader controller, simulating the raw data coming from an RFID reader. The RFID Multiprotocol Simulator connector uses a simulation (.smt) file to simulate RFID tags being brought into and out of the range of a real reader.

To add and configure the RFID MP Simulator connector:

  • Using the Start menu, navigate to “Programs > RFID Anywhere > Administrator Console.” The Administrator Console Login page opens.
  • Enter your credentials, and then click “Log On.” The Administrator Console Home page opens.
  • From the Home page, choose “RFID Multiprotocol Simulator” from the Service Type dropdown list, and then click Add. That adds the RFID Multiprotocol Simulator connector to the list of local services and highlights it. The default name for new connectors follows the pattern RfidMPSimulator1, RfidMPSimulator2, etc.

To edit the properties of this new connector:

  1. Select the checkbox beside it and then click Edit. The properties for the connector appear in the Properties Manager, to the right of the Local Services list.
  2. Expand the Antenna1 set of properties by clicking the plus (+) symbol beside “Antenna1.” Expand the Smoothing set of properties in the same manner.
  3. In the textbox for the Glimpsed Timeout property, type “100ms” (milliseconds).
  4. Repeat the two preceding steps for the Lost Timeout, Observed Threshold, and Observed Timeout properties.
  5. In the textbox for the Cycles per Trigger property, type 1.
  6. In the dropdown list for the Read on Start property, choose True.
  7. In the textbox type a name for the simulator.
  8. Beside the text field for the Session Data property, click Browse and locate the .smt file you created earlier, clicking Open after you locate and highlight the file.

Finally, click the green disk in the title bar of the Properties Manager to save the changes and update the InvTracSim1 RFID Multiprotocol Simulator connector. Click Refresh to view the updated properties in the Administrator Console.

Adding the TCP Messaging Connector
The TCP messaging connector sends processed information from RFID Anywhere via the TCP communications protocol. The output can be received by any external application listening on the configured port.

To add and configure the TCP messaging connector, follow these steps:

  1. Choose TCP Messaging from the Service Type dropdown list and then click Add. The TCP messaging connector is added to the list of Local Services and is highlighted. The new TCP messaging connector has the default name TcpIpConnector1.
  2. Edit the properties of the new connector by selecting the checkbox beside it and then clicking Edit. The properties for the connector appear on the right side of the window.
  3. In the textbox for the IP Address property, type localhost.
  4. In the textbox for the Name property, type InvTracAleTCP.
  5. In the textbox for the Port property, type 10002.
  6. Click the green disk in the Properties Manager title bar to save the above changes and update the TCP messaging connector.

Adding the ALE Event Cycle connector
The ALE Event Cycle connector adheres to the EPC standard and specifies the correct format in which to report processed information. You can configure the connector to filter and group certain types of tags so that only relevant information gets transported across the network. For example, you can configure the connector to filter out products from certain manufacturers.

To add and configure the ALE Event Cycle connector, follow these steps:

  1. Choose “ALE Event Cycle” from the Service Type dropdown list, and then click Add. A new ALE Event Cycle connector appears in the Local Services list. The new ALE Event Cycle connector has the default name AleECConnector1.
  2. Select the new ALE Event Cycle connector and then click Edit. The Properties Manager for the ALE Event Cycle connector appears to the right.
  3. Expand the Event Cycle set of properties, then expand the Start/Stop conditions set of properties.
  4. In the text field for the Duration (ms) property, type 1000.
  5. Expand the Logical Readers property. In the text field, type Source1 and then click the green plus sign to add the entry.
  6. In the textbox for the Report(s) Definition property, type 1.
  7. Expand the reportSpecs(1) set of properties. In the textbox for the Include Patterns property, enter urn:epc:pat:sgtin-96:1.1.2.*. The Include Patterns property is used to specify the tags that you want to be included in the report. When a value is entered for this property, only the tags that are specified will be reported. For purposes of this article, you only want the “AutoClean 77 Sterilizer” tags. The Exclude Patterns property specifies tags that you want to exclude from the reports. You can use the Grouping Patterns property to group certain tags together. For example you can group tags according to their manufacturers.
  8. In the dropdown list for the reportSpecs(1) > Report If Empty property, choose True. When this property is set to True, the ALE Event Cycle connector sends reports, even if it does not contain any tags; in other words the ALE Event Cycle connector sends empty reports when no tags are in the proximity of the reader antennas.
  9. In the textbox for the reportSpecs(1) > Report Name property, type Source1Filtered.
  10. In the dropdown list for the reportSpecs(1) > EPC to be reported property, choose CURRENT.
  11. In the textbox for the reportSpecs(1) > Name property, type FilteredSource1ALE.
  12. In the dropdown list for the Send Reports as Object property, choose False.
  13. Expand the Subscribers property. In the text box, enter FileOutput and press the green plus sign to add this item to the Subscribers list. Follow the same steps to add InvTracAleTCP and MSMQOutput to the Subscribers list.
  14. Click the green disk in the Properties Manager title bar to save the above changes and update the ALE Event Cycle connector.

The RFID ALE Protocol Business Module
The RFID ALE Protocol business module provides the business logic to link the reader group definition to the reader that’s actually gathering data (the RFID MultiProtocol Simulator in this case). It’s installed automatically in the list of Local Services and has the name ALEServiceModule.

To configure the RFID ALE Protocol business module, follow these steps:

  1. Edit the properties of the RFID ALE protocol by selecting the checkbox beside “ALEServiceModule,” and then clicking Edit. The properties for the business module appear on the right side of the window.
  2. In the textbox for the Logical Readers property, type Source1:InvTracSim1. This specifies that the RFID ALE Protocol business module should use the Source1 group of readers and connect to the InvTracSim1 RFID Multiprotocol Simulator connector as the raw data source.
  3. Click the green disk in the Properties Manager title bar to save the above changes and update the RFID ALE Protocol business module.

Starting the Connectors
You must start the connectors created in the previous section to begin the simulation. You start the connectors from the Administrator Console by selecting the checkboxes next to the following connectors:

  • FilteredSource1ALE
  • FileOutput
  • InvTracSim1
  • MSMQOutput
  • InvTracAleTCP

Click Start to start the simulation. Started connectors are identified with green arrows after they start. If an error message appears above the list of Local Services, ensure that you have followed the preceding steps correctly and have not made any spelling errors

Using TCP/IP to Receive Reports
The TCP/IP tab of the RFID Anywhere ALE Report Viewer lets you connect to a TCP messaging connector and receive ALE messages and reports.

To receive messages using the TCP messaging connector, follow these steps:

  1. Select FilteredSource1ALE, InvTracAleTCP, and InvTracSim1, and then click Restart. The ALE event cycle, the TCP messaging connector, and the RFID MultiProtocol simulator connectors restart.
  2. Open the RFID Anywhere ALE Report Viewer if it is not already open.
  3. Click the TCP/IP tab. The TCP/IP pane appears. From here, you can connect to the TCP/IP messaging connector to receive ALE reports.
  4. Set the value for Server Port to 10002. The value for the Server Port should be the same as the Port property of InvTracAleTCP.
  5. Click Clear if output is already available in the RFID Anywhere ALE Report Viewer display.
  6. Click Start to start the receiving process. The processed information appears in the form of reports.
  7. Once you begin receiving reports, click Stop. In the Administrator Console, select FilteredSource1ALE, InvTracAleTCP, and InvTracSim1, and then click Stop. The ALE event cycle, the TCP messaging connector, and the RFID MP Simulator connectors stop.

Figure 6 shows a typical Administrator Console home page.

 
Figure 6. Typical Admin Home Page: The figure shows a typical RFID Anywhere Admin home page.

Analyzing the ALE Demo Source Code
The core functionality for the ALE listener is embodied in the run method of the RFID_ALE_Demo class. As shown in Listing 1, this method opens a server socket and listens for client-connection requests from the TCP messaging connector. When it receives a client-connection request, the run method reads the XML data from the client socket, passing it to the XMLAssetManager class, which processes it for display.

The XMLAssetManager Class
The XMLAssetManager class extends the org.xml.sax.helpers.DefaultHandler class to receive SAX events as an XML document is parsed. When the RFID_ALE_Demo class receives XML data from the TCP messaging connector, it passes the XML data to an instance of the org.xml.sax.XMLReader class for parsing. An instance of the XMLAssetManager class acts as the content and error handler for the SAX reader; in other words, it receives all the SAX events fired by the SAX reader as it processes the document.

When the XMLAssetManager instance receives data of interest to the main application, it calls the appropriate methods on the main application, which will, in turn, update the display with the new data. You can see these steps in detail in Listing 2.

Running the ALE Demo Application
To run the ALE demo application, launch a command window and type:

 
Figure 7. The Demo Application: The figure shows the running demo application after receiving some tag messages.
   java         com.jeffhanson.apps.rfid.RFID_ALE_Demo

After the demo application is running, it should start receiving messages from the TCP messaging connector. Figure 7 shows the running demo app after receiving some messages.

RFID Anywhere is a middleware software platform that simplifies every phase of RFID projects by exposing abstractions on top of lower-layer components such as readers, tags, the RFID network, etc. RFID Anywhere manages the interfaces with RFID readers and printers, as well as bar code equipment, sensors, and controllers. As a result, developers can focus on writing business logic, not low-level device or network interfaces. In addition, the product supports simulated development, actual deployment, and management of highly distributed, multi-site networks.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS