C++ Based OPC UA Client/Server/PubSub SDK  1.7.6.537
UaSubscriptionManager Class Reference

UaSubscriptionManager. More...

#include <uasubscriptionmanager.h>

Inherits EventManagerRegisteredCallback, and UaThread.

Public Member Functions

 UaSubscriptionManager (ServerManager *pServerManager)
 construction More...
 
virtual ~UaSubscriptionManager ()
 destruction
 
UaStatus startUp ()
 Start up subscription manager. More...
 
UaStatus shutDown ()
 Start up subscription manager. More...
 
void waitForTransactionCompletion ()
 Wait for completion of all subscription related transactions. More...
 
UaStatus createSubscription (UaSession *pSession, OpcUa_Double &publishingInterval, OpcUa_UInt32 &lifetimeCount, OpcUa_UInt32 &maxKeepAliveCount, OpcUa_UInt32 maxNotificationPerPublish, OpcUa_Boolean publishingEnabled, OpcUa_Byte priority, OpcUa_UInt32 &subscriptionId)
 Create a new Subscription. More...
 
UaStatus modifySubscription (UaSession *pSession, OpcUa_UInt32 subscriptionId, OpcUa_Double &publishingInterval, OpcUa_UInt32 &lifetimeCount, OpcUa_UInt32 &maxKeepAliveCount, OpcUa_UInt32 maxNotificationPerPublish, OpcUa_Byte priority)
 Modify an existing Subscription. More...
 
UaStatus setPublishingMode (UaSession *pSession, OpcUa_UInt32 subscriptionId, OpcUa_Boolean publishingMode)
 Set PublishingMode of a Subscription. More...
 
UaStatus deleteSubscription (UaSession *pSession, OpcUa_UInt32 subscriptionId)
 Delete a Subscription. More...
 
UaStatus transferSubscription (UaSession *pSession, OpcUa_UInt32 subscriptionId, OpcUa_Boolean sendInitialValues, UaUInt32Array &availableSequenceNumbers)
 Transfer a Subscription.
 
UaStatus beginPublish (UaPublishContext *pUaPublishContext)
 Begin a Publish transaction. More...
 
UaStatus beginRepublish (UaRepublishContext *pUaRepublishContext)
 Begin a Republish transaction. More...
 
UaStatus beginCreateMonitoredItems (UaCreateMonitoredItemsContext *pUaCreateMonitoredItemsContext)
 Create new monitored items. More...
 
UaStatus beginModifyMonitoredItems (UaModifyMonitoredItemsContext *pUaModifyMonitoredItemsContext)
 Modify monitored items. More...
 
UaStatus beginSetMonitoringMode (UaSetMonitoringModeContext *pUaSetMonitoringModeContext)
 Set monitoring mode of monitored items. More...
 
UaStatus setTriggering (UaSession *pSession, OpcUa_UInt32 subscriptionId, OpcUa_UInt32 triggeringItemId, const UaUInt32Array &linksToAdd, const UaUInt32Array &linksToRemove, UaStatusCodeArray &addResults, UaStatusCodeArray &removeResults)
 Set triggering of monitored items. More...
 
UaStatus beginDeleteMonitoredItems (UaDeleteMonitoredItemsContext *pUaDeleteMonitoredItemsContext)
 Delete monitored items. More...
 
UaStatus beginConditionRefresh (const ServiceContext &serviceContext, OpcUa_UInt32 subscriptionId)
 Refresh condition state for the passed subscription. More...
 
UaStatus beginConditionRefresh2 (const ServiceContext &serviceContext, OpcUa_UInt32 subscriptionId, OpcUa_UInt32 monitoredItemId)
 Refresh condition state for the passed monitored item in the passed subscription. More...
 
void run ()
 Main thread method. More...
 
virtual void dynamicEventManagerRegistered (EventManager *pEventManager)
 Callback for new EventManager added to the server. More...
 
virtual void executeDynamicEventManagerRegistered (EventManager *pEventManager)
 Executes the registration of a new EventManager added to the server. More...
 
- Public Member Functions inherited from UaThread
 UaThread ()
 Constructs a thread management object without starting the thread.
 
virtual ~UaThread ()
 Destroys the thread management object.
 
virtual void start ()
 Starts the thread managed by this object. More...
 
OpcUa_Boolean wait (OpcUa_UInt32 time=OpcUa_UInt32_Max)
 Waits for the termination of the thread. More...
 
OpcUa_Boolean running () const
 Returns the running state of the thread. More...
 
OpcUa_Boolean finished () const
 Returns the finished state of the thread. More...
 

Protected Member Functions

