QExtSerialPort doesn't emit readyRead() so there is no point in waiting for it. You need to use a timer. If you want the call to be blocking, you may spawn your own event loop if your application is not already event driven.
QExtSerialPort doesn't emit readyRead() so there is no point in waiting for it. You need to use a timer. If you want the call to be blocking, you may spawn your own event loop if your application is not already event driven.
hallo Wysota,
thanks for ur suggestion.
I made it as polling with bytesavailalbe with a threadsleep().
I feel this is a workaround.
Also, I saw the QextSerialPort 1.2 alpha has a emit ReadyRead() command.
But they did not implement WaitForReadyRead().
Hi,
Has anyone tested the QextSerialPort 1.2Alpha "readyRead" signal ? Does it work? Currently I have a Thread that pools the serial port for "bytesAvailable" and want to know if "readyRead" signal works.
Thanks,
Òscar Llarch i Galán
It wont work as they did not implement it .
Check the win_qextserialport.h line nr. 107
virtual bool waitForReadyRead(int msecs); ///< @todo implement.
I wanna give it a shot .. but at the moment I dont have time to do it.
I used the wysota's way of using the Qtimer method.
Hi,
I don't want "waitForReadyRead", I want to connect "readyRead" SIGNAL and as I can see it is implemented on Windows using a QThread and Windows API functions.
I just want to know if "readyRead" SIGNAL works because now I have a polling Thread that increases CPU load.
Thanks,
Òscar Llarch i Galán
You don't need a separate thread. You can check the port in the main thread. Timers are a bit heavy, so it might be better to use timerEvent() if you experience efficiency problems.
It is possible to do only by polling based on timer and check if data available.
Or you can make reasonable SIGNAL api yourself to hide polling
Hi,
I know that I can use a Timer but I want to know if using QextSerialPort 1.2 Alpha, the signal "readyRead" works !!!
If it works I don't need to use a Timer or a Thread, because it will call the properly SLOT when data arrives.
So, anyone have tested it?
Thanks,
Òscar Llarch i Galán
I didn't manage to get it to work properly... Maybe that's why it's alpha![]()
Bookmarks