class ClaussShutter(AbstractHardwarePlugin, ShutterPlugin): def _init(self): Logger().trace("ClaussShutter._init()") AbstractHardwarePlugin._init(self) ShutterPlugin._init(self) self._hardware = ClaussHardware() def _defineConfig(self): AbstractHardwarePlugin._defineConfig(self) ShutterPlugin._defineConfig(self) self._addConfigKey("_focus", "FOCUS_ENABLE", default=DEFAULT_FOCUS_ENABLE) self._addConfigKey("_focus_time", "FOCUS_TIME", default=DEFAULT_FOCUS_TIME) self._addConfigKey("_dual", "DUAL_ENABLE", default=DEFAULT_DUAL_ENABLE) self._addConfigKey("_dual_time", "DUAL_TIME", default=DEFAULT_DUAL_TIME) def _triggerShutter(self, delay): """ Trigger the shutter contact. Note that FOCUS_ENABLE and DUAL_ENABLE options are exclusive (done via UI) @param delay: delay to wait between on/off, in s @type delay: float """ Logger().trace("ClaussShutter._triggerShutter()") # Autofocus mode enable if self._config["FOCUS_ENABLE"]: self._triggerAutoFocus() time.sleep(self._config["FOCUS_TIME"]) # Shoot regular camera self._triggerOnShutter() time.sleep(delay) self._triggerOffShutter() # Dual camera mode if self._config["DUAL_ENABLE"]: time.sleep(self._config["DUAL_TIME"]) Logger().info("ClaussShutter._triggerShutter(): dual camera shoot") self._triggerAutoFocus() time.sleep(delay) self._triggerOffShutter() self._LastShootTime = time.time() def _triggerAutoFocus(self): """ Set the autofocus on. """ self._hardware.setShutter("AF") def _triggerOnShutter(self): """ Set the shutter on. """ self._hardware.setShutter("ON") def _triggerOffShutter(self): """ Set the shutter off. """ self._hardware.setShutter("OFF") def init(self): Logger().trace("ClaussShutter.init()") self._hardware.setAxis(AXIS_TABLE[self.capacity]), AbstractHardwarePlugin.init(self) def shutdown(self): Logger().trace("ClaussShutter.shutdown()") self._triggerOffShutter() AbstractHardwarePlugin.shutdown(self) ShutterPlugin.shutdown(self)
class ClaussShutter(AbstractHardwarePlugin, ShutterPlugin): def _init(self): Logger().trace("ClaussShutter._init()") AbstractHardwarePlugin._init(self) ShutterPlugin._init(self) self._hardware = ClaussHardware() def _defineConfig(self): AbstractHardwarePlugin._defineConfig(self) ShutterPlugin._defineConfig(self) self._addConfigKey('_focus', 'FOCUS_ENABLE', default=DEFAULT_FOCUS_ENABLE) self._addConfigKey('_focus_time', 'FOCUS_TIME', default=DEFAULT_FOCUS_TIME) self._addConfigKey('_dual', 'DUAL_ENABLE', default=DEFAULT_DUAL_ENABLE) self._addConfigKey('_dual_time', 'DUAL_TIME', default=DEFAULT_DUAL_TIME) def _triggerShutter(self, delay): """ Trigger the shutter contact. Note that FOCUS_ENABLE and DUAL_ENABLE options are exclusive (done via UI) @param delay: delay to wait between on/off, in s @type delay: float """ Logger().trace("ClaussShutter._triggerShutter()") # Autofocus mode enable if self._config['FOCUS_ENABLE']: self._triggerAutoFocus() time.sleep(self._config['FOCUS_TIME']) # Shoot regular camera self._triggerOnShutter() time.sleep(delay) self._triggerOffShutter() # Dual camera mode if self._config['DUAL_ENABLE']: time.sleep(self._config['DUAL_TIME']) Logger().info("ClaussShutter._triggerShutter(): dual camera shoot") self._triggerAutoFocus() time.sleep(delay) self._triggerOffShutter() self._LastShootTime = time.time() def _triggerAutoFocus(self): """ Set the autofocus on. """ self._hardware.setShutter("AF") def _triggerOnShutter(self): """ Set the shutter on. """ self._hardware.setShutter("ON") def _triggerOffShutter(self): """ Set the shutter off. """ self._hardware.setShutter("OFF") def init(self): Logger().trace("ClaussShutter.init()") self._hardware.setAxis(AXIS_TABLE[self.capacity]), AbstractHardwarePlugin.init(self) def shutdown(self): Logger().trace("ClaussShutter.shutdown()") self._triggerOffShutter() AbstractHardwarePlugin.shutdown(self) ShutterPlugin.shutdown(self)