com.prosysopc.ua.server
Class MonitoredDataItem

java.lang.Object
  extended by com.prosysopc.ua.MonitoredItemBase
      extended by com.prosysopc.ua.server.MonitoredItem
          extended by com.prosysopc.ua.server.MonitoredDataItem

public class MonitoredDataItem
extends MonitoredItem


Nested Class Summary
protected  class MonitoredDataItem.AggregateFilterConfiguration
           
 
Field Summary
protected  MonitoredDataItem.AggregateFilterConfiguration aggregateFilter
           
protected  DataChangeListener dataChangeListener
           
 
Fields inherited from class com.prosysopc.ua.server.MonitoredItem
links, node, subscription
 
Fields inherited from class com.prosysopc.ua.MonitoredItemBase
attributeId, clientHandle, dataEncoding, discardOldest, maxQueueSize, monitoredItemId, monitoringMode, nodeId, queueSize
 
Constructor Summary
MonitoredDataItem(ServiceContext serviceContext, Subscription subscription, org.opcfoundation.ua.builtintypes.UnsignedInteger nextMonitoredItemId, org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId, org.opcfoundation.ua.utils.NumericRange indexRange, org.opcfoundation.ua.core.MonitoringMode monitoringMode)
           
 
Method Summary
protected  void addNewSample(org.opcfoundation.ua.builtintypes.DataValue value, boolean mayReplaceLastSample)
           
protected  org.opcfoundation.ua.builtintypes.DataValue applyIndexRange(org.opcfoundation.ua.builtintypes.DataValue value)
           
protected  void assignEuRange(org.opcfoundation.ua.builtintypes.DataValue dataValue)
           
protected  boolean checkDeadband(org.opcfoundation.ua.builtintypes.DataValue lastValue, org.opcfoundation.ua.builtintypes.DataValue value, org.opcfoundation.ua.core.DeadbandType deadbandType)
           
protected  boolean checkDeadband(org.opcfoundation.ua.core.DeadbandType deadbandType, Object lastValue, Object value)
           
protected  void clearQueue()
           
 org.opcfoundation.ua.core.AggregateFilter getAggregateFilter()
           
protected  MonitoredDataItem.AggregateFilterConfiguration getAggregateFilterConfiguration()
           
 org.opcfoundation.ua.core.DataChangeFilter getDataChangeFilter()
           
 org.opcfoundation.ua.core.DataChangeTrigger getDataChangeTrigger()
           
 org.opcfoundation.ua.core.DeadbandType getDeadbandType()
          DeadbandType defines how the getDeadbandValue() should be used.
 double getDeadbandValue()
          Deadband defines the minimum change that is required for the monitored value before a data change notifications should be sent to the client.
protected  long getDefaultQueueSize()
           
 org.opcfoundation.ua.core.Range getEuRange()
          The range defined for the monitoredItem
 UaProperty getEuRangeProperty()
          The property that defines the EuRange
 org.opcfoundation.ua.utils.NumericRange getIndexRange()
          The range of array indexes to monitor with the monitored item.
 org.opcfoundation.ua.builtintypes.DataValue getLastValue()
           
protected  org.opcfoundation.ua.builtintypes.DataValue getNextSample(boolean isTrigger)
           
protected  org.opcfoundation.ua.builtintypes.DataValue getPrevValue()
           
protected  BlockingDeque<org.opcfoundation.ua.builtintypes.DataValue> getQueue()
           
 double getSamplingInterval()
          The SamplingInterval.
protected  double getValueRange()
           
protected  boolean hasAggregateFilter()
           
 boolean hasMoreSamples()
           
protected  boolean isAccessible()
           
protected  boolean mayReplaceLastSample(org.opcfoundation.ua.builtintypes.DataValue value)
          Check if the new sample belongs to the same samplingInterval as lastValue, i.e. timeDiff to prevValue is smaller than samplingInterval.
 void notifyDataChange(org.opcfoundation.ua.builtintypes.DataValue value)
          Report a new data change to the item.
 void notifyDataChange(org.opcfoundation.ua.builtintypes.DataValue value, boolean applyIndexRange)
          Report a new data change to the item.
 void notifyResendData()
           
 void onDataChange(UaNode sender, org.opcfoundation.ua.builtintypes.DataValue prevValue, org.opcfoundation.ua.builtintypes.DataValue value)
          Deprecated. use notifyDataChange(DataValue) instead.
