Read data while available by parts, sleep between checks.
Sleep time calculates from baud rate and count of bits in one byte.
---|-----|-----|------------|-----|------------> t call | | | | readAll | | | | | | | | | | |<---------data receive---------->| | |=== ===== ======| | |== =| | | | | | | | |<-timeout->| | | | | | |<-1->| |<2>| |<-3->| | | | | | |<---readedData--->| | | return |<------readAll work time----->| (1) if readedData.length > 0 then continue reading else throw TimeoutException (2) silent time, if silent < frameGap then continue reading (3) else if silent > frameGap then stop reading and return readedData
Params: buf = buffer for reading startTimeout = timeout for first byte recive frameGap = detect new data frame by silence period
Returns: slice of buf with readed data
Throws: PortClosedException ReadException TimeoutException
See_Also: SerialPort.read
See Implementation
Read data while available by parts, sleep between checks.
Sleep time calculates from baud rate and count of bits in one byte.
Params: buf = buffer for reading startTimeout = timeout for first byte recive frameGap = detect new data frame by silence period
Returns: slice of buf with readed data
Throws: PortClosedException ReadException TimeoutException
See_Also: SerialPort.read