PDA

View Full Version : Question about using the QextSerialPort~



coffeemorphism
1st February 2007, 10:11
hi, all~
I have a question about using QextSerialPort.
When I searched articles about this library, I found that in order to check whether a new data comes or not, we should poll the serial port by using QTimer.
However, when I saw the header file which describes the definition of the QextSerialPort class, I got to know that it is inherited by QIODevice class. Moreover, QIODevice emits signals like readyRead(), or bytesWritten(). Then, by writing slot function about those signals, is it possible to get data from a serial port from the slot function? not by polling repeatedly by using QTimer??

any hints or help will be appreciated~ :)

e8johan
1st February 2007, 13:06
What I have understood from previous questions about this class is that you must poll it. Of course you could write a polling thread class that is wrapped in an asyncronous device class - hence making it look good to the rest of the application - but you still have to poll it internally.

coffeemorphism
1st February 2007, 14:16
What I have understood from previous questions about this class is that you must poll it. Of course you could write a polling thread class that is wrapped in an asyncronous device class - hence making it look good to the rest of the application - but you still have to poll it internally.

Thanks your reply~ but it doesn't still clear for me that if it is impossible to response to serial data by event driven way which is supported by QIODevice class. I just guess if some data come to a serial port, then, since QExtSerialPort is inherited from QIODevice, the corresponding signal will be emitted. In that way, without having to make some thread for polling the serial, I think I just only to write some codes at the corresponding slot function. If it's possible, I guess it's more simpler way to listen to a serial port~ :cool: