Пример #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()
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #6
0
 def init(self):
     """Initilise the predefined values"""
     AbstractNState.init(self)
Пример #7
0
 def init(self):
     """Initialise the device"""
     AbstractNState.init(self)
     self.update_state(self.STATES.READY)