I am using QextSerialPort with Qt 4.8.1 on Win32. When "polling" query mode is set, and a timeout set using QextSerialPort::setTimeout(). When I call QExtSerialPort::read(), even when data is available, the read function does not return until the entire timeout period has expired, even though it returns with data.
For example:
m_port->setTimeout( 3000 ) ;
char data = 0 ;
int count = m_port->read( &data, 1 ) ;
// Returns after three seconds, but count is 1, and data set as expected
I would expect it to return as soon a the specified number or bytes are read or the timeout expires - which ever occurs first.
Should this work or am I misunderstanding this interface? Is there a way of achieving the expected behaviour in polling mode.
It appears the solution is to open in unbuffered mode thus:
I am not really sure why that should be necessary, so if anyone can shed some light on the philosophy of this interface design I'd still be interested in any answers.