On Wed, 2008-05-14 at 08:49 -0700, Andy Severin wrote: > Hi All. > Can somebody explain to newbie how can I force connection to the specified > AP? I am trying to create python applet. > I connected to NM via DBUS can list the devices but have no idea how to > create connection. The NM has ActivateConnection API but what the parameters > it requires is mystery for me. Thanks.
Something needs to provide the pre-defined connections first. Both the existing applet and the system settings service provide connections to NetworkManager. It's not enough to just tell NM to activate a connection, you have to actually tell NM about that connection too, so NM knows the details of how you want to connect, what you want to connect, what passwords it might need, etc. Your applet needs to provide the org.freedesktop.NetworkManagerUserSettings service, exporting the org.freedesktop.NetworkManagerSettings interface. See introspection/nm-settings.xml and introspection/nm-exported-connection.xml for what these interfaces actually are. Each settings service will also export a list of exported connections, which you need to figure out how to store somewhere. A connection is essentially a dictionary of Setting objects (which are themselves dictionaries) which maps pretty well to python's dict type. See: http://live.gnome.org/NetworkManagerConfigurationSpecification for an idea about how connections are organized conceptually. For the ActivateConnection call, you pass: service_name: the service name of the settings service from which NM gets the connection object; this will be either org.freedesktop.NetworkManagerSystemSettings or org.freedesktop.NetworkManagerUserSettings. connection: the object path of the connection you'd like to activate, which is exported by the service named in the service_name argument device: the object path of the device (as exported by NetworkManager) that you'd like to the connection to activated on specific_object: some connection types take additional information; you pass an additional object that the connection should apply to here. For Wifi connections, that is the object path of the specific access point you'd like to connect to, as exported by NetworkManager. This call returns the object path of an active connection object which you can use to track the state of your ActivateConnection request through until it either fails, or succeeds. This object path will also show up in the ActiveConnections property of the /org/freedesktop/NetworkManager object (described by introspection/nm-manager.xml) Dan _______________________________________________ NetworkManager-list mailing list NetworkManager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list