Re: How to get notified about SSID changes with the 0.7 D-Bus API



On Thu, 2008-11-13 at 20:11 +0100, Thomas Perl wrote:
> Hello there!
> 
> NetworkManager 0.7 broke compatibility with the D-Bus API of the 
> previous NetworkManager versions. I could not find the documentation for 
> getting notified about network state changes (i.e. connected to a 
> wireless access point), so can someone point me to example code for 
> monitoring the NetworkManager service for connection changes and get the 
> SSID of the currently-connected Wireless access point? I'm using this 
> information on my program to run certain actions based on which access 
> point SSID I'm connected to.

You can take a look at the D-Bus API, the latest documentation of which
is here:

http://people.redhat.com/dcbw/NetworkManager/spec.html

The basic API for overall NM state has been preserved.  You can use the
"state" method call (just like 0.6) on
the /org/freedesktop/NetworkManager object to get the
"connected"/"connecting"/"disconnected" state of NetworkManager, which
is what almost all apps were using.  If that is broken, then it's a bug.

If you want to get per-device state, you can use the "GetDevices" method
call on the /org/freedesktop/NetworkManager object.

However, I would recommend using the ActiveConnections property of
the /org/freedesktop/NetworkManager instead, which is the preferred
interface for finding out network status on a per-connection level.  The
ActiveConnections property is an array of active connection object
paths, each of which has status (because you can have more than one
active connection at a time).  Each ActiveConnection object will also
give you a list of Device objects that are part of that connection, and
the service name and object path of the connection so you can retrieve
the full connection details.

If you can say a bit more about exactly what you want to do, I can
suggest more exactly how to do it :)

Dan




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