Taking data bearer technology string

Aleksander Morgado aleksander at aleksander.es
Fri May 15 16:12:12 UTC 2020

Hey Carla,

> Hi, I'm trying to make a C++ program (not a command line program like qmicli) which catches the result of commands like the qmicli command
> sudo qmicli -d /dev/cdc-wdm0 --wds-get-data-bearer-technology -p and is able to use it in a main (or another function), like as an if condition to make a decision, for example.
> Do you know what I mean? Until now, I was looking to the qmicli code and I'm currently able to see the result (the current technology) in the console (thanks to a gprint) when executing my C++ code (I'm getting the same result as if I were typing sudo qmicli -d /dev/cdc-wdm0 --wds-get-data-bearer-technology -p on the console) but I'm not being able to pass that result to my main in order to use it as an if condition, for example.

Does your program run a GLib main loop? All libqmi operations are
asynchronous, and therefore a GLib main loop needs to be running in
order to receive the responses. Once you have the response, it's up to
you how to pass it to your main application code. Assuming you want to
have "separate" logic for your C++ program and the GLib main loop, you
can always have a separate thread just for the GLib main loop and
libqmi bits, and if you do that, you would need usual thread sync
stuff to pass info between both threads.

Without looking at your code, it's hard to say how you want to do it.
If you post a simple "tester" of the problem, a simple C++ app showing
what the issue is, we may be able to help you better.



More information about the libqmi-devel mailing list