public class MonitoredDataItem extends MonitoredItem
Use the MonitoredDataItem to add new items to Subscription when you wish to monitor
changes in attribute values - typically in Variable Value attribute.
MonitoredEventItem| Modifier and Type | Field and Description |
|---|---|
protected MonitoredDataItemListener |
dataChangeListener |
loggerattributeId, clientHandle, dataEncoding, discardOldest, maxQueueSize, monitoredItemId, monitoringMode, nodeId, prevMonitoringMode, queueSize| Constructor and Description |
|---|
MonitoredDataItem(ExpandedNodeId expandedNodeId)
Create a new monitored item for data changes.
|
MonitoredDataItem(ExpandedNodeId expandedNodeId,
UnsignedInteger attributeId)
Create a new monitored item for data changes.
|
MonitoredDataItem(ExpandedNodeId expandedNodeId,
UnsignedInteger attributeId,
MonitoringMode monitoringMode)
Create a new monitored item for data changes with sampling interval as -1 (i.e.
|
MonitoredDataItem(ExpandedNodeId expandedNodeId,
UnsignedInteger attributeId,
MonitoringMode monitoringMode,
double samplingInterval)
Create a new monitored item for data changes.
|
MonitoredDataItem(NodeId nodeId)
Create a new monitored item for data changes.
|
MonitoredDataItem(NodeId nodeId,
UnsignedInteger attributeId)
Create a new monitored item for data changes.
|
MonitoredDataItem(NodeId nodeId,
UnsignedInteger attributeId,
MonitoringMode monitoringMode)
Create a new monitored item for data changes with sampling interval as -1 (i.e.
|
MonitoredDataItem(NodeId nodeId,
UnsignedInteger attributeId,
MonitoringMode monitoringMode,
double samplingInterval)
Create a new monitored item for data changes.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
fireDataChange(DataValue prevValue,
DataValue newValue)
Fire the DataChange notification event.
|
DataChangeFilter |
getDataChangeFilter()
Current data change filter.
|
MonitoredDataItemListener |
getDataChangeListener() |
protected long |
getDefaultQueueSize() |
NumericRange |
getIndexRange()
Optional subrange of an array to monitor to.
|
double |
getSamplingInterval()
The SamplingInterval.
|
DataValue |
getValue() |
void |
setAggregateFilter(AggregateFilter filter) |
void |
setDataChangeFilter(DataChangeFilter filter)
Define the filter for selecting which notification the server should send.
|
void |
setDataChangeListener(MonitoredDataItemListener listener)
Define the listener for the DataChange notifications.
|
void |
setIndexRange(NumericRange indexRange)
Define the range of array indexes to monitor.
|
protected void |
setRevisedSamplingInterval(Double revisedSamplingInterval) |
void |
setSamplingInterval(double samplingInterval)
The interval that defines the fastest rate at which the MonitoredItem(s) should be accessed and
evaluated.
|
void |
setSamplingInterval(long samplingInterval,
TimeUnit unit)
The interval that defines the fastest rate at which the MonitoredItem(s) should be accessed and
evaluated.
|
protected void |
setValue(DataValue value) |
clearModified, clearMonitoringModeModified, equals, fireError, getErrorCode, getErrorListener, getExpandedNodeId, getInitialStatus, getNodeId, getNodeIdAsString, getSubscription, hashCode, isModified, isMonitoringModeModified, itemChanged, monitoringModeChanged, setClientHandle, setErrorCode, setErrorListener, setFilterResult, setMonitoredItemId, setRevisedQueueSize, updateFilter, updateQueueclose, getAttributeId, getClientHandle, getDataEncoding, getFilter, getFilterResult, getMonitoredItemId, getMonitoringMode, getPrevMonitoringMode, getQueueSize, getUserData, isDiscardOldest, setDiscardOldest, setFilter, setMonitoringMode, setQueueSize, setQueueSize, setUserData, toStringprotected volatile MonitoredDataItemListener dataChangeListener
public MonitoredDataItem(ExpandedNodeId expandedNodeId)
expandedNodeId - the node to listen topublic MonitoredDataItem(ExpandedNodeId expandedNodeId, UnsignedInteger attributeId)
expandedNodeId - the node to listen toattributeId - the attribute to listen topublic MonitoredDataItem(ExpandedNodeId expandedNodeId, UnsignedInteger attributeId, MonitoringMode monitoringMode)
If the item is an array item, use #setIndexRange(String) to define an optional range to
monitor to.
expandedNodeId - the node to listen toattributeId - the attribute to listen tomonitoringMode - monitoring mode to usepublic MonitoredDataItem(ExpandedNodeId expandedNodeId, UnsignedInteger attributeId, MonitoringMode monitoringMode, double samplingInterval)
If the item is an array item, use #setIndexRange(String) to define an optional range to
monitor to.
expandedNodeId - the node to listen toattributeId - the attribute to listen tomonitoringMode - monitoring mode to usesamplingInterval - the sampling interval for the item in milliseconds.public MonitoredDataItem(NodeId nodeId)
nodeId - the node to listen topublic MonitoredDataItem(NodeId nodeId, UnsignedInteger attributeId)
nodeId - the node to listen toattributeId - the attribute to listen topublic MonitoredDataItem(NodeId nodeId, UnsignedInteger attributeId, MonitoringMode monitoringMode)
If the item is an array item, use #setIndexRange(String) to define an optional range to
monitor to.
nodeId - the node to listen toattributeId - the attribute to listen tomonitoringMode - monitoring mode to usepublic MonitoredDataItem(NodeId nodeId, UnsignedInteger attributeId, MonitoringMode monitoringMode, double samplingInterval)
If the item is an array item, use #setIndexRange(String) to define an optional range to
monitor to.
nodeId - the node to listen toattributeId - the attribute to listen tomonitoringMode - monitoring mode to usesamplingInterval - the sampling interval for the item in milliseconds.public DataChangeFilter getDataChangeFilter()
setDataChangeFilter(com.prosysopc.ua.stack.core.DataChangeFilter)public MonitoredDataItemListener getDataChangeListener()
public NumericRange getIndexRange()
MonitoredItemBasegetIndexRange in class MonitoredItemBasepublic double getSamplingInterval()
MonitoredItemBasegetSamplingInterval in class MonitoredItemBasepublic DataValue getValue()
public void setAggregateFilter(AggregateFilter filter) throws ServiceException, StatusException
ServiceExceptionStatusExceptionpublic void setDataChangeFilter(DataChangeFilter filter) throws ServiceException, StatusException
The DataChangeFilter defines the conditions under which a data change notification should be reported and, optionally, a range or band for value changes where no DataChange Notification is generated. This range is called Deadband.
The fields of the filter are defined as follows
| Name | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| trigger | Specifies the conditions under which a data change notification should be reported. It has
the following values :
| ||||||||
| deadbandType | A value that defines the Deadband type and behaviour.
| ||||||||
| deadbandValue | The Deadband is applied only if
DeadbandType = AbsoluteDeadband: For this type the deadbandValue contains the absolute change in a data value that shall cause a Notification to be generated. This parameter applies only to Variables with any number data type. An exception that causes a DataChange Notification based on an AbsoluteDeadband is determined as follows:
The last cached value is defined as the most recent value previously sent to the Notification channel. If the item is an array of values, the entire array is returned if any array element exceeds the AbsoluteDeadband. DeadbandType = PercentDeadband: For this type of deadband the deadbandValue is defined as the percentage of the EURange. That is, it applies only to AnalogItems with an EURange Property that defines the typical value range for the item. This range shall be multiplied with the deadbandValue to generate an exception limit. An exception is determined as follows:
If the item is an array of values and any array element exceeds the deadbandValue, the entire monitored array is returned. |
filter - the new filterStatusExceptionServiceExceptionpublic void setDataChangeListener(MonitoredDataItemListener listener)
listener - Object that implements the MonitoredDataItemListener. Use null to remove the
listener.public void setIndexRange(NumericRange indexRange) throws ServiceException
This parameter is used to identify a single element of an array, or a single range of indexes for arrays. If a range of elements is specified, the values are returned as a composite. The first element is identified by index 0 (zero).
This parameter is null if the specified Attribute is not an array. However, if the specified Attribute is an array, and this parameter is null, then all elements are to be included in the range.
The format of the parameter is defined formally in the OPC UA specification (Part 4), using BNF notation. In short, the following alternatives can be used:
All indexes start with 0. The maximum value for any index is one less than the length of the dimension.
When reading a value the indexes may not specify a range that is within the bounds of the array. The Server shall return a partial result if some elements exist within the range. The Server shall return a Bad_OutOfRange If no elements exist within the range.
indexRange - A number or a numeric range. Null or empty string indicates that this
parameter is not used.ServiceException - if the service call to update the value to the server failspublic void setSamplingInterval(double samplingInterval)
throws ServiceException
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.
samplingInterval - the interval in millisecondsServiceException - if the service call to update the value to the server failspublic void setSamplingInterval(long samplingInterval,
TimeUnit unit)
throws ServiceException
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.
samplingInterval - the interval in millisecondsunit - the time unit of the requestedPublishingInterval argumentServiceException - if the service call to update the value to the server failsprotected void fireDataChange(DataValue prevValue, DataValue newValue)
prevValue - newValue - protected long getDefaultQueueSize()
getDefaultQueueSize in class MonitoredItemBaseprotected void setRevisedSamplingInterval(Double revisedSamplingInterval)
revisedSamplingInterval - protected void setValue(DataValue value)
Copyright © 2026. All rights reserved.