def write(self, data_str):
cmd_code = byte2int(data_str[<NUM_LIT:2>])<EOL>if cmd_code == <NUM_LIT>:<EOL><INDENT>self.__read_buffer = b'<STR_LIT>'<EOL><DEDENT>print("<STR_LIT>", binascii.hexlify(data_str))<EOL>print(self.__decode_message(data_str))<EOL>return len(data_str)<EOL>
Simulator for serial write.
Prints data and decoded values.

:param data_str: string to write
:return: number of bytes given