[Vala] Help with Variant and DBus



Hi all!

Playing with dbus-monitor I've seen this signal :

   signal sender=:1.7 -> dest=(null destination) serial=169
   path=/org/freedesktop/NetworkManagerSettings/0;
   interface=org.freedesktop.NetworkManagerSettings.Connection;
   member=Updated
       array [
          dict entry(
             string "connection"
             array [
                dict entry(
                   string "id"
                   variant                   string "Auto eth0"
                )
                dict entry(
                   string "uuid"
                   variant                   string
   "f6976041-699f-40c1-b0e2-b114ab865fc0"
                )
                dict entry(
                   string "timestamp"
                   variant                   uint64 1310334701
                )
                dict entry(
                   string "type"
                   variant                   string "802-3-ethernet"
                )
             ]
          )
          dict entry(
             string "802-3-ethernet"
             array [
                dict entry(
                   string "s390-options"
                   variant                   array [
                      ]
                )
                dict entry(
                   string "mac-address"
                   variant                   array of bytes "TBIyVj"
                )
             ]
          )
       ]


Now I'm trying to send a signal with the same format using vala, but I'm really getting crazy. One of my last attempts:

                            var vb1 = new VariantBuilder
   (VariantType.ARRAY);
                            vb1.add ("{sv}","id",  new Variant ("s",
"Auto eth0"
                                                                       ));
                            vb1.add ("{sv}","uuid",  new Variant ("s",
"f6976041-699f-40c1-b0e2-b114ab865fc0"
                                                                       ));
                            vb1.add ("{sv}","timestamp",  new Variant ("u",
1310334701
                                                                       ));
                            vb1.add ("{sv}","type",  new Variant ("s",
"802-3-ethernet"
                                                                       ));

                            var vb2 = new VariantBuilder
   (VariantType.ARRAY);
   vb2.add ("{sa{sv}}","connection",  vb1);// Also tried vb2.add
   ("{sa}","connection",  vb1);

                            newSignal (new Variant ("(sa{sa{sv})",
                                               "This is just a test",
                                               vb2));

Any example code would be very appreciated,
Borja R.




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