ua_plugin_history_data_service.h 3.8 KB

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