ua_subscription_manager.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #ifdef ENABLESUBSCRIPTIONS
  2. #ifndef UA_SUBSCRIPTION_MANAGER_H_
  3. #define UA_SUBSCRIPTION_MANAGER_H_
  4. #include "ua_server.h"
  5. #include "ua_types.h"
  6. #include "queue.h"
  7. typedef struct {
  8. UA_Int32 currentValue;
  9. UA_Int32 minValue;
  10. UA_Int32 maxValue;
  11. } UA_Int32_BoundedValue;
  12. typedef struct {
  13. UA_UInt32 currentValue;
  14. UA_UInt32 minValue;
  15. UA_UInt32 maxValue;
  16. } UA_UInt32_BoundedValue;
  17. typedef struct UA_MonitoredItem_s {
  18. UA_UInt32 ItemId;
  19. UA_UInt32 TimestampsToReturn;
  20. UA_UInt32 MonitoringMode;
  21. UA_NodeId ItemNodeId;
  22. UA_UInt32 AttributeID;
  23. UA_UInt32 ClientHandle;
  24. UA_UInt32 SamplingInterval;
  25. UA_UInt32 QueueSize;
  26. UA_Boolean DiscardOldest;
  27. // FIXME: indexRange is ignored; array values default to element 0
  28. // FIXME: dataEncoding is hardcoded to UA binary
  29. LIST_ENTRY(UA_MonitoredItem_s) listEntry;
  30. } UA_MonitoredItem;
  31. typedef LIST_HEAD(UA_ListOfUAMonitoredItems_s, UA_MonitoredItem_s) UA_ListOfUAMonitoredItems;
  32. typedef struct UA_Subscription_s {
  33. UA_UInt32_BoundedValue LifeTime;
  34. UA_UInt32_BoundedValue KeepAliveCount;
  35. UA_Int32 PublishingInterval;
  36. UA_Int32 SubscriptionID;
  37. UA_Int32 NotificationsPerPublish;
  38. UA_Boolean PublishingMode;
  39. UA_UInt32 Priority;
  40. LIST_ENTRY(UA_Subscription_s) listEntry;
  41. UA_ListOfUAMonitoredItems *MonitoredItems;
  42. } UA_Subscription;
  43. typedef LIST_HEAD(UA_ListOfUASubscriptions_s, UA_Subscription_s) UA_ListOfUASubscriptions;
  44. typedef struct UA_SubscriptionManager_s {
  45. UA_Int32_BoundedValue GlobalPublishingInterval;
  46. UA_UInt32_BoundedValue GlobalLifeTimeCount;
  47. UA_UInt32_BoundedValue GlobalKeepAliveCount;
  48. UA_Int32_BoundedValue GlobalNotificationsPerPublish;
  49. UA_UInt32_BoundedValue GlobalSamplingInterval;
  50. UA_UInt32_BoundedValue GlobalQueueSize;
  51. UA_Int32 LastSessionID;
  52. UA_ListOfUASubscriptions *ServerSubscriptions;
  53. } UA_SubscriptionManager;
  54. void SubscriptionManager_init(UA_Server *server);
  55. UA_Subscription *UA_Subscription_new(UA_Int32 SubscriptionID);
  56. void SubscriptionManager_addSubscription(UA_SubscriptionManager *manager, UA_Subscription *subscription);
  57. UA_Subscription *SubscriptionManager_getSubscriptionByID(UA_SubscriptionManager *manager, UA_Int32 SubscriptionID);
  58. UA_Int32 SubscriptionManager_deleteSubscription(UA_SubscriptionManager *manager, UA_Int32 SubscriptionID);
  59. UA_MonitoredItem *UA_MonitoredItem_new(void);
  60. #endif // ifndef... define UA_SUBSCRIPTION_MANAGER_H_
  61. #endif // ifdef EnableSubscriptions ...