thank you marcvanriet,
you have understood all my problems!
I do not understand why a class for serial communication is not ready to manage the xon/xoff flow control (or other flow control) in a easy way and so I think I'm not able to use it.
I'll try to send the file in smaller partitions. This is a good idea!
This is my code:
I set the Xon/Xoff:
if (!port->setFlowControl(AbstractSerial::FlowControlXonXoff)) {
qDebug() << "Set flow " << AbstractSerial::FlowControlXonXoff << " error.";
return;
}
if (!port->setFlowControl(AbstractSerial::FlowControlXonXoff)) {
qDebug() << "Set flow " << AbstractSerial::FlowControlXonXoff << " error.";
return;
}
To copy to clipboard, switch view to plain text mode
.....
inside the function "writeBinaryFile(QString fileName)" I send the datas
{
qDebug() << "Open file fault";
start(false);
port->close();
return;
}
quint64 r = port->write(data);
port->waitForBytesWritten(responseTimeout);
port->waitForReadyRead(responseTimeout);
cout<<r<<endl;
if (r == quint64(data.size())) qDebug() << "Writed text file.";
else qDebug() << "Bytes writed small: " << r;
}
{
QFile file(fileName);
if (!file.open(QIODevice::ReadOnly)){
qDebug() << "Open file fault";
start(false);
port->close();
return;
}
QByteArray data = file.readAll();
quint64 r = port->write(data);
port->waitForBytesWritten(responseTimeout);
port->waitForReadyRead(responseTimeout);
cout<<r<<endl;
if (r == quint64(data.size())) qDebug() << "Writed text file.";
else qDebug() << "Bytes writed small: " << r;
}
To copy to clipboard, switch view to plain text mode
when I send a small text file all is ok. When I send a bigger binary file (32KByte) printer returns only 7Kbyte read.
regards
ilpaso
Bookmarks