本文整理汇总了Python中mi.core.instrument.instrument_fsm.ThreadSafeFSM.get_events方法的典型用法代码示例。如果您正苦于以下问题:Python ThreadSafeFSM.get_events方法的具体用法?Python ThreadSafeFSM.get_events怎么用?Python ThreadSafeFSM.get_events使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mi.core.instrument.instrument_fsm.ThreadSafeFSM
的用法示例。
在下文中一共展示了ThreadSafeFSM.get_events方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Protocol
# 需要导入模块: from mi.core.instrument.instrument_fsm import ThreadSafeFSM [as 别名]
# 或者: from mi.core.instrument.instrument_fsm.ThreadSafeFSM import get_events [as 别名]
#.........这里部分代码省略.........
else:
temp_dict.setdefault(target, {})[key] = config[key]
for name in temp_dict:
if name in self._slave_protocols:
self._slave_protocols[name].set_init_params({DriverConfigKey.PARAMETERS: temp_dict[name]})
else:
# how did we get here? This should never happen, but raise an exception if it does.
raise InstrumentParameterException('Invalid key(s) in INIT PARAMS action: %r' % temp_dict[name])
def get_config_metadata_dict(self):
"""
See base class for full description. This method is overridden to retrieve the parameter
dictionary from each slave protocol and merge them.
@return: dictionary containing driver metadata
"""
log.debug("Getting metadata dict from protocol...")
return_dict = {ConfigMetadataKey.DRIVER: self._driver_dict.generate_dict(),
ConfigMetadataKey.COMMANDS: self._cmd_dict.generate_dict(),
ConfigMetadataKey.PARAMETERS: self._param_dict.generate_dict()}
for protocol in self._slave_protocols.values():
return_dict[ConfigMetadataKey.PARAMETERS].update(protocol._param_dict.generate_dict())
return_dict[ConfigMetadataKey.COMMANDS].update(protocol._cmd_dict.generate_dict())
return return_dict
def get_resource_capabilities(self, current_state=True):
"""
Overrides base class to include slave protocol parameters
@param current_state: Boolean indicating whether we should return only the current state events
@return: (resource_commands, resource_parameters)
"""
res_cmds = self._protocol_fsm.get_events(current_state)
res_cmds = self._filter_capabilities(res_cmds)
res_params = self._param_dict.get_keys()
for protocol in self._slave_protocols.values():
res_params.extend(protocol._param_dict.get_keys())
return res_cmds, res_params
def _build_scheduler(self):
"""
Build a scheduler for periodic status updates
"""
job_name = ScheduledJob.ACQUIRE_SAMPLE
config = {
DriverConfigKey.SCHEDULER: {
job_name: {
DriverSchedulerConfigKey.TRIGGER: {
DriverSchedulerConfigKey.TRIGGER_TYPE: TriggerType.INTERVAL,
DriverSchedulerConfigKey.SECONDS: self._param_dict.get(Parameter.SAMPLE_INTERVAL)
},
}
}
}
self.set_init_params(config)
self._add_scheduler_event(ScheduledJob.ACQUIRE_SAMPLE, ProtocolEvent.ACQUIRE_SAMPLE)
def _delete_scheduler(self):
"""
Remove the autosample schedule.
"""
try: