Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Get Started with RFID Development in Java : Page 5

Using RFID Anywhere, you can build a highly customized Radio Frequency Identification (RFID) application or service that meets your specific needs.


advertisement
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 <DEMO_OUTPUT_PATH> 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.



Jeff Hanson has more than 18 years of experience in the software industry. He has worked as senior engineer for the Windows OpenDoc port and as lead architect for the Route 66 framework at Novell. He is currently Chief Architect for eReinsure, which specializes in providing frameworks and platforms for J2EE-based reinsurance systems. Jeff has also authored numerous articles and books.
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap