예제 #1
0
class RemoteAutomatedRunMonitor(AutomatedRunMonitor):
    handle = None

    def __init__(self, host, port, kind, *args, **kw):
        super(RemoteAutomatedRunMonitor, self).__init__(*args, **kw)
        self.handle = EthernetCommunicator()
        self.handle.host = host
        self.handle.port = port
        self.handle.kind = kind

    def _get_value(self, name):
        p = self.handle.ask('Read {}'.format(name))
        return self._float(p)

    def get_pressure(self, controller, name):
        cmd = 'GetPressure {}, {}'.format(controller, name)
        p = self.handle.ask(cmd)
        return self._float(p, default=1.0)

    def _float(self, p, default=0.0):
        try:
            p = float(p)
        except (ValueError, TypeError):
            p = default
        return p
예제 #2
0
class RemoteAutomatedRunMonitor(AutomatedRunMonitor):
    handle = None

    def __init__(self, host, port, kind, *args, **kw):
        super(RemoteAutomatedRunMonitor, self).__init__(*args, **kw)
        self.handle = EthernetCommunicator()
        self.handle.host = host
        self.handle.port = port
        self.handle.kind = kind

    def _get_value(self, name):
        p = self.handle.ask('Read {}'.format(name))
        return self._float(p)

    def get_pressure(self, controller, name):
        cmd = 'GetPressure {}, {}'.format(controller, name)
        p = self.handle.ask(cmd)
        return self._float(p, default=1.0)

    def _float(self, p, default=0.0):
        try:
            p = float(p)
        except (ValueError, TypeError):
            p = default
        return p
예제 #3
0
    def __init__(self, *args, **kw):
        super(FirmwareClient, self).__init__(*args, **kw)

        c = EthernetCommunicator(host=self.host,
                                 port=self.port,
                                 use_end=True,
                                 kind='TCP')
        self._comm = c
예제 #4
0
    def open(self):
        host = self.host
        port = self.port

        self._communicator = ec = EthernetCommunicator(host=host, port=port)
        r = ec.open()
        if r:
            self.connected = True
        return r
예제 #5
0
 def _handle_factory(self):
     handle = EthernetCommunicator()
     handle.host = self.host
     handle.port = self.port
     handle.kind = self.kind
     handle.message_frame = self.frame
     handle.use_end = True
     return handle
예제 #6
0
    def setup_communicator(self):
        host = self.host
        port = self.port
        self.communicator = ec = EthernetCommunicator(
            host=host,
            port=port,
            kind=self.kind,
            use_end=self.use_end,
            message_frame=self.message_frame)

        r = ec.open()
        if r:
            r = self.opened()
            self.connected = bool(r)

        return r
예제 #7
0
class RemotePyScriptRunner(PyScriptRunner):
    handle = None
    def __init__(self, host, port, kind, *args, **kw):
        super(RemotePyScriptRunner, self).__init__(*args, **kw)
        self.handle = EthernetCommunicator()
        self.handle.host = host
        self.handle.port = port
        self.handle.kind = kind
#        self.handle.open()

    def _get_resource(self, name):
        r = RemoteResource()
        r.name = name
        r.handle = self.handle
        return r

    def connect(self):
        return self.handle.open()
예제 #8
0
class RemotePyScriptRunner(PyScriptRunner):
    handle = None

    def __init__(self, host, port, kind, *args, **kw):
        super(RemotePyScriptRunner, self).__init__(*args, **kw)
        self.handle = EthernetCommunicator()
        self.handle.host = host
        self.handle.port = port
        self.handle.kind = kind


#        self.handle.open()

    def _get_resource(self, name):
        r = RemoteResource()
        r.name = name
        r.handle = self.handle
        return r

    def connect(self):
        return self.handle.open()
예제 #9
0
 def __init__(self, host, port, kind, *args, **kw):
     super(RemotePyScriptRunner, self).__init__(*args, **kw)
     self.handle = EthernetCommunicator()
     self.handle.host = host
     self.handle.port = port
     self.handle.kind = kind
예제 #10
0
 def _handle_factory(self, h, p, k):
     ec = EthernetCommunicator()
     ec.trait_set(host=h, port=p, kind=k)
     return ec
예제 #11
0
 def __init__(self, host, port, kind, *args, **kw):
     super(RemoteAutomatedRunMonitor, self).__init__(*args, **kw)
     self.handle = EthernetCommunicator()
     self.handle.host = host
     self.handle.port = port
     self.handle.kind = kind
예제 #12
0
 def __init__(self, host, port, kind, *args, **kw):
     super(RemotePyScriptRunner, self).__init__(*args, **kw)
     self.handle = EthernetCommunicator()
     self.handle.host = host
     self.handle.port = port
     self.handle.kind = kind
예제 #13
0
 def _handle_factory(self, h, p, k):
     ec = EthernetCommunicator()
     ec.trait_set(host=h, port=p, kind=k)
     return ec
예제 #14
0
 def __init__(self, host, port, kind, *args, **kw):
     super(RemoteAutomatedRunMonitor, self).__init__(*args, **kw)
     self.handle = EthernetCommunicator()
     self.handle.host = host
     self.handle.port = port
     self.handle.kind = kind