change datatype property to datainfo

- according to SECoP v1.0
- internally the name 'datatype' is kept

Change-Id: I0298a45f2db529ced3a07e2e9b344c91cfb7bb88
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/21300
Tested-by: JenkinsCodeReview <bjoern_pedersen@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:
zolliker 2019-09-24 16:02:18 +02:00
parent 596353e09a
commit 8631fd47a1
3 changed files with 6 additions and 6 deletions

View File

@ -386,7 +386,7 @@ class Client(object):
for module, moduleData in self.describing_data['modules'].items():
for aname, adata in moduleData['accessibles'].items():
datatype = get_datatype(adata['datatype'])
datatype = get_datatype(adata.pop('datainfo'))
# *sigh* special handling for 'some' parameters....
if isinstance(datatype, EnumType):
datatype._enum.name = aname

View File

@ -95,7 +95,7 @@ class Parameter(Accessible):
u'description': Property('Description of the Parameter', TextType(),
extname=u'description', mandatory=True),
u'datatype': Property('Datatype of the Parameter', DataTypeType(),
extname=u'datatype', mandatory=True),
extname=u'datainfo', mandatory=True),
u'unit': Property('[legacy] unit of the parameter. This should now be on the datatype!', StringType(),
extname=u'unit', default=''), # goodie, should be on the datatype!
u'readonly': Property('Is the Parameter readonly? (vs. changeable via SECoP)', BoolType(),
@ -260,7 +260,7 @@ class Command(Accessible):
u'optional': Property('[internal] is The comamnd optional to implement? (vs. mandatory',
BoolType(), export=False, default=False, settable=False),
u'datatype': Property('[internal] datatype of the command, auto generated from \'argument\' and \'result\'',
DataTypeType(), extname=u'datatype', mandatory=True),
DataTypeType(), extname=u'datainfo', mandatory=True),
u'argument': Property('Datatype of the argument to the command, or None.',
NoneOr(DataTypeType()), export=False, mandatory=True),
u'result': Property('Datatype of the result from the command, or None.',

View File

@ -36,17 +36,17 @@ def test_Command():
assert cmd.ctr
assert cmd.argument is None
assert cmd.result is None
assert cmd.for_export() == {u'datatype': {'type': 'command'},
assert cmd.for_export() == {u'datainfo': {'type': 'command'},
u'description': u'do_something'}
cmd = Command(u'do_something', argument=IntRange(-9,9), result=IntRange(-1,1))
assert cmd.description
assert isinstance(cmd.argument, IntRange)
assert isinstance(cmd.result, IntRange)
assert cmd.for_export() == {u'datatype': {'type': 'command', 'argument': {'type': 'int', 'min':-9, 'max':9},
assert cmd.for_export() == {u'datainfo': {'type': 'command', 'argument': {'type': 'int', 'min':-9, 'max':9},
u'result': {'type': 'int', 'min':-1, 'max':1}},
u'description': u'do_something'}
assert cmd.exportProperties() == {u'datatype': {'type': 'command', 'argument': {'type': 'int', 'max': 9, 'min': -9},
assert cmd.exportProperties() == {u'datainfo': {'type': 'command', 'argument': {'type': 'int', 'max': 9, 'min': -9},
'result': {'type': 'int', 'max': 1, 'min': -1}},
u'description': u'do_something'}