Combining QProcess, qterminal and bluetoothctl...in C++ code
-
SOLVED thanks to all contributions received from this forum. Much appreciated. The att6ached code is being posted here because it is C++ code and QT forum did not respond for over two weeks It is posted to seek a solution, not to receive bunch of social noise. If you have no knowledge of QT , PLEASE , keep it to yourself , no need to advertise it here . The code starts QProcess executes qterminal with -e option thus executing argument "bluetoothctl" After many trials, many RTFM and asking Mrs Google I am unable to pass an optional argument to "bluetoothctl", for example "help". I can manually input to the resulting "window", however, I cannot "write " to it using code. I suspect that my "write " code is accessing QProcess , not the qterminal... I am asking for help to solve this... please reply with solutions, I would greatly appreciate that. #ifdef TERMINAL_DEBUG { qDebug()<< Q_FUNC_INFO; processTERMINAL = new QProcess(); QString exec = "qterminal"; //params = QStringList() << "qterminal " << command; //params = QStringList() << "qterminal " << " -e" << " bluetoothctl "; // command; // no go QStringList params = QStringList() << "qterminal" << "-e" << "bluetoothctl" <<"help\n"; QStringList params = QStringList() << "qterminal" << "-e" << "bluetoothctl" ; // help\n"; processTERMINAL->start(exec, params); if(processTERMINAL->waitForStarted()) { qDebug() << " processTERMINAL->waitForStarted() OK"; qDebug() << processTERMINAL->readAllStandardError(); qDebug() << processTERMINAL->readAllStandardOutput(); processTERMINAL->open(); processTERMINAL->write(" help\n"); } return; } #endif
-
SOLVED thanks to all contributions received from this forum. Much appreciated. The att6ached code is being posted here because it is C++ code and QT forum did not respond for over two weeks It is posted to seek a solution, not to receive bunch of social noise. If you have no knowledge of QT , PLEASE , keep it to yourself , no need to advertise it here . The code starts QProcess executes qterminal with -e option thus executing argument "bluetoothctl" After many trials, many RTFM and asking Mrs Google I am unable to pass an optional argument to "bluetoothctl", for example "help". I can manually input to the resulting "window", however, I cannot "write " to it using code. I suspect that my "write " code is accessing QProcess , not the qterminal... I am asking for help to solve this... please reply with solutions, I would greatly appreciate that. #ifdef TERMINAL_DEBUG { qDebug()<< Q_FUNC_INFO; processTERMINAL = new QProcess(); QString exec = "qterminal"; //params = QStringList() << "qterminal " << command; //params = QStringList() << "qterminal " << " -e" << " bluetoothctl "; // command; // no go QStringList params = QStringList() << "qterminal" << "-e" << "bluetoothctl" <<"help\n"; QStringList params = QStringList() << "qterminal" << "-e" << "bluetoothctl" ; // help\n"; processTERMINAL->start(exec, params); if(processTERMINAL->waitForStarted()) { qDebug() << " processTERMINAL->waitForStarted() OK"; qDebug() << processTERMINAL->readAllStandardError(); qDebug() << processTERMINAL->readAllStandardOutput(); processTERMINAL->open(); processTERMINAL->write(" help\n"); } return; } #endif
QStringList params = QStringList() << "qterminal" << "-e" << "bluetoothctl help"
The rude tone of your question would not have deserved an answer but maybe you'll learn to be polite.
Mircea
-
QStringList params = QStringList() << "qterminal" << "-e" << "bluetoothctl help"
The rude tone of your question would not have deserved an answer but maybe you'll learn to be polite.
Mircea
Many thanks for replay. Been there , done that - it does not even start the QProcess. Any spaces in argument string stops the QProcess. PS So I am rude with putting-up with social noise - just like your remark? It is obviously OK for you and not for me. Have a swell day...
-
Many thanks for replay. Been there , done that - it does not even start the QProcess. Any spaces in argument string stops the QProcess. PS So I am rude with putting-up with social noise - just like your remark? It is obviously OK for you and not for me. Have a swell day...
We are getting your rants, and you are not getting what you want, because you keep asking the same questions and people don't keep track of someone who goes by just a "number". The bottom line is: This is NOT a "bluetooth" (expert) site, and all your ranting won't change that. If there is one here (an expert), he may not care to contribute under the circumstances; and that's their choice. You may not realize it, put people do not knowingly volunteer a "wrong" answer. If you don't like the answer, or have heard it before, keep it to yourself. You create a thread; expect different answers; deal with it (and this post).
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
-
SOLVED thanks to all contributions received from this forum. Much appreciated. The att6ached code is being posted here because it is C++ code and QT forum did not respond for over two weeks It is posted to seek a solution, not to receive bunch of social noise. If you have no knowledge of QT , PLEASE , keep it to yourself , no need to advertise it here . The code starts QProcess executes qterminal with -e option thus executing argument "bluetoothctl" After many trials, many RTFM and asking Mrs Google I am unable to pass an optional argument to "bluetoothctl", for example "help". I can manually input to the resulting "window", however, I cannot "write " to it using code. I suspect that my "write " code is accessing QProcess , not the qterminal... I am asking for help to solve this... please reply with solutions, I would greatly appreciate that. #ifdef TERMINAL_DEBUG { qDebug()<< Q_FUNC_INFO; processTERMINAL = new QProcess(); QString exec = "qterminal"; //params = QStringList() << "qterminal " << command; //params = QStringList() << "qterminal " << " -e" << " bluetoothctl "; // command; // no go QStringList params = QStringList() << "qterminal" << "-e" << "bluetoothctl" <<"help\n"; QStringList params = QStringList() << "qterminal" << "-e" << "bluetoothctl" ; // help\n"; processTERMINAL->start(exec, params); if(processTERMINAL->waitForStarted()) { qDebug() << " processTERMINAL->waitForStarted() OK"; qDebug() << processTERMINAL->readAllStandardError(); qDebug() << processTERMINAL->readAllStandardOutput(); processTERMINAL->open(); processTERMINAL->write(" help\n"); } return; } #endif
Member 14968771 wrote:
The att6ached code is being posted here because it is C++ code
No, it has nothing to do with C++, it is purely a QT/qterminal issue. And this is the C/C++ forum. In your code ...
QString exec = "qterminal";
QStringList params = QStringList() << "qterminal" << "-e" << "bluetoothctl" ; // help\n";
processTERMINAL->start(exec, params);... you are passing
"qterminal"
as the first parameter to"qterminal"
. So remove that field from yourparams
. And that is still not a C++ issue.