Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt embedded console commands request and reply
QtWS25 Last Chance

Qt embedded console commands request and reply

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 3.9k Views
  • 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.
  • B Offline
    B Offline
    bluscape
    wrote on last edited by
    #1

    I'm using Qt embedded on linux.
    From the console (serial console) I use the following command to get status on my ppp:

    /etc/rc.d/S09pppd status

    The ppp will reply with "pppd running" or "pppd not running"

    I would like to execute this request from my Qt application and read the reply from my Qt application.

    How can I do this?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      bluscape
      wrote on last edited by
      #2

      So I execute the command with a QProcess for example:

      @QProcess qpCommand;

      qpCommand.execute("/etc/rc.d/S09pppd status");@

      which is creating the desired effect.

      Now how do I read the response?

      1 Reply Last reply
      0
      • B Offline
        B Offline
        Blizzard
        wrote on last edited by
        #3

        @qpCommand.readData(char * data, qint64 maxlen)@

        Software Engineer | Aerospace & Defence

        1 Reply Last reply
        0
        • B Offline
          B Offline
          bluscape
          wrote on last edited by
          #4

          But readData is a protected function?

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goetz
            wrote on last edited by
            #5

            QProcess::execute() is a static method. It does not return any output of the started command/executable. You will have to use the non-static methods in order to ready any data.

            @
            QProcess p;
            p.start("/etc/rc.d/S09pppd status");
            p.waitForFinished(); // blocks!
            QByteArray output = p.readAllStandardOutput();
            @

            http://www.catb.org/~esr/faqs/smart-questions.html

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved