]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
dbus-glib-1: bind more lowlevel (raw) dbus entities from libdbus
authorMichael 'Mickey' Lauer <mickey@vanille-media.de>
Mon, 1 Feb 2010 23:14:33 +0000 (00:14 +0100)
committerMichael 'Mickey' Lauer <mickey@vanille-media.de>
Mon, 1 Feb 2010 23:21:04 +0000 (00:21 +0100)
This allows us to do more advanced things such as constructing
or inspecting method calls part by part.

vapi/dbus-glib-1.vapi

index 92704111cd200320dfe059bd6cdc4c1a14c5801d..b0de83354b902e23af79f19502965451cfb0b425 100644 (file)
@@ -1,6 +1,6 @@
 /* dbus-glib-1.vala
  *
- * Copyright (C) 2007-2009  Jürg Billeter
+ * Copyright (C) 2007-2010  Jürg Billeter
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -18,6 +18,7 @@
  *
  * Author:
  *     Jürg Billeter <j@bitron.ch>
+ *  Michael 'Mickey' Lauer <mlauer@vanille-media.de>
  */
 
 [CCode (cheader_filename = "dbus/dbus-glib-lowlevel.h,dbus/dbus-glib.h")]
@@ -29,12 +30,12 @@ namespace DBus {
                STARTER
        }
 
+       [CCode (lower_case_cprefix = "dbus_bus_")]
        namespace RawBus {
-               [CCode (cname = "dbus_bus_get")]
                public static RawConnection get (BusType type, ref RawError error);
        }
 
-       [CCode (ref_function = "dbus_connection_ref", unref_function = "dbus_connection_unref", cname = "DBusConnection")]
+       [CCode (ref_function = "dbus_connection_ref", unref_function = "dbus_connection_unref", cname = "DBusConnection", cprefix = "dbus_connection_")]
        public class RawConnection {
                [CCode (cname = "dbus_connection_setup_with_g_main")]
                public void setup_with_main (GLib.MainContext? context = null);
@@ -42,6 +43,17 @@ namespace DBus {
                public Connection get_g_connection ();
                [CCode (cname = "dbus_connection_register_g_object")]
                public void register_object (string at_path, GLib.Object object);
+
+               public bool send (RawMessage message, uint32 client_serial);
+               public RawMessage send_with_reply_and_block (RawMessage message, int timeout_milliseconds, ref RawError error);
+
+               public bool add_filter (RawHandleMessageFunction function, RawFreeFunction? free_data_function = null);
+               public void remove_filter (RawHandleMessageFunction function);
+
+               [CCode (cname = "dbus_bus_add_match")]
+               public void add_match (string rule, ref RawError error);
+               [CCode (cname = "dbus_bus_remove_match")]
+               public void remove_match (string rule, ref RawError error);
        }
 
        [CCode (cname = "DBusError", cprefix = "dbus_error_", destroy_function = "dbus_error_free")]
@@ -54,6 +66,107 @@ namespace DBus {
                public bool is_set ();
        }
 
+       [CCode (cname = "DBusFreeFunction", has_target = false)]
+       public delegate void* RawFreeFunction (void* memory);
+       [CCode (cname = "DBusHandleMessageFunction", instance_pos = -1)]
+       public delegate RawHandlerResult RawHandleMessageFunction(RawConnection connection, RawMessage message);
+
+       [CCode (cname = "DBusHandlerResult", cprefix = "DBUS_HANDLER_RESULT_")]
+       public enum RawHandlerResult {
+               HANDLED,
+               NOT_YET_HANDLED,
+               NEED_MEMORY
+       }
+
+       [CCode (cname = "DBusMessageIter", cprefix = "dbus_message_iter_")]
+       public struct RawMessageIter {
+               public bool has_next ();
+               public bool next ();
+               public string get_signature ();
+               public int get_arg_type ();
+               public int get_element_type ();
+               public void recurse (RawMessageIter sub);
+               public void get_basic (void* value);
+
+               [CCode (cname = "dbus_message_type_from_string")]
+               public static int type_from_string (string type);
+               [CCode (cname = "dbus_message_type_to_string")]
+               public static string type_to_string (int type);
+       }
+
+       [CCode (ref_function = "dbus_message_ref", unref_function = "dbus_message_unref", cname = "DBusMessage", cprefix = "dbus_message_")]
+       public class RawMessage {
+               [CCode (cname = "dbus_message_new_method_call")]
+               public RawMessage.call (string bus_name, string path, string interface, string method);
+               [CCode (sentinel = "DBUS_TYPE_INVALID")]
+               public bool append_args (RawType first_arg_type, ...);
+               [CCode (cname = "dbus_message_iter_init")]
+               public bool iter_init( RawMessageIter iter );
+
+               public RawMessageType get_type ();
+               public bool   set_path (string object_path);
+               public unowned string get_path ();
+               public bool   has_path (string object_path);
+               public bool   set_interface (string iface);
+               public unowned string get_interface ();
+               public bool   has_interface (string iface);
+               public bool   set_member (string member);
+               public unowned string get_member ();
+               public bool   has_member (string member);
+               public bool   set_error_name (string name);
+               public unowned string get_error_name ();
+               public bool   set_destination (string destination);
+               public unowned string get_destination ();
+               public bool   set_sender (string sender);
+               public unowned string get_sender ();
+               public unowned string get_signature ();
+               public void   set_no_reply (bool no_reply);
+               public bool   get_no_reply ();
+               public bool   is_method_call (string iface, string method);
+               public bool   is_signal (string iface, string signal_name);
+               public bool   is_error (string error_name);
+               public bool   has_destination (string bus_name);
+               public bool   has_sender (string unique_bus_name);
+               public bool   has_signature (string signature);
+               public uint32 get_serial ();
+               public void   set_serial (uint32 serial);
+               public bool   set_reply_serial (uint32 reply_serial);
+               public uint32 get_reply_serial ();
+               public void   set_auto_start (bool auto_start);
+               public bool   get_auto_start ();
+               public bool   get_path_decomposed (out char[] path );
+       }
+
+       [CCode (cprefix = "DBUS_MESSAGE_TYPE_")]
+       public enum RawMessageType {
+               INVALID,
+               METHOD_CALL,
+               METHOD_RETURN,
+               ERROR,
+               SIGNAL
+       }
+
+       [CCode (cprefix = "DBUS_TYPE_")]
+       public enum RawType {
+               INVALID,
+               BYTE,
+               BOOLEAN,
+               INT16,
+               UINT16,
+               INT32,
+               UINT32,
+               INT64,
+               UINT64,
+               DOUBLE,
+               STRING,
+               OBJECT_PATH,
+               SIGNATURE,
+               ARRAY,
+               VARIANT,
+               STRUCT,
+               DICT_ENTRY,
+       }
+
        [DBus (name = "org.freedesktop.DBus.Error")]
        [CCode (cname = "DBusGError", lower_case_csuffix = "gerror", cprefix = "DBUS_GERROR_")]
        public errordomain Error {