QSerialPort 5.2 and write function?
-
I'm facing a problem with write function. Every time I send "Q" to Hyperterminal or putty, I receive "QQ". This is my code for this function.
@if ( choice == 1 ){
port->write("Q\r\n");if ( port->waitForBytesWritten(-1) && port->clear() )
qDebug() << "Data has been send successfully...";
else
qDebug() << "Data hasn't been send successfully...";}@
I've tested the code in Hyperterminal and putty, so I think the problem with Qt. I'm using Windows 7 and Qt 5,2. The compiler
mingw32-make
-
Never mind. The problem was HDD Virtual Serial Port. It has nothing to do with Qt or Hyperterminal
-
You are sure that problem is in "HDD Virtual Serial Port." ? Can you repeat your code in non-blocking manner (without call of waitForBytesWritten(())?
e.g.:
[code]
void YourClass::handleButtonClickedSlot()
{
port->write("Q\r\n");
}
[/code]?
-
I've tried this but I'm only able to send just one time after I can't send any more unless I use waitForBytesWritten(-1) or clear() . It seems that write() is in a blocking mode even though in the documentation "here":http://qt-project.org/doc/qt-5.1/qtserialport/blockingmaster.html it states that write() is in non blocking mode. I have no idea why this happens.