def init(*args): global tracker, base debug = False if len(args) >= 1: debug = bool(int(args[0])) if debug: print "Debug ON" conn = getConn() if conn is None: print "No device connected." return base = ANT(conn) tracker = FitBit(base) tracker.init_tracker_for_transfer()
def __init__(self, debug=False): self.info_dict = {} self.log_info = {} self.time = time.time() self.data = [] conn = getConn() if conn is None: print "No base found!" exit(1) base = ANT(conn) self.fitbit = FitBit(base) if not self.fitbit: print "No devices connected!" exit(1)
def test(): global base if base is None: conn = getConn() if conn is None: print "No devices connected!" return 1 base = ANT(conn) device = FitBit(base) device.init_tracker_for_transfer() device.get_tracker_info() # print device.tracker device.parse_bank2_data(device.run_data_bank_opcode(0x02)) print "---" device.parse_bank0_data(device.run_data_bank_opcode(0x00)) device.run_data_bank_opcode(0x04) d = device.run_data_bank_opcode(0x02) # 13 for i in range(0, len(d), 13): print ["%02x" % x for x in d[i:i+13]] d = device.run_data_bank_opcode(0x00) # 7 print ["%02x" % x for x in d[0:7]]