QSerialPort open
-
first uncomment line 1 in your main() ;)
on the return do app.exec() instead of returning 0Also you need to move the implementation of your serial port to an object which lives in the Qt event loop. If you use a gui simply add it into a widget. If not just use an QObject which does the work instead doing all in the main function.
-
i tried, but failed. Could U give a simple example ? Thank you
-
i tried, but failed. Could U give a simple example ? Thank you
[quote author="raven-worx" date="1386321238"]first uncomment line 1 in your main() ;)
on the return do app.exec() instead of returning 0Also you need to move the implementation of your serial port to an object which lives in the Qt event loop. If you use a gui simply add it into a widget. If not just use an QObject which does the work instead doing all in the main function.[/quote]
-
Hi,
What did fail ?
Since you are not using any GUI element you can use a QCoreApplication
-
BTW: This is not the QSerialPort issue.. :)
-
Does it work without Qt event loop environment?
[quote author="SGaist" date="1386331898"]Hi,What did fail ?
Since you are not using any GUI element you can use a QCoreApplication[/quote]
-
it works without an event loop when you only use the blocking methods (all waitXXX() methods).
Maybe in your case it's enough to just instantiate the Q(Core)Application? -
yes, you are right.
[quote author="SGaist" date="1386331898"]Hi,What did fail ?
Since you are not using any GUI element you can use a QCoreApplication[/quote]
-
Atfer 2 places modified, it's ok now. But i've a new problem.
The following is the response, and the first line "ls" is the sent data.
Now i don't want the first line to be displayed, then how?ls
bin lib mnt root tmp
dev linuxrc opt sbin usr
etc lost+found proc sys[quote author="raven-worx" date="1386339040"]it works without an event loop when you only use the blocking methods (all waitXXX() methods).
Maybe in your case it's enough to just instantiate the Q(Core)Application?[/quote] -
Isn't that your device that echoes what it has received ?
-
Ah, maybe, i'll check
[quote author="SGaist" date="1386578714"]Isn't that your device that echoes what it has received ?[/quote]