|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.prosysopc.ua.SubscriptionBase
public abstract class SubscriptionBase
Base class for an OPC UA Subscription.
| Field Summary | |
|---|---|
protected Map<org.opcfoundation.ua.builtintypes.UnsignedInteger,MonitoredItemBase> |
items
|
protected long |
lifetimeCount
|
protected long |
maxKeepAliveCount
|
protected int |
maxNotificationsPerPublish
|
protected int |
priority
|
protected boolean |
publishingEnabled
|
protected double |
publishingInterval
|
protected int |
updateCount
|
| Constructor Summary | |
|---|---|
SubscriptionBase(org.opcfoundation.ua.builtintypes.UnsignedInteger id,
boolean publishingEnabled,
double publishingInterval,
long lifetimeCount,
long maxKeepAliveCount,
int maxNotificationsPerPublish,
int priority)
|
|
SubscriptionBase(org.opcfoundation.ua.builtintypes.UnsignedInteger id,
Boolean publishingEnabled,
Double publishingInterval,
org.opcfoundation.ua.builtintypes.UnsignedInteger lifetimeCount,
org.opcfoundation.ua.builtintypes.UnsignedInteger maxKeepAliveCount,
org.opcfoundation.ua.builtintypes.UnsignedInteger maxNotificationsPerPublish,
org.opcfoundation.ua.builtintypes.UnsignedByte priority)
|
|
| Method Summary | |
|---|---|
void |
addItem(MonitoredItemBase item,
org.opcfoundation.ua.builtintypes.UnsignedInteger itemId)
Add a new monitoring item to the subscription. |
protected void |
applyUpdates()
Apply the pending modifications guarded by beginUpdate/endUpdate. |
void |
beginUpdate()
Starts a property or item modification sequence. |
int |
compareTo(SubscriptionBase s)
|
protected void |
enabledChanged()
Handles a change in PublishingEnabled |
void |
endUpdate()
Ends a property or item modification, which was started with beginUpdate(). |
MonitoredItemBase |
getItem(org.opcfoundation.ua.builtintypes.NodeId nodeId,
org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId)
Find the item that is listening to the specified node attribute. |
MonitoredItemBase |
getItem(org.opcfoundation.ua.builtintypes.UnsignedInteger itemId)
Get an item from the subscription. |
int |
getItemCount()
|
MonitoredItemBase[] |
getItems()
|
long |
getLifetimeCount()
The lifetime count should be a mimimum of three times the keep-alive count. |
long |
getMaxKeepAliveCount()
Max keep alive count defines the number of Publishing Intervals that may pass without any notification being sent. |
int |
getMaxNotificationsPerPublish()
The maximum number of notifications that the Client wishes to receive in a single Publish response. |
int |
getPriority()
Indicates the relative priority of the Subscription. |
double |
getPublishingInterval()
This interval defines the cyclic rate that the Subscription is being requested to return Notifications to the Client. |
org.opcfoundation.ua.builtintypes.UnsignedInteger |
getSubscriptionId()
The Server-assigned identifier for the Subscription. |
boolean |
hasItem(org.opcfoundation.ua.builtintypes.NodeId nodeId,
org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId)
Checks if the subscription contains an item that is listening to the specified node attribute. |
boolean |
hasItem(org.opcfoundation.ua.builtintypes.UnsignedInteger itemId)
Checks if the subscription contains an item with the ID. |
boolean |
isPublishingEnabled()
|
protected void |
paramChanged()
Parameter change "event". |
abstract MonitoredItemBase |
removeItem(MonitoredItemBase item)
Remove an item from the subscription. |
MonitoredItemBase |
removeItem(org.opcfoundation.ua.builtintypes.UnsignedInteger itemId)
Remove an item from the subscription. |
void |
setLifetimeCount(long requestedLifetimeCount)
The lifetime count should be a mimimum of three times the keep-alive count. |
void |
setLifetimeCount(org.opcfoundation.ua.builtintypes.UnsignedInteger requestedLifetimeCount)
The lifetime count shall be a mimimum of three times the keep-alive count. |
void |
setMaxKeepAliveCount(long requestedMaxKeepAliveCount)
When the publishing timer in the Server has expired this number of times without requiring any NotificationMessage to be sent, the Subscription sends a keep-alive Message to the Client. |
void |
setMaxKeepAliveCount(org.opcfoundation.ua.builtintypes.UnsignedInteger requestedMaxKeepAliveCount)
When the publishing timer in the Server has expired this number of times without requiring any NotificationMessage to be sent, the Subscription sends a keep-alive Message to the Client. |
void |
setMaxNotificationsPerPublish(long maxNotificationsPerPublish)
The maximum number of notifications that the Client wishes to receive in a single Publish response. |
void |
setMaxNotificationsPerPublish(org.opcfoundation.ua.builtintypes.UnsignedInteger maxNotificationsPerPublish)
The maximum number of notifications that the Client wishes to receive in a single Publish response. |
void |
setPriority(int priority)
Indicates the relative priority of the Subscription. |
void |
setPriority(org.opcfoundation.ua.builtintypes.UnsignedByte priority)
Indicates the relative priority of the Subscription. |
void |
setPublishingEnabled(boolean publishingEnabled)
A Boolean parameter with the following values : TRUE publishing is enabled for the Subscription. |
void |
setPublishingInterval(double requestedPublishingInterval)
This interval defines the cyclic rate that the Subscription is being requested to return Notifications to the Client. |
void |
setPublishingInterval(long requestedPublishingInterval,
TimeUnit timeUnit)
|
protected void |
setSubscriptionId(org.opcfoundation.ua.builtintypes.UnsignedInteger id)
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final Map<org.opcfoundation.ua.builtintypes.UnsignedInteger,MonitoredItemBase> items
protected long lifetimeCount
protected long maxKeepAliveCount
protected int maxNotificationsPerPublish
protected int priority
protected boolean publishingEnabled
protected double publishingInterval
protected int updateCount
| Constructor Detail |
|---|
public SubscriptionBase(org.opcfoundation.ua.builtintypes.UnsignedInteger id,
boolean publishingEnabled,
double publishingInterval,
long lifetimeCount,
long maxKeepAliveCount,
int maxNotificationsPerPublish,
int priority)
public SubscriptionBase(org.opcfoundation.ua.builtintypes.UnsignedInteger id,
Boolean publishingEnabled,
Double publishingInterval,
org.opcfoundation.ua.builtintypes.UnsignedInteger lifetimeCount,
org.opcfoundation.ua.builtintypes.UnsignedInteger maxKeepAliveCount,
org.opcfoundation.ua.builtintypes.UnsignedInteger maxNotificationsPerPublish,
org.opcfoundation.ua.builtintypes.UnsignedByte priority)
| Method Detail |
|---|
public void addItem(MonitoredItemBase item,
org.opcfoundation.ua.builtintypes.UnsignedInteger itemId)
item - itemId - The ID to use to map the item in the list. On server side this is the
monitoredItemId. On client side it is the clientHandle.public void beginUpdate()
The method must be paired with endUpdate(), preferably with a try-finally block. You
can nest several beginUpdate/endUpdate blocks. The final endUpdate will trigger the changes
being written to the server using a modifySubscription or modifyMonitoredItems service call.
public int compareTo(SubscriptionBase s)
compareTo in interface Comparable<SubscriptionBase>
public final void endUpdate()
throws ServiceException
beginUpdate().
ServiceException - if the update fails due to an error in modifySubscription, modifyItems
or setMonitoringMode service call to the server. In that case, you can retry by using a
new beginUpdate/endUpdate sequence.
public MonitoredItemBase getItem(org.opcfoundation.ua.builtintypes.NodeId nodeId,
org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId)
nodeId - the listened nodeattributeId - the attribute
public MonitoredItemBase getItem(org.opcfoundation.ua.builtintypes.UnsignedInteger itemId)
throws StatusException
itemId - the ID of the item. On the client side this is the ClientHandle and on the server
side it is the MonitoredItemId.
StatusException - if the item is not found, with StatusCode=Bad_MonitoredItemIdInvalidpublic int getItemCount()
public MonitoredItemBase[] getItems()
public long getLifetimeCount()
When the publishing timer has expired this number of times without a Publish request being available to send a NotificationMessage, then the Subscription will be deleted by the Server.
setLifetimeCount(long)public long getMaxKeepAliveCount()
If the client does not receive any notification message during the interval specified by the MaxKeepAliveCount (plus some tolerance), the subscription can be considered to be at timeout and the client can assume a problem with a connection to the server.
public int getMaxNotificationsPerPublish()
setMaxNotificationsPerPublish(long)public int getPriority()
A Client that does not require special priority settings should set this value to zero.
setPriority(int)public double getPublishingInterval()
The negotiated value for this parameter returned in the response is used as the default sample interval for MonitoredItems assigned to this Subscription.
The value 0 is invalid.
setPublishingInterval(double)public org.opcfoundation.ua.builtintypes.UnsignedInteger getSubscriptionId()
public boolean hasItem(org.opcfoundation.ua.builtintypes.NodeId nodeId,
org.opcfoundation.ua.builtintypes.UnsignedInteger attributeId)
nodeId - the nodeattributeId - the attribute
public boolean hasItem(org.opcfoundation.ua.builtintypes.UnsignedInteger itemId)
itemId - the ID of the item. On the client side this is the ClientHandle and on the server
side it is the MonitoredItemId.
public boolean isPublishingEnabled()
setPublishingEnabled(boolean)
public abstract MonitoredItemBase removeItem(MonitoredItemBase item)
throws ServiceException,
StatusException
item - The item to remove.
ServiceException - if the (possible) service call to delete the item from the server
fails.
StatusException - if the subscription does not contain the item
public MonitoredItemBase removeItem(org.opcfoundation.ua.builtintypes.UnsignedInteger itemId)
throws ServiceException,
StatusException
itemId - The ID of the item to remove. In the client side this should be the ClientHandle,
but on server side, the MonitoredItemId is used.
ServiceException - if the service call to delete the item from the server fails.
StatusException - if the delete response from the server is bad
public final void setLifetimeCount(long requestedLifetimeCount)
throws ServiceException
When the publishing timer has expired this number of times without a Publish request being available to send a NotificationMessage, then the Subscription will be deleted by the Server.
requestedLifetimeCount - The value must be in the range of UnsignedInteger
ServiceException - If the parameter could not be changed.
public void setLifetimeCount(org.opcfoundation.ua.builtintypes.UnsignedInteger requestedLifetimeCount)
throws ServiceException
When the publishing timer has expired this number of times without a Publish request being available to send a NotificationMessage, then the Subscription will be deleted by the Server.
ServiceException - If the parameter could not be changed.
public final void setMaxKeepAliveCount(long requestedMaxKeepAliveCount)
throws ServiceException
The value 0 is invalid.
requestedMaxKeepAliveCount - The value must be in the range of UnsignedInteger
ServiceException - If the parameter could not be changed.
public void setMaxKeepAliveCount(org.opcfoundation.ua.builtintypes.UnsignedInteger requestedMaxKeepAliveCount)
throws ServiceException
The value 0 is invalid.
requestedMaxKeepAliveCount -
ServiceException - If the parameter could not be changed.
public final void setMaxNotificationsPerPublish(long maxNotificationsPerPublish)
throws ServiceException
maxNotificationsPerPublish - The value must be in the range of UnsignedInteger, but if the
value is bigger than Integer.MAX_VALUE, Integer.MAX_VALUE will be used instead.
ServiceException - If the parameter could not be changed.
public void setMaxNotificationsPerPublish(org.opcfoundation.ua.builtintypes.UnsignedInteger maxNotificationsPerPublish)
throws ServiceException
maxNotificationsPerPublish - If the value is bigger than Integer.MAX_VALUE,
Integer.MAX_VALUE will be used instead.
ServiceException - If the parameter could not be changed.
public final void setPriority(int priority)
throws ServiceException
A Client that does not require special priority settings should set this value to zero.
priority - The value must be in the range of UnsignedByte
ServiceException - If the parameter could not be changed.
public void setPriority(org.opcfoundation.ua.builtintypes.UnsignedByte priority)
throws ServiceException
A Client that does not require special priority settings should set this value to zero.
priority -
ServiceException - If the parameter could not be changed.
public void setPublishingEnabled(boolean publishingEnabled)
throws ServiceException,
StatusException
| TRUE | publishing is enabled for the Subscription. |
| FALSE | publishing is disabled for the Subscription. |
publishingEnabled - the new value to set
StatusException - If the parameter could not be changed due to an operation error from
the server.
ServiceException - If the parameter could not be changed due to a service call error.
public void setPublishingInterval(double requestedPublishingInterval)
throws ServiceException
The negotiated value for this parameter returned in the response is used as the default sample interval for MonitoredItems assigned to this Subscription.
The value 0 is invalid.
requestedPublishingInterval - requested value for the publishing interval in milliseconds
ServiceException - If the parameter could not be changed.
public void setPublishingInterval(long requestedPublishingInterval,
TimeUnit timeUnit)
throws ServiceException
ServiceExceptionsetPublishingInterval(double)public String toString()
toString in class Object
protected void applyUpdates()
throws ServiceException
ServiceException
protected void enabledChanged()
throws ServiceException,
StatusException
ServiceException
StatusException
protected void paramChanged()
throws ServiceException
ServiceExceptionprotected void setSubscriptionId(org.opcfoundation.ua.builtintypes.UnsignedInteger id)
id -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||