PLCControler.py
changeset 883 235a9ec83b95
parent 864 bf4f7f0801b9
child 884 e12228fd8773
equal deleted inserted replaced
882:3c6ce0a5ab2c 883:235a9ec83b95
  1474         return None
  1474         return None
  1475     
  1475     
  1476     def GetVariableLocationTree(self):
  1476     def GetVariableLocationTree(self):
  1477         return []
  1477         return []
  1478 
  1478 
       
  1479     def GetConfNodeGlobalInstances(self):
       
  1480         return []
       
  1481 
       
  1482     def GetConfigurationExtraVariables(self):
       
  1483         global_vars = []
       
  1484         for var_name, var_type in self.GetConfNodeGlobalInstances():
       
  1485             tempvar = plcopen.varListPlain_variable()
       
  1486             tempvar.setname(var_name)
       
  1487             
       
  1488             tempvartype = plcopen.dataType()
       
  1489             if var_type in self.GetBaseTypes():
       
  1490                 if var_type == "STRING":
       
  1491                     var_type.setcontent({"name" : "string", "value" : plcopen.elementaryTypes_string()})
       
  1492                 elif var_type == "WSTRING":
       
  1493                     var_type.setcontent({"name" : "wstring", "value" : plcopen.elementaryTypes_wstring()})
       
  1494                 else:
       
  1495                     var_type.setcontent({"name" : var_type, "value" : None})
       
  1496             else:
       
  1497                 tempderivedtype = plcopen.derivedTypes_derived()
       
  1498                 tempderivedtype.setname(var_type)
       
  1499                 tempvartype.setcontent({"name" : "derived", "value" : tempderivedtype})
       
  1500             tempvar.settype(tempvartype)
       
  1501             
       
  1502             global_vars.append(tempvar)
       
  1503         return global_vars
       
  1504 
  1479     # Function that returns the block definition associated to the block type given
  1505     # Function that returns the block definition associated to the block type given
  1480     def GetBlockType(self, type, inputs = None, debug = False):
  1506     def GetBlockType(self, type, inputs = None, debug = False):
  1481         result_blocktype = None
  1507         result_blocktype = None
  1482         for category in BlockTypes + self.GetConfNodeBlockTypes():
  1508         for category in BlockTypes + self.GetConfNodeBlockTypes():
  1483             for blocktype in category["list"]:
  1509             for blocktype in category["list"]:
  1721         if project is not None:
  1747         if project is not None:
  1722             words = tagname.split("::")
  1748             words = tagname.split("::")
  1723             if words[0] == "D":
  1749             if words[0] == "D":
  1724                 infos = {}
  1750                 infos = {}
  1725                 datatype = project.getdataType(words[1])
  1751                 datatype = project.getdataType(words[1])
       
  1752                 if datatype is None:
       
  1753                     return None
  1726                 basetype_content = datatype.baseType.getcontent()
  1754                 basetype_content = datatype.baseType.getcontent()
  1727                 if basetype_content["value"] is None or basetype_content["name"] in ["string", "wstring"]:
  1755                 if basetype_content["value"] is None or basetype_content["name"] in ["string", "wstring"]:
  1728                     infos["type"] = "Directly"
  1756                     infos["type"] = "Directly"
  1729                     infos["base_type"] = basetype_content["name"].upper()
  1757                     infos["base_type"] = basetype_content["name"].upper()
  1730                 elif basetype_content["name"] == "derived":
  1758                 elif basetype_content["name"] == "derived":