ST5000 XMSG Protocol

The ST5000 wraps data bytes inside a packet that we call an "xmsg". There are 3 sync bytes and then a length code. The idea is that you "sync up" on the sync bytes and "unwrap" packets as they arrive. A transmission error will get you out of sync, but you just sync up again when the bytes get good again.

For historical reasons, we use a variable-length coding for the message length. For fewer than 128 bytes, we use a single byte to encode the length. For values larger than 127, we use the 8th bit of the first byte as a signalling bit, indicating that the next 7 bits of length are in the next byte. See the xmsgEncodeUV() entry in the XMSG codec.

The sync bytes (in order) are: 0x4A, 0x57, 0x50.