High Performance OPC UA Server SDK
1.2.0.193
|
This function inserts new events or replaces existing events in the history database for one or more HistoricalEventNodes. More...
#include <updateeventdetails.h>
Data Fields | |
struct ua_nodeid | node_id |
NodeId of the object to be updated. | |
enum ua_performupdatetype | perform_insert_replace |
Determines which action of insert, replace, or update is performed. More... | |
struct ua_eventfilter | filter |
If the history of the notification conforms to the EventFilter, the history of the notification is updated. | |
struct ua_historyeventfieldlist * | event_data |
Event notification data to be inserted or updated. | |
int32_t | num_event_data |
Number of elements in ua_updateeventdetails::event_data. | |
Related Functions | |
void | ua_updateeventdetails_init (struct ua_updateeventdetails *t) |
Initialize an ua_updateeventdetails struct with a valid value. More... | |
void | ua_updateeventdetails_clear (struct ua_updateeventdetails *t) |
Clear all resources alloctated in an ua_updateeventdetails struct. More... | |
int | ua_updateeventdetails_compare (const struct ua_updateeventdetails *a, const struct ua_updateeventdetails *b) |
Compare two ua_updateeventdetails structs. More... | |
int | ua_updateeventdetails_copy (struct ua_updateeventdetails *dst, const struct ua_updateeventdetails *src) |
Create a copy of a ua_updateeventdetails struct. More... | |
static int | ua_updateeventdetails_resize_event_data_array (struct ua_updateeventdetails *val, int32_t new_len) |
Resize the event_data array of a ua_updateeventdetails struct. More... | |
This function inserts new events or replaces existing events in the history database for one or more HistoricalEventNodes.
Insert event functionality
This function is intended to insert new entries; e.g., backfilling of historical events.
Setting performInsertReplace = INSERT_1 inserts entries into the event history database for one or more HistoricalEventNodes. The whereClause parameter of the EventFilter shall be empty. The SelectClause must as a minimum provide the following event fields: EventType and Time. It is also recommended that the SourceNode and the SourceName fields are provided. If one of the required fields is not provided, the following error is returned: Bad_ArgumentsMissing. If the historian does not support archiving the specified EventType, the StatusCode shall indicate Bad_TypeDefinitionInvalid. If the SourceNode is not a valid source for Events, the StatusCode shall indicate Bad_SourceNodeIdInvalid. If the time does not fall within range that can be stored, the StatusCode shall indicate Bad_OutOfRange. If the selectClause does not include fields which are mandatory for the EventType, the StatusCode shall indicate Bad_ArgumentsMissing. If the selectClause specifies fields which are not valid for the EventType or cannot be saved by the historian, the StatusCode shall indicate Good_DataIgnored and the OperationResults array shall specify Bad_NotSupported for each ignored field.
The EventId is a server generated opaque value and a Client cannot assume that it knows how to create valid EventIds. A Server must be able to generate an appropriate default value for the EventId field. If a Client does specify the EventId in the selectClause and it matches an exitsting event, the StatusCode shall indicate Bad_EntryExists. A Client must use a HistoryRead to discover any automatically generated EventIds.
If any errors occur while processing individual fields, the StatusCode shall indicate Bad_InvalidArgument and the OperationResults array shall specify the exact error for each invalid field. The IndexRange parameter of the SimpleAttributeOperand is not valid for insert operations and the OperationResults shall specify Bad_IndexRangeInvalid if one is specified.
If no errors occur, the StatusCode shall indicate Good and the OperationResults array shall be empty. If errors do occur, the OperationResults array will have one element for each fiel d specified in the selectClause.
A Client may instruct the Server to choose a suitable default value for a field by specifying a value of null. If the server is not able to select a suitable default, the corresponding entry in the OperationResults array shall be Bad_InvalidArgument.
Replace event functionality
This function is intended to replace fields in existing event entries; e.g. correct event data that contained incorrect data due to a bad sensor.
Setting performInsertReplace = REPLACE_2 replaces entries in the event history database for the specified filter for one or more HistoricalEventNodes. The whereClause parameter of the EventFilter shall specify the EventId property. If no entry exists matching the specified filter, no updates will be performed; instead the StatusCode shall indicate Bad_NoEntryExists.
If the selectClause specifies fields which are not valid for the EventType or cannot be saved by the historian, the StatusCode shall indicate Good_DataIgnored and the OperationResults array shall specify Bad_NotSupported for each ignored field.
If a field is valid for the EventType but cannot be changed, then the StatusCode shall indicate Good_DataIgnored and the corresponding entry in the OperationResults array shall be Bad_NotWriteable.
If fatal errors occur while processing individual fields, the StatusCode shall indicate Bad_InvalidArgument and the OperationResults array shall specify the exact error.
If no errors occur, the StatusCode shall indicate Good and the OperationResults array shall be empty.If errors do occur, the OperationResults array will have one element for each field specified in the selectClause.
Update event functionality
This function is intended to unconditionally insert/replace events, e.g. synchronizing a backup event database.
Setting performInsertReplace = UPDATE_3 inserts or replaces entries in the event history database for the specified filter for one or more HistoricalEventNodes.
The server will, based on its own criteria, attempt to determine whether the event already exists. If it does exist, the event will be deleted and the new event will be inserted (retaining the EventId). If the EventID was provided, the EventID will be used to determine if the event already exists. If the event does not exist, a new event will be inserted, including the generation of a new EventId.
All of the restrictions, behaviours, and errors specified for the insert functionality also apply to this function.
If an existing entry was replaced successfully, the the StatusCode shall be Good_EntryReplaced. If a new entry was created, the StatusCode shall be Good_EntryInserted. If the server cannot determine whether it replaced or inserted an entry, the StatusCode shall be Good.
|
related |
Clear all resources alloctated in an ua_updateeventdetails struct.
Frees allocated memory like arrays and resets numeric values. The ua_updateeventdetails struct itself is not freed and must be freed by the caller if required. This function always succeeds for a valid ua_updateeventdetails struct, that was validly decoded, initilized by ua_updateeventdetails_init or created with ua_updateeventdetails_copy.
|
related |
Compare two ua_updateeventdetails structs.
Compares the content of the ua_updateeventdetails struct a
to the content of the ua_updateeventdetails struct b
. If a
is smaller than b
, an integer less than zero is returned, if a
is bigger than b
, an integer greater than zero is returned. If both structs are equal zero is returned.
This function creates a total order on ua_updateeventdetails structs, so it is well suited to not only determine equality, but also sort multiple instances of this struct.
|
related |
Create a copy of a ua_updateeventdetails struct.
Copy all fields from struct ua_updateeventdetails src
to dst
. Creates a deep copy so all content is recusively copied and both src
and dst
can be used and must be freed separately.
dst
is not cleared before the copy operation, so it must not have any allocated data. It may or may not be initilized by the caller before copy.
|
related |
Initialize an ua_updateeventdetails struct with a valid value.
After initialization the fields of the struct are set to valid and consistent values and can safley be accessed. An initialized ua_updateeventdetails struct can also be passed to ua_updateeventdetails_compare, ua_updateeventdetails_copy and ua_updateeventdetails_clear. This function will always succeed as long as an ua_updateeventdetails struct is passed to it.
|
related |
Resize the event_data array of a ua_updateeventdetails struct.
Depending on new_len
and the current size of the array, the array will be created, increased, decreased or deleted. In case array members are removed these are cleared properly, new array members are initialized with zero.
new_len | New length of the event_data array in number of members. |
perform_insert_replace |
Determines which action of insert, replace, or update is performed.
Possible values are INSERT_1, REPLACE_2, or UPDATE_3 (see ua_updateeventdetails).