read() Function

dlestxetx.read(file: Union[io.RawIOBase, _io.BytesIO]) → bytes

Read precisely one DLE/STX/ETX packet from a file object.

Parameters:file – a file object with a read(num_bytes) method.
Returns:the data within the received packet.
Raises:ValueError – if the data from the supplied file object doesn’t start with a packet, or doesn’t follow with a complete, valid packet.