Hi,
I am working on an application which communicates with an appliance attached to the serial port. The application send commands and waits for the appliance's reply, or until timeout. Currently I am doing the waiting using an instance of QEventLoop, however I read that using QEventLoop leads to subtle bugs. So now I need to redesign my application logic, which currently depends on a method which sends data out of the port and waits for a response of certain length.
What I want to achieve is (pseudocode):
response = connection.sendQuery(query, responseLength, timeout)
if (response.length() == responseLength) {
// valid response
} else {
//invalid response
}
response = connection.sendQuery(query, responseLength, timeout)
if (response.length() == responseLength) {
// valid response
} else {
//invalid response
}
To copy to clipboard, switch view to plain text mode
Can you please suggest a strategy for creating that logic?
Thanks
Bookmarks