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


Python AbstractHardwarePlugin.establishConnection方法代码示例

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


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

示例1: establishConnection

# 需要导入模块: from papywizard.plugins.abstractHardwarePlugin import AbstractHardwarePlugin [as 别名]
# 或者: from papywizard.plugins.abstractHardwarePlugin.AbstractHardwarePlugin import establishConnection [as 别名]
    def establishConnection(self):  # Move to hardware?
        """ Establish the connection.

        The SIN-11 device used to control the Pixorb axis needs to be
        initialised before any command can be sent to the axis controllers.
        """
        AbstractHardwarePlugin.establishConnection(self)
        Logger().trace("AbstractPixOrbHardware.establishConnection()")
        if not AbstractPixOrbHardware.__initSIN11:
            try:
                answer = ""
                self._driver.empty()

                # Ask the SIN-11 to scan online controllers
                self._driver.write('&')  # Add '\n' if ethernet driver?
                self._driver.setTimeout(SIN11_INIT_TIMEOUT)  # Sin-11 takes several seconds to answer
                c = ''
                while c != '\r':
                    c = self._driver.read(1)
                    if c in ('#', '?'):
                        self._driver.read(2)  # Read last CRLF
                        Logger().debug("AbstractPixOrbHardware.establishConnection(): SIN-11 '&' answer=%s" % answer)
                        raise HardwareError("Can't init SIN-11")
                    else:
                        answer += c
                answer = answer.strip()  # Remove final CRLF
                Logger().debug("AbstractPixOrbHardware.establishConnection(): SIN-11 '&' answer=%s" % answer)
                AbstractPixOrbHardware.__initSIN11 = True
                self._driver.setTimeout(ConfigManager().getFloat('Plugins/HARDWARE_COM_TIMEOUT'))
            except:
                self._connected = False
                raise
开发者ID:bingostar89,项目名称:Papywizard,代码行数:34,代码来源:pixOrbPlugins.py


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