ReadHandler and WriteHandler decorators

modules with a couple of parameters with similar read_* or
write_* methods may handle them by generic methods wrapped
with decorators ReadHandler / WriteHandler

The trinamic driver is included in this change for demonstrating
how it works.

In a further step, the special handling for the iohandler stuff can
be moved away from secop.server and secop.params, using this feature.

+ fix problem on startup of trinamic driver (needs MultiEvent.queue)
+ some other small fixes
+ apply recommended functools.wraps for wrapping

Change-Id: Ibfeff9209f53c47194628463466cee28366e17ac
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/27460
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
2022-01-18 08:53:46 +01:00
parent 0909f92e12
commit 4f7083bc98
11 changed files with 437 additions and 213 deletions

View File

@ -103,6 +103,7 @@ class PersistentMixin(HasAccessibles):
try:
value = pobj.datatype.import_value(self.persistentData[pname])
pobj.value = value
pobj.readerror = None
if not pobj.readonly:
writeDict[pname] = value
except Exception as e:
@ -144,5 +145,6 @@ class PersistentMixin(HasAccessibles):
@Command()
def factory_reset(self):
"""reset to values from config / default values"""
self.writeDict.update(self.initData)
self.writeInitParams()