com.connecterra.alepc.api
Interface PCSpec


public interface PCSpec

A specification of an EPC Programming Cycle. A PCSpec is processed in one of two modes. In the legacy mode, provided for backwards compatibility with pre-2.0 Edge Servers, the PCSpec contains no AccessSpecs and acts on a single tag in field, performing no function other than to program a single tag's EPC field. In gen2 mode (named for the EPC Class 1 Generation 2 tags that it was primarily developed to support), the PCSpec contains AccessSpec objects that describe a series of actions to be performed on each tag in field. A gen2-mode PCSpec can be restricted to act only if a single tag is in the field by setting the isRestrictSingleTag flag. Some fields of the PCSpec are relevant only to one mode or the other - these are called out in their respective Javadocs.

See Also:
The RFTagAware Programmer Guide

Method Summary
 void addAccessSpec(AccessSpec accessSpec)
          Add an access spec to the end of the list of access specs to be performed by this PCSpec.
 void addLogicalReaderName(java.lang.String name)
          Adds one name to the list of logical reader names which will be used as a part of this PCSpec.
 void addLogicalReaderNames(java.util.List names)
          Appends a list of names to the list of logical reader names which will be used as a part of this PCSpec.
 void addReaderParameters(java.util.Map params)
          Adds the supplied mappings between reader parameter names and reader parameter values to this PCSpec's current mapping.
 java.util.List getAccessSpecs()
          Return the list of access specs associated with this PCSpec.
 java.lang.String getApplicationData()
          Gets the application data String which will be returned in PCWriteReport instances.
 java.lang.String getCacheName()
          Returns the name of the EPC cache from which this programming cycle obtains EPC values for programming operations.
 long getDuration()
          Returns the maximum amount of time to run EPC writing trials before failing a programming cycle.
 java.util.List getLogicalReaderNames()
          Returns the list of logical reader names which will be used as a part of this PCSpec.
 java.lang.String getReaderParameter(java.lang.String paramName)
          Gets a parameter data value for the indicated parameter name.
 java.util.Map getReaderParameters()
          Returns a map whose key is the name of a reader parameter, and whose value is the reader parameter value.
 java.net.URI getStartTrigger()
          Gets the start trigger which will begin a programming cycle.
 java.net.URI getStopTrigger()
          Gets the stop trigger which will abort a programming cycle.
 int getTrials()
          Gets the maximum number of EPC writing trials to run before failing a programming cycle.
 boolean isRestrictSingleTag()
          Returns true if this PCSpec should fail if multiple tags are in the field.
 void setAccessSpecs(java.util.List accessSpecs)
          Set the list of access specs associated with this PCSpec.
 void setApplicationData(java.lang.String value)
          Sets the application data String which will be returned in PCWriteReport instances.
 void setCacheName(java.lang.String cacheName)
          Specifies the name of an EPC cache from which this programming cycle obtains EPC values for programming operations.
 void setDuration(long maxDurationMS)
          Sets the maximum amount of time to run EPC writing trials before failing a programming cycle.
 void setLogicalReaderNames(java.util.List names)
          Sets the list of logical reader names which will be used as a part of this PCSpec.
 void setReaderParameter(java.lang.String paramName, java.lang.String paramValue)
          Sets a parameter data value for the indicated parameter name.
 void setReaderParameters(java.util.Map params)
          Sets the mapping between reader parameter names and reader parameter values.
 void setRestrictSingleTag(boolean restrictSingleTag)
          Sets the flag whether this PCSpec should fail if multiple tags are in the field.
 void setStartTrigger(java.net.URI trigger)
          Sets the start trigger which will begin a programming cycle.
 void setStopTrigger(java.net.URI trigger)
          Sets the stop trigger which will abort a programming cycle.
 void setTrials(int maxTrials)
          Sets the maximum number of EPC writing trials to run before failing a programming cycle.
 

Method Detail

getCacheName

public java.lang.String getCacheName()
Returns the name of the EPC cache from which this programming cycle obtains EPC values for programming operations.

This is only used in legacy PCSpecs.


setCacheName

public void setCacheName(java.lang.String cacheName)
Specifies the name of an EPC cache from which this programming cycle obtains EPC values for programming operations. This is only used in legacy PCSpecs.

Parameters:
cacheName - Specifies an EPC cache. May be null, in which case EPC values must be supplied to poll() or immediate() operations.

getApplicationData

public java.lang.String getApplicationData()
Gets the application data String which will be returned in PCWriteReport instances.


setApplicationData

public void setApplicationData(java.lang.String value)
Sets the application data String which will be returned in PCWriteReport instances.


getLogicalReaderNames

public java.util.List getLogicalReaderNames()
Returns the list of logical reader names which will be used as a part of this PCSpec. The order of the reader names is the order they were first added to the PCSpec.

If a programming cycle specification lists multiple logical readers, then when a programming cycle is started, each write-capable logical reader will be used, in order, to attempt to write the tag. If a logical reader successfuly writes the tag, then the programming cycle ends and no further logical readers are tried. The process of trying the listed logical readers in turn is called a 'EPC writing trial'. See setTrials(int).

Returns:
a List of String objects containing reader names.

setLogicalReaderNames

public void setLogicalReaderNames(java.util.List names)
Sets the list of logical reader names which will be used as a part of this PCSpec. Any previous list is replaced.

