Protocol documentation - HenkKalkwater/fitmetersync GitHub Wiki

The protocol seems to be split in several layers, which are located in different libraries.

Physical layer

This seems to be IrDA-SIR, with a baud rate of 115.2 kbit/s. As this is a standardized protocol, there should be documentation available on other parts of the internet.

Data link layer

The next layer seems to be some kind of link layer, as it contains an 'unique' address, checksum and packet length.

Frame structure

The names are not official in any means, but I will use them in the rest of the documentation,

Seems to correspond with the packet structure used by IR:USER

Name offset (bytes) lenght (bytes) Description
Magic? 0x0 0x1 Always a5?
ConnectionID 0x1 0x1 Connection ID, 00 if there is no connection made yet. (?)
SetupFlag? 0x2 0x1 First bit: flag of some sort? 1 if no connection was made yet or wants to stop the connection?
LargeFlag? ^ ^ Second bit: flag of some sort? 1 if the packet size is larger than 63 bytes?
PacketSize ^ ^ Remaing 6 bits: length of the Data (in bytes) if BigFlag is not set.
PacketSize 0x3 (Not present if LargeFlag was not set) 0x1 Size (in the case that BigFlag was set, otherwise data starts here.)
Data 0x3 (0x4 if LargeFlag was set) Y Data, see the next layer.
Checksum 0x3 + Y (0x4 + Y if LargeFlag was set) 0x1 8-bit CRC over all the previous bytes