当前位置: 首页>>代码示例>>Python>>正文


Python Connector.stopData方法代码示例

本文整理汇总了Python中connector.Connector.stopData方法的典型用法代码示例。如果您正苦于以下问题:Python Connector.stopData方法的具体用法?Python Connector.stopData怎么用?Python Connector.stopData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在connector.Connector的用法示例。


在下文中一共展示了Connector.stopData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: connect

# 需要导入模块: from connector import Connector [as 别名]
# 或者: from connector.Connector import stopData [as 别名]

#.........这里部分代码省略.........
            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

    ## Stops (all) data transfers
    # @param signal_number The number of signal to catch
    # @param all_data If True calls StopAllData(). Calls StopData() if False.
    # @return The boolean result of the operation
    def stopData(self, signal_number=None, all_data=False):
        # TODO: Devo chiudere anche i threads dei poller?
        if all_data:
            return self.connection.stopAllData()
        elif signal_number:
            return self.connection.stopData(signal_number)
        else:
            print ("Can't stop data without signal number or all_data flag")
            return False

    ## Get the structure of the signals
    # @return The structure of the signals or False if the target has no signals
    def getSignalStructure(self):
        return self.connection.getSignalStructure()

    ## Sends new parameters to the server
    # @param params The array of parameters to set
    # @return The boolean result of the operation
    def setParameters(self, params):
        return self.connection.setParameters(params)

    ## Get the parameters from the target server
    # @return An array of params. Every param is an hash
    def getParameters(self):
        self.parameters = self.connection.getParameters()
        return self.parameters

    ## Interface to set a single param
    # @param identifier The identifier string to get the param to update
    # @param value The value to set to the param
    def setParam(self, identifier, value):
        if not self.parameters:
            self.parameters = self.connection.getParameters()
        ids = identifier.split("/")
        param_name = ids.pop()
        block_name = "/".join(ids)
        new_params = []
        for param in self.parameters:
            if param["block_name"] == block_name and param["param_name"] == param_name:
                param["values"] = value
            new_params.append(param)
        self.parameters = new_params
        return self.setParameters(self.parameters)
开发者ID:tommyblue,项目名称:pyRTAI,代码行数:104,代码来源:target.py


注:本文中的connector.Connector.stopData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。