High Performance OPC UA Server SDK
1.2.0.193
|
Create/Delete an event and access its fields. More...
Functions | |
struct uaserver_event * | uaserver_event_create (ua_node_t event_type, ua_node_t source_node) |
Create a new event object. More... | |
void | uaserver_event_delete (struct uaserver_event *event) |
Delete the event and all related data. | |
const struct ua_variant * | uaserver_event_get_field_value (struct uaserver_event *event, int global_handle) |
Get the value of a eventfield. More... | |
int | uaserver_event_overwrite_field (struct uaserver_event *event, int global_handle, const struct ua_variant *value) |
Overwrite the value of an eventfield. More... | |
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... | |
int | uaserver_event_set_event_id (struct uaserver_event *event, const struct ua_bytestring *event_id) |
Set the field EventId of the event . More... | |
int | uaserver_event_set_time (struct uaserver_event *event, ua_datetime time) |
Set the field Time of the event . More... | |
int | uaserver_event_set_local_time (struct uaserver_event *event, const struct ua_timezonedatatype *tz) |
Set the field LocalTime of the event . More... | |
int | uaserver_event_set_receive_time (struct uaserver_event *event, ua_datetime receive_time) |
Set the field ReceiveTime of the event . More... | |
int | uaserver_event_set_message (struct uaserver_event *event, const char *locale, const char *message_text) |
Set the field Message of the event . More... | |
int | uaserver_event_set_severity (struct uaserver_event *event, uint16_t) |
Set the field Severity of the event . More... | |
int | uaserver_event_set_source_name (struct uaserver_event *event, const char *source_name) |
Set the field SourceName of the event . More... | |
int | uaserver_event_fill_eventfieldlist (struct uaserver_event *event, const struct uaserver_selectclause *sc, struct ua_eventfieldlist *field_list) |
struct ua_eventfieldlist * | uaserver_event_create_overfloweventfieldlist (const struct uaserver_selectclause *sc) |
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.
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 . |
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. |
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. |
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 . |
int uaserver_event_set_event_id | ( | struct uaserver_event * | event, |
const struct ua_bytestring * | event_id | ||
) |
Set the field EventId of the event
.
int uaserver_event_set_local_time | ( | struct uaserver_event * | event, |
const struct ua_timezonedatatype * | tz | ||
) |
Set the field LocalTime of the event
.
int uaserver_event_set_message | ( | struct uaserver_event * | event, |
const char * | locale, | ||
const char * | message_text | ||
) |
Set the field Message of the event
.
int uaserver_event_set_receive_time | ( | struct uaserver_event * | event, |
ua_datetime | receive_time | ||
) |
Set the field ReceiveTime of the event
.
int uaserver_event_set_severity | ( | struct uaserver_event * | event, |
uint16_t | severity | ||
) |
Set the field Severity of the event
.
int uaserver_event_set_source_name | ( | struct uaserver_event * | event, |
const char * | source_name | ||
) |
Set the field SourceName of the event
.
int uaserver_event_set_time | ( | struct uaserver_event * | event, |
ua_datetime | time | ||
) |
Set the field Time of the event
.