historydatabase.h 4.3 KB

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