I have two while loops, one to first check start sequence (frame start), once done.
The second loop checks for the checksum value, end sequence (frame end) and if not end of valid, treats this isas a message payload and reads from the stream until a valid end sequence (frame end) is found. Each (n) payload starts with a 3 bytes header (2 bytes identifier + 1 byte length of the succeeding data) and then the actual data.