etherlab/EthercatMaster.py
changeset 2360 2a3d022a7dac
parent 2358 8e5a9830867e
child 2363 9c7da6ff6a34
equal deleted inserted replaced
2359:e945fcb54cd4 2360:2a3d022a7dac
    66 
    66 
    67 # --------------------------------------------------
    67 # --------------------------------------------------
    68 #      Etherlab Specific Blocks Library
    68 #      Etherlab Specific Blocks Library
    69 # --------------------------------------------------
    69 # --------------------------------------------------
    70 
    70 
       
    71 
    71 def GetLocalPath(filename):
    72 def GetLocalPath(filename):
    72     return os.path.join(os.path.split(__file__)[0], filename)
    73     return os.path.join(os.path.split(__file__)[0], filename)
       
    74 
    73 
    75 
    74 class EtherlabLibrary(POULibrary):
    76 class EtherlabLibrary(POULibrary):
    75     def GetLibraryPath(self):
    77     def GetLibraryPath(self):
    76         return GetLocalPath("pous.xml")
    78         return GetLocalPath("pous.xml")
    77 
    79 
    92 # --------------------------------------------------
    94 # --------------------------------------------------
    93 #                 Ethercat MASTER
    95 #                 Ethercat MASTER
    94 # --------------------------------------------------
    96 # --------------------------------------------------
    95 
    97 
    96 EtherCATConfigParser = GenerateParserFromXSD(os.path.join(os.path.dirname(__file__), "EtherCATConfig.xsd"))
    98 EtherCATConfigParser = GenerateParserFromXSD(os.path.join(os.path.dirname(__file__), "EtherCATConfig.xsd"))
       
    99 
    97 
   100 
    98 def sort_commands(x, y):
   101 def sort_commands(x, y):
    99     if x["Index"] == y["Index"]:
   102     if x["Index"] == y["Index"]:
   100         return cmp(x["Subindex"], y["Subindex"])
   103         return cmp(x["Subindex"], y["Subindex"])
   101     return cmp(x["Index"], y["Index"])
   104     return cmp(x["Index"], y["Index"])
   217       </xsd:complexType>
   220       </xsd:complexType>
   218     </xsd:schema>
   221     </xsd:schema>
   219 """
   222 """
   220 
   223 
   221 ProcessVariablesParser = GenerateParserFromXSDstring(ProcessVariablesXSD)
   224 ProcessVariablesParser = GenerateParserFromXSDstring(ProcessVariablesXSD)
       
   225 
   222 
   226 
   223 class _EthercatCTN:
   227 class _EthercatCTN:
   224 
   228 
   225     CTNChildrenTypes = [("EthercatSlave", _EthercatSlaveCTN, "Ethercat Slave")]
   229     CTNChildrenTypes = [("EthercatSlave", _EthercatSlaveCTN, "Ethercat Slave")]
   226     if HAS_MCL:
   230     if HAS_MCL: