예제 #1
0
def analysisStatisticsV1003(buffer):
    "运动统计数据V1003解析"
    print "运动统计数据协议版本V1.0.03(" + hex(dataInfo[DataHead.VERSION]) + ")"

    statisticsData[Statistics.MODE] = util.getUint8(buffer[0:2])
    statisticsData[Statistics.AVERAGEHR] = util.getUint8(buffer[2:4])
    statisticsData[Statistics.MAXHR] = util.getUint8(buffer[4:6])
    statisticsData[Statistics.TIMEZONE] = util.getUint8(buffer[6:8])
    statisticsData[Statistics.DISTRIBUTED1] = util.getUint16(buffer[8:12])
    statisticsData[Statistics.DISTRIBUTED2] = util.getUint16(buffer[12:16])
    statisticsData[Statistics.DISTRIBUTED3] = util.getUint16(buffer[16:20])
    statisticsData[Statistics.DISTRIBUTED4] = util.getUint16(buffer[20:24])
    statisticsData[Statistics.DISTRIBUTED5] = util.getUint16(buffer[24:28])
    statisticsData[Statistics.MAXCADENCE] = util.getUint16(buffer[28:32])
    statisticsData[Statistics.RISEATMOSPRESS] = util.getUint32(buffer[32:40])
    statisticsData[Statistics.DROPATMOSPRESS] = util.getUint32(buffer[40:48])
    statisticsData[Statistics.MAXATMOSPRESS] = util.getUint32(buffer[48:56])
    statisticsData[Statistics.MINATMOSPRESS] = util.getUint32(buffer[56:64])
    statisticsData[Statistics.ATMOSPRESS] = util.getUint32(buffer[64:72])
    statisticsData[Statistics.CALORIE] = util.getUint32(buffer[72:80])
    statisticsData[Statistics.BESTPACE] = util.getUint32(buffer[80:88])
    statisticsData[Statistics.TIMESTAMP] = util.getUint32(buffer[88:96])
    statisticsData[Statistics.ACCOMPLISHTIME] = util.getUint32(buffer[96:104])
    statisticsData[Statistics.PAUSETIME] = util.getUint32(buffer[104:112])
    statisticsData[Statistics.DISTANCE] = util.getUint32(buffer[112:120])
    statisticsData[Statistics.CALIDISTANCE] = util.getUint32(buffer[120:128])
    statisticsData[Statistics.STEP] = util.getUint32(buffer[128:136])
예제 #2
0
def analysisInfo(buffer, buffersize, nodenum, nodesize):
    "计步数据V1004解析"
    print "计步数据协议版本V1.0.04"

    i = 0
    offset = 0
    leftsize = buffersize
    for i in range(nodenum):
        if (leftsize < nodesize * 2):
            print "计步数据不完整"
            print buffer[offset:]
            break
        else:
            leftsize -= nodesize * 2

        stepInfo[StepInfo.TIMESTAMP] = util.getUint32(buffer[offset + 0:offset + 8])
        stepInfo[StepInfo.TIMEZONE] = util.getUint8(buffer[offset + 8:offset + 10])
        stepInfo[StepInfo.SEDENTARYCOUNT] = util.getUint8(buffer[offset + 10:offset + 12])
        stepInfo[StepInfo.REVERSE] = util.getUint16(buffer[offset + 12:offset + 16])
        stepInfo[StepInfo.CALORIEBMR] = util.getUint32(buffer[offset + 16:offset + 24])
        stepInfo[StepInfo.CALORIESPORT] = util.getUint32(buffer[offset + 24:offset + 32])
        for j in range(24):
            start = offset + 32 + 8 * j
            end = offset + 36 + 8 * j
            stepInfo[StepInfo.STEPHOUR + j * 2] = util.getUint16(buffer[start:end])
            stepInfo[StepInfo.DISTANCEHOUR + j * 2] = util.getUint16(buffer[end:end + 4])
        offset += nodesize * 2
        i
        info = copy.copy(stepInfo)
        stepData.append(info)
        print info
