[Dextrose] NetworkManager API (was: Re: Some learning)
Sascha Silbe
silbe at activitycentral.com
Tue Mar 6 17:36:44 EST 2012
Excerpts from Ajay Garg's message of 2012-03-03 04:46:33 +0100:
> I have written a very basic python program, that utilizes Networkmanager
> dbus-apis, to detect addition/removal of network devices.
> It's working as expected, when I insert a 3G USB modem (both addition and
> removal callbacks are hit as expected).
>
> However, when I try this with
>
> a. Inserting/Removing a wired network jack
> b. Enable/Disable Wireless from the Dell Keyboard
> c. On/Off the wireless modem-cum-router-cum-accesspoint
>
> neither of the callbacks is hit.
Yes, that's expected. The signals you connect to are for network
_hardware_ (dis)appearing.
a) is just making a new (wired) network on the existing wired ethernet
interface available. NM will usually connect automatically to this
new network ASAP.
b) depends on how its implemented in hardware. On the XO-1, it would
power down the wireless network module completely, causing it to drop
off from USB and thus really cause a DeviceRemoved / DeviceAdded
signal. On most systems, only the radio gets disabled, so the device
will stay visible.
c) is just making a wireless network (un)available. Depending on
settings, NM may or may not try to connect to it automatically. In
any case there's no hardware that (dis)appears, just a network
(Basic Service Set (BSS) in IEEE 802.11-speak).
If you want to see NM connecting to networks, you can either listen to
the StateChanged signal on each device (to see when/if you're connected)
or monitor [1] the (global) ActiveConnections property (which gives you
a list of object paths of the active connection objects [2] that you can
examine further).
Sascha
[1] http://projects.gnome.org/NetworkManager/developers/spec-08.html#org.freedesktop.NetworkManager.PropertiesChanged
[2] http://projects.gnome.org/NetworkManager/developers/spec-08.html#org.freedesktop.NetworkManager.Connection.Active
--
http://sascha.silbe.org/
http://www.infra-silbe.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://lists.sugarlabs.org/archive/dextrose/attachments/20120306/a74ae814/attachment.pgp>
More information about the Dextrose
mailing list