[libmm-glib] MM API usage and GLib

Colin Helliwell colin.helliwell at ln-systems.com
Thu Jul 26 16:08:14 UTC 2018


Apologies for hijacking the thread, but I also have a need to write a C++ app to access certain MM 'status' info (IMIE, signal strength, etc).
I can shell out to mmcli and awk/parse the response, but lib-based coding would probably be more 'correct'. I was struggling though to get to grips with how to use the MM/Glib APIs - are there any examples anywhere which will show me how to get started in connecting and then drilling down through the objects...?
Thanks

> 2018-06-21 10:26 GMT+02:00 Aleksander Morgado <aleksander at aleksander.es>: 
> 
> > Hey, 
> >  
> > > 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