6 [DBus (name = "org.example.Test")]
7 interface Test : Object {
8 public abstract string[] test_property { owned get; set; }
10 public abstract int[] test_int (int[] i, out int[] j) throws IOError;
11 public abstract string[] test_string (string[] s, out string[] t) throws IOError;
16 Test test = Bus.get_proxy_sync (BusType.SESSION, "org.example.Test", "/org/example/test", DBusProxyFlags.DO_NOT_LOAD_PROPERTIES);
19 k = test.test_int ({ 42 }, out j);
20 assert (j.length == 1 && j[0] == 23);
21 assert (k.length == 1 && k[0] == 11);
24 u = test.test_string ({ "hello" }, out t);
25 assert (t.length == 1 && t[0] == "world");
26 assert (u.length == 1 && u[0] == "vala");
28 test.test_property = { "hello" };
29 t = test.test_property;
30 assert (t.length == 1 && t[0] == "hello");
35 [DBus (name = "org.example.Test")]
37 public string[] test_property { owned get; set; }
39 public int[] test_int (int[] i, out int[] j) {
40 assert (i.length == 1 && i[0] == 42);
45 public string[] test_string (string[] s, out string[] t) {
46 assert (s.length == 1 && s[0] == "hello");
54 void client_exit (Pid pid, int status) {
55 // client finished, terminate server
61 var conn = Bus.get_sync (BusType.SESSION);
62 conn.register_object ("/org/example/test", new Test ());
64 // try to register service in session bus
65 var request_result = conn.call_sync ("org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", "RequestName",
66 new Variant ("(su)", "org.example.Test", 0x4), null, 0, -1);
67 assert ((uint) request_result.get_child_value (0) == 1);
69 // server ready, spawn client
71 Process.spawn_async (null, { "test", "/dbus/arrays/client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
72 ChildWatch.add (client_pid, client_exit);
74 main_loop = new MainLoop ();