introduce command handlers

A command handler can be used to deal with parameters which have a common
command for querying and writing to the hardware. Support for parsing
and formatting commands is included.

Change-Id: I79a1b6c9daf3af3be2e1875875ced41ec1a1829d
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/21946
Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
2019-12-02 15:01:18 +01:00
parent 59fbd5cac0
commit dda8428144
5 changed files with 519 additions and 44 deletions

View File

@@ -110,11 +110,15 @@ class Parameter(Accessible):
'export': Property('Is this parameter accessible via SECoP? (vs. internal parameter)',
OrType(BoolType(), StringType()), export=False, default=True),
'poll': Property('Polling indicator', IntRange(), export=False, default=False),
'optional': Property('[Internal] is this parameter optional?', BoolType(), export=False, default=False),
'optional': Property('[Internal] is this parameter optional?', BoolType(), export=False,
settable=False, default=False),
'handler': Property('[internal] overload the standard read and write functions',
ValueType(), export=False, default=None, mandatory=False, settable=False),
}
value = None
timestamp = None
def __init__(self, description, datatype, ctr=None, unit=None, **kwds):
if ctr is not None:
@@ -256,7 +260,7 @@ class Command(Accessible):
extname='visibility', export=True, default=1),
'export': Property('[internal] Flag: is the command accessible via SECoP? (vs. pure internal use)',
OrType(BoolType(), StringType()), export=False, default=True),
'optional': Property('[internal] is The comamnd optional to implement? (vs. mandatory',
'optional': Property('[internal] is the command optional to implement? (vs. mandatory)',
BoolType(), export=False, default=False, settable=False),
'datatype': Property('[internal] datatype of the command, auto generated from \'argument\' and \'result\'',
DataTypeType(), extname='datainfo', mandatory=True),