UA Server SDK C++ Bundle
1.4.0.258
|
Implements the EventManager interface base functionality independent of the node management It handles all active event monitored items and all event filtering and event field selection. More...
#include <eventmanagerbase.h>
Inherits EventManager.
Inherited by EventManagerUaNode.
Public Member Functions | |
EventManagerBase () | |
Constructs an EventManagerBase object providing a base implementation of the EventManager interface. More... | |
virtual | ~EventManagerBase () |
Destroys the EventManagerBase object. More... | |
virtual void | shutDownEM () |
Shut down the event manager instance. More... | |
virtual void | fireEvent (UaEventData *pEventData) |
Fire an event with the passed event data. More... | |
virtual void | registerEventNotifier (const UaNodeId &parentNotifier, const UaNodeId &newNotifier) |
Add an event notifier to the event notifier tree. More... | |
virtual void | registerEventSource (const UaNodeId &parentNotifier, const UaNodeId &newSource) |
Add an event source to the event notifier tree. More... | |
virtual void | unregisterEventNotifier (const UaNodeId ¬ifier) |
Removes an event notifier and all of its notifier children and event sources from the event notifier tree. More... | |
virtual OpcUa_Boolean | isNotifier (const UaNodeId &eventNotifier) const |
Checks whether the passed NodeId is the NodeId of an event notifier object. More... | |
virtual OpcUa_Boolean | isEventManagerRootNotifier (const UaNodeId ¬ifier) const |
Checks whether the passed NodeId is a root notifier for this EventManager. More... | |
virtual OpcUa_Boolean | inNotifierTree (const UaNodeId &eventNotifier, const UaNodeId &sourceNode, UaEventData *pEventData) const |
Checks whether the passed sourceNode matches the event notifier or is part of the event notifier tree below the eventNotifier. More... | |
virtual UaStatus | beginEventTransaction (EventManagerCallback *, const ServiceContext &, OpcUa_UInt32, OpcUa_UInt32, EventTransactionType, OpcUa_Handle &) |
Begins a transaction for modifying the list of event monitored items. More... | |
virtual UaStatus | beginStartMonitoring (OpcUa_Handle, OpcUa_UInt32, OpcUa_UInt32, EventCallback *, const EventMonitoringContextCreate &) |
Start monitoring of an event notifier. More... | |
virtual UaStatus | beginModifyMonitoring (OpcUa_Handle, OpcUa_UInt32, OpcUa_UInt32, OpcUa_UInt32, const EventMonitoringContext &) |
Notify EventManager about modifying monitoring parameters of an event notifier. More... | |
virtual UaStatus | beginStopMonitoring (OpcUa_Handle hEventManagerContext, OpcUa_UInt32, OpcUa_UInt32, OpcUa_UInt32) |
Notify EventManager about stopping monitoring of an event notifier. More... | |
virtual UaStatus | finishEventTransaction (OpcUa_Handle) |
Finishes the transaction for changing the list of event monitored items. More... | |
virtual UaStatus | beginConditionRefresh (const ServiceContext &serviceContext, OpcUa_UInt32 hEventItem, const UaByteString &, const UaByteString &) |
This method triggers a refresh for all conditions of interest in the EventManager. More... | |
virtual UaStatus | sendRefreshRequired (OpcUa_UInt32 hEventItem, const UaByteString &eventId) |
This method triggers a RefreshRequired event to the clients This event forces the clients to synchronize with the current Condition states by calling ConditionRefresh This method needs to be implemented in every EventManager that is part of a system that provides condition objects. More... | |
Public Member Functions inherited from EventManager | |
EventManager () | |
construction | |
virtual | ~EventManager () |
destruction | |
Static Public Member Functions | |
static void | buildEventId (const UaByteString &userEventId, UaByteString &clientEventId) |
Build a unique EventId that can be send to the client and include a user specific part if provided. More... | |
static void | getUserEventId (const UaByteString &clientEventId, UaByteString &userEventId) |
Get the user part of a unique EventId that was sent to the client. More... | |
static void | registerEventType (const UaNodeId &superType, const UaNodeId &newType) |
Adds a custom event type to the event type tree. More... | |
static OpcUa_UInt32 | registerEventField (const UaQualifiedName &fieldName) |
Add a custom event field to assign a unique index for selection of the field of the custom type. More... | |
static OpcUa_UInt32 | registerEventField (const UaQualifiedNameArray &path) |
Add a custom event field to assign a unique index for selection of the field of the custom type. More... | |
static OpcUa_UInt32 | registerEventField (const UaString &fieldName) |
Add a custom event field to assign a unique index for selection of the field of the custom type. More... | |
static void | unregisterEventType (const UaNodeId &typeToRemove) |
Removes a custom event type from the event type tree. More... | |
static void | unregisterEventField (OpcUa_UInt32 fieldIndex) |
Removes a custom event field with the unique index assigned in EventManagerBase::registerEventField(). More... | |
static OpcUa_UInt32 | getFieldIndex (const OpcUa_SimpleAttributeOperand &selectClause, OpcUa_StatusCode &fieldResult) |
Internal SDK method to get the index of a registered event field. More... | |
static OpcUa_Boolean | isOfType (const UaNodeId &eventType, const UaNodeId &typeToEvaluate) |
Internal SDK method used to evaluate the event type with the event filter. More... | |
static void | clearStaticMembers () |
Internal SDK method to clean up static members. More... | |
Protected Attributes | |
HandleManager< EventItem > | m_EventItemsHandleManager |
UaMutex | m_mutex |
EventNotifierTreeElement * | m_pEventNotifierTree |
std::map< UaNodeId, EventNotifierTreeElement * > | m_notifierTreeEntries |
std::map< UaNodeId, ConditionBranchList * > | m_activeConditions |
OpcUa_Boolean | m_isShutDown |
Static Protected Attributes | |
static UaMutex * | s_pMutex = NULL |
static OpcUa_UInt32 | s_maxFieldIndex = 0 |
static std::map< UaString, OpcUa_UInt32 > | s_eventFields |
static EventTypeTreeElement * | s_pEventTypeTree = NULL |
static std::map< UaNodeId, EventTypeTreeElement * > | s_eventTreeEntries |
Additional Inherited Members | |
Public Types inherited from EventManager | |
enum | EventTransactionType { MONITOR_BEGIN, MONITOR_MODIFY, MONITOR_STOP, INVALID } |
EventTransactionType enumeration. More... | |
Implements the EventManager interface base functionality independent of the node management It handles all active event monitored items and all event filtering and event field selection.
EventManagerBase::EventManagerBase | ( | ) |
Constructs an EventManagerBase object providing a base implementation of the EventManager interface.
|
virtual |
Destroys the EventManagerBase object.
|
virtual |
This method triggers a refresh for all conditions of interest in the EventManager.
Reimplemented from EventManager.
|
virtual |
Begins a transaction for modifying the list of event monitored items.
pCallback | Callback interface used for the transaction. The EventManager must use this interface to finish the action for each passed event monitored item in the transaction. |
serviceContext | General context for the service calls containing information like the session object, return diagnostic mask and timeout hint. |
hTransaction | Handle for the transaction used by the SDK to identify the transaction in the callbacks. The Event manager must store this handle and use it in callbacks to EventManagerCallback |
totalItemCountHint | A hint for the EventManager about the total number of monitored items in the transaction. The EventManager may not be responsible for all items but he can use this hint if he wants to optimize memory allocation. |
transactionType | Type of the transaction. The possible enum values are:
|
hEventManagerContext | Handle provided by the EventManager to identify the transaction in the following begin calls. |
Implements EventManager.
|
virtual |
Notify EventManager about modifying monitoring parameters of an event notifier.
hEventManagerContext | Handle provided by the EventManager in beginEventTransaction used to identify the transaction context for this call. |
callbackHandle | Handle for the item in the callback. |
eventManagerIndex | Index of the EventManager that needs to be passed to the callback function. |
hEventItem | Handle used to identify the EventItem in the EventManager. The handle is provided by the EventManager in the callback EventManagerCallback::finishStartMonitoring. |
eventMonitoringContext | Settings for an event monitored item contained in the EventMonitoringContext class. |
Implements EventManager.
|
virtual |
Start monitoring of an event notifier.
hEventManagerContext | Handle provided by the EventManager in beginEventTransaction used to identify the transaction context for this call. |
callbackHandle | Handle for the item in the callback. |
eventManagerIndex | Index of the EventManager that needs to be passed to the callback function. |
pEventCallback | The callback Interface for the monitored item. |
eventMonitoringContext | Settings for an event monitored item contained in the EventMonitoringContext class. |
Implements EventManager.
|
virtual |
Notify EventManager about stopping monitoring of an event notifier.
hEventManagerContext | Handle provided by the EventManager in beginEventTransaction used to identify the transaction context for this call. |
callbackHandle | Handle for the item in the callback. |
eventManagerIndex | Index of the EventManager that needs to be passed to the callback function. |
hEventItem | Handle used to identify the EventItem in the EventManager. The handle is provided by the EventManager in the callback EventManagerCallback::finishStartMonitoring. |
Implements EventManager.
|
static |
Build a unique EventId that can be send to the client and include a user specific part if provided.
[in] | userEventId | Optional user specific part included in the event id |
[out] | clientEventId | Unique EventId that can be send to the client |
|
static |
Internal SDK method to clean up static members.
|
virtual |
Finishes the transaction for changing the list of event monitored items.
[in] | hEventManagerContext | Handle of the event transaction |
Implements EventManager.
|
virtual |
Fire an event with the passed event data.
[in] | pEventData | The data for the event to fire |
|
static |
Internal SDK method to get the index of a registered event field.
|
static |
Get the user part of a unique EventId that was sent to the client.
[in] | clientEventId | Unique EventId that was sent to the client |
[out] | userEventId | Optional user specific part included in the event id |
|
virtual |
Checks whether the passed sourceNode matches the event notifier or is part of the event notifier tree below the eventNotifier.
A derived class can overwrite this check to apply its own logic for the event notifier tree.
[in] | eventNotifier | NodeId of the event notifier used in the event monitored item |
[in] | sourceNode | NodeId of the source node of the event |
[in] | pEventData | Event data for the current event. This information can be used by derived classes to do additional checks based on the event data by overwriting this function. |
|
virtual |
Checks whether the passed NodeId is a root notifier for this EventManager.
A root notifier is a node that can be used to receive all events from this EventManager. A derived class is able to overwrite this method to allow additional root notifiers in addition to the Server object that is the root notifier for the whole server. If a node is flagged as root notifier and it is used as monitored item, it is not checked if the source node is part of the notifier hierarchy.
[in] | notifier | NodeId of the event notifier used in the event monitored item |
|
virtual |
Checks whether the passed NodeId is the NodeId of an event notifier object.
A derived class can overwrite this check to apply its own for verifying if a node is relevant for monitoring in this EventManager.
[in] | node | NodeId of the node to check for beeing an event notifier |
|
static |
Internal SDK method used to evaluate the event type with the event filter.
[in] | eventType | Event type that is requested as filter |
[in] | typeToEvaluate | Actual event type that needs to be evaluated with the filter event type |
|
static |
Add a custom event field to assign a unique index for selection of the field of the custom type.
The field name is used by the EventManagerBase to verify if the client selected event field is valid and to get the unique index for optimized access to the event field through UaEventData::getFieldData().
fieldName | Field name for a field that is a direct component of the event type. |
|
static |
Add a custom event field to assign a unique index for selection of the field of the custom type.
The field name is used by the EventManagerBase to verify if the client selected event field is valid and to get the unique index for optimized access to the event field through UaEventData::getFieldData().
path | Path of qualified names from the event type to the event field. |
|
static |
Add a custom event field to assign a unique index for selection of the field of the custom type.
The field name is used by the EventManagerBase to verify if the client selected event field is valid and to get the unique index for optimized access to the event field through UaEventData::getFieldData().
Examples are
fieldName | Field name constructed by calling UaQualifiedName::toFullString() for the brows name of the event field. If the field is not a direct component of the event type the string is is constructed by the path of browse names separated with "/". |
|
virtual |
Add an event notifier to the event notifier tree.
Event notifier objects are objects where the EventNotifier attribute is set to SubscribeToEvents. They can be used as nodes in event monitored items. This can be used to limit the events from the monitored item to a specific event notifier or to a part of an event notifier tree.
[in] | parentNotifier | Event notifier used as parent for the new event notifier |
[in] | newNotifier | New event notifier to add to the event notifier tree |
|
virtual |
Add an event source to the event notifier tree.
Event sources are nodes triggering events through one or more notifier objects. Notifier objects are objects where the EventNotifier attribute is set to SubscribeToEvents. They can be used as nodes in event monitored items. This can be used to limit the events from the monitored item to a specific event notifier or to a part of an event notifier tree. This method is used to register an event source with an event notifier for event filtering.
|
static |
Adds a custom event type to the event type tree.
[in] | superType | Super type used to add the new type as derived type |
[in] | newType | New type to add to the type tree |
|
virtual |
This method triggers a RefreshRequired event to the clients This event forces the clients to synchronize with the current Condition states by calling ConditionRefresh This method needs to be implemented in every EventManager that is part of a system that provides condition objects.
The method is not allowed to be blocked in the EventManager. If the method is called, the EventManager must issue a RefreshStartEventType, must resend the state for any condition where the retain flag is set to true and must send a RefreshEndEventType after the conditions are processed. The refresh start and end events must be sent independent of the number of conditions.
hEventItem | Handle used to identify the EventItem in the EventManager. The handle is provided by the EventManager in the callback EventManagerCallback::finishStartMonitoring. |
eventId | EventId used for the RefreshRequired. All monitored items must use the same EventId for this event. |
Reimplemented from EventManager.
|
virtual |
Shut down the event manager instance.
This disconnects the event manager from all event receivers created with beginStartMonitoring, clears all resources and invalidates the event manager instance.
|
static |
Removes a custom event field with the unique index assigned in EventManagerBase::registerEventField().
[in] | fieldIndex | Index assigned in EventManagerBase::registerEventField(). |
|
virtual |
Removes an event notifier and all of its notifier children and event sources from the event notifier tree.
[in] | notifier | NodeId of the event notifier used in the event monitored item |
|
static |
Removes a custom event type from the event type tree.
[in] | typeToRemove | Type to remove from the type tree |