Image 01
profile-image

ilpaso

davide pasini
QSerialDevice

Qt Components by kuzulis 143 comments

Hi
Does QSerialDevice class manage the XON/XOFF flow control.

What is the code in order to send datas to a device with this flow control?

I've to send datas to a device which sends a XOFF when its buffer is full and a XON when I can restart to transfer the datas.

Thank you - Dec 07 2010
QSerialDevice

Qt Components by kuzulis 143 comments

thank you Kuzulis for your answer.
Now my serial port works with XON/XOFF flow control.
I'm able to send a whole text file but I've some problem with binary file.

For me binary files are files without a char or other encoding.
At the moment I've to read a 32500bits file and send it over serial port.
I wrote something like this:

/////////////////
QFile inFile("image.bin");
if( ! inFile.open( QIODevice::ReadOnly ) )
{
cerr << "Cant find file " << filename << endl;
}

QByteArray block;
block = inFile.readAll();
quint64 r = port->write(block);
if (r == quint64(block.size()))
qDebug() << "Writed: " << r << " bytes";
/////////////////

The program returns "Writed: 32500bytes" but it sends only about 7110.


Maybe I've to use QDatastream but I'm not able to use it. I read some documents and the Qt user guide but I need a little help in order to send the QDataStream over the serial port.

Thank you for your help and sorry for my english.
- Dec 06 2010
QSerialDevice

Qt Components by kuzulis 143 comments

thank you Kuzulis for your answer.
Sorry but I understand I'm confused.
For binary file I mean a non text file.

I understand now QByteArray is a container for any data. I'll try to load an entire file and send it over the serial port.

The next questions are:
- If I need a XON/XOFF flow control I've to set the control and does the class do all the work? I've only to send the datas as shown in the examples?

- What do you mean when you write about the QDataStream: "... try to download the current branch library (the master) and use the same Qt sockets...". What is the "current branch library"?

Thank you for the help and sorry again for the confusion.
- Nov 30 2010
QSerialDevice

Qt Components by kuzulis 143 comments

Hi,
I'm able to write and read text. I'd like to send an entire binary file.
I read the file with QFile class but I'm not able to use the finctions "write" in order to sent it.

Thank you for the help - Nov 29 2010
QSerialDevice

Qt Components by kuzulis 143 comments

Hi,
I'm able to write and read text. I'd like to send an entire binary file.
I read the file with QFile class but I'm not able to use the finctions "write" in order to sent it.

Thank you for the help - Nov 29 2010
QSerialDevice

Qt Components
by kuzulis

7.9
Nov 30 2010
QSerialDevice

Qt Components
by kuzulis

7.9
9   Nov 30 2010