Commit 25ffbdb7 authored by Sebastien Petitdemange's avatar Sebastien Petitdemange
Browse files

measument: added callback methods (prepare,start,stop) in Counter.

parent 2ea1f3aa
......@@ -222,7 +222,7 @@ class GroupedReadMixin(object):
def start(self, *counters):
pass
def end(self, *counters):
def stop(self, *counters):
pass
class Counter(object):
......@@ -237,6 +237,15 @@ class Counter(object):
@property
def name(self):
return self.__name
def prepare(self):
pass
def start(self):
pass
def stop(self):
pass
class SamplingCounter(Counter):
class GroupedReadHandler(GroupedReadMixin):
......@@ -263,7 +272,7 @@ class SamplingCounter(Counter):
try:
return grouped_read_handler.read(self)[0]
finally:
grouped_read_handler.end(self)
grouped_read_handler.stop(self)
def DefaultSamplingCounterGroupedReadHandler(controller, handlers=weakref.WeakValueDictionary()):
class DefaultSamplingCounterGroupedReadHandler(SamplingCounter.GroupedReadHandler):
......
......@@ -95,15 +95,19 @@ class SamplingCounterAcquisitionDevice(BaseCounterAcquisitionDevice):
self.__mode = value
def prepare(self):
self.device.prepare(*self.grouped_read_counters)
self._nb_acq_points = 0
self._stop_flag = False
self._ready_flag = True
self._event.clear()
def start(self):
pass
self.device.start(*self.grouped_read_counters)
def stop(self):
self.device.stop(*self.grouped_read_counters)
self._stop_flag = True
self._trig_time = None
self._event.set()
......@@ -173,13 +177,15 @@ class IntegratingCounterAcquisitionDevice(BaseCounterAcquisitionDevice):
BaseCounterAcquisitionDevice.__init__(self, counter, count_time, auto_add_channel, **keys)
def prepare(self):
self.device.prepare(*self.grouped_read_counters)
self._nb_acq_points = 0
self._stop_flag = False
def start(self):
pass
self.device.start(*self.grouped_read_counters)
def stop(self):
self.device.stop(*self.grouped_read_counters)
self._stop_flag = True
def trigger(self):
......
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