S2OPC OPCUA Toolkit
Loading...
Searching...
No Matches
sopc_event_manager.h File Reference

Contains the interface to configure events in the server. This interface is intended to be used by the server frontend wrapper only. More...

#include "sopc_address_space.h"
#include "sopc_event.h"

Go to the source code of this file.

Typedefs

typedef SOPC_Dict SOPC_Server_Event_Types
 OPC UA server events types configuration.
 

Functions

SOPC_ReturnStatus SOPC_EventManager_CreateEventTypes (SOPC_AddressSpace *addSpace, SOPC_Server_Event_Types **outEventTypes)
 Creates the server event types based on given server address space. The BaseEventType is used to find and create reference event types that will be allowed to be instantiated using SOPC_EventManager_CreateEventInstance. BaseEventTypes and all subtypes of BaseEventTypes are then instantiable. Each event variable of each type are referenced and could be modified using SOPC_Event_SetVariable or SOPC_Event_SetVariableFromStrPath.
 
bool SOPC_EventManager_HasEventType (const SOPC_Server_Event_Types *eventTypes, const SOPC_NodeId *eventTypeId)
 Checks if the given event type id is configured in the server event types provided.
 
SOPC_ReturnStatus SOPC_EventManager_HasEventTypeAndBrowsePath (const SOPC_Server_Event_Types *eventTypes, const SOPC_NodeId *eventTypeId, int32_t nbQNamePath, const SOPC_QualifiedName *qNamePath)
 Checks both if the given event type id is configured in the server event types and if the associated browse path is valid for this event type.
 
SOPC_EventSOPC_EventManager_CreateEventInstance (const SOPC_Server_Event_Types *eventTypes, const SOPC_NodeId *eventTypeId)
 Creates an event instance based on the given reference event types. The EventId value is set to a unique value by this function prior to returning the new event instance. Caller is responsible for event deallocation.
 
void SOPC_EventManager_Delete (SOPC_Server_Event_Types **eventTypes)
 Clears the given event types content, the pointed configuration is deallocated and pointer is set to NULL.
 
SOPC_ReturnStatus SOPC_EventManagerUtil_QnPathToCString (uint16_t nbQnPath, const SOPC_QualifiedName *qNamePath, char **qnPathStr)
 Utility function to generate a C string version of a browse path composed of qualified names and separated by '~': "<SOPC_QualifiedName_ToCString(qNamePath[0])>~<SOPC_QualifiedName_ToCString(qNamePath[1])>~[...]<SOPC_QualifiedName_ToCString(qNamePath[nbQnPath-1])>".
 
SOPC_ReturnStatus SOPC_EventManagerUtil_cStringPathToQnPath (char qnPathSep, const char *qnPathStr, int32_t *nbQnPath, SOPC_QualifiedName **qNamePath)
 Utility function to parse a C string version of a browse path composed of qualified names and separated by qnPathSep character, e.g. '~': "<SOPC_QualifiedName_ToCString(qNamePath[0])>~<SOPC_QualifiedName_ToCString(qNamePath[1])>~[...]<SOPC_QualifiedName_ToCString(qNamePath[nbQnPath-1])>".
 

Detailed Description

Contains the interface to configure events in the server. This interface is intended to be used by the server frontend wrapper only.

Typedef Documentation

◆ SOPC_Server_Event_Types

OPC UA server events types configuration.

Function Documentation

◆ SOPC_EventManager_CreateEventTypes()

SOPC_ReturnStatus SOPC_EventManager_CreateEventTypes ( SOPC_AddressSpace * addSpace,
SOPC_Server_Event_Types ** outEventTypes )

Creates the server event types based on given server address space. The BaseEventType is used to find and create reference event types that will be allowed to be instantiated using SOPC_EventManager_CreateEventInstance. BaseEventTypes and all subtypes of BaseEventTypes are then instantiable. Each event variable of each type are referenced and could be modified using SOPC_Event_SetVariable or SOPC_Event_SetVariableFromStrPath.

Note
If BaseEventType cannot be found, the BaseEventType of 1.04 Nodeset is used as referenced and is the only event type available for instantiation.
Parameters
addSpaceThe server address space containing the reference event types for events instantiation.
[out]outEventTypesThe reference event types created by this function in case of success.
Returns
SOPC_STATUS_OK in case of success.

◆ SOPC_EventManager_HasEventType()

bool SOPC_EventManager_HasEventType ( const SOPC_Server_Event_Types * eventTypes,
const SOPC_NodeId * eventTypeId )

Checks if the given event type id is configured in the server event types provided.

