EventManagerBase Class Reference

#include <eventmanagerbase.h>

Inheritance diagram for EventManagerBase:
Collaboration diagram for EventManagerBase:

List of all members.

Public Member Functions

 EventManagerBase ()
virtual ~EventManagerBase ()
virtual void shutDownEM ()
virtual void fireEvent (UaEventData *pEventData)
virtual void registerEventNotifier (const UaNodeId &parentNotifier, const UaNodeId &newNotifier)
virtual void registerEventSource (const UaNodeId &parentNotifier, const UaNodeId &newSource)
virtual void unregisterEventNotifier (const UaNodeId &notifier)
virtual OpcUa_Boolean isNotifier (const UaNodeId &eventNotifier) const
 < [in] NodeId of the node to check for beeing an event notifier
virtual OpcUa_Boolean isEventManagerRootNotifier (const UaNodeId &notifier) const
 < [in] NodeId of the event notifier used in the event monitored item
virtual OpcUa_Boolean inNotifierTree (const UaNodeId &eventNotifier, const UaNodeId &sourceNode, UaEventData *pEventData) const
 < [in] 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 UaStatus beginEventTransaction (EventManagerCallback *, const ServiceContext &, OpcUa_UInt32, OpcUa_Handle &)
virtual UaStatus beginStartMonitoring (OpcUa_Handle, OpcUa_UInt32, OpcUa_UInt32, EventCallback *, const EventMonitoringContextCreate &)
virtual UaStatus beginModifyMonitoring (OpcUa_Handle, OpcUa_UInt32, OpcUa_UInt32, OpcUa_UInt32, const EventMonitoringContext &)
virtual UaStatus beginStopMonitoring (OpcUa_Handle hEventManagerContext, OpcUa_UInt32, OpcUa_UInt32, OpcUa_UInt32)
virtual UaStatus finishEventTransaction (OpcUa_Handle)
virtual UaStatus beginConditionRefresh (const ServiceContext &serviceContext, OpcUa_UInt32 hEventItem, const UaByteString &, const UaByteString &)
virtual UaStatus sendRefreshRequired (OpcUa_UInt32 hEventItem, const UaByteString &eventId)

Static Public Member Functions

static void buildEventId (const UaByteString &userEventId, UaByteString &clientEventId)
static void getUserEventId (const UaByteString &clientEventId, UaByteString &userEventId)
static void registerEventType (const UaNodeId &superType, const UaNodeId &newType)
static OpcUa_UInt32 registerEventField (const UaQualifiedName &fieldName)
static OpcUa_UInt32 registerEventField (const UaQualifiedNameArray &path)
static OpcUa_UInt32 registerEventField (const UaString &fieldName)
static void unregisterEventType (const UaNodeId &typeToRemove)
static void unregisterEventField (OpcUa_UInt32 fieldIndex)
static OpcUa_UInt32 getFieldIndex (const OpcUa_SimpleAttributeOperand &selectClause, OpcUa_StatusCode &fieldResult)
static OpcUa_Boolean isOfType (const UaNodeId &eventType, const UaNodeId &typeToEvaluate)
static void clearStaticMembers ()

Detailed Description

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.


Constructor & Destructor Documentation

EventManagerBase::EventManagerBase (  )

Constructs an EventManagerBase object providing a base implementation of the EventManager interface.

EventManagerBase::~EventManagerBase (  ) [virtual]

Destroys the EventManagerBase object.


Member Function Documentation

UaStatus EventManagerBase::beginConditionRefresh ( const ServiceContext serviceContext,
OpcUa_UInt32  hEventItem,
const UaByteString beginEventId,
const UaByteString endEventId 
) [virtual]

This method triggers a refresh for all conditions of interest in the EventManager.

Returns:
Status code.

Reimplemented from EventManager.

UaStatus EventManagerBase::beginEventTransaction ( EventManagerCallback pCallback,
const ServiceContext serviceContext,
OpcUa_UInt32  hTransaction,
OpcUa_Handle &  hEventManagerContext 
) [virtual]

Begins a transaction for changing the list of event monitored items.

Parameters:
pCallbackinterface used for the transaction. The IOManager must use this interface to finish the action for each passed node in the transaction.
serviceContextGeneral context for the service calls containing information like the session object, return diagnostic mask and timeout hint.
hTransactionHandle for the transaction used by the SDK to identify the transaction in the callbacks. This handle was passed in to the IOManager with the beginTransaction method.
hEventManagerContexta Variable with all information about the current context.
Returns:
Error code.

Implements EventManager.

UaStatus EventManagerBase::beginModifyMonitoring ( OpcUa_Handle  hEventManagerContext,
OpcUa_UInt32  callbackHandle,
OpcUa_UInt32  eventManagerIndex,
OpcUa_UInt32  hEventItem,
const EventMonitoringContext eventMonitoringContext 
) [virtual]

Begins to modify monitoring.

Parameters:
hEventManagerContextThe handle for the transaction context returned by beginEventTransaction.
callbackHandleHandle for the node in the callback.
eventManagerIndexIndex of the EventManager in the SDK.
hEventIteman EventItem used to fire an Event.
eventMonitoringContextSettings for an event monitored item contained in the EventMonitoringContext class.
Returns:
Error code.

Implements EventManager.

UaStatus EventManagerBase::beginStartMonitoring ( OpcUa_Handle  hEventManagerContext,
OpcUa_UInt32  callbackHandle,
OpcUa_UInt32  eventManagerIndex,
EventCallback pEventCallback,
const EventMonitoringContextCreate eventMonitoringContext 
) [virtual]

Begind to start monitoring.

Parameters:
hEventManagerContextThe handle for the transaction context returned by beginEventTransaction.
callbackHandleHandle for the node in the callback.
eventManagerIndexIndex of the EventManager in the SDK.
pEventCallbackThe Event callback interface of the monitored Item.
eventMonitoringContextSettings for an event monitored item contained in the EventMonitoringContext class.
Returns:
Error code.

Implements EventManager.

UaStatus EventManagerBase::beginStopMonitoring ( OpcUa_Handle  hEventManagerContext,
OpcUa_UInt32  callbackHandle,
OpcUa_UInt32  eventManagerIndex,
OpcUa_UInt32  hEventItem 
) [virtual]

Begins to stop monitoring.

Parameters:
hEventManagerContexta Variable with all information about the current context.
callbackHandleHandle for the node in the callback.
eventManagerIndexan Index of different EventManagers.
hEventIteman EventItem used to fire an Event.
Returns:
Error code.

Implements EventManager.

void EventManagerBase::buildEventId ( const UaByteString userEventId,
UaByteString clientEventId 
) [static]

Build a unique EventId that can be send to the client and include a user specific part if provided.

Parameters:
[in]userEventIdOptional user specific part included in the event id
[out]clientEventIdUnique EventId that can be send to the client
void EventManagerBase::clearStaticMembers (  ) [static]

Internal SDK method to clean up static members.

UaStatus EventManagerBase::finishEventTransaction ( OpcUa_Handle  hEventManagerContext ) [virtual]

Finishes the transaction for changing the list of event monitored items.

Returns:
Status code.
Parameters:
[in]hEventManagerContextHandle of the event transaction

Implements EventManager.

void EventManagerBase::fireEvent ( UaEventData pEventData ) [virtual]

Fire an event with the passed event data

Parameters:
[in]pEventDataThe data for the event to fire
OpcUa_UInt32 EventManagerBase::getFieldIndex ( const OpcUa_SimpleAttributeOperand &  selectClause,
OpcUa_StatusCode &  fieldResult 
) [static]

Internal SDK method to get the index of a registered event field.

void EventManagerBase::getUserEventId ( const UaByteString clientEventId,
UaByteString userEventId 
) [static]

Get the user part of a unique EventId that was sent to the client.

Parameters:
[in]clientEventIdUnique EventId that was sent to the client
[out]userEventIdOptional user specific part included in the event id
OpcUa_Boolean EventManagerBase::inNotifierTree ( const UaNodeId eventNotifier,
const UaNodeId sourceNode,
UaEventData pEventData 
) const [virtual]

< [in] 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.

Checks wether 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.

Parameters:
[in]eventNotifierNodeId of the event notifier used in the event monitored item
[in]sourceNodeNodeId of the source node of the event
OpcUa_Boolean EventManagerBase::isEventManagerRootNotifier ( const UaNodeId notifier ) const [virtual]

