Getting data from Qt creator Application Output and assigning it to a variable
-
@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.
-
@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.
Hi @safiye,
I think you should rather use Qt CAN Bus instead running command line programs and parsing their output.
Regards
-
@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.
@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.
-
Hi @safiye,
I think you should rather use Qt CAN Bus instead running command line programs and parsing their output.
Regards
-
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.
@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 theQProcess
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.... -
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.
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?
-
@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 theQProcess
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.... -
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?
-
@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. -