Goog point I'm going to try it.
Thanks

2011/10/1 JM <[email protected]>

> I recommend using dbus-monitor from one terminal and start your program
> from a second. Then (after your program crashed) stop dbus-monitor and
> find the message sent by your program and check if the containing data
> was packaged according to the specification of NetworkManager.
> regards
>
>
> > Hi,
> >
> > I'm trying to create a new wifi connection by d-bus but I get
> "Segmentation
> > fault" with following code. What am I doing wrong?
> > Vala version: 0.13.4.6-33e1
> > Thanks,
> >
> > /*
> > valac --pkg gio-2.0 create.vala
> > */
> >
> > [DBus (name = "org.freedesktop.NetworkManagerSettings")]
> > interface NMSettings : Object {
> >     public abstract ObjectPath AddConnection (HashTable<string,
> > HashTable<string,Variant>> hs) throws IOError;
> > }
> >
> > int main (string[] args) {
> >
> > var uuid = "cabfaf9e-4043-4afb-8506-0e6f4a225636";
> >
> > HashTable<string,Variant> s_con = new HashTable<string,Variant>(str_hash,
> > str_equal);
> > s_con.insert("id", new Variant.string("My AdHoc"));
> > s_con.insert("uuid", new Variant.string(uuid));
> > s_con.insert("type", new Variant.string("802-11-wireless"));
> > s_con.insert("name", new Variant.string("connection"));
> > s_con.insert("autoconnect", new Variant.boolean(false));
> >
> > HashTable<string,Variant> s_wifi = new
> HashTable<string,Variant>(str_hash,
> > str_equal);
> > s_wifi.insert("ssid", new Variant.bytestring("foobar"));
> > s_wifi.insert("mode", new Variant.string("adhoc"));
> > s_wifi.insert("security", new
> Variant.string("802-11-wireless-security"));
> > s_wifi.insert("name", new Variant.string("802-11-wireless"));
> >
> > HashTable<string,Variant> s_wsec = new
> HashTable<string,Variant>(str_hash,
> > str_equal);
> > s_wsec.insert("key-mgmt", new Variant.string("none"));
> > s_wsec.insert("wep-key0", new
> Variant.string("0123456789abcdef0123456789"));
> > s_wsec.insert("name", new Variant.string("802-11-wireless-security"));
> >
> > HashTable<string,Variant> s_ip4 = new HashTable<string,Variant>(str_hash,
> > str_equal);
> > s_ip4.insert("method", new Variant.string("link-local"));
> > s_ip4.insert("name", new Variant.string("ipv4"));
> >
> > HashTable<string, HashTable<string,Variant>> con = new HashTable<string,
> > HashTable<string,Variant>>(str_hash, str_equal);
> > con.insert("connection", s_con);
> > con.insert("802-11-wireless", s_wifi);
> > con.insert("802-11-wireless-security", s_wsec);
> > con.insert("ipv4", s_ip4);
> >
> >     try {
> >
> >         NMSettings nm_set = Bus.get_proxy_sync (BusType.SYSTEM,
> > "org.freedesktop.NetworkManagerSystemSettings",
> > "/org/freedesktop/NetworkManagerSettings");
> >  var obj_path = nm_set.AddConnection(con);
> >
> >     } catch (IOError e) {
> >         stderr.printf ("%s\n", e.message);
> >         return 1;
> >     }
> >
> >     return 0;
> > }
> > _______________________________________________
> > vala-list mailing list
> > [email protected]
> > http://mail.gnome.org/mailman/listinfo/vala-list
>
>
> _______________________________________________
> vala-list mailing list
> [email protected]
> http://mail.gnome.org/mailman/listinfo/vala-list
>
_______________________________________________
vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to