com.prosysopc.ua
Class MonitoredItemBase

java.lang.Object
  extended by com.prosysopc.ua.MonitoredItemBase
Direct Known Subclasses:
MonitoredItem, MonitoredItem

public abstract class MonitoredItemBase
extends Object

The base class for all OPCUA MonitoredItems. It defines the necessary properties for every item.


Field Summary
protected  org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId
           
protected  org.opcfoundation.ua.builtintypes.UnsignedInteger clientHandle
           
protected  org.opcfoundation.ua.builtintypes.QualifiedName dataEncoding
           
protected  boolean discardOldest
           
protected static int maxQueueSize
           
protected  org.opcfoundation.ua.builtintypes.UnsignedInteger monitoredItemId
           
protected  org.opcfoundation.ua.core.MonitoringMode monitoringMode
           
protected  org.opcfoundation.ua.builtintypes.NodeId nodeId
           
protected  long queueSize
           
 
Constructor Summary
MonitoredItemBase(org.opcfoundation.ua.builtintypes.UnsignedInteger clientHandle, org.opcfoundation.ua.builtintypes.UnsignedInteger monitoredItemId, org.opcfoundation.ua.builtintypes.NodeId nodeId, org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId, org.opcfoundation.ua.core.MonitoringMode monitoringMode)
          Create a new monitored item in a subscription.
 
Method Summary
 void close()
          Close down the monitoredItem, when it is removed from the subscription.
 boolean equals(Object obj)
           
 org.opcfoundation.ua.builtintypes.UnsignedInteger getAttributeId()
           
 org.opcfoundation.ua.builtintypes.UnsignedInteger getClientHandle()
          Client-supplied id of the MonitoredItem.
 org.opcfoundation.ua.builtintypes.QualifiedName getDataEncoding()
           
protected abstract  long getDefaultQueueSize()
           
 org.opcfoundation.ua.core.MonitoringFilter getFilter()
          A filter used by the Server to determine if the MonitoredItem should generate a Notification.
 org.opcfoundation.ua.core.MonitoringFilterResult getFilterResult()
           
 org.opcfoundation.ua.utils.NumericRange getIndexRange()
          Optional subrange of an array to monitor to.
 org.opcfoundation.ua.builtintypes.UnsignedInteger getMonitoredItemId()
           
 org.opcfoundation.ua.core.MonitoringMode getMonitoringMode()
          See the setter for a full description.
 org.opcfoundation.ua.builtintypes.NodeId getNodeId()
           
 long getQueueSize()
           
 double getSamplingInterval()
          The SamplingInterval.
 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(org.opcfoundation.ua.core.MonitoringFilter filter)
          A filter used by the Server to determine if the MonitoredItem should generate a Notification.
protected  void setFilterResult(org.opcfoundation.ua.core.MonitoringFilterResult filterResult)
           
protected  void setMonitoredItemId(org.opcfoundation.ua.builtintypes.UnsignedInteger monitoredItemId)
           
 void setMonitoringMode(org.opcfoundation.ua.core.MonitoringMode monitoringMode)
          Set the monitoring mode.
 void setQueueSize(long queueSize)
          The requested size of the MonitoredItem queue.
 void setQueueSize(org.opcfoundation.ua.builtintypes.UnsignedInteger queueSize)
           
 String toString()
           
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 java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

maxQueueSize

protected static int maxQueueSize

attributeId

protected final org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId

clientHandle

protected org.opcfoundation.ua.builtintypes.UnsignedInteger clientHandle

dataEncoding

protected final org.opcfoundation.ua.builtintypes.QualifiedName dataEncoding

discardOldest

protected boolean discardOldest

monitoredItemId

protected org.opcfoundation.ua.builtintypes.UnsignedInteger monitoredItemId

monitoringMode

protected volatile org.opcfoundation.ua.core.MonitoringMode monitoringMode

nodeId

protected final org.opcfoundation.ua.builtintypes.NodeId nodeId

queueSize

protected long queueSize
Constructor Detail

MonitoredItemBase

public MonitoredItemBase(org.opcfoundation.ua.builtintypes.UnsignedInteger clientHandle,
                         org.opcfoundation.ua.builtintypes.UnsignedInteger monitoredItemId,
                         org.opcfoundation.ua.builtintypes.NodeId nodeId,
                         org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId,
                         org.opcfoundation.ua.core.MonitoringMode monitoringMode)
Create a new monitored item in a subscription.

Parameters:
clientHandle - a handle used to identify the item in the client side, assigned by the client
monitoredItemId - the ID used to identify the item in the server side, assigned by the server
nodeId - the NodeId of the node to monitor
attributeId - the attribute to monitor
monitoringMode - the initial monitoring mode for the item. Specifies whether sampling and reporting are enabled or disabled for a MonitoredItem.
Method Detail

