On 02/17/2018 09:52 AM, Williams Jr.,
Ernest L. wrote:
I had added filter plugin support to the pvCopy facility that comes
with pvData.
This was implemented in both pvDataCPP and pvDataJava as part of the
pvCopy facility.
That means that any channel provider that uses pvCopy would
automatically have filter plugin support.
But it was decided that this should not be part of epics7 so I
backed out the support.
Here is a condensed description of the support
Field Plugin Filters
pvCopy, which was described above, implements
plugin filters that can optionally be attached to fields accessed
via pvCopy. Thus, if a channel provider uses pvCopy, it
automatically has plugin filter support.
pvCopy itself provides the following
plugins: array, deadband, timestamp,
and ignore. Other plugins can also be
implemented and registered.
The following interfaces are used for implementing
plugin filters: PVPlugin, PVFilter,
and PVPluginRegistry.
PVPlugin
Method create is called
when an instance of pvCopy is created by a channel provider.
interface PVPlugin {
PVFilter create(String requestValue,PVCopy pvCopy,PVField master);
}
where
- requestValue
- The value part of a name=value request option.
- pvCopy
- The PVCopy to which the PVFilter will be attached.
- master
- The field in the master PVStructure to which the PVFilter will
be attached.
Returns the PVFilter. A null is returned if master or
requestValue is not appropriate for the plugin.
PVFilter
The method filter is
called whenever pvCopy is used to access a field of the client
PVStructure.
interface PVFilter {
boolean filter(PVField copy,BitSet bitSet,boolean toCopy);
String getName();
}
where
- copy
- The data for copy.
- bitSet
- The BitSet for copy.
- toCopy
- (true,false) means copy (from master to copy,from copy to
master)
Returns (true,false) if filter modified destination.
PVPluginRegistry
class PVPluginRegistry {
static void registerPlugin(String name,PVPlugin pvPlugin);
static PVPlugin find(String name);
}
The arguments
are:
- name
- The name part of a name=value request option.
- pvPlugin
- The plugin implementation.
The return value for find is
the plugin implementation or null if no plugin with that name has
been registered.
Array Plugin
This filter is used to retrieve parts of an array
(subarrays and strided subarrays). It is modeled after the array
Filter that is provided with epics base starting with the 3.15
releases.
This filter works for both get and put. It works for any
scalarArray field. It has not been tested for structureArray or
unionArray fields.
The syntax is one of the following:
[array=start]
[array=start:end]
[array=start:increment:end]
start and end both
specify an index. increment must
be a positive integer.
start and end can
be a positive or negative integer. If negative it is relative to
the end of the array with -1 meaning the last element.
Suppose that the master array is:
1,2,3,4,5,6,7,8,9,10
Then the get request
[array=0:4]
gets
1,2,3,4,5
The request:
[array=-3:-1]
gets
8,9,10
The request:
[array=2:5]
gets
3,4,5,6
The request:
[array=0:2:-1]
gets
0,2,4,6,8,10
Deadband Plugin
This filter is used to limit the changes to a numeric
scalar field that are reported to a client. It is modeled after
the deadband Filter that is provided with epics base starting with
the 3.15 releases.
This filter only works for numeric scalar fields and
only for toCopy.
The syntax is one of the following:
[deadband=abs:value]
[deadband=rel:value]
where
- abs
- The value must change by at least this amount since the last
value the client received.
- rel
- The percentage amount the value must change since the last
value the client received.
TimeStamp Plugin
This filter is used for accessing a timeStamp field. It
is modeled after the timeStamp Filter that is provided with epics
base starting with the 3.15 releases.
This filter only works for a timeStamp field.
The syntax is one of the following:
[timestamp=current]
[timestamp=copy]
where
- current
- Only works for toCopy=true. Instead of taking the timestamp
from master the timeStamp for the client is set to the current
time.
- copy
- Only works for toCopy=false. The timestamp in master is set
equal to the timeStamp from the client.
Ignore Plugin
This is not an actual plugin but is handled by pvCopy
itself. It is used to suppress sending data to a client unless
other fields have changed.
The syntax is:
[ignore=true]
One of the
examples shown at the beginning of this section shows how it can
be used.
Marty
epics.anl.gov
Channel Filters. Channel Filters can be applied to
Channel Access channels by a client, using a JSON
Field Modifier to select the filter and any
parameters.
|
Cheers,
Ernest