blob: 64804c889616514c89e236728f021d206d5f1807 [file] [log] [blame]
Norman James362a80f2015-09-14 14:04:39 -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/openbmc_intf.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.Occ
153 * ------------------------------------------------------------------------
154 */
155
156/**
157 * SECTION:Occ
158 * @title: Occ
159 * @short_description: Generated C code for the org.openbmc.Occ D-Bus interface
160 *
161 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link> D-Bus interface in C.
162 */
163
164/* ---- Introspection data for org.openbmc.Occ ---- */
165
166static const _ExtendedGDBusMethodInfo _occ_method_info_init =
167{
168 {
169 -1,
170 (gchar *) "init",
171 NULL,
172 NULL,
173 NULL
174 },
175 "handle-init",
176 FALSE
177};
178
179static const _ExtendedGDBusMethodInfo _occ_method_info_collect =
180{
181 {
182 -1,
183 (gchar *) "collect",
184 NULL,
185 NULL,
186 NULL
187 },
188 "handle-collect",
189 FALSE
190};
191
192static const _ExtendedGDBusMethodInfo * const _occ_method_info_pointers[] =
193{
194 &_occ_method_info_init,
195 &_occ_method_info_collect,
196 NULL
197};
198
199static const _ExtendedGDBusPropertyInfo _occ_property_info_state =
200{
201 {
202 -1,
203 (gchar *) "state",
204 (gchar *) "s",
205 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
206 NULL
207 },
208 "state",
209 FALSE
210};
211
212static const _ExtendedGDBusPropertyInfo _occ_property_info_poll_interval =
213{
214 {
215 -1,
216 (gchar *) "poll_interval",
217 (gchar *) "i",
218 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
219 NULL
220 },
221 "poll-interval",
222 FALSE
223};
224
225static const _ExtendedGDBusPropertyInfo * const _occ_property_info_pointers[] =
226{
227 &_occ_property_info_state,
228 &_occ_property_info_poll_interval,
229 NULL
230};
231
232static const _ExtendedGDBusInterfaceInfo _occ_interface_info =
233{
234 {
235 -1,
236 (gchar *) "org.openbmc.Occ",
237 (GDBusMethodInfo **) &_occ_method_info_pointers,
238 NULL,
239 (GDBusPropertyInfo **) &_occ_property_info_pointers,
240 NULL
241 },
242 "occ",
243};
244
245
246/**
247 * occ_interface_info:
248 *
249 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link> D-Bus interface.
250 *
251 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
252 */
253GDBusInterfaceInfo *
254occ_interface_info (void)
255{
256 return (GDBusInterfaceInfo *) &_occ_interface_info.parent_struct;
257}
258
259/**
260 * occ_override_properties:
261 * @klass: The class structure for a #GObject<!-- -->-derived class.
262 * @property_id_begin: The property id to assign to the first overridden property.
263 *
264 * Overrides all #GObject properties in the #Occ interface for a concrete class.
265 * The properties are overridden in the order they are defined.
266 *
267 * Returns: The last property id.
268 */
269guint
270occ_override_properties (GObjectClass *klass, guint property_id_begin)
271{
272 g_object_class_override_property (klass, property_id_begin++, "state");
273 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
274 return property_id_begin - 1;
275}
276
277
278
279/**
280 * Occ:
281 *
282 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>.
283 */
284
285/**
286 * OccIface:
287 * @parent_iface: The parent interface.
288 * @handle_collect: Handler for the #Occ::handle-collect signal.
289 * @handle_init: Handler for the #Occ::handle-init signal.
290 * @get_poll_interval: Getter for the #Occ:poll-interval property.
291 * @get_state: Getter for the #Occ:state property.
292 *
293 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>.
294 */
295
296typedef OccIface OccInterface;
297G_DEFINE_INTERFACE (Occ, occ, G_TYPE_OBJECT);
298
299static void
300occ_default_init (OccIface *iface)
301{
302 /* GObject signals for incoming D-Bus method calls: */
303 /**
304 * Occ::handle-init:
305 * @object: A #Occ.
306 * @invocation: A #GDBusMethodInvocation.
307 *
308 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Occ.init">init()</link> D-Bus method.
309 *
310 * 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 occ_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.
311 *
312 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
313 */
314 g_signal_new ("handle-init",
315 G_TYPE_FROM_INTERFACE (iface),
316 G_SIGNAL_RUN_LAST,
317 G_STRUCT_OFFSET (OccIface, handle_init),
318 g_signal_accumulator_true_handled,
319 NULL,
320 g_cclosure_marshal_generic,
321 G_TYPE_BOOLEAN,
322 1,
323 G_TYPE_DBUS_METHOD_INVOCATION);
324
325 /**
326 * Occ::handle-collect:
327 * @object: A #Occ.
328 * @invocation: A #GDBusMethodInvocation.
329 *
330 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Occ.collect">collect()</link> D-Bus method.
331 *
332 * 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 occ_complete_collect() 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.
333 *
334 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
335 */
336 g_signal_new ("handle-collect",
337 G_TYPE_FROM_INTERFACE (iface),
338 G_SIGNAL_RUN_LAST,
339 G_STRUCT_OFFSET (OccIface, handle_collect),
340 g_signal_accumulator_true_handled,
341 NULL,
342 g_cclosure_marshal_generic,
343 G_TYPE_BOOLEAN,
344 1,
345 G_TYPE_DBUS_METHOD_INVOCATION);
346
347 /* GObject properties for D-Bus properties: */
348 /**
349 * Occ:state:
350 *
351 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Occ.state">"state"</link>.
352 *
353 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
354 */
355 g_object_interface_install_property (iface,
356 g_param_spec_string ("state", "state", "state", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
357 /**
358 * Occ:poll-interval:
359 *
360 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Occ.poll_interval">"poll_interval"</link>.
361 *
362 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
363 */
364 g_object_interface_install_property (iface,
365 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
366}
367
368/**
369 * occ_get_state: (skip)
370 * @object: A #Occ.
371 *
372 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Occ.state">"state"</link> D-Bus property.
373 *
374 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
375 *
376 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use occ_dup_state() if on another thread.</warning>
377 *
378 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
379 */
380const gchar *
381occ_get_state (Occ *object)
382{
383 return OCC_GET_IFACE (object)->get_state (object);
384}
385
386/**
387 * occ_dup_state: (skip)
388 * @object: A #Occ.
389 *
390 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Occ.state">"state"</link> D-Bus property.
391 *
392 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
393 *
394 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
395 */
396gchar *
397occ_dup_state (Occ *object)
398{
399 gchar *value;
400 g_object_get (G_OBJECT (object), "state", &value, NULL);
401 return value;
402}
403
404/**
405 * occ_set_state: (skip)
406 * @object: A #Occ.
407 * @value: The value to set.
408 *
409 * Sets the <link linkend="gdbus-property-org-openbmc-Occ.state">"state"</link> D-Bus property to @value.
410 *
411 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
412 */
413void
414occ_set_state (Occ *object, const gchar *value)
415{
416 g_object_set (G_OBJECT (object), "state", value, NULL);
417}
418
419/**
420 * occ_get_poll_interval: (skip)
421 * @object: A #Occ.
422 *
423 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Occ.poll_interval">"poll_interval"</link> D-Bus property.
424 *
425 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
426 *
427 * Returns: The property value.
428 */
429gint
430occ_get_poll_interval (Occ *object)
431{
432 return OCC_GET_IFACE (object)->get_poll_interval (object);
433}
434
435/**
436 * occ_set_poll_interval: (skip)
437 * @object: A #Occ.
438 * @value: The value to set.
439 *
440 * Sets the <link linkend="gdbus-property-org-openbmc-Occ.poll_interval">"poll_interval"</link> D-Bus property to @value.
441 *
442 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
443 */
444void
445occ_set_poll_interval (Occ *object, gint value)
446{
447 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
448}
449
450/**
451 * occ_call_init:
452 * @proxy: A #OccProxy.
453 * @cancellable: (allow-none): A #GCancellable or %NULL.
454 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
455 * @user_data: User data to pass to @callback.
456 *
457 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Occ.init">init()</link> D-Bus method on @proxy.
458 * 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.
459 * You can then call occ_call_init_finish() to get the result of the operation.
460 *
461 * See occ_call_init_sync() for the synchronous, blocking version of this method.
462 */
463void
464occ_call_init (
465 Occ *proxy,
466 GCancellable *cancellable,
467 GAsyncReadyCallback callback,
468 gpointer user_data)
469{
470 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
471 "init",
472 g_variant_new ("()"),
473 G_DBUS_CALL_FLAGS_NONE,
474 -1,
475 cancellable,
476 callback,
477 user_data);
478}
479
480/**
481 * occ_call_init_finish:
482 * @proxy: A #OccProxy.
483 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to occ_call_init().
484 * @error: Return location for error or %NULL.
485 *
486 * Finishes an operation started with occ_call_init().
487 *
488 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
489 */
490gboolean
491occ_call_init_finish (
492 Occ *proxy,
493 GAsyncResult *res,
494 GError **error)
495{
496 GVariant *_ret;
497 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
498 if (_ret == NULL)
499 goto _out;
500 g_variant_get (_ret,
501 "()");
502 g_variant_unref (_ret);
503_out:
504 return _ret != NULL;
505}
506
507/**
508 * occ_call_init_sync:
509 * @proxy: A #OccProxy.
510 * @cancellable: (allow-none): A #GCancellable or %NULL.
511 * @error: Return location for error or %NULL.
512 *
513 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Occ.init">init()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
514 *
515 * See occ_call_init() for the asynchronous version of this method.
516 *
517 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
518 */
519gboolean
520occ_call_init_sync (
521 Occ *proxy,
522 GCancellable *cancellable,
523 GError **error)
524{
525 GVariant *_ret;
526 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
527 "init",
528 g_variant_new ("()"),
529 G_DBUS_CALL_FLAGS_NONE,
530 -1,
531 cancellable,
532 error);
533 if (_ret == NULL)
534 goto _out;
535 g_variant_get (_ret,
536 "()");
537 g_variant_unref (_ret);
538_out:
539 return _ret != NULL;
540}
541
542/**
543 * occ_call_collect:
544 * @proxy: A #OccProxy.
545 * @cancellable: (allow-none): A #GCancellable or %NULL.
546 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
547 * @user_data: User data to pass to @callback.
548 *
549 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Occ.collect">collect()</link> D-Bus method on @proxy.
550 * 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.
551 * You can then call occ_call_collect_finish() to get the result of the operation.
552 *
553 * See occ_call_collect_sync() for the synchronous, blocking version of this method.
554 */
555void
556occ_call_collect (
557 Occ *proxy,
558 GCancellable *cancellable,
559 GAsyncReadyCallback callback,
560 gpointer user_data)
561{
562 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
563 "collect",
564 g_variant_new ("()"),
565 G_DBUS_CALL_FLAGS_NONE,
566 -1,
567 cancellable,
568 callback,
569 user_data);
570}
571
572/**
573 * occ_call_collect_finish:
574 * @proxy: A #OccProxy.
575 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to occ_call_collect().
576 * @error: Return location for error or %NULL.
577 *
578 * Finishes an operation started with occ_call_collect().
579 *
580 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
581 */
582gboolean
583occ_call_collect_finish (
584 Occ *proxy,
585 GAsyncResult *res,
586 GError **error)
587{
588 GVariant *_ret;
589 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
590 if (_ret == NULL)
591 goto _out;
592 g_variant_get (_ret,
593 "()");
594 g_variant_unref (_ret);
595_out:
596 return _ret != NULL;
597}
598
599/**
600 * occ_call_collect_sync:
601 * @proxy: A #OccProxy.
602 * @cancellable: (allow-none): A #GCancellable or %NULL.
603 * @error: Return location for error or %NULL.
604 *
605 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Occ.collect">collect()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
606 *
607 * See occ_call_collect() for the asynchronous version of this method.
608 *
609 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
610 */
611gboolean
612occ_call_collect_sync (
613 Occ *proxy,
614 GCancellable *cancellable,
615 GError **error)
616{
617 GVariant *_ret;
618 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
619 "collect",
620 g_variant_new ("()"),
621 G_DBUS_CALL_FLAGS_NONE,
622 -1,
623 cancellable,
624 error);
625 if (_ret == NULL)
626 goto _out;
627 g_variant_get (_ret,
628 "()");
629 g_variant_unref (_ret);
630_out:
631 return _ret != NULL;
632}
633
634/**
635 * occ_complete_init:
636 * @object: A #Occ.
637 * @invocation: (transfer full): A #GDBusMethodInvocation.
638 *
639 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Occ.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.
640 *
641 * This method will free @invocation, you cannot use it afterwards.
642 */
643void
644occ_complete_init (
645 Occ *object,
646 GDBusMethodInvocation *invocation)
647{
648 g_dbus_method_invocation_return_value (invocation,
649 g_variant_new ("()"));
650}
651
652/**
653 * occ_complete_collect:
654 * @object: A #Occ.
655 * @invocation: (transfer full): A #GDBusMethodInvocation.
656 *
657 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Occ.collect">collect()</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.
658 *
659 * This method will free @invocation, you cannot use it afterwards.
660 */
661void
662occ_complete_collect (
663 Occ *object,
664 GDBusMethodInvocation *invocation)
665{
666 g_dbus_method_invocation_return_value (invocation,
667 g_variant_new ("()"));
668}
669
670/* ------------------------------------------------------------------------ */
671
672/**
673 * OccProxy:
674 *
675 * The #OccProxy structure contains only private data and should only be accessed using the provided API.
676 */
677
678/**
679 * OccProxyClass:
680 * @parent_class: The parent class.
681 *
682 * Class structure for #OccProxy.
683 */
684
685struct _OccProxyPrivate
686{
687 GData *qdata;
688};
689
690static void occ_proxy_iface_init (OccIface *iface);
691
692#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
693G_DEFINE_TYPE_WITH_CODE (OccProxy, occ_proxy, G_TYPE_DBUS_PROXY,
694 G_ADD_PRIVATE (OccProxy)
695 G_IMPLEMENT_INTERFACE (TYPE_OCC, occ_proxy_iface_init));
696
697#else
698G_DEFINE_TYPE_WITH_CODE (OccProxy, occ_proxy, G_TYPE_DBUS_PROXY,
699 G_IMPLEMENT_INTERFACE (TYPE_OCC, occ_proxy_iface_init));
700
701#endif
702static void
703occ_proxy_finalize (GObject *object)
704{
705 OccProxy *proxy = OCC_PROXY (object);
706 g_datalist_clear (&proxy->priv->qdata);
707 G_OBJECT_CLASS (occ_proxy_parent_class)->finalize (object);
708}
709
710static void
711occ_proxy_get_property (GObject *object,
712 guint prop_id,
713 GValue *value,
714 GParamSpec *pspec G_GNUC_UNUSED)
715{
716 const _ExtendedGDBusPropertyInfo *info;
717 GVariant *variant;
718 g_assert (prop_id != 0 && prop_id - 1 < 2);
719 info = _occ_property_info_pointers[prop_id - 1];
720 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
721 if (info->use_gvariant)
722 {
723 g_value_set_variant (value, variant);
724 }
725 else
726 {
727 if (variant != NULL)
728 g_dbus_gvariant_to_gvalue (variant, value);
729 }
730 if (variant != NULL)
731 g_variant_unref (variant);
732}
733
734static void
735occ_proxy_set_property_cb (GDBusProxy *proxy,
736 GAsyncResult *res,
737 gpointer user_data)
738{
739 const _ExtendedGDBusPropertyInfo *info = user_data;
740 GError *error;
741 GVariant *_ret;
742 error = NULL;
743 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
744 if (!_ret)
745 {
746 g_warning ("Error setting property '%s' on interface org.openbmc.Occ: %s (%s, %d)",
747 info->parent_struct.name,
748 error->message, g_quark_to_string (error->domain), error->code);
749 g_error_free (error);
750 }
751 else
752 {
753 g_variant_unref (_ret);
754 }
755}
756
757static void
758occ_proxy_set_property (GObject *object,
759 guint prop_id,
760 const GValue *value,
761 GParamSpec *pspec G_GNUC_UNUSED)
762{
763 const _ExtendedGDBusPropertyInfo *info;
764 GVariant *variant;
765 g_assert (prop_id != 0 && prop_id - 1 < 2);
766 info = _occ_property_info_pointers[prop_id - 1];
767 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
768 g_dbus_proxy_call (G_DBUS_PROXY (object),
769 "org.freedesktop.DBus.Properties.Set",
770 g_variant_new ("(ssv)", "org.openbmc.Occ", info->parent_struct.name, variant),
771 G_DBUS_CALL_FLAGS_NONE,
772 -1,
773 NULL, (GAsyncReadyCallback) occ_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
774 g_variant_unref (variant);
775}
776
777static void
778occ_proxy_g_signal (GDBusProxy *proxy,
779 const gchar *sender_name G_GNUC_UNUSED,
780 const gchar *signal_name,
781 GVariant *parameters)
782{
783 _ExtendedGDBusSignalInfo *info;
784 GVariantIter iter;
785 GVariant *child;
786 GValue *paramv;
787 guint num_params;
788 guint n;
789 guint signal_id;
790 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_occ_interface_info.parent_struct, signal_name);
791 if (info == NULL)
792 return;
793 num_params = g_variant_n_children (parameters);
794 paramv = g_new0 (GValue, num_params + 1);
795 g_value_init (&paramv[0], TYPE_OCC);
796 g_value_set_object (&paramv[0], proxy);
797 g_variant_iter_init (&iter, parameters);
798 n = 1;
799 while ((child = g_variant_iter_next_value (&iter)) != NULL)
800 {
801 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
802 if (arg_info->use_gvariant)
803 {
804 g_value_init (&paramv[n], G_TYPE_VARIANT);
805 g_value_set_variant (&paramv[n], child);
806 n++;
807 }
808 else
809 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
810 g_variant_unref (child);
811 }
812 signal_id = g_signal_lookup (info->signal_name, TYPE_OCC);
813 g_signal_emitv (paramv, signal_id, 0, NULL);
814 for (n = 0; n < num_params + 1; n++)
815 g_value_unset (&paramv[n]);
816 g_free (paramv);
817}
818
819static void
820occ_proxy_g_properties_changed (GDBusProxy *_proxy,
821 GVariant *changed_properties,
822 const gchar *const *invalidated_properties)
823{
824 OccProxy *proxy = OCC_PROXY (_proxy);
825 guint n;
826 const gchar *key;
827 GVariantIter *iter;
828 _ExtendedGDBusPropertyInfo *info;
829 g_variant_get (changed_properties, "a{sv}", &iter);
830 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
831 {
832 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_occ_interface_info.parent_struct, key);
833 g_datalist_remove_data (&proxy->priv->qdata, key);
834 if (info != NULL)
835 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
836 }
837 g_variant_iter_free (iter);
838 for (n = 0; invalidated_properties[n] != NULL; n++)
839 {
840 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_occ_interface_info.parent_struct, invalidated_properties[n]);
841 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
842 if (info != NULL)
843 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
844 }
845}
846
847static const gchar *
848occ_proxy_get_state (Occ *object)
849{
850 OccProxy *proxy = OCC_PROXY (object);
851 GVariant *variant;
852 const gchar *value = NULL;
853 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
854 if (variant != NULL)
855 {
856 value = g_variant_get_string (variant, NULL);
857 g_variant_unref (variant);
858 }
859 return value;
860}
861
862static gint
863occ_proxy_get_poll_interval (Occ *object)
864{
865 OccProxy *proxy = OCC_PROXY (object);
866 GVariant *variant;
867 gint value = 0;
868 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
869 if (variant != NULL)
870 {
871 value = g_variant_get_int32 (variant);
872 g_variant_unref (variant);
873 }
874 return value;
875}
876
877static void
878occ_proxy_init (OccProxy *proxy)
879{
880#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
881 proxy->priv = occ_proxy_get_instance_private (proxy);
882#else
883 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_OCC_PROXY, OccProxyPrivate);
884#endif
885
886 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), occ_interface_info ());
887}
888
889static void
890occ_proxy_class_init (OccProxyClass *klass)
891{
892 GObjectClass *gobject_class;
893 GDBusProxyClass *proxy_class;
894
895 gobject_class = G_OBJECT_CLASS (klass);
896 gobject_class->finalize = occ_proxy_finalize;
897 gobject_class->get_property = occ_proxy_get_property;
898 gobject_class->set_property = occ_proxy_set_property;
899
900 proxy_class = G_DBUS_PROXY_CLASS (klass);
901 proxy_class->g_signal = occ_proxy_g_signal;
902 proxy_class->g_properties_changed = occ_proxy_g_properties_changed;
903
904 occ_override_properties (gobject_class, 1);
905
906#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
907 g_type_class_add_private (klass, sizeof (OccProxyPrivate));
908#endif
909}
910
911static void
912occ_proxy_iface_init (OccIface *iface)
913{
914 iface->get_state = occ_proxy_get_state;
915 iface->get_poll_interval = occ_proxy_get_poll_interval;
916}
917
918/**
919 * occ_proxy_new:
920 * @connection: A #GDBusConnection.
921 * @flags: Flags from the #GDBusProxyFlags enumeration.
922 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
923 * @object_path: An object path.
924 * @cancellable: (allow-none): A #GCancellable or %NULL.
925 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
926 * @user_data: User data to pass to @callback.
927 *
928 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>. See g_dbus_proxy_new() for more details.
929 *
930 * 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.
931 * You can then call occ_proxy_new_finish() to get the result of the operation.
932 *
933 * See occ_proxy_new_sync() for the synchronous, blocking version of this constructor.
934 */
935void
936occ_proxy_new (
937 GDBusConnection *connection,
938 GDBusProxyFlags flags,
939 const gchar *name,
940 const gchar *object_path,
941 GCancellable *cancellable,
942 GAsyncReadyCallback callback,
943 gpointer user_data)
944{
945 g_async_initable_new_async (TYPE_OCC_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.Occ", NULL);
946}
947
948/**
949 * occ_proxy_new_finish:
950 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to occ_proxy_new().
951 * @error: Return location for error or %NULL
952 *
953 * Finishes an operation started with occ_proxy_new().
954 *
955 * Returns: (transfer full) (type OccProxy): The constructed proxy object or %NULL if @error is set.
956 */
957Occ *
958occ_proxy_new_finish (
959 GAsyncResult *res,
960 GError **error)
961{
962 GObject *ret;
963 GObject *source_object;
964 source_object = g_async_result_get_source_object (res);
965 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
966 g_object_unref (source_object);
967 if (ret != NULL)
968 return OCC (ret);
969 else
970 return NULL;
971}
972
973/**
974 * occ_proxy_new_sync:
975 * @connection: A #GDBusConnection.
976 * @flags: Flags from the #GDBusProxyFlags enumeration.
977 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
978 * @object_path: An object path.
979 * @cancellable: (allow-none): A #GCancellable or %NULL.
980 * @error: Return location for error or %NULL
981 *
982 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>. See g_dbus_proxy_new_sync() for more details.
983 *
984 * The calling thread is blocked until a reply is received.
985 *
986 * See occ_proxy_new() for the asynchronous version of this constructor.
987 *
988 * Returns: (transfer full) (type OccProxy): The constructed proxy object or %NULL if @error is set.
989 */
990Occ *
991occ_proxy_new_sync (
992 GDBusConnection *connection,
993 GDBusProxyFlags flags,
994 const gchar *name,
995 const gchar *object_path,
996 GCancellable *cancellable,
997 GError **error)
998{
999 GInitable *ret;
1000 ret = g_initable_new (TYPE_OCC_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Occ", NULL);
1001 if (ret != NULL)
1002 return OCC (ret);
1003 else
1004 return NULL;
1005}
1006
1007
1008/**
1009 * occ_proxy_new_for_bus:
1010 * @bus_type: A #GBusType.
1011 * @flags: Flags from the #GDBusProxyFlags enumeration.
1012 * @name: A bus name (well-known or unique).
1013 * @object_path: An object path.
1014 * @cancellable: (allow-none): A #GCancellable or %NULL.
1015 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1016 * @user_data: User data to pass to @callback.
1017 *
1018 * Like occ_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
1019 *
1020 * 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.
1021 * You can then call occ_proxy_new_for_bus_finish() to get the result of the operation.
1022 *
1023 * See occ_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
1024 */
1025void
1026occ_proxy_new_for_bus (
1027 GBusType bus_type,
1028 GDBusProxyFlags flags,
1029 const gchar *name,
1030 const gchar *object_path,
1031 GCancellable *cancellable,
1032 GAsyncReadyCallback callback,
1033 gpointer user_data)
1034{
1035 g_async_initable_new_async (TYPE_OCC_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.Occ", NULL);
1036}
1037
1038/**
1039 * occ_proxy_new_for_bus_finish:
1040 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to occ_proxy_new_for_bus().
1041 * @error: Return location for error or %NULL
1042 *
1043 * Finishes an operation started with occ_proxy_new_for_bus().
1044 *
1045 * Returns: (transfer full) (type OccProxy): The constructed proxy object or %NULL if @error is set.
1046 */
1047Occ *
1048occ_proxy_new_for_bus_finish (
1049 GAsyncResult *res,
1050 GError **error)
1051{
1052 GObject *ret;
1053 GObject *source_object;
1054 source_object = g_async_result_get_source_object (res);
1055 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1056 g_object_unref (source_object);
1057 if (ret != NULL)
1058 return OCC (ret);
1059 else
1060 return NULL;
1061}
1062
1063/**
1064 * occ_proxy_new_for_bus_sync:
1065 * @bus_type: A #GBusType.
1066 * @flags: Flags from the #GDBusProxyFlags enumeration.
1067 * @name: A bus name (well-known or unique).
1068 * @object_path: An object path.
1069 * @cancellable: (allow-none): A #GCancellable or %NULL.
1070 * @error: Return location for error or %NULL
1071 *
1072 * Like occ_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
1073 *
1074 * The calling thread is blocked until a reply is received.
1075 *
1076 * See occ_proxy_new_for_bus() for the asynchronous version of this constructor.
1077 *
1078 * Returns: (transfer full) (type OccProxy): The constructed proxy object or %NULL if @error is set.
1079 */
1080Occ *
1081occ_proxy_new_for_bus_sync (
1082 GBusType bus_type,
1083 GDBusProxyFlags flags,
1084 const gchar *name,
1085 const gchar *object_path,
1086 GCancellable *cancellable,
1087 GError **error)
1088{
1089 GInitable *ret;
1090 ret = g_initable_new (TYPE_OCC_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Occ", NULL);
1091 if (ret != NULL)
1092 return OCC (ret);
1093 else
1094 return NULL;
1095}
1096
1097
1098/* ------------------------------------------------------------------------ */
1099
1100/**
1101 * OccSkeleton:
1102 *
1103 * The #OccSkeleton structure contains only private data and should only be accessed using the provided API.
1104 */
1105
1106/**
1107 * OccSkeletonClass:
1108 * @parent_class: The parent class.
1109 *
1110 * Class structure for #OccSkeleton.
1111 */
1112
1113struct _OccSkeletonPrivate
1114{
1115 GValue *properties;
1116 GList *changed_properties;
1117 GSource *changed_properties_idle_source;
1118 GMainContext *context;
1119 GMutex lock;
1120};
1121
1122static void
1123_occ_skeleton_handle_method_call (
1124 GDBusConnection *connection G_GNUC_UNUSED,
1125 const gchar *sender G_GNUC_UNUSED,
1126 const gchar *object_path G_GNUC_UNUSED,
1127 const gchar *interface_name,
1128 const gchar *method_name,
1129 GVariant *parameters,
1130 GDBusMethodInvocation *invocation,
1131 gpointer user_data)
1132{
1133 OccSkeleton *skeleton = OCC_SKELETON (user_data);
1134 _ExtendedGDBusMethodInfo *info;
1135 GVariantIter iter;
1136 GVariant *child;
1137 GValue *paramv;
1138 guint num_params;
1139 guint num_extra;
1140 guint n;
1141 guint signal_id;
1142 GValue return_value = G_VALUE_INIT;
1143 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
1144 g_assert (info != NULL);
1145 num_params = g_variant_n_children (parameters);
1146 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
1147 n = 0;
1148 g_value_init (&paramv[n], TYPE_OCC);
1149 g_value_set_object (&paramv[n++], skeleton);
1150 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
1151 g_value_set_object (&paramv[n++], invocation);
1152 if (info->pass_fdlist)
1153 {
1154#ifdef G_OS_UNIX
1155 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
1156 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
1157#else
1158 g_assert_not_reached ();
1159#endif
1160 }
1161 g_variant_iter_init (&iter, parameters);
1162 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1163 {
1164 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
1165 if (arg_info->use_gvariant)
1166 {
1167 g_value_init (&paramv[n], G_TYPE_VARIANT);
1168 g_value_set_variant (&paramv[n], child);
1169 n++;
1170 }
1171 else
1172 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
1173 g_variant_unref (child);
1174 }
1175 signal_id = g_signal_lookup (info->signal_name, TYPE_OCC);
1176 g_value_init (&return_value, G_TYPE_BOOLEAN);
1177 g_signal_emitv (paramv, signal_id, 0, &return_value);
1178 if (!g_value_get_boolean (&return_value))
1179 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);
1180 g_value_unset (&return_value);
1181 for (n = 0; n < num_params + num_extra; n++)
1182 g_value_unset (&paramv[n]);
1183 g_free (paramv);
1184}
1185
1186static GVariant *
1187_occ_skeleton_handle_get_property (
1188 GDBusConnection *connection G_GNUC_UNUSED,
1189 const gchar *sender G_GNUC_UNUSED,
1190 const gchar *object_path G_GNUC_UNUSED,
1191 const gchar *interface_name G_GNUC_UNUSED,
1192 const gchar *property_name,
1193 GError **error,
1194 gpointer user_data)
1195{
1196 OccSkeleton *skeleton = OCC_SKELETON (user_data);
1197 GValue value = G_VALUE_INIT;
1198 GParamSpec *pspec;
1199 _ExtendedGDBusPropertyInfo *info;
1200 GVariant *ret;
1201 ret = NULL;
1202 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_occ_interface_info.parent_struct, property_name);
1203 g_assert (info != NULL);
1204 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1205 if (pspec == NULL)
1206 {
1207 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1208 }
1209 else
1210 {
1211 g_value_init (&value, pspec->value_type);
1212 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1213 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
1214 g_value_unset (&value);
1215 }
1216 return ret;
1217}
1218
1219static gboolean
1220_occ_skeleton_handle_set_property (
1221 GDBusConnection *connection G_GNUC_UNUSED,
1222 const gchar *sender G_GNUC_UNUSED,
1223 const gchar *object_path G_GNUC_UNUSED,
1224 const gchar *interface_name G_GNUC_UNUSED,
1225 const gchar *property_name,
1226 GVariant *variant,
1227 GError **error,
1228 gpointer user_data)
1229{
1230 OccSkeleton *skeleton = OCC_SKELETON (user_data);
1231 GValue value = G_VALUE_INIT;
1232 GParamSpec *pspec;
1233 _ExtendedGDBusPropertyInfo *info;
1234 gboolean ret;
1235 ret = FALSE;
1236 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_occ_interface_info.parent_struct, property_name);
1237 g_assert (info != NULL);
1238 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1239 if (pspec == NULL)
1240 {
1241 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1242 }
1243 else
1244 {
1245 if (info->use_gvariant)
1246 g_value_set_variant (&value, variant);
1247 else
1248 g_dbus_gvariant_to_gvalue (variant, &value);
1249 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1250 g_value_unset (&value);
1251 ret = TRUE;
1252 }
1253 return ret;
1254}
1255
1256static const GDBusInterfaceVTable _occ_skeleton_vtable =
1257{
1258 _occ_skeleton_handle_method_call,
1259 _occ_skeleton_handle_get_property,
1260 _occ_skeleton_handle_set_property,
1261 {NULL}
1262};
1263
1264static GDBusInterfaceInfo *
1265occ_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1266{
1267 return occ_interface_info ();
1268}
1269
1270static GDBusInterfaceVTable *
1271occ_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1272{
1273 return (GDBusInterfaceVTable *) &_occ_skeleton_vtable;
1274}
1275
1276static GVariant *
1277occ_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
1278{
1279 OccSkeleton *skeleton = OCC_SKELETON (_skeleton);
1280
1281 GVariantBuilder builder;
1282 guint n;
1283 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1284 if (_occ_interface_info.parent_struct.properties == NULL)
1285 goto out;
1286 for (n = 0; _occ_interface_info.parent_struct.properties[n] != NULL; n++)
1287 {
1288 GDBusPropertyInfo *info = _occ_interface_info.parent_struct.properties[n];
1289 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
1290 {
1291 GVariant *value;
1292 value = _occ_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.Occ", info->name, NULL, skeleton);
1293 if (value != NULL)
1294 {
1295 g_variant_take_ref (value);
1296 g_variant_builder_add (&builder, "{sv}", info->name, value);
1297 g_variant_unref (value);
1298 }
1299 }
1300 }
1301out:
1302 return g_variant_builder_end (&builder);
1303}
1304
1305static gboolean _occ_emit_changed (gpointer user_data);
1306
1307static void
1308occ_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
1309{
1310 OccSkeleton *skeleton = OCC_SKELETON (_skeleton);
1311 gboolean emit_changed = FALSE;
1312
1313 g_mutex_lock (&skeleton->priv->lock);
1314 if (skeleton->priv->changed_properties_idle_source != NULL)
1315 {
1316 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1317 skeleton->priv->changed_properties_idle_source = NULL;
1318 emit_changed = TRUE;
1319 }
1320 g_mutex_unlock (&skeleton->priv->lock);
1321
1322 if (emit_changed)
1323 _occ_emit_changed (skeleton);
1324}
1325
1326static void occ_skeleton_iface_init (OccIface *iface);
1327#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1328G_DEFINE_TYPE_WITH_CODE (OccSkeleton, occ_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1329 G_ADD_PRIVATE (OccSkeleton)
1330 G_IMPLEMENT_INTERFACE (TYPE_OCC, occ_skeleton_iface_init));
1331
1332#else
1333G_DEFINE_TYPE_WITH_CODE (OccSkeleton, occ_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1334 G_IMPLEMENT_INTERFACE (TYPE_OCC, occ_skeleton_iface_init));
1335
1336#endif
1337static void
1338occ_skeleton_finalize (GObject *object)
1339{
1340 OccSkeleton *skeleton = OCC_SKELETON (object);
1341 guint n;
1342 for (n = 0; n < 2; n++)
1343 g_value_unset (&skeleton->priv->properties[n]);
1344 g_free (skeleton->priv->properties);
1345 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1346 if (skeleton->priv->changed_properties_idle_source != NULL)
1347 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1348 g_main_context_unref (skeleton->priv->context);
1349 g_mutex_clear (&skeleton->priv->lock);
1350 G_OBJECT_CLASS (occ_skeleton_parent_class)->finalize (object);
1351}
1352
1353static void
1354occ_skeleton_get_property (GObject *object,
1355 guint prop_id,
1356 GValue *value,
1357 GParamSpec *pspec G_GNUC_UNUSED)
1358{
1359 OccSkeleton *skeleton = OCC_SKELETON (object);
1360 g_assert (prop_id != 0 && prop_id - 1 < 2);
1361 g_mutex_lock (&skeleton->priv->lock);
1362 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
1363 g_mutex_unlock (&skeleton->priv->lock);
1364}
1365
1366static gboolean
1367_occ_emit_changed (gpointer user_data)
1368{
1369 OccSkeleton *skeleton = OCC_SKELETON (user_data);
1370 GList *l;
1371 GVariantBuilder builder;
1372 GVariantBuilder invalidated_builder;
1373 guint num_changes;
1374
1375 g_mutex_lock (&skeleton->priv->lock);
1376 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1377 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
1378 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
1379 {
1380 ChangedProperty *cp = l->data;
1381 GVariant *variant;
1382 const GValue *cur_value;
1383
1384 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
1385 if (!_g_value_equal (cur_value, &cp->orig_value))
1386 {
1387 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
1388 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
1389 g_variant_unref (variant);
1390 num_changes++;
1391 }
1392 }
1393 if (num_changes > 0)
1394 {
1395 GList *connections, *ll;
1396 GVariant *signal_variant;
1397 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Occ",
1398 &builder, &invalidated_builder));
1399 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
1400 for (ll = connections; ll != NULL; ll = ll->next)
1401 {
1402 GDBusConnection *connection = ll->data;
1403
1404 g_dbus_connection_emit_signal (connection,
1405 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
1406 "org.freedesktop.DBus.Properties",
1407 "PropertiesChanged",
1408 signal_variant,
1409 NULL);
1410 }
1411 g_variant_unref (signal_variant);
1412 g_list_free_full (connections, g_object_unref);
1413 }
1414 else
1415 {
1416 g_variant_builder_clear (&builder);
1417 g_variant_builder_clear (&invalidated_builder);
1418 }
1419 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1420 skeleton->priv->changed_properties = NULL;
1421 skeleton->priv->changed_properties_idle_source = NULL;
1422 g_mutex_unlock (&skeleton->priv->lock);
1423 return FALSE;
1424}
1425
1426static void
1427_occ_schedule_emit_changed (OccSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
1428{
1429 ChangedProperty *cp;
1430 GList *l;
1431 cp = NULL;
1432 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
1433 {
1434 ChangedProperty *i_cp = l->data;
1435 if (i_cp->info == info)
1436 {
1437 cp = i_cp;
1438 break;
1439 }
1440 }
1441 if (cp == NULL)
1442 {
1443 cp = g_new0 (ChangedProperty, 1);
1444 cp->prop_id = prop_id;
1445 cp->info = info;
1446 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
1447 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
1448 g_value_copy (orig_value, &cp->orig_value);
1449 }
1450}
1451
1452static void
1453occ_skeleton_notify (GObject *object,
1454 GParamSpec *pspec G_GNUC_UNUSED)
1455{
1456 OccSkeleton *skeleton = OCC_SKELETON (object);
1457 g_mutex_lock (&skeleton->priv->lock);
1458 if (skeleton->priv->changed_properties != NULL &&
1459 skeleton->priv->changed_properties_idle_source == NULL)
1460 {
1461 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
1462 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
1463 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _occ_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
1464 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
1465 g_source_unref (skeleton->priv->changed_properties_idle_source);
1466 }
1467 g_mutex_unlock (&skeleton->priv->lock);
1468}
1469
1470static void
1471occ_skeleton_set_property (GObject *object,
1472 guint prop_id,
1473 const GValue *value,
1474 GParamSpec *pspec)
1475{
1476 OccSkeleton *skeleton = OCC_SKELETON (object);
1477 g_assert (prop_id != 0 && prop_id - 1 < 2);
1478 g_mutex_lock (&skeleton->priv->lock);
1479 g_object_freeze_notify (object);
1480 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
1481 {
1482 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
1483 _occ_schedule_emit_changed (skeleton, _occ_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
1484 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
1485 g_object_notify_by_pspec (object, pspec);
1486 }
1487 g_mutex_unlock (&skeleton->priv->lock);
1488 g_object_thaw_notify (object);
1489}
1490
1491static void
1492occ_skeleton_init (OccSkeleton *skeleton)
1493{
1494#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1495 skeleton->priv = occ_skeleton_get_instance_private (skeleton);
1496#else
1497 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_OCC_SKELETON, OccSkeletonPrivate);
1498#endif
1499
1500 g_mutex_init (&skeleton->priv->lock);
1501 skeleton->priv->context = g_main_context_ref_thread_default ();
1502 skeleton->priv->properties = g_new0 (GValue, 2);
1503 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
1504 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
1505}
1506
1507static const gchar *
1508occ_skeleton_get_state (Occ *object)
1509{
1510 OccSkeleton *skeleton = OCC_SKELETON (object);
1511 const gchar *value;
1512 g_mutex_lock (&skeleton->priv->lock);
1513 value = g_value_get_string (&(skeleton->priv->properties[0]));
1514 g_mutex_unlock (&skeleton->priv->lock);
1515 return value;
1516}
1517
1518static gint
1519occ_skeleton_get_poll_interval (Occ *object)
1520{
1521 OccSkeleton *skeleton = OCC_SKELETON (object);
1522 gint value;
1523 g_mutex_lock (&skeleton->priv->lock);
1524 value = g_value_get_int (&(skeleton->priv->properties[1]));
1525 g_mutex_unlock (&skeleton->priv->lock);
1526 return value;
1527}
1528
1529static void
1530occ_skeleton_class_init (OccSkeletonClass *klass)
1531{
1532 GObjectClass *gobject_class;
1533 GDBusInterfaceSkeletonClass *skeleton_class;
1534
1535 gobject_class = G_OBJECT_CLASS (klass);
1536 gobject_class->finalize = occ_skeleton_finalize;
1537 gobject_class->get_property = occ_skeleton_get_property;
1538 gobject_class->set_property = occ_skeleton_set_property;
1539 gobject_class->notify = occ_skeleton_notify;
1540
1541
1542 occ_override_properties (gobject_class, 1);
1543
1544 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
1545 skeleton_class->get_info = occ_skeleton_dbus_interface_get_info;
1546 skeleton_class->get_properties = occ_skeleton_dbus_interface_get_properties;
1547 skeleton_class->flush = occ_skeleton_dbus_interface_flush;
1548 skeleton_class->get_vtable = occ_skeleton_dbus_interface_get_vtable;
1549
1550#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1551 g_type_class_add_private (klass, sizeof (OccSkeletonPrivate));
1552#endif
1553}
1554
1555static void
1556occ_skeleton_iface_init (OccIface *iface)
1557{
1558 iface->get_state = occ_skeleton_get_state;
1559 iface->get_poll_interval = occ_skeleton_get_poll_interval;
1560}
1561
1562/**
1563 * occ_skeleton_new:
1564 *
1565 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>.
1566 *
1567 * Returns: (transfer full) (type OccSkeleton): The skeleton object.
1568 */
1569Occ *
1570occ_skeleton_new (void)
1571{
1572 return OCC (g_object_new (TYPE_OCC_SKELETON, NULL));
1573}
1574
1575/* ------------------------------------------------------------------------
1576 * Code for interface org.openbmc.Fan
1577 * ------------------------------------------------------------------------
1578 */
1579
1580/**
1581 * SECTION:Fan
1582 * @title: Fan
1583 * @short_description: Generated C code for the org.openbmc.Fan D-Bus interface
1584 *
1585 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> D-Bus interface in C.
1586 */
1587
1588/* ---- Introspection data for org.openbmc.Fan ---- */
1589
1590static const _ExtendedGDBusArgInfo _fan_method_info_set_cooling_zone_IN_ARG_cooling_zone =
1591{
1592 {
1593 -1,
1594 (gchar *) "cooling_zone",
1595 (gchar *) "i",
1596 NULL
1597 },
1598 FALSE
1599};
1600
1601static const _ExtendedGDBusArgInfo * const _fan_method_info_set_cooling_zone_IN_ARG_pointers[] =
1602{
1603 &_fan_method_info_set_cooling_zone_IN_ARG_cooling_zone,
1604 NULL
1605};
1606
1607static const _ExtendedGDBusMethodInfo _fan_method_info_set_cooling_zone =
1608{
1609 {
1610 -1,
1611 (gchar *) "setCoolingZone",
1612 (GDBusArgInfo **) &_fan_method_info_set_cooling_zone_IN_ARG_pointers,
1613 NULL,
1614 NULL
1615 },
1616 "handle-set-cooling-zone",
1617 FALSE
1618};
1619
1620static const _ExtendedGDBusArgInfo _fan_method_info_get_speed_OUT_ARG_speed =
1621{
1622 {
1623 -1,
1624 (gchar *) "speed",
1625 (gchar *) "i",
1626 NULL
1627 },
1628 FALSE
1629};
1630
1631static const _ExtendedGDBusArgInfo * const _fan_method_info_get_speed_OUT_ARG_pointers[] =
1632{
1633 &_fan_method_info_get_speed_OUT_ARG_speed,
1634 NULL
1635};
1636
1637static const _ExtendedGDBusMethodInfo _fan_method_info_get_speed =
1638{
1639 {
1640 -1,
1641 (gchar *) "getSpeed",
1642 NULL,
1643 (GDBusArgInfo **) &_fan_method_info_get_speed_OUT_ARG_pointers,
1644 NULL
1645 },
1646 "handle-get-speed",
1647 FALSE
1648};
1649
1650static const _ExtendedGDBusArgInfo _fan_method_info_set_speed_IN_ARG_speed =
1651{
1652 {
1653 -1,
1654 (gchar *) "speed",
1655 (gchar *) "i",
1656 NULL
1657 },
1658 FALSE
1659};
1660
1661static const _ExtendedGDBusArgInfo * const _fan_method_info_set_speed_IN_ARG_pointers[] =
1662{
1663 &_fan_method_info_set_speed_IN_ARG_speed,
1664 NULL
1665};
1666
1667static const _ExtendedGDBusMethodInfo _fan_method_info_set_speed =
1668{
1669 {
1670 -1,
1671 (gchar *) "setSpeed",
1672 (GDBusArgInfo **) &_fan_method_info_set_speed_IN_ARG_pointers,
1673 NULL,
1674 NULL
1675 },
1676 "handle-set-speed",
1677 FALSE
1678};
1679
1680static const _ExtendedGDBusMethodInfo * const _fan_method_info_pointers[] =
1681{
1682 &_fan_method_info_set_cooling_zone,
1683 &_fan_method_info_get_speed,
1684 &_fan_method_info_set_speed,
1685 NULL
1686};
1687
1688static const _ExtendedGDBusArgInfo _fan_signal_info_speed_changed_ARG_speed =
1689{
1690 {
1691 -1,
1692 (gchar *) "speed",
1693 (gchar *) "i",
1694 NULL
1695 },
1696 FALSE
1697};
1698
1699static const _ExtendedGDBusArgInfo * const _fan_signal_info_speed_changed_ARG_pointers[] =
1700{
1701 &_fan_signal_info_speed_changed_ARG_speed,
1702 NULL
1703};
1704
1705static const _ExtendedGDBusSignalInfo _fan_signal_info_speed_changed =
1706{
1707 {
1708 -1,
1709 (gchar *) "SpeedChanged",
1710 (GDBusArgInfo **) &_fan_signal_info_speed_changed_ARG_pointers,
1711 NULL
1712 },
1713 "speed-changed"
1714};
1715
1716static const _ExtendedGDBusSignalInfo _fan_signal_info_tach_error =
1717{
1718 {
1719 -1,
1720 (gchar *) "TachError",
1721 NULL,
1722 NULL
1723 },
1724 "tach-error"
1725};
1726
1727static const _ExtendedGDBusSignalInfo * const _fan_signal_info_pointers[] =
1728{
1729 &_fan_signal_info_speed_changed,
1730 &_fan_signal_info_tach_error,
1731 NULL
1732};
1733
1734static const _ExtendedGDBusPropertyInfo _fan_property_info_speed =
1735{
1736 {
1737 -1,
1738 (gchar *) "speed",
1739 (gchar *) "i",
1740 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
1741 NULL
1742 },
1743 "speed",
1744 FALSE
1745};
1746
1747static const _ExtendedGDBusPropertyInfo _fan_property_info_cooling_zone =
1748{
1749 {
1750 -1,
1751 (gchar *) "cooling_zone",
1752 (gchar *) "i",
1753 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
1754 NULL
1755 },
1756 "cooling-zone",
1757 FALSE
1758};
1759
1760static const _ExtendedGDBusPropertyInfo _fan_property_info_pwm_num =
1761{
1762 {
1763 -1,
1764 (gchar *) "pwm_num",
1765 (gchar *) "i",
1766 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
1767 NULL
1768 },
1769 "pwm-num",
1770 FALSE
1771};
1772
1773static const _ExtendedGDBusPropertyInfo * const _fan_property_info_pointers[] =
1774{
1775 &_fan_property_info_speed,
1776 &_fan_property_info_cooling_zone,
1777 &_fan_property_info_pwm_num,
1778 NULL
1779};
1780
1781static const _ExtendedGDBusInterfaceInfo _fan_interface_info =
1782{
1783 {
1784 -1,
1785 (gchar *) "org.openbmc.Fan",
1786 (GDBusMethodInfo **) &_fan_method_info_pointers,
1787 (GDBusSignalInfo **) &_fan_signal_info_pointers,
1788 (GDBusPropertyInfo **) &_fan_property_info_pointers,
1789 NULL
1790 },
1791 "fan",
1792};
1793
1794
1795/**
1796 * fan_interface_info:
1797 *
1798 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> D-Bus interface.
1799 *
1800 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
1801 */
1802GDBusInterfaceInfo *
1803fan_interface_info (void)
1804{
1805 return (GDBusInterfaceInfo *) &_fan_interface_info.parent_struct;
1806}
1807
1808/**
1809 * fan_override_properties:
1810 * @klass: The class structure for a #GObject<!-- -->-derived class.
1811 * @property_id_begin: The property id to assign to the first overridden property.
1812 *
1813 * Overrides all #GObject properties in the #Fan interface for a concrete class.
1814 * The properties are overridden in the order they are defined.
1815 *
1816 * Returns: The last property id.
1817 */
1818guint
1819fan_override_properties (GObjectClass *klass, guint property_id_begin)
1820{
1821 g_object_class_override_property (klass, property_id_begin++, "speed");
1822 g_object_class_override_property (klass, property_id_begin++, "cooling-zone");
1823 g_object_class_override_property (klass, property_id_begin++, "pwm-num");
1824 return property_id_begin - 1;
1825}
1826
1827
1828
1829/**
1830 * Fan:
1831 *
1832 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
1833 */
1834
1835/**
1836 * FanIface:
1837 * @parent_iface: The parent interface.
1838 * @handle_get_speed: Handler for the #Fan::handle-get-speed signal.
1839 * @handle_set_cooling_zone: Handler for the #Fan::handle-set-cooling-zone signal.
1840 * @handle_set_speed: Handler for the #Fan::handle-set-speed signal.
1841 * @get_cooling_zone: Getter for the #Fan:cooling-zone property.
1842 * @get_pwm_num: Getter for the #Fan:pwm-num property.
1843 * @get_speed: Getter for the #Fan:speed property.
1844 * @speed_changed: Handler for the #Fan::speed-changed signal.
1845 * @tach_error: Handler for the #Fan::tach-error signal.
1846 *
1847 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
1848 */
1849
1850typedef FanIface FanInterface;
1851G_DEFINE_INTERFACE (Fan, fan, G_TYPE_OBJECT);
1852
1853static void
1854fan_default_init (FanIface *iface)
1855{
1856 /* GObject signals for incoming D-Bus method calls: */
1857 /**
1858 * Fan::handle-set-cooling-zone:
1859 * @object: A #Fan.
1860 * @invocation: A #GDBusMethodInvocation.
1861 * @arg_cooling_zone: Argument passed by remote caller.
1862 *
1863 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method.
1864 *
1865 * 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 fan_complete_set_cooling_zone() 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.
1866 *
1867 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
1868 */
1869 g_signal_new ("handle-set-cooling-zone",
1870 G_TYPE_FROM_INTERFACE (iface),
1871 G_SIGNAL_RUN_LAST,
1872 G_STRUCT_OFFSET (FanIface, handle_set_cooling_zone),
1873 g_signal_accumulator_true_handled,
1874 NULL,
1875 g_cclosure_marshal_generic,
1876 G_TYPE_BOOLEAN,
1877 2,
1878 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
1879
1880 /**
1881 * Fan::handle-get-speed:
1882 * @object: A #Fan.
1883 * @invocation: A #GDBusMethodInvocation.
1884 *
1885 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method.
1886 *
1887 * 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 fan_complete_get_speed() 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.
1888 *
1889 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
1890 */
1891 g_signal_new ("handle-get-speed",
1892 G_TYPE_FROM_INTERFACE (iface),
1893 G_SIGNAL_RUN_LAST,
1894 G_STRUCT_OFFSET (FanIface, handle_get_speed),
1895 g_signal_accumulator_true_handled,
1896 NULL,
1897 g_cclosure_marshal_generic,
1898 G_TYPE_BOOLEAN,
1899 1,
1900 G_TYPE_DBUS_METHOD_INVOCATION);
1901
1902 /**
1903 * Fan::handle-set-speed:
1904 * @object: A #Fan.
1905 * @invocation: A #GDBusMethodInvocation.
1906 * @arg_speed: Argument passed by remote caller.
1907 *
1908 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method.
1909 *
1910 * 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 fan_complete_set_speed() 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.
1911 *
1912 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
1913 */
1914 g_signal_new ("handle-set-speed",
1915 G_TYPE_FROM_INTERFACE (iface),
1916 G_SIGNAL_RUN_LAST,
1917 G_STRUCT_OFFSET (FanIface, handle_set_speed),
1918 g_signal_accumulator_true_handled,
1919 NULL,
1920 g_cclosure_marshal_generic,
1921 G_TYPE_BOOLEAN,
1922 2,
1923 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
1924
1925 /* GObject signals for received D-Bus signals: */
1926 /**
1927 * Fan::speed-changed:
1928 * @object: A #Fan.
1929 * @arg_speed: Argument.
1930 *
1931 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Fan.SpeedChanged">"SpeedChanged"</link> is received.
1932 *
1933 * 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.
1934 */
1935 g_signal_new ("speed-changed",
1936 G_TYPE_FROM_INTERFACE (iface),
1937 G_SIGNAL_RUN_LAST,
1938 G_STRUCT_OFFSET (FanIface, speed_changed),
1939 NULL,
1940 NULL,
1941 g_cclosure_marshal_generic,
1942 G_TYPE_NONE,
1943 1, G_TYPE_INT);
1944
1945 /**
1946 * Fan::tach-error:
1947 * @object: A #Fan.
1948 *
1949 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Fan.TachError">"TachError"</link> is received.
1950 *
1951 * 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.
1952 */
1953 g_signal_new ("tach-error",
1954 G_TYPE_FROM_INTERFACE (iface),
1955 G_SIGNAL_RUN_LAST,
1956 G_STRUCT_OFFSET (FanIface, tach_error),
1957 NULL,
1958 NULL,
1959 g_cclosure_marshal_generic,
1960 G_TYPE_NONE,
1961 0);
1962
1963 /* GObject properties for D-Bus properties: */
1964 /**
1965 * Fan:speed:
1966 *
1967 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link>.
1968 *
1969 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
1970 */
1971 g_object_interface_install_property (iface,
1972 g_param_spec_int ("speed", "speed", "speed", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1973 /**
1974 * Fan:cooling-zone:
1975 *
1976 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link>.
1977 *
1978 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
1979 */
1980 g_object_interface_install_property (iface,
1981 g_param_spec_int ("cooling-zone", "cooling_zone", "cooling_zone", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1982 /**
1983 * Fan:pwm-num:
1984 *
1985 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link>.
1986 *
1987 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
1988 */
1989 g_object_interface_install_property (iface,
1990 g_param_spec_int ("pwm-num", "pwm_num", "pwm_num", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1991}
1992
1993/**
1994 * fan_get_speed: (skip)
1995 * @object: A #Fan.
1996 *
1997 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property.
1998 *
1999 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2000 *
2001 * Returns: The property value.
2002 */
2003gint
2004fan_get_speed (Fan *object)
2005{
2006 return FAN_GET_IFACE (object)->get_speed (object);
2007}
2008
2009/**
2010 * fan_set_speed: (skip)
2011 * @object: A #Fan.
2012 * @value: The value to set.
2013 *
2014 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property to @value.
2015 *
2016 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2017 */
2018void
2019fan_set_speed (Fan *object, gint value)
2020{
2021 g_object_set (G_OBJECT (object), "speed", value, NULL);
2022}
2023
2024/**
2025 * fan_get_cooling_zone: (skip)
2026 * @object: A #Fan.
2027 *
2028 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property.
2029 *
2030 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2031 *
2032 * Returns: The property value.
2033 */
2034gint
2035fan_get_cooling_zone (Fan *object)
2036{
2037 return FAN_GET_IFACE (object)->get_cooling_zone (object);
2038}
2039
2040/**
2041 * fan_set_cooling_zone: (skip)
2042 * @object: A #Fan.
2043 * @value: The value to set.
2044 *
2045 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property to @value.
2046 *
2047 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2048 */
2049void
2050fan_set_cooling_zone (Fan *object, gint value)
2051{
2052 g_object_set (G_OBJECT (object), "cooling-zone", value, NULL);
2053}
2054
2055/**
2056 * fan_get_pwm_num: (skip)
2057 * @object: A #Fan.
2058 *
2059 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property.
2060 *
2061 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2062 *
2063 * Returns: The property value.
2064 */
2065gint
2066fan_get_pwm_num (Fan *object)
2067{
2068 return FAN_GET_IFACE (object)->get_pwm_num (object);
2069}
2070
2071/**
2072 * fan_set_pwm_num: (skip)
2073 * @object: A #Fan.
2074 * @value: The value to set.
2075 *
2076 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property to @value.
2077 *
2078 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2079 */
2080void
2081fan_set_pwm_num (Fan *object, gint value)
2082{
2083 g_object_set (G_OBJECT (object), "pwm-num", value, NULL);
2084}
2085
2086/**
2087 * fan_emit_speed_changed:
2088 * @object: A #Fan.
2089 * @arg_speed: Argument to pass with the signal.
2090 *
2091 * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.SpeedChanged">"SpeedChanged"</link> D-Bus signal.
2092 */
2093void
2094fan_emit_speed_changed (
2095 Fan *object,
2096 gint arg_speed)
2097{
2098 g_signal_emit_by_name (object, "speed-changed", arg_speed);
2099}
2100
2101/**
2102 * fan_emit_tach_error:
2103 * @object: A #Fan.
2104 *
2105 * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.TachError">"TachError"</link> D-Bus signal.
2106 */
2107void
2108fan_emit_tach_error (
2109 Fan *object)
2110{
2111 g_signal_emit_by_name (object, "tach-error");
2112}
2113
2114/**
2115 * fan_call_set_cooling_zone:
2116 * @proxy: A #FanProxy.
2117 * @arg_cooling_zone: Argument to pass with the method invocation.
2118 * @cancellable: (allow-none): A #GCancellable or %NULL.
2119 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2120 * @user_data: User data to pass to @callback.
2121 *
2122 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method on @proxy.
2123 * 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.
2124 * You can then call fan_call_set_cooling_zone_finish() to get the result of the operation.
2125 *
2126 * See fan_call_set_cooling_zone_sync() for the synchronous, blocking version of this method.
2127 */
2128void
2129fan_call_set_cooling_zone (
2130 Fan *proxy,
2131 gint arg_cooling_zone,
2132 GCancellable *cancellable,
2133 GAsyncReadyCallback callback,
2134 gpointer user_data)
2135{
2136 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2137 "setCoolingZone",
2138 g_variant_new ("(i)",
2139 arg_cooling_zone),
2140 G_DBUS_CALL_FLAGS_NONE,
2141 -1,
2142 cancellable,
2143 callback,
2144 user_data);
2145}
2146
2147/**
2148 * fan_call_set_cooling_zone_finish:
2149 * @proxy: A #FanProxy.
2150 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_cooling_zone().
2151 * @error: Return location for error or %NULL.
2152 *
2153 * Finishes an operation started with fan_call_set_cooling_zone().
2154 *
2155 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2156 */
2157gboolean
2158fan_call_set_cooling_zone_finish (
2159 Fan *proxy,
2160 GAsyncResult *res,
2161 GError **error)
2162{
2163 GVariant *_ret;
2164 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2165 if (_ret == NULL)
2166 goto _out;
2167 g_variant_get (_ret,
2168 "()");
2169 g_variant_unref (_ret);
2170_out:
2171 return _ret != NULL;
2172}
2173
2174/**
2175 * fan_call_set_cooling_zone_sync:
2176 * @proxy: A #FanProxy.
2177 * @arg_cooling_zone: Argument to pass with the method invocation.
2178 * @cancellable: (allow-none): A #GCancellable or %NULL.
2179 * @error: Return location for error or %NULL.
2180 *
2181 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
2182 *
2183 * See fan_call_set_cooling_zone() for the asynchronous version of this method.
2184 *
2185 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2186 */
2187gboolean
2188fan_call_set_cooling_zone_sync (
2189 Fan *proxy,
2190 gint arg_cooling_zone,
2191 GCancellable *cancellable,
2192 GError **error)
2193{
2194 GVariant *_ret;
2195 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2196 "setCoolingZone",
2197 g_variant_new ("(i)",
2198 arg_cooling_zone),
2199 G_DBUS_CALL_FLAGS_NONE,
2200 -1,
2201 cancellable,
2202 error);
2203 if (_ret == NULL)
2204 goto _out;
2205 g_variant_get (_ret,
2206 "()");
2207 g_variant_unref (_ret);
2208_out:
2209 return _ret != NULL;
2210}
2211
2212/**
2213 * fan_call_get_speed:
2214 * @proxy: A #FanProxy.
2215 * @cancellable: (allow-none): A #GCancellable or %NULL.
2216 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2217 * @user_data: User data to pass to @callback.
2218 *
2219 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method on @proxy.
2220 * 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.
2221 * You can then call fan_call_get_speed_finish() to get the result of the operation.
2222 *
2223 * See fan_call_get_speed_sync() for the synchronous, blocking version of this method.
2224 */
2225void
2226fan_call_get_speed (
2227 Fan *proxy,
2228 GCancellable *cancellable,
2229 GAsyncReadyCallback callback,
2230 gpointer user_data)
2231{
2232 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2233 "getSpeed",
2234 g_variant_new ("()"),
2235 G_DBUS_CALL_FLAGS_NONE,
2236 -1,
2237 cancellable,
2238 callback,
2239 user_data);
2240}
2241
2242/**
2243 * fan_call_get_speed_finish:
2244 * @proxy: A #FanProxy.
2245 * @out_speed: (out): Return location for return parameter or %NULL to ignore.
2246 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_get_speed().
2247 * @error: Return location for error or %NULL.
2248 *
2249 * Finishes an operation started with fan_call_get_speed().
2250 *
2251 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2252 */
2253gboolean
2254fan_call_get_speed_finish (
2255 Fan *proxy,
2256 gint *out_speed,
2257 GAsyncResult *res,
2258 GError **error)
2259{
2260 GVariant *_ret;
2261 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2262 if (_ret == NULL)
2263 goto _out;
2264 g_variant_get (_ret,
2265 "(i)",
2266 out_speed);
2267 g_variant_unref (_ret);
2268_out:
2269 return _ret != NULL;
2270}
2271
2272/**
2273 * fan_call_get_speed_sync:
2274 * @proxy: A #FanProxy.
2275 * @out_speed: (out): Return location for return parameter or %NULL to ignore.
2276 * @cancellable: (allow-none): A #GCancellable or %NULL.
2277 * @error: Return location for error or %NULL.
2278 *
2279 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
2280 *
2281 * See fan_call_get_speed() for the asynchronous version of this method.
2282 *
2283 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2284 */
2285gboolean
2286fan_call_get_speed_sync (
2287 Fan *proxy,
2288 gint *out_speed,
2289 GCancellable *cancellable,
2290 GError **error)
2291{
2292 GVariant *_ret;
2293 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2294 "getSpeed",
2295 g_variant_new ("()"),
2296 G_DBUS_CALL_FLAGS_NONE,
2297 -1,
2298 cancellable,
2299 error);
2300 if (_ret == NULL)
2301 goto _out;
2302 g_variant_get (_ret,
2303 "(i)",
2304 out_speed);
2305 g_variant_unref (_ret);
2306_out:
2307 return _ret != NULL;
2308}
2309
2310/**
2311 * fan_call_set_speed:
2312 * @proxy: A #FanProxy.
2313 * @arg_speed: Argument to pass with the method invocation.
2314 * @cancellable: (allow-none): A #GCancellable or %NULL.
2315 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2316 * @user_data: User data to pass to @callback.
2317 *
2318 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method on @proxy.
2319 * 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.
2320 * You can then call fan_call_set_speed_finish() to get the result of the operation.
2321 *
2322 * See fan_call_set_speed_sync() for the synchronous, blocking version of this method.
2323 */
2324void
2325fan_call_set_speed (
2326 Fan *proxy,
2327 gint arg_speed,
2328 GCancellable *cancellable,
2329 GAsyncReadyCallback callback,
2330 gpointer user_data)
2331{
2332 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2333 "setSpeed",
2334 g_variant_new ("(i)",
2335 arg_speed),
2336 G_DBUS_CALL_FLAGS_NONE,
2337 -1,
2338 cancellable,
2339 callback,
2340 user_data);
2341}
2342
2343/**
2344 * fan_call_set_speed_finish:
2345 * @proxy: A #FanProxy.
2346 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_speed().
2347 * @error: Return location for error or %NULL.
2348 *
2349 * Finishes an operation started with fan_call_set_speed().
2350 *
2351 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2352 */
2353gboolean
2354fan_call_set_speed_finish (
2355 Fan *proxy,
2356 GAsyncResult *res,
2357 GError **error)
2358{
2359 GVariant *_ret;
2360 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2361 if (_ret == NULL)
2362 goto _out;
2363 g_variant_get (_ret,
2364 "()");
2365 g_variant_unref (_ret);
2366_out:
2367 return _ret != NULL;
2368}
2369
2370/**
2371 * fan_call_set_speed_sync:
2372 * @proxy: A #FanProxy.
2373 * @arg_speed: Argument to pass with the method invocation.
2374 * @cancellable: (allow-none): A #GCancellable or %NULL.
2375 * @error: Return location for error or %NULL.
2376 *
2377 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
2378 *
2379 * See fan_call_set_speed() for the asynchronous version of this method.
2380 *
2381 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2382 */
2383gboolean
2384fan_call_set_speed_sync (
2385 Fan *proxy,
2386 gint arg_speed,
2387 GCancellable *cancellable,
2388 GError **error)
2389{
2390 GVariant *_ret;
2391 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2392 "setSpeed",
2393 g_variant_new ("(i)",
2394 arg_speed),
2395 G_DBUS_CALL_FLAGS_NONE,
2396 -1,
2397 cancellable,
2398 error);
2399 if (_ret == NULL)
2400 goto _out;
2401 g_variant_get (_ret,
2402 "()");
2403 g_variant_unref (_ret);
2404_out:
2405 return _ret != NULL;
2406}
2407
2408/**
2409 * fan_complete_set_cooling_zone:
2410 * @object: A #Fan.
2411 * @invocation: (transfer full): A #GDBusMethodInvocation.
2412 *
2413 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</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.
2414 *
2415 * This method will free @invocation, you cannot use it afterwards.
2416 */
2417void
2418fan_complete_set_cooling_zone (
2419 Fan *object,
2420 GDBusMethodInvocation *invocation)
2421{
2422 g_dbus_method_invocation_return_value (invocation,
2423 g_variant_new ("()"));
2424}
2425
2426/**
2427 * fan_complete_get_speed:
2428 * @object: A #Fan.
2429 * @invocation: (transfer full): A #GDBusMethodInvocation.
2430 * @speed: Parameter to return.
2431 *
2432 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</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.
2433 *
2434 * This method will free @invocation, you cannot use it afterwards.
2435 */
2436void
2437fan_complete_get_speed (
2438 Fan *object,
2439 GDBusMethodInvocation *invocation,
2440 gint speed)
2441{
2442 g_dbus_method_invocation_return_value (invocation,
2443 g_variant_new ("(i)",
2444 speed));
2445}
2446
2447/**
2448 * fan_complete_set_speed:
2449 * @object: A #Fan.
2450 * @invocation: (transfer full): A #GDBusMethodInvocation.
2451 *
2452 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</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.
2453 *
2454 * This method will free @invocation, you cannot use it afterwards.
2455 */
2456void
2457fan_complete_set_speed (
2458 Fan *object,
2459 GDBusMethodInvocation *invocation)
2460{
2461 g_dbus_method_invocation_return_value (invocation,
2462 g_variant_new ("()"));
2463}
2464
2465/* ------------------------------------------------------------------------ */
2466
2467/**
2468 * FanProxy:
2469 *
2470 * The #FanProxy structure contains only private data and should only be accessed using the provided API.
2471 */
2472
2473/**
2474 * FanProxyClass:
2475 * @parent_class: The parent class.
2476 *
2477 * Class structure for #FanProxy.
2478 */
2479
2480struct _FanProxyPrivate
2481{
2482 GData *qdata;
2483};
2484
2485static void fan_proxy_iface_init (FanIface *iface);
2486
2487#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2488G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY,
2489 G_ADD_PRIVATE (FanProxy)
2490 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init));
2491
2492#else
2493G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY,
2494 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init));
2495
2496#endif
2497static void
2498fan_proxy_finalize (GObject *object)
2499{
2500 FanProxy *proxy = FAN_PROXY (object);
2501 g_datalist_clear (&proxy->priv->qdata);
2502 G_OBJECT_CLASS (fan_proxy_parent_class)->finalize (object);
2503}
2504
2505static void
2506fan_proxy_get_property (GObject *object,
2507 guint prop_id,
2508 GValue *value,
2509 GParamSpec *pspec G_GNUC_UNUSED)
2510{
2511 const _ExtendedGDBusPropertyInfo *info;
2512 GVariant *variant;
2513 g_assert (prop_id != 0 && prop_id - 1 < 3);
2514 info = _fan_property_info_pointers[prop_id - 1];
2515 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
2516 if (info->use_gvariant)
2517 {
2518 g_value_set_variant (value, variant);
2519 }
2520 else
2521 {
2522 if (variant != NULL)
2523 g_dbus_gvariant_to_gvalue (variant, value);
2524 }
2525 if (variant != NULL)
2526 g_variant_unref (variant);
2527}
2528
2529static void
2530fan_proxy_set_property_cb (GDBusProxy *proxy,
2531 GAsyncResult *res,
2532 gpointer user_data)
2533{
2534 const _ExtendedGDBusPropertyInfo *info = user_data;
2535 GError *error;
2536 GVariant *_ret;
2537 error = NULL;
2538 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
2539 if (!_ret)
2540 {
2541 g_warning ("Error setting property '%s' on interface org.openbmc.Fan: %s (%s, %d)",
2542 info->parent_struct.name,
2543 error->message, g_quark_to_string (error->domain), error->code);
2544 g_error_free (error);
2545 }
2546 else
2547 {
2548 g_variant_unref (_ret);
2549 }
2550}
2551
2552static void
2553fan_proxy_set_property (GObject *object,
2554 guint prop_id,
2555 const GValue *value,
2556 GParamSpec *pspec G_GNUC_UNUSED)
2557{
2558 const _ExtendedGDBusPropertyInfo *info;
2559 GVariant *variant;
2560 g_assert (prop_id != 0 && prop_id - 1 < 3);
2561 info = _fan_property_info_pointers[prop_id - 1];
2562 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
2563 g_dbus_proxy_call (G_DBUS_PROXY (object),
2564 "org.freedesktop.DBus.Properties.Set",
2565 g_variant_new ("(ssv)", "org.openbmc.Fan", info->parent_struct.name, variant),
2566 G_DBUS_CALL_FLAGS_NONE,
2567 -1,
2568 NULL, (GAsyncReadyCallback) fan_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
2569 g_variant_unref (variant);
2570}
2571
2572static void
2573fan_proxy_g_signal (GDBusProxy *proxy,
2574 const gchar *sender_name G_GNUC_UNUSED,
2575 const gchar *signal_name,
2576 GVariant *parameters)
2577{
2578 _ExtendedGDBusSignalInfo *info;
2579 GVariantIter iter;
2580 GVariant *child;
2581 GValue *paramv;
2582 guint num_params;
2583 guint n;
2584 guint signal_id;
2585 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, signal_name);
2586 if (info == NULL)
2587 return;
2588 num_params = g_variant_n_children (parameters);
2589 paramv = g_new0 (GValue, num_params + 1);
2590 g_value_init (&paramv[0], TYPE_FAN);
2591 g_value_set_object (&paramv[0], proxy);
2592 g_variant_iter_init (&iter, parameters);
2593 n = 1;
2594 while ((child = g_variant_iter_next_value (&iter)) != NULL)
2595 {
2596 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
2597 if (arg_info->use_gvariant)
2598 {
2599 g_value_init (&paramv[n], G_TYPE_VARIANT);
2600 g_value_set_variant (&paramv[n], child);
2601 n++;
2602 }
2603 else
2604 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
2605 g_variant_unref (child);
2606 }
2607 signal_id = g_signal_lookup (info->signal_name, TYPE_FAN);
2608 g_signal_emitv (paramv, signal_id, 0, NULL);
2609 for (n = 0; n < num_params + 1; n++)
2610 g_value_unset (&paramv[n]);
2611 g_free (paramv);
2612}
2613
2614static void
2615fan_proxy_g_properties_changed (GDBusProxy *_proxy,
2616 GVariant *changed_properties,
2617 const gchar *const *invalidated_properties)
2618{
2619 FanProxy *proxy = FAN_PROXY (_proxy);
2620 guint n;
2621 const gchar *key;
2622 GVariantIter *iter;
2623 _ExtendedGDBusPropertyInfo *info;
2624 g_variant_get (changed_properties, "a{sv}", &iter);
2625 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
2626 {
2627 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, key);
2628 g_datalist_remove_data (&proxy->priv->qdata, key);
2629 if (info != NULL)
2630 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
2631 }
2632 g_variant_iter_free (iter);
2633 for (n = 0; invalidated_properties[n] != NULL; n++)
2634 {
2635 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, invalidated_properties[n]);
2636 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
2637 if (info != NULL)
2638 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
2639 }
2640}
2641
2642static gint
2643fan_proxy_get_speed (Fan *object)
2644{
2645 FanProxy *proxy = FAN_PROXY (object);
2646 GVariant *variant;
2647 gint value = 0;
2648 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "speed");
2649 if (variant != NULL)
2650 {
2651 value = g_variant_get_int32 (variant);
2652 g_variant_unref (variant);
2653 }
2654 return value;
2655}
2656
2657static gint
2658fan_proxy_get_cooling_zone (Fan *object)
2659{
2660 FanProxy *proxy = FAN_PROXY (object);
2661 GVariant *variant;
2662 gint value = 0;
2663 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "cooling_zone");
2664 if (variant != NULL)
2665 {
2666 value = g_variant_get_int32 (variant);
2667 g_variant_unref (variant);
2668 }
2669 return value;
2670}
2671
2672static gint
2673fan_proxy_get_pwm_num (Fan *object)
2674{
2675 FanProxy *proxy = FAN_PROXY (object);
2676 GVariant *variant;
2677 gint value = 0;
2678 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pwm_num");
2679 if (variant != NULL)
2680 {
2681 value = g_variant_get_int32 (variant);
2682 g_variant_unref (variant);
2683 }
2684 return value;
2685}
2686
2687static void
2688fan_proxy_init (FanProxy *proxy)
2689{
2690#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2691 proxy->priv = fan_proxy_get_instance_private (proxy);
2692#else
2693 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FAN_PROXY, FanProxyPrivate);
2694#endif
2695
2696 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), fan_interface_info ());
2697}
2698
2699static void
2700fan_proxy_class_init (FanProxyClass *klass)
2701{
2702 GObjectClass *gobject_class;
2703 GDBusProxyClass *proxy_class;
2704
2705 gobject_class = G_OBJECT_CLASS (klass);
2706 gobject_class->finalize = fan_proxy_finalize;
2707 gobject_class->get_property = fan_proxy_get_property;
2708 gobject_class->set_property = fan_proxy_set_property;
2709
2710 proxy_class = G_DBUS_PROXY_CLASS (klass);
2711 proxy_class->g_signal = fan_proxy_g_signal;
2712 proxy_class->g_properties_changed = fan_proxy_g_properties_changed;
2713
2714 fan_override_properties (gobject_class, 1);
2715
2716#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
2717 g_type_class_add_private (klass, sizeof (FanProxyPrivate));
2718#endif
2719}
2720
2721static void
2722fan_proxy_iface_init (FanIface *iface)
2723{
2724 iface->get_speed = fan_proxy_get_speed;
2725 iface->get_cooling_zone = fan_proxy_get_cooling_zone;
2726 iface->get_pwm_num = fan_proxy_get_pwm_num;
2727}
2728
2729/**
2730 * fan_proxy_new:
2731 * @connection: A #GDBusConnection.
2732 * @flags: Flags from the #GDBusProxyFlags enumeration.
2733 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
2734 * @object_path: An object path.
2735 * @cancellable: (allow-none): A #GCancellable or %NULL.
2736 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
2737 * @user_data: User data to pass to @callback.
2738 *
2739 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>. See g_dbus_proxy_new() for more details.
2740 *
2741 * 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.
2742 * You can then call fan_proxy_new_finish() to get the result of the operation.
2743 *
2744 * See fan_proxy_new_sync() for the synchronous, blocking version of this constructor.
2745 */
2746void
2747fan_proxy_new (
2748 GDBusConnection *connection,
2749 GDBusProxyFlags flags,
2750 const gchar *name,
2751 const gchar *object_path,
2752 GCancellable *cancellable,
2753 GAsyncReadyCallback callback,
2754 gpointer user_data)
2755{
2756 g_async_initable_new_async (TYPE_FAN_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.Fan", NULL);
2757}
2758
2759/**
2760 * fan_proxy_new_finish:
2761 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new().
2762 * @error: Return location for error or %NULL
2763 *
2764 * Finishes an operation started with fan_proxy_new().
2765 *
2766 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2767 */
2768Fan *
2769fan_proxy_new_finish (
2770 GAsyncResult *res,
2771 GError **error)
2772{
2773 GObject *ret;
2774 GObject *source_object;
2775 source_object = g_async_result_get_source_object (res);
2776 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
2777 g_object_unref (source_object);
2778 if (ret != NULL)
2779 return FAN (ret);
2780 else
2781 return NULL;
2782}
2783
2784/**
2785 * fan_proxy_new_sync:
2786 * @connection: A #GDBusConnection.
2787 * @flags: Flags from the #GDBusProxyFlags enumeration.
2788 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
2789 * @object_path: An object path.
2790 * @cancellable: (allow-none): A #GCancellable or %NULL.
2791 * @error: Return location for error or %NULL
2792 *
2793 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>. See g_dbus_proxy_new_sync() for more details.
2794 *
2795 * The calling thread is blocked until a reply is received.
2796 *
2797 * See fan_proxy_new() for the asynchronous version of this constructor.
2798 *
2799 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2800 */
2801Fan *
2802fan_proxy_new_sync (
2803 GDBusConnection *connection,
2804 GDBusProxyFlags flags,
2805 const gchar *name,
2806 const gchar *object_path,
2807 GCancellable *cancellable,
2808 GError **error)
2809{
2810 GInitable *ret;
2811 ret = g_initable_new (TYPE_FAN_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Fan", NULL);
2812 if (ret != NULL)
2813 return FAN (ret);
2814 else
2815 return NULL;
2816}
2817
2818
2819/**
2820 * fan_proxy_new_for_bus:
2821 * @bus_type: A #GBusType.
2822 * @flags: Flags from the #GDBusProxyFlags enumeration.
2823 * @name: A bus name (well-known or unique).
2824 * @object_path: An object path.
2825 * @cancellable: (allow-none): A #GCancellable or %NULL.
2826 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
2827 * @user_data: User data to pass to @callback.
2828 *
2829 * Like fan_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
2830 *
2831 * 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.
2832 * You can then call fan_proxy_new_for_bus_finish() to get the result of the operation.
2833 *
2834 * See fan_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
2835 */
2836void
2837fan_proxy_new_for_bus (
2838 GBusType bus_type,
2839 GDBusProxyFlags flags,
2840 const gchar *name,
2841 const gchar *object_path,
2842 GCancellable *cancellable,
2843 GAsyncReadyCallback callback,
2844 gpointer user_data)
2845{
2846 g_async_initable_new_async (TYPE_FAN_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.Fan", NULL);
2847}
2848
2849/**
2850 * fan_proxy_new_for_bus_finish:
2851 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new_for_bus().
2852 * @error: Return location for error or %NULL
2853 *
2854 * Finishes an operation started with fan_proxy_new_for_bus().
2855 *
2856 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2857 */
2858Fan *
2859fan_proxy_new_for_bus_finish (
2860 GAsyncResult *res,
2861 GError **error)
2862{
2863 GObject *ret;
2864 GObject *source_object;
2865 source_object = g_async_result_get_source_object (res);
2866 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
2867 g_object_unref (source_object);
2868 if (ret != NULL)
2869 return FAN (ret);
2870 else
2871 return NULL;
2872}
2873
2874/**
2875 * fan_proxy_new_for_bus_sync:
2876 * @bus_type: A #GBusType.
2877 * @flags: Flags from the #GDBusProxyFlags enumeration.
2878 * @name: A bus name (well-known or unique).
2879 * @object_path: An object path.
2880 * @cancellable: (allow-none): A #GCancellable or %NULL.
2881 * @error: Return location for error or %NULL
2882 *
2883 * Like fan_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
2884 *
2885 * The calling thread is blocked until a reply is received.
2886 *
2887 * See fan_proxy_new_for_bus() for the asynchronous version of this constructor.
2888 *
2889 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2890 */
2891Fan *
2892fan_proxy_new_for_bus_sync (
2893 GBusType bus_type,
2894 GDBusProxyFlags flags,
2895 const gchar *name,
2896 const gchar *object_path,
2897 GCancellable *cancellable,
2898 GError **error)
2899{
2900 GInitable *ret;
2901 ret = g_initable_new (TYPE_FAN_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Fan", NULL);
2902 if (ret != NULL)
2903 return FAN (ret);
2904 else
2905 return NULL;
2906}
2907
2908
2909/* ------------------------------------------------------------------------ */
2910
2911/**
2912 * FanSkeleton:
2913 *
2914 * The #FanSkeleton structure contains only private data and should only be accessed using the provided API.
2915 */
2916
2917/**
2918 * FanSkeletonClass:
2919 * @parent_class: The parent class.
2920 *
2921 * Class structure for #FanSkeleton.
2922 */
2923
2924struct _FanSkeletonPrivate
2925{
2926 GValue *properties;
2927 GList *changed_properties;
2928 GSource *changed_properties_idle_source;
2929 GMainContext *context;
2930 GMutex lock;
2931};
2932
2933static void
2934_fan_skeleton_handle_method_call (
2935 GDBusConnection *connection G_GNUC_UNUSED,
2936 const gchar *sender G_GNUC_UNUSED,
2937 const gchar *object_path G_GNUC_UNUSED,
2938 const gchar *interface_name,
2939 const gchar *method_name,
2940 GVariant *parameters,
2941 GDBusMethodInvocation *invocation,
2942 gpointer user_data)
2943{
2944 FanSkeleton *skeleton = FAN_SKELETON (user_data);
2945 _ExtendedGDBusMethodInfo *info;
2946 GVariantIter iter;
2947 GVariant *child;
2948 GValue *paramv;
2949 guint num_params;
2950 guint num_extra;
2951 guint n;
2952 guint signal_id;
2953 GValue return_value = G_VALUE_INIT;
2954 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
2955 g_assert (info != NULL);
2956 num_params = g_variant_n_children (parameters);
2957 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
2958 n = 0;
2959 g_value_init (&paramv[n], TYPE_FAN);
2960 g_value_set_object (&paramv[n++], skeleton);
2961 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
2962 g_value_set_object (&paramv[n++], invocation);
2963 if (info->pass_fdlist)
2964 {
2965#ifdef G_OS_UNIX
2966 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
2967 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
2968#else
2969 g_assert_not_reached ();
2970#endif
2971 }
2972 g_variant_iter_init (&iter, parameters);
2973 while ((child = g_variant_iter_next_value (&iter)) != NULL)
2974 {
2975 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
2976 if (arg_info->use_gvariant)
2977 {
2978 g_value_init (&paramv[n], G_TYPE_VARIANT);
2979 g_value_set_variant (&paramv[n], child);
2980 n++;
2981 }
2982 else
2983 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
2984 g_variant_unref (child);
2985 }
2986 signal_id = g_signal_lookup (info->signal_name, TYPE_FAN);
2987 g_value_init (&return_value, G_TYPE_BOOLEAN);
2988 g_signal_emitv (paramv, signal_id, 0, &return_value);
2989 if (!g_value_get_boolean (&return_value))
2990 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);
2991 g_value_unset (&return_value);
2992 for (n = 0; n < num_params + num_extra; n++)
2993 g_value_unset (&paramv[n]);
2994 g_free (paramv);
2995}
2996
2997static GVariant *
2998_fan_skeleton_handle_get_property (
2999 GDBusConnection *connection G_GNUC_UNUSED,
3000 const gchar *sender G_GNUC_UNUSED,
3001 const gchar *object_path G_GNUC_UNUSED,
3002 const gchar *interface_name G_GNUC_UNUSED,
3003 const gchar *property_name,
3004 GError **error,
3005 gpointer user_data)
3006{
3007 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3008 GValue value = G_VALUE_INIT;
3009 GParamSpec *pspec;
3010 _ExtendedGDBusPropertyInfo *info;
3011 GVariant *ret;
3012 ret = NULL;
3013 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name);
3014 g_assert (info != NULL);
3015 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3016 if (pspec == NULL)
3017 {
3018 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3019 }
3020 else
3021 {
3022 g_value_init (&value, pspec->value_type);
3023 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3024 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
3025 g_value_unset (&value);
3026 }
3027 return ret;
3028}
3029
3030static gboolean
3031_fan_skeleton_handle_set_property (
3032 GDBusConnection *connection G_GNUC_UNUSED,
3033 const gchar *sender G_GNUC_UNUSED,
3034 const gchar *object_path G_GNUC_UNUSED,
3035 const gchar *interface_name G_GNUC_UNUSED,
3036 const gchar *property_name,
3037 GVariant *variant,
3038 GError **error,
3039 gpointer user_data)
3040{
3041 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3042 GValue value = G_VALUE_INIT;
3043 GParamSpec *pspec;
3044 _ExtendedGDBusPropertyInfo *info;
3045 gboolean ret;
3046 ret = FALSE;
3047 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name);
3048 g_assert (info != NULL);
3049 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3050 if (pspec == NULL)
3051 {
3052 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3053 }
3054 else
3055 {
3056 if (info->use_gvariant)
3057 g_value_set_variant (&value, variant);
3058 else
3059 g_dbus_gvariant_to_gvalue (variant, &value);
3060 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3061 g_value_unset (&value);
3062 ret = TRUE;
3063 }
3064 return ret;
3065}
3066
3067static const GDBusInterfaceVTable _fan_skeleton_vtable =
3068{
3069 _fan_skeleton_handle_method_call,
3070 _fan_skeleton_handle_get_property,
3071 _fan_skeleton_handle_set_property,
3072 {NULL}
3073};
3074
3075static GDBusInterfaceInfo *
3076fan_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3077{
3078 return fan_interface_info ();
3079}
3080
3081static GDBusInterfaceVTable *
3082fan_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3083{
3084 return (GDBusInterfaceVTable *) &_fan_skeleton_vtable;
3085}
3086
3087static GVariant *
3088fan_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
3089{
3090 FanSkeleton *skeleton = FAN_SKELETON (_skeleton);
3091
3092 GVariantBuilder builder;
3093 guint n;
3094 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3095 if (_fan_interface_info.parent_struct.properties == NULL)
3096 goto out;
3097 for (n = 0; _fan_interface_info.parent_struct.properties[n] != NULL; n++)
3098 {
3099 GDBusPropertyInfo *info = _fan_interface_info.parent_struct.properties[n];
3100 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
3101 {
3102 GVariant *value;
3103 value = _fan_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.Fan", info->name, NULL, skeleton);
3104 if (value != NULL)
3105 {
3106 g_variant_take_ref (value);
3107 g_variant_builder_add (&builder, "{sv}", info->name, value);
3108 g_variant_unref (value);
3109 }
3110 }
3111 }
3112out:
3113 return g_variant_builder_end (&builder);
3114}
3115
3116static gboolean _fan_emit_changed (gpointer user_data);
3117
3118static void
3119fan_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
3120{
3121 FanSkeleton *skeleton = FAN_SKELETON (_skeleton);
3122 gboolean emit_changed = FALSE;
3123
3124 g_mutex_lock (&skeleton->priv->lock);
3125 if (skeleton->priv->changed_properties_idle_source != NULL)
3126 {
3127 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3128 skeleton->priv->changed_properties_idle_source = NULL;
3129 emit_changed = TRUE;
3130 }
3131 g_mutex_unlock (&skeleton->priv->lock);
3132
3133 if (emit_changed)
3134 _fan_emit_changed (skeleton);
3135}
3136
3137static void
3138_fan_on_signal_speed_changed (
3139 Fan *object,
3140 gint arg_speed)
3141{
3142 FanSkeleton *skeleton = FAN_SKELETON (object);
3143
3144 GList *connections, *l;
3145 GVariant *signal_variant;
3146 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3147
3148 signal_variant = g_variant_ref_sink (g_variant_new ("(i)",
3149 arg_speed));
3150 for (l = connections; l != NULL; l = l->next)
3151 {
3152 GDBusConnection *connection = l->data;
3153 g_dbus_connection_emit_signal (connection,
3154 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "SpeedChanged",
3155 signal_variant, NULL);
3156 }
3157 g_variant_unref (signal_variant);
3158 g_list_free_full (connections, g_object_unref);
3159}
3160
3161static void
3162_fan_on_signal_tach_error (
3163 Fan *object)
3164{
3165 FanSkeleton *skeleton = FAN_SKELETON (object);
3166
3167 GList *connections, *l;
3168 GVariant *signal_variant;
3169 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3170
3171 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
3172 for (l = connections; l != NULL; l = l->next)
3173 {
3174 GDBusConnection *connection = l->data;
3175 g_dbus_connection_emit_signal (connection,
3176 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "TachError",
3177 signal_variant, NULL);
3178 }
3179 g_variant_unref (signal_variant);
3180 g_list_free_full (connections, g_object_unref);
3181}
3182
3183static void fan_skeleton_iface_init (FanIface *iface);
3184#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3185G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3186 G_ADD_PRIVATE (FanSkeleton)
3187 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init));
3188
3189#else
3190G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3191 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init));
3192
3193#endif
3194static void
3195fan_skeleton_finalize (GObject *object)
3196{
3197 FanSkeleton *skeleton = FAN_SKELETON (object);
3198 guint n;
3199 for (n = 0; n < 3; n++)
3200 g_value_unset (&skeleton->priv->properties[n]);
3201 g_free (skeleton->priv->properties);
3202 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3203 if (skeleton->priv->changed_properties_idle_source != NULL)
3204 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3205 g_main_context_unref (skeleton->priv->context);
3206 g_mutex_clear (&skeleton->priv->lock);
3207 G_OBJECT_CLASS (fan_skeleton_parent_class)->finalize (object);
3208}
3209
3210static void
3211fan_skeleton_get_property (GObject *object,
3212 guint prop_id,
3213 GValue *value,
3214 GParamSpec *pspec G_GNUC_UNUSED)
3215{
3216 FanSkeleton *skeleton = FAN_SKELETON (object);
3217 g_assert (prop_id != 0 && prop_id - 1 < 3);
3218 g_mutex_lock (&skeleton->priv->lock);
3219 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
3220 g_mutex_unlock (&skeleton->priv->lock);
3221}
3222
3223static gboolean
3224_fan_emit_changed (gpointer user_data)
3225{
3226 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3227 GList *l;
3228 GVariantBuilder builder;
3229 GVariantBuilder invalidated_builder;
3230 guint num_changes;
3231
3232 g_mutex_lock (&skeleton->priv->lock);
3233 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3234 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
3235 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
3236 {
3237 ChangedProperty *cp = l->data;
3238 GVariant *variant;
3239 const GValue *cur_value;
3240
3241 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
3242 if (!_g_value_equal (cur_value, &cp->orig_value))
3243 {
3244 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
3245 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
3246 g_variant_unref (variant);
3247 num_changes++;
3248 }
3249 }
3250 if (num_changes > 0)
3251 {
3252 GList *connections, *ll;
3253 GVariant *signal_variant;
3254 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Fan",
3255 &builder, &invalidated_builder));
3256 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3257 for (ll = connections; ll != NULL; ll = ll->next)
3258 {
3259 GDBusConnection *connection = ll->data;
3260
3261 g_dbus_connection_emit_signal (connection,
3262 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
3263 "org.freedesktop.DBus.Properties",
3264 "PropertiesChanged",
3265 signal_variant,
3266 NULL);
3267 }
3268 g_variant_unref (signal_variant);
3269 g_list_free_full (connections, g_object_unref);
3270 }
3271 else
3272 {
3273 g_variant_builder_clear (&builder);
3274 g_variant_builder_clear (&invalidated_builder);
3275 }
3276 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3277 skeleton->priv->changed_properties = NULL;
3278 skeleton->priv->changed_properties_idle_source = NULL;
3279 g_mutex_unlock (&skeleton->priv->lock);
3280 return FALSE;
3281}
3282
3283static void
3284_fan_schedule_emit_changed (FanSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
3285{
3286 ChangedProperty *cp;
3287 GList *l;
3288 cp = NULL;
3289 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
3290 {
3291 ChangedProperty *i_cp = l->data;
3292 if (i_cp->info == info)
3293 {
3294 cp = i_cp;
3295 break;
3296 }
3297 }
3298 if (cp == NULL)
3299 {
3300 cp = g_new0 (ChangedProperty, 1);
3301 cp->prop_id = prop_id;
3302 cp->info = info;
3303 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
3304 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
3305 g_value_copy (orig_value, &cp->orig_value);
3306 }
3307}
3308
3309static void
3310fan_skeleton_notify (GObject *object,
3311 GParamSpec *pspec G_GNUC_UNUSED)
3312{
3313 FanSkeleton *skeleton = FAN_SKELETON (object);
3314 g_mutex_lock (&skeleton->priv->lock);
3315 if (skeleton->priv->changed_properties != NULL &&
3316 skeleton->priv->changed_properties_idle_source == NULL)
3317 {
3318 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
3319 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
3320 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _fan_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
3321 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
3322 g_source_unref (skeleton->priv->changed_properties_idle_source);
3323 }
3324 g_mutex_unlock (&skeleton->priv->lock);
3325}
3326
3327static void
3328fan_skeleton_set_property (GObject *object,
3329 guint prop_id,
3330 const GValue *value,
3331 GParamSpec *pspec)
3332{
3333 FanSkeleton *skeleton = FAN_SKELETON (object);
3334 g_assert (prop_id != 0 && prop_id - 1 < 3);
3335 g_mutex_lock (&skeleton->priv->lock);
3336 g_object_freeze_notify (object);
3337 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
3338 {
3339 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
3340 _fan_schedule_emit_changed (skeleton, _fan_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
3341 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
3342 g_object_notify_by_pspec (object, pspec);
3343 }
3344 g_mutex_unlock (&skeleton->priv->lock);
3345 g_object_thaw_notify (object);
3346}
3347
3348static void
3349fan_skeleton_init (FanSkeleton *skeleton)
3350{
3351#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3352 skeleton->priv = fan_skeleton_get_instance_private (skeleton);
3353#else
3354 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FAN_SKELETON, FanSkeletonPrivate);
3355#endif
3356
3357 g_mutex_init (&skeleton->priv->lock);
3358 skeleton->priv->context = g_main_context_ref_thread_default ();
3359 skeleton->priv->properties = g_new0 (GValue, 3);
3360 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
3361 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
3362 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
3363}
3364
3365static gint
3366fan_skeleton_get_speed (Fan *object)
3367{
3368 FanSkeleton *skeleton = FAN_SKELETON (object);
3369 gint value;
3370 g_mutex_lock (&skeleton->priv->lock);
3371 value = g_value_get_int (&(skeleton->priv->properties[0]));
3372 g_mutex_unlock (&skeleton->priv->lock);
3373 return value;
3374}
3375
3376static gint
3377fan_skeleton_get_cooling_zone (Fan *object)
3378{
3379 FanSkeleton *skeleton = FAN_SKELETON (object);
3380 gint value;
3381 g_mutex_lock (&skeleton->priv->lock);
3382 value = g_value_get_int (&(skeleton->priv->properties[1]));
3383 g_mutex_unlock (&skeleton->priv->lock);
3384 return value;
3385}
3386
3387static gint
3388fan_skeleton_get_pwm_num (Fan *object)
3389{
3390 FanSkeleton *skeleton = FAN_SKELETON (object);
3391 gint value;
3392 g_mutex_lock (&skeleton->priv->lock);
3393 value = g_value_get_int (&(skeleton->priv->properties[2]));
3394 g_mutex_unlock (&skeleton->priv->lock);
3395 return value;
3396}
3397
3398static void
3399fan_skeleton_class_init (FanSkeletonClass *klass)
3400{
3401 GObjectClass *gobject_class;
3402 GDBusInterfaceSkeletonClass *skeleton_class;
3403
3404 gobject_class = G_OBJECT_CLASS (klass);
3405 gobject_class->finalize = fan_skeleton_finalize;
3406 gobject_class->get_property = fan_skeleton_get_property;
3407 gobject_class->set_property = fan_skeleton_set_property;
3408 gobject_class->notify = fan_skeleton_notify;
3409
3410
3411 fan_override_properties (gobject_class, 1);
3412
3413 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
3414 skeleton_class->get_info = fan_skeleton_dbus_interface_get_info;
3415 skeleton_class->get_properties = fan_skeleton_dbus_interface_get_properties;
3416 skeleton_class->flush = fan_skeleton_dbus_interface_flush;
3417 skeleton_class->get_vtable = fan_skeleton_dbus_interface_get_vtable;
3418
3419#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
3420 g_type_class_add_private (klass, sizeof (FanSkeletonPrivate));
3421#endif
3422}
3423
3424static void
3425fan_skeleton_iface_init (FanIface *iface)
3426{
3427 iface->speed_changed = _fan_on_signal_speed_changed;
3428 iface->tach_error = _fan_on_signal_tach_error;
3429 iface->get_speed = fan_skeleton_get_speed;
3430 iface->get_cooling_zone = fan_skeleton_get_cooling_zone;
3431 iface->get_pwm_num = fan_skeleton_get_pwm_num;
3432}
3433
3434/**
3435 * fan_skeleton_new:
3436 *
3437 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
3438 *
3439 * Returns: (transfer full) (type FanSkeleton): The skeleton object.
3440 */
3441Fan *
3442fan_skeleton_new (void)
3443{
3444 return FAN (g_object_new (TYPE_FAN_SKELETON, NULL));
3445}
3446
3447/* ------------------------------------------------------------------------
3448 * Code for interface org.openbmc.SensorValue
3449 * ------------------------------------------------------------------------
3450 */
3451
3452/**
3453 * SECTION:SensorValue
3454 * @title: SensorValue
3455 * @short_description: Generated C code for the org.openbmc.SensorValue D-Bus interface
3456 *
3457 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> D-Bus interface in C.
3458 */
3459
3460/* ---- Introspection data for org.openbmc.SensorValue ---- */
3461
3462static const _ExtendedGDBusMethodInfo _sensor_value_method_info_init =
3463{
3464 {
3465 -1,
3466 (gchar *) "init",
3467 NULL,
3468 NULL,
3469 NULL
3470 },
3471 "handle-init",
3472 FALSE
3473};
3474
3475static const _ExtendedGDBusArgInfo _sensor_value_method_info_get_value_OUT_ARG_value =
3476{
3477 {
3478 -1,
3479 (gchar *) "value",
3480 (gchar *) "v",
3481 NULL
3482 },
3483 FALSE
3484};
3485
3486static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_get_value_OUT_ARG_pointers[] =
3487{
3488 &_sensor_value_method_info_get_value_OUT_ARG_value,
3489 NULL
3490};
3491
3492static const _ExtendedGDBusMethodInfo _sensor_value_method_info_get_value =
3493{
3494 {
3495 -1,
3496 (gchar *) "getValue",
3497 NULL,
3498 (GDBusArgInfo **) &_sensor_value_method_info_get_value_OUT_ARG_pointers,
3499 NULL
3500 },
3501 "handle-get-value",
3502 FALSE
3503};
3504
3505static const _ExtendedGDBusArgInfo _sensor_value_method_info_set_value_IN_ARG_value =
3506{
3507 {
3508 -1,
3509 (gchar *) "value",
3510 (gchar *) "v",
3511 NULL
3512 },
3513 FALSE
3514};
3515
3516static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_set_value_IN_ARG_pointers[] =
3517{
3518 &_sensor_value_method_info_set_value_IN_ARG_value,
3519 NULL
3520};
3521
3522static const _ExtendedGDBusMethodInfo _sensor_value_method_info_set_value =
3523{
3524 {
3525 -1,
3526 (gchar *) "setValue",
3527 (GDBusArgInfo **) &_sensor_value_method_info_set_value_IN_ARG_pointers,
3528 NULL,
3529 NULL
3530 },
3531 "handle-set-value",
3532 FALSE
3533};
3534
3535static const _ExtendedGDBusMethodInfo * const _sensor_value_method_info_pointers[] =
3536{
3537 &_sensor_value_method_info_init,
3538 &_sensor_value_method_info_get_value,
3539 &_sensor_value_method_info_set_value,
3540 NULL
3541};
3542
3543static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_value =
3544{
3545 {
3546 -1,
3547 (gchar *) "value",
3548 (gchar *) "v",
3549 NULL
3550 },
3551 FALSE
3552};
3553
3554static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_units =
3555{
3556 {
3557 -1,
3558 (gchar *) "units",
3559 (gchar *) "s",
3560 NULL
3561 },
3562 FALSE
3563};
3564
3565static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_changed_ARG_pointers[] =
3566{
3567 &_sensor_value_signal_info_changed_ARG_value,
3568 &_sensor_value_signal_info_changed_ARG_units,
3569 NULL
3570};
3571
3572static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_changed =
3573{
3574 {
3575 -1,
3576 (gchar *) "Changed",
3577 (GDBusArgInfo **) &_sensor_value_signal_info_changed_ARG_pointers,
3578 NULL
3579 },
3580 "changed"
3581};
3582
3583static const _ExtendedGDBusArgInfo _sensor_value_signal_info_heartbeat_ARG_bus_name =
3584{
3585 {
3586 -1,
3587 (gchar *) "bus_name",
3588 (gchar *) "s",
3589 NULL
3590 },
3591 FALSE
3592};
3593
3594static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_heartbeat_ARG_pointers[] =
3595{
3596 &_sensor_value_signal_info_heartbeat_ARG_bus_name,
3597 NULL
3598};
3599
3600static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_heartbeat =
3601{
3602 {
3603 -1,
3604 (gchar *) "Heartbeat",
3605 (GDBusArgInfo **) &_sensor_value_signal_info_heartbeat_ARG_pointers,
3606 NULL
3607 },
3608 "heartbeat"
3609};
3610
3611static const _ExtendedGDBusSignalInfo * const _sensor_value_signal_info_pointers[] =
3612{
3613 &_sensor_value_signal_info_changed,
3614 &_sensor_value_signal_info_heartbeat,
3615 NULL
3616};
3617
3618static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_value =
3619{
3620 {
3621 -1,
3622 (gchar *) "value",
3623 (gchar *) "v",
3624 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3625 NULL
3626 },
3627 "value",
3628 FALSE
3629};
3630
3631static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_units =
3632{
3633 {
3634 -1,
3635 (gchar *) "units",
3636 (gchar *) "s",
3637 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3638 NULL
3639 },
3640 "units",
3641 FALSE
3642};
3643
3644static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_poll_interval =
3645{
3646 {
3647 -1,
3648 (gchar *) "poll_interval",
3649 (gchar *) "i",
3650 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
3651 NULL
3652 },
3653 "poll-interval",
3654 FALSE
3655};
3656
3657static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_heatbeat =
3658{
3659 {
3660 -1,
3661 (gchar *) "heatbeat",
3662 (gchar *) "i",
3663 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3664 NULL
3665 },
3666 "heatbeat",
3667 FALSE
3668};
3669
3670static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_settable =
3671{
3672 {
3673 -1,
3674 (gchar *) "settable",
3675 (gchar *) "b",
3676 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3677 NULL
3678 },
3679 "settable",
3680 FALSE
3681};
3682
3683static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_ipmi_entity_id =
3684{
3685 {
3686 -1,
3687 (gchar *) "ipmi_entity_id",
3688 (gchar *) "y",
3689 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3690 NULL
3691 },
3692 "ipmi-entity-id",
3693 FALSE
3694};
3695
3696static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_ipmi_id =
3697{
3698 {
3699 -1,
3700 (gchar *) "ipmi_id",
3701 (gchar *) "y",
3702 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
3703 NULL
3704 },
3705 "ipmi-id",
3706 FALSE
3707};
3708
3709static const _ExtendedGDBusPropertyInfo * const _sensor_value_property_info_pointers[] =
3710{
3711 &_sensor_value_property_info_value,
3712 &_sensor_value_property_info_units,
3713 &_sensor_value_property_info_poll_interval,
3714 &_sensor_value_property_info_heatbeat,
3715 &_sensor_value_property_info_settable,
3716 &_sensor_value_property_info_ipmi_entity_id,
3717 &_sensor_value_property_info_ipmi_id,
3718 NULL
3719};
3720
3721static const _ExtendedGDBusInterfaceInfo _sensor_value_interface_info =
3722{
3723 {
3724 -1,
3725 (gchar *) "org.openbmc.SensorValue",
3726 (GDBusMethodInfo **) &_sensor_value_method_info_pointers,
3727 (GDBusSignalInfo **) &_sensor_value_signal_info_pointers,
3728 (GDBusPropertyInfo **) &_sensor_value_property_info_pointers,
3729 NULL
3730 },
3731 "sensor-value",
3732};
3733
3734
3735/**
3736 * sensor_value_interface_info:
3737 *
3738 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> D-Bus interface.
3739 *
3740 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
3741 */
3742GDBusInterfaceInfo *
3743sensor_value_interface_info (void)
3744{
3745 return (GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct;
3746}
3747
3748/**
3749 * sensor_value_override_properties:
3750 * @klass: The class structure for a #GObject<!-- -->-derived class.
3751 * @property_id_begin: The property id to assign to the first overridden property.
3752 *
3753 * Overrides all #GObject properties in the #SensorValue interface for a concrete class.
3754 * The properties are overridden in the order they are defined.
3755 *
3756 * Returns: The last property id.
3757 */
3758guint
3759sensor_value_override_properties (GObjectClass *klass, guint property_id_begin)
3760{
3761 g_object_class_override_property (klass, property_id_begin++, "value");
3762 g_object_class_override_property (klass, property_id_begin++, "units");
3763 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
3764 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
3765 g_object_class_override_property (klass, property_id_begin++, "settable");
3766 g_object_class_override_property (klass, property_id_begin++, "ipmi-entity-id");
3767 g_object_class_override_property (klass, property_id_begin++, "ipmi-id");
3768 return property_id_begin - 1;
3769}
3770
3771
3772
3773/**
3774 * SensorValue:
3775 *
3776 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
3777 */
3778
3779/**
3780 * SensorValueIface:
3781 * @parent_iface: The parent interface.
3782 * @handle_get_value: Handler for the #SensorValue::handle-get-value signal.
3783 * @handle_init: Handler for the #SensorValue::handle-init signal.
3784 * @handle_set_value: Handler for the #SensorValue::handle-set-value signal.
3785 * @get_heatbeat: Getter for the #SensorValue:heatbeat property.
3786 * @get_ipmi_entity_id: Getter for the #SensorValue:ipmi-entity-id property.
3787 * @get_ipmi_id: Getter for the #SensorValue:ipmi-id property.
3788 * @get_poll_interval: Getter for the #SensorValue:poll-interval property.
3789 * @get_settable: Getter for the #SensorValue:settable property.
3790 * @get_units: Getter for the #SensorValue:units property.
3791 * @get_value: Getter for the #SensorValue:value property.
3792 * @changed: Handler for the #SensorValue::changed signal.
3793 * @heartbeat: Handler for the #SensorValue::heartbeat signal.
3794 *
3795 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
3796 */
3797
3798typedef SensorValueIface SensorValueInterface;
3799G_DEFINE_INTERFACE (SensorValue, sensor_value, G_TYPE_OBJECT);
3800
3801static void
3802sensor_value_default_init (SensorValueIface *iface)
3803{
3804 /* GObject signals for incoming D-Bus method calls: */
3805 /**
3806 * SensorValue::handle-init:
3807 * @object: A #SensorValue.
3808 * @invocation: A #GDBusMethodInvocation.
3809 *
3810 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method.
3811 *
3812 * 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 sensor_value_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.
3813 *
3814 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3815 */
3816 g_signal_new ("handle-init",
3817 G_TYPE_FROM_INTERFACE (iface),
3818 G_SIGNAL_RUN_LAST,
3819 G_STRUCT_OFFSET (SensorValueIface, handle_init),
3820 g_signal_accumulator_true_handled,
3821 NULL,
3822 g_cclosure_marshal_generic,
3823 G_TYPE_BOOLEAN,
3824 1,
3825 G_TYPE_DBUS_METHOD_INVOCATION);
3826
3827 /**
3828 * SensorValue::handle-get-value:
3829 * @object: A #SensorValue.
3830 * @invocation: A #GDBusMethodInvocation.
3831 *
3832 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method.
3833 *
3834 * 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 sensor_value_complete_get_value() 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.
3835 *
3836 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3837 */
3838 g_signal_new ("handle-get-value",
3839 G_TYPE_FROM_INTERFACE (iface),
3840 G_SIGNAL_RUN_LAST,
3841 G_STRUCT_OFFSET (SensorValueIface, handle_get_value),
3842 g_signal_accumulator_true_handled,
3843 NULL,
3844 g_cclosure_marshal_generic,
3845 G_TYPE_BOOLEAN,
3846 1,
3847 G_TYPE_DBUS_METHOD_INVOCATION);
3848
3849 /**
3850 * SensorValue::handle-set-value:
3851 * @object: A #SensorValue.
3852 * @invocation: A #GDBusMethodInvocation.
3853 * @arg_value: Argument passed by remote caller.
3854 *
3855 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method.
3856 *
3857 * 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 sensor_value_complete_set_value() 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.
3858 *
3859 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3860 */
3861 g_signal_new ("handle-set-value",
3862 G_TYPE_FROM_INTERFACE (iface),
3863 G_SIGNAL_RUN_LAST,
3864 G_STRUCT_OFFSET (SensorValueIface, handle_set_value),
3865 g_signal_accumulator_true_handled,
3866 NULL,
3867 g_cclosure_marshal_generic,
3868 G_TYPE_BOOLEAN,
3869 2,
3870 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT);
3871
3872 /* GObject signals for received D-Bus signals: */
3873 /**
3874 * SensorValue::changed:
3875 * @object: A #SensorValue.
3876 * @arg_value: Argument.
3877 * @arg_units: Argument.
3878 *
3879 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorValue.Changed">"Changed"</link> is received.
3880 *
3881 * 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.
3882 */
3883 g_signal_new ("changed",
3884 G_TYPE_FROM_INTERFACE (iface),
3885 G_SIGNAL_RUN_LAST,
3886 G_STRUCT_OFFSET (SensorValueIface, changed),
3887 NULL,
3888 NULL,
3889 g_cclosure_marshal_generic,
3890 G_TYPE_NONE,
3891 2, G_TYPE_VARIANT, G_TYPE_STRING);
3892
3893 /**
3894 * SensorValue::heartbeat:
3895 * @object: A #SensorValue.
3896 * @arg_bus_name: Argument.
3897 *
3898 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorValue.Heartbeat">"Heartbeat"</link> is received.
3899 *
3900 * 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.
3901 */
3902 g_signal_new ("heartbeat",
3903 G_TYPE_FROM_INTERFACE (iface),
3904 G_SIGNAL_RUN_LAST,
3905 G_STRUCT_OFFSET (SensorValueIface, heartbeat),
3906 NULL,
3907 NULL,
3908 g_cclosure_marshal_generic,
3909 G_TYPE_NONE,
3910 1, G_TYPE_STRING);
3911
3912 /* GObject properties for D-Bus properties: */
3913 /**
3914 * SensorValue:value:
3915 *
3916 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link>.
3917 *
3918 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
3919 */
3920 g_object_interface_install_property (iface,
3921 g_param_spec_variant ("value", "value", "value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3922 /**
3923 * SensorValue:units:
3924 *
3925 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link>.
3926 *
3927 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
3928 */
3929 g_object_interface_install_property (iface,
3930 g_param_spec_string ("units", "units", "units", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3931 /**
3932 * SensorValue:poll-interval:
3933 *
3934 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link>.
3935 *
3936 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
3937 */
3938 g_object_interface_install_property (iface,
3939 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3940 /**
3941 * SensorValue:heatbeat:
3942 *
3943 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link>.
3944 *
3945 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
3946 */
3947 g_object_interface_install_property (iface,
3948 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3949 /**
3950 * SensorValue:settable:
3951 *
3952 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link>.
3953 *
3954 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
3955 */
3956 g_object_interface_install_property (iface,
3957 g_param_spec_boolean ("settable", "settable", "settable", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3958 /**
3959 * SensorValue:ipmi-entity-id:
3960 *
3961 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.ipmi_entity_id">"ipmi_entity_id"</link>.
3962 *
3963 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
3964 */
3965 g_object_interface_install_property (iface,
3966 g_param_spec_uchar ("ipmi-entity-id", "ipmi_entity_id", "ipmi_entity_id", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3967 /**
3968 * SensorValue:ipmi-id:
3969 *
3970 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.ipmi_id">"ipmi_id"</link>.
3971 *
3972 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
3973 */
3974 g_object_interface_install_property (iface,
3975 g_param_spec_uchar ("ipmi-id", "ipmi_id", "ipmi_id", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3976}
3977
3978/**
3979 * sensor_value_get_value: (skip)
3980 * @object: A #SensorValue.
3981 *
3982 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property.
3983 *
3984 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
3985 *
3986 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_value_dup_value() if on another thread.</warning>
3987 *
3988 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
3989 */
3990GVariant *
3991sensor_value_get_value (SensorValue *object)
3992{
3993 return SENSOR_VALUE_GET_IFACE (object)->get_value (object);
3994}
3995
3996/**
3997 * sensor_value_dup_value: (skip)
3998 * @object: A #SensorValue.
3999 *
4000 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property.
4001 *
4002 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4003 *
4004 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
4005 */
4006GVariant *
4007sensor_value_dup_value (SensorValue *object)
4008{
4009 GVariant *value;
4010 g_object_get (G_OBJECT (object), "value", &value, NULL);
4011 return value;
4012}
4013
4014/**
4015 * sensor_value_set_value: (skip)
4016 * @object: A #SensorValue.
4017 * @value: The value to set.
4018 *
4019 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property to @value.
4020 *
4021 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4022 */
4023void
4024sensor_value_set_value (SensorValue *object, GVariant *value)
4025{
4026 g_object_set (G_OBJECT (object), "value", value, NULL);
4027}
4028
4029/**
4030 * sensor_value_get_units: (skip)
4031 * @object: A #SensorValue.
4032 *
4033 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property.
4034 *
4035 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4036 *
4037 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_value_dup_units() if on another thread.</warning>
4038 *
4039 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
4040 */
4041const gchar *
4042sensor_value_get_units (SensorValue *object)
4043{
4044 return SENSOR_VALUE_GET_IFACE (object)->get_units (object);
4045}
4046
4047/**
4048 * sensor_value_dup_units: (skip)
4049 * @object: A #SensorValue.
4050 *
4051 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property.
4052 *
4053 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4054 *
4055 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
4056 */
4057gchar *
4058sensor_value_dup_units (SensorValue *object)
4059{
4060 gchar *value;
4061 g_object_get (G_OBJECT (object), "units", &value, NULL);
4062 return value;
4063}
4064
4065/**
4066 * sensor_value_set_units: (skip)
4067 * @object: A #SensorValue.
4068 * @value: The value to set.
4069 *
4070 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property to @value.
4071 *
4072 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4073 */
4074void
4075sensor_value_set_units (SensorValue *object, const gchar *value)
4076{
4077 g_object_set (G_OBJECT (object), "units", value, NULL);
4078}
4079
4080/**
4081 * sensor_value_get_poll_interval: (skip)
4082 * @object: A #SensorValue.
4083 *
4084 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property.
4085 *
4086 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4087 *
4088 * Returns: The property value.
4089 */
4090gint
4091sensor_value_get_poll_interval (SensorValue *object)
4092{
4093 return SENSOR_VALUE_GET_IFACE (object)->get_poll_interval (object);
4094}
4095
4096/**
4097 * sensor_value_set_poll_interval: (skip)
4098 * @object: A #SensorValue.
4099 * @value: The value to set.
4100 *
4101 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property to @value.
4102 *
4103 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4104 */
4105void
4106sensor_value_set_poll_interval (SensorValue *object, gint value)
4107{
4108 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
4109}
4110
4111/**
4112 * sensor_value_get_heatbeat: (skip)
4113 * @object: A #SensorValue.
4114 *
4115 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property.
4116 *
4117 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4118 *
4119 * Returns: The property value.
4120 */
4121gint
4122sensor_value_get_heatbeat (SensorValue *object)
4123{
4124 return SENSOR_VALUE_GET_IFACE (object)->get_heatbeat (object);
4125}
4126
4127/**
4128 * sensor_value_set_heatbeat: (skip)
4129 * @object: A #SensorValue.
4130 * @value: The value to set.
4131 *
4132 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property to @value.
4133 *
4134 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4135 */
4136void
4137sensor_value_set_heatbeat (SensorValue *object, gint value)
4138{
4139 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
4140}
4141
4142/**
4143 * sensor_value_get_settable: (skip)
4144 * @object: A #SensorValue.
4145 *
4146 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property.
4147 *
4148 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4149 *
4150 * Returns: The property value.
4151 */
4152gboolean
4153sensor_value_get_settable (SensorValue *object)
4154{
4155 return SENSOR_VALUE_GET_IFACE (object)->get_settable (object);
4156}
4157
4158/**
4159 * sensor_value_set_settable: (skip)
4160 * @object: A #SensorValue.
4161 * @value: The value to set.
4162 *
4163 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property to @value.
4164 *
4165 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4166 */
4167void
4168sensor_value_set_settable (SensorValue *object, gboolean value)
4169{
4170 g_object_set (G_OBJECT (object), "settable", value, NULL);
4171}
4172
4173/**
4174 * sensor_value_get_ipmi_entity_id: (skip)
4175 * @object: A #SensorValue.
4176 *
4177 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.ipmi_entity_id">"ipmi_entity_id"</link> D-Bus property.
4178 *
4179 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4180 *
4181 * Returns: The property value.
4182 */
4183guchar
4184sensor_value_get_ipmi_entity_id (SensorValue *object)
4185{
4186 return SENSOR_VALUE_GET_IFACE (object)->get_ipmi_entity_id (object);
4187}
4188
4189/**
4190 * sensor_value_set_ipmi_entity_id: (skip)
4191 * @object: A #SensorValue.
4192 * @value: The value to set.
4193 *
4194 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.ipmi_entity_id">"ipmi_entity_id"</link> D-Bus property to @value.
4195 *
4196 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4197 */
4198void
4199sensor_value_set_ipmi_entity_id (SensorValue *object, guchar value)
4200{
4201 g_object_set (G_OBJECT (object), "ipmi-entity-id", value, NULL);
4202}
4203
4204/**
4205 * sensor_value_get_ipmi_id: (skip)
4206 * @object: A #SensorValue.
4207 *
4208 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.ipmi_id">"ipmi_id"</link> D-Bus property.
4209 *
4210 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4211 *
4212 * Returns: The property value.
4213 */
4214guchar
4215sensor_value_get_ipmi_id (SensorValue *object)
4216{
4217 return SENSOR_VALUE_GET_IFACE (object)->get_ipmi_id (object);
4218}
4219
4220/**
4221 * sensor_value_set_ipmi_id: (skip)
4222 * @object: A #SensorValue.
4223 * @value: The value to set.
4224 *
4225 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.ipmi_id">"ipmi_id"</link> D-Bus property to @value.
4226 *
4227 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4228 */
4229void
4230sensor_value_set_ipmi_id (SensorValue *object, guchar value)
4231{
4232 g_object_set (G_OBJECT (object), "ipmi-id", value, NULL);
4233}
4234
4235/**
4236 * sensor_value_emit_changed:
4237 * @object: A #SensorValue.
4238 * @arg_value: Argument to pass with the signal.
4239 * @arg_units: Argument to pass with the signal.
4240 *
4241 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Changed">"Changed"</link> D-Bus signal.
4242 */
4243void
4244sensor_value_emit_changed (
4245 SensorValue *object,
4246 GVariant *arg_value,
4247 const gchar *arg_units)
4248{
4249 g_signal_emit_by_name (object, "changed", arg_value, arg_units);
4250}
4251
4252/**
4253 * sensor_value_emit_heartbeat:
4254 * @object: A #SensorValue.
4255 * @arg_bus_name: Argument to pass with the signal.
4256 *
4257 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Heartbeat">"Heartbeat"</link> D-Bus signal.
4258 */
4259void
4260sensor_value_emit_heartbeat (
4261 SensorValue *object,
4262 const gchar *arg_bus_name)
4263{
4264 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
4265}
4266
4267/**
4268 * sensor_value_call_init:
4269 * @proxy: A #SensorValueProxy.
4270 * @cancellable: (allow-none): A #GCancellable or %NULL.
4271 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4272 * @user_data: User data to pass to @callback.
4273 *
4274 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method on @proxy.
4275 * 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.
4276 * You can then call sensor_value_call_init_finish() to get the result of the operation.
4277 *
4278 * See sensor_value_call_init_sync() for the synchronous, blocking version of this method.
4279 */
4280void
4281sensor_value_call_init (
4282 SensorValue *proxy,
4283 GCancellable *cancellable,
4284 GAsyncReadyCallback callback,
4285 gpointer user_data)
4286{
4287 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4288 "init",
4289 g_variant_new ("()"),
4290 G_DBUS_CALL_FLAGS_NONE,
4291 -1,
4292 cancellable,
4293 callback,
4294 user_data);
4295}
4296
4297/**
4298 * sensor_value_call_init_finish:
4299 * @proxy: A #SensorValueProxy.
4300 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_init().
4301 * @error: Return location for error or %NULL.
4302 *
4303 * Finishes an operation started with sensor_value_call_init().
4304 *
4305 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4306 */
4307gboolean
4308sensor_value_call_init_finish (
4309 SensorValue *proxy,
4310 GAsyncResult *res,
4311 GError **error)
4312{
4313 GVariant *_ret;
4314 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4315 if (_ret == NULL)
4316 goto _out;
4317 g_variant_get (_ret,
4318 "()");
4319 g_variant_unref (_ret);
4320_out:
4321 return _ret != NULL;
4322}
4323
4324/**
4325 * sensor_value_call_init_sync:
4326 * @proxy: A #SensorValueProxy.
4327 * @cancellable: (allow-none): A #GCancellable or %NULL.
4328 * @error: Return location for error or %NULL.
4329 *
4330 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
4331 *
4332 * See sensor_value_call_init() for the asynchronous version of this method.
4333 *
4334 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4335 */
4336gboolean
4337sensor_value_call_init_sync (
4338 SensorValue *proxy,
4339 GCancellable *cancellable,
4340 GError **error)
4341{
4342 GVariant *_ret;
4343 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4344 "init",
4345 g_variant_new ("()"),
4346 G_DBUS_CALL_FLAGS_NONE,
4347 -1,
4348 cancellable,
4349 error);
4350 if (_ret == NULL)
4351 goto _out;
4352 g_variant_get (_ret,
4353 "()");
4354 g_variant_unref (_ret);
4355_out:
4356 return _ret != NULL;
4357}
4358
4359/**
4360 * sensor_value_call_get_value:
4361 * @proxy: A #SensorValueProxy.
4362 * @cancellable: (allow-none): A #GCancellable or %NULL.
4363 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4364 * @user_data: User data to pass to @callback.
4365 *
4366 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method on @proxy.
4367 * 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.
4368 * You can then call sensor_value_call_get_value_finish() to get the result of the operation.
4369 *
4370 * See sensor_value_call_get_value_sync() for the synchronous, blocking version of this method.
4371 */
4372void
4373sensor_value_call_get_value (
4374 SensorValue *proxy,
4375 GCancellable *cancellable,
4376 GAsyncReadyCallback callback,
4377 gpointer user_data)
4378{
4379 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4380 "getValue",
4381 g_variant_new ("()"),
4382 G_DBUS_CALL_FLAGS_NONE,
4383 -1,
4384 cancellable,
4385 callback,
4386 user_data);
4387}
4388
4389/**
4390 * sensor_value_call_get_value_finish:
4391 * @proxy: A #SensorValueProxy.
4392 * @out_value: (out): Return location for return parameter or %NULL to ignore.
4393 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_get_value().
4394 * @error: Return location for error or %NULL.
4395 *
4396 * Finishes an operation started with sensor_value_call_get_value().
4397 *
4398 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4399 */
4400gboolean
4401sensor_value_call_get_value_finish (
4402 SensorValue *proxy,
4403 GVariant **out_value,
4404 GAsyncResult *res,
4405 GError **error)
4406{
4407 GVariant *_ret;
4408 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4409 if (_ret == NULL)
4410 goto _out;
4411 g_variant_get (_ret,
4412 "(@v)",
4413 out_value);
4414 g_variant_unref (_ret);
4415_out:
4416 return _ret != NULL;
4417}
4418
4419/**
4420 * sensor_value_call_get_value_sync:
4421 * @proxy: A #SensorValueProxy.
4422 * @out_value: (out): Return location for return parameter or %NULL to ignore.
4423 * @cancellable: (allow-none): A #GCancellable or %NULL.
4424 * @error: Return location for error or %NULL.
4425 *
4426 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
4427 *
4428 * See sensor_value_call_get_value() for the asynchronous version of this method.
4429 *
4430 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4431 */
4432gboolean
4433sensor_value_call_get_value_sync (
4434 SensorValue *proxy,
4435 GVariant **out_value,
4436 GCancellable *cancellable,
4437 GError **error)
4438{
4439 GVariant *_ret;
4440 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4441 "getValue",
4442 g_variant_new ("()"),
4443 G_DBUS_CALL_FLAGS_NONE,
4444 -1,
4445 cancellable,
4446 error);
4447 if (_ret == NULL)
4448 goto _out;
4449 g_variant_get (_ret,
4450 "(@v)",
4451 out_value);
4452 g_variant_unref (_ret);
4453_out:
4454 return _ret != NULL;
4455}
4456
4457/**
4458 * sensor_value_call_set_value:
4459 * @proxy: A #SensorValueProxy.
4460 * @arg_value: Argument to pass with the method invocation.
4461 * @cancellable: (allow-none): A #GCancellable or %NULL.
4462 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4463 * @user_data: User data to pass to @callback.
4464 *
4465 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method on @proxy.
4466 * 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.
4467 * You can then call sensor_value_call_set_value_finish() to get the result of the operation.
4468 *
4469 * See sensor_value_call_set_value_sync() for the synchronous, blocking version of this method.
4470 */
4471void
4472sensor_value_call_set_value (
4473 SensorValue *proxy,
4474 GVariant *arg_value,
4475 GCancellable *cancellable,
4476 GAsyncReadyCallback callback,
4477 gpointer user_data)
4478{
4479 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4480 "setValue",
4481 g_variant_new ("(@v)",
4482 arg_value),
4483 G_DBUS_CALL_FLAGS_NONE,
4484 -1,
4485 cancellable,
4486 callback,
4487 user_data);
4488}
4489
4490/**
4491 * sensor_value_call_set_value_finish:
4492 * @proxy: A #SensorValueProxy.
4493 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_set_value().
4494 * @error: Return location for error or %NULL.
4495 *
4496 * Finishes an operation started with sensor_value_call_set_value().
4497 *
4498 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4499 */
4500gboolean
4501sensor_value_call_set_value_finish (
4502 SensorValue *proxy,
4503 GAsyncResult *res,
4504 GError **error)
4505{
4506 GVariant *_ret;
4507 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4508 if (_ret == NULL)
4509 goto _out;
4510 g_variant_get (_ret,
4511 "()");
4512 g_variant_unref (_ret);
4513_out:
4514 return _ret != NULL;
4515}
4516
4517/**
4518 * sensor_value_call_set_value_sync:
4519 * @proxy: A #SensorValueProxy.
4520 * @arg_value: Argument to pass with the method invocation.
4521 * @cancellable: (allow-none): A #GCancellable or %NULL.
4522 * @error: Return location for error or %NULL.
4523 *
4524 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
4525 *
4526 * See sensor_value_call_set_value() for the asynchronous version of this method.
4527 *
4528 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4529 */
4530gboolean
4531sensor_value_call_set_value_sync (
4532 SensorValue *proxy,
4533 GVariant *arg_value,
4534 GCancellable *cancellable,
4535 GError **error)
4536{
4537 GVariant *_ret;
4538 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4539 "setValue",
4540 g_variant_new ("(@v)",
4541 arg_value),
4542 G_DBUS_CALL_FLAGS_NONE,
4543 -1,
4544 cancellable,
4545 error);
4546 if (_ret == NULL)
4547 goto _out;
4548 g_variant_get (_ret,
4549 "()");
4550 g_variant_unref (_ret);
4551_out:
4552 return _ret != NULL;
4553}
4554
4555/**
4556 * sensor_value_complete_init:
4557 * @object: A #SensorValue.
4558 * @invocation: (transfer full): A #GDBusMethodInvocation.
4559 *
4560 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorValue.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.
4561 *
4562 * This method will free @invocation, you cannot use it afterwards.
4563 */
4564void
4565sensor_value_complete_init (
4566 SensorValue *object,
4567 GDBusMethodInvocation *invocation)
4568{
4569 g_dbus_method_invocation_return_value (invocation,
4570 g_variant_new ("()"));
4571}
4572
4573/**
4574 * sensor_value_complete_get_value:
4575 * @object: A #SensorValue.
4576 * @invocation: (transfer full): A #GDBusMethodInvocation.
4577 * @value: Parameter to return.
4578 *
4579 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</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.
4580 *
4581 * This method will free @invocation, you cannot use it afterwards.
4582 */
4583void
4584sensor_value_complete_get_value (
4585 SensorValue *object,
4586 GDBusMethodInvocation *invocation,
4587 GVariant *value)
4588{
4589 g_dbus_method_invocation_return_value (invocation,
4590 g_variant_new ("(@v)",
4591 value));
4592}
4593
4594/**
4595 * sensor_value_complete_set_value:
4596 * @object: A #SensorValue.
4597 * @invocation: (transfer full): A #GDBusMethodInvocation.
4598 *
4599 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</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.
4600 *
4601 * This method will free @invocation, you cannot use it afterwards.
4602 */
4603void
4604sensor_value_complete_set_value (
4605 SensorValue *object,
4606 GDBusMethodInvocation *invocation)
4607{
4608 g_dbus_method_invocation_return_value (invocation,
4609 g_variant_new ("()"));
4610}
4611
4612/* ------------------------------------------------------------------------ */
4613
4614/**
4615 * SensorValueProxy:
4616 *
4617 * The #SensorValueProxy structure contains only private data and should only be accessed using the provided API.
4618 */
4619
4620/**
4621 * SensorValueProxyClass:
4622 * @parent_class: The parent class.
4623 *
4624 * Class structure for #SensorValueProxy.
4625 */
4626
4627struct _SensorValueProxyPrivate
4628{
4629 GData *qdata;
4630};
4631
4632static void sensor_value_proxy_iface_init (SensorValueIface *iface);
4633
4634#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4635G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
4636 G_ADD_PRIVATE (SensorValueProxy)
4637 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init));
4638
4639#else
4640G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
4641 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init));
4642
4643#endif
4644static void
4645sensor_value_proxy_finalize (GObject *object)
4646{
4647 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4648 g_datalist_clear (&proxy->priv->qdata);
4649 G_OBJECT_CLASS (sensor_value_proxy_parent_class)->finalize (object);
4650}
4651
4652static void
4653sensor_value_proxy_get_property (GObject *object,
4654 guint prop_id,
4655 GValue *value,
4656 GParamSpec *pspec G_GNUC_UNUSED)
4657{
4658 const _ExtendedGDBusPropertyInfo *info;
4659 GVariant *variant;
4660 g_assert (prop_id != 0 && prop_id - 1 < 7);
4661 info = _sensor_value_property_info_pointers[prop_id - 1];
4662 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
4663 if (info->use_gvariant)
4664 {
4665 g_value_set_variant (value, variant);
4666 }
4667 else
4668 {
4669 if (variant != NULL)
4670 g_dbus_gvariant_to_gvalue (variant, value);
4671 }
4672 if (variant != NULL)
4673 g_variant_unref (variant);
4674}
4675
4676static void
4677sensor_value_proxy_set_property_cb (GDBusProxy *proxy,
4678 GAsyncResult *res,
4679 gpointer user_data)
4680{
4681 const _ExtendedGDBusPropertyInfo *info = user_data;
4682 GError *error;
4683 GVariant *_ret;
4684 error = NULL;
4685 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
4686 if (!_ret)
4687 {
4688 g_warning ("Error setting property '%s' on interface org.openbmc.SensorValue: %s (%s, %d)",
4689 info->parent_struct.name,
4690 error->message, g_quark_to_string (error->domain), error->code);
4691 g_error_free (error);
4692 }
4693 else
4694 {
4695 g_variant_unref (_ret);
4696 }
4697}
4698
4699static void
4700sensor_value_proxy_set_property (GObject *object,
4701 guint prop_id,
4702 const GValue *value,
4703 GParamSpec *pspec G_GNUC_UNUSED)
4704{
4705 const _ExtendedGDBusPropertyInfo *info;
4706 GVariant *variant;
4707 g_assert (prop_id != 0 && prop_id - 1 < 7);
4708 info = _sensor_value_property_info_pointers[prop_id - 1];
4709 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
4710 g_dbus_proxy_call (G_DBUS_PROXY (object),
4711 "org.freedesktop.DBus.Properties.Set",
4712 g_variant_new ("(ssv)", "org.openbmc.SensorValue", info->parent_struct.name, variant),
4713 G_DBUS_CALL_FLAGS_NONE,
4714 -1,
4715 NULL, (GAsyncReadyCallback) sensor_value_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
4716 g_variant_unref (variant);
4717}
4718
4719static void
4720sensor_value_proxy_g_signal (GDBusProxy *proxy,
4721 const gchar *sender_name G_GNUC_UNUSED,
4722 const gchar *signal_name,
4723 GVariant *parameters)
4724{
4725 _ExtendedGDBusSignalInfo *info;
4726 GVariantIter iter;
4727 GVariant *child;
4728 GValue *paramv;
4729 guint num_params;
4730 guint n;
4731 guint signal_id;
4732 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, signal_name);
4733 if (info == NULL)
4734 return;
4735 num_params = g_variant_n_children (parameters);
4736 paramv = g_new0 (GValue, num_params + 1);
4737 g_value_init (&paramv[0], TYPE_SENSOR_VALUE);
4738 g_value_set_object (&paramv[0], proxy);
4739 g_variant_iter_init (&iter, parameters);
4740 n = 1;
4741 while ((child = g_variant_iter_next_value (&iter)) != NULL)
4742 {
4743 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
4744 if (arg_info->use_gvariant)
4745 {
4746 g_value_init (&paramv[n], G_TYPE_VARIANT);
4747 g_value_set_variant (&paramv[n], child);
4748 n++;
4749 }
4750 else
4751 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
4752 g_variant_unref (child);
4753 }
4754 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
4755 g_signal_emitv (paramv, signal_id, 0, NULL);
4756 for (n = 0; n < num_params + 1; n++)
4757 g_value_unset (&paramv[n]);
4758 g_free (paramv);
4759}
4760
4761static void
4762sensor_value_proxy_g_properties_changed (GDBusProxy *_proxy,
4763 GVariant *changed_properties,
4764 const gchar *const *invalidated_properties)
4765{
4766 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (_proxy);
4767 guint n;
4768 const gchar *key;
4769 GVariantIter *iter;
4770 _ExtendedGDBusPropertyInfo *info;
4771 g_variant_get (changed_properties, "a{sv}", &iter);
4772 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
4773 {
4774 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, key);
4775 g_datalist_remove_data (&proxy->priv->qdata, key);
4776 if (info != NULL)
4777 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4778 }
4779 g_variant_iter_free (iter);
4780 for (n = 0; invalidated_properties[n] != NULL; n++)
4781 {
4782 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, invalidated_properties[n]);
4783 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
4784 if (info != NULL)
4785 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4786 }
4787}
4788
4789static GVariant *
4790sensor_value_proxy_get_value (SensorValue *object)
4791{
4792 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4793 GVariant *variant;
4794 GVariant *value = NULL;
4795 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value");
4796 value = variant;
4797 if (variant != NULL)
4798 g_variant_unref (variant);
4799 return value;
4800}
4801
4802static const gchar *
4803sensor_value_proxy_get_units (SensorValue *object)
4804{
4805 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4806 GVariant *variant;
4807 const gchar *value = NULL;
4808 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units");
4809 if (variant != NULL)
4810 {
4811 value = g_variant_get_string (variant, NULL);
4812 g_variant_unref (variant);
4813 }
4814 return value;
4815}
4816
4817static gint
4818sensor_value_proxy_get_poll_interval (SensorValue *object)
4819{
4820 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4821 GVariant *variant;
4822 gint value = 0;
4823 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
4824 if (variant != NULL)
4825 {
4826 value = g_variant_get_int32 (variant);
4827 g_variant_unref (variant);
4828 }
4829 return value;
4830}
4831
4832static gint
4833sensor_value_proxy_get_heatbeat (SensorValue *object)
4834{
4835 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4836 GVariant *variant;
4837 gint value = 0;
4838 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
4839 if (variant != NULL)
4840 {
4841 value = g_variant_get_int32 (variant);
4842 g_variant_unref (variant);
4843 }
4844 return value;
4845}
4846
4847static gboolean
4848sensor_value_proxy_get_settable (SensorValue *object)
4849{
4850 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4851 GVariant *variant;
4852 gboolean value = 0;
4853 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "settable");
4854 if (variant != NULL)
4855 {
4856 value = g_variant_get_boolean (variant);
4857 g_variant_unref (variant);
4858 }
4859 return value;
4860}
4861
4862static guchar
4863sensor_value_proxy_get_ipmi_entity_id (SensorValue *object)
4864{
4865 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4866 GVariant *variant;
4867 guchar value = 0;
4868 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "ipmi_entity_id");
4869 if (variant != NULL)
4870 {
4871 value = g_variant_get_byte (variant);
4872 g_variant_unref (variant);
4873 }
4874 return value;
4875}
4876
4877static guchar
4878sensor_value_proxy_get_ipmi_id (SensorValue *object)
4879{
4880 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4881 GVariant *variant;
4882 guchar value = 0;
4883 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "ipmi_id");
4884 if (variant != NULL)
4885 {
4886 value = g_variant_get_byte (variant);
4887 g_variant_unref (variant);
4888 }
4889 return value;
4890}
4891
4892static void
4893sensor_value_proxy_init (SensorValueProxy *proxy)
4894{
4895#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4896 proxy->priv = sensor_value_proxy_get_instance_private (proxy);
4897#else
4898 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_VALUE_PROXY, SensorValueProxyPrivate);
4899#endif
4900
4901 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_value_interface_info ());
4902}
4903
4904static void
4905sensor_value_proxy_class_init (SensorValueProxyClass *klass)
4906{
4907 GObjectClass *gobject_class;
4908 GDBusProxyClass *proxy_class;
4909
4910 gobject_class = G_OBJECT_CLASS (klass);
4911 gobject_class->finalize = sensor_value_proxy_finalize;
4912 gobject_class->get_property = sensor_value_proxy_get_property;
4913 gobject_class->set_property = sensor_value_proxy_set_property;
4914
4915 proxy_class = G_DBUS_PROXY_CLASS (klass);
4916 proxy_class->g_signal = sensor_value_proxy_g_signal;
4917 proxy_class->g_properties_changed = sensor_value_proxy_g_properties_changed;
4918
4919 sensor_value_override_properties (gobject_class, 1);
4920
4921#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
4922 g_type_class_add_private (klass, sizeof (SensorValueProxyPrivate));
4923#endif
4924}
4925
4926static void
4927sensor_value_proxy_iface_init (SensorValueIface *iface)
4928{
4929 iface->get_value = sensor_value_proxy_get_value;
4930 iface->get_units = sensor_value_proxy_get_units;
4931 iface->get_poll_interval = sensor_value_proxy_get_poll_interval;
4932 iface->get_heatbeat = sensor_value_proxy_get_heatbeat;
4933 iface->get_settable = sensor_value_proxy_get_settable;
4934 iface->get_ipmi_entity_id = sensor_value_proxy_get_ipmi_entity_id;
4935 iface->get_ipmi_id = sensor_value_proxy_get_ipmi_id;
4936}
4937
4938/**
4939 * sensor_value_proxy_new:
4940 * @connection: A #GDBusConnection.
4941 * @flags: Flags from the #GDBusProxyFlags enumeration.
4942 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
4943 * @object_path: An object path.
4944 * @cancellable: (allow-none): A #GCancellable or %NULL.
4945 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
4946 * @user_data: User data to pass to @callback.
4947 *
4948 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>. See g_dbus_proxy_new() for more details.
4949 *
4950 * 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.
4951 * You can then call sensor_value_proxy_new_finish() to get the result of the operation.
4952 *
4953 * See sensor_value_proxy_new_sync() for the synchronous, blocking version of this constructor.
4954 */
4955void
4956sensor_value_proxy_new (
4957 GDBusConnection *connection,
4958 GDBusProxyFlags flags,
4959 const gchar *name,
4960 const gchar *object_path,
4961 GCancellable *cancellable,
4962 GAsyncReadyCallback callback,
4963 gpointer user_data)
4964{
4965 g_async_initable_new_async (TYPE_SENSOR_VALUE_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.SensorValue", NULL);
4966}
4967
4968/**
4969 * sensor_value_proxy_new_finish:
4970 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new().
4971 * @error: Return location for error or %NULL
4972 *
4973 * Finishes an operation started with sensor_value_proxy_new().
4974 *
4975 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
4976 */
4977SensorValue *
4978sensor_value_proxy_new_finish (
4979 GAsyncResult *res,
4980 GError **error)
4981{
4982 GObject *ret;
4983 GObject *source_object;
4984 source_object = g_async_result_get_source_object (res);
4985 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
4986 g_object_unref (source_object);
4987 if (ret != NULL)
4988 return SENSOR_VALUE (ret);
4989 else
4990 return NULL;
4991}
4992
4993/**
4994 * sensor_value_proxy_new_sync:
4995 * @connection: A #GDBusConnection.
4996 * @flags: Flags from the #GDBusProxyFlags enumeration.
4997 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
4998 * @object_path: An object path.
4999 * @cancellable: (allow-none): A #GCancellable or %NULL.
5000 * @error: Return location for error or %NULL
5001 *
5002 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>. See g_dbus_proxy_new_sync() for more details.
5003 *
5004 * The calling thread is blocked until a reply is received.
5005 *
5006 * See sensor_value_proxy_new() for the asynchronous version of this constructor.
5007 *
5008 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5009 */
5010SensorValue *
5011sensor_value_proxy_new_sync (
5012 GDBusConnection *connection,
5013 GDBusProxyFlags flags,
5014 const gchar *name,
5015 const gchar *object_path,
5016 GCancellable *cancellable,
5017 GError **error)
5018{
5019 GInitable *ret;
5020 ret = g_initable_new (TYPE_SENSOR_VALUE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorValue", NULL);
5021 if (ret != NULL)
5022 return SENSOR_VALUE (ret);
5023 else
5024 return NULL;
5025}
5026
5027
5028/**
5029 * sensor_value_proxy_new_for_bus:
5030 * @bus_type: A #GBusType.
5031 * @flags: Flags from the #GDBusProxyFlags enumeration.
5032 * @name: A bus name (well-known or unique).
5033 * @object_path: An object path.
5034 * @cancellable: (allow-none): A #GCancellable or %NULL.
5035 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
5036 * @user_data: User data to pass to @callback.
5037 *
5038 * Like sensor_value_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
5039 *
5040 * 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.
5041 * You can then call sensor_value_proxy_new_for_bus_finish() to get the result of the operation.
5042 *
5043 * See sensor_value_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
5044 */
5045void
5046sensor_value_proxy_new_for_bus (
5047 GBusType bus_type,
5048 GDBusProxyFlags flags,
5049 const gchar *name,
5050 const gchar *object_path,
5051 GCancellable *cancellable,
5052 GAsyncReadyCallback callback,
5053 gpointer user_data)
5054{
5055 g_async_initable_new_async (TYPE_SENSOR_VALUE_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.SensorValue", NULL);
5056}
5057
5058/**
5059 * sensor_value_proxy_new_for_bus_finish:
5060 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new_for_bus().
5061 * @error: Return location for error or %NULL
5062 *
5063 * Finishes an operation started with sensor_value_proxy_new_for_bus().
5064 *
5065 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5066 */
5067SensorValue *
5068sensor_value_proxy_new_for_bus_finish (
5069 GAsyncResult *res,
5070 GError **error)
5071{
5072 GObject *ret;
5073 GObject *source_object;
5074 source_object = g_async_result_get_source_object (res);
5075 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
5076 g_object_unref (source_object);
5077 if (ret != NULL)
5078 return SENSOR_VALUE (ret);
5079 else
5080 return NULL;
5081}
5082
5083/**
5084 * sensor_value_proxy_new_for_bus_sync:
5085 * @bus_type: A #GBusType.
5086 * @flags: Flags from the #GDBusProxyFlags enumeration.
5087 * @name: A bus name (well-known or unique).
5088 * @object_path: An object path.
5089 * @cancellable: (allow-none): A #GCancellable or %NULL.
5090 * @error: Return location for error or %NULL
5091 *
5092 * Like sensor_value_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
5093 *
5094 * The calling thread is blocked until a reply is received.
5095 *
5096 * See sensor_value_proxy_new_for_bus() for the asynchronous version of this constructor.
5097 *
5098 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5099 */
5100SensorValue *
5101sensor_value_proxy_new_for_bus_sync (
5102 GBusType bus_type,
5103 GDBusProxyFlags flags,
5104 const gchar *name,
5105 const gchar *object_path,
5106 GCancellable *cancellable,
5107 GError **error)
5108{
5109 GInitable *ret;
5110 ret = g_initable_new (TYPE_SENSOR_VALUE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorValue", NULL);
5111 if (ret != NULL)
5112 return SENSOR_VALUE (ret);
5113 else
5114 return NULL;
5115}
5116
5117
5118/* ------------------------------------------------------------------------ */
5119
5120/**
5121 * SensorValueSkeleton:
5122 *
5123 * The #SensorValueSkeleton structure contains only private data and should only be accessed using the provided API.
5124 */
5125
5126/**
5127 * SensorValueSkeletonClass:
5128 * @parent_class: The parent class.
5129 *
5130 * Class structure for #SensorValueSkeleton.
5131 */
5132
5133struct _SensorValueSkeletonPrivate
5134{
5135 GValue *properties;
5136 GList *changed_properties;
5137 GSource *changed_properties_idle_source;
5138 GMainContext *context;
5139 GMutex lock;
5140};
5141
5142static void
5143_sensor_value_skeleton_handle_method_call (
5144 GDBusConnection *connection G_GNUC_UNUSED,
5145 const gchar *sender G_GNUC_UNUSED,
5146 const gchar *object_path G_GNUC_UNUSED,
5147 const gchar *interface_name,
5148 const gchar *method_name,
5149 GVariant *parameters,
5150 GDBusMethodInvocation *invocation,
5151 gpointer user_data)
5152{
5153 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5154 _ExtendedGDBusMethodInfo *info;
5155 GVariantIter iter;
5156 GVariant *child;
5157 GValue *paramv;
5158 guint num_params;
5159 guint num_extra;
5160 guint n;
5161 guint signal_id;
5162 GValue return_value = G_VALUE_INIT;
5163 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
5164 g_assert (info != NULL);
5165 num_params = g_variant_n_children (parameters);
5166 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
5167 n = 0;
5168 g_value_init (&paramv[n], TYPE_SENSOR_VALUE);
5169 g_value_set_object (&paramv[n++], skeleton);
5170 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
5171 g_value_set_object (&paramv[n++], invocation);
5172 if (info->pass_fdlist)
5173 {
5174#ifdef G_OS_UNIX
5175 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
5176 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
5177#else
5178 g_assert_not_reached ();
5179#endif
5180 }
5181 g_variant_iter_init (&iter, parameters);
5182 while ((child = g_variant_iter_next_value (&iter)) != NULL)
5183 {
5184 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
5185 if (arg_info->use_gvariant)
5186 {
5187 g_value_init (&paramv[n], G_TYPE_VARIANT);
5188 g_value_set_variant (&paramv[n], child);
5189 n++;
5190 }
5191 else
5192 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
5193 g_variant_unref (child);
5194 }
5195 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
5196 g_value_init (&return_value, G_TYPE_BOOLEAN);
5197 g_signal_emitv (paramv, signal_id, 0, &return_value);
5198 if (!g_value_get_boolean (&return_value))
5199 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);
5200 g_value_unset (&return_value);
5201 for (n = 0; n < num_params + num_extra; n++)
5202 g_value_unset (&paramv[n]);
5203 g_free (paramv);
5204}
5205
5206static GVariant *
5207_sensor_value_skeleton_handle_get_property (
5208 GDBusConnection *connection G_GNUC_UNUSED,
5209 const gchar *sender G_GNUC_UNUSED,
5210 const gchar *object_path G_GNUC_UNUSED,
5211 const gchar *interface_name G_GNUC_UNUSED,
5212 const gchar *property_name,
5213 GError **error,
5214 gpointer user_data)
5215{
5216 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5217 GValue value = G_VALUE_INIT;
5218 GParamSpec *pspec;
5219 _ExtendedGDBusPropertyInfo *info;
5220 GVariant *ret;
5221 ret = NULL;
5222 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
5223 g_assert (info != NULL);
5224 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5225 if (pspec == NULL)
5226 {
5227 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5228 }
5229 else
5230 {
5231 g_value_init (&value, pspec->value_type);
5232 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5233 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
5234 g_value_unset (&value);
5235 }
5236 return ret;
5237}
5238
5239static gboolean
5240_sensor_value_skeleton_handle_set_property (
5241 GDBusConnection *connection G_GNUC_UNUSED,
5242 const gchar *sender G_GNUC_UNUSED,
5243 const gchar *object_path G_GNUC_UNUSED,
5244 const gchar *interface_name G_GNUC_UNUSED,
5245 const gchar *property_name,
5246 GVariant *variant,
5247 GError **error,
5248 gpointer user_data)
5249{
5250 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5251 GValue value = G_VALUE_INIT;
5252 GParamSpec *pspec;
5253 _ExtendedGDBusPropertyInfo *info;
5254 gboolean ret;
5255 ret = FALSE;
5256 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
5257 g_assert (info != NULL);
5258 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5259 if (pspec == NULL)
5260 {
5261 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5262 }
5263 else
5264 {
5265 if (info->use_gvariant)
5266 g_value_set_variant (&value, variant);
5267 else
5268 g_dbus_gvariant_to_gvalue (variant, &value);
5269 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5270 g_value_unset (&value);
5271 ret = TRUE;
5272 }
5273 return ret;
5274}
5275
5276static const GDBusInterfaceVTable _sensor_value_skeleton_vtable =
5277{
5278 _sensor_value_skeleton_handle_method_call,
5279 _sensor_value_skeleton_handle_get_property,
5280 _sensor_value_skeleton_handle_set_property,
5281 {NULL}
5282};
5283
5284static GDBusInterfaceInfo *
5285sensor_value_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5286{
5287 return sensor_value_interface_info ();
5288}
5289
5290static GDBusInterfaceVTable *
5291sensor_value_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5292{
5293 return (GDBusInterfaceVTable *) &_sensor_value_skeleton_vtable;
5294}
5295
5296static GVariant *
5297sensor_value_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
5298{
5299 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
5300
5301 GVariantBuilder builder;
5302 guint n;
5303 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5304 if (_sensor_value_interface_info.parent_struct.properties == NULL)
5305 goto out;
5306 for (n = 0; _sensor_value_interface_info.parent_struct.properties[n] != NULL; n++)
5307 {
5308 GDBusPropertyInfo *info = _sensor_value_interface_info.parent_struct.properties[n];
5309 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
5310 {
5311 GVariant *value;
5312 value = _sensor_value_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.SensorValue", info->name, NULL, skeleton);
5313 if (value != NULL)
5314 {
5315 g_variant_take_ref (value);
5316 g_variant_builder_add (&builder, "{sv}", info->name, value);
5317 g_variant_unref (value);
5318 }
5319 }
5320 }
5321out:
5322 return g_variant_builder_end (&builder);
5323}
5324
5325static gboolean _sensor_value_emit_changed (gpointer user_data);
5326
5327static void
5328sensor_value_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
5329{
5330 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
5331 gboolean emit_changed = FALSE;
5332
5333 g_mutex_lock (&skeleton->priv->lock);
5334 if (skeleton->priv->changed_properties_idle_source != NULL)
5335 {
5336 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5337 skeleton->priv->changed_properties_idle_source = NULL;
5338 emit_changed = TRUE;
5339 }
5340 g_mutex_unlock (&skeleton->priv->lock);
5341
5342 if (emit_changed)
5343 _sensor_value_emit_changed (skeleton);
5344}
5345
5346static void
5347_sensor_value_on_signal_changed (
5348 SensorValue *object,
5349 GVariant *arg_value,
5350 const gchar *arg_units)
5351{
5352 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5353
5354 GList *connections, *l;
5355 GVariant *signal_variant;
5356 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5357
5358 signal_variant = g_variant_ref_sink (g_variant_new ("(@vs)",
5359 arg_value,
5360 arg_units));
5361 for (l = connections; l != NULL; l = l->next)
5362 {
5363 GDBusConnection *connection = l->data;
5364 g_dbus_connection_emit_signal (connection,
5365 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Changed",
5366 signal_variant, NULL);
5367 }
5368 g_variant_unref (signal_variant);
5369 g_list_free_full (connections, g_object_unref);
5370}
5371
5372static void
5373_sensor_value_on_signal_heartbeat (
5374 SensorValue *object,
5375 const gchar *arg_bus_name)
5376{
5377 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5378
5379 GList *connections, *l;
5380 GVariant *signal_variant;
5381 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5382
5383 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
5384 arg_bus_name));
5385 for (l = connections; l != NULL; l = l->next)
5386 {
5387 GDBusConnection *connection = l->data;
5388 g_dbus_connection_emit_signal (connection,
5389 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Heartbeat",
5390 signal_variant, NULL);
5391 }
5392 g_variant_unref (signal_variant);
5393 g_list_free_full (connections, g_object_unref);
5394}
5395
5396static void sensor_value_skeleton_iface_init (SensorValueIface *iface);
5397#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5398G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5399 G_ADD_PRIVATE (SensorValueSkeleton)
5400 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init));
5401
5402#else
5403G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5404 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init));
5405
5406#endif
5407static void
5408sensor_value_skeleton_finalize (GObject *object)
5409{
5410 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5411 guint n;
5412 for (n = 0; n < 7; n++)
5413 g_value_unset (&skeleton->priv->properties[n]);
5414 g_free (skeleton->priv->properties);
5415 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5416 if (skeleton->priv->changed_properties_idle_source != NULL)
5417 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5418 g_main_context_unref (skeleton->priv->context);
5419 g_mutex_clear (&skeleton->priv->lock);
5420 G_OBJECT_CLASS (sensor_value_skeleton_parent_class)->finalize (object);
5421}
5422
5423static void
5424sensor_value_skeleton_get_property (GObject *object,
5425 guint prop_id,
5426 GValue *value,
5427 GParamSpec *pspec G_GNUC_UNUSED)
5428{
5429 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5430 g_assert (prop_id != 0 && prop_id - 1 < 7);
5431 g_mutex_lock (&skeleton->priv->lock);
5432 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
5433 g_mutex_unlock (&skeleton->priv->lock);
5434}
5435
5436static gboolean
5437_sensor_value_emit_changed (gpointer user_data)
5438{
5439 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5440 GList *l;
5441 GVariantBuilder builder;
5442 GVariantBuilder invalidated_builder;
5443 guint num_changes;
5444
5445 g_mutex_lock (&skeleton->priv->lock);
5446 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5447 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
5448 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
5449 {
5450 ChangedProperty *cp = l->data;
5451 GVariant *variant;
5452 const GValue *cur_value;
5453
5454 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
5455 if (!_g_value_equal (cur_value, &cp->orig_value))
5456 {
5457 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
5458 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
5459 g_variant_unref (variant);
5460 num_changes++;
5461 }
5462 }
5463 if (num_changes > 0)
5464 {
5465 GList *connections, *ll;
5466 GVariant *signal_variant;
5467 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorValue",
5468 &builder, &invalidated_builder));
5469 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5470 for (ll = connections; ll != NULL; ll = ll->next)
5471 {
5472 GDBusConnection *connection = ll->data;
5473
5474 g_dbus_connection_emit_signal (connection,
5475 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
5476 "org.freedesktop.DBus.Properties",
5477 "PropertiesChanged",
5478 signal_variant,
5479 NULL);
5480 }
5481 g_variant_unref (signal_variant);
5482 g_list_free_full (connections, g_object_unref);
5483 }
5484 else
5485 {
5486 g_variant_builder_clear (&builder);
5487 g_variant_builder_clear (&invalidated_builder);
5488 }
5489 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5490 skeleton->priv->changed_properties = NULL;
5491 skeleton->priv->changed_properties_idle_source = NULL;
5492 g_mutex_unlock (&skeleton->priv->lock);
5493 return FALSE;
5494}
5495
5496static void
5497_sensor_value_schedule_emit_changed (SensorValueSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
5498{
5499 ChangedProperty *cp;
5500 GList *l;
5501 cp = NULL;
5502 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
5503 {
5504 ChangedProperty *i_cp = l->data;
5505 if (i_cp->info == info)
5506 {
5507 cp = i_cp;
5508 break;
5509 }
5510 }
5511 if (cp == NULL)
5512 {
5513 cp = g_new0 (ChangedProperty, 1);
5514 cp->prop_id = prop_id;
5515 cp->info = info;
5516 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
5517 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
5518 g_value_copy (orig_value, &cp->orig_value);
5519 }
5520}
5521
5522static void
5523sensor_value_skeleton_notify (GObject *object,
5524 GParamSpec *pspec G_GNUC_UNUSED)
5525{
5526 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5527 g_mutex_lock (&skeleton->priv->lock);
5528 if (skeleton->priv->changed_properties != NULL &&
5529 skeleton->priv->changed_properties_idle_source == NULL)
5530 {
5531 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
5532 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
5533 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_value_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
5534 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
5535 g_source_unref (skeleton->priv->changed_properties_idle_source);
5536 }
5537 g_mutex_unlock (&skeleton->priv->lock);
5538}
5539
5540static void
5541sensor_value_skeleton_set_property (GObject *object,
5542 guint prop_id,
5543 const GValue *value,
5544 GParamSpec *pspec)
5545{
5546 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5547 g_assert (prop_id != 0 && prop_id - 1 < 7);
5548 g_mutex_lock (&skeleton->priv->lock);
5549 g_object_freeze_notify (object);
5550 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
5551 {
5552 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
5553 _sensor_value_schedule_emit_changed (skeleton, _sensor_value_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
5554 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
5555 g_object_notify_by_pspec (object, pspec);
5556 }
5557 g_mutex_unlock (&skeleton->priv->lock);
5558 g_object_thaw_notify (object);
5559}
5560
5561static void
5562sensor_value_skeleton_init (SensorValueSkeleton *skeleton)
5563{
5564#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5565 skeleton->priv = sensor_value_skeleton_get_instance_private (skeleton);
5566#else
5567 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_VALUE_SKELETON, SensorValueSkeletonPrivate);
5568#endif
5569
5570 g_mutex_init (&skeleton->priv->lock);
5571 skeleton->priv->context = g_main_context_ref_thread_default ();
5572 skeleton->priv->properties = g_new0 (GValue, 7);
5573 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
5574 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
5575 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
5576 g_value_init (&skeleton->priv->properties[3], G_TYPE_INT);
5577 g_value_init (&skeleton->priv->properties[4], G_TYPE_BOOLEAN);
5578 g_value_init (&skeleton->priv->properties[5], G_TYPE_UCHAR);
5579 g_value_init (&skeleton->priv->properties[6], G_TYPE_UCHAR);
5580}
5581
5582static GVariant *
5583sensor_value_skeleton_get_value (SensorValue *object)
5584{
5585 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5586 GVariant *value;
5587 g_mutex_lock (&skeleton->priv->lock);
5588 value = g_value_get_variant (&(skeleton->priv->properties[0]));
5589 g_mutex_unlock (&skeleton->priv->lock);
5590 return value;
5591}
5592
5593static const gchar *
5594sensor_value_skeleton_get_units (SensorValue *object)
5595{
5596 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5597 const gchar *value;
5598 g_mutex_lock (&skeleton->priv->lock);
5599 value = g_value_get_string (&(skeleton->priv->properties[1]));
5600 g_mutex_unlock (&skeleton->priv->lock);
5601 return value;
5602}
5603
5604static gint
5605sensor_value_skeleton_get_poll_interval (SensorValue *object)
5606{
5607 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5608 gint value;
5609 g_mutex_lock (&skeleton->priv->lock);
5610 value = g_value_get_int (&(skeleton->priv->properties[2]));
5611 g_mutex_unlock (&skeleton->priv->lock);
5612 return value;
5613}
5614
5615static gint
5616sensor_value_skeleton_get_heatbeat (SensorValue *object)
5617{
5618 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5619 gint value;
5620 g_mutex_lock (&skeleton->priv->lock);
5621 value = g_value_get_int (&(skeleton->priv->properties[3]));
5622 g_mutex_unlock (&skeleton->priv->lock);
5623 return value;
5624}
5625
5626static gboolean
5627sensor_value_skeleton_get_settable (SensorValue *object)
5628{
5629 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5630 gboolean value;
5631 g_mutex_lock (&skeleton->priv->lock);
5632 value = g_value_get_boolean (&(skeleton->priv->properties[4]));
5633 g_mutex_unlock (&skeleton->priv->lock);
5634 return value;
5635}
5636
5637static guchar
5638sensor_value_skeleton_get_ipmi_entity_id (SensorValue *object)
5639{
5640 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5641 guchar value;
5642 g_mutex_lock (&skeleton->priv->lock);
5643 value = g_value_get_uchar (&(skeleton->priv->properties[5]));
5644 g_mutex_unlock (&skeleton->priv->lock);
5645 return value;
5646}
5647
5648static guchar
5649sensor_value_skeleton_get_ipmi_id (SensorValue *object)
5650{
5651 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5652 guchar value;
5653 g_mutex_lock (&skeleton->priv->lock);
5654 value = g_value_get_uchar (&(skeleton->priv->properties[6]));
5655 g_mutex_unlock (&skeleton->priv->lock);
5656 return value;
5657}
5658
5659static void
5660sensor_value_skeleton_class_init (SensorValueSkeletonClass *klass)
5661{
5662 GObjectClass *gobject_class;
5663 GDBusInterfaceSkeletonClass *skeleton_class;
5664
5665 gobject_class = G_OBJECT_CLASS (klass);
5666 gobject_class->finalize = sensor_value_skeleton_finalize;
5667 gobject_class->get_property = sensor_value_skeleton_get_property;
5668 gobject_class->set_property = sensor_value_skeleton_set_property;
5669 gobject_class->notify = sensor_value_skeleton_notify;
5670
5671
5672 sensor_value_override_properties (gobject_class, 1);
5673
5674 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
5675 skeleton_class->get_info = sensor_value_skeleton_dbus_interface_get_info;
5676 skeleton_class->get_properties = sensor_value_skeleton_dbus_interface_get_properties;
5677 skeleton_class->flush = sensor_value_skeleton_dbus_interface_flush;
5678 skeleton_class->get_vtable = sensor_value_skeleton_dbus_interface_get_vtable;
5679
5680#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
5681 g_type_class_add_private (klass, sizeof (SensorValueSkeletonPrivate));
5682#endif
5683}
5684
5685static void
5686sensor_value_skeleton_iface_init (SensorValueIface *iface)
5687{
5688 iface->changed = _sensor_value_on_signal_changed;
5689 iface->heartbeat = _sensor_value_on_signal_heartbeat;
5690 iface->get_value = sensor_value_skeleton_get_value;
5691 iface->get_units = sensor_value_skeleton_get_units;
5692 iface->get_poll_interval = sensor_value_skeleton_get_poll_interval;
5693 iface->get_heatbeat = sensor_value_skeleton_get_heatbeat;
5694 iface->get_settable = sensor_value_skeleton_get_settable;
5695 iface->get_ipmi_entity_id = sensor_value_skeleton_get_ipmi_entity_id;
5696 iface->get_ipmi_id = sensor_value_skeleton_get_ipmi_id;
5697}
5698
5699/**
5700 * sensor_value_skeleton_new:
5701 *
5702 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
5703 *
5704 * Returns: (transfer full) (type SensorValueSkeleton): The skeleton object.
5705 */
5706SensorValue *
5707sensor_value_skeleton_new (void)
5708{
5709 return SENSOR_VALUE (g_object_new (TYPE_SENSOR_VALUE_SKELETON, NULL));
5710}
5711
5712/* ------------------------------------------------------------------------
5713 * Code for interface org.openbmc.SensorThreshold
5714 * ------------------------------------------------------------------------
5715 */
5716
5717/**
5718 * SECTION:SensorThreshold
5719 * @title: SensorThreshold
5720 * @short_description: Generated C code for the org.openbmc.SensorThreshold D-Bus interface
5721 *
5722 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> D-Bus interface in C.
5723 */
5724
5725/* ---- Introspection data for org.openbmc.SensorThreshold ---- */
5726
5727static const _ExtendedGDBusArgInfo _sensor_threshold_method_info_get_state_OUT_ARG_state =
5728{
5729 {
5730 -1,
5731 (gchar *) "state",
5732 (gchar *) "y",
5733 NULL
5734 },
5735 FALSE
5736};
5737
5738static const _ExtendedGDBusArgInfo * const _sensor_threshold_method_info_get_state_OUT_ARG_pointers[] =
5739{
5740 &_sensor_threshold_method_info_get_state_OUT_ARG_state,
5741 NULL
5742};
5743
5744static const _ExtendedGDBusMethodInfo _sensor_threshold_method_info_get_state =
5745{
5746 {
5747 -1,
5748 (gchar *) "getState",
5749 NULL,
5750 (GDBusArgInfo **) &_sensor_threshold_method_info_get_state_OUT_ARG_pointers,
5751 NULL
5752 },
5753 "handle-get-state",
5754 FALSE
5755};
5756
5757static const _ExtendedGDBusMethodInfo * const _sensor_threshold_method_info_pointers[] =
5758{
5759 &_sensor_threshold_method_info_get_state,
5760 NULL
5761};
5762
5763static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_warning =
5764{
5765 {
5766 -1,
5767 (gchar *) "Warning",
5768 NULL,
5769 NULL
5770 },
5771 "warning"
5772};
5773
5774static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_critical =
5775{
5776 {
5777 -1,
5778 (gchar *) "Critical",
5779 NULL,
5780 NULL
5781 },
5782 "critical"
5783};
5784
5785static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_normal =
5786{
5787 {
5788 -1,
5789 (gchar *) "Normal",
5790 NULL,
5791 NULL
5792 },
5793 "normal"
5794};
5795
5796static const _ExtendedGDBusSignalInfo * const _sensor_threshold_signal_info_pointers[] =
5797{
5798 &_sensor_threshold_signal_info_warning,
5799 &_sensor_threshold_signal_info_critical,
5800 &_sensor_threshold_signal_info_normal,
5801 NULL
5802};
5803
5804static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_critical =
5805{
5806 {
5807 -1,
5808 (gchar *) "lower_critical",
5809 (gchar *) "v",
5810 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5811 NULL
5812 },
5813 "lower-critical",
5814 FALSE
5815};
5816
5817static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_warning =
5818{
5819 {
5820 -1,
5821 (gchar *) "lower_warning",
5822 (gchar *) "v",
5823 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5824 NULL
5825 },
5826 "lower-warning",
5827 FALSE
5828};
5829
5830static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_warning =
5831{
5832 {
5833 -1,
5834 (gchar *) "upper_warning",
5835 (gchar *) "v",
5836 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5837 NULL
5838 },
5839 "upper-warning",
5840 FALSE
5841};
5842
5843static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_critical =
5844{
5845 {
5846 -1,
5847 (gchar *) "upper_critical",
5848 (gchar *) "v",
5849 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5850 NULL
5851 },
5852 "upper-critical",
5853 FALSE
5854};
5855
5856static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_state =
5857{
5858 {
5859 -1,
5860 (gchar *) "state",
5861 (gchar *) "y",
5862 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
5863 NULL
5864 },
5865 "state",
5866 FALSE
5867};
5868
5869static const _ExtendedGDBusPropertyInfo * const _sensor_threshold_property_info_pointers[] =
5870{
5871 &_sensor_threshold_property_info_lower_critical,
5872 &_sensor_threshold_property_info_lower_warning,
5873 &_sensor_threshold_property_info_upper_warning,
5874 &_sensor_threshold_property_info_upper_critical,
5875 &_sensor_threshold_property_info_state,
5876 NULL
5877};
5878
5879static const _ExtendedGDBusInterfaceInfo _sensor_threshold_interface_info =
5880{
5881 {
5882 -1,
5883 (gchar *) "org.openbmc.SensorThreshold",
5884 (GDBusMethodInfo **) &_sensor_threshold_method_info_pointers,
5885 (GDBusSignalInfo **) &_sensor_threshold_signal_info_pointers,
5886 (GDBusPropertyInfo **) &_sensor_threshold_property_info_pointers,
5887 NULL
5888 },
5889 "sensor-threshold",
5890};
5891
5892
5893/**
5894 * sensor_threshold_interface_info:
5895 *
5896 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> D-Bus interface.
5897 *
5898 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
5899 */
5900GDBusInterfaceInfo *
5901sensor_threshold_interface_info (void)
5902{
5903 return (GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct;
5904}
5905
5906/**
5907 * sensor_threshold_override_properties:
5908 * @klass: The class structure for a #GObject<!-- -->-derived class.
5909 * @property_id_begin: The property id to assign to the first overridden property.
5910 *
5911 * Overrides all #GObject properties in the #SensorThreshold interface for a concrete class.
5912 * The properties are overridden in the order they are defined.
5913 *
5914 * Returns: The last property id.
5915 */
5916guint
5917sensor_threshold_override_properties (GObjectClass *klass, guint property_id_begin)
5918{
5919 g_object_class_override_property (klass, property_id_begin++, "lower-critical");
5920 g_object_class_override_property (klass, property_id_begin++, "lower-warning");
5921 g_object_class_override_property (klass, property_id_begin++, "upper-warning");
5922 g_object_class_override_property (klass, property_id_begin++, "upper-critical");
5923 g_object_class_override_property (klass, property_id_begin++, "state");
5924 return property_id_begin - 1;
5925}
5926
5927
5928
5929/**
5930 * SensorThreshold:
5931 *
5932 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
5933 */
5934
5935/**
5936 * SensorThresholdIface:
5937 * @parent_iface: The parent interface.
5938 * @handle_get_state: Handler for the #SensorThreshold::handle-get-state signal.
5939 * @get_lower_critical: Getter for the #SensorThreshold:lower-critical property.
5940 * @get_lower_warning: Getter for the #SensorThreshold:lower-warning property.
5941 * @get_state: Getter for the #SensorThreshold:state property.
5942 * @get_upper_critical: Getter for the #SensorThreshold:upper-critical property.
5943 * @get_upper_warning: Getter for the #SensorThreshold:upper-warning property.
5944 * @critical: Handler for the #SensorThreshold::critical signal.
5945 * @normal: Handler for the #SensorThreshold::normal signal.
5946 * @warning: Handler for the #SensorThreshold::warning signal.
5947 *
5948 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
5949 */
5950
5951typedef SensorThresholdIface SensorThresholdInterface;
5952G_DEFINE_INTERFACE (SensorThreshold, sensor_threshold, G_TYPE_OBJECT);
5953
5954static void
5955sensor_threshold_default_init (SensorThresholdIface *iface)
5956{
5957 /* GObject signals for incoming D-Bus method calls: */
5958 /**
5959 * SensorThreshold::handle-get-state:
5960 * @object: A #SensorThreshold.
5961 * @invocation: A #GDBusMethodInvocation.
5962 *
5963 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method.
5964 *
5965 * 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 sensor_threshold_complete_get_state() 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.
5966 *
5967 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
5968 */
5969 g_signal_new ("handle-get-state",
5970 G_TYPE_FROM_INTERFACE (iface),
5971 G_SIGNAL_RUN_LAST,
5972 G_STRUCT_OFFSET (SensorThresholdIface, handle_get_state),
5973 g_signal_accumulator_true_handled,
5974 NULL,
5975 g_cclosure_marshal_generic,
5976 G_TYPE_BOOLEAN,
5977 1,
5978 G_TYPE_DBUS_METHOD_INVOCATION);
5979
5980 /* GObject signals for received D-Bus signals: */
5981 /**
5982 * SensorThreshold::warning:
5983 * @object: A #SensorThreshold.
5984 *
5985 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Warning">"Warning"</link> is received.
5986 *
5987 * 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.
5988 */
5989 g_signal_new ("warning",
5990 G_TYPE_FROM_INTERFACE (iface),
5991 G_SIGNAL_RUN_LAST,
5992 G_STRUCT_OFFSET (SensorThresholdIface, warning),
5993 NULL,
5994 NULL,
5995 g_cclosure_marshal_generic,
5996 G_TYPE_NONE,
5997 0);
5998
5999 /**
6000 * SensorThreshold::critical:
6001 * @object: A #SensorThreshold.
6002 *
6003 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Critical">"Critical"</link> is received.
6004 *
6005 * 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.
6006 */
6007 g_signal_new ("critical",
6008 G_TYPE_FROM_INTERFACE (iface),
6009 G_SIGNAL_RUN_LAST,
6010 G_STRUCT_OFFSET (SensorThresholdIface, critical),
6011 NULL,
6012 NULL,
6013 g_cclosure_marshal_generic,
6014 G_TYPE_NONE,
6015 0);
6016
6017 /**
6018 * SensorThreshold::normal:
6019 * @object: A #SensorThreshold.
6020 *
6021 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Normal">"Normal"</link> is received.
6022 *
6023 * 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.
6024 */
6025 g_signal_new ("normal",
6026 G_TYPE_FROM_INTERFACE (iface),
6027 G_SIGNAL_RUN_LAST,
6028 G_STRUCT_OFFSET (SensorThresholdIface, normal),
6029 NULL,
6030 NULL,
6031 g_cclosure_marshal_generic,
6032 G_TYPE_NONE,
6033 0);
6034
6035 /* GObject properties for D-Bus properties: */
6036 /**
6037 * SensorThreshold:lower-critical:
6038 *
6039 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link>.
6040 *
6041 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
6042 */
6043 g_object_interface_install_property (iface,
6044 g_param_spec_variant ("lower-critical", "lower_critical", "lower_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6045 /**
6046 * SensorThreshold:lower-warning:
6047 *
6048 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link>.
6049 *
6050 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
6051 */
6052 g_object_interface_install_property (iface,
6053 g_param_spec_variant ("lower-warning", "lower_warning", "lower_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6054 /**
6055 * SensorThreshold:upper-warning:
6056 *
6057 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link>.
6058 *
6059 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
6060 */
6061 g_object_interface_install_property (iface,
6062 g_param_spec_variant ("upper-warning", "upper_warning", "upper_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6063 /**
6064 * SensorThreshold:upper-critical:
6065 *
6066 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link>.
6067 *
6068 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
6069 */
6070 g_object_interface_install_property (iface,
6071 g_param_spec_variant ("upper-critical", "upper_critical", "upper_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6072 /**
6073 * SensorThreshold:state:
6074 *
6075 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link>.
6076 *
6077 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
6078 */
6079 g_object_interface_install_property (iface,
6080 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6081}
6082
6083/**
6084 * sensor_threshold_get_lower_critical: (skip)
6085 * @object: A #SensorThreshold.
6086 *
6087 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property.
6088 *
6089 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6090 *
6091 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_threshold_dup_lower_critical() if on another thread.</warning>
6092 *
6093 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6094 */
6095GVariant *
6096sensor_threshold_get_lower_critical (SensorThreshold *object)
6097{
6098 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_critical (object);
6099}
6100
6101/**
6102 * sensor_threshold_dup_lower_critical: (skip)
6103 * @object: A #SensorThreshold.
6104 *
6105 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property.
6106 *
6107 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6108 *
6109 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6110 */
6111GVariant *
6112sensor_threshold_dup_lower_critical (SensorThreshold *object)
6113{
6114 GVariant *value;
6115 g_object_get (G_OBJECT (object), "lower-critical", &value, NULL);
6116 return value;
6117}
6118
6119/**
6120 * sensor_threshold_set_lower_critical: (skip)
6121 * @object: A #SensorThreshold.
6122 * @value: The value to set.
6123 *
6124 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property to @value.
6125 *
6126 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6127 */
6128void
6129sensor_threshold_set_lower_critical (SensorThreshold *object, GVariant *value)
6130{
6131 g_object_set (G_OBJECT (object), "lower-critical", value, NULL);
6132}
6133
6134/**
6135 * sensor_threshold_get_lower_warning: (skip)
6136 * @object: A #SensorThreshold.
6137 *
6138 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property.
6139 *
6140 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6141 *
6142 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_threshold_dup_lower_warning() if on another thread.</warning>
6143 *
6144 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6145 */
6146GVariant *
6147sensor_threshold_get_lower_warning (SensorThreshold *object)
6148{
6149 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_warning (object);
6150}
6151
6152/**
6153 * sensor_threshold_dup_lower_warning: (skip)
6154 * @object: A #SensorThreshold.
6155 *
6156 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property.
6157 *
6158 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6159 *
6160 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6161 */
6162GVariant *
6163sensor_threshold_dup_lower_warning (SensorThreshold *object)
6164{
6165 GVariant *value;
6166 g_object_get (G_OBJECT (object), "lower-warning", &value, NULL);
6167 return value;
6168}
6169
6170/**
6171 * sensor_threshold_set_lower_warning: (skip)
6172 * @object: A #SensorThreshold.
6173 * @value: The value to set.
6174 *
6175 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property to @value.
6176 *
6177 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6178 */
6179void
6180sensor_threshold_set_lower_warning (SensorThreshold *object, GVariant *value)
6181{
6182 g_object_set (G_OBJECT (object), "lower-warning", value, NULL);
6183}
6184
6185/**
6186 * sensor_threshold_get_upper_warning: (skip)
6187 * @object: A #SensorThreshold.
6188 *
6189 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property.
6190 *
6191 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6192 *
6193 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_threshold_dup_upper_warning() if on another thread.</warning>
6194 *
6195 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6196 */
6197GVariant *
6198sensor_threshold_get_upper_warning (SensorThreshold *object)
6199{
6200 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_warning (object);
6201}
6202
6203/**
6204 * sensor_threshold_dup_upper_warning: (skip)
6205 * @object: A #SensorThreshold.
6206 *
6207 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property.
6208 *
6209 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6210 *
6211 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6212 */
6213GVariant *
6214sensor_threshold_dup_upper_warning (SensorThreshold *object)
6215{
6216 GVariant *value;
6217 g_object_get (G_OBJECT (object), "upper-warning", &value, NULL);
6218 return value;
6219}
6220
6221/**
6222 * sensor_threshold_set_upper_warning: (skip)
6223 * @object: A #SensorThreshold.
6224 * @value: The value to set.
6225 *
6226 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property to @value.
6227 *
6228 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6229 */
6230void
6231sensor_threshold_set_upper_warning (SensorThreshold *object, GVariant *value)
6232{
6233 g_object_set (G_OBJECT (object), "upper-warning", value, NULL);
6234}
6235
6236/**
6237 * sensor_threshold_get_upper_critical: (skip)
6238 * @object: A #SensorThreshold.
6239 *
6240 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property.
6241 *
6242 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6243 *
6244 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_threshold_dup_upper_critical() if on another thread.</warning>
6245 *
6246 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6247 */
6248GVariant *
6249sensor_threshold_get_upper_critical (SensorThreshold *object)
6250{
6251 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_critical (object);
6252}
6253
6254/**
6255 * sensor_threshold_dup_upper_critical: (skip)
6256 * @object: A #SensorThreshold.
6257 *
6258 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property.
6259 *
6260 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6261 *
6262 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6263 */
6264GVariant *
6265sensor_threshold_dup_upper_critical (SensorThreshold *object)
6266{
6267 GVariant *value;
6268 g_object_get (G_OBJECT (object), "upper-critical", &value, NULL);
6269 return value;
6270}
6271
6272/**
6273 * sensor_threshold_set_upper_critical: (skip)
6274 * @object: A #SensorThreshold.
6275 * @value: The value to set.
6276 *
6277 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property to @value.
6278 *
6279 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6280 */
6281void
6282sensor_threshold_set_upper_critical (SensorThreshold *object, GVariant *value)
6283{
6284 g_object_set (G_OBJECT (object), "upper-critical", value, NULL);
6285}
6286
6287/**
6288 * sensor_threshold_get_state: (skip)
6289 * @object: A #SensorThreshold.
6290 *
6291 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property.
6292 *
6293 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
6294 *
6295 * Returns: The property value.
6296 */
6297guchar
6298sensor_threshold_get_state (SensorThreshold *object)
6299{
6300 return SENSOR_THRESHOLD_GET_IFACE (object)->get_state (object);
6301}
6302
6303/**
6304 * sensor_threshold_set_state: (skip)
6305 * @object: A #SensorThreshold.
6306 * @value: The value to set.
6307 *
6308 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property to @value.
6309 *
6310 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
6311 */
6312void
6313sensor_threshold_set_state (SensorThreshold *object, guchar value)
6314{
6315 g_object_set (G_OBJECT (object), "state", value, NULL);
6316}
6317
6318/**
6319 * sensor_threshold_emit_warning:
6320 * @object: A #SensorThreshold.
6321 *
6322 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Warning">"Warning"</link> D-Bus signal.
6323 */
6324void
6325sensor_threshold_emit_warning (
6326 SensorThreshold *object)
6327{
6328 g_signal_emit_by_name (object, "warning");
6329}
6330
6331/**
6332 * sensor_threshold_emit_critical:
6333 * @object: A #SensorThreshold.
6334 *
6335 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Critical">"Critical"</link> D-Bus signal.
6336 */
6337void
6338sensor_threshold_emit_critical (
6339 SensorThreshold *object)
6340{
6341 g_signal_emit_by_name (object, "critical");
6342}
6343
6344/**
6345 * sensor_threshold_emit_normal:
6346 * @object: A #SensorThreshold.
6347 *
6348 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Normal">"Normal"</link> D-Bus signal.
6349 */
6350void
6351sensor_threshold_emit_normal (
6352 SensorThreshold *object)
6353{
6354 g_signal_emit_by_name (object, "normal");
6355}
6356
6357/**
6358 * sensor_threshold_call_get_state:
6359 * @proxy: A #SensorThresholdProxy.
6360 * @cancellable: (allow-none): A #GCancellable or %NULL.
6361 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
6362 * @user_data: User data to pass to @callback.
6363 *
6364 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method on @proxy.
6365 * 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.
6366 * You can then call sensor_threshold_call_get_state_finish() to get the result of the operation.
6367 *
6368 * See sensor_threshold_call_get_state_sync() for the synchronous, blocking version of this method.
6369 */
6370void
6371sensor_threshold_call_get_state (
6372 SensorThreshold *proxy,
6373 GCancellable *cancellable,
6374 GAsyncReadyCallback callback,
6375 gpointer user_data)
6376{
6377 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
6378 "getState",
6379 g_variant_new ("()"),
6380 G_DBUS_CALL_FLAGS_NONE,
6381 -1,
6382 cancellable,
6383 callback,
6384 user_data);
6385}
6386
6387/**
6388 * sensor_threshold_call_get_state_finish:
6389 * @proxy: A #SensorThresholdProxy.
6390 * @out_state: (out): Return location for return parameter or %NULL to ignore.
6391 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_call_get_state().
6392 * @error: Return location for error or %NULL.
6393 *
6394 * Finishes an operation started with sensor_threshold_call_get_state().
6395 *
6396 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
6397 */
6398gboolean
6399sensor_threshold_call_get_state_finish (
6400 SensorThreshold *proxy,
6401 guchar *out_state,
6402 GAsyncResult *res,
6403 GError **error)
6404{
6405 GVariant *_ret;
6406 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
6407 if (_ret == NULL)
6408 goto _out;
6409 g_variant_get (_ret,
6410 "(y)",
6411 out_state);
6412 g_variant_unref (_ret);
6413_out:
6414 return _ret != NULL;
6415}
6416
6417/**
6418 * sensor_threshold_call_get_state_sync:
6419 * @proxy: A #SensorThresholdProxy.
6420 * @out_state: (out): Return location for return parameter or %NULL to ignore.
6421 * @cancellable: (allow-none): A #GCancellable or %NULL.
6422 * @error: Return location for error or %NULL.
6423 *
6424 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
6425 *
6426 * See sensor_threshold_call_get_state() for the asynchronous version of this method.
6427 *
6428 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
6429 */
6430gboolean
6431sensor_threshold_call_get_state_sync (
6432 SensorThreshold *proxy,
6433 guchar *out_state,
6434 GCancellable *cancellable,
6435 GError **error)
6436{
6437 GVariant *_ret;
6438 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
6439 "getState",
6440 g_variant_new ("()"),
6441 G_DBUS_CALL_FLAGS_NONE,
6442 -1,
6443 cancellable,
6444 error);
6445 if (_ret == NULL)
6446 goto _out;
6447 g_variant_get (_ret,
6448 "(y)",
6449 out_state);
6450 g_variant_unref (_ret);
6451_out:
6452 return _ret != NULL;
6453}
6454
6455/**
6456 * sensor_threshold_complete_get_state:
6457 * @object: A #SensorThreshold.
6458 * @invocation: (transfer full): A #GDBusMethodInvocation.
6459 * @state: Parameter to return.
6460 *
6461 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</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.
6462 *
6463 * This method will free @invocation, you cannot use it afterwards.
6464 */
6465void
6466sensor_threshold_complete_get_state (
6467 SensorThreshold *object,
6468 GDBusMethodInvocation *invocation,
6469 guchar state)
6470{
6471 g_dbus_method_invocation_return_value (invocation,
6472 g_variant_new ("(y)",
6473 state));
6474}
6475
6476/* ------------------------------------------------------------------------ */
6477
6478/**
6479 * SensorThresholdProxy:
6480 *
6481 * The #SensorThresholdProxy structure contains only private data and should only be accessed using the provided API.
6482 */
6483
6484/**
6485 * SensorThresholdProxyClass:
6486 * @parent_class: The parent class.
6487 *
6488 * Class structure for #SensorThresholdProxy.
6489 */
6490
6491struct _SensorThresholdProxyPrivate
6492{
6493 GData *qdata;
6494};
6495
6496static void sensor_threshold_proxy_iface_init (SensorThresholdIface *iface);
6497
6498#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6499G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
6500 G_ADD_PRIVATE (SensorThresholdProxy)
6501 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init));
6502
6503#else
6504G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
6505 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init));
6506
6507#endif
6508static void
6509sensor_threshold_proxy_finalize (GObject *object)
6510{
6511 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6512 g_datalist_clear (&proxy->priv->qdata);
6513 G_OBJECT_CLASS (sensor_threshold_proxy_parent_class)->finalize (object);
6514}
6515
6516static void
6517sensor_threshold_proxy_get_property (GObject *object,
6518 guint prop_id,
6519 GValue *value,
6520 GParamSpec *pspec G_GNUC_UNUSED)
6521{
6522 const _ExtendedGDBusPropertyInfo *info;
6523 GVariant *variant;
6524 g_assert (prop_id != 0 && prop_id - 1 < 5);
6525 info = _sensor_threshold_property_info_pointers[prop_id - 1];
6526 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
6527 if (info->use_gvariant)
6528 {
6529 g_value_set_variant (value, variant);
6530 }
6531 else
6532 {
6533 if (variant != NULL)
6534 g_dbus_gvariant_to_gvalue (variant, value);
6535 }
6536 if (variant != NULL)
6537 g_variant_unref (variant);
6538}
6539
6540static void
6541sensor_threshold_proxy_set_property_cb (GDBusProxy *proxy,
6542 GAsyncResult *res,
6543 gpointer user_data)
6544{
6545 const _ExtendedGDBusPropertyInfo *info = user_data;
6546 GError *error;
6547 GVariant *_ret;
6548 error = NULL;
6549 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
6550 if (!_ret)
6551 {
6552 g_warning ("Error setting property '%s' on interface org.openbmc.SensorThreshold: %s (%s, %d)",
6553 info->parent_struct.name,
6554 error->message, g_quark_to_string (error->domain), error->code);
6555 g_error_free (error);
6556 }
6557 else
6558 {
6559 g_variant_unref (_ret);
6560 }
6561}
6562
6563static void
6564sensor_threshold_proxy_set_property (GObject *object,
6565 guint prop_id,
6566 const GValue *value,
6567 GParamSpec *pspec G_GNUC_UNUSED)
6568{
6569 const _ExtendedGDBusPropertyInfo *info;
6570 GVariant *variant;
6571 g_assert (prop_id != 0 && prop_id - 1 < 5);
6572 info = _sensor_threshold_property_info_pointers[prop_id - 1];
6573 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
6574 g_dbus_proxy_call (G_DBUS_PROXY (object),
6575 "org.freedesktop.DBus.Properties.Set",
6576 g_variant_new ("(ssv)", "org.openbmc.SensorThreshold", info->parent_struct.name, variant),
6577 G_DBUS_CALL_FLAGS_NONE,
6578 -1,
6579 NULL, (GAsyncReadyCallback) sensor_threshold_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
6580 g_variant_unref (variant);
6581}
6582
6583static void
6584sensor_threshold_proxy_g_signal (GDBusProxy *proxy,
6585 const gchar *sender_name G_GNUC_UNUSED,
6586 const gchar *signal_name,
6587 GVariant *parameters)
6588{
6589 _ExtendedGDBusSignalInfo *info;
6590 GVariantIter iter;
6591 GVariant *child;
6592 GValue *paramv;
6593 guint num_params;
6594 guint n;
6595 guint signal_id;
6596 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, signal_name);
6597 if (info == NULL)
6598 return;
6599 num_params = g_variant_n_children (parameters);
6600 paramv = g_new0 (GValue, num_params + 1);
6601 g_value_init (&paramv[0], TYPE_SENSOR_THRESHOLD);
6602 g_value_set_object (&paramv[0], proxy);
6603 g_variant_iter_init (&iter, parameters);
6604 n = 1;
6605 while ((child = g_variant_iter_next_value (&iter)) != NULL)
6606 {
6607 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
6608 if (arg_info->use_gvariant)
6609 {
6610 g_value_init (&paramv[n], G_TYPE_VARIANT);
6611 g_value_set_variant (&paramv[n], child);
6612 n++;
6613 }
6614 else
6615 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
6616 g_variant_unref (child);
6617 }
6618 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
6619 g_signal_emitv (paramv, signal_id, 0, NULL);
6620 for (n = 0; n < num_params + 1; n++)
6621 g_value_unset (&paramv[n]);
6622 g_free (paramv);
6623}
6624
6625static void
6626sensor_threshold_proxy_g_properties_changed (GDBusProxy *_proxy,
6627 GVariant *changed_properties,
6628 const gchar *const *invalidated_properties)
6629{
6630 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (_proxy);
6631 guint n;
6632 const gchar *key;
6633 GVariantIter *iter;
6634 _ExtendedGDBusPropertyInfo *info;
6635 g_variant_get (changed_properties, "a{sv}", &iter);
6636 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
6637 {
6638 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, key);
6639 g_datalist_remove_data (&proxy->priv->qdata, key);
6640 if (info != NULL)
6641 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
6642 }
6643 g_variant_iter_free (iter);
6644 for (n = 0; invalidated_properties[n] != NULL; n++)
6645 {
6646 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, invalidated_properties[n]);
6647 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
6648 if (info != NULL)
6649 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
6650 }
6651}
6652
6653static GVariant *
6654sensor_threshold_proxy_get_lower_critical (SensorThreshold *object)
6655{
6656 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6657 GVariant *variant;
6658 GVariant *value = NULL;
6659 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_critical");
6660 value = variant;
6661 if (variant != NULL)
6662 g_variant_unref (variant);
6663 return value;
6664}
6665
6666static GVariant *
6667sensor_threshold_proxy_get_lower_warning (SensorThreshold *object)
6668{
6669 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6670 GVariant *variant;
6671 GVariant *value = NULL;
6672 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_warning");
6673 value = variant;
6674 if (variant != NULL)
6675 g_variant_unref (variant);
6676 return value;
6677}
6678
6679static GVariant *
6680sensor_threshold_proxy_get_upper_warning (SensorThreshold *object)
6681{
6682 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6683 GVariant *variant;
6684 GVariant *value = NULL;
6685 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_warning");
6686 value = variant;
6687 if (variant != NULL)
6688 g_variant_unref (variant);
6689 return value;
6690}
6691
6692static GVariant *
6693sensor_threshold_proxy_get_upper_critical (SensorThreshold *object)
6694{
6695 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6696 GVariant *variant;
6697 GVariant *value = NULL;
6698 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_critical");
6699 value = variant;
6700 if (variant != NULL)
6701 g_variant_unref (variant);
6702 return value;
6703}
6704
6705static guchar
6706sensor_threshold_proxy_get_state (SensorThreshold *object)
6707{
6708 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6709 GVariant *variant;
6710 guchar value = 0;
6711 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
6712 if (variant != NULL)
6713 {
6714 value = g_variant_get_byte (variant);
6715 g_variant_unref (variant);
6716 }
6717 return value;
6718}
6719
6720static void
6721sensor_threshold_proxy_init (SensorThresholdProxy *proxy)
6722{
6723#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6724 proxy->priv = sensor_threshold_proxy_get_instance_private (proxy);
6725#else
6726 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_THRESHOLD_PROXY, SensorThresholdProxyPrivate);
6727#endif
6728
6729 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_threshold_interface_info ());
6730}
6731
6732static void
6733sensor_threshold_proxy_class_init (SensorThresholdProxyClass *klass)
6734{
6735 GObjectClass *gobject_class;
6736 GDBusProxyClass *proxy_class;
6737
6738 gobject_class = G_OBJECT_CLASS (klass);
6739 gobject_class->finalize = sensor_threshold_proxy_finalize;
6740 gobject_class->get_property = sensor_threshold_proxy_get_property;
6741 gobject_class->set_property = sensor_threshold_proxy_set_property;
6742
6743 proxy_class = G_DBUS_PROXY_CLASS (klass);
6744 proxy_class->g_signal = sensor_threshold_proxy_g_signal;
6745 proxy_class->g_properties_changed = sensor_threshold_proxy_g_properties_changed;
6746
6747 sensor_threshold_override_properties (gobject_class, 1);
6748
6749#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
6750 g_type_class_add_private (klass, sizeof (SensorThresholdProxyPrivate));
6751#endif
6752}
6753
6754static void
6755sensor_threshold_proxy_iface_init (SensorThresholdIface *iface)
6756{
6757 iface->get_lower_critical = sensor_threshold_proxy_get_lower_critical;
6758 iface->get_lower_warning = sensor_threshold_proxy_get_lower_warning;
6759 iface->get_upper_warning = sensor_threshold_proxy_get_upper_warning;
6760 iface->get_upper_critical = sensor_threshold_proxy_get_upper_critical;
6761 iface->get_state = sensor_threshold_proxy_get_state;
6762}
6763
6764/**
6765 * sensor_threshold_proxy_new:
6766 * @connection: A #GDBusConnection.
6767 * @flags: Flags from the #GDBusProxyFlags enumeration.
6768 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6769 * @object_path: An object path.
6770 * @cancellable: (allow-none): A #GCancellable or %NULL.
6771 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6772 * @user_data: User data to pass to @callback.
6773 *
6774 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>. See g_dbus_proxy_new() for more details.
6775 *
6776 * 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.
6777 * You can then call sensor_threshold_proxy_new_finish() to get the result of the operation.
6778 *
6779 * See sensor_threshold_proxy_new_sync() for the synchronous, blocking version of this constructor.
6780 */
6781void
6782sensor_threshold_proxy_new (
6783 GDBusConnection *connection,
6784 GDBusProxyFlags flags,
6785 const gchar *name,
6786 const gchar *object_path,
6787 GCancellable *cancellable,
6788 GAsyncReadyCallback callback,
6789 gpointer user_data)
6790{
6791 g_async_initable_new_async (TYPE_SENSOR_THRESHOLD_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.SensorThreshold", NULL);
6792}
6793
6794/**
6795 * sensor_threshold_proxy_new_finish:
6796 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new().
6797 * @error: Return location for error or %NULL
6798 *
6799 * Finishes an operation started with sensor_threshold_proxy_new().
6800 *
6801 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6802 */
6803SensorThreshold *
6804sensor_threshold_proxy_new_finish (
6805 GAsyncResult *res,
6806 GError **error)
6807{
6808 GObject *ret;
6809 GObject *source_object;
6810 source_object = g_async_result_get_source_object (res);
6811 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6812 g_object_unref (source_object);
6813 if (ret != NULL)
6814 return SENSOR_THRESHOLD (ret);
6815 else
6816 return NULL;
6817}
6818
6819/**
6820 * sensor_threshold_proxy_new_sync:
6821 * @connection: A #GDBusConnection.
6822 * @flags: Flags from the #GDBusProxyFlags enumeration.
6823 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6824 * @object_path: An object path.
6825 * @cancellable: (allow-none): A #GCancellable or %NULL.
6826 * @error: Return location for error or %NULL
6827 *
6828 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>. See g_dbus_proxy_new_sync() for more details.
6829 *
6830 * The calling thread is blocked until a reply is received.
6831 *
6832 * See sensor_threshold_proxy_new() for the asynchronous version of this constructor.
6833 *
6834 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6835 */
6836SensorThreshold *
6837sensor_threshold_proxy_new_sync (
6838 GDBusConnection *connection,
6839 GDBusProxyFlags flags,
6840 const gchar *name,
6841 const gchar *object_path,
6842 GCancellable *cancellable,
6843 GError **error)
6844{
6845 GInitable *ret;
6846 ret = g_initable_new (TYPE_SENSOR_THRESHOLD_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorThreshold", NULL);
6847 if (ret != NULL)
6848 return SENSOR_THRESHOLD (ret);
6849 else
6850 return NULL;
6851}
6852
6853
6854/**
6855 * sensor_threshold_proxy_new_for_bus:
6856 * @bus_type: A #GBusType.
6857 * @flags: Flags from the #GDBusProxyFlags enumeration.
6858 * @name: A bus name (well-known or unique).
6859 * @object_path: An object path.
6860 * @cancellable: (allow-none): A #GCancellable or %NULL.
6861 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6862 * @user_data: User data to pass to @callback.
6863 *
6864 * Like sensor_threshold_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
6865 *
6866 * 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.
6867 * You can then call sensor_threshold_proxy_new_for_bus_finish() to get the result of the operation.
6868 *
6869 * See sensor_threshold_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
6870 */
6871void
6872sensor_threshold_proxy_new_for_bus (
6873 GBusType bus_type,
6874 GDBusProxyFlags flags,
6875 const gchar *name,
6876 const gchar *object_path,
6877 GCancellable *cancellable,
6878 GAsyncReadyCallback callback,
6879 gpointer user_data)
6880{
6881 g_async_initable_new_async (TYPE_SENSOR_THRESHOLD_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.SensorThreshold", NULL);
6882}
6883
6884/**
6885 * sensor_threshold_proxy_new_for_bus_finish:
6886 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new_for_bus().
6887 * @error: Return location for error or %NULL
6888 *
6889 * Finishes an operation started with sensor_threshold_proxy_new_for_bus().
6890 *
6891 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6892 */
6893SensorThreshold *
6894sensor_threshold_proxy_new_for_bus_finish (
6895 GAsyncResult *res,
6896 GError **error)
6897{
6898 GObject *ret;
6899 GObject *source_object;
6900 source_object = g_async_result_get_source_object (res);
6901 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6902 g_object_unref (source_object);
6903 if (ret != NULL)
6904 return SENSOR_THRESHOLD (ret);
6905 else
6906 return NULL;
6907}
6908
6909/**
6910 * sensor_threshold_proxy_new_for_bus_sync:
6911 * @bus_type: A #GBusType.
6912 * @flags: Flags from the #GDBusProxyFlags enumeration.
6913 * @name: A bus name (well-known or unique).
6914 * @object_path: An object path.
6915 * @cancellable: (allow-none): A #GCancellable or %NULL.
6916 * @error: Return location for error or %NULL
6917 *
6918 * Like sensor_threshold_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
6919 *
6920 * The calling thread is blocked until a reply is received.
6921 *
6922 * See sensor_threshold_proxy_new_for_bus() for the asynchronous version of this constructor.
6923 *
6924 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6925 */
6926SensorThreshold *
6927sensor_threshold_proxy_new_for_bus_sync (
6928 GBusType bus_type,
6929 GDBusProxyFlags flags,
6930 const gchar *name,
6931 const gchar *object_path,
6932 GCancellable *cancellable,
6933 GError **error)
6934{
6935 GInitable *ret;
6936 ret = g_initable_new (TYPE_SENSOR_THRESHOLD_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorThreshold", NULL);
6937 if (ret != NULL)
6938 return SENSOR_THRESHOLD (ret);
6939 else
6940 return NULL;
6941}
6942
6943
6944/* ------------------------------------------------------------------------ */
6945
6946/**
6947 * SensorThresholdSkeleton:
6948 *
6949 * The #SensorThresholdSkeleton structure contains only private data and should only be accessed using the provided API.
6950 */
6951
6952/**
6953 * SensorThresholdSkeletonClass:
6954 * @parent_class: The parent class.
6955 *
6956 * Class structure for #SensorThresholdSkeleton.
6957 */
6958
6959struct _SensorThresholdSkeletonPrivate
6960{
6961 GValue *properties;
6962 GList *changed_properties;
6963 GSource *changed_properties_idle_source;
6964 GMainContext *context;
6965 GMutex lock;
6966};
6967
6968static void
6969_sensor_threshold_skeleton_handle_method_call (
6970 GDBusConnection *connection G_GNUC_UNUSED,
6971 const gchar *sender G_GNUC_UNUSED,
6972 const gchar *object_path G_GNUC_UNUSED,
6973 const gchar *interface_name,
6974 const gchar *method_name,
6975 GVariant *parameters,
6976 GDBusMethodInvocation *invocation,
6977 gpointer user_data)
6978{
6979 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
6980 _ExtendedGDBusMethodInfo *info;
6981 GVariantIter iter;
6982 GVariant *child;
6983 GValue *paramv;
6984 guint num_params;
6985 guint num_extra;
6986 guint n;
6987 guint signal_id;
6988 GValue return_value = G_VALUE_INIT;
6989 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
6990 g_assert (info != NULL);
6991 num_params = g_variant_n_children (parameters);
6992 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
6993 n = 0;
6994 g_value_init (&paramv[n], TYPE_SENSOR_THRESHOLD);
6995 g_value_set_object (&paramv[n++], skeleton);
6996 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
6997 g_value_set_object (&paramv[n++], invocation);
6998 if (info->pass_fdlist)
6999 {
7000#ifdef G_OS_UNIX
7001 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
7002 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
7003#else
7004 g_assert_not_reached ();
7005#endif
7006 }
7007 g_variant_iter_init (&iter, parameters);
7008 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7009 {
7010 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
7011 if (arg_info->use_gvariant)
7012 {
7013 g_value_init (&paramv[n], G_TYPE_VARIANT);
7014 g_value_set_variant (&paramv[n], child);
7015 n++;
7016 }
7017 else
7018 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
7019 g_variant_unref (child);
7020 }
7021 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
7022 g_value_init (&return_value, G_TYPE_BOOLEAN);
7023 g_signal_emitv (paramv, signal_id, 0, &return_value);
7024 if (!g_value_get_boolean (&return_value))
7025 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);
7026 g_value_unset (&return_value);
7027 for (n = 0; n < num_params + num_extra; n++)
7028 g_value_unset (&paramv[n]);
7029 g_free (paramv);
7030}
7031
7032static GVariant *
7033_sensor_threshold_skeleton_handle_get_property (
7034 GDBusConnection *connection G_GNUC_UNUSED,
7035 const gchar *sender G_GNUC_UNUSED,
7036 const gchar *object_path G_GNUC_UNUSED,
7037 const gchar *interface_name G_GNUC_UNUSED,
7038 const gchar *property_name,
7039 GError **error,
7040 gpointer user_data)
7041{
7042 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7043 GValue value = G_VALUE_INIT;
7044 GParamSpec *pspec;
7045 _ExtendedGDBusPropertyInfo *info;
7046 GVariant *ret;
7047 ret = NULL;
7048 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
7049 g_assert (info != NULL);
7050 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
7051 if (pspec == NULL)
7052 {
7053 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
7054 }
7055 else
7056 {
7057 g_value_init (&value, pspec->value_type);
7058 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
7059 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
7060 g_value_unset (&value);
7061 }
7062 return ret;
7063}
7064
7065static gboolean
7066_sensor_threshold_skeleton_handle_set_property (
7067 GDBusConnection *connection G_GNUC_UNUSED,
7068 const gchar *sender G_GNUC_UNUSED,
7069 const gchar *object_path G_GNUC_UNUSED,
7070 const gchar *interface_name G_GNUC_UNUSED,
7071 const gchar *property_name,
7072 GVariant *variant,
7073 GError **error,
7074 gpointer user_data)
7075{
7076 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7077 GValue value = G_VALUE_INIT;
7078 GParamSpec *pspec;
7079 _ExtendedGDBusPropertyInfo *info;
7080 gboolean ret;
7081 ret = FALSE;
7082 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
7083 g_assert (info != NULL);
7084 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
7085 if (pspec == NULL)
7086 {
7087 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
7088 }
7089 else
7090 {
7091 if (info->use_gvariant)
7092 g_value_set_variant (&value, variant);
7093 else
7094 g_dbus_gvariant_to_gvalue (variant, &value);
7095 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
7096 g_value_unset (&value);
7097 ret = TRUE;
7098 }
7099 return ret;
7100}
7101
7102static const GDBusInterfaceVTable _sensor_threshold_skeleton_vtable =
7103{
7104 _sensor_threshold_skeleton_handle_method_call,
7105 _sensor_threshold_skeleton_handle_get_property,
7106 _sensor_threshold_skeleton_handle_set_property,
7107 {NULL}
7108};
7109
7110static GDBusInterfaceInfo *
7111sensor_threshold_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
7112{
7113 return sensor_threshold_interface_info ();
7114}
7115
7116static GDBusInterfaceVTable *
7117sensor_threshold_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
7118{
7119 return (GDBusInterfaceVTable *) &_sensor_threshold_skeleton_vtable;
7120}
7121
7122static GVariant *
7123sensor_threshold_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
7124{
7125 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
7126
7127 GVariantBuilder builder;
7128 guint n;
7129 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
7130 if (_sensor_threshold_interface_info.parent_struct.properties == NULL)
7131 goto out;
7132 for (n = 0; _sensor_threshold_interface_info.parent_struct.properties[n] != NULL; n++)
7133 {
7134 GDBusPropertyInfo *info = _sensor_threshold_interface_info.parent_struct.properties[n];
7135 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
7136 {
7137 GVariant *value;
7138 value = _sensor_threshold_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.SensorThreshold", info->name, NULL, skeleton);
7139 if (value != NULL)
7140 {
7141 g_variant_take_ref (value);
7142 g_variant_builder_add (&builder, "{sv}", info->name, value);
7143 g_variant_unref (value);
7144 }
7145 }
7146 }
7147out:
7148 return g_variant_builder_end (&builder);
7149}
7150
7151static gboolean _sensor_threshold_emit_changed (gpointer user_data);
7152
7153static void
7154sensor_threshold_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
7155{
7156 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
7157 gboolean emit_changed = FALSE;
7158
7159 g_mutex_lock (&skeleton->priv->lock);
7160 if (skeleton->priv->changed_properties_idle_source != NULL)
7161 {
7162 g_source_destroy (skeleton->priv->changed_properties_idle_source);
7163 skeleton->priv->changed_properties_idle_source = NULL;
7164 emit_changed = TRUE;
7165 }
7166 g_mutex_unlock (&skeleton->priv->lock);
7167
7168 if (emit_changed)
7169 _sensor_threshold_emit_changed (skeleton);
7170}
7171
7172static void
7173_sensor_threshold_on_signal_warning (
7174 SensorThreshold *object)
7175{
7176 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7177
7178 GList *connections, *l;
7179 GVariant *signal_variant;
7180 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7181
7182 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7183 for (l = connections; l != NULL; l = l->next)
7184 {
7185 GDBusConnection *connection = l->data;
7186 g_dbus_connection_emit_signal (connection,
7187 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Warning",
7188 signal_variant, NULL);
7189 }
7190 g_variant_unref (signal_variant);
7191 g_list_free_full (connections, g_object_unref);
7192}
7193
7194static void
7195_sensor_threshold_on_signal_critical (
7196 SensorThreshold *object)
7197{
7198 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7199
7200 GList *connections, *l;
7201 GVariant *signal_variant;
7202 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7203
7204 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7205 for (l = connections; l != NULL; l = l->next)
7206 {
7207 GDBusConnection *connection = l->data;
7208 g_dbus_connection_emit_signal (connection,
7209 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Critical",
7210 signal_variant, NULL);
7211 }
7212 g_variant_unref (signal_variant);
7213 g_list_free_full (connections, g_object_unref);
7214}
7215
7216static void
7217_sensor_threshold_on_signal_normal (
7218 SensorThreshold *object)
7219{
7220 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7221
7222 GList *connections, *l;
7223 GVariant *signal_variant;
7224 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7225
7226 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7227 for (l = connections; l != NULL; l = l->next)
7228 {
7229 GDBusConnection *connection = l->data;
7230 g_dbus_connection_emit_signal (connection,
7231 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Normal",
7232 signal_variant, NULL);
7233 }
7234 g_variant_unref (signal_variant);
7235 g_list_free_full (connections, g_object_unref);
7236}
7237
7238static void sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface);
7239#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7240G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
7241 G_ADD_PRIVATE (SensorThresholdSkeleton)
7242 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init));
7243
7244#else
7245G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
7246 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init));
7247
7248#endif
7249static void
7250sensor_threshold_skeleton_finalize (GObject *object)
7251{
7252 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7253 guint n;
7254 for (n = 0; n < 5; n++)
7255 g_value_unset (&skeleton->priv->properties[n]);
7256 g_free (skeleton->priv->properties);
7257 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
7258 if (skeleton->priv->changed_properties_idle_source != NULL)
7259 g_source_destroy (skeleton->priv->changed_properties_idle_source);
7260 g_main_context_unref (skeleton->priv->context);
7261 g_mutex_clear (&skeleton->priv->lock);
7262 G_OBJECT_CLASS (sensor_threshold_skeleton_parent_class)->finalize (object);
7263}
7264
7265static void
7266sensor_threshold_skeleton_get_property (GObject *object,
7267 guint prop_id,
7268 GValue *value,
7269 GParamSpec *pspec G_GNUC_UNUSED)
7270{
7271 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7272 g_assert (prop_id != 0 && prop_id - 1 < 5);
7273 g_mutex_lock (&skeleton->priv->lock);
7274 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
7275 g_mutex_unlock (&skeleton->priv->lock);
7276}
7277
7278static gboolean
7279_sensor_threshold_emit_changed (gpointer user_data)
7280{
7281 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7282 GList *l;
7283 GVariantBuilder builder;
7284 GVariantBuilder invalidated_builder;
7285 guint num_changes;
7286
7287 g_mutex_lock (&skeleton->priv->lock);
7288 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
7289 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
7290 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
7291 {
7292 ChangedProperty *cp = l->data;
7293 GVariant *variant;
7294 const GValue *cur_value;
7295
7296 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
7297 if (!_g_value_equal (cur_value, &cp->orig_value))
7298 {
7299 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
7300 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
7301 g_variant_unref (variant);
7302 num_changes++;
7303 }
7304 }
7305 if (num_changes > 0)
7306 {
7307 GList *connections, *ll;
7308 GVariant *signal_variant;
7309 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorThreshold",
7310 &builder, &invalidated_builder));
7311 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7312 for (ll = connections; ll != NULL; ll = ll->next)
7313 {
7314 GDBusConnection *connection = ll->data;
7315
7316 g_dbus_connection_emit_signal (connection,
7317 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
7318 "org.freedesktop.DBus.Properties",
7319 "PropertiesChanged",
7320 signal_variant,
7321 NULL);
7322 }
7323 g_variant_unref (signal_variant);
7324 g_list_free_full (connections, g_object_unref);
7325 }
7326 else
7327 {
7328 g_variant_builder_clear (&builder);
7329 g_variant_builder_clear (&invalidated_builder);
7330 }
7331 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
7332 skeleton->priv->changed_properties = NULL;
7333 skeleton->priv->changed_properties_idle_source = NULL;
7334 g_mutex_unlock (&skeleton->priv->lock);
7335 return FALSE;
7336}
7337
7338static void
7339_sensor_threshold_schedule_emit_changed (SensorThresholdSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
7340{
7341 ChangedProperty *cp;
7342 GList *l;
7343 cp = NULL;
7344 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
7345 {
7346 ChangedProperty *i_cp = l->data;
7347 if (i_cp->info == info)
7348 {
7349 cp = i_cp;
7350 break;
7351 }
7352 }
7353 if (cp == NULL)
7354 {
7355 cp = g_new0 (ChangedProperty, 1);
7356 cp->prop_id = prop_id;
7357 cp->info = info;
7358 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
7359 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
7360 g_value_copy (orig_value, &cp->orig_value);
7361 }
7362}
7363
7364static void
7365sensor_threshold_skeleton_notify (GObject *object,
7366 GParamSpec *pspec G_GNUC_UNUSED)
7367{
7368 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7369 g_mutex_lock (&skeleton->priv->lock);
7370 if (skeleton->priv->changed_properties != NULL &&
7371 skeleton->priv->changed_properties_idle_source == NULL)
7372 {
7373 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
7374 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
7375 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_threshold_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
7376 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
7377 g_source_unref (skeleton->priv->changed_properties_idle_source);
7378 }
7379 g_mutex_unlock (&skeleton->priv->lock);
7380}
7381
7382static void
7383sensor_threshold_skeleton_set_property (GObject *object,
7384 guint prop_id,
7385 const GValue *value,
7386 GParamSpec *pspec)
7387{
7388 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7389 g_assert (prop_id != 0 && prop_id - 1 < 5);
7390 g_mutex_lock (&skeleton->priv->lock);
7391 g_object_freeze_notify (object);
7392 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
7393 {
7394 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
7395 _sensor_threshold_schedule_emit_changed (skeleton, _sensor_threshold_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
7396 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
7397 g_object_notify_by_pspec (object, pspec);
7398 }
7399 g_mutex_unlock (&skeleton->priv->lock);
7400 g_object_thaw_notify (object);
7401}
7402
7403static void
7404sensor_threshold_skeleton_init (SensorThresholdSkeleton *skeleton)
7405{
7406#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7407 skeleton->priv = sensor_threshold_skeleton_get_instance_private (skeleton);
7408#else
7409 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_THRESHOLD_SKELETON, SensorThresholdSkeletonPrivate);
7410#endif
7411
7412 g_mutex_init (&skeleton->priv->lock);
7413 skeleton->priv->context = g_main_context_ref_thread_default ();
7414 skeleton->priv->properties = g_new0 (GValue, 5);
7415 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
7416 g_value_init (&skeleton->priv->properties[1], G_TYPE_VARIANT);
7417 g_value_init (&skeleton->priv->properties[2], G_TYPE_VARIANT);
7418 g_value_init (&skeleton->priv->properties[3], G_TYPE_VARIANT);
7419 g_value_init (&skeleton->priv->properties[4], G_TYPE_UCHAR);
7420}
7421
7422static GVariant *
7423sensor_threshold_skeleton_get_lower_critical (SensorThreshold *object)
7424{
7425 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7426 GVariant *value;
7427 g_mutex_lock (&skeleton->priv->lock);
7428 value = g_value_get_variant (&(skeleton->priv->properties[0]));
7429 g_mutex_unlock (&skeleton->priv->lock);
7430 return value;
7431}
7432
7433static GVariant *
7434sensor_threshold_skeleton_get_lower_warning (SensorThreshold *object)
7435{
7436 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7437 GVariant *value;
7438 g_mutex_lock (&skeleton->priv->lock);
7439 value = g_value_get_variant (&(skeleton->priv->properties[1]));
7440 g_mutex_unlock (&skeleton->priv->lock);
7441 return value;
7442}
7443
7444static GVariant *
7445sensor_threshold_skeleton_get_upper_warning (SensorThreshold *object)
7446{
7447 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7448 GVariant *value;
7449 g_mutex_lock (&skeleton->priv->lock);
7450 value = g_value_get_variant (&(skeleton->priv->properties[2]));
7451 g_mutex_unlock (&skeleton->priv->lock);
7452 return value;
7453}
7454
7455static GVariant *
7456sensor_threshold_skeleton_get_upper_critical (SensorThreshold *object)
7457{
7458 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7459 GVariant *value;
7460 g_mutex_lock (&skeleton->priv->lock);
7461 value = g_value_get_variant (&(skeleton->priv->properties[3]));
7462 g_mutex_unlock (&skeleton->priv->lock);
7463 return value;
7464}
7465
7466static guchar
7467sensor_threshold_skeleton_get_state (SensorThreshold *object)
7468{
7469 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7470 guchar value;
7471 g_mutex_lock (&skeleton->priv->lock);
7472 value = g_value_get_uchar (&(skeleton->priv->properties[4]));
7473 g_mutex_unlock (&skeleton->priv->lock);
7474 return value;
7475}
7476
7477static void
7478sensor_threshold_skeleton_class_init (SensorThresholdSkeletonClass *klass)
7479{
7480 GObjectClass *gobject_class;
7481 GDBusInterfaceSkeletonClass *skeleton_class;
7482
7483 gobject_class = G_OBJECT_CLASS (klass);
7484 gobject_class->finalize = sensor_threshold_skeleton_finalize;
7485 gobject_class->get_property = sensor_threshold_skeleton_get_property;
7486 gobject_class->set_property = sensor_threshold_skeleton_set_property;
7487 gobject_class->notify = sensor_threshold_skeleton_notify;
7488
7489
7490 sensor_threshold_override_properties (gobject_class, 1);
7491
7492 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
7493 skeleton_class->get_info = sensor_threshold_skeleton_dbus_interface_get_info;
7494 skeleton_class->get_properties = sensor_threshold_skeleton_dbus_interface_get_properties;
7495 skeleton_class->flush = sensor_threshold_skeleton_dbus_interface_flush;
7496 skeleton_class->get_vtable = sensor_threshold_skeleton_dbus_interface_get_vtable;
7497
7498#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
7499 g_type_class_add_private (klass, sizeof (SensorThresholdSkeletonPrivate));
7500#endif
7501}
7502
7503static void
7504sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface)
7505{
7506 iface->warning = _sensor_threshold_on_signal_warning;
7507 iface->critical = _sensor_threshold_on_signal_critical;
7508 iface->normal = _sensor_threshold_on_signal_normal;
7509 iface->get_lower_critical = sensor_threshold_skeleton_get_lower_critical;
7510 iface->get_lower_warning = sensor_threshold_skeleton_get_lower_warning;
7511 iface->get_upper_warning = sensor_threshold_skeleton_get_upper_warning;
7512 iface->get_upper_critical = sensor_threshold_skeleton_get_upper_critical;
7513 iface->get_state = sensor_threshold_skeleton_get_state;
7514}
7515
7516/**
7517 * sensor_threshold_skeleton_new:
7518 *
7519 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
7520 *
7521 * Returns: (transfer full) (type SensorThresholdSkeleton): The skeleton object.
7522 */
7523SensorThreshold *
7524sensor_threshold_skeleton_new (void)
7525{
7526 return SENSOR_THRESHOLD (g_object_new (TYPE_SENSOR_THRESHOLD_SKELETON, NULL));
7527}
7528
7529/* ------------------------------------------------------------------------
7530 * Code for interface org.openbmc.SensorI2c
7531 * ------------------------------------------------------------------------
7532 */
7533
7534/**
7535 * SECTION:SensorI2c
7536 * @title: SensorI2c
7537 * @short_description: Generated C code for the org.openbmc.SensorI2c D-Bus interface
7538 *
7539 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> D-Bus interface in C.
7540 */
7541
7542/* ---- Introspection data for org.openbmc.SensorI2c ---- */
7543
7544static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_dev_path =
7545{
7546 {
7547 -1,
7548 (gchar *) "dev_path",
7549 (gchar *) "s",
7550 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
7551 NULL
7552 },
7553 "dev-path",
7554 FALSE
7555};
7556
7557static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_address =
7558{
7559 {
7560 -1,
7561 (gchar *) "address",
7562 (gchar *) "s",
7563 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
7564 NULL
7565 },
7566 "address",
7567 FALSE
7568};
7569
7570static const _ExtendedGDBusPropertyInfo * const _sensor_i2c_property_info_pointers[] =
7571{
7572 &_sensor_i2c_property_info_dev_path,
7573 &_sensor_i2c_property_info_address,
7574 NULL
7575};
7576
7577static const _ExtendedGDBusInterfaceInfo _sensor_i2c_interface_info =
7578{
7579 {
7580 -1,
7581 (gchar *) "org.openbmc.SensorI2c",
7582 NULL,
7583 NULL,
7584 (GDBusPropertyInfo **) &_sensor_i2c_property_info_pointers,
7585 NULL
7586 },
7587 "sensor-i2c",
7588};
7589
7590
7591/**
7592 * sensor_i2c_interface_info:
7593 *
7594 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> D-Bus interface.
7595 *
7596 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
7597 */
7598GDBusInterfaceInfo *
7599sensor_i2c_interface_info (void)
7600{
7601 return (GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct;
7602}
7603
7604/**
7605 * sensor_i2c_override_properties:
7606 * @klass: The class structure for a #GObject<!-- -->-derived class.
7607 * @property_id_begin: The property id to assign to the first overridden property.
7608 *
7609 * Overrides all #GObject properties in the #SensorI2c interface for a concrete class.
7610 * The properties are overridden in the order they are defined.
7611 *
7612 * Returns: The last property id.
7613 */
7614guint
7615sensor_i2c_override_properties (GObjectClass *klass, guint property_id_begin)
7616{
7617 g_object_class_override_property (klass, property_id_begin++, "dev-path");
7618 g_object_class_override_property (klass, property_id_begin++, "address");
7619 return property_id_begin - 1;
7620}
7621
7622
7623
7624/**
7625 * SensorI2c:
7626 *
7627 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
7628 */
7629
7630/**
7631 * SensorI2cIface:
7632 * @parent_iface: The parent interface.
7633 * @get_address: Getter for the #SensorI2c:address property.
7634 * @get_dev_path: Getter for the #SensorI2c:dev-path property.
7635 *
7636 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
7637 */
7638
7639typedef SensorI2cIface SensorI2cInterface;
7640G_DEFINE_INTERFACE (SensorI2c, sensor_i2c, G_TYPE_OBJECT);
7641
7642static void
7643sensor_i2c_default_init (SensorI2cIface *iface)
7644{
7645 /* GObject properties for D-Bus properties: */
7646 /**
7647 * SensorI2c:dev-path:
7648 *
7649 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link>.
7650 *
7651 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
7652 */
7653 g_object_interface_install_property (iface,
7654 g_param_spec_string ("dev-path", "dev_path", "dev_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
7655 /**
7656 * SensorI2c:address:
7657 *
7658 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link>.
7659 *
7660 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
7661 */
7662 g_object_interface_install_property (iface,
7663 g_param_spec_string ("address", "address", "address", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
7664}
7665
7666/**
7667 * sensor_i2c_get_dev_path: (skip)
7668 * @object: A #SensorI2c.
7669 *
7670 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
7671 *
7672 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7673 *
7674 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_i2c_dup_dev_path() if on another thread.</warning>
7675 *
7676 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
7677 */
7678const gchar *
7679sensor_i2c_get_dev_path (SensorI2c *object)
7680{
7681 return SENSOR_I2C_GET_IFACE (object)->get_dev_path (object);
7682}
7683
7684/**
7685 * sensor_i2c_dup_dev_path: (skip)
7686 * @object: A #SensorI2c.
7687 *
7688 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
7689 *
7690 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7691 *
7692 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
7693 */
7694gchar *
7695sensor_i2c_dup_dev_path (SensorI2c *object)
7696{
7697 gchar *value;
7698 g_object_get (G_OBJECT (object), "dev-path", &value, NULL);
7699 return value;
7700}
7701
7702/**
7703 * sensor_i2c_set_dev_path: (skip)
7704 * @object: A #SensorI2c.
7705 * @value: The value to set.
7706 *
7707 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property to @value.
7708 *
7709 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7710 */
7711void
7712sensor_i2c_set_dev_path (SensorI2c *object, const gchar *value)
7713{
7714 g_object_set (G_OBJECT (object), "dev-path", value, NULL);
7715}
7716
7717/**
7718 * sensor_i2c_get_address: (skip)
7719 * @object: A #SensorI2c.
7720 *
7721 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
7722 *
7723 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7724 *
7725 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_i2c_dup_address() if on another thread.</warning>
7726 *
7727 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
7728 */
7729const gchar *
7730sensor_i2c_get_address (SensorI2c *object)
7731{
7732 return SENSOR_I2C_GET_IFACE (object)->get_address (object);
7733}
7734
7735/**
7736 * sensor_i2c_dup_address: (skip)
7737 * @object: A #SensorI2c.
7738 *
7739 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
7740 *
7741 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7742 *
7743 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
7744 */
7745gchar *
7746sensor_i2c_dup_address (SensorI2c *object)
7747{
7748 gchar *value;
7749 g_object_get (G_OBJECT (object), "address", &value, NULL);
7750 return value;
7751}
7752
7753/**
7754 * sensor_i2c_set_address: (skip)
7755 * @object: A #SensorI2c.
7756 * @value: The value to set.
7757 *
7758 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property to @value.
7759 *
7760 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7761 */
7762void
7763sensor_i2c_set_address (SensorI2c *object, const gchar *value)
7764{
7765 g_object_set (G_OBJECT (object), "address", value, NULL);
7766}
7767
7768/* ------------------------------------------------------------------------ */
7769
7770/**
7771 * SensorI2cProxy:
7772 *
7773 * The #SensorI2cProxy structure contains only private data and should only be accessed using the provided API.
7774 */
7775
7776/**
7777 * SensorI2cProxyClass:
7778 * @parent_class: The parent class.
7779 *
7780 * Class structure for #SensorI2cProxy.
7781 */
7782
7783struct _SensorI2cProxyPrivate
7784{
7785 GData *qdata;
7786};
7787
7788static void sensor_i2c_proxy_iface_init (SensorI2cIface *iface);
7789
7790#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7791G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
7792 G_ADD_PRIVATE (SensorI2cProxy)
7793 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
7794
7795#else
7796G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
7797 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
7798
7799#endif
7800static void
7801sensor_i2c_proxy_finalize (GObject *object)
7802{
7803 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
7804 g_datalist_clear (&proxy->priv->qdata);
7805 G_OBJECT_CLASS (sensor_i2c_proxy_parent_class)->finalize (object);
7806}
7807
7808static void
7809sensor_i2c_proxy_get_property (GObject *object,
7810 guint prop_id,
7811 GValue *value,
7812 GParamSpec *pspec G_GNUC_UNUSED)
7813{
7814 const _ExtendedGDBusPropertyInfo *info;
7815 GVariant *variant;
7816 g_assert (prop_id != 0 && prop_id - 1 < 2);
7817 info = _sensor_i2c_property_info_pointers[prop_id - 1];
7818 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
7819 if (info->use_gvariant)
7820 {
7821 g_value_set_variant (value, variant);
7822 }
7823 else
7824 {
7825 if (variant != NULL)
7826 g_dbus_gvariant_to_gvalue (variant, value);
7827 }
7828 if (variant != NULL)
7829 g_variant_unref (variant);
7830}
7831
7832static void
7833sensor_i2c_proxy_set_property_cb (GDBusProxy *proxy,
7834 GAsyncResult *res,
7835 gpointer user_data)
7836{
7837 const _ExtendedGDBusPropertyInfo *info = user_data;
7838 GError *error;
7839 GVariant *_ret;
7840 error = NULL;
7841 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
7842 if (!_ret)
7843 {
7844 g_warning ("Error setting property '%s' on interface org.openbmc.SensorI2c: %s (%s, %d)",
7845 info->parent_struct.name,
7846 error->message, g_quark_to_string (error->domain), error->code);
7847 g_error_free (error);
7848 }
7849 else
7850 {
7851 g_variant_unref (_ret);
7852 }
7853}
7854
7855static void
7856sensor_i2c_proxy_set_property (GObject *object,
7857 guint prop_id,
7858 const GValue *value,
7859 GParamSpec *pspec G_GNUC_UNUSED)
7860{
7861 const _ExtendedGDBusPropertyInfo *info;
7862 GVariant *variant;
7863 g_assert (prop_id != 0 && prop_id - 1 < 2);
7864 info = _sensor_i2c_property_info_pointers[prop_id - 1];
7865 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
7866 g_dbus_proxy_call (G_DBUS_PROXY (object),
7867 "org.freedesktop.DBus.Properties.Set",
7868 g_variant_new ("(ssv)", "org.openbmc.SensorI2c", info->parent_struct.name, variant),
7869 G_DBUS_CALL_FLAGS_NONE,
7870 -1,
7871 NULL, (GAsyncReadyCallback) sensor_i2c_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
7872 g_variant_unref (variant);
7873}
7874
7875static void
7876sensor_i2c_proxy_g_signal (GDBusProxy *proxy,
7877 const gchar *sender_name G_GNUC_UNUSED,
7878 const gchar *signal_name,
7879 GVariant *parameters)
7880{
7881 _ExtendedGDBusSignalInfo *info;
7882 GVariantIter iter;
7883 GVariant *child;
7884 GValue *paramv;
7885 guint num_params;
7886 guint n;
7887 guint signal_id;
7888 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, signal_name);
7889 if (info == NULL)
7890 return;
7891 num_params = g_variant_n_children (parameters);
7892 paramv = g_new0 (GValue, num_params + 1);
7893 g_value_init (&paramv[0], TYPE_SENSOR_I2C);
7894 g_value_set_object (&paramv[0], proxy);
7895 g_variant_iter_init (&iter, parameters);
7896 n = 1;
7897 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7898 {
7899 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
7900 if (arg_info->use_gvariant)
7901 {
7902 g_value_init (&paramv[n], G_TYPE_VARIANT);
7903 g_value_set_variant (&paramv[n], child);
7904 n++;
7905 }
7906 else
7907 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
7908 g_variant_unref (child);
7909 }
7910 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
7911 g_signal_emitv (paramv, signal_id, 0, NULL);
7912 for (n = 0; n < num_params + 1; n++)
7913 g_value_unset (&paramv[n]);
7914 g_free (paramv);
7915}
7916
7917static void
7918sensor_i2c_proxy_g_properties_changed (GDBusProxy *_proxy,
7919 GVariant *changed_properties,
7920 const gchar *const *invalidated_properties)
7921{
7922 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (_proxy);
7923 guint n;
7924 const gchar *key;
7925 GVariantIter *iter;
7926 _ExtendedGDBusPropertyInfo *info;
7927 g_variant_get (changed_properties, "a{sv}", &iter);
7928 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
7929 {
7930 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, key);
7931 g_datalist_remove_data (&proxy->priv->qdata, key);
7932 if (info != NULL)
7933 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7934 }
7935 g_variant_iter_free (iter);
7936 for (n = 0; invalidated_properties[n] != NULL; n++)
7937 {
7938 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, invalidated_properties[n]);
7939 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
7940 if (info != NULL)
7941 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7942 }
7943}
7944
7945static const gchar *
7946sensor_i2c_proxy_get_dev_path (SensorI2c *object)
7947{
7948 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
7949 GVariant *variant;
7950 const gchar *value = NULL;
7951 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "dev_path");
7952 if (variant != NULL)
7953 {
7954 value = g_variant_get_string (variant, NULL);
7955 g_variant_unref (variant);
7956 }
7957 return value;
7958}
7959
7960static const gchar *
7961sensor_i2c_proxy_get_address (SensorI2c *object)
7962{
7963 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
7964 GVariant *variant;
7965 const gchar *value = NULL;
7966 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "address");
7967 if (variant != NULL)
7968 {
7969 value = g_variant_get_string (variant, NULL);
7970 g_variant_unref (variant);
7971 }
7972 return value;
7973}
7974
7975static void
7976sensor_i2c_proxy_init (SensorI2cProxy *proxy)
7977{
7978#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7979 proxy->priv = sensor_i2c_proxy_get_instance_private (proxy);
7980#else
7981 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_I2C_PROXY, SensorI2cProxyPrivate);
7982#endif
7983
7984 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_i2c_interface_info ());
7985}
7986
7987static void
7988sensor_i2c_proxy_class_init (SensorI2cProxyClass *klass)
7989{
7990 GObjectClass *gobject_class;
7991 GDBusProxyClass *proxy_class;
7992
7993 gobject_class = G_OBJECT_CLASS (klass);
7994 gobject_class->finalize = sensor_i2c_proxy_finalize;
7995 gobject_class->get_property = sensor_i2c_proxy_get_property;
7996 gobject_class->set_property = sensor_i2c_proxy_set_property;
7997
7998 proxy_class = G_DBUS_PROXY_CLASS (klass);
7999 proxy_class->g_signal = sensor_i2c_proxy_g_signal;
8000 proxy_class->g_properties_changed = sensor_i2c_proxy_g_properties_changed;
8001
8002 sensor_i2c_override_properties (gobject_class, 1);
8003
8004#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8005 g_type_class_add_private (klass, sizeof (SensorI2cProxyPrivate));
8006#endif
8007}
8008
8009static void
8010sensor_i2c_proxy_iface_init (SensorI2cIface *iface)
8011{
8012 iface->get_dev_path = sensor_i2c_proxy_get_dev_path;
8013 iface->get_address = sensor_i2c_proxy_get_address;
8014}
8015
8016/**
8017 * sensor_i2c_proxy_new:
8018 * @connection: A #GDBusConnection.
8019 * @flags: Flags from the #GDBusProxyFlags enumeration.
8020 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
8021 * @object_path: An object path.
8022 * @cancellable: (allow-none): A #GCancellable or %NULL.
8023 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
8024 * @user_data: User data to pass to @callback.
8025 *
8026 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. See g_dbus_proxy_new() for more details.
8027 *
8028 * 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.
8029 * You can then call sensor_i2c_proxy_new_finish() to get the result of the operation.
8030 *
8031 * See sensor_i2c_proxy_new_sync() for the synchronous, blocking version of this constructor.
8032 */
8033void
8034sensor_i2c_proxy_new (
8035 GDBusConnection *connection,
8036 GDBusProxyFlags flags,
8037 const gchar *name,
8038 const gchar *object_path,
8039 GCancellable *cancellable,
8040 GAsyncReadyCallback callback,
8041 gpointer user_data)
8042{
8043 g_async_initable_new_async (TYPE_SENSOR_I2C_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.SensorI2c", NULL);
8044}
8045
8046/**
8047 * sensor_i2c_proxy_new_finish:
8048 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new().
8049 * @error: Return location for error or %NULL
8050 *
8051 * Finishes an operation started with sensor_i2c_proxy_new().
8052 *
8053 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8054 */
8055SensorI2c *
8056sensor_i2c_proxy_new_finish (
8057 GAsyncResult *res,
8058 GError **error)
8059{
8060 GObject *ret;
8061 GObject *source_object;
8062 source_object = g_async_result_get_source_object (res);
8063 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
8064 g_object_unref (source_object);
8065 if (ret != NULL)
8066 return SENSOR_I2C (ret);
8067 else
8068 return NULL;
8069}
8070
8071/**
8072 * sensor_i2c_proxy_new_sync:
8073 * @connection: A #GDBusConnection.
8074 * @flags: Flags from the #GDBusProxyFlags enumeration.
8075 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
8076 * @object_path: An object path.
8077 * @cancellable: (allow-none): A #GCancellable or %NULL.
8078 * @error: Return location for error or %NULL
8079 *
8080 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. See g_dbus_proxy_new_sync() for more details.
8081 *
8082 * The calling thread is blocked until a reply is received.
8083 *
8084 * See sensor_i2c_proxy_new() for the asynchronous version of this constructor.
8085 *
8086 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8087 */
8088SensorI2c *
8089sensor_i2c_proxy_new_sync (
8090 GDBusConnection *connection,
8091 GDBusProxyFlags flags,
8092 const gchar *name,
8093 const gchar *object_path,
8094 GCancellable *cancellable,
8095 GError **error)
8096{
8097 GInitable *ret;
8098 ret = g_initable_new (TYPE_SENSOR_I2C_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorI2c", NULL);
8099 if (ret != NULL)
8100 return SENSOR_I2C (ret);
8101 else
8102 return NULL;
8103}
8104
8105
8106/**
8107 * sensor_i2c_proxy_new_for_bus:
8108 * @bus_type: A #GBusType.
8109 * @flags: Flags from the #GDBusProxyFlags enumeration.
8110 * @name: A bus name (well-known or unique).
8111 * @object_path: An object path.
8112 * @cancellable: (allow-none): A #GCancellable or %NULL.
8113 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
8114 * @user_data: User data to pass to @callback.
8115 *
8116 * Like sensor_i2c_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
8117 *
8118 * 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.
8119 * You can then call sensor_i2c_proxy_new_for_bus_finish() to get the result of the operation.
8120 *
8121 * See sensor_i2c_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
8122 */
8123void
8124sensor_i2c_proxy_new_for_bus (
8125 GBusType bus_type,
8126 GDBusProxyFlags flags,
8127 const gchar *name,
8128 const gchar *object_path,
8129 GCancellable *cancellable,
8130 GAsyncReadyCallback callback,
8131 gpointer user_data)
8132{
8133 g_async_initable_new_async (TYPE_SENSOR_I2C_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.SensorI2c", NULL);
8134}
8135
8136/**
8137 * sensor_i2c_proxy_new_for_bus_finish:
8138 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new_for_bus().
8139 * @error: Return location for error or %NULL
8140 *
8141 * Finishes an operation started with sensor_i2c_proxy_new_for_bus().
8142 *
8143 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8144 */
8145SensorI2c *
8146sensor_i2c_proxy_new_for_bus_finish (
8147 GAsyncResult *res,
8148 GError **error)
8149{
8150 GObject *ret;
8151 GObject *source_object;
8152 source_object = g_async_result_get_source_object (res);
8153 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
8154 g_object_unref (source_object);
8155 if (ret != NULL)
8156 return SENSOR_I2C (ret);
8157 else
8158 return NULL;
8159}
8160
8161/**
8162 * sensor_i2c_proxy_new_for_bus_sync:
8163 * @bus_type: A #GBusType.
8164 * @flags: Flags from the #GDBusProxyFlags enumeration.
8165 * @name: A bus name (well-known or unique).
8166 * @object_path: An object path.
8167 * @cancellable: (allow-none): A #GCancellable or %NULL.
8168 * @error: Return location for error or %NULL
8169 *
8170 * Like sensor_i2c_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
8171 *
8172 * The calling thread is blocked until a reply is received.
8173 *
8174 * See sensor_i2c_proxy_new_for_bus() for the asynchronous version of this constructor.
8175 *
8176 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8177 */
8178SensorI2c *
8179sensor_i2c_proxy_new_for_bus_sync (
8180 GBusType bus_type,
8181 GDBusProxyFlags flags,
8182 const gchar *name,
8183 const gchar *object_path,
8184 GCancellable *cancellable,
8185 GError **error)
8186{
8187 GInitable *ret;
8188 ret = g_initable_new (TYPE_SENSOR_I2C_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorI2c", NULL);
8189 if (ret != NULL)
8190 return SENSOR_I2C (ret);
8191 else
8192 return NULL;
8193}
8194
8195
8196/* ------------------------------------------------------------------------ */
8197
8198/**
8199 * SensorI2cSkeleton:
8200 *
8201 * The #SensorI2cSkeleton structure contains only private data and should only be accessed using the provided API.
8202 */
8203
8204/**
8205 * SensorI2cSkeletonClass:
8206 * @parent_class: The parent class.
8207 *
8208 * Class structure for #SensorI2cSkeleton.
8209 */
8210
8211struct _SensorI2cSkeletonPrivate
8212{
8213 GValue *properties;
8214 GList *changed_properties;
8215 GSource *changed_properties_idle_source;
8216 GMainContext *context;
8217 GMutex lock;
8218};
8219
8220static void
8221_sensor_i2c_skeleton_handle_method_call (
8222 GDBusConnection *connection G_GNUC_UNUSED,
8223 const gchar *sender G_GNUC_UNUSED,
8224 const gchar *object_path G_GNUC_UNUSED,
8225 const gchar *interface_name,
8226 const gchar *method_name,
8227 GVariant *parameters,
8228 GDBusMethodInvocation *invocation,
8229 gpointer user_data)
8230{
8231 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8232 _ExtendedGDBusMethodInfo *info;
8233 GVariantIter iter;
8234 GVariant *child;
8235 GValue *paramv;
8236 guint num_params;
8237 guint num_extra;
8238 guint n;
8239 guint signal_id;
8240 GValue return_value = G_VALUE_INIT;
8241 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
8242 g_assert (info != NULL);
8243 num_params = g_variant_n_children (parameters);
8244 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
8245 n = 0;
8246 g_value_init (&paramv[n], TYPE_SENSOR_I2C);
8247 g_value_set_object (&paramv[n++], skeleton);
8248 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
8249 g_value_set_object (&paramv[n++], invocation);
8250 if (info->pass_fdlist)
8251 {
8252#ifdef G_OS_UNIX
8253 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
8254 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
8255#else
8256 g_assert_not_reached ();
8257#endif
8258 }
8259 g_variant_iter_init (&iter, parameters);
8260 while ((child = g_variant_iter_next_value (&iter)) != NULL)
8261 {
8262 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
8263 if (arg_info->use_gvariant)
8264 {
8265 g_value_init (&paramv[n], G_TYPE_VARIANT);
8266 g_value_set_variant (&paramv[n], child);
8267 n++;
8268 }
8269 else
8270 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
8271 g_variant_unref (child);
8272 }
8273 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
8274 g_value_init (&return_value, G_TYPE_BOOLEAN);
8275 g_signal_emitv (paramv, signal_id, 0, &return_value);
8276 if (!g_value_get_boolean (&return_value))
8277 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);
8278 g_value_unset (&return_value);
8279 for (n = 0; n < num_params + num_extra; n++)
8280 g_value_unset (&paramv[n]);
8281 g_free (paramv);
8282}
8283
8284static GVariant *
8285_sensor_i2c_skeleton_handle_get_property (
8286 GDBusConnection *connection G_GNUC_UNUSED,
8287 const gchar *sender G_GNUC_UNUSED,
8288 const gchar *object_path G_GNUC_UNUSED,
8289 const gchar *interface_name G_GNUC_UNUSED,
8290 const gchar *property_name,
8291 GError **error,
8292 gpointer user_data)
8293{
8294 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8295 GValue value = G_VALUE_INIT;
8296 GParamSpec *pspec;
8297 _ExtendedGDBusPropertyInfo *info;
8298 GVariant *ret;
8299 ret = NULL;
8300 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
8301 g_assert (info != NULL);
8302 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
8303 if (pspec == NULL)
8304 {
8305 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
8306 }
8307 else
8308 {
8309 g_value_init (&value, pspec->value_type);
8310 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
8311 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
8312 g_value_unset (&value);
8313 }
8314 return ret;
8315}
8316
8317static gboolean
8318_sensor_i2c_skeleton_handle_set_property (
8319 GDBusConnection *connection G_GNUC_UNUSED,
8320 const gchar *sender G_GNUC_UNUSED,
8321 const gchar *object_path G_GNUC_UNUSED,
8322 const gchar *interface_name G_GNUC_UNUSED,
8323 const gchar *property_name,
8324 GVariant *variant,
8325 GError **error,
8326 gpointer user_data)
8327{
8328 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8329 GValue value = G_VALUE_INIT;
8330 GParamSpec *pspec;
8331 _ExtendedGDBusPropertyInfo *info;
8332 gboolean ret;
8333 ret = FALSE;
8334 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
8335 g_assert (info != NULL);
8336 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
8337 if (pspec == NULL)
8338 {
8339 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
8340 }
8341 else
8342 {
8343 if (info->use_gvariant)
8344 g_value_set_variant (&value, variant);
8345 else
8346 g_dbus_gvariant_to_gvalue (variant, &value);
8347 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
8348 g_value_unset (&value);
8349 ret = TRUE;
8350 }
8351 return ret;
8352}
8353
8354static const GDBusInterfaceVTable _sensor_i2c_skeleton_vtable =
8355{
8356 _sensor_i2c_skeleton_handle_method_call,
8357 _sensor_i2c_skeleton_handle_get_property,
8358 _sensor_i2c_skeleton_handle_set_property,
8359 {NULL}
8360};
8361
8362static GDBusInterfaceInfo *
8363sensor_i2c_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8364{
8365 return sensor_i2c_interface_info ();
8366}
8367
8368static GDBusInterfaceVTable *
8369sensor_i2c_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8370{
8371 return (GDBusInterfaceVTable *) &_sensor_i2c_skeleton_vtable;
8372}
8373
8374static GVariant *
8375sensor_i2c_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
8376{
8377 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
8378
8379 GVariantBuilder builder;
8380 guint n;
8381 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8382 if (_sensor_i2c_interface_info.parent_struct.properties == NULL)
8383 goto out;
8384 for (n = 0; _sensor_i2c_interface_info.parent_struct.properties[n] != NULL; n++)
8385 {
8386 GDBusPropertyInfo *info = _sensor_i2c_interface_info.parent_struct.properties[n];
8387 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
8388 {
8389 GVariant *value;
8390 value = _sensor_i2c_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.SensorI2c", info->name, NULL, skeleton);
8391 if (value != NULL)
8392 {
8393 g_variant_take_ref (value);
8394 g_variant_builder_add (&builder, "{sv}", info->name, value);
8395 g_variant_unref (value);
8396 }
8397 }
8398 }
8399out:
8400 return g_variant_builder_end (&builder);
8401}
8402
8403static gboolean _sensor_i2c_emit_changed (gpointer user_data);
8404
8405static void
8406sensor_i2c_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
8407{
8408 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
8409 gboolean emit_changed = FALSE;
8410
8411 g_mutex_lock (&skeleton->priv->lock);
8412 if (skeleton->priv->changed_properties_idle_source != NULL)
8413 {
8414 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8415 skeleton->priv->changed_properties_idle_source = NULL;
8416 emit_changed = TRUE;
8417 }
8418 g_mutex_unlock (&skeleton->priv->lock);
8419
8420 if (emit_changed)
8421 _sensor_i2c_emit_changed (skeleton);
8422}
8423
8424static void sensor_i2c_skeleton_iface_init (SensorI2cIface *iface);
8425#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8426G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8427 G_ADD_PRIVATE (SensorI2cSkeleton)
8428 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
8429
8430#else
8431G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8432 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
8433
8434#endif
8435static void
8436sensor_i2c_skeleton_finalize (GObject *object)
8437{
8438 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8439 guint n;
8440 for (n = 0; n < 2; n++)
8441 g_value_unset (&skeleton->priv->properties[n]);
8442 g_free (skeleton->priv->properties);
8443 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
8444 if (skeleton->priv->changed_properties_idle_source != NULL)
8445 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8446 g_main_context_unref (skeleton->priv->context);
8447 g_mutex_clear (&skeleton->priv->lock);
8448 G_OBJECT_CLASS (sensor_i2c_skeleton_parent_class)->finalize (object);
8449}
8450
8451static void
8452sensor_i2c_skeleton_get_property (GObject *object,
8453 guint prop_id,
8454 GValue *value,
8455 GParamSpec *pspec G_GNUC_UNUSED)
8456{
8457 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8458 g_assert (prop_id != 0 && prop_id - 1 < 2);
8459 g_mutex_lock (&skeleton->priv->lock);
8460 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
8461 g_mutex_unlock (&skeleton->priv->lock);
8462}
8463
8464static gboolean
8465_sensor_i2c_emit_changed (gpointer user_data)
8466{
8467 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8468 GList *l;
8469 GVariantBuilder builder;
8470 GVariantBuilder invalidated_builder;
8471 guint num_changes;
8472
8473 g_mutex_lock (&skeleton->priv->lock);
8474 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8475 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
8476 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
8477 {
8478 ChangedProperty *cp = l->data;
8479 GVariant *variant;
8480 const GValue *cur_value;
8481
8482 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
8483 if (!_g_value_equal (cur_value, &cp->orig_value))
8484 {
8485 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
8486 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
8487 g_variant_unref (variant);
8488 num_changes++;
8489 }
8490 }
8491 if (num_changes > 0)
8492 {
8493 GList *connections, *ll;
8494 GVariant *signal_variant;
8495 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorI2c",
8496 &builder, &invalidated_builder));
8497 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
8498 for (ll = connections; ll != NULL; ll = ll->next)
8499 {
8500 GDBusConnection *connection = ll->data;
8501
8502 g_dbus_connection_emit_signal (connection,
8503 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
8504 "org.freedesktop.DBus.Properties",
8505 "PropertiesChanged",
8506 signal_variant,
8507 NULL);
8508 }
8509 g_variant_unref (signal_variant);
8510 g_list_free_full (connections, g_object_unref);
8511 }
8512 else
8513 {
8514 g_variant_builder_clear (&builder);
8515 g_variant_builder_clear (&invalidated_builder);
8516 }
8517 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
8518 skeleton->priv->changed_properties = NULL;
8519 skeleton->priv->changed_properties_idle_source = NULL;
8520 g_mutex_unlock (&skeleton->priv->lock);
8521 return FALSE;
8522}
8523
8524static void
8525_sensor_i2c_schedule_emit_changed (SensorI2cSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
8526{
8527 ChangedProperty *cp;
8528 GList *l;
8529 cp = NULL;
8530 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
8531 {
8532 ChangedProperty *i_cp = l->data;
8533 if (i_cp->info == info)
8534 {
8535 cp = i_cp;
8536 break;
8537 }
8538 }
8539 if (cp == NULL)
8540 {
8541 cp = g_new0 (ChangedProperty, 1);
8542 cp->prop_id = prop_id;
8543 cp->info = info;
8544 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
8545 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
8546 g_value_copy (orig_value, &cp->orig_value);
8547 }
8548}
8549
8550static void
8551sensor_i2c_skeleton_notify (GObject *object,
8552 GParamSpec *pspec G_GNUC_UNUSED)
8553{
8554 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8555 g_mutex_lock (&skeleton->priv->lock);
8556 if (skeleton->priv->changed_properties != NULL &&
8557 skeleton->priv->changed_properties_idle_source == NULL)
8558 {
8559 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
8560 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
8561 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_i2c_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
8562 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
8563 g_source_unref (skeleton->priv->changed_properties_idle_source);
8564 }
8565 g_mutex_unlock (&skeleton->priv->lock);
8566}
8567
8568static void
8569sensor_i2c_skeleton_set_property (GObject *object,
8570 guint prop_id,
8571 const GValue *value,
8572 GParamSpec *pspec)
8573{
8574 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8575 g_assert (prop_id != 0 && prop_id - 1 < 2);
8576 g_mutex_lock (&skeleton->priv->lock);
8577 g_object_freeze_notify (object);
8578 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
8579 {
8580 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
8581 _sensor_i2c_schedule_emit_changed (skeleton, _sensor_i2c_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
8582 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
8583 g_object_notify_by_pspec (object, pspec);
8584 }
8585 g_mutex_unlock (&skeleton->priv->lock);
8586 g_object_thaw_notify (object);
8587}
8588
8589static void
8590sensor_i2c_skeleton_init (SensorI2cSkeleton *skeleton)
8591{
8592#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8593 skeleton->priv = sensor_i2c_skeleton_get_instance_private (skeleton);
8594#else
8595 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_I2C_SKELETON, SensorI2cSkeletonPrivate);
8596#endif
8597
8598 g_mutex_init (&skeleton->priv->lock);
8599 skeleton->priv->context = g_main_context_ref_thread_default ();
8600 skeleton->priv->properties = g_new0 (GValue, 2);
8601 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
8602 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
8603}
8604
8605static const gchar *
8606sensor_i2c_skeleton_get_dev_path (SensorI2c *object)
8607{
8608 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8609 const gchar *value;
8610 g_mutex_lock (&skeleton->priv->lock);
8611 value = g_value_get_string (&(skeleton->priv->properties[0]));
8612 g_mutex_unlock (&skeleton->priv->lock);
8613 return value;
8614}
8615
8616static const gchar *
8617sensor_i2c_skeleton_get_address (SensorI2c *object)
8618{
8619 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8620 const gchar *value;
8621 g_mutex_lock (&skeleton->priv->lock);
8622 value = g_value_get_string (&(skeleton->priv->properties[1]));
8623 g_mutex_unlock (&skeleton->priv->lock);
8624 return value;
8625}
8626
8627static void
8628sensor_i2c_skeleton_class_init (SensorI2cSkeletonClass *klass)
8629{
8630 GObjectClass *gobject_class;
8631 GDBusInterfaceSkeletonClass *skeleton_class;
8632
8633 gobject_class = G_OBJECT_CLASS (klass);
8634 gobject_class->finalize = sensor_i2c_skeleton_finalize;
8635 gobject_class->get_property = sensor_i2c_skeleton_get_property;
8636 gobject_class->set_property = sensor_i2c_skeleton_set_property;
8637 gobject_class->notify = sensor_i2c_skeleton_notify;
8638
8639
8640 sensor_i2c_override_properties (gobject_class, 1);
8641
8642 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
8643 skeleton_class->get_info = sensor_i2c_skeleton_dbus_interface_get_info;
8644 skeleton_class->get_properties = sensor_i2c_skeleton_dbus_interface_get_properties;
8645 skeleton_class->flush = sensor_i2c_skeleton_dbus_interface_flush;
8646 skeleton_class->get_vtable = sensor_i2c_skeleton_dbus_interface_get_vtable;
8647
8648#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8649 g_type_class_add_private (klass, sizeof (SensorI2cSkeletonPrivate));
8650#endif
8651}
8652
8653static void
8654sensor_i2c_skeleton_iface_init (SensorI2cIface *iface)
8655{
8656 iface->get_dev_path = sensor_i2c_skeleton_get_dev_path;
8657 iface->get_address = sensor_i2c_skeleton_get_address;
8658}
8659
8660/**
8661 * sensor_i2c_skeleton_new:
8662 *
8663 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
8664 *
8665 * Returns: (transfer full) (type SensorI2cSkeleton): The skeleton object.
8666 */
8667SensorI2c *
8668sensor_i2c_skeleton_new (void)
8669{
8670 return SENSOR_I2C (g_object_new (TYPE_SENSOR_I2C_SKELETON, NULL));
8671}
8672
8673/* ------------------------------------------------------------------------
8674 * Code for interface org.openbmc.SensorMatch
8675 * ------------------------------------------------------------------------
8676 */
8677
8678/**
8679 * SECTION:SensorMatch
8680 * @title: SensorMatch
8681 * @short_description: Generated C code for the org.openbmc.SensorMatch D-Bus interface
8682 *
8683 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> D-Bus interface in C.
8684 */
8685
8686/* ---- Introspection data for org.openbmc.SensorMatch ---- */
8687
8688static const _ExtendedGDBusArgInfo _sensor_match_signal_info_sensor_match_ARG_state =
8689{
8690 {
8691 -1,
8692 (gchar *) "state",
8693 (gchar *) "y",
8694 NULL
8695 },
8696 FALSE
8697};
8698
8699static const _ExtendedGDBusArgInfo * const _sensor_match_signal_info_sensor_match_ARG_pointers[] =
8700{
8701 &_sensor_match_signal_info_sensor_match_ARG_state,
8702 NULL
8703};
8704
8705static const _ExtendedGDBusSignalInfo _sensor_match_signal_info_sensor_match =
8706{
8707 {
8708 -1,
8709 (gchar *) "SensorMatch",
8710 (GDBusArgInfo **) &_sensor_match_signal_info_sensor_match_ARG_pointers,
8711 NULL
8712 },
8713 "sensor-match"
8714};
8715
8716static const _ExtendedGDBusSignalInfo * const _sensor_match_signal_info_pointers[] =
8717{
8718 &_sensor_match_signal_info_sensor_match,
8719 NULL
8720};
8721
8722static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_match_value =
8723{
8724 {
8725 -1,
8726 (gchar *) "match_value",
8727 (gchar *) "v",
8728 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
8729 NULL
8730 },
8731 "match-value",
8732 FALSE
8733};
8734
8735static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_state =
8736{
8737 {
8738 -1,
8739 (gchar *) "state",
8740 (gchar *) "y",
8741 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
8742 NULL
8743 },
8744 "state",
8745 FALSE
8746};
8747
8748static const _ExtendedGDBusPropertyInfo * const _sensor_match_property_info_pointers[] =
8749{
8750 &_sensor_match_property_info_match_value,
8751 &_sensor_match_property_info_state,
8752 NULL
8753};
8754
8755static const _ExtendedGDBusInterfaceInfo _sensor_match_interface_info =
8756{
8757 {
8758 -1,
8759 (gchar *) "org.openbmc.SensorMatch",
8760 NULL,
8761 (GDBusSignalInfo **) &_sensor_match_signal_info_pointers,
8762 (GDBusPropertyInfo **) &_sensor_match_property_info_pointers,
8763 NULL
8764 },
8765 "sensor-match",
8766};
8767
8768
8769/**
8770 * sensor_match_interface_info:
8771 *
8772 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> D-Bus interface.
8773 *
8774 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
8775 */
8776GDBusInterfaceInfo *
8777sensor_match_interface_info (void)
8778{
8779 return (GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct;
8780}
8781
8782/**
8783 * sensor_match_override_properties:
8784 * @klass: The class structure for a #GObject<!-- -->-derived class.
8785 * @property_id_begin: The property id to assign to the first overridden property.
8786 *
8787 * Overrides all #GObject properties in the #SensorMatch interface for a concrete class.
8788 * The properties are overridden in the order they are defined.
8789 *
8790 * Returns: The last property id.
8791 */
8792guint
8793sensor_match_override_properties (GObjectClass *klass, guint property_id_begin)
8794{
8795 g_object_class_override_property (klass, property_id_begin++, "match-value");
8796 g_object_class_override_property (klass, property_id_begin++, "state");
8797 return property_id_begin - 1;
8798}
8799
8800
8801
8802/**
8803 * SensorMatch:
8804 *
8805 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
8806 */
8807
8808/**
8809 * SensorMatchIface:
8810 * @parent_iface: The parent interface.
8811 * @get_match_value: Getter for the #SensorMatch:match-value property.
8812 * @get_state: Getter for the #SensorMatch:state property.
8813 * @sensor_match: Handler for the #SensorMatch::sensor-match signal.
8814 *
8815 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
8816 */
8817
8818typedef SensorMatchIface SensorMatchInterface;
8819G_DEFINE_INTERFACE (SensorMatch, sensor_match, G_TYPE_OBJECT);
8820
8821static void
8822sensor_match_default_init (SensorMatchIface *iface)
8823{
8824 /* GObject signals for received D-Bus signals: */
8825 /**
8826 * SensorMatch::sensor-match:
8827 * @object: A #SensorMatch.
8828 * @arg_state: Argument.
8829 *
8830 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorMatch.SensorMatch">"SensorMatch"</link> is received.
8831 *
8832 * 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.
8833 */
8834 g_signal_new ("sensor-match",
8835 G_TYPE_FROM_INTERFACE (iface),
8836 G_SIGNAL_RUN_LAST,
8837 G_STRUCT_OFFSET (SensorMatchIface, sensor_match),
8838 NULL,
8839 NULL,
8840 g_cclosure_marshal_generic,
8841 G_TYPE_NONE,
8842 1, G_TYPE_UCHAR);
8843
8844 /* GObject properties for D-Bus properties: */
8845 /**
8846 * SensorMatch:match-value:
8847 *
8848 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link>.
8849 *
8850 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
8851 */
8852 g_object_interface_install_property (iface,
8853 g_param_spec_variant ("match-value", "match_value", "match_value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
8854 /**
8855 * SensorMatch:state:
8856 *
8857 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link>.
8858 *
8859 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
8860 */
8861 g_object_interface_install_property (iface,
8862 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
8863}
8864
8865/**
8866 * sensor_match_get_match_value: (skip)
8867 * @object: A #SensorMatch.
8868 *
8869 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property.
8870 *
8871 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
8872 *
8873 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_match_dup_match_value() if on another thread.</warning>
8874 *
8875 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
8876 */
8877GVariant *
8878sensor_match_get_match_value (SensorMatch *object)
8879{
8880 return SENSOR_MATCH_GET_IFACE (object)->get_match_value (object);
8881}
8882
8883/**
8884 * sensor_match_dup_match_value: (skip)
8885 * @object: A #SensorMatch.
8886 *
8887 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property.
8888 *
8889 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
8890 *
8891 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
8892 */
8893GVariant *
8894sensor_match_dup_match_value (SensorMatch *object)
8895{
8896 GVariant *value;
8897 g_object_get (G_OBJECT (object), "match-value", &value, NULL);
8898 return value;
8899}
8900
8901/**
8902 * sensor_match_set_match_value: (skip)
8903 * @object: A #SensorMatch.
8904 * @value: The value to set.
8905 *
8906 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property to @value.
8907 *
8908 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
8909 */
8910void
8911sensor_match_set_match_value (SensorMatch *object, GVariant *value)
8912{
8913 g_object_set (G_OBJECT (object), "match-value", value, NULL);
8914}
8915
8916/**
8917 * sensor_match_get_state: (skip)
8918 * @object: A #SensorMatch.
8919 *
8920 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property.
8921 *
8922 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
8923 *
8924 * Returns: The property value.
8925 */
8926guchar
8927sensor_match_get_state (SensorMatch *object)
8928{
8929 return SENSOR_MATCH_GET_IFACE (object)->get_state (object);
8930}
8931
8932/**
8933 * sensor_match_set_state: (skip)
8934 * @object: A #SensorMatch.
8935 * @value: The value to set.
8936 *
8937 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property to @value.
8938 *
8939 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
8940 */
8941void
8942sensor_match_set_state (SensorMatch *object, guchar value)
8943{
8944 g_object_set (G_OBJECT (object), "state", value, NULL);
8945}
8946
8947/**
8948 * sensor_match_emit_sensor_match:
8949 * @object: A #SensorMatch.
8950 * @arg_state: Argument to pass with the signal.
8951 *
8952 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorMatch.SensorMatch">"SensorMatch"</link> D-Bus signal.
8953 */
8954void
8955sensor_match_emit_sensor_match (
8956 SensorMatch *object,
8957 guchar arg_state)
8958{
8959 g_signal_emit_by_name (object, "sensor-match", arg_state);
8960}
8961
8962/* ------------------------------------------------------------------------ */
8963
8964/**
8965 * SensorMatchProxy:
8966 *
8967 * The #SensorMatchProxy structure contains only private data and should only be accessed using the provided API.
8968 */
8969
8970/**
8971 * SensorMatchProxyClass:
8972 * @parent_class: The parent class.
8973 *
8974 * Class structure for #SensorMatchProxy.
8975 */
8976
8977struct _SensorMatchProxyPrivate
8978{
8979 GData *qdata;
8980};
8981
8982static void sensor_match_proxy_iface_init (SensorMatchIface *iface);
8983
8984#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8985G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY,
8986 G_ADD_PRIVATE (SensorMatchProxy)
8987 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init));
8988
8989#else
8990G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY,
8991 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init));
8992
8993#endif
8994static void
8995sensor_match_proxy_finalize (GObject *object)
8996{
8997 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
8998 g_datalist_clear (&proxy->priv->qdata);
8999 G_OBJECT_CLASS (sensor_match_proxy_parent_class)->finalize (object);
9000}
9001
9002static void
9003sensor_match_proxy_get_property (GObject *object,
9004 guint prop_id,
9005 GValue *value,
9006 GParamSpec *pspec G_GNUC_UNUSED)
9007{
9008 const _ExtendedGDBusPropertyInfo *info;
9009 GVariant *variant;
9010 g_assert (prop_id != 0 && prop_id - 1 < 2);
9011 info = _sensor_match_property_info_pointers[prop_id - 1];
9012 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
9013 if (info->use_gvariant)
9014 {
9015 g_value_set_variant (value, variant);
9016 }
9017 else
9018 {
9019 if (variant != NULL)
9020 g_dbus_gvariant_to_gvalue (variant, value);
9021 }
9022 if (variant != NULL)
9023 g_variant_unref (variant);
9024}
9025
9026static void
9027sensor_match_proxy_set_property_cb (GDBusProxy *proxy,
9028 GAsyncResult *res,
9029 gpointer user_data)
9030{
9031 const _ExtendedGDBusPropertyInfo *info = user_data;
9032 GError *error;
9033 GVariant *_ret;
9034 error = NULL;
9035 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
9036 if (!_ret)
9037 {
9038 g_warning ("Error setting property '%s' on interface org.openbmc.SensorMatch: %s (%s, %d)",
9039 info->parent_struct.name,
9040 error->message, g_quark_to_string (error->domain), error->code);
9041 g_error_free (error);
9042 }
9043 else
9044 {
9045 g_variant_unref (_ret);
9046 }
9047}
9048
9049static void
9050sensor_match_proxy_set_property (GObject *object,
9051 guint prop_id,
9052 const GValue *value,
9053 GParamSpec *pspec G_GNUC_UNUSED)
9054{
9055 const _ExtendedGDBusPropertyInfo *info;
9056 GVariant *variant;
9057 g_assert (prop_id != 0 && prop_id - 1 < 2);
9058 info = _sensor_match_property_info_pointers[prop_id - 1];
9059 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
9060 g_dbus_proxy_call (G_DBUS_PROXY (object),
9061 "org.freedesktop.DBus.Properties.Set",
9062 g_variant_new ("(ssv)", "org.openbmc.SensorMatch", info->parent_struct.name, variant),
9063 G_DBUS_CALL_FLAGS_NONE,
9064 -1,
9065 NULL, (GAsyncReadyCallback) sensor_match_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
9066 g_variant_unref (variant);
9067}
9068
9069static void
9070sensor_match_proxy_g_signal (GDBusProxy *proxy,
9071 const gchar *sender_name G_GNUC_UNUSED,
9072 const gchar *signal_name,
9073 GVariant *parameters)
9074{
9075 _ExtendedGDBusSignalInfo *info;
9076 GVariantIter iter;
9077 GVariant *child;
9078 GValue *paramv;
9079 guint num_params;
9080 guint n;
9081 guint signal_id;
9082 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, signal_name);
9083 if (info == NULL)
9084 return;
9085 num_params = g_variant_n_children (parameters);
9086 paramv = g_new0 (GValue, num_params + 1);
9087 g_value_init (&paramv[0], TYPE_SENSOR_MATCH);
9088 g_value_set_object (&paramv[0], proxy);
9089 g_variant_iter_init (&iter, parameters);
9090 n = 1;
9091 while ((child = g_variant_iter_next_value (&iter)) != NULL)
9092 {
9093 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
9094 if (arg_info->use_gvariant)
9095 {
9096 g_value_init (&paramv[n], G_TYPE_VARIANT);
9097 g_value_set_variant (&paramv[n], child);
9098 n++;
9099 }
9100 else
9101 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
9102 g_variant_unref (child);
9103 }
9104 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH);
9105 g_signal_emitv (paramv, signal_id, 0, NULL);
9106 for (n = 0; n < num_params + 1; n++)
9107 g_value_unset (&paramv[n]);
9108 g_free (paramv);
9109}
9110
9111static void
9112sensor_match_proxy_g_properties_changed (GDBusProxy *_proxy,
9113 GVariant *changed_properties,
9114 const gchar *const *invalidated_properties)
9115{
9116 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (_proxy);
9117 guint n;
9118 const gchar *key;
9119 GVariantIter *iter;
9120 _ExtendedGDBusPropertyInfo *info;
9121 g_variant_get (changed_properties, "a{sv}", &iter);
9122 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
9123 {
9124 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, key);
9125 g_datalist_remove_data (&proxy->priv->qdata, key);
9126 if (info != NULL)
9127 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
9128 }
9129 g_variant_iter_free (iter);
9130 for (n = 0; invalidated_properties[n] != NULL; n++)
9131 {
9132 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, invalidated_properties[n]);
9133 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
9134 if (info != NULL)
9135 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
9136 }
9137}
9138
9139static GVariant *
9140sensor_match_proxy_get_match_value (SensorMatch *object)
9141{
9142 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9143 GVariant *variant;
9144 GVariant *value = NULL;
9145 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "match_value");
9146 value = variant;
9147 if (variant != NULL)
9148 g_variant_unref (variant);
9149 return value;
9150}
9151
9152static guchar
9153sensor_match_proxy_get_state (SensorMatch *object)
9154{
9155 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9156 GVariant *variant;
9157 guchar value = 0;
9158 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
9159 if (variant != NULL)
9160 {
9161 value = g_variant_get_byte (variant);
9162 g_variant_unref (variant);
9163 }
9164 return value;
9165}
9166
9167static void
9168sensor_match_proxy_init (SensorMatchProxy *proxy)
9169{
9170#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9171 proxy->priv = sensor_match_proxy_get_instance_private (proxy);
9172#else
9173 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_MATCH_PROXY, SensorMatchProxyPrivate);
9174#endif
9175
9176 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_match_interface_info ());
9177}
9178
9179static void
9180sensor_match_proxy_class_init (SensorMatchProxyClass *klass)
9181{
9182 GObjectClass *gobject_class;
9183 GDBusProxyClass *proxy_class;
9184
9185 gobject_class = G_OBJECT_CLASS (klass);
9186 gobject_class->finalize = sensor_match_proxy_finalize;
9187 gobject_class->get_property = sensor_match_proxy_get_property;
9188 gobject_class->set_property = sensor_match_proxy_set_property;
9189
9190 proxy_class = G_DBUS_PROXY_CLASS (klass);
9191 proxy_class->g_signal = sensor_match_proxy_g_signal;
9192 proxy_class->g_properties_changed = sensor_match_proxy_g_properties_changed;
9193
9194 sensor_match_override_properties (gobject_class, 1);
9195
9196#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
9197 g_type_class_add_private (klass, sizeof (SensorMatchProxyPrivate));
9198#endif
9199}
9200
9201static void
9202sensor_match_proxy_iface_init (SensorMatchIface *iface)
9203{
9204 iface->get_match_value = sensor_match_proxy_get_match_value;
9205 iface->get_state = sensor_match_proxy_get_state;
9206}
9207
9208/**
9209 * sensor_match_proxy_new:
9210 * @connection: A #GDBusConnection.
9211 * @flags: Flags from the #GDBusProxyFlags enumeration.
9212 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
9213 * @object_path: An object path.
9214 * @cancellable: (allow-none): A #GCancellable or %NULL.
9215 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
9216 * @user_data: User data to pass to @callback.
9217 *
9218 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. See g_dbus_proxy_new() for more details.
9219 *
9220 * 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.
9221 * You can then call sensor_match_proxy_new_finish() to get the result of the operation.
9222 *
9223 * See sensor_match_proxy_new_sync() for the synchronous, blocking version of this constructor.
9224 */
9225void
9226sensor_match_proxy_new (
9227 GDBusConnection *connection,
9228 GDBusProxyFlags flags,
9229 const gchar *name,
9230 const gchar *object_path,
9231 GCancellable *cancellable,
9232 GAsyncReadyCallback callback,
9233 gpointer user_data)
9234{
9235 g_async_initable_new_async (TYPE_SENSOR_MATCH_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.SensorMatch", NULL);
9236}
9237
9238/**
9239 * sensor_match_proxy_new_finish:
9240 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new().
9241 * @error: Return location for error or %NULL
9242 *
9243 * Finishes an operation started with sensor_match_proxy_new().
9244 *
9245 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9246 */
9247SensorMatch *
9248sensor_match_proxy_new_finish (
9249 GAsyncResult *res,
9250 GError **error)
9251{
9252 GObject *ret;
9253 GObject *source_object;
9254 source_object = g_async_result_get_source_object (res);
9255 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
9256 g_object_unref (source_object);
9257 if (ret != NULL)
9258 return SENSOR_MATCH (ret);
9259 else
9260 return NULL;
9261}
9262
9263/**
9264 * sensor_match_proxy_new_sync:
9265 * @connection: A #GDBusConnection.
9266 * @flags: Flags from the #GDBusProxyFlags enumeration.
9267 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
9268 * @object_path: An object path.
9269 * @cancellable: (allow-none): A #GCancellable or %NULL.
9270 * @error: Return location for error or %NULL
9271 *
9272 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. See g_dbus_proxy_new_sync() for more details.
9273 *
9274 * The calling thread is blocked until a reply is received.
9275 *
9276 * See sensor_match_proxy_new() for the asynchronous version of this constructor.
9277 *
9278 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9279 */
9280SensorMatch *
9281sensor_match_proxy_new_sync (
9282 GDBusConnection *connection,
9283 GDBusProxyFlags flags,
9284 const gchar *name,
9285 const gchar *object_path,
9286 GCancellable *cancellable,
9287 GError **error)
9288{
9289 GInitable *ret;
9290 ret = g_initable_new (TYPE_SENSOR_MATCH_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorMatch", NULL);
9291 if (ret != NULL)
9292 return SENSOR_MATCH (ret);
9293 else
9294 return NULL;
9295}
9296
9297
9298/**
9299 * sensor_match_proxy_new_for_bus:
9300 * @bus_type: A #GBusType.
9301 * @flags: Flags from the #GDBusProxyFlags enumeration.
9302 * @name: A bus name (well-known or unique).
9303 * @object_path: An object path.
9304 * @cancellable: (allow-none): A #GCancellable or %NULL.
9305 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
9306 * @user_data: User data to pass to @callback.
9307 *
9308 * Like sensor_match_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
9309 *
9310 * 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.
9311 * You can then call sensor_match_proxy_new_for_bus_finish() to get the result of the operation.
9312 *
9313 * See sensor_match_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
9314 */
9315void
9316sensor_match_proxy_new_for_bus (
9317 GBusType bus_type,
9318 GDBusProxyFlags flags,
9319 const gchar *name,
9320 const gchar *object_path,
9321 GCancellable *cancellable,
9322 GAsyncReadyCallback callback,
9323 gpointer user_data)
9324{
9325 g_async_initable_new_async (TYPE_SENSOR_MATCH_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.SensorMatch", NULL);
9326}
9327
9328/**
9329 * sensor_match_proxy_new_for_bus_finish:
9330 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new_for_bus().
9331 * @error: Return location for error or %NULL
9332 *
9333 * Finishes an operation started with sensor_match_proxy_new_for_bus().
9334 *
9335 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9336 */
9337SensorMatch *
9338sensor_match_proxy_new_for_bus_finish (
9339 GAsyncResult *res,
9340 GError **error)
9341{
9342 GObject *ret;
9343 GObject *source_object;
9344 source_object = g_async_result_get_source_object (res);
9345 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
9346 g_object_unref (source_object);
9347 if (ret != NULL)
9348 return SENSOR_MATCH (ret);
9349 else
9350 return NULL;
9351}
9352
9353/**
9354 * sensor_match_proxy_new_for_bus_sync:
9355 * @bus_type: A #GBusType.
9356 * @flags: Flags from the #GDBusProxyFlags enumeration.
9357 * @name: A bus name (well-known or unique).
9358 * @object_path: An object path.
9359 * @cancellable: (allow-none): A #GCancellable or %NULL.
9360 * @error: Return location for error or %NULL
9361 *
9362 * Like sensor_match_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
9363 *
9364 * The calling thread is blocked until a reply is received.
9365 *
9366 * See sensor_match_proxy_new_for_bus() for the asynchronous version of this constructor.
9367 *
9368 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9369 */
9370SensorMatch *
9371sensor_match_proxy_new_for_bus_sync (
9372 GBusType bus_type,
9373 GDBusProxyFlags flags,
9374 const gchar *name,
9375 const gchar *object_path,
9376 GCancellable *cancellable,
9377 GError **error)
9378{
9379 GInitable *ret;
9380 ret = g_initable_new (TYPE_SENSOR_MATCH_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorMatch", NULL);
9381 if (ret != NULL)
9382 return SENSOR_MATCH (ret);
9383 else
9384 return NULL;
9385}
9386
9387
9388/* ------------------------------------------------------------------------ */
9389
9390/**
9391 * SensorMatchSkeleton:
9392 *
9393 * The #SensorMatchSkeleton structure contains only private data and should only be accessed using the provided API.
9394 */
9395
9396/**
9397 * SensorMatchSkeletonClass:
9398 * @parent_class: The parent class.
9399 *
9400 * Class structure for #SensorMatchSkeleton.
9401 */
9402
9403struct _SensorMatchSkeletonPrivate
9404{
9405 GValue *properties;
9406 GList *changed_properties;
9407 GSource *changed_properties_idle_source;
9408 GMainContext *context;
9409 GMutex lock;
9410};
9411
9412static void
9413_sensor_match_skeleton_handle_method_call (
9414 GDBusConnection *connection G_GNUC_UNUSED,
9415 const gchar *sender G_GNUC_UNUSED,
9416 const gchar *object_path G_GNUC_UNUSED,
9417 const gchar *interface_name,
9418 const gchar *method_name,
9419 GVariant *parameters,
9420 GDBusMethodInvocation *invocation,
9421 gpointer user_data)
9422{
9423 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9424 _ExtendedGDBusMethodInfo *info;
9425 GVariantIter iter;
9426 GVariant *child;
9427 GValue *paramv;
9428 guint num_params;
9429 guint num_extra;
9430 guint n;
9431 guint signal_id;
9432 GValue return_value = G_VALUE_INIT;
9433 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
9434 g_assert (info != NULL);
9435 num_params = g_variant_n_children (parameters);
9436 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
9437 n = 0;
9438 g_value_init (&paramv[n], TYPE_SENSOR_MATCH);
9439 g_value_set_object (&paramv[n++], skeleton);
9440 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
9441 g_value_set_object (&paramv[n++], invocation);
9442 if (info->pass_fdlist)
9443 {
9444#ifdef G_OS_UNIX
9445 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
9446 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
9447#else
9448 g_assert_not_reached ();
9449#endif
9450 }
9451 g_variant_iter_init (&iter, parameters);
9452 while ((child = g_variant_iter_next_value (&iter)) != NULL)
9453 {
9454 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
9455 if (arg_info->use_gvariant)
9456 {
9457 g_value_init (&paramv[n], G_TYPE_VARIANT);
9458 g_value_set_variant (&paramv[n], child);
9459 n++;
9460 }
9461 else
9462 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
9463 g_variant_unref (child);
9464 }
9465 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH);
9466 g_value_init (&return_value, G_TYPE_BOOLEAN);
9467 g_signal_emitv (paramv, signal_id, 0, &return_value);
9468 if (!g_value_get_boolean (&return_value))
9469 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);
9470 g_value_unset (&return_value);
9471 for (n = 0; n < num_params + num_extra; n++)
9472 g_value_unset (&paramv[n]);
9473 g_free (paramv);
9474}
9475
9476static GVariant *
9477_sensor_match_skeleton_handle_get_property (
9478 GDBusConnection *connection G_GNUC_UNUSED,
9479 const gchar *sender G_GNUC_UNUSED,
9480 const gchar *object_path G_GNUC_UNUSED,
9481 const gchar *interface_name G_GNUC_UNUSED,
9482 const gchar *property_name,
9483 GError **error,
9484 gpointer user_data)
9485{
9486 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9487 GValue value = G_VALUE_INIT;
9488 GParamSpec *pspec;
9489 _ExtendedGDBusPropertyInfo *info;
9490 GVariant *ret;
9491 ret = NULL;
9492 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name);
9493 g_assert (info != NULL);
9494 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
9495 if (pspec == NULL)
9496 {
9497 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
9498 }
9499 else
9500 {
9501 g_value_init (&value, pspec->value_type);
9502 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
9503 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
9504 g_value_unset (&value);
9505 }
9506 return ret;
9507}
9508
9509static gboolean
9510_sensor_match_skeleton_handle_set_property (
9511 GDBusConnection *connection G_GNUC_UNUSED,
9512 const gchar *sender G_GNUC_UNUSED,
9513 const gchar *object_path G_GNUC_UNUSED,
9514 const gchar *interface_name G_GNUC_UNUSED,
9515 const gchar *property_name,
9516 GVariant *variant,
9517 GError **error,
9518 gpointer user_data)
9519{
9520 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9521 GValue value = G_VALUE_INIT;
9522 GParamSpec *pspec;
9523 _ExtendedGDBusPropertyInfo *info;
9524 gboolean ret;
9525 ret = FALSE;
9526 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name);
9527 g_assert (info != NULL);
9528 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
9529 if (pspec == NULL)
9530 {
9531 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
9532 }
9533 else
9534 {
9535 if (info->use_gvariant)
9536 g_value_set_variant (&value, variant);
9537 else
9538 g_dbus_gvariant_to_gvalue (variant, &value);
9539 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
9540 g_value_unset (&value);
9541 ret = TRUE;
9542 }
9543 return ret;
9544}
9545
9546static const GDBusInterfaceVTable _sensor_match_skeleton_vtable =
9547{
9548 _sensor_match_skeleton_handle_method_call,
9549 _sensor_match_skeleton_handle_get_property,
9550 _sensor_match_skeleton_handle_set_property,
9551 {NULL}
9552};
9553
9554static GDBusInterfaceInfo *
9555sensor_match_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
9556{
9557 return sensor_match_interface_info ();
9558}
9559
9560static GDBusInterfaceVTable *
9561sensor_match_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
9562{
9563 return (GDBusInterfaceVTable *) &_sensor_match_skeleton_vtable;
9564}
9565
9566static GVariant *
9567sensor_match_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
9568{
9569 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton);
9570
9571 GVariantBuilder builder;
9572 guint n;
9573 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
9574 if (_sensor_match_interface_info.parent_struct.properties == NULL)
9575 goto out;
9576 for (n = 0; _sensor_match_interface_info.parent_struct.properties[n] != NULL; n++)
9577 {
9578 GDBusPropertyInfo *info = _sensor_match_interface_info.parent_struct.properties[n];
9579 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
9580 {
9581 GVariant *value;
9582 value = _sensor_match_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.SensorMatch", info->name, NULL, skeleton);
9583 if (value != NULL)
9584 {
9585 g_variant_take_ref (value);
9586 g_variant_builder_add (&builder, "{sv}", info->name, value);
9587 g_variant_unref (value);
9588 }
9589 }
9590 }
9591out:
9592 return g_variant_builder_end (&builder);
9593}
9594
9595static gboolean _sensor_match_emit_changed (gpointer user_data);
9596
9597static void
9598sensor_match_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
9599{
9600 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton);
9601 gboolean emit_changed = FALSE;
9602
9603 g_mutex_lock (&skeleton->priv->lock);
9604 if (skeleton->priv->changed_properties_idle_source != NULL)
9605 {
9606 g_source_destroy (skeleton->priv->changed_properties_idle_source);
9607 skeleton->priv->changed_properties_idle_source = NULL;
9608 emit_changed = TRUE;
9609 }
9610 g_mutex_unlock (&skeleton->priv->lock);
9611
9612 if (emit_changed)
9613 _sensor_match_emit_changed (skeleton);
9614}
9615
9616static void
9617_sensor_match_on_signal_sensor_match (
9618 SensorMatch *object,
9619 guchar arg_state)
9620{
9621 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9622
9623 GList *connections, *l;
9624 GVariant *signal_variant;
9625 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
9626
9627 signal_variant = g_variant_ref_sink (g_variant_new ("(y)",
9628 arg_state));
9629 for (l = connections; l != NULL; l = l->next)
9630 {
9631 GDBusConnection *connection = l->data;
9632 g_dbus_connection_emit_signal (connection,
9633 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorMatch", "SensorMatch",
9634 signal_variant, NULL);
9635 }
9636 g_variant_unref (signal_variant);
9637 g_list_free_full (connections, g_object_unref);
9638}
9639
9640static void sensor_match_skeleton_iface_init (SensorMatchIface *iface);
9641#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9642G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
9643 G_ADD_PRIVATE (SensorMatchSkeleton)
9644 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init));
9645
9646#else
9647G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
9648 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init));
9649
9650#endif
9651static void
9652sensor_match_skeleton_finalize (GObject *object)
9653{
9654 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9655 guint n;
9656 for (n = 0; n < 2; n++)
9657 g_value_unset (&skeleton->priv->properties[n]);
9658 g_free (skeleton->priv->properties);
9659 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
9660 if (skeleton->priv->changed_properties_idle_source != NULL)
9661 g_source_destroy (skeleton->priv->changed_properties_idle_source);
9662 g_main_context_unref (skeleton->priv->context);
9663 g_mutex_clear (&skeleton->priv->lock);
9664 G_OBJECT_CLASS (sensor_match_skeleton_parent_class)->finalize (object);
9665}
9666
9667static void
9668sensor_match_skeleton_get_property (GObject *object,
9669 guint prop_id,
9670 GValue *value,
9671 GParamSpec *pspec G_GNUC_UNUSED)
9672{
9673 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9674 g_assert (prop_id != 0 && prop_id - 1 < 2);
9675 g_mutex_lock (&skeleton->priv->lock);
9676 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
9677 g_mutex_unlock (&skeleton->priv->lock);
9678}
9679
9680static gboolean
9681_sensor_match_emit_changed (gpointer user_data)
9682{
9683 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9684 GList *l;
9685 GVariantBuilder builder;
9686 GVariantBuilder invalidated_builder;
9687 guint num_changes;
9688
9689 g_mutex_lock (&skeleton->priv->lock);
9690 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
9691 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
9692 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
9693 {
9694 ChangedProperty *cp = l->data;
9695 GVariant *variant;
9696 const GValue *cur_value;
9697
9698 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
9699 if (!_g_value_equal (cur_value, &cp->orig_value))
9700 {
9701 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
9702 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
9703 g_variant_unref (variant);
9704 num_changes++;
9705 }
9706 }
9707 if (num_changes > 0)
9708 {
9709 GList *connections, *ll;
9710 GVariant *signal_variant;
9711 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorMatch",
9712 &builder, &invalidated_builder));
9713 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
9714 for (ll = connections; ll != NULL; ll = ll->next)
9715 {
9716 GDBusConnection *connection = ll->data;
9717
9718 g_dbus_connection_emit_signal (connection,
9719 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
9720 "org.freedesktop.DBus.Properties",
9721 "PropertiesChanged",
9722 signal_variant,
9723 NULL);
9724 }
9725 g_variant_unref (signal_variant);
9726 g_list_free_full (connections, g_object_unref);
9727 }
9728 else
9729 {
9730 g_variant_builder_clear (&builder);
9731 g_variant_builder_clear (&invalidated_builder);
9732 }
9733 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
9734 skeleton->priv->changed_properties = NULL;
9735 skeleton->priv->changed_properties_idle_source = NULL;
9736 g_mutex_unlock (&skeleton->priv->lock);
9737 return FALSE;
9738}
9739
9740static void
9741_sensor_match_schedule_emit_changed (SensorMatchSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
9742{
9743 ChangedProperty *cp;
9744 GList *l;
9745 cp = NULL;
9746 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
9747 {
9748 ChangedProperty *i_cp = l->data;
9749 if (i_cp->info == info)
9750 {
9751 cp = i_cp;
9752 break;
9753 }
9754 }
9755 if (cp == NULL)
9756 {
9757 cp = g_new0 (ChangedProperty, 1);
9758 cp->prop_id = prop_id;
9759 cp->info = info;
9760 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
9761 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
9762 g_value_copy (orig_value, &cp->orig_value);
9763 }
9764}
9765
9766static void
9767sensor_match_skeleton_notify (GObject *object,
9768 GParamSpec *pspec G_GNUC_UNUSED)
9769{
9770 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9771 g_mutex_lock (&skeleton->priv->lock);
9772 if (skeleton->priv->changed_properties != NULL &&
9773 skeleton->priv->changed_properties_idle_source == NULL)
9774 {
9775 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
9776 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
9777 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_match_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
9778 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
9779 g_source_unref (skeleton->priv->changed_properties_idle_source);
9780 }
9781 g_mutex_unlock (&skeleton->priv->lock);
9782}
9783
9784static void
9785sensor_match_skeleton_set_property (GObject *object,
9786 guint prop_id,
9787 const GValue *value,
9788 GParamSpec *pspec)
9789{
9790 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9791 g_assert (prop_id != 0 && prop_id - 1 < 2);
9792 g_mutex_lock (&skeleton->priv->lock);
9793 g_object_freeze_notify (object);
9794 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
9795 {
9796 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
9797 _sensor_match_schedule_emit_changed (skeleton, _sensor_match_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
9798 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
9799 g_object_notify_by_pspec (object, pspec);
9800 }
9801 g_mutex_unlock (&skeleton->priv->lock);
9802 g_object_thaw_notify (object);
9803}
9804
9805static void
9806sensor_match_skeleton_init (SensorMatchSkeleton *skeleton)
9807{
9808#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9809 skeleton->priv = sensor_match_skeleton_get_instance_private (skeleton);
9810#else
9811 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_MATCH_SKELETON, SensorMatchSkeletonPrivate);
9812#endif
9813
9814 g_mutex_init (&skeleton->priv->lock);
9815 skeleton->priv->context = g_main_context_ref_thread_default ();
9816 skeleton->priv->properties = g_new0 (GValue, 2);
9817 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
9818 g_value_init (&skeleton->priv->properties[1], G_TYPE_UCHAR);
9819}
9820
9821static GVariant *
9822sensor_match_skeleton_get_match_value (SensorMatch *object)
9823{
9824 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9825 GVariant *value;
9826 g_mutex_lock (&skeleton->priv->lock);
9827 value = g_value_get_variant (&(skeleton->priv->properties[0]));
9828 g_mutex_unlock (&skeleton->priv->lock);
9829 return value;
9830}
9831
9832static guchar
9833sensor_match_skeleton_get_state (SensorMatch *object)
9834{
9835 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9836 guchar value;
9837 g_mutex_lock (&skeleton->priv->lock);
9838 value = g_value_get_uchar (&(skeleton->priv->properties[1]));
9839 g_mutex_unlock (&skeleton->priv->lock);
9840 return value;
9841}
9842
9843static void
9844sensor_match_skeleton_class_init (SensorMatchSkeletonClass *klass)
9845{
9846 GObjectClass *gobject_class;
9847 GDBusInterfaceSkeletonClass *skeleton_class;
9848
9849 gobject_class = G_OBJECT_CLASS (klass);
9850 gobject_class->finalize = sensor_match_skeleton_finalize;
9851 gobject_class->get_property = sensor_match_skeleton_get_property;
9852 gobject_class->set_property = sensor_match_skeleton_set_property;
9853 gobject_class->notify = sensor_match_skeleton_notify;
9854
9855
9856 sensor_match_override_properties (gobject_class, 1);
9857
9858 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
9859 skeleton_class->get_info = sensor_match_skeleton_dbus_interface_get_info;
9860 skeleton_class->get_properties = sensor_match_skeleton_dbus_interface_get_properties;
9861 skeleton_class->flush = sensor_match_skeleton_dbus_interface_flush;
9862 skeleton_class->get_vtable = sensor_match_skeleton_dbus_interface_get_vtable;
9863
9864#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
9865 g_type_class_add_private (klass, sizeof (SensorMatchSkeletonPrivate));
9866#endif
9867}
9868
9869static void
9870sensor_match_skeleton_iface_init (SensorMatchIface *iface)
9871{
9872 iface->sensor_match = _sensor_match_on_signal_sensor_match;
9873 iface->get_match_value = sensor_match_skeleton_get_match_value;
9874 iface->get_state = sensor_match_skeleton_get_state;
9875}
9876
9877/**
9878 * sensor_match_skeleton_new:
9879 *
9880 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
9881 *
9882 * Returns: (transfer full) (type SensorMatchSkeleton): The skeleton object.
9883 */
9884SensorMatch *
9885sensor_match_skeleton_new (void)
9886{
9887 return SENSOR_MATCH (g_object_new (TYPE_SENSOR_MATCH_SKELETON, NULL));
9888}
9889
9890/* ------------------------------------------------------------------------
9891 * Code for interface org.openbmc.Process
9892 * ------------------------------------------------------------------------
9893 */
9894
9895/**
9896 * SECTION:Process
9897 * @title: Process
9898 * @short_description: Generated C code for the org.openbmc.Process D-Bus interface
9899 *
9900 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> D-Bus interface in C.
9901 */
9902
9903/* ---- Introspection data for org.openbmc.Process ---- */
9904
9905static const _ExtendedGDBusMethodInfo _process_method_info_stop =
9906{
9907 {
9908 -1,
9909 (gchar *) "stop",
9910 NULL,
9911 NULL,
9912 NULL
9913 },
9914 "handle-stop",
9915 FALSE
9916};
9917
9918static const _ExtendedGDBusMethodInfo * const _process_method_info_pointers[] =
9919{
9920 &_process_method_info_stop,
9921 NULL
9922};
9923
9924static const _ExtendedGDBusInterfaceInfo _process_interface_info =
9925{
9926 {
9927 -1,
9928 (gchar *) "org.openbmc.Process",
9929 (GDBusMethodInfo **) &_process_method_info_pointers,
9930 NULL,
9931 NULL,
9932 NULL
9933 },
9934 "process",
9935};
9936
9937
9938/**
9939 * process_interface_info:
9940 *
9941 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> D-Bus interface.
9942 *
9943 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
9944 */
9945GDBusInterfaceInfo *
9946process_interface_info (void)
9947{
9948 return (GDBusInterfaceInfo *) &_process_interface_info.parent_struct;
9949}
9950
9951/**
9952 * process_override_properties:
9953 * @klass: The class structure for a #GObject<!-- -->-derived class.
9954 * @property_id_begin: The property id to assign to the first overridden property.
9955 *
9956 * Overrides all #GObject properties in the #Process interface for a concrete class.
9957 * The properties are overridden in the order they are defined.
9958 *
9959 * Returns: The last property id.
9960 */
9961guint
9962process_override_properties (GObjectClass *klass, guint property_id_begin)
9963{
9964 return property_id_begin - 1;
9965}
9966
9967
9968
9969/**
9970 * Process:
9971 *
9972 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
9973 */
9974
9975/**
9976 * ProcessIface:
9977 * @parent_iface: The parent interface.
9978 * @handle_stop: Handler for the #Process::handle-stop signal.
9979 *
9980 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
9981 */
9982
9983typedef ProcessIface ProcessInterface;
9984G_DEFINE_INTERFACE (Process, process, G_TYPE_OBJECT);
9985
9986static void
9987process_default_init (ProcessIface *iface)
9988{
9989 /* GObject signals for incoming D-Bus method calls: */
9990 /**
9991 * Process::handle-stop:
9992 * @object: A #Process.
9993 * @invocation: A #GDBusMethodInvocation.
9994 *
9995 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method.
9996 *
9997 * 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 process_complete_stop() 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.
9998 *
9999 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
10000 */
10001 g_signal_new ("handle-stop",
10002 G_TYPE_FROM_INTERFACE (iface),
10003 G_SIGNAL_RUN_LAST,
10004 G_STRUCT_OFFSET (ProcessIface, handle_stop),
10005 g_signal_accumulator_true_handled,
10006 NULL,
10007 g_cclosure_marshal_generic,
10008 G_TYPE_BOOLEAN,
10009 1,
10010 G_TYPE_DBUS_METHOD_INVOCATION);
10011
10012}
10013
10014/**
10015 * process_call_stop:
10016 * @proxy: A #ProcessProxy.
10017 * @cancellable: (allow-none): A #GCancellable or %NULL.
10018 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
10019 * @user_data: User data to pass to @callback.
10020 *
10021 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method on @proxy.
10022 * 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.
10023 * You can then call process_call_stop_finish() to get the result of the operation.
10024 *
10025 * See process_call_stop_sync() for the synchronous, blocking version of this method.
10026 */
10027void
10028process_call_stop (
10029 Process *proxy,
10030 GCancellable *cancellable,
10031 GAsyncReadyCallback callback,
10032 gpointer user_data)
10033{
10034 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
10035 "stop",
10036 g_variant_new ("()"),
10037 G_DBUS_CALL_FLAGS_NONE,
10038 -1,
10039 cancellable,
10040 callback,
10041 user_data);
10042}
10043
10044/**
10045 * process_call_stop_finish:
10046 * @proxy: A #ProcessProxy.
10047 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_call_stop().
10048 * @error: Return location for error or %NULL.
10049 *
10050 * Finishes an operation started with process_call_stop().
10051 *
10052 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
10053 */
10054gboolean
10055process_call_stop_finish (
10056 Process *proxy,
10057 GAsyncResult *res,
10058 GError **error)
10059{
10060 GVariant *_ret;
10061 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
10062 if (_ret == NULL)
10063 goto _out;
10064 g_variant_get (_ret,
10065 "()");
10066 g_variant_unref (_ret);
10067_out:
10068 return _ret != NULL;
10069}
10070
10071/**
10072 * process_call_stop_sync:
10073 * @proxy: A #ProcessProxy.
10074 * @cancellable: (allow-none): A #GCancellable or %NULL.
10075 * @error: Return location for error or %NULL.
10076 *
10077 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
10078 *
10079 * See process_call_stop() for the asynchronous version of this method.
10080 *
10081 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
10082 */
10083gboolean
10084process_call_stop_sync (
10085 Process *proxy,
10086 GCancellable *cancellable,
10087 GError **error)
10088{
10089 GVariant *_ret;
10090 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
10091 "stop",
10092 g_variant_new ("()"),
10093 G_DBUS_CALL_FLAGS_NONE,
10094 -1,
10095 cancellable,
10096 error);
10097 if (_ret == NULL)
10098 goto _out;
10099 g_variant_get (_ret,
10100 "()");
10101 g_variant_unref (_ret);
10102_out:
10103 return _ret != NULL;
10104}
10105
10106/**
10107 * process_complete_stop:
10108 * @object: A #Process.
10109 * @invocation: (transfer full): A #GDBusMethodInvocation.
10110 *
10111 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</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.
10112 *
10113 * This method will free @invocation, you cannot use it afterwards.
10114 */
10115void
10116process_complete_stop (
10117 Process *object,
10118 GDBusMethodInvocation *invocation)
10119{
10120 g_dbus_method_invocation_return_value (invocation,
10121 g_variant_new ("()"));
10122}
10123
10124/* ------------------------------------------------------------------------ */
10125
10126/**
10127 * ProcessProxy:
10128 *
10129 * The #ProcessProxy structure contains only private data and should only be accessed using the provided API.
10130 */
10131
10132/**
10133 * ProcessProxyClass:
10134 * @parent_class: The parent class.
10135 *
10136 * Class structure for #ProcessProxy.
10137 */
10138
10139struct _ProcessProxyPrivate
10140{
10141 GData *qdata;
10142};
10143
10144static void process_proxy_iface_init (ProcessIface *iface);
10145
10146#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10147G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY,
10148 G_ADD_PRIVATE (ProcessProxy)
10149 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init));
10150
10151#else
10152G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY,
10153 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init));
10154
10155#endif
10156static void
10157process_proxy_finalize (GObject *object)
10158{
10159 ProcessProxy *proxy = PROCESS_PROXY (object);
10160 g_datalist_clear (&proxy->priv->qdata);
10161 G_OBJECT_CLASS (process_proxy_parent_class)->finalize (object);
10162}
10163
10164static void
10165process_proxy_get_property (GObject *object,
10166 guint prop_id,
10167 GValue *value,
10168 GParamSpec *pspec G_GNUC_UNUSED)
10169{
10170}
10171
10172static void
10173process_proxy_set_property (GObject *object,
10174 guint prop_id,
10175 const GValue *value,
10176 GParamSpec *pspec G_GNUC_UNUSED)
10177{
10178}
10179
10180static void
10181process_proxy_g_signal (GDBusProxy *proxy,
10182 const gchar *sender_name G_GNUC_UNUSED,
10183 const gchar *signal_name,
10184 GVariant *parameters)
10185{
10186 _ExtendedGDBusSignalInfo *info;
10187 GVariantIter iter;
10188 GVariant *child;
10189 GValue *paramv;
10190 guint num_params;
10191 guint n;
10192 guint signal_id;
10193 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, signal_name);
10194 if (info == NULL)
10195 return;
10196 num_params = g_variant_n_children (parameters);
10197 paramv = g_new0 (GValue, num_params + 1);
10198 g_value_init (&paramv[0], TYPE_PROCESS);
10199 g_value_set_object (&paramv[0], proxy);
10200 g_variant_iter_init (&iter, parameters);
10201 n = 1;
10202 while ((child = g_variant_iter_next_value (&iter)) != NULL)
10203 {
10204 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
10205 if (arg_info->use_gvariant)
10206 {
10207 g_value_init (&paramv[n], G_TYPE_VARIANT);
10208 g_value_set_variant (&paramv[n], child);
10209 n++;
10210 }
10211 else
10212 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
10213 g_variant_unref (child);
10214 }
10215 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS);
10216 g_signal_emitv (paramv, signal_id, 0, NULL);
10217 for (n = 0; n < num_params + 1; n++)
10218 g_value_unset (&paramv[n]);
10219 g_free (paramv);
10220}
10221
10222static void
10223process_proxy_g_properties_changed (GDBusProxy *_proxy,
10224 GVariant *changed_properties,
10225 const gchar *const *invalidated_properties)
10226{
10227 ProcessProxy *proxy = PROCESS_PROXY (_proxy);
10228 guint n;
10229 const gchar *key;
10230 GVariantIter *iter;
10231 _ExtendedGDBusPropertyInfo *info;
10232 g_variant_get (changed_properties, "a{sv}", &iter);
10233 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
10234 {
10235 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, key);
10236 g_datalist_remove_data (&proxy->priv->qdata, key);
10237 if (info != NULL)
10238 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
10239 }
10240 g_variant_iter_free (iter);
10241 for (n = 0; invalidated_properties[n] != NULL; n++)
10242 {
10243 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, invalidated_properties[n]);
10244 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
10245 if (info != NULL)
10246 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
10247 }
10248}
10249
10250static void
10251process_proxy_init (ProcessProxy *proxy)
10252{
10253#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10254 proxy->priv = process_proxy_get_instance_private (proxy);
10255#else
10256 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_PROCESS_PROXY, ProcessProxyPrivate);
10257#endif
10258
10259 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), process_interface_info ());
10260}
10261
10262static void
10263process_proxy_class_init (ProcessProxyClass *klass)
10264{
10265 GObjectClass *gobject_class;
10266 GDBusProxyClass *proxy_class;
10267
10268 gobject_class = G_OBJECT_CLASS (klass);
10269 gobject_class->finalize = process_proxy_finalize;
10270 gobject_class->get_property = process_proxy_get_property;
10271 gobject_class->set_property = process_proxy_set_property;
10272
10273 proxy_class = G_DBUS_PROXY_CLASS (klass);
10274 proxy_class->g_signal = process_proxy_g_signal;
10275 proxy_class->g_properties_changed = process_proxy_g_properties_changed;
10276
10277#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
10278 g_type_class_add_private (klass, sizeof (ProcessProxyPrivate));
10279#endif
10280}
10281
10282static void
10283process_proxy_iface_init (ProcessIface *iface)
10284{
10285}
10286
10287/**
10288 * process_proxy_new:
10289 * @connection: A #GDBusConnection.
10290 * @flags: Flags from the #GDBusProxyFlags enumeration.
10291 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
10292 * @object_path: An object path.
10293 * @cancellable: (allow-none): A #GCancellable or %NULL.
10294 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
10295 * @user_data: User data to pass to @callback.
10296 *
10297 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>. See g_dbus_proxy_new() for more details.
10298 *
10299 * 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.
10300 * You can then call process_proxy_new_finish() to get the result of the operation.
10301 *
10302 * See process_proxy_new_sync() for the synchronous, blocking version of this constructor.
10303 */
10304void
10305process_proxy_new (
10306 GDBusConnection *connection,
10307 GDBusProxyFlags flags,
10308 const gchar *name,
10309 const gchar *object_path,
10310 GCancellable *cancellable,
10311 GAsyncReadyCallback callback,
10312 gpointer user_data)
10313{
10314 g_async_initable_new_async (TYPE_PROCESS_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.Process", NULL);
10315}
10316
10317/**
10318 * process_proxy_new_finish:
10319 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new().
10320 * @error: Return location for error or %NULL
10321 *
10322 * Finishes an operation started with process_proxy_new().
10323 *
10324 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10325 */
10326Process *
10327process_proxy_new_finish (
10328 GAsyncResult *res,
10329 GError **error)
10330{
10331 GObject *ret;
10332 GObject *source_object;
10333 source_object = g_async_result_get_source_object (res);
10334 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
10335 g_object_unref (source_object);
10336 if (ret != NULL)
10337 return PROCESS (ret);
10338 else
10339 return NULL;
10340}
10341
10342/**
10343 * process_proxy_new_sync:
10344 * @connection: A #GDBusConnection.
10345 * @flags: Flags from the #GDBusProxyFlags enumeration.
10346 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
10347 * @object_path: An object path.
10348 * @cancellable: (allow-none): A #GCancellable or %NULL.
10349 * @error: Return location for error or %NULL
10350 *
10351 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>. See g_dbus_proxy_new_sync() for more details.
10352 *
10353 * The calling thread is blocked until a reply is received.
10354 *
10355 * See process_proxy_new() for the asynchronous version of this constructor.
10356 *
10357 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10358 */
10359Process *
10360process_proxy_new_sync (
10361 GDBusConnection *connection,
10362 GDBusProxyFlags flags,
10363 const gchar *name,
10364 const gchar *object_path,
10365 GCancellable *cancellable,
10366 GError **error)
10367{
10368 GInitable *ret;
10369 ret = g_initable_new (TYPE_PROCESS_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Process", NULL);
10370 if (ret != NULL)
10371 return PROCESS (ret);
10372 else
10373 return NULL;
10374}
10375
10376
10377/**
10378 * process_proxy_new_for_bus:
10379 * @bus_type: A #GBusType.
10380 * @flags: Flags from the #GDBusProxyFlags enumeration.
10381 * @name: A bus name (well-known or unique).
10382 * @object_path: An object path.
10383 * @cancellable: (allow-none): A #GCancellable or %NULL.
10384 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
10385 * @user_data: User data to pass to @callback.
10386 *
10387 * Like process_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
10388 *
10389 * 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.
10390 * You can then call process_proxy_new_for_bus_finish() to get the result of the operation.
10391 *
10392 * See process_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
10393 */
10394void
10395process_proxy_new_for_bus (
10396 GBusType bus_type,
10397 GDBusProxyFlags flags,
10398 const gchar *name,
10399 const gchar *object_path,
10400 GCancellable *cancellable,
10401 GAsyncReadyCallback callback,
10402 gpointer user_data)
10403{
10404 g_async_initable_new_async (TYPE_PROCESS_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.Process", NULL);
10405}
10406
10407/**
10408 * process_proxy_new_for_bus_finish:
10409 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new_for_bus().
10410 * @error: Return location for error or %NULL
10411 *
10412 * Finishes an operation started with process_proxy_new_for_bus().
10413 *
10414 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10415 */
10416Process *
10417process_proxy_new_for_bus_finish (
10418 GAsyncResult *res,
10419 GError **error)
10420{
10421 GObject *ret;
10422 GObject *source_object;
10423 source_object = g_async_result_get_source_object (res);
10424 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
10425 g_object_unref (source_object);
10426 if (ret != NULL)
10427 return PROCESS (ret);
10428 else
10429 return NULL;
10430}
10431
10432/**
10433 * process_proxy_new_for_bus_sync:
10434 * @bus_type: A #GBusType.
10435 * @flags: Flags from the #GDBusProxyFlags enumeration.
10436 * @name: A bus name (well-known or unique).
10437 * @object_path: An object path.
10438 * @cancellable: (allow-none): A #GCancellable or %NULL.
10439 * @error: Return location for error or %NULL
10440 *
10441 * Like process_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
10442 *
10443 * The calling thread is blocked until a reply is received.
10444 *
10445 * See process_proxy_new_for_bus() for the asynchronous version of this constructor.
10446 *
10447 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10448 */
10449Process *
10450process_proxy_new_for_bus_sync (
10451 GBusType bus_type,
10452 GDBusProxyFlags flags,
10453 const gchar *name,
10454 const gchar *object_path,
10455 GCancellable *cancellable,
10456 GError **error)
10457{
10458 GInitable *ret;
10459 ret = g_initable_new (TYPE_PROCESS_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Process", NULL);
10460 if (ret != NULL)
10461 return PROCESS (ret);
10462 else
10463 return NULL;
10464}
10465
10466
10467/* ------------------------------------------------------------------------ */
10468
10469/**
10470 * ProcessSkeleton:
10471 *
10472 * The #ProcessSkeleton structure contains only private data and should only be accessed using the provided API.
10473 */
10474
10475/**
10476 * ProcessSkeletonClass:
10477 * @parent_class: The parent class.
10478 *
10479 * Class structure for #ProcessSkeleton.
10480 */
10481
10482struct _ProcessSkeletonPrivate
10483{
10484 GValue *properties;
10485 GList *changed_properties;
10486 GSource *changed_properties_idle_source;
10487 GMainContext *context;
10488 GMutex lock;
10489};
10490
10491static void
10492_process_skeleton_handle_method_call (
10493 GDBusConnection *connection G_GNUC_UNUSED,
10494 const gchar *sender G_GNUC_UNUSED,
10495 const gchar *object_path G_GNUC_UNUSED,
10496 const gchar *interface_name,
10497 const gchar *method_name,
10498 GVariant *parameters,
10499 GDBusMethodInvocation *invocation,
10500 gpointer user_data)
10501{
10502 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
10503 _ExtendedGDBusMethodInfo *info;
10504 GVariantIter iter;
10505 GVariant *child;
10506 GValue *paramv;
10507 guint num_params;
10508 guint num_extra;
10509 guint n;
10510 guint signal_id;
10511 GValue return_value = G_VALUE_INIT;
10512 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
10513 g_assert (info != NULL);
10514 num_params = g_variant_n_children (parameters);
10515 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
10516 n = 0;
10517 g_value_init (&paramv[n], TYPE_PROCESS);
10518 g_value_set_object (&paramv[n++], skeleton);
10519 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
10520 g_value_set_object (&paramv[n++], invocation);
10521 if (info->pass_fdlist)
10522 {
10523#ifdef G_OS_UNIX
10524 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
10525 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
10526#else
10527 g_assert_not_reached ();
10528#endif
10529 }
10530 g_variant_iter_init (&iter, parameters);
10531 while ((child = g_variant_iter_next_value (&iter)) != NULL)
10532 {
10533 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
10534 if (arg_info->use_gvariant)
10535 {
10536 g_value_init (&paramv[n], G_TYPE_VARIANT);
10537 g_value_set_variant (&paramv[n], child);
10538 n++;
10539 }
10540 else
10541 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
10542 g_variant_unref (child);
10543 }
10544 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS);
10545 g_value_init (&return_value, G_TYPE_BOOLEAN);
10546 g_signal_emitv (paramv, signal_id, 0, &return_value);
10547 if (!g_value_get_boolean (&return_value))
10548 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);
10549 g_value_unset (&return_value);
10550 for (n = 0; n < num_params + num_extra; n++)
10551 g_value_unset (&paramv[n]);
10552 g_free (paramv);
10553}
10554
10555static GVariant *
10556_process_skeleton_handle_get_property (
10557 GDBusConnection *connection G_GNUC_UNUSED,
10558 const gchar *sender G_GNUC_UNUSED,
10559 const gchar *object_path G_GNUC_UNUSED,
10560 const gchar *interface_name G_GNUC_UNUSED,
10561 const gchar *property_name,
10562 GError **error,
10563 gpointer user_data)
10564{
10565 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
10566 GValue value = G_VALUE_INIT;
10567 GParamSpec *pspec;
10568 _ExtendedGDBusPropertyInfo *info;
10569 GVariant *ret;
10570 ret = NULL;
10571 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name);
10572 g_assert (info != NULL);
10573 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
10574 if (pspec == NULL)
10575 {
10576 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
10577 }
10578 else
10579 {
10580 g_value_init (&value, pspec->value_type);
10581 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
10582 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
10583 g_value_unset (&value);
10584 }
10585 return ret;
10586}
10587
10588static gboolean
10589_process_skeleton_handle_set_property (
10590 GDBusConnection *connection G_GNUC_UNUSED,
10591 const gchar *sender G_GNUC_UNUSED,
10592 const gchar *object_path G_GNUC_UNUSED,
10593 const gchar *interface_name G_GNUC_UNUSED,
10594 const gchar *property_name,
10595 GVariant *variant,
10596 GError **error,
10597 gpointer user_data)
10598{
10599 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
10600 GValue value = G_VALUE_INIT;
10601 GParamSpec *pspec;
10602 _ExtendedGDBusPropertyInfo *info;
10603 gboolean ret;
10604 ret = FALSE;
10605 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name);
10606 g_assert (info != NULL);
10607 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
10608 if (pspec == NULL)
10609 {
10610 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
10611 }
10612 else
10613 {
10614 if (info->use_gvariant)
10615 g_value_set_variant (&value, variant);
10616 else
10617 g_dbus_gvariant_to_gvalue (variant, &value);
10618 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
10619 g_value_unset (&value);
10620 ret = TRUE;
10621 }
10622 return ret;
10623}
10624
10625static const GDBusInterfaceVTable _process_skeleton_vtable =
10626{
10627 _process_skeleton_handle_method_call,
10628 _process_skeleton_handle_get_property,
10629 _process_skeleton_handle_set_property,
10630 {NULL}
10631};
10632
10633static GDBusInterfaceInfo *
10634process_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
10635{
10636 return process_interface_info ();
10637}
10638
10639static GDBusInterfaceVTable *
10640process_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
10641{
10642 return (GDBusInterfaceVTable *) &_process_skeleton_vtable;
10643}
10644
10645static GVariant *
10646process_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
10647{
10648 ProcessSkeleton *skeleton = PROCESS_SKELETON (_skeleton);
10649
10650 GVariantBuilder builder;
10651 guint n;
10652 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
10653 if (_process_interface_info.parent_struct.properties == NULL)
10654 goto out;
10655 for (n = 0; _process_interface_info.parent_struct.properties[n] != NULL; n++)
10656 {
10657 GDBusPropertyInfo *info = _process_interface_info.parent_struct.properties[n];
10658 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
10659 {
10660 GVariant *value;
10661 value = _process_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.Process", info->name, NULL, skeleton);
10662 if (value != NULL)
10663 {
10664 g_variant_take_ref (value);
10665 g_variant_builder_add (&builder, "{sv}", info->name, value);
10666 g_variant_unref (value);
10667 }
10668 }
10669 }
10670out:
10671 return g_variant_builder_end (&builder);
10672}
10673
10674static void
10675process_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
10676{
10677}
10678
10679static void process_skeleton_iface_init (ProcessIface *iface);
10680#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10681G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
10682 G_ADD_PRIVATE (ProcessSkeleton)
10683 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init));
10684
10685#else
10686G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
10687 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init));
10688
10689#endif
10690static void
10691process_skeleton_finalize (GObject *object)
10692{
10693 ProcessSkeleton *skeleton = PROCESS_SKELETON (object);
10694 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
10695 if (skeleton->priv->changed_properties_idle_source != NULL)
10696 g_source_destroy (skeleton->priv->changed_properties_idle_source);
10697 g_main_context_unref (skeleton->priv->context);
10698 g_mutex_clear (&skeleton->priv->lock);
10699 G_OBJECT_CLASS (process_skeleton_parent_class)->finalize (object);
10700}
10701
10702static void
10703process_skeleton_init (ProcessSkeleton *skeleton)
10704{
10705#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10706 skeleton->priv = process_skeleton_get_instance_private (skeleton);
10707#else
10708 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_PROCESS_SKELETON, ProcessSkeletonPrivate);
10709#endif
10710
10711 g_mutex_init (&skeleton->priv->lock);
10712 skeleton->priv->context = g_main_context_ref_thread_default ();
10713}
10714
10715static void
10716process_skeleton_class_init (ProcessSkeletonClass *klass)
10717{
10718 GObjectClass *gobject_class;
10719 GDBusInterfaceSkeletonClass *skeleton_class;
10720
10721 gobject_class = G_OBJECT_CLASS (klass);
10722 gobject_class->finalize = process_skeleton_finalize;
10723
10724 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
10725 skeleton_class->get_info = process_skeleton_dbus_interface_get_info;
10726 skeleton_class->get_properties = process_skeleton_dbus_interface_get_properties;
10727 skeleton_class->flush = process_skeleton_dbus_interface_flush;
10728 skeleton_class->get_vtable = process_skeleton_dbus_interface_get_vtable;
10729
10730#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
10731 g_type_class_add_private (klass, sizeof (ProcessSkeletonPrivate));
10732#endif
10733}
10734
10735static void
10736process_skeleton_iface_init (ProcessIface *iface)
10737{
10738}
10739
10740/**
10741 * process_skeleton_new:
10742 *
10743 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
10744 *
10745 * Returns: (transfer full) (type ProcessSkeleton): The skeleton object.
10746 */
10747Process *
10748process_skeleton_new (void)
10749{
10750 return PROCESS (g_object_new (TYPE_PROCESS_SKELETON, NULL));
10751}
10752
10753/* ------------------------------------------------------------------------
10754 * Code for interface org.openbmc.Control
10755 * ------------------------------------------------------------------------
10756 */
10757
10758/**
10759 * SECTION:Control
10760 * @title: Control
10761 * @short_description: Generated C code for the org.openbmc.Control D-Bus interface
10762 *
10763 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> D-Bus interface in C.
10764 */
10765
10766/* ---- Introspection data for org.openbmc.Control ---- */
10767
10768static const _ExtendedGDBusMethodInfo _control_method_info_init =
10769{
10770 {
10771 -1,
10772 (gchar *) "init",
10773 NULL,
10774 NULL,
10775 NULL
10776 },
10777 "handle-init",
10778 FALSE
10779};
10780
10781static const _ExtendedGDBusMethodInfo * const _control_method_info_pointers[] =
10782{
10783 &_control_method_info_init,
10784 NULL
10785};
10786
10787static const _ExtendedGDBusArgInfo _control_signal_info_heartbeat_ARG_bus_name =
10788{
10789 {
10790 -1,
10791 (gchar *) "bus_name",
10792 (gchar *) "s",
10793 NULL
10794 },
10795 FALSE
10796};
10797
10798static const _ExtendedGDBusArgInfo * const _control_signal_info_heartbeat_ARG_pointers[] =
10799{
10800 &_control_signal_info_heartbeat_ARG_bus_name,
10801 NULL
10802};
10803
10804static const _ExtendedGDBusSignalInfo _control_signal_info_heartbeat =
10805{
10806 {
10807 -1,
10808 (gchar *) "Heartbeat",
10809 (GDBusArgInfo **) &_control_signal_info_heartbeat_ARG_pointers,
10810 NULL
10811 },
10812 "heartbeat"
10813};
10814
10815static const _ExtendedGDBusArgInfo _control_signal_info_goto_system_state_ARG_state_name =
10816{
10817 {
10818 -1,
10819 (gchar *) "state_name",
10820 (gchar *) "s",
10821 NULL
10822 },
10823 FALSE
10824};
10825
10826static const _ExtendedGDBusArgInfo * const _control_signal_info_goto_system_state_ARG_pointers[] =
10827{
10828 &_control_signal_info_goto_system_state_ARG_state_name,
10829 NULL
10830};
10831
10832static const _ExtendedGDBusSignalInfo _control_signal_info_goto_system_state =
10833{
10834 {
10835 -1,
10836 (gchar *) "GotoSystemState",
10837 (GDBusArgInfo **) &_control_signal_info_goto_system_state_ARG_pointers,
10838 NULL
10839 },
10840 "goto-system-state"
10841};
10842
10843static const _ExtendedGDBusSignalInfo * const _control_signal_info_pointers[] =
10844{
10845 &_control_signal_info_heartbeat,
10846 &_control_signal_info_goto_system_state,
10847 NULL
10848};
10849
10850static const _ExtendedGDBusPropertyInfo _control_property_info_poll_interval =
10851{
10852 {
10853 -1,
10854 (gchar *) "poll_interval",
10855 (gchar *) "i",
10856 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
10857 NULL
10858 },
10859 "poll-interval",
10860 FALSE
10861};
10862
10863static const _ExtendedGDBusPropertyInfo _control_property_info_heatbeat =
10864{
10865 {
10866 -1,
10867 (gchar *) "heatbeat",
10868 (gchar *) "i",
10869 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
10870 NULL
10871 },
10872 "heatbeat",
10873 FALSE
10874};
10875
10876static const _ExtendedGDBusPropertyInfo * const _control_property_info_pointers[] =
10877{
10878 &_control_property_info_poll_interval,
10879 &_control_property_info_heatbeat,
10880 NULL
10881};
10882
10883static const _ExtendedGDBusInterfaceInfo _control_interface_info =
10884{
10885 {
10886 -1,
10887 (gchar *) "org.openbmc.Control",
10888 (GDBusMethodInfo **) &_control_method_info_pointers,
10889 (GDBusSignalInfo **) &_control_signal_info_pointers,
10890 (GDBusPropertyInfo **) &_control_property_info_pointers,
10891 NULL
10892 },
10893 "control",
10894};
10895
10896
10897/**
10898 * control_interface_info:
10899 *
10900 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> D-Bus interface.
10901 *
10902 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
10903 */
10904GDBusInterfaceInfo *
10905control_interface_info (void)
10906{
10907 return (GDBusInterfaceInfo *) &_control_interface_info.parent_struct;
10908}
10909
10910/**
10911 * control_override_properties:
10912 * @klass: The class structure for a #GObject<!-- -->-derived class.
10913 * @property_id_begin: The property id to assign to the first overridden property.
10914 *
10915 * Overrides all #GObject properties in the #Control interface for a concrete class.
10916 * The properties are overridden in the order they are defined.
10917 *
10918 * Returns: The last property id.
10919 */
10920guint
10921control_override_properties (GObjectClass *klass, guint property_id_begin)
10922{
10923 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
10924 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
10925 return property_id_begin - 1;
10926}
10927
10928
10929
10930/**
10931 * Control:
10932 *
10933 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
10934 */
10935
10936/**
10937 * ControlIface:
10938 * @parent_iface: The parent interface.
10939 * @handle_init: Handler for the #Control::handle-init signal.
10940 * @get_heatbeat: Getter for the #Control:heatbeat property.
10941 * @get_poll_interval: Getter for the #Control:poll-interval property.
10942 * @goto_system_state: Handler for the #Control::goto-system-state signal.
10943 * @heartbeat: Handler for the #Control::heartbeat signal.
10944 *
10945 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
10946 */
10947
10948typedef ControlIface ControlInterface;
10949G_DEFINE_INTERFACE (Control, control, G_TYPE_OBJECT);
10950
10951static void
10952control_default_init (ControlIface *iface)
10953{
10954 /* GObject signals for incoming D-Bus method calls: */
10955 /**
10956 * Control::handle-init:
10957 * @object: A #Control.
10958 * @invocation: A #GDBusMethodInvocation.
10959 *
10960 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method.
10961 *
10962 * 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_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.
10963 *
10964 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
10965 */
10966 g_signal_new ("handle-init",
10967 G_TYPE_FROM_INTERFACE (iface),
10968 G_SIGNAL_RUN_LAST,
10969 G_STRUCT_OFFSET (ControlIface, handle_init),
10970 g_signal_accumulator_true_handled,
10971 NULL,
10972 g_cclosure_marshal_generic,
10973 G_TYPE_BOOLEAN,
10974 1,
10975 G_TYPE_DBUS_METHOD_INVOCATION);
10976
10977 /* GObject signals for received D-Bus signals: */
10978 /**
10979 * Control::heartbeat:
10980 * @object: A #Control.
10981 * @arg_bus_name: Argument.
10982 *
10983 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Control.Heartbeat">"Heartbeat"</link> is received.
10984 *
10985 * 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.
10986 */
10987 g_signal_new ("heartbeat",
10988 G_TYPE_FROM_INTERFACE (iface),
10989 G_SIGNAL_RUN_LAST,
10990 G_STRUCT_OFFSET (ControlIface, heartbeat),
10991 NULL,
10992 NULL,
10993 g_cclosure_marshal_generic,
10994 G_TYPE_NONE,
10995 1, G_TYPE_STRING);
10996
10997 /**
10998 * Control::goto-system-state:
10999 * @object: A #Control.
11000 * @arg_state_name: Argument.
11001 *
11002 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Control.GotoSystemState">"GotoSystemState"</link> is received.
11003 *
11004 * 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.
11005 */
11006 g_signal_new ("goto-system-state",
11007 G_TYPE_FROM_INTERFACE (iface),
11008 G_SIGNAL_RUN_LAST,
11009 G_STRUCT_OFFSET (ControlIface, goto_system_state),
11010 NULL,
11011 NULL,
11012 g_cclosure_marshal_generic,
11013 G_TYPE_NONE,
11014 1, G_TYPE_STRING);
11015
11016 /* GObject properties for D-Bus properties: */
11017 /**
11018 * Control:poll-interval:
11019 *
11020 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link>.
11021 *
11022 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
11023 */
11024 g_object_interface_install_property (iface,
11025 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
11026 /**
11027 * Control:heatbeat:
11028 *
11029 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link>.
11030 *
11031 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
11032 */
11033 g_object_interface_install_property (iface,
11034 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
11035}
11036
11037/**
11038 * control_get_poll_interval: (skip)
11039 * @object: A #Control.
11040 *
11041 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property.
11042 *
11043 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
11044 *
11045 * Returns: The property value.
11046 */
11047gint
11048control_get_poll_interval (Control *object)
11049{
11050 return CONTROL_GET_IFACE (object)->get_poll_interval (object);
11051}
11052
11053/**
11054 * control_set_poll_interval: (skip)
11055 * @object: A #Control.
11056 * @value: The value to set.
11057 *
11058 * Sets the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property to @value.
11059 *
11060 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
11061 */
11062void
11063control_set_poll_interval (Control *object, gint value)
11064{
11065 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
11066}
11067
11068/**
11069 * control_get_heatbeat: (skip)
11070 * @object: A #Control.
11071 *
11072 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property.
11073 *
11074 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
11075 *
11076 * Returns: The property value.
11077 */
11078gint
11079control_get_heatbeat (Control *object)
11080{
11081 return CONTROL_GET_IFACE (object)->get_heatbeat (object);
11082}
11083
11084/**
11085 * control_set_heatbeat: (skip)
11086 * @object: A #Control.
11087 * @value: The value to set.
11088 *
11089 * Sets the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property to @value.
11090 *
11091 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
11092 */
11093void
11094control_set_heatbeat (Control *object, gint value)
11095{
11096 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
11097}
11098
11099/**
11100 * control_emit_heartbeat:
11101 * @object: A #Control.
11102 * @arg_bus_name: Argument to pass with the signal.
11103 *
11104 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Heartbeat">"Heartbeat"</link> D-Bus signal.
11105 */
11106void
11107control_emit_heartbeat (
11108 Control *object,
11109 const gchar *arg_bus_name)
11110{
11111 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
11112}
11113
11114/**
11115 * control_emit_goto_system_state:
11116 * @object: A #Control.
11117 * @arg_state_name: Argument to pass with the signal.
11118 *
11119 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.GotoSystemState">"GotoSystemState"</link> D-Bus signal.
11120 */
11121void
11122control_emit_goto_system_state (
11123 Control *object,
11124 const gchar *arg_state_name)
11125{
11126 g_signal_emit_by_name (object, "goto-system-state", arg_state_name);
11127}
11128
11129/**
11130 * control_call_init:
11131 * @proxy: A #ControlProxy.
11132 * @cancellable: (allow-none): A #GCancellable or %NULL.
11133 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
11134 * @user_data: User data to pass to @callback.
11135 *
11136 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method on @proxy.
11137 * 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.
11138 * You can then call control_call_init_finish() to get the result of the operation.
11139 *
11140 * See control_call_init_sync() for the synchronous, blocking version of this method.
11141 */
11142void
11143control_call_init (
11144 Control *proxy,
11145 GCancellable *cancellable,
11146 GAsyncReadyCallback callback,
11147 gpointer user_data)
11148{
11149 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
11150 "init",
11151 g_variant_new ("()"),
11152 G_DBUS_CALL_FLAGS_NONE,
11153 -1,
11154 cancellable,
11155 callback,
11156 user_data);
11157}
11158
11159/**
11160 * control_call_init_finish:
11161 * @proxy: A #ControlProxy.
11162 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_call_init().
11163 * @error: Return location for error or %NULL.
11164 *
11165 * Finishes an operation started with control_call_init().
11166 *
11167 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11168 */
11169gboolean
11170control_call_init_finish (
11171 Control *proxy,
11172 GAsyncResult *res,
11173 GError **error)
11174{
11175 GVariant *_ret;
11176 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
11177 if (_ret == NULL)
11178 goto _out;
11179 g_variant_get (_ret,
11180 "()");
11181 g_variant_unref (_ret);
11182_out:
11183 return _ret != NULL;
11184}
11185
11186/**
11187 * control_call_init_sync:
11188 * @proxy: A #ControlProxy.
11189 * @cancellable: (allow-none): A #GCancellable or %NULL.
11190 * @error: Return location for error or %NULL.
11191 *
11192 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
11193 *
11194 * See control_call_init() for the asynchronous version of this method.
11195 *
11196 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11197 */
11198gboolean
11199control_call_init_sync (
11200 Control *proxy,
11201 GCancellable *cancellable,
11202 GError **error)
11203{
11204 GVariant *_ret;
11205 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
11206 "init",
11207 g_variant_new ("()"),
11208 G_DBUS_CALL_FLAGS_NONE,
11209 -1,
11210 cancellable,
11211 error);
11212 if (_ret == NULL)
11213 goto _out;
11214 g_variant_get (_ret,
11215 "()");
11216 g_variant_unref (_ret);
11217_out:
11218 return _ret != NULL;
11219}
11220
11221/**
11222 * control_complete_init:
11223 * @object: A #Control.
11224 * @invocation: (transfer full): A #GDBusMethodInvocation.
11225 *
11226 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Control.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.
11227 *
11228 * This method will free @invocation, you cannot use it afterwards.
11229 */
11230void
11231control_complete_init (
11232 Control *object,
11233 GDBusMethodInvocation *invocation)
11234{
11235 g_dbus_method_invocation_return_value (invocation,
11236 g_variant_new ("()"));
11237}
11238
11239/* ------------------------------------------------------------------------ */
11240
11241/**
11242 * ControlProxy:
11243 *
11244 * The #ControlProxy structure contains only private data and should only be accessed using the provided API.
11245 */
11246
11247/**
11248 * ControlProxyClass:
11249 * @parent_class: The parent class.
11250 *
11251 * Class structure for #ControlProxy.
11252 */
11253
11254struct _ControlProxyPrivate
11255{
11256 GData *qdata;
11257};
11258
11259static void control_proxy_iface_init (ControlIface *iface);
11260
11261#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11262G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
11263 G_ADD_PRIVATE (ControlProxy)
11264 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init));
11265
11266#else
11267G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
11268 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init));
11269
11270#endif
11271static void
11272control_proxy_finalize (GObject *object)
11273{
11274 ControlProxy *proxy = CONTROL_PROXY (object);
11275 g_datalist_clear (&proxy->priv->qdata);
11276 G_OBJECT_CLASS (control_proxy_parent_class)->finalize (object);
11277}
11278
11279static void
11280control_proxy_get_property (GObject *object,
11281 guint prop_id,
11282 GValue *value,
11283 GParamSpec *pspec G_GNUC_UNUSED)
11284{
11285 const _ExtendedGDBusPropertyInfo *info;
11286 GVariant *variant;
11287 g_assert (prop_id != 0 && prop_id - 1 < 2);
11288 info = _control_property_info_pointers[prop_id - 1];
11289 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
11290 if (info->use_gvariant)
11291 {
11292 g_value_set_variant (value, variant);
11293 }
11294 else
11295 {
11296 if (variant != NULL)
11297 g_dbus_gvariant_to_gvalue (variant, value);
11298 }
11299 if (variant != NULL)
11300 g_variant_unref (variant);
11301}
11302
11303static void
11304control_proxy_set_property_cb (GDBusProxy *proxy,
11305 GAsyncResult *res,
11306 gpointer user_data)
11307{
11308 const _ExtendedGDBusPropertyInfo *info = user_data;
11309 GError *error;
11310 GVariant *_ret;
11311 error = NULL;
11312 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
11313 if (!_ret)
11314 {
11315 g_warning ("Error setting property '%s' on interface org.openbmc.Control: %s (%s, %d)",
11316 info->parent_struct.name,
11317 error->message, g_quark_to_string (error->domain), error->code);
11318 g_error_free (error);
11319 }
11320 else
11321 {
11322 g_variant_unref (_ret);
11323 }
11324}
11325
11326static void
11327control_proxy_set_property (GObject *object,
11328 guint prop_id,
11329 const GValue *value,
11330 GParamSpec *pspec G_GNUC_UNUSED)
11331{
11332 const _ExtendedGDBusPropertyInfo *info;
11333 GVariant *variant;
11334 g_assert (prop_id != 0 && prop_id - 1 < 2);
11335 info = _control_property_info_pointers[prop_id - 1];
11336 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
11337 g_dbus_proxy_call (G_DBUS_PROXY (object),
11338 "org.freedesktop.DBus.Properties.Set",
11339 g_variant_new ("(ssv)", "org.openbmc.Control", info->parent_struct.name, variant),
11340 G_DBUS_CALL_FLAGS_NONE,
11341 -1,
11342 NULL, (GAsyncReadyCallback) control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
11343 g_variant_unref (variant);
11344}
11345
11346static void
11347control_proxy_g_signal (GDBusProxy *proxy,
11348 const gchar *sender_name G_GNUC_UNUSED,
11349 const gchar *signal_name,
11350 GVariant *parameters)
11351{
11352 _ExtendedGDBusSignalInfo *info;
11353 GVariantIter iter;
11354 GVariant *child;
11355 GValue *paramv;
11356 guint num_params;
11357 guint n;
11358 guint signal_id;
11359 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, signal_name);
11360 if (info == NULL)
11361 return;
11362 num_params = g_variant_n_children (parameters);
11363 paramv = g_new0 (GValue, num_params + 1);
11364 g_value_init (&paramv[0], TYPE_CONTROL);
11365 g_value_set_object (&paramv[0], proxy);
11366 g_variant_iter_init (&iter, parameters);
11367 n = 1;
11368 while ((child = g_variant_iter_next_value (&iter)) != NULL)
11369 {
11370 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
11371 if (arg_info->use_gvariant)
11372 {
11373 g_value_init (&paramv[n], G_TYPE_VARIANT);
11374 g_value_set_variant (&paramv[n], child);
11375 n++;
11376 }
11377 else
11378 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
11379 g_variant_unref (child);
11380 }
11381 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
11382 g_signal_emitv (paramv, signal_id, 0, NULL);
11383 for (n = 0; n < num_params + 1; n++)
11384 g_value_unset (&paramv[n]);
11385 g_free (paramv);
11386}
11387
11388static void
11389control_proxy_g_properties_changed (GDBusProxy *_proxy,
11390 GVariant *changed_properties,
11391 const gchar *const *invalidated_properties)
11392{
11393 ControlProxy *proxy = CONTROL_PROXY (_proxy);
11394 guint n;
11395 const gchar *key;
11396 GVariantIter *iter;
11397 _ExtendedGDBusPropertyInfo *info;
11398 g_variant_get (changed_properties, "a{sv}", &iter);
11399 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
11400 {
11401 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, key);
11402 g_datalist_remove_data (&proxy->priv->qdata, key);
11403 if (info != NULL)
11404 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
11405 }
11406 g_variant_iter_free (iter);
11407 for (n = 0; invalidated_properties[n] != NULL; n++)
11408 {
11409 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, invalidated_properties[n]);
11410 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
11411 if (info != NULL)
11412 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
11413 }
11414}
11415
11416static gint
11417control_proxy_get_poll_interval (Control *object)
11418{
11419 ControlProxy *proxy = CONTROL_PROXY (object);
11420 GVariant *variant;
11421 gint value = 0;
11422 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
11423 if (variant != NULL)
11424 {
11425 value = g_variant_get_int32 (variant);
11426 g_variant_unref (variant);
11427 }
11428 return value;
11429}
11430
11431static gint
11432control_proxy_get_heatbeat (Control *object)
11433{
11434 ControlProxy *proxy = CONTROL_PROXY (object);
11435 GVariant *variant;
11436 gint value = 0;
11437 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
11438 if (variant != NULL)
11439 {
11440 value = g_variant_get_int32 (variant);
11441 g_variant_unref (variant);
11442 }
11443 return value;
11444}
11445
11446static void
11447control_proxy_init (ControlProxy *proxy)
11448{
11449#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11450 proxy->priv = control_proxy_get_instance_private (proxy);
11451#else
11452 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_PROXY, ControlProxyPrivate);
11453#endif
11454
11455 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_interface_info ());
11456}
11457
11458static void
11459control_proxy_class_init (ControlProxyClass *klass)
11460{
11461 GObjectClass *gobject_class;
11462 GDBusProxyClass *proxy_class;
11463
11464 gobject_class = G_OBJECT_CLASS (klass);
11465 gobject_class->finalize = control_proxy_finalize;
11466 gobject_class->get_property = control_proxy_get_property;
11467 gobject_class->set_property = control_proxy_set_property;
11468
11469 proxy_class = G_DBUS_PROXY_CLASS (klass);
11470 proxy_class->g_signal = control_proxy_g_signal;
11471 proxy_class->g_properties_changed = control_proxy_g_properties_changed;
11472
11473 control_override_properties (gobject_class, 1);
11474
11475#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
11476 g_type_class_add_private (klass, sizeof (ControlProxyPrivate));
11477#endif
11478}
11479
11480static void
11481control_proxy_iface_init (ControlIface *iface)
11482{
11483 iface->get_poll_interval = control_proxy_get_poll_interval;
11484 iface->get_heatbeat = control_proxy_get_heatbeat;
11485}
11486
11487/**
11488 * control_proxy_new:
11489 * @connection: A #GDBusConnection.
11490 * @flags: Flags from the #GDBusProxyFlags enumeration.
11491 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
11492 * @object_path: An object path.
11493 * @cancellable: (allow-none): A #GCancellable or %NULL.
11494 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
11495 * @user_data: User data to pass to @callback.
11496 *
11497 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>. See g_dbus_proxy_new() for more details.
11498 *
11499 * 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.
11500 * You can then call control_proxy_new_finish() to get the result of the operation.
11501 *
11502 * See control_proxy_new_sync() for the synchronous, blocking version of this constructor.
11503 */
11504void
11505control_proxy_new (
11506 GDBusConnection *connection,
11507 GDBusProxyFlags flags,
11508 const gchar *name,
11509 const gchar *object_path,
11510 GCancellable *cancellable,
11511 GAsyncReadyCallback callback,
11512 gpointer user_data)
11513{
11514 g_async_initable_new_async (TYPE_CONTROL_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", NULL);
11515}
11516
11517/**
11518 * control_proxy_new_finish:
11519 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new().
11520 * @error: Return location for error or %NULL
11521 *
11522 * Finishes an operation started with control_proxy_new().
11523 *
11524 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
11525 */
11526Control *
11527control_proxy_new_finish (
11528 GAsyncResult *res,
11529 GError **error)
11530{
11531 GObject *ret;
11532 GObject *source_object;
11533 source_object = g_async_result_get_source_object (res);
11534 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
11535 g_object_unref (source_object);
11536 if (ret != NULL)
11537 return CONTROL (ret);
11538 else
11539 return NULL;
11540}
11541
11542/**
11543 * control_proxy_new_sync:
11544 * @connection: A #GDBusConnection.
11545 * @flags: Flags from the #GDBusProxyFlags enumeration.
11546 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
11547 * @object_path: An object path.
11548 * @cancellable: (allow-none): A #GCancellable or %NULL.
11549 * @error: Return location for error or %NULL
11550 *
11551 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>. See g_dbus_proxy_new_sync() for more details.
11552 *
11553 * The calling thread is blocked until a reply is received.
11554 *
11555 * See control_proxy_new() for the asynchronous version of this constructor.
11556 *
11557 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
11558 */
11559Control *
11560control_proxy_new_sync (
11561 GDBusConnection *connection,
11562 GDBusProxyFlags flags,
11563 const gchar *name,
11564 const gchar *object_path,
11565 GCancellable *cancellable,
11566 GError **error)
11567{
11568 GInitable *ret;
11569 ret = g_initable_new (TYPE_CONTROL_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Control", NULL);
11570 if (ret != NULL)
11571 return CONTROL (ret);
11572 else
11573 return NULL;
11574}
11575
11576
11577/**
11578 * control_proxy_new_for_bus:
11579 * @bus_type: A #GBusType.
11580 * @flags: Flags from the #GDBusProxyFlags enumeration.
11581 * @name: A bus name (well-known or unique).
11582 * @object_path: An object path.
11583 * @cancellable: (allow-none): A #GCancellable or %NULL.
11584 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
11585 * @user_data: User data to pass to @callback.
11586 *
11587 * Like control_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
11588 *
11589 * 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.
11590 * You can then call control_proxy_new_for_bus_finish() to get the result of the operation.
11591 *
11592 * See control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
11593 */
11594void
11595control_proxy_new_for_bus (
11596 GBusType bus_type,
11597 GDBusProxyFlags flags,
11598 const gchar *name,
11599 const gchar *object_path,
11600 GCancellable *cancellable,
11601 GAsyncReadyCallback callback,
11602 gpointer user_data)
11603{
11604 g_async_initable_new_async (TYPE_CONTROL_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", NULL);
11605}
11606
11607/**
11608 * control_proxy_new_for_bus_finish:
11609 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new_for_bus().
11610 * @error: Return location for error or %NULL
11611 *
11612 * Finishes an operation started with control_proxy_new_for_bus().
11613 *
11614 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
11615 */
11616Control *
11617control_proxy_new_for_bus_finish (
11618 GAsyncResult *res,
11619 GError **error)
11620{
11621 GObject *ret;
11622 GObject *source_object;
11623 source_object = g_async_result_get_source_object (res);
11624 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
11625 g_object_unref (source_object);
11626 if (ret != NULL)
11627 return CONTROL (ret);
11628 else
11629 return NULL;
11630}
11631
11632/**
11633 * control_proxy_new_for_bus_sync:
11634 * @bus_type: A #GBusType.
11635 * @flags: Flags from the #GDBusProxyFlags enumeration.
11636 * @name: A bus name (well-known or unique).
11637 * @object_path: An object path.
11638 * @cancellable: (allow-none): A #GCancellable or %NULL.
11639 * @error: Return location for error or %NULL
11640 *
11641 * Like control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
11642 *
11643 * The calling thread is blocked until a reply is received.
11644 *
11645 * See control_proxy_new_for_bus() for the asynchronous version of this constructor.
11646 *
11647 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
11648 */
11649Control *
11650control_proxy_new_for_bus_sync (
11651 GBusType bus_type,
11652 GDBusProxyFlags flags,
11653 const gchar *name,
11654 const gchar *object_path,
11655 GCancellable *cancellable,
11656 GError **error)
11657{
11658 GInitable *ret;
11659 ret = g_initable_new (TYPE_CONTROL_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", NULL);
11660 if (ret != NULL)
11661 return CONTROL (ret);
11662 else
11663 return NULL;
11664}
11665
11666
11667/* ------------------------------------------------------------------------ */
11668
11669/**
11670 * ControlSkeleton:
11671 *
11672 * The #ControlSkeleton structure contains only private data and should only be accessed using the provided API.
11673 */
11674
11675/**
11676 * ControlSkeletonClass:
11677 * @parent_class: The parent class.
11678 *
11679 * Class structure for #ControlSkeleton.
11680 */
11681
11682struct _ControlSkeletonPrivate
11683{
11684 GValue *properties;
11685 GList *changed_properties;
11686 GSource *changed_properties_idle_source;
11687 GMainContext *context;
11688 GMutex lock;
11689};
11690
11691static void
11692_control_skeleton_handle_method_call (
11693 GDBusConnection *connection G_GNUC_UNUSED,
11694 const gchar *sender G_GNUC_UNUSED,
11695 const gchar *object_path G_GNUC_UNUSED,
11696 const gchar *interface_name,
11697 const gchar *method_name,
11698 GVariant *parameters,
11699 GDBusMethodInvocation *invocation,
11700 gpointer user_data)
11701{
11702 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
11703 _ExtendedGDBusMethodInfo *info;
11704 GVariantIter iter;
11705 GVariant *child;
11706 GValue *paramv;
11707 guint num_params;
11708 guint num_extra;
11709 guint n;
11710 guint signal_id;
11711 GValue return_value = G_VALUE_INIT;
11712 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
11713 g_assert (info != NULL);
11714 num_params = g_variant_n_children (parameters);
11715 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
11716 n = 0;
11717 g_value_init (&paramv[n], TYPE_CONTROL);
11718 g_value_set_object (&paramv[n++], skeleton);
11719 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
11720 g_value_set_object (&paramv[n++], invocation);
11721 if (info->pass_fdlist)
11722 {
11723#ifdef G_OS_UNIX
11724 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
11725 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
11726#else
11727 g_assert_not_reached ();
11728#endif
11729 }
11730 g_variant_iter_init (&iter, parameters);
11731 while ((child = g_variant_iter_next_value (&iter)) != NULL)
11732 {
11733 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
11734 if (arg_info->use_gvariant)
11735 {
11736 g_value_init (&paramv[n], G_TYPE_VARIANT);
11737 g_value_set_variant (&paramv[n], child);
11738 n++;
11739 }
11740 else
11741 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
11742 g_variant_unref (child);
11743 }
11744 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
11745 g_value_init (&return_value, G_TYPE_BOOLEAN);
11746 g_signal_emitv (paramv, signal_id, 0, &return_value);
11747 if (!g_value_get_boolean (&return_value))
11748 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);
11749 g_value_unset (&return_value);
11750 for (n = 0; n < num_params + num_extra; n++)
11751 g_value_unset (&paramv[n]);
11752 g_free (paramv);
11753}
11754
11755static GVariant *
11756_control_skeleton_handle_get_property (
11757 GDBusConnection *connection G_GNUC_UNUSED,
11758 const gchar *sender G_GNUC_UNUSED,
11759 const gchar *object_path G_GNUC_UNUSED,
11760 const gchar *interface_name G_GNUC_UNUSED,
11761 const gchar *property_name,
11762 GError **error,
11763 gpointer user_data)
11764{
11765 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
11766 GValue value = G_VALUE_INIT;
11767 GParamSpec *pspec;
11768 _ExtendedGDBusPropertyInfo *info;
11769 GVariant *ret;
11770 ret = NULL;
11771 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
11772 g_assert (info != NULL);
11773 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
11774 if (pspec == NULL)
11775 {
11776 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
11777 }
11778 else
11779 {
11780 g_value_init (&value, pspec->value_type);
11781 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
11782 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
11783 g_value_unset (&value);
11784 }
11785 return ret;
11786}
11787
11788static gboolean
11789_control_skeleton_handle_set_property (
11790 GDBusConnection *connection G_GNUC_UNUSED,
11791 const gchar *sender G_GNUC_UNUSED,
11792 const gchar *object_path G_GNUC_UNUSED,
11793 const gchar *interface_name G_GNUC_UNUSED,
11794 const gchar *property_name,
11795 GVariant *variant,
11796 GError **error,
11797 gpointer user_data)
11798{
11799 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
11800 GValue value = G_VALUE_INIT;
11801 GParamSpec *pspec;
11802 _ExtendedGDBusPropertyInfo *info;
11803 gboolean ret;
11804 ret = FALSE;
11805 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
11806 g_assert (info != NULL);
11807 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
11808 if (pspec == NULL)
11809 {
11810 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
11811 }
11812 else
11813 {
11814 if (info->use_gvariant)
11815 g_value_set_variant (&value, variant);
11816 else
11817 g_dbus_gvariant_to_gvalue (variant, &value);
11818 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
11819 g_value_unset (&value);
11820 ret = TRUE;
11821 }
11822 return ret;
11823}
11824
11825static const GDBusInterfaceVTable _control_skeleton_vtable =
11826{
11827 _control_skeleton_handle_method_call,
11828 _control_skeleton_handle_get_property,
11829 _control_skeleton_handle_set_property,
11830 {NULL}
11831};
11832
11833static GDBusInterfaceInfo *
11834control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
11835{
11836 return control_interface_info ();
11837}
11838
11839static GDBusInterfaceVTable *
11840control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
11841{
11842 return (GDBusInterfaceVTable *) &_control_skeleton_vtable;
11843}
11844
11845static GVariant *
11846control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
11847{
11848 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
11849
11850 GVariantBuilder builder;
11851 guint n;
11852 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
11853 if (_control_interface_info.parent_struct.properties == NULL)
11854 goto out;
11855 for (n = 0; _control_interface_info.parent_struct.properties[n] != NULL; n++)
11856 {
11857 GDBusPropertyInfo *info = _control_interface_info.parent_struct.properties[n];
11858 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
11859 {
11860 GVariant *value;
11861 value = _control_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", info->name, NULL, skeleton);
11862 if (value != NULL)
11863 {
11864 g_variant_take_ref (value);
11865 g_variant_builder_add (&builder, "{sv}", info->name, value);
11866 g_variant_unref (value);
11867 }
11868 }
11869 }
11870out:
11871 return g_variant_builder_end (&builder);
11872}
11873
11874static gboolean _control_emit_changed (gpointer user_data);
11875
11876static void
11877control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
11878{
11879 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
11880 gboolean emit_changed = FALSE;
11881
11882 g_mutex_lock (&skeleton->priv->lock);
11883 if (skeleton->priv->changed_properties_idle_source != NULL)
11884 {
11885 g_source_destroy (skeleton->priv->changed_properties_idle_source);
11886 skeleton->priv->changed_properties_idle_source = NULL;
11887 emit_changed = TRUE;
11888 }
11889 g_mutex_unlock (&skeleton->priv->lock);
11890
11891 if (emit_changed)
11892 _control_emit_changed (skeleton);
11893}
11894
11895static void
11896_control_on_signal_heartbeat (
11897 Control *object,
11898 const gchar *arg_bus_name)
11899{
11900 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
11901
11902 GList *connections, *l;
11903 GVariant *signal_variant;
11904 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
11905
11906 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
11907 arg_bus_name));
11908 for (l = connections; l != NULL; l = l->next)
11909 {
11910 GDBusConnection *connection = l->data;
11911 g_dbus_connection_emit_signal (connection,
11912 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Heartbeat",
11913 signal_variant, NULL);
11914 }
11915 g_variant_unref (signal_variant);
11916 g_list_free_full (connections, g_object_unref);
11917}
11918
11919static void
11920_control_on_signal_goto_system_state (
11921 Control *object,
11922 const gchar *arg_state_name)
11923{
11924 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
11925
11926 GList *connections, *l;
11927 GVariant *signal_variant;
11928 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
11929
11930 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
11931 arg_state_name));
11932 for (l = connections; l != NULL; l = l->next)
11933 {
11934 GDBusConnection *connection = l->data;
11935 g_dbus_connection_emit_signal (connection,
11936 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "GotoSystemState",
11937 signal_variant, NULL);
11938 }
11939 g_variant_unref (signal_variant);
11940 g_list_free_full (connections, g_object_unref);
11941}
11942
11943static void control_skeleton_iface_init (ControlIface *iface);
11944#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11945G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
11946 G_ADD_PRIVATE (ControlSkeleton)
11947 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init));
11948
11949#else
11950G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
11951 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init));
11952
11953#endif
11954static void
11955control_skeleton_finalize (GObject *object)
11956{
11957 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
11958 guint n;
11959 for (n = 0; n < 2; n++)
11960 g_value_unset (&skeleton->priv->properties[n]);
11961 g_free (skeleton->priv->properties);
11962 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
11963 if (skeleton->priv->changed_properties_idle_source != NULL)
11964 g_source_destroy (skeleton->priv->changed_properties_idle_source);
11965 g_main_context_unref (skeleton->priv->context);
11966 g_mutex_clear (&skeleton->priv->lock);
11967 G_OBJECT_CLASS (control_skeleton_parent_class)->finalize (object);
11968}
11969
11970static void
11971control_skeleton_get_property (GObject *object,
11972 guint prop_id,
11973 GValue *value,
11974 GParamSpec *pspec G_GNUC_UNUSED)
11975{
11976 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
11977 g_assert (prop_id != 0 && prop_id - 1 < 2);
11978 g_mutex_lock (&skeleton->priv->lock);
11979 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
11980 g_mutex_unlock (&skeleton->priv->lock);
11981}
11982
11983static gboolean
11984_control_emit_changed (gpointer user_data)
11985{
11986 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
11987 GList *l;
11988 GVariantBuilder builder;
11989 GVariantBuilder invalidated_builder;
11990 guint num_changes;
11991
11992 g_mutex_lock (&skeleton->priv->lock);
11993 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
11994 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
11995 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
11996 {
11997 ChangedProperty *cp = l->data;
11998 GVariant *variant;
11999 const GValue *cur_value;
12000
12001 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
12002 if (!_g_value_equal (cur_value, &cp->orig_value))
12003 {
12004 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
12005 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
12006 g_variant_unref (variant);
12007 num_changes++;
12008 }
12009 }
12010 if (num_changes > 0)
12011 {
12012 GList *connections, *ll;
12013 GVariant *signal_variant;
12014 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Control",
12015 &builder, &invalidated_builder));
12016 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
12017 for (ll = connections; ll != NULL; ll = ll->next)
12018 {
12019 GDBusConnection *connection = ll->data;
12020
12021 g_dbus_connection_emit_signal (connection,
12022 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
12023 "org.freedesktop.DBus.Properties",
12024 "PropertiesChanged",
12025 signal_variant,
12026 NULL);
12027 }
12028 g_variant_unref (signal_variant);
12029 g_list_free_full (connections, g_object_unref);
12030 }
12031 else
12032 {
12033 g_variant_builder_clear (&builder);
12034 g_variant_builder_clear (&invalidated_builder);
12035 }
12036 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
12037 skeleton->priv->changed_properties = NULL;
12038 skeleton->priv->changed_properties_idle_source = NULL;
12039 g_mutex_unlock (&skeleton->priv->lock);
12040 return FALSE;
12041}
12042
12043static void
12044_control_schedule_emit_changed (ControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
12045{
12046 ChangedProperty *cp;
12047 GList *l;
12048 cp = NULL;
12049 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
12050 {
12051 ChangedProperty *i_cp = l->data;
12052 if (i_cp->info == info)
12053 {
12054 cp = i_cp;
12055 break;
12056 }
12057 }
12058 if (cp == NULL)
12059 {
12060 cp = g_new0 (ChangedProperty, 1);
12061 cp->prop_id = prop_id;
12062 cp->info = info;
12063 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
12064 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
12065 g_value_copy (orig_value, &cp->orig_value);
12066 }
12067}
12068
12069static void
12070control_skeleton_notify (GObject *object,
12071 GParamSpec *pspec G_GNUC_UNUSED)
12072{
12073 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12074 g_mutex_lock (&skeleton->priv->lock);
12075 if (skeleton->priv->changed_properties != NULL &&
12076 skeleton->priv->changed_properties_idle_source == NULL)
12077 {
12078 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
12079 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
12080 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
12081 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
12082 g_source_unref (skeleton->priv->changed_properties_idle_source);
12083 }
12084 g_mutex_unlock (&skeleton->priv->lock);
12085}
12086
12087static void
12088control_skeleton_set_property (GObject *object,
12089 guint prop_id,
12090 const GValue *value,
12091 GParamSpec *pspec)
12092{
12093 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12094 g_assert (prop_id != 0 && prop_id - 1 < 2);
12095 g_mutex_lock (&skeleton->priv->lock);
12096 g_object_freeze_notify (object);
12097 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
12098 {
12099 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
12100 _control_schedule_emit_changed (skeleton, _control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
12101 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
12102 g_object_notify_by_pspec (object, pspec);
12103 }
12104 g_mutex_unlock (&skeleton->priv->lock);
12105 g_object_thaw_notify (object);
12106}
12107
12108static void
12109control_skeleton_init (ControlSkeleton *skeleton)
12110{
12111#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12112 skeleton->priv = control_skeleton_get_instance_private (skeleton);
12113#else
12114 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_SKELETON, ControlSkeletonPrivate);
12115#endif
12116
12117 g_mutex_init (&skeleton->priv->lock);
12118 skeleton->priv->context = g_main_context_ref_thread_default ();
12119 skeleton->priv->properties = g_new0 (GValue, 2);
12120 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
12121 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
12122}
12123
12124static gint
12125control_skeleton_get_poll_interval (Control *object)
12126{
12127 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12128 gint value;
12129 g_mutex_lock (&skeleton->priv->lock);
12130 value = g_value_get_int (&(skeleton->priv->properties[0]));
12131 g_mutex_unlock (&skeleton->priv->lock);
12132 return value;
12133}
12134
12135static gint
12136control_skeleton_get_heatbeat (Control *object)
12137{
12138 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12139 gint value;
12140 g_mutex_lock (&skeleton->priv->lock);
12141 value = g_value_get_int (&(skeleton->priv->properties[1]));
12142 g_mutex_unlock (&skeleton->priv->lock);
12143 return value;
12144}
12145
12146static void
12147control_skeleton_class_init (ControlSkeletonClass *klass)
12148{
12149 GObjectClass *gobject_class;
12150 GDBusInterfaceSkeletonClass *skeleton_class;
12151
12152 gobject_class = G_OBJECT_CLASS (klass);
12153 gobject_class->finalize = control_skeleton_finalize;
12154 gobject_class->get_property = control_skeleton_get_property;
12155 gobject_class->set_property = control_skeleton_set_property;
12156 gobject_class->notify = control_skeleton_notify;
12157
12158
12159 control_override_properties (gobject_class, 1);
12160
12161 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
12162 skeleton_class->get_info = control_skeleton_dbus_interface_get_info;
12163 skeleton_class->get_properties = control_skeleton_dbus_interface_get_properties;
12164 skeleton_class->flush = control_skeleton_dbus_interface_flush;
12165 skeleton_class->get_vtable = control_skeleton_dbus_interface_get_vtable;
12166
12167#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
12168 g_type_class_add_private (klass, sizeof (ControlSkeletonPrivate));
12169#endif
12170}
12171
12172static void
12173control_skeleton_iface_init (ControlIface *iface)
12174{
12175 iface->heartbeat = _control_on_signal_heartbeat;
12176 iface->goto_system_state = _control_on_signal_goto_system_state;
12177 iface->get_poll_interval = control_skeleton_get_poll_interval;
12178 iface->get_heatbeat = control_skeleton_get_heatbeat;
12179}
12180
12181/**
12182 * control_skeleton_new:
12183 *
12184 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
12185 *
12186 * Returns: (transfer full) (type ControlSkeleton): The skeleton object.
12187 */
12188Control *
12189control_skeleton_new (void)
12190{
12191 return CONTROL (g_object_new (TYPE_CONTROL_SKELETON, NULL));
12192}
12193
12194/* ------------------------------------------------------------------------
12195 * Code for interface org.openbmc.control.Bmc
12196 * ------------------------------------------------------------------------
12197 */
12198
12199/**
12200 * SECTION:ControlBmc
12201 * @title: ControlBmc
12202 * @short_description: Generated C code for the org.openbmc.control.Bmc D-Bus interface
12203 *
12204 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link> D-Bus interface in C.
12205 */
12206
12207/* ---- Introspection data for org.openbmc.control.Bmc ---- */
12208
12209static const _ExtendedGDBusMethodInfo _control_bmc_method_info_place_holder =
12210{
12211 {
12212 -1,
12213 (gchar *) "place_holder",
12214 NULL,
12215 NULL,
12216 NULL
12217 },
12218 "handle-place-holder",
12219 FALSE
12220};
12221
12222static const _ExtendedGDBusMethodInfo * const _control_bmc_method_info_pointers[] =
12223{
12224 &_control_bmc_method_info_place_holder,
12225 NULL
12226};
12227
12228static const _ExtendedGDBusInterfaceInfo _control_bmc_interface_info =
12229{
12230 {
12231 -1,
12232 (gchar *) "org.openbmc.control.Bmc",
12233 (GDBusMethodInfo **) &_control_bmc_method_info_pointers,
12234 NULL,
12235 NULL,
12236 NULL
12237 },
12238 "control-bmc",
12239};
12240
12241
12242/**
12243 * control_bmc_interface_info:
12244 *
12245 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link> D-Bus interface.
12246 *
12247 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
12248 */
12249GDBusInterfaceInfo *
12250control_bmc_interface_info (void)
12251{
12252 return (GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct;
12253}
12254
12255/**
12256 * control_bmc_override_properties:
12257 * @klass: The class structure for a #GObject<!-- -->-derived class.
12258 * @property_id_begin: The property id to assign to the first overridden property.
12259 *
12260 * Overrides all #GObject properties in the #ControlBmc interface for a concrete class.
12261 * The properties are overridden in the order they are defined.
12262 *
12263 * Returns: The last property id.
12264 */
12265guint
12266control_bmc_override_properties (GObjectClass *klass, guint property_id_begin)
12267{
12268 return property_id_begin - 1;
12269}
12270
12271
12272
12273/**
12274 * ControlBmc:
12275 *
12276 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
12277 */
12278
12279/**
12280 * ControlBmcIface:
12281 * @parent_iface: The parent interface.
12282 * @handle_place_holder: Handler for the #ControlBmc::handle-place-holder signal.
12283 *
12284 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
12285 */
12286
12287typedef ControlBmcIface ControlBmcInterface;
12288G_DEFINE_INTERFACE (ControlBmc, control_bmc, G_TYPE_OBJECT);
12289
12290static void
12291control_bmc_default_init (ControlBmcIface *iface)
12292{
12293 /* GObject signals for incoming D-Bus method calls: */
12294 /**
12295 * ControlBmc::handle-place-holder:
12296 * @object: A #ControlBmc.
12297 * @invocation: A #GDBusMethodInvocation.
12298 *
12299 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Bmc.place_holder">place_holder()</link> D-Bus method.
12300 *
12301 * 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_bmc_complete_place_holder() 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.
12302 *
12303 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
12304 */
12305 g_signal_new ("handle-place-holder",
12306 G_TYPE_FROM_INTERFACE (iface),
12307 G_SIGNAL_RUN_LAST,
12308 G_STRUCT_OFFSET (ControlBmcIface, handle_place_holder),
12309 g_signal_accumulator_true_handled,
12310 NULL,
12311 g_cclosure_marshal_generic,
12312 G_TYPE_BOOLEAN,
12313 1,
12314 G_TYPE_DBUS_METHOD_INVOCATION);
12315
12316}
12317
12318/**
12319 * control_bmc_call_place_holder:
12320 * @proxy: A #ControlBmcProxy.
12321 * @cancellable: (allow-none): A #GCancellable or %NULL.
12322 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
12323 * @user_data: User data to pass to @callback.
12324 *
12325 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.place_holder">place_holder()</link> D-Bus method on @proxy.
12326 * 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.
12327 * You can then call control_bmc_call_place_holder_finish() to get the result of the operation.
12328 *
12329 * See control_bmc_call_place_holder_sync() for the synchronous, blocking version of this method.
12330 */
12331void
12332control_bmc_call_place_holder (
12333 ControlBmc *proxy,
12334 GCancellable *cancellable,
12335 GAsyncReadyCallback callback,
12336 gpointer user_data)
12337{
12338 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
12339 "place_holder",
12340 g_variant_new ("()"),
12341 G_DBUS_CALL_FLAGS_NONE,
12342 -1,
12343 cancellable,
12344 callback,
12345 user_data);
12346}
12347
12348/**
12349 * control_bmc_call_place_holder_finish:
12350 * @proxy: A #ControlBmcProxy.
12351 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_call_place_holder().
12352 * @error: Return location for error or %NULL.
12353 *
12354 * Finishes an operation started with control_bmc_call_place_holder().
12355 *
12356 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
12357 */
12358gboolean
12359control_bmc_call_place_holder_finish (
12360 ControlBmc *proxy,
12361 GAsyncResult *res,
12362 GError **error)
12363{
12364 GVariant *_ret;
12365 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
12366 if (_ret == NULL)
12367 goto _out;
12368 g_variant_get (_ret,
12369 "()");
12370 g_variant_unref (_ret);
12371_out:
12372 return _ret != NULL;
12373}
12374
12375/**
12376 * control_bmc_call_place_holder_sync:
12377 * @proxy: A #ControlBmcProxy.
12378 * @cancellable: (allow-none): A #GCancellable or %NULL.
12379 * @error: Return location for error or %NULL.
12380 *
12381 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.place_holder">place_holder()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
12382 *
12383 * See control_bmc_call_place_holder() for the asynchronous version of this method.
12384 *
12385 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
12386 */
12387gboolean
12388control_bmc_call_place_holder_sync (
12389 ControlBmc *proxy,
12390 GCancellable *cancellable,
12391 GError **error)
12392{
12393 GVariant *_ret;
12394 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
12395 "place_holder",
12396 g_variant_new ("()"),
12397 G_DBUS_CALL_FLAGS_NONE,
12398 -1,
12399 cancellable,
12400 error);
12401 if (_ret == NULL)
12402 goto _out;
12403 g_variant_get (_ret,
12404 "()");
12405 g_variant_unref (_ret);
12406_out:
12407 return _ret != NULL;
12408}
12409
12410/**
12411 * control_bmc_complete_place_holder:
12412 * @object: A #ControlBmc.
12413 * @invocation: (transfer full): A #GDBusMethodInvocation.
12414 *
12415 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Bmc.place_holder">place_holder()</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.
12416 *
12417 * This method will free @invocation, you cannot use it afterwards.
12418 */
12419void
12420control_bmc_complete_place_holder (
12421 ControlBmc *object,
12422 GDBusMethodInvocation *invocation)
12423{
12424 g_dbus_method_invocation_return_value (invocation,
12425 g_variant_new ("()"));
12426}
12427
12428/* ------------------------------------------------------------------------ */
12429
12430/**
12431 * ControlBmcProxy:
12432 *
12433 * The #ControlBmcProxy structure contains only private data and should only be accessed using the provided API.
12434 */
12435
12436/**
12437 * ControlBmcProxyClass:
12438 * @parent_class: The parent class.
12439 *
12440 * Class structure for #ControlBmcProxy.
12441 */
12442
12443struct _ControlBmcProxyPrivate
12444{
12445 GData *qdata;
12446};
12447
12448static void control_bmc_proxy_iface_init (ControlBmcIface *iface);
12449
12450#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12451G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY,
12452 G_ADD_PRIVATE (ControlBmcProxy)
12453 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init));
12454
12455#else
12456G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY,
12457 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init));
12458
12459#endif
12460static void
12461control_bmc_proxy_finalize (GObject *object)
12462{
12463 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (object);
12464 g_datalist_clear (&proxy->priv->qdata);
12465 G_OBJECT_CLASS (control_bmc_proxy_parent_class)->finalize (object);
12466}
12467
12468static void
12469control_bmc_proxy_get_property (GObject *object,
12470 guint prop_id,
12471 GValue *value,
12472 GParamSpec *pspec G_GNUC_UNUSED)
12473{
12474}
12475
12476static void
12477control_bmc_proxy_set_property (GObject *object,
12478 guint prop_id,
12479 const GValue *value,
12480 GParamSpec *pspec G_GNUC_UNUSED)
12481{
12482}
12483
12484static void
12485control_bmc_proxy_g_signal (GDBusProxy *proxy,
12486 const gchar *sender_name G_GNUC_UNUSED,
12487 const gchar *signal_name,
12488 GVariant *parameters)
12489{
12490 _ExtendedGDBusSignalInfo *info;
12491 GVariantIter iter;
12492 GVariant *child;
12493 GValue *paramv;
12494 guint num_params;
12495 guint n;
12496 guint signal_id;
12497 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, signal_name);
12498 if (info == NULL)
12499 return;
12500 num_params = g_variant_n_children (parameters);
12501 paramv = g_new0 (GValue, num_params + 1);
12502 g_value_init (&paramv[0], TYPE_CONTROL_BMC);
12503 g_value_set_object (&paramv[0], proxy);
12504 g_variant_iter_init (&iter, parameters);
12505 n = 1;
12506 while ((child = g_variant_iter_next_value (&iter)) != NULL)
12507 {
12508 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
12509 if (arg_info->use_gvariant)
12510 {
12511 g_value_init (&paramv[n], G_TYPE_VARIANT);
12512 g_value_set_variant (&paramv[n], child);
12513 n++;
12514 }
12515 else
12516 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
12517 g_variant_unref (child);
12518 }
12519 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC);
12520 g_signal_emitv (paramv, signal_id, 0, NULL);
12521 for (n = 0; n < num_params + 1; n++)
12522 g_value_unset (&paramv[n]);
12523 g_free (paramv);
12524}
12525
12526static void
12527control_bmc_proxy_g_properties_changed (GDBusProxy *_proxy,
12528 GVariant *changed_properties,
12529 const gchar *const *invalidated_properties)
12530{
12531 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (_proxy);
12532 guint n;
12533 const gchar *key;
12534 GVariantIter *iter;
12535 _ExtendedGDBusPropertyInfo *info;
12536 g_variant_get (changed_properties, "a{sv}", &iter);
12537 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
12538 {
12539 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, key);
12540 g_datalist_remove_data (&proxy->priv->qdata, key);
12541 if (info != NULL)
12542 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
12543 }
12544 g_variant_iter_free (iter);
12545 for (n = 0; invalidated_properties[n] != NULL; n++)
12546 {
12547 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, invalidated_properties[n]);
12548 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
12549 if (info != NULL)
12550 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
12551 }
12552}
12553
12554static void
12555control_bmc_proxy_init (ControlBmcProxy *proxy)
12556{
12557#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12558 proxy->priv = control_bmc_proxy_get_instance_private (proxy);
12559#else
12560 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_BMC_PROXY, ControlBmcProxyPrivate);
12561#endif
12562
12563 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_bmc_interface_info ());
12564}
12565
12566static void
12567control_bmc_proxy_class_init (ControlBmcProxyClass *klass)
12568{
12569 GObjectClass *gobject_class;
12570 GDBusProxyClass *proxy_class;
12571
12572 gobject_class = G_OBJECT_CLASS (klass);
12573 gobject_class->finalize = control_bmc_proxy_finalize;
12574 gobject_class->get_property = control_bmc_proxy_get_property;
12575 gobject_class->set_property = control_bmc_proxy_set_property;
12576
12577 proxy_class = G_DBUS_PROXY_CLASS (klass);
12578 proxy_class->g_signal = control_bmc_proxy_g_signal;
12579 proxy_class->g_properties_changed = control_bmc_proxy_g_properties_changed;
12580
12581#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
12582 g_type_class_add_private (klass, sizeof (ControlBmcProxyPrivate));
12583#endif
12584}
12585
12586static void
12587control_bmc_proxy_iface_init (ControlBmcIface *iface)
12588{
12589}
12590
12591/**
12592 * control_bmc_proxy_new:
12593 * @connection: A #GDBusConnection.
12594 * @flags: Flags from the #GDBusProxyFlags enumeration.
12595 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
12596 * @object_path: An object path.
12597 * @cancellable: (allow-none): A #GCancellable or %NULL.
12598 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
12599 * @user_data: User data to pass to @callback.
12600 *
12601 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>. See g_dbus_proxy_new() for more details.
12602 *
12603 * 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.
12604 * You can then call control_bmc_proxy_new_finish() to get the result of the operation.
12605 *
12606 * See control_bmc_proxy_new_sync() for the synchronous, blocking version of this constructor.
12607 */
12608void
12609control_bmc_proxy_new (
12610 GDBusConnection *connection,
12611 GDBusProxyFlags flags,
12612 const gchar *name,
12613 const gchar *object_path,
12614 GCancellable *cancellable,
12615 GAsyncReadyCallback callback,
12616 gpointer user_data)
12617{
12618 g_async_initable_new_async (TYPE_CONTROL_BMC_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.Bmc", NULL);
12619}
12620
12621/**
12622 * control_bmc_proxy_new_finish:
12623 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new().
12624 * @error: Return location for error or %NULL
12625 *
12626 * Finishes an operation started with control_bmc_proxy_new().
12627 *
12628 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
12629 */
12630ControlBmc *
12631control_bmc_proxy_new_finish (
12632 GAsyncResult *res,
12633 GError **error)
12634{
12635 GObject *ret;
12636 GObject *source_object;
12637 source_object = g_async_result_get_source_object (res);
12638 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
12639 g_object_unref (source_object);
12640 if (ret != NULL)
12641 return CONTROL_BMC (ret);
12642 else
12643 return NULL;
12644}
12645
12646/**
12647 * control_bmc_proxy_new_sync:
12648 * @connection: A #GDBusConnection.
12649 * @flags: Flags from the #GDBusProxyFlags enumeration.
12650 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
12651 * @object_path: An object path.
12652 * @cancellable: (allow-none): A #GCancellable or %NULL.
12653 * @error: Return location for error or %NULL
12654 *
12655 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>. See g_dbus_proxy_new_sync() for more details.
12656 *
12657 * The calling thread is blocked until a reply is received.
12658 *
12659 * See control_bmc_proxy_new() for the asynchronous version of this constructor.
12660 *
12661 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
12662 */
12663ControlBmc *
12664control_bmc_proxy_new_sync (
12665 GDBusConnection *connection,
12666 GDBusProxyFlags flags,
12667 const gchar *name,
12668 const gchar *object_path,
12669 GCancellable *cancellable,
12670 GError **error)
12671{
12672 GInitable *ret;
12673 ret = g_initable_new (TYPE_CONTROL_BMC_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Bmc", NULL);
12674 if (ret != NULL)
12675 return CONTROL_BMC (ret);
12676 else
12677 return NULL;
12678}
12679
12680
12681/**
12682 * control_bmc_proxy_new_for_bus:
12683 * @bus_type: A #GBusType.
12684 * @flags: Flags from the #GDBusProxyFlags enumeration.
12685 * @name: A bus name (well-known or unique).
12686 * @object_path: An object path.
12687 * @cancellable: (allow-none): A #GCancellable or %NULL.
12688 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
12689 * @user_data: User data to pass to @callback.
12690 *
12691 * Like control_bmc_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
12692 *
12693 * 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.
12694 * You can then call control_bmc_proxy_new_for_bus_finish() to get the result of the operation.
12695 *
12696 * See control_bmc_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
12697 */
12698void
12699control_bmc_proxy_new_for_bus (
12700 GBusType bus_type,
12701 GDBusProxyFlags flags,
12702 const gchar *name,
12703 const gchar *object_path,
12704 GCancellable *cancellable,
12705 GAsyncReadyCallback callback,
12706 gpointer user_data)
12707{
12708 g_async_initable_new_async (TYPE_CONTROL_BMC_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.Bmc", NULL);
12709}
12710
12711/**
12712 * control_bmc_proxy_new_for_bus_finish:
12713 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new_for_bus().
12714 * @error: Return location for error or %NULL
12715 *
12716 * Finishes an operation started with control_bmc_proxy_new_for_bus().
12717 *
12718 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
12719 */
12720ControlBmc *
12721control_bmc_proxy_new_for_bus_finish (
12722 GAsyncResult *res,
12723 GError **error)
12724{
12725 GObject *ret;
12726 GObject *source_object;
12727 source_object = g_async_result_get_source_object (res);
12728 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
12729 g_object_unref (source_object);
12730 if (ret != NULL)
12731 return CONTROL_BMC (ret);
12732 else
12733 return NULL;
12734}
12735
12736/**
12737 * control_bmc_proxy_new_for_bus_sync:
12738 * @bus_type: A #GBusType.
12739 * @flags: Flags from the #GDBusProxyFlags enumeration.
12740 * @name: A bus name (well-known or unique).
12741 * @object_path: An object path.
12742 * @cancellable: (allow-none): A #GCancellable or %NULL.
12743 * @error: Return location for error or %NULL
12744 *
12745 * Like control_bmc_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
12746 *
12747 * The calling thread is blocked until a reply is received.
12748 *
12749 * See control_bmc_proxy_new_for_bus() for the asynchronous version of this constructor.
12750 *
12751 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
12752 */
12753ControlBmc *
12754control_bmc_proxy_new_for_bus_sync (
12755 GBusType bus_type,
12756 GDBusProxyFlags flags,
12757 const gchar *name,
12758 const gchar *object_path,
12759 GCancellable *cancellable,
12760 GError **error)
12761{
12762 GInitable *ret;
12763 ret = g_initable_new (TYPE_CONTROL_BMC_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.Bmc", NULL);
12764 if (ret != NULL)
12765 return CONTROL_BMC (ret);
12766 else
12767 return NULL;
12768}
12769
12770
12771/* ------------------------------------------------------------------------ */
12772
12773/**
12774 * ControlBmcSkeleton:
12775 *
12776 * The #ControlBmcSkeleton structure contains only private data and should only be accessed using the provided API.
12777 */
12778
12779/**
12780 * ControlBmcSkeletonClass:
12781 * @parent_class: The parent class.
12782 *
12783 * Class structure for #ControlBmcSkeleton.
12784 */
12785
12786struct _ControlBmcSkeletonPrivate
12787{
12788 GValue *properties;
12789 GList *changed_properties;
12790 GSource *changed_properties_idle_source;
12791 GMainContext *context;
12792 GMutex lock;
12793};
12794
12795static void
12796_control_bmc_skeleton_handle_method_call (
12797 GDBusConnection *connection G_GNUC_UNUSED,
12798 const gchar *sender G_GNUC_UNUSED,
12799 const gchar *object_path G_GNUC_UNUSED,
12800 const gchar *interface_name,
12801 const gchar *method_name,
12802 GVariant *parameters,
12803 GDBusMethodInvocation *invocation,
12804 gpointer user_data)
12805{
12806 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
12807 _ExtendedGDBusMethodInfo *info;
12808 GVariantIter iter;
12809 GVariant *child;
12810 GValue *paramv;
12811 guint num_params;
12812 guint num_extra;
12813 guint n;
12814 guint signal_id;
12815 GValue return_value = G_VALUE_INIT;
12816 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
12817 g_assert (info != NULL);
12818 num_params = g_variant_n_children (parameters);
12819 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
12820 n = 0;
12821 g_value_init (&paramv[n], TYPE_CONTROL_BMC);
12822 g_value_set_object (&paramv[n++], skeleton);
12823 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
12824 g_value_set_object (&paramv[n++], invocation);
12825 if (info->pass_fdlist)
12826 {
12827#ifdef G_OS_UNIX
12828 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
12829 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
12830#else
12831 g_assert_not_reached ();
12832#endif
12833 }
12834 g_variant_iter_init (&iter, parameters);
12835 while ((child = g_variant_iter_next_value (&iter)) != NULL)
12836 {
12837 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
12838 if (arg_info->use_gvariant)
12839 {
12840 g_value_init (&paramv[n], G_TYPE_VARIANT);
12841 g_value_set_variant (&paramv[n], child);
12842 n++;
12843 }
12844 else
12845 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
12846 g_variant_unref (child);
12847 }
12848 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC);
12849 g_value_init (&return_value, G_TYPE_BOOLEAN);
12850 g_signal_emitv (paramv, signal_id, 0, &return_value);
12851 if (!g_value_get_boolean (&return_value))
12852 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);
12853 g_value_unset (&return_value);
12854 for (n = 0; n < num_params + num_extra; n++)
12855 g_value_unset (&paramv[n]);
12856 g_free (paramv);
12857}
12858
12859static GVariant *
12860_control_bmc_skeleton_handle_get_property (
12861 GDBusConnection *connection G_GNUC_UNUSED,
12862 const gchar *sender G_GNUC_UNUSED,
12863 const gchar *object_path G_GNUC_UNUSED,
12864 const gchar *interface_name G_GNUC_UNUSED,
12865 const gchar *property_name,
12866 GError **error,
12867 gpointer user_data)
12868{
12869 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
12870 GValue value = G_VALUE_INIT;
12871 GParamSpec *pspec;
12872 _ExtendedGDBusPropertyInfo *info;
12873 GVariant *ret;
12874 ret = NULL;
12875 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name);
12876 g_assert (info != NULL);
12877 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
12878 if (pspec == NULL)
12879 {
12880 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
12881 }
12882 else
12883 {
12884 g_value_init (&value, pspec->value_type);
12885 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
12886 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
12887 g_value_unset (&value);
12888 }
12889 return ret;
12890}
12891
12892static gboolean
12893_control_bmc_skeleton_handle_set_property (
12894 GDBusConnection *connection G_GNUC_UNUSED,
12895 const gchar *sender G_GNUC_UNUSED,
12896 const gchar *object_path G_GNUC_UNUSED,
12897 const gchar *interface_name G_GNUC_UNUSED,
12898 const gchar *property_name,
12899 GVariant *variant,
12900 GError **error,
12901 gpointer user_data)
12902{
12903 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
12904 GValue value = G_VALUE_INIT;
12905 GParamSpec *pspec;
12906 _ExtendedGDBusPropertyInfo *info;
12907 gboolean ret;
12908 ret = FALSE;
12909 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name);
12910 g_assert (info != NULL);
12911 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
12912 if (pspec == NULL)
12913 {
12914 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
12915 }
12916 else
12917 {
12918 if (info->use_gvariant)
12919 g_value_set_variant (&value, variant);
12920 else
12921 g_dbus_gvariant_to_gvalue (variant, &value);
12922 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
12923 g_value_unset (&value);
12924 ret = TRUE;
12925 }
12926 return ret;
12927}
12928
12929static const GDBusInterfaceVTable _control_bmc_skeleton_vtable =
12930{
12931 _control_bmc_skeleton_handle_method_call,
12932 _control_bmc_skeleton_handle_get_property,
12933 _control_bmc_skeleton_handle_set_property,
12934 {NULL}
12935};
12936
12937static GDBusInterfaceInfo *
12938control_bmc_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
12939{
12940 return control_bmc_interface_info ();
12941}
12942
12943static GDBusInterfaceVTable *
12944control_bmc_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
12945{
12946 return (GDBusInterfaceVTable *) &_control_bmc_skeleton_vtable;
12947}
12948
12949static GVariant *
12950control_bmc_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
12951{
12952 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (_skeleton);
12953
12954 GVariantBuilder builder;
12955 guint n;
12956 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
12957 if (_control_bmc_interface_info.parent_struct.properties == NULL)
12958 goto out;
12959 for (n = 0; _control_bmc_interface_info.parent_struct.properties[n] != NULL; n++)
12960 {
12961 GDBusPropertyInfo *info = _control_bmc_interface_info.parent_struct.properties[n];
12962 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
12963 {
12964 GVariant *value;
12965 value = _control_bmc_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.Bmc", info->name, NULL, skeleton);
12966 if (value != NULL)
12967 {
12968 g_variant_take_ref (value);
12969 g_variant_builder_add (&builder, "{sv}", info->name, value);
12970 g_variant_unref (value);
12971 }
12972 }
12973 }
12974out:
12975 return g_variant_builder_end (&builder);
12976}
12977
12978static void
12979control_bmc_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
12980{
12981}
12982
12983static void control_bmc_skeleton_iface_init (ControlBmcIface *iface);
12984#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12985G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
12986 G_ADD_PRIVATE (ControlBmcSkeleton)
12987 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init));
12988
12989#else
12990G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
12991 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init));
12992
12993#endif
12994static void
12995control_bmc_skeleton_finalize (GObject *object)
12996{
12997 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (object);
12998 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
12999 if (skeleton->priv->changed_properties_idle_source != NULL)
13000 g_source_destroy (skeleton->priv->changed_properties_idle_source);
13001 g_main_context_unref (skeleton->priv->context);
13002 g_mutex_clear (&skeleton->priv->lock);
13003 G_OBJECT_CLASS (control_bmc_skeleton_parent_class)->finalize (object);
13004}
13005
13006static void
13007control_bmc_skeleton_init (ControlBmcSkeleton *skeleton)
13008{
13009#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13010 skeleton->priv = control_bmc_skeleton_get_instance_private (skeleton);
13011#else
13012 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_BMC_SKELETON, ControlBmcSkeletonPrivate);
13013#endif
13014
13015 g_mutex_init (&skeleton->priv->lock);
13016 skeleton->priv->context = g_main_context_ref_thread_default ();
13017}
13018
13019static void
13020control_bmc_skeleton_class_init (ControlBmcSkeletonClass *klass)
13021{
13022 GObjectClass *gobject_class;
13023 GDBusInterfaceSkeletonClass *skeleton_class;
13024
13025 gobject_class = G_OBJECT_CLASS (klass);
13026 gobject_class->finalize = control_bmc_skeleton_finalize;
13027
13028 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
13029 skeleton_class->get_info = control_bmc_skeleton_dbus_interface_get_info;
13030 skeleton_class->get_properties = control_bmc_skeleton_dbus_interface_get_properties;
13031 skeleton_class->flush = control_bmc_skeleton_dbus_interface_flush;
13032 skeleton_class->get_vtable = control_bmc_skeleton_dbus_interface_get_vtable;
13033
13034#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
13035 g_type_class_add_private (klass, sizeof (ControlBmcSkeletonPrivate));
13036#endif
13037}
13038
13039static void
13040control_bmc_skeleton_iface_init (ControlBmcIface *iface)
13041{
13042}
13043
13044/**
13045 * control_bmc_skeleton_new:
13046 *
13047 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
13048 *
13049 * Returns: (transfer full) (type ControlBmcSkeleton): The skeleton object.
13050 */
13051ControlBmc *
13052control_bmc_skeleton_new (void)
13053{
13054 return CONTROL_BMC (g_object_new (TYPE_CONTROL_BMC_SKELETON, NULL));
13055}
13056
13057/* ------------------------------------------------------------------------
13058 * Code for interface org.openbmc.control.Host
13059 * ------------------------------------------------------------------------
13060 */
13061
13062/**
13063 * SECTION:ControlHost
13064 * @title: ControlHost
13065 * @short_description: Generated C code for the org.openbmc.control.Host D-Bus interface
13066 *
13067 * 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.
13068 */
13069
13070/* ---- Introspection data for org.openbmc.control.Host ---- */
13071
13072static const _ExtendedGDBusMethodInfo _control_host_method_info_boot =
13073{
13074 {
13075 -1,
13076 (gchar *) "boot",
13077 NULL,
13078 NULL,
13079 NULL
13080 },
13081 "handle-boot",
13082 FALSE
13083};
13084
13085static const _ExtendedGDBusMethodInfo _control_host_method_info_shutdown =
13086{
13087 {
13088 -1,
13089 (gchar *) "shutdown",
13090 NULL,
13091 NULL,
13092 NULL
13093 },
13094 "handle-shutdown",
13095 FALSE
13096};
13097
13098static const _ExtendedGDBusMethodInfo _control_host_method_info_reboot =
13099{
13100 {
13101 -1,
13102 (gchar *) "reboot",
13103 NULL,
13104 NULL,
13105 NULL
13106 },
13107 "handle-reboot",
13108 FALSE
13109};
13110
13111static const _ExtendedGDBusMethodInfo * const _control_host_method_info_pointers[] =
13112{
13113 &_control_host_method_info_boot,
13114 &_control_host_method_info_shutdown,
13115 &_control_host_method_info_reboot,
13116 NULL
13117};
13118
13119static const _ExtendedGDBusSignalInfo _control_host_signal_info_booted =
13120{
13121 {
13122 -1,
13123 (gchar *) "Booted",
13124 NULL,
13125 NULL
13126 },
13127 "booted"
13128};
13129
13130static const _ExtendedGDBusSignalInfo * const _control_host_signal_info_pointers[] =
13131{
13132 &_control_host_signal_info_booted,
13133 NULL
13134};
13135
13136static const _ExtendedGDBusInterfaceInfo _control_host_interface_info =
13137{
13138 {
13139 -1,
13140 (gchar *) "org.openbmc.control.Host",
13141 (GDBusMethodInfo **) &_control_host_method_info_pointers,
13142 (GDBusSignalInfo **) &_control_host_signal_info_pointers,
13143 NULL,
13144 NULL
13145 },
13146 "control-host",
13147};
13148
13149
13150/**
13151 * control_host_interface_info:
13152 *
13153 * 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.
13154 *
13155 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
13156 */
13157GDBusInterfaceInfo *
13158control_host_interface_info (void)
13159{
13160 return (GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct;
13161}
13162
13163/**
13164 * control_host_override_properties:
13165 * @klass: The class structure for a #GObject<!-- -->-derived class.
13166 * @property_id_begin: The property id to assign to the first overridden property.
13167 *
13168 * Overrides all #GObject properties in the #ControlHost interface for a concrete class.
13169 * The properties are overridden in the order they are defined.
13170 *
13171 * Returns: The last property id.
13172 */
13173guint
13174control_host_override_properties (GObjectClass *klass, guint property_id_begin)
13175{
13176 return property_id_begin - 1;
13177}
13178
13179
13180
13181/**
13182 * ControlHost:
13183 *
13184 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
13185 */
13186
13187/**
13188 * ControlHostIface:
13189 * @parent_iface: The parent interface.
13190 * @handle_boot: Handler for the #ControlHost::handle-boot signal.
13191 * @handle_reboot: Handler for the #ControlHost::handle-reboot signal.
13192 * @handle_shutdown: Handler for the #ControlHost::handle-shutdown signal.
13193 * @booted: Handler for the #ControlHost::booted signal.
13194 *
13195 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
13196 */
13197
13198typedef ControlHostIface ControlHostInterface;
13199G_DEFINE_INTERFACE (ControlHost, control_host, G_TYPE_OBJECT);
13200
13201static void
13202control_host_default_init (ControlHostIface *iface)
13203{
13204 /* GObject signals for incoming D-Bus method calls: */
13205 /**
13206 * ControlHost::handle-boot:
13207 * @object: A #ControlHost.
13208 * @invocation: A #GDBusMethodInvocation.
13209 *
13210 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method.
13211 *
13212 * 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.
13213 *
13214 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
13215 */
13216 g_signal_new ("handle-boot",
13217 G_TYPE_FROM_INTERFACE (iface),
13218 G_SIGNAL_RUN_LAST,
13219 G_STRUCT_OFFSET (ControlHostIface, handle_boot),
13220 g_signal_accumulator_true_handled,
13221 NULL,
13222 g_cclosure_marshal_generic,
13223 G_TYPE_BOOLEAN,
13224 1,
13225 G_TYPE_DBUS_METHOD_INVOCATION);
13226
13227 /**
13228 * ControlHost::handle-shutdown:
13229 * @object: A #ControlHost.
13230 * @invocation: A #GDBusMethodInvocation.
13231 *
13232 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method.
13233 *
13234 * 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.
13235 *
13236 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
13237 */
13238 g_signal_new ("handle-shutdown",
13239 G_TYPE_FROM_INTERFACE (iface),
13240 G_SIGNAL_RUN_LAST,
13241 G_STRUCT_OFFSET (ControlHostIface, handle_shutdown),
13242 g_signal_accumulator_true_handled,
13243 NULL,
13244 g_cclosure_marshal_generic,
13245 G_TYPE_BOOLEAN,
13246 1,
13247 G_TYPE_DBUS_METHOD_INVOCATION);
13248
13249 /**
13250 * ControlHost::handle-reboot:
13251 * @object: A #ControlHost.
13252 * @invocation: A #GDBusMethodInvocation.
13253 *
13254 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method.
13255 *
13256 * 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.
13257 *
13258 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
13259 */
13260 g_signal_new ("handle-reboot",
13261 G_TYPE_FROM_INTERFACE (iface),
13262 G_SIGNAL_RUN_LAST,
13263 G_STRUCT_OFFSET (ControlHostIface, handle_reboot),
13264 g_signal_accumulator_true_handled,
13265 NULL,
13266 g_cclosure_marshal_generic,
13267 G_TYPE_BOOLEAN,
13268 1,
13269 G_TYPE_DBUS_METHOD_INVOCATION);
13270
13271 /* GObject signals for received D-Bus signals: */
13272 /**
13273 * ControlHost::booted:
13274 * @object: A #ControlHost.
13275 *
13276 * 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.
13277 *
13278 * 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.
13279 */
13280 g_signal_new ("booted",
13281 G_TYPE_FROM_INTERFACE (iface),
13282 G_SIGNAL_RUN_LAST,
13283 G_STRUCT_OFFSET (ControlHostIface, booted),
13284 NULL,
13285 NULL,
13286 g_cclosure_marshal_generic,
13287 G_TYPE_NONE,
13288 0);
13289
13290}
13291
13292/**
13293 * control_host_emit_booted:
13294 * @object: A #ControlHost.
13295 *
13296 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Host.Booted">"Booted"</link> D-Bus signal.
13297 */
13298void
13299control_host_emit_booted (
13300 ControlHost *object)
13301{
13302 g_signal_emit_by_name (object, "booted");
13303}
13304
13305/**
13306 * control_host_call_boot:
13307 * @proxy: A #ControlHostProxy.
13308 * @cancellable: (allow-none): A #GCancellable or %NULL.
13309 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
13310 * @user_data: User data to pass to @callback.
13311 *
13312 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method on @proxy.
13313 * 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.
13314 * You can then call control_host_call_boot_finish() to get the result of the operation.
13315 *
13316 * See control_host_call_boot_sync() for the synchronous, blocking version of this method.
13317 */
13318void
13319control_host_call_boot (
13320 ControlHost *proxy,
13321 GCancellable *cancellable,
13322 GAsyncReadyCallback callback,
13323 gpointer user_data)
13324{
13325 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
13326 "boot",
13327 g_variant_new ("()"),
13328 G_DBUS_CALL_FLAGS_NONE,
13329 -1,
13330 cancellable,
13331 callback,
13332 user_data);
13333}
13334
13335/**
13336 * control_host_call_boot_finish:
13337 * @proxy: A #ControlHostProxy.
13338 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_boot().
13339 * @error: Return location for error or %NULL.
13340 *
13341 * Finishes an operation started with control_host_call_boot().
13342 *
13343 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13344 */
13345gboolean
13346control_host_call_boot_finish (
13347 ControlHost *proxy,
13348 GAsyncResult *res,
13349 GError **error)
13350{
13351 GVariant *_ret;
13352 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
13353 if (_ret == NULL)
13354 goto _out;
13355 g_variant_get (_ret,
13356 "()");
13357 g_variant_unref (_ret);
13358_out:
13359 return _ret != NULL;
13360}
13361
13362/**
13363 * control_host_call_boot_sync:
13364 * @proxy: A #ControlHostProxy.
13365 * @cancellable: (allow-none): A #GCancellable or %NULL.
13366 * @error: Return location for error or %NULL.
13367 *
13368 * 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.
13369 *
13370 * See control_host_call_boot() for the asynchronous version of this method.
13371 *
13372 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13373 */
13374gboolean
13375control_host_call_boot_sync (
13376 ControlHost *proxy,
13377 GCancellable *cancellable,
13378 GError **error)
13379{
13380 GVariant *_ret;
13381 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
13382 "boot",
13383 g_variant_new ("()"),
13384 G_DBUS_CALL_FLAGS_NONE,
13385 -1,
13386 cancellable,
13387 error);
13388 if (_ret == NULL)
13389 goto _out;
13390 g_variant_get (_ret,
13391 "()");
13392 g_variant_unref (_ret);
13393_out:
13394 return _ret != NULL;
13395}
13396
13397/**
13398 * control_host_call_shutdown:
13399 * @proxy: A #ControlHostProxy.
13400 * @cancellable: (allow-none): A #GCancellable or %NULL.
13401 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
13402 * @user_data: User data to pass to @callback.
13403 *
13404 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method on @proxy.
13405 * 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.
13406 * You can then call control_host_call_shutdown_finish() to get the result of the operation.
13407 *
13408 * See control_host_call_shutdown_sync() for the synchronous, blocking version of this method.
13409 */
13410void
13411control_host_call_shutdown (
13412 ControlHost *proxy,
13413 GCancellable *cancellable,
13414 GAsyncReadyCallback callback,
13415 gpointer user_data)
13416{
13417 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
13418 "shutdown",
13419 g_variant_new ("()"),
13420 G_DBUS_CALL_FLAGS_NONE,
13421 -1,
13422 cancellable,
13423 callback,
13424 user_data);
13425}
13426
13427/**
13428 * control_host_call_shutdown_finish:
13429 * @proxy: A #ControlHostProxy.
13430 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_shutdown().
13431 * @error: Return location for error or %NULL.
13432 *
13433 * Finishes an operation started with control_host_call_shutdown().
13434 *
13435 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13436 */
13437gboolean
13438control_host_call_shutdown_finish (
13439 ControlHost *proxy,
13440 GAsyncResult *res,
13441 GError **error)
13442{
13443 GVariant *_ret;
13444 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
13445 if (_ret == NULL)
13446 goto _out;
13447 g_variant_get (_ret,
13448 "()");
13449 g_variant_unref (_ret);
13450_out:
13451 return _ret != NULL;
13452}
13453
13454/**
13455 * control_host_call_shutdown_sync:
13456 * @proxy: A #ControlHostProxy.
13457 * @cancellable: (allow-none): A #GCancellable or %NULL.
13458 * @error: Return location for error or %NULL.
13459 *
13460 * 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.
13461 *
13462 * See control_host_call_shutdown() for the asynchronous version of this method.
13463 *
13464 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13465 */
13466gboolean
13467control_host_call_shutdown_sync (
13468 ControlHost *proxy,
13469 GCancellable *cancellable,
13470 GError **error)
13471{
13472 GVariant *_ret;
13473 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
13474 "shutdown",
13475 g_variant_new ("()"),
13476 G_DBUS_CALL_FLAGS_NONE,
13477 -1,
13478 cancellable,
13479 error);
13480 if (_ret == NULL)
13481 goto _out;
13482 g_variant_get (_ret,
13483 "()");
13484 g_variant_unref (_ret);
13485_out:
13486 return _ret != NULL;
13487}
13488
13489/**
13490 * control_host_call_reboot:
13491 * @proxy: A #ControlHostProxy.
13492 * @cancellable: (allow-none): A #GCancellable or %NULL.
13493 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
13494 * @user_data: User data to pass to @callback.
13495 *
13496 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method on @proxy.
13497 * 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.
13498 * You can then call control_host_call_reboot_finish() to get the result of the operation.
13499 *
13500 * See control_host_call_reboot_sync() for the synchronous, blocking version of this method.
13501 */
13502void
13503control_host_call_reboot (
13504 ControlHost *proxy,
13505 GCancellable *cancellable,
13506 GAsyncReadyCallback callback,
13507 gpointer user_data)
13508{
13509 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
13510 "reboot",
13511 g_variant_new ("()"),
13512 G_DBUS_CALL_FLAGS_NONE,
13513 -1,
13514 cancellable,
13515 callback,
13516 user_data);
13517}
13518
13519/**
13520 * control_host_call_reboot_finish:
13521 * @proxy: A #ControlHostProxy.
13522 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_reboot().
13523 * @error: Return location for error or %NULL.
13524 *
13525 * Finishes an operation started with control_host_call_reboot().
13526 *
13527 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13528 */
13529gboolean
13530control_host_call_reboot_finish (
13531 ControlHost *proxy,
13532 GAsyncResult *res,
13533 GError **error)
13534{
13535 GVariant *_ret;
13536 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
13537 if (_ret == NULL)
13538 goto _out;
13539 g_variant_get (_ret,
13540 "()");
13541 g_variant_unref (_ret);
13542_out:
13543 return _ret != NULL;
13544}
13545
13546/**
13547 * control_host_call_reboot_sync:
13548 * @proxy: A #ControlHostProxy.
13549 * @cancellable: (allow-none): A #GCancellable or %NULL.
13550 * @error: Return location for error or %NULL.
13551 *
13552 * 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.
13553 *
13554 * See control_host_call_reboot() for the asynchronous version of this method.
13555 *
13556 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13557 */
13558gboolean
13559control_host_call_reboot_sync (
13560 ControlHost *proxy,
13561 GCancellable *cancellable,
13562 GError **error)
13563{
13564 GVariant *_ret;
13565 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
13566 "reboot",
13567 g_variant_new ("()"),
13568 G_DBUS_CALL_FLAGS_NONE,
13569 -1,
13570 cancellable,
13571 error);
13572 if (_ret == NULL)
13573 goto _out;
13574 g_variant_get (_ret,
13575 "()");
13576 g_variant_unref (_ret);
13577_out:
13578 return _ret != NULL;
13579}
13580
13581/**
13582 * control_host_complete_boot:
13583 * @object: A #ControlHost.
13584 * @invocation: (transfer full): A #GDBusMethodInvocation.
13585 *
13586 * 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.
13587 *
13588 * This method will free @invocation, you cannot use it afterwards.
13589 */
13590void
13591control_host_complete_boot (
13592 ControlHost *object,
13593 GDBusMethodInvocation *invocation)
13594{
13595 g_dbus_method_invocation_return_value (invocation,
13596 g_variant_new ("()"));
13597}
13598
13599/**
13600 * control_host_complete_shutdown:
13601 * @object: A #ControlHost.
13602 * @invocation: (transfer full): A #GDBusMethodInvocation.
13603 *
13604 * 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.
13605 *
13606 * This method will free @invocation, you cannot use it afterwards.
13607 */
13608void
13609control_host_complete_shutdown (
13610 ControlHost *object,
13611 GDBusMethodInvocation *invocation)
13612{
13613 g_dbus_method_invocation_return_value (invocation,
13614 g_variant_new ("()"));
13615}
13616
13617/**
13618 * control_host_complete_reboot:
13619 * @object: A #ControlHost.
13620 * @invocation: (transfer full): A #GDBusMethodInvocation.
13621 *
13622 * 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.
13623 *
13624 * This method will free @invocation, you cannot use it afterwards.
13625 */
13626void
13627control_host_complete_reboot (
13628 ControlHost *object,
13629 GDBusMethodInvocation *invocation)
13630{
13631 g_dbus_method_invocation_return_value (invocation,
13632 g_variant_new ("()"));
13633}
13634
13635/* ------------------------------------------------------------------------ */
13636
13637/**
13638 * ControlHostProxy:
13639 *
13640 * The #ControlHostProxy structure contains only private data and should only be accessed using the provided API.
13641 */
13642
13643/**
13644 * ControlHostProxyClass:
13645 * @parent_class: The parent class.
13646 *
13647 * Class structure for #ControlHostProxy.
13648 */
13649
13650struct _ControlHostProxyPrivate
13651{
13652 GData *qdata;
13653};
13654
13655static void control_host_proxy_iface_init (ControlHostIface *iface);
13656
13657#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13658G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
13659 G_ADD_PRIVATE (ControlHostProxy)
13660 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
13661
13662#else
13663G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
13664 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
13665
13666#endif
13667static void
13668control_host_proxy_finalize (GObject *object)
13669{
13670 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object);
13671 g_datalist_clear (&proxy->priv->qdata);
13672 G_OBJECT_CLASS (control_host_proxy_parent_class)->finalize (object);
13673}
13674
13675static void
13676control_host_proxy_get_property (GObject *object,
13677 guint prop_id,
13678 GValue *value,
13679 GParamSpec *pspec G_GNUC_UNUSED)
13680{
13681}
13682
13683static void
13684control_host_proxy_set_property (GObject *object,
13685 guint prop_id,
13686 const GValue *value,
13687 GParamSpec *pspec G_GNUC_UNUSED)
13688{
13689}
13690
13691static void
13692control_host_proxy_g_signal (GDBusProxy *proxy,
13693 const gchar *sender_name G_GNUC_UNUSED,
13694 const gchar *signal_name,
13695 GVariant *parameters)
13696{
13697 _ExtendedGDBusSignalInfo *info;
13698 GVariantIter iter;
13699 GVariant *child;
13700 GValue *paramv;
13701 guint num_params;
13702 guint n;
13703 guint signal_id;
13704 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, signal_name);
13705 if (info == NULL)
13706 return;
13707 num_params = g_variant_n_children (parameters);
13708 paramv = g_new0 (GValue, num_params + 1);
13709 g_value_init (&paramv[0], TYPE_CONTROL_HOST);
13710 g_value_set_object (&paramv[0], proxy);
13711 g_variant_iter_init (&iter, parameters);
13712 n = 1;
13713 while ((child = g_variant_iter_next_value (&iter)) != NULL)
13714 {
13715 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
13716 if (arg_info->use_gvariant)
13717 {
13718 g_value_init (&paramv[n], G_TYPE_VARIANT);
13719 g_value_set_variant (&paramv[n], child);
13720 n++;
13721 }
13722 else
13723 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
13724 g_variant_unref (child);
13725 }
13726 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
13727 g_signal_emitv (paramv, signal_id, 0, NULL);
13728 for (n = 0; n < num_params + 1; n++)
13729 g_value_unset (&paramv[n]);
13730 g_free (paramv);
13731}
13732
13733static void
13734control_host_proxy_g_properties_changed (GDBusProxy *_proxy,
13735 GVariant *changed_properties,
13736 const gchar *const *invalidated_properties)
13737{
13738 ControlHostProxy *proxy = CONTROL_HOST_PROXY (_proxy);
13739 guint n;
13740 const gchar *key;
13741 GVariantIter *iter;
13742 _ExtendedGDBusPropertyInfo *info;
13743 g_variant_get (changed_properties, "a{sv}", &iter);
13744 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
13745 {
13746 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, key);
13747 g_datalist_remove_data (&proxy->priv->qdata, key);
13748 if (info != NULL)
13749 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
13750 }
13751 g_variant_iter_free (iter);
13752 for (n = 0; invalidated_properties[n] != NULL; n++)
13753 {
13754 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, invalidated_properties[n]);
13755 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
13756 if (info != NULL)
13757 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
13758 }
13759}
13760
13761static void
13762control_host_proxy_init (ControlHostProxy *proxy)
13763{
13764#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13765 proxy->priv = control_host_proxy_get_instance_private (proxy);
13766#else
13767 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_HOST_PROXY, ControlHostProxyPrivate);
13768#endif
13769
13770 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_host_interface_info ());
13771}
13772
13773static void
13774control_host_proxy_class_init (ControlHostProxyClass *klass)
13775{
13776 GObjectClass *gobject_class;
13777 GDBusProxyClass *proxy_class;
13778
13779 gobject_class = G_OBJECT_CLASS (klass);
13780 gobject_class->finalize = control_host_proxy_finalize;
13781 gobject_class->get_property = control_host_proxy_get_property;
13782 gobject_class->set_property = control_host_proxy_set_property;
13783
13784 proxy_class = G_DBUS_PROXY_CLASS (klass);
13785 proxy_class->g_signal = control_host_proxy_g_signal;
13786 proxy_class->g_properties_changed = control_host_proxy_g_properties_changed;
13787
13788#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
13789 g_type_class_add_private (klass, sizeof (ControlHostProxyPrivate));
13790#endif
13791}
13792
13793static void
13794control_host_proxy_iface_init (ControlHostIface *iface)
13795{
13796}
13797
13798/**
13799 * control_host_proxy_new:
13800 * @connection: A #GDBusConnection.
13801 * @flags: Flags from the #GDBusProxyFlags enumeration.
13802 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
13803 * @object_path: An object path.
13804 * @cancellable: (allow-none): A #GCancellable or %NULL.
13805 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
13806 * @user_data: User data to pass to @callback.
13807 *
13808 * 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.
13809 *
13810 * 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.
13811 * You can then call control_host_proxy_new_finish() to get the result of the operation.
13812 *
13813 * See control_host_proxy_new_sync() for the synchronous, blocking version of this constructor.
13814 */
13815void
13816control_host_proxy_new (
13817 GDBusConnection *connection,
13818 GDBusProxyFlags flags,
13819 const gchar *name,
13820 const gchar *object_path,
13821 GCancellable *cancellable,
13822 GAsyncReadyCallback callback,
13823 gpointer user_data)
13824{
13825 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);
13826}
13827
13828/**
13829 * control_host_proxy_new_finish:
13830 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new().
13831 * @error: Return location for error or %NULL
13832 *
13833 * Finishes an operation started with control_host_proxy_new().
13834 *
13835 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
13836 */
13837ControlHost *
13838control_host_proxy_new_finish (
13839 GAsyncResult *res,
13840 GError **error)
13841{
13842 GObject *ret;
13843 GObject *source_object;
13844 source_object = g_async_result_get_source_object (res);
13845 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
13846 g_object_unref (source_object);
13847 if (ret != NULL)
13848 return CONTROL_HOST (ret);
13849 else
13850 return NULL;
13851}
13852
13853/**
13854 * control_host_proxy_new_sync:
13855 * @connection: A #GDBusConnection.
13856 * @flags: Flags from the #GDBusProxyFlags enumeration.
13857 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
13858 * @object_path: An object path.
13859 * @cancellable: (allow-none): A #GCancellable or %NULL.
13860 * @error: Return location for error or %NULL
13861 *
13862 * 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.
13863 *
13864 * The calling thread is blocked until a reply is received.
13865 *
13866 * See control_host_proxy_new() for the asynchronous version of this constructor.
13867 *
13868 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
13869 */
13870ControlHost *
13871control_host_proxy_new_sync (
13872 GDBusConnection *connection,
13873 GDBusProxyFlags flags,
13874 const gchar *name,
13875 const gchar *object_path,
13876 GCancellable *cancellable,
13877 GError **error)
13878{
13879 GInitable *ret;
13880 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);
13881 if (ret != NULL)
13882 return CONTROL_HOST (ret);
13883 else
13884 return NULL;
13885}
13886
13887
13888/**
13889 * control_host_proxy_new_for_bus:
13890 * @bus_type: A #GBusType.
13891 * @flags: Flags from the #GDBusProxyFlags enumeration.
13892 * @name: A bus name (well-known or unique).
13893 * @object_path: An object path.
13894 * @cancellable: (allow-none): A #GCancellable or %NULL.
13895 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
13896 * @user_data: User data to pass to @callback.
13897 *
13898 * Like control_host_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
13899 *
13900 * 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.
13901 * You can then call control_host_proxy_new_for_bus_finish() to get the result of the operation.
13902 *
13903 * See control_host_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
13904 */
13905void
13906control_host_proxy_new_for_bus (
13907 GBusType bus_type,
13908 GDBusProxyFlags flags,
13909 const gchar *name,
13910 const gchar *object_path,
13911 GCancellable *cancellable,
13912 GAsyncReadyCallback callback,
13913 gpointer user_data)
13914{
13915 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);
13916}
13917
13918/**
13919 * control_host_proxy_new_for_bus_finish:
13920 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new_for_bus().
13921 * @error: Return location for error or %NULL
13922 *
13923 * Finishes an operation started with control_host_proxy_new_for_bus().
13924 *
13925 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
13926 */
13927ControlHost *
13928control_host_proxy_new_for_bus_finish (
13929 GAsyncResult *res,
13930 GError **error)
13931{
13932 GObject *ret;
13933 GObject *source_object;
13934 source_object = g_async_result_get_source_object (res);
13935 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
13936 g_object_unref (source_object);
13937 if (ret != NULL)
13938 return CONTROL_HOST (ret);
13939 else
13940 return NULL;
13941}
13942
13943/**
13944 * control_host_proxy_new_for_bus_sync:
13945 * @bus_type: A #GBusType.
13946 * @flags: Flags from the #GDBusProxyFlags enumeration.
13947 * @name: A bus name (well-known or unique).
13948 * @object_path: An object path.
13949 * @cancellable: (allow-none): A #GCancellable or %NULL.
13950 * @error: Return location for error or %NULL
13951 *
13952 * Like control_host_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
13953 *
13954 * The calling thread is blocked until a reply is received.
13955 *
13956 * See control_host_proxy_new_for_bus() for the asynchronous version of this constructor.
13957 *
13958 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
13959 */
13960ControlHost *
13961control_host_proxy_new_for_bus_sync (
13962 GBusType bus_type,
13963 GDBusProxyFlags flags,
13964 const gchar *name,
13965 const gchar *object_path,
13966 GCancellable *cancellable,
13967 GError **error)
13968{
13969 GInitable *ret;
13970 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);
13971 if (ret != NULL)
13972 return CONTROL_HOST (ret);
13973 else
13974 return NULL;
13975}
13976
13977
13978/* ------------------------------------------------------------------------ */
13979
13980/**
13981 * ControlHostSkeleton:
13982 *
13983 * The #ControlHostSkeleton structure contains only private data and should only be accessed using the provided API.
13984 */
13985
13986/**
13987 * ControlHostSkeletonClass:
13988 * @parent_class: The parent class.
13989 *
13990 * Class structure for #ControlHostSkeleton.
13991 */
13992
13993struct _ControlHostSkeletonPrivate
13994{
13995 GValue *properties;
13996 GList *changed_properties;
13997 GSource *changed_properties_idle_source;
13998 GMainContext *context;
13999 GMutex lock;
14000};
14001
14002static void
14003_control_host_skeleton_handle_method_call (
14004 GDBusConnection *connection G_GNUC_UNUSED,
14005 const gchar *sender G_GNUC_UNUSED,
14006 const gchar *object_path G_GNUC_UNUSED,
14007 const gchar *interface_name,
14008 const gchar *method_name,
14009 GVariant *parameters,
14010 GDBusMethodInvocation *invocation,
14011 gpointer user_data)
14012{
14013 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
14014 _ExtendedGDBusMethodInfo *info;
14015 GVariantIter iter;
14016 GVariant *child;
14017 GValue *paramv;
14018 guint num_params;
14019 guint num_extra;
14020 guint n;
14021 guint signal_id;
14022 GValue return_value = G_VALUE_INIT;
14023 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
14024 g_assert (info != NULL);
14025 num_params = g_variant_n_children (parameters);
14026 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
14027 n = 0;
14028 g_value_init (&paramv[n], TYPE_CONTROL_HOST);
14029 g_value_set_object (&paramv[n++], skeleton);
14030 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
14031 g_value_set_object (&paramv[n++], invocation);
14032 if (info->pass_fdlist)
14033 {
14034#ifdef G_OS_UNIX
14035 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
14036 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
14037#else
14038 g_assert_not_reached ();
14039#endif
14040 }
14041 g_variant_iter_init (&iter, parameters);
14042 while ((child = g_variant_iter_next_value (&iter)) != NULL)
14043 {
14044 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
14045 if (arg_info->use_gvariant)
14046 {
14047 g_value_init (&paramv[n], G_TYPE_VARIANT);
14048 g_value_set_variant (&paramv[n], child);
14049 n++;
14050 }
14051 else
14052 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
14053 g_variant_unref (child);
14054 }
14055 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
14056 g_value_init (&return_value, G_TYPE_BOOLEAN);
14057 g_signal_emitv (paramv, signal_id, 0, &return_value);
14058 if (!g_value_get_boolean (&return_value))
14059 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);
14060 g_value_unset (&return_value);
14061 for (n = 0; n < num_params + num_extra; n++)
14062 g_value_unset (&paramv[n]);
14063 g_free (paramv);
14064}
14065
14066static GVariant *
14067_control_host_skeleton_handle_get_property (
14068 GDBusConnection *connection G_GNUC_UNUSED,
14069 const gchar *sender G_GNUC_UNUSED,
14070 const gchar *object_path G_GNUC_UNUSED,
14071 const gchar *interface_name G_GNUC_UNUSED,
14072 const gchar *property_name,
14073 GError **error,
14074 gpointer user_data)
14075{
14076 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
14077 GValue value = G_VALUE_INIT;
14078 GParamSpec *pspec;
14079 _ExtendedGDBusPropertyInfo *info;
14080 GVariant *ret;
14081 ret = NULL;
14082 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
14083 g_assert (info != NULL);
14084 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
14085 if (pspec == NULL)
14086 {
14087 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
14088 }
14089 else
14090 {
14091 g_value_init (&value, pspec->value_type);
14092 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
14093 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
14094 g_value_unset (&value);
14095 }
14096 return ret;
14097}
14098
14099static gboolean
14100_control_host_skeleton_handle_set_property (
14101 GDBusConnection *connection G_GNUC_UNUSED,
14102 const gchar *sender G_GNUC_UNUSED,
14103 const gchar *object_path G_GNUC_UNUSED,
14104 const gchar *interface_name G_GNUC_UNUSED,
14105 const gchar *property_name,
14106 GVariant *variant,
14107 GError **error,
14108 gpointer user_data)
14109{
14110 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
14111 GValue value = G_VALUE_INIT;
14112 GParamSpec *pspec;
14113 _ExtendedGDBusPropertyInfo *info;
14114 gboolean ret;
14115 ret = FALSE;
14116 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
14117 g_assert (info != NULL);
14118 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
14119 if (pspec == NULL)
14120 {
14121 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
14122 }
14123 else
14124 {
14125 if (info->use_gvariant)
14126 g_value_set_variant (&value, variant);
14127 else
14128 g_dbus_gvariant_to_gvalue (variant, &value);
14129 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
14130 g_value_unset (&value);
14131 ret = TRUE;
14132 }
14133 return ret;
14134}
14135
14136static const GDBusInterfaceVTable _control_host_skeleton_vtable =
14137{
14138 _control_host_skeleton_handle_method_call,
14139 _control_host_skeleton_handle_get_property,
14140 _control_host_skeleton_handle_set_property,
14141 {NULL}
14142};
14143
14144static GDBusInterfaceInfo *
14145control_host_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
14146{
14147 return control_host_interface_info ();
14148}
14149
14150static GDBusInterfaceVTable *
14151control_host_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
14152{
14153 return (GDBusInterfaceVTable *) &_control_host_skeleton_vtable;
14154}
14155
14156static GVariant *
14157control_host_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
14158{
14159 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton);
14160
14161 GVariantBuilder builder;
14162 guint n;
14163 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
14164 if (_control_host_interface_info.parent_struct.properties == NULL)
14165 goto out;
14166 for (n = 0; _control_host_interface_info.parent_struct.properties[n] != NULL; n++)
14167 {
14168 GDBusPropertyInfo *info = _control_host_interface_info.parent_struct.properties[n];
14169 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
14170 {
14171 GVariant *value;
14172 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);
14173 if (value != NULL)
14174 {
14175 g_variant_take_ref (value);
14176 g_variant_builder_add (&builder, "{sv}", info->name, value);
14177 g_variant_unref (value);
14178 }
14179 }
14180 }
14181out:
14182 return g_variant_builder_end (&builder);
14183}
14184
14185static void
14186control_host_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
14187{
14188}
14189
14190static void
14191_control_host_on_signal_booted (
14192 ControlHost *object)
14193{
14194 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
14195
14196 GList *connections, *l;
14197 GVariant *signal_variant;
14198 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
14199
14200 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
14201 for (l = connections; l != NULL; l = l->next)
14202 {
14203 GDBusConnection *connection = l->data;
14204 g_dbus_connection_emit_signal (connection,
14205 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Host", "Booted",
14206 signal_variant, NULL);
14207 }
14208 g_variant_unref (signal_variant);
14209 g_list_free_full (connections, g_object_unref);
14210}
14211
14212static void control_host_skeleton_iface_init (ControlHostIface *iface);
14213#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14214G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
14215 G_ADD_PRIVATE (ControlHostSkeleton)
14216 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
14217
14218#else
14219G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
14220 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
14221
14222#endif
14223static void
14224control_host_skeleton_finalize (GObject *object)
14225{
14226 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
14227 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
14228 if (skeleton->priv->changed_properties_idle_source != NULL)
14229 g_source_destroy (skeleton->priv->changed_properties_idle_source);
14230 g_main_context_unref (skeleton->priv->context);
14231 g_mutex_clear (&skeleton->priv->lock);
14232 G_OBJECT_CLASS (control_host_skeleton_parent_class)->finalize (object);
14233}
14234
14235static void
14236control_host_skeleton_init (ControlHostSkeleton *skeleton)
14237{
14238#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14239 skeleton->priv = control_host_skeleton_get_instance_private (skeleton);
14240#else
14241 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_HOST_SKELETON, ControlHostSkeletonPrivate);
14242#endif
14243
14244 g_mutex_init (&skeleton->priv->lock);
14245 skeleton->priv->context = g_main_context_ref_thread_default ();
14246}
14247
14248static void
14249control_host_skeleton_class_init (ControlHostSkeletonClass *klass)
14250{
14251 GObjectClass *gobject_class;
14252 GDBusInterfaceSkeletonClass *skeleton_class;
14253
14254 gobject_class = G_OBJECT_CLASS (klass);
14255 gobject_class->finalize = control_host_skeleton_finalize;
14256
14257 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
14258 skeleton_class->get_info = control_host_skeleton_dbus_interface_get_info;
14259 skeleton_class->get_properties = control_host_skeleton_dbus_interface_get_properties;
14260 skeleton_class->flush = control_host_skeleton_dbus_interface_flush;
14261 skeleton_class->get_vtable = control_host_skeleton_dbus_interface_get_vtable;
14262
14263#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
14264 g_type_class_add_private (klass, sizeof (ControlHostSkeletonPrivate));
14265#endif
14266}
14267
14268static void
14269control_host_skeleton_iface_init (ControlHostIface *iface)
14270{
14271 iface->booted = _control_host_on_signal_booted;
14272}
14273
14274/**
14275 * control_host_skeleton_new:
14276 *
14277 * 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>.
14278 *
14279 * Returns: (transfer full) (type ControlHostSkeleton): The skeleton object.
14280 */
14281ControlHost *
14282control_host_skeleton_new (void)
14283{
14284 return CONTROL_HOST (g_object_new (TYPE_CONTROL_HOST_SKELETON, NULL));
14285}
14286
14287/* ------------------------------------------------------------------------
14288 * Code for interface org.openbmc.control.Power
14289 * ------------------------------------------------------------------------
14290 */
14291
14292/**
14293 * SECTION:ControlPower
14294 * @title: ControlPower
14295 * @short_description: Generated C code for the org.openbmc.control.Power D-Bus interface
14296 *
14297 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link> D-Bus interface in C.
14298 */
14299
14300/* ---- Introspection data for org.openbmc.control.Power ---- */
14301
14302static const _ExtendedGDBusArgInfo _control_power_method_info_set_power_state_IN_ARG_state =
14303{
14304 {
14305 -1,
14306 (gchar *) "state",
14307 (gchar *) "i",
14308 NULL
14309 },
14310 FALSE
14311};
14312
14313static const _ExtendedGDBusArgInfo * const _control_power_method_info_set_power_state_IN_ARG_pointers[] =
14314{
14315 &_control_power_method_info_set_power_state_IN_ARG_state,
14316 NULL
14317};
14318
14319static const _ExtendedGDBusMethodInfo _control_power_method_info_set_power_state =
14320{
14321 {
14322 -1,
14323 (gchar *) "setPowerState",
14324 (GDBusArgInfo **) &_control_power_method_info_set_power_state_IN_ARG_pointers,
14325 NULL,
14326 NULL
14327 },
14328 "handle-set-power-state",
14329 FALSE
14330};
14331
14332static const _ExtendedGDBusArgInfo _control_power_method_info_get_power_state_OUT_ARG_state =
14333{
14334 {
14335 -1,
14336 (gchar *) "state",
14337 (gchar *) "i",
14338 NULL
14339 },
14340 FALSE
14341};
14342
14343static const _ExtendedGDBusArgInfo * const _control_power_method_info_get_power_state_OUT_ARG_pointers[] =
14344{
14345 &_control_power_method_info_get_power_state_OUT_ARG_state,
14346 NULL
14347};
14348
14349static const _ExtendedGDBusMethodInfo _control_power_method_info_get_power_state =
14350{
14351 {
14352 -1,
14353 (gchar *) "getPowerState",
14354 NULL,
14355 (GDBusArgInfo **) &_control_power_method_info_get_power_state_OUT_ARG_pointers,
14356 NULL
14357 },
14358 "handle-get-power-state",
14359 FALSE
14360};
14361
14362static const _ExtendedGDBusMethodInfo * const _control_power_method_info_pointers[] =
14363{
14364 &_control_power_method_info_set_power_state,
14365 &_control_power_method_info_get_power_state,
14366 NULL
14367};
14368
14369static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_good =
14370{
14371 {
14372 -1,
14373 (gchar *) "PowerGood",
14374 NULL,
14375 NULL
14376 },
14377 "power-good"
14378};
14379
14380static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_lost =
14381{
14382 {
14383 -1,
14384 (gchar *) "PowerLost",
14385 NULL,
14386 NULL
14387 },
14388 "power-lost"
14389};
14390
14391static const _ExtendedGDBusSignalInfo * const _control_power_signal_info_pointers[] =
14392{
14393 &_control_power_signal_info_power_good,
14394 &_control_power_signal_info_power_lost,
14395 NULL
14396};
14397
14398static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood =
14399{
14400 {
14401 -1,
14402 (gchar *) "pgood",
14403 (gchar *) "i",
14404 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
14405 NULL
14406 },
14407 "pgood",
14408 FALSE
14409};
14410
14411static const _ExtendedGDBusPropertyInfo _control_power_property_info_state =
14412{
14413 {
14414 -1,
14415 (gchar *) "state",
14416 (gchar *) "i",
14417 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
14418 NULL
14419 },
14420 "state",
14421 FALSE
14422};
14423
14424static const _ExtendedGDBusPropertyInfo * const _control_power_property_info_pointers[] =
14425{
14426 &_control_power_property_info_pgood,
14427 &_control_power_property_info_state,
14428 NULL
14429};
14430
14431static const _ExtendedGDBusInterfaceInfo _control_power_interface_info =
14432{
14433 {
14434 -1,
14435 (gchar *) "org.openbmc.control.Power",
14436 (GDBusMethodInfo **) &_control_power_method_info_pointers,
14437 (GDBusSignalInfo **) &_control_power_signal_info_pointers,
14438 (GDBusPropertyInfo **) &_control_power_property_info_pointers,
14439 NULL
14440 },
14441 "control-power",
14442};
14443
14444
14445/**
14446 * control_power_interface_info:
14447 *
14448 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link> D-Bus interface.
14449 *
14450 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
14451 */
14452GDBusInterfaceInfo *
14453control_power_interface_info (void)
14454{
14455 return (GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct;
14456}
14457
14458/**
14459 * control_power_override_properties:
14460 * @klass: The class structure for a #GObject<!-- -->-derived class.
14461 * @property_id_begin: The property id to assign to the first overridden property.
14462 *
14463 * Overrides all #GObject properties in the #ControlPower interface for a concrete class.
14464 * The properties are overridden in the order they are defined.
14465 *
14466 * Returns: The last property id.
14467 */
14468guint
14469control_power_override_properties (GObjectClass *klass, guint property_id_begin)
14470{
14471 g_object_class_override_property (klass, property_id_begin++, "pgood");
14472 g_object_class_override_property (klass, property_id_begin++, "state");
14473 return property_id_begin - 1;
14474}
14475
14476
14477
14478/**
14479 * ControlPower:
14480 *
14481 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
14482 */
14483
14484/**
14485 * ControlPowerIface:
14486 * @parent_iface: The parent interface.
14487 * @handle_get_power_state: Handler for the #ControlPower::handle-get-power-state signal.
14488 * @handle_set_power_state: Handler for the #ControlPower::handle-set-power-state signal.
14489 * @get_pgood: Getter for the #ControlPower:pgood property.
14490 * @get_state: Getter for the #ControlPower:state property.
14491 * @power_good: Handler for the #ControlPower::power-good signal.
14492 * @power_lost: Handler for the #ControlPower::power-lost signal.
14493 *
14494 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
14495 */
14496
14497typedef ControlPowerIface ControlPowerInterface;
14498G_DEFINE_INTERFACE (ControlPower, control_power, G_TYPE_OBJECT);
14499
14500static void
14501control_power_default_init (ControlPowerIface *iface)
14502{
14503 /* GObject signals for incoming D-Bus method calls: */
14504 /**
14505 * ControlPower::handle-set-power-state:
14506 * @object: A #ControlPower.
14507 * @invocation: A #GDBusMethodInvocation.
14508 * @arg_state: Argument passed by remote caller.
14509 *
14510 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method.
14511 *
14512 * 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_power_complete_set_power_state() 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.
14513 *
14514 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14515 */
14516 g_signal_new ("handle-set-power-state",
14517 G_TYPE_FROM_INTERFACE (iface),
14518 G_SIGNAL_RUN_LAST,
14519 G_STRUCT_OFFSET (ControlPowerIface, handle_set_power_state),
14520 g_signal_accumulator_true_handled,
14521 NULL,
14522 g_cclosure_marshal_generic,
14523 G_TYPE_BOOLEAN,
14524 2,
14525 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
14526
14527 /**
14528 * ControlPower::handle-get-power-state:
14529 * @object: A #ControlPower.
14530 * @invocation: A #GDBusMethodInvocation.
14531 *
14532 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method.
14533 *
14534 * 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_power_complete_get_power_state() 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.
14535 *
14536 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14537 */
14538 g_signal_new ("handle-get-power-state",
14539 G_TYPE_FROM_INTERFACE (iface),
14540 G_SIGNAL_RUN_LAST,
14541 G_STRUCT_OFFSET (ControlPowerIface, handle_get_power_state),
14542 g_signal_accumulator_true_handled,
14543 NULL,
14544 g_cclosure_marshal_generic,
14545 G_TYPE_BOOLEAN,
14546 1,
14547 G_TYPE_DBUS_METHOD_INVOCATION);
14548
14549 /* GObject signals for received D-Bus signals: */
14550 /**
14551 * ControlPower::power-good:
14552 * @object: A #ControlPower.
14553 *
14554 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-control-Power.PowerGood">"PowerGood"</link> is received.
14555 *
14556 * 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.
14557 */
14558 g_signal_new ("power-good",
14559 G_TYPE_FROM_INTERFACE (iface),
14560 G_SIGNAL_RUN_LAST,
14561 G_STRUCT_OFFSET (ControlPowerIface, power_good),
14562 NULL,
14563 NULL,
14564 g_cclosure_marshal_generic,
14565 G_TYPE_NONE,
14566 0);
14567
14568 /**
14569 * ControlPower::power-lost:
14570 * @object: A #ControlPower.
14571 *
14572 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-control-Power.PowerLost">"PowerLost"</link> is received.
14573 *
14574 * 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.
14575 */
14576 g_signal_new ("power-lost",
14577 G_TYPE_FROM_INTERFACE (iface),
14578 G_SIGNAL_RUN_LAST,
14579 G_STRUCT_OFFSET (ControlPowerIface, power_lost),
14580 NULL,
14581 NULL,
14582 g_cclosure_marshal_generic,
14583 G_TYPE_NONE,
14584 0);
14585
14586 /* GObject properties for D-Bus properties: */
14587 /**
14588 * ControlPower:pgood:
14589 *
14590 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link>.
14591 *
14592 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
14593 */
14594 g_object_interface_install_property (iface,
14595 g_param_spec_int ("pgood", "pgood", "pgood", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
14596 /**
14597 * ControlPower:state:
14598 *
14599 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link>.
14600 *
14601 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
14602 */
14603 g_object_interface_install_property (iface,
14604 g_param_spec_int ("state", "state", "state", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
14605}
14606
14607/**
14608 * control_power_get_pgood: (skip)
14609 * @object: A #ControlPower.
14610 *
14611 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property.
14612 *
14613 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
14614 *
14615 * Returns: The property value.
14616 */
14617gint
14618control_power_get_pgood (ControlPower *object)
14619{
14620 return CONTROL_POWER_GET_IFACE (object)->get_pgood (object);
14621}
14622
14623/**
14624 * control_power_set_pgood: (skip)
14625 * @object: A #ControlPower.
14626 * @value: The value to set.
14627 *
14628 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property to @value.
14629 *
14630 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
14631 */
14632void
14633control_power_set_pgood (ControlPower *object, gint value)
14634{
14635 g_object_set (G_OBJECT (object), "pgood", value, NULL);
14636}
14637
14638/**
14639 * control_power_get_state: (skip)
14640 * @object: A #ControlPower.
14641 *
14642 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property.
14643 *
14644 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
14645 *
14646 * Returns: The property value.
14647 */
14648gint
14649control_power_get_state (ControlPower *object)
14650{
14651 return CONTROL_POWER_GET_IFACE (object)->get_state (object);
14652}
14653
14654/**
14655 * control_power_set_state: (skip)
14656 * @object: A #ControlPower.
14657 * @value: The value to set.
14658 *
14659 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property to @value.
14660 *
14661 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
14662 */
14663void
14664control_power_set_state (ControlPower *object, gint value)
14665{
14666 g_object_set (G_OBJECT (object), "state", value, NULL);
14667}
14668
14669/**
14670 * control_power_emit_power_good:
14671 * @object: A #ControlPower.
14672 *
14673 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerGood">"PowerGood"</link> D-Bus signal.
14674 */
14675void
14676control_power_emit_power_good (
14677 ControlPower *object)
14678{
14679 g_signal_emit_by_name (object, "power-good");
14680}
14681
14682/**
14683 * control_power_emit_power_lost:
14684 * @object: A #ControlPower.
14685 *
14686 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerLost">"PowerLost"</link> D-Bus signal.
14687 */
14688void
14689control_power_emit_power_lost (
14690 ControlPower *object)
14691{
14692 g_signal_emit_by_name (object, "power-lost");
14693}
14694
14695/**
14696 * control_power_call_set_power_state:
14697 * @proxy: A #ControlPowerProxy.
14698 * @arg_state: Argument to pass with the method invocation.
14699 * @cancellable: (allow-none): A #GCancellable or %NULL.
14700 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
14701 * @user_data: User data to pass to @callback.
14702 *
14703 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method on @proxy.
14704 * 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.
14705 * You can then call control_power_call_set_power_state_finish() to get the result of the operation.
14706 *
14707 * See control_power_call_set_power_state_sync() for the synchronous, blocking version of this method.
14708 */
14709void
14710control_power_call_set_power_state (
14711 ControlPower *proxy,
14712 gint arg_state,
14713 GCancellable *cancellable,
14714 GAsyncReadyCallback callback,
14715 gpointer user_data)
14716{
14717 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
14718 "setPowerState",
14719 g_variant_new ("(i)",
14720 arg_state),
14721 G_DBUS_CALL_FLAGS_NONE,
14722 -1,
14723 cancellable,
14724 callback,
14725 user_data);
14726}
14727
14728/**
14729 * control_power_call_set_power_state_finish:
14730 * @proxy: A #ControlPowerProxy.
14731 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_set_power_state().
14732 * @error: Return location for error or %NULL.
14733 *
14734 * Finishes an operation started with control_power_call_set_power_state().
14735 *
14736 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14737 */
14738gboolean
14739control_power_call_set_power_state_finish (
14740 ControlPower *proxy,
14741 GAsyncResult *res,
14742 GError **error)
14743{
14744 GVariant *_ret;
14745 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
14746 if (_ret == NULL)
14747 goto _out;
14748 g_variant_get (_ret,
14749 "()");
14750 g_variant_unref (_ret);
14751_out:
14752 return _ret != NULL;
14753}
14754
14755/**
14756 * control_power_call_set_power_state_sync:
14757 * @proxy: A #ControlPowerProxy.
14758 * @arg_state: Argument to pass with the method invocation.
14759 * @cancellable: (allow-none): A #GCancellable or %NULL.
14760 * @error: Return location for error or %NULL.
14761 *
14762 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
14763 *
14764 * See control_power_call_set_power_state() for the asynchronous version of this method.
14765 *
14766 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14767 */
14768gboolean
14769control_power_call_set_power_state_sync (
14770 ControlPower *proxy,
14771 gint arg_state,
14772 GCancellable *cancellable,
14773 GError **error)
14774{
14775 GVariant *_ret;
14776 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
14777 "setPowerState",
14778 g_variant_new ("(i)",
14779 arg_state),
14780 G_DBUS_CALL_FLAGS_NONE,
14781 -1,
14782 cancellable,
14783 error);
14784 if (_ret == NULL)
14785 goto _out;
14786 g_variant_get (_ret,
14787 "()");
14788 g_variant_unref (_ret);
14789_out:
14790 return _ret != NULL;
14791}
14792
14793/**
14794 * control_power_call_get_power_state:
14795 * @proxy: A #ControlPowerProxy.
14796 * @cancellable: (allow-none): A #GCancellable or %NULL.
14797 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
14798 * @user_data: User data to pass to @callback.
14799 *
14800 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method on @proxy.
14801 * 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.
14802 * You can then call control_power_call_get_power_state_finish() to get the result of the operation.
14803 *
14804 * See control_power_call_get_power_state_sync() for the synchronous, blocking version of this method.
14805 */
14806void
14807control_power_call_get_power_state (
14808 ControlPower *proxy,
14809 GCancellable *cancellable,
14810 GAsyncReadyCallback callback,
14811 gpointer user_data)
14812{
14813 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
14814 "getPowerState",
14815 g_variant_new ("()"),
14816 G_DBUS_CALL_FLAGS_NONE,
14817 -1,
14818 cancellable,
14819 callback,
14820 user_data);
14821}
14822
14823/**
14824 * control_power_call_get_power_state_finish:
14825 * @proxy: A #ControlPowerProxy.
14826 * @out_state: (out): Return location for return parameter or %NULL to ignore.
14827 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_get_power_state().
14828 * @error: Return location for error or %NULL.
14829 *
14830 * Finishes an operation started with control_power_call_get_power_state().
14831 *
14832 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14833 */
14834gboolean
14835control_power_call_get_power_state_finish (
14836 ControlPower *proxy,
14837 gint *out_state,
14838 GAsyncResult *res,
14839 GError **error)
14840{
14841 GVariant *_ret;
14842 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
14843 if (_ret == NULL)
14844 goto _out;
14845 g_variant_get (_ret,
14846 "(i)",
14847 out_state);
14848 g_variant_unref (_ret);
14849_out:
14850 return _ret != NULL;
14851}
14852
14853/**
14854 * control_power_call_get_power_state_sync:
14855 * @proxy: A #ControlPowerProxy.
14856 * @out_state: (out): Return location for return parameter or %NULL to ignore.
14857 * @cancellable: (allow-none): A #GCancellable or %NULL.
14858 * @error: Return location for error or %NULL.
14859 *
14860 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
14861 *
14862 * See control_power_call_get_power_state() for the asynchronous version of this method.
14863 *
14864 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14865 */
14866gboolean
14867control_power_call_get_power_state_sync (
14868 ControlPower *proxy,
14869 gint *out_state,
14870 GCancellable *cancellable,
14871 GError **error)
14872{
14873 GVariant *_ret;
14874 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
14875 "getPowerState",
14876 g_variant_new ("()"),
14877 G_DBUS_CALL_FLAGS_NONE,
14878 -1,
14879 cancellable,
14880 error);
14881 if (_ret == NULL)
14882 goto _out;
14883 g_variant_get (_ret,
14884 "(i)",
14885 out_state);
14886 g_variant_unref (_ret);
14887_out:
14888 return _ret != NULL;
14889}
14890
14891/**
14892 * control_power_complete_set_power_state:
14893 * @object: A #ControlPower.
14894 * @invocation: (transfer full): A #GDBusMethodInvocation.
14895 *
14896 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</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.
14897 *
14898 * This method will free @invocation, you cannot use it afterwards.
14899 */
14900void
14901control_power_complete_set_power_state (
14902 ControlPower *object,
14903 GDBusMethodInvocation *invocation)
14904{
14905 g_dbus_method_invocation_return_value (invocation,
14906 g_variant_new ("()"));
14907}
14908
14909/**
14910 * control_power_complete_get_power_state:
14911 * @object: A #ControlPower.
14912 * @invocation: (transfer full): A #GDBusMethodInvocation.
14913 * @state: Parameter to return.
14914 *
14915 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</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.
14916 *
14917 * This method will free @invocation, you cannot use it afterwards.
14918 */
14919void
14920control_power_complete_get_power_state (
14921 ControlPower *object,
14922 GDBusMethodInvocation *invocation,
14923 gint state)
14924{
14925 g_dbus_method_invocation_return_value (invocation,
14926 g_variant_new ("(i)",
14927 state));
14928}
14929
14930/* ------------------------------------------------------------------------ */
14931
14932/**
14933 * ControlPowerProxy:
14934 *
14935 * The #ControlPowerProxy structure contains only private data and should only be accessed using the provided API.
14936 */
14937
14938/**
14939 * ControlPowerProxyClass:
14940 * @parent_class: The parent class.
14941 *
14942 * Class structure for #ControlPowerProxy.
14943 */
14944
14945struct _ControlPowerProxyPrivate
14946{
14947 GData *qdata;
14948};
14949
14950static void control_power_proxy_iface_init (ControlPowerIface *iface);
14951
14952#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14953G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
14954 G_ADD_PRIVATE (ControlPowerProxy)
14955 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init));
14956
14957#else
14958G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
14959 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init));
14960
14961#endif
14962static void
14963control_power_proxy_finalize (GObject *object)
14964{
14965 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
14966 g_datalist_clear (&proxy->priv->qdata);
14967 G_OBJECT_CLASS (control_power_proxy_parent_class)->finalize (object);
14968}
14969
14970static void
14971control_power_proxy_get_property (GObject *object,
14972 guint prop_id,
14973 GValue *value,
14974 GParamSpec *pspec G_GNUC_UNUSED)
14975{
14976 const _ExtendedGDBusPropertyInfo *info;
14977 GVariant *variant;
14978 g_assert (prop_id != 0 && prop_id - 1 < 2);
14979 info = _control_power_property_info_pointers[prop_id - 1];
14980 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
14981 if (info->use_gvariant)
14982 {
14983 g_value_set_variant (value, variant);
14984 }
14985 else
14986 {
14987 if (variant != NULL)
14988 g_dbus_gvariant_to_gvalue (variant, value);
14989 }
14990 if (variant != NULL)
14991 g_variant_unref (variant);
14992}
14993
14994static void
14995control_power_proxy_set_property_cb (GDBusProxy *proxy,
14996 GAsyncResult *res,
14997 gpointer user_data)
14998{
14999 const _ExtendedGDBusPropertyInfo *info = user_data;
15000 GError *error;
15001 GVariant *_ret;
15002 error = NULL;
15003 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
15004 if (!_ret)
15005 {
15006 g_warning ("Error setting property '%s' on interface org.openbmc.control.Power: %s (%s, %d)",
15007 info->parent_struct.name,
15008 error->message, g_quark_to_string (error->domain), error->code);
15009 g_error_free (error);
15010 }
15011 else
15012 {
15013 g_variant_unref (_ret);
15014 }
15015}
15016
15017static void
15018control_power_proxy_set_property (GObject *object,
15019 guint prop_id,
15020 const GValue *value,
15021 GParamSpec *pspec G_GNUC_UNUSED)
15022{
15023 const _ExtendedGDBusPropertyInfo *info;
15024 GVariant *variant;
15025 g_assert (prop_id != 0 && prop_id - 1 < 2);
15026 info = _control_power_property_info_pointers[prop_id - 1];
15027 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
15028 g_dbus_proxy_call (G_DBUS_PROXY (object),
15029 "org.freedesktop.DBus.Properties.Set",
15030 g_variant_new ("(ssv)", "org.openbmc.control.Power", info->parent_struct.name, variant),
15031 G_DBUS_CALL_FLAGS_NONE,
15032 -1,
15033 NULL, (GAsyncReadyCallback) control_power_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
15034 g_variant_unref (variant);
15035}
15036
15037static void
15038control_power_proxy_g_signal (GDBusProxy *proxy,
15039 const gchar *sender_name G_GNUC_UNUSED,
15040 const gchar *signal_name,
15041 GVariant *parameters)
15042{
15043 _ExtendedGDBusSignalInfo *info;
15044 GVariantIter iter;
15045 GVariant *child;
15046 GValue *paramv;
15047 guint num_params;
15048 guint n;
15049 guint signal_id;
15050 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, signal_name);
15051 if (info == NULL)
15052 return;
15053 num_params = g_variant_n_children (parameters);
15054 paramv = g_new0 (GValue, num_params + 1);
15055 g_value_init (&paramv[0], TYPE_CONTROL_POWER);
15056 g_value_set_object (&paramv[0], proxy);
15057 g_variant_iter_init (&iter, parameters);
15058 n = 1;
15059 while ((child = g_variant_iter_next_value (&iter)) != NULL)
15060 {
15061 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
15062 if (arg_info->use_gvariant)
15063 {
15064 g_value_init (&paramv[n], G_TYPE_VARIANT);
15065 g_value_set_variant (&paramv[n], child);
15066 n++;
15067 }
15068 else
15069 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
15070 g_variant_unref (child);
15071 }
15072 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
15073 g_signal_emitv (paramv, signal_id, 0, NULL);
15074 for (n = 0; n < num_params + 1; n++)
15075 g_value_unset (&paramv[n]);
15076 g_free (paramv);
15077}
15078
15079static void
15080control_power_proxy_g_properties_changed (GDBusProxy *_proxy,
15081 GVariant *changed_properties,
15082 const gchar *const *invalidated_properties)
15083{
15084 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (_proxy);
15085 guint n;
15086 const gchar *key;
15087 GVariantIter *iter;
15088 _ExtendedGDBusPropertyInfo *info;
15089 g_variant_get (changed_properties, "a{sv}", &iter);
15090 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
15091 {
15092 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, key);
15093 g_datalist_remove_data (&proxy->priv->qdata, key);
15094 if (info != NULL)
15095 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
15096 }
15097 g_variant_iter_free (iter);
15098 for (n = 0; invalidated_properties[n] != NULL; n++)
15099 {
15100 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, invalidated_properties[n]);
15101 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
15102 if (info != NULL)
15103 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
15104 }
15105}
15106
15107static gint
15108control_power_proxy_get_pgood (ControlPower *object)
15109{
15110 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
15111 GVariant *variant;
15112 gint value = 0;
15113 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood");
15114 if (variant != NULL)
15115 {
15116 value = g_variant_get_int32 (variant);
15117 g_variant_unref (variant);
15118 }
15119 return value;
15120}
15121
15122static gint
15123control_power_proxy_get_state (ControlPower *object)
15124{
15125 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
15126 GVariant *variant;
15127 gint value = 0;
15128 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
15129 if (variant != NULL)
15130 {
15131 value = g_variant_get_int32 (variant);
15132 g_variant_unref (variant);
15133 }
15134 return value;
15135}
15136
15137static void
15138control_power_proxy_init (ControlPowerProxy *proxy)
15139{
15140#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15141 proxy->priv = control_power_proxy_get_instance_private (proxy);
15142#else
15143 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_POWER_PROXY, ControlPowerProxyPrivate);
15144#endif
15145
15146 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_power_interface_info ());
15147}
15148
15149static void
15150control_power_proxy_class_init (ControlPowerProxyClass *klass)
15151{
15152 GObjectClass *gobject_class;
15153 GDBusProxyClass *proxy_class;
15154
15155 gobject_class = G_OBJECT_CLASS (klass);
15156 gobject_class->finalize = control_power_proxy_finalize;
15157 gobject_class->get_property = control_power_proxy_get_property;
15158 gobject_class->set_property = control_power_proxy_set_property;
15159
15160 proxy_class = G_DBUS_PROXY_CLASS (klass);
15161 proxy_class->g_signal = control_power_proxy_g_signal;
15162 proxy_class->g_properties_changed = control_power_proxy_g_properties_changed;
15163
15164 control_power_override_properties (gobject_class, 1);
15165
15166#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
15167 g_type_class_add_private (klass, sizeof (ControlPowerProxyPrivate));
15168#endif
15169}
15170
15171static void
15172control_power_proxy_iface_init (ControlPowerIface *iface)
15173{
15174 iface->get_pgood = control_power_proxy_get_pgood;
15175 iface->get_state = control_power_proxy_get_state;
15176}
15177
15178/**
15179 * control_power_proxy_new:
15180 * @connection: A #GDBusConnection.
15181 * @flags: Flags from the #GDBusProxyFlags enumeration.
15182 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
15183 * @object_path: An object path.
15184 * @cancellable: (allow-none): A #GCancellable or %NULL.
15185 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
15186 * @user_data: User data to pass to @callback.
15187 *
15188 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>. See g_dbus_proxy_new() for more details.
15189 *
15190 * 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.
15191 * You can then call control_power_proxy_new_finish() to get the result of the operation.
15192 *
15193 * See control_power_proxy_new_sync() for the synchronous, blocking version of this constructor.
15194 */
15195void
15196control_power_proxy_new (
15197 GDBusConnection *connection,
15198 GDBusProxyFlags flags,
15199 const gchar *name,
15200 const gchar *object_path,
15201 GCancellable *cancellable,
15202 GAsyncReadyCallback callback,
15203 gpointer user_data)
15204{
15205 g_async_initable_new_async (TYPE_CONTROL_POWER_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.Power", NULL);
15206}
15207
15208/**
15209 * control_power_proxy_new_finish:
15210 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new().
15211 * @error: Return location for error or %NULL
15212 *
15213 * Finishes an operation started with control_power_proxy_new().
15214 *
15215 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
15216 */
15217ControlPower *
15218control_power_proxy_new_finish (
15219 GAsyncResult *res,
15220 GError **error)
15221{
15222 GObject *ret;
15223 GObject *source_object;
15224 source_object = g_async_result_get_source_object (res);
15225 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
15226 g_object_unref (source_object);
15227 if (ret != NULL)
15228 return CONTROL_POWER (ret);
15229 else
15230 return NULL;
15231}
15232
15233/**
15234 * control_power_proxy_new_sync:
15235 * @connection: A #GDBusConnection.
15236 * @flags: Flags from the #GDBusProxyFlags enumeration.
15237 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
15238 * @object_path: An object path.
15239 * @cancellable: (allow-none): A #GCancellable or %NULL.
15240 * @error: Return location for error or %NULL
15241 *
15242 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>. See g_dbus_proxy_new_sync() for more details.
15243 *
15244 * The calling thread is blocked until a reply is received.
15245 *
15246 * See control_power_proxy_new() for the asynchronous version of this constructor.
15247 *
15248 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
15249 */
15250ControlPower *
15251control_power_proxy_new_sync (
15252 GDBusConnection *connection,
15253 GDBusProxyFlags flags,
15254 const gchar *name,
15255 const gchar *object_path,
15256 GCancellable *cancellable,
15257 GError **error)
15258{
15259 GInitable *ret;
15260 ret = g_initable_new (TYPE_CONTROL_POWER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Power", NULL);
15261 if (ret != NULL)
15262 return CONTROL_POWER (ret);
15263 else
15264 return NULL;
15265}
15266
15267
15268/**
15269 * control_power_proxy_new_for_bus:
15270 * @bus_type: A #GBusType.
15271 * @flags: Flags from the #GDBusProxyFlags enumeration.
15272 * @name: A bus name (well-known or unique).
15273 * @object_path: An object path.
15274 * @cancellable: (allow-none): A #GCancellable or %NULL.
15275 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
15276 * @user_data: User data to pass to @callback.
15277 *
15278 * Like control_power_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
15279 *
15280 * 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.
15281 * You can then call control_power_proxy_new_for_bus_finish() to get the result of the operation.
15282 *
15283 * See control_power_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
15284 */
15285void
15286control_power_proxy_new_for_bus (
15287 GBusType bus_type,
15288 GDBusProxyFlags flags,
15289 const gchar *name,
15290 const gchar *object_path,
15291 GCancellable *cancellable,
15292 GAsyncReadyCallback callback,
15293 gpointer user_data)
15294{
15295 g_async_initable_new_async (TYPE_CONTROL_POWER_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.Power", NULL);
15296}
15297
15298/**
15299 * control_power_proxy_new_for_bus_finish:
15300 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new_for_bus().
15301 * @error: Return location for error or %NULL
15302 *
15303 * Finishes an operation started with control_power_proxy_new_for_bus().
15304 *
15305 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
15306 */
15307ControlPower *
15308control_power_proxy_new_for_bus_finish (
15309 GAsyncResult *res,
15310 GError **error)
15311{
15312 GObject *ret;
15313 GObject *source_object;
15314 source_object = g_async_result_get_source_object (res);
15315 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
15316 g_object_unref (source_object);
15317 if (ret != NULL)
15318 return CONTROL_POWER (ret);
15319 else
15320 return NULL;
15321}
15322
15323/**
15324 * control_power_proxy_new_for_bus_sync:
15325 * @bus_type: A #GBusType.
15326 * @flags: Flags from the #GDBusProxyFlags enumeration.
15327 * @name: A bus name (well-known or unique).
15328 * @object_path: An object path.
15329 * @cancellable: (allow-none): A #GCancellable or %NULL.
15330 * @error: Return location for error or %NULL
15331 *
15332 * Like control_power_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
15333 *
15334 * The calling thread is blocked until a reply is received.
15335 *
15336 * See control_power_proxy_new_for_bus() for the asynchronous version of this constructor.
15337 *
15338 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
15339 */
15340ControlPower *
15341control_power_proxy_new_for_bus_sync (
15342 GBusType bus_type,
15343 GDBusProxyFlags flags,
15344 const gchar *name,
15345 const gchar *object_path,
15346 GCancellable *cancellable,
15347 GError **error)
15348{
15349 GInitable *ret;
15350 ret = g_initable_new (TYPE_CONTROL_POWER_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.Power", NULL);
15351 if (ret != NULL)
15352 return CONTROL_POWER (ret);
15353 else
15354 return NULL;
15355}
15356
15357
15358/* ------------------------------------------------------------------------ */
15359
15360/**
15361 * ControlPowerSkeleton:
15362 *
15363 * The #ControlPowerSkeleton structure contains only private data and should only be accessed using the provided API.
15364 */
15365
15366/**
15367 * ControlPowerSkeletonClass:
15368 * @parent_class: The parent class.
15369 *
15370 * Class structure for #ControlPowerSkeleton.
15371 */
15372
15373struct _ControlPowerSkeletonPrivate
15374{
15375 GValue *properties;
15376 GList *changed_properties;
15377 GSource *changed_properties_idle_source;
15378 GMainContext *context;
15379 GMutex lock;
15380};
15381
15382static void
15383_control_power_skeleton_handle_method_call (
15384 GDBusConnection *connection G_GNUC_UNUSED,
15385 const gchar *sender G_GNUC_UNUSED,
15386 const gchar *object_path G_GNUC_UNUSED,
15387 const gchar *interface_name,
15388 const gchar *method_name,
15389 GVariant *parameters,
15390 GDBusMethodInvocation *invocation,
15391 gpointer user_data)
15392{
15393 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
15394 _ExtendedGDBusMethodInfo *info;
15395 GVariantIter iter;
15396 GVariant *child;
15397 GValue *paramv;
15398 guint num_params;
15399 guint num_extra;
15400 guint n;
15401 guint signal_id;
15402 GValue return_value = G_VALUE_INIT;
15403 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
15404 g_assert (info != NULL);
15405 num_params = g_variant_n_children (parameters);
15406 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
15407 n = 0;
15408 g_value_init (&paramv[n], TYPE_CONTROL_POWER);
15409 g_value_set_object (&paramv[n++], skeleton);
15410 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
15411 g_value_set_object (&paramv[n++], invocation);
15412 if (info->pass_fdlist)
15413 {
15414#ifdef G_OS_UNIX
15415 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
15416 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
15417#else
15418 g_assert_not_reached ();
15419#endif
15420 }
15421 g_variant_iter_init (&iter, parameters);
15422 while ((child = g_variant_iter_next_value (&iter)) != NULL)
15423 {
15424 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
15425 if (arg_info->use_gvariant)
15426 {
15427 g_value_init (&paramv[n], G_TYPE_VARIANT);
15428 g_value_set_variant (&paramv[n], child);
15429 n++;
15430 }
15431 else
15432 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
15433 g_variant_unref (child);
15434 }
15435 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
15436 g_value_init (&return_value, G_TYPE_BOOLEAN);
15437 g_signal_emitv (paramv, signal_id, 0, &return_value);
15438 if (!g_value_get_boolean (&return_value))
15439 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);
15440 g_value_unset (&return_value);
15441 for (n = 0; n < num_params + num_extra; n++)
15442 g_value_unset (&paramv[n]);
15443 g_free (paramv);
15444}
15445
15446static GVariant *
15447_control_power_skeleton_handle_get_property (
15448 GDBusConnection *connection G_GNUC_UNUSED,
15449 const gchar *sender G_GNUC_UNUSED,
15450 const gchar *object_path G_GNUC_UNUSED,
15451 const gchar *interface_name G_GNUC_UNUSED,
15452 const gchar *property_name,
15453 GError **error,
15454 gpointer user_data)
15455{
15456 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
15457 GValue value = G_VALUE_INIT;
15458 GParamSpec *pspec;
15459 _ExtendedGDBusPropertyInfo *info;
15460 GVariant *ret;
15461 ret = NULL;
15462 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
15463 g_assert (info != NULL);
15464 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
15465 if (pspec == NULL)
15466 {
15467 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
15468 }
15469 else
15470 {
15471 g_value_init (&value, pspec->value_type);
15472 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
15473 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
15474 g_value_unset (&value);
15475 }
15476 return ret;
15477}
15478
15479static gboolean
15480_control_power_skeleton_handle_set_property (
15481 GDBusConnection *connection G_GNUC_UNUSED,
15482 const gchar *sender G_GNUC_UNUSED,
15483 const gchar *object_path G_GNUC_UNUSED,
15484 const gchar *interface_name G_GNUC_UNUSED,
15485 const gchar *property_name,
15486 GVariant *variant,
15487 GError **error,
15488 gpointer user_data)
15489{
15490 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
15491 GValue value = G_VALUE_INIT;
15492 GParamSpec *pspec;
15493 _ExtendedGDBusPropertyInfo *info;
15494 gboolean ret;
15495 ret = FALSE;
15496 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
15497 g_assert (info != NULL);
15498 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
15499 if (pspec == NULL)
15500 {
15501 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
15502 }
15503 else
15504 {
15505 if (info->use_gvariant)
15506 g_value_set_variant (&value, variant);
15507 else
15508 g_dbus_gvariant_to_gvalue (variant, &value);
15509 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
15510 g_value_unset (&value);
15511 ret = TRUE;
15512 }
15513 return ret;
15514}
15515
15516static const GDBusInterfaceVTable _control_power_skeleton_vtable =
15517{
15518 _control_power_skeleton_handle_method_call,
15519 _control_power_skeleton_handle_get_property,
15520 _control_power_skeleton_handle_set_property,
15521 {NULL}
15522};
15523
15524static GDBusInterfaceInfo *
15525control_power_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
15526{
15527 return control_power_interface_info ();
15528}
15529
15530static GDBusInterfaceVTable *
15531control_power_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
15532{
15533 return (GDBusInterfaceVTable *) &_control_power_skeleton_vtable;
15534}
15535
15536static GVariant *
15537control_power_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
15538{
15539 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
15540
15541 GVariantBuilder builder;
15542 guint n;
15543 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
15544 if (_control_power_interface_info.parent_struct.properties == NULL)
15545 goto out;
15546 for (n = 0; _control_power_interface_info.parent_struct.properties[n] != NULL; n++)
15547 {
15548 GDBusPropertyInfo *info = _control_power_interface_info.parent_struct.properties[n];
15549 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
15550 {
15551 GVariant *value;
15552 value = _control_power_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.Power", info->name, NULL, skeleton);
15553 if (value != NULL)
15554 {
15555 g_variant_take_ref (value);
15556 g_variant_builder_add (&builder, "{sv}", info->name, value);
15557 g_variant_unref (value);
15558 }
15559 }
15560 }
15561out:
15562 return g_variant_builder_end (&builder);
15563}
15564
15565static gboolean _control_power_emit_changed (gpointer user_data);
15566
15567static void
15568control_power_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
15569{
15570 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
15571 gboolean emit_changed = FALSE;
15572
15573 g_mutex_lock (&skeleton->priv->lock);
15574 if (skeleton->priv->changed_properties_idle_source != NULL)
15575 {
15576 g_source_destroy (skeleton->priv->changed_properties_idle_source);
15577 skeleton->priv->changed_properties_idle_source = NULL;
15578 emit_changed = TRUE;
15579 }
15580 g_mutex_unlock (&skeleton->priv->lock);
15581
15582 if (emit_changed)
15583 _control_power_emit_changed (skeleton);
15584}
15585
15586static void
15587_control_power_on_signal_power_good (
15588 ControlPower *object)
15589{
15590 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
15591
15592 GList *connections, *l;
15593 GVariant *signal_variant;
15594 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
15595
15596 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
15597 for (l = connections; l != NULL; l = l->next)
15598 {
15599 GDBusConnection *connection = l->data;
15600 g_dbus_connection_emit_signal (connection,
15601 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerGood",
15602 signal_variant, NULL);
15603 }
15604 g_variant_unref (signal_variant);
15605 g_list_free_full (connections, g_object_unref);
15606}
15607
15608static void
15609_control_power_on_signal_power_lost (
15610 ControlPower *object)
15611{
15612 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
15613
15614 GList *connections, *l;
15615 GVariant *signal_variant;
15616 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
15617
15618 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
15619 for (l = connections; l != NULL; l = l->next)
15620 {
15621 GDBusConnection *connection = l->data;
15622 g_dbus_connection_emit_signal (connection,
15623 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerLost",
15624 signal_variant, NULL);
15625 }
15626 g_variant_unref (signal_variant);
15627 g_list_free_full (connections, g_object_unref);
15628}
15629
15630static void control_power_skeleton_iface_init (ControlPowerIface *iface);
15631#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15632G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
15633 G_ADD_PRIVATE (ControlPowerSkeleton)
15634 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init));
15635
15636#else
15637G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
15638 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init));
15639
15640#endif
15641static void
15642control_power_skeleton_finalize (GObject *object)
15643{
15644 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
15645 guint n;
15646 for (n = 0; n < 2; n++)
15647 g_value_unset (&skeleton->priv->properties[n]);
15648 g_free (skeleton->priv->properties);
15649 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
15650 if (skeleton->priv->changed_properties_idle_source != NULL)
15651 g_source_destroy (skeleton->priv->changed_properties_idle_source);
15652 g_main_context_unref (skeleton->priv->context);
15653 g_mutex_clear (&skeleton->priv->lock);
15654 G_OBJECT_CLASS (control_power_skeleton_parent_class)->finalize (object);
15655}
15656
15657static void
15658control_power_skeleton_get_property (GObject *object,
15659 guint prop_id,
15660 GValue *value,
15661 GParamSpec *pspec G_GNUC_UNUSED)
15662{
15663 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
15664 g_assert (prop_id != 0 && prop_id - 1 < 2);
15665 g_mutex_lock (&skeleton->priv->lock);
15666 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
15667 g_mutex_unlock (&skeleton->priv->lock);
15668}
15669
15670static gboolean
15671_control_power_emit_changed (gpointer user_data)
15672{
15673 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
15674 GList *l;
15675 GVariantBuilder builder;
15676 GVariantBuilder invalidated_builder;
15677 guint num_changes;
15678
15679 g_mutex_lock (&skeleton->priv->lock);
15680 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
15681 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
15682 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
15683 {
15684 ChangedProperty *cp = l->data;
15685 GVariant *variant;
15686 const GValue *cur_value;
15687
15688 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
15689 if (!_g_value_equal (cur_value, &cp->orig_value))
15690 {
15691 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
15692 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
15693 g_variant_unref (variant);
15694 num_changes++;
15695 }
15696 }
15697 if (num_changes > 0)
15698 {
15699 GList *connections, *ll;
15700 GVariant *signal_variant;
15701 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.control.Power",
15702 &builder, &invalidated_builder));
15703 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
15704 for (ll = connections; ll != NULL; ll = ll->next)
15705 {
15706 GDBusConnection *connection = ll->data;
15707
15708 g_dbus_connection_emit_signal (connection,
15709 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
15710 "org.freedesktop.DBus.Properties",
15711 "PropertiesChanged",
15712 signal_variant,
15713 NULL);
15714 }
15715 g_variant_unref (signal_variant);
15716 g_list_free_full (connections, g_object_unref);
15717 }
15718 else
15719 {
15720 g_variant_builder_clear (&builder);
15721 g_variant_builder_clear (&invalidated_builder);
15722 }
15723 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
15724 skeleton->priv->changed_properties = NULL;
15725 skeleton->priv->changed_properties_idle_source = NULL;
15726 g_mutex_unlock (&skeleton->priv->lock);
15727 return FALSE;
15728}
15729
15730static void
15731_control_power_schedule_emit_changed (ControlPowerSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
15732{
15733 ChangedProperty *cp;
15734 GList *l;
15735 cp = NULL;
15736 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
15737 {
15738 ChangedProperty *i_cp = l->data;
15739 if (i_cp->info == info)
15740 {
15741 cp = i_cp;
15742 break;
15743 }
15744 }
15745 if (cp == NULL)
15746 {
15747 cp = g_new0 (ChangedProperty, 1);
15748 cp->prop_id = prop_id;
15749 cp->info = info;
15750 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
15751 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
15752 g_value_copy (orig_value, &cp->orig_value);
15753 }
15754}
15755
15756static void
15757control_power_skeleton_notify (GObject *object,
15758 GParamSpec *pspec G_GNUC_UNUSED)
15759{
15760 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
15761 g_mutex_lock (&skeleton->priv->lock);
15762 if (skeleton->priv->changed_properties != NULL &&
15763 skeleton->priv->changed_properties_idle_source == NULL)
15764 {
15765 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
15766 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
15767 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_power_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
15768 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
15769 g_source_unref (skeleton->priv->changed_properties_idle_source);
15770 }
15771 g_mutex_unlock (&skeleton->priv->lock);
15772}
15773
15774static void
15775control_power_skeleton_set_property (GObject *object,
15776 guint prop_id,
15777 const GValue *value,
15778 GParamSpec *pspec)
15779{
15780 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
15781 g_assert (prop_id != 0 && prop_id - 1 < 2);
15782 g_mutex_lock (&skeleton->priv->lock);
15783 g_object_freeze_notify (object);
15784 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
15785 {
15786 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
15787 _control_power_schedule_emit_changed (skeleton, _control_power_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
15788 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
15789 g_object_notify_by_pspec (object, pspec);
15790 }
15791 g_mutex_unlock (&skeleton->priv->lock);
15792 g_object_thaw_notify (object);
15793}
15794
15795static void
15796control_power_skeleton_init (ControlPowerSkeleton *skeleton)
15797{
15798#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15799 skeleton->priv = control_power_skeleton_get_instance_private (skeleton);
15800#else
15801 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_POWER_SKELETON, ControlPowerSkeletonPrivate);
15802#endif
15803
15804 g_mutex_init (&skeleton->priv->lock);
15805 skeleton->priv->context = g_main_context_ref_thread_default ();
15806 skeleton->priv->properties = g_new0 (GValue, 2);
15807 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
15808 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
15809}
15810
15811static gint
15812control_power_skeleton_get_pgood (ControlPower *object)
15813{
15814 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
15815 gint value;
15816 g_mutex_lock (&skeleton->priv->lock);
15817 value = g_value_get_int (&(skeleton->priv->properties[0]));
15818 g_mutex_unlock (&skeleton->priv->lock);
15819 return value;
15820}
15821
15822static gint
15823control_power_skeleton_get_state (ControlPower *object)
15824{
15825 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
15826 gint value;
15827 g_mutex_lock (&skeleton->priv->lock);
15828 value = g_value_get_int (&(skeleton->priv->properties[1]));
15829 g_mutex_unlock (&skeleton->priv->lock);
15830 return value;
15831}
15832
15833static void
15834control_power_skeleton_class_init (ControlPowerSkeletonClass *klass)
15835{
15836 GObjectClass *gobject_class;
15837 GDBusInterfaceSkeletonClass *skeleton_class;
15838
15839 gobject_class = G_OBJECT_CLASS (klass);
15840 gobject_class->finalize = control_power_skeleton_finalize;
15841 gobject_class->get_property = control_power_skeleton_get_property;
15842 gobject_class->set_property = control_power_skeleton_set_property;
15843 gobject_class->notify = control_power_skeleton_notify;
15844
15845
15846 control_power_override_properties (gobject_class, 1);
15847
15848 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
15849 skeleton_class->get_info = control_power_skeleton_dbus_interface_get_info;
15850 skeleton_class->get_properties = control_power_skeleton_dbus_interface_get_properties;
15851 skeleton_class->flush = control_power_skeleton_dbus_interface_flush;
15852 skeleton_class->get_vtable = control_power_skeleton_dbus_interface_get_vtable;
15853
15854#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
15855 g_type_class_add_private (klass, sizeof (ControlPowerSkeletonPrivate));
15856#endif
15857}
15858
15859static void
15860control_power_skeleton_iface_init (ControlPowerIface *iface)
15861{
15862 iface->power_good = _control_power_on_signal_power_good;
15863 iface->power_lost = _control_power_on_signal_power_lost;
15864 iface->get_pgood = control_power_skeleton_get_pgood;
15865 iface->get_state = control_power_skeleton_get_state;
15866}
15867
15868/**
15869 * control_power_skeleton_new:
15870 *
15871 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
15872 *
15873 * Returns: (transfer full) (type ControlPowerSkeleton): The skeleton object.
15874 */
15875ControlPower *
15876control_power_skeleton_new (void)
15877{
15878 return CONTROL_POWER (g_object_new (TYPE_CONTROL_POWER_SKELETON, NULL));
15879}
15880
15881/* ------------------------------------------------------------------------
15882 * Code for interface org.openbmc.Watchdog
15883 * ------------------------------------------------------------------------
15884 */
15885
15886/**
15887 * SECTION:Watchdog
15888 * @title: Watchdog
15889 * @short_description: Generated C code for the org.openbmc.Watchdog D-Bus interface
15890 *
15891 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> D-Bus interface in C.
15892 */
15893
15894/* ---- Introspection data for org.openbmc.Watchdog ---- */
15895
15896static const _ExtendedGDBusMethodInfo _watchdog_method_info_start =
15897{
15898 {
15899 -1,
15900 (gchar *) "start",
15901 NULL,
15902 NULL,
15903 NULL
15904 },
15905 "handle-start",
15906 FALSE
15907};
15908
15909static const _ExtendedGDBusMethodInfo _watchdog_method_info_poke =
15910{
15911 {
15912 -1,
15913 (gchar *) "poke",
15914 NULL,
15915 NULL,
15916 NULL
15917 },
15918 "handle-poke",
15919 FALSE
15920};
15921
15922static const _ExtendedGDBusMethodInfo _watchdog_method_info_stop =
15923{
15924 {
15925 -1,
15926 (gchar *) "stop",
15927 NULL,
15928 NULL,
15929 NULL
15930 },
15931 "handle-stop",
15932 FALSE
15933};
15934
15935static const _ExtendedGDBusMethodInfo * const _watchdog_method_info_pointers[] =
15936{
15937 &_watchdog_method_info_start,
15938 &_watchdog_method_info_poke,
15939 &_watchdog_method_info_stop,
15940 NULL
15941};
15942
15943static const _ExtendedGDBusSignalInfo _watchdog_signal_info_watchdog_error =
15944{
15945 {
15946 -1,
15947 (gchar *) "WatchdogError",
15948 NULL,
15949 NULL
15950 },
15951 "watchdog-error"
15952};
15953
15954static const _ExtendedGDBusSignalInfo * const _watchdog_signal_info_pointers[] =
15955{
15956 &_watchdog_signal_info_watchdog_error,
15957 NULL
15958};
15959
15960static const _ExtendedGDBusPropertyInfo _watchdog_property_info_watchdog =
15961{
15962 {
15963 -1,
15964 (gchar *) "watchdog",
15965 (gchar *) "i",
15966 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
15967 NULL
15968 },
15969 "watchdog",
15970 FALSE
15971};
15972
15973static const _ExtendedGDBusPropertyInfo _watchdog_property_info_poll_interval =
15974{
15975 {
15976 -1,
15977 (gchar *) "poll_interval",
15978 (gchar *) "i",
15979 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
15980 NULL
15981 },
15982 "poll-interval",
15983 FALSE
15984};
15985
15986static const _ExtendedGDBusPropertyInfo * const _watchdog_property_info_pointers[] =
15987{
15988 &_watchdog_property_info_watchdog,
15989 &_watchdog_property_info_poll_interval,
15990 NULL
15991};
15992
15993static const _ExtendedGDBusInterfaceInfo _watchdog_interface_info =
15994{
15995 {
15996 -1,
15997 (gchar *) "org.openbmc.Watchdog",
15998 (GDBusMethodInfo **) &_watchdog_method_info_pointers,
15999 (GDBusSignalInfo **) &_watchdog_signal_info_pointers,
16000 (GDBusPropertyInfo **) &_watchdog_property_info_pointers,
16001 NULL
16002 },
16003 "watchdog",
16004};
16005
16006
16007/**
16008 * watchdog_interface_info:
16009 *
16010 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> D-Bus interface.
16011 *
16012 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
16013 */
16014GDBusInterfaceInfo *
16015watchdog_interface_info (void)
16016{
16017 return (GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct;
16018}
16019
16020/**
16021 * watchdog_override_properties:
16022 * @klass: The class structure for a #GObject<!-- -->-derived class.
16023 * @property_id_begin: The property id to assign to the first overridden property.
16024 *
16025 * Overrides all #GObject properties in the #Watchdog interface for a concrete class.
16026 * The properties are overridden in the order they are defined.
16027 *
16028 * Returns: The last property id.
16029 */
16030guint
16031watchdog_override_properties (GObjectClass *klass, guint property_id_begin)
16032{
16033 g_object_class_override_property (klass, property_id_begin++, "watchdog");
16034 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
16035 return property_id_begin - 1;
16036}
16037
16038
16039
16040/**
16041 * Watchdog:
16042 *
16043 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
16044 */
16045
16046/**
16047 * WatchdogIface:
16048 * @parent_iface: The parent interface.
16049 * @handle_poke: Handler for the #Watchdog::handle-poke signal.
16050 * @handle_start: Handler for the #Watchdog::handle-start signal.
16051 * @handle_stop: Handler for the #Watchdog::handle-stop signal.
16052 * @get_poll_interval: Getter for the #Watchdog:poll-interval property.
16053 * @get_watchdog: Getter for the #Watchdog:watchdog property.
16054 * @watchdog_error: Handler for the #Watchdog::watchdog-error signal.
16055 *
16056 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
16057 */
16058
16059typedef WatchdogIface WatchdogInterface;
16060G_DEFINE_INTERFACE (Watchdog, watchdog, G_TYPE_OBJECT);
16061
16062static void
16063watchdog_default_init (WatchdogIface *iface)
16064{
16065 /* GObject signals for incoming D-Bus method calls: */
16066 /**
16067 * Watchdog::handle-start:
16068 * @object: A #Watchdog.
16069 * @invocation: A #GDBusMethodInvocation.
16070 *
16071 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method.
16072 *
16073 * 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 watchdog_complete_start() 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.
16074 *
16075 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
16076 */
16077 g_signal_new ("handle-start",
16078 G_TYPE_FROM_INTERFACE (iface),
16079 G_SIGNAL_RUN_LAST,
16080 G_STRUCT_OFFSET (WatchdogIface, handle_start),
16081 g_signal_accumulator_true_handled,
16082 NULL,
16083 g_cclosure_marshal_generic,
16084 G_TYPE_BOOLEAN,
16085 1,
16086 G_TYPE_DBUS_METHOD_INVOCATION);
16087
16088 /**
16089 * Watchdog::handle-poke:
16090 * @object: A #Watchdog.
16091 * @invocation: A #GDBusMethodInvocation.
16092 *
16093 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method.
16094 *
16095 * 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 watchdog_complete_poke() 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.
16096 *
16097 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
16098 */
16099 g_signal_new ("handle-poke",
16100 G_TYPE_FROM_INTERFACE (iface),
16101 G_SIGNAL_RUN_LAST,
16102 G_STRUCT_OFFSET (WatchdogIface, handle_poke),
16103 g_signal_accumulator_true_handled,
16104 NULL,
16105 g_cclosure_marshal_generic,
16106 G_TYPE_BOOLEAN,
16107 1,
16108 G_TYPE_DBUS_METHOD_INVOCATION);
16109
16110 /**
16111 * Watchdog::handle-stop:
16112 * @object: A #Watchdog.
16113 * @invocation: A #GDBusMethodInvocation.
16114 *
16115 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method.
16116 *
16117 * 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 watchdog_complete_stop() 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.
16118 *
16119 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
16120 */
16121 g_signal_new ("handle-stop",
16122 G_TYPE_FROM_INTERFACE (iface),
16123 G_SIGNAL_RUN_LAST,
16124 G_STRUCT_OFFSET (WatchdogIface, handle_stop),
16125 g_signal_accumulator_true_handled,
16126 NULL,
16127 g_cclosure_marshal_generic,
16128 G_TYPE_BOOLEAN,
16129 1,
16130 G_TYPE_DBUS_METHOD_INVOCATION);
16131
16132 /* GObject signals for received D-Bus signals: */
16133 /**
16134 * Watchdog::watchdog-error:
16135 * @object: A #Watchdog.
16136 *
16137 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Watchdog.WatchdogError">"WatchdogError"</link> is received.
16138 *
16139 * 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.
16140 */
16141 g_signal_new ("watchdog-error",
16142 G_TYPE_FROM_INTERFACE (iface),
16143 G_SIGNAL_RUN_LAST,
16144 G_STRUCT_OFFSET (WatchdogIface, watchdog_error),
16145 NULL,
16146 NULL,
16147 g_cclosure_marshal_generic,
16148 G_TYPE_NONE,
16149 0);
16150
16151 /* GObject properties for D-Bus properties: */
16152 /**
16153 * Watchdog:watchdog:
16154 *
16155 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link>.
16156 *
16157 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
16158 */
16159 g_object_interface_install_property (iface,
16160 g_param_spec_int ("watchdog", "watchdog", "watchdog", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
16161 /**
16162 * Watchdog:poll-interval:
16163 *
16164 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link>.
16165 *
16166 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
16167 */
16168 g_object_interface_install_property (iface,
16169 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
16170}
16171
16172/**
16173 * watchdog_get_watchdog: (skip)
16174 * @object: A #Watchdog.
16175 *
16176 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property.
16177 *
16178 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
16179 *
16180 * Returns: The property value.
16181 */
16182gint
16183watchdog_get_watchdog (Watchdog *object)
16184{
16185 return WATCHDOG_GET_IFACE (object)->get_watchdog (object);
16186}
16187
16188/**
16189 * watchdog_set_watchdog: (skip)
16190 * @object: A #Watchdog.
16191 * @value: The value to set.
16192 *
16193 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property to @value.
16194 *
16195 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
16196 */
16197void
16198watchdog_set_watchdog (Watchdog *object, gint value)
16199{
16200 g_object_set (G_OBJECT (object), "watchdog", value, NULL);
16201}
16202
16203/**
16204 * watchdog_get_poll_interval: (skip)
16205 * @object: A #Watchdog.
16206 *
16207 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property.
16208 *
16209 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
16210 *
16211 * Returns: The property value.
16212 */
16213gint
16214watchdog_get_poll_interval (Watchdog *object)
16215{
16216 return WATCHDOG_GET_IFACE (object)->get_poll_interval (object);
16217}
16218
16219/**
16220 * watchdog_set_poll_interval: (skip)
16221 * @object: A #Watchdog.
16222 * @value: The value to set.
16223 *
16224 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property to @value.
16225 *
16226 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
16227 */
16228void
16229watchdog_set_poll_interval (Watchdog *object, gint value)
16230{
16231 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
16232}
16233
16234/**
16235 * watchdog_emit_watchdog_error:
16236 * @object: A #Watchdog.
16237 *
16238 * Emits the <link linkend="gdbus-signal-org-openbmc-Watchdog.WatchdogError">"WatchdogError"</link> D-Bus signal.
16239 */
16240void
16241watchdog_emit_watchdog_error (
16242 Watchdog *object)
16243{
16244 g_signal_emit_by_name (object, "watchdog-error");
16245}
16246
16247/**
16248 * watchdog_call_start:
16249 * @proxy: A #WatchdogProxy.
16250 * @cancellable: (allow-none): A #GCancellable or %NULL.
16251 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
16252 * @user_data: User data to pass to @callback.
16253 *
16254 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method on @proxy.
16255 * 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.
16256 * You can then call watchdog_call_start_finish() to get the result of the operation.
16257 *
16258 * See watchdog_call_start_sync() for the synchronous, blocking version of this method.
16259 */
16260void
16261watchdog_call_start (
16262 Watchdog *proxy,
16263 GCancellable *cancellable,
16264 GAsyncReadyCallback callback,
16265 gpointer user_data)
16266{
16267 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
16268 "start",
16269 g_variant_new ("()"),
16270 G_DBUS_CALL_FLAGS_NONE,
16271 -1,
16272 cancellable,
16273 callback,
16274 user_data);
16275}
16276
16277/**
16278 * watchdog_call_start_finish:
16279 * @proxy: A #WatchdogProxy.
16280 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_start().
16281 * @error: Return location for error or %NULL.
16282 *
16283 * Finishes an operation started with watchdog_call_start().
16284 *
16285 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16286 */
16287gboolean
16288watchdog_call_start_finish (
16289 Watchdog *proxy,
16290 GAsyncResult *res,
16291 GError **error)
16292{
16293 GVariant *_ret;
16294 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
16295 if (_ret == NULL)
16296 goto _out;
16297 g_variant_get (_ret,
16298 "()");
16299 g_variant_unref (_ret);
16300_out:
16301 return _ret != NULL;
16302}
16303
16304/**
16305 * watchdog_call_start_sync:
16306 * @proxy: A #WatchdogProxy.
16307 * @cancellable: (allow-none): A #GCancellable or %NULL.
16308 * @error: Return location for error or %NULL.
16309 *
16310 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
16311 *
16312 * See watchdog_call_start() for the asynchronous version of this method.
16313 *
16314 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16315 */
16316gboolean
16317watchdog_call_start_sync (
16318 Watchdog *proxy,
16319 GCancellable *cancellable,
16320 GError **error)
16321{
16322 GVariant *_ret;
16323 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
16324 "start",
16325 g_variant_new ("()"),
16326 G_DBUS_CALL_FLAGS_NONE,
16327 -1,
16328 cancellable,
16329 error);
16330 if (_ret == NULL)
16331 goto _out;
16332 g_variant_get (_ret,
16333 "()");
16334 g_variant_unref (_ret);
16335_out:
16336 return _ret != NULL;
16337}
16338
16339/**
16340 * watchdog_call_poke:
16341 * @proxy: A #WatchdogProxy.
16342 * @cancellable: (allow-none): A #GCancellable or %NULL.
16343 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
16344 * @user_data: User data to pass to @callback.
16345 *
16346 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method on @proxy.
16347 * 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.
16348 * You can then call watchdog_call_poke_finish() to get the result of the operation.
16349 *
16350 * See watchdog_call_poke_sync() for the synchronous, blocking version of this method.
16351 */
16352void
16353watchdog_call_poke (
16354 Watchdog *proxy,
16355 GCancellable *cancellable,
16356 GAsyncReadyCallback callback,
16357 gpointer user_data)
16358{
16359 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
16360 "poke",
16361 g_variant_new ("()"),
16362 G_DBUS_CALL_FLAGS_NONE,
16363 -1,
16364 cancellable,
16365 callback,
16366 user_data);
16367}
16368
16369/**
16370 * watchdog_call_poke_finish:
16371 * @proxy: A #WatchdogProxy.
16372 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_poke().
16373 * @error: Return location for error or %NULL.
16374 *
16375 * Finishes an operation started with watchdog_call_poke().
16376 *
16377 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16378 */
16379gboolean
16380watchdog_call_poke_finish (
16381 Watchdog *proxy,
16382 GAsyncResult *res,
16383 GError **error)
16384{
16385 GVariant *_ret;
16386 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
16387 if (_ret == NULL)
16388 goto _out;
16389 g_variant_get (_ret,
16390 "()");
16391 g_variant_unref (_ret);
16392_out:
16393 return _ret != NULL;
16394}
16395
16396/**
16397 * watchdog_call_poke_sync:
16398 * @proxy: A #WatchdogProxy.
16399 * @cancellable: (allow-none): A #GCancellable or %NULL.
16400 * @error: Return location for error or %NULL.
16401 *
16402 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
16403 *
16404 * See watchdog_call_poke() for the asynchronous version of this method.
16405 *
16406 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16407 */
16408gboolean
16409watchdog_call_poke_sync (
16410 Watchdog *proxy,
16411 GCancellable *cancellable,
16412 GError **error)
16413{
16414 GVariant *_ret;
16415 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
16416 "poke",
16417 g_variant_new ("()"),
16418 G_DBUS_CALL_FLAGS_NONE,
16419 -1,
16420 cancellable,
16421 error);
16422 if (_ret == NULL)
16423 goto _out;
16424 g_variant_get (_ret,
16425 "()");
16426 g_variant_unref (_ret);
16427_out:
16428 return _ret != NULL;
16429}
16430
16431/**
16432 * watchdog_call_stop:
16433 * @proxy: A #WatchdogProxy.
16434 * @cancellable: (allow-none): A #GCancellable or %NULL.
16435 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
16436 * @user_data: User data to pass to @callback.
16437 *
16438 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method on @proxy.
16439 * 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.
16440 * You can then call watchdog_call_stop_finish() to get the result of the operation.
16441 *
16442 * See watchdog_call_stop_sync() for the synchronous, blocking version of this method.
16443 */
16444void
16445watchdog_call_stop (
16446 Watchdog *proxy,
16447 GCancellable *cancellable,
16448 GAsyncReadyCallback callback,
16449 gpointer user_data)
16450{
16451 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
16452 "stop",
16453 g_variant_new ("()"),
16454 G_DBUS_CALL_FLAGS_NONE,
16455 -1,
16456 cancellable,
16457 callback,
16458 user_data);
16459}
16460
16461/**
16462 * watchdog_call_stop_finish:
16463 * @proxy: A #WatchdogProxy.
16464 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_stop().
16465 * @error: Return location for error or %NULL.
16466 *
16467 * Finishes an operation started with watchdog_call_stop().
16468 *
16469 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16470 */
16471gboolean
16472watchdog_call_stop_finish (
16473 Watchdog *proxy,
16474 GAsyncResult *res,
16475 GError **error)
16476{
16477 GVariant *_ret;
16478 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
16479 if (_ret == NULL)
16480 goto _out;
16481 g_variant_get (_ret,
16482 "()");
16483 g_variant_unref (_ret);
16484_out:
16485 return _ret != NULL;
16486}
16487
16488/**
16489 * watchdog_call_stop_sync:
16490 * @proxy: A #WatchdogProxy.
16491 * @cancellable: (allow-none): A #GCancellable or %NULL.
16492 * @error: Return location for error or %NULL.
16493 *
16494 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
16495 *
16496 * See watchdog_call_stop() for the asynchronous version of this method.
16497 *
16498 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16499 */
16500gboolean
16501watchdog_call_stop_sync (
16502 Watchdog *proxy,
16503 GCancellable *cancellable,
16504 GError **error)
16505{
16506 GVariant *_ret;
16507 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
16508 "stop",
16509 g_variant_new ("()"),
16510 G_DBUS_CALL_FLAGS_NONE,
16511 -1,
16512 cancellable,
16513 error);
16514 if (_ret == NULL)
16515 goto _out;
16516 g_variant_get (_ret,
16517 "()");
16518 g_variant_unref (_ret);
16519_out:
16520 return _ret != NULL;
16521}
16522
16523/**
16524 * watchdog_complete_start:
16525 * @object: A #Watchdog.
16526 * @invocation: (transfer full): A #GDBusMethodInvocation.
16527 *
16528 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</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.
16529 *
16530 * This method will free @invocation, you cannot use it afterwards.
16531 */
16532void
16533watchdog_complete_start (
16534 Watchdog *object,
16535 GDBusMethodInvocation *invocation)
16536{
16537 g_dbus_method_invocation_return_value (invocation,
16538 g_variant_new ("()"));
16539}
16540
16541/**
16542 * watchdog_complete_poke:
16543 * @object: A #Watchdog.
16544 * @invocation: (transfer full): A #GDBusMethodInvocation.
16545 *
16546 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</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.
16547 *
16548 * This method will free @invocation, you cannot use it afterwards.
16549 */
16550void
16551watchdog_complete_poke (
16552 Watchdog *object,
16553 GDBusMethodInvocation *invocation)
16554{
16555 g_dbus_method_invocation_return_value (invocation,
16556 g_variant_new ("()"));
16557}
16558
16559/**
16560 * watchdog_complete_stop:
16561 * @object: A #Watchdog.
16562 * @invocation: (transfer full): A #GDBusMethodInvocation.
16563 *
16564 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</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.
16565 *
16566 * This method will free @invocation, you cannot use it afterwards.
16567 */
16568void
16569watchdog_complete_stop (
16570 Watchdog *object,
16571 GDBusMethodInvocation *invocation)
16572{
16573 g_dbus_method_invocation_return_value (invocation,
16574 g_variant_new ("()"));
16575}
16576
16577/* ------------------------------------------------------------------------ */
16578
16579/**
16580 * WatchdogProxy:
16581 *
16582 * The #WatchdogProxy structure contains only private data and should only be accessed using the provided API.
16583 */
16584
16585/**
16586 * WatchdogProxyClass:
16587 * @parent_class: The parent class.
16588 *
16589 * Class structure for #WatchdogProxy.
16590 */
16591
16592struct _WatchdogProxyPrivate
16593{
16594 GData *qdata;
16595};
16596
16597static void watchdog_proxy_iface_init (WatchdogIface *iface);
16598
16599#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16600G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY,
16601 G_ADD_PRIVATE (WatchdogProxy)
16602 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init));
16603
16604#else
16605G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY,
16606 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init));
16607
16608#endif
16609static void
16610watchdog_proxy_finalize (GObject *object)
16611{
16612 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
16613 g_datalist_clear (&proxy->priv->qdata);
16614 G_OBJECT_CLASS (watchdog_proxy_parent_class)->finalize (object);
16615}
16616
16617static void
16618watchdog_proxy_get_property (GObject *object,
16619 guint prop_id,
16620 GValue *value,
16621 GParamSpec *pspec G_GNUC_UNUSED)
16622{
16623 const _ExtendedGDBusPropertyInfo *info;
16624 GVariant *variant;
16625 g_assert (prop_id != 0 && prop_id - 1 < 2);
16626 info = _watchdog_property_info_pointers[prop_id - 1];
16627 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
16628 if (info->use_gvariant)
16629 {
16630 g_value_set_variant (value, variant);
16631 }
16632 else
16633 {
16634 if (variant != NULL)
16635 g_dbus_gvariant_to_gvalue (variant, value);
16636 }
16637 if (variant != NULL)
16638 g_variant_unref (variant);
16639}
16640
16641static void
16642watchdog_proxy_set_property_cb (GDBusProxy *proxy,
16643 GAsyncResult *res,
16644 gpointer user_data)
16645{
16646 const _ExtendedGDBusPropertyInfo *info = user_data;
16647 GError *error;
16648 GVariant *_ret;
16649 error = NULL;
16650 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
16651 if (!_ret)
16652 {
16653 g_warning ("Error setting property '%s' on interface org.openbmc.Watchdog: %s (%s, %d)",
16654 info->parent_struct.name,
16655 error->message, g_quark_to_string (error->domain), error->code);
16656 g_error_free (error);
16657 }
16658 else
16659 {
16660 g_variant_unref (_ret);
16661 }
16662}
16663
16664static void
16665watchdog_proxy_set_property (GObject *object,
16666 guint prop_id,
16667 const GValue *value,
16668 GParamSpec *pspec G_GNUC_UNUSED)
16669{
16670 const _ExtendedGDBusPropertyInfo *info;
16671 GVariant *variant;
16672 g_assert (prop_id != 0 && prop_id - 1 < 2);
16673 info = _watchdog_property_info_pointers[prop_id - 1];
16674 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
16675 g_dbus_proxy_call (G_DBUS_PROXY (object),
16676 "org.freedesktop.DBus.Properties.Set",
16677 g_variant_new ("(ssv)", "org.openbmc.Watchdog", info->parent_struct.name, variant),
16678 G_DBUS_CALL_FLAGS_NONE,
16679 -1,
16680 NULL, (GAsyncReadyCallback) watchdog_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
16681 g_variant_unref (variant);
16682}
16683
16684static void
16685watchdog_proxy_g_signal (GDBusProxy *proxy,
16686 const gchar *sender_name G_GNUC_UNUSED,
16687 const gchar *signal_name,
16688 GVariant *parameters)
16689{
16690 _ExtendedGDBusSignalInfo *info;
16691 GVariantIter iter;
16692 GVariant *child;
16693 GValue *paramv;
16694 guint num_params;
16695 guint n;
16696 guint signal_id;
16697 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, signal_name);
16698 if (info == NULL)
16699 return;
16700 num_params = g_variant_n_children (parameters);
16701 paramv = g_new0 (GValue, num_params + 1);
16702 g_value_init (&paramv[0], TYPE_WATCHDOG);
16703 g_value_set_object (&paramv[0], proxy);
16704 g_variant_iter_init (&iter, parameters);
16705 n = 1;
16706 while ((child = g_variant_iter_next_value (&iter)) != NULL)
16707 {
16708 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
16709 if (arg_info->use_gvariant)
16710 {
16711 g_value_init (&paramv[n], G_TYPE_VARIANT);
16712 g_value_set_variant (&paramv[n], child);
16713 n++;
16714 }
16715 else
16716 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
16717 g_variant_unref (child);
16718 }
16719 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG);
16720 g_signal_emitv (paramv, signal_id, 0, NULL);
16721 for (n = 0; n < num_params + 1; n++)
16722 g_value_unset (&paramv[n]);
16723 g_free (paramv);
16724}
16725
16726static void
16727watchdog_proxy_g_properties_changed (GDBusProxy *_proxy,
16728 GVariant *changed_properties,
16729 const gchar *const *invalidated_properties)
16730{
16731 WatchdogProxy *proxy = WATCHDOG_PROXY (_proxy);
16732 guint n;
16733 const gchar *key;
16734 GVariantIter *iter;
16735 _ExtendedGDBusPropertyInfo *info;
16736 g_variant_get (changed_properties, "a{sv}", &iter);
16737 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
16738 {
16739 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, key);
16740 g_datalist_remove_data (&proxy->priv->qdata, key);
16741 if (info != NULL)
16742 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
16743 }
16744 g_variant_iter_free (iter);
16745 for (n = 0; invalidated_properties[n] != NULL; n++)
16746 {
16747 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, invalidated_properties[n]);
16748 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
16749 if (info != NULL)
16750 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
16751 }
16752}
16753
16754static gint
16755watchdog_proxy_get_watchdog (Watchdog *object)
16756{
16757 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
16758 GVariant *variant;
16759 gint value = 0;
16760 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "watchdog");
16761 if (variant != NULL)
16762 {
16763 value = g_variant_get_int32 (variant);
16764 g_variant_unref (variant);
16765 }
16766 return value;
16767}
16768
16769static gint
16770watchdog_proxy_get_poll_interval (Watchdog *object)
16771{
16772 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
16773 GVariant *variant;
16774 gint value = 0;
16775 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
16776 if (variant != NULL)
16777 {
16778 value = g_variant_get_int32 (variant);
16779 g_variant_unref (variant);
16780 }
16781 return value;
16782}
16783
16784static void
16785watchdog_proxy_init (WatchdogProxy *proxy)
16786{
16787#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16788 proxy->priv = watchdog_proxy_get_instance_private (proxy);
16789#else
16790 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_WATCHDOG_PROXY, WatchdogProxyPrivate);
16791#endif
16792
16793 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), watchdog_interface_info ());
16794}
16795
16796static void
16797watchdog_proxy_class_init (WatchdogProxyClass *klass)
16798{
16799 GObjectClass *gobject_class;
16800 GDBusProxyClass *proxy_class;
16801
16802 gobject_class = G_OBJECT_CLASS (klass);
16803 gobject_class->finalize = watchdog_proxy_finalize;
16804 gobject_class->get_property = watchdog_proxy_get_property;
16805 gobject_class->set_property = watchdog_proxy_set_property;
16806
16807 proxy_class = G_DBUS_PROXY_CLASS (klass);
16808 proxy_class->g_signal = watchdog_proxy_g_signal;
16809 proxy_class->g_properties_changed = watchdog_proxy_g_properties_changed;
16810
16811 watchdog_override_properties (gobject_class, 1);
16812
16813#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
16814 g_type_class_add_private (klass, sizeof (WatchdogProxyPrivate));
16815#endif
16816}
16817
16818static void
16819watchdog_proxy_iface_init (WatchdogIface *iface)
16820{
16821 iface->get_watchdog = watchdog_proxy_get_watchdog;
16822 iface->get_poll_interval = watchdog_proxy_get_poll_interval;
16823}
16824
16825/**
16826 * watchdog_proxy_new:
16827 * @connection: A #GDBusConnection.
16828 * @flags: Flags from the #GDBusProxyFlags enumeration.
16829 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
16830 * @object_path: An object path.
16831 * @cancellable: (allow-none): A #GCancellable or %NULL.
16832 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
16833 * @user_data: User data to pass to @callback.
16834 *
16835 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>. See g_dbus_proxy_new() for more details.
16836 *
16837 * 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.
16838 * You can then call watchdog_proxy_new_finish() to get the result of the operation.
16839 *
16840 * See watchdog_proxy_new_sync() for the synchronous, blocking version of this constructor.
16841 */
16842void
16843watchdog_proxy_new (
16844 GDBusConnection *connection,
16845 GDBusProxyFlags flags,
16846 const gchar *name,
16847 const gchar *object_path,
16848 GCancellable *cancellable,
16849 GAsyncReadyCallback callback,
16850 gpointer user_data)
16851{
16852 g_async_initable_new_async (TYPE_WATCHDOG_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.Watchdog", NULL);
16853}
16854
16855/**
16856 * watchdog_proxy_new_finish:
16857 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new().
16858 * @error: Return location for error or %NULL
16859 *
16860 * Finishes an operation started with watchdog_proxy_new().
16861 *
16862 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
16863 */
16864Watchdog *
16865watchdog_proxy_new_finish (
16866 GAsyncResult *res,
16867 GError **error)
16868{
16869 GObject *ret;
16870 GObject *source_object;
16871 source_object = g_async_result_get_source_object (res);
16872 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
16873 g_object_unref (source_object);
16874 if (ret != NULL)
16875 return WATCHDOG (ret);
16876 else
16877 return NULL;
16878}
16879
16880/**
16881 * watchdog_proxy_new_sync:
16882 * @connection: A #GDBusConnection.
16883 * @flags: Flags from the #GDBusProxyFlags enumeration.
16884 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
16885 * @object_path: An object path.
16886 * @cancellable: (allow-none): A #GCancellable or %NULL.
16887 * @error: Return location for error or %NULL
16888 *
16889 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>. See g_dbus_proxy_new_sync() for more details.
16890 *
16891 * The calling thread is blocked until a reply is received.
16892 *
16893 * See watchdog_proxy_new() for the asynchronous version of this constructor.
16894 *
16895 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
16896 */
16897Watchdog *
16898watchdog_proxy_new_sync (
16899 GDBusConnection *connection,
16900 GDBusProxyFlags flags,
16901 const gchar *name,
16902 const gchar *object_path,
16903 GCancellable *cancellable,
16904 GError **error)
16905{
16906 GInitable *ret;
16907 ret = g_initable_new (TYPE_WATCHDOG_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Watchdog", NULL);
16908 if (ret != NULL)
16909 return WATCHDOG (ret);
16910 else
16911 return NULL;
16912}
16913
16914
16915/**
16916 * watchdog_proxy_new_for_bus:
16917 * @bus_type: A #GBusType.
16918 * @flags: Flags from the #GDBusProxyFlags enumeration.
16919 * @name: A bus name (well-known or unique).
16920 * @object_path: An object path.
16921 * @cancellable: (allow-none): A #GCancellable or %NULL.
16922 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
16923 * @user_data: User data to pass to @callback.
16924 *
16925 * Like watchdog_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
16926 *
16927 * 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.
16928 * You can then call watchdog_proxy_new_for_bus_finish() to get the result of the operation.
16929 *
16930 * See watchdog_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
16931 */
16932void
16933watchdog_proxy_new_for_bus (
16934 GBusType bus_type,
16935 GDBusProxyFlags flags,
16936 const gchar *name,
16937 const gchar *object_path,
16938 GCancellable *cancellable,
16939 GAsyncReadyCallback callback,
16940 gpointer user_data)
16941{
16942 g_async_initable_new_async (TYPE_WATCHDOG_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.Watchdog", NULL);
16943}
16944
16945/**
16946 * watchdog_proxy_new_for_bus_finish:
16947 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new_for_bus().
16948 * @error: Return location for error or %NULL
16949 *
16950 * Finishes an operation started with watchdog_proxy_new_for_bus().
16951 *
16952 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
16953 */
16954Watchdog *
16955watchdog_proxy_new_for_bus_finish (
16956 GAsyncResult *res,
16957 GError **error)
16958{
16959 GObject *ret;
16960 GObject *source_object;
16961 source_object = g_async_result_get_source_object (res);
16962 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
16963 g_object_unref (source_object);
16964 if (ret != NULL)
16965 return WATCHDOG (ret);
16966 else
16967 return NULL;
16968}
16969
16970/**
16971 * watchdog_proxy_new_for_bus_sync:
16972 * @bus_type: A #GBusType.
16973 * @flags: Flags from the #GDBusProxyFlags enumeration.
16974 * @name: A bus name (well-known or unique).
16975 * @object_path: An object path.
16976 * @cancellable: (allow-none): A #GCancellable or %NULL.
16977 * @error: Return location for error or %NULL
16978 *
16979 * Like watchdog_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
16980 *
16981 * The calling thread is blocked until a reply is received.
16982 *
16983 * See watchdog_proxy_new_for_bus() for the asynchronous version of this constructor.
16984 *
16985 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
16986 */
16987Watchdog *
16988watchdog_proxy_new_for_bus_sync (
16989 GBusType bus_type,
16990 GDBusProxyFlags flags,
16991 const gchar *name,
16992 const gchar *object_path,
16993 GCancellable *cancellable,
16994 GError **error)
16995{
16996 GInitable *ret;
16997 ret = g_initable_new (TYPE_WATCHDOG_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Watchdog", NULL);
16998 if (ret != NULL)
16999 return WATCHDOG (ret);
17000 else
17001 return NULL;
17002}
17003
17004
17005/* ------------------------------------------------------------------------ */
17006
17007/**
17008 * WatchdogSkeleton:
17009 *
17010 * The #WatchdogSkeleton structure contains only private data and should only be accessed using the provided API.
17011 */
17012
17013/**
17014 * WatchdogSkeletonClass:
17015 * @parent_class: The parent class.
17016 *
17017 * Class structure for #WatchdogSkeleton.
17018 */
17019
17020struct _WatchdogSkeletonPrivate
17021{
17022 GValue *properties;
17023 GList *changed_properties;
17024 GSource *changed_properties_idle_source;
17025 GMainContext *context;
17026 GMutex lock;
17027};
17028
17029static void
17030_watchdog_skeleton_handle_method_call (
17031 GDBusConnection *connection G_GNUC_UNUSED,
17032 const gchar *sender G_GNUC_UNUSED,
17033 const gchar *object_path G_GNUC_UNUSED,
17034 const gchar *interface_name,
17035 const gchar *method_name,
17036 GVariant *parameters,
17037 GDBusMethodInvocation *invocation,
17038 gpointer user_data)
17039{
17040 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
17041 _ExtendedGDBusMethodInfo *info;
17042 GVariantIter iter;
17043 GVariant *child;
17044 GValue *paramv;
17045 guint num_params;
17046 guint num_extra;
17047 guint n;
17048 guint signal_id;
17049 GValue return_value = G_VALUE_INIT;
17050 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
17051 g_assert (info != NULL);
17052 num_params = g_variant_n_children (parameters);
17053 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
17054 n = 0;
17055 g_value_init (&paramv[n], TYPE_WATCHDOG);
17056 g_value_set_object (&paramv[n++], skeleton);
17057 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
17058 g_value_set_object (&paramv[n++], invocation);
17059 if (info->pass_fdlist)
17060 {
17061#ifdef G_OS_UNIX
17062 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
17063 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
17064#else
17065 g_assert_not_reached ();
17066#endif
17067 }
17068 g_variant_iter_init (&iter, parameters);
17069 while ((child = g_variant_iter_next_value (&iter)) != NULL)
17070 {
17071 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
17072 if (arg_info->use_gvariant)
17073 {
17074 g_value_init (&paramv[n], G_TYPE_VARIANT);
17075 g_value_set_variant (&paramv[n], child);
17076 n++;
17077 }
17078 else
17079 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
17080 g_variant_unref (child);
17081 }
17082 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG);
17083 g_value_init (&return_value, G_TYPE_BOOLEAN);
17084 g_signal_emitv (paramv, signal_id, 0, &return_value);
17085 if (!g_value_get_boolean (&return_value))
17086 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);
17087 g_value_unset (&return_value);
17088 for (n = 0; n < num_params + num_extra; n++)
17089 g_value_unset (&paramv[n]);
17090 g_free (paramv);
17091}
17092
17093static GVariant *
17094_watchdog_skeleton_handle_get_property (
17095 GDBusConnection *connection G_GNUC_UNUSED,
17096 const gchar *sender G_GNUC_UNUSED,
17097 const gchar *object_path G_GNUC_UNUSED,
17098 const gchar *interface_name G_GNUC_UNUSED,
17099 const gchar *property_name,
17100 GError **error,
17101 gpointer user_data)
17102{
17103 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
17104 GValue value = G_VALUE_INIT;
17105 GParamSpec *pspec;
17106 _ExtendedGDBusPropertyInfo *info;
17107 GVariant *ret;
17108 ret = NULL;
17109 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name);
17110 g_assert (info != NULL);
17111 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
17112 if (pspec == NULL)
17113 {
17114 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
17115 }
17116 else
17117 {
17118 g_value_init (&value, pspec->value_type);
17119 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
17120 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
17121 g_value_unset (&value);
17122 }
17123 return ret;
17124}
17125
17126static gboolean
17127_watchdog_skeleton_handle_set_property (
17128 GDBusConnection *connection G_GNUC_UNUSED,
17129 const gchar *sender G_GNUC_UNUSED,
17130 const gchar *object_path G_GNUC_UNUSED,
17131 const gchar *interface_name G_GNUC_UNUSED,
17132 const gchar *property_name,
17133 GVariant *variant,
17134 GError **error,
17135 gpointer user_data)
17136{
17137 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
17138 GValue value = G_VALUE_INIT;
17139 GParamSpec *pspec;
17140 _ExtendedGDBusPropertyInfo *info;
17141 gboolean ret;
17142 ret = FALSE;
17143 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name);
17144 g_assert (info != NULL);
17145 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
17146 if (pspec == NULL)
17147 {
17148 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
17149 }
17150 else
17151 {
17152 if (info->use_gvariant)
17153 g_value_set_variant (&value, variant);
17154 else
17155 g_dbus_gvariant_to_gvalue (variant, &value);
17156 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
17157 g_value_unset (&value);
17158 ret = TRUE;
17159 }
17160 return ret;
17161}
17162
17163static const GDBusInterfaceVTable _watchdog_skeleton_vtable =
17164{
17165 _watchdog_skeleton_handle_method_call,
17166 _watchdog_skeleton_handle_get_property,
17167 _watchdog_skeleton_handle_set_property,
17168 {NULL}
17169};
17170
17171static GDBusInterfaceInfo *
17172watchdog_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
17173{
17174 return watchdog_interface_info ();
17175}
17176
17177static GDBusInterfaceVTable *
17178watchdog_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
17179{
17180 return (GDBusInterfaceVTable *) &_watchdog_skeleton_vtable;
17181}
17182
17183static GVariant *
17184watchdog_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
17185{
17186 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton);
17187
17188 GVariantBuilder builder;
17189 guint n;
17190 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
17191 if (_watchdog_interface_info.parent_struct.properties == NULL)
17192 goto out;
17193 for (n = 0; _watchdog_interface_info.parent_struct.properties[n] != NULL; n++)
17194 {
17195 GDBusPropertyInfo *info = _watchdog_interface_info.parent_struct.properties[n];
17196 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
17197 {
17198 GVariant *value;
17199 value = _watchdog_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.Watchdog", info->name, NULL, skeleton);
17200 if (value != NULL)
17201 {
17202 g_variant_take_ref (value);
17203 g_variant_builder_add (&builder, "{sv}", info->name, value);
17204 g_variant_unref (value);
17205 }
17206 }
17207 }
17208out:
17209 return g_variant_builder_end (&builder);
17210}
17211
17212static gboolean _watchdog_emit_changed (gpointer user_data);
17213
17214static void
17215watchdog_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
17216{
17217 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton);
17218 gboolean emit_changed = FALSE;
17219
17220 g_mutex_lock (&skeleton->priv->lock);
17221 if (skeleton->priv->changed_properties_idle_source != NULL)
17222 {
17223 g_source_destroy (skeleton->priv->changed_properties_idle_source);
17224 skeleton->priv->changed_properties_idle_source = NULL;
17225 emit_changed = TRUE;
17226 }
17227 g_mutex_unlock (&skeleton->priv->lock);
17228
17229 if (emit_changed)
17230 _watchdog_emit_changed (skeleton);
17231}
17232
17233static void
17234_watchdog_on_signal_watchdog_error (
17235 Watchdog *object)
17236{
17237 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17238
17239 GList *connections, *l;
17240 GVariant *signal_variant;
17241 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
17242
17243 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
17244 for (l = connections; l != NULL; l = l->next)
17245 {
17246 GDBusConnection *connection = l->data;
17247 g_dbus_connection_emit_signal (connection,
17248 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Watchdog", "WatchdogError",
17249 signal_variant, NULL);
17250 }
17251 g_variant_unref (signal_variant);
17252 g_list_free_full (connections, g_object_unref);
17253}
17254
17255static void watchdog_skeleton_iface_init (WatchdogIface *iface);
17256#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17257G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
17258 G_ADD_PRIVATE (WatchdogSkeleton)
17259 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init));
17260
17261#else
17262G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
17263 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init));
17264
17265#endif
17266static void
17267watchdog_skeleton_finalize (GObject *object)
17268{
17269 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17270 guint n;
17271 for (n = 0; n < 2; n++)
17272 g_value_unset (&skeleton->priv->properties[n]);
17273 g_free (skeleton->priv->properties);
17274 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
17275 if (skeleton->priv->changed_properties_idle_source != NULL)
17276 g_source_destroy (skeleton->priv->changed_properties_idle_source);
17277 g_main_context_unref (skeleton->priv->context);
17278 g_mutex_clear (&skeleton->priv->lock);
17279 G_OBJECT_CLASS (watchdog_skeleton_parent_class)->finalize (object);
17280}
17281
17282static void
17283watchdog_skeleton_get_property (GObject *object,
17284 guint prop_id,
17285 GValue *value,
17286 GParamSpec *pspec G_GNUC_UNUSED)
17287{
17288 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17289 g_assert (prop_id != 0 && prop_id - 1 < 2);
17290 g_mutex_lock (&skeleton->priv->lock);
17291 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
17292 g_mutex_unlock (&skeleton->priv->lock);
17293}
17294
17295static gboolean
17296_watchdog_emit_changed (gpointer user_data)
17297{
17298 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
17299 GList *l;
17300 GVariantBuilder builder;
17301 GVariantBuilder invalidated_builder;
17302 guint num_changes;
17303
17304 g_mutex_lock (&skeleton->priv->lock);
17305 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
17306 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
17307 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
17308 {
17309 ChangedProperty *cp = l->data;
17310 GVariant *variant;
17311 const GValue *cur_value;
17312
17313 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
17314 if (!_g_value_equal (cur_value, &cp->orig_value))
17315 {
17316 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
17317 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
17318 g_variant_unref (variant);
17319 num_changes++;
17320 }
17321 }
17322 if (num_changes > 0)
17323 {
17324 GList *connections, *ll;
17325 GVariant *signal_variant;
17326 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Watchdog",
17327 &builder, &invalidated_builder));
17328 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
17329 for (ll = connections; ll != NULL; ll = ll->next)
17330 {
17331 GDBusConnection *connection = ll->data;
17332
17333 g_dbus_connection_emit_signal (connection,
17334 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
17335 "org.freedesktop.DBus.Properties",
17336 "PropertiesChanged",
17337 signal_variant,
17338 NULL);
17339 }
17340 g_variant_unref (signal_variant);
17341 g_list_free_full (connections, g_object_unref);
17342 }
17343 else
17344 {
17345 g_variant_builder_clear (&builder);
17346 g_variant_builder_clear (&invalidated_builder);
17347 }
17348 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
17349 skeleton->priv->changed_properties = NULL;
17350 skeleton->priv->changed_properties_idle_source = NULL;
17351 g_mutex_unlock (&skeleton->priv->lock);
17352 return FALSE;
17353}
17354
17355static void
17356_watchdog_schedule_emit_changed (WatchdogSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
17357{
17358 ChangedProperty *cp;
17359 GList *l;
17360 cp = NULL;
17361 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
17362 {
17363 ChangedProperty *i_cp = l->data;
17364 if (i_cp->info == info)
17365 {
17366 cp = i_cp;
17367 break;
17368 }
17369 }
17370 if (cp == NULL)
17371 {
17372 cp = g_new0 (ChangedProperty, 1);
17373 cp->prop_id = prop_id;
17374 cp->info = info;
17375 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
17376 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
17377 g_value_copy (orig_value, &cp->orig_value);
17378 }
17379}
17380
17381static void
17382watchdog_skeleton_notify (GObject *object,
17383 GParamSpec *pspec G_GNUC_UNUSED)
17384{
17385 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17386 g_mutex_lock (&skeleton->priv->lock);
17387 if (skeleton->priv->changed_properties != NULL &&
17388 skeleton->priv->changed_properties_idle_source == NULL)
17389 {
17390 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
17391 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
17392 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _watchdog_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
17393 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
17394 g_source_unref (skeleton->priv->changed_properties_idle_source);
17395 }
17396 g_mutex_unlock (&skeleton->priv->lock);
17397}
17398
17399static void
17400watchdog_skeleton_set_property (GObject *object,
17401 guint prop_id,
17402 const GValue *value,
17403 GParamSpec *pspec)
17404{
17405 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17406 g_assert (prop_id != 0 && prop_id - 1 < 2);
17407 g_mutex_lock (&skeleton->priv->lock);
17408 g_object_freeze_notify (object);
17409 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
17410 {
17411 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
17412 _watchdog_schedule_emit_changed (skeleton, _watchdog_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
17413 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
17414 g_object_notify_by_pspec (object, pspec);
17415 }
17416 g_mutex_unlock (&skeleton->priv->lock);
17417 g_object_thaw_notify (object);
17418}
17419
17420static void
17421watchdog_skeleton_init (WatchdogSkeleton *skeleton)
17422{
17423#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17424 skeleton->priv = watchdog_skeleton_get_instance_private (skeleton);
17425#else
17426 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_WATCHDOG_SKELETON, WatchdogSkeletonPrivate);
17427#endif
17428
17429 g_mutex_init (&skeleton->priv->lock);
17430 skeleton->priv->context = g_main_context_ref_thread_default ();
17431 skeleton->priv->properties = g_new0 (GValue, 2);
17432 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
17433 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
17434}
17435
17436static gint
17437watchdog_skeleton_get_watchdog (Watchdog *object)
17438{
17439 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17440 gint value;
17441 g_mutex_lock (&skeleton->priv->lock);
17442 value = g_value_get_int (&(skeleton->priv->properties[0]));
17443 g_mutex_unlock (&skeleton->priv->lock);
17444 return value;
17445}
17446
17447static gint
17448watchdog_skeleton_get_poll_interval (Watchdog *object)
17449{
17450 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17451 gint value;
17452 g_mutex_lock (&skeleton->priv->lock);
17453 value = g_value_get_int (&(skeleton->priv->properties[1]));
17454 g_mutex_unlock (&skeleton->priv->lock);
17455 return value;
17456}
17457
17458static void
17459watchdog_skeleton_class_init (WatchdogSkeletonClass *klass)
17460{
17461 GObjectClass *gobject_class;
17462 GDBusInterfaceSkeletonClass *skeleton_class;
17463
17464 gobject_class = G_OBJECT_CLASS (klass);
17465 gobject_class->finalize = watchdog_skeleton_finalize;
17466 gobject_class->get_property = watchdog_skeleton_get_property;
17467 gobject_class->set_property = watchdog_skeleton_set_property;
17468 gobject_class->notify = watchdog_skeleton_notify;
17469
17470
17471 watchdog_override_properties (gobject_class, 1);
17472
17473 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
17474 skeleton_class->get_info = watchdog_skeleton_dbus_interface_get_info;
17475 skeleton_class->get_properties = watchdog_skeleton_dbus_interface_get_properties;
17476 skeleton_class->flush = watchdog_skeleton_dbus_interface_flush;
17477 skeleton_class->get_vtable = watchdog_skeleton_dbus_interface_get_vtable;
17478
17479#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
17480 g_type_class_add_private (klass, sizeof (WatchdogSkeletonPrivate));
17481#endif
17482}
17483
17484static void
17485watchdog_skeleton_iface_init (WatchdogIface *iface)
17486{
17487 iface->watchdog_error = _watchdog_on_signal_watchdog_error;
17488 iface->get_watchdog = watchdog_skeleton_get_watchdog;
17489 iface->get_poll_interval = watchdog_skeleton_get_poll_interval;
17490}
17491
17492/**
17493 * watchdog_skeleton_new:
17494 *
17495 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
17496 *
17497 * Returns: (transfer full) (type WatchdogSkeleton): The skeleton object.
17498 */
17499Watchdog *
17500watchdog_skeleton_new (void)
17501{
17502 return WATCHDOG (g_object_new (TYPE_WATCHDOG_SKELETON, NULL));
17503}
17504
17505/* ------------------------------------------------------------------------
17506 * Code for interface org.openbmc.EventLog
17507 * ------------------------------------------------------------------------
17508 */
17509
17510/**
17511 * SECTION:EventLog
17512 * @title: EventLog
17513 * @short_description: Generated C code for the org.openbmc.EventLog D-Bus interface
17514 *
17515 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> D-Bus interface in C.
17516 */
17517
17518/* ---- Introspection data for org.openbmc.EventLog ---- */
17519
17520static const _ExtendedGDBusArgInfo _event_log_method_info_get_message_OUT_ARG_message =
17521{
17522 {
17523 -1,
17524 (gchar *) "message",
17525 (gchar *) "a{ss}",
17526 NULL
17527 },
17528 FALSE
17529};
17530
17531static const _ExtendedGDBusArgInfo * const _event_log_method_info_get_message_OUT_ARG_pointers[] =
17532{
17533 &_event_log_method_info_get_message_OUT_ARG_message,
17534 NULL
17535};
17536
17537static const _ExtendedGDBusMethodInfo _event_log_method_info_get_message =
17538{
17539 {
17540 -1,
17541 (gchar *) "getMessage",
17542 NULL,
17543 (GDBusArgInfo **) &_event_log_method_info_get_message_OUT_ARG_pointers,
17544 NULL
17545 },
17546 "handle-get-message",
17547 FALSE
17548};
17549
17550static const _ExtendedGDBusMethodInfo * const _event_log_method_info_pointers[] =
17551{
17552 &_event_log_method_info_get_message,
17553 NULL
17554};
17555
17556static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_message =
17557{
17558 {
17559 -1,
17560 (gchar *) "message",
17561 (gchar *) "a{ss}",
17562 NULL
17563 },
17564 FALSE
17565};
17566
17567static const _ExtendedGDBusArgInfo * const _event_log_signal_info_event_log_ARG_pointers[] =
17568{
17569 &_event_log_signal_info_event_log_ARG_message,
17570 NULL
17571};
17572
17573static const _ExtendedGDBusSignalInfo _event_log_signal_info_event_log =
17574{
17575 {
17576 -1,
17577 (gchar *) "EventLog",
17578 (GDBusArgInfo **) &_event_log_signal_info_event_log_ARG_pointers,
17579 NULL
17580 },
17581 "event-log"
17582};
17583
17584static const _ExtendedGDBusSignalInfo * const _event_log_signal_info_pointers[] =
17585{
17586 &_event_log_signal_info_event_log,
17587 NULL
17588};
17589
17590static const _ExtendedGDBusPropertyInfo _event_log_property_info_message =
17591{
17592 {
17593 -1,
17594 (gchar *) "message",
17595 (gchar *) "a{ss}",
17596 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
17597 NULL
17598 },
17599 "message",
17600 FALSE
17601};
17602
17603static const _ExtendedGDBusPropertyInfo * const _event_log_property_info_pointers[] =
17604{
17605 &_event_log_property_info_message,
17606 NULL
17607};
17608
17609static const _ExtendedGDBusInterfaceInfo _event_log_interface_info =
17610{
17611 {
17612 -1,
17613 (gchar *) "org.openbmc.EventLog",
17614 (GDBusMethodInfo **) &_event_log_method_info_pointers,
17615 (GDBusSignalInfo **) &_event_log_signal_info_pointers,
17616 (GDBusPropertyInfo **) &_event_log_property_info_pointers,
17617 NULL
17618 },
17619 "event-log",
17620};
17621
17622
17623/**
17624 * event_log_interface_info:
17625 *
17626 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> D-Bus interface.
17627 *
17628 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
17629 */
17630GDBusInterfaceInfo *
17631event_log_interface_info (void)
17632{
17633 return (GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct;
17634}
17635
17636/**
17637 * event_log_override_properties:
17638 * @klass: The class structure for a #GObject<!-- -->-derived class.
17639 * @property_id_begin: The property id to assign to the first overridden property.
17640 *
17641 * Overrides all #GObject properties in the #EventLog interface for a concrete class.
17642 * The properties are overridden in the order they are defined.
17643 *
17644 * Returns: The last property id.
17645 */
17646guint
17647event_log_override_properties (GObjectClass *klass, guint property_id_begin)
17648{
17649 g_object_class_override_property (klass, property_id_begin++, "message");
17650 return property_id_begin - 1;
17651}
17652
17653
17654
17655/**
17656 * EventLog:
17657 *
17658 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
17659 */
17660
17661/**
17662 * EventLogIface:
17663 * @parent_iface: The parent interface.
17664 * @handle_get_message: Handler for the #EventLog::handle-get-message signal.
17665 * @get_message: Getter for the #EventLog:message property.
17666 * @event_log: Handler for the #EventLog::event-log signal.
17667 *
17668 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
17669 */
17670
17671typedef EventLogIface EventLogInterface;
17672G_DEFINE_INTERFACE (EventLog, event_log, G_TYPE_OBJECT);
17673
17674static void
17675event_log_default_init (EventLogIface *iface)
17676{
17677 /* GObject signals for incoming D-Bus method calls: */
17678 /**
17679 * EventLog::handle-get-message:
17680 * @object: A #EventLog.
17681 * @invocation: A #GDBusMethodInvocation.
17682 *
17683 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-EventLog.getMessage">getMessage()</link> D-Bus method.
17684 *
17685 * 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 event_log_complete_get_message() 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.
17686 *
17687 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
17688 */
17689 g_signal_new ("handle-get-message",
17690 G_TYPE_FROM_INTERFACE (iface),
17691 G_SIGNAL_RUN_LAST,
17692 G_STRUCT_OFFSET (EventLogIface, handle_get_message),
17693 g_signal_accumulator_true_handled,
17694 NULL,
17695 g_cclosure_marshal_generic,
17696 G_TYPE_BOOLEAN,
17697 1,
17698 G_TYPE_DBUS_METHOD_INVOCATION);
17699
17700 /* GObject signals for received D-Bus signals: */
17701 /**
17702 * EventLog::event-log:
17703 * @object: A #EventLog.
17704 * @arg_message: Argument.
17705 *
17706 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-EventLog.EventLog">"EventLog"</link> is received.
17707 *
17708 * 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.
17709 */
17710 g_signal_new ("event-log",
17711 G_TYPE_FROM_INTERFACE (iface),
17712 G_SIGNAL_RUN_LAST,
17713 G_STRUCT_OFFSET (EventLogIface, event_log),
17714 NULL,
17715 NULL,
17716 g_cclosure_marshal_generic,
17717 G_TYPE_NONE,
17718 1, G_TYPE_VARIANT);
17719
17720 /* GObject properties for D-Bus properties: */
17721 /**
17722 * EventLog:message:
17723 *
17724 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-EventLog.message">"message"</link>.
17725 *
17726 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
17727 */
17728 g_object_interface_install_property (iface,
17729 g_param_spec_variant ("message", "message", "message", G_VARIANT_TYPE ("a{ss}"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
17730}
17731
17732/**
17733 * event_log_get_message: (skip)
17734 * @object: A #EventLog.
17735 *
17736 * Gets the value of the <link linkend="gdbus-property-org-openbmc-EventLog.message">"message"</link> D-Bus property.
17737 *
17738 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
17739 *
17740 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use event_log_dup_message() if on another thread.</warning>
17741 *
17742 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
17743 */
17744GVariant *
17745event_log_get_message (EventLog *object)
17746{
17747 return EVENT_LOG_GET_IFACE (object)->get_message (object);
17748}
17749
17750/**
17751 * event_log_dup_message: (skip)
17752 * @object: A #EventLog.
17753 *
17754 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-EventLog.message">"message"</link> D-Bus property.
17755 *
17756 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
17757 *
17758 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
17759 */
17760GVariant *
17761event_log_dup_message (EventLog *object)
17762{
17763 GVariant *value;
17764 g_object_get (G_OBJECT (object), "message", &value, NULL);
17765 return value;
17766}
17767
17768/**
17769 * event_log_set_message: (skip)
17770 * @object: A #EventLog.
17771 * @value: The value to set.
17772 *
17773 * Sets the <link linkend="gdbus-property-org-openbmc-EventLog.message">"message"</link> D-Bus property to @value.
17774 *
17775 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
17776 */
17777void
17778event_log_set_message (EventLog *object, GVariant *value)
17779{
17780 g_object_set (G_OBJECT (object), "message", value, NULL);
17781}
17782
17783/**
17784 * event_log_emit_event_log:
17785 * @object: A #EventLog.
17786 * @arg_message: Argument to pass with the signal.
17787 *
17788 * Emits the <link linkend="gdbus-signal-org-openbmc-EventLog.EventLog">"EventLog"</link> D-Bus signal.
17789 */
17790void
17791event_log_emit_event_log (
17792 EventLog *object,
17793 GVariant *arg_message)
17794{
17795 g_signal_emit_by_name (object, "event-log", arg_message);
17796}
17797
17798/**
17799 * event_log_call_get_message:
17800 * @proxy: A #EventLogProxy.
17801 * @cancellable: (allow-none): A #GCancellable or %NULL.
17802 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
17803 * @user_data: User data to pass to @callback.
17804 *
17805 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-EventLog.getMessage">getMessage()</link> D-Bus method on @proxy.
17806 * 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.
17807 * You can then call event_log_call_get_message_finish() to get the result of the operation.
17808 *
17809 * See event_log_call_get_message_sync() for the synchronous, blocking version of this method.
17810 */
17811void
17812event_log_call_get_message (
17813 EventLog *proxy,
17814 GCancellable *cancellable,
17815 GAsyncReadyCallback callback,
17816 gpointer user_data)
17817{
17818 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
17819 "getMessage",
17820 g_variant_new ("()"),
17821 G_DBUS_CALL_FLAGS_NONE,
17822 -1,
17823 cancellable,
17824 callback,
17825 user_data);
17826}
17827
17828/**
17829 * event_log_call_get_message_finish:
17830 * @proxy: A #EventLogProxy.
17831 * @out_message: (out): Return location for return parameter or %NULL to ignore.
17832 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_call_get_message().
17833 * @error: Return location for error or %NULL.
17834 *
17835 * Finishes an operation started with event_log_call_get_message().
17836 *
17837 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
17838 */
17839gboolean
17840event_log_call_get_message_finish (
17841 EventLog *proxy,
17842 GVariant **out_message,
17843 GAsyncResult *res,
17844 GError **error)
17845{
17846 GVariant *_ret;
17847 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
17848 if (_ret == NULL)
17849 goto _out;
17850 g_variant_get (_ret,
17851 "(@a{ss})",
17852 out_message);
17853 g_variant_unref (_ret);
17854_out:
17855 return _ret != NULL;
17856}
17857
17858/**
17859 * event_log_call_get_message_sync:
17860 * @proxy: A #EventLogProxy.
17861 * @out_message: (out): Return location for return parameter or %NULL to ignore.
17862 * @cancellable: (allow-none): A #GCancellable or %NULL.
17863 * @error: Return location for error or %NULL.
17864 *
17865 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-EventLog.getMessage">getMessage()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
17866 *
17867 * See event_log_call_get_message() for the asynchronous version of this method.
17868 *
17869 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
17870 */
17871gboolean
17872event_log_call_get_message_sync (
17873 EventLog *proxy,
17874 GVariant **out_message,
17875 GCancellable *cancellable,
17876 GError **error)
17877{
17878 GVariant *_ret;
17879 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
17880 "getMessage",
17881 g_variant_new ("()"),
17882 G_DBUS_CALL_FLAGS_NONE,
17883 -1,
17884 cancellable,
17885 error);
17886 if (_ret == NULL)
17887 goto _out;
17888 g_variant_get (_ret,
17889 "(@a{ss})",
17890 out_message);
17891 g_variant_unref (_ret);
17892_out:
17893 return _ret != NULL;
17894}
17895
17896/**
17897 * event_log_complete_get_message:
17898 * @object: A #EventLog.
17899 * @invocation: (transfer full): A #GDBusMethodInvocation.
17900 * @message: Parameter to return.
17901 *
17902 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-EventLog.getMessage">getMessage()</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.
17903 *
17904 * This method will free @invocation, you cannot use it afterwards.
17905 */
17906void
17907event_log_complete_get_message (
17908 EventLog *object,
17909 GDBusMethodInvocation *invocation,
17910 GVariant *message)
17911{
17912 g_dbus_method_invocation_return_value (invocation,
17913 g_variant_new ("(@a{ss})",
17914 message));
17915}
17916
17917/* ------------------------------------------------------------------------ */
17918
17919/**
17920 * EventLogProxy:
17921 *
17922 * The #EventLogProxy structure contains only private data and should only be accessed using the provided API.
17923 */
17924
17925/**
17926 * EventLogProxyClass:
17927 * @parent_class: The parent class.
17928 *
17929 * Class structure for #EventLogProxy.
17930 */
17931
17932struct _EventLogProxyPrivate
17933{
17934 GData *qdata;
17935};
17936
17937static void event_log_proxy_iface_init (EventLogIface *iface);
17938
17939#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17940G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
17941 G_ADD_PRIVATE (EventLogProxy)
17942 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
17943
17944#else
17945G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
17946 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
17947
17948#endif
17949static void
17950event_log_proxy_finalize (GObject *object)
17951{
17952 EventLogProxy *proxy = EVENT_LOG_PROXY (object);
17953 g_datalist_clear (&proxy->priv->qdata);
17954 G_OBJECT_CLASS (event_log_proxy_parent_class)->finalize (object);
17955}
17956
17957static void
17958event_log_proxy_get_property (GObject *object,
17959 guint prop_id,
17960 GValue *value,
17961 GParamSpec *pspec G_GNUC_UNUSED)
17962{
17963 const _ExtendedGDBusPropertyInfo *info;
17964 GVariant *variant;
17965 g_assert (prop_id != 0 && prop_id - 1 < 1);
17966 info = _event_log_property_info_pointers[prop_id - 1];
17967 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
17968 if (info->use_gvariant)
17969 {
17970 g_value_set_variant (value, variant);
17971 }
17972 else
17973 {
17974 if (variant != NULL)
17975 g_dbus_gvariant_to_gvalue (variant, value);
17976 }
17977 if (variant != NULL)
17978 g_variant_unref (variant);
17979}
17980
17981static void
17982event_log_proxy_set_property_cb (GDBusProxy *proxy,
17983 GAsyncResult *res,
17984 gpointer user_data)
17985{
17986 const _ExtendedGDBusPropertyInfo *info = user_data;
17987 GError *error;
17988 GVariant *_ret;
17989 error = NULL;
17990 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
17991 if (!_ret)
17992 {
17993 g_warning ("Error setting property '%s' on interface org.openbmc.EventLog: %s (%s, %d)",
17994 info->parent_struct.name,
17995 error->message, g_quark_to_string (error->domain), error->code);
17996 g_error_free (error);
17997 }
17998 else
17999 {
18000 g_variant_unref (_ret);
18001 }
18002}
18003
18004static void
18005event_log_proxy_set_property (GObject *object,
18006 guint prop_id,
18007 const GValue *value,
18008 GParamSpec *pspec G_GNUC_UNUSED)
18009{
18010 const _ExtendedGDBusPropertyInfo *info;
18011 GVariant *variant;
18012 g_assert (prop_id != 0 && prop_id - 1 < 1);
18013 info = _event_log_property_info_pointers[prop_id - 1];
18014 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
18015 g_dbus_proxy_call (G_DBUS_PROXY (object),
18016 "org.freedesktop.DBus.Properties.Set",
18017 g_variant_new ("(ssv)", "org.openbmc.EventLog", info->parent_struct.name, variant),
18018 G_DBUS_CALL_FLAGS_NONE,
18019 -1,
18020 NULL, (GAsyncReadyCallback) event_log_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
18021 g_variant_unref (variant);
18022}
18023
18024static void
18025event_log_proxy_g_signal (GDBusProxy *proxy,
18026 const gchar *sender_name G_GNUC_UNUSED,
18027 const gchar *signal_name,
18028 GVariant *parameters)
18029{
18030 _ExtendedGDBusSignalInfo *info;
18031 GVariantIter iter;
18032 GVariant *child;
18033 GValue *paramv;
18034 guint num_params;
18035 guint n;
18036 guint signal_id;
18037 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, signal_name);
18038 if (info == NULL)
18039 return;
18040 num_params = g_variant_n_children (parameters);
18041 paramv = g_new0 (GValue, num_params + 1);
18042 g_value_init (&paramv[0], TYPE_EVENT_LOG);
18043 g_value_set_object (&paramv[0], proxy);
18044 g_variant_iter_init (&iter, parameters);
18045 n = 1;
18046 while ((child = g_variant_iter_next_value (&iter)) != NULL)
18047 {
18048 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
18049 if (arg_info->use_gvariant)
18050 {
18051 g_value_init (&paramv[n], G_TYPE_VARIANT);
18052 g_value_set_variant (&paramv[n], child);
18053 n++;
18054 }
18055 else
18056 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
18057 g_variant_unref (child);
18058 }
18059 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
18060 g_signal_emitv (paramv, signal_id, 0, NULL);
18061 for (n = 0; n < num_params + 1; n++)
18062 g_value_unset (&paramv[n]);
18063 g_free (paramv);
18064}
18065
18066static void
18067event_log_proxy_g_properties_changed (GDBusProxy *_proxy,
18068 GVariant *changed_properties,
18069 const gchar *const *invalidated_properties)
18070{
18071 EventLogProxy *proxy = EVENT_LOG_PROXY (_proxy);
18072 guint n;
18073 const gchar *key;
18074 GVariantIter *iter;
18075 _ExtendedGDBusPropertyInfo *info;
18076 g_variant_get (changed_properties, "a{sv}", &iter);
18077 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
18078 {
18079 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, key);
18080 g_datalist_remove_data (&proxy->priv->qdata, key);
18081 if (info != NULL)
18082 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
18083 }
18084 g_variant_iter_free (iter);
18085 for (n = 0; invalidated_properties[n] != NULL; n++)
18086 {
18087 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, invalidated_properties[n]);
18088 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
18089 if (info != NULL)
18090 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
18091 }
18092}
18093
18094static GVariant *
18095event_log_proxy_get_message (EventLog *object)
18096{
18097 EventLogProxy *proxy = EVENT_LOG_PROXY (object);
18098 GVariant *variant;
18099 GVariant *value = NULL;
18100 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "message");
18101 value = variant;
18102 if (variant != NULL)
18103 g_variant_unref (variant);
18104 return value;
18105}
18106
18107static void
18108event_log_proxy_init (EventLogProxy *proxy)
18109{
18110#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18111 proxy->priv = event_log_proxy_get_instance_private (proxy);
18112#else
18113 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_EVENT_LOG_PROXY, EventLogProxyPrivate);
18114#endif
18115
18116 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), event_log_interface_info ());
18117}
18118
18119static void
18120event_log_proxy_class_init (EventLogProxyClass *klass)
18121{
18122 GObjectClass *gobject_class;
18123 GDBusProxyClass *proxy_class;
18124
18125 gobject_class = G_OBJECT_CLASS (klass);
18126 gobject_class->finalize = event_log_proxy_finalize;
18127 gobject_class->get_property = event_log_proxy_get_property;
18128 gobject_class->set_property = event_log_proxy_set_property;
18129
18130 proxy_class = G_DBUS_PROXY_CLASS (klass);
18131 proxy_class->g_signal = event_log_proxy_g_signal;
18132 proxy_class->g_properties_changed = event_log_proxy_g_properties_changed;
18133
18134 event_log_override_properties (gobject_class, 1);
18135
18136#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
18137 g_type_class_add_private (klass, sizeof (EventLogProxyPrivate));
18138#endif
18139}
18140
18141static void
18142event_log_proxy_iface_init (EventLogIface *iface)
18143{
18144 iface->get_message = event_log_proxy_get_message;
18145}
18146
18147/**
18148 * event_log_proxy_new:
18149 * @connection: A #GDBusConnection.
18150 * @flags: Flags from the #GDBusProxyFlags enumeration.
18151 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
18152 * @object_path: An object path.
18153 * @cancellable: (allow-none): A #GCancellable or %NULL.
18154 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
18155 * @user_data: User data to pass to @callback.
18156 *
18157 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>. See g_dbus_proxy_new() for more details.
18158 *
18159 * 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.
18160 * You can then call event_log_proxy_new_finish() to get the result of the operation.
18161 *
18162 * See event_log_proxy_new_sync() for the synchronous, blocking version of this constructor.
18163 */
18164void
18165event_log_proxy_new (
18166 GDBusConnection *connection,
18167 GDBusProxyFlags flags,
18168 const gchar *name,
18169 const gchar *object_path,
18170 GCancellable *cancellable,
18171 GAsyncReadyCallback callback,
18172 gpointer user_data)
18173{
18174 g_async_initable_new_async (TYPE_EVENT_LOG_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.EventLog", NULL);
18175}
18176
18177/**
18178 * event_log_proxy_new_finish:
18179 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new().
18180 * @error: Return location for error or %NULL
18181 *
18182 * Finishes an operation started with event_log_proxy_new().
18183 *
18184 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
18185 */
18186EventLog *
18187event_log_proxy_new_finish (
18188 GAsyncResult *res,
18189 GError **error)
18190{
18191 GObject *ret;
18192 GObject *source_object;
18193 source_object = g_async_result_get_source_object (res);
18194 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
18195 g_object_unref (source_object);
18196 if (ret != NULL)
18197 return EVENT_LOG (ret);
18198 else
18199 return NULL;
18200}
18201
18202/**
18203 * event_log_proxy_new_sync:
18204 * @connection: A #GDBusConnection.
18205 * @flags: Flags from the #GDBusProxyFlags enumeration.
18206 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
18207 * @object_path: An object path.
18208 * @cancellable: (allow-none): A #GCancellable or %NULL.
18209 * @error: Return location for error or %NULL
18210 *
18211 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>. See g_dbus_proxy_new_sync() for more details.
18212 *
18213 * The calling thread is blocked until a reply is received.
18214 *
18215 * See event_log_proxy_new() for the asynchronous version of this constructor.
18216 *
18217 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
18218 */
18219EventLog *
18220event_log_proxy_new_sync (
18221 GDBusConnection *connection,
18222 GDBusProxyFlags flags,
18223 const gchar *name,
18224 const gchar *object_path,
18225 GCancellable *cancellable,
18226 GError **error)
18227{
18228 GInitable *ret;
18229 ret = g_initable_new (TYPE_EVENT_LOG_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.EventLog", NULL);
18230 if (ret != NULL)
18231 return EVENT_LOG (ret);
18232 else
18233 return NULL;
18234}
18235
18236
18237/**
18238 * event_log_proxy_new_for_bus:
18239 * @bus_type: A #GBusType.
18240 * @flags: Flags from the #GDBusProxyFlags enumeration.
18241 * @name: A bus name (well-known or unique).
18242 * @object_path: An object path.
18243 * @cancellable: (allow-none): A #GCancellable or %NULL.
18244 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
18245 * @user_data: User data to pass to @callback.
18246 *
18247 * Like event_log_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
18248 *
18249 * 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.
18250 * You can then call event_log_proxy_new_for_bus_finish() to get the result of the operation.
18251 *
18252 * See event_log_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
18253 */
18254void
18255event_log_proxy_new_for_bus (
18256 GBusType bus_type,
18257 GDBusProxyFlags flags,
18258 const gchar *name,
18259 const gchar *object_path,
18260 GCancellable *cancellable,
18261 GAsyncReadyCallback callback,
18262 gpointer user_data)
18263{
18264 g_async_initable_new_async (TYPE_EVENT_LOG_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.EventLog", NULL);
18265}
18266
18267/**
18268 * event_log_proxy_new_for_bus_finish:
18269 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new_for_bus().
18270 * @error: Return location for error or %NULL
18271 *
18272 * Finishes an operation started with event_log_proxy_new_for_bus().
18273 *
18274 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
18275 */
18276EventLog *
18277event_log_proxy_new_for_bus_finish (
18278 GAsyncResult *res,
18279 GError **error)
18280{
18281 GObject *ret;
18282 GObject *source_object;
18283 source_object = g_async_result_get_source_object (res);
18284 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
18285 g_object_unref (source_object);
18286 if (ret != NULL)
18287 return EVENT_LOG (ret);
18288 else
18289 return NULL;
18290}
18291
18292/**
18293 * event_log_proxy_new_for_bus_sync:
18294 * @bus_type: A #GBusType.
18295 * @flags: Flags from the #GDBusProxyFlags enumeration.
18296 * @name: A bus name (well-known or unique).
18297 * @object_path: An object path.
18298 * @cancellable: (allow-none): A #GCancellable or %NULL.
18299 * @error: Return location for error or %NULL
18300 *
18301 * Like event_log_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
18302 *
18303 * The calling thread is blocked until a reply is received.
18304 *
18305 * See event_log_proxy_new_for_bus() for the asynchronous version of this constructor.
18306 *
18307 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
18308 */
18309EventLog *
18310event_log_proxy_new_for_bus_sync (
18311 GBusType bus_type,
18312 GDBusProxyFlags flags,
18313 const gchar *name,
18314 const gchar *object_path,
18315 GCancellable *cancellable,
18316 GError **error)
18317{
18318 GInitable *ret;
18319 ret = g_initable_new (TYPE_EVENT_LOG_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.EventLog", NULL);
18320 if (ret != NULL)
18321 return EVENT_LOG (ret);
18322 else
18323 return NULL;
18324}
18325
18326
18327/* ------------------------------------------------------------------------ */
18328
18329/**
18330 * EventLogSkeleton:
18331 *
18332 * The #EventLogSkeleton structure contains only private data and should only be accessed using the provided API.
18333 */
18334
18335/**
18336 * EventLogSkeletonClass:
18337 * @parent_class: The parent class.
18338 *
18339 * Class structure for #EventLogSkeleton.
18340 */
18341
18342struct _EventLogSkeletonPrivate
18343{
18344 GValue *properties;
18345 GList *changed_properties;
18346 GSource *changed_properties_idle_source;
18347 GMainContext *context;
18348 GMutex lock;
18349};
18350
18351static void
18352_event_log_skeleton_handle_method_call (
18353 GDBusConnection *connection G_GNUC_UNUSED,
18354 const gchar *sender G_GNUC_UNUSED,
18355 const gchar *object_path G_GNUC_UNUSED,
18356 const gchar *interface_name,
18357 const gchar *method_name,
18358 GVariant *parameters,
18359 GDBusMethodInvocation *invocation,
18360 gpointer user_data)
18361{
18362 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
18363 _ExtendedGDBusMethodInfo *info;
18364 GVariantIter iter;
18365 GVariant *child;
18366 GValue *paramv;
18367 guint num_params;
18368 guint num_extra;
18369 guint n;
18370 guint signal_id;
18371 GValue return_value = G_VALUE_INIT;
18372 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
18373 g_assert (info != NULL);
18374 num_params = g_variant_n_children (parameters);
18375 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
18376 n = 0;
18377 g_value_init (&paramv[n], TYPE_EVENT_LOG);
18378 g_value_set_object (&paramv[n++], skeleton);
18379 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
18380 g_value_set_object (&paramv[n++], invocation);
18381 if (info->pass_fdlist)
18382 {
18383#ifdef G_OS_UNIX
18384 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
18385 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
18386#else
18387 g_assert_not_reached ();
18388#endif
18389 }
18390 g_variant_iter_init (&iter, parameters);
18391 while ((child = g_variant_iter_next_value (&iter)) != NULL)
18392 {
18393 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
18394 if (arg_info->use_gvariant)
18395 {
18396 g_value_init (&paramv[n], G_TYPE_VARIANT);
18397 g_value_set_variant (&paramv[n], child);
18398 n++;
18399 }
18400 else
18401 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
18402 g_variant_unref (child);
18403 }
18404 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
18405 g_value_init (&return_value, G_TYPE_BOOLEAN);
18406 g_signal_emitv (paramv, signal_id, 0, &return_value);
18407 if (!g_value_get_boolean (&return_value))
18408 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);
18409 g_value_unset (&return_value);
18410 for (n = 0; n < num_params + num_extra; n++)
18411 g_value_unset (&paramv[n]);
18412 g_free (paramv);
18413}
18414
18415static GVariant *
18416_event_log_skeleton_handle_get_property (
18417 GDBusConnection *connection G_GNUC_UNUSED,
18418 const gchar *sender G_GNUC_UNUSED,
18419 const gchar *object_path G_GNUC_UNUSED,
18420 const gchar *interface_name G_GNUC_UNUSED,
18421 const gchar *property_name,
18422 GError **error,
18423 gpointer user_data)
18424{
18425 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
18426 GValue value = G_VALUE_INIT;
18427 GParamSpec *pspec;
18428 _ExtendedGDBusPropertyInfo *info;
18429 GVariant *ret;
18430 ret = NULL;
18431 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
18432 g_assert (info != NULL);
18433 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
18434 if (pspec == NULL)
18435 {
18436 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
18437 }
18438 else
18439 {
18440 g_value_init (&value, pspec->value_type);
18441 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
18442 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
18443 g_value_unset (&value);
18444 }
18445 return ret;
18446}
18447
18448static gboolean
18449_event_log_skeleton_handle_set_property (
18450 GDBusConnection *connection G_GNUC_UNUSED,
18451 const gchar *sender G_GNUC_UNUSED,
18452 const gchar *object_path G_GNUC_UNUSED,
18453 const gchar *interface_name G_GNUC_UNUSED,
18454 const gchar *property_name,
18455 GVariant *variant,
18456 GError **error,
18457 gpointer user_data)
18458{
18459 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
18460 GValue value = G_VALUE_INIT;
18461 GParamSpec *pspec;
18462 _ExtendedGDBusPropertyInfo *info;
18463 gboolean ret;
18464 ret = FALSE;
18465 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
18466 g_assert (info != NULL);
18467 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
18468 if (pspec == NULL)
18469 {
18470 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
18471 }
18472 else
18473 {
18474 if (info->use_gvariant)
18475 g_value_set_variant (&value, variant);
18476 else
18477 g_dbus_gvariant_to_gvalue (variant, &value);
18478 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
18479 g_value_unset (&value);
18480 ret = TRUE;
18481 }
18482 return ret;
18483}
18484
18485static const GDBusInterfaceVTable _event_log_skeleton_vtable =
18486{
18487 _event_log_skeleton_handle_method_call,
18488 _event_log_skeleton_handle_get_property,
18489 _event_log_skeleton_handle_set_property,
18490 {NULL}
18491};
18492
18493static GDBusInterfaceInfo *
18494event_log_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
18495{
18496 return event_log_interface_info ();
18497}
18498
18499static GDBusInterfaceVTable *
18500event_log_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
18501{
18502 return (GDBusInterfaceVTable *) &_event_log_skeleton_vtable;
18503}
18504
18505static GVariant *
18506event_log_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
18507{
18508 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (_skeleton);
18509
18510 GVariantBuilder builder;
18511 guint n;
18512 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
18513 if (_event_log_interface_info.parent_struct.properties == NULL)
18514 goto out;
18515 for (n = 0; _event_log_interface_info.parent_struct.properties[n] != NULL; n++)
18516 {
18517 GDBusPropertyInfo *info = _event_log_interface_info.parent_struct.properties[n];
18518 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
18519 {
18520 GVariant *value;
18521 value = _event_log_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.EventLog", info->name, NULL, skeleton);
18522 if (value != NULL)
18523 {
18524 g_variant_take_ref (value);
18525 g_variant_builder_add (&builder, "{sv}", info->name, value);
18526 g_variant_unref (value);
18527 }
18528 }
18529 }
18530out:
18531 return g_variant_builder_end (&builder);
18532}
18533
18534static gboolean _event_log_emit_changed (gpointer user_data);
18535
18536static void
18537event_log_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
18538{
18539 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (_skeleton);
18540 gboolean emit_changed = FALSE;
18541
18542 g_mutex_lock (&skeleton->priv->lock);
18543 if (skeleton->priv->changed_properties_idle_source != NULL)
18544 {
18545 g_source_destroy (skeleton->priv->changed_properties_idle_source);
18546 skeleton->priv->changed_properties_idle_source = NULL;
18547 emit_changed = TRUE;
18548 }
18549 g_mutex_unlock (&skeleton->priv->lock);
18550
18551 if (emit_changed)
18552 _event_log_emit_changed (skeleton);
18553}
18554
18555static void
18556_event_log_on_signal_event_log (
18557 EventLog *object,
18558 GVariant *arg_message)
18559{
18560 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
18561
18562 GList *connections, *l;
18563 GVariant *signal_variant;
18564 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
18565
18566 signal_variant = g_variant_ref_sink (g_variant_new ("(@a{ss})",
18567 arg_message));
18568 for (l = connections; l != NULL; l = l->next)
18569 {
18570 GDBusConnection *connection = l->data;
18571 g_dbus_connection_emit_signal (connection,
18572 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.EventLog", "EventLog",
18573 signal_variant, NULL);
18574 }
18575 g_variant_unref (signal_variant);
18576 g_list_free_full (connections, g_object_unref);
18577}
18578
18579static void event_log_skeleton_iface_init (EventLogIface *iface);
18580#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18581G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
18582 G_ADD_PRIVATE (EventLogSkeleton)
18583 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
18584
18585#else
18586G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
18587 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
18588
18589#endif
18590static void
18591event_log_skeleton_finalize (GObject *object)
18592{
18593 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
18594 guint n;
18595 for (n = 0; n < 1; n++)
18596 g_value_unset (&skeleton->priv->properties[n]);
18597 g_free (skeleton->priv->properties);
18598 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
18599 if (skeleton->priv->changed_properties_idle_source != NULL)
18600 g_source_destroy (skeleton->priv->changed_properties_idle_source);
18601 g_main_context_unref (skeleton->priv->context);
18602 g_mutex_clear (&skeleton->priv->lock);
18603 G_OBJECT_CLASS (event_log_skeleton_parent_class)->finalize (object);
18604}
18605
18606static void
18607event_log_skeleton_get_property (GObject *object,
18608 guint prop_id,
18609 GValue *value,
18610 GParamSpec *pspec G_GNUC_UNUSED)
18611{
18612 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
18613 g_assert (prop_id != 0 && prop_id - 1 < 1);
18614 g_mutex_lock (&skeleton->priv->lock);
18615 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
18616 g_mutex_unlock (&skeleton->priv->lock);
18617}
18618
18619static gboolean
18620_event_log_emit_changed (gpointer user_data)
18621{
18622 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
18623 GList *l;
18624 GVariantBuilder builder;
18625 GVariantBuilder invalidated_builder;
18626 guint num_changes;
18627
18628 g_mutex_lock (&skeleton->priv->lock);
18629 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
18630 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
18631 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
18632 {
18633 ChangedProperty *cp = l->data;
18634 GVariant *variant;
18635 const GValue *cur_value;
18636
18637 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
18638 if (!_g_value_equal (cur_value, &cp->orig_value))
18639 {
18640 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
18641 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
18642 g_variant_unref (variant);
18643 num_changes++;
18644 }
18645 }
18646 if (num_changes > 0)
18647 {
18648 GList *connections, *ll;
18649 GVariant *signal_variant;
18650 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.EventLog",
18651 &builder, &invalidated_builder));
18652 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
18653 for (ll = connections; ll != NULL; ll = ll->next)
18654 {
18655 GDBusConnection *connection = ll->data;
18656
18657 g_dbus_connection_emit_signal (connection,
18658 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
18659 "org.freedesktop.DBus.Properties",
18660 "PropertiesChanged",
18661 signal_variant,
18662 NULL);
18663 }
18664 g_variant_unref (signal_variant);
18665 g_list_free_full (connections, g_object_unref);
18666 }
18667 else
18668 {
18669 g_variant_builder_clear (&builder);
18670 g_variant_builder_clear (&invalidated_builder);
18671 }
18672 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
18673 skeleton->priv->changed_properties = NULL;
18674 skeleton->priv->changed_properties_idle_source = NULL;
18675 g_mutex_unlock (&skeleton->priv->lock);
18676 return FALSE;
18677}
18678
18679static void
18680_event_log_schedule_emit_changed (EventLogSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
18681{
18682 ChangedProperty *cp;
18683 GList *l;
18684 cp = NULL;
18685 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
18686 {
18687 ChangedProperty *i_cp = l->data;
18688 if (i_cp->info == info)
18689 {
18690 cp = i_cp;
18691 break;
18692 }
18693 }
18694 if (cp == NULL)
18695 {
18696 cp = g_new0 (ChangedProperty, 1);
18697 cp->prop_id = prop_id;
18698 cp->info = info;
18699 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
18700 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
18701 g_value_copy (orig_value, &cp->orig_value);
18702 }
18703}
18704
18705static void
18706event_log_skeleton_notify (GObject *object,
18707 GParamSpec *pspec G_GNUC_UNUSED)
18708{
18709 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
18710 g_mutex_lock (&skeleton->priv->lock);
18711 if (skeleton->priv->changed_properties != NULL &&
18712 skeleton->priv->changed_properties_idle_source == NULL)
18713 {
18714 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
18715 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
18716 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _event_log_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
18717 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
18718 g_source_unref (skeleton->priv->changed_properties_idle_source);
18719 }
18720 g_mutex_unlock (&skeleton->priv->lock);
18721}
18722
18723static void
18724event_log_skeleton_set_property (GObject *object,
18725 guint prop_id,
18726 const GValue *value,
18727 GParamSpec *pspec)
18728{
18729 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
18730 g_assert (prop_id != 0 && prop_id - 1 < 1);
18731 g_mutex_lock (&skeleton->priv->lock);
18732 g_object_freeze_notify (object);
18733 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
18734 {
18735 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
18736 _event_log_schedule_emit_changed (skeleton, _event_log_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
18737 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
18738 g_object_notify_by_pspec (object, pspec);
18739 }
18740 g_mutex_unlock (&skeleton->priv->lock);
18741 g_object_thaw_notify (object);
18742}
18743
18744static void
18745event_log_skeleton_init (EventLogSkeleton *skeleton)
18746{
18747#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18748 skeleton->priv = event_log_skeleton_get_instance_private (skeleton);
18749#else
18750 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_EVENT_LOG_SKELETON, EventLogSkeletonPrivate);
18751#endif
18752
18753 g_mutex_init (&skeleton->priv->lock);
18754 skeleton->priv->context = g_main_context_ref_thread_default ();
18755 skeleton->priv->properties = g_new0 (GValue, 1);
18756 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
18757}
18758
18759static GVariant *
18760event_log_skeleton_get_message (EventLog *object)
18761{
18762 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
18763 GVariant *value;
18764 g_mutex_lock (&skeleton->priv->lock);
18765 value = g_value_get_variant (&(skeleton->priv->properties[0]));
18766 g_mutex_unlock (&skeleton->priv->lock);
18767 return value;
18768}
18769
18770static void
18771event_log_skeleton_class_init (EventLogSkeletonClass *klass)
18772{
18773 GObjectClass *gobject_class;
18774 GDBusInterfaceSkeletonClass *skeleton_class;
18775
18776 gobject_class = G_OBJECT_CLASS (klass);
18777 gobject_class->finalize = event_log_skeleton_finalize;
18778 gobject_class->get_property = event_log_skeleton_get_property;
18779 gobject_class->set_property = event_log_skeleton_set_property;
18780 gobject_class->notify = event_log_skeleton_notify;
18781
18782
18783 event_log_override_properties (gobject_class, 1);
18784
18785 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
18786 skeleton_class->get_info = event_log_skeleton_dbus_interface_get_info;
18787 skeleton_class->get_properties = event_log_skeleton_dbus_interface_get_properties;
18788 skeleton_class->flush = event_log_skeleton_dbus_interface_flush;
18789 skeleton_class->get_vtable = event_log_skeleton_dbus_interface_get_vtable;
18790
18791#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
18792 g_type_class_add_private (klass, sizeof (EventLogSkeletonPrivate));
18793#endif
18794}
18795
18796static void
18797event_log_skeleton_iface_init (EventLogIface *iface)
18798{
18799 iface->event_log = _event_log_on_signal_event_log;
18800 iface->get_message = event_log_skeleton_get_message;
18801}
18802
18803/**
18804 * event_log_skeleton_new:
18805 *
18806 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
18807 *
18808 * Returns: (transfer full) (type EventLogSkeleton): The skeleton object.
18809 */
18810EventLog *
18811event_log_skeleton_new (void)
18812{
18813 return EVENT_LOG (g_object_new (TYPE_EVENT_LOG_SKELETON, NULL));
18814}
18815
18816/* ------------------------------------------------------------------------
18817 * Code for interface org.openbmc.Flash
18818 * ------------------------------------------------------------------------
18819 */
18820
18821/**
18822 * SECTION:Flash
18823 * @title: Flash
18824 * @short_description: Generated C code for the org.openbmc.Flash D-Bus interface
18825 *
18826 * 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.
18827 */
18828
18829/* ---- Introspection data for org.openbmc.Flash ---- */
18830
18831static const _ExtendedGDBusArgInfo _flash_method_info_update_via_file_IN_ARG_file =
18832{
18833 {
18834 -1,
18835 (gchar *) "file",
18836 (gchar *) "s",
18837 NULL
18838 },
18839 FALSE
18840};
18841
18842static const _ExtendedGDBusArgInfo * const _flash_method_info_update_via_file_IN_ARG_pointers[] =
18843{
18844 &_flash_method_info_update_via_file_IN_ARG_file,
18845 NULL
18846};
18847
18848static const _ExtendedGDBusMethodInfo _flash_method_info_update_via_file =
18849{
18850 {
18851 -1,
18852 (gchar *) "updateViaFile",
18853 (GDBusArgInfo **) &_flash_method_info_update_via_file_IN_ARG_pointers,
18854 NULL,
18855 NULL
18856 },
18857 "handle-update-via-file",
18858 FALSE
18859};
18860
18861static const _ExtendedGDBusArgInfo _flash_method_info_update_via_http_IN_ARG_url =
18862{
18863 {
18864 -1,
18865 (gchar *) "url",
18866 (gchar *) "s",
18867 NULL
18868 },
18869 FALSE
18870};
18871
18872static const _ExtendedGDBusArgInfo * const _flash_method_info_update_via_http_IN_ARG_pointers[] =
18873{
18874 &_flash_method_info_update_via_http_IN_ARG_url,
18875 NULL
18876};
18877
18878static const _ExtendedGDBusMethodInfo _flash_method_info_update_via_http =
18879{
18880 {
18881 -1,
18882 (gchar *) "updateViaHttp",
18883 (GDBusArgInfo **) &_flash_method_info_update_via_http_IN_ARG_pointers,
18884 NULL,
18885 NULL
18886 },
18887 "handle-update-via-http",
18888 FALSE
18889};
18890
18891static const _ExtendedGDBusMethodInfo _flash_method_info_erase =
18892{
18893 {
18894 -1,
18895 (gchar *) "erase",
18896 NULL,
18897 NULL,
18898 NULL
18899 },
18900 "handle-erase",
18901 FALSE
18902};
18903
18904static const _ExtendedGDBusMethodInfo _flash_method_info_init =
18905{
18906 {
18907 -1,
18908 (gchar *) "init",
18909 NULL,
18910 NULL,
18911 NULL
18912 },
18913 "handle-init",
18914 FALSE
18915};
18916
18917static const _ExtendedGDBusMethodInfo * const _flash_method_info_pointers[] =
18918{
18919 &_flash_method_info_update_via_file,
18920 &_flash_method_info_update_via_http,
18921 &_flash_method_info_erase,
18922 &_flash_method_info_init,
18923 NULL
18924};
18925
18926static const _ExtendedGDBusSignalInfo _flash_signal_info_updated =
18927{
18928 {
18929 -1,
18930 (gchar *) "Updated",
18931 NULL,
18932 NULL
18933 },
18934 "updated"
18935};
18936
18937static const _ExtendedGDBusSignalInfo * const _flash_signal_info_pointers[] =
18938{
18939 &_flash_signal_info_updated,
18940 NULL
18941};
18942
18943static const _ExtendedGDBusInterfaceInfo _flash_interface_info =
18944{
18945 {
18946 -1,
18947 (gchar *) "org.openbmc.Flash",
18948 (GDBusMethodInfo **) &_flash_method_info_pointers,
18949 (GDBusSignalInfo **) &_flash_signal_info_pointers,
18950 NULL,
18951 NULL
18952 },
18953 "flash",
18954};
18955
18956
18957/**
18958 * flash_interface_info:
18959 *
18960 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> D-Bus interface.
18961 *
18962 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
18963 */
18964GDBusInterfaceInfo *
18965flash_interface_info (void)
18966{
18967 return (GDBusInterfaceInfo *) &_flash_interface_info.parent_struct;
18968}
18969
18970/**
18971 * flash_override_properties:
18972 * @klass: The class structure for a #GObject<!-- -->-derived class.
18973 * @property_id_begin: The property id to assign to the first overridden property.
18974 *
18975 * Overrides all #GObject properties in the #Flash interface for a concrete class.
18976 * The properties are overridden in the order they are defined.
18977 *
18978 * Returns: The last property id.
18979 */
18980guint
18981flash_override_properties (GObjectClass *klass, guint property_id_begin)
18982{
18983 return property_id_begin - 1;
18984}
18985
18986
18987
18988/**
18989 * Flash:
18990 *
18991 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
18992 */
18993
18994/**
18995 * FlashIface:
18996 * @parent_iface: The parent interface.
18997 * @handle_erase: Handler for the #Flash::handle-erase signal.
18998 * @handle_init: Handler for the #Flash::handle-init signal.
18999 * @handle_update_via_file: Handler for the #Flash::handle-update-via-file signal.
19000 * @handle_update_via_http: Handler for the #Flash::handle-update-via-http signal.
19001 * @updated: Handler for the #Flash::updated signal.
19002 *
19003 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
19004 */
19005
19006typedef FlashIface FlashInterface;
19007G_DEFINE_INTERFACE (Flash, flash, G_TYPE_OBJECT);
19008
19009static void
19010flash_default_init (FlashIface *iface)
19011{
19012 /* GObject signals for incoming D-Bus method calls: */
19013 /**
19014 * Flash::handle-update-via-file:
19015 * @object: A #Flash.
19016 * @invocation: A #GDBusMethodInvocation.
19017 * @arg_file: Argument passed by remote caller.
19018 *
19019 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.updateViaFile">updateViaFile()</link> D-Bus method.
19020 *
19021 * 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.
19022 *
19023 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
19024 */
19025 g_signal_new ("handle-update-via-file",
19026 G_TYPE_FROM_INTERFACE (iface),
19027 G_SIGNAL_RUN_LAST,
19028 G_STRUCT_OFFSET (FlashIface, handle_update_via_file),
19029 g_signal_accumulator_true_handled,
19030 NULL,
19031 g_cclosure_marshal_generic,
19032 G_TYPE_BOOLEAN,
19033 2,
19034 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
19035
19036 /**
19037 * Flash::handle-update-via-http:
19038 * @object: A #Flash.
19039 * @invocation: A #GDBusMethodInvocation.
19040 * @arg_url: Argument passed by remote caller.
19041 *
19042 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.updateViaHttp">updateViaHttp()</link> D-Bus method.
19043 *
19044 * 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.
19045 *
19046 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
19047 */
19048 g_signal_new ("handle-update-via-http",
19049 G_TYPE_FROM_INTERFACE (iface),
19050 G_SIGNAL_RUN_LAST,
19051 G_STRUCT_OFFSET (FlashIface, handle_update_via_http),
19052 g_signal_accumulator_true_handled,
19053 NULL,
19054 g_cclosure_marshal_generic,
19055 G_TYPE_BOOLEAN,
19056 2,
19057 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
19058
19059 /**
19060 * Flash::handle-erase:
19061 * @object: A #Flash.
19062 * @invocation: A #GDBusMethodInvocation.
19063 *
19064 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.erase">erase()</link> D-Bus method.
19065 *
19066 * 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.
19067 *
19068 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
19069 */
19070 g_signal_new ("handle-erase",
19071 G_TYPE_FROM_INTERFACE (iface),
19072 G_SIGNAL_RUN_LAST,
19073 G_STRUCT_OFFSET (FlashIface, handle_erase),
19074 g_signal_accumulator_true_handled,
19075 NULL,
19076 g_cclosure_marshal_generic,
19077 G_TYPE_BOOLEAN,
19078 1,
19079 G_TYPE_DBUS_METHOD_INVOCATION);
19080
19081 /**
19082 * Flash::handle-init:
19083 * @object: A #Flash.
19084 * @invocation: A #GDBusMethodInvocation.
19085 *
19086 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method.
19087 *
19088 * 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.
19089 *
19090 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
19091 */
19092 g_signal_new ("handle-init",
19093 G_TYPE_FROM_INTERFACE (iface),
19094 G_SIGNAL_RUN_LAST,
19095 G_STRUCT_OFFSET (FlashIface, handle_init),
19096 g_signal_accumulator_true_handled,
19097 NULL,
19098 g_cclosure_marshal_generic,
19099 G_TYPE_BOOLEAN,
19100 1,
19101 G_TYPE_DBUS_METHOD_INVOCATION);
19102
19103 /* GObject signals for received D-Bus signals: */
19104 /**
19105 * Flash::updated:
19106 * @object: A #Flash.
19107 *
19108 * 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.
19109 *
19110 * 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.
19111 */
19112 g_signal_new ("updated",
19113 G_TYPE_FROM_INTERFACE (iface),
19114 G_SIGNAL_RUN_LAST,
19115 G_STRUCT_OFFSET (FlashIface, updated),
19116 NULL,
19117 NULL,
19118 g_cclosure_marshal_generic,
19119 G_TYPE_NONE,
19120 0);
19121
19122}
19123
19124/**
19125 * flash_emit_updated:
19126 * @object: A #Flash.
19127 *
19128 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Updated">"Updated"</link> D-Bus signal.
19129 */
19130void
19131flash_emit_updated (
19132 Flash *object)
19133{
19134 g_signal_emit_by_name (object, "updated");
19135}
19136
19137/**
19138 * flash_call_update_via_file:
19139 * @proxy: A #FlashProxy.
19140 * @arg_file: Argument to pass with the method invocation.
19141 * @cancellable: (allow-none): A #GCancellable or %NULL.
19142 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19143 * @user_data: User data to pass to @callback.
19144 *
19145 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaFile">updateViaFile()</link> D-Bus method on @proxy.
19146 * 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.
19147 * You can then call flash_call_update_via_file_finish() to get the result of the operation.
19148 *
19149 * See flash_call_update_via_file_sync() for the synchronous, blocking version of this method.
19150 */
19151void
19152flash_call_update_via_file (
19153 Flash *proxy,
19154 const gchar *arg_file,
19155 GCancellable *cancellable,
19156 GAsyncReadyCallback callback,
19157 gpointer user_data)
19158{
19159 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19160 "updateViaFile",
19161 g_variant_new ("(s)",
19162 arg_file),
19163 G_DBUS_CALL_FLAGS_NONE,
19164 -1,
19165 cancellable,
19166 callback,
19167 user_data);
19168}
19169
19170/**
19171 * flash_call_update_via_file_finish:
19172 * @proxy: A #FlashProxy.
19173 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update_via_file().
19174 * @error: Return location for error or %NULL.
19175 *
19176 * Finishes an operation started with flash_call_update_via_file().
19177 *
19178 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19179 */
19180gboolean
19181flash_call_update_via_file_finish (
19182 Flash *proxy,
19183 GAsyncResult *res,
19184 GError **error)
19185{
19186 GVariant *_ret;
19187 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19188 if (_ret == NULL)
19189 goto _out;
19190 g_variant_get (_ret,
19191 "()");
19192 g_variant_unref (_ret);
19193_out:
19194 return _ret != NULL;
19195}
19196
19197/**
19198 * flash_call_update_via_file_sync:
19199 * @proxy: A #FlashProxy.
19200 * @arg_file: Argument to pass with the method invocation.
19201 * @cancellable: (allow-none): A #GCancellable or %NULL.
19202 * @error: Return location for error or %NULL.
19203 *
19204 * 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.
19205 *
19206 * See flash_call_update_via_file() for the asynchronous version of this method.
19207 *
19208 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19209 */
19210gboolean
19211flash_call_update_via_file_sync (
19212 Flash *proxy,
19213 const gchar *arg_file,
19214 GCancellable *cancellable,
19215 GError **error)
19216{
19217 GVariant *_ret;
19218 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19219 "updateViaFile",
19220 g_variant_new ("(s)",
19221 arg_file),
19222 G_DBUS_CALL_FLAGS_NONE,
19223 -1,
19224 cancellable,
19225 error);
19226 if (_ret == NULL)
19227 goto _out;
19228 g_variant_get (_ret,
19229 "()");
19230 g_variant_unref (_ret);
19231_out:
19232 return _ret != NULL;
19233}
19234
19235/**
19236 * flash_call_update_via_http:
19237 * @proxy: A #FlashProxy.
19238 * @arg_url: Argument to pass with the method invocation.
19239 * @cancellable: (allow-none): A #GCancellable or %NULL.
19240 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19241 * @user_data: User data to pass to @callback.
19242 *
19243 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaHttp">updateViaHttp()</link> D-Bus method on @proxy.
19244 * 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.
19245 * You can then call flash_call_update_via_http_finish() to get the result of the operation.
19246 *
19247 * See flash_call_update_via_http_sync() for the synchronous, blocking version of this method.
19248 */
19249void
19250flash_call_update_via_http (
19251 Flash *proxy,
19252 const gchar *arg_url,
19253 GCancellable *cancellable,
19254 GAsyncReadyCallback callback,
19255 gpointer user_data)
19256{
19257 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19258 "updateViaHttp",
19259 g_variant_new ("(s)",
19260 arg_url),
19261 G_DBUS_CALL_FLAGS_NONE,
19262 -1,
19263 cancellable,
19264 callback,
19265 user_data);
19266}
19267
19268/**
19269 * flash_call_update_via_http_finish:
19270 * @proxy: A #FlashProxy.
19271 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update_via_http().
19272 * @error: Return location for error or %NULL.
19273 *
19274 * Finishes an operation started with flash_call_update_via_http().
19275 *
19276 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19277 */
19278gboolean
19279flash_call_update_via_http_finish (
19280 Flash *proxy,
19281 GAsyncResult *res,
19282 GError **error)
19283{
19284 GVariant *_ret;
19285 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19286 if (_ret == NULL)
19287 goto _out;
19288 g_variant_get (_ret,
19289 "()");
19290 g_variant_unref (_ret);
19291_out:
19292 return _ret != NULL;
19293}
19294
19295/**
19296 * flash_call_update_via_http_sync:
19297 * @proxy: A #FlashProxy.
19298 * @arg_url: Argument to pass with the method invocation.
19299 * @cancellable: (allow-none): A #GCancellable or %NULL.
19300 * @error: Return location for error or %NULL.
19301 *
19302 * 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.
19303 *
19304 * See flash_call_update_via_http() for the asynchronous version of this method.
19305 *
19306 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19307 */
19308gboolean
19309flash_call_update_via_http_sync (
19310 Flash *proxy,
19311 const gchar *arg_url,
19312 GCancellable *cancellable,
19313 GError **error)
19314{
19315 GVariant *_ret;
19316 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19317 "updateViaHttp",
19318 g_variant_new ("(s)",
19319 arg_url),
19320 G_DBUS_CALL_FLAGS_NONE,
19321 -1,
19322 cancellable,
19323 error);
19324 if (_ret == NULL)
19325 goto _out;
19326 g_variant_get (_ret,
19327 "()");
19328 g_variant_unref (_ret);
19329_out:
19330 return _ret != NULL;
19331}
19332
19333/**
19334 * flash_call_erase:
19335 * @proxy: A #FlashProxy.
19336 * @cancellable: (allow-none): A #GCancellable or %NULL.
19337 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19338 * @user_data: User data to pass to @callback.
19339 *
19340 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.erase">erase()</link> D-Bus method on @proxy.
19341 * 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.
19342 * You can then call flash_call_erase_finish() to get the result of the operation.
19343 *
19344 * See flash_call_erase_sync() for the synchronous, blocking version of this method.
19345 */
19346void
19347flash_call_erase (
19348 Flash *proxy,
19349 GCancellable *cancellable,
19350 GAsyncReadyCallback callback,
19351 gpointer user_data)
19352{
19353 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19354 "erase",
19355 g_variant_new ("()"),
19356 G_DBUS_CALL_FLAGS_NONE,
19357 -1,
19358 cancellable,
19359 callback,
19360 user_data);
19361}
19362
19363/**
19364 * flash_call_erase_finish:
19365 * @proxy: A #FlashProxy.
19366 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_erase().
19367 * @error: Return location for error or %NULL.
19368 *
19369 * Finishes an operation started with flash_call_erase().
19370 *
19371 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19372 */
19373gboolean
19374flash_call_erase_finish (
19375 Flash *proxy,
19376 GAsyncResult *res,
19377 GError **error)
19378{
19379 GVariant *_ret;
19380 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19381 if (_ret == NULL)
19382 goto _out;
19383 g_variant_get (_ret,
19384 "()");
19385 g_variant_unref (_ret);
19386_out:
19387 return _ret != NULL;
19388}
19389
19390/**
19391 * flash_call_erase_sync:
19392 * @proxy: A #FlashProxy.
19393 * @cancellable: (allow-none): A #GCancellable or %NULL.
19394 * @error: Return location for error or %NULL.
19395 *
19396 * 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.
19397 *
19398 * See flash_call_erase() for the asynchronous version of this method.
19399 *
19400 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19401 */
19402gboolean
19403flash_call_erase_sync (
19404 Flash *proxy,
19405 GCancellable *cancellable,
19406 GError **error)
19407{
19408 GVariant *_ret;
19409 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19410 "erase",
19411 g_variant_new ("()"),
19412 G_DBUS_CALL_FLAGS_NONE,
19413 -1,
19414 cancellable,
19415 error);
19416 if (_ret == NULL)
19417 goto _out;
19418 g_variant_get (_ret,
19419 "()");
19420 g_variant_unref (_ret);
19421_out:
19422 return _ret != NULL;
19423}
19424
19425/**
19426 * flash_call_init:
19427 * @proxy: A #FlashProxy.
19428 * @cancellable: (allow-none): A #GCancellable or %NULL.
19429 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19430 * @user_data: User data to pass to @callback.
19431 *
19432 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method on @proxy.
19433 * 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.
19434 * You can then call flash_call_init_finish() to get the result of the operation.
19435 *
19436 * See flash_call_init_sync() for the synchronous, blocking version of this method.
19437 */
19438void
19439flash_call_init (
19440 Flash *proxy,
19441 GCancellable *cancellable,
19442 GAsyncReadyCallback callback,
19443 gpointer user_data)
19444{
19445 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19446 "init",
19447 g_variant_new ("()"),
19448 G_DBUS_CALL_FLAGS_NONE,
19449 -1,
19450 cancellable,
19451 callback,
19452 user_data);
19453}
19454
19455/**
19456 * flash_call_init_finish:
19457 * @proxy: A #FlashProxy.
19458 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_init().
19459 * @error: Return location for error or %NULL.
19460 *
19461 * Finishes an operation started with flash_call_init().
19462 *
19463 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19464 */
19465gboolean
19466flash_call_init_finish (
19467 Flash *proxy,
19468 GAsyncResult *res,
19469 GError **error)
19470{
19471 GVariant *_ret;
19472 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19473 if (_ret == NULL)
19474 goto _out;
19475 g_variant_get (_ret,
19476 "()");
19477 g_variant_unref (_ret);
19478_out:
19479 return _ret != NULL;
19480}
19481
19482/**
19483 * flash_call_init_sync:
19484 * @proxy: A #FlashProxy.
19485 * @cancellable: (allow-none): A #GCancellable or %NULL.
19486 * @error: Return location for error or %NULL.
19487 *
19488 * 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.
19489 *
19490 * See flash_call_init() for the asynchronous version of this method.
19491 *
19492 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19493 */
19494gboolean
19495flash_call_init_sync (
19496 Flash *proxy,
19497 GCancellable *cancellable,
19498 GError **error)
19499{
19500 GVariant *_ret;
19501 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19502 "init",
19503 g_variant_new ("()"),
19504 G_DBUS_CALL_FLAGS_NONE,
19505 -1,
19506 cancellable,
19507 error);
19508 if (_ret == NULL)
19509 goto _out;
19510 g_variant_get (_ret,
19511 "()");
19512 g_variant_unref (_ret);
19513_out:
19514 return _ret != NULL;
19515}
19516
19517/**
19518 * flash_complete_update_via_file:
19519 * @object: A #Flash.
19520 * @invocation: (transfer full): A #GDBusMethodInvocation.
19521 *
19522 * 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.
19523 *
19524 * This method will free @invocation, you cannot use it afterwards.
19525 */
19526void
19527flash_complete_update_via_file (
19528 Flash *object,
19529 GDBusMethodInvocation *invocation)
19530{
19531 g_dbus_method_invocation_return_value (invocation,
19532 g_variant_new ("()"));
19533}
19534
19535/**
19536 * flash_complete_update_via_http:
19537 * @object: A #Flash.
19538 * @invocation: (transfer full): A #GDBusMethodInvocation.
19539 *
19540 * 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.
19541 *
19542 * This method will free @invocation, you cannot use it afterwards.
19543 */
19544void
19545flash_complete_update_via_http (
19546 Flash *object,
19547 GDBusMethodInvocation *invocation)
19548{
19549 g_dbus_method_invocation_return_value (invocation,
19550 g_variant_new ("()"));
19551}
19552
19553/**
19554 * flash_complete_erase:
19555 * @object: A #Flash.
19556 * @invocation: (transfer full): A #GDBusMethodInvocation.
19557 *
19558 * 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.
19559 *
19560 * This method will free @invocation, you cannot use it afterwards.
19561 */
19562void
19563flash_complete_erase (
19564 Flash *object,
19565 GDBusMethodInvocation *invocation)
19566{
19567 g_dbus_method_invocation_return_value (invocation,
19568 g_variant_new ("()"));
19569}
19570
19571/**
19572 * flash_complete_init:
19573 * @object: A #Flash.
19574 * @invocation: (transfer full): A #GDBusMethodInvocation.
19575 *
19576 * 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.
19577 *
19578 * This method will free @invocation, you cannot use it afterwards.
19579 */
19580void
19581flash_complete_init (
19582 Flash *object,
19583 GDBusMethodInvocation *invocation)
19584{
19585 g_dbus_method_invocation_return_value (invocation,
19586 g_variant_new ("()"));
19587}
19588
19589/* ------------------------------------------------------------------------ */
19590
19591/**
19592 * FlashProxy:
19593 *
19594 * The #FlashProxy structure contains only private data and should only be accessed using the provided API.
19595 */
19596
19597/**
19598 * FlashProxyClass:
19599 * @parent_class: The parent class.
19600 *
19601 * Class structure for #FlashProxy.
19602 */
19603
19604struct _FlashProxyPrivate
19605{
19606 GData *qdata;
19607};
19608
19609static void flash_proxy_iface_init (FlashIface *iface);
19610
19611#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19612G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
19613 G_ADD_PRIVATE (FlashProxy)
19614 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
19615
19616#else
19617G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
19618 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
19619
19620#endif
19621static void
19622flash_proxy_finalize (GObject *object)
19623{
19624 FlashProxy *proxy = FLASH_PROXY (object);
19625 g_datalist_clear (&proxy->priv->qdata);
19626 G_OBJECT_CLASS (flash_proxy_parent_class)->finalize (object);
19627}
19628
19629static void
19630flash_proxy_get_property (GObject *object,
19631 guint prop_id,
19632 GValue *value,
19633 GParamSpec *pspec G_GNUC_UNUSED)
19634{
19635}
19636
19637static void
19638flash_proxy_set_property (GObject *object,
19639 guint prop_id,
19640 const GValue *value,
19641 GParamSpec *pspec G_GNUC_UNUSED)
19642{
19643}
19644
19645static void
19646flash_proxy_g_signal (GDBusProxy *proxy,
19647 const gchar *sender_name G_GNUC_UNUSED,
19648 const gchar *signal_name,
19649 GVariant *parameters)
19650{
19651 _ExtendedGDBusSignalInfo *info;
19652 GVariantIter iter;
19653 GVariant *child;
19654 GValue *paramv;
19655 guint num_params;
19656 guint n;
19657 guint signal_id;
19658 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, signal_name);
19659 if (info == NULL)
19660 return;
19661 num_params = g_variant_n_children (parameters);
19662 paramv = g_new0 (GValue, num_params + 1);
19663 g_value_init (&paramv[0], TYPE_FLASH);
19664 g_value_set_object (&paramv[0], proxy);
19665 g_variant_iter_init (&iter, parameters);
19666 n = 1;
19667 while ((child = g_variant_iter_next_value (&iter)) != NULL)
19668 {
19669 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
19670 if (arg_info->use_gvariant)
19671 {
19672 g_value_init (&paramv[n], G_TYPE_VARIANT);
19673 g_value_set_variant (&paramv[n], child);
19674 n++;
19675 }
19676 else
19677 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
19678 g_variant_unref (child);
19679 }
19680 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
19681 g_signal_emitv (paramv, signal_id, 0, NULL);
19682 for (n = 0; n < num_params + 1; n++)
19683 g_value_unset (&paramv[n]);
19684 g_free (paramv);
19685}
19686
19687static void
19688flash_proxy_g_properties_changed (GDBusProxy *_proxy,
19689 GVariant *changed_properties,
19690 const gchar *const *invalidated_properties)
19691{
19692 FlashProxy *proxy = FLASH_PROXY (_proxy);
19693 guint n;
19694 const gchar *key;
19695 GVariantIter *iter;
19696 _ExtendedGDBusPropertyInfo *info;
19697 g_variant_get (changed_properties, "a{sv}", &iter);
19698 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
19699 {
19700 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, key);
19701 g_datalist_remove_data (&proxy->priv->qdata, key);
19702 if (info != NULL)
19703 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
19704 }
19705 g_variant_iter_free (iter);
19706 for (n = 0; invalidated_properties[n] != NULL; n++)
19707 {
19708 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, invalidated_properties[n]);
19709 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
19710 if (info != NULL)
19711 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
19712 }
19713}
19714
19715static void
19716flash_proxy_init (FlashProxy *proxy)
19717{
19718#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19719 proxy->priv = flash_proxy_get_instance_private (proxy);
19720#else
19721 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_PROXY, FlashProxyPrivate);
19722#endif
19723
19724 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_interface_info ());
19725}
19726
19727static void
19728flash_proxy_class_init (FlashProxyClass *klass)
19729{
19730 GObjectClass *gobject_class;
19731 GDBusProxyClass *proxy_class;
19732
19733 gobject_class = G_OBJECT_CLASS (klass);
19734 gobject_class->finalize = flash_proxy_finalize;
19735 gobject_class->get_property = flash_proxy_get_property;
19736 gobject_class->set_property = flash_proxy_set_property;
19737
19738 proxy_class = G_DBUS_PROXY_CLASS (klass);
19739 proxy_class->g_signal = flash_proxy_g_signal;
19740 proxy_class->g_properties_changed = flash_proxy_g_properties_changed;
19741
19742#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
19743 g_type_class_add_private (klass, sizeof (FlashProxyPrivate));
19744#endif
19745}
19746
19747static void
19748flash_proxy_iface_init (FlashIface *iface)
19749{
19750}
19751
19752/**
19753 * flash_proxy_new:
19754 * @connection: A #GDBusConnection.
19755 * @flags: Flags from the #GDBusProxyFlags enumeration.
19756 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
19757 * @object_path: An object path.
19758 * @cancellable: (allow-none): A #GCancellable or %NULL.
19759 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
19760 * @user_data: User data to pass to @callback.
19761 *
19762 * 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.
19763 *
19764 * 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.
19765 * You can then call flash_proxy_new_finish() to get the result of the operation.
19766 *
19767 * See flash_proxy_new_sync() for the synchronous, blocking version of this constructor.
19768 */
19769void
19770flash_proxy_new (
19771 GDBusConnection *connection,
19772 GDBusProxyFlags flags,
19773 const gchar *name,
19774 const gchar *object_path,
19775 GCancellable *cancellable,
19776 GAsyncReadyCallback callback,
19777 gpointer user_data)
19778{
19779 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);
19780}
19781
19782/**
19783 * flash_proxy_new_finish:
19784 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new().
19785 * @error: Return location for error or %NULL
19786 *
19787 * Finishes an operation started with flash_proxy_new().
19788 *
19789 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
19790 */
19791Flash *
19792flash_proxy_new_finish (
19793 GAsyncResult *res,
19794 GError **error)
19795{
19796 GObject *ret;
19797 GObject *source_object;
19798 source_object = g_async_result_get_source_object (res);
19799 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
19800 g_object_unref (source_object);
19801 if (ret != NULL)
19802 return FLASH (ret);
19803 else
19804 return NULL;
19805}
19806
19807/**
19808 * flash_proxy_new_sync:
19809 * @connection: A #GDBusConnection.
19810 * @flags: Flags from the #GDBusProxyFlags enumeration.
19811 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
19812 * @object_path: An object path.
19813 * @cancellable: (allow-none): A #GCancellable or %NULL.
19814 * @error: Return location for error or %NULL
19815 *
19816 * 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.
19817 *
19818 * The calling thread is blocked until a reply is received.
19819 *
19820 * See flash_proxy_new() for the asynchronous version of this constructor.
19821 *
19822 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
19823 */
19824Flash *
19825flash_proxy_new_sync (
19826 GDBusConnection *connection,
19827 GDBusProxyFlags flags,
19828 const gchar *name,
19829 const gchar *object_path,
19830 GCancellable *cancellable,
19831 GError **error)
19832{
19833 GInitable *ret;
19834 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);
19835 if (ret != NULL)
19836 return FLASH (ret);
19837 else
19838 return NULL;
19839}
19840
19841
19842/**
19843 * flash_proxy_new_for_bus:
19844 * @bus_type: A #GBusType.
19845 * @flags: Flags from the #GDBusProxyFlags enumeration.
19846 * @name: A bus name (well-known or unique).
19847 * @object_path: An object path.
19848 * @cancellable: (allow-none): A #GCancellable or %NULL.
19849 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
19850 * @user_data: User data to pass to @callback.
19851 *
19852 * Like flash_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
19853 *
19854 * 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.
19855 * You can then call flash_proxy_new_for_bus_finish() to get the result of the operation.
19856 *
19857 * See flash_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
19858 */
19859void
19860flash_proxy_new_for_bus (
19861 GBusType bus_type,
19862 GDBusProxyFlags flags,
19863 const gchar *name,
19864 const gchar *object_path,
19865 GCancellable *cancellable,
19866 GAsyncReadyCallback callback,
19867 gpointer user_data)
19868{
19869 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);
19870}
19871
19872/**
19873 * flash_proxy_new_for_bus_finish:
19874 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new_for_bus().
19875 * @error: Return location for error or %NULL
19876 *
19877 * Finishes an operation started with flash_proxy_new_for_bus().
19878 *
19879 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
19880 */
19881Flash *
19882flash_proxy_new_for_bus_finish (
19883 GAsyncResult *res,
19884 GError **error)
19885{
19886 GObject *ret;
19887 GObject *source_object;
19888 source_object = g_async_result_get_source_object (res);
19889 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
19890 g_object_unref (source_object);
19891 if (ret != NULL)
19892 return FLASH (ret);
19893 else
19894 return NULL;
19895}
19896
19897/**
19898 * flash_proxy_new_for_bus_sync:
19899 * @bus_type: A #GBusType.
19900 * @flags: Flags from the #GDBusProxyFlags enumeration.
19901 * @name: A bus name (well-known or unique).
19902 * @object_path: An object path.
19903 * @cancellable: (allow-none): A #GCancellable or %NULL.
19904 * @error: Return location for error or %NULL
19905 *
19906 * Like flash_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
19907 *
19908 * The calling thread is blocked until a reply is received.
19909 *
19910 * See flash_proxy_new_for_bus() for the asynchronous version of this constructor.
19911 *
19912 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
19913 */
19914Flash *
19915flash_proxy_new_for_bus_sync (
19916 GBusType bus_type,
19917 GDBusProxyFlags flags,
19918 const gchar *name,
19919 const gchar *object_path,
19920 GCancellable *cancellable,
19921 GError **error)
19922{
19923 GInitable *ret;
19924 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);
19925 if (ret != NULL)
19926 return FLASH (ret);
19927 else
19928 return NULL;
19929}
19930
19931
19932/* ------------------------------------------------------------------------ */
19933
19934/**
19935 * FlashSkeleton:
19936 *
19937 * The #FlashSkeleton structure contains only private data and should only be accessed using the provided API.
19938 */
19939
19940/**
19941 * FlashSkeletonClass:
19942 * @parent_class: The parent class.
19943 *
19944 * Class structure for #FlashSkeleton.
19945 */
19946
19947struct _FlashSkeletonPrivate
19948{
19949 GValue *properties;
19950 GList *changed_properties;
19951 GSource *changed_properties_idle_source;
19952 GMainContext *context;
19953 GMutex lock;
19954};
19955
19956static void
19957_flash_skeleton_handle_method_call (
19958 GDBusConnection *connection G_GNUC_UNUSED,
19959 const gchar *sender G_GNUC_UNUSED,
19960 const gchar *object_path G_GNUC_UNUSED,
19961 const gchar *interface_name,
19962 const gchar *method_name,
19963 GVariant *parameters,
19964 GDBusMethodInvocation *invocation,
19965 gpointer user_data)
19966{
19967 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
19968 _ExtendedGDBusMethodInfo *info;
19969 GVariantIter iter;
19970 GVariant *child;
19971 GValue *paramv;
19972 guint num_params;
19973 guint num_extra;
19974 guint n;
19975 guint signal_id;
19976 GValue return_value = G_VALUE_INIT;
19977 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
19978 g_assert (info != NULL);
19979 num_params = g_variant_n_children (parameters);
19980 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
19981 n = 0;
19982 g_value_init (&paramv[n], TYPE_FLASH);
19983 g_value_set_object (&paramv[n++], skeleton);
19984 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
19985 g_value_set_object (&paramv[n++], invocation);
19986 if (info->pass_fdlist)
19987 {
19988#ifdef G_OS_UNIX
19989 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
19990 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
19991#else
19992 g_assert_not_reached ();
19993#endif
19994 }
19995 g_variant_iter_init (&iter, parameters);
19996 while ((child = g_variant_iter_next_value (&iter)) != NULL)
19997 {
19998 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
19999 if (arg_info->use_gvariant)
20000 {
20001 g_value_init (&paramv[n], G_TYPE_VARIANT);
20002 g_value_set_variant (&paramv[n], child);
20003 n++;
20004 }
20005 else
20006 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
20007 g_variant_unref (child);
20008 }
20009 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
20010 g_value_init (&return_value, G_TYPE_BOOLEAN);
20011 g_signal_emitv (paramv, signal_id, 0, &return_value);
20012 if (!g_value_get_boolean (&return_value))
20013 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);
20014 g_value_unset (&return_value);
20015 for (n = 0; n < num_params + num_extra; n++)
20016 g_value_unset (&paramv[n]);
20017 g_free (paramv);
20018}
20019
20020static GVariant *
20021_flash_skeleton_handle_get_property (
20022 GDBusConnection *connection G_GNUC_UNUSED,
20023 const gchar *sender G_GNUC_UNUSED,
20024 const gchar *object_path G_GNUC_UNUSED,
20025 const gchar *interface_name G_GNUC_UNUSED,
20026 const gchar *property_name,
20027 GError **error,
20028 gpointer user_data)
20029{
20030 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
20031 GValue value = G_VALUE_INIT;
20032 GParamSpec *pspec;
20033 _ExtendedGDBusPropertyInfo *info;
20034 GVariant *ret;
20035 ret = NULL;
20036 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
20037 g_assert (info != NULL);
20038 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
20039 if (pspec == NULL)
20040 {
20041 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
20042 }
20043 else
20044 {
20045 g_value_init (&value, pspec->value_type);
20046 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
20047 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
20048 g_value_unset (&value);
20049 }
20050 return ret;
20051}
20052
20053static gboolean
20054_flash_skeleton_handle_set_property (
20055 GDBusConnection *connection G_GNUC_UNUSED,
20056 const gchar *sender G_GNUC_UNUSED,
20057 const gchar *object_path G_GNUC_UNUSED,
20058 const gchar *interface_name G_GNUC_UNUSED,
20059 const gchar *property_name,
20060 GVariant *variant,
20061 GError **error,
20062 gpointer user_data)
20063{
20064 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
20065 GValue value = G_VALUE_INIT;
20066 GParamSpec *pspec;
20067 _ExtendedGDBusPropertyInfo *info;
20068 gboolean ret;
20069 ret = FALSE;
20070 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
20071 g_assert (info != NULL);
20072 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
20073 if (pspec == NULL)
20074 {
20075 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
20076 }
20077 else
20078 {
20079 if (info->use_gvariant)
20080 g_value_set_variant (&value, variant);
20081 else
20082 g_dbus_gvariant_to_gvalue (variant, &value);
20083 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
20084 g_value_unset (&value);
20085 ret = TRUE;
20086 }
20087 return ret;
20088}
20089
20090static const GDBusInterfaceVTable _flash_skeleton_vtable =
20091{
20092 _flash_skeleton_handle_method_call,
20093 _flash_skeleton_handle_get_property,
20094 _flash_skeleton_handle_set_property,
20095 {NULL}
20096};
20097
20098static GDBusInterfaceInfo *
20099flash_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
20100{
20101 return flash_interface_info ();
20102}
20103
20104static GDBusInterfaceVTable *
20105flash_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
20106{
20107 return (GDBusInterfaceVTable *) &_flash_skeleton_vtable;
20108}
20109
20110static GVariant *
20111flash_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
20112{
20113 FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton);
20114
20115 GVariantBuilder builder;
20116 guint n;
20117 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
20118 if (_flash_interface_info.parent_struct.properties == NULL)
20119 goto out;
20120 for (n = 0; _flash_interface_info.parent_struct.properties[n] != NULL; n++)
20121 {
20122 GDBusPropertyInfo *info = _flash_interface_info.parent_struct.properties[n];
20123 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
20124 {
20125 GVariant *value;
20126 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);
20127 if (value != NULL)
20128 {
20129 g_variant_take_ref (value);
20130 g_variant_builder_add (&builder, "{sv}", info->name, value);
20131 g_variant_unref (value);
20132 }
20133 }
20134 }
20135out:
20136 return g_variant_builder_end (&builder);
20137}
20138
20139static void
20140flash_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
20141{
20142}
20143
20144static void
20145_flash_on_signal_updated (
20146 Flash *object)
20147{
20148 FlashSkeleton *skeleton = FLASH_SKELETON (object);
20149
20150 GList *connections, *l;
20151 GVariant *signal_variant;
20152 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
20153
20154 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
20155 for (l = connections; l != NULL; l = l->next)
20156 {
20157 GDBusConnection *connection = l->data;
20158 g_dbus_connection_emit_signal (connection,
20159 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Updated",
20160 signal_variant, NULL);
20161 }
20162 g_variant_unref (signal_variant);
20163 g_list_free_full (connections, g_object_unref);
20164}
20165
20166static void flash_skeleton_iface_init (FlashIface *iface);
20167#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20168G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
20169 G_ADD_PRIVATE (FlashSkeleton)
20170 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
20171
20172#else
20173G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
20174 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
20175
20176#endif
20177static void
20178flash_skeleton_finalize (GObject *object)
20179{
20180 FlashSkeleton *skeleton = FLASH_SKELETON (object);
20181 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
20182 if (skeleton->priv->changed_properties_idle_source != NULL)
20183 g_source_destroy (skeleton->priv->changed_properties_idle_source);
20184 g_main_context_unref (skeleton->priv->context);
20185 g_mutex_clear (&skeleton->priv->lock);
20186 G_OBJECT_CLASS (flash_skeleton_parent_class)->finalize (object);
20187}
20188
20189static void
20190flash_skeleton_init (FlashSkeleton *skeleton)
20191{
20192#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20193 skeleton->priv = flash_skeleton_get_instance_private (skeleton);
20194#else
20195 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_SKELETON, FlashSkeletonPrivate);
20196#endif
20197
20198 g_mutex_init (&skeleton->priv->lock);
20199 skeleton->priv->context = g_main_context_ref_thread_default ();
20200}
20201
20202static void
20203flash_skeleton_class_init (FlashSkeletonClass *klass)
20204{
20205 GObjectClass *gobject_class;
20206 GDBusInterfaceSkeletonClass *skeleton_class;
20207
20208 gobject_class = G_OBJECT_CLASS (klass);
20209 gobject_class->finalize = flash_skeleton_finalize;
20210
20211 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
20212 skeleton_class->get_info = flash_skeleton_dbus_interface_get_info;
20213 skeleton_class->get_properties = flash_skeleton_dbus_interface_get_properties;
20214 skeleton_class->flush = flash_skeleton_dbus_interface_flush;
20215 skeleton_class->get_vtable = flash_skeleton_dbus_interface_get_vtable;
20216
20217#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
20218 g_type_class_add_private (klass, sizeof (FlashSkeletonPrivate));
20219#endif
20220}
20221
20222static void
20223flash_skeleton_iface_init (FlashIface *iface)
20224{
20225 iface->updated = _flash_on_signal_updated;
20226}
20227
20228/**
20229 * flash_skeleton_new:
20230 *
20231 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
20232 *
20233 * Returns: (transfer full) (type FlashSkeleton): The skeleton object.
20234 */
20235Flash *
20236flash_skeleton_new (void)
20237{
20238 return FLASH (g_object_new (TYPE_FLASH_SKELETON, NULL));
20239}
20240
20241/* ------------------------------------------------------------------------
20242 * Code for interface org.openbmc.Button
20243 * ------------------------------------------------------------------------
20244 */
20245
20246/**
20247 * SECTION:Button
20248 * @title: Button
20249 * @short_description: Generated C code for the org.openbmc.Button D-Bus interface
20250 *
20251 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> D-Bus interface in C.
20252 */
20253
20254/* ---- Introspection data for org.openbmc.Button ---- */
20255
20256static const _ExtendedGDBusArgInfo _button_method_info_is_on_OUT_ARG_state =
20257{
20258 {
20259 -1,
20260 (gchar *) "state",
20261 (gchar *) "b",
20262 NULL
20263 },
20264 FALSE
20265};
20266
20267static const _ExtendedGDBusArgInfo * const _button_method_info_is_on_OUT_ARG_pointers[] =
20268{
20269 &_button_method_info_is_on_OUT_ARG_state,
20270 NULL
20271};
20272
20273static const _ExtendedGDBusMethodInfo _button_method_info_is_on =
20274{
20275 {
20276 -1,
20277 (gchar *) "isOn",
20278 NULL,
20279 (GDBusArgInfo **) &_button_method_info_is_on_OUT_ARG_pointers,
20280 NULL
20281 },
20282 "handle-is-on",
20283 FALSE
20284};
20285
20286static const _ExtendedGDBusMethodInfo _button_method_info_sim_button_press =
20287{
20288 {
20289 -1,
20290 (gchar *) "simButtonPress",
20291 NULL,
20292 NULL,
20293 NULL
20294 },
20295 "handle-sim-button-press",
20296 FALSE
20297};
20298
20299static const _ExtendedGDBusMethodInfo _button_method_info_sim_button_long_press =
20300{
20301 {
20302 -1,
20303 (gchar *) "simButtonLongPress",
20304 NULL,
20305 NULL,
20306 NULL
20307 },
20308 "handle-sim-button-long-press",
20309 FALSE
20310};
20311
20312static const _ExtendedGDBusMethodInfo * const _button_method_info_pointers[] =
20313{
20314 &_button_method_info_is_on,
20315 &_button_method_info_sim_button_press,
20316 &_button_method_info_sim_button_long_press,
20317 NULL
20318};
20319
20320static const _ExtendedGDBusSignalInfo _button_signal_info_button_release =
20321{
20322 {
20323 -1,
20324 (gchar *) "ButtonRelease",
20325 NULL,
20326 NULL
20327 },
20328 "button-release"
20329};
20330
20331static const _ExtendedGDBusSignalInfo _button_signal_info_button_pressed =
20332{
20333 {
20334 -1,
20335 (gchar *) "ButtonPressed",
20336 NULL,
20337 NULL
20338 },
20339 "button-pressed"
20340};
20341
20342static const _ExtendedGDBusSignalInfo _button_signal_info_button_pressed_long =
20343{
20344 {
20345 -1,
20346 (gchar *) "ButtonPressedLong",
20347 NULL,
20348 NULL
20349 },
20350 "button-pressed-long"
20351};
20352
20353static const _ExtendedGDBusSignalInfo * const _button_signal_info_pointers[] =
20354{
20355 &_button_signal_info_button_release,
20356 &_button_signal_info_button_pressed,
20357 &_button_signal_info_button_pressed_long,
20358 NULL
20359};
20360
20361static const _ExtendedGDBusPropertyInfo _button_property_info_state =
20362{
20363 {
20364 -1,
20365 (gchar *) "state",
20366 (gchar *) "b",
20367 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
20368 NULL
20369 },
20370 "state",
20371 FALSE
20372};
20373
20374static const _ExtendedGDBusPropertyInfo * const _button_property_info_pointers[] =
20375{
20376 &_button_property_info_state,
20377 NULL
20378};
20379
20380static const _ExtendedGDBusInterfaceInfo _button_interface_info =
20381{
20382 {
20383 -1,
20384 (gchar *) "org.openbmc.Button",
20385 (GDBusMethodInfo **) &_button_method_info_pointers,
20386 (GDBusSignalInfo **) &_button_signal_info_pointers,
20387 (GDBusPropertyInfo **) &_button_property_info_pointers,
20388 NULL
20389 },
20390 "button",
20391};
20392
20393
20394/**
20395 * button_interface_info:
20396 *
20397 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> D-Bus interface.
20398 *
20399 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
20400 */
20401GDBusInterfaceInfo *
20402button_interface_info (void)
20403{
20404 return (GDBusInterfaceInfo *) &_button_interface_info.parent_struct;
20405}
20406
20407/**
20408 * button_override_properties:
20409 * @klass: The class structure for a #GObject<!-- -->-derived class.
20410 * @property_id_begin: The property id to assign to the first overridden property.
20411 *
20412 * Overrides all #GObject properties in the #Button interface for a concrete class.
20413 * The properties are overridden in the order they are defined.
20414 *
20415 * Returns: The last property id.
20416 */
20417guint
20418button_override_properties (GObjectClass *klass, guint property_id_begin)
20419{
20420 g_object_class_override_property (klass, property_id_begin++, "state");
20421 return property_id_begin - 1;
20422}
20423
20424
20425
20426/**
20427 * Button:
20428 *
20429 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
20430 */
20431
20432/**
20433 * ButtonIface:
20434 * @parent_iface: The parent interface.
20435 * @handle_is_on: Handler for the #Button::handle-is-on signal.
20436 * @handle_sim_button_long_press: Handler for the #Button::handle-sim-button-long-press signal.
20437 * @handle_sim_button_press: Handler for the #Button::handle-sim-button-press signal.
20438 * @get_state: Getter for the #Button:state property.
20439 * @button_pressed: Handler for the #Button::button-pressed signal.
20440 * @button_pressed_long: Handler for the #Button::button-pressed-long signal.
20441 * @button_release: Handler for the #Button::button-release signal.
20442 *
20443 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
20444 */
20445
20446typedef ButtonIface ButtonInterface;
20447G_DEFINE_INTERFACE (Button, button, G_TYPE_OBJECT);
20448
20449static void
20450button_default_init (ButtonIface *iface)
20451{
20452 /* GObject signals for incoming D-Bus method calls: */
20453 /**
20454 * Button::handle-is-on:
20455 * @object: A #Button.
20456 * @invocation: A #GDBusMethodInvocation.
20457 *
20458 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method.
20459 *
20460 * 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 button_complete_is_on() 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.
20461 *
20462 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
20463 */
20464 g_signal_new ("handle-is-on",
20465 G_TYPE_FROM_INTERFACE (iface),
20466 G_SIGNAL_RUN_LAST,
20467 G_STRUCT_OFFSET (ButtonIface, handle_is_on),
20468 g_signal_accumulator_true_handled,
20469 NULL,
20470 g_cclosure_marshal_generic,
20471 G_TYPE_BOOLEAN,
20472 1,
20473 G_TYPE_DBUS_METHOD_INVOCATION);
20474
20475 /**
20476 * Button::handle-sim-button-press:
20477 * @object: A #Button.
20478 * @invocation: A #GDBusMethodInvocation.
20479 *
20480 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method.
20481 *
20482 * 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 button_complete_sim_button_press() 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.
20483 *
20484 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
20485 */
20486 g_signal_new ("handle-sim-button-press",
20487 G_TYPE_FROM_INTERFACE (iface),
20488 G_SIGNAL_RUN_LAST,
20489 G_STRUCT_OFFSET (ButtonIface, handle_sim_button_press),
20490 g_signal_accumulator_true_handled,
20491 NULL,
20492 g_cclosure_marshal_generic,
20493 G_TYPE_BOOLEAN,
20494 1,
20495 G_TYPE_DBUS_METHOD_INVOCATION);
20496
20497 /**
20498 * Button::handle-sim-button-long-press:
20499 * @object: A #Button.
20500 * @invocation: A #GDBusMethodInvocation.
20501 *
20502 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method.
20503 *
20504 * 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 button_complete_sim_button_long_press() 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.
20505 *
20506 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
20507 */
20508 g_signal_new ("handle-sim-button-long-press",
20509 G_TYPE_FROM_INTERFACE (iface),
20510 G_SIGNAL_RUN_LAST,
20511 G_STRUCT_OFFSET (ButtonIface, handle_sim_button_long_press),
20512 g_signal_accumulator_true_handled,
20513 NULL,
20514 g_cclosure_marshal_generic,
20515 G_TYPE_BOOLEAN,
20516 1,
20517 G_TYPE_DBUS_METHOD_INVOCATION);
20518
20519 /* GObject signals for received D-Bus signals: */
20520 /**
20521 * Button::button-release:
20522 * @object: A #Button.
20523 *
20524 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Button.ButtonRelease">"ButtonRelease"</link> is received.
20525 *
20526 * 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.
20527 */
20528 g_signal_new ("button-release",
20529 G_TYPE_FROM_INTERFACE (iface),
20530 G_SIGNAL_RUN_LAST,
20531 G_STRUCT_OFFSET (ButtonIface, button_release),
20532 NULL,
20533 NULL,
20534 g_cclosure_marshal_generic,
20535 G_TYPE_NONE,
20536 0);
20537
20538 /**
20539 * Button::button-pressed:
20540 * @object: A #Button.
20541 *
20542 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressed">"ButtonPressed"</link> is received.
20543 *
20544 * 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.
20545 */
20546 g_signal_new ("button-pressed",
20547 G_TYPE_FROM_INTERFACE (iface),
20548 G_SIGNAL_RUN_LAST,
20549 G_STRUCT_OFFSET (ButtonIface, button_pressed),
20550 NULL,
20551 NULL,
20552 g_cclosure_marshal_generic,
20553 G_TYPE_NONE,
20554 0);
20555
20556 /**
20557 * Button::button-pressed-long:
20558 * @object: A #Button.
20559 *
20560 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressedLong">"ButtonPressedLong"</link> is received.
20561 *
20562 * 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.
20563 */
20564 g_signal_new ("button-pressed-long",
20565 G_TYPE_FROM_INTERFACE (iface),
20566 G_SIGNAL_RUN_LAST,
20567 G_STRUCT_OFFSET (ButtonIface, button_pressed_long),
20568 NULL,
20569 NULL,
20570 g_cclosure_marshal_generic,
20571 G_TYPE_NONE,
20572 0);
20573
20574 /* GObject properties for D-Bus properties: */
20575 /**
20576 * Button:state:
20577 *
20578 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link>.
20579 *
20580 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
20581 */
20582 g_object_interface_install_property (iface,
20583 g_param_spec_boolean ("state", "state", "state", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
20584}
20585
20586/**
20587 * button_get_state: (skip)
20588 * @object: A #Button.
20589 *
20590 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property.
20591 *
20592 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
20593 *
20594 * Returns: The property value.
20595 */
20596gboolean
20597button_get_state (Button *object)
20598{
20599 return BUTTON_GET_IFACE (object)->get_state (object);
20600}
20601
20602/**
20603 * button_set_state: (skip)
20604 * @object: A #Button.
20605 * @value: The value to set.
20606 *
20607 * Sets the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property to @value.
20608 *
20609 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
20610 */
20611void
20612button_set_state (Button *object, gboolean value)
20613{
20614 g_object_set (G_OBJECT (object), "state", value, NULL);
20615}
20616
20617/**
20618 * button_emit_button_release:
20619 * @object: A #Button.
20620 *
20621 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonRelease">"ButtonRelease"</link> D-Bus signal.
20622 */
20623void
20624button_emit_button_release (
20625 Button *object)
20626{
20627 g_signal_emit_by_name (object, "button-release");
20628}
20629
20630/**
20631 * button_emit_button_pressed:
20632 * @object: A #Button.
20633 *
20634 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressed">"ButtonPressed"</link> D-Bus signal.
20635 */
20636void
20637button_emit_button_pressed (
20638 Button *object)
20639{
20640 g_signal_emit_by_name (object, "button-pressed");
20641}
20642
20643/**
20644 * button_emit_button_pressed_long:
20645 * @object: A #Button.
20646 *
20647 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressedLong">"ButtonPressedLong"</link> D-Bus signal.
20648 */
20649void
20650button_emit_button_pressed_long (
20651 Button *object)
20652{
20653 g_signal_emit_by_name (object, "button-pressed-long");
20654}
20655
20656/**
20657 * button_call_is_on:
20658 * @proxy: A #ButtonProxy.
20659 * @cancellable: (allow-none): A #GCancellable or %NULL.
20660 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
20661 * @user_data: User data to pass to @callback.
20662 *
20663 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method on @proxy.
20664 * 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.
20665 * You can then call button_call_is_on_finish() to get the result of the operation.
20666 *
20667 * See button_call_is_on_sync() for the synchronous, blocking version of this method.
20668 */
20669void
20670button_call_is_on (
20671 Button *proxy,
20672 GCancellable *cancellable,
20673 GAsyncReadyCallback callback,
20674 gpointer user_data)
20675{
20676 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
20677 "isOn",
20678 g_variant_new ("()"),
20679 G_DBUS_CALL_FLAGS_NONE,
20680 -1,
20681 cancellable,
20682 callback,
20683 user_data);
20684}
20685
20686/**
20687 * button_call_is_on_finish:
20688 * @proxy: A #ButtonProxy.
20689 * @out_state: (out): Return location for return parameter or %NULL to ignore.
20690 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_is_on().
20691 * @error: Return location for error or %NULL.
20692 *
20693 * Finishes an operation started with button_call_is_on().
20694 *
20695 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20696 */
20697gboolean
20698button_call_is_on_finish (
20699 Button *proxy,
20700 gboolean *out_state,
20701 GAsyncResult *res,
20702 GError **error)
20703{
20704 GVariant *_ret;
20705 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
20706 if (_ret == NULL)
20707 goto _out;
20708 g_variant_get (_ret,
20709 "(b)",
20710 out_state);
20711 g_variant_unref (_ret);
20712_out:
20713 return _ret != NULL;
20714}
20715
20716/**
20717 * button_call_is_on_sync:
20718 * @proxy: A #ButtonProxy.
20719 * @out_state: (out): Return location for return parameter or %NULL to ignore.
20720 * @cancellable: (allow-none): A #GCancellable or %NULL.
20721 * @error: Return location for error or %NULL.
20722 *
20723 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
20724 *
20725 * See button_call_is_on() for the asynchronous version of this method.
20726 *
20727 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20728 */
20729gboolean
20730button_call_is_on_sync (
20731 Button *proxy,
20732 gboolean *out_state,
20733 GCancellable *cancellable,
20734 GError **error)
20735{
20736 GVariant *_ret;
20737 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
20738 "isOn",
20739 g_variant_new ("()"),
20740 G_DBUS_CALL_FLAGS_NONE,
20741 -1,
20742 cancellable,
20743 error);
20744 if (_ret == NULL)
20745 goto _out;
20746 g_variant_get (_ret,
20747 "(b)",
20748 out_state);
20749 g_variant_unref (_ret);
20750_out:
20751 return _ret != NULL;
20752}
20753
20754/**
20755 * button_call_sim_button_press:
20756 * @proxy: A #ButtonProxy.
20757 * @cancellable: (allow-none): A #GCancellable or %NULL.
20758 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
20759 * @user_data: User data to pass to @callback.
20760 *
20761 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method on @proxy.
20762 * 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.
20763 * You can then call button_call_sim_button_press_finish() to get the result of the operation.
20764 *
20765 * See button_call_sim_button_press_sync() for the synchronous, blocking version of this method.
20766 */
20767void
20768button_call_sim_button_press (
20769 Button *proxy,
20770 GCancellable *cancellable,
20771 GAsyncReadyCallback callback,
20772 gpointer user_data)
20773{
20774 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
20775 "simButtonPress",
20776 g_variant_new ("()"),
20777 G_DBUS_CALL_FLAGS_NONE,
20778 -1,
20779 cancellable,
20780 callback,
20781 user_data);
20782}
20783
20784/**
20785 * button_call_sim_button_press_finish:
20786 * @proxy: A #ButtonProxy.
20787 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_button_press().
20788 * @error: Return location for error or %NULL.
20789 *
20790 * Finishes an operation started with button_call_sim_button_press().
20791 *
20792 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20793 */
20794gboolean
20795button_call_sim_button_press_finish (
20796 Button *proxy,
20797 GAsyncResult *res,
20798 GError **error)
20799{
20800 GVariant *_ret;
20801 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
20802 if (_ret == NULL)
20803 goto _out;
20804 g_variant_get (_ret,
20805 "()");
20806 g_variant_unref (_ret);
20807_out:
20808 return _ret != NULL;
20809}
20810
20811/**
20812 * button_call_sim_button_press_sync:
20813 * @proxy: A #ButtonProxy.
20814 * @cancellable: (allow-none): A #GCancellable or %NULL.
20815 * @error: Return location for error or %NULL.
20816 *
20817 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
20818 *
20819 * See button_call_sim_button_press() for the asynchronous version of this method.
20820 *
20821 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20822 */
20823gboolean
20824button_call_sim_button_press_sync (
20825 Button *proxy,
20826 GCancellable *cancellable,
20827 GError **error)
20828{
20829 GVariant *_ret;
20830 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
20831 "simButtonPress",
20832 g_variant_new ("()"),
20833 G_DBUS_CALL_FLAGS_NONE,
20834 -1,
20835 cancellable,
20836 error);
20837 if (_ret == NULL)
20838 goto _out;
20839 g_variant_get (_ret,
20840 "()");
20841 g_variant_unref (_ret);
20842_out:
20843 return _ret != NULL;
20844}
20845
20846/**
20847 * button_call_sim_button_long_press:
20848 * @proxy: A #ButtonProxy.
20849 * @cancellable: (allow-none): A #GCancellable or %NULL.
20850 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
20851 * @user_data: User data to pass to @callback.
20852 *
20853 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method on @proxy.
20854 * 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.
20855 * You can then call button_call_sim_button_long_press_finish() to get the result of the operation.
20856 *
20857 * See button_call_sim_button_long_press_sync() for the synchronous, blocking version of this method.
20858 */
20859void
20860button_call_sim_button_long_press (
20861 Button *proxy,
20862 GCancellable *cancellable,
20863 GAsyncReadyCallback callback,
20864 gpointer user_data)
20865{
20866 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
20867 "simButtonLongPress",
20868 g_variant_new ("()"),
20869 G_DBUS_CALL_FLAGS_NONE,
20870 -1,
20871 cancellable,
20872 callback,
20873 user_data);
20874}
20875
20876/**
20877 * button_call_sim_button_long_press_finish:
20878 * @proxy: A #ButtonProxy.
20879 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_button_long_press().
20880 * @error: Return location for error or %NULL.
20881 *
20882 * Finishes an operation started with button_call_sim_button_long_press().
20883 *
20884 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20885 */
20886gboolean
20887button_call_sim_button_long_press_finish (
20888 Button *proxy,
20889 GAsyncResult *res,
20890 GError **error)
20891{
20892 GVariant *_ret;
20893 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
20894 if (_ret == NULL)
20895 goto _out;
20896 g_variant_get (_ret,
20897 "()");
20898 g_variant_unref (_ret);
20899_out:
20900 return _ret != NULL;
20901}
20902
20903/**
20904 * button_call_sim_button_long_press_sync:
20905 * @proxy: A #ButtonProxy.
20906 * @cancellable: (allow-none): A #GCancellable or %NULL.
20907 * @error: Return location for error or %NULL.
20908 *
20909 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
20910 *
20911 * See button_call_sim_button_long_press() for the asynchronous version of this method.
20912 *
20913 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20914 */
20915gboolean
20916button_call_sim_button_long_press_sync (
20917 Button *proxy,
20918 GCancellable *cancellable,
20919 GError **error)
20920{
20921 GVariant *_ret;
20922 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
20923 "simButtonLongPress",
20924 g_variant_new ("()"),
20925 G_DBUS_CALL_FLAGS_NONE,
20926 -1,
20927 cancellable,
20928 error);
20929 if (_ret == NULL)
20930 goto _out;
20931 g_variant_get (_ret,
20932 "()");
20933 g_variant_unref (_ret);
20934_out:
20935 return _ret != NULL;
20936}
20937
20938/**
20939 * button_complete_is_on:
20940 * @object: A #Button.
20941 * @invocation: (transfer full): A #GDBusMethodInvocation.
20942 * @state: Parameter to return.
20943 *
20944 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</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.
20945 *
20946 * This method will free @invocation, you cannot use it afterwards.
20947 */
20948void
20949button_complete_is_on (
20950 Button *object,
20951 GDBusMethodInvocation *invocation,
20952 gboolean state)
20953{
20954 g_dbus_method_invocation_return_value (invocation,
20955 g_variant_new ("(b)",
20956 state));
20957}
20958
20959/**
20960 * button_complete_sim_button_press:
20961 * @object: A #Button.
20962 * @invocation: (transfer full): A #GDBusMethodInvocation.
20963 *
20964 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</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.
20965 *
20966 * This method will free @invocation, you cannot use it afterwards.
20967 */
20968void
20969button_complete_sim_button_press (
20970 Button *object,
20971 GDBusMethodInvocation *invocation)
20972{
20973 g_dbus_method_invocation_return_value (invocation,
20974 g_variant_new ("()"));
20975}
20976
20977/**
20978 * button_complete_sim_button_long_press:
20979 * @object: A #Button.
20980 * @invocation: (transfer full): A #GDBusMethodInvocation.
20981 *
20982 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</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.
20983 *
20984 * This method will free @invocation, you cannot use it afterwards.
20985 */
20986void
20987button_complete_sim_button_long_press (
20988 Button *object,
20989 GDBusMethodInvocation *invocation)
20990{
20991 g_dbus_method_invocation_return_value (invocation,
20992 g_variant_new ("()"));
20993}
20994
20995/* ------------------------------------------------------------------------ */
20996
20997/**
20998 * ButtonProxy:
20999 *
21000 * The #ButtonProxy structure contains only private data and should only be accessed using the provided API.
21001 */
21002
21003/**
21004 * ButtonProxyClass:
21005 * @parent_class: The parent class.
21006 *
21007 * Class structure for #ButtonProxy.
21008 */
21009
21010struct _ButtonProxyPrivate
21011{
21012 GData *qdata;
21013};
21014
21015static void button_proxy_iface_init (ButtonIface *iface);
21016
21017#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21018G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
21019 G_ADD_PRIVATE (ButtonProxy)
21020 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
21021
21022#else
21023G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
21024 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
21025
21026#endif
21027static void
21028button_proxy_finalize (GObject *object)
21029{
21030 ButtonProxy *proxy = BUTTON_PROXY (object);
21031 g_datalist_clear (&proxy->priv->qdata);
21032 G_OBJECT_CLASS (button_proxy_parent_class)->finalize (object);
21033}
21034
21035static void
21036button_proxy_get_property (GObject *object,
21037 guint prop_id,
21038 GValue *value,
21039 GParamSpec *pspec G_GNUC_UNUSED)
21040{
21041 const _ExtendedGDBusPropertyInfo *info;
21042 GVariant *variant;
21043 g_assert (prop_id != 0 && prop_id - 1 < 1);
21044 info = _button_property_info_pointers[prop_id - 1];
21045 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
21046 if (info->use_gvariant)
21047 {
21048 g_value_set_variant (value, variant);
21049 }
21050 else
21051 {
21052 if (variant != NULL)
21053 g_dbus_gvariant_to_gvalue (variant, value);
21054 }
21055 if (variant != NULL)
21056 g_variant_unref (variant);
21057}
21058
21059static void
21060button_proxy_set_property_cb (GDBusProxy *proxy,
21061 GAsyncResult *res,
21062 gpointer user_data)
21063{
21064 const _ExtendedGDBusPropertyInfo *info = user_data;
21065 GError *error;
21066 GVariant *_ret;
21067 error = NULL;
21068 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
21069 if (!_ret)
21070 {
21071 g_warning ("Error setting property '%s' on interface org.openbmc.Button: %s (%s, %d)",
21072 info->parent_struct.name,
21073 error->message, g_quark_to_string (error->domain), error->code);
21074 g_error_free (error);
21075 }
21076 else
21077 {
21078 g_variant_unref (_ret);
21079 }
21080}
21081
21082static void
21083button_proxy_set_property (GObject *object,
21084 guint prop_id,
21085 const GValue *value,
21086 GParamSpec *pspec G_GNUC_UNUSED)
21087{
21088 const _ExtendedGDBusPropertyInfo *info;
21089 GVariant *variant;
21090 g_assert (prop_id != 0 && prop_id - 1 < 1);
21091 info = _button_property_info_pointers[prop_id - 1];
21092 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
21093 g_dbus_proxy_call (G_DBUS_PROXY (object),
21094 "org.freedesktop.DBus.Properties.Set",
21095 g_variant_new ("(ssv)", "org.openbmc.Button", info->parent_struct.name, variant),
21096 G_DBUS_CALL_FLAGS_NONE,
21097 -1,
21098 NULL, (GAsyncReadyCallback) button_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
21099 g_variant_unref (variant);
21100}
21101
21102static void
21103button_proxy_g_signal (GDBusProxy *proxy,
21104 const gchar *sender_name G_GNUC_UNUSED,
21105 const gchar *signal_name,
21106 GVariant *parameters)
21107{
21108 _ExtendedGDBusSignalInfo *info;
21109 GVariantIter iter;
21110 GVariant *child;
21111 GValue *paramv;
21112 guint num_params;
21113 guint n;
21114 guint signal_id;
21115 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, signal_name);
21116 if (info == NULL)
21117 return;
21118 num_params = g_variant_n_children (parameters);
21119 paramv = g_new0 (GValue, num_params + 1);
21120 g_value_init (&paramv[0], TYPE_BUTTON);
21121 g_value_set_object (&paramv[0], proxy);
21122 g_variant_iter_init (&iter, parameters);
21123 n = 1;
21124 while ((child = g_variant_iter_next_value (&iter)) != NULL)
21125 {
21126 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
21127 if (arg_info->use_gvariant)
21128 {
21129 g_value_init (&paramv[n], G_TYPE_VARIANT);
21130 g_value_set_variant (&paramv[n], child);
21131 n++;
21132 }
21133 else
21134 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
21135 g_variant_unref (child);
21136 }
21137 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
21138 g_signal_emitv (paramv, signal_id, 0, NULL);
21139 for (n = 0; n < num_params + 1; n++)
21140 g_value_unset (&paramv[n]);
21141 g_free (paramv);
21142}
21143
21144static void
21145button_proxy_g_properties_changed (GDBusProxy *_proxy,
21146 GVariant *changed_properties,
21147 const gchar *const *invalidated_properties)
21148{
21149 ButtonProxy *proxy = BUTTON_PROXY (_proxy);
21150 guint n;
21151 const gchar *key;
21152 GVariantIter *iter;
21153 _ExtendedGDBusPropertyInfo *info;
21154 g_variant_get (changed_properties, "a{sv}", &iter);
21155 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
21156 {
21157 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, key);
21158 g_datalist_remove_data (&proxy->priv->qdata, key);
21159 if (info != NULL)
21160 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
21161 }
21162 g_variant_iter_free (iter);
21163 for (n = 0; invalidated_properties[n] != NULL; n++)
21164 {
21165 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, invalidated_properties[n]);
21166 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
21167 if (info != NULL)
21168 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
21169 }
21170}
21171
21172static gboolean
21173button_proxy_get_state (Button *object)
21174{
21175 ButtonProxy *proxy = BUTTON_PROXY (object);
21176 GVariant *variant;
21177 gboolean value = 0;
21178 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
21179 if (variant != NULL)
21180 {
21181 value = g_variant_get_boolean (variant);
21182 g_variant_unref (variant);
21183 }
21184 return value;
21185}
21186
21187static void
21188button_proxy_init (ButtonProxy *proxy)
21189{
21190#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21191 proxy->priv = button_proxy_get_instance_private (proxy);
21192#else
21193 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_BUTTON_PROXY, ButtonProxyPrivate);
21194#endif
21195
21196 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), button_interface_info ());
21197}
21198
21199static void
21200button_proxy_class_init (ButtonProxyClass *klass)
21201{
21202 GObjectClass *gobject_class;
21203 GDBusProxyClass *proxy_class;
21204
21205 gobject_class = G_OBJECT_CLASS (klass);
21206 gobject_class->finalize = button_proxy_finalize;
21207 gobject_class->get_property = button_proxy_get_property;
21208 gobject_class->set_property = button_proxy_set_property;
21209
21210 proxy_class = G_DBUS_PROXY_CLASS (klass);
21211 proxy_class->g_signal = button_proxy_g_signal;
21212 proxy_class->g_properties_changed = button_proxy_g_properties_changed;
21213
21214 button_override_properties (gobject_class, 1);
21215
21216#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
21217 g_type_class_add_private (klass, sizeof (ButtonProxyPrivate));
21218#endif
21219}
21220
21221static void
21222button_proxy_iface_init (ButtonIface *iface)
21223{
21224 iface->get_state = button_proxy_get_state;
21225}
21226
21227/**
21228 * button_proxy_new:
21229 * @connection: A #GDBusConnection.
21230 * @flags: Flags from the #GDBusProxyFlags enumeration.
21231 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
21232 * @object_path: An object path.
21233 * @cancellable: (allow-none): A #GCancellable or %NULL.
21234 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
21235 * @user_data: User data to pass to @callback.
21236 *
21237 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>. See g_dbus_proxy_new() for more details.
21238 *
21239 * 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.
21240 * You can then call button_proxy_new_finish() to get the result of the operation.
21241 *
21242 * See button_proxy_new_sync() for the synchronous, blocking version of this constructor.
21243 */
21244void
21245button_proxy_new (
21246 GDBusConnection *connection,
21247 GDBusProxyFlags flags,
21248 const gchar *name,
21249 const gchar *object_path,
21250 GCancellable *cancellable,
21251 GAsyncReadyCallback callback,
21252 gpointer user_data)
21253{
21254 g_async_initable_new_async (TYPE_BUTTON_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.Button", NULL);
21255}
21256
21257/**
21258 * button_proxy_new_finish:
21259 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new().
21260 * @error: Return location for error or %NULL
21261 *
21262 * Finishes an operation started with button_proxy_new().
21263 *
21264 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
21265 */
21266Button *
21267button_proxy_new_finish (
21268 GAsyncResult *res,
21269 GError **error)
21270{
21271 GObject *ret;
21272 GObject *source_object;
21273 source_object = g_async_result_get_source_object (res);
21274 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
21275 g_object_unref (source_object);
21276 if (ret != NULL)
21277 return BUTTON (ret);
21278 else
21279 return NULL;
21280}
21281
21282/**
21283 * button_proxy_new_sync:
21284 * @connection: A #GDBusConnection.
21285 * @flags: Flags from the #GDBusProxyFlags enumeration.
21286 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
21287 * @object_path: An object path.
21288 * @cancellable: (allow-none): A #GCancellable or %NULL.
21289 * @error: Return location for error or %NULL
21290 *
21291 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>. See g_dbus_proxy_new_sync() for more details.
21292 *
21293 * The calling thread is blocked until a reply is received.
21294 *
21295 * See button_proxy_new() for the asynchronous version of this constructor.
21296 *
21297 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
21298 */
21299Button *
21300button_proxy_new_sync (
21301 GDBusConnection *connection,
21302 GDBusProxyFlags flags,
21303 const gchar *name,
21304 const gchar *object_path,
21305 GCancellable *cancellable,
21306 GError **error)
21307{
21308 GInitable *ret;
21309 ret = g_initable_new (TYPE_BUTTON_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Button", NULL);
21310 if (ret != NULL)
21311 return BUTTON (ret);
21312 else
21313 return NULL;
21314}
21315
21316
21317/**
21318 * button_proxy_new_for_bus:
21319 * @bus_type: A #GBusType.
21320 * @flags: Flags from the #GDBusProxyFlags enumeration.
21321 * @name: A bus name (well-known or unique).
21322 * @object_path: An object path.
21323 * @cancellable: (allow-none): A #GCancellable or %NULL.
21324 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
21325 * @user_data: User data to pass to @callback.
21326 *
21327 * Like button_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
21328 *
21329 * 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.
21330 * You can then call button_proxy_new_for_bus_finish() to get the result of the operation.
21331 *
21332 * See button_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
21333 */
21334void
21335button_proxy_new_for_bus (
21336 GBusType bus_type,
21337 GDBusProxyFlags flags,
21338 const gchar *name,
21339 const gchar *object_path,
21340 GCancellable *cancellable,
21341 GAsyncReadyCallback callback,
21342 gpointer user_data)
21343{
21344 g_async_initable_new_async (TYPE_BUTTON_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.Button", NULL);
21345}
21346
21347/**
21348 * button_proxy_new_for_bus_finish:
21349 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new_for_bus().
21350 * @error: Return location for error or %NULL
21351 *
21352 * Finishes an operation started with button_proxy_new_for_bus().
21353 *
21354 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
21355 */
21356Button *
21357button_proxy_new_for_bus_finish (
21358 GAsyncResult *res,
21359 GError **error)
21360{
21361 GObject *ret;
21362 GObject *source_object;
21363 source_object = g_async_result_get_source_object (res);
21364 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
21365 g_object_unref (source_object);
21366 if (ret != NULL)
21367 return BUTTON (ret);
21368 else
21369 return NULL;
21370}
21371
21372/**
21373 * button_proxy_new_for_bus_sync:
21374 * @bus_type: A #GBusType.
21375 * @flags: Flags from the #GDBusProxyFlags enumeration.
21376 * @name: A bus name (well-known or unique).
21377 * @object_path: An object path.
21378 * @cancellable: (allow-none): A #GCancellable or %NULL.
21379 * @error: Return location for error or %NULL
21380 *
21381 * Like button_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
21382 *
21383 * The calling thread is blocked until a reply is received.
21384 *
21385 * See button_proxy_new_for_bus() for the asynchronous version of this constructor.
21386 *
21387 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
21388 */
21389Button *
21390button_proxy_new_for_bus_sync (
21391 GBusType bus_type,
21392 GDBusProxyFlags flags,
21393 const gchar *name,
21394 const gchar *object_path,
21395 GCancellable *cancellable,
21396 GError **error)
21397{
21398 GInitable *ret;
21399 ret = g_initable_new (TYPE_BUTTON_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Button", NULL);
21400 if (ret != NULL)
21401 return BUTTON (ret);
21402 else
21403 return NULL;
21404}
21405
21406
21407/* ------------------------------------------------------------------------ */
21408
21409/**
21410 * ButtonSkeleton:
21411 *
21412 * The #ButtonSkeleton structure contains only private data and should only be accessed using the provided API.
21413 */
21414
21415/**
21416 * ButtonSkeletonClass:
21417 * @parent_class: The parent class.
21418 *
21419 * Class structure for #ButtonSkeleton.
21420 */
21421
21422struct _ButtonSkeletonPrivate
21423{
21424 GValue *properties;
21425 GList *changed_properties;
21426 GSource *changed_properties_idle_source;
21427 GMainContext *context;
21428 GMutex lock;
21429};
21430
21431static void
21432_button_skeleton_handle_method_call (
21433 GDBusConnection *connection G_GNUC_UNUSED,
21434 const gchar *sender G_GNUC_UNUSED,
21435 const gchar *object_path G_GNUC_UNUSED,
21436 const gchar *interface_name,
21437 const gchar *method_name,
21438 GVariant *parameters,
21439 GDBusMethodInvocation *invocation,
21440 gpointer user_data)
21441{
21442 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
21443 _ExtendedGDBusMethodInfo *info;
21444 GVariantIter iter;
21445 GVariant *child;
21446 GValue *paramv;
21447 guint num_params;
21448 guint num_extra;
21449 guint n;
21450 guint signal_id;
21451 GValue return_value = G_VALUE_INIT;
21452 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
21453 g_assert (info != NULL);
21454 num_params = g_variant_n_children (parameters);
21455 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
21456 n = 0;
21457 g_value_init (&paramv[n], TYPE_BUTTON);
21458 g_value_set_object (&paramv[n++], skeleton);
21459 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
21460 g_value_set_object (&paramv[n++], invocation);
21461 if (info->pass_fdlist)
21462 {
21463#ifdef G_OS_UNIX
21464 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
21465 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
21466#else
21467 g_assert_not_reached ();
21468#endif
21469 }
21470 g_variant_iter_init (&iter, parameters);
21471 while ((child = g_variant_iter_next_value (&iter)) != NULL)
21472 {
21473 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
21474 if (arg_info->use_gvariant)
21475 {
21476 g_value_init (&paramv[n], G_TYPE_VARIANT);
21477 g_value_set_variant (&paramv[n], child);
21478 n++;
21479 }
21480 else
21481 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
21482 g_variant_unref (child);
21483 }
21484 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
21485 g_value_init (&return_value, G_TYPE_BOOLEAN);
21486 g_signal_emitv (paramv, signal_id, 0, &return_value);
21487 if (!g_value_get_boolean (&return_value))
21488 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);
21489 g_value_unset (&return_value);
21490 for (n = 0; n < num_params + num_extra; n++)
21491 g_value_unset (&paramv[n]);
21492 g_free (paramv);
21493}
21494
21495static GVariant *
21496_button_skeleton_handle_get_property (
21497 GDBusConnection *connection G_GNUC_UNUSED,
21498 const gchar *sender G_GNUC_UNUSED,
21499 const gchar *object_path G_GNUC_UNUSED,
21500 const gchar *interface_name G_GNUC_UNUSED,
21501 const gchar *property_name,
21502 GError **error,
21503 gpointer user_data)
21504{
21505 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
21506 GValue value = G_VALUE_INIT;
21507 GParamSpec *pspec;
21508 _ExtendedGDBusPropertyInfo *info;
21509 GVariant *ret;
21510 ret = NULL;
21511 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
21512 g_assert (info != NULL);
21513 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
21514 if (pspec == NULL)
21515 {
21516 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
21517 }
21518 else
21519 {
21520 g_value_init (&value, pspec->value_type);
21521 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
21522 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
21523 g_value_unset (&value);
21524 }
21525 return ret;
21526}
21527
21528static gboolean
21529_button_skeleton_handle_set_property (
21530 GDBusConnection *connection G_GNUC_UNUSED,
21531 const gchar *sender G_GNUC_UNUSED,
21532 const gchar *object_path G_GNUC_UNUSED,
21533 const gchar *interface_name G_GNUC_UNUSED,
21534 const gchar *property_name,
21535 GVariant *variant,
21536 GError **error,
21537 gpointer user_data)
21538{
21539 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
21540 GValue value = G_VALUE_INIT;
21541 GParamSpec *pspec;
21542 _ExtendedGDBusPropertyInfo *info;
21543 gboolean ret;
21544 ret = FALSE;
21545 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
21546 g_assert (info != NULL);
21547 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
21548 if (pspec == NULL)
21549 {
21550 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
21551 }
21552 else
21553 {
21554 if (info->use_gvariant)
21555 g_value_set_variant (&value, variant);
21556 else
21557 g_dbus_gvariant_to_gvalue (variant, &value);
21558 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
21559 g_value_unset (&value);
21560 ret = TRUE;
21561 }
21562 return ret;
21563}
21564
21565static const GDBusInterfaceVTable _button_skeleton_vtable =
21566{
21567 _button_skeleton_handle_method_call,
21568 _button_skeleton_handle_get_property,
21569 _button_skeleton_handle_set_property,
21570 {NULL}
21571};
21572
21573static GDBusInterfaceInfo *
21574button_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
21575{
21576 return button_interface_info ();
21577}
21578
21579static GDBusInterfaceVTable *
21580button_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
21581{
21582 return (GDBusInterfaceVTable *) &_button_skeleton_vtable;
21583}
21584
21585static GVariant *
21586button_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
21587{
21588 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
21589
21590 GVariantBuilder builder;
21591 guint n;
21592 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
21593 if (_button_interface_info.parent_struct.properties == NULL)
21594 goto out;
21595 for (n = 0; _button_interface_info.parent_struct.properties[n] != NULL; n++)
21596 {
21597 GDBusPropertyInfo *info = _button_interface_info.parent_struct.properties[n];
21598 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
21599 {
21600 GVariant *value;
21601 value = _button_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.Button", info->name, NULL, skeleton);
21602 if (value != NULL)
21603 {
21604 g_variant_take_ref (value);
21605 g_variant_builder_add (&builder, "{sv}", info->name, value);
21606 g_variant_unref (value);
21607 }
21608 }
21609 }
21610out:
21611 return g_variant_builder_end (&builder);
21612}
21613
21614static gboolean _button_emit_changed (gpointer user_data);
21615
21616static void
21617button_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
21618{
21619 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
21620 gboolean emit_changed = FALSE;
21621
21622 g_mutex_lock (&skeleton->priv->lock);
21623 if (skeleton->priv->changed_properties_idle_source != NULL)
21624 {
21625 g_source_destroy (skeleton->priv->changed_properties_idle_source);
21626 skeleton->priv->changed_properties_idle_source = NULL;
21627 emit_changed = TRUE;
21628 }
21629 g_mutex_unlock (&skeleton->priv->lock);
21630
21631 if (emit_changed)
21632 _button_emit_changed (skeleton);
21633}
21634
21635static void
21636_button_on_signal_button_release (
21637 Button *object)
21638{
21639 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21640
21641 GList *connections, *l;
21642 GVariant *signal_variant;
21643 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
21644
21645 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
21646 for (l = connections; l != NULL; l = l->next)
21647 {
21648 GDBusConnection *connection = l->data;
21649 g_dbus_connection_emit_signal (connection,
21650 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonRelease",
21651 signal_variant, NULL);
21652 }
21653 g_variant_unref (signal_variant);
21654 g_list_free_full (connections, g_object_unref);
21655}
21656
21657static void
21658_button_on_signal_button_pressed (
21659 Button *object)
21660{
21661 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21662
21663 GList *connections, *l;
21664 GVariant *signal_variant;
21665 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
21666
21667 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
21668 for (l = connections; l != NULL; l = l->next)
21669 {
21670 GDBusConnection *connection = l->data;
21671 g_dbus_connection_emit_signal (connection,
21672 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonPressed",
21673 signal_variant, NULL);
21674 }
21675 g_variant_unref (signal_variant);
21676 g_list_free_full (connections, g_object_unref);
21677}
21678
21679static void
21680_button_on_signal_button_pressed_long (
21681 Button *object)
21682{
21683 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21684
21685 GList *connections, *l;
21686 GVariant *signal_variant;
21687 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
21688
21689 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
21690 for (l = connections; l != NULL; l = l->next)
21691 {
21692 GDBusConnection *connection = l->data;
21693 g_dbus_connection_emit_signal (connection,
21694 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonPressedLong",
21695 signal_variant, NULL);
21696 }
21697 g_variant_unref (signal_variant);
21698 g_list_free_full (connections, g_object_unref);
21699}
21700
21701static void button_skeleton_iface_init (ButtonIface *iface);
21702#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21703G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
21704 G_ADD_PRIVATE (ButtonSkeleton)
21705 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
21706
21707#else
21708G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
21709 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
21710
21711#endif
21712static void
21713button_skeleton_finalize (GObject *object)
21714{
21715 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21716 guint n;
21717 for (n = 0; n < 1; n++)
21718 g_value_unset (&skeleton->priv->properties[n]);
21719 g_free (skeleton->priv->properties);
21720 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
21721 if (skeleton->priv->changed_properties_idle_source != NULL)
21722 g_source_destroy (skeleton->priv->changed_properties_idle_source);
21723 g_main_context_unref (skeleton->priv->context);
21724 g_mutex_clear (&skeleton->priv->lock);
21725 G_OBJECT_CLASS (button_skeleton_parent_class)->finalize (object);
21726}
21727
21728static void
21729button_skeleton_get_property (GObject *object,
21730 guint prop_id,
21731 GValue *value,
21732 GParamSpec *pspec G_GNUC_UNUSED)
21733{
21734 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21735 g_assert (prop_id != 0 && prop_id - 1 < 1);
21736 g_mutex_lock (&skeleton->priv->lock);
21737 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
21738 g_mutex_unlock (&skeleton->priv->lock);
21739}
21740
21741static gboolean
21742_button_emit_changed (gpointer user_data)
21743{
21744 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
21745 GList *l;
21746 GVariantBuilder builder;
21747 GVariantBuilder invalidated_builder;
21748 guint num_changes;
21749
21750 g_mutex_lock (&skeleton->priv->lock);
21751 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
21752 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
21753 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
21754 {
21755 ChangedProperty *cp = l->data;
21756 GVariant *variant;
21757 const GValue *cur_value;
21758
21759 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
21760 if (!_g_value_equal (cur_value, &cp->orig_value))
21761 {
21762 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
21763 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
21764 g_variant_unref (variant);
21765 num_changes++;
21766 }
21767 }
21768 if (num_changes > 0)
21769 {
21770 GList *connections, *ll;
21771 GVariant *signal_variant;
21772 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Button",
21773 &builder, &invalidated_builder));
21774 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
21775 for (ll = connections; ll != NULL; ll = ll->next)
21776 {
21777 GDBusConnection *connection = ll->data;
21778
21779 g_dbus_connection_emit_signal (connection,
21780 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
21781 "org.freedesktop.DBus.Properties",
21782 "PropertiesChanged",
21783 signal_variant,
21784 NULL);
21785 }
21786 g_variant_unref (signal_variant);
21787 g_list_free_full (connections, g_object_unref);
21788 }
21789 else
21790 {
21791 g_variant_builder_clear (&builder);
21792 g_variant_builder_clear (&invalidated_builder);
21793 }
21794 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
21795 skeleton->priv->changed_properties = NULL;
21796 skeleton->priv->changed_properties_idle_source = NULL;
21797 g_mutex_unlock (&skeleton->priv->lock);
21798 return FALSE;
21799}
21800
21801static void
21802_button_schedule_emit_changed (ButtonSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
21803{
21804 ChangedProperty *cp;
21805 GList *l;
21806 cp = NULL;
21807 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
21808 {
21809 ChangedProperty *i_cp = l->data;
21810 if (i_cp->info == info)
21811 {
21812 cp = i_cp;
21813 break;
21814 }
21815 }
21816 if (cp == NULL)
21817 {
21818 cp = g_new0 (ChangedProperty, 1);
21819 cp->prop_id = prop_id;
21820 cp->info = info;
21821 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
21822 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
21823 g_value_copy (orig_value, &cp->orig_value);
21824 }
21825}
21826
21827static void
21828button_skeleton_notify (GObject *object,
21829 GParamSpec *pspec G_GNUC_UNUSED)
21830{
21831 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21832 g_mutex_lock (&skeleton->priv->lock);
21833 if (skeleton->priv->changed_properties != NULL &&
21834 skeleton->priv->changed_properties_idle_source == NULL)
21835 {
21836 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
21837 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
21838 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _button_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
21839 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
21840 g_source_unref (skeleton->priv->changed_properties_idle_source);
21841 }
21842 g_mutex_unlock (&skeleton->priv->lock);
21843}
21844
21845static void
21846button_skeleton_set_property (GObject *object,
21847 guint prop_id,
21848 const GValue *value,
21849 GParamSpec *pspec)
21850{
21851 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21852 g_assert (prop_id != 0 && prop_id - 1 < 1);
21853 g_mutex_lock (&skeleton->priv->lock);
21854 g_object_freeze_notify (object);
21855 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
21856 {
21857 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
21858 _button_schedule_emit_changed (skeleton, _button_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
21859 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
21860 g_object_notify_by_pspec (object, pspec);
21861 }
21862 g_mutex_unlock (&skeleton->priv->lock);
21863 g_object_thaw_notify (object);
21864}
21865
21866static void
21867button_skeleton_init (ButtonSkeleton *skeleton)
21868{
21869#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21870 skeleton->priv = button_skeleton_get_instance_private (skeleton);
21871#else
21872 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_BUTTON_SKELETON, ButtonSkeletonPrivate);
21873#endif
21874
21875 g_mutex_init (&skeleton->priv->lock);
21876 skeleton->priv->context = g_main_context_ref_thread_default ();
21877 skeleton->priv->properties = g_new0 (GValue, 1);
21878 g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN);
21879}
21880
21881static gboolean
21882button_skeleton_get_state (Button *object)
21883{
21884 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21885 gboolean value;
21886 g_mutex_lock (&skeleton->priv->lock);
21887 value = g_value_get_boolean (&(skeleton->priv->properties[0]));
21888 g_mutex_unlock (&skeleton->priv->lock);
21889 return value;
21890}
21891
21892static void
21893button_skeleton_class_init (ButtonSkeletonClass *klass)
21894{
21895 GObjectClass *gobject_class;
21896 GDBusInterfaceSkeletonClass *skeleton_class;
21897
21898 gobject_class = G_OBJECT_CLASS (klass);
21899 gobject_class->finalize = button_skeleton_finalize;
21900 gobject_class->get_property = button_skeleton_get_property;
21901 gobject_class->set_property = button_skeleton_set_property;
21902 gobject_class->notify = button_skeleton_notify;
21903
21904
21905 button_override_properties (gobject_class, 1);
21906
21907 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
21908 skeleton_class->get_info = button_skeleton_dbus_interface_get_info;
21909 skeleton_class->get_properties = button_skeleton_dbus_interface_get_properties;
21910 skeleton_class->flush = button_skeleton_dbus_interface_flush;
21911 skeleton_class->get_vtable = button_skeleton_dbus_interface_get_vtable;
21912
21913#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
21914 g_type_class_add_private (klass, sizeof (ButtonSkeletonPrivate));
21915#endif
21916}
21917
21918static void
21919button_skeleton_iface_init (ButtonIface *iface)
21920{
21921 iface->button_release = _button_on_signal_button_release;
21922 iface->button_pressed = _button_on_signal_button_pressed;
21923 iface->button_pressed_long = _button_on_signal_button_pressed_long;
21924 iface->get_state = button_skeleton_get_state;
21925}
21926
21927/**
21928 * button_skeleton_new:
21929 *
21930 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
21931 *
21932 * Returns: (transfer full) (type ButtonSkeleton): The skeleton object.
21933 */
21934Button *
21935button_skeleton_new (void)
21936{
21937 return BUTTON (g_object_new (TYPE_BUTTON_SKELETON, NULL));
21938}
21939
21940/* ------------------------------------------------------------------------
21941 * Code for interface org.openbmc.Led
21942 * ------------------------------------------------------------------------
21943 */
21944
21945/**
21946 * SECTION:Led
21947 * @title: Led
21948 * @short_description: Generated C code for the org.openbmc.Led D-Bus interface
21949 *
21950 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> D-Bus interface in C.
21951 */
21952
21953/* ---- Introspection data for org.openbmc.Led ---- */
21954
21955static const _ExtendedGDBusMethodInfo _led_method_info_set_on =
21956{
21957 {
21958 -1,
21959 (gchar *) "setOn",
21960 NULL,
21961 NULL,
21962 NULL
21963 },
21964 "handle-set-on",
21965 FALSE
21966};
21967
21968static const _ExtendedGDBusMethodInfo _led_method_info_set_off =
21969{
21970 {
21971 -1,
21972 (gchar *) "setOff",
21973 NULL,
21974 NULL,
21975 NULL
21976 },
21977 "handle-set-off",
21978 FALSE
21979};
21980
21981static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_slow =
21982{
21983 {
21984 -1,
21985 (gchar *) "setBlinkSlow",
21986 NULL,
21987 NULL,
21988 NULL
21989 },
21990 "handle-set-blink-slow",
21991 FALSE
21992};
21993
21994static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_fast =
21995{
21996 {
21997 -1,
21998 (gchar *) "setBlinkFast",
21999 NULL,
22000 NULL,
22001 NULL
22002 },
22003 "handle-set-blink-fast",
22004 FALSE
22005};
22006
22007static const _ExtendedGDBusMethodInfo * const _led_method_info_pointers[] =
22008{
22009 &_led_method_info_set_on,
22010 &_led_method_info_set_off,
22011 &_led_method_info_set_blink_slow,
22012 &_led_method_info_set_blink_fast,
22013 NULL
22014};
22015
22016static const _ExtendedGDBusPropertyInfo _led_property_info_color =
22017{
22018 {
22019 -1,
22020 (gchar *) "color",
22021 (gchar *) "i",
22022 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
22023 NULL
22024 },
22025 "color",
22026 FALSE
22027};
22028
22029static const _ExtendedGDBusPropertyInfo _led_property_info_function =
22030{
22031 {
22032 -1,
22033 (gchar *) "function",
22034 (gchar *) "s",
22035 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
22036 NULL
22037 },
22038 "function",
22039 FALSE
22040};
22041
22042static const _ExtendedGDBusPropertyInfo * const _led_property_info_pointers[] =
22043{
22044 &_led_property_info_color,
22045 &_led_property_info_function,
22046 NULL
22047};
22048
22049static const _ExtendedGDBusInterfaceInfo _led_interface_info =
22050{
22051 {
22052 -1,
22053 (gchar *) "org.openbmc.Led",
22054 (GDBusMethodInfo **) &_led_method_info_pointers,
22055 NULL,
22056 (GDBusPropertyInfo **) &_led_property_info_pointers,
22057 NULL
22058 },
22059 "led",
22060};
22061
22062
22063/**
22064 * led_interface_info:
22065 *
22066 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> D-Bus interface.
22067 *
22068 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
22069 */
22070GDBusInterfaceInfo *
22071led_interface_info (void)
22072{
22073 return (GDBusInterfaceInfo *) &_led_interface_info.parent_struct;
22074}
22075
22076/**
22077 * led_override_properties:
22078 * @klass: The class structure for a #GObject<!-- -->-derived class.
22079 * @property_id_begin: The property id to assign to the first overridden property.
22080 *
22081 * Overrides all #GObject properties in the #Led interface for a concrete class.
22082 * The properties are overridden in the order they are defined.
22083 *
22084 * Returns: The last property id.
22085 */
22086guint
22087led_override_properties (GObjectClass *klass, guint property_id_begin)
22088{
22089 g_object_class_override_property (klass, property_id_begin++, "color");
22090 g_object_class_override_property (klass, property_id_begin++, "function");
22091 return property_id_begin - 1;
22092}
22093
22094
22095
22096/**
22097 * Led:
22098 *
22099 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
22100 */
22101
22102/**
22103 * LedIface:
22104 * @parent_iface: The parent interface.
22105 * @handle_set_blink_fast: Handler for the #Led::handle-set-blink-fast signal.
22106 * @handle_set_blink_slow: Handler for the #Led::handle-set-blink-slow signal.
22107 * @handle_set_off: Handler for the #Led::handle-set-off signal.
22108 * @handle_set_on: Handler for the #Led::handle-set-on signal.
22109 * @get_color: Getter for the #Led:color property.
22110 * @get_function: Getter for the #Led:function property.
22111 *
22112 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
22113 */
22114
22115typedef LedIface LedInterface;
22116G_DEFINE_INTERFACE (Led, led, G_TYPE_OBJECT);
22117
22118static void
22119led_default_init (LedIface *iface)
22120{
22121 /* GObject signals for incoming D-Bus method calls: */
22122 /**
22123 * Led::handle-set-on:
22124 * @object: A #Led.
22125 * @invocation: A #GDBusMethodInvocation.
22126 *
22127 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method.
22128 *
22129 * 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 led_complete_set_on() 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.
22130 *
22131 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
22132 */
22133 g_signal_new ("handle-set-on",
22134 G_TYPE_FROM_INTERFACE (iface),
22135 G_SIGNAL_RUN_LAST,
22136 G_STRUCT_OFFSET (LedIface, handle_set_on),
22137 g_signal_accumulator_true_handled,
22138 NULL,
22139 g_cclosure_marshal_generic,
22140 G_TYPE_BOOLEAN,
22141 1,
22142 G_TYPE_DBUS_METHOD_INVOCATION);
22143
22144 /**
22145 * Led::handle-set-off:
22146 * @object: A #Led.
22147 * @invocation: A #GDBusMethodInvocation.
22148 *
22149 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method.
22150 *
22151 * 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 led_complete_set_off() 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.
22152 *
22153 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
22154 */
22155 g_signal_new ("handle-set-off",
22156 G_TYPE_FROM_INTERFACE (iface),
22157 G_SIGNAL_RUN_LAST,
22158 G_STRUCT_OFFSET (LedIface, handle_set_off),
22159 g_signal_accumulator_true_handled,
22160 NULL,
22161 g_cclosure_marshal_generic,
22162 G_TYPE_BOOLEAN,
22163 1,
22164 G_TYPE_DBUS_METHOD_INVOCATION);
22165
22166 /**
22167 * Led::handle-set-blink-slow:
22168 * @object: A #Led.
22169 * @invocation: A #GDBusMethodInvocation.
22170 *
22171 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method.
22172 *
22173 * 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 led_complete_set_blink_slow() 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.
22174 *
22175 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
22176 */
22177 g_signal_new ("handle-set-blink-slow",
22178 G_TYPE_FROM_INTERFACE (iface),
22179 G_SIGNAL_RUN_LAST,
22180 G_STRUCT_OFFSET (LedIface, handle_set_blink_slow),
22181 g_signal_accumulator_true_handled,
22182 NULL,
22183 g_cclosure_marshal_generic,
22184 G_TYPE_BOOLEAN,
22185 1,
22186 G_TYPE_DBUS_METHOD_INVOCATION);
22187
22188 /**
22189 * Led::handle-set-blink-fast:
22190 * @object: A #Led.
22191 * @invocation: A #GDBusMethodInvocation.
22192 *
22193 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method.
22194 *
22195 * 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 led_complete_set_blink_fast() 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.
22196 *
22197 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
22198 */
22199 g_signal_new ("handle-set-blink-fast",
22200 G_TYPE_FROM_INTERFACE (iface),
22201 G_SIGNAL_RUN_LAST,
22202 G_STRUCT_OFFSET (LedIface, handle_set_blink_fast),
22203 g_signal_accumulator_true_handled,
22204 NULL,
22205 g_cclosure_marshal_generic,
22206 G_TYPE_BOOLEAN,
22207 1,
22208 G_TYPE_DBUS_METHOD_INVOCATION);
22209
22210 /* GObject properties for D-Bus properties: */
22211 /**
22212 * Led:color:
22213 *
22214 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link>.
22215 *
22216 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
22217 */
22218 g_object_interface_install_property (iface,
22219 g_param_spec_int ("color", "color", "color", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
22220 /**
22221 * Led:function:
22222 *
22223 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link>.
22224 *
22225 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
22226 */
22227 g_object_interface_install_property (iface,
22228 g_param_spec_string ("function", "function", "function", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
22229}
22230
22231/**
22232 * led_get_color: (skip)
22233 * @object: A #Led.
22234 *
22235 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property.
22236 *
22237 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22238 *
22239 * Returns: The property value.
22240 */
22241gint
22242led_get_color (Led *object)
22243{
22244 return LED_GET_IFACE (object)->get_color (object);
22245}
22246
22247/**
22248 * led_set_color: (skip)
22249 * @object: A #Led.
22250 * @value: The value to set.
22251 *
22252 * Sets the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property to @value.
22253 *
22254 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22255 */
22256void
22257led_set_color (Led *object, gint value)
22258{
22259 g_object_set (G_OBJECT (object), "color", value, NULL);
22260}
22261
22262/**
22263 * led_get_function: (skip)
22264 * @object: A #Led.
22265 *
22266 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
22267 *
22268 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22269 *
22270 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use led_dup_function() if on another thread.</warning>
22271 *
22272 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
22273 */
22274const gchar *
22275led_get_function (Led *object)
22276{
22277 return LED_GET_IFACE (object)->get_function (object);
22278}
22279
22280/**
22281 * led_dup_function: (skip)
22282 * @object: A #Led.
22283 *
22284 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
22285 *
22286 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22287 *
22288 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22289 */
22290gchar *
22291led_dup_function (Led *object)
22292{
22293 gchar *value;
22294 g_object_get (G_OBJECT (object), "function", &value, NULL);
22295 return value;
22296}
22297
22298/**
22299 * led_set_function: (skip)
22300 * @object: A #Led.
22301 * @value: The value to set.
22302 *
22303 * Sets the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property to @value.
22304 *
22305 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22306 */
22307void
22308led_set_function (Led *object, const gchar *value)
22309{
22310 g_object_set (G_OBJECT (object), "function", value, NULL);
22311}
22312
22313/**
22314 * led_call_set_on:
22315 * @proxy: A #LedProxy.
22316 * @cancellable: (allow-none): A #GCancellable or %NULL.
22317 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22318 * @user_data: User data to pass to @callback.
22319 *
22320 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method on @proxy.
22321 * 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.
22322 * You can then call led_call_set_on_finish() to get the result of the operation.
22323 *
22324 * See led_call_set_on_sync() for the synchronous, blocking version of this method.
22325 */
22326void
22327led_call_set_on (
22328 Led *proxy,
22329 GCancellable *cancellable,
22330 GAsyncReadyCallback callback,
22331 gpointer user_data)
22332{
22333 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22334 "setOn",
22335 g_variant_new ("()"),
22336 G_DBUS_CALL_FLAGS_NONE,
22337 -1,
22338 cancellable,
22339 callback,
22340 user_data);
22341}
22342
22343/**
22344 * led_call_set_on_finish:
22345 * @proxy: A #LedProxy.
22346 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_on().
22347 * @error: Return location for error or %NULL.
22348 *
22349 * Finishes an operation started with led_call_set_on().
22350 *
22351 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22352 */
22353gboolean
22354led_call_set_on_finish (
22355 Led *proxy,
22356 GAsyncResult *res,
22357 GError **error)
22358{
22359 GVariant *_ret;
22360 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22361 if (_ret == NULL)
22362 goto _out;
22363 g_variant_get (_ret,
22364 "()");
22365 g_variant_unref (_ret);
22366_out:
22367 return _ret != NULL;
22368}
22369
22370/**
22371 * led_call_set_on_sync:
22372 * @proxy: A #LedProxy.
22373 * @cancellable: (allow-none): A #GCancellable or %NULL.
22374 * @error: Return location for error or %NULL.
22375 *
22376 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
22377 *
22378 * See led_call_set_on() for the asynchronous version of this method.
22379 *
22380 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22381 */
22382gboolean
22383led_call_set_on_sync (
22384 Led *proxy,
22385 GCancellable *cancellable,
22386 GError **error)
22387{
22388 GVariant *_ret;
22389 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22390 "setOn",
22391 g_variant_new ("()"),
22392 G_DBUS_CALL_FLAGS_NONE,
22393 -1,
22394 cancellable,
22395 error);
22396 if (_ret == NULL)
22397 goto _out;
22398 g_variant_get (_ret,
22399 "()");
22400 g_variant_unref (_ret);
22401_out:
22402 return _ret != NULL;
22403}
22404
22405/**
22406 * led_call_set_off:
22407 * @proxy: A #LedProxy.
22408 * @cancellable: (allow-none): A #GCancellable or %NULL.
22409 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22410 * @user_data: User data to pass to @callback.
22411 *
22412 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method on @proxy.
22413 * 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.
22414 * You can then call led_call_set_off_finish() to get the result of the operation.
22415 *
22416 * See led_call_set_off_sync() for the synchronous, blocking version of this method.
22417 */
22418void
22419led_call_set_off (
22420 Led *proxy,
22421 GCancellable *cancellable,
22422 GAsyncReadyCallback callback,
22423 gpointer user_data)
22424{
22425 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22426 "setOff",
22427 g_variant_new ("()"),
22428 G_DBUS_CALL_FLAGS_NONE,
22429 -1,
22430 cancellable,
22431 callback,
22432 user_data);
22433}
22434
22435/**
22436 * led_call_set_off_finish:
22437 * @proxy: A #LedProxy.
22438 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_off().
22439 * @error: Return location for error or %NULL.
22440 *
22441 * Finishes an operation started with led_call_set_off().
22442 *
22443 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22444 */
22445gboolean
22446led_call_set_off_finish (
22447 Led *proxy,
22448 GAsyncResult *res,
22449 GError **error)
22450{
22451 GVariant *_ret;
22452 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22453 if (_ret == NULL)
22454 goto _out;
22455 g_variant_get (_ret,
22456 "()");
22457 g_variant_unref (_ret);
22458_out:
22459 return _ret != NULL;
22460}
22461
22462/**
22463 * led_call_set_off_sync:
22464 * @proxy: A #LedProxy.
22465 * @cancellable: (allow-none): A #GCancellable or %NULL.
22466 * @error: Return location for error or %NULL.
22467 *
22468 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
22469 *
22470 * See led_call_set_off() for the asynchronous version of this method.
22471 *
22472 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22473 */
22474gboolean
22475led_call_set_off_sync (
22476 Led *proxy,
22477 GCancellable *cancellable,
22478 GError **error)
22479{
22480 GVariant *_ret;
22481 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22482 "setOff",
22483 g_variant_new ("()"),
22484 G_DBUS_CALL_FLAGS_NONE,
22485 -1,
22486 cancellable,
22487 error);
22488 if (_ret == NULL)
22489 goto _out;
22490 g_variant_get (_ret,
22491 "()");
22492 g_variant_unref (_ret);
22493_out:
22494 return _ret != NULL;
22495}
22496
22497/**
22498 * led_call_set_blink_slow:
22499 * @proxy: A #LedProxy.
22500 * @cancellable: (allow-none): A #GCancellable or %NULL.
22501 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22502 * @user_data: User data to pass to @callback.
22503 *
22504 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method on @proxy.
22505 * 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.
22506 * You can then call led_call_set_blink_slow_finish() to get the result of the operation.
22507 *
22508 * See led_call_set_blink_slow_sync() for the synchronous, blocking version of this method.
22509 */
22510void
22511led_call_set_blink_slow (
22512 Led *proxy,
22513 GCancellable *cancellable,
22514 GAsyncReadyCallback callback,
22515 gpointer user_data)
22516{
22517 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22518 "setBlinkSlow",
22519 g_variant_new ("()"),
22520 G_DBUS_CALL_FLAGS_NONE,
22521 -1,
22522 cancellable,
22523 callback,
22524 user_data);
22525}
22526
22527/**
22528 * led_call_set_blink_slow_finish:
22529 * @proxy: A #LedProxy.
22530 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_slow().
22531 * @error: Return location for error or %NULL.
22532 *
22533 * Finishes an operation started with led_call_set_blink_slow().
22534 *
22535 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22536 */
22537gboolean
22538led_call_set_blink_slow_finish (
22539 Led *proxy,
22540 GAsyncResult *res,
22541 GError **error)
22542{
22543 GVariant *_ret;
22544 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22545 if (_ret == NULL)
22546 goto _out;
22547 g_variant_get (_ret,
22548 "()");
22549 g_variant_unref (_ret);
22550_out:
22551 return _ret != NULL;
22552}
22553
22554/**
22555 * led_call_set_blink_slow_sync:
22556 * @proxy: A #LedProxy.
22557 * @cancellable: (allow-none): A #GCancellable or %NULL.
22558 * @error: Return location for error or %NULL.
22559 *
22560 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
22561 *
22562 * See led_call_set_blink_slow() for the asynchronous version of this method.
22563 *
22564 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22565 */
22566gboolean
22567led_call_set_blink_slow_sync (
22568 Led *proxy,
22569 GCancellable *cancellable,
22570 GError **error)
22571{
22572 GVariant *_ret;
22573 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22574 "setBlinkSlow",
22575 g_variant_new ("()"),
22576 G_DBUS_CALL_FLAGS_NONE,
22577 -1,
22578 cancellable,
22579 error);
22580 if (_ret == NULL)
22581 goto _out;
22582 g_variant_get (_ret,
22583 "()");
22584 g_variant_unref (_ret);
22585_out:
22586 return _ret != NULL;
22587}
22588
22589/**
22590 * led_call_set_blink_fast:
22591 * @proxy: A #LedProxy.
22592 * @cancellable: (allow-none): A #GCancellable or %NULL.
22593 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22594 * @user_data: User data to pass to @callback.
22595 *
22596 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method on @proxy.
22597 * 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.
22598 * You can then call led_call_set_blink_fast_finish() to get the result of the operation.
22599 *
22600 * See led_call_set_blink_fast_sync() for the synchronous, blocking version of this method.
22601 */
22602void
22603led_call_set_blink_fast (
22604 Led *proxy,
22605 GCancellable *cancellable,
22606 GAsyncReadyCallback callback,
22607 gpointer user_data)
22608{
22609 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22610 "setBlinkFast",
22611 g_variant_new ("()"),
22612 G_DBUS_CALL_FLAGS_NONE,
22613 -1,
22614 cancellable,
22615 callback,
22616 user_data);
22617}
22618
22619/**
22620 * led_call_set_blink_fast_finish:
22621 * @proxy: A #LedProxy.
22622 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_fast().
22623 * @error: Return location for error or %NULL.
22624 *
22625 * Finishes an operation started with led_call_set_blink_fast().
22626 *
22627 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22628 */
22629gboolean
22630led_call_set_blink_fast_finish (
22631 Led *proxy,
22632 GAsyncResult *res,
22633 GError **error)
22634{
22635 GVariant *_ret;
22636 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22637 if (_ret == NULL)
22638 goto _out;
22639 g_variant_get (_ret,
22640 "()");
22641 g_variant_unref (_ret);
22642_out:
22643 return _ret != NULL;
22644}
22645
22646/**
22647 * led_call_set_blink_fast_sync:
22648 * @proxy: A #LedProxy.
22649 * @cancellable: (allow-none): A #GCancellable or %NULL.
22650 * @error: Return location for error or %NULL.
22651 *
22652 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
22653 *
22654 * See led_call_set_blink_fast() for the asynchronous version of this method.
22655 *
22656 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22657 */
22658gboolean
22659led_call_set_blink_fast_sync (
22660 Led *proxy,
22661 GCancellable *cancellable,
22662 GError **error)
22663{
22664 GVariant *_ret;
22665 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22666 "setBlinkFast",
22667 g_variant_new ("()"),
22668 G_DBUS_CALL_FLAGS_NONE,
22669 -1,
22670 cancellable,
22671 error);
22672 if (_ret == NULL)
22673 goto _out;
22674 g_variant_get (_ret,
22675 "()");
22676 g_variant_unref (_ret);
22677_out:
22678 return _ret != NULL;
22679}
22680
22681/**
22682 * led_complete_set_on:
22683 * @object: A #Led.
22684 * @invocation: (transfer full): A #GDBusMethodInvocation.
22685 *
22686 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</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.
22687 *
22688 * This method will free @invocation, you cannot use it afterwards.
22689 */
22690void
22691led_complete_set_on (
22692 Led *object,
22693 GDBusMethodInvocation *invocation)
22694{
22695 g_dbus_method_invocation_return_value (invocation,
22696 g_variant_new ("()"));
22697}
22698
22699/**
22700 * led_complete_set_off:
22701 * @object: A #Led.
22702 * @invocation: (transfer full): A #GDBusMethodInvocation.
22703 *
22704 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</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.
22705 *
22706 * This method will free @invocation, you cannot use it afterwards.
22707 */
22708void
22709led_complete_set_off (
22710 Led *object,
22711 GDBusMethodInvocation *invocation)
22712{
22713 g_dbus_method_invocation_return_value (invocation,
22714 g_variant_new ("()"));
22715}
22716
22717/**
22718 * led_complete_set_blink_slow:
22719 * @object: A #Led.
22720 * @invocation: (transfer full): A #GDBusMethodInvocation.
22721 *
22722 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</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.
22723 *
22724 * This method will free @invocation, you cannot use it afterwards.
22725 */
22726void
22727led_complete_set_blink_slow (
22728 Led *object,
22729 GDBusMethodInvocation *invocation)
22730{
22731 g_dbus_method_invocation_return_value (invocation,
22732 g_variant_new ("()"));
22733}
22734
22735/**
22736 * led_complete_set_blink_fast:
22737 * @object: A #Led.
22738 * @invocation: (transfer full): A #GDBusMethodInvocation.
22739 *
22740 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</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.
22741 *
22742 * This method will free @invocation, you cannot use it afterwards.
22743 */
22744void
22745led_complete_set_blink_fast (
22746 Led *object,
22747 GDBusMethodInvocation *invocation)
22748{
22749 g_dbus_method_invocation_return_value (invocation,
22750 g_variant_new ("()"));
22751}
22752
22753/* ------------------------------------------------------------------------ */
22754
22755/**
22756 * LedProxy:
22757 *
22758 * The #LedProxy structure contains only private data and should only be accessed using the provided API.
22759 */
22760
22761/**
22762 * LedProxyClass:
22763 * @parent_class: The parent class.
22764 *
22765 * Class structure for #LedProxy.
22766 */
22767
22768struct _LedProxyPrivate
22769{
22770 GData *qdata;
22771};
22772
22773static void led_proxy_iface_init (LedIface *iface);
22774
22775#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22776G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
22777 G_ADD_PRIVATE (LedProxy)
22778 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
22779
22780#else
22781G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
22782 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
22783
22784#endif
22785static void
22786led_proxy_finalize (GObject *object)
22787{
22788 LedProxy *proxy = LED_PROXY (object);
22789 g_datalist_clear (&proxy->priv->qdata);
22790 G_OBJECT_CLASS (led_proxy_parent_class)->finalize (object);
22791}
22792
22793static void
22794led_proxy_get_property (GObject *object,
22795 guint prop_id,
22796 GValue *value,
22797 GParamSpec *pspec G_GNUC_UNUSED)
22798{
22799 const _ExtendedGDBusPropertyInfo *info;
22800 GVariant *variant;
22801 g_assert (prop_id != 0 && prop_id - 1 < 2);
22802 info = _led_property_info_pointers[prop_id - 1];
22803 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
22804 if (info->use_gvariant)
22805 {
22806 g_value_set_variant (value, variant);
22807 }
22808 else
22809 {
22810 if (variant != NULL)
22811 g_dbus_gvariant_to_gvalue (variant, value);
22812 }
22813 if (variant != NULL)
22814 g_variant_unref (variant);
22815}
22816
22817static void
22818led_proxy_set_property_cb (GDBusProxy *proxy,
22819 GAsyncResult *res,
22820 gpointer user_data)
22821{
22822 const _ExtendedGDBusPropertyInfo *info = user_data;
22823 GError *error;
22824 GVariant *_ret;
22825 error = NULL;
22826 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
22827 if (!_ret)
22828 {
22829 g_warning ("Error setting property '%s' on interface org.openbmc.Led: %s (%s, %d)",
22830 info->parent_struct.name,
22831 error->message, g_quark_to_string (error->domain), error->code);
22832 g_error_free (error);
22833 }
22834 else
22835 {
22836 g_variant_unref (_ret);
22837 }
22838}
22839
22840static void
22841led_proxy_set_property (GObject *object,
22842 guint prop_id,
22843 const GValue *value,
22844 GParamSpec *pspec G_GNUC_UNUSED)
22845{
22846 const _ExtendedGDBusPropertyInfo *info;
22847 GVariant *variant;
22848 g_assert (prop_id != 0 && prop_id - 1 < 2);
22849 info = _led_property_info_pointers[prop_id - 1];
22850 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
22851 g_dbus_proxy_call (G_DBUS_PROXY (object),
22852 "org.freedesktop.DBus.Properties.Set",
22853 g_variant_new ("(ssv)", "org.openbmc.Led", info->parent_struct.name, variant),
22854 G_DBUS_CALL_FLAGS_NONE,
22855 -1,
22856 NULL, (GAsyncReadyCallback) led_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
22857 g_variant_unref (variant);
22858}
22859
22860static void
22861led_proxy_g_signal (GDBusProxy *proxy,
22862 const gchar *sender_name G_GNUC_UNUSED,
22863 const gchar *signal_name,
22864 GVariant *parameters)
22865{
22866 _ExtendedGDBusSignalInfo *info;
22867 GVariantIter iter;
22868 GVariant *child;
22869 GValue *paramv;
22870 guint num_params;
22871 guint n;
22872 guint signal_id;
22873 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, signal_name);
22874 if (info == NULL)
22875 return;
22876 num_params = g_variant_n_children (parameters);
22877 paramv = g_new0 (GValue, num_params + 1);
22878 g_value_init (&paramv[0], TYPE_LED);
22879 g_value_set_object (&paramv[0], proxy);
22880 g_variant_iter_init (&iter, parameters);
22881 n = 1;
22882 while ((child = g_variant_iter_next_value (&iter)) != NULL)
22883 {
22884 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
22885 if (arg_info->use_gvariant)
22886 {
22887 g_value_init (&paramv[n], G_TYPE_VARIANT);
22888 g_value_set_variant (&paramv[n], child);
22889 n++;
22890 }
22891 else
22892 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
22893 g_variant_unref (child);
22894 }
22895 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
22896 g_signal_emitv (paramv, signal_id, 0, NULL);
22897 for (n = 0; n < num_params + 1; n++)
22898 g_value_unset (&paramv[n]);
22899 g_free (paramv);
22900}
22901
22902static void
22903led_proxy_g_properties_changed (GDBusProxy *_proxy,
22904 GVariant *changed_properties,
22905 const gchar *const *invalidated_properties)
22906{
22907 LedProxy *proxy = LED_PROXY (_proxy);
22908 guint n;
22909 const gchar *key;
22910 GVariantIter *iter;
22911 _ExtendedGDBusPropertyInfo *info;
22912 g_variant_get (changed_properties, "a{sv}", &iter);
22913 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
22914 {
22915 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, key);
22916 g_datalist_remove_data (&proxy->priv->qdata, key);
22917 if (info != NULL)
22918 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
22919 }
22920 g_variant_iter_free (iter);
22921 for (n = 0; invalidated_properties[n] != NULL; n++)
22922 {
22923 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, invalidated_properties[n]);
22924 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
22925 if (info != NULL)
22926 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
22927 }
22928}
22929
22930static gint
22931led_proxy_get_color (Led *object)
22932{
22933 LedProxy *proxy = LED_PROXY (object);
22934 GVariant *variant;
22935 gint value = 0;
22936 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "color");
22937 if (variant != NULL)
22938 {
22939 value = g_variant_get_int32 (variant);
22940 g_variant_unref (variant);
22941 }
22942 return value;
22943}
22944
22945static const gchar *
22946led_proxy_get_function (Led *object)
22947{
22948 LedProxy *proxy = LED_PROXY (object);
22949 GVariant *variant;
22950 const gchar *value = NULL;
22951 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "function");
22952 if (variant != NULL)
22953 {
22954 value = g_variant_get_string (variant, NULL);
22955 g_variant_unref (variant);
22956 }
22957 return value;
22958}
22959
22960static void
22961led_proxy_init (LedProxy *proxy)
22962{
22963#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22964 proxy->priv = led_proxy_get_instance_private (proxy);
22965#else
22966 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_LED_PROXY, LedProxyPrivate);
22967#endif
22968
22969 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), led_interface_info ());
22970}
22971
22972static void
22973led_proxy_class_init (LedProxyClass *klass)
22974{
22975 GObjectClass *gobject_class;
22976 GDBusProxyClass *proxy_class;
22977
22978 gobject_class = G_OBJECT_CLASS (klass);
22979 gobject_class->finalize = led_proxy_finalize;
22980 gobject_class->get_property = led_proxy_get_property;
22981 gobject_class->set_property = led_proxy_set_property;
22982
22983 proxy_class = G_DBUS_PROXY_CLASS (klass);
22984 proxy_class->g_signal = led_proxy_g_signal;
22985 proxy_class->g_properties_changed = led_proxy_g_properties_changed;
22986
22987 led_override_properties (gobject_class, 1);
22988
22989#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
22990 g_type_class_add_private (klass, sizeof (LedProxyPrivate));
22991#endif
22992}
22993
22994static void
22995led_proxy_iface_init (LedIface *iface)
22996{
22997 iface->get_color = led_proxy_get_color;
22998 iface->get_function = led_proxy_get_function;
22999}
23000
23001/**
23002 * led_proxy_new:
23003 * @connection: A #GDBusConnection.
23004 * @flags: Flags from the #GDBusProxyFlags enumeration.
23005 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
23006 * @object_path: An object path.
23007 * @cancellable: (allow-none): A #GCancellable or %NULL.
23008 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
23009 * @user_data: User data to pass to @callback.
23010 *
23011 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>. See g_dbus_proxy_new() for more details.
23012 *
23013 * 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.
23014 * You can then call led_proxy_new_finish() to get the result of the operation.
23015 *
23016 * See led_proxy_new_sync() for the synchronous, blocking version of this constructor.
23017 */
23018void
23019led_proxy_new (
23020 GDBusConnection *connection,
23021 GDBusProxyFlags flags,
23022 const gchar *name,
23023 const gchar *object_path,
23024 GCancellable *cancellable,
23025 GAsyncReadyCallback callback,
23026 gpointer user_data)
23027{
23028 g_async_initable_new_async (TYPE_LED_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.Led", NULL);
23029}
23030
23031/**
23032 * led_proxy_new_finish:
23033 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new().
23034 * @error: Return location for error or %NULL
23035 *
23036 * Finishes an operation started with led_proxy_new().
23037 *
23038 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
23039 */
23040Led *
23041led_proxy_new_finish (
23042 GAsyncResult *res,
23043 GError **error)
23044{
23045 GObject *ret;
23046 GObject *source_object;
23047 source_object = g_async_result_get_source_object (res);
23048 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
23049 g_object_unref (source_object);
23050 if (ret != NULL)
23051 return LED (ret);
23052 else
23053 return NULL;
23054}
23055
23056/**
23057 * led_proxy_new_sync:
23058 * @connection: A #GDBusConnection.
23059 * @flags: Flags from the #GDBusProxyFlags enumeration.
23060 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
23061 * @object_path: An object path.
23062 * @cancellable: (allow-none): A #GCancellable or %NULL.
23063 * @error: Return location for error or %NULL
23064 *
23065 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>. See g_dbus_proxy_new_sync() for more details.
23066 *
23067 * The calling thread is blocked until a reply is received.
23068 *
23069 * See led_proxy_new() for the asynchronous version of this constructor.
23070 *
23071 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
23072 */
23073Led *
23074led_proxy_new_sync (
23075 GDBusConnection *connection,
23076 GDBusProxyFlags flags,
23077 const gchar *name,
23078 const gchar *object_path,
23079 GCancellable *cancellable,
23080 GError **error)
23081{
23082 GInitable *ret;
23083 ret = g_initable_new (TYPE_LED_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Led", NULL);
23084 if (ret != NULL)
23085 return LED (ret);
23086 else
23087 return NULL;
23088}
23089
23090
23091/**
23092 * led_proxy_new_for_bus:
23093 * @bus_type: A #GBusType.
23094 * @flags: Flags from the #GDBusProxyFlags enumeration.
23095 * @name: A bus name (well-known or unique).
23096 * @object_path: An object path.
23097 * @cancellable: (allow-none): A #GCancellable or %NULL.
23098 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
23099 * @user_data: User data to pass to @callback.
23100 *
23101 * Like led_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
23102 *
23103 * 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.
23104 * You can then call led_proxy_new_for_bus_finish() to get the result of the operation.
23105 *
23106 * See led_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
23107 */
23108void
23109led_proxy_new_for_bus (
23110 GBusType bus_type,
23111 GDBusProxyFlags flags,
23112 const gchar *name,
23113 const gchar *object_path,
23114 GCancellable *cancellable,
23115 GAsyncReadyCallback callback,
23116 gpointer user_data)
23117{
23118 g_async_initable_new_async (TYPE_LED_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.Led", NULL);
23119}
23120
23121/**
23122 * led_proxy_new_for_bus_finish:
23123 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new_for_bus().
23124 * @error: Return location for error or %NULL
23125 *
23126 * Finishes an operation started with led_proxy_new_for_bus().
23127 *
23128 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
23129 */
23130Led *
23131led_proxy_new_for_bus_finish (
23132 GAsyncResult *res,
23133 GError **error)
23134{
23135 GObject *ret;
23136 GObject *source_object;
23137 source_object = g_async_result_get_source_object (res);
23138 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
23139 g_object_unref (source_object);
23140 if (ret != NULL)
23141 return LED (ret);
23142 else
23143 return NULL;
23144}
23145
23146/**
23147 * led_proxy_new_for_bus_sync:
23148 * @bus_type: A #GBusType.
23149 * @flags: Flags from the #GDBusProxyFlags enumeration.
23150 * @name: A bus name (well-known or unique).
23151 * @object_path: An object path.
23152 * @cancellable: (allow-none): A #GCancellable or %NULL.
23153 * @error: Return location for error or %NULL
23154 *
23155 * Like led_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
23156 *
23157 * The calling thread is blocked until a reply is received.
23158 *
23159 * See led_proxy_new_for_bus() for the asynchronous version of this constructor.
23160 *
23161 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
23162 */
23163Led *
23164led_proxy_new_for_bus_sync (
23165 GBusType bus_type,
23166 GDBusProxyFlags flags,
23167 const gchar *name,
23168 const gchar *object_path,
23169 GCancellable *cancellable,
23170 GError **error)
23171{
23172 GInitable *ret;
23173 ret = g_initable_new (TYPE_LED_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Led", NULL);
23174 if (ret != NULL)
23175 return LED (ret);
23176 else
23177 return NULL;
23178}
23179
23180
23181/* ------------------------------------------------------------------------ */
23182
23183/**
23184 * LedSkeleton:
23185 *
23186 * The #LedSkeleton structure contains only private data and should only be accessed using the provided API.
23187 */
23188
23189/**
23190 * LedSkeletonClass:
23191 * @parent_class: The parent class.
23192 *
23193 * Class structure for #LedSkeleton.
23194 */
23195
23196struct _LedSkeletonPrivate
23197{
23198 GValue *properties;
23199 GList *changed_properties;
23200 GSource *changed_properties_idle_source;
23201 GMainContext *context;
23202 GMutex lock;
23203};
23204
23205static void
23206_led_skeleton_handle_method_call (
23207 GDBusConnection *connection G_GNUC_UNUSED,
23208 const gchar *sender G_GNUC_UNUSED,
23209 const gchar *object_path G_GNUC_UNUSED,
23210 const gchar *interface_name,
23211 const gchar *method_name,
23212 GVariant *parameters,
23213 GDBusMethodInvocation *invocation,
23214 gpointer user_data)
23215{
23216 LedSkeleton *skeleton = LED_SKELETON (user_data);
23217 _ExtendedGDBusMethodInfo *info;
23218 GVariantIter iter;
23219 GVariant *child;
23220 GValue *paramv;
23221 guint num_params;
23222 guint num_extra;
23223 guint n;
23224 guint signal_id;
23225 GValue return_value = G_VALUE_INIT;
23226 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
23227 g_assert (info != NULL);
23228 num_params = g_variant_n_children (parameters);
23229 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
23230 n = 0;
23231 g_value_init (&paramv[n], TYPE_LED);
23232 g_value_set_object (&paramv[n++], skeleton);
23233 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
23234 g_value_set_object (&paramv[n++], invocation);
23235 if (info->pass_fdlist)
23236 {
23237#ifdef G_OS_UNIX
23238 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
23239 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
23240#else
23241 g_assert_not_reached ();
23242#endif
23243 }
23244 g_variant_iter_init (&iter, parameters);
23245 while ((child = g_variant_iter_next_value (&iter)) != NULL)
23246 {
23247 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
23248 if (arg_info->use_gvariant)
23249 {
23250 g_value_init (&paramv[n], G_TYPE_VARIANT);
23251 g_value_set_variant (&paramv[n], child);
23252 n++;
23253 }
23254 else
23255 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
23256 g_variant_unref (child);
23257 }
23258 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
23259 g_value_init (&return_value, G_TYPE_BOOLEAN);
23260 g_signal_emitv (paramv, signal_id, 0, &return_value);
23261 if (!g_value_get_boolean (&return_value))
23262 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);
23263 g_value_unset (&return_value);
23264 for (n = 0; n < num_params + num_extra; n++)
23265 g_value_unset (&paramv[n]);
23266 g_free (paramv);
23267}
23268
23269static GVariant *
23270_led_skeleton_handle_get_property (
23271 GDBusConnection *connection G_GNUC_UNUSED,
23272 const gchar *sender G_GNUC_UNUSED,
23273 const gchar *object_path G_GNUC_UNUSED,
23274 const gchar *interface_name G_GNUC_UNUSED,
23275 const gchar *property_name,
23276 GError **error,
23277 gpointer user_data)
23278{
23279 LedSkeleton *skeleton = LED_SKELETON (user_data);
23280 GValue value = G_VALUE_INIT;
23281 GParamSpec *pspec;
23282 _ExtendedGDBusPropertyInfo *info;
23283 GVariant *ret;
23284 ret = NULL;
23285 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
23286 g_assert (info != NULL);
23287 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
23288 if (pspec == NULL)
23289 {
23290 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
23291 }
23292 else
23293 {
23294 g_value_init (&value, pspec->value_type);
23295 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
23296 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
23297 g_value_unset (&value);
23298 }
23299 return ret;
23300}
23301
23302static gboolean
23303_led_skeleton_handle_set_property (
23304 GDBusConnection *connection G_GNUC_UNUSED,
23305 const gchar *sender G_GNUC_UNUSED,
23306 const gchar *object_path G_GNUC_UNUSED,
23307 const gchar *interface_name G_GNUC_UNUSED,
23308 const gchar *property_name,
23309 GVariant *variant,
23310 GError **error,
23311 gpointer user_data)
23312{
23313 LedSkeleton *skeleton = LED_SKELETON (user_data);
23314 GValue value = G_VALUE_INIT;
23315 GParamSpec *pspec;
23316 _ExtendedGDBusPropertyInfo *info;
23317 gboolean ret;
23318 ret = FALSE;
23319 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
23320 g_assert (info != NULL);
23321 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
23322 if (pspec == NULL)
23323 {
23324 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
23325 }
23326 else
23327 {
23328 if (info->use_gvariant)
23329 g_value_set_variant (&value, variant);
23330 else
23331 g_dbus_gvariant_to_gvalue (variant, &value);
23332 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
23333 g_value_unset (&value);
23334 ret = TRUE;
23335 }
23336 return ret;
23337}
23338
23339static const GDBusInterfaceVTable _led_skeleton_vtable =
23340{
23341 _led_skeleton_handle_method_call,
23342 _led_skeleton_handle_get_property,
23343 _led_skeleton_handle_set_property,
23344 {NULL}
23345};
23346
23347static GDBusInterfaceInfo *
23348led_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
23349{
23350 return led_interface_info ();
23351}
23352
23353static GDBusInterfaceVTable *
23354led_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
23355{
23356 return (GDBusInterfaceVTable *) &_led_skeleton_vtable;
23357}
23358
23359static GVariant *
23360led_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
23361{
23362 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
23363
23364 GVariantBuilder builder;
23365 guint n;
23366 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
23367 if (_led_interface_info.parent_struct.properties == NULL)
23368 goto out;
23369 for (n = 0; _led_interface_info.parent_struct.properties[n] != NULL; n++)
23370 {
23371 GDBusPropertyInfo *info = _led_interface_info.parent_struct.properties[n];
23372 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
23373 {
23374 GVariant *value;
23375 value = _led_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.Led", info->name, NULL, skeleton);
23376 if (value != NULL)
23377 {
23378 g_variant_take_ref (value);
23379 g_variant_builder_add (&builder, "{sv}", info->name, value);
23380 g_variant_unref (value);
23381 }
23382 }
23383 }
23384out:
23385 return g_variant_builder_end (&builder);
23386}
23387
23388static gboolean _led_emit_changed (gpointer user_data);
23389
23390static void
23391led_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
23392{
23393 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
23394 gboolean emit_changed = FALSE;
23395
23396 g_mutex_lock (&skeleton->priv->lock);
23397 if (skeleton->priv->changed_properties_idle_source != NULL)
23398 {
23399 g_source_destroy (skeleton->priv->changed_properties_idle_source);
23400 skeleton->priv->changed_properties_idle_source = NULL;
23401 emit_changed = TRUE;
23402 }
23403 g_mutex_unlock (&skeleton->priv->lock);
23404
23405 if (emit_changed)
23406 _led_emit_changed (skeleton);
23407}
23408
23409static void led_skeleton_iface_init (LedIface *iface);
23410#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23411G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
23412 G_ADD_PRIVATE (LedSkeleton)
23413 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
23414
23415#else
23416G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
23417 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
23418
23419#endif
23420static void
23421led_skeleton_finalize (GObject *object)
23422{
23423 LedSkeleton *skeleton = LED_SKELETON (object);
23424 guint n;
23425 for (n = 0; n < 2; n++)
23426 g_value_unset (&skeleton->priv->properties[n]);
23427 g_free (skeleton->priv->properties);
23428 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
23429 if (skeleton->priv->changed_properties_idle_source != NULL)
23430 g_source_destroy (skeleton->priv->changed_properties_idle_source);
23431 g_main_context_unref (skeleton->priv->context);
23432 g_mutex_clear (&skeleton->priv->lock);
23433 G_OBJECT_CLASS (led_skeleton_parent_class)->finalize (object);
23434}
23435
23436static void
23437led_skeleton_get_property (GObject *object,
23438 guint prop_id,
23439 GValue *value,
23440 GParamSpec *pspec G_GNUC_UNUSED)
23441{
23442 LedSkeleton *skeleton = LED_SKELETON (object);
23443 g_assert (prop_id != 0 && prop_id - 1 < 2);
23444 g_mutex_lock (&skeleton->priv->lock);
23445 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
23446 g_mutex_unlock (&skeleton->priv->lock);
23447}
23448
23449static gboolean
23450_led_emit_changed (gpointer user_data)
23451{
23452 LedSkeleton *skeleton = LED_SKELETON (user_data);
23453 GList *l;
23454 GVariantBuilder builder;
23455 GVariantBuilder invalidated_builder;
23456 guint num_changes;
23457
23458 g_mutex_lock (&skeleton->priv->lock);
23459 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
23460 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
23461 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
23462 {
23463 ChangedProperty *cp = l->data;
23464 GVariant *variant;
23465 const GValue *cur_value;
23466
23467 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
23468 if (!_g_value_equal (cur_value, &cp->orig_value))
23469 {
23470 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
23471 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
23472 g_variant_unref (variant);
23473 num_changes++;
23474 }
23475 }
23476 if (num_changes > 0)
23477 {
23478 GList *connections, *ll;
23479 GVariant *signal_variant;
23480 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Led",
23481 &builder, &invalidated_builder));
23482 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
23483 for (ll = connections; ll != NULL; ll = ll->next)
23484 {
23485 GDBusConnection *connection = ll->data;
23486
23487 g_dbus_connection_emit_signal (connection,
23488 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
23489 "org.freedesktop.DBus.Properties",
23490 "PropertiesChanged",
23491 signal_variant,
23492 NULL);
23493 }
23494 g_variant_unref (signal_variant);
23495 g_list_free_full (connections, g_object_unref);
23496 }
23497 else
23498 {
23499 g_variant_builder_clear (&builder);
23500 g_variant_builder_clear (&invalidated_builder);
23501 }
23502 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
23503 skeleton->priv->changed_properties = NULL;
23504 skeleton->priv->changed_properties_idle_source = NULL;
23505 g_mutex_unlock (&skeleton->priv->lock);
23506 return FALSE;
23507}
23508
23509static void
23510_led_schedule_emit_changed (LedSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
23511{
23512 ChangedProperty *cp;
23513 GList *l;
23514 cp = NULL;
23515 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
23516 {
23517 ChangedProperty *i_cp = l->data;
23518 if (i_cp->info == info)
23519 {
23520 cp = i_cp;
23521 break;
23522 }
23523 }
23524 if (cp == NULL)
23525 {
23526 cp = g_new0 (ChangedProperty, 1);
23527 cp->prop_id = prop_id;
23528 cp->info = info;
23529 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
23530 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
23531 g_value_copy (orig_value, &cp->orig_value);
23532 }
23533}
23534
23535static void
23536led_skeleton_notify (GObject *object,
23537 GParamSpec *pspec G_GNUC_UNUSED)
23538{
23539 LedSkeleton *skeleton = LED_SKELETON (object);
23540 g_mutex_lock (&skeleton->priv->lock);
23541 if (skeleton->priv->changed_properties != NULL &&
23542 skeleton->priv->changed_properties_idle_source == NULL)
23543 {
23544 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
23545 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
23546 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _led_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
23547 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
23548 g_source_unref (skeleton->priv->changed_properties_idle_source);
23549 }
23550 g_mutex_unlock (&skeleton->priv->lock);
23551}
23552
23553static void
23554led_skeleton_set_property (GObject *object,
23555 guint prop_id,
23556 const GValue *value,
23557 GParamSpec *pspec)
23558{
23559 LedSkeleton *skeleton = LED_SKELETON (object);
23560 g_assert (prop_id != 0 && prop_id - 1 < 2);
23561 g_mutex_lock (&skeleton->priv->lock);
23562 g_object_freeze_notify (object);
23563 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
23564 {
23565 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
23566 _led_schedule_emit_changed (skeleton, _led_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
23567 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
23568 g_object_notify_by_pspec (object, pspec);
23569 }
23570 g_mutex_unlock (&skeleton->priv->lock);
23571 g_object_thaw_notify (object);
23572}
23573
23574static void
23575led_skeleton_init (LedSkeleton *skeleton)
23576{
23577#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23578 skeleton->priv = led_skeleton_get_instance_private (skeleton);
23579#else
23580 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_LED_SKELETON, LedSkeletonPrivate);
23581#endif
23582
23583 g_mutex_init (&skeleton->priv->lock);
23584 skeleton->priv->context = g_main_context_ref_thread_default ();
23585 skeleton->priv->properties = g_new0 (GValue, 2);
23586 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
23587 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
23588}
23589
23590static gint
23591led_skeleton_get_color (Led *object)
23592{
23593 LedSkeleton *skeleton = LED_SKELETON (object);
23594 gint value;
23595 g_mutex_lock (&skeleton->priv->lock);
23596 value = g_value_get_int (&(skeleton->priv->properties[0]));
23597 g_mutex_unlock (&skeleton->priv->lock);
23598 return value;
23599}
23600
23601static const gchar *
23602led_skeleton_get_function (Led *object)
23603{
23604 LedSkeleton *skeleton = LED_SKELETON (object);
23605 const gchar *value;
23606 g_mutex_lock (&skeleton->priv->lock);
23607 value = g_value_get_string (&(skeleton->priv->properties[1]));
23608 g_mutex_unlock (&skeleton->priv->lock);
23609 return value;
23610}
23611
23612static void
23613led_skeleton_class_init (LedSkeletonClass *klass)
23614{
23615 GObjectClass *gobject_class;
23616 GDBusInterfaceSkeletonClass *skeleton_class;
23617
23618 gobject_class = G_OBJECT_CLASS (klass);
23619 gobject_class->finalize = led_skeleton_finalize;
23620 gobject_class->get_property = led_skeleton_get_property;
23621 gobject_class->set_property = led_skeleton_set_property;
23622 gobject_class->notify = led_skeleton_notify;
23623
23624
23625 led_override_properties (gobject_class, 1);
23626
23627 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
23628 skeleton_class->get_info = led_skeleton_dbus_interface_get_info;
23629 skeleton_class->get_properties = led_skeleton_dbus_interface_get_properties;
23630 skeleton_class->flush = led_skeleton_dbus_interface_flush;
23631 skeleton_class->get_vtable = led_skeleton_dbus_interface_get_vtable;
23632
23633#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
23634 g_type_class_add_private (klass, sizeof (LedSkeletonPrivate));
23635#endif
23636}
23637
23638static void
23639led_skeleton_iface_init (LedIface *iface)
23640{
23641 iface->get_color = led_skeleton_get_color;
23642 iface->get_function = led_skeleton_get_function;
23643}
23644
23645/**
23646 * led_skeleton_new:
23647 *
23648 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
23649 *
23650 * Returns: (transfer full) (type LedSkeleton): The skeleton object.
23651 */
23652Led *
23653led_skeleton_new (void)
23654{
23655 return LED (g_object_new (TYPE_LED_SKELETON, NULL));
23656}
23657
23658/* ------------------------------------------------------------------------
23659 * Code for Object, ObjectProxy and ObjectSkeleton
23660 * ------------------------------------------------------------------------
23661 */
23662
23663/**
23664 * SECTION:Object
23665 * @title: Object
23666 * @short_description: Specialized GDBusObject types
23667 *
23668 * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
23669 */
23670
23671/**
23672 * Object:
23673 *
23674 * The #Object type is a specialized container of interfaces.
23675 */
23676
23677/**
23678 * ObjectIface:
23679 * @parent_iface: The parent interface.
23680 *
23681 * Virtual table for the #Object interface.
23682 */
23683
23684typedef ObjectIface ObjectInterface;
23685G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));
23686
23687static void
23688object_default_init (ObjectIface *iface)
23689{
23690 /**
23691 * Object:occ:
23692 *
23693 * The #Occ instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>, if any.
23694 *
23695 * Connect to the #GObject::notify signal to get informed of property changes.
23696 */
23697 g_object_interface_install_property (iface, g_param_spec_object ("occ", "occ", "occ", TYPE_OCC, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23698
23699 /**
23700 * Object:fan:
23701 *
23702 * The #Fan instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>, if any.
23703 *
23704 * Connect to the #GObject::notify signal to get informed of property changes.
23705 */
23706 g_object_interface_install_property (iface, g_param_spec_object ("fan", "fan", "fan", TYPE_FAN, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23707
23708 /**
23709 * Object:sensor-value:
23710 *
23711 * The #SensorValue instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>, if any.
23712 *
23713 * Connect to the #GObject::notify signal to get informed of property changes.
23714 */
23715 g_object_interface_install_property (iface, g_param_spec_object ("sensor-value", "sensor-value", "sensor-value", TYPE_SENSOR_VALUE, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23716
23717 /**
23718 * Object:sensor-threshold:
23719 *
23720 * The #SensorThreshold instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>, if any.
23721 *
23722 * Connect to the #GObject::notify signal to get informed of property changes.
23723 */
23724 g_object_interface_install_property (iface, g_param_spec_object ("sensor-threshold", "sensor-threshold", "sensor-threshold", TYPE_SENSOR_THRESHOLD, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23725
23726 /**
23727 * Object:sensor-i2c:
23728 *
23729 * The #SensorI2c instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>, if any.
23730 *
23731 * Connect to the #GObject::notify signal to get informed of property changes.
23732 */
23733 g_object_interface_install_property (iface, g_param_spec_object ("sensor-i2c", "sensor-i2c", "sensor-i2c", TYPE_SENSOR_I2C, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23734
23735 /**
23736 * Object:sensor-match:
23737 *
23738 * The #SensorMatch instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>, if any.
23739 *
23740 * Connect to the #GObject::notify signal to get informed of property changes.
23741 */
23742 g_object_interface_install_property (iface, g_param_spec_object ("sensor-match", "sensor-match", "sensor-match", TYPE_SENSOR_MATCH, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23743
23744 /**
23745 * Object:process:
23746 *
23747 * The #Process instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>, if any.
23748 *
23749 * Connect to the #GObject::notify signal to get informed of property changes.
23750 */
23751 g_object_interface_install_property (iface, g_param_spec_object ("process", "process", "process", TYPE_PROCESS, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23752
23753 /**
23754 * Object:control:
23755 *
23756 * The #Control instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>, if any.
23757 *
23758 * Connect to the #GObject::notify signal to get informed of property changes.
23759 */
23760 g_object_interface_install_property (iface, g_param_spec_object ("control", "control", "control", TYPE_CONTROL, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23761
23762 /**
23763 * Object:control-bmc:
23764 *
23765 * The #ControlBmc instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>, if any.
23766 *
23767 * Connect to the #GObject::notify signal to get informed of property changes.
23768 */
23769 g_object_interface_install_property (iface, g_param_spec_object ("control-bmc", "control-bmc", "control-bmc", TYPE_CONTROL_BMC, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23770
23771 /**
23772 * Object:control-host:
23773 *
23774 * 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.
23775 *
23776 * Connect to the #GObject::notify signal to get informed of property changes.
23777 */
23778 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));
23779
23780 /**
23781 * Object:control-power:
23782 *
23783 * The #ControlPower instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>, if any.
23784 *
23785 * Connect to the #GObject::notify signal to get informed of property changes.
23786 */
23787 g_object_interface_install_property (iface, g_param_spec_object ("control-power", "control-power", "control-power", TYPE_CONTROL_POWER, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23788
23789 /**
23790 * Object:watchdog:
23791 *
23792 * The #Watchdog instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>, if any.
23793 *
23794 * Connect to the #GObject::notify signal to get informed of property changes.
23795 */
23796 g_object_interface_install_property (iface, g_param_spec_object ("watchdog", "watchdog", "watchdog", TYPE_WATCHDOG, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23797
23798 /**
23799 * Object:event-log:
23800 *
23801 * The #EventLog instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>, if any.
23802 *
23803 * Connect to the #GObject::notify signal to get informed of property changes.
23804 */
23805 g_object_interface_install_property (iface, g_param_spec_object ("event-log", "event-log", "event-log", TYPE_EVENT_LOG, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23806
23807 /**
23808 * Object:flash:
23809 *
23810 * 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.
23811 *
23812 * Connect to the #GObject::notify signal to get informed of property changes.
23813 */
23814 g_object_interface_install_property (iface, g_param_spec_object ("flash", "flash", "flash", TYPE_FLASH, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23815
23816 /**
23817 * Object:button:
23818 *
23819 * The #Button instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>, if any.
23820 *
23821 * Connect to the #GObject::notify signal to get informed of property changes.
23822 */
23823 g_object_interface_install_property (iface, g_param_spec_object ("button", "button", "button", TYPE_BUTTON, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23824
23825 /**
23826 * Object:led:
23827 *
23828 * The #Led instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>, if any.
23829 *
23830 * Connect to the #GObject::notify signal to get informed of property changes.
23831 */
23832 g_object_interface_install_property (iface, g_param_spec_object ("led", "led", "led", TYPE_LED, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23833
23834}
23835
23836/**
23837 * object_get_occ:
23838 * @object: A #Object.
23839 *
23840 * Gets the #Occ instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link> on @object, if any.
23841 *
23842 * Returns: (transfer full): A #Occ that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23843 */
23844Occ *object_get_occ (Object *object)
23845{
23846 GDBusInterface *ret;
23847 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
23848 if (ret == NULL)
23849 return NULL;
23850 return OCC (ret);
23851}
23852
23853/**
23854 * object_get_fan:
23855 * @object: A #Object.
23856 *
23857 * Gets the #Fan instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> on @object, if any.
23858 *
23859 * Returns: (transfer full): A #Fan that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23860 */
23861Fan *object_get_fan (Object *object)
23862{
23863 GDBusInterface *ret;
23864 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
23865 if (ret == NULL)
23866 return NULL;
23867 return FAN (ret);
23868}
23869
23870/**
23871 * object_get_sensor_value:
23872 * @object: A #Object.
23873 *
23874 * Gets the #SensorValue instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> on @object, if any.
23875 *
23876 * Returns: (transfer full): A #SensorValue that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23877 */
23878SensorValue *object_get_sensor_value (Object *object)
23879{
23880 GDBusInterface *ret;
23881 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
23882 if (ret == NULL)
23883 return NULL;
23884 return SENSOR_VALUE (ret);
23885}
23886
23887/**
23888 * object_get_sensor_threshold:
23889 * @object: A #Object.
23890 *
23891 * Gets the #SensorThreshold instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> on @object, if any.
23892 *
23893 * Returns: (transfer full): A #SensorThreshold that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23894 */
23895SensorThreshold *object_get_sensor_threshold (Object *object)
23896{
23897 GDBusInterface *ret;
23898 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
23899 if (ret == NULL)
23900 return NULL;
23901 return SENSOR_THRESHOLD (ret);
23902}
23903
23904/**
23905 * object_get_sensor_i2c:
23906 * @object: A #Object.
23907 *
23908 * Gets the #SensorI2c instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> on @object, if any.
23909 *
23910 * Returns: (transfer full): A #SensorI2c that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23911 */
23912SensorI2c *object_get_sensor_i2c (Object *object)
23913{
23914 GDBusInterface *ret;
23915 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
23916 if (ret == NULL)
23917 return NULL;
23918 return SENSOR_I2C (ret);
23919}
23920
23921/**
23922 * object_get_sensor_match:
23923 * @object: A #Object.
23924 *
23925 * Gets the #SensorMatch instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> on @object, if any.
23926 *
23927 * Returns: (transfer full): A #SensorMatch that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23928 */
23929SensorMatch *object_get_sensor_match (Object *object)
23930{
23931 GDBusInterface *ret;
23932 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
23933 if (ret == NULL)
23934 return NULL;
23935 return SENSOR_MATCH (ret);
23936}
23937
23938/**
23939 * object_get_process:
23940 * @object: A #Object.
23941 *
23942 * Gets the #Process instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> on @object, if any.
23943 *
23944 * Returns: (transfer full): A #Process that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23945 */
23946Process *object_get_process (Object *object)
23947{
23948 GDBusInterface *ret;
23949 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
23950 if (ret == NULL)
23951 return NULL;
23952 return PROCESS (ret);
23953}
23954
23955/**
23956 * object_get_control:
23957 * @object: A #Object.
23958 *
23959 * Gets the #Control instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> on @object, if any.
23960 *
23961 * Returns: (transfer full): A #Control that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23962 */
23963Control *object_get_control (Object *object)
23964{
23965 GDBusInterface *ret;
23966 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
23967 if (ret == NULL)
23968 return NULL;
23969 return CONTROL (ret);
23970}
23971
23972/**
23973 * object_get_control_bmc:
23974 * @object: A #Object.
23975 *
23976 * Gets the #ControlBmc instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link> on @object, if any.
23977 *
23978 * Returns: (transfer full): A #ControlBmc that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23979 */
23980ControlBmc *object_get_control_bmc (Object *object)
23981{
23982 GDBusInterface *ret;
23983 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
23984 if (ret == NULL)
23985 return NULL;
23986 return CONTROL_BMC (ret);
23987}
23988
23989/**
23990 * object_get_control_host:
23991 * @object: A #Object.
23992 *
23993 * 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.
23994 *
23995 * Returns: (transfer full): A #ControlHost that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23996 */
23997ControlHost *object_get_control_host (Object *object)
23998{
23999 GDBusInterface *ret;
24000 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
24001 if (ret == NULL)
24002 return NULL;
24003 return CONTROL_HOST (ret);
24004}
24005
24006/**
24007 * object_get_control_power:
24008 * @object: A #Object.
24009 *
24010 * Gets the #ControlPower instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link> on @object, if any.
24011 *
24012 * Returns: (transfer full): A #ControlPower that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24013 */
24014ControlPower *object_get_control_power (Object *object)
24015{
24016 GDBusInterface *ret;
24017 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
24018 if (ret == NULL)
24019 return NULL;
24020 return CONTROL_POWER (ret);
24021}
24022
24023/**
24024 * object_get_watchdog:
24025 * @object: A #Object.
24026 *
24027 * Gets the #Watchdog instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> on @object, if any.
24028 *
24029 * Returns: (transfer full): A #Watchdog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24030 */
24031Watchdog *object_get_watchdog (Object *object)
24032{
24033 GDBusInterface *ret;
24034 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
24035 if (ret == NULL)
24036 return NULL;
24037 return WATCHDOG (ret);
24038}
24039
24040/**
24041 * object_get_event_log:
24042 * @object: A #Object.
24043 *
24044 * Gets the #EventLog instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> on @object, if any.
24045 *
24046 * Returns: (transfer full): A #EventLog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24047 */
24048EventLog *object_get_event_log (Object *object)
24049{
24050 GDBusInterface *ret;
24051 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
24052 if (ret == NULL)
24053 return NULL;
24054 return EVENT_LOG (ret);
24055}
24056
24057/**
24058 * object_get_flash:
24059 * @object: A #Object.
24060 *
24061 * 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.
24062 *
24063 * Returns: (transfer full): A #Flash that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24064 */
24065Flash *object_get_flash (Object *object)
24066{
24067 GDBusInterface *ret;
24068 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
24069 if (ret == NULL)
24070 return NULL;
24071 return FLASH (ret);
24072}
24073
24074/**
24075 * object_get_button:
24076 * @object: A #Object.
24077 *
24078 * Gets the #Button instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> on @object, if any.
24079 *
24080 * Returns: (transfer full): A #Button that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24081 */
24082Button *object_get_button (Object *object)
24083{
24084 GDBusInterface *ret;
24085 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
24086 if (ret == NULL)
24087 return NULL;
24088 return BUTTON (ret);
24089}
24090
24091/**
24092 * object_get_led:
24093 * @object: A #Object.
24094 *
24095 * Gets the #Led instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> on @object, if any.
24096 *
24097 * Returns: (transfer full): A #Led that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24098 */
24099Led *object_get_led (Object *object)
24100{
24101 GDBusInterface *ret;
24102 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
24103 if (ret == NULL)
24104 return NULL;
24105 return LED (ret);
24106}
24107
24108
24109/**
24110 * object_peek_occ: (skip)
24111 * @object: A #Object.
24112 *
24113 * Like object_get_occ() but doesn't increase the reference count on the returned object.
24114 *
24115 * <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>
24116 *
24117 * Returns: (transfer none): A #Occ or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
24118 */
24119Occ *object_peek_occ (Object *object)
24120{
24121 GDBusInterface *ret;
24122 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
24123 if (ret == NULL)
24124 return NULL;
24125 g_object_unref (ret);
24126 return OCC (ret);
24127}
24128
24129/**
24130 * object_peek_fan: (skip)
24131 * @object: A #Object.
24132 *
24133 * Like object_get_fan() but doesn't increase the reference count on the returned object.
24134 *
24135 * <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>
24136 *
24137 * Returns: (transfer none): A #Fan or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
24138 */
24139Fan *object_peek_fan (Object *object)
24140{
24141 GDBusInterface *ret;
24142 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
24143 if (ret == NULL)
24144 return NULL;
24145 g_object_unref (ret);
24146 return FAN (ret);
24147}
24148
24149/**
24150 * object_peek_sensor_value: (skip)
24151 * @object: A #Object.
24152 *
24153 * Like object_get_sensor_value() but doesn't increase the reference count on the returned object.
24154 *
24155 * <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>
24156 *
24157 * Returns: (transfer none): A #SensorValue or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
24158 */
24159SensorValue *object_peek_sensor_value (Object *object)
24160{
24161 GDBusInterface *ret;
24162 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
24163 if (ret == NULL)
24164 return NULL;
24165 g_object_unref (ret);
24166 return SENSOR_VALUE (ret);
24167}
24168
24169/**
24170 * object_peek_sensor_threshold: (skip)
24171 * @object: A #Object.
24172 *
24173 * Like object_get_sensor_threshold() but doesn't increase the reference count on the returned object.
24174 *
24175 * <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>
24176 *
24177 * Returns: (transfer none): A #SensorThreshold or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
24178 */
24179SensorThreshold *object_peek_sensor_threshold (Object *object)
24180{
24181 GDBusInterface *ret;
24182 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
24183 if (ret == NULL)
24184 return NULL;
24185 g_object_unref (ret);
24186 return SENSOR_THRESHOLD (ret);
24187}
24188
24189/**
24190 * object_peek_sensor_i2c: (skip)
24191 * @object: A #Object.
24192 *
24193 * Like object_get_sensor_i2c() but doesn't increase the reference count on the returned object.
24194 *
24195 * <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>
24196 *
24197 * Returns: (transfer none): A #SensorI2c or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
24198 */
24199SensorI2c *object_peek_sensor_i2c (Object *object)
24200{
24201 GDBusInterface *ret;
24202 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
24203 if (ret == NULL)
24204 return NULL;
24205 g_object_unref (ret);
24206 return SENSOR_I2C (ret);
24207}
24208
24209/**
24210 * object_peek_sensor_match: (skip)
24211 * @object: A #Object.
24212 *
24213 * Like object_get_sensor_match() but doesn't increase the reference count on the returned object.
24214 *
24215 * <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>
24216 *
24217 * Returns: (transfer none): A #SensorMatch or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
24218 */
24219SensorMatch *object_peek_sensor_match (Object *object)
24220{
24221 GDBusInterface *ret;
24222 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
24223 if (ret == NULL)
24224 return NULL;
24225 g_object_unref (ret);
24226 return SENSOR_MATCH (ret);
24227}
24228
24229/**
24230 * object_peek_process: (skip)
24231 * @object: A #Object.
24232 *
24233 * Like object_get_process() but doesn't increase the reference count on the returned object.
24234 *
24235 * <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>
24236 *
24237 * Returns: (transfer none): A #Process or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
24238 */
24239Process *object_peek_process (Object *object)
24240{
24241 GDBusInterface *ret;
24242 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
24243 if (ret == NULL)
24244 return NULL;
24245 g_object_unref (ret);
24246 return PROCESS (ret);
24247}
24248
24249/**
24250 * object_peek_control: (skip)
24251 * @object: A #Object.
24252 *
24253 * Like object_get_control() but doesn't increase the reference count on the returned object.
24254 *
24255 * <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>
24256 *
24257 * Returns: (transfer none): A #Control or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
24258 */
24259Control *object_peek_control (Object *object)
24260{
24261 GDBusInterface *ret;
24262 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
24263 if (ret == NULL)
24264 return NULL;
24265 g_object_unref (ret);
24266 return CONTROL (ret);
24267}
24268
24269/**
24270 * object_peek_control_bmc: (skip)
24271 * @object: A #Object.
24272 *
24273 * Like object_get_control_bmc() but doesn't increase the reference count on the returned object.
24274 *
24275 * <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>
24276 *
24277 * Returns: (transfer none): A #ControlBmc or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
24278 */
24279ControlBmc *object_peek_control_bmc (Object *object)
24280{
24281 GDBusInterface *ret;
24282 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
24283 if (ret == NULL)
24284 return NULL;
24285 g_object_unref (ret);
24286 return CONTROL_BMC (ret);
24287}
24288
24289/**
24290 * object_peek_control_host: (skip)
24291 * @object: A #Object.
24292 *
24293 * Like object_get_control_host() but doesn't increase the reference count on the returned object.
24294 *
24295 * <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>
24296 *
24297 * 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.
24298 */
24299ControlHost *object_peek_control_host (Object *object)
24300{
24301 GDBusInterface *ret;
24302 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
24303 if (ret == NULL)
24304 return NULL;
24305 g_object_unref (ret);
24306 return CONTROL_HOST (ret);
24307}
24308
24309/**
24310 * object_peek_control_power: (skip)
24311 * @object: A #Object.
24312 *
24313 * Like object_get_control_power() but doesn't increase the reference count on the returned object.
24314 *
24315 * <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>
24316 *
24317 * Returns: (transfer none): A #ControlPower or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
24318 */
24319ControlPower *object_peek_control_power (Object *object)
24320{
24321 GDBusInterface *ret;
24322 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
24323 if (ret == NULL)
24324 return NULL;
24325 g_object_unref (ret);
24326 return CONTROL_POWER (ret);
24327}
24328
24329/**
24330 * object_peek_watchdog: (skip)
24331 * @object: A #Object.
24332 *
24333 * Like object_get_watchdog() but doesn't increase the reference count on the returned object.
24334 *
24335 * <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>
24336 *
24337 * Returns: (transfer none): A #Watchdog or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
24338 */
24339Watchdog *object_peek_watchdog (Object *object)
24340{
24341 GDBusInterface *ret;
24342 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
24343 if (ret == NULL)
24344 return NULL;
24345 g_object_unref (ret);
24346 return WATCHDOG (ret);
24347}
24348
24349/**
24350 * object_peek_event_log: (skip)
24351 * @object: A #Object.
24352 *
24353 * Like object_get_event_log() but doesn't increase the reference count on the returned object.
24354 *
24355 * <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>
24356 *
24357 * Returns: (transfer none): A #EventLog or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
24358 */
24359EventLog *object_peek_event_log (Object *object)
24360{
24361 GDBusInterface *ret;
24362 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
24363 if (ret == NULL)
24364 return NULL;
24365 g_object_unref (ret);
24366 return EVENT_LOG (ret);
24367}
24368
24369/**
24370 * object_peek_flash: (skip)
24371 * @object: A #Object.
24372 *
24373 * Like object_get_flash() but doesn't increase the reference count on the returned object.
24374 *
24375 * <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>
24376 *
24377 * 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.
24378 */
24379Flash *object_peek_flash (Object *object)
24380{
24381 GDBusInterface *ret;
24382 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
24383 if (ret == NULL)
24384 return NULL;
24385 g_object_unref (ret);
24386 return FLASH (ret);
24387}
24388
24389/**
24390 * object_peek_button: (skip)
24391 * @object: A #Object.
24392 *
24393 * Like object_get_button() but doesn't increase the reference count on the returned object.
24394 *
24395 * <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>
24396 *
24397 * Returns: (transfer none): A #Button or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
24398 */
24399Button *object_peek_button (Object *object)
24400{
24401 GDBusInterface *ret;
24402 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
24403 if (ret == NULL)
24404 return NULL;
24405 g_object_unref (ret);
24406 return BUTTON (ret);
24407}
24408
24409/**
24410 * object_peek_led: (skip)
24411 * @object: A #Object.
24412 *
24413 * Like object_get_led() but doesn't increase the reference count on the returned object.
24414 *
24415 * <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>
24416 *
24417 * Returns: (transfer none): A #Led or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
24418 */
24419Led *object_peek_led (Object *object)
24420{
24421 GDBusInterface *ret;
24422 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
24423 if (ret == NULL)
24424 return NULL;
24425 g_object_unref (ret);
24426 return LED (ret);
24427}
24428
24429
24430static void
24431object_notify (GDBusObject *object, GDBusInterface *interface)
24432{
24433 _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
24434 /* info can be NULL if the other end is using a D-Bus interface we don't know
24435 * anything about, for example old generated code in this process talking to
24436 * newer generated code in the other process. */
24437 if (info != NULL)
24438 g_object_notify (G_OBJECT (object), info->hyphen_name);
24439}
24440
24441/**
24442 * ObjectProxy:
24443 *
24444 * The #ObjectProxy structure contains only private data and should only be accessed using the provided API.
24445 */
24446
24447/**
24448 * ObjectProxyClass:
24449 * @parent_class: The parent class.
24450 *
24451 * Class structure for #ObjectProxy.
24452 */
24453
24454static void
24455object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
24456{
24457}
24458
24459static void
24460object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
24461{
24462 iface->interface_added = object_notify;
24463 iface->interface_removed = object_notify;
24464}
24465
24466
24467G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
24468 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init)
24469 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init));
24470
24471static void
24472object_proxy_init (ObjectProxy *object G_GNUC_UNUSED)
24473{
24474}
24475
24476static void
24477object_proxy_set_property (GObject *gobject,
24478 guint prop_id,
24479 const GValue *value G_GNUC_UNUSED,
24480 GParamSpec *pspec)
24481{
24482 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
24483}
24484
24485static void
24486object_proxy_get_property (GObject *gobject,
24487 guint prop_id,
24488 GValue *value,
24489 GParamSpec *pspec)
24490{
24491 ObjectProxy *object = OBJECT_PROXY (gobject);
24492 GDBusInterface *interface;
24493
24494 switch (prop_id)
24495 {
24496 case 1:
24497 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
24498 g_value_take_object (value, interface);
24499 break;
24500
24501 case 2:
24502 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
24503 g_value_take_object (value, interface);
24504 break;
24505
24506 case 3:
24507 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
24508 g_value_take_object (value, interface);
24509 break;
24510
24511 case 4:
24512 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
24513 g_value_take_object (value, interface);
24514 break;
24515
24516 case 5:
24517 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
24518 g_value_take_object (value, interface);
24519 break;
24520
24521 case 6:
24522 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
24523 g_value_take_object (value, interface);
24524 break;
24525
24526 case 7:
24527 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
24528 g_value_take_object (value, interface);
24529 break;
24530
24531 case 8:
24532 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
24533 g_value_take_object (value, interface);
24534 break;
24535
24536 case 9:
24537 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
24538 g_value_take_object (value, interface);
24539 break;
24540
24541 case 10:
24542 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
24543 g_value_take_object (value, interface);
24544 break;
24545
24546 case 11:
24547 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
24548 g_value_take_object (value, interface);
24549 break;
24550
24551 case 12:
24552 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
24553 g_value_take_object (value, interface);
24554 break;
24555
24556 case 13:
24557 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
24558 g_value_take_object (value, interface);
24559 break;
24560
24561 case 14:
24562 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
24563 g_value_take_object (value, interface);
24564 break;
24565
24566 case 15:
24567 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
24568 g_value_take_object (value, interface);
24569 break;
24570
24571 case 16:
24572 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
24573 g_value_take_object (value, interface);
24574 break;
24575
24576 default:
24577 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
24578 break;
24579 }
24580}
24581
24582static void
24583object_proxy_class_init (ObjectProxyClass *klass)
24584{
24585 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
24586
24587 gobject_class->set_property = object_proxy_set_property;
24588 gobject_class->get_property = object_proxy_get_property;
24589
24590 g_object_class_override_property (gobject_class, 1, "occ");
24591 g_object_class_override_property (gobject_class, 2, "fan");
24592 g_object_class_override_property (gobject_class, 3, "sensor-value");
24593 g_object_class_override_property (gobject_class, 4, "sensor-threshold");
24594 g_object_class_override_property (gobject_class, 5, "sensor-i2c");
24595 g_object_class_override_property (gobject_class, 6, "sensor-match");
24596 g_object_class_override_property (gobject_class, 7, "process");
24597 g_object_class_override_property (gobject_class, 8, "control");
24598 g_object_class_override_property (gobject_class, 9, "control-bmc");
24599 g_object_class_override_property (gobject_class, 10, "control-host");
24600 g_object_class_override_property (gobject_class, 11, "control-power");
24601 g_object_class_override_property (gobject_class, 12, "watchdog");
24602 g_object_class_override_property (gobject_class, 13, "event-log");
24603 g_object_class_override_property (gobject_class, 14, "flash");
24604 g_object_class_override_property (gobject_class, 15, "button");
24605 g_object_class_override_property (gobject_class, 16, "led");
24606}
24607
24608/**
24609 * object_proxy_new:
24610 * @connection: A #GDBusConnection.
24611 * @object_path: An object path.
24612 *
24613 * Creates a new proxy object.
24614 *
24615 * Returns: (transfer full): The proxy object.
24616 */
24617ObjectProxy *
24618object_proxy_new (GDBusConnection *connection,
24619 const gchar *object_path)
24620{
24621 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
24622 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
24623 return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
24624}
24625
24626/**
24627 * ObjectSkeleton:
24628 *
24629 * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API.
24630 */
24631
24632/**
24633 * ObjectSkeletonClass:
24634 * @parent_class: The parent class.
24635 *
24636 * Class structure for #ObjectSkeleton.
24637 */
24638
24639static void
24640object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
24641{
24642}
24643
24644
24645static void
24646object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
24647{
24648 iface->interface_added = object_notify;
24649 iface->interface_removed = object_notify;
24650}
24651
24652G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
24653 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init)
24654 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init));
24655
24656static void
24657object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED)
24658{
24659}
24660
24661static void
24662object_skeleton_set_property (GObject *gobject,
24663 guint prop_id,
24664 const GValue *value,
24665 GParamSpec *pspec)
24666{
24667 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
24668 GDBusInterfaceSkeleton *interface;
24669
24670 switch (prop_id)
24671 {
24672 case 1:
24673 interface = g_value_get_object (value);
24674 if (interface != NULL)
24675 {
24676 g_warn_if_fail (IS_OCC (interface));
24677 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24678 }
24679 else
24680 {
24681 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Occ");
24682 }
24683 break;
24684
24685 case 2:
24686 interface = g_value_get_object (value);
24687 if (interface != NULL)
24688 {
24689 g_warn_if_fail (IS_FAN (interface));
24690 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24691 }
24692 else
24693 {
24694 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Fan");
24695 }
24696 break;
24697
24698 case 3:
24699 interface = g_value_get_object (value);
24700 if (interface != NULL)
24701 {
24702 g_warn_if_fail (IS_SENSOR_VALUE (interface));
24703 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24704 }
24705 else
24706 {
24707 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorValue");
24708 }
24709 break;
24710
24711 case 4:
24712 interface = g_value_get_object (value);
24713 if (interface != NULL)
24714 {
24715 g_warn_if_fail (IS_SENSOR_THRESHOLD (interface));
24716 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24717 }
24718 else
24719 {
24720 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorThreshold");
24721 }
24722 break;
24723
24724 case 5:
24725 interface = g_value_get_object (value);
24726 if (interface != NULL)
24727 {
24728 g_warn_if_fail (IS_SENSOR_I2C (interface));
24729 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24730 }
24731 else
24732 {
24733 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorI2c");
24734 }
24735 break;
24736
24737 case 6:
24738 interface = g_value_get_object (value);
24739 if (interface != NULL)
24740 {
24741 g_warn_if_fail (IS_SENSOR_MATCH (interface));
24742 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24743 }
24744 else
24745 {
24746 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorMatch");
24747 }
24748 break;
24749
24750 case 7:
24751 interface = g_value_get_object (value);
24752 if (interface != NULL)
24753 {
24754 g_warn_if_fail (IS_PROCESS (interface));
24755 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24756 }
24757 else
24758 {
24759 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Process");
24760 }
24761 break;
24762
24763 case 8:
24764 interface = g_value_get_object (value);
24765 if (interface != NULL)
24766 {
24767 g_warn_if_fail (IS_CONTROL (interface));
24768 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24769 }
24770 else
24771 {
24772 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Control");
24773 }
24774 break;
24775
24776 case 9:
24777 interface = g_value_get_object (value);
24778 if (interface != NULL)
24779 {
24780 g_warn_if_fail (IS_CONTROL_BMC (interface));
24781 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24782 }
24783 else
24784 {
24785 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Bmc");
24786 }
24787 break;
24788
24789 case 10:
24790 interface = g_value_get_object (value);
24791 if (interface != NULL)
24792 {
24793 g_warn_if_fail (IS_CONTROL_HOST (interface));
24794 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24795 }
24796 else
24797 {
24798 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Host");
24799 }
24800 break;
24801
24802 case 11:
24803 interface = g_value_get_object (value);
24804 if (interface != NULL)
24805 {
24806 g_warn_if_fail (IS_CONTROL_POWER (interface));
24807 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24808 }
24809 else
24810 {
24811 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Power");
24812 }
24813 break;
24814
24815 case 12:
24816 interface = g_value_get_object (value);
24817 if (interface != NULL)
24818 {
24819 g_warn_if_fail (IS_WATCHDOG (interface));
24820 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24821 }
24822 else
24823 {
24824 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Watchdog");
24825 }
24826 break;
24827
24828 case 13:
24829 interface = g_value_get_object (value);
24830 if (interface != NULL)
24831 {
24832 g_warn_if_fail (IS_EVENT_LOG (interface));
24833 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24834 }
24835 else
24836 {
24837 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.EventLog");
24838 }
24839 break;
24840
24841 case 14:
24842 interface = g_value_get_object (value);
24843 if (interface != NULL)
24844 {
24845 g_warn_if_fail (IS_FLASH (interface));
24846 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24847 }
24848 else
24849 {
24850 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Flash");
24851 }
24852 break;
24853
24854 case 15:
24855 interface = g_value_get_object (value);
24856 if (interface != NULL)
24857 {
24858 g_warn_if_fail (IS_BUTTON (interface));
24859 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24860 }
24861 else
24862 {
24863 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Button");
24864 }
24865 break;
24866
24867 case 16:
24868 interface = g_value_get_object (value);
24869 if (interface != NULL)
24870 {
24871 g_warn_if_fail (IS_LED (interface));
24872 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24873 }
24874 else
24875 {
24876 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Led");
24877 }
24878 break;
24879
24880 default:
24881 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
24882 break;
24883 }
24884}
24885
24886static void
24887object_skeleton_get_property (GObject *gobject,
24888 guint prop_id,
24889 GValue *value,
24890 GParamSpec *pspec)
24891{
24892 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
24893 GDBusInterface *interface;
24894
24895 switch (prop_id)
24896 {
24897 case 1:
24898 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
24899 g_value_take_object (value, interface);
24900 break;
24901
24902 case 2:
24903 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
24904 g_value_take_object (value, interface);
24905 break;
24906
24907 case 3:
24908 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
24909 g_value_take_object (value, interface);
24910 break;
24911
24912 case 4:
24913 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
24914 g_value_take_object (value, interface);
24915 break;
24916
24917 case 5:
24918 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
24919 g_value_take_object (value, interface);
24920 break;
24921
24922 case 6:
24923 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
24924 g_value_take_object (value, interface);
24925 break;
24926
24927 case 7:
24928 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
24929 g_value_take_object (value, interface);
24930 break;
24931
24932 case 8:
24933 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
24934 g_value_take_object (value, interface);
24935 break;
24936
24937 case 9:
24938 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
24939 g_value_take_object (value, interface);
24940 break;
24941
24942 case 10:
24943 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
24944 g_value_take_object (value, interface);
24945 break;
24946
24947 case 11:
24948 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
24949 g_value_take_object (value, interface);
24950 break;
24951
24952 case 12:
24953 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
24954 g_value_take_object (value, interface);
24955 break;
24956
24957 case 13:
24958 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
24959 g_value_take_object (value, interface);
24960 break;
24961
24962 case 14:
24963 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
24964 g_value_take_object (value, interface);
24965 break;
24966
24967 case 15:
24968 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
24969 g_value_take_object (value, interface);
24970 break;
24971
24972 case 16:
24973 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
24974 g_value_take_object (value, interface);
24975 break;
24976
24977 default:
24978 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
24979 break;
24980 }
24981}
24982
24983static void
24984object_skeleton_class_init (ObjectSkeletonClass *klass)
24985{
24986 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
24987
24988 gobject_class->set_property = object_skeleton_set_property;
24989 gobject_class->get_property = object_skeleton_get_property;
24990
24991 g_object_class_override_property (gobject_class, 1, "occ");
24992 g_object_class_override_property (gobject_class, 2, "fan");
24993 g_object_class_override_property (gobject_class, 3, "sensor-value");
24994 g_object_class_override_property (gobject_class, 4, "sensor-threshold");
24995 g_object_class_override_property (gobject_class, 5, "sensor-i2c");
24996 g_object_class_override_property (gobject_class, 6, "sensor-match");
24997 g_object_class_override_property (gobject_class, 7, "process");
24998 g_object_class_override_property (gobject_class, 8, "control");
24999 g_object_class_override_property (gobject_class, 9, "control-bmc");
25000 g_object_class_override_property (gobject_class, 10, "control-host");
25001 g_object_class_override_property (gobject_class, 11, "control-power");
25002 g_object_class_override_property (gobject_class, 12, "watchdog");
25003 g_object_class_override_property (gobject_class, 13, "event-log");
25004 g_object_class_override_property (gobject_class, 14, "flash");
25005 g_object_class_override_property (gobject_class, 15, "button");
25006 g_object_class_override_property (gobject_class, 16, "led");
25007}
25008
25009/**
25010 * object_skeleton_new:
25011 * @object_path: An object path.
25012 *
25013 * Creates a new skeleton object.
25014 *
25015 * Returns: (transfer full): The skeleton object.
25016 */
25017ObjectSkeleton *
25018object_skeleton_new (const gchar *object_path)
25019{
25020 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
25021 return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
25022}
25023
25024/**
25025 * object_skeleton_set_occ:
25026 * @object: A #ObjectSkeleton.
25027 * @interface_: (allow-none): A #Occ or %NULL to clear the interface.
25028 *
25029 * Sets the #Occ instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link> on @object.
25030 */
25031void object_skeleton_set_occ (ObjectSkeleton *object, Occ *interface_)
25032{
25033 g_object_set (G_OBJECT (object), "occ", interface_, NULL);
25034}
25035
25036/**
25037 * object_skeleton_set_fan:
25038 * @object: A #ObjectSkeleton.
25039 * @interface_: (allow-none): A #Fan or %NULL to clear the interface.
25040 *
25041 * Sets the #Fan instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> on @object.
25042 */
25043void object_skeleton_set_fan (ObjectSkeleton *object, Fan *interface_)
25044{
25045 g_object_set (G_OBJECT (object), "fan", interface_, NULL);
25046}
25047
25048/**
25049 * object_skeleton_set_sensor_value:
25050 * @object: A #ObjectSkeleton.
25051 * @interface_: (allow-none): A #SensorValue or %NULL to clear the interface.
25052 *
25053 * Sets the #SensorValue instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> on @object.
25054 */
25055void object_skeleton_set_sensor_value (ObjectSkeleton *object, SensorValue *interface_)
25056{
25057 g_object_set (G_OBJECT (object), "sensor-value", interface_, NULL);
25058}
25059
25060/**
25061 * object_skeleton_set_sensor_threshold:
25062 * @object: A #ObjectSkeleton.
25063 * @interface_: (allow-none): A #SensorThreshold or %NULL to clear the interface.
25064 *
25065 * Sets the #SensorThreshold instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> on @object.
25066 */
25067void object_skeleton_set_sensor_threshold (ObjectSkeleton *object, SensorThreshold *interface_)
25068{
25069 g_object_set (G_OBJECT (object), "sensor-threshold", interface_, NULL);
25070}
25071
25072/**
25073 * object_skeleton_set_sensor_i2c:
25074 * @object: A #ObjectSkeleton.
25075 * @interface_: (allow-none): A #SensorI2c or %NULL to clear the interface.
25076 *
25077 * Sets the #SensorI2c instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> on @object.
25078 */
25079void object_skeleton_set_sensor_i2c (ObjectSkeleton *object, SensorI2c *interface_)
25080{
25081 g_object_set (G_OBJECT (object), "sensor-i2c", interface_, NULL);
25082}
25083
25084/**
25085 * object_skeleton_set_sensor_match:
25086 * @object: A #ObjectSkeleton.
25087 * @interface_: (allow-none): A #SensorMatch or %NULL to clear the interface.
25088 *
25089 * Sets the #SensorMatch instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> on @object.
25090 */
25091void object_skeleton_set_sensor_match (ObjectSkeleton *object, SensorMatch *interface_)
25092{
25093 g_object_set (G_OBJECT (object), "sensor-match", interface_, NULL);
25094}
25095
25096/**
25097 * object_skeleton_set_process:
25098 * @object: A #ObjectSkeleton.
25099 * @interface_: (allow-none): A #Process or %NULL to clear the interface.
25100 *
25101 * Sets the #Process instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> on @object.
25102 */
25103void object_skeleton_set_process (ObjectSkeleton *object, Process *interface_)
25104{
25105 g_object_set (G_OBJECT (object), "process", interface_, NULL);
25106}
25107
25108/**
25109 * object_skeleton_set_control:
25110 * @object: A #ObjectSkeleton.
25111 * @interface_: (allow-none): A #Control or %NULL to clear the interface.
25112 *
25113 * Sets the #Control instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> on @object.
25114 */
25115void object_skeleton_set_control (ObjectSkeleton *object, Control *interface_)
25116{
25117 g_object_set (G_OBJECT (object), "control", interface_, NULL);
25118}
25119
25120/**
25121 * object_skeleton_set_control_bmc:
25122 * @object: A #ObjectSkeleton.
25123 * @interface_: (allow-none): A #ControlBmc or %NULL to clear the interface.
25124 *
25125 * Sets the #ControlBmc instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link> on @object.
25126 */
25127void object_skeleton_set_control_bmc (ObjectSkeleton *object, ControlBmc *interface_)
25128{
25129 g_object_set (G_OBJECT (object), "control-bmc", interface_, NULL);
25130}
25131
25132/**
25133 * object_skeleton_set_control_host:
25134 * @object: A #ObjectSkeleton.
25135 * @interface_: (allow-none): A #ControlHost or %NULL to clear the interface.
25136 *
25137 * 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.
25138 */
25139void object_skeleton_set_control_host (ObjectSkeleton *object, ControlHost *interface_)
25140{
25141 g_object_set (G_OBJECT (object), "control-host", interface_, NULL);
25142}
25143
25144/**
25145 * object_skeleton_set_control_power:
25146 * @object: A #ObjectSkeleton.
25147 * @interface_: (allow-none): A #ControlPower or %NULL to clear the interface.
25148 *
25149 * Sets the #ControlPower instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link> on @object.
25150 */
25151void object_skeleton_set_control_power (ObjectSkeleton *object, ControlPower *interface_)
25152{
25153 g_object_set (G_OBJECT (object), "control-power", interface_, NULL);
25154}
25155
25156/**
25157 * object_skeleton_set_watchdog:
25158 * @object: A #ObjectSkeleton.
25159 * @interface_: (allow-none): A #Watchdog or %NULL to clear the interface.
25160 *
25161 * Sets the #Watchdog instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> on @object.
25162 */
25163void object_skeleton_set_watchdog (ObjectSkeleton *object, Watchdog *interface_)
25164{
25165 g_object_set (G_OBJECT (object), "watchdog", interface_, NULL);
25166}
25167
25168/**
25169 * object_skeleton_set_event_log:
25170 * @object: A #ObjectSkeleton.
25171 * @interface_: (allow-none): A #EventLog or %NULL to clear the interface.
25172 *
25173 * Sets the #EventLog instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> on @object.
25174 */
25175void object_skeleton_set_event_log (ObjectSkeleton *object, EventLog *interface_)
25176{
25177 g_object_set (G_OBJECT (object), "event-log", interface_, NULL);
25178}
25179
25180/**
25181 * object_skeleton_set_flash:
25182 * @object: A #ObjectSkeleton.
25183 * @interface_: (allow-none): A #Flash or %NULL to clear the interface.
25184 *
25185 * 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.
25186 */
25187void object_skeleton_set_flash (ObjectSkeleton *object, Flash *interface_)
25188{
25189 g_object_set (G_OBJECT (object), "flash", interface_, NULL);
25190}
25191
25192/**
25193 * object_skeleton_set_button:
25194 * @object: A #ObjectSkeleton.
25195 * @interface_: (allow-none): A #Button or %NULL to clear the interface.
25196 *
25197 * Sets the #Button instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> on @object.
25198 */
25199void object_skeleton_set_button (ObjectSkeleton *object, Button *interface_)
25200{
25201 g_object_set (G_OBJECT (object), "button", interface_, NULL);
25202}
25203
25204/**
25205 * object_skeleton_set_led:
25206 * @object: A #ObjectSkeleton.
25207 * @interface_: (allow-none): A #Led or %NULL to clear the interface.
25208 *
25209 * Sets the #Led instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> on @object.
25210 */
25211void object_skeleton_set_led (ObjectSkeleton *object, Led *interface_)
25212{
25213 g_object_set (G_OBJECT (object), "led", interface_, NULL);
25214}
25215
25216
25217/* ------------------------------------------------------------------------
25218 * Code for ObjectManager client
25219 * ------------------------------------------------------------------------
25220 */
25221
25222/**
25223 * SECTION:ObjectManagerClient
25224 * @title: ObjectManagerClient
25225 * @short_description: Generated GDBusObjectManagerClient type
25226 *
25227 * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
25228 */
25229
25230/**
25231 * ObjectManagerClient:
25232 *
25233 * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API.
25234 */
25235
25236/**
25237 * ObjectManagerClientClass:
25238 * @parent_class: The parent class.
25239 *
25240 * Class structure for #ObjectManagerClient.
25241 */
25242
25243G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT);
25244
25245static void
25246object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED)
25247{
25248}
25249
25250static void
25251object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED)
25252{
25253}
25254
25255/**
25256 * object_manager_client_get_proxy_type:
25257 * @manager: A #GDBusObjectManagerClient.
25258 * @object_path: The object path of the remote object (unused).
25259 * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType.
25260 * @user_data: User data (unused).
25261 *
25262 * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types.
25263 *
25264 * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy.
25265 */
25266GType
25267object_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)
25268{
25269 static gsize once_init_value = 0;
25270 static GHashTable *lookup_hash;
25271 GType ret;
25272
25273 if (interface_name == NULL)
25274 return TYPE_OBJECT_PROXY;
25275 if (g_once_init_enter (&once_init_value))
25276 {
25277 lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
25278 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Occ", GSIZE_TO_POINTER (TYPE_OCC_PROXY));
25279 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Fan", GSIZE_TO_POINTER (TYPE_FAN_PROXY));
25280 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorValue", GSIZE_TO_POINTER (TYPE_SENSOR_VALUE_PROXY));
25281 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_THRESHOLD_PROXY));
25282 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorI2c", GSIZE_TO_POINTER (TYPE_SENSOR_I2C_PROXY));
25283 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorMatch", GSIZE_TO_POINTER (TYPE_SENSOR_MATCH_PROXY));
25284 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Process", GSIZE_TO_POINTER (TYPE_PROCESS_PROXY));
25285 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Control", GSIZE_TO_POINTER (TYPE_CONTROL_PROXY));
25286 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Bmc", GSIZE_TO_POINTER (TYPE_CONTROL_BMC_PROXY));
25287 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Host", GSIZE_TO_POINTER (TYPE_CONTROL_HOST_PROXY));
25288 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Power", GSIZE_TO_POINTER (TYPE_CONTROL_POWER_PROXY));
25289 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Watchdog", GSIZE_TO_POINTER (TYPE_WATCHDOG_PROXY));
25290 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.EventLog", GSIZE_TO_POINTER (TYPE_EVENT_LOG_PROXY));
25291 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Flash", GSIZE_TO_POINTER (TYPE_FLASH_PROXY));
25292 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Button", GSIZE_TO_POINTER (TYPE_BUTTON_PROXY));
25293 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Led", GSIZE_TO_POINTER (TYPE_LED_PROXY));
25294 g_once_init_leave (&once_init_value, 1);
25295 }
25296 ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
25297 if (ret == (GType) 0)
25298 ret = G_TYPE_DBUS_PROXY;
25299 return ret;
25300}
25301
25302/**
25303 * object_manager_client_new:
25304 * @connection: A #GDBusConnection.
25305 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
25306 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
25307 * @object_path: An object path.
25308 * @cancellable: (allow-none): A #GCancellable or %NULL.
25309 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
25310 * @user_data: User data to pass to @callback.
25311 *
25312 * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
25313 *
25314 * 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.
25315 * You can then call object_manager_client_new_finish() to get the result of the operation.
25316 *
25317 * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
25318 */
25319void
25320object_manager_client_new (
25321 GDBusConnection *connection,
25322 GDBusObjectManagerClientFlags flags,
25323 const gchar *name,
25324 const gchar *object_path,
25325 GCancellable *cancellable,
25326 GAsyncReadyCallback callback,
25327 gpointer user_data)
25328{
25329 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);
25330}
25331
25332/**
25333 * object_manager_client_new_finish:
25334 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new().
25335 * @error: Return location for error or %NULL
25336 *
25337 * Finishes an operation started with object_manager_client_new().
25338 *
25339 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
25340 */
25341GDBusObjectManager *
25342object_manager_client_new_finish (
25343 GAsyncResult *res,
25344 GError **error)
25345{
25346 GObject *ret;
25347 GObject *source_object;
25348 source_object = g_async_result_get_source_object (res);
25349 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
25350 g_object_unref (source_object);
25351 if (ret != NULL)
25352 return G_DBUS_OBJECT_MANAGER (ret);
25353 else
25354 return NULL;
25355}
25356
25357/**
25358 * object_manager_client_new_sync:
25359 * @connection: A #GDBusConnection.
25360 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
25361 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
25362 * @object_path: An object path.
25363 * @cancellable: (allow-none): A #GCancellable or %NULL.
25364 * @error: Return location for error or %NULL
25365 *
25366 * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
25367 *
25368 * The calling thread is blocked until a reply is received.
25369 *
25370 * See object_manager_client_new() for the asynchronous version of this constructor.
25371 *
25372 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
25373 */
25374GDBusObjectManager *
25375object_manager_client_new_sync (
25376 GDBusConnection *connection,
25377 GDBusObjectManagerClientFlags flags,
25378 const gchar *name,
25379 const gchar *object_path,
25380 GCancellable *cancellable,
25381 GError **error)
25382{
25383 GInitable *ret;
25384 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);
25385 if (ret != NULL)
25386 return G_DBUS_OBJECT_MANAGER (ret);
25387 else
25388 return NULL;
25389}
25390
25391
25392/**
25393 * object_manager_client_new_for_bus:
25394 * @bus_type: A #GBusType.
25395 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
25396 * @name: A bus name (well-known or unique).
25397 * @object_path: An object path.
25398 * @cancellable: (allow-none): A #GCancellable or %NULL.
25399 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
25400 * @user_data: User data to pass to @callback.
25401 *
25402 * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
25403 *
25404 * 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.
25405 * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation.
25406 *
25407 * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
25408 */
25409void
25410object_manager_client_new_for_bus (
25411 GBusType bus_type,
25412 GDBusObjectManagerClientFlags flags,
25413 const gchar *name,
25414 const gchar *object_path,
25415 GCancellable *cancellable,
25416 GAsyncReadyCallback callback,
25417 gpointer user_data)
25418{
25419 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);
25420}
25421
25422/**
25423 * object_manager_client_new_for_bus_finish:
25424 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus().
25425 * @error: Return location for error or %NULL
25426 *
25427 * Finishes an operation started with object_manager_client_new_for_bus().
25428 *
25429 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
25430 */
25431GDBusObjectManager *
25432object_manager_client_new_for_bus_finish (
25433 GAsyncResult *res,
25434 GError **error)
25435{
25436 GObject *ret;
25437 GObject *source_object;
25438 source_object = g_async_result_get_source_object (res);
25439 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
25440 g_object_unref (source_object);
25441 if (ret != NULL)
25442 return G_DBUS_OBJECT_MANAGER (ret);
25443 else
25444 return NULL;
25445}
25446
25447/**
25448 * object_manager_client_new_for_bus_sync:
25449 * @bus_type: A #GBusType.
25450 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
25451 * @name: A bus name (well-known or unique).
25452 * @object_path: An object path.
25453 * @cancellable: (allow-none): A #GCancellable or %NULL.
25454 * @error: Return location for error or %NULL
25455 *
25456 * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
25457 *
25458 * The calling thread is blocked until a reply is received.
25459 *
25460 * See object_manager_client_new_for_bus() for the asynchronous version of this constructor.
25461 *
25462 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
25463 */
25464GDBusObjectManager *
25465object_manager_client_new_for_bus_sync (
25466 GBusType bus_type,
25467 GDBusObjectManagerClientFlags flags,
25468 const gchar *name,
25469 const gchar *object_path,
25470 GCancellable *cancellable,
25471 GError **error)
25472{
25473 GInitable *ret;
25474 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);
25475 if (ret != NULL)
25476 return G_DBUS_OBJECT_MANAGER (ret);
25477 else
25478 return NULL;
25479}
25480
25481