示例#1
0
def main():
    #base = DynastreamANT(True)
    base = FitBitANT(debug=True)
    if not base.open():
        print "No devices connected!"
        return 1

    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]]
    print["%02x" % x for x in d[7:14]]
    j = 0
    for i in range(14, len(d), 3):
        print d[i:i + 3]
        j += 1
    print "Records: %d" % (j)
    device.parse_bank1_data(device.run_data_bank_opcode(0x01))

    # for i in range(0, len(d), 14):
    #     print ["%02x" % x for x in d[i:i+14]]
    base.close()
    return 0
示例#2
0
    def __init__(self):
        self.info_dict = {}
        base = FitBitANT(debug=True)
        if not base.open():
            print "No devices connected!"
            return 1

        self.fitbit = FitBit(base)
        self.remote_info = None
示例#3
0
    def __init__(self):
        self.info_dict = {}
        base = FitBitANT(debug=True)
        if not base.open():
            print "No devices connected!"
            return 1

        self.fitbit = FitBit(base)
        self.remote_info = None
示例#4
0
    def __init__(self):
        self.info_dict = {}
        base = FitBitANT(debug=True)

        for retries in (2, 1, 0):
            try:
                if not base.open():
                    print "No devices connected!"
                    return
            except Exception, e:
                print e
                if retries:
                    print "retrying"
                    time.sleep(5)
                else:
                    raise
示例#5
0
 def __init__(self):
     self.info_dict = {}
     base = FitBitANT(debug=True)
     
     for retries in (2,1,0):
         try:
             if not base.open():
                 print "No devices connected!"
                 return
         except Exception, e:
             print e
             if retries:
                 print "retrying"
                 time.sleep(5)
             else:
                 raise
示例#6
0
 def __init__(self):
     self.info_dict = {}
     base = FitBitANT(debug=True)
     self.fitbit = FitBit(base)
     self.remote_info = None
     for retries in (2, 1, 0):
         try:
             if not base.open():
                 print "No devices connected!"
                 exit(1)
         except Exception, e:
             print e
             if retries:
                 print "retrying"
                 time.sleep(5)
             else:
                 raise
示例#7
0
 def __init__(self):
     self.info_dict = {}
     base = FitBitANT(debug=True)
     self.fitbit = FitBit(base)
     self.remote_info = None
     for retries in (2,1,0):
         try:
             if not base.open():
                 print "No devices connected!"
                 exit(1)
         except Exception, e:
             print e
             if retries:
                 print "retrying"
                 time.sleep(5)
             else:
                 raise
示例#8
0
文件: fitbit.py 项目: hsu/libfitbit
def main():
    #base = DynastreamANT(True)
    base = FitBitANT(debug=True)
    if not base.open():
        print "No devices connected!"
        return 1

    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]]