protected  void plugNodeListener()
           
protected  void setDataChangeFilter(org.opcfoundation.ua.core.DataChangeFilter filter)
           
 void setEuRange(org.opcfoundation.ua.core.Range range)
          Define the EuRange corresponding to the monitored item.
 void setEuRangeProperty(UaProperty euRangeProperty)
          The property that defines the EuRange for the monitoredItem.
protected  void setIndexRange(org.opcfoundation.ua.utils.NumericRange indexRange)
           
protected  void setLastValue(org.opcfoundation.ua.builtintypes.DataValue value, boolean updatePrevValue)
           
protected  org.opcfoundation.ua.builtintypes.DataValue setOverflowBit(org.opcfoundation.ua.builtintypes.DataValue value)
           
 void setSamplingInterval(double samplingInterval)
          The interval that defines the fastest rate at which the MonitoredItem(s) should be accessed and evaluated.
protected  void startSampling()
           
protected  void unPlugNodeListener()
           
protected  void updateAccessible(Session session)
           
protected  void updateFilter()
          React to changes in the filter.
protected  void updateQueue()
          Update the queue, when it's size has changed.
 
Methods inherited from class com.prosysopc.ua.server.MonitoredItem
addLink, close, equals, getMaxQueueSize, getNode, getServiceContext, getSubscription, getTimestampsToReturn, hashCode, monitoringModeChanged, removeLink, setClientHandle, setFilter, setFilterResult, setMaxQueueSize, setNode, setServiceContext, setTimestampsToReturn
 
Methods inherited from class com.prosysopc.ua.MonitoredItemBase
getAttributeId, getClientHandle, getDataEncoding, getFilter, getFilterResult, getMonitoredItemId, getMonitoringMode, getNodeId, getQueueSize, isDiscardOldest, setDiscardOldest, setMonitoredItemId, setMonitoringMode, setQueueSize, setQueueSize, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

aggregateFilter

protected MonitoredDataItem.AggregateFilterConfiguration aggregateFilter

dataChangeListener

protected DataChangeListener dataChangeListener
Constructor Detail

MonitoredDataItem

public MonitoredDataItem(ServiceContext serviceContext,
                         Subscription subscription,
                         org.opcfoundation.ua.builtintypes.UnsignedInteger nextMonitoredItemId,
                         org.opcfoundation.ua.builtintypes.NodeId nodeId,
                         org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId,
                         org.opcfoundation.ua.utils.NumericRange indexRange,
                         org.opcfoundation.ua.core.MonitoringMode monitoringMode)
Parameters:
subscription -
nextMonitoredItemId -
nodeId -
attributeId -
indexRange -
monitoringMode -
Method Detail

getAggregateFilter

public org.opcfoundation.ua.core.AggregateFilter getAggregateFilter()
Returns:
the aggregateFilter defined for the monitored item

getDataChangeFilter

public org.opcfoundation.ua.core.DataChangeFilter getDataChangeFilter()
Returns:
the dataChangeFilter defined for the monitored item

getDataChangeTrigger

public org.opcfoundation.ua.core.DataChangeTrigger getDataChangeTrigger()
Returns:
the dataChangeTrigger defined for the monitored item

getDeadbandType

public org.opcfoundation.ua.core.DeadbandType getDeadbandType()
DeadbandType defines how the getDeadbandValue() should be used.

Returns:
the deadbandType
See Also:
getDeadbandValue()

getDeadbandValue

public double getDeadbandValue()
Deadband defines the minimum change that is required for the monitored value before a data change notifications should be sent to the client.

The value is applied depending on the getDeadbandType():

Returns:
the deadbandValue

getEuRange

public org.opcfoundation.ua.core.Range getEuRange()
The range defined for the monitoredItem

