public abstract class MonitoredItemBase extends Object
| Modifier and Type | Field and Description |
|---|---|
protected UnsignedInteger |
attributeId |
protected UnsignedInteger |
clientHandle |
protected QualifiedName |
dataEncoding |
protected boolean |
discardOldest |
protected static int |
maxQueueSize |
protected UnsignedInteger |
monitoredItemId |
protected MonitoringMode |
monitoringMode |
protected NodeId |
nodeId |
protected MonitoringMode |
prevMonitoringMode |
protected long |
queueSize |
| Constructor and Description |
|---|
MonitoredItemBase(UnsignedInteger clientHandle,
UnsignedInteger monitoredItemId,
NodeId nodeId,
UnsignedInteger attributeId,
MonitoringMode monitoringMode)
Create a new monitored item in a subscription.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close down the monitoredItem, when it is removed from the subscription.
|
boolean |
equals(Object obj) |
UnsignedInteger |
getAttributeId() |
UnsignedInteger |
getClientHandle()
Client-supplied id of the MonitoredItem.
|
QualifiedName |
getDataEncoding() |
protected abstract long |
getDefaultQueueSize() |
MonitoringFilter |
getFilter()
A filter used by the Server to determine if the MonitoredItem should generate a Notification.
|
MonitoringFilterResult |
getFilterResult() |
NumericRange |
getIndexRange()
Optional subrange of an array to monitor to.
|
UnsignedInteger |
getMonitoredItemId() |
MonitoringMode |
getMonitoringMode()
See the setter for a full description.
|
NodeId |
getNodeId() |
protected String |
getNodeIdAsString() |
protected MonitoringMode |
getPrevMonitoringMode()
Returns the previous
MonitoringMode that was active before current, returned by
getMonitoringMode(). |
long |
getQueueSize() |
double |
getSamplingInterval()
The SamplingInterval.
|
Object |
getUserData()
Returns a previously
setUserData(Object) object. |
int |
hashCode() |
boolean |
isDiscardOldest() |
protected void |
monitoringModeChanged() |
void |
setDiscardOldest(boolean discardOldest)
A boolean parameter that specifies the discard policy when the queue is full and a new
Notification is to be enqueued.
|
protected void |
setFilter(MonitoringFilter filter)
A filter used by the Server to determine if the MonitoredItem should generate a Notification.
|
protected void |
setFilterResult(MonitoringFilterResult filterResult) |
protected void |
setMonitoredItemId(UnsignedInteger monitoredItemId) |
void |
setMonitoringMode(MonitoringMode monitoringMode)
Set the monitoring mode.
|
void |
setQueueSize(long queueSize)
The requested size of the MonitoredItem queue.
|
void |
setQueueSize(UnsignedInteger queueSize) |
void |
setUserData(Object userData)
Set a custom data object to this item that can be later retrieved with
getUserData(). |
String |
toString() |
protected void |
updateFilter()
React to changes in the filter.
|
protected void |
updateQueue()
Update the queue, when it's size has changed.
|
protected static int maxQueueSize
protected final UnsignedInteger attributeId
protected UnsignedInteger clientHandle
protected final QualifiedName dataEncoding
protected boolean discardOldest
protected UnsignedInteger monitoredItemId
protected volatile MonitoringMode monitoringMode
protected volatile MonitoringMode prevMonitoringMode
protected final NodeId nodeId
protected long queueSize
public MonitoredItemBase(UnsignedInteger clientHandle, UnsignedInteger monitoredItemId, NodeId nodeId, UnsignedInteger attributeId, MonitoringMode monitoringMode)
clientHandle - a handle used to identify the item in the client side, assigned by the
clientmonitoredItemId - the ID used to identify the item in the server side, assigned by the
servernodeId - the NodeId of the node to monitorattributeId - the attribute to monitormonitoringMode - the initial monitoring mode for the item. Specifies whether sampling and
reporting are enabled or disabled for a MonitoredItem.public void close()
public UnsignedInteger getAttributeId()
public UnsignedInteger getClientHandle()
getMonitoredItemId()public QualifiedName getDataEncoding()
public MonitoringFilter getFilter()
public MonitoringFilterResult getFilterResult()
public NumericRange getIndexRange()
public UnsignedInteger getMonitoredItemId()
getClientHandle()public MonitoringMode getMonitoringMode()
setMonitoringMode(MonitoringMode)public NodeId getNodeId()
public long getQueueSize()
setQueueSize(long)public double getSamplingInterval()
public Object getUserData()
setUserData(Object) object.public boolean isDiscardOldest()
setDiscardOldest(boolean)public void setDiscardOldest(boolean discardOldest)
true
| the oldest (first) Notification in the queue is discarded. The new Notification is added to
the end of the queue.
| false
| the new Notification is discarded. The queue is unchanged.
| |
discardOldest - the new value to setpublic void setMonitoringMode(MonitoringMode monitoringMode) throws ServiceException
The value of the publishing enabled parameter for a Subscription does not affect the value of the monitoring mode for a MonitoredItem of the Subscription
The values are
| Value | Description> |
|---|---|
| Disabled | The item is not sampled nor reported. |
| Sampling | The item is sampled, but not reported. |
| Reporting | The item is sampled and reported. |
Note: This method changes the mode of a single item. If you wish to change several items
at once from the client side, use
Subscription#setMonitoringMode(MonitoringMode, com.prosysopc.ua.client.MonitoredItem...)
instead.
monitoringMode - the new monitoring mode to set.ServiceException - if the mode change failsgetMonitoringMode(),
SubscriptionBase.setPublishingEnabled(boolean)public void setQueueSize(long queueSize)
throws ServiceException
The following values have special meaning:
| Value | Meaning |
|---|---|
| 1 | the queue has a single entry, effectively disabling queuing. |
| >1 | a first-in-first-out queue is to be used. |
| Max Value (UnsignedInteger.MAX_VALUE.getValue()) | the max size that the Server can support. This is used for Event Notifications. In this case the Server is responsible for the Event buffer. |
queueSize - the value must be between 0 and UnsignedInteger.MAX_VALUE.getValue(). Value of
0 is changed to 1.ServiceExceptionpublic void setQueueSize(UnsignedInteger queueSize) throws ServiceException
queueSize - ServiceExceptionpublic void setUserData(Object userData)
getUserData().
This can be used to store business logic object mapping directly in the item. It will be stored
using strong reference and equivalent to having the 'volatile' keyword. Set null to remove.
This data is not used in equals(Object), hashCode() or toString().protected abstract long getDefaultQueueSize()
protected String getNodeIdAsString()
protected MonitoringMode getPrevMonitoringMode()
MonitoringMode that was active before current, returned by
getMonitoringMode(). Returns null if we are in the initial state after construction,
which is Disabled. This data is mainly intended for SDK internals.protected void monitoringModeChanged()
throws ServiceException
ServiceExceptionprotected void setFilter(MonitoringFilter filter) throws ServiceException
DataChangeFilter
| The change in a data value that will cause a Notification to be generated.
| EventFilter
| If a Notification conforms to the EventFilter, the Notification is sent to the Client.
| AggregateFilter
| The aggregate and its intervals when it will be calculated and a Notification is generated.
| |
filter - StatusExceptionServiceExceptionprotected void setFilterResult(MonitoringFilterResult filterResult)
filterResult - the filterResult to setprotected void setMonitoredItemId(UnsignedInteger monitoredItemId)
protected void updateFilter()
throws ServiceException
StatusExceptionServiceExceptionprotected void updateQueue()
throws ServiceException
ServiceExceptionCopyright © 2026. All rights reserved.