[libmm-glib] MM API usage and GLib

Aleksander Morgado aleksander at aleksander.es
Thu Jun 21 08:26:05 UTC 2018


> I am currently facing the implementation of a application which makes use of
> the libmm-glib high level API and I am facing some problems when I try to
> use this API in my C++ application.
> Until now in my C++ application I have been using Boost::Asio in order to
> manage asynchronous calls and keep the program alive while performing
> operations with io.run(). However, when I started using libmm-glib API I
> took a look at qmicli (which , if I am not wrong, it is an example of use of
> this API) and noticed that it makes use of Glib library.
> After making some tests I noticed that io.run() is totally incompatible with
> making async queries using g_main_loop_run() as they both launch a loop
> separately and I cant find a elegant and working solution to use both.
> Keeping in mind that I want to keep using asio to manage the operations in
> my application,
> - what could be the best way to make use of this API ? (threads,
> starting/exiting loop, ...)
> - has anyone faced the development of an application in which  Boost::asio
> and Glib interact ?

No idea how to sync Boost::asio and GLib main loops :) I know that the
GLib main loop may be extended with additional loops "scheduling" the
additional loop within the GLib main loop, but I don't know if
Boost::asio can do that easily... I  have used both things myself,
never together.
For C++ programs you could use Qt, as Qt reuses the GLib main loop, so
libmm-glib works out of the box. Or, even better, just use
ModemManagerQt... Have to say that writing lambdas in Qt5 for async
calls is extremely nice, even if I find the ModemManagerQt layer a bit
redundant (works on top of the libmm-glib library). I've worked with
ModemManagerQt in the past months and does the job for me.


More information about the ModemManager-devel mailing list