ReadCycle Class Hierarchy

From RifidiWiki

Jump to: navigation, search

The sensors plugins in the Sensor Abstraction Layer produce ReadCycle objects that are put into Esper. Because you query objects (rather than tables) in Esper, you need to know the class hierarchy of ReadCycle in order to write queries.

ReadCycle.png

Built-in Hierarchy

This section details the current classes that hold data gathered from sensors which can be queried in Esper.

ReadCycle

A ReadCycle represents one cycle of interaction with a sensor. It can contain 0 to many TagReadEvent objects. A cycle of interaction might entail polling the sensor for data or perhaps the sensor is pushing data to the edge server. It is also important to realize that since the Edge Server supports the concept of logical readers, a single ReadCycle might contain tag reads from multiple physical readers.

TagReadEvent

A TagReadEvent represents a single tag read from an RFID reader. The TagReadEvent object is a wrapper around a DataContainerEvent in order to provide information about the tag that is not written on the tag itself. For example, suppose you are interested in knowing the antenna that saw the tag. The antenna number is not information that is stored in the tag's memory bank. You can instead put this kind of information in the TagReadEvent object.

DatacontainerEvent

The DatacontainerEvent is an abstract class that represents information (such as the EPC) that is stored on the tag. This class is meant to be extended to support many kinds of tag types.

EpcGeneration1Event

The EPCGeneration1Event represents the information read from an EPC Gen1 tag.

EpcGeneration2Event

The EPCGeneration2Event extends the EPCGeneration1Event and represents the information read from an EPC Gen2 tag.

Extending the Hierarchy

The current hierarchy is flexible and can be extended to meet the various of different kinds of applications. The two places that extensions are forseen are TagReadEvent and DatacontainerEvent

Extending TagReadEvent

You might want to extend TagReadEvent if, for example, you are interested in data about a tag that is collected when the tag is read. For example, suppose the reader you are working with can give you the speed the tag is moving. The speed is not information that is stored on the tag, so it should go in The TagReadEvent. You can extend the TagReadEvent object to include a setSpeed() and getSpeed() methods. Now when you collect the data from the RFID reader in the Sensor Layer, you can store the speed data in your new TagReadEvent class.

Furthermore, you can query the data in your esper statements. For example, you can ask for all tags where the speed of the tag is greater than 4 m/s like this:

Select * from ReadCycle[select * from tags(cast(speed?,Integer) > 4)]

Extending DatacontainerEvent

You would extend the DatacontainerEvent when the tag you are using in your RFID system is not an EPC Gen1 or Gen2 tag. For example, if you are using active tags which do not follow the EPC Gen2 specification, then you will want to make up a new Class that represents the kind of tags you are using.

Adding new Event Types in Esper

If you need to query the new event types that you created by extending the other classes, you will need to add those event types to Esper with code like this:

esperService.getProvider().getEPAdministrator().getConfiguration.addEventType("MyNewEvent",MyNewEvent.class);
Personal tools