本文整理汇总了Python中connector.Connector.stopTarget方法的典型用法代码示例。如果您正苦于以下问题:Python Connector.stopTarget方法的具体用法?Python Connector.stopTarget怎么用?Python Connector.stopTarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类connector.Connector
的用法示例。
在下文中一共展示了Connector.stopTarget方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: connect
# 需要导入模块: from connector import Connector [as 别名]
# 或者: from connector.Connector import stopTarget [as 别名]
#.........这里部分代码省略.........
else:
print ("Can't call disconnect on master server")
return False
## Stops target server. This method, called on a master server, calls connector::Connector::stopServer and called on slave, calls connector::Connection::stopSlave
# @return The boolean result of the operation
def stop(self):
if self.is_slave:
# TODO: Stop the data thread if active
result = self.connection.stopSlaveServer()
self.is_connected = result
# Stops data threads
self.stop_data_threads()
return result
else:
result = self.connection.stopMasterServer()
self.is_connected = result
return result
## Closes the session
# @return The boolean result of the operation
def close(self):
result = self.connection.closeSession()
# Stops data threads
self.stop_data_threads()
self.is_connected = result
return result
## Stops the target
# This method closes the data threads (if they exist) then closes the session
# @return The boolean result of the operation
def halt(self):
self.stop_data_threads()
result = self.connection.stopTarget()
self.is_connected = result
return result
## Starts the connected target
# @return The boolean result of the operation
def start(self):
return self.connection.start()
## Starts data transfer for the specified signal
# @param signal_number The number of the signal to start
# @param sample_time The sample time of the signal
# @param decimation The decimation to use
# @return The boolean result of the operation
def startData(self, signal_number, decimation=None):
sample_time = self.getSampleTimeFromSignalNumber(signal_number)
self.setup_data_threads(sample_time, decimation, True)
return self.connection.startData(signal_number, decimation)
## Returns sample time given the signal number
# @param signal_number The number of the signal to analyze
# @return The sample time of the given signal number
def getSampleTimeFromSignalNumber(self, signal_number):
try:
sample_time = None
for signal in self.signal_structure:
if signal["number"] == signal_number:
sample_time = signal["sample_time"]
break
return sample_time
except:
return None