Re: nminfotest.c for NM-0.7



On Thu, 2008-04-03 at 11:49 +0800, alex z wrote:
> Dear All,
> 
> NM-0.7 is running on my device and I can use nm-tool to find AP list.
> But I want a little test program to let NM connecting to a specified
> AP. In NM-0.6.x, I can use nminfotest.c, is there any demo can do that
> in NM-0.7?

First you need a settings service to provide the connection information
about your AP to NetworkManager.  Then you can poke NetworkManager to
activate that connection using dbus-send or python if you like.

The system settings daemon provides the system settings service, but you
probably don't have a plugin written for your platform (Fedora and SUSE
have plugins so far).

The gnome applet 'nm-applet' provides the user settings service in GNOME
environments, and knetworkmanager would provide the user settings
service in KDE environments.

> If no, how can I complete the following codes to make it work?
> 
> connection = ???
> int is_system = 1;
> const char* specific_object = "myessid";

The specific object for wireless connections is the dbus-object path of
the BSS you initially want to connect to, as returned by calling the
GetAccessPoints() method of a wireless device.  Filter that list on SSID
for the SSID you care about, then send it's object path to NM as the
specific_object when activating a connection.

> nm_client = nm_client_new ();
> devices = nm_client_get_devices (client);
> char *con_path = g_strdup (nm_connection_get_path (connection));

A connection is uniquely identified by the settings service which
provides it, and the connection's object path as exported by that
settings service.  When activating a connection, you pass both to
NetworkManager so that it knows which specific connection to activate.

Dan

> nm_client_activate_connection (nm_client,
>                                    is_system ?
> NM_DBUS_SERVICE_SYSTEM_SETTINGS : NM_DBUS_SERVICE_USER_SETTINGS,
>                                    con_path,
>                                    device,
>                                    specific_object,
>                                    activate_device_cb,
>                                    user_data);
> 
> Thanks for your help!
> 
> Alex
> _______________________________________________
> NetworkManager-list mailing list
> NetworkManager-list gnome org
> http://mail.gnome.org/mailman/listinfo/networkmanager-list



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