Commit 74fab309 authored by Laurent Claustre's avatar Laurent Claustre
Browse files

fixed some bugs. Tested on ID10

parent 14d1ef3b
Pipeline #62000 passed with stages
in 5 minutes and 11 seconds
......@@ -115,17 +115,17 @@ class Eiger(PyTango.LatestDeviceImpl):
# Put in cache some hardware parameters to avoid cumulative deadtime
# That means only attribute reading return the cache value.
# for client reading them regulary. Each hw param. reading takes ~100ms
for attr in ["auto_summation",
"countrate_correction",
"flatfield_correction",
"pixel_mask",
"retrigger",
"threshold_energy",
"threshold_energy2",
"threshold_diff_mode",
"virtual_pixel_correction",
for attr in ["read_auto_summation",
"read_countrate_correction",
"read_flatfield_correction",
"read_pixel_mask",
"read_retrigger",
"read_threshold_energy",
"read_threshold_energy2",
"read_threshold_diff_mode",
"read_virtual_pixel_correction",
]:
init_attr_4u_with_cache(attr, _EigerCamera)
init_attr_4u_with_cache(self, attr, _EigerCamera)
#------------------------------------------------------------------
# getAttrStringValueList command:
......@@ -416,20 +416,19 @@ def get_attr_4u_objs(obj, name):
return attr_name, AttrName, d, cache
def init_attr_4u_with_cache(obj, name, interface):
attr_name, AttrName, d, cache = get_attr_4u_objs(obj, name)
functName = 'get'+AttrName
funct = getattr(interface, functName)
if cache:
data = funct()
if d:
data = getDictKey(d, data)
attr_name, AttrName, d, cache = get_attr_4u_objs(obj, name)
functName = 'get'+AttrName
funct = getattr(interface, functName)
if cache:
data = funct()
if d:
data = getDictKey(d, data)
cache[attr_name] = data
def get_attr_4u_with_cache(obj, name, interface, update_dict=True) :
if name.startswith('read_') or name.startswith('write_') :
attr_name, AttrName, d, cache = get_attr_4u_objs(obj, name)
if d:
if name.startswith('read_') :
functionName = 'get' + AttrName
......@@ -451,7 +450,6 @@ def get_attr_4u_with_cache(obj, name, interface, update_dict=True) :
function2Call = getattr(interface,functionName)
callable_obj = CallableWriteWithCache(attr_name,
function2Call, cache)
if update_dict: obj.__dict__[name] = callable_obj
callable_obj.__name__ = name
return callable_obj
......@@ -471,11 +469,11 @@ class CallableReadEnumWithCache:
if self.__cache:
data = self.__cache[self.__attr_name]
else:
data = self.__func2Call())
data = self.__func2Call()
attr.set_value(getDictKey(self.__dict, data))
## @brief Class for genenic write_<attribute> with enum value
class CallableWriteEnummWithCache:
class CallableWriteEnumWithCache:
def __init__(self, attr_name, dictionary, func2Call, cache) :
self.__attr_name = attr_name
self.__dict = dictionary
......@@ -495,7 +493,7 @@ class CallableWriteEnummWithCache:
self.__cache[self.__attr_name] = value
## @brief Class for genenic read_<attribute> with simple value
class CallableReadmWithCache:
class CallableReadWithCache:
def __init__(self, attr_name, func2Call, cache) :
self.__attr_name = attr_name
self.__func2Call = func2Call
......@@ -503,13 +501,13 @@ class CallableReadmWithCache:
def __call__(self,attr) :
if self.__cache:
value = self.__cache[self._attr_name]
value = self.__cache[self.__attr_name]
else:
value = self.__func2Call()
attr.set_value(value)
## @brief Class for genenic write_<attribute> with simple value
class CallableWritemWithCache:
class CallableWriteWithCache:
def __init__(self, attr_name, func2Call, cache) :
self.__attr_name = attr_name
self.__func2Call = func2Call
......
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