virtual UaSubscriptioncreateUaSubscription (UaSession *pSession, ServerManager *pServerManager, OpcUa_Double publishingInterval, OpcUa_UInt32 &lifetimeCount, OpcUa_UInt32 maxKeepAliveCount, OpcUa_UInt32 maxRetransmissionQueueSize, OpcUa_UInt32 maxNotificationPerPublish, OpcUa_Boolean publishingEnabled, OpcUa_Byte priority)
 Creates a new subscription object. More...
 
virtual OpcUa_Int32 getNewSubscriptionId ()
 Returns a new unique subscription id The method can be overwritten by a derived class.
 
virtual void subscriptionCreated (UaSubscription *pUaSubscription)
 Event for derived classes indicating that a new subscription was created. More...
 
virtual void subscriptionModified (UaSubscription *pUaSubscription)
 Event for derived classes indicating that a subscription was modified. More...
 
virtual void subscriptionChangedPublishMode (UaSubscription *pUaSubscription)
 Event for derived classes indicating that the publish mode of a subscription was changed. More...
 
virtual void subscriptionDeleted (UaSubscription *pUaSubscription)
 Event for derived classes indicating that a subscription was deleted. More...
 
void incrementCurrentSubscriptionCount ()
 Increments the current subscription count. More...
 
void decrementCurrentSubscriptionCount ()
 Decrements the current subscription count. More...
 
void incrementCumulatedSubscriptionCount ()
 Increments the cumulated subscription count. More...
 
void clearSubscriptions ()
 Clears the management and releases references to the Subscriptions. More...
 
UaSubscriptionfindSubscription (OpcUa_UInt32 integerId)
 Find Subscriptions with a specified SubscriptionId. More...
 
OpcUa_UInt32 addSubscription (UaSubscription *pSubscription)
 Adds Subscriptions and returns the assigned integerId. More...
 
void addSubscription (OpcUa_UInt32 subscriptionId, UaSubscription *pSubscription)
 Adds Subscriptions with a specified integerId. More...
 
void removeSubscription (OpcUa_UInt32 integerId)
 Removes Subscriptions with a specified integerId. More...
 
void checkForActiveTransactionsAfterRemoveSubscription (UaSubscription *pSubscription)
 Check if the subscription has active transactions after remove. More...
 
OpcUa_UInt32 subscriptionCount ()
 Counts all available Subscriptions. More...
 
UaSubscriptiongetFirstSubscription ()
 Get the first available Subscription. More...
 
UaSubscriptiongetNextSubscription ()
 Get the next available Subscription. More...
 

Protected Attributes

OpcUa_UInt32 m_lastIntegerId
 Last used integer ID for subscriptions.
 

Additional Inherited Members

- Static Public Member Functions inherited from UaThread
static OpcUa_UInt32 currentThread ()
 Get thread ID of current thread. More...
 
static void sleep (OpcUa_UInt32 secs)
 Sleep for n seconds. More...
 
static void msleep (OpcUa_UInt32 msecs)
 Sleep for n milliseconds. More...
 
static void usleep (OpcUa_UInt32 usecs)
 Sleep for n microseconds. More...
 

Detailed Description

UaSubscriptionManager.

Implements the UA subscription manager. Derived from UaThread. It is not possible to create shallow copies of this class. It is not possible to use the default constructor.

Constructor & Destructor Documentation

UaSubscriptionManager::UaSubscriptionManager ( ServerManager pServerManager)

construction

Parameters
pServerManagerInterface to the central ServerManager object. This interface pointer should be stored in the NodeManager instance to have access to core module objects like the root NodeManager or the ServerConfig

Member Function Documentation

OpcUa_UInt32 UaSubscriptionManager::addSubscription ( UaSubscription pSubscription)
protected

Adds Subscriptions and returns the assigned integerId.

Parameters
pSubscriptionThe subscription to add.
Returns
The assigned integer id for the added subscription.
void UaSubscriptionManager::addSubscription ( OpcUa_UInt32  subscriptionId,
UaSubscription pSubscription 
)
protected

Adds Subscriptions with a specified integerId.

Parameters
subscriptionIdThe subscription id for the subscription to add.
pSubscriptionThe subscription to add.
UaStatus UaSubscriptionManager::beginConditionRefresh ( const ServiceContext serviceContext,
OpcUa_UInt32  subscriptionId 
)

Refresh condition state for the passed subscription.

Parameters
serviceContextGeneral context for the service calls containing information like the session object, return diagnostic mask and timeout hint.
subscriptionId
UaStatus UaSubscriptionManager::beginConditionRefresh2 ( const ServiceContext serviceContext,
OpcUa_UInt32  subscriptionId,
OpcUa_UInt32  monitoredItemId 
)

Refresh condition state for the passed monitored item in the passed subscription.

