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
QtWS25 Last Chance

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 20 Nov 2020, 08:59 last edited by
    #1

    Hi,
    I want to assign the data shown on the Application Output screen in Qt creator to a variable as a string and keep it in that variable, but I couldn't find how to do it. On the output screen, I get the following information "can0 605 [8] 20 00 20 02 DD 00 00 00" I want to assign this data as a string in Qt creator. How can I do it ?

    J 1 Reply Last reply 20 Nov 2020, 09:01
    0
    • S safiye
      20 Nov 2020, 08:59

      Hi,
      I want to assign the data shown on the Application Output screen in Qt creator to a variable as a string and keep it in that variable, but I couldn't find how to do it. On the output screen, I get the following information "can0 605 [8] 20 00 20 02 DD 00 00 00" I want to assign this data as a string in Qt creator. How can I do it ?

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 20 Nov 2020, 09:01 last edited by
      #2

      @safiye QtCreator is an IDE. Please explain better what you want to do.
      Do you have an app which starts another one and you want to get the stdout from the second in the first one?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • S Offline
        S Offline
        safiye
        wrote on 20 Nov 2020, 09:54 last edited by
        #3

        @jsulm I want to assign the data I read from the can bus communication protocol to a variable in my study and then use that variable. Now, I can see the data I read with the Can-bus protocol on the Qt Application Output. I want to use the data I see here by assigning it to a variable in Qt creator.

        J J 2 Replies Last reply 20 Nov 2020, 10:12
        0
        • S safiye
          20 Nov 2020, 09:54

          @jsulm I want to assign the data I read from the can bus communication protocol to a variable in my study and then use that variable. Now, I can see the data I read with the Can-bus protocol on the Qt Application Output. I want to use the data I see here by assigning it to a variable in Qt creator.

          J Offline
          J Offline
          JonB
          wrote on 20 Nov 2020, 10:12 last edited by
          #4

          @safiye
          Start by running your app outside of Qt Creator. Do you still see that line of output? What is generating it where, and how is it being output. You'll need to know that before you can think about capturing it, if it's even possible....

          1 Reply Last reply
          1
          • S safiye
            20 Nov 2020, 09:54

            @jsulm I want to assign the data I read from the can bus communication protocol to a variable in my study and then use that variable. Now, I can see the data I read with the Can-bus protocol on the Qt Application Output. I want to use the data I see here by assigning it to a variable in Qt creator.

            J Offline
            J Offline
            jsulm
            Lifetime Qt Champion
            wrote on 20 Nov 2020, 10:22 last edited by jsulm
            #5

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

            I read from the can bus communication protocol

            If you're already reading it then what is the problem to put this data into a variable?
            Please show how you're reading this data.

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            3
            • 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 Offline
                  J Offline
                  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 Offline
                      J Offline
                      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 Offline
                              J Offline
                              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