Serial communication, waitForReadyRead() doesn't wait
I have a device connected to my PC with a usb converted serial port (FTDI). I'm using qextserialport and altogether it works great. However, waitForReadyRead() doesn't wait for data to arrive, but returns immidiately with false. I'm using it like this:
Code:
void Serial::checkForData()
{
port = new QextSerialPort("COM3");
port->setBaudRate(BAUD115200);
port->setFlowControl(FLOW_OFF);
port->setParity(PAR_NONE);
port->setDataBits(DATA_8);
port->setStopBits(STOP_1);
sendSomething();
if (port->waitForReadyRead(1000))
{
// Device replied within 1 second
}
else
{
// Device didn't reply.
}
}
The waitForReadyRead call returns immidiately with false, without waiting for 1 second.
Any ideas?
Re: Serial communication, waitForReadyRead() doesn't wait
Hi,
Reading the QextSerialPort docs. Only using 1.2 Alpha version with MS Windows and configuring it as "event driven" you will be able to get it work as you expected.
Using older versions or using another OS like Linux you will probably need to use a timer to read the data every X ms, or wait X ms and then perform a "read" operation(if you are sure that you have data).
Re: Serial communication, waitForReadyRead() doesn't wait
Thanks mate. What documentation did you read? I saw only the doxygen stuff on the website and the function description didn't say anything like what you described.
Re: Serial communication, waitForReadyRead() doesn't wait
Hi,
I don't remember were I readed it but I know that there is this problem. I had developed an application one year ago that uses it and ther is no other way to make it works(at least for me).
Re: Serial communication, waitForReadyRead() doesn't wait
Bumping into you here just saved me several days of time. :)