btcomm.py 文件源码

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

项目:BlueDot 作者: martinohanlon 项目源码 文件源码
def _read(self):
        #read until the client is stopped or the client disconnects
        while self._connected:
            #read data from Bluetooth socket
            try:
                data = self._client_sock.recv(1024, socket.MSG_DONTWAIT)
            except IOError as e:
                self._handle_bt_error(e)
                data = b""
            if data:
                #print("received [%s]" % data)
                if self._data_received_callback:
                    if self._encoding:
                        data = data.decode(self._encoding)
                    self.data_received_callback(data)
            if self._conn_thread.stopping.wait(BLUETOOTH_TIMEOUT):
                break
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号