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 safiye

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

    jsulmJ Online
    jsulmJ Online
    jsulm
    Lifetime Qt Champion
    wrote on 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 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

      aha_1980A JonBJ 2 Replies Last reply
      0
      • S safiye

        @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

        aha_1980A Offline
        aha_1980A Offline
        aha_1980
        Lifetime Qt Champion
        wrote on 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
        2
        • S safiye

          @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

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on 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
          • aha_1980A aha_1980

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

            JonBJ aha_1980A 2 Replies Last reply
            0
            • S safiye

              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.

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on 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
              2
              • S safiye

                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.

                aha_1980A Offline
                aha_1980A Offline
                aha_1980
                Lifetime Qt Champion
                wrote on 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
                3
                • JonBJ JonB

                  @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 last edited by
                  #12

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

                  JonBJ 1 Reply Last reply
                  0
                  • aha_1980A aha_1980

                    @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 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
                    0
                    • S safiye

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

                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote on 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

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