I mean - when I needed to do something like this in the past, what I did was 
something like:
sig_id = g_signal_connect(modem, "g-properties-changed", 
G_CALLBACK(my_mm_showchanges_on_modem_signal), NULL);

And then my handler was something like:
static void my_mm_showchanges_on_modem_signal(MMModem *modem, GVariant 
*changed_props, GStrv inv_props, gpointer user_data) {
        ...
}

Is this the proper way to go? and what might I do now? Fetch the list from my 
MMModem or can I use the GVariant data somehow?

Thanks a lot!

On Mon, 4 Oct 2021, Aleksander Morgado wrote:

Date: Mon, 4 Oct 2021 12:31:14
From: Aleksander Morgado <aleksan...@aleksander.es>
To: Enrico Mioso <mrkiko...@gmail.com>
Cc: "ModemManager (development)" <modemmanager-devel@lists.freedesktop.org>
Subject: Re: GSignals for bearers addition/removal

Hey!

I see there is no documented GSignals for bearers addition/removal.
I understand I probably should get the bearers list and connect 
object-{added,removed} GSignals to it. But I would like to see some code 
snippets, to know the proper prototypes for the handlers.


We have the "Bearers" property in the Modem interface:
https://www.freedesktop.org/software/ModemManager/doc/latest/ModemManager/gdbus-org.freedesktop.ModemManager1.Modem.html#gdbus-property-org-freedesktop-ModemManager1-Modem.Bearers

If you're using raw processing of DBus, you'll need to listen for
org.freedesktop.DBus.Properties.PropertiesChanged signals emitted, and
monitor for the "Bearers" property being updated:

             org.freedesktop.DBus.Properties.PropertiesChanged
(STRING interface_name,

DICT<STRING,VARIANT> changed_properties,

ARRAY<STRING> invalidated_properties);

But doing all this manually is a lot of work really; libmm-glib
abstracts all this nicely and is much easier to use...

--
Aleksander
https://aleksander.es

Reply via email to