open62541 1.3.12
Open source implementation of OPC UA
Loading...
Searching...
No Matches
history_data_backend.h
Go to the documentation of this file.
1/** This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
4 *
5 * Copyright 2018 (c) basysKom GmbH <opensource@basyskom.com> (Author: Peter Rustler)
6 */
7
8#ifndef UA_PLUGIN_HISTORY_DATA_BACKEND_H_
9#define UA_PLUGIN_HISTORY_DATA_BACKEND_H_
10
11#include <open62541/server.h>
12
14
15typedef enum {
16 MATCH_EQUAL, /* Match with the exact timestamp. */
17 MATCH_AFTER, /* Match the value with the timestamp in the
18 database that is the first later in time from the provided timestamp. */
19 MATCH_EQUAL_OR_AFTER, /* Match exactly if possible, or the first timestamp
20 later in time from the provided timestamp. */
21 MATCH_BEFORE, /* Match the first timestamp in the database that is earlier
22 in time from the provided timestamp. */
23 MATCH_EQUAL_OR_BEFORE /* Match exactly if possible, or the first timestamp
24 that is earlier in time from the provided timestamp. */
26
28
30 void *context;
31
32 void
34
35 /* This function sets a DataValue for a node in the historical data storage.
36 *
37 * server is the server the node lives in.
38 * hdbContext is the context of the UA_HistoryDataBackend.
39 * sessionId and sessionContext identify the session that wants to read historical data.
40 * nodeId is the node for which the value shall be stored.
41 * value is the value which shall be stored.
42 * historizing is the historizing flag of the node identified by nodeId.
43 * If sessionId is NULL, the historizing flag is invalid and must not be used. */
46 void *hdbContext,
47 const UA_NodeId *sessionId,
48 void *sessionContext,
49 const UA_NodeId *nodeId,
50 UA_Boolean historizing,
51 const UA_DataValue *value);
52
53 /* This function is the high level interface for the ReadRaw operation. Set
54 * it to NULL if you use the low level API for your plugin. It should be
55 * used if the low level interface does not suite your database. It is more
56 * complex to implement the high level interface but it also provide more
57 * freedom. If you implement this, then set all low level api function
58 * pointer to NULL.
59 *
60 * server is the server the node lives in.
61 * hdbContext is the context of the UA_HistoryDataBackend.
62 * sessionId and sessionContext identify the session that wants to read historical data.
63 * backend is the HistoryDataBackend whose storage is to be queried.
64 * start is the start time of the HistoryRead request.
65 * end is the end time of the HistoryRead request.
66 * nodeId is the node id of the node for which historical data is requested.
67 * maxSizePerResponse is the maximum number of items per response the server can provide.
68 * numValuesPerNode is the maximum number of items per response the client wants to receive.
69 * returnBounds determines if the client wants to receive bounding values.
70 * timestampsToReturn contains the time stamps the client is interested in.
71 * range is the numeric range the client wants to read.
72 * releaseContinuationPoints determines if the continuation points shall be released.
73 * continuationPoint is the continuation point the client wants to release or start from.
74 * outContinuationPoint is the continuation point that gets passed to the
75 * client by the HistoryRead service.
76 * result contains the result histoy data that gets passed to the client. */
78 (*getHistoryData)(UA_Server *server,
79 const UA_NodeId *sessionId,
80 void *sessionContext,
81 const UA_HistoryDataBackend *backend,
82 const UA_DateTime start,
83 const UA_DateTime end,
84 const UA_NodeId *nodeId,
85 size_t maxSizePerResponse,
86 UA_UInt32 numValuesPerNode,
87 UA_Boolean returnBounds,
88 UA_TimestampsToReturn timestampsToReturn,
89 UA_NumericRange range,
90 UA_Boolean releaseContinuationPoints,
91 const UA_ByteString *continuationPoint,
92 UA_ByteString *outContinuationPoint,
93 UA_HistoryData *result);
94
95 /* This function is part of the low level HistoryRead API. It returns the
96 * index of a value in the database which matches certain criteria.
97 *
98 * server is the server the node lives in.
99 * hdbContext is the context of the UA_HistoryDataBackend.
100 * sessionId and sessionContext identify the session that wants to read historical data.
101 * nodeId is the node id of the node for which the matching value shall be found.
102 * timestamp is the timestamp of the requested index.
103 * strategy is the matching strategy which shall be applied in finding the index. */
104 size_t
105 (*getDateTimeMatch)(UA_Server *server,
106 void *hdbContext,
107 const UA_NodeId *sessionId,
108 void *sessionContext,
109 const UA_NodeId *nodeId,
110 const UA_DateTime timestamp,
111 const MatchStrategy strategy);
112
113 /* This function is part of the low level HistoryRead API. It returns the
114 * index of the element after the last valid entry in the database for a
115 * node.
116 *
117 * server is the server the node lives in.
118 * hdbContext is the context of the UA_HistoryDataBackend.
119 * sessionId and sessionContext identify the session that wants to read historical data.
120 * nodeId is the node id of the node for which the end of storage shall be returned. */
121 size_t
122 (*getEnd)(UA_Server *server,
123 void *hdbContext,
124 const UA_NodeId *sessionId,
125 void *sessionContext,
126 const UA_NodeId *nodeId);
127
128 /* This function is part of the low level HistoryRead API. It returns the
129 * index of the last element in the database for a node.
130 *
131 * server is the server the node lives in.
132 * hdbContext is the context of the UA_HistoryDataBackend.
133 * sessionId and sessionContext identify the session that wants to read historical data.
134 * nodeId is the node id of the node for which the index of the last element
135 * shall be returned. */
136 size_t
137 (*lastIndex)(UA_Server *server,
138 void *hdbContext,
139 const UA_NodeId *sessionId,
140 void *sessionContext,
141 const UA_NodeId *nodeId);
142
143 /* This function is part of the low level HistoryRead API. It returns the
144 * index of the first element in the database for a node.
145 *
146 * server is the server the node lives in.
147 * hdbContext is the context of the UA_HistoryDataBackend.
148 * sessionId and sessionContext identify the session that wants to read historical data.
149 * nodeId is the node id of the node for which the index of the first
150 * element shall be returned. */
151 size_t
152 (*firstIndex)(UA_Server *server,
153 void *hdbContext,
154 const UA_NodeId *sessionId,
155 void *sessionContext,
156 const UA_NodeId *nodeId);
157
158 /* This function is part of the low level HistoryRead API. It returns the
159 * number of elements between startIndex and endIndex including both.
160 *
161 * server is the server the node lives in.
162 * hdbContext is the context of the UA_HistoryDataBackend.
163 * sessionId and sessionContext identify the session that wants to read historical data.
164 * nodeId is the node id of the node for which the number of elements shall be returned.
165 * startIndex is the index of the first element in the range.
166 * endIndex is the index of the last element in the range. */
167 size_t
168 (*resultSize)(UA_Server *server,
169 void *hdbContext,
170 const UA_NodeId *sessionId,
171 void *sessionContext,
172 const UA_NodeId *nodeId,
173 size_t startIndex,
174 size_t endIndex);
175
176 /* This function is part of the low level HistoryRead API. It copies data
177 * values inside a certain range into a buffer.
178 *
179 * server is the server the node lives in.
180 * hdbContext is the context of the UA_HistoryDataBackend.
181 * sessionId and sessionContext identify the session that wants to read historical data.
182 * nodeId is the node id of the node for which the data values shall be copied.
183 * startIndex is the index of the first value in the range.
184 * endIndex is the index of the last value in the range.
185 * reverse determines if the values shall be copied in reverse order.
186 * valueSize is the maximal number of data values to copy.
187 * range is the numeric range which shall be copied for every data value.
188 * releaseContinuationPoints determines if the continuation points shall be released.
189 * continuationPoint is a continuation point the client wants to release or start from.
190 * outContinuationPoint is a continuation point which will be passed to the client.
191 * providedValues contains the number of values that were copied.
192 * values contains the values that have been copied from the database. */
194 (*copyDataValues)(UA_Server *server,
195 void *hdbContext,
196 const UA_NodeId *sessionId,
197 void *sessionContext,
198 const UA_NodeId *nodeId,
199 size_t startIndex,
200 size_t endIndex,
201 UA_Boolean reverse,
202 size_t valueSize,
203 UA_NumericRange range,
204 UA_Boolean releaseContinuationPoints,
205 const UA_ByteString *continuationPoint,
206 UA_ByteString *outContinuationPoint,
207 size_t *providedValues,
208 UA_DataValue *values);
209
210 /* This function is part of the low level HistoryRead API. It returns the
211 * data value stored at a certain index in the database.
212 *
213 * server is the server the node lives in.
214 * hdbContext is the context of the UA_HistoryDataBackend.
215 * sessionId and sessionContext identify the session that wants to read historical data.
216 * nodeId is the node id of the node for which the data value shall be returned.
217 * index is the index in the database for which the data value is requested. */
219 (*getDataValue)(UA_Server *server,
220 void *hdbContext,
221 const UA_NodeId *sessionId,
222 void *sessionContext,
223 const UA_NodeId *nodeId,
224 size_t index);
225
226 /* This function returns UA_TRUE if the backend supports returning bounding
227 * values for a node. This function is mandatory.
228 *
229 * server is the server the node lives in.
230 * hdbContext is the context of the UA_HistoryDataBackend.
231 * sessionId and sessionContext identify the session that wants to read
232 * historical data.
233 * nodeId is the node id of the node for which the capability to return
234 * bounds shall be queried. */
236 (*boundSupported)(UA_Server *server,
237 void *hdbContext,
238 const UA_NodeId *sessionId,
239 void *sessionContext,
240 const UA_NodeId *nodeId);
241
242 /* This function returns UA_TRUE if the backend supports returning the
243 * requested timestamps for a node. This function is mandatory.
244 *
245 * server is the server the node lives in.
246 * hdbContext is the context of the UA_HistoryDataBackend.
247 * sessionId and sessionContext identify the session that wants to read historical data.
248 * nodeId is the node id of the node for which the capability to return
249 * certain timestamps shall be queried. */
252 void *hdbContext,
253 const UA_NodeId *sessionId,
254 void *sessionContext,
255 const UA_NodeId *nodeId,
256 const UA_TimestampsToReturn timestampsToReturn);
257
259 (*insertDataValue)(UA_Server *server,
260 void *hdbContext,
261 const UA_NodeId *sessionId,
262 void *sessionContext,
263 const UA_NodeId *nodeId,
264 const UA_DataValue *value);
266 (*replaceDataValue)(UA_Server *server,
267 void *hdbContext,
268 const UA_NodeId *sessionId,
269 void *sessionContext,
270 const UA_NodeId *nodeId,
271 const UA_DataValue *value);
273 (*updateDataValue)(UA_Server *server,
274 void *hdbContext,
275 const UA_NodeId *sessionId,
276 void *sessionContext,
277 const UA_NodeId *nodeId,
278 const UA_DataValue *value);
280 (*removeDataValue)(UA_Server *server,
281 void *hdbContext,
282 const UA_NodeId *sessionId,
283 void *sessionContext,
284 const UA_NodeId *nodeId,
285 UA_DateTime startTimestamp,
286 UA_DateTime endTimestamp);
287};
288
290
291#endif /* UA_PLUGIN_HISTORY_DATA_BACKEND_H_ */
#define _UA_BEGIN_DECLS
#undef UA_DEBUG_DUMP_PKGS
Definition config.h:89
#define _UA_END_DECLS
Definition config.h:96
MatchStrategy
This Source Code Form is subject to the terms of the Mozilla Public License, v.
@ MATCH_AFTER
@ MATCH_BEFORE
@ MATCH_EQUAL_OR_AFTER
@ MATCH_EQUAL
@ MATCH_EQUAL_OR_BEFORE
UA_StatusCode(* updateDataValue)(UA_Server *server, void *hdbContext, const UA_NodeId *sessionId, void *sessionContext, const UA_NodeId *nodeId, const UA_DataValue *value)
UA_Boolean(* boundSupported)(UA_Server *server, void *hdbContext, const UA_NodeId *sessionId, void *sessionContext, const UA_NodeId *nodeId)
UA_StatusCode(* removeDataValue)(UA_Server *server, void *hdbContext, const UA_NodeId *sessionId, void *sessionContext, const UA_NodeId *nodeId, UA_DateTime startTimestamp, UA_DateTime endTimestamp)
size_t(* getDateTimeMatch)(UA_Server *server, void *hdbContext, const UA_NodeId *sessionId, void *sessionContext, const UA_NodeId *nodeId, const UA_DateTime timestamp, const MatchStrategy strategy)
void(* deleteMembers)(UA_HistoryDataBackend *backend)
size_t(* getEnd)(UA_Server *server, void *hdbContext, const UA_NodeId *sessionId, void *sessionContext, const UA_NodeId *nodeId)
UA_StatusCode(* copyDataValues)(UA_Server *server, void *hdbContext, const UA_NodeId *sessionId, void *sessionContext, const UA_NodeId *nodeId, size_t startIndex, size_t endIndex, UA_Boolean reverse, size_t valueSize, UA_NumericRange range, UA_Boolean releaseContinuationPoints, const UA_ByteString *continuationPoint, UA_ByteString *outContinuationPoint, size_t *providedValues, UA_DataValue *values)
size_t(* lastIndex)(UA_Server *server, void *hdbContext, const UA_NodeId *sessionId, void *sessionContext, const UA_NodeId *nodeId)
size_t(* resultSize)(UA_Server *server, void *hdbContext, const UA_NodeId *sessionId, void *sessionContext, const UA_NodeId *nodeId, size_t startIndex, size_t endIndex)
UA_StatusCode(* getHistoryData)(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext, const UA_HistoryDataBackend *backend, const UA_DateTime start, const UA_DateTime end, const UA_NodeId *nodeId, size_t maxSizePerResponse, UA_UInt32 numValuesPerNode, UA_Boolean returnBounds, UA_TimestampsToReturn timestampsToReturn, UA_NumericRange range, UA_Boolean releaseContinuationPoints, const UA_ByteString *continuationPoint, UA_ByteString *outContinuationPoint, UA_HistoryData *result)
size_t(* firstIndex)(UA_Server *server, void *hdbContext, const UA_NodeId *sessionId, void *sessionContext, const UA_NodeId *nodeId)
UA_StatusCode(* serverSetHistoryData)(UA_Server *server, void *hdbContext, const UA_NodeId *sessionId, void *sessionContext, const UA_NodeId *nodeId, UA_Boolean historizing, const UA_DataValue *value)
UA_StatusCode(* insertDataValue)(UA_Server *server, void *hdbContext, const UA_NodeId *sessionId, void *sessionContext, const UA_NodeId *nodeId, const UA_DataValue *value)
UA_Boolean(* timestampsToReturnSupported)(UA_Server *server, void *hdbContext, const UA_NodeId *sessionId, void *sessionContext, const UA_NodeId *nodeId, const UA_TimestampsToReturn timestampsToReturn)
UA_StatusCode(* replaceDataValue)(UA_Server *server, void *hdbContext, const UA_NodeId *sessionId, void *sessionContext, const UA_NodeId *nodeId, const UA_DataValue *value)
_UA_BEGIN_DECLS typedef bool UA_Boolean
This Source Code Form is subject to the terms of the Mozilla Public License, v.
Definition types.h:26
uint32_t UA_UInt32
Definition types.h:56
int64_t UA_DateTime
Definition types.h:144
uint32_t UA_StatusCode
Definition types.h:77
UA_TimestampsToReturn