ua_plugin_historydatabase.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. void
  68. (*updateData)(UA_Server *server,
  69. void *hdbContext,
  70. const UA_NodeId *sessionId,
  71. void *sessionContext,
  72. const UA_RequestHeader *requestHeader,
  73. const UA_UpdateDataDetails *details,
  74. UA_HistoryUpdateResult *result);
  75. void
  76. (*deleteRawModified)(UA_Server *server,
  77. void *hdbContext,
  78. const UA_NodeId *sessionId,
  79. void *sessionContext,
  80. const UA_RequestHeader *requestHeader,
  81. const UA_DeleteRawModifiedDetails *details,
  82. UA_HistoryUpdateResult *result);
  83. /* Add more function pointer here.
  84. * For example for read_event, read_modified, read_processed, read_at_time */
  85. };
  86. _UA_END_DECLS
  87. #endif /* UA_PLUGIN_HISTORYDATABASE_H_ */