1 /* -*- mode: C; c-file-style: "gnu" -*- */
2 /* dbus-glib.h GLib integration
4 * Copyright (C) 2002, 2003 CodeFactory AB
5 * Copyright (C) 2003, 2004 Red Hat, Inc.
6 * Portion Copyright © 2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
7 * Licensed under the Academic Free License version 2.1
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #include <glib-object.h>
28 #include <dbus/dbus-shared.h>
32 #define DBUS_INSIDE_DBUS_GLIB_H 1
36 * Convert to DBusConnection with dbus_g_connection_get_connection() in dbus-glib-lowlevel.h
38 typedef struct _DBusGConnection DBusGConnection;
40 * Convert to DBusMessage with dbus_g_message_get_message() in dbus-glib-lowlevel.h
42 typedef struct _DBusGMessage DBusGMessage;
45 #define DBUS_TYPE_G_CONNECTION (dbus_g_connection_get_g_type ())
46 #define DBUS_TYPE_G_MESSAGE (dbus_g_message_get_g_type ())
50 GType dbus_g_connection_get_g_type (void) G_GNUC_CONST;
54 GType dbus_g_message_get_g_type (void) G_GNUC_CONST;
60 DBusGConnection* dbus_g_connection_ref (DBusGConnection *connection);
64 void dbus_g_connection_unref (DBusGConnection *connection);
68 DBusGMessage* dbus_g_message_ref (DBusGMessage *message);
72 void dbus_g_message_unref (DBusGMessage *message);
77 void dbus_g_connection_flush (DBusGConnection *connection);
82 GQuark dbus_g_error_quark (void);
83 #define DBUS_GERROR dbus_g_error_quark ()
88 #include "dbus-glib-error-enum.h"
90 #include <dbus/dbus-glib-error-enum.h>
91 #endif //__SYMBIAN32__
97 gboolean dbus_g_error_has_name (GError *error,
102 const char * dbus_g_error_get_name (GError *error);
107 void dbus_g_thread_init (void);
112 DBusGConnection* dbus_g_connection_open (const gchar *address,
117 DBusGConnection* dbus_g_bus_get (DBusBusType type,
120 typedef struct _DBusGObjectInfo DBusGObjectInfo;
121 typedef struct _DBusGMethodInfo DBusGMethodInfo;
125 * @function: C method to invoke
126 * @marshaller: Marshaller to invoke method
127 * @data_offset: Offset into the introspection data
129 * Object typically generated by #dbus-binding-tool that
130 * stores a mapping from introspection data to a
131 * function pointer for a C method to be invoked.
133 struct _DBusGMethodInfo
136 GClosureMarshal marshaller;
142 * @format_version: Allows us to change the rest of this struct
143 * by adding DBusGObjectInfo2, DBusGObjectInfo3, etc.
144 * @method_infos: Array of method pointers
145 * @n_method_infos: Length of the infos array
146 * @data: Introspection data
147 * @exported_signals: Exported signals
148 * @exported_properties: Exported properties
150 * Introspection data for a #GObject, normally autogenerated by
151 * a tool such as #dbus-binding-tool.
153 struct _DBusGObjectInfo
157 const DBusGMethodInfo *method_infos;
160 const char *exported_signals;
161 const char *exported_properties;
167 void dbus_g_object_type_install_info (GType object_type,
168 const DBusGObjectInfo *info);
173 void dbus_g_error_domain_register (GQuark domain,
174 const char * default_iface,
180 void dbus_g_connection_register_g_object (DBusGConnection *connection,
186 GObject * dbus_g_connection_lookup_g_object (DBusGConnection *connection,
187 const char *at_path);
189 #ifdef DBUS_COMPILATION
190 #include "dbus/dbus-gtype-specialized.h"
192 #include <dbus/dbus-gtype-specialized.h>
195 /* definitions for some basic array types */
196 #define DBUS_TYPE_G_BOOLEAN_ARRAY (dbus_g_type_get_collection ("GArray", G_TYPE_BOOLEAN))
197 #define DBUS_TYPE_G_UCHAR_ARRAY (dbus_g_type_get_collection ("GArray", G_TYPE_UCHAR))
198 #define DBUS_TYPE_G_UINT_ARRAY (dbus_g_type_get_collection ("GArray", G_TYPE_UINT))
199 #define DBUS_TYPE_G_INT_ARRAY (dbus_g_type_get_collection ("GArray", G_TYPE_INT))
200 #define DBUS_TYPE_G_UINT64_ARRAY (dbus_g_type_get_collection ("GArray", G_TYPE_UINT64))
201 #define DBUS_TYPE_G_INT64_ARRAY (dbus_g_type_get_collection ("GArray", G_TYPE_INT64))
202 #define DBUS_TYPE_G_OBJECT_ARRAY (dbus_g_type_get_collection ("GPtrArray", G_TYPE_OBJECT))
204 #define DBUS_TYPE_G_STRING_STRING_HASHTABLE (dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING))
209 GType dbus_g_object_path_get_g_type (void) G_GNUC_CONST;
210 #define DBUS_TYPE_G_OBJECT_PATH (dbus_g_object_path_get_g_type ())
215 void dbus_g_object_register_marshaller (GClosureMarshal marshaller,
218 void dbus_g_object_register_marshaller_array(GClosureMarshal marshaller,
223 typedef struct _DBusGProxy DBusGProxy;
224 typedef struct _DBusGProxyClass DBusGProxyClass;
226 #define DBUS_TYPE_G_PROXY (dbus_g_proxy_get_type ())
227 #define DBUS_G_PROXY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), DBUS_TYPE_G_PROXY, DBusGProxy))
228 #define DBUS_G_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DBUS_TYPE_G_PROXY, DBusGProxyClass))
229 #define DBUS_IS_G_PROXY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), DBUS_TYPE_G_PROXY))
230 #define DBUS_IS_G_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DBUS_TYPE_G_PROXY))
231 #define DBUS_G_PROXY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DBUS_TYPE_G_PROXY, DBusGProxyClass))
238 struct _DBusGProxyClass
240 GObjectClass parent_class; /**< Parent class */
243 typedef struct _DBusGProxyCall DBusGProxyCall;
244 typedef void (* DBusGProxyCallNotify) (DBusGProxy *proxy,
245 DBusGProxyCall *call_id,
251 GType dbus_g_proxy_get_type (void) G_GNUC_CONST;
255 DBusGProxy* dbus_g_proxy_new_for_name (DBusGConnection *connection,
258 const char *interface);
262 DBusGProxy* dbus_g_proxy_new_for_name_owner (DBusGConnection *connection,
265 const char *interface,
270 DBusGProxy* dbus_g_proxy_new_from_proxy (DBusGProxy *proxy,
271 const char *interface,
272 const char *path_name);
276 DBusGProxy* dbus_g_proxy_new_for_peer (DBusGConnection *connection,
277 const char *path_name,
278 const char *interface_name);
283 void dbus_g_proxy_set_interface (DBusGProxy *proxy,
284 const char *interface_name);
288 void dbus_g_proxy_add_signal (DBusGProxy *proxy,
289 const char *signal_name,
296 void dbus_g_proxy_connect_signal (DBusGProxy *proxy,
297 const char *signal_name,
300 GClosureNotify free_data_func);
304 void dbus_g_proxy_disconnect_signal (DBusGProxy *proxy,
305 const char *signal_name,
312 gboolean dbus_g_proxy_call (DBusGProxy *proxy,
315 GType first_arg_type,
321 gboolean dbus_g_proxy_call_with_timeout (DBusGProxy *proxy,
325 GType first_arg_type,
331 void dbus_g_proxy_call_no_reply (DBusGProxy *proxy,
333 GType first_arg_type,
339 DBusGProxyCall * dbus_g_proxy_begin_call (DBusGProxy *proxy,
341 DBusGProxyCallNotify notify,
343 GDestroyNotify destroy,
344 GType first_arg_type,
349 DBusGProxyCall * dbus_g_proxy_begin_call_with_timeout (DBusGProxy *proxy,
351 DBusGProxyCallNotify notify,
353 GDestroyNotify destroy,
355 GType first_arg_type,
361 gboolean dbus_g_proxy_end_call (DBusGProxy *proxy,
362 DBusGProxyCall *call,
364 GType first_arg_type,
369 void dbus_g_proxy_cancel_call (DBusGProxy *proxy,
370 DBusGProxyCall *call);
375 const char* dbus_g_proxy_get_path (DBusGProxy *proxy);
380 const char* dbus_g_proxy_get_bus_name (DBusGProxy *proxy);
385 const char* dbus_g_proxy_get_interface (DBusGProxy *proxy);
387 typedef struct _DBusGMethodInvocation DBusGMethodInvocation;
392 void dbus_g_method_return (DBusGMethodInvocation *context, ...);
397 void dbus_g_method_return_error (DBusGMethodInvocation *context, GError *error);
399 /* Probably possible to replace this with a closure */
405 #undef DBUS_INSIDE_DBUS_GLIB_H
409 #endif /* DBUS_GLIB_H */