High Performance OPC UA Server SDK
1.7.1.383
|
Create/Delete an event and access its fields. More...
Functions | |
UA_BEGIN_EXTERN_C SERVER_EXPORT struct uaserver_event * | uaserver_event_create (ua_node_t event_type, ua_node_t source_node) |
Create a new event object. More... | |
SERVER_EXPORT void | uaserver_event_delete (struct uaserver_event *event) |
Delete the event and all related data. | |
SERVER_EXPORT const struct ua_variant * | uaserver_event_get_field_value (struct uaserver_event *event, int global_handle) |
Get the value of a eventfield. More... | |
SERVER_EXPORT int | uaserver_event_overwrite_field (struct uaserver_event *event, int global_handle, const struct ua_variant *value) |
Overwrite the value of an eventfield. More... | |
SERVER_EXPORT int | uaserver_event_add_field (struct uaserver_event *event, int global_handle, const struct ua_variant *value) |
Add a new eventfield with value to the event . More... | |
SERVER_EXPORT int | uaserver_event_set_event_id (struct uaserver_event *event, const struct ua_bytestring *event_id) |
Set the field EventId of the event . More... | |
SERVER_EXPORT int | uaserver_event_update_event_id (struct uaserver_event *event) |
Update the EventId with a new randomly generated EventId. More... | |
SERVER_EXPORT int | uaserver_event_set_time (struct uaserver_event *event, ua_datetime time) |
Set the field Time of the event . More... | |
SERVER_EXPORT int | uaserver_event_set_local_time (struct uaserver_event *event, const struct ua_timezonedatatype *tz) |
Set the field LocalTime of the event . More... | |
SERVER_EXPORT int | uaserver_event_set_receive_time (struct uaserver_event *event, ua_datetime receive_time) |
Set the field ReceiveTime of the event . More... | |
SERVER_EXPORT int | uaserver_event_set_message (struct uaserver_event *event, const char *locale, const char *message_text) |
Set the field Message of the event . More... | |
SERVER_EXPORT int | uaserver_event_set_severity (struct uaserver_event *event, uint16_t) |
Set the field Severity of the event . More... | |
SERVER_EXPORT int | uaserver_event_set_source_name (struct uaserver_event *event, const char *source_name) |
Set the field SourceName of the event . More... | |
SERVER_NO_EXPORT int | uaserver_event_fill_eventfieldlist (struct uaserver_event *event, const struct uaserver_selectclause *sc, struct ua_eventfieldlist *field_list) |
SERVER_NO_EXPORT struct ua_eventfieldlist * | uaserver_event_create_overfloweventfieldlist (const struct uaserver_selectclause *sc) |
SERVER_EXPORT bool | uaserver_event_is_condition (struct uaserver_event *event) |
Returns true if the given event is a subtype of ConditionType. | |
SERVER_EXPORT bool | uaserver_event_is_refresh (struct uaserver_event *event) |
Returns true if the given event is a Refreshstarteventtype or Refreshendeventtype. | |
SERVER_EXPORT int | uaserver_event_set_bool (struct uaserver_event *e, int handle, bool value) |
Convenience function to set a boolean value in an event field. More... | |
SERVER_EXPORT int | uaserver_event_set_string (struct uaserver_event *e, int handle, const char *value) |
Convenience function to set a string value in an event field. More... | |
SERVER_EXPORT int | uaserver_event_set_uint16 (struct uaserver_event *e, int handle, uint16_t value) |
Convenience function to set an uint16 value in an event field. More... | |
SERVER_EXPORT int | uaserver_event_set_uint32 (struct uaserver_event *e, int handle, uint32_t value) |
Convenience function to set an uint32 value in an event field. More... | |
SERVER_EXPORT int | uaserver_event_set_datetime (struct uaserver_event *e, int handle, ua_datetime value) |
Convenience function to set a datime value in an event field. More... | |
SERVER_EXPORT int | uaserver_event_set_nodeid (struct uaserver_event *e, int handle, const struct ua_nodeid *value) |
Convenience function to set a nodeid value in an event field. More... | |
SERVER_EXPORT int | uaserver_event_set_localized_text (struct uaserver_event *e, int handle, const char *locale, const char *text) |
Convenience function to set a localized text value in an event field. More... | |
SERVER_EXPORT int | uaserver_event_set_twostatevariable (struct uaserver_event *e, const char *browsename, uint16_t nsidx, const char *locale, const char *text, bool state) |
Convenience function to set the localized text and Id of a TwoStateVariable. More... | |
static const struct ua_variant * | uaserver_event_get_field_value_qn (struct uaserver_event *event, const char *name, uint16_t nsidx) |
Same as uaserver_event_get_field_value but uses a qualifiedname (browsepath of length 1) to identify the eventfield. | |
static int | uaserver_event_overwrite_field_qn (struct uaserver_event *event, const char *name, uint16_t nsidx, const struct ua_variant *value) |
Same as uaserver_event_overwrite_field but uses a qualifiedname (browsepath of length 1) to identify the eventfield. | |
static int | uaserver_event_add_field_qn (struct uaserver_event *event, const char *name, uint16_t nsidx, const struct ua_variant *value) |
Same as uaserver_event_add_field but uses a qualifiedname (browsepath of length 1) to identify the eventfield. | |
Create/Delete an event and access its fields.
SERVER_EXPORT int uaserver_event_add_field | ( | struct uaserver_event * | event, |
int | global_handle, | ||
const struct ua_variant * | value | ||
) |
Add a new eventfield with value to the event
.
Only use this functions for fields that do not exist in the event
. If you know the field already exists or unsure use uaserver_event_overwrite_field instead.
event | Event to add the field to. |
global_handle | Handle to identify the new field, see uaserver_eventfield_lookup. |
value | New value to add for the field, a copy of this value will be attached to the event . |
UA_BEGIN_EXTERN_C SERVER_EXPORT struct uaserver_event* uaserver_event_create | ( | ua_node_t | event_type, |
ua_node_t | source_node | ||
) |
Create a new event object.
The following fields from the BaseEventType are initialized:
event_type
argument.source_node
argument.source_node
source_node
To set a new value for any of these fields or set the LocalTime the respective setter function should be used.
To add/overwrite eventfields from other event types the functions uaserver_event_add_field and uaserver_event_overwrite_field should be used.
To fire the event it must be passed to uaserver_eventnotifier_fire_event. Afterwards it can be deleted with uaserver_event_delete or it may be reused and later fired again as new event, in this case at least the EvendId must be changed.
event_type | Node handle for the type of the new event. |
source_node | Node handle for the source of the event, this node must have been registered with uaserver_eventnotifier_register. The node must be either an event source or an event notifier. |
SERVER_EXPORT const struct ua_variant* uaserver_event_get_field_value | ( | struct uaserver_event * | event, |
int | global_handle | ||
) |
Get the value of a eventfield.
The value is still attached to the event, so it must not be freed and must not be accessed after the event
is deleted.
event | Event to get the value from. |
global_handle | Handle to identify the field, see uaserver_eventfield_lookup. |
SERVER_EXPORT int uaserver_event_overwrite_field | ( | struct uaserver_event * | event, |
int | global_handle, | ||
const struct ua_variant * | value | ||
) |
Overwrite the value of an eventfield.
Replace the value of an existing eventfield. If the field is not present in the event
it will be added. If you are sure the field does not exist in the event
use uaserver_event_add_field for better performance.
event | Event to overwrite the field. |
global_handle | Handle to identify the field, see uaserver_eventfield_lookup. |
value | New value to write, a copy of this value will be attached to the event . |
SERVER_EXPORT int uaserver_event_set_bool | ( | struct uaserver_event * | e, |
int | handle, | ||
bool | value | ||
) |
Convenience function to set a boolean value in an event field.
e | Event to set value. |
handle | Global handle of the event field. |
value | Boolean value to set. |
SERVER_EXPORT int uaserver_event_set_datetime | ( | struct uaserver_event * | e, |
int | handle, | ||
ua_datetime | value | ||
) |
Convenience function to set a datime value in an event field.
e | Event to set value. |
handle | Global handle of the event field. |
value | Datetime value to set. |
SERVER_EXPORT int uaserver_event_set_event_id | ( | struct uaserver_event * | event, |
const struct ua_bytestring * | event_id | ||
) |
Set the field EventId of the event
.
SERVER_EXPORT int uaserver_event_set_local_time | ( | struct uaserver_event * | event, |
const struct ua_timezonedatatype * | tz | ||
) |
Set the field LocalTime of the event
.
SERVER_EXPORT int uaserver_event_set_localized_text | ( | struct uaserver_event * | e, |
int | handle, | ||
const char * | locale, | ||
const char * | text | ||
) |
Convenience function to set a localized text value in an event field.
e | Event to set value. |
handle | Global handle of the event field. |
locale | Locale to set (may be NULL). |
text | Text to set (may be NULL). |
SERVER_EXPORT int uaserver_event_set_message | ( | struct uaserver_event * | event, |
const char * | locale, | ||
const char * | message_text | ||
) |
Set the field Message of the event
.
SERVER_EXPORT int uaserver_event_set_nodeid | ( | struct uaserver_event * | e, |
int | handle, | ||
const struct ua_nodeid * | value | ||
) |
Convenience function to set a nodeid value in an event field.
e | Event to set value. |
handle | Global handle of the event field. |
value | Nodeid value to set. |
SERVER_EXPORT int uaserver_event_set_receive_time | ( | struct uaserver_event * | event, |
ua_datetime | receive_time | ||
) |
Set the field ReceiveTime of the event
.
SERVER_EXPORT int uaserver_event_set_severity | ( | struct uaserver_event * | event, |
uint16_t | severity | ||
) |
Set the field Severity of the event
.
SERVER_EXPORT int uaserver_event_set_source_name | ( | struct uaserver_event * | event, |
const char * | source_name | ||
) |
Set the field SourceName of the event
.
SERVER_EXPORT int uaserver_event_set_string | ( | struct uaserver_event * | e, |
int | handle, | ||
const char * | value | ||
) |
Convenience function to set a string value in an event field.
e | Event to set value. |
handle | Global handle of the event field. |
value | String value to set. |
SERVER_EXPORT int uaserver_event_set_time | ( | struct uaserver_event * | event, |
ua_datetime | time | ||
) |
Set the field Time of the event
.
SERVER_EXPORT int uaserver_event_set_twostatevariable | ( | struct uaserver_event * | e, |
const char * | browsename, | ||
uint16_t | nsidx, | ||
const char * | locale, | ||
const char * | text, | ||
bool | state | ||
) |
Convenience function to set the localized text and Id of a TwoStateVariable.
The event field is given by its browsename, so only fields with a browsepath of length 1 are supported by this function. Also only the mandatory Id Property of the TwoStateVariable is set, possible further Properties must be set manually.
e | Event to set value. |
browsename | Name part of the browsename to identifiy the event field. |
nsidx | Namespace index part of the browsename to identifiy the event field. |
locale | Locale to set (may be NULL). |
text | Text to set (may be NULL). |
state | State of the Id Property. |
SERVER_EXPORT int uaserver_event_set_uint16 | ( | struct uaserver_event * | e, |
int | handle, | ||
uint16_t | value | ||
) |
Convenience function to set an uint16 value in an event field.
e | Event to set value. |
handle | Global handle of the event field. |
value | Uint16 value to set. |
SERVER_EXPORT int uaserver_event_set_uint32 | ( | struct uaserver_event * | e, |
int | handle, | ||
uint32_t | value | ||
) |
Convenience function to set an uint32 value in an event field.
e | Event to set value. |
handle | Global handle of the event field. |
value | Uint32 value to set. |
SERVER_EXPORT int uaserver_event_update_event_id | ( | struct uaserver_event * | e | ) |
Update the EventId with a new randomly generated EventId.