本文整理汇总了Python中mi.core.instrument.protocol_param_dict.ProtocolParameterDict.get_config_value方法的典型用法代码示例。如果您正苦于以下问题:Python ProtocolParameterDict.get_config_value方法的具体用法?Python ProtocolParameterDict.get_config_value怎么用?Python ProtocolParameterDict.get_config_value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mi.core.instrument.protocol_param_dict.ProtocolParameterDict
的用法示例。
在下文中一共展示了ProtocolParameterDict.get_config_value方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: InstrumentProtocol
# 需要导入模块: from mi.core.instrument.protocol_param_dict import ProtocolParameterDict [as 别名]
# 或者: from mi.core.instrument.protocol_param_dict.ProtocolParameterDict import get_config_value [as 别名]
#.........这里部分代码省略.........
fields of the parameter dictionary
@raise InstrumentParameterException If the config cannot be set
"""
if not isinstance(config, dict):
raise InstrumentParameterException("Invalid init config format")
self._startup_config = config
param_config = config.get(DriverConfigKey.PARAMETERS)
if(param_config):
for name in param_config.keys():
log.debug("Setting init value for %s to %s", name, param_config[name])
self._param_dict.set_init_value(name, param_config[name])
def get_startup_config(self):
"""
Gets the startup configuration for the instrument. The parameters
returned are marked as startup, and the values are the best as chosen
from the initialization, default, and current parameters.
@retval The dict of parameter_name/values (override this method if it
is more involved for a specific instrument) that should be set at
a higher level.
@raise InstrumentProtocolException if a startup parameter doesn't
have a init or default value
"""
return_dict = {}
start_list = self._param_dict.get_keys()
log.trace("Startup list: %s", start_list)
assert isinstance(start_list, list)
for param in start_list:
result = self._param_dict.get_config_value(param)
if(result != None):
return_dict[param] = result
elif(self._param_dict.is_startup_param(param)):
raise InstrumentProtocolException("Required startup value not specified: %s" % param)
return return_dict
def get_direct_access_params(self):
"""
Get the list of direct access parameters, useful for restoring direct
access configurations up in the driver.
@retval a list of direct access parameter names
"""
return self._param_dict.get_direct_access_list()
def get_cached_config(self):
"""
Return the configuration object that shows the instrument's
configuration as cached in the parameter dictionary...usually in
sync with the instrument, but accessible when offline...
@retval The cached configuration in the instruments config format. By
default, it is a dictionary of parameter names and values.
"""
assert self._param_dict != None
return self._param_dict.get_config()
########################################################################
# Command build and response parse handlers.
########################################################################
def _add_response_handler(self, cmd, func, state=None):
"""