def __init__(self, socket, max_message = 100000):
     self.__super.__init__()
     self.socket = socket
     self.max_message = max_message
     self.chain = ethercat.EthercatChain()
     self.chainfile = IocDataStream("chain.xml")
     self.expandedfile = IocDataStream("expanded.xml")
     self.scannerf = IocDataStream("scanner.sh",mode=0555)
     self.dev_descriptions = []
Exemple #2
0
 def __init__(self, socket, max_message=100000, master_index=0):
     self.__super.__init__()
     self.socket = socket
     self.max_message = max_message
     self.master_index = master_index
     self.chain = ethercat.EthercatChain()
     self.chainfile = IocDataStream("chain.xml")
     self.expandedfile = IocDataStream("expanded.xml")
     self.scannerf = IocDataStream("scanner.sh", mode=0555)
     self.dev_descriptions = []
Exemple #3
0
class EthercatMaster(Device):
    '''An EtherCAT Master device for the iocbuilder
      Keeps a 'chain' member with a list of slaves in the bus
      '''
    Dependencies = ( Asyn, )
    LibFileList = [ 'ecAsyn' ]
    DbdFileList = [ 'ecAsyn' ]

    def __init__(self, socket, max_message = 100000, master_index = 0):
        self.__super.__init__()
        self.socket = socket
        self.max_message = max_message
        self.master_index = master_index
        self.chain = ethercat.EthercatChain()
        self.chainfile = IocDataStream("chain.xml")
        self.expandedfile = IocDataStream("expanded.xml")
        self.scannerf = IocDataStream("scanner.sh",mode=0555)
        self.dev_descriptions = []

    def Initialise(self):
        print 'ecAsynInit("%(socket)s", %(max_message)d)' % self.__dict__
        self.getDeviceDescriptions()
        self.expandedfile.write( self.generateMasterXml() )
        self.writeScannerStartup()

    ArgInfo = makeArgInfo(
        __init__,
        socket = Simple("scanner socket path", str),
        max_message = Simple("max scanner message size", int),
        master_index = Simple("master index", int)
    )

    def writeScannerStartup(self):
        scanner_path = os.path.join(ethercat.etcdir,'../bin/linux-x86_64/scanner')
        self.scannerf.write(SCANNER_STARTUP_TEXT % dict(
            scanner = os.path.realpath(scanner_path),
            expanded_chain = "./" + self.expandedfile.name,
            socket_path = self.socket,
            master_index = self.master_index))

    def setSlave(self, slave):
        self.chain.setDevice(slave.chainelem)

    def getDeviceDescriptions(self):
        self.chain.getDeviceDescriptions()
    
    def generateChainXml(self):
        return self.chain.generateChainXml()

    def generateMasterXml(self):
        return self.chain.generateMasterXml()
Exemple #4
0
class EthercatMaster(Device):
    '''An EtherCAT Master device for the iocbuilder
      Keeps a 'chain' member with a list of slaves in the bus
      '''
    Dependencies = (Asyn, )
    LibFileList = ['ecAsyn']
    DbdFileList = ['ecAsyn']

    def __init__(self, socket, max_message=100000, master_index=0):
        self.__super.__init__()
        self.socket = socket
        self.max_message = max_message
        self.master_index = master_index
        self.chain = ethercat.EthercatChain()
        self.chainfile = IocDataStream("chain.xml")
        self.expandedfile = IocDataStream("expanded.xml")
        self.scannerf = IocDataStream("scanner.sh", mode=0555)
        self.dev_descriptions = []

    def Initialise(self):
        print 'ecAsynInit("%(socket)s", %(max_message)d)' % self.__dict__
        self.getDeviceDescriptions()
        self.expandedfile.write(self.generateMasterXml())
        self.writeScannerStartup()

    ArgInfo = makeArgInfo(__init__,
                          socket=Simple("scanner socket path", str),
                          max_message=Simple("max scanner message size", int),
                          master_index=Simple("master index", int))

    def writeScannerStartup(self):
        scanner_path = os.path.join(ethercat.etcdir,
                                    '../bin/linux-x86_64/scanner')
        self.scannerf.write(SCANNER_STARTUP_TEXT %
                            dict(scanner=os.path.realpath(scanner_path),
                                 expanded_chain="./" + self.expandedfile.name,
                                 socket_path=self.socket,
                                 master_index=self.master_index))

    def setSlave(self, slave):
        self.chain.setDevice(slave.chainelem)

    def getDeviceDescriptions(self):
        self.chain.getDeviceDescriptions()

    def generateChainXml(self):
        return self.chain.generateChainXml()

    def generateMasterXml(self):
        return self.chain.generateMasterXml()
Exemple #5
0
 def __init__(self):
     self.__super.__init__(IocDataStream('auto_blacklist'))
     self.blacklist.write(' Automatically generated, do not edit\n')
     Record.AddMetadataHook(lambda _: None, Blacklist = self.add_blacklist)
     assert self.Instance is None, 'Cannot have multiple instances'
     BlacklistPvs.Instance = self