S2OPC OPCUA Toolkit
|
Interface to manipulate and customize OPC UA event instances. More...
#include "sopc_types.h"
Go to the source code of this file.
Typedefs | |
typedef struct _SOPC_Event | SOPC_Event |
The abstract structure type for an OpcUa event instance that might be triggered from nodes. | |
typedef void | SOPC_Event_ForEachVar_Fct(const char *qnPath, SOPC_Variant *var, const SOPC_NodeId *dataType, int32_t valueRank, uintptr_t user_data) |
Type of callback functions for SOPC_Event. The value of user_data is set when calling SOPC_Event_ForEachVar. | |
Functions | |
void | SOPC_Event_Clear (SOPC_Event *pEvent) |
Clears the content of an Event. | |
void | SOPC_Event_Delete (SOPC_Event **ppEvent) |
Deletes the content of an Event. | |
SOPC_Event * | SOPC_Event_CreateCopy (const SOPC_Event *pEvent, bool genNewId) |
Copies the provided event in a newly created event. | |
const SOPC_NodeId * | SOPC_Event_GetEventTypeId (const SOPC_Event *pEvent) |
Get the EventTypeId for the given event. | |
SOPC_ReturnStatus | SOPC_Event_SetEventId (SOPC_Event *pEvent, const SOPC_ByteString *pEventId) |
Sets the given EventId for the given event. | |
SOPC_ReturnStatus | SOPC_Event_SetSourceName (SOPC_Event *pEvent, const SOPC_String *pSourceName) |
Sets the given SourceName for the given event indicating the name of the event source. | |
SOPC_ReturnStatus | SOPC_Event_SetSourceNode (SOPC_Event *pEvent, const SOPC_NodeId *pSourceNode) |
Sets the given SourceNode for the given event indicating the node of the event source. | |
SOPC_DateTime | SOPC_Event_GetTime (const SOPC_Event *pEvent) |
Get the Time for the given event. | |
SOPC_ReturnStatus | SOPC_Event_SetTime (SOPC_Event *pEvent, SOPC_DateTime time) |
Sets the given Time for the given event indicating the time the event occurred. | |
SOPC_ReturnStatus | SOPC_Event_SetReceiveTime (SOPC_Event *pEvent, SOPC_DateTime receiveTime) |
(Internal purpose only) Sets the given ReceiveTime for the given event indicating the time the event was received by server (time it is triggered). | |
SOPC_ReturnStatus | SOPC_Event_SetLocalTime (SOPC_Event *pEvent, const OpcUa_TimeZoneDataType *pLocalTime) |
Sets the given LocalTime for the given event indicating the Offset and the DaylightSavingInOffset of the event. | |
SOPC_ReturnStatus | SOPC_Event_SetMessage (SOPC_Event *pEvent, const SOPC_LocalizedText *pMessage) |
Sets the given Message for the given event indicating a human-readable and localizable text description of the event. | |
SOPC_ReturnStatus | SOPC_Event_SetSeverity (SOPC_Event *pEvent, uint16_t severity) |
Sets the given Severity for the given event indicating the urgency of the event. | |
SOPC_ReturnStatus | SOPC_Event_SetVariable (SOPC_Event *pEvent, uint16_t nbQnPath, SOPC_QualifiedName *qualifiedNamePathArray, const SOPC_Variant *var) |
Sets the given variable value for the given browse path in the given event. | |
SOPC_ReturnStatus | SOPC_Event_SetVariableFromStrPath (SOPC_Event *pEvent, const char *qnPath, const SOPC_Variant *var) |
Sets the given variable value for the given browse path (as a string) in the given event. | |
const SOPC_Variant * | SOPC_Event_GetVariableFromStrPath (const SOPC_Event *pEvent, const char *qnPath) |
Gets the variable value for the given browse path (as a string) in the given event. | |
const SOPC_Variant * | SOPC_Event_GetVariableAndType (const SOPC_Event *pEvent, uint16_t nbQnPath, SOPC_QualifiedName *qualifiedNamePathArray, const SOPC_NodeId **outDataType, int32_t *outValueRank) |
Gets the variable value and type information for the given browse path in the given event. | |
const SOPC_Variant * | SOPC_Event_GetVariableAndTypeFromStrPath (const SOPC_Event *pEvent, const char *qnPath, const SOPC_NodeId **outDataType, int32_t *outValueRank) |
Gets the variable value and type information for the given browse path (as a string) in the given event. | |
void | SOPC_Event_ForEachVar (SOPC_Event *event, SOPC_Event_ForEachVar_Fct *func, uintptr_t user_data) |
Iterates over the event variables, calling the given function for each event variable. | |
Interface to manipulate and customize OPC UA event instances.
The initial instance should be created using ::SOPC_ServerHelper_CreateEvent using an existing event type id in the configured address space. Once the event has been customized, it might be triggered using ::SOPC_ServerHelper_TriggerEvent. This module provides dedicated functions to access the variables of base event type easily, including EventId, EventType, Time, Severity and Source. For other variables of known event subtypes, the generic access functions should be used to set variable value (::SOPC_Event_SetVariable or ::SOPC_Event_SetVariableFromStrPath) or to get variable value (::SOPC_Event_GetVariableAndType or ::SOPC_Event_GetVariableAndTypeFromStrPath).
typedef struct _SOPC_Event SOPC_Event |
The abstract structure type for an OpcUa event instance that might be triggered from nodes.
typedef void SOPC_Event_ForEachVar_Fct(const char *qnPath, SOPC_Variant *var, const SOPC_NodeId *dataType, int32_t valueRank, uintptr_t user_data) |
Type of callback functions for SOPC_Event. The value of user_data
is set when calling SOPC_Event_ForEachVar.
void SOPC_Event_Clear | ( | SOPC_Event * | pEvent | ) |
Clears the content of an Event.
pEvent | pointer to the event to clear |
void SOPC_Event_Delete | ( | SOPC_Event ** | ppEvent | ) |
Deletes the content of an Event.
ppEvent | reference on the pointer to the event to clear |
SOPC_Event * SOPC_Event_CreateCopy | ( | const SOPC_Event * | pEvent, |
bool | genNewId ) |
Copies the provided event in a newly created event.
pEvent | pointer to the event to copy |
genNewId | flag to set to indicate a new eventId shall be generated |
pEvent
or NULL in case of invalid parameter or allocation failure. const SOPC_NodeId * SOPC_Event_GetEventTypeId | ( | const SOPC_Event * | pEvent | ) |
Get the EventTypeId for the given event.
pEvent | pointer to the event from which EventTypeId shall be retrieved |
SOPC_ReturnStatus SOPC_Event_SetEventId | ( | SOPC_Event * | pEvent, |
const SOPC_ByteString * | pEventId ) |
Sets the given EventId for the given event.
pEvent | pointer to the event for which EventId shall be set |
pEventId | pointer to the byte string to set as EventId content |
SOPC_ReturnStatus SOPC_Event_SetSourceName | ( | SOPC_Event * | pEvent, |
const SOPC_String * | pSourceName ) |
Sets the given SourceName for the given event indicating the name of the event source.
pEvent | pointer to the event for which SourceName shall be set |
pSourceName | pointer to the string to set as source name |
SOPC_ReturnStatus SOPC_Event_SetSourceNode | ( | SOPC_Event * | pEvent, |
const SOPC_NodeId * | pSourceNode ) |
Sets the given SourceNode for the given event indicating the node of the event source.
pEvent | pointer to the event for which SourceNode shall be set |
pSourceNode | pointer to the node id to set as source node |
SOPC_DateTime SOPC_Event_GetTime | ( | const SOPC_Event * | pEvent | ) |
Get the Time for the given event.
pEvent | pointer to the event from which Time shall be retrieved |
SOPC_ReturnStatus SOPC_Event_SetTime | ( | SOPC_Event * | pEvent, |
SOPC_DateTime | time ) |
Sets the given Time for the given event indicating the time the event occurred.
pEvent | pointer to the event for which Time shall be set |
time | time value of the event to set |
SOPC_ReturnStatus SOPC_Event_SetReceiveTime | ( | SOPC_Event * | pEvent, |
SOPC_DateTime | receiveTime ) |
(Internal purpose only) Sets the given ReceiveTime for the given event indicating the time the event was received by server (time it is triggered).
pEvent | pointer to the event for which Time shall be set |
receiveTime | receive time value of the event by the server |
SOPC_ReturnStatus SOPC_Event_SetLocalTime | ( | SOPC_Event * | pEvent, |
const OpcUa_TimeZoneDataType * | pLocalTime ) |
Sets the given LocalTime for the given event indicating the Offset and the DaylightSavingInOffset of the event.
pEvent | pointer to the event for which SourceNode shall be set |
pLocalTime | pointer to the time zone data to set as local time |
SOPC_ReturnStatus SOPC_Event_SetMessage | ( | SOPC_Event * | pEvent, |
const SOPC_LocalizedText * | pMessage ) |
Sets the given Message for the given event indicating a human-readable and localizable text description of the event.
pEvent | pointer to the event for which Message shall be set |
pMessage | pointer to the message to set as message description |
SOPC_ReturnStatus SOPC_Event_SetSeverity | ( | SOPC_Event * | pEvent, |
uint16_t | severity ) |
Sets the given Severity for the given event indicating the urgency of the event.
pEvent | pointer to the event for which SourceNode shall be set |
severity | severity value to set for the given event |
SOPC_ReturnStatus SOPC_Event_SetVariable | ( | SOPC_Event * | pEvent, |
uint16_t | nbQnPath, | ||
SOPC_QualifiedName * | qualifiedNamePathArray, | ||
const SOPC_Variant * | var ) |
Sets the given variable value for the given browse path in the given event.
pEvent | pointer to the event for which variable value shall be set |
nbQnPath | number of qualified name in the browse path |
qualifiedNamePathArray | qualified name path array containing the nbQnPath path elements (e.g.: ['0:EnabledState', '0:Id']) |
var | variable to set in the given event for the given browse path |
SOPC_ReturnStatus SOPC_Event_SetVariableFromStrPath | ( | SOPC_Event * | pEvent, |
const char * | qnPath, | ||
const SOPC_Variant * | var ) |
Sets the given variable value for the given browse path (as a string) in the given event.
pEvent | pointer to the event for which variable value shall be set |
qnPath | qualified name path separated by '~' as a string (e.g.: '0:EnabledState~0:Id') |
var | variable to set in the given event for the given browse path |
const SOPC_Variant * SOPC_Event_GetVariableFromStrPath | ( | const SOPC_Event * | pEvent, |
const char * | qnPath ) |
Gets the variable value for the given browse path (as a string) in the given event.
pEvent | pointer to the event for which variable value shall be set |
qnPath | qualified name path separated by '~' as a string (e.g.: '0:EnabledState~0:Id') |
const SOPC_Variant * SOPC_Event_GetVariableAndType | ( | const SOPC_Event * | pEvent, |
uint16_t | nbQnPath, | ||
SOPC_QualifiedName * | qualifiedNamePathArray, | ||
const SOPC_NodeId ** | outDataType, | ||
int32_t * | outValueRank ) |
Gets the variable value and type information for the given browse path in the given event.
pEvent | pointer to the event for which variable value shall be set | |
nbQnPath | number of qualified name in the browse path | |
qualifiedNamePathArray | qualified name path array containing the nbQnPath path elements (e.g.: ['0:EnabledState', '0:Id']) | |
[out] | outDataType | (optional) the pointer is set with the data type of the returned value (if pointer provided) |
[out] | outValueRank | (optional) the pointer is set with the value rank of the returned value (if pointer provided) |
const SOPC_Variant * SOPC_Event_GetVariableAndTypeFromStrPath | ( | const SOPC_Event * | pEvent, |
const char * | qnPath, | ||
const SOPC_NodeId ** | outDataType, | ||
int32_t * | outValueRank ) |
Gets the variable value and type information for the given browse path (as a string) in the given event.
pEvent | pointer to the event for which variable value shall be set | |
qnPath | qualified name path separated by '~' as a string (e.g.: '0:EnabledState~0:Id') | |
[out] | outDataType | (optional) the pointer is set with the data type of the returned value (if pointer provided) |
[out] | outValueRank | (optional) the pointer is set with the value rank of the returned value (if pointer provided) |
void SOPC_Event_ForEachVar | ( | SOPC_Event * | event, |
SOPC_Event_ForEachVar_Fct * | func, | ||
uintptr_t | user_data ) |
Iterates over the event variables, calling the given function for each event variable.
event | The event to iterate on |
func | The function to call on each event variable |
user_data | A user chose pointer to pass as last parameter to the callback function. |