C++ Based OPC UA Client/Server SDK
1.6.1.391
|
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 UaSubscription * | 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) |
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... | |
UaSubscription * | findSubscription (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... | |
UaSubscription * | getFirstSubscription () |
Get the first available Subscription. More... | |
UaSubscription * | getNextSubscription () |
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... | |
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.
UaSubscriptionManager::UaSubscriptionManager | ( | ServerManager * | pServerManager | ) |
construction
pServerManager | Interface 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 |
|
protected |
Adds Subscriptions and returns the assigned integerId.
pSubscription | The subscription to add. |
|
protected |
Adds Subscriptions with a specified integerId.
subscriptionId | The subscription id for the subscription to add. |
pSubscription | The subscription to add. |
UaStatus UaSubscriptionManager::beginConditionRefresh | ( | const ServiceContext & | serviceContext, |
OpcUa_UInt32 | subscriptionId | ||
) |
Refresh condition state for the passed subscription.
serviceContext | General 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.
serviceContext | General context for the service calls containing information like the session object, return diagnostic mask and timeout hint. |
subscriptionId | SubsriptionId for the subscription that contains the monitored item |
monitoredItemId | MonitoredItemId for the monitored item to refresh. |
UaStatus UaSubscriptionManager::beginCreateMonitoredItems | ( | UaCreateMonitoredItemsContext * | pUaCreateMonitoredItemsContext | ) |
Create new monitored items.
pUaCreateMonitoredItemsContext | the context of the items to create. |
UaStatus UaSubscriptionManager::beginDeleteMonitoredItems | ( | UaDeleteMonitoredItemsContext * | pUaDeleteMonitoredItemsContext | ) |
Delete monitored items.
pUaDeleteMonitoredItemsContext | the context to delete. |
UaStatus UaSubscriptionManager::beginModifyMonitoredItems | ( | UaModifyMonitoredItemsContext * | pUaModifyMonitoredItemsContext | ) |
Modify monitored items.
pUaModifyMonitoredItemsContext | the context for the monitored items to modify. |
UaStatus UaSubscriptionManager::beginPublish | ( | UaPublishContext * | pUaPublishContext | ) |
Begin a Publish transaction.
pUaPublishContext | the context of the needed publish transaction. |
UaStatus UaSubscriptionManager::beginRepublish | ( | UaRepublishContext * | pUaRepublishContext | ) |
Begin a Republish transaction.
pUaRepublishContext | the context of the Republish transaction. |
UaStatus UaSubscriptionManager::beginSetMonitoringMode | ( | UaSetMonitoringModeContext * | pUaSetMonitoringModeContext | ) |
Set monitoring mode of monitored items.
pUaSetMonitoringModeContext | the context to be set. |
|
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
pSubscription | The Subscription to check. |
|
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.
pSession | Interface to the Session context for the method call |
publishingInterval | publishing interval in milliseconds the server allows |
lifetimeCount | a count for the the actual lifetime. |
maxKeepAliveCount | the maximum of Time to keep the Session alive. |
maxNotificationPerPublish | the maximum of notification per Publish. |
publishingEnabled | indicates if publishing is enabled or not. |
priority | the priority of the operation. |
subscriptionId | the Id of the Subscription. |
|
protectedvirtual |
Creates a new subscription object.
This method can be overwritten by a derived class to create a implementation specific derived class of UaSubscription.
pSession | Interface to the Session context for the method call |
pServerManager | Interface to the central ServerManager object. |
maxRetransmissionQueueSize | Maximum number of messages in the republish queue the server allows per Subscription |
publishingInterval | publishing interval in milliseconds the server allows |
lifetimeCount | a count for the the actual lifetime. |
maxKeepAliveCount | the maximum of Time to keep the Session alive. |
publishingEnabled | |
maxNotificationPerPublish | the maximum of notification per Publish. |
priority | the priority of the operation. |
|
protected |
Decrements the current subscription count.
UaStatus UaSubscriptionManager::deleteSubscription | ( | UaSession * | pSession, |
OpcUa_UInt32 | subscriptionId | ||
) |
Delete a Subscription.
pSession | Interface to the Session context for the method call |
subscriptionId | the Id of the Subscription. |
|
virtual |
Callback for new EventManager added to the server.
pEventManager | [in] EventManager interface |
|
virtual |
Executes the registration of a new EventManager added to the server.
pEventManager | [in] EventManager interface |
|
protected |
Find Subscriptions with a specified SubscriptionId.
integerId | the specified SubscriptionId to find. |
|
protected |
Get the first available Subscription.
|
protected |
Get the next available Subscription.
|
protected |
Increments the cumulated subscription count.
|
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.
pSession | Interface to the Session context for the method call |
subscriptionId | the Id of the Subscription. |
publishingInterval | publishing interval in milliseconds the server allows |
lifetimeCount | a count for the the actual lifetime. |
maxKeepAliveCount | the maximum of Time to keep the Session alive. |
maxNotificationPerPublish | the maximum of notification per Publish. |
priority | the priority of the operation. |
|
protected |
Removes Subscriptions with a specified integerId.
integerId | The Id of the Subscription to remove. |
|
virtual |
Main thread method.
Implements UaThread.
UaStatus UaSubscriptionManager::setPublishingMode | ( | UaSession * | pSession, |
OpcUa_UInt32 | subscriptionId, | ||
OpcUa_Boolean | publishingMode | ||
) |
Set PublishingMode of a Subscription.
pSession | Interface to the Session context for the method call |
subscriptionId | the Id of the Subscription. |
publishingMode | true if publishing mode false if not. |
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.
pSession | Interface to the Session context for the method call |
subscriptionId | the Id of the Subscription. |
triggeringItemId | the Id of the items to set triggering to. |
linksToAdd | the number of links to add to the monitored item. |
linksToRemove | the number of links toremove from the monitored item. |
addResults | the results of this operation. |
removeResults | the results to remove from this operation. |
UaStatus UaSubscriptionManager::shutDown | ( | ) |
Start up subscription manager.
UaStatus UaSubscriptionManager::startUp | ( | ) |
Start up subscription manager.
|
protectedvirtual |
Event for derived classes indicating that the publish mode of a subscription was changed.
pUaSubscription | Interface pointer of the changed subscription. |
|
protected |
Counts all available Subscriptions.
|
protectedvirtual |
Event for derived classes indicating that a new subscription was created.
pUaSubscription | Interface pointer of the new subscription. |
|
protectedvirtual |
Event for derived classes indicating that a subscription was deleted.
pUaSubscription | Interface pointer of the deleted subscription. |
|
protectedvirtual |
Event for derived classes indicating that a subscription was modified.
pUaSubscription | Interface pointer of the modified subscription. |
void UaSubscriptionManager::waitForTransactionCompletion | ( | ) |
Wait for completion of all subscription related transactions.