I have an Qt Widgets application that needs to talk to some devices. I have created most of the data representation and command queuing in the widgets application to deal with any communication system based on an interface similar to QIODevice with transactions objects.
In the future this will actually be QSerialPort or a QTCPSocket which I easy to do. However, today I need to work with a protocol library that is written in blocking C code.
I know this library must run in a thread for it to work otherwise it would stop the qt event loop.
This is how the same library works on the other (embedded) end, in a thread.
What I cannot figure out is how to translate a QIODevice-alike interface to inter-thread communication via signal/slots.
Functions like open/close and configuration changes have a return value. Which doesn't work synchronously over signal/slot.
How is this typically solved?
Aucun commentaire:
Enregistrer un commentaire