Pārlūkot izejas kodu

Fixed name compilers array encoding by removing the manual type assigned to the variant. Method generation overwrites argument creation of addMethodNode.

ichrispa 9 gadi atpakaļ
vecāks
revīzija
b106687b4b

+ 6 - 2
tools/pyUANamespace/open62541_MacroHelper.py

@@ -128,7 +128,9 @@ class open62541_MacroHelper():
       code.append("UA_QualifiedName nodeName = UA_QUALIFIEDNAME(" +  str(extrNs[0]) + ", \"" + extrNs[1] + "\");")
       code.append("UA_QualifiedName nodeName = UA_QUALIFIEDNAME(" +  str(extrNs[0]) + ", \"" + extrNs[1] + "\");")
     else:
     else:
       code.append("UA_QualifiedName nodeName = UA_QUALIFIEDNAME(0, \"" + str(node.browseName()) + "\");")
       code.append("UA_QualifiedName nodeName = UA_QUALIFIEDNAME(0, \"" + str(node.browseName()) + "\");")
-
+    
+    # In case of a MethodNode: Add in|outArg struct generation here. Mandates that namespace reordering was done using 
+    # Djikstra (check that arguments have not been printed). (@ichrispa)
     code.append("UA_Server_add%sNode(server, nodeId, parentNodeId, parentReferenceNodeId, nodeName" % nodetype)
     code.append("UA_Server_add%sNode(server, nodeId, parentNodeId, parentReferenceNodeId, nodeName" % nodetype)
       
       
     if nodetype in ["Object", "Variable"]:
     if nodetype in ["Object", "Variable"]:
@@ -137,7 +139,9 @@ class open62541_MacroHelper():
     if nodetype != "Method":
     if nodetype != "Method":
       code.append("       , attr, NULL);")
       code.append("       , attr, NULL);")
     else:
     else:
-      code.append("       , attr, (UA_MethodCallback) NULL, NULL, 0, NULL, 0, NULL, NULL);")
+      # FIXME:  Semantic of inputArgumentSize = -1 is used to signal the suppression of argument creation.
+      #         This should be replaced with a properly generated struct for the arguments.
+      code.append("       , attr, (UA_MethodCallback) NULL, NULL, -1, NULL, -1, NULL, NULL);")
     return code
     return code
     
     
   def getCreateNodeBootstrap(self, node):
   def getCreateNodeBootstrap(self, node):

+ 2 - 2
tools/pyUANamespace/ua_builtin_types.py

@@ -353,7 +353,7 @@ class opcua_value_t():
           for v in self.value:
           for v in self.value:
             log(self, "Building extObj array index " + str(self.value.index(v)))
             log(self, "Building extObj array index " + str(self.value.index(v)))
             code = code + v.printOpen62541CCode_SubType_build(arrayIndex=self.value.index(v))
             code = code + v.printOpen62541CCode_SubType_build(arrayIndex=self.value.index(v))
-        code.append("attr.value.type = &UA_TYPES[UA_TYPES_" + self.value[0].stringRepresentation.upper() + "];")
+        #code.append("attr.value.type = &UA_TYPES[UA_TYPES_" + self.value[0].stringRepresentation.upper() + "];")
         code.append("UA_" + self.value[0].stringRepresentation + " " + valueName + "[" + str(len(self.value)) + "];")
         code.append("UA_" + self.value[0].stringRepresentation + " " + valueName + "[" + str(len(self.value)) + "];")
         if self.value[0].__binTypeId__ == BUILTINTYPE_TYPEID_EXTENSIONOBJECT:
         if self.value[0].__binTypeId__ == BUILTINTYPE_TYPEID_EXTENSIONOBJECT:
           for v in self.value:
           for v in self.value:
@@ -378,7 +378,7 @@ class opcua_value_t():
       else:
       else:
         # The following strategy applies to all other types, in particular strings and numerics.
         # The following strategy applies to all other types, in particular strings and numerics.
         if self.value[0].__binTypeId__ == BUILTINTYPE_TYPEID_EXTENSIONOBJECT:
         if self.value[0].__binTypeId__ == BUILTINTYPE_TYPEID_EXTENSIONOBJECT:
-          code = code + self.value[0].printOpen62541CCode_SubType_build()`
+          code = code + self.value[0].printOpen62541CCode_SubType_build()
         #code.append("attr.value.type = &UA_TYPES[UA_TYPES_" + self.value[0].stringRepresentation.upper() + "];")
         #code.append("attr.value.type = &UA_TYPES[UA_TYPES_" + self.value[0].stringRepresentation.upper() + "];")
         if self.value[0].__binTypeId__ == BUILTINTYPE_TYPEID_EXTENSIONOBJECT:
         if self.value[0].__binTypeId__ == BUILTINTYPE_TYPEID_EXTENSIONOBJECT:
           code.append("UA_" + self.value[0].stringRepresentation + " *" + valueName + " = " + self.value[0].printOpen62541CCode_SubType() + ";")
           code.append("UA_" + self.value[0].stringRepresentation + " *" + valueName + " = " + self.value[0].printOpen62541CCode_SubType() + ";")