Parameters:
names - a List of String objects containing reader names.

addLogicalReaderName

public void addLogicalReaderName(java.lang.String name)
Adds one name to the list of logical reader names which will be used as a part of this PCSpec. If the name is already present, this method has no effect.


addLogicalReaderNames

public void addLogicalReaderNames(java.util.List names)
Appends a list of names to the list of logical reader names which will be used as a part of this PCSpec. Names already in the list are ignored.

Parameters:
names - a List of String objects containing reader names.

getReaderParameter

public java.lang.String getReaderParameter(java.lang.String paramName)
Gets a parameter data value for the indicated parameter name. Each reader driver defines the parameter name(s), if any, under which they look for parameter data from the PCSpec.

In gen2-mode PCSpecs, reader parameters are also used to perform substitutions in AccessSpecs. See the various AccessSpec elements that perform such substitutions for more details (most notably, #ParamDataSpec).

Parameters:
paramName - Identifies the reader driver parameter to be read.
Returns:
The reader driver parameter value. Returns null if the named parameter has not been set.

setReaderParameter

public void setReaderParameter(java.lang.String paramName,
                               java.lang.String paramValue)
Sets a parameter data value for the indicated parameter name.

Parameters:
paramName - Identifies the reader driver parameter to be set. If an already set parameter is named, its value will be replaced.
paramValue - Supplies the value to be associated with the parameter name. May be null, in which case the parameter value is deleted (in which case getReaderParameter(java.lang.String) will return null).
See Also:
getReaderParameter(java.lang.String)

getReaderParameters

public java.util.Map getReaderParameters()
Returns a map whose key is the name of a reader parameter, and whose value is the reader parameter value.

See Also:
getReaderParameter(java.lang.String)

setReaderParameters

public void setReaderParameters(java.util.Map params)
Sets the mapping between reader parameter names and reader parameter values.

Parameters:
params - A Map whose keys and values are all Strings.
See Also:
setReaderParameter(java.lang.String, java.lang.String)

addReaderParameters

public void addReaderParameters(java.util.Map params)
Adds the supplied mappings between reader parameter names and reader parameter values to this PCSpec's current mapping. Like-named mappings are replaced.

See Also:
setReaderParameter(java.lang.String, java.lang.String)

getStartTrigger

public java.net.URI getStartTrigger()
Gets the start trigger which will begin a programming cycle.

Returns:
The URI for the trigger, or null if there is none.

setStartTrigger

public void setStartTrigger(java.net.URI trigger)
Sets the start trigger which will begin a programming cycle.

Parameters:
trigger - The URI for the trigger, or null to remove the trigger.

getStopTrigger

public java.net.URI getStopTrigger()
Gets the stop trigger which will abort a programming cycle.

Returns:
The URI for the trigger, or null if there is none.

setStopTrigger

public void setStopTrigger(java.net.URI trigger)
Sets the stop trigger which will abort a programming cycle.

Parameters:
trigger - The URI for the trigger, or null to remove the trigger.

getTrials

public int getTrials()
Gets the maximum number of EPC writing trials to run before failing a programming cycle. Each EPC writing trial consists of an attempt to write the tag using each of this spec's logical readers in turn; a trial ends when all readers have been tried or when a reader succeeds in writing the tag, whichever comes first.

Returns:
The maximum number of trials to run. 0 means no limit.

setTrials

public void setTrials(int maxTrials)
Sets the maximum number of EPC writing trials to run before failing a programming cycle.

Parameters:
maxTrials - The maximum number of trials to run. 0 means no limit.
See Also:
getTrials()

getDuration

public long getDuration()
Returns the maximum amount of time to run EPC writing trials before failing a programming cycle.

Returns:
The maximum amount of time to run trials, in milliseconds. 0 means no limit.
See Also:
getTrials()

setDuration

public void setDuration(long maxDurationMS)
Sets the maximum amount of time to run EPC writing trials before failing a programming cycle.

Parameters:
maxDurationMS - The maximum amount of time to run trials, in milliseconds. 0 means no limit.

getAccessSpecs

public java.util.List getAccessSpecs()
Return the list of access specs associated with this PCSpec. Each access spec contains a list of Gen2 operations to perform on a Gen2 tag.

Returns:
the list of access specs.

setAccessSpecs

public void setAccessSpecs(java.util.List accessSpecs)
Set the list of access specs associated with this PCSpec. An access spec contains a list of operations to perform on a tag.

If this list is present in a PCSpec, the PCSpec is a gen2 PCSpec.


addAccessSpec

public void addAccessSpec(AccessSpec accessSpec)
Add an access spec to the end of the list of access specs to be performed by this PCSpec. See setAccessSpecs for more information.

Parameters:
accessSpec - the access spec to add to the end of the PCSpec's list of AccessSpecs

isRestrictSingleTag

public boolean isRestrictSingleTag()
Returns true if this PCSpec should fail if multiple tags are in the field.

This value is ignored in legacy mode PCSpecs.

Returns:
true if this PCSpec is set to fail if multiple tags are in the field.

setRestrictSingleTag

public void setRestrictSingleTag(boolean restrictSingleTag)
Sets the flag whether this PCSpec should fail if multiple tags are in the field.

This value is ignored in legacy mode PCSpecs.

Parameters:
restrictSingleTag - true if this PCSpec should fail if multiple tags are detected in the field before starting processing