Returns:
the euRange
See Also:
setEuRange(Range), setEuRangeProperty(UaProperty)

getEuRangeProperty

public UaProperty getEuRangeProperty()
The property that defines the EuRange

Returns:
the euRangeProperty
See Also:
setEuRange(Range), setEuRangeProperty(UaProperty)

getIndexRange

public org.opcfoundation.ua.utils.NumericRange getIndexRange()
The range of array indexes to monitor with the monitored item.

Overrides:
getIndexRange in class MonitoredItemBase
Returns:
the indexRange

getLastValue

public org.opcfoundation.ua.builtintypes.DataValue getLastValue()

getSamplingInterval

public double getSamplingInterval()
Description copied from class: MonitoredItemBase
The SamplingInterval. This is only used for the monitored data items. For event items it is always 0.

Overrides:
getSamplingInterval in class MonitoredItemBase
Returns:
the requested sampling interval in milliseconds. If negative, then the publishingInterval of the Subscription is used.

hasMoreSamples

public boolean hasMoreSamples()
Returns:
true if the sample queue has more samples that have not been processed.

notifyDataChange

public void notifyDataChange(org.opcfoundation.ua.builtintypes.DataValue value)
Report a new data change to the item.

This method is used for non-UaNode items from your application to report value changes in the monitored item. UaNode-based items will monitor the nodes automatically.

The value will be checked against the filter and deadband defined by the client to determine if it really needs to be sent. getIndexRange() will be applied to the value, if defined.

Parameters:
value - the new value for the item.
See Also:
notifyDataChange(DataValue, boolean)

notifyDataChange

public void notifyDataChange(org.opcfoundation.ua.builtintypes.DataValue value,
                             boolean applyIndexRange)
Report a new data change to the item.

This method is used for non-UaNode items from your application to report value changes in the monitored item. UaNode-based items will monitor the nodes automatically.

The value will be checked against the filter and deadband defined by the client to determine if it really needs to be sent. You can define whether getIndexRange() should be applied to the value.

Parameters:
value - the new value for the item.
applyIndexRange - whether the getIndexRange() defined for the item should be applied to the value. Default is true, but if you have already applied the range before calling this method to notify the change, use false.
See Also:
notifyDataChange(DataValue)

notifyResendData

public void notifyResendData()

onDataChange

@Deprecated
public void onDataChange(UaNode sender,
                                    org.opcfoundation.ua.builtintypes.DataValue prevValue,
                                    org.opcfoundation.ua.builtintypes.DataValue value)
Deprecated. use notifyDataChange(DataValue) instead.

Report a new data change to the item.

This method is used for non-UaNode items from your application to report value changes in the monitored item. UaNode-based items will monitor the nodes automatically.

Parameters:
sender - not used
prevValue - not used
value - the new value for the item.

setEuRange

public void setEuRange(org.opcfoundation.ua.core.Range range)
Define the EuRange corresponding to the monitored item. The range is required to support Deadband of type Deadband.Percent.

You can define the range for each item when they are created, in NodeManager.afterCreateMonitoredDataItem(ServiceContext, Subscription, MonitoredDataItem) or NodeManagerListener.onAfterCreateMonitoredDataItem(ServiceContext, Subscription, MonitoredDataItem) .

