I'm trying to set up a serial connection with a device which runs on a 1996 processor. This means that it can take several second for the data to be transmitted back to me. I know that the readyRead
signal is generated every time new data is available, but my question is how long is generated for. Also is their a way that I can test for the ready read being low because if it stops being emitted when their is no longer any data left to read in, that would be really helpful.
do{
ui->label_5->setText("readyRead");
} while (readyRead() == true);
QString output = serial->readAll();
ui->label->setText(output);
}
I hope this code segment illustrates what i'm trying to do. I haven't been able to test it as I haven't been able to work out how to call readyRead
. I think that my readAll
command might be in the wrong place but i'm not sure?
If anybody could help that would be greatly appreciated. Also if anybody knows a better way of doing this that would be greater still.
edit
I've added connect(serial, SIGNAL(readyRead()),this,SLOT(myReceivedData()));
to my code but i've still got issues. I think their occurring because the processor is so slow that it takes several seconds to transmit the data, and that because of this my program is exiting the void loop only to return again because the readyRead flag is still true because their is still data left to read. I have tried adding a "sleep" command but this pauses the gui and seams to affect the reading time of the data.
My main question is am I correct about the readyRead
signal still being true mid way through the data transition or am I missing a key fact?
Thanks for the replies.