Difference between revisions of "Rifidi Services Jumpstart"

From RifidiWiki

Jump to: navigation, search
Line 15: Line 15:
 
==UniqueTagBatchIntervalService==
 
==UniqueTagBatchIntervalService==
 
This service will notify you at given intervals of all tags currently seen at the given readzones.
 
This service will notify you at given intervals of all tags currently seen at the given readzones.
 +
 +
=How to use a Service=
 +
For an example of how to use a service, refer to the Northwind application referred to in the [[Developer's Guide]]. 
 +
 +
Here is a list of all the steps you will need to get an instance of the ReadZoneMonitoringService running.  All other services will be set up in a way that is very similar to this.  The code examples used are taken from the Northwind example. 
 +
 +
1. Get a reference the service in your spring.xml file:
 +
 +
<pre>
 +
<osgi:reference id="readZoneMonitoringService" interface="org.rifidi.edge.api.service.tagmonitor.ReadZoneMonitoringService" />
 +
</pre>
 +
 +
Then inject it into your application (second to last line):
 +
 +
<pre>
 +
<bean id="Northwind" class="org.rifidi.edge.northwind.NorthwindApp">
 +
<constructor-arg index="0" value="Northwind" />
 +
<constructor-arg index="1" value="Shipping" />
 +
<property name="stableSetService" ref="stableSetService" />
 +
<property name="readZoneMonitoringService" ref="readZoneMonitoringService" />
 +
</bean>
 +
</pre>
 +
 +
The "name" attribute is the name of the method spring will look for to inject the property into in your application class.

Revision as of 19:14, 4 April 2012

Services

There are a variety of services available to anyone who wishes to write a RifidiApp. These services can help you more easily perform tasks that would normally require you to write custom esper within your app itself. The services can't handle every scenario, but they do give you an option to use if your particular use case can make use of them.

This list is NOT meant to fully document these services, but rather to provide a quick reference for you to check when you are designing your app. More complete documentation can be found in the edge developer document, the most recent Javadocs, and the Northwind sample app.

ReadZoneMonitorService

Monitors a ReadZone or group of ReadZones and reports when a tag enters or leaves a reader or antenna in the readzone. Passing in an empty list for the ReadZones argument will monitor all readers. Passing in "true" for the "wholereader" argument will treat the entire list of readers and antennas passed in as a monolithic entity, only giving you a departed event if the tag leaves the entire entity rather than updating you of any internal movement of the tag within the readzone.

StableSetService

The StableSetService returns a list of tags representing a "group" after an allotted time has passed with no new tags arriving. For instance, if you place 30 tags in the readzone of the reader, assuming all tags can be read correctly it will return a list of 30 tags assuming no new tags are seen for the duration given.

LimitStableSetService

Exactly the same as the StableSetService, however you can also place a limit on the number of tags that can show up before it automatically returns. If the tag limit is hit before the time duration of the StableSet runs out it will automatically return with all seen tags.

UniqueTagBatchIntervalService

This service will notify you at given intervals of all tags currently seen at the given readzones.

How to use a Service

For an example of how to use a service, refer to the Northwind application referred to in the Developer's Guide.

Here is a list of all the steps you will need to get an instance of the ReadZoneMonitoringService running. All other services will be set up in a way that is very similar to this. The code examples used are taken from the Northwind example.

1. Get a reference the service in your spring.xml file:

<osgi:reference id="readZoneMonitoringService" interface="org.rifidi.edge.api.service.tagmonitor.ReadZoneMonitoringService" />

Then inject it into your application (second to last line):

<bean id="Northwind" class="org.rifidi.edge.northwind.NorthwindApp">
	<constructor-arg index="0" value="Northwind" />
	<constructor-arg index="1" value="Shipping" />
	<property name="stableSetService" ref="stableSetService" />
	<property name="readZoneMonitoringService" ref="readZoneMonitoringService" />
</bean>

The "name" attribute is the name of the method spring will look for to inject the property into in your application class.

Personal tools