gps.py 文件源码

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

项目:racercat-logger 作者: theduckylittle 项目源码 文件源码
def __init__(self, addr):

        connected = False
        while(not connected):
            try:
                self.sock = socket.socket(socket.AF_BLUETOOTH, 
                                socket.SOCK_STREAM, socket.BTPROTO_RFCOMM)
                self.sock.connect((addr, 1))
                connected = True
            except KeyboardInterrupt:
                sys.exit(0)
            except Exception as e:
                # TODO: Move to the logging library
                logging.error("Exception: "+str(e))
                logging.info("Could not connect. Waiting 10s")
                time.sleep(10)


        # set the timeout to 5 seconds.
        self.sock.settimeout(5)

    ## Read data from the GPS feed
    #
    #  @returns Data read from the GPS
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号