00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef DBUS_GLIB_H
00025 #define DBUS_GLIB_H
00026
00027 #include <glib-object.h>
00028 #include <dbus/dbus-shared.h>
00029
00030 G_BEGIN_DECLS
00031
00032 #define DBUS_INSIDE_DBUS_GLIB_H 1
00033
00034
00038 typedef struct _DBusGConnection DBusGConnection;
00042 typedef struct _DBusGMessage DBusGMessage;
00043
00044
00045 #define DBUS_TYPE_G_CONNECTION (dbus_g_connection_get_g_type ())
00046 #define DBUS_TYPE_G_MESSAGE (dbus_g_message_get_g_type ())
00047 GType dbus_g_connection_get_g_type (void) G_GNUC_CONST;
00048 GType dbus_g_message_get_g_type (void) G_GNUC_CONST;
00049
00050
00051 DBusGConnection* dbus_g_connection_ref (DBusGConnection *connection);
00052 void dbus_g_connection_unref (DBusGConnection *connection);
00053 DBusGMessage* dbus_g_message_ref (DBusGMessage *message);
00054 void dbus_g_message_unref (DBusGMessage *message);
00055
00056 void dbus_g_connection_flush (DBusGConnection *connection);
00057
00058 GQuark dbus_g_error_quark (void);
00059 #define DBUS_GERROR dbus_g_error_quark ()
00060
00061 typedef enum
00062 {
00063 #include <dbus/dbus-glib-error-enum.h>
00064 } DBusGError;
00065
00066 gboolean dbus_g_error_has_name (GError *error,
00067 const char *name);
00068 const char * dbus_g_error_get_name (GError *error);
00069
00070 void dbus_g_thread_init (void);
00071
00072 DBusGConnection* dbus_g_connection_open (const gchar *address,
00073 GError **error);
00074 DBusGConnection* dbus_g_bus_get (DBusBusType type,
00075 GError **error);
00076
00077 typedef struct _DBusGObjectInfo DBusGObjectInfo;
00078 typedef struct _DBusGMethodInfo DBusGMethodInfo;
00079
00085 struct _DBusGMethodInfo
00086 {
00087 GCallback function;
00088 GClosureMarshal marshaller;
00089 int data_offset;
00090 };
00091
00096 struct _DBusGObjectInfo
00097 {
00098 int format_version;
00101 const DBusGMethodInfo *method_infos;
00102 int n_method_infos;
00103 const char *data;
00104 const char *exported_signals;
00105 const char *exported_properties;
00106 };
00107
00108 void dbus_g_object_type_install_info (GType object_type,
00109 const DBusGObjectInfo *info);
00110
00111 void dbus_g_error_domain_register (GQuark domain,
00112 const char * default_iface,
00113 GType code_enum);
00114
00115 void dbus_g_connection_register_g_object (DBusGConnection *connection,
00116 const char *at_path,
00117 GObject *object);
00118 GObject * dbus_g_connection_lookup_g_object (DBusGConnection *connection,
00119 const char *at_path);
00120
00121 #ifdef DBUS_COMPILATION
00122 #include "glib/dbus-gtype-specialized.h"
00123 #else
00124 #include <dbus/dbus-gtype-specialized.h>
00125 #endif
00126
00127
00128 #define DBUS_TYPE_G_BOOLEAN_ARRAY (dbus_g_type_get_collection ("GArray", G_TYPE_BOOLEAN))
00129 #define DBUS_TYPE_G_UCHAR_ARRAY (dbus_g_type_get_collection ("GArray", G_TYPE_UCHAR))
00130 #define DBUS_TYPE_G_UINT_ARRAY (dbus_g_type_get_collection ("GArray", G_TYPE_UINT))
00131 #define DBUS_TYPE_G_INT_ARRAY (dbus_g_type_get_collection ("GArray", G_TYPE_INT))
00132 #define DBUS_TYPE_G_UINT64_ARRAY (dbus_g_type_get_collection ("GArray", G_TYPE_UINT64))
00133 #define DBUS_TYPE_G_INT64_ARRAY (dbus_g_type_get_collection ("GArray", G_TYPE_INT64))
00134 #define DBUS_TYPE_G_OBJECT_ARRAY (dbus_g_type_get_collection ("GPtrArray", G_TYPE_OBJECT))
00135
00136 #define DBUS_TYPE_G_STRING_STRING_HASHTABLE (dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING))
00137
00138 GType dbus_g_object_path_get_g_type (void) G_GNUC_CONST;
00139 #define DBUS_TYPE_G_OBJECT_PATH (dbus_g_object_path_get_g_type ())
00140
00141 void dbus_g_object_register_marshaller (GClosureMarshal marshaller,
00142 GType rettype,
00143 ...);
00144 void dbus_g_object_register_marshaller_array(GClosureMarshal marshaller,
00145 GType rettype,
00146 guint n_types,
00147 const GType* types);
00148
00149 typedef struct _DBusGProxy DBusGProxy;
00150 typedef struct _DBusGProxyClass DBusGProxyClass;
00151
00152 #define DBUS_TYPE_G_PROXY (dbus_g_proxy_get_type ())
00153 #define DBUS_G_PROXY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), DBUS_TYPE_G_PROXY, DBusGProxy))
00154 #define DBUS_G_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DBUS_TYPE_G_PROXY, DBusGProxyClass))
00155 #define DBUS_IS_G_PROXY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), DBUS_TYPE_G_PROXY))
00156 #define DBUS_IS_G_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DBUS_TYPE_G_PROXY))
00157 #define DBUS_G_PROXY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DBUS_TYPE_G_PROXY, DBusGProxyClass))
00158
00159 struct _DBusGProxy
00160 {
00161 GObject parent;
00162 };
00163
00164 struct _DBusGProxyClass
00165 {
00166 GObjectClass parent_class;
00167 };
00168
00169 typedef struct _DBusGProxyCall DBusGProxyCall;
00170 typedef void (* DBusGProxyCallNotify) (DBusGProxy *proxy,
00171 DBusGProxyCall *call_id,
00172 void *user_data);
00173
00174 GType dbus_g_proxy_get_type (void) G_GNUC_CONST;
00175 DBusGProxy* dbus_g_proxy_new_for_name (DBusGConnection *connection,
00176 const char *name,
00177 const char *path,
00178 const char *interface);
00179 DBusGProxy* dbus_g_proxy_new_for_name_owner (DBusGConnection *connection,
00180 const char *name,
00181 const char *path,
00182 const char *interface,
00183 GError **error);
00184 DBusGProxy* dbus_g_proxy_new_from_proxy (DBusGProxy *proxy,
00185 const char *interface,
00186 const char *path_name);
00187 DBusGProxy* dbus_g_proxy_new_for_peer (DBusGConnection *connection,
00188 const char *path_name,
00189 const char *interface_name);
00190
00191 void dbus_g_proxy_set_interface (DBusGProxy *proxy,
00192 const char *interface_name);
00193 void dbus_g_proxy_add_signal (DBusGProxy *proxy,
00194 const char *signal_name,
00195 GType first_type,
00196 ...);
00197
00198 void dbus_g_proxy_connect_signal (DBusGProxy *proxy,
00199 const char *signal_name,
00200 GCallback handler,
00201 void *data,
00202 GClosureNotify free_data_func);
00203 void dbus_g_proxy_disconnect_signal (DBusGProxy *proxy,
00204 const char *signal_name,
00205 GCallback handler,
00206 void *data);
00207
00208 gboolean dbus_g_proxy_call (DBusGProxy *proxy,
00209 const char *method,
00210 GError **error,
00211 GType first_arg_type,
00212 ...);
00213
00214 void dbus_g_proxy_call_no_reply (DBusGProxy *proxy,
00215 const char *method,
00216 GType first_arg_type,
00217 ...);
00218
00219 DBusGProxyCall * dbus_g_proxy_begin_call (DBusGProxy *proxy,
00220 const char *method,
00221 DBusGProxyCallNotify notify,
00222 gpointer data,
00223 GDestroyNotify destroy,
00224 GType first_arg_type,
00225 ...);
00226 gboolean dbus_g_proxy_end_call (DBusGProxy *proxy,
00227 DBusGProxyCall *call,
00228 GError **error,
00229 GType first_arg_type,
00230 ...);
00231 void dbus_g_proxy_cancel_call (DBusGProxy *proxy,
00232 DBusGProxyCall *call);
00233
00234 const char* dbus_g_proxy_get_path (DBusGProxy *proxy);
00235
00236 const char* dbus_g_proxy_get_bus_name (DBusGProxy *proxy);
00237
00238 const char* dbus_g_proxy_get_interface (DBusGProxy *proxy);
00239
00240 typedef struct _DBusGMethodInvocation DBusGMethodInvocation;
00241
00242 void dbus_g_method_return (DBusGMethodInvocation *context, ...);
00243
00244 void dbus_g_method_return_error (DBusGMethodInvocation *context, GError *error);
00245
00246
00247 typedef struct {
00248 GCallback cb;
00249 gpointer userdata;
00250 } DBusGAsyncData;
00251
00252 #undef DBUS_INSIDE_DBUS_GLIB_H
00253
00254 G_END_DECLS
00255
00256 #endif