alarm_serial_comms.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:pyparadox_alarm 作者: PollieKrismis 项目源码 文件源码
def connect(self):
        '''
        Opens a serial connection to the Paradox Alarm Panel.
        To do: Add a loop to attempt a connection several times before giving up.
        '''
        self._lock = Lock() #Does this do anything?

        try:
            self._pipe = serial.Serial(self._port, self._speed, timeout=1)
            self._pipe.flushInput() #Gets rid of /X0 after being disconnected for long?
        except SerialException:
            if self._port is None:
                _LOGGER.error(str.format('Port not configured yet.'))
            else:
                self.reconnect()
        else:
            #Connection should now be open
            self._shutdown = False
            _LOGGER.info(str.format("Connected to Paradox on port: {0}, speed: {1}",
                                    self._port, self._speed))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号