ua_plugin_history_data_gathering.h 4.3 KB

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