implement SECoP commands on the server side
This commit is contained in:
9
secop.py
9
secop.py
@ -19,17 +19,24 @@ def convert_par(module, name, par):
|
||||
|
||||
|
||||
def convert_cmd(module, name, cmd):
|
||||
result = dict(type='input', button=True, name=module+":"+name, title=name)
|
||||
result = dict(type='pushbutton', name=module+":"+name, title=name)
|
||||
result['command'] = 'do %s:%s' % (module, name)
|
||||
argument = cmd['datainfo'].get('argument')
|
||||
if cmd['datainfo'].get('result'):
|
||||
result['result'] = True
|
||||
else:
|
||||
if not argument: # simple command like stop
|
||||
return result
|
||||
result['button'] = not argument
|
||||
# result['type'] = pushbutton will be replaced below
|
||||
if argument:
|
||||
if argument['type'] == 'enum':
|
||||
result['enum_names'] = [dict(title=k, value=v) for k, v in argument['members'].items()]
|
||||
result['type'] = 'enum'
|
||||
elif argument['type'] == 'bool':
|
||||
result['type'] = 'checkbox'
|
||||
else:
|
||||
result['type'] = 'input'
|
||||
else:
|
||||
result['type'] = 'rdonly'
|
||||
if cmd['description']:
|
||||
|
Reference in New Issue
Block a user