예제 #3
0
def analysisInfo(buffer, buffersize, nodenum, nodesize):
    "运动统计数据V1003解析"
    print "运动统计数据协议版本V1.0.03"

    if (buffersize < nodesize * 2):
        print "运动统计数据不完整"
        print buffer
        return

    statisticsData[Statistics.MODE] = util.getUint8(buffer[0:2])
    statisticsData[Statistics.AVERAGEHR] = util.getUint8(buffer[2:4])
    statisticsData[Statistics.MAXHR] = util.getUint8(buffer[4:6])
    statisticsData[Statistics.TIMEZONE] = util.getUint8(buffer[6:8])
    statisticsData[Statistics.DISTRIBUTED1] = util.getUint16(buffer[8:12])
    statisticsData[Statistics.DISTRIBUTED2] = util.getUint16(buffer[12:16])
    statisticsData[Statistics.DISTRIBUTED3] = util.getUint16(buffer[16:20])
    statisticsData[Statistics.DISTRIBUTED4] = util.getUint16(buffer[20:24])
    statisticsData[Statistics.DISTRIBUTED5] = util.getUint16(buffer[24:28])
    statisticsData[Statistics.MAXCADENCE] = util.getUint16(buffer[28:32])
    statisticsData[Statistics.RISEATMOSPRESS] = util.getUint32(buffer[32:40])
    statisticsData[Statistics.DROPATMOSPRESS] = util.getUint32(buffer[40:48])
    statisticsData[Statistics.MAXATMOSPRESS] = util.getUint32(buffer[48:56])
    statisticsData[Statistics.MINATMOSPRESS] = util.getUint32(buffer[56:64])
    statisticsData[Statistics.ATMOSPRESS] = util.getUint32(buffer[64:72])
    statisticsData[Statistics.CALORIE] = util.getUint32(buffer[72:80])
    statisticsData[Statistics.BESTPACE] = util.getUint32(buffer[80:88])
    statisticsData[Statistics.TIMESTAMP] = util.getUint32(buffer[88:96])
    statisticsData[Statistics.ACCOMPLISHTIME] = util.getUint32(buffer[96:104])
    statisticsData[Statistics.PAUSETIME] = util.getUint32(buffer[104:112])
    statisticsData[Statistics.DISTANCE] = util.getUint32(buffer[112:120])
    statisticsData[Statistics.CALIDISTANCE] = util.getUint32(buffer[120:128])
    statisticsData[Statistics.STEP] = util.getUint32(buffer[128:136])

    info.mode = statisticsData[Statistics.MODE]
    info.uuid = statisticsData[Statistics.TIMESTAMP]
예제 #4
0
def analysisInfo(buffer, buffersize, nodenum, nodesize):
    "运动计圈数据V1002解析"
    print "运动计圈数据协议版本V1.0.02"

    i = 0
    leftsize = buffersize
    offset = 0
    for i in range(nodenum):
        if (leftsize < nodesize * 2):
            print "运动计圈数据不完整"
            print buffer[offset:]
            break
        else:
            leftsize -= nodesize * 2

        countcircleInfo[CountCircleInfo.PACE] = util.getUint32(buffer[offset + 0:offset + 8])
        countcircleInfo[CountCircleInfo.ELAPSETIME] = util.getUint32(buffer[offset + 8:offset + 16])
        countcircleInfo[CountCircleInfo.PAUSETIME] = util.getUint32(buffer[offset + 16:offset + 24])
        countcircleInfo[CountCircleInfo.UNIT] = util.getUint32(buffer[offset + 24:offset + 32])
        countcircleInfo[CountCircleInfo.LONGITUDE] = util.getUint32(buffer[offset + 32:offset + 40])
        countcircleInfo[CountCircleInfo.LATITUDE] = util.getUint32(buffer[offset + 40:offset + 48])
        countcircleInfo[CountCircleInfo.LONGITUDE_EW] = util.getUint8(buffer[offset + 48:offset + 50])
        countcircleInfo[CountCircleInfo.LATITUDE_NS] = util.getUint8(buffer[offset + 50:offset + 52])
        offset += nodesize * 2
        info = copy.copy(countcircleInfo)
        countcircleData.append(info)
    str(i)