Parameters
serviceContextGeneral context for the service calls containing information like the session object, return diagnostic mask and timeout hint.
subscriptionIdSubsriptionId for the subscription that contains the monitored item
monitoredItemIdMonitoredItemId for the monitored item to refresh.
UaStatus UaSubscriptionManager::beginCreateMonitoredItems ( UaCreateMonitoredItemsContext pUaCreateMonitoredItemsContext)

Create new monitored items.

Parameters
pUaCreateMonitoredItemsContextthe context of the items to create.
Returns
Error code
UaStatus UaSubscriptionManager::beginDeleteMonitoredItems ( UaDeleteMonitoredItemsContext pUaDeleteMonitoredItemsContext)

Delete monitored items.

Parameters
pUaDeleteMonitoredItemsContextthe context to delete.
Returns
Error code
UaStatus UaSubscriptionManager::beginModifyMonitoredItems ( UaModifyMonitoredItemsContext pUaModifyMonitoredItemsContext)

Modify monitored items.

Parameters
pUaModifyMonitoredItemsContextthe context for the monitored items to modify.
Returns
Error code
UaStatus UaSubscriptionManager::beginPublish ( UaPublishContext pUaPublishContext)

Begin a Publish transaction.

Parameters
pUaPublishContextthe context of the needed publish transaction.
Returns
Error code
UaStatus UaSubscriptionManager::beginRepublish ( UaRepublishContext pUaRepublishContext)

Begin a Republish transaction.

Parameters
pUaRepublishContextthe context of the Republish transaction.
Returns
Error code
UaStatus UaSubscriptionManager::beginSetMonitoringMode ( UaSetMonitoringModeContext pUaSetMonitoringModeContext)

Set monitoring mode of monitored items.

Parameters
pUaSetMonitoringModeContextthe context to be set.
Returns
Error code
void UaSubscriptionManager::checkForActiveTransactionsAfterRemoveSubscription ( UaSubscription pSubscription)
protected

Check if the subscription has active transactions after remove.

If there are active transactions, the subscription is added to a special remove list for later checks

Parameters
pSubscriptionThe Subscription to check.
void UaSubscriptionManager::clearSubscriptions ( )
protected

Clears the management and releases references to the Subscriptions.

UaStatus UaSubscriptionManager::createSubscription ( UaSession pSession,
OpcUa_Double &  publishingInterval,
OpcUa_UInt32 &  lifetimeCount,
OpcUa_UInt32 &  maxKeepAliveCount,
OpcUa_UInt32  maxNotificationPerPublish,
OpcUa_Boolean  publishingEnabled,
OpcUa_Byte  priority,
OpcUa_UInt32 &  subscriptionId 
)

Create a new Subscription.

Parameters
pSessionInterface to the Session context for the method call
publishingIntervalpublishing interval in milliseconds the server allows
lifetimeCounta count for the the actual lifetime.
maxKeepAliveCountthe maximum of Time to keep the Session alive.
maxNotificationPerPublishthe maximum of notification per Publish.
publishingEnabledindicates if publishing is enabled or not.
prioritythe priority of the operation.
subscriptionIdthe Id of the Subscription.
Returns
Error code
UaSubscription * UaSubscriptionManager::createUaSubscription ( UaSession pSession,
ServerManager pServerManager,
OpcUa_Double  publishingInterval,
OpcUa_UInt32 &  lifetimeCount,
OpcUa_UInt32  maxKeepAliveCount,
OpcUa_UInt32  maxRetransmissionQueueSize,
OpcUa_UInt32  maxNotificationPerPublish,
OpcUa_Boolean  publishingEnabled,
OpcUa_Byte  priority 
)
protectedvirtual

Creates a new subscription object.

This method can be overwritten by a derived class to create a implementation specific derived class of UaSubscription.

Parameters
pSessionInterface to the Session context for the method call
pServerManagerInterface to the central ServerManager object.
maxRetransmissionQueueSizeMaximum number of messages in the republish queue the server allows per Subscription
publishingIntervalpublishing interval in milliseconds the server allows
lifetimeCounta count for the the actual lifetime.
maxKeepAliveCountthe maximum of Time to keep the Session alive.
publishingEnabled
maxNotificationPerPublishthe maximum of notification per Publish.
prioritythe priority of the operation.
void UaSubscriptionManager::decrementCurrentSubscriptionCount ( )
protected

Decrements the current subscription count.

UaStatus UaSubscriptionManager::deleteSubscription ( UaSession pSession,
OpcUa_UInt32  subscriptionId 
)

Delete a Subscription.

Parameters
pSessionInterface to the Session context for the method call
subscriptionIdthe Id of the Subscription.
Returns
Error code
void UaSubscriptionManager::dynamicEventManagerRegistered ( EventManager pEventManager)
virtual

Callback for new EventManager added to the server.

