ua_plugin_historydatabase.h 3.6 KB

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