History (C)
History API In the "Independent" section:
#include <opcua/opcua_history.h>
Subpage Redirect
- For a list of all origin points within the range, please refer to ReadRaw.
- For a record of changes, please refer to ReadModified.
- For interpolation at a specific point in time, please refer to ReadAtTime.
- Aggregation (Avg / Min / Max / TimeAverage / ...) Please refer to ReadProcessed.
- Historical Events (Alarms / Conditions) — Please refer to ReadEvents.
- For writing history (Insert / Replace / Update), please refer to HistoryUpdate.
- For instructions on deleting history, please refer to Delete.
5 Modes HistoryRead
| Pattern | API | Note |
|---|---|---|
| Raw Data | DarraUa_Session_HistoryReadRaw | All points within the interval |
| Modified (includes revision history) | DarraUa_Session_HistoryReadModified | The range contains modification records |
| AtTime A specific point in time | DarraUa_Session_HistoryReadAtTime | Interpolation for a Given Timestamp |
| Processed Aggregation | DarraUa_Session_HistoryReadProcessed | Aggregation (Avg / Min / Max / ...) |
| Events History | DarraUa_Session_HistoryReadEvents | Historical Events (Alarms / Conditions) |
HistoryUpdate
| API | Uses |
|---|---|
| DarraUa_Session_HistoryUpdateData | Insert / Replace / Update / Remove |
| DarraUa_Session_HistoryDeleteRange | Batch Delete by Time Period |
Timestamp Convention
DarraUa_DateTime is int64_t, the unit 100ns is the same FILETIME 1601-01-01 UTC as in Windows. Use the same timestamp format UTC; do not send the local time.
/* Current UTC → DarraUa_DateTime */
#include <time.h>
DarraUa_DateTime now_to_ft(void)
{
return (DarraUa_DateTime)((int64_t)time(NULL) * 10000000LL + 116444736000000000LL);
}
General Prerequisites
- The server must implement the corresponding HistoryRead/service HistoryUpdate. If it is not supported, return the SDK server's status code.Pass-through as-is (e.g.,
BadHistoryOperationUnsupported/BadNotSupported/BadNotReadable). These are server-side OPC UA status codes; there are no corresponding macros in the client headers. To interpret them, useDarraUa_StatusName - A node
AccessLevelmust contain HistoryRead bits (0x04) / HistoryWrite bits (0x08) - Node
HistorizingAttribute (20) Determines whether to log history
Uniform Rules for Memory Release
| Exit | Release |
|---|---|
| out_values (DataValue array) | DarraUa_DataValueArray_Delete(arr, count) (one-time) |
| out_events (array of Events) | DarraUa_EventArray_Delete(arr, count) (one-time) |