ua_plugin_history_data_gathering.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. typedef struct UA_HistoryDataGathering UA_HistoryDataGathering;
  26. struct UA_HistoryDataGathering {
  27. void *context;
  28. void
  29. (*deleteMembers)(UA_HistoryDataGathering *gathering);
  30. /* This function registers a node for the gathering of historical data.
  31. *
  32. * server is the server the node lives in.
  33. * hdgContext is the context of the UA_HistoryDataGathering.
  34. * nodeId is the node id of the node to register.
  35. * setting contains the gatering settings for the node to register. */
  36. UA_StatusCode
  37. (*registerNodeId)(UA_Server *server,
  38. void *hdgContext,
  39. const UA_NodeId *nodeId,
  40. const UA_HistorizingNodeIdSettings setting);
  41. /* This function stops polling a node for value changes.
  42. *
  43. * server is the server the node lives in.
  44. * hdgContext is the context of the UA_HistoryDataGathering.
  45. * nodeId is id of the node for which polling shall be stopped.
  46. * setting contains the gatering settings for the node. */
  47. UA_StatusCode
  48. (*stopPoll)(UA_Server *server,
  49. void *hdgContext,
  50. const UA_NodeId *nodeId);
  51. /* This function starts polling a node for value changes.
  52. *
  53. * server is the server the node lives in.
  54. * hdgContext is the context of the UA_HistoryDataGathering.
  55. * nodeId is the id of the node for which polling shall be started. */
  56. UA_StatusCode
  57. (*startPoll)(UA_Server *server,
  58. void *hdgContext,
  59. const UA_NodeId *nodeId);
  60. /* This function modifies the gathering settings for a node.
  61. *
  62. * server is the server the node lives in.
  63. * hdgContext is the context of the UA_HistoryDataGathering.
  64. * nodeId is the node id of the node for which gathering shall be modified.
  65. * setting contains the new gatering settings for the node. */
  66. UA_Boolean
  67. (*updateNodeIdSetting)(UA_Server *server,
  68. void *hdgContext,
  69. const UA_NodeId *nodeId,
  70. const UA_HistorizingNodeIdSettings setting);
  71. /* Returns the gathering settings for a node.
  72. *
  73. * server is the server the node lives in.
  74. * hdgContext is the context of the UA_HistoryDataGathering.
  75. * nodeId is the node id of the node for which the gathering settings shall
  76. * be retrieved. */
  77. const UA_HistorizingNodeIdSettings*
  78. (*getHistorizingSetting)(UA_Server *server,
  79. void *hdgContext,
  80. const UA_NodeId *nodeId);
  81. /* Sets a DataValue for a node in the historical data storage.
  82. *
  83. * server is the server the node lives in.
  84. * hdgContext is the context of the UA_HistoryDataGathering.
  85. * sessionId and sessionContext identify the session which wants to set this value.
  86. * nodeId is the node id of the node for which a value shall be set.
  87. * historizing is the historizing flag of the node identified by nodeId.
  88. * value is the value to set in the history data storage. */
  89. void
  90. (*setValue)(UA_Server *server,
  91. void *hdgContext,
  92. const UA_NodeId *sessionId,
  93. void *sessionContext,
  94. const UA_NodeId *nodeId,
  95. UA_Boolean historizing,
  96. const UA_DataValue *value);
  97. };
  98. _UA_END_DECLS
  99. #endif /* UA_PLUGIN_HISTORY_DATA_GATHERING_H_ */