ghtalpo / py_amazfit_tools

pack/unpack .bin for amazfit verge lite/gtr/gts
55 stars 53 forks source link

New faces and unexpected byte #21

Open dpeddi opened 4 years ago

dpeddi commented 4 years ago

Hi Ghtalpo,

Here is GTS but i expect the same on gtr and other watches in the near future... I need some help in decoding an unexpected byte: Sports Circle: https://store-cdn.huami.com/market_app/20191029/dca475518b08e48c90d592fbc8bfe817.bin Fluorescence: https://store-cdn.huami.com/market_app/20191130/0e7b2617d07122eb6b2b2538621a841a.bin

these are just an example... however on Fluorescence I have more evidence...

On Activity Parameter as you can see I get two time the Id 3. Parmeter4:

2 (12): 18 bytes
    1 ( 8): 266 10A
    2 (10): 38 26
    3 (18): 318 13E
    4 (20): 53 35
    5 (28): 24 18
    6 (30): 0  0
    7 (38): 2  2
    8 (40): 10  A
3 (1A): 16 bytes
    1 ( 8): 34 22
    2 (10): 38 26
    3 (18): 74 4A
    4 (20): 53 35
    5 (28): 72 48
    6 (30): 0  0
    7 (38): 2  2
    8 (40): 10  A
11 (5A): 37 bytes
    1 ( 8): 54 36
    2 (10): 46 2E
    3 (18): 37 25
    4 (20): 37 25
    5 (28): 18446744073709551485 FFFFFFFFFFFFFF7D
    6 (30): 131 83
    7 (38): 8  8
    8 (40): 18446744073706601289 FFFFFFFFFFD2FB49
    9 (48): 0  0
13 (68): 12  C
17 (8A): 1 bytes
    7 (3A): 2  2
1 ( A): 38 bytes
    1 ( 8): 292 124
    2 (10): 46 2E
    3 (18): 37 25
    4 (20): 37 25
    5 (28): 18446744073709551485 FFFFFFFFFFFFFF7D
    6 (30): 131 83
    7 (38): 8  8
    8 (40): 18446744073706601289 FFFFFFFFFFD2FB49
    9 (48): 0  0
3 (1A): 16 bytes
    1 ( 8): 0  0
    2 (10): 0  0
    3 (1A): 4 bytes
        1 ( 8): 0  0
        2 (10): 0  0
    4 (22): 4 bytes
        1 ( 8): 0  0
        2 (10): 0  0
18 (92): 1 bytes
    2 (12): 2  2
2 (12): 16 bytes
    1 ( 8): 0  0
    2 (10): 0  0
    3 (1A): 4 bytes
        1 ( 8): 0  0
        2 (10): 0  0
    4 (22): 4 bytes
        1 ( 8): 0  0
        2 (10): 0  0

If in parameters.py - def readFrom() I add

+        if value == 1 and flags.hasFlag(ParameterFlags.hasChildren): 
+            value = Parameter.readValue(fileStream, traceOffset) 
         if flags.hasFlag(ParameterFlags.hasChildren):

All get more sense and the repeated rowid get nested under the previous element.

But why i have that unexpected 1 byte? how i can store in the json this information?

Regards E.

dpeddi commented 4 years ago

perhaps I've understood

    def readFrom(fileStream, traceOffset = 0):
-        rawId = Parameter.readByte(fileStream, traceOffset)
+        rawId = Parameter.readValue(fileStream, traceOffset)

...

test in progress

ghtalpo commented 4 years ago

Thanks for reporting. I'll check out that.