blob: 6dc02c6cade689bcdfa3782a989f5f667d97f5cc [file] [log] [blame]
Norman Jamese2765102015-08-19 22:00:55 -05001/*
2 * Generated by gdbus-codegen 2.40.2. DO NOT EDIT.
3 *
4 * The license of this code is the same as for the source it was derived from.
5 */
6
7#ifdef HAVE_CONFIG_H
8# include "config.h"
9#endif
10
11#include "interfaces/flash.h"
12
13#include <string.h>
14#ifdef G_OS_UNIX
15# include <gio/gunixfdlist.h>
16#endif
17
18typedef struct
19{
20 GDBusArgInfo parent_struct;
21 gboolean use_gvariant;
22} _ExtendedGDBusArgInfo;
23
24typedef struct
25{
26 GDBusMethodInfo parent_struct;
27 const gchar *signal_name;
28 gboolean pass_fdlist;
29} _ExtendedGDBusMethodInfo;
30
31typedef struct
32{
33 GDBusSignalInfo parent_struct;
34 const gchar *signal_name;
35} _ExtendedGDBusSignalInfo;
36
37typedef struct
38{
39 GDBusPropertyInfo parent_struct;
40 const gchar *hyphen_name;
41 gboolean use_gvariant;
42} _ExtendedGDBusPropertyInfo;
43
44typedef struct
45{
46 GDBusInterfaceInfo parent_struct;
47 const gchar *hyphen_name;
48} _ExtendedGDBusInterfaceInfo;
49
50typedef struct
51{
52 const _ExtendedGDBusPropertyInfo *info;
53 guint prop_id;
54 GValue orig_value; /* the value before the change */
55} ChangedProperty;
56
57static void
58_changed_property_free (ChangedProperty *data)
59{
60 g_value_unset (&data->orig_value);
61 g_free (data);
62}
63
64static gboolean
65_g_strv_equal0 (gchar **a, gchar **b)
66{
67 gboolean ret = FALSE;
68 guint n;
69 if (a == NULL && b == NULL)
70 {
71 ret = TRUE;
72 goto out;
73 }
74 if (a == NULL || b == NULL)
75 goto out;
76 if (g_strv_length (a) != g_strv_length (b))
77 goto out;
78 for (n = 0; a[n] != NULL; n++)
79 if (g_strcmp0 (a[n], b[n]) != 0)
80 goto out;
81 ret = TRUE;
82out:
83 return ret;
84}
85
86static gboolean
87_g_variant_equal0 (GVariant *a, GVariant *b)
88{
89 gboolean ret = FALSE;
90 if (a == NULL && b == NULL)
91 {
92 ret = TRUE;
93 goto out;
94 }
95 if (a == NULL || b == NULL)
96 goto out;
97 ret = g_variant_equal (a, b);
98out:
99 return ret;
100}
101
102G_GNUC_UNUSED static gboolean
103_g_value_equal (const GValue *a, const GValue *b)
104{
105 gboolean ret = FALSE;
106 g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b));
107 switch (G_VALUE_TYPE (a))
108 {
109 case G_TYPE_BOOLEAN:
110 ret = (g_value_get_boolean (a) == g_value_get_boolean (b));
111 break;
112 case G_TYPE_UCHAR:
113 ret = (g_value_get_uchar (a) == g_value_get_uchar (b));
114 break;
115 case G_TYPE_INT:
116 ret = (g_value_get_int (a) == g_value_get_int (b));
117 break;
118 case G_TYPE_UINT:
119 ret = (g_value_get_uint (a) == g_value_get_uint (b));
120 break;
121 case G_TYPE_INT64:
122 ret = (g_value_get_int64 (a) == g_value_get_int64 (b));
123 break;
124 case G_TYPE_UINT64:
125 ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b));
126 break;
127 case G_TYPE_DOUBLE:
128 {
129 /* Avoid -Wfloat-equal warnings by doing a direct bit compare */
130 gdouble da = g_value_get_double (a);
131 gdouble db = g_value_get_double (b);
132 ret = memcmp (&da, &db, sizeof (gdouble)) == 0;
133 }
134 break;
135 case G_TYPE_STRING:
136 ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0);
137 break;
138 case G_TYPE_VARIANT:
139 ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b));
140 break;
141 default:
142 if (G_VALUE_TYPE (a) == G_TYPE_STRV)
143 ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b));
144 else
145 g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a)));
146 break;
147 }
148 return ret;
149}
150
151/* ------------------------------------------------------------------------
152 * Code for interface org.openbmc.Flash
153 * ------------------------------------------------------------------------
154 */
155
156/**
157 * SECTION:Flash
158 * @title: Flash
159 * @short_description: Generated C code for the org.openbmc.Flash D-Bus interface
160 *
161 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> D-Bus interface in C.
162 */
163
164/* ---- Introspection data for org.openbmc.Flash ---- */
165
166static const _ExtendedGDBusArgInfo _flash_method_info_update_via_file_IN_ARG_file =
167{
168 {
169 -1,
170 (gchar *) "file",
171 (gchar *) "s",
172 NULL
173 },
174 FALSE
175};
176
177static const _ExtendedGDBusArgInfo * const _flash_method_info_update_via_file_IN_ARG_pointers[] =
178{
179 &_flash_method_info_update_via_file_IN_ARG_file,
180 NULL
181};
182
183static const _ExtendedGDBusMethodInfo _flash_method_info_update_via_file =
184{
185 {
186 -1,
187 (gchar *) "updateViaFile",
188 (GDBusArgInfo **) &_flash_method_info_update_via_file_IN_ARG_pointers,
189 NULL,
190 NULL
191 },
192 "handle-update-via-file",
193 FALSE
194};
195
196static const _ExtendedGDBusArgInfo _flash_method_info_update_via_http_IN_ARG_url =
197{
198 {
199 -1,
200 (gchar *) "url",
201 (gchar *) "s",
202 NULL
203 },
204 FALSE
205};
206
207static const _ExtendedGDBusArgInfo * const _flash_method_info_update_via_http_IN_ARG_pointers[] =
208{
209 &_flash_method_info_update_via_http_IN_ARG_url,
210 NULL
211};
212
213static const _ExtendedGDBusMethodInfo _flash_method_info_update_via_http =
214{
215 {
216 -1,
217 (gchar *) "updateViaHttp",
218 (GDBusArgInfo **) &_flash_method_info_update_via_http_IN_ARG_pointers,
219 NULL,
220 NULL
221 },
222 "handle-update-via-http",
223 FALSE
224};
225
226static const _ExtendedGDBusMethodInfo _flash_method_info_erase =
227{
228 {
229 -1,
230 (gchar *) "erase",
231 NULL,
232 NULL,
233 NULL
234 },
235 "handle-erase",
236 FALSE
237};
238
239static const _ExtendedGDBusMethodInfo _flash_method_info_init =
240{
241 {
242 -1,
243 (gchar *) "init",
244 NULL,
245 NULL,
246 NULL
247 },
248 "handle-init",
249 FALSE
250};
251
252static const _ExtendedGDBusMethodInfo * const _flash_method_info_pointers[] =
253{
254 &_flash_method_info_update_via_file,
255 &_flash_method_info_update_via_http,
256 &_flash_method_info_erase,
257 &_flash_method_info_init,
258 NULL
259};
260
261static const _ExtendedGDBusSignalInfo _flash_signal_info_updated =
262{
263 {
264 -1,
265 (gchar *) "Updated",
266 NULL,
267 NULL
268 },
269 "updated"
270};
271
272static const _ExtendedGDBusSignalInfo * const _flash_signal_info_pointers[] =
273{
274 &_flash_signal_info_updated,
275 NULL
276};
277
278static const _ExtendedGDBusInterfaceInfo _flash_interface_info =
279{
280 {
281 -1,
282 (gchar *) "org.openbmc.Flash",
283 (GDBusMethodInfo **) &_flash_method_info_pointers,
284 (GDBusSignalInfo **) &_flash_signal_info_pointers,
285 NULL,
286 NULL
287 },
288 "flash",
289};
290
291
292/**
293 * flash_interface_info:
294 *
295 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> D-Bus interface.
296 *
297 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
298 */
299GDBusInterfaceInfo *
300flash_interface_info (void)
301{
302 return (GDBusInterfaceInfo *) &_flash_interface_info.parent_struct;
303}
304
305/**
306 * flash_override_properties:
307 * @klass: The class structure for a #GObject<!-- -->-derived class.
308 * @property_id_begin: The property id to assign to the first overridden property.
309 *
310 * Overrides all #GObject properties in the #Flash interface for a concrete class.
311 * The properties are overridden in the order they are defined.
312 *
313 * Returns: The last property id.
314 */
315guint
316flash_override_properties (GObjectClass *klass, guint property_id_begin)
317{
318 return property_id_begin - 1;
319}
320
321
322
323/**
324 * Flash:
325 *
326 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
327 */
328
329/**
330 * FlashIface:
331 * @parent_iface: The parent interface.
332 * @handle_erase: Handler for the #Flash::handle-erase signal.
333 * @handle_init: Handler for the #Flash::handle-init signal.
334 * @handle_update_via_file: Handler for the #Flash::handle-update-via-file signal.
335 * @handle_update_via_http: Handler for the #Flash::handle-update-via-http signal.
336 * @updated: Handler for the #Flash::updated signal.
337 *
338 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
339 */
340
341typedef FlashIface FlashInterface;
342G_DEFINE_INTERFACE (Flash, flash, G_TYPE_OBJECT);
343
344static void
345flash_default_init (FlashIface *iface)
346{
347 /* GObject signals for incoming D-Bus method calls: */
348 /**
349 * Flash::handle-update-via-file:
350 * @object: A #Flash.
351 * @invocation: A #GDBusMethodInvocation.
352 * @arg_file: Argument passed by remote caller.
353 *
354 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.updateViaFile">updateViaFile()</link> D-Bus method.
355 *
356 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call flash_complete_update_via_file() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
357 *
358 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
359 */
360 g_signal_new ("handle-update-via-file",
361 G_TYPE_FROM_INTERFACE (iface),
362 G_SIGNAL_RUN_LAST,
363 G_STRUCT_OFFSET (FlashIface, handle_update_via_file),
364 g_signal_accumulator_true_handled,
365 NULL,
366 g_cclosure_marshal_generic,
367 G_TYPE_BOOLEAN,
368 2,
369 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
370
371 /**
372 * Flash::handle-update-via-http:
373 * @object: A #Flash.
374 * @invocation: A #GDBusMethodInvocation.
375 * @arg_url: Argument passed by remote caller.
376 *
377 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.updateViaHttp">updateViaHttp()</link> D-Bus method.
378 *
379 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call flash_complete_update_via_http() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
380 *
381 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
382 */
383 g_signal_new ("handle-update-via-http",
384 G_TYPE_FROM_INTERFACE (iface),
385 G_SIGNAL_RUN_LAST,
386 G_STRUCT_OFFSET (FlashIface, handle_update_via_http),
387 g_signal_accumulator_true_handled,
388 NULL,
389 g_cclosure_marshal_generic,
390 G_TYPE_BOOLEAN,
391 2,
392 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
393
394 /**
395 * Flash::handle-erase:
396 * @object: A #Flash.
397 * @invocation: A #GDBusMethodInvocation.
398 *
399 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.erase">erase()</link> D-Bus method.
400 *
401 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call flash_complete_erase() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
402 *
403 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
404 */
405 g_signal_new ("handle-erase",
406 G_TYPE_FROM_INTERFACE (iface),
407 G_SIGNAL_RUN_LAST,
408 G_STRUCT_OFFSET (FlashIface, handle_erase),
409 g_signal_accumulator_true_handled,
410 NULL,
411 g_cclosure_marshal_generic,
412 G_TYPE_BOOLEAN,
413 1,
414 G_TYPE_DBUS_METHOD_INVOCATION);
415
416 /**
417 * Flash::handle-init:
418 * @object: A #Flash.
419 * @invocation: A #GDBusMethodInvocation.
420 *
421 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method.
422 *
423 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call flash_complete_init() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
424 *
425 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
426 */
427 g_signal_new ("handle-init",
428 G_TYPE_FROM_INTERFACE (iface),
429 G_SIGNAL_RUN_LAST,
430 G_STRUCT_OFFSET (FlashIface, handle_init),
431 g_signal_accumulator_true_handled,
432 NULL,
433 g_cclosure_marshal_generic,
434 G_TYPE_BOOLEAN,
435 1,
436 G_TYPE_DBUS_METHOD_INVOCATION);
437
438 /* GObject signals for received D-Bus signals: */
439 /**
440 * Flash::updated:
441 * @object: A #Flash.
442 *
443 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Flash.Updated">"Updated"</link> is received.
444 *
445 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal.
446 */
447 g_signal_new ("updated",
448 G_TYPE_FROM_INTERFACE (iface),
449 G_SIGNAL_RUN_LAST,
450 G_STRUCT_OFFSET (FlashIface, updated),
451 NULL,
452 NULL,
453 g_cclosure_marshal_generic,
454 G_TYPE_NONE,
455 0);
456
457}
458
459/**
460 * flash_emit_updated:
461 * @object: A #Flash.
462 *
463 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Updated">"Updated"</link> D-Bus signal.
464 */
465void
466flash_emit_updated (
467 Flash *object)
468{
469 g_signal_emit_by_name (object, "updated");
470}
471
472/**
473 * flash_call_update_via_file:
474 * @proxy: A #FlashProxy.
475 * @arg_file: Argument to pass with the method invocation.
476 * @cancellable: (allow-none): A #GCancellable or %NULL.
477 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
478 * @user_data: User data to pass to @callback.
479 *
480 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaFile">updateViaFile()</link> D-Bus method on @proxy.
481 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
482 * You can then call flash_call_update_via_file_finish() to get the result of the operation.
483 *
484 * See flash_call_update_via_file_sync() for the synchronous, blocking version of this method.
485 */
486void
487flash_call_update_via_file (
488 Flash *proxy,
489 const gchar *arg_file,
490 GCancellable *cancellable,
491 GAsyncReadyCallback callback,
492 gpointer user_data)
493{
494 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
495 "updateViaFile",
496 g_variant_new ("(s)",
497 arg_file),
498 G_DBUS_CALL_FLAGS_NONE,
499 -1,
500 cancellable,
501 callback,
502 user_data);
503}
504
505/**
506 * flash_call_update_via_file_finish:
507 * @proxy: A #FlashProxy.
508 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update_via_file().
509 * @error: Return location for error or %NULL.
510 *
511 * Finishes an operation started with flash_call_update_via_file().
512 *
513 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
514 */
515gboolean
516flash_call_update_via_file_finish (
517 Flash *proxy,
518 GAsyncResult *res,
519 GError **error)
520{
521 GVariant *_ret;
522 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
523 if (_ret == NULL)
524 goto _out;
525 g_variant_get (_ret,
526 "()");
527 g_variant_unref (_ret);
528_out:
529 return _ret != NULL;
530}
531
532/**
533 * flash_call_update_via_file_sync:
534 * @proxy: A #FlashProxy.
535 * @arg_file: Argument to pass with the method invocation.
536 * @cancellable: (allow-none): A #GCancellable or %NULL.
537 * @error: Return location for error or %NULL.
538 *
539 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaFile">updateViaFile()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
540 *
541 * See flash_call_update_via_file() for the asynchronous version of this method.
542 *
543 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
544 */
545gboolean
546flash_call_update_via_file_sync (
547 Flash *proxy,
548 const gchar *arg_file,
549 GCancellable *cancellable,
550 GError **error)
551{
552 GVariant *_ret;
553 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
554 "updateViaFile",
555 g_variant_new ("(s)",
556 arg_file),
557 G_DBUS_CALL_FLAGS_NONE,
558 -1,
559 cancellable,
560 error);
561 if (_ret == NULL)
562 goto _out;
563 g_variant_get (_ret,
564 "()");
565 g_variant_unref (_ret);
566_out:
567 return _ret != NULL;
568}
569
570/**
571 * flash_call_update_via_http:
572 * @proxy: A #FlashProxy.
573 * @arg_url: Argument to pass with the method invocation.
574 * @cancellable: (allow-none): A #GCancellable or %NULL.
575 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
576 * @user_data: User data to pass to @callback.
577 *
578 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaHttp">updateViaHttp()</link> D-Bus method on @proxy.
579 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
580 * You can then call flash_call_update_via_http_finish() to get the result of the operation.
581 *
582 * See flash_call_update_via_http_sync() for the synchronous, blocking version of this method.
583 */
584void
585flash_call_update_via_http (
586 Flash *proxy,
587 const gchar *arg_url,
588 GCancellable *cancellable,
589 GAsyncReadyCallback callback,
590 gpointer user_data)
591{
592 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
593 "updateViaHttp",
594 g_variant_new ("(s)",
595 arg_url),
596 G_DBUS_CALL_FLAGS_NONE,
597 -1,
598 cancellable,
599 callback,
600 user_data);
601}
602
603/**
604 * flash_call_update_via_http_finish:
605 * @proxy: A #FlashProxy.
606 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update_via_http().
607 * @error: Return location for error or %NULL.
608 *
609 * Finishes an operation started with flash_call_update_via_http().
610 *
611 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
612 */
613gboolean
614flash_call_update_via_http_finish (
615 Flash *proxy,
616 GAsyncResult *res,
617 GError **error)
618{
619 GVariant *_ret;
620 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
621 if (_ret == NULL)
622 goto _out;
623 g_variant_get (_ret,
624 "()");
625 g_variant_unref (_ret);
626_out:
627 return _ret != NULL;
628}
629
630/**
631 * flash_call_update_via_http_sync:
632 * @proxy: A #FlashProxy.
633 * @arg_url: Argument to pass with the method invocation.
634 * @cancellable: (allow-none): A #GCancellable or %NULL.
635 * @error: Return location for error or %NULL.
636 *
637 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaHttp">updateViaHttp()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
638 *
639 * See flash_call_update_via_http() for the asynchronous version of this method.
640 *
641 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
642 */
643gboolean
644flash_call_update_via_http_sync (
645 Flash *proxy,
646 const gchar *arg_url,
647 GCancellable *cancellable,
648 GError **error)
649{
650 GVariant *_ret;
651 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
652 "updateViaHttp",
653 g_variant_new ("(s)",
654 arg_url),
655 G_DBUS_CALL_FLAGS_NONE,
656 -1,
657 cancellable,
658 error);
659 if (_ret == NULL)
660 goto _out;
661 g_variant_get (_ret,
662 "()");
663 g_variant_unref (_ret);
664_out:
665 return _ret != NULL;
666}
667
668/**
669 * flash_call_erase:
670 * @proxy: A #FlashProxy.
671 * @cancellable: (allow-none): A #GCancellable or %NULL.
672 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
673 * @user_data: User data to pass to @callback.
674 *
675 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.erase">erase()</link> D-Bus method on @proxy.
676 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
677 * You can then call flash_call_erase_finish() to get the result of the operation.
678 *
679 * See flash_call_erase_sync() for the synchronous, blocking version of this method.
680 */
681void
682flash_call_erase (
683 Flash *proxy,
684 GCancellable *cancellable,
685 GAsyncReadyCallback callback,
686 gpointer user_data)
687{
688 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
689 "erase",
690 g_variant_new ("()"),
691 G_DBUS_CALL_FLAGS_NONE,
692 -1,
693 cancellable,
694 callback,
695 user_data);
696}
697
698/**
699 * flash_call_erase_finish:
700 * @proxy: A #FlashProxy.
701 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_erase().
702 * @error: Return location for error or %NULL.
703 *
704 * Finishes an operation started with flash_call_erase().
705 *
706 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
707 */
708gboolean
709flash_call_erase_finish (
710 Flash *proxy,
711 GAsyncResult *res,
712 GError **error)
713{
714 GVariant *_ret;
715 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
716 if (_ret == NULL)
717 goto _out;
718 g_variant_get (_ret,
719 "()");
720 g_variant_unref (_ret);
721_out:
722 return _ret != NULL;
723}
724
725/**
726 * flash_call_erase_sync:
727 * @proxy: A #FlashProxy.
728 * @cancellable: (allow-none): A #GCancellable or %NULL.
729 * @error: Return location for error or %NULL.
730 *
731 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.erase">erase()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
732 *
733 * See flash_call_erase() for the asynchronous version of this method.
734 *
735 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
736 */
737gboolean
738flash_call_erase_sync (
739 Flash *proxy,
740 GCancellable *cancellable,
741 GError **error)
742{
743 GVariant *_ret;
744 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
745 "erase",
746 g_variant_new ("()"),
747 G_DBUS_CALL_FLAGS_NONE,
748 -1,
749 cancellable,
750 error);
751 if (_ret == NULL)
752 goto _out;
753 g_variant_get (_ret,
754 "()");
755 g_variant_unref (_ret);
756_out:
757 return _ret != NULL;
758}
759
760/**
761 * flash_call_init:
762 * @proxy: A #FlashProxy.
763 * @cancellable: (allow-none): A #GCancellable or %NULL.
764 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
765 * @user_data: User data to pass to @callback.
766 *
767 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method on @proxy.
768 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
769 * You can then call flash_call_init_finish() to get the result of the operation.
770 *
771 * See flash_call_init_sync() for the synchronous, blocking version of this method.
772 */
773void
774flash_call_init (
775 Flash *proxy,
776 GCancellable *cancellable,
777 GAsyncReadyCallback callback,
778 gpointer user_data)
779{
780 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
781 "init",
782 g_variant_new ("()"),
783 G_DBUS_CALL_FLAGS_NONE,
784 -1,
785 cancellable,
786 callback,
787 user_data);
788}
789
790/**
791 * flash_call_init_finish:
792 * @proxy: A #FlashProxy.
793 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_init().
794 * @error: Return location for error or %NULL.
795 *
796 * Finishes an operation started with flash_call_init().
797 *
798 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
799 */
800gboolean
801flash_call_init_finish (
802 Flash *proxy,
803 GAsyncResult *res,
804 GError **error)
805{
806 GVariant *_ret;
807 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
808 if (_ret == NULL)
809 goto _out;
810 g_variant_get (_ret,
811 "()");
812 g_variant_unref (_ret);
813_out:
814 return _ret != NULL;
815}
816
817/**
818 * flash_call_init_sync:
819 * @proxy: A #FlashProxy.
820 * @cancellable: (allow-none): A #GCancellable or %NULL.
821 * @error: Return location for error or %NULL.
822 *
823 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
824 *
825 * See flash_call_init() for the asynchronous version of this method.
826 *
827 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
828 */
829gboolean
830flash_call_init_sync (
831 Flash *proxy,
832 GCancellable *cancellable,
833 GError **error)
834{
835 GVariant *_ret;
836 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
837 "init",
838 g_variant_new ("()"),
839 G_DBUS_CALL_FLAGS_NONE,
840 -1,
841 cancellable,
842 error);
843 if (_ret == NULL)
844 goto _out;
845 g_variant_get (_ret,
846 "()");
847 g_variant_unref (_ret);
848_out:
849 return _ret != NULL;
850}
851
852/**
853 * flash_complete_update_via_file:
854 * @object: A #Flash.
855 * @invocation: (transfer full): A #GDBusMethodInvocation.
856 *
857 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.updateViaFile">updateViaFile()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
858 *
859 * This method will free @invocation, you cannot use it afterwards.
860 */
861void
862flash_complete_update_via_file (
863 Flash *object,
864 GDBusMethodInvocation *invocation)
865{
866 g_dbus_method_invocation_return_value (invocation,
867 g_variant_new ("()"));
868}
869
870/**
871 * flash_complete_update_via_http:
872 * @object: A #Flash.
873 * @invocation: (transfer full): A #GDBusMethodInvocation.
874 *
875 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.updateViaHttp">updateViaHttp()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
876 *
877 * This method will free @invocation, you cannot use it afterwards.
878 */
879void
880flash_complete_update_via_http (
881 Flash *object,
882 GDBusMethodInvocation *invocation)
883{
884 g_dbus_method_invocation_return_value (invocation,
885 g_variant_new ("()"));
886}
887
888/**
889 * flash_complete_erase:
890 * @object: A #Flash.
891 * @invocation: (transfer full): A #GDBusMethodInvocation.
892 *
893 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.erase">erase()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
894 *
895 * This method will free @invocation, you cannot use it afterwards.
896 */
897void
898flash_complete_erase (
899 Flash *object,
900 GDBusMethodInvocation *invocation)
901{
902 g_dbus_method_invocation_return_value (invocation,
903 g_variant_new ("()"));
904}
905
906/**
907 * flash_complete_init:
908 * @object: A #Flash.
909 * @invocation: (transfer full): A #GDBusMethodInvocation.
910 *
911 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
912 *
913 * This method will free @invocation, you cannot use it afterwards.
914 */
915void
916flash_complete_init (
917 Flash *object,
918 GDBusMethodInvocation *invocation)
919{
920 g_dbus_method_invocation_return_value (invocation,
921 g_variant_new ("()"));
922}
923
924/* ------------------------------------------------------------------------ */
925
926/**
927 * FlashProxy:
928 *
929 * The #FlashProxy structure contains only private data and should only be accessed using the provided API.
930 */
931
932/**
933 * FlashProxyClass:
934 * @parent_class: The parent class.
935 *
936 * Class structure for #FlashProxy.
937 */
938
939struct _FlashProxyPrivate
940{
941 GData *qdata;
942};
943
944static void flash_proxy_iface_init (FlashIface *iface);
945
946#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
947G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
948 G_ADD_PRIVATE (FlashProxy)
949 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
950
951#else
952G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
953 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
954
955#endif
956static void
957flash_proxy_finalize (GObject *object)
958{
959 FlashProxy *proxy = FLASH_PROXY (object);
960 g_datalist_clear (&proxy->priv->qdata);
961 G_OBJECT_CLASS (flash_proxy_parent_class)->finalize (object);
962}
963
964static void
965flash_proxy_get_property (GObject *object,
966 guint prop_id,
967 GValue *value,
968 GParamSpec *pspec G_GNUC_UNUSED)
969{
970}
971
972static void
973flash_proxy_set_property (GObject *object,
974 guint prop_id,
975 const GValue *value,
976 GParamSpec *pspec G_GNUC_UNUSED)
977{
978}
979
980static void
981flash_proxy_g_signal (GDBusProxy *proxy,
982 const gchar *sender_name G_GNUC_UNUSED,
983 const gchar *signal_name,
984 GVariant *parameters)
985{
986 _ExtendedGDBusSignalInfo *info;
987 GVariantIter iter;
988 GVariant *child;
989 GValue *paramv;
990 guint num_params;
991 guint n;
992 guint signal_id;
993 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, signal_name);
994 if (info == NULL)
995 return;
996 num_params = g_variant_n_children (parameters);
997 paramv = g_new0 (GValue, num_params + 1);
998 g_value_init (&paramv[0], TYPE_FLASH);
999 g_value_set_object (&paramv[0], proxy);
1000 g_variant_iter_init (&iter, parameters);
1001 n = 1;
1002 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1003 {
1004 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
1005 if (arg_info->use_gvariant)
1006 {
1007 g_value_init (&paramv[n], G_TYPE_VARIANT);
1008 g_value_set_variant (&paramv[n], child);
1009 n++;
1010 }
1011 else
1012 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
1013 g_variant_unref (child);
1014 }
1015 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
1016 g_signal_emitv (paramv, signal_id, 0, NULL);
1017 for (n = 0; n < num_params + 1; n++)
1018 g_value_unset (&paramv[n]);
1019 g_free (paramv);
1020}
1021
1022static void
1023flash_proxy_g_properties_changed (GDBusProxy *_proxy,
1024 GVariant *changed_properties,
1025 const gchar *const *invalidated_properties)
1026{
1027 FlashProxy *proxy = FLASH_PROXY (_proxy);
1028 guint n;
1029 const gchar *key;
1030 GVariantIter *iter;
1031 _ExtendedGDBusPropertyInfo *info;
1032 g_variant_get (changed_properties, "a{sv}", &iter);
1033 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
1034 {
1035 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, key);
1036 g_datalist_remove_data (&proxy->priv->qdata, key);
1037 if (info != NULL)
1038 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
1039 }
1040 g_variant_iter_free (iter);
1041 for (n = 0; invalidated_properties[n] != NULL; n++)
1042 {
1043 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, invalidated_properties[n]);
1044 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
1045 if (info != NULL)
1046 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
1047 }
1048}
1049
1050static void
1051flash_proxy_init (FlashProxy *proxy)
1052{
1053#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1054 proxy->priv = flash_proxy_get_instance_private (proxy);
1055#else
1056 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_PROXY, FlashProxyPrivate);
1057#endif
1058
1059 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_interface_info ());
1060}
1061
1062static void
1063flash_proxy_class_init (FlashProxyClass *klass)
1064{
1065 GObjectClass *gobject_class;
1066 GDBusProxyClass *proxy_class;
1067
1068 gobject_class = G_OBJECT_CLASS (klass);
1069 gobject_class->finalize = flash_proxy_finalize;
1070 gobject_class->get_property = flash_proxy_get_property;
1071 gobject_class->set_property = flash_proxy_set_property;
1072
1073 proxy_class = G_DBUS_PROXY_CLASS (klass);
1074 proxy_class->g_signal = flash_proxy_g_signal;
1075 proxy_class->g_properties_changed = flash_proxy_g_properties_changed;
1076
1077#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1078 g_type_class_add_private (klass, sizeof (FlashProxyPrivate));
1079#endif
1080}
1081
1082static void
1083flash_proxy_iface_init (FlashIface *iface)
1084{
1085}
1086
1087/**
1088 * flash_proxy_new:
1089 * @connection: A #GDBusConnection.
1090 * @flags: Flags from the #GDBusProxyFlags enumeration.
1091 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1092 * @object_path: An object path.
1093 * @cancellable: (allow-none): A #GCancellable or %NULL.
1094 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1095 * @user_data: User data to pass to @callback.
1096 *
1097 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>. See g_dbus_proxy_new() for more details.
1098 *
1099 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
1100 * You can then call flash_proxy_new_finish() to get the result of the operation.
1101 *
1102 * See flash_proxy_new_sync() for the synchronous, blocking version of this constructor.
1103 */
1104void
1105flash_proxy_new (
1106 GDBusConnection *connection,
1107 GDBusProxyFlags flags,
1108 const gchar *name,
1109 const gchar *object_path,
1110 GCancellable *cancellable,
1111 GAsyncReadyCallback callback,
1112 gpointer user_data)
1113{
1114 g_async_initable_new_async (TYPE_FLASH_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Flash", NULL);
1115}
1116
1117/**
1118 * flash_proxy_new_finish:
1119 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new().
1120 * @error: Return location for error or %NULL
1121 *
1122 * Finishes an operation started with flash_proxy_new().
1123 *
1124 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
1125 */
1126Flash *
1127flash_proxy_new_finish (
1128 GAsyncResult *res,
1129 GError **error)
1130{
1131 GObject *ret;
1132 GObject *source_object;
1133 source_object = g_async_result_get_source_object (res);
1134 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1135 g_object_unref (source_object);
1136 if (ret != NULL)
1137 return FLASH (ret);
1138 else
1139 return NULL;
1140}
1141
1142/**
1143 * flash_proxy_new_sync:
1144 * @connection: A #GDBusConnection.
1145 * @flags: Flags from the #GDBusProxyFlags enumeration.
1146 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1147 * @object_path: An object path.
1148 * @cancellable: (allow-none): A #GCancellable or %NULL.
1149 * @error: Return location for error or %NULL
1150 *
1151 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>. See g_dbus_proxy_new_sync() for more details.
1152 *
1153 * The calling thread is blocked until a reply is received.
1154 *
1155 * See flash_proxy_new() for the asynchronous version of this constructor.
1156 *
1157 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
1158 */
1159Flash *
1160flash_proxy_new_sync (
1161 GDBusConnection *connection,
1162 GDBusProxyFlags flags,
1163 const gchar *name,
1164 const gchar *object_path,
1165 GCancellable *cancellable,
1166 GError **error)
1167{
1168 GInitable *ret;
1169 ret = g_initable_new (TYPE_FLASH_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Flash", NULL);
1170 if (ret != NULL)
1171 return FLASH (ret);
1172 else
1173 return NULL;
1174}
1175
1176
1177/**
1178 * flash_proxy_new_for_bus:
1179 * @bus_type: A #GBusType.
1180 * @flags: Flags from the #GDBusProxyFlags enumeration.
1181 * @name: A bus name (well-known or unique).
1182 * @object_path: An object path.
1183 * @cancellable: (allow-none): A #GCancellable or %NULL.
1184 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1185 * @user_data: User data to pass to @callback.
1186 *
1187 * Like flash_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
1188 *
1189 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
1190 * You can then call flash_proxy_new_for_bus_finish() to get the result of the operation.
1191 *
1192 * See flash_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
1193 */
1194void
1195flash_proxy_new_for_bus (
1196 GBusType bus_type,
1197 GDBusProxyFlags flags,
1198 const gchar *name,
1199 const gchar *object_path,
1200 GCancellable *cancellable,
1201 GAsyncReadyCallback callback,
1202 gpointer user_data)
1203{
1204 g_async_initable_new_async (TYPE_FLASH_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Flash", NULL);
1205}
1206
1207/**
1208 * flash_proxy_new_for_bus_finish:
1209 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new_for_bus().
1210 * @error: Return location for error or %NULL
1211 *
1212 * Finishes an operation started with flash_proxy_new_for_bus().
1213 *
1214 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
1215 */
1216Flash *
1217flash_proxy_new_for_bus_finish (
1218 GAsyncResult *res,
1219 GError **error)
1220{
1221 GObject *ret;
1222 GObject *source_object;
1223 source_object = g_async_result_get_source_object (res);
1224 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1225 g_object_unref (source_object);
1226 if (ret != NULL)
1227 return FLASH (ret);
1228 else
1229 return NULL;
1230}
1231
1232/**
1233 * flash_proxy_new_for_bus_sync:
1234 * @bus_type: A #GBusType.
1235 * @flags: Flags from the #GDBusProxyFlags enumeration.
1236 * @name: A bus name (well-known or unique).
1237 * @object_path: An object path.
1238 * @cancellable: (allow-none): A #GCancellable or %NULL.
1239 * @error: Return location for error or %NULL
1240 *
1241 * Like flash_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
1242 *
1243 * The calling thread is blocked until a reply is received.
1244 *
1245 * See flash_proxy_new_for_bus() for the asynchronous version of this constructor.
1246 *
1247 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
1248 */
1249Flash *
1250flash_proxy_new_for_bus_sync (
1251 GBusType bus_type,
1252 GDBusProxyFlags flags,
1253 const gchar *name,
1254 const gchar *object_path,
1255 GCancellable *cancellable,
1256 GError **error)
1257{
1258 GInitable *ret;
1259 ret = g_initable_new (TYPE_FLASH_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Flash", NULL);
1260 if (ret != NULL)
1261 return FLASH (ret);
1262 else
1263 return NULL;
1264}
1265
1266
1267/* ------------------------------------------------------------------------ */
1268
1269/**
1270 * FlashSkeleton:
1271 *
1272 * The #FlashSkeleton structure contains only private data and should only be accessed using the provided API.
1273 */
1274
1275/**
1276 * FlashSkeletonClass:
1277 * @parent_class: The parent class.
1278 *
1279 * Class structure for #FlashSkeleton.
1280 */
1281
1282struct _FlashSkeletonPrivate
1283{
1284 GValue *properties;
1285 GList *changed_properties;
1286 GSource *changed_properties_idle_source;
1287 GMainContext *context;
1288 GMutex lock;
1289};
1290
1291static void
1292_flash_skeleton_handle_method_call (
1293 GDBusConnection *connection G_GNUC_UNUSED,
1294 const gchar *sender G_GNUC_UNUSED,
1295 const gchar *object_path G_GNUC_UNUSED,
1296 const gchar *interface_name,
1297 const gchar *method_name,
1298 GVariant *parameters,
1299 GDBusMethodInvocation *invocation,
1300 gpointer user_data)
1301{
1302 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
1303 _ExtendedGDBusMethodInfo *info;
1304 GVariantIter iter;
1305 GVariant *child;
1306 GValue *paramv;
1307 guint num_params;
1308 guint num_extra;
1309 guint n;
1310 guint signal_id;
1311 GValue return_value = G_VALUE_INIT;
1312 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
1313 g_assert (info != NULL);
1314 num_params = g_variant_n_children (parameters);
1315 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
1316 n = 0;
1317 g_value_init (&paramv[n], TYPE_FLASH);
1318 g_value_set_object (&paramv[n++], skeleton);
1319 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
1320 g_value_set_object (&paramv[n++], invocation);
1321 if (info->pass_fdlist)
1322 {
1323#ifdef G_OS_UNIX
1324 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
1325 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
1326#else
1327 g_assert_not_reached ();
1328#endif
1329 }
1330 g_variant_iter_init (&iter, parameters);
1331 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1332 {
1333 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
1334 if (arg_info->use_gvariant)
1335 {
1336 g_value_init (&paramv[n], G_TYPE_VARIANT);
1337 g_value_set_variant (&paramv[n], child);
1338 n++;
1339 }
1340 else
1341 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
1342 g_variant_unref (child);
1343 }
1344 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
1345 g_value_init (&return_value, G_TYPE_BOOLEAN);
1346 g_signal_emitv (paramv, signal_id, 0, &return_value);
1347 if (!g_value_get_boolean (&return_value))
1348 g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "Method %s is not implemented on interface %s", method_name, interface_name);
1349 g_value_unset (&return_value);
1350 for (n = 0; n < num_params + num_extra; n++)
1351 g_value_unset (&paramv[n]);
1352 g_free (paramv);
1353}
1354
1355static GVariant *
1356_flash_skeleton_handle_get_property (
1357 GDBusConnection *connection G_GNUC_UNUSED,
1358 const gchar *sender G_GNUC_UNUSED,
1359 const gchar *object_path G_GNUC_UNUSED,
1360 const gchar *interface_name G_GNUC_UNUSED,
1361 const gchar *property_name,
1362 GError **error,
1363 gpointer user_data)
1364{
1365 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
1366 GValue value = G_VALUE_INIT;
1367 GParamSpec *pspec;
1368 _ExtendedGDBusPropertyInfo *info;
1369 GVariant *ret;
1370 ret = NULL;
1371 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
1372 g_assert (info != NULL);
1373 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1374 if (pspec == NULL)
1375 {
1376 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1377 }
1378 else
1379 {
1380 g_value_init (&value, pspec->value_type);
1381 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1382 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
1383 g_value_unset (&value);
1384 }
1385 return ret;
1386}
1387
1388static gboolean
1389_flash_skeleton_handle_set_property (
1390 GDBusConnection *connection G_GNUC_UNUSED,
1391 const gchar *sender G_GNUC_UNUSED,
1392 const gchar *object_path G_GNUC_UNUSED,
1393 const gchar *interface_name G_GNUC_UNUSED,
1394 const gchar *property_name,
1395 GVariant *variant,
1396 GError **error,
1397 gpointer user_data)
1398{
1399 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
1400 GValue value = G_VALUE_INIT;
1401 GParamSpec *pspec;
1402 _ExtendedGDBusPropertyInfo *info;
1403 gboolean ret;
1404 ret = FALSE;
1405 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
1406 g_assert (info != NULL);
1407 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1408 if (pspec == NULL)
1409 {
1410 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1411 }
1412 else
1413 {
1414 if (info->use_gvariant)
1415 g_value_set_variant (&value, variant);
1416 else
1417 g_dbus_gvariant_to_gvalue (variant, &value);
1418 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1419 g_value_unset (&value);
1420 ret = TRUE;
1421 }
1422 return ret;
1423}
1424
1425static const GDBusInterfaceVTable _flash_skeleton_vtable =
1426{
1427 _flash_skeleton_handle_method_call,
1428 _flash_skeleton_handle_get_property,
1429 _flash_skeleton_handle_set_property,
1430 {NULL}
1431};
1432
1433static GDBusInterfaceInfo *
1434flash_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1435{
1436 return flash_interface_info ();
1437}
1438
1439static GDBusInterfaceVTable *
1440flash_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1441{
1442 return (GDBusInterfaceVTable *) &_flash_skeleton_vtable;
1443}
1444
1445static GVariant *
1446flash_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
1447{
1448 FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton);
1449
1450 GVariantBuilder builder;
1451 guint n;
1452 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1453 if (_flash_interface_info.parent_struct.properties == NULL)
1454 goto out;
1455 for (n = 0; _flash_interface_info.parent_struct.properties[n] != NULL; n++)
1456 {
1457 GDBusPropertyInfo *info = _flash_interface_info.parent_struct.properties[n];
1458 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
1459 {
1460 GVariant *value;
1461 value = _flash_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", info->name, NULL, skeleton);
1462 if (value != NULL)
1463 {
1464 g_variant_take_ref (value);
1465 g_variant_builder_add (&builder, "{sv}", info->name, value);
1466 g_variant_unref (value);
1467 }
1468 }
1469 }
1470out:
1471 return g_variant_builder_end (&builder);
1472}
1473
1474static void
1475flash_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
1476{
1477}
1478
1479static void
1480_flash_on_signal_updated (
1481 Flash *object)
1482{
1483 FlashSkeleton *skeleton = FLASH_SKELETON (object);
1484
1485 GList *connections, *l;
1486 GVariant *signal_variant;
1487 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
1488
1489 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
1490 for (l = connections; l != NULL; l = l->next)
1491 {
1492 GDBusConnection *connection = l->data;
1493 g_dbus_connection_emit_signal (connection,
1494 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Updated",
1495 signal_variant, NULL);
1496 }
1497 g_variant_unref (signal_variant);
1498 g_list_free_full (connections, g_object_unref);
1499}
1500
1501static void flash_skeleton_iface_init (FlashIface *iface);
1502#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1503G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1504 G_ADD_PRIVATE (FlashSkeleton)
1505 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
1506
1507#else
1508G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1509 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
1510
1511#endif
1512static void
1513flash_skeleton_finalize (GObject *object)
1514{
1515 FlashSkeleton *skeleton = FLASH_SKELETON (object);
1516 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1517 if (skeleton->priv->changed_properties_idle_source != NULL)
1518 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1519 g_main_context_unref (skeleton->priv->context);
1520 g_mutex_clear (&skeleton->priv->lock);
1521 G_OBJECT_CLASS (flash_skeleton_parent_class)->finalize (object);
1522}
1523
1524static void
1525flash_skeleton_init (FlashSkeleton *skeleton)
1526{
1527#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1528 skeleton->priv = flash_skeleton_get_instance_private (skeleton);
1529#else
1530 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_SKELETON, FlashSkeletonPrivate);
1531#endif
1532
1533 g_mutex_init (&skeleton->priv->lock);
1534 skeleton->priv->context = g_main_context_ref_thread_default ();
1535}
1536
1537static void
1538flash_skeleton_class_init (FlashSkeletonClass *klass)
1539{
1540 GObjectClass *gobject_class;
1541 GDBusInterfaceSkeletonClass *skeleton_class;
1542
1543 gobject_class = G_OBJECT_CLASS (klass);
1544 gobject_class->finalize = flash_skeleton_finalize;
1545
1546 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
1547 skeleton_class->get_info = flash_skeleton_dbus_interface_get_info;
1548 skeleton_class->get_properties = flash_skeleton_dbus_interface_get_properties;
1549 skeleton_class->flush = flash_skeleton_dbus_interface_flush;
1550 skeleton_class->get_vtable = flash_skeleton_dbus_interface_get_vtable;
1551
1552#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1553 g_type_class_add_private (klass, sizeof (FlashSkeletonPrivate));
1554#endif
1555}
1556
1557static void
1558flash_skeleton_iface_init (FlashIface *iface)
1559{
1560 iface->updated = _flash_on_signal_updated;
1561}
1562
1563/**
1564 * flash_skeleton_new:
1565 *
1566 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
1567 *
1568 * Returns: (transfer full) (type FlashSkeleton): The skeleton object.
1569 */
1570Flash *
1571flash_skeleton_new (void)
1572{
1573 return FLASH (g_object_new (TYPE_FLASH_SKELETON, NULL));
1574}
1575
1576/* ------------------------------------------------------------------------
1577 * Code for Object, ObjectProxy and ObjectSkeleton
1578 * ------------------------------------------------------------------------
1579 */
1580
1581/**
1582 * SECTION:Object
1583 * @title: Object
1584 * @short_description: Specialized GDBusObject types
1585 *
1586 * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
1587 */
1588
1589/**
1590 * Object:
1591 *
1592 * The #Object type is a specialized container of interfaces.
1593 */
1594
1595/**
1596 * ObjectIface:
1597 * @parent_iface: The parent interface.
1598 *
1599 * Virtual table for the #Object interface.
1600 */
1601
1602typedef ObjectIface ObjectInterface;
1603G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));
1604
1605static void
1606object_default_init (ObjectIface *iface)
1607{
1608 /**
1609 * Object:flash:
1610 *
1611 * The #Flash instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>, if any.
1612 *
1613 * Connect to the #GObject::notify signal to get informed of property changes.
1614 */
1615 g_object_interface_install_property (iface, g_param_spec_object ("flash", "flash", "flash", TYPE_FLASH, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
1616
1617}
1618
1619/**
1620 * object_get_flash:
1621 * @object: A #Object.
1622 *
1623 * Gets the #Flash instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> on @object, if any.
1624 *
1625 * Returns: (transfer full): A #Flash that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
1626 */
1627Flash *object_get_flash (Object *object)
1628{
1629 GDBusInterface *ret;
1630 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
1631 if (ret == NULL)
1632 return NULL;
1633 return FLASH (ret);
1634}
1635
1636
1637/**
1638 * object_peek_flash: (skip)
1639 * @object: A #Object.
1640 *
1641 * Like object_get_flash() but doesn't increase the reference count on the returned object.
1642 *
1643 * <warning>It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.</warning>
1644 *
1645 * Returns: (transfer none): A #Flash or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
1646 */
1647Flash *object_peek_flash (Object *object)
1648{
1649 GDBusInterface *ret;
1650 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
1651 if (ret == NULL)
1652 return NULL;
1653 g_object_unref (ret);
1654 return FLASH (ret);
1655}
1656
1657
1658static void
1659object_notify (GDBusObject *object, GDBusInterface *interface)
1660{
1661 _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
1662 /* info can be NULL if the other end is using a D-Bus interface we don't know
1663 * anything about, for example old generated code in this process talking to
1664 * newer generated code in the other process. */
1665 if (info != NULL)
1666 g_object_notify (G_OBJECT (object), info->hyphen_name);
1667}
1668
1669/**
1670 * ObjectProxy:
1671 *
1672 * The #ObjectProxy structure contains only private data and should only be accessed using the provided API.
1673 */
1674
1675/**
1676 * ObjectProxyClass:
1677 * @parent_class: The parent class.
1678 *
1679 * Class structure for #ObjectProxy.
1680 */
1681
1682static void
1683object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
1684{
1685}
1686
1687static void
1688object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
1689{
1690 iface->interface_added = object_notify;
1691 iface->interface_removed = object_notify;
1692}
1693
1694
1695G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
1696 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init)
1697 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init));
1698
1699static void
1700object_proxy_init (ObjectProxy *object G_GNUC_UNUSED)
1701{
1702}
1703
1704static void
1705object_proxy_set_property (GObject *gobject,
1706 guint prop_id,
1707 const GValue *value G_GNUC_UNUSED,
1708 GParamSpec *pspec)
1709{
1710 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
1711}
1712
1713static void
1714object_proxy_get_property (GObject *gobject,
1715 guint prop_id,
1716 GValue *value,
1717 GParamSpec *pspec)
1718{
1719 ObjectProxy *object = OBJECT_PROXY (gobject);
1720 GDBusInterface *interface;
1721
1722 switch (prop_id)
1723 {
1724 case 1:
1725 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
1726 g_value_take_object (value, interface);
1727 break;
1728
1729 default:
1730 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
1731 break;
1732 }
1733}
1734
1735static void
1736object_proxy_class_init (ObjectProxyClass *klass)
1737{
1738 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
1739
1740 gobject_class->set_property = object_proxy_set_property;
1741 gobject_class->get_property = object_proxy_get_property;
1742
1743 g_object_class_override_property (gobject_class, 1, "flash");
1744}
1745
1746/**
1747 * object_proxy_new:
1748 * @connection: A #GDBusConnection.
1749 * @object_path: An object path.
1750 *
1751 * Creates a new proxy object.
1752 *
1753 * Returns: (transfer full): The proxy object.
1754 */
1755ObjectProxy *
1756object_proxy_new (GDBusConnection *connection,
1757 const gchar *object_path)
1758{
1759 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
1760 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
1761 return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
1762}
1763
1764/**
1765 * ObjectSkeleton:
1766 *
1767 * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API.
1768 */
1769
1770/**
1771 * ObjectSkeletonClass:
1772 * @parent_class: The parent class.
1773 *
1774 * Class structure for #ObjectSkeleton.
1775 */
1776
1777static void
1778object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
1779{
1780}
1781
1782
1783static void
1784object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
1785{
1786 iface->interface_added = object_notify;
1787 iface->interface_removed = object_notify;
1788}
1789
1790G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
1791 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init)
1792 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init));
1793
1794static void
1795object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED)
1796{
1797}
1798
1799static void
1800object_skeleton_set_property (GObject *gobject,
1801 guint prop_id,
1802 const GValue *value,
1803 GParamSpec *pspec)
1804{
1805 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
1806 GDBusInterfaceSkeleton *interface;
1807
1808 switch (prop_id)
1809 {
1810 case 1:
1811 interface = g_value_get_object (value);
1812 if (interface != NULL)
1813 {
1814 g_warn_if_fail (IS_FLASH (interface));
1815 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
1816 }
1817 else
1818 {
1819 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Flash");
1820 }
1821 break;
1822
1823 default:
1824 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
1825 break;
1826 }
1827}
1828
1829static void
1830object_skeleton_get_property (GObject *gobject,
1831 guint prop_id,
1832 GValue *value,
1833 GParamSpec *pspec)
1834{
1835 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
1836 GDBusInterface *interface;
1837
1838 switch (prop_id)
1839 {
1840 case 1:
1841 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
1842 g_value_take_object (value, interface);
1843 break;
1844
1845 default:
1846 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
1847 break;
1848 }
1849}
1850
1851static void
1852object_skeleton_class_init (ObjectSkeletonClass *klass)
1853{
1854 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
1855
1856 gobject_class->set_property = object_skeleton_set_property;
1857 gobject_class->get_property = object_skeleton_get_property;
1858
1859 g_object_class_override_property (gobject_class, 1, "flash");
1860}
1861
1862/**
1863 * object_skeleton_new:
1864 * @object_path: An object path.
1865 *
1866 * Creates a new skeleton object.
1867 *
1868 * Returns: (transfer full): The skeleton object.
1869 */
1870ObjectSkeleton *
1871object_skeleton_new (const gchar *object_path)
1872{
1873 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
1874 return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
1875}
1876
1877/**
1878 * object_skeleton_set_flash:
1879 * @object: A #ObjectSkeleton.
1880 * @interface_: (allow-none): A #Flash or %NULL to clear the interface.
1881 *
1882 * Sets the #Flash instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> on @object.
1883 */
1884void object_skeleton_set_flash (ObjectSkeleton *object, Flash *interface_)
1885{
1886 g_object_set (G_OBJECT (object), "flash", interface_, NULL);
1887}
1888
1889
1890/* ------------------------------------------------------------------------
1891 * Code for ObjectManager client
1892 * ------------------------------------------------------------------------
1893 */
1894
1895/**
1896 * SECTION:ObjectManagerClient
1897 * @title: ObjectManagerClient
1898 * @short_description: Generated GDBusObjectManagerClient type
1899 *
1900 * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
1901 */
1902
1903/**
1904 * ObjectManagerClient:
1905 *
1906 * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API.
1907 */
1908
1909/**
1910 * ObjectManagerClientClass:
1911 * @parent_class: The parent class.
1912 *
1913 * Class structure for #ObjectManagerClient.
1914 */
1915
1916G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT);
1917
1918static void
1919object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED)
1920{
1921}
1922
1923static void
1924object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED)
1925{
1926}
1927
1928/**
1929 * object_manager_client_get_proxy_type:
1930 * @manager: A #GDBusObjectManagerClient.
1931 * @object_path: The object path of the remote object (unused).
1932 * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType.
1933 * @user_data: User data (unused).
1934 *
1935 * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types.
1936 *
1937 * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy.
1938 */
1939GType
1940object_manager_client_get_proxy_type (GDBusObjectManagerClient *manager G_GNUC_UNUSED, const gchar *object_path G_GNUC_UNUSED, const gchar *interface_name, gpointer user_data G_GNUC_UNUSED)
1941{
1942 static gsize once_init_value = 0;
1943 static GHashTable *lookup_hash;
1944 GType ret;
1945
1946 if (interface_name == NULL)
1947 return TYPE_OBJECT_PROXY;
1948 if (g_once_init_enter (&once_init_value))
1949 {
1950 lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
1951 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Flash", GSIZE_TO_POINTER (TYPE_FLASH_PROXY));
1952 g_once_init_leave (&once_init_value, 1);
1953 }
1954 ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
1955 if (ret == (GType) 0)
1956 ret = G_TYPE_DBUS_PROXY;
1957 return ret;
1958}
1959
1960/**
1961 * object_manager_client_new:
1962 * @connection: A #GDBusConnection.
1963 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
1964 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1965 * @object_path: An object path.
1966 * @cancellable: (allow-none): A #GCancellable or %NULL.
1967 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1968 * @user_data: User data to pass to @callback.
1969 *
1970 * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
1971 *
1972 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
1973 * You can then call object_manager_client_new_finish() to get the result of the operation.
1974 *
1975 * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
1976 */
1977void
1978object_manager_client_new (
1979 GDBusConnection *connection,
1980 GDBusObjectManagerClientFlags flags,
1981 const gchar *name,
1982 const gchar *object_path,
1983 GCancellable *cancellable,
1984 GAsyncReadyCallback callback,
1985 gpointer user_data)
1986{
1987 g_async_initable_new_async (TYPE_OBJECT_MANAGER_CLIENT, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "flags", flags, "name", name, "connection", connection, "object-path", object_path, "get-proxy-type-func", object_manager_client_get_proxy_type, NULL);
1988}
1989
1990/**
1991 * object_manager_client_new_finish:
1992 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new().
1993 * @error: Return location for error or %NULL
1994 *
1995 * Finishes an operation started with object_manager_client_new().
1996 *
1997 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
1998 */
1999GDBusObjectManager *
2000object_manager_client_new_finish (
2001 GAsyncResult *res,
2002 GError **error)
2003{
2004 GObject *ret;
2005 GObject *source_object;
2006 source_object = g_async_result_get_source_object (res);
2007 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
2008 g_object_unref (source_object);
2009 if (ret != NULL)
2010 return G_DBUS_OBJECT_MANAGER (ret);
2011 else
2012 return NULL;
2013}
2014
2015/**
2016 * object_manager_client_new_sync:
2017 * @connection: A #GDBusConnection.
2018 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
2019 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
2020 * @object_path: An object path.
2021 * @cancellable: (allow-none): A #GCancellable or %NULL.
2022 * @error: Return location for error or %NULL
2023 *
2024 * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
2025 *
2026 * The calling thread is blocked until a reply is received.
2027 *
2028 * See object_manager_client_new() for the asynchronous version of this constructor.
2029 *
2030 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
2031 */
2032GDBusObjectManager *
2033object_manager_client_new_sync (
2034 GDBusConnection *connection,
2035 GDBusObjectManagerClientFlags flags,
2036 const gchar *name,
2037 const gchar *object_path,
2038 GCancellable *cancellable,
2039 GError **error)
2040{
2041 GInitable *ret;
2042 ret = g_initable_new (TYPE_OBJECT_MANAGER_CLIENT, cancellable, error, "flags", flags, "name", name, "connection", connection, "object-path", object_path, "get-proxy-type-func", object_manager_client_get_proxy_type, NULL);
2043 if (ret != NULL)
2044 return G_DBUS_OBJECT_MANAGER (ret);
2045 else
2046 return NULL;
2047}
2048
2049
2050/**
2051 * object_manager_client_new_for_bus:
2052 * @bus_type: A #GBusType.
2053 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
2054 * @name: A bus name (well-known or unique).
2055 * @object_path: An object path.
2056 * @cancellable: (allow-none): A #GCancellable or %NULL.
2057 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
2058 * @user_data: User data to pass to @callback.
2059 *
2060 * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
2061 *
2062 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
2063 * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation.
2064 *
2065 * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
2066 */
2067void
2068object_manager_client_new_for_bus (
2069 GBusType bus_type,
2070 GDBusObjectManagerClientFlags flags,
2071 const gchar *name,
2072 const gchar *object_path,
2073 GCancellable *cancellable,
2074 GAsyncReadyCallback callback,
2075 gpointer user_data)
2076{
2077 g_async_initable_new_async (TYPE_OBJECT_MANAGER_CLIENT, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "flags", flags, "name", name, "bus-type", bus_type, "object-path", object_path, "get-proxy-type-func", object_manager_client_get_proxy_type, NULL);
2078}
2079
2080/**
2081 * object_manager_client_new_for_bus_finish:
2082 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus().
2083 * @error: Return location for error or %NULL
2084 *
2085 * Finishes an operation started with object_manager_client_new_for_bus().
2086 *
2087 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
2088 */
2089GDBusObjectManager *
2090object_manager_client_new_for_bus_finish (
2091 GAsyncResult *res,
2092 GError **error)
2093{
2094 GObject *ret;
2095 GObject *source_object;
2096 source_object = g_async_result_get_source_object (res);
2097 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
2098 g_object_unref (source_object);
2099 if (ret != NULL)
2100 return G_DBUS_OBJECT_MANAGER (ret);
2101 else
2102 return NULL;
2103}
2104
2105/**
2106 * object_manager_client_new_for_bus_sync:
2107 * @bus_type: A #GBusType.
2108 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
2109 * @name: A bus name (well-known or unique).
2110 * @object_path: An object path.
2111 * @cancellable: (allow-none): A #GCancellable or %NULL.
2112 * @error: Return location for error or %NULL
2113 *
2114 * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
2115 *
2116 * The calling thread is blocked until a reply is received.
2117 *
2118 * See object_manager_client_new_for_bus() for the asynchronous version of this constructor.
2119 *
2120 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
2121 */
2122GDBusObjectManager *
2123object_manager_client_new_for_bus_sync (
2124 GBusType bus_type,
2125 GDBusObjectManagerClientFlags flags,
2126 const gchar *name,
2127 const gchar *object_path,
2128 GCancellable *cancellable,
2129 GError **error)
2130{
2131 GInitable *ret;
2132 ret = g_initable_new (TYPE_OBJECT_MANAGER_CLIENT, cancellable, error, "flags", flags, "name", name, "bus-type", bus_type, "object-path", object_path, "get-proxy-type-func", object_manager_client_get_proxy_type, NULL);
2133 if (ret != NULL)
2134 return G_DBUS_OBJECT_MANAGER (ret);
2135 else
2136 return NULL;
2137}
2138
2139