I'm creating a console application which needs to be able to identify and to
connect to wireless access points.

So far I have been able to scan and parse the access point I wish to connect
to but I'm having trouble understanding how to actually connect to it now.
>From reading the source for the applet I have been able to come up with
this:

    s_wireless = (NMSettingWireless *)nm_setting_wireless_new ();
    ap_ssid = nm_access_point_get_ssid(ap);

    g_object_set(s_wireless, NM_SETTING_WIRELESS_SSID, ap_ssid, NULL);
    g_object_set(s_wireless, NM_SETTING_WIRELESS_MODE, "infrastructure",
NULL);

    connection = nm_connection_new();
    nm_connection_add_setting(connection, NM_SETTING(s_wireless));

    s_con = NM_SETTING_CONNECTION(nm_setting_connection_new());
    g_object_set(s_con,
                       NM_SETTING_CONNECTION_TYPE,
                       nm_setting_get_name(NM_SETTING(s_wireless)),
                       NULL);

    nm_connection_add_setting(connection, NM_SETTING(s_con));
    specific_object = nm_object_get_path (NM_OBJECT(ap));

    g_assert(connection);
    con_path = nm_connection_get_path(connection);
    g_assert(con_path); /* FAILS HERE */

    nm_client_activate_connection(app->priv->client,
                                  NM_DBUS_SERVICE_USER_SETTINGS,
                                  con_path,
                                  device,
                                  specific_object,
                                  activate_connection_cb,
                                  app);

After I filter and select the access point (unencrypted) that i want to
connect to I'm unable to get the path of the NMConnection I have created.
The nm-applet is not running.

Thanks
_______________________________________________
NetworkManager-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/networkmanager-list

Reply via email to