ua_plugin_history_data_service.h 3.7 KB

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