예제 #5
0
def analysisInfo(buffer, buffersize, nodenum, nodesize):
    "运动实时数据V1004解析"
    print "运动实时数据协议版本V1.0.04"

    offset = 0
    leftsize = buffersize
    for i in range(nodenum):
        if (leftsize < nodesize * 2):
            print "运动实时数据不完整"
            print buffer[offset:]
            break
        else:
            leftsize -= nodesize * 2

        realtimeInfo[RealtimeData.PAUSE] = util.getUint8(buffer[offset + 0:offset + 2])
        realtimeInfo[RealtimeData.HR] = util.getUint8(buffer[offset + 2:offset + 4])
        realtimeInfo[RealtimeData.LONGITUDE_EW] = util.getUint8(buffer[offset + 4:offset + 6])
        realtimeInfo[RealtimeData.LATITUDE_NS] = util.getUint8(buffer[offset + 6:offset + 8])
        realtimeInfo[RealtimeData.CADENCE] = util.getUint16(buffer[offset + 8:offset + 12])
        realtimeInfo[RealtimeData.TEMPERATURE] = util.getUint16(buffer[offset + 12:offset + 16])
        realtimeInfo[RealtimeData.PACE] = util.getUint32(buffer[offset + 16:offset + 24])
        realtimeInfo[RealtimeData.LATITUDE] = util.getUint32(buffer[offset + 24:offset + 32])
        realtimeInfo[RealtimeData.LONGITUDE] = util.getUint32(buffer[offset + 32:offset + 40])
        realtimeInfo[RealtimeData.ATMOSPRESS] = util.getUint32(buffer[offset + 40:offset + 48])
        offset += nodesize * 2
        info = copy.copy(realtimeInfo)
        realtimeData.append(info)
    str(i)
예제 #6
0
def analysisHeadInfo(buffer):
    "数据头信息解析"

    # print "RAW数据头"
    # print buffer
    # util.printDividingLine()

    dataInfo[DataHead.UUID] = util.getUint32(buffer[0:8])
    dataInfo[DataHead.MODEL1] = util.getUint8(buffer[8:10])
    dataInfo[DataHead.MODEL2] = util.getUint8(buffer[10:12])
    dataInfo[DataHead.VERSION] = util.getUint16(buffer[12:16])
    dataInfo[DataHead.NODESIZE] = util.getUint16(buffer[16:20])
    dataInfo[DataHead.NODENUM] = util.getUint16(buffer[20:24])
예제 #7
0
def analysisInfo(buffer, buffersize, nodenum, nodesize):
    "运动统计数据V1005解析"
    print "运动统计数据协议版本V1.0.05"

    if (buffersize < nodesize * 2):
        print "运动统计数据不完整"
        print buffer
        return

    statisticsData[Statistics.MODE] = util.getUint8(buffer[0:2])
    statisticsData[Statistics.AVERAGEHR] = util.getUint8(buffer[2:4])
    statisticsData[Statistics.MAXHR] = util.getUint8(buffer[4:6])
    statisticsData[Statistics.TIMEZONE] = util.getUint8(buffer[6:8])
    statisticsData[Statistics.DISTRIBUTED1] = util.getUint16(buffer[8:12])
    statisticsData[Statistics.DISTRIBUTED2] = util.getUint16(buffer[12:16])
    statisticsData[Statistics.DISTRIBUTED3] = util.getUint16(buffer[16:20])
    statisticsData[Statistics.DISTRIBUTED4] = util.getUint16(buffer[20:24])
    statisticsData[Statistics.DISTRIBUTED5] = util.getUint16(buffer[24:28])
    statisticsData[Statistics.MAXCADENCE] = util.getUint16(buffer[28:32])
    statisticsData[Statistics.RISEALTITUDE] = util.getUint32(buffer[32:40])
    statisticsData[Statistics.DROPALTITUDE] = util.getUint32(buffer[40:48])
    statisticsData[Statistics.MAXALTITUDE] = util.getUint32(buffer[48:56])
    statisticsData[Statistics.MINALTITUDE] = util.getUint32(buffer[56:64])
    statisticsData[Statistics.ALTITUDE] = util.getUint32(buffer[64:72])
    statisticsData[Statistics.CALORIE] = util.getUint32(buffer[72:80])
    statisticsData[Statistics.BESTPACE] = util.getUint32(buffer[80:88])
    statisticsData[Statistics.TIMESTAMP] = util.getUint32(buffer[88:96])
    statisticsData[Statistics.ACCOMPLISHTIME] = util.getUint32(buffer[96:104])
    statisticsData[Statistics.PAUSETIME] = util.getUint32(buffer[104:112])
    statisticsData[Statistics.DISTANCE] = util.getUint32(buffer[112:120])
    statisticsData[Statistics.CALIDISTANCE] = util.getUint32(buffer[120:128])
    statisticsData[Statistics.STEP] = util.getUint32(buffer[128:136])
    statisticsData[Statistics.OLONGITUDE] = util.getUint32(buffer[136:144])
    statisticsData[Statistics.OLATITUDE] = util.getUint32(buffer[144:152])
    statisticsData[Statistics.TLONGITUDE] = util.getUint32(buffer[152:160])
    statisticsData[Statistics.TLATITUDE] = util.getUint32(buffer[160:168])
    statisticsData[Statistics.OLONGITUDE_EW] = util.getUint8(buffer[168:170])
    statisticsData[Statistics.OLATITUDE_NS] = util.getUint8(buffer[170:172])
    statisticsData[Statistics.TLONGITUDE_EW] = util.getUint8(buffer[172:174])
    statisticsData[Statistics.TLATITUDE_NS] = util.getUint8(buffer[174:176])
    statisticsData[Statistics.UNITTYPE] = util.getUint8(buffer[176:178])
    statisticsData[Statistics.WEATHER] = util.getUint8(buffer[178:180])
    statisticsData[Statistics.TEMPERATURE] = util.getUint16(buffer[180:184])
    statisticsData[Statistics.MAXOXYGENUPTAKE] = util.getUint16(buffer[184:188])

    info.mode = statisticsData[Statistics.MODE]
    info.uuid = statisticsData[Statistics.TIMESTAMP]
