Hello.
I am implementing a kind of waitForReadyRead datas from the serial port, where if after 10 seconds without bytesAvailable the program continues running.
This is the code:
Qt Code:
timer2->start(10000); while(port->bytesAvailable()<=0 && timer2->isActive()); if(port->bytesAvailable()<=0){ //There arent bytesAvailable and the timer has expired ( timeOut) }else{ port->read(); }To copy to clipboard, switch view to plain text mode
The problem is that if it isnt bytesAvailable the program is all the time in an infinite loop, in the while loop, but it should stop the loop after 10 seconds.
Maybe I am using the timer in a wrong way, do you think it is this?
Cheers.
Bookmarks