tuwien.auto.calimero.buffer
Class StateFilter

java.lang.Object
  extended by tuwien.auto.calimero.buffer.StateFilter
All Implemented Interfaces:
Configuration.NetworkFilter, Configuration.RequestFilter

public class StateFilter
extends java.lang.Object
implements Configuration.NetworkFilter, Configuration.RequestFilter

Predefined filter for filtering KNX messages of datapoints with state semantic into the associated network buffer configuration.

This filter might be used in a configuration to build up and maintain a process image of the KNX network the used network link communicates with. The buffer will keep the most up to date state to a KNX group address / datapoint.
KNX messages are buffered using a LDataObject (an object of this type is also expected when the request method is invoked).

If a datapoint model is available in the Configuration, the filter uses that model in its init(Configuration) method. It initializes its local lookup references with necessary updating / invalidating information of other datapoints stored in that model. Thus, the filter will update or invalidate all other associated datapoint state values in the network buffer configuration when receiving a new KNX message.
To reflect subsequent changes of the datapoint model in the filter, the filter has to be reinitialized (using init(Configuration).


Constructor Summary
StateFilter()
          Creates a new state based filter.
 
Method Summary
 void accept(CEMI frame, Configuration c)
          Applies state based filter rules on frame.
 void init(Configuration c)
          Does all necessary filter initializations.
 CEMILData request(KNXAddress dst, Configuration c)
          Requests data for address dst from the network buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StateFilter

public StateFilter()
Creates a new state based filter.

Method Detail

accept

public void accept(CEMI frame,
                   Configuration c)
Applies state based filter rules on frame.

Criteria for accept:

On acceptance, the frame is stored into the configuration cache using a LDataObject. For easier handling of subsequent read requests on such a buffered frame, all frames are converted to L-data indications with application layer group response service code before getting stored.

If update and invalidation information is available, other dependent datapoint state values will be updated or invalidated appropriately.

Specified by:
accept in interface Configuration.NetworkFilter
Parameters:
frame - cEMI frame to accept for buffering
c - the configuration this filter belongs to

init

public void init(Configuration c)
Description copied from interface: Configuration.NetworkFilter
Does all necessary filter initializations.

This method is invoked by the owning configuration.

Specified by:
init in interface Configuration.NetworkFilter
Parameters:
c - the configuration this filter is set for

request

public CEMILData request(KNXAddress dst,
                         Configuration c)
Description copied from interface: Configuration.RequestFilter
Requests data for address dst from the network buffer.

How a buffer is searched and data is matched depends on the individual filter rules. A filter might use provided information of the configuration if necessary.

Specified by:
request in interface Configuration.RequestFilter
Parameters:
dst - address to request data for
c - the configuration this filter belongs to
Returns:
the cEMI data on match in buffer, null otherwise