예제 #8
0
def analysisRealtimeV1004(buffer):
    "运动实时数据V1004解析"
    print "运动实时数据协议版本V1.0.04(" + hex(dataInfo[DataHead.VERSION]) + ")"

    offset = 0
    for i in range(dataInfo[DataHead.NODENUM]):
        realtimeInfo[RealtimeData.PAUSE] = util.getUint8(buffer[offset + 0:offset + 2])
        realtimeInfo[RealtimeData.HR] = util.getUint8(buffer[offset + 2:offset + 4])
        realtimeInfo[RealtimeData.LONGITUDE_EW] = util.getUint8(buffer[offset + 4:offset + 6])
        realtimeInfo[RealtimeData.LATITUDE_NS] = util.getUint8(buffer[offset + 6:offset + 8])
        realtimeInfo[RealtimeData.CADENCE] = util.getUint16(buffer[offset + 8:offset + 12])
        realtimeInfo[RealtimeData.TEMPERATURE] = util.getUint16(buffer[offset + 12:offset + 16])
        realtimeInfo[RealtimeData.PACE] = util.getUint32(buffer[offset + 16:offset + 24])
        realtimeInfo[RealtimeData.LATITUDE] = util.getUint32(buffer[offset + 24:offset + 32])
        realtimeInfo[RealtimeData.LONGITUDE] = util.getUint32(buffer[offset + 32:offset + 40])
        realtimeInfo[RealtimeData.ATMOSPRESS] = util.getUint32(buffer[offset + 40:offset + 48])
        offset += dataInfo[DataHead.NODESIZE] * 2
        i
        info = copy.copy(realtimeInfo)
        realtimeData.append(info)
예제 #9
0
def analysisStepV1004(buffer):
    "计步数据V1004解析"
    print "计步数据协议版本V1.0.04(" + hex(dataInfo[DataHead.VERSION]) + ")"

    offset = 0
    for i in range(dataInfo[DataHead.NODENUM]):
        stepInfo[StepInfo.TIMESTAMP] = util.getUint32(buffer[offset + 0:offset + 8])
        stepInfo[StepInfo.TIMEZONE] = util.getUint8(buffer[offset + 8:offset + 10])
        stepInfo[StepInfo.SEDENTARYCOUNT] = util.getUint8(buffer[offset + 10:offset + 12])
        stepInfo[StepInfo.REVERSE] = util.getUint16(buffer[offset + 12:offset + 16])
        stepInfo[StepInfo.CALORIEBMR] = util.getUint32(buffer[offset + 16:offset + 24])
        stepInfo[StepInfo.CALORIESPORT] = util.getUint32(buffer[offset + 24:offset + 32])
        for j in range(24):
            start = offset + 32 + 8 * j
            end = offset + 36 + 8 * j
            stepInfo[StepInfo.STEPHOUR + j * 2] = util.getUint16(buffer[start:end])
            stepInfo[StepInfo.DISTANCEHOUR + j * 2] = util.getUint16(buffer[end:end + 4])
        offset += dataInfo[DataHead.NODESIZE] * 2
        i
        info = copy.copy(stepInfo)
        stepData.append(info)
        print info