improve tutorial_helevel
- fix indent of query method - add remark about the CCU4 cid command Change-Id: Iaee821cf7739536cc823494f646a1d2a4bbbfa44 Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/25092 Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de> Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
parent
d0f895ed44
commit
e568c665a8
@ -30,6 +30,7 @@ CCU4 luckily has a very simple and logical protocol:
|
|||||||
# for completeness: (not needed, as it is the default)
|
# for completeness: (not needed, as it is the default)
|
||||||
end_of_line = '\n'
|
end_of_line = '\n'
|
||||||
# on connect, we send 'cid' and expect a reply starting with 'CCU4'
|
# on connect, we send 'cid' and expect a reply starting with 'CCU4'
|
||||||
|
# 'cid' is a CCU4 command returning the current version prefixed with CCU4
|
||||||
identification = [('cid', r'CCU4.*')]
|
identification = [('cid', r'CCU4.*')]
|
||||||
|
|
||||||
|
|
||||||
@ -144,16 +145,16 @@ which means it might be worth to create a *query* method, and then the
|
|||||||
...
|
...
|
||||||
|
|
||||||
|
|
||||||
def query(self, cmd):
|
def query(self, cmd):
|
||||||
"""send a query and get the response
|
"""send a query and get the response
|
||||||
|
|
||||||
:param cmd: the name of the parameter to query or '<parameter>=<value'
|
:param cmd: the name of the parameter to query or '<parameter>=<value'
|
||||||
for changing a parameter
|
for changing a parameter
|
||||||
:returns: the (new) value of the parameter
|
:returns: the (new) value of the parameter
|
||||||
"""
|
"""
|
||||||
name, txtvalue = self._iodev.communicate(cmd).split('=')
|
name, txtvalue = self._iodev.communicate(cmd).split('=')
|
||||||
assert name == cmd.split('=')[0] # check that we got a reply to our command
|
assert name == cmd.split('=')[0] # check that we got a reply to our command
|
||||||
return txtvalue # Frappy will automatically convert the string to the needed data type
|
return txtvalue # Frappy will automatically convert the string to the needed data type
|
||||||
|
|
||||||
def read_value(self):
|
def read_value(self):
|
||||||
return self.query('h')
|
return self.query('h')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user