diff --git a/old/OpUtils.py b/old/OpUtils.py index 302aae66720101b9f6c11c25c4574b81e6c40f32..571e948983de770590b296baece18bafabb28885 100644 --- a/old/OpUtils.py +++ b/old/OpUtils.py @@ -27,6 +27,32 @@ def searchattr(prx, attr, ignorecase=True): else: return [a for a in prx.get_attribute_list() if attr in a] +def captureattr(prx): + """ + Capture all attributes in the device, return a python dict. + + PARAMETERS + ---------- + prx: tango.DeviceProxy + Proxy to the device. + + RETURN + ------ + attrs: dict + keys are attributes names, values are values. + """ + + attrs=dict() + attrlist=prx.get_attribute_list() + + R= prx.read_attributes(attrlist, wait=True) + for r in R: + attrs[r.name.lower()]=r.value + + return attrs + + + ############################################################################### # FUNCTIONS ON TANGO DATABASE ###############################################################################