ua_plugin_history_data_gathering.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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_HISTORY_DATA_GATHERING_H_
  8. #define UA_PLUGIN_HISTORY_DATA_GATHERING_H_
  9. #include "ua_types.h"
  10. #include "ua_server.h"
  11. #include "ua_plugin_history_data_backend.h"
  12. _UA_BEGIN_DECLS
  13. typedef enum {
  14. UA_HISTORIZINGUPDATESTRATEGY_USER = 0x00,
  15. UA_HISTORIZINGUPDATESTRATEGY_VALUESET = 0x01,
  16. UA_HISTORIZINGUPDATESTRATEGY_POLL = 0x02
  17. } UA_HistorizingUpdateStrategy;
  18. typedef struct {
  19. UA_HistoryDataBackend historizingBackend;
  20. size_t maxHistoryDataResponseSize;
  21. UA_HistorizingUpdateStrategy historizingUpdateStrategy;
  22. size_t pollingInterval;
  23. void * userContext;
  24. } UA_HistorizingNodeIdSettings;
  25. struct UA_HistoryDataGathering;
  26. typedef struct UA_HistoryDataGathering UA_HistoryDataGathering;
  27. struct UA_HistoryDataGathering {
  28. void *context;
  29. void
  30. (*deleteMembers)(UA_HistoryDataGathering *gathering);
  31. /* This function registers a node for the gathering of historical data.
  32. *
  33. * server is the server the node lives in.
  34. * hdgContext is the context of the UA_HistoryDataGathering.
  35. * nodeId is the node id of the node to register.
  36. * setting contains the gatering settings for the node to register. */
  37. UA_StatusCode
  38. (*registerNodeId)(UA_Server *server,
  39. void *hdgContext,
  40. const UA_NodeId *nodeId,
  41. const UA_HistorizingNodeIdSettings setting);
  42. /* This function stops polling a node for value changes.
  43. *
  44. * server is the server the node lives in.
  45. * hdgContext is the context of the UA_HistoryDataGathering.
  46. * nodeId is id of the node for which polling shall be stopped.
  47. * setting contains the gatering settings for the node. */
  48. UA_StatusCode
  49. (*stopPoll)(UA_Server *server,
  50. void *hdgContext,
  51. const UA_NodeId *nodeId);
  52. /* This function starts polling a node for value changes.
  53. *
  54. * server is the server the node lives in.
  55. * hdgContext is the context of the UA_HistoryDataGathering.
  56. * nodeId is the id of the node for which polling shall be started. */
  57. UA_StatusCode
  58. (*startPoll)(UA_Server *server,
  59. void *hdgContext,
  60. const UA_NodeId *nodeId);
  61. /* This function modifies the gathering settings for a node.
  62. *
  63. * server is the server the node lives in.
  64. * hdgContext is the context of the UA_HistoryDataGathering.
  65. * nodeId is the node id of the node for which gathering shall be modified.
  66. * setting contains the new gatering settings for the node. */
  67. UA_Boolean
  68. (*updateNodeIdSetting)(UA_Server *server,
  69. void *hdgContext,
  70. const UA_NodeId *nodeId,
  71. const UA_HistorizingNodeIdSettings setting);
  72. /* Returns the gathering settings for a node.
  73. *
  74. * server is the server the node lives in.
  75. * hdgContext is the context of the UA_HistoryDataGathering.
  76. * nodeId is the node id of the node for which the gathering settings shall
  77. * be retrieved. */
  78. const UA_HistorizingNodeIdSettings*
  79. (*getHistorizingSetting)(UA_Server *server,
  80. void *hdgContext,
  81. const UA_NodeId *nodeId);
  82. /* Sets a DataValue for a node in the historical data storage.
  83. *
  84. * server is the server the node lives in.
  85. * hdgContext is the context of the UA_HistoryDataGathering.
  86. * sessionId and sessionContext identify the session which wants to set this value.
  87. * nodeId is the node id of the node for which a value shall be set.
  88. * historizing is the historizing flag of the node identified by nodeId.
  89. * value is the value to set in the history data storage. */
  90. void
  91. (*setValue)(UA_Server *server,
  92. void *hdgContext,
  93. const UA_NodeId *sessionId,
  94. void *sessionContext,
  95. const UA_NodeId *nodeId,
  96. UA_Boolean historizing,
  97. const UA_DataValue *value);
  98. };
  99. _UA_END_DECLS
  100. #endif /* UA_PLUGIN_HISTORY_DATA_GATHERING_H_ */