Commit 2d2f96f6 authored by Matias Guijarro's avatar Matias Guijarro
Browse files

add CounterContainer interface where appropriate

parent 60a79326
......@@ -29,7 +29,7 @@ def get_object_from_port(port):
# --- CLIENT ---
class Client:
class Client(protocols.CounterContainer):
def __init__(self, name, config_node):
self.__name = name
self._config_node = config_node
......@@ -138,7 +138,7 @@ class Client:
return self._proxy.counters
if isinstance(self._proxy, counter.Counter):
return protocols.counter_namespace([self._proxy])
raise NotImplementedError
return protocols.counter_namespace([])
# --- SERVER ---
......
......@@ -6,6 +6,7 @@ import gevent.lock
from bliss.controllers.wago.wago import ModulesConfig, WagoController, get_wago_comm
from bliss.config.channels import Channel
from bliss.common.counter import SamplingCounter
from bliss.common.protocols import CounterContainer
from bliss.controllers.counter import SamplingCounterController, counter_namespace
from bliss.common import event
from bliss import global_map
......@@ -378,7 +379,7 @@ class BpmController(SamplingCounterController):
# --------- EBV CONTROLLER ----------------------------
class EBV:
class EBV(CounterContainer):
_WAGO_KEYS = [
"status",
"screen",
......
......@@ -21,13 +21,14 @@ from bliss.controllers.counter import counter_namespace
from bliss.scanning.scan_meta import get_user_scan_meta
from bliss.scanning.chain import ChainPreset, ChainIterationPreset
from bliss.common import tango
from bliss.common.protocols import IcatPublisher
from bliss.controllers.tango_attr_as_counter import (
TangoCounterController,
TangoAttrCounter,
)
class MachInfo(BeaconObject):
class MachInfo(BeaconObject, IcatPublisher):
""" Access to accelerator information.
- SR_Current
- SR_Lifetime
......
......@@ -3,9 +3,10 @@ from bliss.comm.util import get_comm
from bliss.common.greenlet_utils import protect_from_kill
from bliss.common.counter import SamplingCounter, SamplingMode
from bliss.controllers.counter import SamplingCounterController
from bliss.common.protocols import CounterContainer
class Moco(object):
class Moco(CounterContainer):
def __init__(self, name, config_tree):
self.values = {
......
......@@ -8,6 +8,7 @@
from bliss.controllers.motor import CalcController
from bliss.common.logtools import user_warning, log_debug
from bliss.scanning.scan_meta import get_user_scan_meta
from bliss.common.protocols import IcatPublisher
"""
example for single VERTICAL slits:
......@@ -85,7 +86,7 @@ example for single HORIZONTAL slits:
"""
class Slits(CalcController):
class Slits(CalcController, IcatPublisher):
def __init__(self, *args, **kwargs):
CalcController.__init__(self, *args, **kwargs)
self.slit_type = self.config.get("slit_type", default="both")
......@@ -102,7 +103,6 @@ class Slits(CalcController):
scan_meta_obj = get_user_scan_meta()
scan_meta_obj.instrument.set(self, lambda _: {self.name: self.metadata()})
# used by the IcatPublisher protocol
def metadata(self):
"""
this is about metadata publishing to the h5 file AND ICAT
......
......@@ -71,6 +71,7 @@ import functools
from tabulate import tabulate
from gevent import Timeout
from bliss.common.protocols import IcatPublisher
from bliss.common.motor_group import Group
from bliss.common.axis import AxisState
from bliss.config.channels import Channel
......@@ -81,7 +82,7 @@ from bliss import global_map, is_bliss_shell
from bliss.scanning.scan_meta import get_user_scan_meta
class MultiplePositions:
class MultiplePositions(IcatPublisher):
""" Handle multiple positions.
"""
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment