Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Turkish
  4. Getting data from Qt creator Application Output and assigning it to a variable

Getting data from Qt creator Application Output and assigning it to a variable

Scheduled Pinned Locked Moved Unsolved Turkish
15 Posts 5 Posters 2.4k 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.
  • S Offline
    S Offline
    safiye
    wrote on 21 Nov 2020, 12:14 last edited by safiye
    #6

    @jsulm and @JonB I am sending a hexadecimal code with the startDetached function in the code I have prepared in Qt Creator. In response to the code I send, the can-bus protocol sends me a response code (in hexedecimal form). I can only see the hexadecimal response the can-bus sent me in the Qt output. This hex I see in the output section. I want to assign the answer code to a value and use it in my Qt code that I have prepared.

    I am sending hexadecimal codes with ID 605 in Applicaiton Output section. In response, Can-bus ID is sending me the 585 hexadecimal codes. I want to assign and use hexadecimal codes with an ID of 585 to a value.

    hexkode.jpeg

    A J 2 Replies Last reply 21 Nov 2020, 12:18
    0
    • S safiye
      21 Nov 2020, 12:14

      @jsulm and @JonB I am sending a hexadecimal code with the startDetached function in the code I have prepared in Qt Creator. In response to the code I send, the can-bus protocol sends me a response code (in hexedecimal form). I can only see the hexadecimal response the can-bus sent me in the Qt output. This hex I see in the output section. I want to assign the answer code to a value and use it in my Qt code that I have prepared.

      I am sending hexadecimal codes with ID 605 in Applicaiton Output section. In response, Can-bus ID is sending me the 585 hexadecimal codes. I want to assign and use hexadecimal codes with an ID of 585 to a value.

      hexkode.jpeg

      A Offline
      A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on 21 Nov 2020, 12:18 last edited by
      #7

      Hi @safiye,

      I think you should rather use Qt CAN Bus instead running command line programs and parsing their output.

      Regards

      Qt has to stay free or it will die.

      S 1 Reply Last reply 21 Nov 2020, 12:26
      2
      • S safiye
        21 Nov 2020, 12:14

        @jsulm and @JonB I am sending a hexadecimal code with the startDetached function in the code I have prepared in Qt Creator. In response to the code I send, the can-bus protocol sends me a response code (in hexedecimal form). I can only see the hexadecimal response the can-bus sent me in the Qt output. This hex I see in the output section. I want to assign the answer code to a value and use it in my Qt code that I have prepared.

        I am sending hexadecimal codes with ID 605 in Applicaiton Output section. In response, Can-bus ID is sending me the 585 hexadecimal codes. I want to assign and use hexadecimal codes with an ID of 585 to a value.

        hexkode.jpeg

        J Online
        J Online
        JonB
        wrote on 21 Nov 2020, 12:23 last edited by
        #8

        @safiye said in Getting data from Qt creator Application Output and assigning it to a variable:

        the can-bus protocol sends me a response code (in hexedecimal form). I can only see the hexadecimal response the can-bus sent me in the Qt output. This hex I see in the output section.

        In that case it is not sending you anything. Rather, it is probably writing something to stdout, and you happen to see that in Creator's Output Window.

        If you have to do it this way you would have to capture that output from the command, parse and act on it.

        If @aha_1980 has said you can access some CAN API directly from Qt then presumably that is the correct/better way to go to access the data you want than running an external program and parsing its output, but I know nothing about CAN Bus.

        1 Reply Last reply
        2
        • A aha_1980
          21 Nov 2020, 12:18

          Hi @safiye,

          I think you should rather use Qt CAN Bus instead running command line programs and parsing their output.

          Regards

          S Offline
          S Offline
          safiye
          wrote on 21 Nov 2020, 12:26 last edited by
          #9

          Hi @aha_1980 do you think I cannot use the hexadecimal responses from the output screen to a variable in another way? Because I couldn't achieve this with Qt Can Bus.

          J A 2 Replies Last reply 21 Nov 2020, 12:28
          0
          • S safiye
            21 Nov 2020, 12:26

            Hi @aha_1980 do you think I cannot use the hexadecimal responses from the output screen to a variable in another way? Because I couldn't achieve this with Qt Can Bus.

            J Online
            J Online
            JonB
            wrote on 21 Nov 2020, 12:28 last edited by
            #10

            @safiye
            Any reason to ignore what I said? If you really have to run an external command, and that writes to stdout, and you want to access that, you have to use the QProcess methods to read that output. @aha_1980 is not a magician and won't be able to make it otherwise if you are not calling a CAN API but doing it via an OS command....

            S 1 Reply Last reply 21 Nov 2020, 12:44
            2
            • S safiye
              21 Nov 2020, 12:26

              Hi @aha_1980 do you think I cannot use the hexadecimal responses from the output screen to a variable in another way? Because I couldn't achieve this with Qt Can Bus.

              A Offline
              A Offline
              aha_1980
              Lifetime Qt Champion
              wrote on 21 Nov 2020, 12:31 last edited by
              #11

              @safiye

              Hi @aha_1980 do you think I cannot use the hexadecimal responses from the output screen to a variable in another way?

              Both will work, but using an API is the cleaner way.

              Because I couldn't achieve this with Qt Can Bus.

              Well, than it would be helpful if you state what you did and what exactly did not work.

              Have you already tried the example?

              Qt has to stay free or it will die.

              S 1 Reply Last reply 21 Nov 2020, 12:55
              3
              • J JonB
                21 Nov 2020, 12:28

                @safiye
                Any reason to ignore what I said? If you really have to run an external command, and that writes to stdout, and you want to access that, you have to use the QProcess methods to read that output. @aha_1980 is not a magician and won't be able to make it otherwise if you are not calling a CAN API but doing it via an OS command....

                S Offline
                S Offline
                safiye
                wrote on 21 Nov 2020, 12:44 last edited by
                #12

                Thank you @JonB. I will also review and try the Qprocess methods.

                J 1 Reply Last reply 21 Nov 2020, 13:01
                0
                • A aha_1980
                  21 Nov 2020, 12:31

                  @safiye

                  Hi @aha_1980 do you think I cannot use the hexadecimal responses from the output screen to a variable in another way?

                  Both will work, but using an API is the cleaner way.

                  Because I couldn't achieve this with Qt Can Bus.

                  Well, than it would be helpful if you state what you did and what exactly did not work.

                  Have you already tried the example?

                  S Offline
                  S Offline
                  safiye
                  wrote on 21 Nov 2020, 12:55 last edited by
                  #13

                  @aha_1980

                  In my work with Qt Can Bus, I first wanted to create socketcan using these, but I got 'Not avaliable "socketcan"' error and could not create socketcan. I am using version 5.11 of Qt. Do you think using this version of Qt could cause a problem ?

                  Y 1 Reply Last reply 30 Jul 2021, 02:24
                  0
                  • S safiye
                    21 Nov 2020, 12:44

                    Thank you @JonB. I will also review and try the Qprocess methods.

                    J Online
                    J Online
                    JonB
                    wrote on 21 Nov 2020, 13:01 last edited by
                    #14

                    @safiye said in Getting data from Qt creator Application Output and assigning it to a variable:

                    Thank you @JonB. I will also review and try the Qprocess methods.

                    Just to say: if you have to use QProcess you will have to do that. But I am sure you really do not want to do it this way, you ought be getting the API working as @aha_1980 is saying.

                    1 Reply Last reply
                    1
                    • S safiye
                      21 Nov 2020, 12:55

                      @aha_1980

                      In my work with Qt Can Bus, I first wanted to create socketcan using these, but I got 'Not avaliable "socketcan"' error and could not create socketcan. I am using version 5.11 of Qt. Do you think using this version of Qt could cause a problem ?

                      Y Offline
                      Y Offline
                      Yenii
                      wrote on 30 Jul 2021, 02:24 last edited by
                      #15

                      @safiye hola, es un tema viejo pero puede servirle a alguien, cuando instalas qcanbus no siempre viene con los plugins para que se puedan identificar, tienes que instalar la misma libretia pero con el "-plugins" al final.

                      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