Interfacing with ModemManager

Aleksander Morgado aleksander at aleksander.es
Fri Sep 1 06:03:36 UTC 2017


Hey,

>
> I need to write a custom user process that can send connection requests/user
> actions to ModemManager and also receive status notifications from
> ModemManager such as change of connection status, signal statistics, etc.
>
> What inter-process communication interface does ModemManager provide in
> order to achieve this? Dbus messages or by directly using APIs?
>
> Will looking at Network Manager or mmcli source help understand how to
> communicate with MM?
>

ModemManager exposes a DBus interface. If you install the "d-feet"
program and look for ModemManager in the system bus you'll understand
clearly how the objects and interfaces exposed work. If you install
the "dbus-monitor" program and monitor for messages in the "system"
bus while using e.g. mmcli you'll see the DBus messages being
transferred.

Client applications all interface with DBus, but they may do it in
different ways. Some applications may want to use "raw" DBus proxies
and request/responses, while others use the "libmm-glib" library,
which provides a high level API that hides almost completely the usage
of DBus, see:
https://www.freedesktop.org/software/ModemManager/libmm-glib/1.6.0/

Using libmm-glib does NOT require your program to be in C. You can
write programs in any language supported by "GObject introspection
bindings"; and that includes e.g. Lua, Python or Javascript; see e.g.:
https://cgit.freedesktop.org/ModemManager/ModemManager/tree/examples/modem-watcher-python
https://cgit.freedesktop.org/ModemManager/ModemManager/tree/examples/modem-watcher-javascript

Of course, you can also write your program in C, and you can use mmcli
as an example of that:
https://cgit.freedesktop.org/ModemManager/ModemManager/tree/cli


-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list