ua_server_pubsub.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 (c) 2017-2018 Fraunhofer IOSB (Author: Andreas Ebner)
  6. */
  7. #ifndef UA_SERVER_PUBSUB_H
  8. #define UA_SERVER_PUBSUB_H
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. #include "ua_server.h"
  13. /**
  14. * .. _pubsub:
  15. *
  16. * Publish/Subscribe
  17. * =================
  18. *
  19. * Work in progress!
  20. * This part will be a new chapter later.
  21. *
  22. * TODO: write general PubSub introduction
  23. *
  24. * The Publish/Subscribe (PubSub) extension for OPC UA enables fast and efficient
  25. * 1:m communication. The PubSub extension is protocol agnostic and can be used
  26. * with broker based protocols like MQTT and AMQP or brokerless implementations like UDP-Multicasting.
  27. *
  28. * The PubSub API uses the following scheme:
  29. *
  30. * 1. Create a configuration for the needed PubSub element.
  31. *
  32. * 2. Call the add[element] function and pass in the configuration.
  33. *
  34. * 3. The add[element] function returns the unique nodeId of the internally created element.
  35. *
  36. * Take a look on the PubSub Tutorials for mor details about the API usage.
  37. * Connections
  38. * -----------
  39. */
  40. typedef struct{
  41. UA_String name;
  42. UA_Boolean enabled;
  43. union{ //std: valid types UInt or String
  44. UA_UInt32 numeric;
  45. UA_String string;
  46. }publisherId;
  47. UA_String transportProfileUri;
  48. UA_Variant address;
  49. size_t connectionPropertiesSize;
  50. UA_KeyValuePair *connectionProperties;
  51. UA_Variant connectionTransportSettings;
  52. } UA_PubSubConnectionConfig;
  53. UA_StatusCode
  54. UA_PubSubConnection_getConfig(UA_Server *server, UA_NodeId connectionIdentifier,
  55. UA_PubSubConnectionConfig *config);
  56. /**
  57. * **Create and Remove Connections**
  58. */
  59. UA_StatusCode
  60. UA_Server_addPubSubConnection(UA_Server *server, const UA_PubSubConnectionConfig *connectionConfig,
  61. UA_NodeId *connectionIdentifier);
  62. UA_StatusCode
  63. UA_Server_removePubSubConnection(UA_Server *server, UA_NodeId connectionIdentifier);
  64. #ifdef __cplusplus
  65. } // extern "C"
  66. #endif
  67. #endif /* UA_SERVER_PUBSUB_H */