|
1 /* -*- mode: C; c-file-style: "gnu" -*- */ |
|
2 /* dbus-glib.h GLib integration |
|
3 * |
|
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 |
|
8 * |
|
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. |
|
13 * |
|
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. |
|
18 * |
|
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 |
|
22 * |
|
23 */ |
|
24 #ifndef DBUS_GLIB_H |
|
25 #define DBUS_GLIB_H |
|
26 |
|
27 #include <glib-object.h> |
|
28 #include <dbus/dbus-shared.h> |
|
29 |
|
30 G_BEGIN_DECLS |
|
31 |
|
32 #define DBUS_INSIDE_DBUS_GLIB_H 1 |
|
33 |
|
34 |
|
35 /** |
|
36 * Convert to DBusConnection with dbus_g_connection_get_connection() in dbus-glib-lowlevel.h |
|
37 */ |
|
38 typedef struct _DBusGConnection DBusGConnection; |
|
39 /** |
|
40 * Convert to DBusMessage with dbus_g_message_get_message() in dbus-glib-lowlevel.h |
|
41 */ |
|
42 typedef struct _DBusGMessage DBusGMessage; |
|
43 |
|
44 |
|
45 #define DBUS_TYPE_G_CONNECTION (dbus_g_connection_get_g_type ()) |
|
46 #define DBUS_TYPE_G_MESSAGE (dbus_g_message_get_g_type ()) |
|
47 #ifdef __SYMBIAN32__ |
|
48 IMPORT_C |
|
49 #endif |
|
50 GType dbus_g_connection_get_g_type (void) G_GNUC_CONST; |
|
51 #ifdef __SYMBIAN32__ |
|
52 IMPORT_C |
|
53 #endif |
|
54 GType dbus_g_message_get_g_type (void) G_GNUC_CONST; |
|
55 |
|
56 |
|
57 #ifdef __SYMBIAN32__ |
|
58 IMPORT_C |
|
59 #endif |
|
60 DBusGConnection* dbus_g_connection_ref (DBusGConnection *connection); |
|
61 #ifdef __SYMBIAN32__ |
|
62 IMPORT_C |
|
63 #endif |
|
64 void dbus_g_connection_unref (DBusGConnection *connection); |
|
65 #ifdef __SYMBIAN32__ |
|
66 IMPORT_C |
|
67 #endif |
|
68 DBusGMessage* dbus_g_message_ref (DBusGMessage *message); |
|
69 #ifdef __SYMBIAN32__ |
|
70 IMPORT_C |
|
71 #endif |
|
72 void dbus_g_message_unref (DBusGMessage *message); |
|
73 |
|
74 #ifdef __SYMBIAN32__ |
|
75 IMPORT_C |
|
76 #endif |
|
77 void dbus_g_connection_flush (DBusGConnection *connection); |
|
78 |
|
79 #ifdef __SYMBIAN32__ |
|
80 IMPORT_C |
|
81 #endif |
|
82 GQuark dbus_g_error_quark (void); |
|
83 #define DBUS_GERROR dbus_g_error_quark () |
|
84 |
|
85 typedef enum |
|
86 { |
|
87 #ifndef __SYMBIAN32__ |
|
88 #include "dbus-glib-error-enum.h" |
|
89 #else |
|
90 #include <dbus/dbus-glib-error-enum.h> |
|
91 #endif //__SYMBIAN32__ |
|
92 } DBusGError; |
|
93 |
|
94 #ifdef __SYMBIAN32__ |
|
95 IMPORT_C |
|
96 #endif |
|
97 gboolean dbus_g_error_has_name (GError *error, |
|
98 const char *name); |
|
99 #ifdef __SYMBIAN32__ |
|
100 IMPORT_C |
|
101 #endif |
|
102 const char * dbus_g_error_get_name (GError *error); |
|
103 |
|
104 #ifdef __SYMBIAN32__ |
|
105 IMPORT_C |
|
106 #endif |
|
107 void dbus_g_thread_init (void); |
|
108 |
|
109 #ifdef __SYMBIAN32__ |
|
110 IMPORT_C |
|
111 #endif |
|
112 DBusGConnection* dbus_g_connection_open (const gchar *address, |
|
113 GError **error); |
|
114 #ifdef __SYMBIAN32__ |
|
115 IMPORT_C |
|
116 #endif |
|
117 DBusGConnection* dbus_g_bus_get (DBusBusType type, |
|
118 GError **error); |
|
119 |
|
120 typedef struct _DBusGObjectInfo DBusGObjectInfo; |
|
121 typedef struct _DBusGMethodInfo DBusGMethodInfo; |
|
122 |
|
123 /** |
|
124 * DBusGMethodInfo: |
|
125 * @function: C method to invoke |
|
126 * @marshaller: Marshaller to invoke method |
|
127 * @data_offset: Offset into the introspection data |
|
128 * |
|
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. |
|
132 */ |
|
133 struct _DBusGMethodInfo |
|
134 { |
|
135 GCallback function; |
|
136 GClosureMarshal marshaller; |
|
137 int data_offset; |
|
138 }; |
|
139 |
|
140 /** |
|
141 * DBusGObjectInfo: |
|
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 |
|
149 * |
|
150 * Introspection data for a #GObject, normally autogenerated by |
|
151 * a tool such as #dbus-binding-tool. |
|
152 */ |
|
153 struct _DBusGObjectInfo |
|
154 { |
|
155 int format_version; |
|
156 |
|
157 const DBusGMethodInfo *method_infos; |
|
158 int n_method_infos; |
|
159 const char *data; |
|
160 const char *exported_signals; |
|
161 const char *exported_properties; |
|
162 }; |
|
163 |
|
164 #ifdef __SYMBIAN32__ |
|
165 IMPORT_C |
|
166 #endif |
|
167 void dbus_g_object_type_install_info (GType object_type, |
|
168 const DBusGObjectInfo *info); |
|
169 |
|
170 #ifdef __SYMBIAN32__ |
|
171 IMPORT_C |
|
172 #endif |
|
173 void dbus_g_error_domain_register (GQuark domain, |
|
174 const char * default_iface, |
|
175 GType code_enum); |
|
176 |
|
177 #ifdef __SYMBIAN32__ |
|
178 IMPORT_C |
|
179 #endif |
|
180 void dbus_g_connection_register_g_object (DBusGConnection *connection, |
|
181 const char *at_path, |
|
182 GObject *object); |
|
183 #ifdef __SYMBIAN32__ |
|
184 IMPORT_C |
|
185 #endif |
|
186 GObject * dbus_g_connection_lookup_g_object (DBusGConnection *connection, |
|
187 const char *at_path); |
|
188 |
|
189 #ifdef DBUS_COMPILATION |
|
190 #include "dbus/dbus-gtype-specialized.h" |
|
191 #else |
|
192 #include <dbus/dbus-gtype-specialized.h> |
|
193 #endif |
|
194 |
|
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)) |
|
203 |
|
204 #define DBUS_TYPE_G_STRING_STRING_HASHTABLE (dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING)) |
|
205 |
|
206 #ifdef __SYMBIAN32__ |
|
207 IMPORT_C |
|
208 #endif |
|
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 ()) |
|
211 |
|
212 #ifdef __SYMBIAN32__ |
|
213 IMPORT_C |
|
214 #endif |
|
215 void dbus_g_object_register_marshaller (GClosureMarshal marshaller, |
|
216 GType rettype, |
|
217 ...); |
|
218 void dbus_g_object_register_marshaller_array(GClosureMarshal marshaller, |
|
219 GType rettype, |
|
220 guint n_types, |
|
221 const GType* types); |
|
222 |
|
223 typedef struct _DBusGProxy DBusGProxy; |
|
224 typedef struct _DBusGProxyClass DBusGProxyClass; |
|
225 |
|
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)) |
|
232 |
|
233 struct _DBusGProxy |
|
234 { |
|
235 GObject parent; |
|
236 }; |
|
237 |
|
238 struct _DBusGProxyClass |
|
239 { |
|
240 GObjectClass parent_class; /**< Parent class */ |
|
241 }; |
|
242 |
|
243 typedef struct _DBusGProxyCall DBusGProxyCall; |
|
244 typedef void (* DBusGProxyCallNotify) (DBusGProxy *proxy, |
|
245 DBusGProxyCall *call_id, |
|
246 void *user_data); |
|
247 |
|
248 #ifdef __SYMBIAN32__ |
|
249 IMPORT_C |
|
250 #endif |
|
251 GType dbus_g_proxy_get_type (void) G_GNUC_CONST; |
|
252 #ifdef __SYMBIAN32__ |
|
253 IMPORT_C |
|
254 #endif |
|
255 DBusGProxy* dbus_g_proxy_new_for_name (DBusGConnection *connection, |
|
256 const char *name, |
|
257 const char *path, |
|
258 const char *interface); |
|
259 #ifdef __SYMBIAN32__ |
|
260 IMPORT_C |
|
261 #endif |
|
262 DBusGProxy* dbus_g_proxy_new_for_name_owner (DBusGConnection *connection, |
|
263 const char *name, |
|
264 const char *path, |
|
265 const char *interface, |
|
266 GError **error); |
|
267 #ifdef __SYMBIAN32__ |
|
268 IMPORT_C |
|
269 #endif |
|
270 DBusGProxy* dbus_g_proxy_new_from_proxy (DBusGProxy *proxy, |
|
271 const char *interface, |
|
272 const char *path_name); |
|
273 #ifdef __SYMBIAN32__ |
|
274 IMPORT_C |
|
275 #endif |
|
276 DBusGProxy* dbus_g_proxy_new_for_peer (DBusGConnection *connection, |
|
277 const char *path_name, |
|
278 const char *interface_name); |
|
279 |
|
280 #ifdef __SYMBIAN32__ |
|
281 IMPORT_C |
|
282 #endif |
|
283 void dbus_g_proxy_set_interface (DBusGProxy *proxy, |
|
284 const char *interface_name); |
|
285 #ifdef __SYMBIAN32__ |
|
286 IMPORT_C |
|
287 #endif |
|
288 void dbus_g_proxy_add_signal (DBusGProxy *proxy, |
|
289 const char *signal_name, |
|
290 GType first_type, |
|
291 ...); |
|
292 |
|
293 #ifdef __SYMBIAN32__ |
|
294 IMPORT_C |
|
295 #endif |
|
296 void dbus_g_proxy_connect_signal (DBusGProxy *proxy, |
|
297 const char *signal_name, |
|
298 GCallback handler, |
|
299 void *data, |
|
300 GClosureNotify free_data_func); |
|
301 #ifdef __SYMBIAN32__ |
|
302 IMPORT_C |
|
303 #endif |
|
304 void dbus_g_proxy_disconnect_signal (DBusGProxy *proxy, |
|
305 const char *signal_name, |
|
306 GCallback handler, |
|
307 void *data); |
|
308 |
|
309 #ifdef __SYMBIAN32__ |
|
310 IMPORT_C |
|
311 #endif |
|
312 gboolean dbus_g_proxy_call (DBusGProxy *proxy, |
|
313 const char *method, |
|
314 GError **error, |
|
315 GType first_arg_type, |
|
316 ...); |
|
317 |
|
318 #ifdef __SYMBIAN32__ |
|
319 IMPORT_C |
|
320 #endif |
|
321 gboolean dbus_g_proxy_call_with_timeout (DBusGProxy *proxy, |
|
322 const char *method, |
|
323 int timeout, |
|
324 GError **error, |
|
325 GType first_arg_type, |
|
326 ...); |
|
327 |
|
328 #ifdef __SYMBIAN32__ |
|
329 IMPORT_C |
|
330 #endif |
|
331 void dbus_g_proxy_call_no_reply (DBusGProxy *proxy, |
|
332 const char *method, |
|
333 GType first_arg_type, |
|
334 ...); |
|
335 |
|
336 #ifdef __SYMBIAN32__ |
|
337 IMPORT_C |
|
338 #endif |
|
339 DBusGProxyCall * dbus_g_proxy_begin_call (DBusGProxy *proxy, |
|
340 const char *method, |
|
341 DBusGProxyCallNotify notify, |
|
342 gpointer data, |
|
343 GDestroyNotify destroy, |
|
344 GType first_arg_type, |
|
345 ...); |
|
346 #ifdef __SYMBIAN32__ |
|
347 IMPORT_C |
|
348 #endif |
|
349 DBusGProxyCall * dbus_g_proxy_begin_call_with_timeout (DBusGProxy *proxy, |
|
350 const char *method, |
|
351 DBusGProxyCallNotify notify, |
|
352 gpointer user_data, |
|
353 GDestroyNotify destroy, |
|
354 int timeout, |
|
355 GType first_arg_type, |
|
356 ...); |
|
357 |
|
358 #ifdef __SYMBIAN32__ |
|
359 IMPORT_C |
|
360 #endif |
|
361 gboolean dbus_g_proxy_end_call (DBusGProxy *proxy, |
|
362 DBusGProxyCall *call, |
|
363 GError **error, |
|
364 GType first_arg_type, |
|
365 ...); |
|
366 #ifdef __SYMBIAN32__ |
|
367 IMPORT_C |
|
368 #endif |
|
369 void dbus_g_proxy_cancel_call (DBusGProxy *proxy, |
|
370 DBusGProxyCall *call); |
|
371 |
|
372 #ifdef __SYMBIAN32__ |
|
373 IMPORT_C |
|
374 #endif |
|
375 const char* dbus_g_proxy_get_path (DBusGProxy *proxy); |
|
376 |
|
377 #ifdef __SYMBIAN32__ |
|
378 IMPORT_C |
|
379 #endif |
|
380 const char* dbus_g_proxy_get_bus_name (DBusGProxy *proxy); |
|
381 |
|
382 #ifdef __SYMBIAN32__ |
|
383 IMPORT_C |
|
384 #endif |
|
385 const char* dbus_g_proxy_get_interface (DBusGProxy *proxy); |
|
386 |
|
387 typedef struct _DBusGMethodInvocation DBusGMethodInvocation; |
|
388 |
|
389 #ifdef __SYMBIAN32__ |
|
390 IMPORT_C |
|
391 #endif |
|
392 void dbus_g_method_return (DBusGMethodInvocation *context, ...); |
|
393 |
|
394 #ifdef __SYMBIAN32__ |
|
395 IMPORT_C |
|
396 #endif |
|
397 void dbus_g_method_return_error (DBusGMethodInvocation *context, GError *error); |
|
398 |
|
399 /* Probably possible to replace this with a closure */ |
|
400 typedef struct { |
|
401 GCallback cb; |
|
402 gpointer userdata; |
|
403 } DBusGAsyncData; |
|
404 |
|
405 #undef DBUS_INSIDE_DBUS_GLIB_H |
|
406 |
|
407 G_END_DECLS |
|
408 |
|
409 #endif /* DBUS_GLIB_H */ |