Пример #1
0
    def init_device(self):
        Device.init_device(self)
        for attr in ("state", "status", "last_error", "last_point_nb",
                     "acq_mode", "acq_expo_time", "acq_nb_points",
                     "acq_channels"):
            self.set_change_event(attr, True, False)

        self.__last_error = ""
        self.__last_point_nb = -1
        self.__last_point_nb_timestamp = 0.

        try:
            config = get_config()
            util = PyTango.Util.instance()
            if util.is_svr_starting():
                self.device = CT2Device(config, self.card_name)
                dispatcher.connect(self.__on_error, signal=ErrorSignal,
                                   sender=self.device)
                dispatcher.connect(self.__on_point_nb, signal=PointNbSignal,
                                   sender=self.device)
                dispatcher.connect(self.__on_stop, signal=StopSignal,
                                   sender=self.device)
            else:
                self.apply_config()
            switch_state(self, DevState.ON, "Ready!")
        except Exception as e:
            msg = "Exception initializing device: {0}".format(e)
            self.error_stream(msg)
            switch_state(self, DevState.FAULT, msg)
Пример #2
0
    def init_device(self):
        Device.init_device(self)
        for attr in ("state", "status", "last_error", "last_point_nb",
                     "acq_mode", "acq_expo_time", "acq_nb_points",
                     "acq_channels"):
            self.set_change_event(attr, True, False)

        self.__last_error = ""
        self.__last_point_nb = -1
        self.__last_point_nb_timestamp = 0.

        try:
            config = get_config()
            util = PyTango.Util.instance()
            if util.is_svr_starting():
                self.device = CT2Device(config, self.card_name)
                dispatcher.connect(self.__on_error,
                                   signal=ErrorSignal,
                                   sender=self.device)
                dispatcher.connect(self.__on_point_nb,
                                   signal=PointNbSignal,
                                   sender=self.device)
                dispatcher.connect(self.__on_stop,
                                   signal=StopSignal,
                                   sender=self.device)
            else:
                self.apply_config()
            switch_state(self, DevState.ON, "Ready!")
        except Exception as e:
            msg = "Exception initializing device: {0}".format(e)
            self.error_stream(msg)
            switch_state(self, DevState.FAULT, msg)
Пример #3
0
 def reload(self):
     cfg = static.get_config()
     # this reloads *all* the configuration, hopefully it is not such
     # a big task and it can be left as simple as it is, if needed
     # we could selectively reload only parts of the config (e.g one
     # single object yml file)
     cfg.reload()
     self.config_dict = cfg.get_config(self.config_dict['name'])
     self._update_channel()
Пример #4
0
def get_config(reload=False):
    global __config
    try:
        cfg = __config
        if reload:
            cfg.reload()
        return cfg
    except NameError:
        from beacon.static import get_config
        __config = get_config()
    return __config
Пример #5
0
def get_config(reload=False):
    global __config
    try:
        cfg = __config
        if reload:
            cfg.reload()
        return cfg
    except NameError:
        from beacon.static import get_config
        __config = get_config()
    return __config
Пример #6
0
 def __onReconfigure(self):
     card = self.__card
     cfg = get_config(reload=True)
     if card is None:
         return
     card.request_exclusive_access()
     card.disable_interrupts()
     card.reset_FIFO_error_flags()
     card.reset()
     card.software_reset()
     card_cfg = cfg.get_config(self.__card.name)
     ct2.configure_card(self.__card, card_cfg)
Пример #7
0
 def __onReconfigure(self):
     card = self.__card
     cfg = get_config(reload=True)
     if card is None:
         return
     card.request_exclusive_access()
     card.disable_interrupts()
     card.reset_FIFO_error_flags()
     card.reset()
     card.software_reset()
     card_cfg = cfg.get_config(self.__card.name)
     ct2.configure_card(self.__card, card_cfg)
Пример #8
0
def get_card_config(name):
    return get_config().get_config(name)
Пример #9
0
def get_card_config(name):
    return get_config().get_config(name)