Ejemplo n.º 1
0
    def init(self):
        """Initialise the device"""
        AbstractNState.init(self)
        value_channel = self.get_property("value_channel_name")
        state_channel = self.get_property("state_channel_name", "State")

        _exporter_address = self.get_property("exporter_address")
        _host, _port = _exporter_address.split(":")
        self._exporter = Exporter(_host, int(_port))

        self.value_channel = self.add_channel(
            {
                "type": "exporter",
                "exporter_address": _exporter_address,
                "name": value_channel.lower(),
            },
            value_channel,
        )
        self.value_channel.connect_signal("update", self.update_value)

        self.state_channel = self.add_channel(
            {
                "type": "exporter",
                "exporter_address": _exporter_address,
                "name": "state",
            },
            state_channel,
        )

        self.state_channel.connect_signal("update", self._update_state)
        self.update_state()
Ejemplo n.º 2
0
    def init(self):

        self.pixels_per_mm = self.get_property("pixels_per_mm")
        self.camera_hwobj = self.get_object_by_role("camera")

        self.connect(self.camera_hwobj, "zoomChanged", self.zoom_value_changed)

        if self.camera_hwobj is None:
            self.log.debug("P11Zoom.py - cannot connect to camera hardware object")
        else:
            self.log.debug("P11Zoom.py / current zoom is %s" % self.camera_hwobj.get_zoom())

        AbstractNState.init(self)
Ejemplo n.º 3
0
    def init(self):
        """Initialize the zoom"""
        AbstractNState.init(self)

        try:
            values = ast.literal_eval(self.getProperty("values")).values()
        except AttributeError:
            limits = (0, 10)
        else:
            limits = (min(values), max(values))

        self.update_limits(limits)
        self.update_value([*self.VALUES.__members__.values()][0])
        self.update_state(self.STATES.READY)
Ejemplo n.º 4
0
    def init(self):
        """Initialise the device"""
        AbstractNState.init(self)
        _name = self.getProperty("object_name")
        self._bliss_obj = getattr(self.getObjectByRole("controller"), _name)

        self.device_type = "actuator"
        if "MultiplePositions" in self._bliss_obj.__class__:
            self.device_type = "motor"

        if self.device_type == "actuator":
            self.connect(self.bliss_obj, "state", self.update_value)
            self.connect(self.bliss_obj, "state", self.update_state)
            self.__saved_state = self.get_value()
        elif self.device_type == "motor":
            self.connect(self.bliss_obj, "position", self.update_value)
            self.connect(self.bliss_obj, "state", self._update_state_motor)
Ejemplo n.º 5
0
    def init(self):
        """Initialize the zoom"""
        EPICSActuator.init(self)
        AbstractNState.init(self)

        self.initialise_values()
        _len = len(self.VALUES) - 1
        if _len > 0:
            # we can only assume that the values are consecutive integers
            # so the limits correspond to the keys
            limits = (1, _len)
            self.set_limits(limits)
        else:
            # Normally we get the limits from the hardware
            limits = (1, 10)
            self.set_limits(limits)
            # there is nothing in the xml file, create ValueEnum from the limits
            self._initialise_values()

        self.update_limits(limits)
        current_value = self.get_value()
        self.update_value(current_value)
        self.update_state(self.STATES.READY)
Ejemplo n.º 6
0
 def __init__(self, name):
     AbstractNState.__init__(self, name)
     self._exporter = None
     self.value_channel = None
     self.state_channel = None
Ejemplo n.º 7
0
    def __init__(self, name):
        self.camera_hwobj = None
        self.pixels_per_mm = None
        self.closest_zoom = None

        AbstractNState.__init__(self,name)
Ejemplo n.º 8
0
 def __init__(self, name):
     AbstractNState.__init__(self, name)
     self._bliss_obj = None
     self.device_type = None
     self.__saved_state = None
Ejemplo n.º 9
0
 def init(self):
     """Initilise the predefined values"""
     AbstractNState.init(self)
Ejemplo n.º 10
0
 def __init__(self, name):
     AbstractNState.__init__(self, name)
Ejemplo n.º 11
0
 def init(self):
     """Initialise the device"""
     AbstractNState.init(self)
     self.update_state(self.STATES.READY)
Ejemplo n.º 12
0
 def __init__(self, name):
     AbstractNState.__init__(self, name)
     self._mock_value = "OUT"
     self._mock_state = "READY"
Ejemplo n.º 13
0
 def init(self):
     AbstractNState.initialise_values(self)
     self.username = self.getProperty("username")
     self.states = dict((item.value, item.name) for item in self.VALUES)
     self.moves = dict((item.name, item.value) for item in self.VALUES)
     self.get_actuator_state()
Ejemplo n.º 14
0
 def __init__(self, name):
     AbstractNState.__init__(self, name)
     self.username = "******"
     self.actuatorState = "unknown"
     self.state_attr = None