If the monitoredItem is linked to an UaVariable (in MonitoredItem.getNode()), the range is looked among the properties of the variable. The property is then assigned to RangeProperty (with setEuRangeProperty(UaProperty).

Instead of Range you may also define RangeProperty, if it is not assigned automatically.

Parameters:
range - the range to set setEuRangeProperty(UaProperty)

setEuRangeProperty

public void setEuRangeProperty(UaProperty euRangeProperty)
The property that defines the EuRange for the monitoredItem. If you define the property, EuRange is assigned from the property value.

Parameters:
euRangeProperty - the euRangeProperty to set
See Also:
setEuRange(Range)

setSamplingInterval

public void setSamplingInterval(double samplingInterval)
The interval that defines the fastest rate at which the MonitoredItem(s) should be accessed and evaluated. This interval is defined in milliseconds.

The value 0 indicates that the Server should use the fastest practical rate.

The value -1 indicates that the default sampling interval defined by the publishing rate of the Subscription is used.

The Server uses this parameter to assign the MonitoredItems to a sampling interval that it supports.

The value can be modified at NodeManager#afterCreateMonitoredDataItem() or NodeManagerListener#onAfterCreateMonitoredDataItem() - and the updated value is returned as a revised value back to the client.

Parameters:
samplingInterval - the interval in milliseconds

addNewSample

protected void addNewSample(org.opcfoundation.ua.builtintypes.DataValue value,
                            boolean mayReplaceLastSample)
Parameters:
value -
mayReplaceLastSample -

applyIndexRange

protected org.opcfoundation.ua.builtintypes.DataValue applyIndexRange(org.opcfoundation.ua.builtintypes.DataValue value)

assignEuRange

protected void assignEuRange(org.opcfoundation.ua.builtintypes.DataValue dataValue)
Parameters:
dataValue -

checkDeadband

protected boolean checkDeadband(org.opcfoundation.ua.builtintypes.DataValue lastValue,
                                org.opcfoundation.ua.builtintypes.DataValue value,
                                org.opcfoundation.ua.core.DeadbandType deadbandType)

checkDeadband

protected boolean checkDeadband(org.opcfoundation.ua.core.DeadbandType deadbandType,
                                Object lastValue,
                                Object value)

clearQueue

protected void clearQueue()

getAggregateFilterConfiguration

protected MonitoredDataItem.AggregateFilterConfiguration getAggregateFilterConfiguration()

getDefaultQueueSize

protected long getDefaultQueueSize()
Specified by:
getDefaultQueueSize in class MonitoredItemBase
Returns:

getNextSample

protected org.opcfoundation.ua.builtintypes.DataValue getNextSample(boolean isTrigger)
Returns:
the next sample in the queue or last sampled value (if no queue)

getPrevValue

protected org.opcfoundation.ua.builtintypes.DataValue getPrevValue()

getQueue

protected BlockingDeque<org.opcfoundation.ua.builtintypes.DataValue> getQueue()

getValueRange

protected double getValueRange()
Returns:

hasAggregateFilter

protected boolean hasAggregateFilter()

isAccessible

protected boolean isAccessible()
Returns:

mayReplaceLastSample

protected boolean mayReplaceLastSample(org.opcfoundation.ua.builtintypes.DataValue value)
Check if the new sample belongs to the same samplingInterval as lastValue, i.e. timeDiff to prevValue is smaller than samplingInterval.

Parameters:
value -
Returns:
true if value may replace lastValue in the sampling queue

plugNodeListener

protected void plugNodeListener()
Overrides:
plugNodeListener in class MonitoredItem

setDataChangeFilter

protected void setDataChangeFilter(org.opcfoundation.ua.core.DataChangeFilter filter)
                            throws ServiceException
Parameters:
filter -
Throws:
StatusException
ServiceException

setIndexRange

protected void setIndexRange(org.opcfoundation.ua.utils.NumericRange indexRange)
Parameters:
indexRange -

setLastValue

protected void setLastValue(org.opcfoundation.ua.builtintypes.DataValue value,
                            boolean updatePrevValue)
Parameters:
value -
updatePrevValue -

setOverflowBit

protected org.opcfoundation.ua.builtintypes.DataValue setOverflowBit(org.opcfoundation.ua.builtintypes.DataValue value)
Parameters:
value -
Returns:

startSampling

protected void startSampling()

unPlugNodeListener

protected void unPlugNodeListener()
Overrides:
unPlugNodeListener in class MonitoredItem

updateAccessible

protected void updateAccessible(Session session)

updateFilter

protected void updateFilter()
Description copied from class: MonitoredItemBase
React to changes in the filter.

Overrides:
updateFilter in class MonitoredItemBase

updateQueue

protected void updateQueue()
Update the queue, when it's size has changed.

Overrides:
updateQueue in class MonitoredItemBase


Copyright © 2018. All rights reserved.