blob: c43d00c0f4a44871b115297ac20751ed12fd8f2f [file] [log] [blame]
Norman Jamesfa2e76e2015-08-26 17:41:20 -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/control_host.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.control.Host
153 * ------------------------------------------------------------------------
154 */
155
156/**
157 * SECTION:ControlHost
158 * @title: ControlHost
159 * @short_description: Generated C code for the org.openbmc.control.Host D-Bus interface
160 *
161 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link> D-Bus interface in C.
162 */
163
164/* ---- Introspection data for org.openbmc.control.Host ---- */
165
166static const _ExtendedGDBusMethodInfo _control_host_method_info_boot =
167{
168 {
169 -1,
170 (gchar *) "boot",
171 NULL,
172 NULL,
173 NULL
174 },
175 "handle-boot",
176 FALSE
177};
178
179static const _ExtendedGDBusMethodInfo _control_host_method_info_shutdown =
180{
181 {
182 -1,
183 (gchar *) "shutdown",
184 NULL,
185 NULL,
186 NULL
187 },
188 "handle-shutdown",
189 FALSE
190};
191
192static const _ExtendedGDBusMethodInfo _control_host_method_info_reboot =
193{
194 {
195 -1,
196 (gchar *) "reboot",
197 NULL,
198 NULL,
199 NULL
200 },
201 "handle-reboot",
202 FALSE
203};
204
205static const _ExtendedGDBusMethodInfo * const _control_host_method_info_pointers[] =
206{
207 &_control_host_method_info_boot,
208 &_control_host_method_info_shutdown,
209 &_control_host_method_info_reboot,
210 NULL
211};
212
213static const _ExtendedGDBusSignalInfo _control_host_signal_info_booted =
214{
215 {
216 -1,
217 (gchar *) "Booted",
218 NULL,
219 NULL
220 },
221 "booted"
222};
223
224static const _ExtendedGDBusSignalInfo * const _control_host_signal_info_pointers[] =
225{
226 &_control_host_signal_info_booted,
227 NULL
228};
229
230static const _ExtendedGDBusInterfaceInfo _control_host_interface_info =
231{
232 {
233 -1,
234 (gchar *) "org.openbmc.control.Host",
235 (GDBusMethodInfo **) &_control_host_method_info_pointers,
236 (GDBusSignalInfo **) &_control_host_signal_info_pointers,
237 NULL,
238 NULL
239 },
240 "control-host",
241};
242
243
244/**
245 * control_host_interface_info:
246 *
247 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link> D-Bus interface.
248 *
249 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
250 */
251GDBusInterfaceInfo *
252control_host_interface_info (void)
253{
254 return (GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct;
255}
256
257/**
258 * control_host_override_properties:
259 * @klass: The class structure for a #GObject<!-- -->-derived class.
260 * @property_id_begin: The property id to assign to the first overridden property.
261 *
262 * Overrides all #GObject properties in the #ControlHost interface for a concrete class.
263 * The properties are overridden in the order they are defined.
264 *
265 * Returns: The last property id.
266 */
267guint
268control_host_override_properties (GObjectClass *klass, guint property_id_begin)
269{
270 return property_id_begin - 1;
271}
272
273
274
275/**
276 * ControlHost:
277 *
278 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
279 */
280
281/**
282 * ControlHostIface:
283 * @parent_iface: The parent interface.
284 * @handle_boot: Handler for the #ControlHost::handle-boot signal.
285 * @handle_reboot: Handler for the #ControlHost::handle-reboot signal.
286 * @handle_shutdown: Handler for the #ControlHost::handle-shutdown signal.
287 * @booted: Handler for the #ControlHost::booted signal.
288 *
289 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
290 */
291
292typedef ControlHostIface ControlHostInterface;
293G_DEFINE_INTERFACE (ControlHost, control_host, G_TYPE_OBJECT);
294
295static void
296control_host_default_init (ControlHostIface *iface)
297{
298 /* GObject signals for incoming D-Bus method calls: */
299 /**
300 * ControlHost::handle-boot:
301 * @object: A #ControlHost.
302 * @invocation: A #GDBusMethodInvocation.
303 *
304 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method.
305 *
306 * 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 control_host_complete_boot() 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.
307 *
308 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
309 */
310 g_signal_new ("handle-boot",
311 G_TYPE_FROM_INTERFACE (iface),
312 G_SIGNAL_RUN_LAST,
313 G_STRUCT_OFFSET (ControlHostIface, handle_boot),
314 g_signal_accumulator_true_handled,
315 NULL,
316 g_cclosure_marshal_generic,
317 G_TYPE_BOOLEAN,
318 1,
319 G_TYPE_DBUS_METHOD_INVOCATION);
320
321 /**
322 * ControlHost::handle-shutdown:
323 * @object: A #ControlHost.
324 * @invocation: A #GDBusMethodInvocation.
325 *
326 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method.
327 *
328 * 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 control_host_complete_shutdown() 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.
329 *
330 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
331 */
332 g_signal_new ("handle-shutdown",
333 G_TYPE_FROM_INTERFACE (iface),
334 G_SIGNAL_RUN_LAST,
335 G_STRUCT_OFFSET (ControlHostIface, handle_shutdown),
336 g_signal_accumulator_true_handled,
337 NULL,
338 g_cclosure_marshal_generic,
339 G_TYPE_BOOLEAN,
340 1,
341 G_TYPE_DBUS_METHOD_INVOCATION);
342
343 /**
344 * ControlHost::handle-reboot:
345 * @object: A #ControlHost.
346 * @invocation: A #GDBusMethodInvocation.
347 *
348 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method.
349 *
350 * 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 control_host_complete_reboot() 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.
351 *
352 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
353 */
354 g_signal_new ("handle-reboot",
355 G_TYPE_FROM_INTERFACE (iface),
356 G_SIGNAL_RUN_LAST,
357 G_STRUCT_OFFSET (ControlHostIface, handle_reboot),
358 g_signal_accumulator_true_handled,
359 NULL,
360 g_cclosure_marshal_generic,
361 G_TYPE_BOOLEAN,
362 1,
363 G_TYPE_DBUS_METHOD_INVOCATION);
364
365 /* GObject signals for received D-Bus signals: */
366 /**
367 * ControlHost::booted:
368 * @object: A #ControlHost.
369 *
370 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-control-Host.Booted">"Booted"</link> is received.
371 *
372 * 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.
373 */
374 g_signal_new ("booted",
375 G_TYPE_FROM_INTERFACE (iface),
376 G_SIGNAL_RUN_LAST,
377 G_STRUCT_OFFSET (ControlHostIface, booted),
378 NULL,
379 NULL,
380 g_cclosure_marshal_generic,
381 G_TYPE_NONE,
382 0);
383
384}
385
386/**
387 * control_host_emit_booted:
388 * @object: A #ControlHost.
389 *
390 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Host.Booted">"Booted"</link> D-Bus signal.
391 */
392void
393control_host_emit_booted (
394 ControlHost *object)
395{
396 g_signal_emit_by_name (object, "booted");
397}
398
399/**
400 * control_host_call_boot:
401 * @proxy: A #ControlHostProxy.
402 * @cancellable: (allow-none): A #GCancellable or %NULL.
403 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
404 * @user_data: User data to pass to @callback.
405 *
406 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method on @proxy.
407 * 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.
408 * You can then call control_host_call_boot_finish() to get the result of the operation.
409 *
410 * See control_host_call_boot_sync() for the synchronous, blocking version of this method.
411 */
412void
413control_host_call_boot (
414 ControlHost *proxy,
415 GCancellable *cancellable,
416 GAsyncReadyCallback callback,
417 gpointer user_data)
418{
419 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
420 "boot",
421 g_variant_new ("()"),
422 G_DBUS_CALL_FLAGS_NONE,
423 -1,
424 cancellable,
425 callback,
426 user_data);
427}
428
429/**
430 * control_host_call_boot_finish:
431 * @proxy: A #ControlHostProxy.
432 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_boot().
433 * @error: Return location for error or %NULL.
434 *
435 * Finishes an operation started with control_host_call_boot().
436 *
437 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
438 */
439gboolean
440control_host_call_boot_finish (
441 ControlHost *proxy,
442 GAsyncResult *res,
443 GError **error)
444{
445 GVariant *_ret;
446 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
447 if (_ret == NULL)
448 goto _out;
449 g_variant_get (_ret,
450 "()");
451 g_variant_unref (_ret);
452_out:
453 return _ret != NULL;
454}
455
456/**
457 * control_host_call_boot_sync:
458 * @proxy: A #ControlHostProxy.
459 * @cancellable: (allow-none): A #GCancellable or %NULL.
460 * @error: Return location for error or %NULL.
461 *
462 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
463 *
464 * See control_host_call_boot() for the asynchronous version of this method.
465 *
466 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
467 */
468gboolean
469control_host_call_boot_sync (
470 ControlHost *proxy,
471 GCancellable *cancellable,
472 GError **error)
473{
474 GVariant *_ret;
475 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
476 "boot",
477 g_variant_new ("()"),
478 G_DBUS_CALL_FLAGS_NONE,
479 -1,
480 cancellable,
481 error);
482 if (_ret == NULL)
483 goto _out;
484 g_variant_get (_ret,
485 "()");
486 g_variant_unref (_ret);
487_out:
488 return _ret != NULL;
489}
490
491/**
492 * control_host_call_shutdown:
493 * @proxy: A #ControlHostProxy.
494 * @cancellable: (allow-none): A #GCancellable or %NULL.
495 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
496 * @user_data: User data to pass to @callback.
497 *
498 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method on @proxy.
499 * 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.
500 * You can then call control_host_call_shutdown_finish() to get the result of the operation.
501 *
502 * See control_host_call_shutdown_sync() for the synchronous, blocking version of this method.
503 */
504void
505control_host_call_shutdown (
506 ControlHost *proxy,
507 GCancellable *cancellable,
508 GAsyncReadyCallback callback,
509 gpointer user_data)
510{
511 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
512 "shutdown",
513 g_variant_new ("()"),
514 G_DBUS_CALL_FLAGS_NONE,
515 -1,
516 cancellable,
517 callback,
518 user_data);
519}
520
521/**
522 * control_host_call_shutdown_finish:
523 * @proxy: A #ControlHostProxy.
524 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_shutdown().
525 * @error: Return location for error or %NULL.
526 *
527 * Finishes an operation started with control_host_call_shutdown().
528 *
529 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
530 */
531gboolean
532control_host_call_shutdown_finish (
533 ControlHost *proxy,
534 GAsyncResult *res,
535 GError **error)
536{
537 GVariant *_ret;
538 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
539 if (_ret == NULL)
540 goto _out;
541 g_variant_get (_ret,
542 "()");
543 g_variant_unref (_ret);
544_out:
545 return _ret != NULL;
546}
547
548/**
549 * control_host_call_shutdown_sync:
550 * @proxy: A #ControlHostProxy.
551 * @cancellable: (allow-none): A #GCancellable or %NULL.
552 * @error: Return location for error or %NULL.
553 *
554 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
555 *
556 * See control_host_call_shutdown() for the asynchronous version of this method.
557 *
558 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
559 */
560gboolean
561control_host_call_shutdown_sync (
562 ControlHost *proxy,
563 GCancellable *cancellable,
564 GError **error)
565{
566 GVariant *_ret;
567 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
568 "shutdown",
569 g_variant_new ("()"),
570 G_DBUS_CALL_FLAGS_NONE,
571 -1,
572 cancellable,
573 error);
574 if (_ret == NULL)
575 goto _out;
576 g_variant_get (_ret,
577 "()");
578 g_variant_unref (_ret);
579_out:
580 return _ret != NULL;
581}
582
583/**
584 * control_host_call_reboot:
585 * @proxy: A #ControlHostProxy.
586 * @cancellable: (allow-none): A #GCancellable or %NULL.
587 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
588 * @user_data: User data to pass to @callback.
589 *
590 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method on @proxy.
591 * 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.
592 * You can then call control_host_call_reboot_finish() to get the result of the operation.
593 *
594 * See control_host_call_reboot_sync() for the synchronous, blocking version of this method.
595 */
596void
597control_host_call_reboot (
598 ControlHost *proxy,
599 GCancellable *cancellable,
600 GAsyncReadyCallback callback,
601 gpointer user_data)
602{
603 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
604 "reboot",
605 g_variant_new ("()"),
606 G_DBUS_CALL_FLAGS_NONE,
607 -1,
608 cancellable,
609 callback,
610 user_data);
611}
612
613/**
614 * control_host_call_reboot_finish:
615 * @proxy: A #ControlHostProxy.
616 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_reboot().
617 * @error: Return location for error or %NULL.
618 *
619 * Finishes an operation started with control_host_call_reboot().
620 *
621 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
622 */
623gboolean
624control_host_call_reboot_finish (
625 ControlHost *proxy,
626 GAsyncResult *res,
627 GError **error)
628{
629 GVariant *_ret;
630 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
631 if (_ret == NULL)
632 goto _out;
633 g_variant_get (_ret,
634 "()");
635 g_variant_unref (_ret);
636_out:
637 return _ret != NULL;
638}
639
640/**
641 * control_host_call_reboot_sync:
642 * @proxy: A #ControlHostProxy.
643 * @cancellable: (allow-none): A #GCancellable or %NULL.
644 * @error: Return location for error or %NULL.
645 *
646 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
647 *
648 * See control_host_call_reboot() for the asynchronous version of this method.
649 *
650 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
651 */
652gboolean
653control_host_call_reboot_sync (
654 ControlHost *proxy,
655 GCancellable *cancellable,
656 GError **error)
657{
658 GVariant *_ret;
659 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
660 "reboot",
661 g_variant_new ("()"),
662 G_DBUS_CALL_FLAGS_NONE,
663 -1,
664 cancellable,
665 error);
666 if (_ret == NULL)
667 goto _out;
668 g_variant_get (_ret,
669 "()");
670 g_variant_unref (_ret);
671_out:
672 return _ret != NULL;
673}
674
675/**
676 * control_host_complete_boot:
677 * @object: A #ControlHost.
678 * @invocation: (transfer full): A #GDBusMethodInvocation.
679 *
680 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</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.
681 *
682 * This method will free @invocation, you cannot use it afterwards.
683 */
684void
685control_host_complete_boot (
686 ControlHost *object,
687 GDBusMethodInvocation *invocation)
688{
689 g_dbus_method_invocation_return_value (invocation,
690 g_variant_new ("()"));
691}
692
693/**
694 * control_host_complete_shutdown:
695 * @object: A #ControlHost.
696 * @invocation: (transfer full): A #GDBusMethodInvocation.
697 *
698 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</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.
699 *
700 * This method will free @invocation, you cannot use it afterwards.
701 */
702void
703control_host_complete_shutdown (
704 ControlHost *object,
705 GDBusMethodInvocation *invocation)
706{
707 g_dbus_method_invocation_return_value (invocation,
708 g_variant_new ("()"));
709}
710
711/**
712 * control_host_complete_reboot:
713 * @object: A #ControlHost.
714 * @invocation: (transfer full): A #GDBusMethodInvocation.
715 *
716 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</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.
717 *
718 * This method will free @invocation, you cannot use it afterwards.
719 */
720void
721control_host_complete_reboot (
722 ControlHost *object,
723 GDBusMethodInvocation *invocation)
724{
725 g_dbus_method_invocation_return_value (invocation,
726 g_variant_new ("()"));
727}
728
729/* ------------------------------------------------------------------------ */
730
731/**
732 * ControlHostProxy:
733 *
734 * The #ControlHostProxy structure contains only private data and should only be accessed using the provided API.
735 */
736
737/**
738 * ControlHostProxyClass:
739 * @parent_class: The parent class.
740 *
741 * Class structure for #ControlHostProxy.
742 */
743
744struct _ControlHostProxyPrivate
745{
746 GData *qdata;
747};
748
749static void control_host_proxy_iface_init (ControlHostIface *iface);
750
751#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
752G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
753 G_ADD_PRIVATE (ControlHostProxy)
754 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
755
756#else
757G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
758 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
759
760#endif
761static void
762control_host_proxy_finalize (GObject *object)
763{
764 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object);
765 g_datalist_clear (&proxy->priv->qdata);
766 G_OBJECT_CLASS (control_host_proxy_parent_class)->finalize (object);
767}
768
769static void
770control_host_proxy_get_property (GObject *object,
771 guint prop_id,
772 GValue *value,
773 GParamSpec *pspec G_GNUC_UNUSED)
774{
775}
776
777static void
778control_host_proxy_set_property (GObject *object,
779 guint prop_id,
780 const GValue *value,
781 GParamSpec *pspec G_GNUC_UNUSED)
782{
783}
784
785static void
786control_host_proxy_g_signal (GDBusProxy *proxy,
787 const gchar *sender_name G_GNUC_UNUSED,
788 const gchar *signal_name,
789 GVariant *parameters)
790{
791 _ExtendedGDBusSignalInfo *info;
792 GVariantIter iter;
793 GVariant *child;
794 GValue *paramv;
795 guint num_params;
796 guint n;
797 guint signal_id;
798 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, signal_name);
799 if (info == NULL)
800 return;
801 num_params = g_variant_n_children (parameters);
802 paramv = g_new0 (GValue, num_params + 1);
803 g_value_init (&paramv[0], TYPE_CONTROL_HOST);
804 g_value_set_object (&paramv[0], proxy);
805 g_variant_iter_init (&iter, parameters);
806 n = 1;
807 while ((child = g_variant_iter_next_value (&iter)) != NULL)
808 {
809 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
810 if (arg_info->use_gvariant)
811 {
812 g_value_init (&paramv[n], G_TYPE_VARIANT);
813 g_value_set_variant (&paramv[n], child);
814 n++;
815 }
816 else
817 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
818 g_variant_unref (child);
819 }
820 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
821 g_signal_emitv (paramv, signal_id, 0, NULL);
822 for (n = 0; n < num_params + 1; n++)
823 g_value_unset (&paramv[n]);
824 g_free (paramv);
825}
826
827static void
828control_host_proxy_g_properties_changed (GDBusProxy *_proxy,
829 GVariant *changed_properties,
830 const gchar *const *invalidated_properties)
831{
832 ControlHostProxy *proxy = CONTROL_HOST_PROXY (_proxy);
833 guint n;
834 const gchar *key;
835 GVariantIter *iter;
836 _ExtendedGDBusPropertyInfo *info;
837 g_variant_get (changed_properties, "a{sv}", &iter);
838 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
839 {
840 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, key);
841 g_datalist_remove_data (&proxy->priv->qdata, key);
842 if (info != NULL)
843 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
844 }
845 g_variant_iter_free (iter);
846 for (n = 0; invalidated_properties[n] != NULL; n++)
847 {
848 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, invalidated_properties[n]);
849 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
850 if (info != NULL)
851 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
852 }
853}
854
855static void
856control_host_proxy_init (ControlHostProxy *proxy)
857{
858#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
859 proxy->priv = control_host_proxy_get_instance_private (proxy);
860#else
861 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_HOST_PROXY, ControlHostProxyPrivate);
862#endif
863
864 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_host_interface_info ());
865}
866
867static void
868control_host_proxy_class_init (ControlHostProxyClass *klass)
869{
870 GObjectClass *gobject_class;
871 GDBusProxyClass *proxy_class;
872
873 gobject_class = G_OBJECT_CLASS (klass);
874 gobject_class->finalize = control_host_proxy_finalize;
875 gobject_class->get_property = control_host_proxy_get_property;
876 gobject_class->set_property = control_host_proxy_set_property;
877
878 proxy_class = G_DBUS_PROXY_CLASS (klass);
879 proxy_class->g_signal = control_host_proxy_g_signal;
880 proxy_class->g_properties_changed = control_host_proxy_g_properties_changed;
881
882#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
883 g_type_class_add_private (klass, sizeof (ControlHostProxyPrivate));
884#endif
885}
886
887static void
888control_host_proxy_iface_init (ControlHostIface *iface)
889{
890}
891
892/**
893 * control_host_proxy_new:
894 * @connection: A #GDBusConnection.
895 * @flags: Flags from the #GDBusProxyFlags enumeration.
896 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
897 * @object_path: An object path.
898 * @cancellable: (allow-none): A #GCancellable or %NULL.
899 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
900 * @user_data: User data to pass to @callback.
901 *
902 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>. See g_dbus_proxy_new() for more details.
903 *
904 * 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.
905 * You can then call control_host_proxy_new_finish() to get the result of the operation.
906 *
907 * See control_host_proxy_new_sync() for the synchronous, blocking version of this constructor.
908 */
909void
910control_host_proxy_new (
911 GDBusConnection *connection,
912 GDBusProxyFlags flags,
913 const gchar *name,
914 const gchar *object_path,
915 GCancellable *cancellable,
916 GAsyncReadyCallback callback,
917 gpointer user_data)
918{
919 g_async_initable_new_async (TYPE_CONTROL_HOST_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.control.Host", NULL);
920}
921
922/**
923 * control_host_proxy_new_finish:
924 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new().
925 * @error: Return location for error or %NULL
926 *
927 * Finishes an operation started with control_host_proxy_new().
928 *
929 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
930 */
931ControlHost *
932control_host_proxy_new_finish (
933 GAsyncResult *res,
934 GError **error)
935{
936 GObject *ret;
937 GObject *source_object;
938 source_object = g_async_result_get_source_object (res);
939 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
940 g_object_unref (source_object);
941 if (ret != NULL)
942 return CONTROL_HOST (ret);
943 else
944 return NULL;
945}
946
947/**
948 * control_host_proxy_new_sync:
949 * @connection: A #GDBusConnection.
950 * @flags: Flags from the #GDBusProxyFlags enumeration.
951 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
952 * @object_path: An object path.
953 * @cancellable: (allow-none): A #GCancellable or %NULL.
954 * @error: Return location for error or %NULL
955 *
956 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>. See g_dbus_proxy_new_sync() for more details.
957 *
958 * The calling thread is blocked until a reply is received.
959 *
960 * See control_host_proxy_new() for the asynchronous version of this constructor.
961 *
962 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
963 */
964ControlHost *
965control_host_proxy_new_sync (
966 GDBusConnection *connection,
967 GDBusProxyFlags flags,
968 const gchar *name,
969 const gchar *object_path,
970 GCancellable *cancellable,
971 GError **error)
972{
973 GInitable *ret;
974 ret = g_initable_new (TYPE_CONTROL_HOST_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Host", NULL);
975 if (ret != NULL)
976 return CONTROL_HOST (ret);
977 else
978 return NULL;
979}
980
981
982/**
983 * control_host_proxy_new_for_bus:
984 * @bus_type: A #GBusType.
985 * @flags: Flags from the #GDBusProxyFlags enumeration.
986 * @name: A bus name (well-known or unique).
987 * @object_path: An object path.
988 * @cancellable: (allow-none): A #GCancellable or %NULL.
989 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
990 * @user_data: User data to pass to @callback.
991 *
992 * Like control_host_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
993 *
994 * 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.
995 * You can then call control_host_proxy_new_for_bus_finish() to get the result of the operation.
996 *
997 * See control_host_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
998 */
999void
1000control_host_proxy_new_for_bus (
1001 GBusType bus_type,
1002 GDBusProxyFlags flags,
1003 const gchar *name,
1004 const gchar *object_path,
1005 GCancellable *cancellable,
1006 GAsyncReadyCallback callback,
1007 gpointer user_data)
1008{
1009 g_async_initable_new_async (TYPE_CONTROL_HOST_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.control.Host", NULL);
1010}
1011
1012/**
1013 * control_host_proxy_new_for_bus_finish:
1014 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new_for_bus().
1015 * @error: Return location for error or %NULL
1016 *
1017 * Finishes an operation started with control_host_proxy_new_for_bus().
1018 *
1019 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
1020 */
1021ControlHost *
1022control_host_proxy_new_for_bus_finish (
1023 GAsyncResult *res,
1024 GError **error)
1025{
1026 GObject *ret;
1027 GObject *source_object;
1028 source_object = g_async_result_get_source_object (res);
1029 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1030 g_object_unref (source_object);
1031 if (ret != NULL)
1032 return CONTROL_HOST (ret);
1033 else
1034 return NULL;
1035}
1036
1037/**
1038 * control_host_proxy_new_for_bus_sync:
1039 * @bus_type: A #GBusType.
1040 * @flags: Flags from the #GDBusProxyFlags enumeration.
1041 * @name: A bus name (well-known or unique).
1042 * @object_path: An object path.
1043 * @cancellable: (allow-none): A #GCancellable or %NULL.
1044 * @error: Return location for error or %NULL
1045 *
1046 * Like control_host_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
1047 *
1048 * The calling thread is blocked until a reply is received.
1049 *
1050 * See control_host_proxy_new_for_bus() for the asynchronous version of this constructor.
1051 *
1052 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
1053 */
1054ControlHost *
1055control_host_proxy_new_for_bus_sync (
1056 GBusType bus_type,
1057 GDBusProxyFlags flags,
1058 const gchar *name,
1059 const gchar *object_path,
1060 GCancellable *cancellable,
1061 GError **error)
1062{
1063 GInitable *ret;
1064 ret = g_initable_new (TYPE_CONTROL_HOST_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Host", NULL);
1065 if (ret != NULL)
1066 return CONTROL_HOST (ret);
1067 else
1068 return NULL;
1069}
1070
1071
1072/* ------------------------------------------------------------------------ */
1073
1074/**
1075 * ControlHostSkeleton:
1076 *
1077 * The #ControlHostSkeleton structure contains only private data and should only be accessed using the provided API.
1078 */
1079
1080/**
1081 * ControlHostSkeletonClass:
1082 * @parent_class: The parent class.
1083 *
1084 * Class structure for #ControlHostSkeleton.
1085 */
1086
1087struct _ControlHostSkeletonPrivate
1088{
1089 GValue *properties;
1090 GList *changed_properties;
1091 GSource *changed_properties_idle_source;
1092 GMainContext *context;
1093 GMutex lock;
1094};
1095
1096static void
1097_control_host_skeleton_handle_method_call (
1098 GDBusConnection *connection G_GNUC_UNUSED,
1099 const gchar *sender G_GNUC_UNUSED,
1100 const gchar *object_path G_GNUC_UNUSED,
1101 const gchar *interface_name,
1102 const gchar *method_name,
1103 GVariant *parameters,
1104 GDBusMethodInvocation *invocation,
1105 gpointer user_data)
1106{
1107 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
1108 _ExtendedGDBusMethodInfo *info;
1109 GVariantIter iter;
1110 GVariant *child;
1111 GValue *paramv;
1112 guint num_params;
1113 guint num_extra;
1114 guint n;
1115 guint signal_id;
1116 GValue return_value = G_VALUE_INIT;
1117 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
1118 g_assert (info != NULL);
1119 num_params = g_variant_n_children (parameters);
1120 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
1121 n = 0;
1122 g_value_init (&paramv[n], TYPE_CONTROL_HOST);
1123 g_value_set_object (&paramv[n++], skeleton);
1124 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
1125 g_value_set_object (&paramv[n++], invocation);
1126 if (info->pass_fdlist)
1127 {
1128#ifdef G_OS_UNIX
1129 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
1130 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
1131#else
1132 g_assert_not_reached ();
1133#endif
1134 }
1135 g_variant_iter_init (&iter, parameters);
1136 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1137 {
1138 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
1139 if (arg_info->use_gvariant)
1140 {
1141 g_value_init (&paramv[n], G_TYPE_VARIANT);
1142 g_value_set_variant (&paramv[n], child);
1143 n++;
1144 }
1145 else
1146 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
1147 g_variant_unref (child);
1148 }
1149 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
1150 g_value_init (&return_value, G_TYPE_BOOLEAN);
1151 g_signal_emitv (paramv, signal_id, 0, &return_value);
1152 if (!g_value_get_boolean (&return_value))
1153 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);
1154 g_value_unset (&return_value);
1155 for (n = 0; n < num_params + num_extra; n++)
1156 g_value_unset (&paramv[n]);
1157 g_free (paramv);
1158}
1159
1160static GVariant *
1161_control_host_skeleton_handle_get_property (
1162 GDBusConnection *connection G_GNUC_UNUSED,
1163 const gchar *sender G_GNUC_UNUSED,
1164 const gchar *object_path G_GNUC_UNUSED,
1165 const gchar *interface_name G_GNUC_UNUSED,
1166 const gchar *property_name,
1167 GError **error,
1168 gpointer user_data)
1169{
1170 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
1171 GValue value = G_VALUE_INIT;
1172 GParamSpec *pspec;
1173 _ExtendedGDBusPropertyInfo *info;
1174 GVariant *ret;
1175 ret = NULL;
1176 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
1177 g_assert (info != NULL);
1178 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1179 if (pspec == NULL)
1180 {
1181 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1182 }
1183 else
1184 {
1185 g_value_init (&value, pspec->value_type);
1186 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1187 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
1188 g_value_unset (&value);
1189 }
1190 return ret;
1191}
1192
1193static gboolean
1194_control_host_skeleton_handle_set_property (
1195 GDBusConnection *connection G_GNUC_UNUSED,
1196 const gchar *sender G_GNUC_UNUSED,
1197 const gchar *object_path G_GNUC_UNUSED,
1198 const gchar *interface_name G_GNUC_UNUSED,
1199 const gchar *property_name,
1200 GVariant *variant,
1201 GError **error,
1202 gpointer user_data)
1203{
1204 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
1205 GValue value = G_VALUE_INIT;
1206 GParamSpec *pspec;
1207 _ExtendedGDBusPropertyInfo *info;
1208 gboolean ret;
1209 ret = FALSE;
1210 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
1211 g_assert (info != NULL);
1212 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1213 if (pspec == NULL)
1214 {
1215 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1216 }
1217 else
1218 {
1219 if (info->use_gvariant)
1220 g_value_set_variant (&value, variant);
1221 else
1222 g_dbus_gvariant_to_gvalue (variant, &value);
1223 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1224 g_value_unset (&value);
1225 ret = TRUE;
1226 }
1227 return ret;
1228}
1229
1230static const GDBusInterfaceVTable _control_host_skeleton_vtable =
1231{
1232 _control_host_skeleton_handle_method_call,
1233 _control_host_skeleton_handle_get_property,
1234 _control_host_skeleton_handle_set_property,
1235 {NULL}
1236};
1237
1238static GDBusInterfaceInfo *
1239control_host_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1240{
1241 return control_host_interface_info ();
1242}
1243
1244static GDBusInterfaceVTable *
1245control_host_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1246{
1247 return (GDBusInterfaceVTable *) &_control_host_skeleton_vtable;
1248}
1249
1250static GVariant *
1251control_host_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
1252{
1253 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton);
1254
1255 GVariantBuilder builder;
1256 guint n;
1257 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1258 if (_control_host_interface_info.parent_struct.properties == NULL)
1259 goto out;
1260 for (n = 0; _control_host_interface_info.parent_struct.properties[n] != NULL; n++)
1261 {
1262 GDBusPropertyInfo *info = _control_host_interface_info.parent_struct.properties[n];
1263 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
1264 {
1265 GVariant *value;
1266 value = _control_host_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.control.Host", info->name, NULL, skeleton);
1267 if (value != NULL)
1268 {
1269 g_variant_take_ref (value);
1270 g_variant_builder_add (&builder, "{sv}", info->name, value);
1271 g_variant_unref (value);
1272 }
1273 }
1274 }
1275out:
1276 return g_variant_builder_end (&builder);
1277}
1278
1279static void
1280control_host_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
1281{
1282}
1283
1284static void
1285_control_host_on_signal_booted (
1286 ControlHost *object)
1287{
1288 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
1289
1290 GList *connections, *l;
1291 GVariant *signal_variant;
1292 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
1293
1294 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
1295 for (l = connections; l != NULL; l = l->next)
1296 {
1297 GDBusConnection *connection = l->data;
1298 g_dbus_connection_emit_signal (connection,
1299 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Host", "Booted",
1300 signal_variant, NULL);
1301 }
1302 g_variant_unref (signal_variant);
1303 g_list_free_full (connections, g_object_unref);
1304}
1305
1306static void control_host_skeleton_iface_init (ControlHostIface *iface);
1307#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1308G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1309 G_ADD_PRIVATE (ControlHostSkeleton)
1310 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
1311
1312#else
1313G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1314 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
1315
1316#endif
1317static void
1318control_host_skeleton_finalize (GObject *object)
1319{
1320 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
1321 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1322 if (skeleton->priv->changed_properties_idle_source != NULL)
1323 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1324 g_main_context_unref (skeleton->priv->context);
1325 g_mutex_clear (&skeleton->priv->lock);
1326 G_OBJECT_CLASS (control_host_skeleton_parent_class)->finalize (object);
1327}
1328
1329static void
1330control_host_skeleton_init (ControlHostSkeleton *skeleton)
1331{
1332#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1333 skeleton->priv = control_host_skeleton_get_instance_private (skeleton);
1334#else
1335 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_HOST_SKELETON, ControlHostSkeletonPrivate);
1336#endif
1337
1338 g_mutex_init (&skeleton->priv->lock);
1339 skeleton->priv->context = g_main_context_ref_thread_default ();
1340}
1341
1342static void
1343control_host_skeleton_class_init (ControlHostSkeletonClass *klass)
1344{
1345 GObjectClass *gobject_class;
1346 GDBusInterfaceSkeletonClass *skeleton_class;
1347
1348 gobject_class = G_OBJECT_CLASS (klass);
1349 gobject_class->finalize = control_host_skeleton_finalize;
1350
1351 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
1352 skeleton_class->get_info = control_host_skeleton_dbus_interface_get_info;
1353 skeleton_class->get_properties = control_host_skeleton_dbus_interface_get_properties;
1354 skeleton_class->flush = control_host_skeleton_dbus_interface_flush;
1355 skeleton_class->get_vtable = control_host_skeleton_dbus_interface_get_vtable;
1356
1357#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1358 g_type_class_add_private (klass, sizeof (ControlHostSkeletonPrivate));
1359#endif
1360}
1361
1362static void
1363control_host_skeleton_iface_init (ControlHostIface *iface)
1364{
1365 iface->booted = _control_host_on_signal_booted;
1366}
1367
1368/**
1369 * control_host_skeleton_new:
1370 *
1371 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
1372 *
1373 * Returns: (transfer full) (type ControlHostSkeleton): The skeleton object.
1374 */
1375ControlHost *
1376control_host_skeleton_new (void)
1377{
1378 return CONTROL_HOST (g_object_new (TYPE_CONTROL_HOST_SKELETON, NULL));
1379}
1380
1381/* ------------------------------------------------------------------------
1382 * Code for Object, ObjectProxy and ObjectSkeleton
1383 * ------------------------------------------------------------------------
1384 */
1385
1386/**
1387 * SECTION:Object
1388 * @title: Object
1389 * @short_description: Specialized GDBusObject types
1390 *
1391 * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
1392 */
1393
1394/**
1395 * Object:
1396 *
1397 * The #Object type is a specialized container of interfaces.
1398 */
1399
1400/**
1401 * ObjectIface:
1402 * @parent_iface: The parent interface.
1403 *
1404 * Virtual table for the #Object interface.
1405 */
1406
1407typedef ObjectIface ObjectInterface;
1408G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));
1409
1410static void
1411object_default_init (ObjectIface *iface)
1412{
1413 /**
1414 * Object:control-host:
1415 *
1416 * The #ControlHost instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>, if any.
1417 *
1418 * Connect to the #GObject::notify signal to get informed of property changes.
1419 */
1420 g_object_interface_install_property (iface, g_param_spec_object ("control-host", "control-host", "control-host", TYPE_CONTROL_HOST, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
1421
1422}
1423
1424/**
1425 * object_get_control_host:
1426 * @object: A #Object.
1427 *
1428 * Gets the #ControlHost instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link> on @object, if any.
1429 *
1430 * Returns: (transfer full): A #ControlHost that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
1431 */
1432ControlHost *object_get_control_host (Object *object)
1433{
1434 GDBusInterface *ret;
1435 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
1436 if (ret == NULL)
1437 return NULL;
1438 return CONTROL_HOST (ret);
1439}
1440
1441
1442/**
1443 * object_peek_control_host: (skip)
1444 * @object: A #Object.
1445 *
1446 * Like object_get_control_host() but doesn't increase the reference count on the returned object.
1447 *
1448 * <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>
1449 *
1450 * Returns: (transfer none): A #ControlHost or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
1451 */
1452ControlHost *object_peek_control_host (Object *object)
1453{
1454 GDBusInterface *ret;
1455 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
1456 if (ret == NULL)
1457 return NULL;
1458 g_object_unref (ret);
1459 return CONTROL_HOST (ret);
1460}
1461
1462
1463static void
1464object_notify (GDBusObject *object, GDBusInterface *interface)
1465{
1466 _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
1467 /* info can be NULL if the other end is using a D-Bus interface we don't know
1468 * anything about, for example old generated code in this process talking to
1469 * newer generated code in the other process. */
1470 if (info != NULL)
1471 g_object_notify (G_OBJECT (object), info->hyphen_name);
1472}
1473
1474/**
1475 * ObjectProxy:
1476 *
1477 * The #ObjectProxy structure contains only private data and should only be accessed using the provided API.
1478 */
1479
1480/**
1481 * ObjectProxyClass:
1482 * @parent_class: The parent class.
1483 *
1484 * Class structure for #ObjectProxy.
1485 */
1486
1487static void
1488object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
1489{
1490}
1491
1492static void
1493object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
1494{
1495 iface->interface_added = object_notify;
1496 iface->interface_removed = object_notify;
1497}
1498
1499
1500G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
1501 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init)
1502 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init));
1503
1504static void
1505object_proxy_init (ObjectProxy *object G_GNUC_UNUSED)
1506{
1507}
1508
1509static void
1510object_proxy_set_property (GObject *gobject,
1511 guint prop_id,
1512 const GValue *value G_GNUC_UNUSED,
1513 GParamSpec *pspec)
1514{
1515 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
1516}
1517
1518static void
1519object_proxy_get_property (GObject *gobject,
1520 guint prop_id,
1521 GValue *value,
1522 GParamSpec *pspec)
1523{
1524 ObjectProxy *object = OBJECT_PROXY (gobject);
1525 GDBusInterface *interface;
1526
1527 switch (prop_id)
1528 {
1529 case 1:
1530 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
1531 g_value_take_object (value, interface);
1532 break;
1533
1534 default:
1535 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
1536 break;
1537 }
1538}
1539
1540static void
1541object_proxy_class_init (ObjectProxyClass *klass)
1542{
1543 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
1544
1545 gobject_class->set_property = object_proxy_set_property;
1546 gobject_class->get_property = object_proxy_get_property;
1547
1548 g_object_class_override_property (gobject_class, 1, "control-host");
1549}
1550
1551/**
1552 * object_proxy_new:
1553 * @connection: A #GDBusConnection.
1554 * @object_path: An object path.
1555 *
1556 * Creates a new proxy object.
1557 *
1558 * Returns: (transfer full): The proxy object.
1559 */
1560ObjectProxy *
1561object_proxy_new (GDBusConnection *connection,
1562 const gchar *object_path)
1563{
1564 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
1565 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
1566 return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
1567}
1568
1569/**
1570 * ObjectSkeleton:
1571 *
1572 * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API.
1573 */
1574
1575/**
1576 * ObjectSkeletonClass:
1577 * @parent_class: The parent class.
1578 *
1579 * Class structure for #ObjectSkeleton.
1580 */
1581
1582static void
1583object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
1584{
1585}
1586
1587
1588static void
1589object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
1590{
1591 iface->interface_added = object_notify;
1592 iface->interface_removed = object_notify;
1593}
1594
1595G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
1596 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init)
1597 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init));
1598
1599static void
1600object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED)
1601{
1602}
1603
1604static void
1605object_skeleton_set_property (GObject *gobject,
1606 guint prop_id,
1607 const GValue *value,
1608 GParamSpec *pspec)
1609{
1610 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
1611 GDBusInterfaceSkeleton *interface;
1612
1613 switch (prop_id)
1614 {
1615 case 1:
1616 interface = g_value_get_object (value);
1617 if (interface != NULL)
1618 {
1619 g_warn_if_fail (IS_CONTROL_HOST (interface));
1620 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
1621 }
1622 else
1623 {
1624 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Host");
1625 }
1626 break;
1627
1628 default:
1629 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
1630 break;
1631 }
1632}
1633
1634static void
1635object_skeleton_get_property (GObject *gobject,
1636 guint prop_id,
1637 GValue *value,
1638 GParamSpec *pspec)
1639{
1640 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
1641 GDBusInterface *interface;
1642
1643 switch (prop_id)
1644 {
1645 case 1:
1646 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
1647 g_value_take_object (value, interface);
1648 break;
1649
1650 default:
1651 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
1652 break;
1653 }
1654}
1655
1656static void
1657object_skeleton_class_init (ObjectSkeletonClass *klass)
1658{
1659 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
1660
1661 gobject_class->set_property = object_skeleton_set_property;
1662 gobject_class->get_property = object_skeleton_get_property;
1663
1664 g_object_class_override_property (gobject_class, 1, "control-host");
1665}
1666
1667/**
1668 * object_skeleton_new:
1669 * @object_path: An object path.
1670 *
1671 * Creates a new skeleton object.
1672 *
1673 * Returns: (transfer full): The skeleton object.
1674 */
1675ObjectSkeleton *
1676object_skeleton_new (const gchar *object_path)
1677{
1678 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
1679 return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
1680}
1681
1682/**
1683 * object_skeleton_set_control_host:
1684 * @object: A #ObjectSkeleton.
1685 * @interface_: (allow-none): A #ControlHost or %NULL to clear the interface.
1686 *
1687 * Sets the #ControlHost instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link> on @object.
1688 */
1689void object_skeleton_set_control_host (ObjectSkeleton *object, ControlHost *interface_)
1690{
1691 g_object_set (G_OBJECT (object), "control-host", interface_, NULL);
1692}
1693
1694
1695/* ------------------------------------------------------------------------
1696 * Code for ObjectManager client
1697 * ------------------------------------------------------------------------
1698 */
1699
1700/**
1701 * SECTION:ObjectManagerClient
1702 * @title: ObjectManagerClient
1703 * @short_description: Generated GDBusObjectManagerClient type
1704 *
1705 * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
1706 */
1707
1708/**
1709 * ObjectManagerClient:
1710 *
1711 * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API.
1712 */
1713
1714/**
1715 * ObjectManagerClientClass:
1716 * @parent_class: The parent class.
1717 *
1718 * Class structure for #ObjectManagerClient.
1719 */
1720
1721G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT);
1722
1723static void
1724object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED)
1725{
1726}
1727
1728static void
1729object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED)
1730{
1731}
1732
1733/**
1734 * object_manager_client_get_proxy_type:
1735 * @manager: A #GDBusObjectManagerClient.
1736 * @object_path: The object path of the remote object (unused).
1737 * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType.
1738 * @user_data: User data (unused).
1739 *
1740 * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types.
1741 *
1742 * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy.
1743 */
1744GType
1745object_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)
1746{
1747 static gsize once_init_value = 0;
1748 static GHashTable *lookup_hash;
1749 GType ret;
1750
1751 if (interface_name == NULL)
1752 return TYPE_OBJECT_PROXY;
1753 if (g_once_init_enter (&once_init_value))
1754 {
1755 lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
1756 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Host", GSIZE_TO_POINTER (TYPE_CONTROL_HOST_PROXY));
1757 g_once_init_leave (&once_init_value, 1);
1758 }
1759 ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
1760 if (ret == (GType) 0)
1761 ret = G_TYPE_DBUS_PROXY;
1762 return ret;
1763}
1764
1765/**
1766 * object_manager_client_new:
1767 * @connection: A #GDBusConnection.
1768 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
1769 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1770 * @object_path: An object path.
1771 * @cancellable: (allow-none): A #GCancellable or %NULL.
1772 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1773 * @user_data: User data to pass to @callback.
1774 *
1775 * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
1776 *
1777 * 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.
1778 * You can then call object_manager_client_new_finish() to get the result of the operation.
1779 *
1780 * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
1781 */
1782void
1783object_manager_client_new (
1784 GDBusConnection *connection,
1785 GDBusObjectManagerClientFlags flags,
1786 const gchar *name,
1787 const gchar *object_path,
1788 GCancellable *cancellable,
1789 GAsyncReadyCallback callback,
1790 gpointer user_data)
1791{
1792 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);
1793}
1794
1795/**
1796 * object_manager_client_new_finish:
1797 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new().
1798 * @error: Return location for error or %NULL
1799 *
1800 * Finishes an operation started with object_manager_client_new().
1801 *
1802 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
1803 */
1804GDBusObjectManager *
1805object_manager_client_new_finish (
1806 GAsyncResult *res,
1807 GError **error)
1808{
1809 GObject *ret;
1810 GObject *source_object;
1811 source_object = g_async_result_get_source_object (res);
1812 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1813 g_object_unref (source_object);
1814 if (ret != NULL)
1815 return G_DBUS_OBJECT_MANAGER (ret);
1816 else
1817 return NULL;
1818}
1819
1820/**
1821 * object_manager_client_new_sync:
1822 * @connection: A #GDBusConnection.
1823 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
1824 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1825 * @object_path: An object path.
1826 * @cancellable: (allow-none): A #GCancellable or %NULL.
1827 * @error: Return location for error or %NULL
1828 *
1829 * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
1830 *
1831 * The calling thread is blocked until a reply is received.
1832 *
1833 * See object_manager_client_new() for the asynchronous version of this constructor.
1834 *
1835 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
1836 */
1837GDBusObjectManager *
1838object_manager_client_new_sync (
1839 GDBusConnection *connection,
1840 GDBusObjectManagerClientFlags flags,
1841 const gchar *name,
1842 const gchar *object_path,
1843 GCancellable *cancellable,
1844 GError **error)
1845{
1846 GInitable *ret;
1847 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);
1848 if (ret != NULL)
1849 return G_DBUS_OBJECT_MANAGER (ret);
1850 else
1851 return NULL;
1852}
1853
1854
1855/**
1856 * object_manager_client_new_for_bus:
1857 * @bus_type: A #GBusType.
1858 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
1859 * @name: A bus name (well-known or unique).
1860 * @object_path: An object path.
1861 * @cancellable: (allow-none): A #GCancellable or %NULL.
1862 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1863 * @user_data: User data to pass to @callback.
1864 *
1865 * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
1866 *
1867 * 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.
1868 * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation.
1869 *
1870 * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
1871 */
1872void
1873object_manager_client_new_for_bus (
1874 GBusType bus_type,
1875 GDBusObjectManagerClientFlags flags,
1876 const gchar *name,
1877 const gchar *object_path,
1878 GCancellable *cancellable,
1879 GAsyncReadyCallback callback,
1880 gpointer user_data)
1881{
1882 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);
1883}
1884
1885/**
1886 * object_manager_client_new_for_bus_finish:
1887 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus().
1888 * @error: Return location for error or %NULL
1889 *
1890 * Finishes an operation started with object_manager_client_new_for_bus().
1891 *
1892 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
1893 */
1894GDBusObjectManager *
1895object_manager_client_new_for_bus_finish (
1896 GAsyncResult *res,
1897 GError **error)
1898{
1899 GObject *ret;
1900 GObject *source_object;
1901 source_object = g_async_result_get_source_object (res);
1902 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1903 g_object_unref (source_object);
1904 if (ret != NULL)
1905 return G_DBUS_OBJECT_MANAGER (ret);
1906 else
1907 return NULL;
1908}
1909
1910/**
1911 * object_manager_client_new_for_bus_sync:
1912 * @bus_type: A #GBusType.
1913 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
1914 * @name: A bus name (well-known or unique).
1915 * @object_path: An object path.
1916 * @cancellable: (allow-none): A #GCancellable or %NULL.
1917 * @error: Return location for error or %NULL
1918 *
1919 * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
1920 *
1921 * The calling thread is blocked until a reply is received.
1922 *
1923 * See object_manager_client_new_for_bus() for the asynchronous version of this constructor.
1924 *
1925 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
1926 */
1927GDBusObjectManager *
1928object_manager_client_new_for_bus_sync (
1929 GBusType bus_type,
1930 GDBusObjectManagerClientFlags flags,
1931 const gchar *name,
1932 const gchar *object_path,
1933 GCancellable *cancellable,
1934 GError **error)
1935{
1936 GInitable *ret;
1937 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);
1938 if (ret != NULL)
1939 return G_DBUS_OBJECT_MANAGER (ret);
1940 else
1941 return NULL;
1942}
1943
1944