Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Combining QProcess, qterminal and bluetoothctl...in C++ code

Combining QProcess, qterminal and bluetoothctl...in C++ code

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutoriallounge
5 Posts 2 Posters 10 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    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

    Mircea NeacsuM L 2 Replies Last reply
    0
    • L Lost User

      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

      Mircea NeacsuM Offline
      Mircea NeacsuM Offline
      Mircea Neacsu
      wrote on last edited by
      #2

      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

      L 1 Reply Last reply
      0
      • Mircea NeacsuM Mircea Neacsu

        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

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        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...

        L 1 Reply Last reply
        0
        • L Lost User

          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...

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          • L Lost User

            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

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            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 your params. And that is still not a C++ issue.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups