本文整理汇总了Python中mi.core.instrument.protocol_param_dict.ProtocolParameterDict.get_all方法的典型用法代码示例。如果您正苦于以下问题:Python ProtocolParameterDict.get_all方法的具体用法?Python ProtocolParameterDict.get_all怎么用?Python ProtocolParameterDict.get_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mi.core.instrument.protocol_param_dict.ProtocolParameterDict
的用法示例。
在下文中一共展示了ProtocolParameterDict.get_all方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Protocol
# 需要导入模块: from mi.core.instrument.protocol_param_dict import ProtocolParameterDict [as 别名]
# 或者: from mi.core.instrument.protocol_param_dict.ProtocolParameterDict import get_all [as 别名]
#.........这里部分代码省略.........
self._linebuf[connection] = ''
self._promptbuf[connection] = ''
self._do_cmd_direct(command, connection=connection)
return self._get_response(response_regex=regex, connection=connection)
def _update_params(self, *args, **kwargs):
"""
Update the parameter dictionary.
"""
# see if we passed in a list of parameters to query
# if not, use the whole parameter list
parameters = kwargs.get('params')
if parameters is None or WorkhorseParameter.ALL in parameters:
parameters = self._param_dict.get_keys()
# filter out the engineering parameters and ALL
parameters = [p for p in parameters if not WorkhorseEngineeringParameter.has(p) and p != WorkhorseParameter.ALL]
# Get old param dict config.
old_config = self._param_dict.get_config()
if parameters:
# MASTER
master_params = [p for p in parameters if '_5th' not in p]
if master_params:
resp = self._get_params(master_params, SlaveProtocol.FOURBEAM)
self._param_dict.update_many(resp)
# SLAVE
slave_params = [p.replace('_5th', '') for p in parameters if '_5th' in p]
if slave_params:
resp = self._get_params(slave_params, SlaveProtocol.FIFTHBEAM)
self._param_dict2.update_many(resp)
for key, value in self._param_dict2.get_all().iteritems():
self._param_dict.set_value(key, value)
new_config = self._param_dict.get_config()
# Check if there is any changes. Ignore TT
if not dict_equal(new_config, old_config, ['TT']) or kwargs.get('force'):
self._driver_event(DriverAsyncEvent.CONFIG_CHANGE)
def _execute_set_params(self, commands, connection):
if commands:
# we are going to send the concatenation of all our set commands
self._linebuf[connection] = ''
self._do_cmd_direct(''.join(commands), connection=connection)
# we'll need to build a regular expression to retrieve all of the responses
# including any possible errors
if len(commands) == 1:
regex = re.compile(r'(%s.*?)\r\n>' % commands[-1].strip(), re.DOTALL)
else:
regex = re.compile(r'(%s.*?%s.*?)\r\n>' % (commands[0].strip(), commands[-1].strip()), re.DOTALL)
response = self._get_response(response_regex=regex, connection=connection)
self._parse_set_response(response[0], None)
def _set_params(self, *args, **kwargs):
"""
Issue commands to the instrument to set various parameters
"""
self._verify_not_readonly(*args, **kwargs)
params = args[0]
changed = []
old_config = self._param_dict.get_config()