def _receive(self):
<EOL>preamble = self._read(<NUM_LIT:1>)<EOL>if not preamble:<EOL><INDENT>return None<EOL><DEDENT>elif ord(preamble) != SBP_PREAMBLE:<EOL><INDENT>if self._verbose:<EOL><INDENT>print("<STR_LIT>" % ord(preamble))<EOL><DEDENT>return None<EOL><DEDENT>hdr = self._readall(<NUM_LIT:5>)<EOL>msg_crc = crc16(hdr)<EOL>msg_type, sender, msg_len = struct.unpack("<STR_LIT>", hdr)<EOL>data = self._readall(msg_len)<EOL>msg_crc = crc16(data, msg_crc)<EOL>crc = self._readall(<NUM_LIT:2>)<EOL>crc, = struct.unpack("<STR_LIT>", crc)<EOL>if crc != msg_crc:<EOL><INDENT>if self._verbose:<EOL><INDENT>print("<STR_LIT>" % (msg_crc, crc))<EOL><DEDENT>return None<EOL><DEDENT>msg = SBP(msg_type, sender, msg_len, data, crc)<EOL>try:<EOL><INDENT>msg = self._dispatch(msg)<EOL><DEDENT>except Exception as exc:<EOL><INDENT>warnings.warn("<STR_LIT>" % (exc,))<EOL><DEDENT>return msg<EOL>
Read and build SBP message.