Hi Guys,
Thank you very much for your answers. I rode the QIODevice::waitForReadyRead definition too fast and I misunderstood this point.
For guys who will read this thread and who will be faced with the same problem, i can suggest this solution (which is a blocking one). This solution is exposed in qt example.
char* dataToReceive= new char;
cout<< "the device is open Y/N: "<< SerialEmitter->isOpen()<<endl;
cout<< "The value retrun of this function is "<< SerialEmitter->write(TheMessage,TailleMessage*sizeof(char))<<endl;
SerialEmitter->waitForBytesWritten(200);
dataToReceiveQBA=SerialEmitter->readAll();
while (SerialReceiver->waitForReadyRead(250))
{
dataToReceiveQBA.append(SerialEmitter->readAll());
}
dataToReceive= dataToReceiveQBA.data();
QByteArray dataToReceiveQBA;
char* dataToReceive= new char;
cout<< "the device is open Y/N: "<< SerialEmitter->isOpen()<<endl;
cout<< "The value retrun of this function is "<< SerialEmitter->write(TheMessage,TailleMessage*sizeof(char))<<endl;
SerialEmitter->waitForBytesWritten(200);
dataToReceiveQBA=SerialEmitter->readAll();
while (SerialReceiver->waitForReadyRead(250))
{
dataToReceiveQBA.append(SerialEmitter->readAll());
}
dataToReceive= dataToReceiveQBA.data();
To copy to clipboard, switch view to plain text mode
Bookmarks