Hi, after a long time I found some time to start the rewrite of my script. There are a few questions remaining, though.
If I understood correctly, for a generic script I have to iterate over all existing connections (ListConnections). What I don't understand actually is how to get a relation between the connection settings object and an existing active connection object. Do I have to iterate over all active connections and find a matching uuid? Or do we have a simpler way to get to this relation/information? Thx. Bye. Michael. [...] >Hi, >sounds a bit like you want to perform some action when a particular >connection profile activates/deactivates. >First, you need to know which a connection profile you care about, that >is, you need its /org/freedesktop/NetworkManager/Settings/* path. >You need to call GetSettings() on each of the profiles, to match what >you are looking for (for example, matching the connection.id). >When a connection is activated, it has an active-connection that >references it. Usually there is at most one such active-connection, >but while re-activating a connection there can be multiple once (one >that is about to deactivate, and once that is about to activate). >Anyway, you need to monitor these active connections for whether they >reference the profile you care about. The Manager's PropertyChanged >event for ActiveConnections notifies you when active-connection come to >be and cease to exist. >The ActiveConnection basically ties the profile to the networking >device. >and as said, an active VPN connection is a bit odd, they are active- >connections too (with an additional >org.freedesktop.NetworkManager.VPN.Connection interface). >I would inspect the state with the "d-feet" GUI. >You could also use libnm via GObject introspection (e.g. from Perl or >Python). That might be more convenient to use, then a plain D-Bus >library (the latter works of course too). We don't have any perl >examples, only Python: >https://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/pyth >on >best, >Thomas -- Michael Hirmke _______________________________________________ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list