Parameters
eventTypesThe reference event types that might contain the event type corresponding to the given eventTypeId
eventTypeIdThe NodeId of the event type to instantiate
Returns
true if eventTypes contains eventTypeId, false otherwise (or in case of invalid parameter)

◆ SOPC_EventManager_HasEventTypeAndBrowsePath()

SOPC_ReturnStatus SOPC_EventManager_HasEventTypeAndBrowsePath ( const SOPC_Server_Event_Types * eventTypes,
const SOPC_NodeId * eventTypeId,
int32_t nbQNamePath,
const SOPC_QualifiedName * qNamePath )

Checks both if the given event type id is configured in the server event types and if the associated browse path is valid for this event type.

Parameters
eventTypesThe reference event types that might contain the event type corresponding to the given eventTypeId
eventTypeIdThe NodeId of the event type to instantiate
nbQNamePathThe number of qualified names in the relative browse path to a node
qNamePathThe array of nbQNamePath qualified names in the relative browse path to a node
Returns
SOPC_STATUS_OK in case of success, otherwise SOPC_STATUS_INVALID_PARAMETERS (invalid parameters or NULL browse name) or SOPC_STATUS_NOK (absent event type or browse path)

◆ SOPC_EventManager_CreateEventInstance()

SOPC_Event * SOPC_EventManager_CreateEventInstance ( const SOPC_Server_Event_Types * eventTypes,
const SOPC_NodeId * eventTypeId )

Creates an event instance based on the given reference event types. The EventId value is set to a unique value by this function prior to returning the new event instance. Caller is responsible for event deallocation.

Parameters
eventTypesThe reference event types that shall contain the event type corresponding to the given eventTypeId
eventTypeIdThe NodeId of the event type to instantiate
Returns
The created event instance or NULL in case of error

◆ SOPC_EventManager_Delete()

void SOPC_EventManager_Delete ( SOPC_Server_Event_Types ** eventTypes)

Clears the given event types content, the pointed configuration is deallocated and pointer is set to NULL.

Parameters
eventTypesThe event types configuration to delete

◆ SOPC_EventManagerUtil_QnPathToCString()

SOPC_ReturnStatus SOPC_EventManagerUtil_QnPathToCString ( uint16_t nbQnPath,
const SOPC_QualifiedName * qNamePath,
char ** qnPathStr )

Utility function to generate a C string version of a browse path composed of qualified names and separated by '~': "<SOPC_QualifiedName_ToCString(qNamePath[0])>~<SOPC_QualifiedName_ToCString(qNamePath[1])>~[...]<SOPC_QualifiedName_ToCString(qNamePath[nbQnPath-1])>".

Parameters
nbQnPathNumber of qualified names in the browse path contained in qNamePath, it shall be > 0.
qNamePathArray of qualified names of length qNamePath representing the browse path
[out]qnPathStrThe resulting C string representing the browse path as a string
Returns
SOPC_STATUS_OK in case of success, SOPC_STATUS_INVALID_PARAMETERS (invalid path size or empty QualifiedName path, etc.) or SOPC_STATUS_OUT_OF_MEMORY otherwise.

◆ SOPC_EventManagerUtil_cStringPathToQnPath()

SOPC_ReturnStatus SOPC_EventManagerUtil_cStringPathToQnPath ( char qnPathSep,
const char * qnPathStr,
int32_t * nbQnPath,
SOPC_QualifiedName ** qNamePath )

Utility function to parse a C string version of a browse path composed of qualified names and separated by qnPathSep character, e.g. '~': "<SOPC_QualifiedName_ToCString(qNamePath[0])>~<SOPC_QualifiedName_ToCString(qNamePath[1])>~[...]<SOPC_QualifiedName_ToCString(qNamePath[nbQnPath-1])>".

Parameters
qnPathSepThe character to use as separator between path elements in qnPathStr, '\0' is forbidden
qnPathStrThe qualified name path separated by qnPathSep separator as a string. It might be empty. E.g. with sep='~' for path qn0=(nsIdx=0,"EnabledState"), qn1=(0,"Id"): "0:EnabledState~0:Id". The escape character '\' might be used to un-specialize separator
[out]nbQnPathNumber of qualified names in the browse path contained in qNamePath
[out]qNamePathArray of qualified names of length qNamePath representing the browse path
Returns
SOPC_STATUS_OK in case of success, SOPC_STATUS_INVALID_PARAMETERS (invalid path size or NULL input, etc.) or SOPC_STATUS_OUT_OF_MEMORY otherwise.