...
  View open merge request
Commits (4)
......@@ -194,10 +194,12 @@ class Shutter(BaseShutter):
@property
def name(self):
"""A unique name"""
return self.__name
@property
def config(self):
"""Config of shutter"""
return self.__config
@property
......
......@@ -43,6 +43,30 @@ class DevState(IntEnum):
UNKNOWN = 13
def get_comm(config):
"""
Returns a DeviceProxy based on the config key `tango_ds:` containing `uri:` and potentially `timeout:`,`tango_host:`
"""
# tango_ds:
# uri: id23/v-bsh/2
# timeout: 3
# tango_host: lid231:20000
keys = {"uri": None, "timeout": 3, "tango_host": None}
keys.update(config.get("tango_ds"))
if keys["uri"] == None:
raise RuntimeError(f"No tango uri in {config.get('name')}")
if keys["tango_host"] == None:
dev_name = keys["uri"]
else:
dev_name = f"tango://{keys['tango_host']}/{keys['uri']}"
return DeviceProxy(dev_name, timeout=keys["timeout"])
def DeviceProxy(*args, **kwargs):
raise RuntimeError(
"Tango is not imported. Hint: is tango Python module installed ?"
......
......@@ -7,7 +7,7 @@
from gevent import Timeout, sleep
from bliss.common.tango import DeviceProxy, DevFailed
from bliss.common.tango import DeviceProxy, DevFailed, get_comm
from bliss.common.shutter import BaseShutter
......@@ -37,7 +37,7 @@ class tango_shutter(BaseShutter):
tango_uri = config.get("uri")
self.__name = name
self.__config = config
self.__control = DeviceProxy(tango_uri)
self.__control = get_comm(config)
self._init_type()
self._mode = False
......
plugin: bliss
class: tango_shutter
uri: id00/tango/dummy
name: safshut
tango_ds:
uri: id00/tango/dummy