Skip to main content

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​

PatternAPINote
Raw DataDarraUa_Session_HistoryReadRawAll points within the interval
Modified (includes revision history)DarraUa_Session_HistoryReadModifiedThe range contains modification records
AtTime A specific point in timeDarraUa_Session_HistoryReadAtTimeInterpolation for a Given Timestamp
Processed AggregationDarraUa_Session_HistoryReadProcessedAggregation (Avg / Min / Max / ...)
Events HistoryDarraUa_Session_HistoryReadEventsHistorical Events (Alarms / Conditions)

HistoryUpdate​

APIUses
DarraUa_Session_HistoryUpdateDataInsert / Replace / Update / Remove
DarraUa_Session_HistoryDeleteRangeBatch 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, use DarraUa_StatusName
  • A node AccessLevel must contain HistoryRead bits (0x04) / HistoryWrite bits (0x08)
  • Node Historizing Attribute (20) Determines whether to log history

Uniform Rules for Memory Release​

ExitRelease
out_values (DataValue array)DarraUa_DataValueArray_Delete(arr, count) (one-time)
out_events (array of Events)DarraUa_EventArray_Delete(arr, count) (one-time)

Next Step​