How to read TxD and RxD line states in Rs232 communication with QSerialPort::PinoutSignals?
-
Hi! I'm using QSerialPort in my Rs-232 communication app. I'm trying to show in statusBar all the pinout states (DTR, RTS, CTS, ...) and this works fine, but the TxD and RxD states do not change while transmitting or receiving data. Is it a QSerialPort or Windows implementation problem, or do I do something wrong?
@QSerialPort::PinoutSignals s = serial->pinoutSignals();
QSerialPort::PinoutSignals txd = QSerialPort::TransmittedDataSignal
if(txd&s) txdlabel->setStyleSheet("QLabel{ color: black; background-color: yellow;}");
else txdlabel->setStyleSheet("QLabel{color: gray; background-color: lightgray;}");@ -
It is an Windows restrictions. Though, seems and on Linux (with use a POSIX abi) it is impossible to got it.
So, just skip it. :)
-
Thanks for fast reply! This time I can skip it, as this is not important for my current task. But - for future reference - how to get that working? It's definetely possible -I saw it in many apps in Windows...
-
I never heard about such opportunity (e.g. Windows drivers do not provide this API) and didn't see applications which got a state of TxD/RxD lines. IMHO, it is impossible, but if you can provide an examples (e.g. the mentioned applications that can do it?) then we can try to make something.
-
OK ;) If I have to name the apps, the only one I remember is RealTerm (http://realterm.sourceforge.net/), but it's working there.
-
Most likely the RealTerm displays a "fake" status of lines, i.e. simply EV_TXEMPTY and/or EV_RXCHAR events in process of I/O (or something like). Because API for getting state of the TXD/RXD pins doesn't exist.
-
Thanks for explanation, kuzulis!