Browse Source

CreateMonitoredItems being processed. Publish scaffolding added.

ichrispa 10 years ago
parent
commit
8867ba8d88
2 changed files with 21 additions and 5 deletions
  1. 9 1
      src/server/ua_subscription_manager.c
  2. 12 4
      src/server/ua_subscription_manager.h

+ 9 - 1
src/server/ua_subscription_manager.c

@@ -14,6 +14,8 @@ void SubscriptionManager_init(UA_Server *server) {
     manager->GlobalLifeTimeCount           = (UA_UInt32_BoundedValue) { .maxValue = 15000, .minValue = 0, .currentValue=0 };
     manager->GlobalKeepAliveCount          = (UA_UInt32_BoundedValue) { .maxValue = 100,   .minValue = 0, .currentValue=0 };
     manager->GlobalNotificationsPerPublish = (UA_Int32_BoundedValue)  { .maxValue = 1000,  .minValue = 1, .currentValue=0 };
+    manager->GlobalSamplingInterval        = (UA_UInt32_BoundedValue) { .maxValue = 100,   .minValue = 0, .currentValue=0 };
+    manager->GlobalQueueSize               = (UA_UInt32_BoundedValue) { .maxValue = 100,   .minValue = 0, .currentValue=0 };
     
     manager->ServerSubscriptions = (UA_ListOfUASubscriptions *) malloc (sizeof(UA_ListOfUASubscriptions));
     LIST_INIT(manager->ServerSubscriptions);
@@ -33,6 +35,12 @@ UA_Subscription *UA_Subscription_new(UA_Int32 SubscriptionID) {
     return new;
 }
 
+UA_MonitoredItem *UA_MonitoredItem_new() {
+    UA_MonitoredItem *new = (UA_MonitoredItem *) malloc(sizeof(UA_MonitoredItem));
+    
+    return new;
+}
+
 void SubscriptionManager_addSubscription(UA_SubscriptionManager *manager, UA_Subscription *newSubscription) {    
     LIST_INSERT_HEAD(manager->ServerSubscriptions, newSubscription, listEntry);
 
@@ -59,6 +67,6 @@ void SubscriptionManager_deleteSubscription(UA_SubscriptionManager *manager, UA_
     if (sub != NULL) LIST_REMOVE(sub, listEntry);
     
     return;
-}
+} 
 
 #endif //#ifdef ENABLESUBSCRIPTIONS

+ 12 - 4
src/server/ua_subscription_manager.h

@@ -19,10 +19,15 @@ typedef struct {
 } UA_UInt32_BoundedValue;
 
 typedef struct UA_MonitoredItem_s {
-    UA_UInt32 TimestampsToReturn;
-    UA_UInt32 MonitoringMode;
-    UA_NodeId ItemNodeId;
-    UA_UInt32 AttributeID;
+    UA_UInt32  ItemId;
+    UA_UInt32  TimestampsToReturn;
+    UA_UInt32  MonitoringMode;
+    UA_NodeId  ItemNodeId;
+    UA_UInt32  AttributeID;
+    UA_UInt32  ClientHandle;
+    UA_UInt32  SamplingInterval;
+    UA_UInt32  QueueSize;
+    UA_Boolean DiscardOldest;
     // FIXME: indexRange is ignored; array values default to element 0
     // FIXME: dataEncoding is hardcoded to UA binary
     LIST_ENTRY(UA_MonitoredItem_s) listEntry;
@@ -47,6 +52,8 @@ typedef struct UA_SubscriptionManager_s {
     UA_UInt32_BoundedValue GlobalLifeTimeCount;
     UA_UInt32_BoundedValue GlobalKeepAliveCount;
     UA_Int32_BoundedValue  GlobalNotificationsPerPublish;
+    UA_UInt32_BoundedValue GlobalSamplingInterval;
+    UA_UInt32_BoundedValue GlobalQueueSize;
     UA_Int32 LastSessionID;
     UA_ListOfUASubscriptions *ServerSubscriptions;
 } UA_SubscriptionManager;
@@ -56,6 +63,7 @@ UA_Subscription *UA_Subscription_new(UA_Int32 SubscriptionID);
 void SubscriptionManager_addSubscription(UA_SubscriptionManager *manager, UA_Subscription *subscription);
 UA_Subscription *SubscriptionManager_getSubscriptionByID(UA_SubscriptionManager *manager, UA_Int32 SubscriptionID);
 void SubscriptionManager_deleteSubscription(UA_SubscriptionManager *manager, UA_Int32 SubscriptionID);
+UA_MonitoredItem *UA_MonitoredItem_new(void);
 
 #endif  // ifndef... define UA_SUBSCRIPTION_MANAGER_H_
 #endif  // ifdef EnableSubscriptions ...