< [in] NodeId of the event notifier used in the event monitored item

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 hirarchy.

OpcUa_Boolean EventManagerBase::isNotifier ( const UaNodeId node ) const [virtual]

< [in] NodeId of the node to check for beeing an event notifier

Checks wether 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.

OpcUa_Boolean EventManagerBase::isOfType ( const UaNodeId eventType,
const UaNodeId typeToEvaluate 
) [static]

Internal SDK method used to evaluate the event type with the evnt filter

Parameters:
[in]eventTypeEvent type that is requested as filter
[in]typeToEvaluateActual event type that needs to be evaluated with the filter event type
OpcUa_UInt32 EventManagerBase::registerEventField ( const UaQualifiedName fieldName ) [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 verifiy if the client selected event field is valid and to get the unique index for optimized access to the event field through UaEventData::getFieldData().

Parameters:
fieldNameField name for a field that is a direct component of the event type.
Returns:
Unique index for the event field used in UaEventData::getFieldData()
OpcUa_UInt32 EventManagerBase::registerEventField ( const UaString fieldName ) [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 verifiy 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

  • ns=0|Time (BaseEventType)
  • ns=0|Message (BaseEventType)
  • ns=0|ActiveState (AlarmConditionType)
  • ns=0|ActiveState/ns=0|Id (AlarmConditionType)
  • ns=6|Temperature (User specific event type)
Parameters:
fieldNameField 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 seperated with "/".
Returns:
Unique index for the event field used in UaEventData::getFieldData()
OpcUa_UInt32 EventManagerBase::registerEventField ( const UaQualifiedNameArray &  path ) [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 verifiy if the client selected event field is valid and to get the unique index for optimized access to the event field through UaEventData::getFieldData().

Parameters:
pathPath of qualified names from the event type to the event field.
Returns:
Unique index for the event field used in UaEventData::getFieldData()
void EventManagerBase::registerEventNotifier ( const UaNodeId parentNotifier,
const UaNodeId newNotifier 
) [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 montitored 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.

Parameters:
[in]parentNotifierEvent notifier used as parent for the new event notifier
[in]newNotifierNew event notifier to add to the event notifier tree
void EventManagerBase::registerEventSource ( const UaNodeId parentNotifier,
const UaNodeId newSource 
) [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 montitored 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.

void EventManagerBase::registerEventType ( const UaNodeId superType,
const UaNodeId newType 
) [static]

Adds a custom event type to the event type tree.

Parameters:
[in]superTypeSuper type used to add the new type as derived type
[in]newTypeNew type to add to the type tree
UaStatus EventManagerBase::sendRefreshRequired ( OpcUa_UInt32  hEventItem,
const UaByteString eventId 
) [virtual]

This method triggers a RefreshRequired event to the clients This event forces the clients to syncronize 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.

Parameters:
hEventItemHandle used to identify the EventItem in the EventManager. The handle is provided by the EventManager in the callback EventManagerCallback::finishStartMonitoring.
eventIdEventId used for the RefreshRequired. All monitored items must use the same EventId for this event.
Returns:
Result code of the method call

Reimplemented from EventManager.

void EventManagerBase::shutDownEM (  ) [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.

void EventManagerBase::unregisterEventField ( OpcUa_UInt32  fieldIndex ) [static]

Removes a custom event field with the unique index assigned in EventManagerBase::registerEventField().

Parameters:
[in]fieldIndexIndex assigned in EventManagerBase::registerEventField().
void EventManagerBase::unregisterEventNotifier ( const UaNodeId notifier ) [virtual]

Removes an event notifier and all of its notfier children and event sources from the event notifier tree.

Parameters:
[in]notifierNodeId of the event notifier used in the event monitored item
void EventManagerBase::unregisterEventType ( const UaNodeId typeToRemove ) [static]

Removes a custom event type from the event type tree.

Parameters:
[in]typeToRemoveType to remove from the type tree

The documentation for this class was generated from the following files:
  • /home/buildbot/work/uasdkcpp/src/uaserver/uaservercpp/coremodule/eventmanagerbase.h
  • /home/buildbot/work/uasdkcpp/src/uaserver/uaservercpp/coremodule/eventmanagerbase.cpp