Unsolved QThread sync communication + one extra event
-
Hi,
Im using QThread for sync QSerialPort communication - i need it. But i have one very long operation, and i dont wonna stop serial communication with 2 minutes timeoutif (serial.waitForReadyRead(waitTimeout)) { QByteArray responseData = serial.readAll(); while (serial.waitForReadyRead(10)) responseData += serial.readAll();
I need some way to recive this one special operation in async way.
QThread is blocked until next data send by wait condition
mutex.lock(); condition.wait(&mutex);
I can recognize this anserw by data inside frame
-
@qtprogrammer123 said in QThread sync communication + one extra event:
I need some way to recive this one special operation in async way.
Then why do you use blocking calls? QSerialPort provides asynchronous API, use it.
-
Like i wrote it must be sync communication in other thread, application need it. I using serial in 5 places in code and all of them need take serial for communication with device and wait for anserw, anserw are similar and i cant recognize it. Only 6 operation not
-
@qtprogrammer123 I have no idea how you would use same serial port at the same time for synchronous and asynchronous communication...
-
Its only one async operation - this command not block device, but i recive anserw after few minutes. Before that i wonna still use my sync communication for regular operation
----sync communication ---
----sync communication ---
...
----command with long period of anserw ---
...
----sync communication ---
....
....----command with long period of anserw response --- -
Then use async everywhere.