jrnelson90 / tinderboxpedal

Bluetooth "Universal Remote" Footpedal for Digital Guitar Amps, on ESP32 or Pi Zero W
Apache License 2.0
71 stars 11 forks source link

Update on bluetooth data structure #13

Open paulhamsh opened 3 years ago

paulhamsh commented 3 years ago

Hi I am working on decoding the data format to add to the amazing work above. I think the key is the 8th byte in the sequence - so I've created this addition to the description you have created. I am still working through how this works but think it all relies on the 8th byte, and that data is not prefixed by a type indicator. I hope this helps.

`

Body structure

The body of the message made of sequences of 8 bytes - 7 bytes of data and 'format' byte. Arguments are sequential in the data sequence and the format byte shows where new a new argument starts. Each bit maps to a byte in the next sequence, and if the bit is set in the format byte then that byte in the sequence is the start of a new data element. Strings have their length as their first byte (stored as 0x20 + length).

An example is shown below, with each new data sequence on a new line. The bit expansion is the 8th byte with the bits reversed, to show where the new sequence starts:

    D1 D2 D3 D4   D5 D6 D7         F1    Bit expansion of F1
    xx xx xx xx   xx xx xx         02    0100 000x
    xx 
       2b 52 6f   79 61 62         40    0000 001x
    20 43 72 6f   77 6e 
                        23         08    0001 000x
    30 2e 37 
             27   31 2d 43         10    0000 100x
    6c 65 61 6e   
                  28 69 63         40    0000 001x
    6f 63 2e 70   6e 67 
                        4a         32    0100 110x
    42 
       70 00 00   
                  17 
                     2e 62         00    0000 000x
    69 61 73 2e   6e 6f 69         40    0000 001x
    73 65 67 61   74 65 
                        xx         xx    xxxx xxxx

Which translates to: String: Royal Crown String: 0.7 String: 1-Clean String: icon.png ???: 4a 42 ???: 70 00 00 ???: 17 String: .bias.noisegate

It appears that strings are the only variable length data sequence and the only sequence that starts with a length `