Re: signal for interface up/down



Hi Dan,

[...]
Yes, but what I need is to listen for every connection/device
becoming
active or inactive. So I would have to find out, what devices are
present, then listen to the appropriate signals for *each* of them?

Correct.  But in reality you can just watch for all signals coming out
of NetworkManager.  You'd match on the signal (member) name
"StateChanged", and look for object paths starting with
"/org/freedesktop/NetworkManager/Devices/" and an interface of
"org.freedesktop.NetworkManager.Device".

The Device.StateChanged signal arguments are documented in the NM D-Bus
API; they are new-state (uint), old-state (uint), and reason (uint).

So once you know you've got a device state change signal, you can read
the new-state argument and you'll know when the device is activated or
deactivated.

This all makes it seem more complicated than it is.  In reality you're
just listening for NetworkManager messages of type SIGNAL, checking a
couple standard message attributes (interface, object path, and member
name), and then reading one uint from the message data.

ok, I'll do my very best :))
Hopefully I'll find a way to listen to all signals coming out of
NetworkManager, because I use perl::DBus - and it seems to be a bit
limited regarding this problem.
Thx a lot for your hints!

Dan

Bye.
Michael.
-- 
Michael Hirmke


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]