close

public void close()
Close down the monitoredItem, when it is removed from the subscription.


equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getAttributeId

public org.opcfoundation.ua.builtintypes.UnsignedInteger getAttributeId()
Returns:
the attribute to monitor to.

getClientHandle

public org.opcfoundation.ua.builtintypes.UnsignedInteger getClientHandle()
Client-supplied id of the MonitoredItem. This id is used in Notifications generated for the list Node. The id is generated automatically by the client items.

Returns:
the handle of the monitored item
See Also:
getMonitoredItemId()

getDataEncoding

public org.opcfoundation.ua.builtintypes.QualifiedName getDataEncoding()
Returns:
the data encoding to use or null to use the default encoding

getFilter

public org.opcfoundation.ua.core.MonitoringFilter getFilter()
A filter used by the Server to determine if the MonitoredItem should generate a Notification.

Returns:
the current filter. If not used, this is null.

getFilterResult

public org.opcfoundation.ua.core.MonitoringFilterResult getFilterResult()
Returns:

getIndexRange

public org.opcfoundation.ua.utils.NumericRange getIndexRange()
Optional subrange of an array to monitor to.

Returns:
the index range of an array to monitor.

getMonitoredItemId

public org.opcfoundation.ua.builtintypes.UnsignedInteger getMonitoredItemId()
Returns:
the ID of the monitored item. The ID is assigned by the server.
See Also:
getClientHandle()

getMonitoringMode

public org.opcfoundation.ua.core.MonitoringMode getMonitoringMode()
See the setter for a full description.

Returns:
current monitoring mode.
See Also:
setMonitoringMode(MonitoringMode)

getNodeId

public org.opcfoundation.ua.builtintypes.NodeId getNodeId()
Returns:
the node to monitor

getQueueSize

public long getQueueSize()
Returns:
the queue size. When the item is created in the server, this is the value revised by the server.
See Also:
setQueueSize(long)

getSamplingInterval

public double getSamplingInterval()
The SamplingInterval. This is only used for the monitored data items. For event items it is always 0.

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object

isDiscardOldest

public boolean isDiscardOldest()
Returns:
whether to discard the oldest or newest value, if the queue gets full in the server side.
See Also:
setDiscardOldest(boolean)

setDiscardOldest

public 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. It has the following values:
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.
Default: false

Parameters:
discardOldest - the new value to set

setMonitoringMode

public void setMonitoringMode(org.opcfoundation.ua.core.MonitoringMode monitoringMode)
                       throws ServiceException
Set the monitoring mode.

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.

Parameters:
monitoringMode - the new monitoring mode to set.
Throws:
ServiceException - if the mode change fails
See Also:
getMonitoringMode(), SubscriptionBase.setPublishingEnabled(boolean)

setQueueSize

public void setQueueSize(long queueSize)
                  throws ServiceException
The requested size of the MonitoredItem queue. If Events are lost an Event of the type EventQueueOverflow is generated.

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.
If 0 is passed by the client, the server shall set the queue size to 1 and return 1 as revisedQueueSize.

Parameters:
queueSize - the value must be between 0 and UnsignedInteger.MAX_VALUE.getValue(). Value of 0 is changed to 1.
Throws:
ServiceException

setQueueSize

public void setQueueSize(org.opcfoundation.ua.builtintypes.UnsignedInteger queueSize)
                  throws ServiceException
Parameters:
queueSize -
Throws:
ServiceException

toString

public String toString()
Overrides:
toString in class Object

getDefaultQueueSize

protected abstract long getDefaultQueueSize()
Returns:

monitoringModeChanged

protected void monitoringModeChanged()
                              throws ServiceException
Throws:
ServiceException

setFilter

protected void setFilter(org.opcfoundation.ua.core.MonitoringFilter filter)
                  throws ServiceException
A filter used by the Server to determine if the MonitoredItem should generate a Notification. If not used, this parameter is null. The filter type depends on type of item being monitored. The main types are
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.
See the respective type definitions in org.opcfoundation.org.core.

Parameters:
filter -
Throws:
StatusException
ServiceException

setFilterResult

protected void setFilterResult(org.opcfoundation.ua.core.MonitoringFilterResult filterResult)
Parameters:
filterResult - the filterResult to set

setMonitoredItemId

protected void setMonitoredItemId(org.opcfoundation.ua.builtintypes.UnsignedInteger monitoredItemId)

updateFilter

protected void updateFilter()
                     throws ServiceException
React to changes in the filter.

Throws:
StatusException
ServiceException

updateQueue

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

Throws:
ServiceException


Copyright © 2018. All rights reserved.