Parameters
pEventManager[in] EventManager interface
void UaSubscriptionManager::executeDynamicEventManagerRegistered ( EventManager pEventManager)
virtual

Executes the registration of a new EventManager added to the server.

Parameters
pEventManager[in] EventManager interface
UaSubscription * UaSubscriptionManager::findSubscription ( OpcUa_UInt32  integerId)
protected

Find Subscriptions with a specified SubscriptionId.

Parameters
integerIdthe specified SubscriptionId to find.
Returns
the found Subscriptions.
UaSubscription * UaSubscriptionManager::getFirstSubscription ( )
protected

Get the first available Subscription.

Returns
the first available Subscription.
UaSubscription * UaSubscriptionManager::getNextSubscription ( )
protected

Get the next available Subscription.

Returns
the next available Subscription.
void UaSubscriptionManager::incrementCumulatedSubscriptionCount ( )
protected

Increments the cumulated subscription count.

void UaSubscriptionManager::incrementCurrentSubscriptionCount ( )
protected

Increments the current subscription count.

UaStatus UaSubscriptionManager::modifySubscription ( UaSession pSession,
OpcUa_UInt32  subscriptionId,
OpcUa_Double &  publishingInterval,
OpcUa_UInt32 &  lifetimeCount,
OpcUa_UInt32 &  maxKeepAliveCount,
OpcUa_UInt32  maxNotificationPerPublish,
OpcUa_Byte  priority 
)

Modify an existing Subscription.

Parameters
pSessionInterface to the Session context for the method call
subscriptionIdthe Id of the Subscription.
publishingIntervalpublishing interval in milliseconds the server allows
lifetimeCounta count for the the actual lifetime.
maxKeepAliveCountthe maximum of Time to keep the Session alive.
maxNotificationPerPublishthe maximum of notification per Publish.
prioritythe priority of the operation.
Returns
Error code
void UaSubscriptionManager::removeSubscription ( OpcUa_UInt32  integerId)
protected

Removes Subscriptions with a specified integerId.

Parameters
integerIdThe Id of the Subscription to remove.
void UaSubscriptionManager::run ( )
virtual

Main thread method.

Implements UaThread.

UaStatus UaSubscriptionManager::setPublishingMode ( UaSession pSession,
OpcUa_UInt32  subscriptionId,
OpcUa_Boolean  publishingMode 
)

Set PublishingMode of a Subscription.

Parameters
pSessionInterface to the Session context for the method call
subscriptionIdthe Id of the Subscription.
publishingModetrue if publishing mode false if not.
Returns
Error code
UaStatus UaSubscriptionManager::setTriggering ( UaSession pSession,
OpcUa_UInt32  subscriptionId,
OpcUa_UInt32  triggeringItemId,
const UaUInt32Array linksToAdd,
const UaUInt32Array linksToRemove,
UaStatusCodeArray addResults,
UaStatusCodeArray removeResults 
)

Set triggering of monitored items.

Parameters
pSessionInterface to the Session context for the method call
subscriptionIdthe Id of the Subscription.
triggeringItemIdthe Id of the items to set triggering to.
linksToAddthe number of links to add to the monitored item.
linksToRemovethe number of links toremove from the monitored item.
addResultsthe results of this operation.
removeResultsthe results to remove from this operation.
Returns
Error code
UaStatus UaSubscriptionManager::shutDown ( )

Start up subscription manager.

Returns
Error code
UaStatus UaSubscriptionManager::startUp ( )

Start up subscription manager.

Returns
Error code
void UaSubscriptionManager::subscriptionChangedPublishMode ( UaSubscription pUaSubscription)
protectedvirtual

Event for derived classes indicating that the publish mode of a subscription was changed.

Parameters
pUaSubscriptionInterface pointer of the changed subscription.
OpcUa_UInt32 UaSubscriptionManager::subscriptionCount ( )
protected

Counts all available Subscriptions.

Returns
the counted number of all Subscriptions.
void UaSubscriptionManager::subscriptionCreated ( UaSubscription pUaSubscription)
protectedvirtual

Event for derived classes indicating that a new subscription was created.

Parameters
pUaSubscriptionInterface pointer of the new subscription.
void UaSubscriptionManager::subscriptionDeleted ( UaSubscription pUaSubscription)
protectedvirtual

Event for derived classes indicating that a subscription was deleted.

Parameters
pUaSubscriptionInterface pointer of the deleted subscription.
void UaSubscriptionManager::subscriptionModified ( UaSubscription pUaSubscription)
protectedvirtual

Event for derived classes indicating that a subscription was modified.

Parameters
pUaSubscriptionInterface pointer of the modified subscription.
void UaSubscriptionManager::waitForTransactionCompletion ( )

Wait for completion of all subscription related transactions.


The documentation for this class was generated from the following files: