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
评论列表
文章目录