本文整理汇总了Python中mi.core.instrument.instrument_protocol.CommandResponseInstrumentProtocol._got_data方法的典型用法代码示例。如果您正苦于以下问题:Python CommandResponseInstrumentProtocol._got_data方法的具体用法?Python CommandResponseInstrumentProtocol._got_data怎么用?Python CommandResponseInstrumentProtocol._got_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mi.core.instrument.instrument_protocol.CommandResponseInstrumentProtocol
的用法示例。
在下文中一共展示了CommandResponseInstrumentProtocol._got_data方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _got_data
# 需要导入模块: from mi.core.instrument.instrument_protocol import CommandResponseInstrumentProtocol [as 别名]
# 或者: from mi.core.instrument.instrument_protocol.CommandResponseInstrumentProtocol import _got_data [as 别名]
def _got_data(self, data):
""" The comms object fires this when data is received
@param data The chunk of data that was received
"""
CommandResponseInstrumentProtocol._got_data(self, data)
# If we are streaming, process the line buffer for samples, but it
# could have header stuff come out if you just got a break!
if self._protocol_fsm.get_current_state() == PARProtocolState.AUTOSAMPLE_MODE:
if self.eoln in self._linebuf:
lines = self._linebuf.split(self.eoln)
for line in lines:
if sample_regex.match(line):
self._last_data_timestamp = time.time()
self._driver_event(DriverAsyncEvent.SAMPLE, line)
self._linebuf = self._linebuf.replace(line+self.eoln, "") # been processed