Browse Source

added createMonitoredItems again

FlorianPalm 10 years ago
parent
commit
883ba6a596
3 changed files with 18 additions and 8 deletions
  1. 1 0
      src/Makefile.am
  2. 14 8
      src/ua_services_monitoreditems.c
  3. 3 0
      src/ua_transport_binary_secure.c

+ 1 - 0
src/Makefile.am

@@ -25,6 +25,7 @@ libopen62541_la_SOURCES = ua_types.c \
 						  ua_services_nodemanagement.c \
 						  ua_services_nodemanagement.c \
 						  ua_services_view.c \
 						  ua_services_view.c \
 						  ua_services_subscription.c\
 						  ua_services_subscription.c\
+						  ua_services_monitoreditems.c\
 						  ua_application.c \
 						  ua_application.c \
 						  ua_xml.c
 						  ua_xml.c
 ua_types.c: ua_namespace_0.h
 ua_types.c: ua_namespace_0.h

+ 14 - 8
src/ua_services_monitoreditems.c

@@ -1,24 +1,30 @@
 #include "ua_services.h"
 #include "ua_services.h"
+#include "ua_statuscodes.h"
 
 
-#if 0
+//#if 0
 /* Activate once the infrastructure for pushing events is in place. */
 /* Activate once the infrastructure for pushing events is in place. */
 
 
 UA_Int32 Service_CreateMonitoredItems(SL_Channel *channel, const UA_CreateMonitoredItemsRequest *request, UA_CreateMonitoredItemsResponse *response) {
 UA_Int32 Service_CreateMonitoredItems(SL_Channel *channel, const UA_CreateMonitoredItemsRequest *request, UA_CreateMonitoredItemsResponse *response) {
 	if (request->itemsToCreateSize > 0) {
 	if (request->itemsToCreateSize > 0) {
 		response->resultsSize = request->itemsToCreateSize;
 		response->resultsSize = request->itemsToCreateSize;
-		UA_Array_new((void**)&(response->results),response->resultsSize,UA_MONITOREDITEMCREATERESULT);
+
+		UA_Array_new((void**)&(response->results),response->resultsSize,&UA_.types[UA_MONITOREDITEMCREATERESULT]);
 		for (int i=0;request->itemsToCreateSize > 0 && i < request->itemsToCreateSize;i++) {
 		for (int i=0;request->itemsToCreateSize > 0 && i < request->itemsToCreateSize;i++) {
-			UA_NodeId_printf("CreateMonitoredItems - itemToCreate=",&(request->itemsToCreate[i]->itemToMonitor.nodeId));
+			UA_NodeId_printf("CreateMonitoredItems - itemToCreate=",&(request->itemsToCreate[i].itemToMonitor.nodeId));
 			//FIXME: search the object in the namespace
 			//FIXME: search the object in the namespace
-			if (request->itemsToCreate[i]->itemToMonitor.nodeId.identifier.numeric == 2253) { // server
-				response->results[i]->statusCode = UA_STATUSCODE_GOOD;
-				response->results[i]->monitoredItemId = 1024;
+			if (request->itemsToCreate[i].itemToMonitor.nodeId.identifier.numeric == 2253) { // server
+
+				response->results[i].statusCode = UA_STATUSCODE_GOOD;
+				response->results[i].monitoredItemId = 1024;
 			} else {
 			} else {
 				// response->results[i]->statusCode = UA_STATUSCODE_BAD_NODEIDUNKNOWN;
 				// response->results[i]->statusCode = UA_STATUSCODE_BAD_NODEIDUNKNOWN;
-				response->results[i]->statusCode = -1;
+
+				response->results[i].statusCode = -1;
 			}
 			}
 		}
 		}
 	}
 	}
+	//mock up
+	return UA_SUCCESS;
 }
 }
 
 
-#endif
+//#endif

+ 3 - 0
src/ua_transport_binary_secure.c

@@ -149,6 +149,9 @@ UA_Int32 SL_handleRequest(SL_Channel *channel, const UA_ByteString *msg, UA_UInt
 	}else if(serviceid == UA_CREATESUBSCRIPTIONREQUEST_NS0) {
 	}else if(serviceid == UA_CREATESUBSCRIPTIONREQUEST_NS0) {
 		INVOKE_SERVICE(CreateSubscription);
 		INVOKE_SERVICE(CreateSubscription);
 		responsetype = UA_CREATESUBSCRIPTIONRESPONSE_NS0;
 		responsetype = UA_CREATESUBSCRIPTIONRESPONSE_NS0;
+	}else if(serviceid == UA_CREATEMONITOREDITEMSREQUEST_NS0) {
+		INVOKE_SERVICE(CreateMonitoredItems);
+		responsetype = UA_CREATEMONITOREDITEMSRESPONSE_NS0;
 	}else{
 	}else{
 		printf("SL_processMessage - unknown request, namespace=%d, request=%d\n",
 		printf("SL_processMessage - unknown request, namespace=%d, request=%d\n",
 		       serviceRequestType.namespace,
 		       serviceRequestType.namespace,