ua_plugin_historydatabase.h 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. #ifndef UA_PLUGIN_HISTORYDATABASE_H_
  8. #define UA_PLUGIN_HISTORYDATABASE_H_
  9. #include "ua_types.h"
  10. #include "ua_server.h"
  11. _UA_BEGIN_DECLS
  12. typedef struct UA_HistoryDatabase UA_HistoryDatabase;
  13. struct UA_HistoryDatabase {
  14. void *context;
  15. void
  16. (*deleteMembers)(UA_HistoryDatabase *hdb);
  17. /* This function will be called when a nodes value is set.
  18. * Use this to insert data into your database(s) if polling is not suitable
  19. * and you need to get all data changes.
  20. * Set it to NULL if you do not need it.
  21. *
  22. * server is the server this node lives in.
  23. * hdbContext is the context of the UA_HistoryDatabase.
  24. * sessionId and sessionContext identify the session which set this value.
  25. * nodeId is the node id for which data was set.
  26. * historizing is the nodes boolean flag for historizing
  27. * value is the new value. */
  28. void
  29. (*setValue)(UA_Server *server,
  30. void *hdbContext,
  31. const UA_NodeId *sessionId,
  32. void *sessionContext,
  33. const UA_NodeId *nodeId,
  34. UA_Boolean historizing,
  35. const UA_DataValue *value);
  36. /* This function is called if a history read is requested with
  37. * isRawReadModified set to false. Setting it to NULL will result in a
  38. * response with statuscode UA_STATUSCODE_BADHISTORYOPERATIONUNSUPPORTED.
  39. *
  40. * server is the server this node lives in.
  41. * hdbContext is the context of the UA_HistoryDatabase.
  42. * sessionId and sessionContext identify the session which set this value.
  43. * requestHeader, historyReadDetails, timestampsToReturn, releaseContinuationPoints
  44. * nodesToReadSize and nodesToRead is the requested data from the client. It is from the request object.
  45. * response the response to fill for the client. If the request is ok, there is no need to use it.
  46. * Use this to set status codes other than "Good" or other data.
  47. * You find an already allocated UA_HistoryReadResult array with an UA_HistoryData object
  48. * in the extension object in the size of nodesToReadSize. If you are not willing to return data,
  49. * you have to delete the results array, set it to NULL and set the resultsSize to 0.
  50. * Do not access historyData after that.
  51. * historyData is a proper typed pointer array pointing in the UA_HistoryReadResult extension object.
  52. * use this to provide result data to the client.
  53. * Index in the array is the same as in nodesToRead and the UA_HistoryReadResult array. */
  54. void
  55. (*readRaw)(UA_Server *server,
  56. void *hdbContext,
  57. const UA_NodeId *sessionId,
  58. void *sessionContext,
  59. const UA_RequestHeader *requestHeader,
  60. const UA_ReadRawModifiedDetails *historyReadDetails,
  61. UA_TimestampsToReturn timestampsToReturn,
  62. UA_Boolean releaseContinuationPoints,
  63. size_t nodesToReadSize,
  64. const UA_HistoryReadValueId *nodesToRead,
  65. UA_HistoryReadResponse *response,
  66. UA_HistoryData * const * const historyData);
  67. /* Add more function pointer here.
  68. * For example for read_event, read_modified, read_processed, read_at_time */
  69. };
  70. _UA_END_DECLS
  71. #endif /* UA_PLUGIN_HISTORYDATABASE_H_ */