Explorar el Código

add UA_ENABLE_METHODCALLS in nodeset_compiler

StalderT hace 6 años
padre
commit
51a38e5413
Se han modificado 1 ficheros con 17 adiciones y 4 borrados
  1. 17 4
      tools/nodeset_compiler/backend_open62541.py

+ 17 - 4
tools/nodeset_compiler/backend_open62541.py

@@ -269,21 +269,34 @@ extern UA_StatusCode %s(UA_Server *server);
                 continue
             else:
                 writec("\nstatic UA_StatusCode function_" + outfilebase + "_" + str(functionNumber) + "_begin(UA_Server *server, UA_UInt16* ns) {\n")
+                if isinstance(node, MethodNode):
+                    writec("#ifdef UA_ENABLE_METHODCALLS")
                 writec(code)
 
         # Print inverse references leading to this node
         for ref in node.printRefs:
             writec(generateReferenceCode(ref))
             
-        writec("return retVal;\n}")
+        writec("return retVal;")
+        if isinstance(node, MethodNode):
+            writec("#else")
+            writec("return UA_STATUSCODE_GOOD;")
+            writec("#endif /* UA_ENABLE_METHODCALLS */")
+        writec("}");
 
         writec("\nstatic UA_StatusCode function_" + outfilebase + "_" + str(functionNumber) + "_finish(UA_Server *server, UA_UInt16* ns) {\n")
+        if isinstance(node, MethodNode):
+            writec("#ifdef UA_ENABLE_METHODCALLS")
         code = generateNodeCode_finish(node)
-        writec("return " + code + "\n}\n")
+        writec("return " + code)
+        if isinstance(node, MethodNode):
+            writec("#else")
+            writec("return UA_STATUSCODE_GOOD;")
+            writec("#endif /* UA_ENABLE_METHODCALLS */")
+        writec("}");
 
         functionNumber = functionNumber + 1
-    
-    
+
     writec("""
 UA_StatusCode %s(UA_Server *server) {
 UA_StatusCode retVal = UA_STATUSCODE_GOOD;""" % (outfilebase))