Hi,
if r is equal to the file size the program prints "Writed binary file."
The error is: the program sends all the bytes but if there is a XOFF the device doesn't read all the bytes.
Just to make sure I understand you right : you do get the message "Writed binary file.", right ? This may be significant because QSerialDevice doesn't send all data at once, but in chuncks of 512 or so bytes. It might be that the serial port driver returns false on a write() when an XOff has been received. Unlikely though.
I thought the QSerialDevice manage this XON/XOFF but I don't know if it works.
The operating system should take care of this. QSerialDevice doesn't need to do this.
It is very easy to implement the Xon/Xoff handshaking yourself :
// until all data sent :
// send a chunck of data
// if something is received from the printer :
// if Xoff was received :
// wait until Xon received
// until all data sent :
// send a chunck of data
// if something is received from the printer :
// if Xoff was received :
// wait until Xon received
To copy to clipboard, switch view to plain text mode
Best regards,
Marc
Bookmarks