Hi all,
thanks for the help. I explain you my intent and the problems.
The intent is to connect my Qt application to a serial printer with its own protocoll. In order to do this I've to send 2 files: the first is a binary file and the second is a text file with some commands inside. I've some commands in order to check the connection and the number of bytes I sent.
The connection is a Rs232 with a XON/XOFF control.
I tried 2 classes: QextSerialPort and QSerialDevice. My choice was on QSerialDevice but the 2 classes are similar.
I creare a QByteArray reading the Qfile "textfile.bin" and I send it with "qint64 write(const QByteArray &byteArray)" function. It works!
The problem is to send the "imageBinary.bin" with the same procedure. My Qt application returns "32Kbyte sent!" but the device receives only 7Kbyte. I'm not able to see what there is inside the file with a text editor because this is binary file.
I'm sure the printer is ok because with its windows software it works.
I suppose the problem is in the conversion from the binary file to QbyteArray. So I read something about QDataStream and QTextStream. I suppose QDataStream reads raw datas without a conversion.
Another hypothesis could be that the QSerialDevice class has bug but I don't think.
Maybe this is enough in order to help me.
Thank you very much for your help and sorry for my Qt incompetence and my English.
ilpaso
Bookmarks