blob: 6fbda1e513ec24d4ee98184ef4f2bf5e88f7c08d [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
Norman James2d1ee892015-09-16 23:13:45 -0500212static const _ExtendedGDBusPropertyInfo _occ_property_info_instance_name =
213{
214 {
215 -1,
216 (gchar *) "instance_name",
217 (gchar *) "s",
218 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
219 NULL
220 },
221 "instance-name",
222 FALSE
223};
224
Norman James362a80f2015-09-14 14:04:39 -0500225static const _ExtendedGDBusPropertyInfo _occ_property_info_poll_interval =
226{
227 {
228 -1,
229 (gchar *) "poll_interval",
230 (gchar *) "i",
231 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
232 NULL
233 },
234 "poll-interval",
235 FALSE
236};
237
238static const _ExtendedGDBusPropertyInfo * const _occ_property_info_pointers[] =
239{
240 &_occ_property_info_state,
Norman James2d1ee892015-09-16 23:13:45 -0500241 &_occ_property_info_instance_name,
Norman James362a80f2015-09-14 14:04:39 -0500242 &_occ_property_info_poll_interval,
243 NULL
244};
245
246static const _ExtendedGDBusInterfaceInfo _occ_interface_info =
247{
248 {
249 -1,
250 (gchar *) "org.openbmc.Occ",
251 (GDBusMethodInfo **) &_occ_method_info_pointers,
252 NULL,
253 (GDBusPropertyInfo **) &_occ_property_info_pointers,
254 NULL
255 },
256 "occ",
257};
258
259
260/**
261 * occ_interface_info:
262 *
263 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link> D-Bus interface.
264 *
265 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
266 */
267GDBusInterfaceInfo *
268occ_interface_info (void)
269{
270 return (GDBusInterfaceInfo *) &_occ_interface_info.parent_struct;
271}
272
273/**
274 * occ_override_properties:
275 * @klass: The class structure for a #GObject<!-- -->-derived class.
276 * @property_id_begin: The property id to assign to the first overridden property.
277 *
278 * Overrides all #GObject properties in the #Occ interface for a concrete class.
279 * The properties are overridden in the order they are defined.
280 *
281 * Returns: The last property id.
282 */
283guint
284occ_override_properties (GObjectClass *klass, guint property_id_begin)
285{
286 g_object_class_override_property (klass, property_id_begin++, "state");
Norman James2d1ee892015-09-16 23:13:45 -0500287 g_object_class_override_property (klass, property_id_begin++, "instance-name");
Norman James362a80f2015-09-14 14:04:39 -0500288 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
289 return property_id_begin - 1;
290}
291
292
293
294/**
295 * Occ:
296 *
297 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>.
298 */
299
300/**
301 * OccIface:
302 * @parent_iface: The parent interface.
303 * @handle_collect: Handler for the #Occ::handle-collect signal.
304 * @handle_init: Handler for the #Occ::handle-init signal.
Norman James2d1ee892015-09-16 23:13:45 -0500305 * @get_instance_name: Getter for the #Occ:instance-name property.
Norman James362a80f2015-09-14 14:04:39 -0500306 * @get_poll_interval: Getter for the #Occ:poll-interval property.
307 * @get_state: Getter for the #Occ:state property.
308 *
309 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>.
310 */
311
312typedef OccIface OccInterface;
313G_DEFINE_INTERFACE (Occ, occ, G_TYPE_OBJECT);
314
315static void
316occ_default_init (OccIface *iface)
317{
318 /* GObject signals for incoming D-Bus method calls: */
319 /**
320 * Occ::handle-init:
321 * @object: A #Occ.
322 * @invocation: A #GDBusMethodInvocation.
323 *
324 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Occ.init">init()</link> D-Bus method.
325 *
326 * 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.
327 *
328 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
329 */
330 g_signal_new ("handle-init",
331 G_TYPE_FROM_INTERFACE (iface),
332 G_SIGNAL_RUN_LAST,
333 G_STRUCT_OFFSET (OccIface, handle_init),
334 g_signal_accumulator_true_handled,
335 NULL,
336 g_cclosure_marshal_generic,
337 G_TYPE_BOOLEAN,
338 1,
339 G_TYPE_DBUS_METHOD_INVOCATION);
340
341 /**
342 * Occ::handle-collect:
343 * @object: A #Occ.
344 * @invocation: A #GDBusMethodInvocation.
345 *
346 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Occ.collect">collect()</link> D-Bus method.
347 *
348 * 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.
349 *
350 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
351 */
352 g_signal_new ("handle-collect",
353 G_TYPE_FROM_INTERFACE (iface),
354 G_SIGNAL_RUN_LAST,
355 G_STRUCT_OFFSET (OccIface, handle_collect),
356 g_signal_accumulator_true_handled,
357 NULL,
358 g_cclosure_marshal_generic,
359 G_TYPE_BOOLEAN,
360 1,
361 G_TYPE_DBUS_METHOD_INVOCATION);
362
363 /* GObject properties for D-Bus properties: */
364 /**
365 * Occ:state:
366 *
367 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Occ.state">"state"</link>.
368 *
369 * 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.
370 */
371 g_object_interface_install_property (iface,
372 g_param_spec_string ("state", "state", "state", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
373 /**
Norman James2d1ee892015-09-16 23:13:45 -0500374 * Occ:instance-name:
375 *
376 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Occ.instance_name">"instance_name"</link>.
377 *
378 * 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.
379 */
380 g_object_interface_install_property (iface,
381 g_param_spec_string ("instance-name", "instance_name", "instance_name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
382 /**
Norman James362a80f2015-09-14 14:04:39 -0500383 * Occ:poll-interval:
384 *
385 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Occ.poll_interval">"poll_interval"</link>.
386 *
387 * 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.
388 */
389 g_object_interface_install_property (iface,
390 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
391}
392
393/**
394 * occ_get_state: (skip)
395 * @object: A #Occ.
396 *
397 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Occ.state">"state"</link> D-Bus property.
398 *
399 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
400 *
401 * <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>
402 *
403 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
404 */
405const gchar *
406occ_get_state (Occ *object)
407{
408 return OCC_GET_IFACE (object)->get_state (object);
409}
410
411/**
412 * occ_dup_state: (skip)
413 * @object: A #Occ.
414 *
415 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Occ.state">"state"</link> D-Bus property.
416 *
417 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
418 *
419 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
420 */
421gchar *
422occ_dup_state (Occ *object)
423{
424 gchar *value;
425 g_object_get (G_OBJECT (object), "state", &value, NULL);
426 return value;
427}
428
429/**
430 * occ_set_state: (skip)
431 * @object: A #Occ.
432 * @value: The value to set.
433 *
434 * Sets the <link linkend="gdbus-property-org-openbmc-Occ.state">"state"</link> D-Bus property to @value.
435 *
436 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
437 */
438void
439occ_set_state (Occ *object, const gchar *value)
440{
441 g_object_set (G_OBJECT (object), "state", value, NULL);
442}
443
444/**
Norman James2d1ee892015-09-16 23:13:45 -0500445 * occ_get_instance_name: (skip)
446 * @object: A #Occ.
447 *
448 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Occ.instance_name">"instance_name"</link> D-Bus property.
449 *
450 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
451 *
452 * <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_instance_name() if on another thread.</warning>
453 *
454 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
455 */
456const gchar *
457occ_get_instance_name (Occ *object)
458{
459 return OCC_GET_IFACE (object)->get_instance_name (object);
460}
461
462/**
463 * occ_dup_instance_name: (skip)
464 * @object: A #Occ.
465 *
466 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Occ.instance_name">"instance_name"</link> D-Bus property.
467 *
468 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
469 *
470 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
471 */
472gchar *
473occ_dup_instance_name (Occ *object)
474{
475 gchar *value;
476 g_object_get (G_OBJECT (object), "instance-name", &value, NULL);
477 return value;
478}
479
480/**
481 * occ_set_instance_name: (skip)
482 * @object: A #Occ.
483 * @value: The value to set.
484 *
485 * Sets the <link linkend="gdbus-property-org-openbmc-Occ.instance_name">"instance_name"</link> D-Bus property to @value.
486 *
487 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
488 */
489void
490occ_set_instance_name (Occ *object, const gchar *value)
491{
492 g_object_set (G_OBJECT (object), "instance-name", value, NULL);
493}
494
495/**
Norman James362a80f2015-09-14 14:04:39 -0500496 * occ_get_poll_interval: (skip)
497 * @object: A #Occ.
498 *
499 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Occ.poll_interval">"poll_interval"</link> D-Bus property.
500 *
501 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
502 *
503 * Returns: The property value.
504 */
505gint
506occ_get_poll_interval (Occ *object)
507{
508 return OCC_GET_IFACE (object)->get_poll_interval (object);
509}
510
511/**
512 * occ_set_poll_interval: (skip)
513 * @object: A #Occ.
514 * @value: The value to set.
515 *
516 * Sets the <link linkend="gdbus-property-org-openbmc-Occ.poll_interval">"poll_interval"</link> D-Bus property to @value.
517 *
518 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
519 */
520void
521occ_set_poll_interval (Occ *object, gint value)
522{
523 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
524}
525
526/**
527 * occ_call_init:
528 * @proxy: A #OccProxy.
529 * @cancellable: (allow-none): A #GCancellable or %NULL.
530 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
531 * @user_data: User data to pass to @callback.
532 *
533 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Occ.init">init()</link> D-Bus method on @proxy.
534 * 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.
535 * You can then call occ_call_init_finish() to get the result of the operation.
536 *
537 * See occ_call_init_sync() for the synchronous, blocking version of this method.
538 */
539void
540occ_call_init (
541 Occ *proxy,
542 GCancellable *cancellable,
543 GAsyncReadyCallback callback,
544 gpointer user_data)
545{
546 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
547 "init",
548 g_variant_new ("()"),
549 G_DBUS_CALL_FLAGS_NONE,
550 -1,
551 cancellable,
552 callback,
553 user_data);
554}
555
556/**
557 * occ_call_init_finish:
558 * @proxy: A #OccProxy.
559 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to occ_call_init().
560 * @error: Return location for error or %NULL.
561 *
562 * Finishes an operation started with occ_call_init().
563 *
564 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
565 */
566gboolean
567occ_call_init_finish (
568 Occ *proxy,
569 GAsyncResult *res,
570 GError **error)
571{
572 GVariant *_ret;
573 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
574 if (_ret == NULL)
575 goto _out;
576 g_variant_get (_ret,
577 "()");
578 g_variant_unref (_ret);
579_out:
580 return _ret != NULL;
581}
582
583/**
584 * occ_call_init_sync:
585 * @proxy: A #OccProxy.
586 * @cancellable: (allow-none): A #GCancellable or %NULL.
587 * @error: Return location for error or %NULL.
588 *
589 * 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.
590 *
591 * See occ_call_init() for the asynchronous version of this method.
592 *
593 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
594 */
595gboolean
596occ_call_init_sync (
597 Occ *proxy,
598 GCancellable *cancellable,
599 GError **error)
600{
601 GVariant *_ret;
602 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
603 "init",
604 g_variant_new ("()"),
605 G_DBUS_CALL_FLAGS_NONE,
606 -1,
607 cancellable,
608 error);
609 if (_ret == NULL)
610 goto _out;
611 g_variant_get (_ret,
612 "()");
613 g_variant_unref (_ret);
614_out:
615 return _ret != NULL;
616}
617
618/**
619 * occ_call_collect:
620 * @proxy: A #OccProxy.
621 * @cancellable: (allow-none): A #GCancellable or %NULL.
622 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
623 * @user_data: User data to pass to @callback.
624 *
625 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Occ.collect">collect()</link> D-Bus method on @proxy.
626 * 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.
627 * You can then call occ_call_collect_finish() to get the result of the operation.
628 *
629 * See occ_call_collect_sync() for the synchronous, blocking version of this method.
630 */
631void
632occ_call_collect (
633 Occ *proxy,
634 GCancellable *cancellable,
635 GAsyncReadyCallback callback,
636 gpointer user_data)
637{
638 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
639 "collect",
640 g_variant_new ("()"),
641 G_DBUS_CALL_FLAGS_NONE,
642 -1,
643 cancellable,
644 callback,
645 user_data);
646}
647
648/**
649 * occ_call_collect_finish:
650 * @proxy: A #OccProxy.
651 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to occ_call_collect().
652 * @error: Return location for error or %NULL.
653 *
654 * Finishes an operation started with occ_call_collect().
655 *
656 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
657 */
658gboolean
659occ_call_collect_finish (
660 Occ *proxy,
661 GAsyncResult *res,
662 GError **error)
663{
664 GVariant *_ret;
665 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
666 if (_ret == NULL)
667 goto _out;
668 g_variant_get (_ret,
669 "()");
670 g_variant_unref (_ret);
671_out:
672 return _ret != NULL;
673}
674
675/**
676 * occ_call_collect_sync:
677 * @proxy: A #OccProxy.
678 * @cancellable: (allow-none): A #GCancellable or %NULL.
679 * @error: Return location for error or %NULL.
680 *
681 * 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.
682 *
683 * See occ_call_collect() for the asynchronous version of this method.
684 *
685 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
686 */
687gboolean
688occ_call_collect_sync (
689 Occ *proxy,
690 GCancellable *cancellable,
691 GError **error)
692{
693 GVariant *_ret;
694 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
695 "collect",
696 g_variant_new ("()"),
697 G_DBUS_CALL_FLAGS_NONE,
698 -1,
699 cancellable,
700 error);
701 if (_ret == NULL)
702 goto _out;
703 g_variant_get (_ret,
704 "()");
705 g_variant_unref (_ret);
706_out:
707 return _ret != NULL;
708}
709
710/**
711 * occ_complete_init:
712 * @object: A #Occ.
713 * @invocation: (transfer full): A #GDBusMethodInvocation.
714 *
715 * 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.
716 *
717 * This method will free @invocation, you cannot use it afterwards.
718 */
719void
720occ_complete_init (
721 Occ *object,
722 GDBusMethodInvocation *invocation)
723{
724 g_dbus_method_invocation_return_value (invocation,
725 g_variant_new ("()"));
726}
727
728/**
729 * occ_complete_collect:
730 * @object: A #Occ.
731 * @invocation: (transfer full): A #GDBusMethodInvocation.
732 *
733 * 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.
734 *
735 * This method will free @invocation, you cannot use it afterwards.
736 */
737void
738occ_complete_collect (
739 Occ *object,
740 GDBusMethodInvocation *invocation)
741{
742 g_dbus_method_invocation_return_value (invocation,
743 g_variant_new ("()"));
744}
745
746/* ------------------------------------------------------------------------ */
747
748/**
749 * OccProxy:
750 *
751 * The #OccProxy structure contains only private data and should only be accessed using the provided API.
752 */
753
754/**
755 * OccProxyClass:
756 * @parent_class: The parent class.
757 *
758 * Class structure for #OccProxy.
759 */
760
761struct _OccProxyPrivate
762{
763 GData *qdata;
764};
765
766static void occ_proxy_iface_init (OccIface *iface);
767
768#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
769G_DEFINE_TYPE_WITH_CODE (OccProxy, occ_proxy, G_TYPE_DBUS_PROXY,
770 G_ADD_PRIVATE (OccProxy)
771 G_IMPLEMENT_INTERFACE (TYPE_OCC, occ_proxy_iface_init));
772
773#else
774G_DEFINE_TYPE_WITH_CODE (OccProxy, occ_proxy, G_TYPE_DBUS_PROXY,
775 G_IMPLEMENT_INTERFACE (TYPE_OCC, occ_proxy_iface_init));
776
777#endif
778static void
779occ_proxy_finalize (GObject *object)
780{
781 OccProxy *proxy = OCC_PROXY (object);
782 g_datalist_clear (&proxy->priv->qdata);
783 G_OBJECT_CLASS (occ_proxy_parent_class)->finalize (object);
784}
785
786static void
787occ_proxy_get_property (GObject *object,
788 guint prop_id,
789 GValue *value,
790 GParamSpec *pspec G_GNUC_UNUSED)
791{
792 const _ExtendedGDBusPropertyInfo *info;
793 GVariant *variant;
Norman James2d1ee892015-09-16 23:13:45 -0500794 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -0500795 info = _occ_property_info_pointers[prop_id - 1];
796 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
797 if (info->use_gvariant)
798 {
799 g_value_set_variant (value, variant);
800 }
801 else
802 {
803 if (variant != NULL)
804 g_dbus_gvariant_to_gvalue (variant, value);
805 }
806 if (variant != NULL)
807 g_variant_unref (variant);
808}
809
810static void
811occ_proxy_set_property_cb (GDBusProxy *proxy,
812 GAsyncResult *res,
813 gpointer user_data)
814{
815 const _ExtendedGDBusPropertyInfo *info = user_data;
816 GError *error;
817 GVariant *_ret;
818 error = NULL;
819 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
820 if (!_ret)
821 {
822 g_warning ("Error setting property '%s' on interface org.openbmc.Occ: %s (%s, %d)",
823 info->parent_struct.name,
824 error->message, g_quark_to_string (error->domain), error->code);
825 g_error_free (error);
826 }
827 else
828 {
829 g_variant_unref (_ret);
830 }
831}
832
833static void
834occ_proxy_set_property (GObject *object,
835 guint prop_id,
836 const GValue *value,
837 GParamSpec *pspec G_GNUC_UNUSED)
838{
839 const _ExtendedGDBusPropertyInfo *info;
840 GVariant *variant;
Norman James2d1ee892015-09-16 23:13:45 -0500841 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -0500842 info = _occ_property_info_pointers[prop_id - 1];
843 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
844 g_dbus_proxy_call (G_DBUS_PROXY (object),
845 "org.freedesktop.DBus.Properties.Set",
846 g_variant_new ("(ssv)", "org.openbmc.Occ", info->parent_struct.name, variant),
847 G_DBUS_CALL_FLAGS_NONE,
848 -1,
849 NULL, (GAsyncReadyCallback) occ_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
850 g_variant_unref (variant);
851}
852
853static void
854occ_proxy_g_signal (GDBusProxy *proxy,
855 const gchar *sender_name G_GNUC_UNUSED,
856 const gchar *signal_name,
857 GVariant *parameters)
858{
859 _ExtendedGDBusSignalInfo *info;
860 GVariantIter iter;
861 GVariant *child;
862 GValue *paramv;
863 guint num_params;
864 guint n;
865 guint signal_id;
866 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_occ_interface_info.parent_struct, signal_name);
867 if (info == NULL)
868 return;
869 num_params = g_variant_n_children (parameters);
870 paramv = g_new0 (GValue, num_params + 1);
871 g_value_init (&paramv[0], TYPE_OCC);
872 g_value_set_object (&paramv[0], proxy);
873 g_variant_iter_init (&iter, parameters);
874 n = 1;
875 while ((child = g_variant_iter_next_value (&iter)) != NULL)
876 {
877 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
878 if (arg_info->use_gvariant)
879 {
880 g_value_init (&paramv[n], G_TYPE_VARIANT);
881 g_value_set_variant (&paramv[n], child);
882 n++;
883 }
884 else
885 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
886 g_variant_unref (child);
887 }
888 signal_id = g_signal_lookup (info->signal_name, TYPE_OCC);
889 g_signal_emitv (paramv, signal_id, 0, NULL);
890 for (n = 0; n < num_params + 1; n++)
891 g_value_unset (&paramv[n]);
892 g_free (paramv);
893}
894
895static void
896occ_proxy_g_properties_changed (GDBusProxy *_proxy,
897 GVariant *changed_properties,
898 const gchar *const *invalidated_properties)
899{
900 OccProxy *proxy = OCC_PROXY (_proxy);
901 guint n;
902 const gchar *key;
903 GVariantIter *iter;
904 _ExtendedGDBusPropertyInfo *info;
905 g_variant_get (changed_properties, "a{sv}", &iter);
906 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
907 {
908 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_occ_interface_info.parent_struct, key);
909 g_datalist_remove_data (&proxy->priv->qdata, key);
910 if (info != NULL)
911 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
912 }
913 g_variant_iter_free (iter);
914 for (n = 0; invalidated_properties[n] != NULL; n++)
915 {
916 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_occ_interface_info.parent_struct, invalidated_properties[n]);
917 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
918 if (info != NULL)
919 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
920 }
921}
922
923static const gchar *
924occ_proxy_get_state (Occ *object)
925{
926 OccProxy *proxy = OCC_PROXY (object);
927 GVariant *variant;
928 const gchar *value = NULL;
929 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
930 if (variant != NULL)
931 {
932 value = g_variant_get_string (variant, NULL);
933 g_variant_unref (variant);
934 }
935 return value;
936}
937
Norman James2d1ee892015-09-16 23:13:45 -0500938static const gchar *
939occ_proxy_get_instance_name (Occ *object)
940{
941 OccProxy *proxy = OCC_PROXY (object);
942 GVariant *variant;
943 const gchar *value = NULL;
944 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "instance_name");
945 if (variant != NULL)
946 {
947 value = g_variant_get_string (variant, NULL);
948 g_variant_unref (variant);
949 }
950 return value;
951}
952
Norman James362a80f2015-09-14 14:04:39 -0500953static gint
954occ_proxy_get_poll_interval (Occ *object)
955{
956 OccProxy *proxy = OCC_PROXY (object);
957 GVariant *variant;
958 gint value = 0;
959 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
960 if (variant != NULL)
961 {
962 value = g_variant_get_int32 (variant);
963 g_variant_unref (variant);
964 }
965 return value;
966}
967
968static void
969occ_proxy_init (OccProxy *proxy)
970{
971#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
972 proxy->priv = occ_proxy_get_instance_private (proxy);
973#else
974 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_OCC_PROXY, OccProxyPrivate);
975#endif
976
977 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), occ_interface_info ());
978}
979
980static void
981occ_proxy_class_init (OccProxyClass *klass)
982{
983 GObjectClass *gobject_class;
984 GDBusProxyClass *proxy_class;
985
986 gobject_class = G_OBJECT_CLASS (klass);
987 gobject_class->finalize = occ_proxy_finalize;
988 gobject_class->get_property = occ_proxy_get_property;
989 gobject_class->set_property = occ_proxy_set_property;
990
991 proxy_class = G_DBUS_PROXY_CLASS (klass);
992 proxy_class->g_signal = occ_proxy_g_signal;
993 proxy_class->g_properties_changed = occ_proxy_g_properties_changed;
994
995 occ_override_properties (gobject_class, 1);
996
997#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
998 g_type_class_add_private (klass, sizeof (OccProxyPrivate));
999#endif
1000}
1001
1002static void
1003occ_proxy_iface_init (OccIface *iface)
1004{
1005 iface->get_state = occ_proxy_get_state;
Norman James2d1ee892015-09-16 23:13:45 -05001006 iface->get_instance_name = occ_proxy_get_instance_name;
Norman James362a80f2015-09-14 14:04:39 -05001007 iface->get_poll_interval = occ_proxy_get_poll_interval;
1008}
1009
1010/**
1011 * occ_proxy_new:
1012 * @connection: A #GDBusConnection.
1013 * @flags: Flags from the #GDBusProxyFlags enumeration.
1014 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1015 * @object_path: An object path.
1016 * @cancellable: (allow-none): A #GCancellable or %NULL.
1017 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1018 * @user_data: User data to pass to @callback.
1019 *
1020 * 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.
1021 *
1022 * 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.
1023 * You can then call occ_proxy_new_finish() to get the result of the operation.
1024 *
1025 * See occ_proxy_new_sync() for the synchronous, blocking version of this constructor.
1026 */
1027void
1028occ_proxy_new (
1029 GDBusConnection *connection,
1030 GDBusProxyFlags flags,
1031 const gchar *name,
1032 const gchar *object_path,
1033 GCancellable *cancellable,
1034 GAsyncReadyCallback callback,
1035 gpointer user_data)
1036{
1037 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);
1038}
1039
1040/**
1041 * occ_proxy_new_finish:
1042 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to occ_proxy_new().
1043 * @error: Return location for error or %NULL
1044 *
1045 * Finishes an operation started with occ_proxy_new().
1046 *
1047 * Returns: (transfer full) (type OccProxy): The constructed proxy object or %NULL if @error is set.
1048 */
1049Occ *
1050occ_proxy_new_finish (
1051 GAsyncResult *res,
1052 GError **error)
1053{
1054 GObject *ret;
1055 GObject *source_object;
1056 source_object = g_async_result_get_source_object (res);
1057 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1058 g_object_unref (source_object);
1059 if (ret != NULL)
1060 return OCC (ret);
1061 else
1062 return NULL;
1063}
1064
1065/**
1066 * occ_proxy_new_sync:
1067 * @connection: A #GDBusConnection.
1068 * @flags: Flags from the #GDBusProxyFlags enumeration.
1069 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1070 * @object_path: An object path.
1071 * @cancellable: (allow-none): A #GCancellable or %NULL.
1072 * @error: Return location for error or %NULL
1073 *
1074 * 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.
1075 *
1076 * The calling thread is blocked until a reply is received.
1077 *
1078 * See occ_proxy_new() for the asynchronous version of this constructor.
1079 *
1080 * Returns: (transfer full) (type OccProxy): The constructed proxy object or %NULL if @error is set.
1081 */
1082Occ *
1083occ_proxy_new_sync (
1084 GDBusConnection *connection,
1085 GDBusProxyFlags flags,
1086 const gchar *name,
1087 const gchar *object_path,
1088 GCancellable *cancellable,
1089 GError **error)
1090{
1091 GInitable *ret;
1092 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);
1093 if (ret != NULL)
1094 return OCC (ret);
1095 else
1096 return NULL;
1097}
1098
1099
1100/**
1101 * occ_proxy_new_for_bus:
1102 * @bus_type: A #GBusType.
1103 * @flags: Flags from the #GDBusProxyFlags enumeration.
1104 * @name: A bus name (well-known or unique).
1105 * @object_path: An object path.
1106 * @cancellable: (allow-none): A #GCancellable or %NULL.
1107 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1108 * @user_data: User data to pass to @callback.
1109 *
1110 * Like occ_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
1111 *
1112 * 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.
1113 * You can then call occ_proxy_new_for_bus_finish() to get the result of the operation.
1114 *
1115 * See occ_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
1116 */
1117void
1118occ_proxy_new_for_bus (
1119 GBusType bus_type,
1120 GDBusProxyFlags flags,
1121 const gchar *name,
1122 const gchar *object_path,
1123 GCancellable *cancellable,
1124 GAsyncReadyCallback callback,
1125 gpointer user_data)
1126{
1127 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);
1128}
1129
1130/**
1131 * occ_proxy_new_for_bus_finish:
1132 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to occ_proxy_new_for_bus().
1133 * @error: Return location for error or %NULL
1134 *
1135 * Finishes an operation started with occ_proxy_new_for_bus().
1136 *
1137 * Returns: (transfer full) (type OccProxy): The constructed proxy object or %NULL if @error is set.
1138 */
1139Occ *
1140occ_proxy_new_for_bus_finish (
1141 GAsyncResult *res,
1142 GError **error)
1143{
1144 GObject *ret;
1145 GObject *source_object;
1146 source_object = g_async_result_get_source_object (res);
1147 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1148 g_object_unref (source_object);
1149 if (ret != NULL)
1150 return OCC (ret);
1151 else
1152 return NULL;
1153}
1154
1155/**
1156 * occ_proxy_new_for_bus_sync:
1157 * @bus_type: A #GBusType.
1158 * @flags: Flags from the #GDBusProxyFlags enumeration.
1159 * @name: A bus name (well-known or unique).
1160 * @object_path: An object path.
1161 * @cancellable: (allow-none): A #GCancellable or %NULL.
1162 * @error: Return location for error or %NULL
1163 *
1164 * Like occ_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
1165 *
1166 * The calling thread is blocked until a reply is received.
1167 *
1168 * See occ_proxy_new_for_bus() for the asynchronous version of this constructor.
1169 *
1170 * Returns: (transfer full) (type OccProxy): The constructed proxy object or %NULL if @error is set.
1171 */
1172Occ *
1173occ_proxy_new_for_bus_sync (
1174 GBusType bus_type,
1175 GDBusProxyFlags flags,
1176 const gchar *name,
1177 const gchar *object_path,
1178 GCancellable *cancellable,
1179 GError **error)
1180{
1181 GInitable *ret;
1182 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);
1183 if (ret != NULL)
1184 return OCC (ret);
1185 else
1186 return NULL;
1187}
1188
1189
1190/* ------------------------------------------------------------------------ */
1191
1192/**
1193 * OccSkeleton:
1194 *
1195 * The #OccSkeleton structure contains only private data and should only be accessed using the provided API.
1196 */
1197
1198/**
1199 * OccSkeletonClass:
1200 * @parent_class: The parent class.
1201 *
1202 * Class structure for #OccSkeleton.
1203 */
1204
1205struct _OccSkeletonPrivate
1206{
1207 GValue *properties;
1208 GList *changed_properties;
1209 GSource *changed_properties_idle_source;
1210 GMainContext *context;
1211 GMutex lock;
1212};
1213
1214static void
1215_occ_skeleton_handle_method_call (
1216 GDBusConnection *connection G_GNUC_UNUSED,
1217 const gchar *sender G_GNUC_UNUSED,
1218 const gchar *object_path G_GNUC_UNUSED,
1219 const gchar *interface_name,
1220 const gchar *method_name,
1221 GVariant *parameters,
1222 GDBusMethodInvocation *invocation,
1223 gpointer user_data)
1224{
1225 OccSkeleton *skeleton = OCC_SKELETON (user_data);
1226 _ExtendedGDBusMethodInfo *info;
1227 GVariantIter iter;
1228 GVariant *child;
1229 GValue *paramv;
1230 guint num_params;
1231 guint num_extra;
1232 guint n;
1233 guint signal_id;
1234 GValue return_value = G_VALUE_INIT;
1235 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
1236 g_assert (info != NULL);
1237 num_params = g_variant_n_children (parameters);
1238 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
1239 n = 0;
1240 g_value_init (&paramv[n], TYPE_OCC);
1241 g_value_set_object (&paramv[n++], skeleton);
1242 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
1243 g_value_set_object (&paramv[n++], invocation);
1244 if (info->pass_fdlist)
1245 {
1246#ifdef G_OS_UNIX
1247 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
1248 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
1249#else
1250 g_assert_not_reached ();
1251#endif
1252 }
1253 g_variant_iter_init (&iter, parameters);
1254 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1255 {
1256 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
1257 if (arg_info->use_gvariant)
1258 {
1259 g_value_init (&paramv[n], G_TYPE_VARIANT);
1260 g_value_set_variant (&paramv[n], child);
1261 n++;
1262 }
1263 else
1264 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
1265 g_variant_unref (child);
1266 }
1267 signal_id = g_signal_lookup (info->signal_name, TYPE_OCC);
1268 g_value_init (&return_value, G_TYPE_BOOLEAN);
1269 g_signal_emitv (paramv, signal_id, 0, &return_value);
1270 if (!g_value_get_boolean (&return_value))
1271 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);
1272 g_value_unset (&return_value);
1273 for (n = 0; n < num_params + num_extra; n++)
1274 g_value_unset (&paramv[n]);
1275 g_free (paramv);
1276}
1277
1278static GVariant *
1279_occ_skeleton_handle_get_property (
1280 GDBusConnection *connection G_GNUC_UNUSED,
1281 const gchar *sender G_GNUC_UNUSED,
1282 const gchar *object_path G_GNUC_UNUSED,
1283 const gchar *interface_name G_GNUC_UNUSED,
1284 const gchar *property_name,
1285 GError **error,
1286 gpointer user_data)
1287{
1288 OccSkeleton *skeleton = OCC_SKELETON (user_data);
1289 GValue value = G_VALUE_INIT;
1290 GParamSpec *pspec;
1291 _ExtendedGDBusPropertyInfo *info;
1292 GVariant *ret;
1293 ret = NULL;
1294 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_occ_interface_info.parent_struct, property_name);
1295 g_assert (info != NULL);
1296 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1297 if (pspec == NULL)
1298 {
1299 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1300 }
1301 else
1302 {
1303 g_value_init (&value, pspec->value_type);
1304 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1305 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
1306 g_value_unset (&value);
1307 }
1308 return ret;
1309}
1310
1311static gboolean
1312_occ_skeleton_handle_set_property (
1313 GDBusConnection *connection G_GNUC_UNUSED,
1314 const gchar *sender G_GNUC_UNUSED,
1315 const gchar *object_path G_GNUC_UNUSED,
1316 const gchar *interface_name G_GNUC_UNUSED,
1317 const gchar *property_name,
1318 GVariant *variant,
1319 GError **error,
1320 gpointer user_data)
1321{
1322 OccSkeleton *skeleton = OCC_SKELETON (user_data);
1323 GValue value = G_VALUE_INIT;
1324 GParamSpec *pspec;
1325 _ExtendedGDBusPropertyInfo *info;
1326 gboolean ret;
1327 ret = FALSE;
1328 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_occ_interface_info.parent_struct, property_name);
1329 g_assert (info != NULL);
1330 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1331 if (pspec == NULL)
1332 {
1333 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1334 }
1335 else
1336 {
1337 if (info->use_gvariant)
1338 g_value_set_variant (&value, variant);
1339 else
1340 g_dbus_gvariant_to_gvalue (variant, &value);
1341 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1342 g_value_unset (&value);
1343 ret = TRUE;
1344 }
1345 return ret;
1346}
1347
1348static const GDBusInterfaceVTable _occ_skeleton_vtable =
1349{
1350 _occ_skeleton_handle_method_call,
1351 _occ_skeleton_handle_get_property,
1352 _occ_skeleton_handle_set_property,
1353 {NULL}
1354};
1355
1356static GDBusInterfaceInfo *
1357occ_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1358{
1359 return occ_interface_info ();
1360}
1361
1362static GDBusInterfaceVTable *
1363occ_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1364{
1365 return (GDBusInterfaceVTable *) &_occ_skeleton_vtable;
1366}
1367
1368static GVariant *
1369occ_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
1370{
1371 OccSkeleton *skeleton = OCC_SKELETON (_skeleton);
1372
1373 GVariantBuilder builder;
1374 guint n;
1375 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1376 if (_occ_interface_info.parent_struct.properties == NULL)
1377 goto out;
1378 for (n = 0; _occ_interface_info.parent_struct.properties[n] != NULL; n++)
1379 {
1380 GDBusPropertyInfo *info = _occ_interface_info.parent_struct.properties[n];
1381 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
1382 {
1383 GVariant *value;
1384 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);
1385 if (value != NULL)
1386 {
1387 g_variant_take_ref (value);
1388 g_variant_builder_add (&builder, "{sv}", info->name, value);
1389 g_variant_unref (value);
1390 }
1391 }
1392 }
1393out:
1394 return g_variant_builder_end (&builder);
1395}
1396
1397static gboolean _occ_emit_changed (gpointer user_data);
1398
1399static void
1400occ_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
1401{
1402 OccSkeleton *skeleton = OCC_SKELETON (_skeleton);
1403 gboolean emit_changed = FALSE;
1404
1405 g_mutex_lock (&skeleton->priv->lock);
1406 if (skeleton->priv->changed_properties_idle_source != NULL)
1407 {
1408 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1409 skeleton->priv->changed_properties_idle_source = NULL;
1410 emit_changed = TRUE;
1411 }
1412 g_mutex_unlock (&skeleton->priv->lock);
1413
1414 if (emit_changed)
1415 _occ_emit_changed (skeleton);
1416}
1417
1418static void occ_skeleton_iface_init (OccIface *iface);
1419#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1420G_DEFINE_TYPE_WITH_CODE (OccSkeleton, occ_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1421 G_ADD_PRIVATE (OccSkeleton)
1422 G_IMPLEMENT_INTERFACE (TYPE_OCC, occ_skeleton_iface_init));
1423
1424#else
1425G_DEFINE_TYPE_WITH_CODE (OccSkeleton, occ_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1426 G_IMPLEMENT_INTERFACE (TYPE_OCC, occ_skeleton_iface_init));
1427
1428#endif
1429static void
1430occ_skeleton_finalize (GObject *object)
1431{
1432 OccSkeleton *skeleton = OCC_SKELETON (object);
1433 guint n;
Norman James2d1ee892015-09-16 23:13:45 -05001434 for (n = 0; n < 3; n++)
Norman James362a80f2015-09-14 14:04:39 -05001435 g_value_unset (&skeleton->priv->properties[n]);
1436 g_free (skeleton->priv->properties);
1437 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1438 if (skeleton->priv->changed_properties_idle_source != NULL)
1439 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1440 g_main_context_unref (skeleton->priv->context);
1441 g_mutex_clear (&skeleton->priv->lock);
1442 G_OBJECT_CLASS (occ_skeleton_parent_class)->finalize (object);
1443}
1444
1445static void
1446occ_skeleton_get_property (GObject *object,
1447 guint prop_id,
1448 GValue *value,
1449 GParamSpec *pspec G_GNUC_UNUSED)
1450{
1451 OccSkeleton *skeleton = OCC_SKELETON (object);
Norman James2d1ee892015-09-16 23:13:45 -05001452 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -05001453 g_mutex_lock (&skeleton->priv->lock);
1454 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
1455 g_mutex_unlock (&skeleton->priv->lock);
1456}
1457
1458static gboolean
1459_occ_emit_changed (gpointer user_data)
1460{
1461 OccSkeleton *skeleton = OCC_SKELETON (user_data);
1462 GList *l;
1463 GVariantBuilder builder;
1464 GVariantBuilder invalidated_builder;
1465 guint num_changes;
1466
1467 g_mutex_lock (&skeleton->priv->lock);
1468 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1469 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
1470 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
1471 {
1472 ChangedProperty *cp = l->data;
1473 GVariant *variant;
1474 const GValue *cur_value;
1475
1476 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
1477 if (!_g_value_equal (cur_value, &cp->orig_value))
1478 {
1479 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
1480 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
1481 g_variant_unref (variant);
1482 num_changes++;
1483 }
1484 }
1485 if (num_changes > 0)
1486 {
1487 GList *connections, *ll;
1488 GVariant *signal_variant;
1489 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Occ",
1490 &builder, &invalidated_builder));
1491 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
1492 for (ll = connections; ll != NULL; ll = ll->next)
1493 {
1494 GDBusConnection *connection = ll->data;
1495
1496 g_dbus_connection_emit_signal (connection,
1497 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
1498 "org.freedesktop.DBus.Properties",
1499 "PropertiesChanged",
1500 signal_variant,
1501 NULL);
1502 }
1503 g_variant_unref (signal_variant);
1504 g_list_free_full (connections, g_object_unref);
1505 }
1506 else
1507 {
1508 g_variant_builder_clear (&builder);
1509 g_variant_builder_clear (&invalidated_builder);
1510 }
1511 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1512 skeleton->priv->changed_properties = NULL;
1513 skeleton->priv->changed_properties_idle_source = NULL;
1514 g_mutex_unlock (&skeleton->priv->lock);
1515 return FALSE;
1516}
1517
1518static void
1519_occ_schedule_emit_changed (OccSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
1520{
1521 ChangedProperty *cp;
1522 GList *l;
1523 cp = NULL;
1524 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
1525 {
1526 ChangedProperty *i_cp = l->data;
1527 if (i_cp->info == info)
1528 {
1529 cp = i_cp;
1530 break;
1531 }
1532 }
1533 if (cp == NULL)
1534 {
1535 cp = g_new0 (ChangedProperty, 1);
1536 cp->prop_id = prop_id;
1537 cp->info = info;
1538 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
1539 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
1540 g_value_copy (orig_value, &cp->orig_value);
1541 }
1542}
1543
1544static void
1545occ_skeleton_notify (GObject *object,
1546 GParamSpec *pspec G_GNUC_UNUSED)
1547{
1548 OccSkeleton *skeleton = OCC_SKELETON (object);
1549 g_mutex_lock (&skeleton->priv->lock);
1550 if (skeleton->priv->changed_properties != NULL &&
1551 skeleton->priv->changed_properties_idle_source == NULL)
1552 {
1553 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
1554 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
1555 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _occ_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
1556 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
1557 g_source_unref (skeleton->priv->changed_properties_idle_source);
1558 }
1559 g_mutex_unlock (&skeleton->priv->lock);
1560}
1561
1562static void
1563occ_skeleton_set_property (GObject *object,
1564 guint prop_id,
1565 const GValue *value,
1566 GParamSpec *pspec)
1567{
1568 OccSkeleton *skeleton = OCC_SKELETON (object);
Norman James2d1ee892015-09-16 23:13:45 -05001569 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -05001570 g_mutex_lock (&skeleton->priv->lock);
1571 g_object_freeze_notify (object);
1572 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
1573 {
1574 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
1575 _occ_schedule_emit_changed (skeleton, _occ_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
1576 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
1577 g_object_notify_by_pspec (object, pspec);
1578 }
1579 g_mutex_unlock (&skeleton->priv->lock);
1580 g_object_thaw_notify (object);
1581}
1582
1583static void
1584occ_skeleton_init (OccSkeleton *skeleton)
1585{
1586#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1587 skeleton->priv = occ_skeleton_get_instance_private (skeleton);
1588#else
1589 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_OCC_SKELETON, OccSkeletonPrivate);
1590#endif
1591
1592 g_mutex_init (&skeleton->priv->lock);
1593 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James2d1ee892015-09-16 23:13:45 -05001594 skeleton->priv->properties = g_new0 (GValue, 3);
Norman James362a80f2015-09-14 14:04:39 -05001595 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
Norman James2d1ee892015-09-16 23:13:45 -05001596 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
1597 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
Norman James362a80f2015-09-14 14:04:39 -05001598}
1599
1600static const gchar *
1601occ_skeleton_get_state (Occ *object)
1602{
1603 OccSkeleton *skeleton = OCC_SKELETON (object);
1604 const gchar *value;
1605 g_mutex_lock (&skeleton->priv->lock);
1606 value = g_value_get_string (&(skeleton->priv->properties[0]));
1607 g_mutex_unlock (&skeleton->priv->lock);
1608 return value;
1609}
1610
Norman James2d1ee892015-09-16 23:13:45 -05001611static const gchar *
1612occ_skeleton_get_instance_name (Occ *object)
1613{
1614 OccSkeleton *skeleton = OCC_SKELETON (object);
1615 const gchar *value;
1616 g_mutex_lock (&skeleton->priv->lock);
1617 value = g_value_get_string (&(skeleton->priv->properties[1]));
1618 g_mutex_unlock (&skeleton->priv->lock);
1619 return value;
1620}
1621
Norman James362a80f2015-09-14 14:04:39 -05001622static gint
1623occ_skeleton_get_poll_interval (Occ *object)
1624{
1625 OccSkeleton *skeleton = OCC_SKELETON (object);
1626 gint value;
1627 g_mutex_lock (&skeleton->priv->lock);
Norman James2d1ee892015-09-16 23:13:45 -05001628 value = g_value_get_int (&(skeleton->priv->properties[2]));
Norman James362a80f2015-09-14 14:04:39 -05001629 g_mutex_unlock (&skeleton->priv->lock);
1630 return value;
1631}
1632
1633static void
1634occ_skeleton_class_init (OccSkeletonClass *klass)
1635{
1636 GObjectClass *gobject_class;
1637 GDBusInterfaceSkeletonClass *skeleton_class;
1638
1639 gobject_class = G_OBJECT_CLASS (klass);
1640 gobject_class->finalize = occ_skeleton_finalize;
1641 gobject_class->get_property = occ_skeleton_get_property;
1642 gobject_class->set_property = occ_skeleton_set_property;
1643 gobject_class->notify = occ_skeleton_notify;
1644
1645
1646 occ_override_properties (gobject_class, 1);
1647
1648 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
1649 skeleton_class->get_info = occ_skeleton_dbus_interface_get_info;
1650 skeleton_class->get_properties = occ_skeleton_dbus_interface_get_properties;
1651 skeleton_class->flush = occ_skeleton_dbus_interface_flush;
1652 skeleton_class->get_vtable = occ_skeleton_dbus_interface_get_vtable;
1653
1654#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1655 g_type_class_add_private (klass, sizeof (OccSkeletonPrivate));
1656#endif
1657}
1658
1659static void
1660occ_skeleton_iface_init (OccIface *iface)
1661{
1662 iface->get_state = occ_skeleton_get_state;
Norman James2d1ee892015-09-16 23:13:45 -05001663 iface->get_instance_name = occ_skeleton_get_instance_name;
Norman James362a80f2015-09-14 14:04:39 -05001664 iface->get_poll_interval = occ_skeleton_get_poll_interval;
1665}
1666
1667/**
1668 * occ_skeleton_new:
1669 *
1670 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>.
1671 *
1672 * Returns: (transfer full) (type OccSkeleton): The skeleton object.
1673 */
1674Occ *
1675occ_skeleton_new (void)
1676{
1677 return OCC (g_object_new (TYPE_OCC_SKELETON, NULL));
1678}
1679
1680/* ------------------------------------------------------------------------
1681 * Code for interface org.openbmc.Fan
1682 * ------------------------------------------------------------------------
1683 */
1684
1685/**
1686 * SECTION:Fan
1687 * @title: Fan
1688 * @short_description: Generated C code for the org.openbmc.Fan D-Bus interface
1689 *
1690 * 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.
1691 */
1692
1693/* ---- Introspection data for org.openbmc.Fan ---- */
1694
1695static const _ExtendedGDBusArgInfo _fan_method_info_set_cooling_zone_IN_ARG_cooling_zone =
1696{
1697 {
1698 -1,
1699 (gchar *) "cooling_zone",
1700 (gchar *) "i",
1701 NULL
1702 },
1703 FALSE
1704};
1705
1706static const _ExtendedGDBusArgInfo * const _fan_method_info_set_cooling_zone_IN_ARG_pointers[] =
1707{
1708 &_fan_method_info_set_cooling_zone_IN_ARG_cooling_zone,
1709 NULL
1710};
1711
1712static const _ExtendedGDBusMethodInfo _fan_method_info_set_cooling_zone =
1713{
1714 {
1715 -1,
1716 (gchar *) "setCoolingZone",
1717 (GDBusArgInfo **) &_fan_method_info_set_cooling_zone_IN_ARG_pointers,
1718 NULL,
1719 NULL
1720 },
1721 "handle-set-cooling-zone",
1722 FALSE
1723};
1724
1725static const _ExtendedGDBusArgInfo _fan_method_info_get_speed_OUT_ARG_speed =
1726{
1727 {
1728 -1,
1729 (gchar *) "speed",
1730 (gchar *) "i",
1731 NULL
1732 },
1733 FALSE
1734};
1735
1736static const _ExtendedGDBusArgInfo * const _fan_method_info_get_speed_OUT_ARG_pointers[] =
1737{
1738 &_fan_method_info_get_speed_OUT_ARG_speed,
1739 NULL
1740};
1741
1742static const _ExtendedGDBusMethodInfo _fan_method_info_get_speed =
1743{
1744 {
1745 -1,
1746 (gchar *) "getSpeed",
1747 NULL,
1748 (GDBusArgInfo **) &_fan_method_info_get_speed_OUT_ARG_pointers,
1749 NULL
1750 },
1751 "handle-get-speed",
1752 FALSE
1753};
1754
1755static const _ExtendedGDBusArgInfo _fan_method_info_set_speed_IN_ARG_speed =
1756{
1757 {
1758 -1,
1759 (gchar *) "speed",
1760 (gchar *) "i",
1761 NULL
1762 },
1763 FALSE
1764};
1765
1766static const _ExtendedGDBusArgInfo * const _fan_method_info_set_speed_IN_ARG_pointers[] =
1767{
1768 &_fan_method_info_set_speed_IN_ARG_speed,
1769 NULL
1770};
1771
1772static const _ExtendedGDBusMethodInfo _fan_method_info_set_speed =
1773{
1774 {
1775 -1,
1776 (gchar *) "setSpeed",
1777 (GDBusArgInfo **) &_fan_method_info_set_speed_IN_ARG_pointers,
1778 NULL,
1779 NULL
1780 },
1781 "handle-set-speed",
1782 FALSE
1783};
1784
1785static const _ExtendedGDBusMethodInfo * const _fan_method_info_pointers[] =
1786{
1787 &_fan_method_info_set_cooling_zone,
1788 &_fan_method_info_get_speed,
1789 &_fan_method_info_set_speed,
1790 NULL
1791};
1792
1793static const _ExtendedGDBusArgInfo _fan_signal_info_speed_changed_ARG_speed =
1794{
1795 {
1796 -1,
1797 (gchar *) "speed",
1798 (gchar *) "i",
1799 NULL
1800 },
1801 FALSE
1802};
1803
1804static const _ExtendedGDBusArgInfo * const _fan_signal_info_speed_changed_ARG_pointers[] =
1805{
1806 &_fan_signal_info_speed_changed_ARG_speed,
1807 NULL
1808};
1809
1810static const _ExtendedGDBusSignalInfo _fan_signal_info_speed_changed =
1811{
1812 {
1813 -1,
1814 (gchar *) "SpeedChanged",
1815 (GDBusArgInfo **) &_fan_signal_info_speed_changed_ARG_pointers,
1816 NULL
1817 },
1818 "speed-changed"
1819};
1820
1821static const _ExtendedGDBusSignalInfo _fan_signal_info_tach_error =
1822{
1823 {
1824 -1,
1825 (gchar *) "TachError",
1826 NULL,
1827 NULL
1828 },
1829 "tach-error"
1830};
1831
1832static const _ExtendedGDBusSignalInfo * const _fan_signal_info_pointers[] =
1833{
1834 &_fan_signal_info_speed_changed,
1835 &_fan_signal_info_tach_error,
1836 NULL
1837};
1838
1839static const _ExtendedGDBusPropertyInfo _fan_property_info_speed =
1840{
1841 {
1842 -1,
1843 (gchar *) "speed",
1844 (gchar *) "i",
1845 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
1846 NULL
1847 },
1848 "speed",
1849 FALSE
1850};
1851
1852static const _ExtendedGDBusPropertyInfo _fan_property_info_cooling_zone =
1853{
1854 {
1855 -1,
1856 (gchar *) "cooling_zone",
1857 (gchar *) "i",
1858 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
1859 NULL
1860 },
1861 "cooling-zone",
1862 FALSE
1863};
1864
1865static const _ExtendedGDBusPropertyInfo _fan_property_info_pwm_num =
1866{
1867 {
1868 -1,
1869 (gchar *) "pwm_num",
1870 (gchar *) "i",
1871 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
1872 NULL
1873 },
1874 "pwm-num",
1875 FALSE
1876};
1877
1878static const _ExtendedGDBusPropertyInfo * const _fan_property_info_pointers[] =
1879{
1880 &_fan_property_info_speed,
1881 &_fan_property_info_cooling_zone,
1882 &_fan_property_info_pwm_num,
1883 NULL
1884};
1885
1886static const _ExtendedGDBusInterfaceInfo _fan_interface_info =
1887{
1888 {
1889 -1,
1890 (gchar *) "org.openbmc.Fan",
1891 (GDBusMethodInfo **) &_fan_method_info_pointers,
1892 (GDBusSignalInfo **) &_fan_signal_info_pointers,
1893 (GDBusPropertyInfo **) &_fan_property_info_pointers,
1894 NULL
1895 },
1896 "fan",
1897};
1898
1899
1900/**
1901 * fan_interface_info:
1902 *
1903 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> D-Bus interface.
1904 *
1905 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
1906 */
1907GDBusInterfaceInfo *
1908fan_interface_info (void)
1909{
1910 return (GDBusInterfaceInfo *) &_fan_interface_info.parent_struct;
1911}
1912
1913/**
1914 * fan_override_properties:
1915 * @klass: The class structure for a #GObject<!-- -->-derived class.
1916 * @property_id_begin: The property id to assign to the first overridden property.
1917 *
1918 * Overrides all #GObject properties in the #Fan interface for a concrete class.
1919 * The properties are overridden in the order they are defined.
1920 *
1921 * Returns: The last property id.
1922 */
1923guint
1924fan_override_properties (GObjectClass *klass, guint property_id_begin)
1925{
1926 g_object_class_override_property (klass, property_id_begin++, "speed");
1927 g_object_class_override_property (klass, property_id_begin++, "cooling-zone");
1928 g_object_class_override_property (klass, property_id_begin++, "pwm-num");
1929 return property_id_begin - 1;
1930}
1931
1932
1933
1934/**
1935 * Fan:
1936 *
1937 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
1938 */
1939
1940/**
1941 * FanIface:
1942 * @parent_iface: The parent interface.
1943 * @handle_get_speed: Handler for the #Fan::handle-get-speed signal.
1944 * @handle_set_cooling_zone: Handler for the #Fan::handle-set-cooling-zone signal.
1945 * @handle_set_speed: Handler for the #Fan::handle-set-speed signal.
1946 * @get_cooling_zone: Getter for the #Fan:cooling-zone property.
1947 * @get_pwm_num: Getter for the #Fan:pwm-num property.
1948 * @get_speed: Getter for the #Fan:speed property.
1949 * @speed_changed: Handler for the #Fan::speed-changed signal.
1950 * @tach_error: Handler for the #Fan::tach-error signal.
1951 *
1952 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
1953 */
1954
1955typedef FanIface FanInterface;
1956G_DEFINE_INTERFACE (Fan, fan, G_TYPE_OBJECT);
1957
1958static void
1959fan_default_init (FanIface *iface)
1960{
1961 /* GObject signals for incoming D-Bus method calls: */
1962 /**
1963 * Fan::handle-set-cooling-zone:
1964 * @object: A #Fan.
1965 * @invocation: A #GDBusMethodInvocation.
1966 * @arg_cooling_zone: Argument passed by remote caller.
1967 *
1968 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method.
1969 *
1970 * 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.
1971 *
1972 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
1973 */
1974 g_signal_new ("handle-set-cooling-zone",
1975 G_TYPE_FROM_INTERFACE (iface),
1976 G_SIGNAL_RUN_LAST,
1977 G_STRUCT_OFFSET (FanIface, handle_set_cooling_zone),
1978 g_signal_accumulator_true_handled,
1979 NULL,
1980 g_cclosure_marshal_generic,
1981 G_TYPE_BOOLEAN,
1982 2,
1983 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
1984
1985 /**
1986 * Fan::handle-get-speed:
1987 * @object: A #Fan.
1988 * @invocation: A #GDBusMethodInvocation.
1989 *
1990 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method.
1991 *
1992 * 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.
1993 *
1994 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
1995 */
1996 g_signal_new ("handle-get-speed",
1997 G_TYPE_FROM_INTERFACE (iface),
1998 G_SIGNAL_RUN_LAST,
1999 G_STRUCT_OFFSET (FanIface, handle_get_speed),
2000 g_signal_accumulator_true_handled,
2001 NULL,
2002 g_cclosure_marshal_generic,
2003 G_TYPE_BOOLEAN,
2004 1,
2005 G_TYPE_DBUS_METHOD_INVOCATION);
2006
2007 /**
2008 * Fan::handle-set-speed:
2009 * @object: A #Fan.
2010 * @invocation: A #GDBusMethodInvocation.
2011 * @arg_speed: Argument passed by remote caller.
2012 *
2013 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method.
2014 *
2015 * 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.
2016 *
2017 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
2018 */
2019 g_signal_new ("handle-set-speed",
2020 G_TYPE_FROM_INTERFACE (iface),
2021 G_SIGNAL_RUN_LAST,
2022 G_STRUCT_OFFSET (FanIface, handle_set_speed),
2023 g_signal_accumulator_true_handled,
2024 NULL,
2025 g_cclosure_marshal_generic,
2026 G_TYPE_BOOLEAN,
2027 2,
2028 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
2029
2030 /* GObject signals for received D-Bus signals: */
2031 /**
2032 * Fan::speed-changed:
2033 * @object: A #Fan.
2034 * @arg_speed: Argument.
2035 *
2036 * 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.
2037 *
2038 * 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.
2039 */
2040 g_signal_new ("speed-changed",
2041 G_TYPE_FROM_INTERFACE (iface),
2042 G_SIGNAL_RUN_LAST,
2043 G_STRUCT_OFFSET (FanIface, speed_changed),
2044 NULL,
2045 NULL,
2046 g_cclosure_marshal_generic,
2047 G_TYPE_NONE,
2048 1, G_TYPE_INT);
2049
2050 /**
2051 * Fan::tach-error:
2052 * @object: A #Fan.
2053 *
2054 * 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.
2055 *
2056 * 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.
2057 */
2058 g_signal_new ("tach-error",
2059 G_TYPE_FROM_INTERFACE (iface),
2060 G_SIGNAL_RUN_LAST,
2061 G_STRUCT_OFFSET (FanIface, tach_error),
2062 NULL,
2063 NULL,
2064 g_cclosure_marshal_generic,
2065 G_TYPE_NONE,
2066 0);
2067
2068 /* GObject properties for D-Bus properties: */
2069 /**
2070 * Fan:speed:
2071 *
2072 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link>.
2073 *
2074 * 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.
2075 */
2076 g_object_interface_install_property (iface,
2077 g_param_spec_int ("speed", "speed", "speed", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2078 /**
2079 * Fan:cooling-zone:
2080 *
2081 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link>.
2082 *
2083 * 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.
2084 */
2085 g_object_interface_install_property (iface,
2086 g_param_spec_int ("cooling-zone", "cooling_zone", "cooling_zone", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2087 /**
2088 * Fan:pwm-num:
2089 *
2090 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link>.
2091 *
2092 * 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.
2093 */
2094 g_object_interface_install_property (iface,
2095 g_param_spec_int ("pwm-num", "pwm_num", "pwm_num", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2096}
2097
2098/**
2099 * fan_get_speed: (skip)
2100 * @object: A #Fan.
2101 *
2102 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property.
2103 *
2104 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2105 *
2106 * Returns: The property value.
2107 */
2108gint
2109fan_get_speed (Fan *object)
2110{
2111 return FAN_GET_IFACE (object)->get_speed (object);
2112}
2113
2114/**
2115 * fan_set_speed: (skip)
2116 * @object: A #Fan.
2117 * @value: The value to set.
2118 *
2119 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property to @value.
2120 *
2121 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2122 */
2123void
2124fan_set_speed (Fan *object, gint value)
2125{
2126 g_object_set (G_OBJECT (object), "speed", value, NULL);
2127}
2128
2129/**
2130 * fan_get_cooling_zone: (skip)
2131 * @object: A #Fan.
2132 *
2133 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property.
2134 *
2135 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2136 *
2137 * Returns: The property value.
2138 */
2139gint
2140fan_get_cooling_zone (Fan *object)
2141{
2142 return FAN_GET_IFACE (object)->get_cooling_zone (object);
2143}
2144
2145/**
2146 * fan_set_cooling_zone: (skip)
2147 * @object: A #Fan.
2148 * @value: The value to set.
2149 *
2150 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property to @value.
2151 *
2152 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2153 */
2154void
2155fan_set_cooling_zone (Fan *object, gint value)
2156{
2157 g_object_set (G_OBJECT (object), "cooling-zone", value, NULL);
2158}
2159
2160/**
2161 * fan_get_pwm_num: (skip)
2162 * @object: A #Fan.
2163 *
2164 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property.
2165 *
2166 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2167 *
2168 * Returns: The property value.
2169 */
2170gint
2171fan_get_pwm_num (Fan *object)
2172{
2173 return FAN_GET_IFACE (object)->get_pwm_num (object);
2174}
2175
2176/**
2177 * fan_set_pwm_num: (skip)
2178 * @object: A #Fan.
2179 * @value: The value to set.
2180 *
2181 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property to @value.
2182 *
2183 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2184 */
2185void
2186fan_set_pwm_num (Fan *object, gint value)
2187{
2188 g_object_set (G_OBJECT (object), "pwm-num", value, NULL);
2189}
2190
2191/**
2192 * fan_emit_speed_changed:
2193 * @object: A #Fan.
2194 * @arg_speed: Argument to pass with the signal.
2195 *
2196 * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.SpeedChanged">"SpeedChanged"</link> D-Bus signal.
2197 */
2198void
2199fan_emit_speed_changed (
2200 Fan *object,
2201 gint arg_speed)
2202{
2203 g_signal_emit_by_name (object, "speed-changed", arg_speed);
2204}
2205
2206/**
2207 * fan_emit_tach_error:
2208 * @object: A #Fan.
2209 *
2210 * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.TachError">"TachError"</link> D-Bus signal.
2211 */
2212void
2213fan_emit_tach_error (
2214 Fan *object)
2215{
2216 g_signal_emit_by_name (object, "tach-error");
2217}
2218
2219/**
2220 * fan_call_set_cooling_zone:
2221 * @proxy: A #FanProxy.
2222 * @arg_cooling_zone: Argument to pass with the method invocation.
2223 * @cancellable: (allow-none): A #GCancellable or %NULL.
2224 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2225 * @user_data: User data to pass to @callback.
2226 *
2227 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method on @proxy.
2228 * 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.
2229 * You can then call fan_call_set_cooling_zone_finish() to get the result of the operation.
2230 *
2231 * See fan_call_set_cooling_zone_sync() for the synchronous, blocking version of this method.
2232 */
2233void
2234fan_call_set_cooling_zone (
2235 Fan *proxy,
2236 gint arg_cooling_zone,
2237 GCancellable *cancellable,
2238 GAsyncReadyCallback callback,
2239 gpointer user_data)
2240{
2241 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2242 "setCoolingZone",
2243 g_variant_new ("(i)",
2244 arg_cooling_zone),
2245 G_DBUS_CALL_FLAGS_NONE,
2246 -1,
2247 cancellable,
2248 callback,
2249 user_data);
2250}
2251
2252/**
2253 * fan_call_set_cooling_zone_finish:
2254 * @proxy: A #FanProxy.
2255 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_cooling_zone().
2256 * @error: Return location for error or %NULL.
2257 *
2258 * Finishes an operation started with fan_call_set_cooling_zone().
2259 *
2260 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2261 */
2262gboolean
2263fan_call_set_cooling_zone_finish (
2264 Fan *proxy,
2265 GAsyncResult *res,
2266 GError **error)
2267{
2268 GVariant *_ret;
2269 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2270 if (_ret == NULL)
2271 goto _out;
2272 g_variant_get (_ret,
2273 "()");
2274 g_variant_unref (_ret);
2275_out:
2276 return _ret != NULL;
2277}
2278
2279/**
2280 * fan_call_set_cooling_zone_sync:
2281 * @proxy: A #FanProxy.
2282 * @arg_cooling_zone: Argument to pass with the method invocation.
2283 * @cancellable: (allow-none): A #GCancellable or %NULL.
2284 * @error: Return location for error or %NULL.
2285 *
2286 * 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.
2287 *
2288 * See fan_call_set_cooling_zone() for the asynchronous version of this method.
2289 *
2290 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2291 */
2292gboolean
2293fan_call_set_cooling_zone_sync (
2294 Fan *proxy,
2295 gint arg_cooling_zone,
2296 GCancellable *cancellable,
2297 GError **error)
2298{
2299 GVariant *_ret;
2300 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2301 "setCoolingZone",
2302 g_variant_new ("(i)",
2303 arg_cooling_zone),
2304 G_DBUS_CALL_FLAGS_NONE,
2305 -1,
2306 cancellable,
2307 error);
2308 if (_ret == NULL)
2309 goto _out;
2310 g_variant_get (_ret,
2311 "()");
2312 g_variant_unref (_ret);
2313_out:
2314 return _ret != NULL;
2315}
2316
2317/**
2318 * fan_call_get_speed:
2319 * @proxy: A #FanProxy.
2320 * @cancellable: (allow-none): A #GCancellable or %NULL.
2321 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2322 * @user_data: User data to pass to @callback.
2323 *
2324 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method on @proxy.
2325 * 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.
2326 * You can then call fan_call_get_speed_finish() to get the result of the operation.
2327 *
2328 * See fan_call_get_speed_sync() for the synchronous, blocking version of this method.
2329 */
2330void
2331fan_call_get_speed (
2332 Fan *proxy,
2333 GCancellable *cancellable,
2334 GAsyncReadyCallback callback,
2335 gpointer user_data)
2336{
2337 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2338 "getSpeed",
2339 g_variant_new ("()"),
2340 G_DBUS_CALL_FLAGS_NONE,
2341 -1,
2342 cancellable,
2343 callback,
2344 user_data);
2345}
2346
2347/**
2348 * fan_call_get_speed_finish:
2349 * @proxy: A #FanProxy.
2350 * @out_speed: (out): Return location for return parameter or %NULL to ignore.
2351 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_get_speed().
2352 * @error: Return location for error or %NULL.
2353 *
2354 * Finishes an operation started with fan_call_get_speed().
2355 *
2356 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2357 */
2358gboolean
2359fan_call_get_speed_finish (
2360 Fan *proxy,
2361 gint *out_speed,
2362 GAsyncResult *res,
2363 GError **error)
2364{
2365 GVariant *_ret;
2366 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2367 if (_ret == NULL)
2368 goto _out;
2369 g_variant_get (_ret,
2370 "(i)",
2371 out_speed);
2372 g_variant_unref (_ret);
2373_out:
2374 return _ret != NULL;
2375}
2376
2377/**
2378 * fan_call_get_speed_sync:
2379 * @proxy: A #FanProxy.
2380 * @out_speed: (out): Return location for return parameter or %NULL to ignore.
2381 * @cancellable: (allow-none): A #GCancellable or %NULL.
2382 * @error: Return location for error or %NULL.
2383 *
2384 * 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.
2385 *
2386 * See fan_call_get_speed() for the asynchronous version of this method.
2387 *
2388 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2389 */
2390gboolean
2391fan_call_get_speed_sync (
2392 Fan *proxy,
2393 gint *out_speed,
2394 GCancellable *cancellable,
2395 GError **error)
2396{
2397 GVariant *_ret;
2398 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2399 "getSpeed",
2400 g_variant_new ("()"),
2401 G_DBUS_CALL_FLAGS_NONE,
2402 -1,
2403 cancellable,
2404 error);
2405 if (_ret == NULL)
2406 goto _out;
2407 g_variant_get (_ret,
2408 "(i)",
2409 out_speed);
2410 g_variant_unref (_ret);
2411_out:
2412 return _ret != NULL;
2413}
2414
2415/**
2416 * fan_call_set_speed:
2417 * @proxy: A #FanProxy.
2418 * @arg_speed: Argument to pass with the method invocation.
2419 * @cancellable: (allow-none): A #GCancellable or %NULL.
2420 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2421 * @user_data: User data to pass to @callback.
2422 *
2423 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method on @proxy.
2424 * 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.
2425 * You can then call fan_call_set_speed_finish() to get the result of the operation.
2426 *
2427 * See fan_call_set_speed_sync() for the synchronous, blocking version of this method.
2428 */
2429void
2430fan_call_set_speed (
2431 Fan *proxy,
2432 gint arg_speed,
2433 GCancellable *cancellable,
2434 GAsyncReadyCallback callback,
2435 gpointer user_data)
2436{
2437 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2438 "setSpeed",
2439 g_variant_new ("(i)",
2440 arg_speed),
2441 G_DBUS_CALL_FLAGS_NONE,
2442 -1,
2443 cancellable,
2444 callback,
2445 user_data);
2446}
2447
2448/**
2449 * fan_call_set_speed_finish:
2450 * @proxy: A #FanProxy.
2451 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_speed().
2452 * @error: Return location for error or %NULL.
2453 *
2454 * Finishes an operation started with fan_call_set_speed().
2455 *
2456 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2457 */
2458gboolean
2459fan_call_set_speed_finish (
2460 Fan *proxy,
2461 GAsyncResult *res,
2462 GError **error)
2463{
2464 GVariant *_ret;
2465 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2466 if (_ret == NULL)
2467 goto _out;
2468 g_variant_get (_ret,
2469 "()");
2470 g_variant_unref (_ret);
2471_out:
2472 return _ret != NULL;
2473}
2474
2475/**
2476 * fan_call_set_speed_sync:
2477 * @proxy: A #FanProxy.
2478 * @arg_speed: Argument to pass with the method invocation.
2479 * @cancellable: (allow-none): A #GCancellable or %NULL.
2480 * @error: Return location for error or %NULL.
2481 *
2482 * 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.
2483 *
2484 * See fan_call_set_speed() for the asynchronous version of this method.
2485 *
2486 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2487 */
2488gboolean
2489fan_call_set_speed_sync (
2490 Fan *proxy,
2491 gint arg_speed,
2492 GCancellable *cancellable,
2493 GError **error)
2494{
2495 GVariant *_ret;
2496 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2497 "setSpeed",
2498 g_variant_new ("(i)",
2499 arg_speed),
2500 G_DBUS_CALL_FLAGS_NONE,
2501 -1,
2502 cancellable,
2503 error);
2504 if (_ret == NULL)
2505 goto _out;
2506 g_variant_get (_ret,
2507 "()");
2508 g_variant_unref (_ret);
2509_out:
2510 return _ret != NULL;
2511}
2512
2513/**
2514 * fan_complete_set_cooling_zone:
2515 * @object: A #Fan.
2516 * @invocation: (transfer full): A #GDBusMethodInvocation.
2517 *
2518 * 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.
2519 *
2520 * This method will free @invocation, you cannot use it afterwards.
2521 */
2522void
2523fan_complete_set_cooling_zone (
2524 Fan *object,
2525 GDBusMethodInvocation *invocation)
2526{
2527 g_dbus_method_invocation_return_value (invocation,
2528 g_variant_new ("()"));
2529}
2530
2531/**
2532 * fan_complete_get_speed:
2533 * @object: A #Fan.
2534 * @invocation: (transfer full): A #GDBusMethodInvocation.
2535 * @speed: Parameter to return.
2536 *
2537 * 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.
2538 *
2539 * This method will free @invocation, you cannot use it afterwards.
2540 */
2541void
2542fan_complete_get_speed (
2543 Fan *object,
2544 GDBusMethodInvocation *invocation,
2545 gint speed)
2546{
2547 g_dbus_method_invocation_return_value (invocation,
2548 g_variant_new ("(i)",
2549 speed));
2550}
2551
2552/**
2553 * fan_complete_set_speed:
2554 * @object: A #Fan.
2555 * @invocation: (transfer full): A #GDBusMethodInvocation.
2556 *
2557 * 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.
2558 *
2559 * This method will free @invocation, you cannot use it afterwards.
2560 */
2561void
2562fan_complete_set_speed (
2563 Fan *object,
2564 GDBusMethodInvocation *invocation)
2565{
2566 g_dbus_method_invocation_return_value (invocation,
2567 g_variant_new ("()"));
2568}
2569
2570/* ------------------------------------------------------------------------ */
2571
2572/**
2573 * FanProxy:
2574 *
2575 * The #FanProxy structure contains only private data and should only be accessed using the provided API.
2576 */
2577
2578/**
2579 * FanProxyClass:
2580 * @parent_class: The parent class.
2581 *
2582 * Class structure for #FanProxy.
2583 */
2584
2585struct _FanProxyPrivate
2586{
2587 GData *qdata;
2588};
2589
2590static void fan_proxy_iface_init (FanIface *iface);
2591
2592#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2593G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY,
2594 G_ADD_PRIVATE (FanProxy)
2595 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init));
2596
2597#else
2598G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY,
2599 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init));
2600
2601#endif
2602static void
2603fan_proxy_finalize (GObject *object)
2604{
2605 FanProxy *proxy = FAN_PROXY (object);
2606 g_datalist_clear (&proxy->priv->qdata);
2607 G_OBJECT_CLASS (fan_proxy_parent_class)->finalize (object);
2608}
2609
2610static void
2611fan_proxy_get_property (GObject *object,
2612 guint prop_id,
2613 GValue *value,
2614 GParamSpec *pspec G_GNUC_UNUSED)
2615{
2616 const _ExtendedGDBusPropertyInfo *info;
2617 GVariant *variant;
2618 g_assert (prop_id != 0 && prop_id - 1 < 3);
2619 info = _fan_property_info_pointers[prop_id - 1];
2620 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
2621 if (info->use_gvariant)
2622 {
2623 g_value_set_variant (value, variant);
2624 }
2625 else
2626 {
2627 if (variant != NULL)
2628 g_dbus_gvariant_to_gvalue (variant, value);
2629 }
2630 if (variant != NULL)
2631 g_variant_unref (variant);
2632}
2633
2634static void
2635fan_proxy_set_property_cb (GDBusProxy *proxy,
2636 GAsyncResult *res,
2637 gpointer user_data)
2638{
2639 const _ExtendedGDBusPropertyInfo *info = user_data;
2640 GError *error;
2641 GVariant *_ret;
2642 error = NULL;
2643 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
2644 if (!_ret)
2645 {
2646 g_warning ("Error setting property '%s' on interface org.openbmc.Fan: %s (%s, %d)",
2647 info->parent_struct.name,
2648 error->message, g_quark_to_string (error->domain), error->code);
2649 g_error_free (error);
2650 }
2651 else
2652 {
2653 g_variant_unref (_ret);
2654 }
2655}
2656
2657static void
2658fan_proxy_set_property (GObject *object,
2659 guint prop_id,
2660 const GValue *value,
2661 GParamSpec *pspec G_GNUC_UNUSED)
2662{
2663 const _ExtendedGDBusPropertyInfo *info;
2664 GVariant *variant;
2665 g_assert (prop_id != 0 && prop_id - 1 < 3);
2666 info = _fan_property_info_pointers[prop_id - 1];
2667 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
2668 g_dbus_proxy_call (G_DBUS_PROXY (object),
2669 "org.freedesktop.DBus.Properties.Set",
2670 g_variant_new ("(ssv)", "org.openbmc.Fan", info->parent_struct.name, variant),
2671 G_DBUS_CALL_FLAGS_NONE,
2672 -1,
2673 NULL, (GAsyncReadyCallback) fan_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
2674 g_variant_unref (variant);
2675}
2676
2677static void
2678fan_proxy_g_signal (GDBusProxy *proxy,
2679 const gchar *sender_name G_GNUC_UNUSED,
2680 const gchar *signal_name,
2681 GVariant *parameters)
2682{
2683 _ExtendedGDBusSignalInfo *info;
2684 GVariantIter iter;
2685 GVariant *child;
2686 GValue *paramv;
2687 guint num_params;
2688 guint n;
2689 guint signal_id;
2690 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, signal_name);
2691 if (info == NULL)
2692 return;
2693 num_params = g_variant_n_children (parameters);
2694 paramv = g_new0 (GValue, num_params + 1);
2695 g_value_init (&paramv[0], TYPE_FAN);
2696 g_value_set_object (&paramv[0], proxy);
2697 g_variant_iter_init (&iter, parameters);
2698 n = 1;
2699 while ((child = g_variant_iter_next_value (&iter)) != NULL)
2700 {
2701 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
2702 if (arg_info->use_gvariant)
2703 {
2704 g_value_init (&paramv[n], G_TYPE_VARIANT);
2705 g_value_set_variant (&paramv[n], child);
2706 n++;
2707 }
2708 else
2709 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
2710 g_variant_unref (child);
2711 }
2712 signal_id = g_signal_lookup (info->signal_name, TYPE_FAN);
2713 g_signal_emitv (paramv, signal_id, 0, NULL);
2714 for (n = 0; n < num_params + 1; n++)
2715 g_value_unset (&paramv[n]);
2716 g_free (paramv);
2717}
2718
2719static void
2720fan_proxy_g_properties_changed (GDBusProxy *_proxy,
2721 GVariant *changed_properties,
2722 const gchar *const *invalidated_properties)
2723{
2724 FanProxy *proxy = FAN_PROXY (_proxy);
2725 guint n;
2726 const gchar *key;
2727 GVariantIter *iter;
2728 _ExtendedGDBusPropertyInfo *info;
2729 g_variant_get (changed_properties, "a{sv}", &iter);
2730 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
2731 {
2732 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, key);
2733 g_datalist_remove_data (&proxy->priv->qdata, key);
2734 if (info != NULL)
2735 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
2736 }
2737 g_variant_iter_free (iter);
2738 for (n = 0; invalidated_properties[n] != NULL; n++)
2739 {
2740 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, invalidated_properties[n]);
2741 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
2742 if (info != NULL)
2743 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
2744 }
2745}
2746
2747static gint
2748fan_proxy_get_speed (Fan *object)
2749{
2750 FanProxy *proxy = FAN_PROXY (object);
2751 GVariant *variant;
2752 gint value = 0;
2753 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "speed");
2754 if (variant != NULL)
2755 {
2756 value = g_variant_get_int32 (variant);
2757 g_variant_unref (variant);
2758 }
2759 return value;
2760}
2761
2762static gint
2763fan_proxy_get_cooling_zone (Fan *object)
2764{
2765 FanProxy *proxy = FAN_PROXY (object);
2766 GVariant *variant;
2767 gint value = 0;
2768 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "cooling_zone");
2769 if (variant != NULL)
2770 {
2771 value = g_variant_get_int32 (variant);
2772 g_variant_unref (variant);
2773 }
2774 return value;
2775}
2776
2777static gint
2778fan_proxy_get_pwm_num (Fan *object)
2779{
2780 FanProxy *proxy = FAN_PROXY (object);
2781 GVariant *variant;
2782 gint value = 0;
2783 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pwm_num");
2784 if (variant != NULL)
2785 {
2786 value = g_variant_get_int32 (variant);
2787 g_variant_unref (variant);
2788 }
2789 return value;
2790}
2791
2792static void
2793fan_proxy_init (FanProxy *proxy)
2794{
2795#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2796 proxy->priv = fan_proxy_get_instance_private (proxy);
2797#else
2798 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FAN_PROXY, FanProxyPrivate);
2799#endif
2800
2801 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), fan_interface_info ());
2802}
2803
2804static void
2805fan_proxy_class_init (FanProxyClass *klass)
2806{
2807 GObjectClass *gobject_class;
2808 GDBusProxyClass *proxy_class;
2809
2810 gobject_class = G_OBJECT_CLASS (klass);
2811 gobject_class->finalize = fan_proxy_finalize;
2812 gobject_class->get_property = fan_proxy_get_property;
2813 gobject_class->set_property = fan_proxy_set_property;
2814
2815 proxy_class = G_DBUS_PROXY_CLASS (klass);
2816 proxy_class->g_signal = fan_proxy_g_signal;
2817 proxy_class->g_properties_changed = fan_proxy_g_properties_changed;
2818
2819 fan_override_properties (gobject_class, 1);
2820
2821#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
2822 g_type_class_add_private (klass, sizeof (FanProxyPrivate));
2823#endif
2824}
2825
2826static void
2827fan_proxy_iface_init (FanIface *iface)
2828{
2829 iface->get_speed = fan_proxy_get_speed;
2830 iface->get_cooling_zone = fan_proxy_get_cooling_zone;
2831 iface->get_pwm_num = fan_proxy_get_pwm_num;
2832}
2833
2834/**
2835 * fan_proxy_new:
2836 * @connection: A #GDBusConnection.
2837 * @flags: Flags from the #GDBusProxyFlags enumeration.
2838 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
2839 * @object_path: An object path.
2840 * @cancellable: (allow-none): A #GCancellable or %NULL.
2841 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
2842 * @user_data: User data to pass to @callback.
2843 *
2844 * 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.
2845 *
2846 * 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.
2847 * You can then call fan_proxy_new_finish() to get the result of the operation.
2848 *
2849 * See fan_proxy_new_sync() for the synchronous, blocking version of this constructor.
2850 */
2851void
2852fan_proxy_new (
2853 GDBusConnection *connection,
2854 GDBusProxyFlags flags,
2855 const gchar *name,
2856 const gchar *object_path,
2857 GCancellable *cancellable,
2858 GAsyncReadyCallback callback,
2859 gpointer user_data)
2860{
2861 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);
2862}
2863
2864/**
2865 * fan_proxy_new_finish:
2866 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new().
2867 * @error: Return location for error or %NULL
2868 *
2869 * Finishes an operation started with fan_proxy_new().
2870 *
2871 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2872 */
2873Fan *
2874fan_proxy_new_finish (
2875 GAsyncResult *res,
2876 GError **error)
2877{
2878 GObject *ret;
2879 GObject *source_object;
2880 source_object = g_async_result_get_source_object (res);
2881 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
2882 g_object_unref (source_object);
2883 if (ret != NULL)
2884 return FAN (ret);
2885 else
2886 return NULL;
2887}
2888
2889/**
2890 * fan_proxy_new_sync:
2891 * @connection: A #GDBusConnection.
2892 * @flags: Flags from the #GDBusProxyFlags enumeration.
2893 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
2894 * @object_path: An object path.
2895 * @cancellable: (allow-none): A #GCancellable or %NULL.
2896 * @error: Return location for error or %NULL
2897 *
2898 * 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.
2899 *
2900 * The calling thread is blocked until a reply is received.
2901 *
2902 * See fan_proxy_new() for the asynchronous version of this constructor.
2903 *
2904 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2905 */
2906Fan *
2907fan_proxy_new_sync (
2908 GDBusConnection *connection,
2909 GDBusProxyFlags flags,
2910 const gchar *name,
2911 const gchar *object_path,
2912 GCancellable *cancellable,
2913 GError **error)
2914{
2915 GInitable *ret;
2916 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);
2917 if (ret != NULL)
2918 return FAN (ret);
2919 else
2920 return NULL;
2921}
2922
2923
2924/**
2925 * fan_proxy_new_for_bus:
2926 * @bus_type: A #GBusType.
2927 * @flags: Flags from the #GDBusProxyFlags enumeration.
2928 * @name: A bus name (well-known or unique).
2929 * @object_path: An object path.
2930 * @cancellable: (allow-none): A #GCancellable or %NULL.
2931 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
2932 * @user_data: User data to pass to @callback.
2933 *
2934 * Like fan_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
2935 *
2936 * 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.
2937 * You can then call fan_proxy_new_for_bus_finish() to get the result of the operation.
2938 *
2939 * See fan_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
2940 */
2941void
2942fan_proxy_new_for_bus (
2943 GBusType bus_type,
2944 GDBusProxyFlags flags,
2945 const gchar *name,
2946 const gchar *object_path,
2947 GCancellable *cancellable,
2948 GAsyncReadyCallback callback,
2949 gpointer user_data)
2950{
2951 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);
2952}
2953
2954/**
2955 * fan_proxy_new_for_bus_finish:
2956 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new_for_bus().
2957 * @error: Return location for error or %NULL
2958 *
2959 * Finishes an operation started with fan_proxy_new_for_bus().
2960 *
2961 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2962 */
2963Fan *
2964fan_proxy_new_for_bus_finish (
2965 GAsyncResult *res,
2966 GError **error)
2967{
2968 GObject *ret;
2969 GObject *source_object;
2970 source_object = g_async_result_get_source_object (res);
2971 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
2972 g_object_unref (source_object);
2973 if (ret != NULL)
2974 return FAN (ret);
2975 else
2976 return NULL;
2977}
2978
2979/**
2980 * fan_proxy_new_for_bus_sync:
2981 * @bus_type: A #GBusType.
2982 * @flags: Flags from the #GDBusProxyFlags enumeration.
2983 * @name: A bus name (well-known or unique).
2984 * @object_path: An object path.
2985 * @cancellable: (allow-none): A #GCancellable or %NULL.
2986 * @error: Return location for error or %NULL
2987 *
2988 * Like fan_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
2989 *
2990 * The calling thread is blocked until a reply is received.
2991 *
2992 * See fan_proxy_new_for_bus() for the asynchronous version of this constructor.
2993 *
2994 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2995 */
2996Fan *
2997fan_proxy_new_for_bus_sync (
2998 GBusType bus_type,
2999 GDBusProxyFlags flags,
3000 const gchar *name,
3001 const gchar *object_path,
3002 GCancellable *cancellable,
3003 GError **error)
3004{
3005 GInitable *ret;
3006 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);
3007 if (ret != NULL)
3008 return FAN (ret);
3009 else
3010 return NULL;
3011}
3012
3013
3014/* ------------------------------------------------------------------------ */
3015
3016/**
3017 * FanSkeleton:
3018 *
3019 * The #FanSkeleton structure contains only private data and should only be accessed using the provided API.
3020 */
3021
3022/**
3023 * FanSkeletonClass:
3024 * @parent_class: The parent class.
3025 *
3026 * Class structure for #FanSkeleton.
3027 */
3028
3029struct _FanSkeletonPrivate
3030{
3031 GValue *properties;
3032 GList *changed_properties;
3033 GSource *changed_properties_idle_source;
3034 GMainContext *context;
3035 GMutex lock;
3036};
3037
3038static void
3039_fan_skeleton_handle_method_call (
3040 GDBusConnection *connection G_GNUC_UNUSED,
3041 const gchar *sender G_GNUC_UNUSED,
3042 const gchar *object_path G_GNUC_UNUSED,
3043 const gchar *interface_name,
3044 const gchar *method_name,
3045 GVariant *parameters,
3046 GDBusMethodInvocation *invocation,
3047 gpointer user_data)
3048{
3049 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3050 _ExtendedGDBusMethodInfo *info;
3051 GVariantIter iter;
3052 GVariant *child;
3053 GValue *paramv;
3054 guint num_params;
3055 guint num_extra;
3056 guint n;
3057 guint signal_id;
3058 GValue return_value = G_VALUE_INIT;
3059 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
3060 g_assert (info != NULL);
3061 num_params = g_variant_n_children (parameters);
3062 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
3063 n = 0;
3064 g_value_init (&paramv[n], TYPE_FAN);
3065 g_value_set_object (&paramv[n++], skeleton);
3066 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
3067 g_value_set_object (&paramv[n++], invocation);
3068 if (info->pass_fdlist)
3069 {
3070#ifdef G_OS_UNIX
3071 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
3072 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
3073#else
3074 g_assert_not_reached ();
3075#endif
3076 }
3077 g_variant_iter_init (&iter, parameters);
3078 while ((child = g_variant_iter_next_value (&iter)) != NULL)
3079 {
3080 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
3081 if (arg_info->use_gvariant)
3082 {
3083 g_value_init (&paramv[n], G_TYPE_VARIANT);
3084 g_value_set_variant (&paramv[n], child);
3085 n++;
3086 }
3087 else
3088 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
3089 g_variant_unref (child);
3090 }
3091 signal_id = g_signal_lookup (info->signal_name, TYPE_FAN);
3092 g_value_init (&return_value, G_TYPE_BOOLEAN);
3093 g_signal_emitv (paramv, signal_id, 0, &return_value);
3094 if (!g_value_get_boolean (&return_value))
3095 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);
3096 g_value_unset (&return_value);
3097 for (n = 0; n < num_params + num_extra; n++)
3098 g_value_unset (&paramv[n]);
3099 g_free (paramv);
3100}
3101
3102static GVariant *
3103_fan_skeleton_handle_get_property (
3104 GDBusConnection *connection G_GNUC_UNUSED,
3105 const gchar *sender G_GNUC_UNUSED,
3106 const gchar *object_path G_GNUC_UNUSED,
3107 const gchar *interface_name G_GNUC_UNUSED,
3108 const gchar *property_name,
3109 GError **error,
3110 gpointer user_data)
3111{
3112 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3113 GValue value = G_VALUE_INIT;
3114 GParamSpec *pspec;
3115 _ExtendedGDBusPropertyInfo *info;
3116 GVariant *ret;
3117 ret = NULL;
3118 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name);
3119 g_assert (info != NULL);
3120 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3121 if (pspec == NULL)
3122 {
3123 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3124 }
3125 else
3126 {
3127 g_value_init (&value, pspec->value_type);
3128 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3129 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
3130 g_value_unset (&value);
3131 }
3132 return ret;
3133}
3134
3135static gboolean
3136_fan_skeleton_handle_set_property (
3137 GDBusConnection *connection G_GNUC_UNUSED,
3138 const gchar *sender G_GNUC_UNUSED,
3139 const gchar *object_path G_GNUC_UNUSED,
3140 const gchar *interface_name G_GNUC_UNUSED,
3141 const gchar *property_name,
3142 GVariant *variant,
3143 GError **error,
3144 gpointer user_data)
3145{
3146 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3147 GValue value = G_VALUE_INIT;
3148 GParamSpec *pspec;
3149 _ExtendedGDBusPropertyInfo *info;
3150 gboolean ret;
3151 ret = FALSE;
3152 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name);
3153 g_assert (info != NULL);
3154 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3155 if (pspec == NULL)
3156 {
3157 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3158 }
3159 else
3160 {
3161 if (info->use_gvariant)
3162 g_value_set_variant (&value, variant);
3163 else
3164 g_dbus_gvariant_to_gvalue (variant, &value);
3165 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3166 g_value_unset (&value);
3167 ret = TRUE;
3168 }
3169 return ret;
3170}
3171
3172static const GDBusInterfaceVTable _fan_skeleton_vtable =
3173{
3174 _fan_skeleton_handle_method_call,
3175 _fan_skeleton_handle_get_property,
3176 _fan_skeleton_handle_set_property,
3177 {NULL}
3178};
3179
3180static GDBusInterfaceInfo *
3181fan_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3182{
3183 return fan_interface_info ();
3184}
3185
3186static GDBusInterfaceVTable *
3187fan_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3188{
3189 return (GDBusInterfaceVTable *) &_fan_skeleton_vtable;
3190}
3191
3192static GVariant *
3193fan_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
3194{
3195 FanSkeleton *skeleton = FAN_SKELETON (_skeleton);
3196
3197 GVariantBuilder builder;
3198 guint n;
3199 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3200 if (_fan_interface_info.parent_struct.properties == NULL)
3201 goto out;
3202 for (n = 0; _fan_interface_info.parent_struct.properties[n] != NULL; n++)
3203 {
3204 GDBusPropertyInfo *info = _fan_interface_info.parent_struct.properties[n];
3205 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
3206 {
3207 GVariant *value;
3208 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);
3209 if (value != NULL)
3210 {
3211 g_variant_take_ref (value);
3212 g_variant_builder_add (&builder, "{sv}", info->name, value);
3213 g_variant_unref (value);
3214 }
3215 }
3216 }
3217out:
3218 return g_variant_builder_end (&builder);
3219}
3220
3221static gboolean _fan_emit_changed (gpointer user_data);
3222
3223static void
3224fan_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
3225{
3226 FanSkeleton *skeleton = FAN_SKELETON (_skeleton);
3227 gboolean emit_changed = FALSE;
3228
3229 g_mutex_lock (&skeleton->priv->lock);
3230 if (skeleton->priv->changed_properties_idle_source != NULL)
3231 {
3232 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3233 skeleton->priv->changed_properties_idle_source = NULL;
3234 emit_changed = TRUE;
3235 }
3236 g_mutex_unlock (&skeleton->priv->lock);
3237
3238 if (emit_changed)
3239 _fan_emit_changed (skeleton);
3240}
3241
3242static void
3243_fan_on_signal_speed_changed (
3244 Fan *object,
3245 gint arg_speed)
3246{
3247 FanSkeleton *skeleton = FAN_SKELETON (object);
3248
3249 GList *connections, *l;
3250 GVariant *signal_variant;
3251 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3252
3253 signal_variant = g_variant_ref_sink (g_variant_new ("(i)",
3254 arg_speed));
3255 for (l = connections; l != NULL; l = l->next)
3256 {
3257 GDBusConnection *connection = l->data;
3258 g_dbus_connection_emit_signal (connection,
3259 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "SpeedChanged",
3260 signal_variant, NULL);
3261 }
3262 g_variant_unref (signal_variant);
3263 g_list_free_full (connections, g_object_unref);
3264}
3265
3266static void
3267_fan_on_signal_tach_error (
3268 Fan *object)
3269{
3270 FanSkeleton *skeleton = FAN_SKELETON (object);
3271
3272 GList *connections, *l;
3273 GVariant *signal_variant;
3274 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3275
3276 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
3277 for (l = connections; l != NULL; l = l->next)
3278 {
3279 GDBusConnection *connection = l->data;
3280 g_dbus_connection_emit_signal (connection,
3281 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "TachError",
3282 signal_variant, NULL);
3283 }
3284 g_variant_unref (signal_variant);
3285 g_list_free_full (connections, g_object_unref);
3286}
3287
3288static void fan_skeleton_iface_init (FanIface *iface);
3289#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3290G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3291 G_ADD_PRIVATE (FanSkeleton)
3292 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init));
3293
3294#else
3295G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3296 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init));
3297
3298#endif
3299static void
3300fan_skeleton_finalize (GObject *object)
3301{
3302 FanSkeleton *skeleton = FAN_SKELETON (object);
3303 guint n;
3304 for (n = 0; n < 3; n++)
3305 g_value_unset (&skeleton->priv->properties[n]);
3306 g_free (skeleton->priv->properties);
3307 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3308 if (skeleton->priv->changed_properties_idle_source != NULL)
3309 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3310 g_main_context_unref (skeleton->priv->context);
3311 g_mutex_clear (&skeleton->priv->lock);
3312 G_OBJECT_CLASS (fan_skeleton_parent_class)->finalize (object);
3313}
3314
3315static void
3316fan_skeleton_get_property (GObject *object,
3317 guint prop_id,
3318 GValue *value,
3319 GParamSpec *pspec G_GNUC_UNUSED)
3320{
3321 FanSkeleton *skeleton = FAN_SKELETON (object);
3322 g_assert (prop_id != 0 && prop_id - 1 < 3);
3323 g_mutex_lock (&skeleton->priv->lock);
3324 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
3325 g_mutex_unlock (&skeleton->priv->lock);
3326}
3327
3328static gboolean
3329_fan_emit_changed (gpointer user_data)
3330{
3331 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3332 GList *l;
3333 GVariantBuilder builder;
3334 GVariantBuilder invalidated_builder;
3335 guint num_changes;
3336
3337 g_mutex_lock (&skeleton->priv->lock);
3338 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3339 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
3340 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
3341 {
3342 ChangedProperty *cp = l->data;
3343 GVariant *variant;
3344 const GValue *cur_value;
3345
3346 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
3347 if (!_g_value_equal (cur_value, &cp->orig_value))
3348 {
3349 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
3350 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
3351 g_variant_unref (variant);
3352 num_changes++;
3353 }
3354 }
3355 if (num_changes > 0)
3356 {
3357 GList *connections, *ll;
3358 GVariant *signal_variant;
3359 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Fan",
3360 &builder, &invalidated_builder));
3361 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3362 for (ll = connections; ll != NULL; ll = ll->next)
3363 {
3364 GDBusConnection *connection = ll->data;
3365
3366 g_dbus_connection_emit_signal (connection,
3367 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
3368 "org.freedesktop.DBus.Properties",
3369 "PropertiesChanged",
3370 signal_variant,
3371 NULL);
3372 }
3373 g_variant_unref (signal_variant);
3374 g_list_free_full (connections, g_object_unref);
3375 }
3376 else
3377 {
3378 g_variant_builder_clear (&builder);
3379 g_variant_builder_clear (&invalidated_builder);
3380 }
3381 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3382 skeleton->priv->changed_properties = NULL;
3383 skeleton->priv->changed_properties_idle_source = NULL;
3384 g_mutex_unlock (&skeleton->priv->lock);
3385 return FALSE;
3386}
3387
3388static void
3389_fan_schedule_emit_changed (FanSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
3390{
3391 ChangedProperty *cp;
3392 GList *l;
3393 cp = NULL;
3394 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
3395 {
3396 ChangedProperty *i_cp = l->data;
3397 if (i_cp->info == info)
3398 {
3399 cp = i_cp;
3400 break;
3401 }
3402 }
3403 if (cp == NULL)
3404 {
3405 cp = g_new0 (ChangedProperty, 1);
3406 cp->prop_id = prop_id;
3407 cp->info = info;
3408 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
3409 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
3410 g_value_copy (orig_value, &cp->orig_value);
3411 }
3412}
3413
3414static void
3415fan_skeleton_notify (GObject *object,
3416 GParamSpec *pspec G_GNUC_UNUSED)
3417{
3418 FanSkeleton *skeleton = FAN_SKELETON (object);
3419 g_mutex_lock (&skeleton->priv->lock);
3420 if (skeleton->priv->changed_properties != NULL &&
3421 skeleton->priv->changed_properties_idle_source == NULL)
3422 {
3423 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
3424 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
3425 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _fan_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
3426 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
3427 g_source_unref (skeleton->priv->changed_properties_idle_source);
3428 }
3429 g_mutex_unlock (&skeleton->priv->lock);
3430}
3431
3432static void
3433fan_skeleton_set_property (GObject *object,
3434 guint prop_id,
3435 const GValue *value,
3436 GParamSpec *pspec)
3437{
3438 FanSkeleton *skeleton = FAN_SKELETON (object);
3439 g_assert (prop_id != 0 && prop_id - 1 < 3);
3440 g_mutex_lock (&skeleton->priv->lock);
3441 g_object_freeze_notify (object);
3442 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
3443 {
3444 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
3445 _fan_schedule_emit_changed (skeleton, _fan_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
3446 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
3447 g_object_notify_by_pspec (object, pspec);
3448 }
3449 g_mutex_unlock (&skeleton->priv->lock);
3450 g_object_thaw_notify (object);
3451}
3452
3453static void
3454fan_skeleton_init (FanSkeleton *skeleton)
3455{
3456#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3457 skeleton->priv = fan_skeleton_get_instance_private (skeleton);
3458#else
3459 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FAN_SKELETON, FanSkeletonPrivate);
3460#endif
3461
3462 g_mutex_init (&skeleton->priv->lock);
3463 skeleton->priv->context = g_main_context_ref_thread_default ();
3464 skeleton->priv->properties = g_new0 (GValue, 3);
3465 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
3466 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
3467 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
3468}
3469
3470static gint
3471fan_skeleton_get_speed (Fan *object)
3472{
3473 FanSkeleton *skeleton = FAN_SKELETON (object);
3474 gint value;
3475 g_mutex_lock (&skeleton->priv->lock);
3476 value = g_value_get_int (&(skeleton->priv->properties[0]));
3477 g_mutex_unlock (&skeleton->priv->lock);
3478 return value;
3479}
3480
3481static gint
3482fan_skeleton_get_cooling_zone (Fan *object)
3483{
3484 FanSkeleton *skeleton = FAN_SKELETON (object);
3485 gint value;
3486 g_mutex_lock (&skeleton->priv->lock);
3487 value = g_value_get_int (&(skeleton->priv->properties[1]));
3488 g_mutex_unlock (&skeleton->priv->lock);
3489 return value;
3490}
3491
3492static gint
3493fan_skeleton_get_pwm_num (Fan *object)
3494{
3495 FanSkeleton *skeleton = FAN_SKELETON (object);
3496 gint value;
3497 g_mutex_lock (&skeleton->priv->lock);
3498 value = g_value_get_int (&(skeleton->priv->properties[2]));
3499 g_mutex_unlock (&skeleton->priv->lock);
3500 return value;
3501}
3502
3503static void
3504fan_skeleton_class_init (FanSkeletonClass *klass)
3505{
3506 GObjectClass *gobject_class;
3507 GDBusInterfaceSkeletonClass *skeleton_class;
3508
3509 gobject_class = G_OBJECT_CLASS (klass);
3510 gobject_class->finalize = fan_skeleton_finalize;
3511 gobject_class->get_property = fan_skeleton_get_property;
3512 gobject_class->set_property = fan_skeleton_set_property;
3513 gobject_class->notify = fan_skeleton_notify;
3514
3515
3516 fan_override_properties (gobject_class, 1);
3517
3518 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
3519 skeleton_class->get_info = fan_skeleton_dbus_interface_get_info;
3520 skeleton_class->get_properties = fan_skeleton_dbus_interface_get_properties;
3521 skeleton_class->flush = fan_skeleton_dbus_interface_flush;
3522 skeleton_class->get_vtable = fan_skeleton_dbus_interface_get_vtable;
3523
3524#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
3525 g_type_class_add_private (klass, sizeof (FanSkeletonPrivate));
3526#endif
3527}
3528
3529static void
3530fan_skeleton_iface_init (FanIface *iface)
3531{
3532 iface->speed_changed = _fan_on_signal_speed_changed;
3533 iface->tach_error = _fan_on_signal_tach_error;
3534 iface->get_speed = fan_skeleton_get_speed;
3535 iface->get_cooling_zone = fan_skeleton_get_cooling_zone;
3536 iface->get_pwm_num = fan_skeleton_get_pwm_num;
3537}
3538
3539/**
3540 * fan_skeleton_new:
3541 *
3542 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
3543 *
3544 * Returns: (transfer full) (type FanSkeleton): The skeleton object.
3545 */
3546Fan *
3547fan_skeleton_new (void)
3548{
3549 return FAN (g_object_new (TYPE_FAN_SKELETON, NULL));
3550}
3551
3552/* ------------------------------------------------------------------------
3553 * Code for interface org.openbmc.SensorValue
3554 * ------------------------------------------------------------------------
3555 */
3556
3557/**
3558 * SECTION:SensorValue
3559 * @title: SensorValue
3560 * @short_description: Generated C code for the org.openbmc.SensorValue D-Bus interface
3561 *
3562 * 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.
3563 */
3564
3565/* ---- Introspection data for org.openbmc.SensorValue ---- */
3566
3567static const _ExtendedGDBusMethodInfo _sensor_value_method_info_init =
3568{
3569 {
3570 -1,
3571 (gchar *) "init",
3572 NULL,
3573 NULL,
3574 NULL
3575 },
3576 "handle-init",
3577 FALSE
3578};
3579
3580static const _ExtendedGDBusArgInfo _sensor_value_method_info_get_value_OUT_ARG_value =
3581{
3582 {
3583 -1,
3584 (gchar *) "value",
3585 (gchar *) "v",
3586 NULL
3587 },
3588 FALSE
3589};
3590
3591static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_get_value_OUT_ARG_pointers[] =
3592{
3593 &_sensor_value_method_info_get_value_OUT_ARG_value,
3594 NULL
3595};
3596
3597static const _ExtendedGDBusMethodInfo _sensor_value_method_info_get_value =
3598{
3599 {
3600 -1,
3601 (gchar *) "getValue",
3602 NULL,
3603 (GDBusArgInfo **) &_sensor_value_method_info_get_value_OUT_ARG_pointers,
3604 NULL
3605 },
3606 "handle-get-value",
3607 FALSE
3608};
3609
3610static const _ExtendedGDBusArgInfo _sensor_value_method_info_set_value_IN_ARG_value =
3611{
3612 {
3613 -1,
3614 (gchar *) "value",
3615 (gchar *) "v",
3616 NULL
3617 },
3618 FALSE
3619};
3620
3621static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_set_value_IN_ARG_pointers[] =
3622{
3623 &_sensor_value_method_info_set_value_IN_ARG_value,
3624 NULL
3625};
3626
3627static const _ExtendedGDBusMethodInfo _sensor_value_method_info_set_value =
3628{
3629 {
3630 -1,
3631 (gchar *) "setValue",
3632 (GDBusArgInfo **) &_sensor_value_method_info_set_value_IN_ARG_pointers,
3633 NULL,
3634 NULL
3635 },
3636 "handle-set-value",
3637 FALSE
3638};
3639
3640static const _ExtendedGDBusMethodInfo * const _sensor_value_method_info_pointers[] =
3641{
3642 &_sensor_value_method_info_init,
3643 &_sensor_value_method_info_get_value,
3644 &_sensor_value_method_info_set_value,
3645 NULL
3646};
3647
3648static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_value =
3649{
3650 {
3651 -1,
3652 (gchar *) "value",
3653 (gchar *) "v",
3654 NULL
3655 },
3656 FALSE
3657};
3658
3659static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_units =
3660{
3661 {
3662 -1,
3663 (gchar *) "units",
3664 (gchar *) "s",
3665 NULL
3666 },
3667 FALSE
3668};
3669
3670static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_changed_ARG_pointers[] =
3671{
3672 &_sensor_value_signal_info_changed_ARG_value,
3673 &_sensor_value_signal_info_changed_ARG_units,
3674 NULL
3675};
3676
3677static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_changed =
3678{
3679 {
3680 -1,
3681 (gchar *) "Changed",
3682 (GDBusArgInfo **) &_sensor_value_signal_info_changed_ARG_pointers,
3683 NULL
3684 },
3685 "changed"
3686};
3687
Norman James32e74e22015-09-15 21:28:06 -05003688static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_error =
3689{
3690 {
3691 -1,
3692 (gchar *) "Error",
3693 NULL,
3694 NULL
3695 },
3696 "error"
3697};
3698
Norman James362a80f2015-09-14 14:04:39 -05003699static const _ExtendedGDBusArgInfo _sensor_value_signal_info_heartbeat_ARG_bus_name =
3700{
3701 {
3702 -1,
3703 (gchar *) "bus_name",
3704 (gchar *) "s",
3705 NULL
3706 },
3707 FALSE
3708};
3709
3710static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_heartbeat_ARG_pointers[] =
3711{
3712 &_sensor_value_signal_info_heartbeat_ARG_bus_name,
3713 NULL
3714};
3715
3716static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_heartbeat =
3717{
3718 {
3719 -1,
3720 (gchar *) "Heartbeat",
3721 (GDBusArgInfo **) &_sensor_value_signal_info_heartbeat_ARG_pointers,
3722 NULL
3723 },
3724 "heartbeat"
3725};
3726
3727static const _ExtendedGDBusSignalInfo * const _sensor_value_signal_info_pointers[] =
3728{
3729 &_sensor_value_signal_info_changed,
Norman James32e74e22015-09-15 21:28:06 -05003730 &_sensor_value_signal_info_error,
Norman James362a80f2015-09-14 14:04:39 -05003731 &_sensor_value_signal_info_heartbeat,
3732 NULL
3733};
3734
3735static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_value =
3736{
3737 {
3738 -1,
3739 (gchar *) "value",
3740 (gchar *) "v",
3741 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3742 NULL
3743 },
3744 "value",
3745 FALSE
3746};
3747
3748static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_units =
3749{
3750 {
3751 -1,
3752 (gchar *) "units",
3753 (gchar *) "s",
3754 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3755 NULL
3756 },
3757 "units",
3758 FALSE
3759};
3760
3761static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_poll_interval =
3762{
3763 {
3764 -1,
3765 (gchar *) "poll_interval",
3766 (gchar *) "i",
3767 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
3768 NULL
3769 },
3770 "poll-interval",
3771 FALSE
3772};
3773
3774static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_heatbeat =
3775{
3776 {
3777 -1,
3778 (gchar *) "heatbeat",
3779 (gchar *) "i",
3780 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3781 NULL
3782 },
3783 "heatbeat",
3784 FALSE
3785};
3786
3787static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_settable =
3788{
3789 {
3790 -1,
3791 (gchar *) "settable",
3792 (gchar *) "b",
3793 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3794 NULL
3795 },
3796 "settable",
3797 FALSE
3798};
3799
3800static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_ipmi_entity_id =
3801{
3802 {
3803 -1,
3804 (gchar *) "ipmi_entity_id",
3805 (gchar *) "y",
3806 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3807 NULL
3808 },
3809 "ipmi-entity-id",
3810 FALSE
3811};
3812
3813static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_ipmi_id =
3814{
3815 {
3816 -1,
3817 (gchar *) "ipmi_id",
3818 (gchar *) "y",
3819 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
3820 NULL
3821 },
3822 "ipmi-id",
3823 FALSE
3824};
3825
3826static const _ExtendedGDBusPropertyInfo * const _sensor_value_property_info_pointers[] =
3827{
3828 &_sensor_value_property_info_value,
3829 &_sensor_value_property_info_units,
3830 &_sensor_value_property_info_poll_interval,
3831 &_sensor_value_property_info_heatbeat,
3832 &_sensor_value_property_info_settable,
3833 &_sensor_value_property_info_ipmi_entity_id,
3834 &_sensor_value_property_info_ipmi_id,
3835 NULL
3836};
3837
3838static const _ExtendedGDBusInterfaceInfo _sensor_value_interface_info =
3839{
3840 {
3841 -1,
3842 (gchar *) "org.openbmc.SensorValue",
3843 (GDBusMethodInfo **) &_sensor_value_method_info_pointers,
3844 (GDBusSignalInfo **) &_sensor_value_signal_info_pointers,
3845 (GDBusPropertyInfo **) &_sensor_value_property_info_pointers,
3846 NULL
3847 },
3848 "sensor-value",
3849};
3850
3851
3852/**
3853 * sensor_value_interface_info:
3854 *
3855 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> D-Bus interface.
3856 *
3857 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
3858 */
3859GDBusInterfaceInfo *
3860sensor_value_interface_info (void)
3861{
3862 return (GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct;
3863}
3864
3865/**
3866 * sensor_value_override_properties:
3867 * @klass: The class structure for a #GObject<!-- -->-derived class.
3868 * @property_id_begin: The property id to assign to the first overridden property.
3869 *
3870 * Overrides all #GObject properties in the #SensorValue interface for a concrete class.
3871 * The properties are overridden in the order they are defined.
3872 *
3873 * Returns: The last property id.
3874 */
3875guint
3876sensor_value_override_properties (GObjectClass *klass, guint property_id_begin)
3877{
3878 g_object_class_override_property (klass, property_id_begin++, "value");
3879 g_object_class_override_property (klass, property_id_begin++, "units");
3880 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
3881 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
3882 g_object_class_override_property (klass, property_id_begin++, "settable");
3883 g_object_class_override_property (klass, property_id_begin++, "ipmi-entity-id");
3884 g_object_class_override_property (klass, property_id_begin++, "ipmi-id");
3885 return property_id_begin - 1;
3886}
3887
3888
3889
3890/**
3891 * SensorValue:
3892 *
3893 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
3894 */
3895
3896/**
3897 * SensorValueIface:
3898 * @parent_iface: The parent interface.
3899 * @handle_get_value: Handler for the #SensorValue::handle-get-value signal.
3900 * @handle_init: Handler for the #SensorValue::handle-init signal.
3901 * @handle_set_value: Handler for the #SensorValue::handle-set-value signal.
3902 * @get_heatbeat: Getter for the #SensorValue:heatbeat property.
3903 * @get_ipmi_entity_id: Getter for the #SensorValue:ipmi-entity-id property.
3904 * @get_ipmi_id: Getter for the #SensorValue:ipmi-id property.
3905 * @get_poll_interval: Getter for the #SensorValue:poll-interval property.
3906 * @get_settable: Getter for the #SensorValue:settable property.
3907 * @get_units: Getter for the #SensorValue:units property.
3908 * @get_value: Getter for the #SensorValue:value property.
3909 * @changed: Handler for the #SensorValue::changed signal.
Norman James32e74e22015-09-15 21:28:06 -05003910 * @error: Handler for the #SensorValue::error signal.
Norman James362a80f2015-09-14 14:04:39 -05003911 * @heartbeat: Handler for the #SensorValue::heartbeat signal.
3912 *
3913 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
3914 */
3915
3916typedef SensorValueIface SensorValueInterface;
3917G_DEFINE_INTERFACE (SensorValue, sensor_value, G_TYPE_OBJECT);
3918
3919static void
3920sensor_value_default_init (SensorValueIface *iface)
3921{
3922 /* GObject signals for incoming D-Bus method calls: */
3923 /**
3924 * SensorValue::handle-init:
3925 * @object: A #SensorValue.
3926 * @invocation: A #GDBusMethodInvocation.
3927 *
3928 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method.
3929 *
3930 * 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.
3931 *
3932 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3933 */
3934 g_signal_new ("handle-init",
3935 G_TYPE_FROM_INTERFACE (iface),
3936 G_SIGNAL_RUN_LAST,
3937 G_STRUCT_OFFSET (SensorValueIface, handle_init),
3938 g_signal_accumulator_true_handled,
3939 NULL,
3940 g_cclosure_marshal_generic,
3941 G_TYPE_BOOLEAN,
3942 1,
3943 G_TYPE_DBUS_METHOD_INVOCATION);
3944
3945 /**
3946 * SensorValue::handle-get-value:
3947 * @object: A #SensorValue.
3948 * @invocation: A #GDBusMethodInvocation.
3949 *
3950 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method.
3951 *
3952 * 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.
3953 *
3954 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3955 */
3956 g_signal_new ("handle-get-value",
3957 G_TYPE_FROM_INTERFACE (iface),
3958 G_SIGNAL_RUN_LAST,
3959 G_STRUCT_OFFSET (SensorValueIface, handle_get_value),
3960 g_signal_accumulator_true_handled,
3961 NULL,
3962 g_cclosure_marshal_generic,
3963 G_TYPE_BOOLEAN,
3964 1,
3965 G_TYPE_DBUS_METHOD_INVOCATION);
3966
3967 /**
3968 * SensorValue::handle-set-value:
3969 * @object: A #SensorValue.
3970 * @invocation: A #GDBusMethodInvocation.
3971 * @arg_value: Argument passed by remote caller.
3972 *
3973 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method.
3974 *
3975 * 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.
3976 *
3977 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3978 */
3979 g_signal_new ("handle-set-value",
3980 G_TYPE_FROM_INTERFACE (iface),
3981 G_SIGNAL_RUN_LAST,
3982 G_STRUCT_OFFSET (SensorValueIface, handle_set_value),
3983 g_signal_accumulator_true_handled,
3984 NULL,
3985 g_cclosure_marshal_generic,
3986 G_TYPE_BOOLEAN,
3987 2,
3988 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT);
3989
3990 /* GObject signals for received D-Bus signals: */
3991 /**
3992 * SensorValue::changed:
3993 * @object: A #SensorValue.
3994 * @arg_value: Argument.
3995 * @arg_units: Argument.
3996 *
3997 * 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.
3998 *
3999 * 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.
4000 */
4001 g_signal_new ("changed",
4002 G_TYPE_FROM_INTERFACE (iface),
4003 G_SIGNAL_RUN_LAST,
4004 G_STRUCT_OFFSET (SensorValueIface, changed),
4005 NULL,
4006 NULL,
4007 g_cclosure_marshal_generic,
4008 G_TYPE_NONE,
4009 2, G_TYPE_VARIANT, G_TYPE_STRING);
4010
4011 /**
Norman James32e74e22015-09-15 21:28:06 -05004012 * SensorValue::error:
4013 * @object: A #SensorValue.
4014 *
4015 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorValue.Error">"Error"</link> is received.
4016 *
4017 * 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.
4018 */
4019 g_signal_new ("error",
4020 G_TYPE_FROM_INTERFACE (iface),
4021 G_SIGNAL_RUN_LAST,
4022 G_STRUCT_OFFSET (SensorValueIface, error),
4023 NULL,
4024 NULL,
4025 g_cclosure_marshal_generic,
4026 G_TYPE_NONE,
4027 0);
4028
4029 /**
Norman James362a80f2015-09-14 14:04:39 -05004030 * SensorValue::heartbeat:
4031 * @object: A #SensorValue.
4032 * @arg_bus_name: Argument.
4033 *
4034 * 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.
4035 *
4036 * 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.
4037 */
4038 g_signal_new ("heartbeat",
4039 G_TYPE_FROM_INTERFACE (iface),
4040 G_SIGNAL_RUN_LAST,
4041 G_STRUCT_OFFSET (SensorValueIface, heartbeat),
4042 NULL,
4043 NULL,
4044 g_cclosure_marshal_generic,
4045 G_TYPE_NONE,
4046 1, G_TYPE_STRING);
4047
4048 /* GObject properties for D-Bus properties: */
4049 /**
4050 * SensorValue:value:
4051 *
4052 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link>.
4053 *
4054 * 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.
4055 */
4056 g_object_interface_install_property (iface,
4057 g_param_spec_variant ("value", "value", "value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4058 /**
4059 * SensorValue:units:
4060 *
4061 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link>.
4062 *
4063 * 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.
4064 */
4065 g_object_interface_install_property (iface,
4066 g_param_spec_string ("units", "units", "units", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4067 /**
4068 * SensorValue:poll-interval:
4069 *
4070 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link>.
4071 *
4072 * 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.
4073 */
4074 g_object_interface_install_property (iface,
4075 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4076 /**
4077 * SensorValue:heatbeat:
4078 *
4079 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link>.
4080 *
4081 * 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.
4082 */
4083 g_object_interface_install_property (iface,
4084 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4085 /**
4086 * SensorValue:settable:
4087 *
4088 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link>.
4089 *
4090 * 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.
4091 */
4092 g_object_interface_install_property (iface,
4093 g_param_spec_boolean ("settable", "settable", "settable", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4094 /**
4095 * SensorValue:ipmi-entity-id:
4096 *
4097 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.ipmi_entity_id">"ipmi_entity_id"</link>.
4098 *
4099 * 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.
4100 */
4101 g_object_interface_install_property (iface,
4102 g_param_spec_uchar ("ipmi-entity-id", "ipmi_entity_id", "ipmi_entity_id", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4103 /**
4104 * SensorValue:ipmi-id:
4105 *
4106 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.ipmi_id">"ipmi_id"</link>.
4107 *
4108 * 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.
4109 */
4110 g_object_interface_install_property (iface,
4111 g_param_spec_uchar ("ipmi-id", "ipmi_id", "ipmi_id", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4112}
4113
4114/**
4115 * sensor_value_get_value: (skip)
4116 * @object: A #SensorValue.
4117 *
4118 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property.
4119 *
4120 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4121 *
4122 * <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>
4123 *
4124 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
4125 */
4126GVariant *
4127sensor_value_get_value (SensorValue *object)
4128{
4129 return SENSOR_VALUE_GET_IFACE (object)->get_value (object);
4130}
4131
4132/**
4133 * sensor_value_dup_value: (skip)
4134 * @object: A #SensorValue.
4135 *
4136 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property.
4137 *
4138 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4139 *
4140 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
4141 */
4142GVariant *
4143sensor_value_dup_value (SensorValue *object)
4144{
4145 GVariant *value;
4146 g_object_get (G_OBJECT (object), "value", &value, NULL);
4147 return value;
4148}
4149
4150/**
4151 * sensor_value_set_value: (skip)
4152 * @object: A #SensorValue.
4153 * @value: The value to set.
4154 *
4155 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property to @value.
4156 *
4157 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4158 */
4159void
4160sensor_value_set_value (SensorValue *object, GVariant *value)
4161{
4162 g_object_set (G_OBJECT (object), "value", value, NULL);
4163}
4164
4165/**
4166 * sensor_value_get_units: (skip)
4167 * @object: A #SensorValue.
4168 *
4169 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property.
4170 *
4171 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4172 *
4173 * <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>
4174 *
4175 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
4176 */
4177const gchar *
4178sensor_value_get_units (SensorValue *object)
4179{
4180 return SENSOR_VALUE_GET_IFACE (object)->get_units (object);
4181}
4182
4183/**
4184 * sensor_value_dup_units: (skip)
4185 * @object: A #SensorValue.
4186 *
4187 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property.
4188 *
4189 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4190 *
4191 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
4192 */
4193gchar *
4194sensor_value_dup_units (SensorValue *object)
4195{
4196 gchar *value;
4197 g_object_get (G_OBJECT (object), "units", &value, NULL);
4198 return value;
4199}
4200
4201/**
4202 * sensor_value_set_units: (skip)
4203 * @object: A #SensorValue.
4204 * @value: The value to set.
4205 *
4206 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property to @value.
4207 *
4208 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4209 */
4210void
4211sensor_value_set_units (SensorValue *object, const gchar *value)
4212{
4213 g_object_set (G_OBJECT (object), "units", value, NULL);
4214}
4215
4216/**
4217 * sensor_value_get_poll_interval: (skip)
4218 * @object: A #SensorValue.
4219 *
4220 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property.
4221 *
4222 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4223 *
4224 * Returns: The property value.
4225 */
4226gint
4227sensor_value_get_poll_interval (SensorValue *object)
4228{
4229 return SENSOR_VALUE_GET_IFACE (object)->get_poll_interval (object);
4230}
4231
4232/**
4233 * sensor_value_set_poll_interval: (skip)
4234 * @object: A #SensorValue.
4235 * @value: The value to set.
4236 *
4237 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property to @value.
4238 *
4239 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4240 */
4241void
4242sensor_value_set_poll_interval (SensorValue *object, gint value)
4243{
4244 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
4245}
4246
4247/**
4248 * sensor_value_get_heatbeat: (skip)
4249 * @object: A #SensorValue.
4250 *
4251 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property.
4252 *
4253 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4254 *
4255 * Returns: The property value.
4256 */
4257gint
4258sensor_value_get_heatbeat (SensorValue *object)
4259{
4260 return SENSOR_VALUE_GET_IFACE (object)->get_heatbeat (object);
4261}
4262
4263/**
4264 * sensor_value_set_heatbeat: (skip)
4265 * @object: A #SensorValue.
4266 * @value: The value to set.
4267 *
4268 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property to @value.
4269 *
4270 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4271 */
4272void
4273sensor_value_set_heatbeat (SensorValue *object, gint value)
4274{
4275 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
4276}
4277
4278/**
4279 * sensor_value_get_settable: (skip)
4280 * @object: A #SensorValue.
4281 *
4282 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property.
4283 *
4284 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4285 *
4286 * Returns: The property value.
4287 */
4288gboolean
4289sensor_value_get_settable (SensorValue *object)
4290{
4291 return SENSOR_VALUE_GET_IFACE (object)->get_settable (object);
4292}
4293
4294/**
4295 * sensor_value_set_settable: (skip)
4296 * @object: A #SensorValue.
4297 * @value: The value to set.
4298 *
4299 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property to @value.
4300 *
4301 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4302 */
4303void
4304sensor_value_set_settable (SensorValue *object, gboolean value)
4305{
4306 g_object_set (G_OBJECT (object), "settable", value, NULL);
4307}
4308
4309/**
4310 * sensor_value_get_ipmi_entity_id: (skip)
4311 * @object: A #SensorValue.
4312 *
4313 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.ipmi_entity_id">"ipmi_entity_id"</link> D-Bus property.
4314 *
4315 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4316 *
4317 * Returns: The property value.
4318 */
4319guchar
4320sensor_value_get_ipmi_entity_id (SensorValue *object)
4321{
4322 return SENSOR_VALUE_GET_IFACE (object)->get_ipmi_entity_id (object);
4323}
4324
4325/**
4326 * sensor_value_set_ipmi_entity_id: (skip)
4327 * @object: A #SensorValue.
4328 * @value: The value to set.
4329 *
4330 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.ipmi_entity_id">"ipmi_entity_id"</link> D-Bus property to @value.
4331 *
4332 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4333 */
4334void
4335sensor_value_set_ipmi_entity_id (SensorValue *object, guchar value)
4336{
4337 g_object_set (G_OBJECT (object), "ipmi-entity-id", value, NULL);
4338}
4339
4340/**
4341 * sensor_value_get_ipmi_id: (skip)
4342 * @object: A #SensorValue.
4343 *
4344 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.ipmi_id">"ipmi_id"</link> D-Bus property.
4345 *
4346 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4347 *
4348 * Returns: The property value.
4349 */
4350guchar
4351sensor_value_get_ipmi_id (SensorValue *object)
4352{
4353 return SENSOR_VALUE_GET_IFACE (object)->get_ipmi_id (object);
4354}
4355
4356/**
4357 * sensor_value_set_ipmi_id: (skip)
4358 * @object: A #SensorValue.
4359 * @value: The value to set.
4360 *
4361 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.ipmi_id">"ipmi_id"</link> D-Bus property to @value.
4362 *
4363 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4364 */
4365void
4366sensor_value_set_ipmi_id (SensorValue *object, guchar value)
4367{
4368 g_object_set (G_OBJECT (object), "ipmi-id", value, NULL);
4369}
4370
4371/**
4372 * sensor_value_emit_changed:
4373 * @object: A #SensorValue.
4374 * @arg_value: Argument to pass with the signal.
4375 * @arg_units: Argument to pass with the signal.
4376 *
4377 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Changed">"Changed"</link> D-Bus signal.
4378 */
4379void
4380sensor_value_emit_changed (
4381 SensorValue *object,
4382 GVariant *arg_value,
4383 const gchar *arg_units)
4384{
4385 g_signal_emit_by_name (object, "changed", arg_value, arg_units);
4386}
4387
4388/**
Norman James32e74e22015-09-15 21:28:06 -05004389 * sensor_value_emit_error:
4390 * @object: A #SensorValue.
4391 *
4392 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Error">"Error"</link> D-Bus signal.
4393 */
4394void
4395sensor_value_emit_error (
4396 SensorValue *object)
4397{
4398 g_signal_emit_by_name (object, "error");
4399}
4400
4401/**
Norman James362a80f2015-09-14 14:04:39 -05004402 * sensor_value_emit_heartbeat:
4403 * @object: A #SensorValue.
4404 * @arg_bus_name: Argument to pass with the signal.
4405 *
4406 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Heartbeat">"Heartbeat"</link> D-Bus signal.
4407 */
4408void
4409sensor_value_emit_heartbeat (
4410 SensorValue *object,
4411 const gchar *arg_bus_name)
4412{
4413 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
4414}
4415
4416/**
4417 * sensor_value_call_init:
4418 * @proxy: A #SensorValueProxy.
4419 * @cancellable: (allow-none): A #GCancellable or %NULL.
4420 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4421 * @user_data: User data to pass to @callback.
4422 *
4423 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method on @proxy.
4424 * 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.
4425 * You can then call sensor_value_call_init_finish() to get the result of the operation.
4426 *
4427 * See sensor_value_call_init_sync() for the synchronous, blocking version of this method.
4428 */
4429void
4430sensor_value_call_init (
4431 SensorValue *proxy,
4432 GCancellable *cancellable,
4433 GAsyncReadyCallback callback,
4434 gpointer user_data)
4435{
4436 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4437 "init",
4438 g_variant_new ("()"),
4439 G_DBUS_CALL_FLAGS_NONE,
4440 -1,
4441 cancellable,
4442 callback,
4443 user_data);
4444}
4445
4446/**
4447 * sensor_value_call_init_finish:
4448 * @proxy: A #SensorValueProxy.
4449 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_init().
4450 * @error: Return location for error or %NULL.
4451 *
4452 * Finishes an operation started with sensor_value_call_init().
4453 *
4454 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4455 */
4456gboolean
4457sensor_value_call_init_finish (
4458 SensorValue *proxy,
4459 GAsyncResult *res,
4460 GError **error)
4461{
4462 GVariant *_ret;
4463 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4464 if (_ret == NULL)
4465 goto _out;
4466 g_variant_get (_ret,
4467 "()");
4468 g_variant_unref (_ret);
4469_out:
4470 return _ret != NULL;
4471}
4472
4473/**
4474 * sensor_value_call_init_sync:
4475 * @proxy: A #SensorValueProxy.
4476 * @cancellable: (allow-none): A #GCancellable or %NULL.
4477 * @error: Return location for error or %NULL.
4478 *
4479 * 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.
4480 *
4481 * See sensor_value_call_init() for the asynchronous version of this method.
4482 *
4483 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4484 */
4485gboolean
4486sensor_value_call_init_sync (
4487 SensorValue *proxy,
4488 GCancellable *cancellable,
4489 GError **error)
4490{
4491 GVariant *_ret;
4492 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4493 "init",
4494 g_variant_new ("()"),
4495 G_DBUS_CALL_FLAGS_NONE,
4496 -1,
4497 cancellable,
4498 error);
4499 if (_ret == NULL)
4500 goto _out;
4501 g_variant_get (_ret,
4502 "()");
4503 g_variant_unref (_ret);
4504_out:
4505 return _ret != NULL;
4506}
4507
4508/**
4509 * sensor_value_call_get_value:
4510 * @proxy: A #SensorValueProxy.
4511 * @cancellable: (allow-none): A #GCancellable or %NULL.
4512 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4513 * @user_data: User data to pass to @callback.
4514 *
4515 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method on @proxy.
4516 * 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.
4517 * You can then call sensor_value_call_get_value_finish() to get the result of the operation.
4518 *
4519 * See sensor_value_call_get_value_sync() for the synchronous, blocking version of this method.
4520 */
4521void
4522sensor_value_call_get_value (
4523 SensorValue *proxy,
4524 GCancellable *cancellable,
4525 GAsyncReadyCallback callback,
4526 gpointer user_data)
4527{
4528 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4529 "getValue",
4530 g_variant_new ("()"),
4531 G_DBUS_CALL_FLAGS_NONE,
4532 -1,
4533 cancellable,
4534 callback,
4535 user_data);
4536}
4537
4538/**
4539 * sensor_value_call_get_value_finish:
4540 * @proxy: A #SensorValueProxy.
4541 * @out_value: (out): Return location for return parameter or %NULL to ignore.
4542 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_get_value().
4543 * @error: Return location for error or %NULL.
4544 *
4545 * Finishes an operation started with sensor_value_call_get_value().
4546 *
4547 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4548 */
4549gboolean
4550sensor_value_call_get_value_finish (
4551 SensorValue *proxy,
4552 GVariant **out_value,
4553 GAsyncResult *res,
4554 GError **error)
4555{
4556 GVariant *_ret;
4557 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4558 if (_ret == NULL)
4559 goto _out;
4560 g_variant_get (_ret,
4561 "(@v)",
4562 out_value);
4563 g_variant_unref (_ret);
4564_out:
4565 return _ret != NULL;
4566}
4567
4568/**
4569 * sensor_value_call_get_value_sync:
4570 * @proxy: A #SensorValueProxy.
4571 * @out_value: (out): Return location for return parameter or %NULL to ignore.
4572 * @cancellable: (allow-none): A #GCancellable or %NULL.
4573 * @error: Return location for error or %NULL.
4574 *
4575 * 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.
4576 *
4577 * See sensor_value_call_get_value() for the asynchronous version of this method.
4578 *
4579 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4580 */
4581gboolean
4582sensor_value_call_get_value_sync (
4583 SensorValue *proxy,
4584 GVariant **out_value,
4585 GCancellable *cancellable,
4586 GError **error)
4587{
4588 GVariant *_ret;
4589 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4590 "getValue",
4591 g_variant_new ("()"),
4592 G_DBUS_CALL_FLAGS_NONE,
4593 -1,
4594 cancellable,
4595 error);
4596 if (_ret == NULL)
4597 goto _out;
4598 g_variant_get (_ret,
4599 "(@v)",
4600 out_value);
4601 g_variant_unref (_ret);
4602_out:
4603 return _ret != NULL;
4604}
4605
4606/**
4607 * sensor_value_call_set_value:
4608 * @proxy: A #SensorValueProxy.
4609 * @arg_value: Argument to pass with the method invocation.
4610 * @cancellable: (allow-none): A #GCancellable or %NULL.
4611 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4612 * @user_data: User data to pass to @callback.
4613 *
4614 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method on @proxy.
4615 * 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.
4616 * You can then call sensor_value_call_set_value_finish() to get the result of the operation.
4617 *
4618 * See sensor_value_call_set_value_sync() for the synchronous, blocking version of this method.
4619 */
4620void
4621sensor_value_call_set_value (
4622 SensorValue *proxy,
4623 GVariant *arg_value,
4624 GCancellable *cancellable,
4625 GAsyncReadyCallback callback,
4626 gpointer user_data)
4627{
4628 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4629 "setValue",
4630 g_variant_new ("(@v)",
4631 arg_value),
4632 G_DBUS_CALL_FLAGS_NONE,
4633 -1,
4634 cancellable,
4635 callback,
4636 user_data);
4637}
4638
4639/**
4640 * sensor_value_call_set_value_finish:
4641 * @proxy: A #SensorValueProxy.
4642 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_set_value().
4643 * @error: Return location for error or %NULL.
4644 *
4645 * Finishes an operation started with sensor_value_call_set_value().
4646 *
4647 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4648 */
4649gboolean
4650sensor_value_call_set_value_finish (
4651 SensorValue *proxy,
4652 GAsyncResult *res,
4653 GError **error)
4654{
4655 GVariant *_ret;
4656 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4657 if (_ret == NULL)
4658 goto _out;
4659 g_variant_get (_ret,
4660 "()");
4661 g_variant_unref (_ret);
4662_out:
4663 return _ret != NULL;
4664}
4665
4666/**
4667 * sensor_value_call_set_value_sync:
4668 * @proxy: A #SensorValueProxy.
4669 * @arg_value: Argument to pass with the method invocation.
4670 * @cancellable: (allow-none): A #GCancellable or %NULL.
4671 * @error: Return location for error or %NULL.
4672 *
4673 * 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.
4674 *
4675 * See sensor_value_call_set_value() for the asynchronous version of this method.
4676 *
4677 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4678 */
4679gboolean
4680sensor_value_call_set_value_sync (
4681 SensorValue *proxy,
4682 GVariant *arg_value,
4683 GCancellable *cancellable,
4684 GError **error)
4685{
4686 GVariant *_ret;
4687 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4688 "setValue",
4689 g_variant_new ("(@v)",
4690 arg_value),
4691 G_DBUS_CALL_FLAGS_NONE,
4692 -1,
4693 cancellable,
4694 error);
4695 if (_ret == NULL)
4696 goto _out;
4697 g_variant_get (_ret,
4698 "()");
4699 g_variant_unref (_ret);
4700_out:
4701 return _ret != NULL;
4702}
4703
4704/**
4705 * sensor_value_complete_init:
4706 * @object: A #SensorValue.
4707 * @invocation: (transfer full): A #GDBusMethodInvocation.
4708 *
4709 * 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.
4710 *
4711 * This method will free @invocation, you cannot use it afterwards.
4712 */
4713void
4714sensor_value_complete_init (
4715 SensorValue *object,
4716 GDBusMethodInvocation *invocation)
4717{
4718 g_dbus_method_invocation_return_value (invocation,
4719 g_variant_new ("()"));
4720}
4721
4722/**
4723 * sensor_value_complete_get_value:
4724 * @object: A #SensorValue.
4725 * @invocation: (transfer full): A #GDBusMethodInvocation.
4726 * @value: Parameter to return.
4727 *
4728 * 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.
4729 *
4730 * This method will free @invocation, you cannot use it afterwards.
4731 */
4732void
4733sensor_value_complete_get_value (
4734 SensorValue *object,
4735 GDBusMethodInvocation *invocation,
4736 GVariant *value)
4737{
4738 g_dbus_method_invocation_return_value (invocation,
4739 g_variant_new ("(@v)",
4740 value));
4741}
4742
4743/**
4744 * sensor_value_complete_set_value:
4745 * @object: A #SensorValue.
4746 * @invocation: (transfer full): A #GDBusMethodInvocation.
4747 *
4748 * 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.
4749 *
4750 * This method will free @invocation, you cannot use it afterwards.
4751 */
4752void
4753sensor_value_complete_set_value (
4754 SensorValue *object,
4755 GDBusMethodInvocation *invocation)
4756{
4757 g_dbus_method_invocation_return_value (invocation,
4758 g_variant_new ("()"));
4759}
4760
4761/* ------------------------------------------------------------------------ */
4762
4763/**
4764 * SensorValueProxy:
4765 *
4766 * The #SensorValueProxy structure contains only private data and should only be accessed using the provided API.
4767 */
4768
4769/**
4770 * SensorValueProxyClass:
4771 * @parent_class: The parent class.
4772 *
4773 * Class structure for #SensorValueProxy.
4774 */
4775
4776struct _SensorValueProxyPrivate
4777{
4778 GData *qdata;
4779};
4780
4781static void sensor_value_proxy_iface_init (SensorValueIface *iface);
4782
4783#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4784G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
4785 G_ADD_PRIVATE (SensorValueProxy)
4786 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init));
4787
4788#else
4789G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
4790 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init));
4791
4792#endif
4793static void
4794sensor_value_proxy_finalize (GObject *object)
4795{
4796 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4797 g_datalist_clear (&proxy->priv->qdata);
4798 G_OBJECT_CLASS (sensor_value_proxy_parent_class)->finalize (object);
4799}
4800
4801static void
4802sensor_value_proxy_get_property (GObject *object,
4803 guint prop_id,
4804 GValue *value,
4805 GParamSpec *pspec G_GNUC_UNUSED)
4806{
4807 const _ExtendedGDBusPropertyInfo *info;
4808 GVariant *variant;
4809 g_assert (prop_id != 0 && prop_id - 1 < 7);
4810 info = _sensor_value_property_info_pointers[prop_id - 1];
4811 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
4812 if (info->use_gvariant)
4813 {
4814 g_value_set_variant (value, variant);
4815 }
4816 else
4817 {
4818 if (variant != NULL)
4819 g_dbus_gvariant_to_gvalue (variant, value);
4820 }
4821 if (variant != NULL)
4822 g_variant_unref (variant);
4823}
4824
4825static void
4826sensor_value_proxy_set_property_cb (GDBusProxy *proxy,
4827 GAsyncResult *res,
4828 gpointer user_data)
4829{
4830 const _ExtendedGDBusPropertyInfo *info = user_data;
4831 GError *error;
4832 GVariant *_ret;
4833 error = NULL;
4834 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
4835 if (!_ret)
4836 {
4837 g_warning ("Error setting property '%s' on interface org.openbmc.SensorValue: %s (%s, %d)",
4838 info->parent_struct.name,
4839 error->message, g_quark_to_string (error->domain), error->code);
4840 g_error_free (error);
4841 }
4842 else
4843 {
4844 g_variant_unref (_ret);
4845 }
4846}
4847
4848static void
4849sensor_value_proxy_set_property (GObject *object,
4850 guint prop_id,
4851 const GValue *value,
4852 GParamSpec *pspec G_GNUC_UNUSED)
4853{
4854 const _ExtendedGDBusPropertyInfo *info;
4855 GVariant *variant;
4856 g_assert (prop_id != 0 && prop_id - 1 < 7);
4857 info = _sensor_value_property_info_pointers[prop_id - 1];
4858 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
4859 g_dbus_proxy_call (G_DBUS_PROXY (object),
4860 "org.freedesktop.DBus.Properties.Set",
4861 g_variant_new ("(ssv)", "org.openbmc.SensorValue", info->parent_struct.name, variant),
4862 G_DBUS_CALL_FLAGS_NONE,
4863 -1,
4864 NULL, (GAsyncReadyCallback) sensor_value_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
4865 g_variant_unref (variant);
4866}
4867
4868static void
4869sensor_value_proxy_g_signal (GDBusProxy *proxy,
4870 const gchar *sender_name G_GNUC_UNUSED,
4871 const gchar *signal_name,
4872 GVariant *parameters)
4873{
4874 _ExtendedGDBusSignalInfo *info;
4875 GVariantIter iter;
4876 GVariant *child;
4877 GValue *paramv;
4878 guint num_params;
4879 guint n;
4880 guint signal_id;
4881 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, signal_name);
4882 if (info == NULL)
4883 return;
4884 num_params = g_variant_n_children (parameters);
4885 paramv = g_new0 (GValue, num_params + 1);
4886 g_value_init (&paramv[0], TYPE_SENSOR_VALUE);
4887 g_value_set_object (&paramv[0], proxy);
4888 g_variant_iter_init (&iter, parameters);
4889 n = 1;
4890 while ((child = g_variant_iter_next_value (&iter)) != NULL)
4891 {
4892 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
4893 if (arg_info->use_gvariant)
4894 {
4895 g_value_init (&paramv[n], G_TYPE_VARIANT);
4896 g_value_set_variant (&paramv[n], child);
4897 n++;
4898 }
4899 else
4900 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
4901 g_variant_unref (child);
4902 }
4903 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
4904 g_signal_emitv (paramv, signal_id, 0, NULL);
4905 for (n = 0; n < num_params + 1; n++)
4906 g_value_unset (&paramv[n]);
4907 g_free (paramv);
4908}
4909
4910static void
4911sensor_value_proxy_g_properties_changed (GDBusProxy *_proxy,
4912 GVariant *changed_properties,
4913 const gchar *const *invalidated_properties)
4914{
4915 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (_proxy);
4916 guint n;
4917 const gchar *key;
4918 GVariantIter *iter;
4919 _ExtendedGDBusPropertyInfo *info;
4920 g_variant_get (changed_properties, "a{sv}", &iter);
4921 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
4922 {
4923 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, key);
4924 g_datalist_remove_data (&proxy->priv->qdata, key);
4925 if (info != NULL)
4926 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4927 }
4928 g_variant_iter_free (iter);
4929 for (n = 0; invalidated_properties[n] != NULL; n++)
4930 {
4931 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, invalidated_properties[n]);
4932 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
4933 if (info != NULL)
4934 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4935 }
4936}
4937
4938static GVariant *
4939sensor_value_proxy_get_value (SensorValue *object)
4940{
4941 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4942 GVariant *variant;
4943 GVariant *value = NULL;
4944 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value");
4945 value = variant;
4946 if (variant != NULL)
4947 g_variant_unref (variant);
4948 return value;
4949}
4950
4951static const gchar *
4952sensor_value_proxy_get_units (SensorValue *object)
4953{
4954 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4955 GVariant *variant;
4956 const gchar *value = NULL;
4957 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units");
4958 if (variant != NULL)
4959 {
4960 value = g_variant_get_string (variant, NULL);
4961 g_variant_unref (variant);
4962 }
4963 return value;
4964}
4965
4966static gint
4967sensor_value_proxy_get_poll_interval (SensorValue *object)
4968{
4969 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4970 GVariant *variant;
4971 gint value = 0;
4972 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
4973 if (variant != NULL)
4974 {
4975 value = g_variant_get_int32 (variant);
4976 g_variant_unref (variant);
4977 }
4978 return value;
4979}
4980
4981static gint
4982sensor_value_proxy_get_heatbeat (SensorValue *object)
4983{
4984 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4985 GVariant *variant;
4986 gint value = 0;
4987 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
4988 if (variant != NULL)
4989 {
4990 value = g_variant_get_int32 (variant);
4991 g_variant_unref (variant);
4992 }
4993 return value;
4994}
4995
4996static gboolean
4997sensor_value_proxy_get_settable (SensorValue *object)
4998{
4999 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
5000 GVariant *variant;
5001 gboolean value = 0;
5002 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "settable");
5003 if (variant != NULL)
5004 {
5005 value = g_variant_get_boolean (variant);
5006 g_variant_unref (variant);
5007 }
5008 return value;
5009}
5010
5011static guchar
5012sensor_value_proxy_get_ipmi_entity_id (SensorValue *object)
5013{
5014 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
5015 GVariant *variant;
5016 guchar value = 0;
5017 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "ipmi_entity_id");
5018 if (variant != NULL)
5019 {
5020 value = g_variant_get_byte (variant);
5021 g_variant_unref (variant);
5022 }
5023 return value;
5024}
5025
5026static guchar
5027sensor_value_proxy_get_ipmi_id (SensorValue *object)
5028{
5029 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
5030 GVariant *variant;
5031 guchar value = 0;
5032 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "ipmi_id");
5033 if (variant != NULL)
5034 {
5035 value = g_variant_get_byte (variant);
5036 g_variant_unref (variant);
5037 }
5038 return value;
5039}
5040
5041static void
5042sensor_value_proxy_init (SensorValueProxy *proxy)
5043{
5044#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5045 proxy->priv = sensor_value_proxy_get_instance_private (proxy);
5046#else
5047 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_VALUE_PROXY, SensorValueProxyPrivate);
5048#endif
5049
5050 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_value_interface_info ());
5051}
5052
5053static void
5054sensor_value_proxy_class_init (SensorValueProxyClass *klass)
5055{
5056 GObjectClass *gobject_class;
5057 GDBusProxyClass *proxy_class;
5058
5059 gobject_class = G_OBJECT_CLASS (klass);
5060 gobject_class->finalize = sensor_value_proxy_finalize;
5061 gobject_class->get_property = sensor_value_proxy_get_property;
5062 gobject_class->set_property = sensor_value_proxy_set_property;
5063
5064 proxy_class = G_DBUS_PROXY_CLASS (klass);
5065 proxy_class->g_signal = sensor_value_proxy_g_signal;
5066 proxy_class->g_properties_changed = sensor_value_proxy_g_properties_changed;
5067
5068 sensor_value_override_properties (gobject_class, 1);
5069
5070#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
5071 g_type_class_add_private (klass, sizeof (SensorValueProxyPrivate));
5072#endif
5073}
5074
5075static void
5076sensor_value_proxy_iface_init (SensorValueIface *iface)
5077{
5078 iface->get_value = sensor_value_proxy_get_value;
5079 iface->get_units = sensor_value_proxy_get_units;
5080 iface->get_poll_interval = sensor_value_proxy_get_poll_interval;
5081 iface->get_heatbeat = sensor_value_proxy_get_heatbeat;
5082 iface->get_settable = sensor_value_proxy_get_settable;
5083 iface->get_ipmi_entity_id = sensor_value_proxy_get_ipmi_entity_id;
5084 iface->get_ipmi_id = sensor_value_proxy_get_ipmi_id;
5085}
5086
5087/**
5088 * sensor_value_proxy_new:
5089 * @connection: A #GDBusConnection.
5090 * @flags: Flags from the #GDBusProxyFlags enumeration.
5091 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
5092 * @object_path: An object path.
5093 * @cancellable: (allow-none): A #GCancellable or %NULL.
5094 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
5095 * @user_data: User data to pass to @callback.
5096 *
5097 * 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.
5098 *
5099 * 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.
5100 * You can then call sensor_value_proxy_new_finish() to get the result of the operation.
5101 *
5102 * See sensor_value_proxy_new_sync() for the synchronous, blocking version of this constructor.
5103 */
5104void
5105sensor_value_proxy_new (
5106 GDBusConnection *connection,
5107 GDBusProxyFlags flags,
5108 const gchar *name,
5109 const gchar *object_path,
5110 GCancellable *cancellable,
5111 GAsyncReadyCallback callback,
5112 gpointer user_data)
5113{
5114 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);
5115}
5116
5117/**
5118 * sensor_value_proxy_new_finish:
5119 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new().
5120 * @error: Return location for error or %NULL
5121 *
5122 * Finishes an operation started with sensor_value_proxy_new().
5123 *
5124 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5125 */
5126SensorValue *
5127sensor_value_proxy_new_finish (
5128 GAsyncResult *res,
5129 GError **error)
5130{
5131 GObject *ret;
5132 GObject *source_object;
5133 source_object = g_async_result_get_source_object (res);
5134 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
5135 g_object_unref (source_object);
5136 if (ret != NULL)
5137 return SENSOR_VALUE (ret);
5138 else
5139 return NULL;
5140}
5141
5142/**
5143 * sensor_value_proxy_new_sync:
5144 * @connection: A #GDBusConnection.
5145 * @flags: Flags from the #GDBusProxyFlags enumeration.
5146 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
5147 * @object_path: An object path.
5148 * @cancellable: (allow-none): A #GCancellable or %NULL.
5149 * @error: Return location for error or %NULL
5150 *
5151 * 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.
5152 *
5153 * The calling thread is blocked until a reply is received.
5154 *
5155 * See sensor_value_proxy_new() for the asynchronous version of this constructor.
5156 *
5157 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5158 */
5159SensorValue *
5160sensor_value_proxy_new_sync (
5161 GDBusConnection *connection,
5162 GDBusProxyFlags flags,
5163 const gchar *name,
5164 const gchar *object_path,
5165 GCancellable *cancellable,
5166 GError **error)
5167{
5168 GInitable *ret;
5169 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);
5170 if (ret != NULL)
5171 return SENSOR_VALUE (ret);
5172 else
5173 return NULL;
5174}
5175
5176
5177/**
5178 * sensor_value_proxy_new_for_bus:
5179 * @bus_type: A #GBusType.
5180 * @flags: Flags from the #GDBusProxyFlags enumeration.
5181 * @name: A bus name (well-known or unique).
5182 * @object_path: An object path.
5183 * @cancellable: (allow-none): A #GCancellable or %NULL.
5184 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
5185 * @user_data: User data to pass to @callback.
5186 *
5187 * Like sensor_value_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
5188 *
5189 * 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.
5190 * You can then call sensor_value_proxy_new_for_bus_finish() to get the result of the operation.
5191 *
5192 * See sensor_value_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
5193 */
5194void
5195sensor_value_proxy_new_for_bus (
5196 GBusType bus_type,
5197 GDBusProxyFlags flags,
5198 const gchar *name,
5199 const gchar *object_path,
5200 GCancellable *cancellable,
5201 GAsyncReadyCallback callback,
5202 gpointer user_data)
5203{
5204 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);
5205}
5206
5207/**
5208 * sensor_value_proxy_new_for_bus_finish:
5209 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new_for_bus().
5210 * @error: Return location for error or %NULL
5211 *
5212 * Finishes an operation started with sensor_value_proxy_new_for_bus().
5213 *
5214 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5215 */
5216SensorValue *
5217sensor_value_proxy_new_for_bus_finish (
5218 GAsyncResult *res,
5219 GError **error)
5220{
5221 GObject *ret;
5222 GObject *source_object;
5223 source_object = g_async_result_get_source_object (res);
5224 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
5225 g_object_unref (source_object);
5226 if (ret != NULL)
5227 return SENSOR_VALUE (ret);
5228 else
5229 return NULL;
5230}
5231
5232/**
5233 * sensor_value_proxy_new_for_bus_sync:
5234 * @bus_type: A #GBusType.
5235 * @flags: Flags from the #GDBusProxyFlags enumeration.
5236 * @name: A bus name (well-known or unique).
5237 * @object_path: An object path.
5238 * @cancellable: (allow-none): A #GCancellable or %NULL.
5239 * @error: Return location for error or %NULL
5240 *
5241 * Like sensor_value_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
5242 *
5243 * The calling thread is blocked until a reply is received.
5244 *
5245 * See sensor_value_proxy_new_for_bus() for the asynchronous version of this constructor.
5246 *
5247 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5248 */
5249SensorValue *
5250sensor_value_proxy_new_for_bus_sync (
5251 GBusType bus_type,
5252 GDBusProxyFlags flags,
5253 const gchar *name,
5254 const gchar *object_path,
5255 GCancellable *cancellable,
5256 GError **error)
5257{
5258 GInitable *ret;
5259 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);
5260 if (ret != NULL)
5261 return SENSOR_VALUE (ret);
5262 else
5263 return NULL;
5264}
5265
5266
5267/* ------------------------------------------------------------------------ */
5268
5269/**
5270 * SensorValueSkeleton:
5271 *
5272 * The #SensorValueSkeleton structure contains only private data and should only be accessed using the provided API.
5273 */
5274
5275/**
5276 * SensorValueSkeletonClass:
5277 * @parent_class: The parent class.
5278 *
5279 * Class structure for #SensorValueSkeleton.
5280 */
5281
5282struct _SensorValueSkeletonPrivate
5283{
5284 GValue *properties;
5285 GList *changed_properties;
5286 GSource *changed_properties_idle_source;
5287 GMainContext *context;
5288 GMutex lock;
5289};
5290
5291static void
5292_sensor_value_skeleton_handle_method_call (
5293 GDBusConnection *connection G_GNUC_UNUSED,
5294 const gchar *sender G_GNUC_UNUSED,
5295 const gchar *object_path G_GNUC_UNUSED,
5296 const gchar *interface_name,
5297 const gchar *method_name,
5298 GVariant *parameters,
5299 GDBusMethodInvocation *invocation,
5300 gpointer user_data)
5301{
5302 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5303 _ExtendedGDBusMethodInfo *info;
5304 GVariantIter iter;
5305 GVariant *child;
5306 GValue *paramv;
5307 guint num_params;
5308 guint num_extra;
5309 guint n;
5310 guint signal_id;
5311 GValue return_value = G_VALUE_INIT;
5312 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
5313 g_assert (info != NULL);
5314 num_params = g_variant_n_children (parameters);
5315 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
5316 n = 0;
5317 g_value_init (&paramv[n], TYPE_SENSOR_VALUE);
5318 g_value_set_object (&paramv[n++], skeleton);
5319 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
5320 g_value_set_object (&paramv[n++], invocation);
5321 if (info->pass_fdlist)
5322 {
5323#ifdef G_OS_UNIX
5324 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
5325 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
5326#else
5327 g_assert_not_reached ();
5328#endif
5329 }
5330 g_variant_iter_init (&iter, parameters);
5331 while ((child = g_variant_iter_next_value (&iter)) != NULL)
5332 {
5333 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
5334 if (arg_info->use_gvariant)
5335 {
5336 g_value_init (&paramv[n], G_TYPE_VARIANT);
5337 g_value_set_variant (&paramv[n], child);
5338 n++;
5339 }
5340 else
5341 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
5342 g_variant_unref (child);
5343 }
5344 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
5345 g_value_init (&return_value, G_TYPE_BOOLEAN);
5346 g_signal_emitv (paramv, signal_id, 0, &return_value);
5347 if (!g_value_get_boolean (&return_value))
5348 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);
5349 g_value_unset (&return_value);
5350 for (n = 0; n < num_params + num_extra; n++)
5351 g_value_unset (&paramv[n]);
5352 g_free (paramv);
5353}
5354
5355static GVariant *
5356_sensor_value_skeleton_handle_get_property (
5357 GDBusConnection *connection G_GNUC_UNUSED,
5358 const gchar *sender G_GNUC_UNUSED,
5359 const gchar *object_path G_GNUC_UNUSED,
5360 const gchar *interface_name G_GNUC_UNUSED,
5361 const gchar *property_name,
5362 GError **error,
5363 gpointer user_data)
5364{
5365 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5366 GValue value = G_VALUE_INIT;
5367 GParamSpec *pspec;
5368 _ExtendedGDBusPropertyInfo *info;
5369 GVariant *ret;
5370 ret = NULL;
5371 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
5372 g_assert (info != NULL);
5373 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5374 if (pspec == NULL)
5375 {
5376 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5377 }
5378 else
5379 {
5380 g_value_init (&value, pspec->value_type);
5381 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5382 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
5383 g_value_unset (&value);
5384 }
5385 return ret;
5386}
5387
5388static gboolean
5389_sensor_value_skeleton_handle_set_property (
5390 GDBusConnection *connection G_GNUC_UNUSED,
5391 const gchar *sender G_GNUC_UNUSED,
5392 const gchar *object_path G_GNUC_UNUSED,
5393 const gchar *interface_name G_GNUC_UNUSED,
5394 const gchar *property_name,
5395 GVariant *variant,
5396 GError **error,
5397 gpointer user_data)
5398{
5399 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5400 GValue value = G_VALUE_INIT;
5401 GParamSpec *pspec;
5402 _ExtendedGDBusPropertyInfo *info;
5403 gboolean ret;
5404 ret = FALSE;
5405 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
5406 g_assert (info != NULL);
5407 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5408 if (pspec == NULL)
5409 {
5410 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5411 }
5412 else
5413 {
5414 if (info->use_gvariant)
5415 g_value_set_variant (&value, variant);
5416 else
5417 g_dbus_gvariant_to_gvalue (variant, &value);
5418 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5419 g_value_unset (&value);
5420 ret = TRUE;
5421 }
5422 return ret;
5423}
5424
5425static const GDBusInterfaceVTable _sensor_value_skeleton_vtable =
5426{
5427 _sensor_value_skeleton_handle_method_call,
5428 _sensor_value_skeleton_handle_get_property,
5429 _sensor_value_skeleton_handle_set_property,
5430 {NULL}
5431};
5432
5433static GDBusInterfaceInfo *
5434sensor_value_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5435{
5436 return sensor_value_interface_info ();
5437}
5438
5439static GDBusInterfaceVTable *
5440sensor_value_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5441{
5442 return (GDBusInterfaceVTable *) &_sensor_value_skeleton_vtable;
5443}
5444
5445static GVariant *
5446sensor_value_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
5447{
5448 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
5449
5450 GVariantBuilder builder;
5451 guint n;
5452 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5453 if (_sensor_value_interface_info.parent_struct.properties == NULL)
5454 goto out;
5455 for (n = 0; _sensor_value_interface_info.parent_struct.properties[n] != NULL; n++)
5456 {
5457 GDBusPropertyInfo *info = _sensor_value_interface_info.parent_struct.properties[n];
5458 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
5459 {
5460 GVariant *value;
5461 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);
5462 if (value != NULL)
5463 {
5464 g_variant_take_ref (value);
5465 g_variant_builder_add (&builder, "{sv}", info->name, value);
5466 g_variant_unref (value);
5467 }
5468 }
5469 }
5470out:
5471 return g_variant_builder_end (&builder);
5472}
5473
5474static gboolean _sensor_value_emit_changed (gpointer user_data);
5475
5476static void
5477sensor_value_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
5478{
5479 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
5480 gboolean emit_changed = FALSE;
5481
5482 g_mutex_lock (&skeleton->priv->lock);
5483 if (skeleton->priv->changed_properties_idle_source != NULL)
5484 {
5485 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5486 skeleton->priv->changed_properties_idle_source = NULL;
5487 emit_changed = TRUE;
5488 }
5489 g_mutex_unlock (&skeleton->priv->lock);
5490
5491 if (emit_changed)
5492 _sensor_value_emit_changed (skeleton);
5493}
5494
5495static void
5496_sensor_value_on_signal_changed (
5497 SensorValue *object,
5498 GVariant *arg_value,
5499 const gchar *arg_units)
5500{
5501 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5502
5503 GList *connections, *l;
5504 GVariant *signal_variant;
5505 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5506
5507 signal_variant = g_variant_ref_sink (g_variant_new ("(@vs)",
5508 arg_value,
5509 arg_units));
5510 for (l = connections; l != NULL; l = l->next)
5511 {
5512 GDBusConnection *connection = l->data;
5513 g_dbus_connection_emit_signal (connection,
5514 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Changed",
5515 signal_variant, NULL);
5516 }
5517 g_variant_unref (signal_variant);
5518 g_list_free_full (connections, g_object_unref);
5519}
5520
5521static void
Norman James32e74e22015-09-15 21:28:06 -05005522_sensor_value_on_signal_error (
5523 SensorValue *object)
5524{
5525 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5526
5527 GList *connections, *l;
5528 GVariant *signal_variant;
5529 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5530
5531 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
5532 for (l = connections; l != NULL; l = l->next)
5533 {
5534 GDBusConnection *connection = l->data;
5535 g_dbus_connection_emit_signal (connection,
5536 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Error",
5537 signal_variant, NULL);
5538 }
5539 g_variant_unref (signal_variant);
5540 g_list_free_full (connections, g_object_unref);
5541}
5542
5543static void
Norman James362a80f2015-09-14 14:04:39 -05005544_sensor_value_on_signal_heartbeat (
5545 SensorValue *object,
5546 const gchar *arg_bus_name)
5547{
5548 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5549
5550 GList *connections, *l;
5551 GVariant *signal_variant;
5552 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5553
5554 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
5555 arg_bus_name));
5556 for (l = connections; l != NULL; l = l->next)
5557 {
5558 GDBusConnection *connection = l->data;
5559 g_dbus_connection_emit_signal (connection,
5560 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Heartbeat",
5561 signal_variant, NULL);
5562 }
5563 g_variant_unref (signal_variant);
5564 g_list_free_full (connections, g_object_unref);
5565}
5566
5567static void sensor_value_skeleton_iface_init (SensorValueIface *iface);
5568#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5569G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5570 G_ADD_PRIVATE (SensorValueSkeleton)
5571 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init));
5572
5573#else
5574G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5575 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init));
5576
5577#endif
5578static void
5579sensor_value_skeleton_finalize (GObject *object)
5580{
5581 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5582 guint n;
5583 for (n = 0; n < 7; n++)
5584 g_value_unset (&skeleton->priv->properties[n]);
5585 g_free (skeleton->priv->properties);
5586 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5587 if (skeleton->priv->changed_properties_idle_source != NULL)
5588 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5589 g_main_context_unref (skeleton->priv->context);
5590 g_mutex_clear (&skeleton->priv->lock);
5591 G_OBJECT_CLASS (sensor_value_skeleton_parent_class)->finalize (object);
5592}
5593
5594static void
5595sensor_value_skeleton_get_property (GObject *object,
5596 guint prop_id,
5597 GValue *value,
5598 GParamSpec *pspec G_GNUC_UNUSED)
5599{
5600 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5601 g_assert (prop_id != 0 && prop_id - 1 < 7);
5602 g_mutex_lock (&skeleton->priv->lock);
5603 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
5604 g_mutex_unlock (&skeleton->priv->lock);
5605}
5606
5607static gboolean
5608_sensor_value_emit_changed (gpointer user_data)
5609{
5610 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5611 GList *l;
5612 GVariantBuilder builder;
5613 GVariantBuilder invalidated_builder;
5614 guint num_changes;
5615
5616 g_mutex_lock (&skeleton->priv->lock);
5617 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5618 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
5619 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
5620 {
5621 ChangedProperty *cp = l->data;
5622 GVariant *variant;
5623 const GValue *cur_value;
5624
5625 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
5626 if (!_g_value_equal (cur_value, &cp->orig_value))
5627 {
5628 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
5629 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
5630 g_variant_unref (variant);
5631 num_changes++;
5632 }
5633 }
5634 if (num_changes > 0)
5635 {
5636 GList *connections, *ll;
5637 GVariant *signal_variant;
5638 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorValue",
5639 &builder, &invalidated_builder));
5640 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5641 for (ll = connections; ll != NULL; ll = ll->next)
5642 {
5643 GDBusConnection *connection = ll->data;
5644
5645 g_dbus_connection_emit_signal (connection,
5646 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
5647 "org.freedesktop.DBus.Properties",
5648 "PropertiesChanged",
5649 signal_variant,
5650 NULL);
5651 }
5652 g_variant_unref (signal_variant);
5653 g_list_free_full (connections, g_object_unref);
5654 }
5655 else
5656 {
5657 g_variant_builder_clear (&builder);
5658 g_variant_builder_clear (&invalidated_builder);
5659 }
5660 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5661 skeleton->priv->changed_properties = NULL;
5662 skeleton->priv->changed_properties_idle_source = NULL;
5663 g_mutex_unlock (&skeleton->priv->lock);
5664 return FALSE;
5665}
5666
5667static void
5668_sensor_value_schedule_emit_changed (SensorValueSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
5669{
5670 ChangedProperty *cp;
5671 GList *l;
5672 cp = NULL;
5673 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
5674 {
5675 ChangedProperty *i_cp = l->data;
5676 if (i_cp->info == info)
5677 {
5678 cp = i_cp;
5679 break;
5680 }
5681 }
5682 if (cp == NULL)
5683 {
5684 cp = g_new0 (ChangedProperty, 1);
5685 cp->prop_id = prop_id;
5686 cp->info = info;
5687 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
5688 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
5689 g_value_copy (orig_value, &cp->orig_value);
5690 }
5691}
5692
5693static void
5694sensor_value_skeleton_notify (GObject *object,
5695 GParamSpec *pspec G_GNUC_UNUSED)
5696{
5697 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5698 g_mutex_lock (&skeleton->priv->lock);
5699 if (skeleton->priv->changed_properties != NULL &&
5700 skeleton->priv->changed_properties_idle_source == NULL)
5701 {
5702 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
5703 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
5704 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_value_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
5705 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
5706 g_source_unref (skeleton->priv->changed_properties_idle_source);
5707 }
5708 g_mutex_unlock (&skeleton->priv->lock);
5709}
5710
5711static void
5712sensor_value_skeleton_set_property (GObject *object,
5713 guint prop_id,
5714 const GValue *value,
5715 GParamSpec *pspec)
5716{
5717 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5718 g_assert (prop_id != 0 && prop_id - 1 < 7);
5719 g_mutex_lock (&skeleton->priv->lock);
5720 g_object_freeze_notify (object);
5721 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
5722 {
5723 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
5724 _sensor_value_schedule_emit_changed (skeleton, _sensor_value_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
5725 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
5726 g_object_notify_by_pspec (object, pspec);
5727 }
5728 g_mutex_unlock (&skeleton->priv->lock);
5729 g_object_thaw_notify (object);
5730}
5731
5732static void
5733sensor_value_skeleton_init (SensorValueSkeleton *skeleton)
5734{
5735#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5736 skeleton->priv = sensor_value_skeleton_get_instance_private (skeleton);
5737#else
5738 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_VALUE_SKELETON, SensorValueSkeletonPrivate);
5739#endif
5740
5741 g_mutex_init (&skeleton->priv->lock);
5742 skeleton->priv->context = g_main_context_ref_thread_default ();
5743 skeleton->priv->properties = g_new0 (GValue, 7);
5744 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
5745 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
5746 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
5747 g_value_init (&skeleton->priv->properties[3], G_TYPE_INT);
5748 g_value_init (&skeleton->priv->properties[4], G_TYPE_BOOLEAN);
5749 g_value_init (&skeleton->priv->properties[5], G_TYPE_UCHAR);
5750 g_value_init (&skeleton->priv->properties[6], G_TYPE_UCHAR);
5751}
5752
5753static GVariant *
5754sensor_value_skeleton_get_value (SensorValue *object)
5755{
5756 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5757 GVariant *value;
5758 g_mutex_lock (&skeleton->priv->lock);
5759 value = g_value_get_variant (&(skeleton->priv->properties[0]));
5760 g_mutex_unlock (&skeleton->priv->lock);
5761 return value;
5762}
5763
5764static const gchar *
5765sensor_value_skeleton_get_units (SensorValue *object)
5766{
5767 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5768 const gchar *value;
5769 g_mutex_lock (&skeleton->priv->lock);
5770 value = g_value_get_string (&(skeleton->priv->properties[1]));
5771 g_mutex_unlock (&skeleton->priv->lock);
5772 return value;
5773}
5774
5775static gint
5776sensor_value_skeleton_get_poll_interval (SensorValue *object)
5777{
5778 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5779 gint value;
5780 g_mutex_lock (&skeleton->priv->lock);
5781 value = g_value_get_int (&(skeleton->priv->properties[2]));
5782 g_mutex_unlock (&skeleton->priv->lock);
5783 return value;
5784}
5785
5786static gint
5787sensor_value_skeleton_get_heatbeat (SensorValue *object)
5788{
5789 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5790 gint value;
5791 g_mutex_lock (&skeleton->priv->lock);
5792 value = g_value_get_int (&(skeleton->priv->properties[3]));
5793 g_mutex_unlock (&skeleton->priv->lock);
5794 return value;
5795}
5796
5797static gboolean
5798sensor_value_skeleton_get_settable (SensorValue *object)
5799{
5800 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5801 gboolean value;
5802 g_mutex_lock (&skeleton->priv->lock);
5803 value = g_value_get_boolean (&(skeleton->priv->properties[4]));
5804 g_mutex_unlock (&skeleton->priv->lock);
5805 return value;
5806}
5807
5808static guchar
5809sensor_value_skeleton_get_ipmi_entity_id (SensorValue *object)
5810{
5811 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5812 guchar value;
5813 g_mutex_lock (&skeleton->priv->lock);
5814 value = g_value_get_uchar (&(skeleton->priv->properties[5]));
5815 g_mutex_unlock (&skeleton->priv->lock);
5816 return value;
5817}
5818
5819static guchar
5820sensor_value_skeleton_get_ipmi_id (SensorValue *object)
5821{
5822 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5823 guchar value;
5824 g_mutex_lock (&skeleton->priv->lock);
5825 value = g_value_get_uchar (&(skeleton->priv->properties[6]));
5826 g_mutex_unlock (&skeleton->priv->lock);
5827 return value;
5828}
5829
5830static void
5831sensor_value_skeleton_class_init (SensorValueSkeletonClass *klass)
5832{
5833 GObjectClass *gobject_class;
5834 GDBusInterfaceSkeletonClass *skeleton_class;
5835
5836 gobject_class = G_OBJECT_CLASS (klass);
5837 gobject_class->finalize = sensor_value_skeleton_finalize;
5838 gobject_class->get_property = sensor_value_skeleton_get_property;
5839 gobject_class->set_property = sensor_value_skeleton_set_property;
5840 gobject_class->notify = sensor_value_skeleton_notify;
5841
5842
5843 sensor_value_override_properties (gobject_class, 1);
5844
5845 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
5846 skeleton_class->get_info = sensor_value_skeleton_dbus_interface_get_info;
5847 skeleton_class->get_properties = sensor_value_skeleton_dbus_interface_get_properties;
5848 skeleton_class->flush = sensor_value_skeleton_dbus_interface_flush;
5849 skeleton_class->get_vtable = sensor_value_skeleton_dbus_interface_get_vtable;
5850
5851#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
5852 g_type_class_add_private (klass, sizeof (SensorValueSkeletonPrivate));
5853#endif
5854}
5855
5856static void
5857sensor_value_skeleton_iface_init (SensorValueIface *iface)
5858{
5859 iface->changed = _sensor_value_on_signal_changed;
Norman James32e74e22015-09-15 21:28:06 -05005860 iface->error = _sensor_value_on_signal_error;
Norman James362a80f2015-09-14 14:04:39 -05005861 iface->heartbeat = _sensor_value_on_signal_heartbeat;
5862 iface->get_value = sensor_value_skeleton_get_value;
5863 iface->get_units = sensor_value_skeleton_get_units;
5864 iface->get_poll_interval = sensor_value_skeleton_get_poll_interval;
5865 iface->get_heatbeat = sensor_value_skeleton_get_heatbeat;
5866 iface->get_settable = sensor_value_skeleton_get_settable;
5867 iface->get_ipmi_entity_id = sensor_value_skeleton_get_ipmi_entity_id;
5868 iface->get_ipmi_id = sensor_value_skeleton_get_ipmi_id;
5869}
5870
5871/**
5872 * sensor_value_skeleton_new:
5873 *
5874 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
5875 *
5876 * Returns: (transfer full) (type SensorValueSkeleton): The skeleton object.
5877 */
5878SensorValue *
5879sensor_value_skeleton_new (void)
5880{
5881 return SENSOR_VALUE (g_object_new (TYPE_SENSOR_VALUE_SKELETON, NULL));
5882}
5883
5884/* ------------------------------------------------------------------------
5885 * Code for interface org.openbmc.SensorThreshold
5886 * ------------------------------------------------------------------------
5887 */
5888
5889/**
5890 * SECTION:SensorThreshold
5891 * @title: SensorThreshold
5892 * @short_description: Generated C code for the org.openbmc.SensorThreshold D-Bus interface
5893 *
5894 * 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.
5895 */
5896
5897/* ---- Introspection data for org.openbmc.SensorThreshold ---- */
5898
5899static const _ExtendedGDBusArgInfo _sensor_threshold_method_info_get_state_OUT_ARG_state =
5900{
5901 {
5902 -1,
5903 (gchar *) "state",
5904 (gchar *) "y",
5905 NULL
5906 },
5907 FALSE
5908};
5909
5910static const _ExtendedGDBusArgInfo * const _sensor_threshold_method_info_get_state_OUT_ARG_pointers[] =
5911{
5912 &_sensor_threshold_method_info_get_state_OUT_ARG_state,
5913 NULL
5914};
5915
5916static const _ExtendedGDBusMethodInfo _sensor_threshold_method_info_get_state =
5917{
5918 {
5919 -1,
5920 (gchar *) "getState",
5921 NULL,
5922 (GDBusArgInfo **) &_sensor_threshold_method_info_get_state_OUT_ARG_pointers,
5923 NULL
5924 },
5925 "handle-get-state",
5926 FALSE
5927};
5928
5929static const _ExtendedGDBusMethodInfo * const _sensor_threshold_method_info_pointers[] =
5930{
5931 &_sensor_threshold_method_info_get_state,
5932 NULL
5933};
5934
5935static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_warning =
5936{
5937 {
5938 -1,
5939 (gchar *) "Warning",
5940 NULL,
5941 NULL
5942 },
5943 "warning"
5944};
5945
5946static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_critical =
5947{
5948 {
5949 -1,
5950 (gchar *) "Critical",
5951 NULL,
5952 NULL
5953 },
5954 "critical"
5955};
5956
5957static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_normal =
5958{
5959 {
5960 -1,
5961 (gchar *) "Normal",
5962 NULL,
5963 NULL
5964 },
5965 "normal"
5966};
5967
5968static const _ExtendedGDBusSignalInfo * const _sensor_threshold_signal_info_pointers[] =
5969{
5970 &_sensor_threshold_signal_info_warning,
5971 &_sensor_threshold_signal_info_critical,
5972 &_sensor_threshold_signal_info_normal,
5973 NULL
5974};
5975
5976static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_critical =
5977{
5978 {
5979 -1,
5980 (gchar *) "lower_critical",
5981 (gchar *) "v",
5982 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5983 NULL
5984 },
5985 "lower-critical",
5986 FALSE
5987};
5988
5989static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_warning =
5990{
5991 {
5992 -1,
5993 (gchar *) "lower_warning",
5994 (gchar *) "v",
5995 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5996 NULL
5997 },
5998 "lower-warning",
5999 FALSE
6000};
6001
6002static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_warning =
6003{
6004 {
6005 -1,
6006 (gchar *) "upper_warning",
6007 (gchar *) "v",
6008 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
6009 NULL
6010 },
6011 "upper-warning",
6012 FALSE
6013};
6014
6015static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_critical =
6016{
6017 {
6018 -1,
6019 (gchar *) "upper_critical",
6020 (gchar *) "v",
6021 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
6022 NULL
6023 },
6024 "upper-critical",
6025 FALSE
6026};
6027
6028static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_state =
6029{
6030 {
6031 -1,
6032 (gchar *) "state",
6033 (gchar *) "y",
6034 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
6035 NULL
6036 },
6037 "state",
6038 FALSE
6039};
6040
6041static const _ExtendedGDBusPropertyInfo * const _sensor_threshold_property_info_pointers[] =
6042{
6043 &_sensor_threshold_property_info_lower_critical,
6044 &_sensor_threshold_property_info_lower_warning,
6045 &_sensor_threshold_property_info_upper_warning,
6046 &_sensor_threshold_property_info_upper_critical,
6047 &_sensor_threshold_property_info_state,
6048 NULL
6049};
6050
6051static const _ExtendedGDBusInterfaceInfo _sensor_threshold_interface_info =
6052{
6053 {
6054 -1,
6055 (gchar *) "org.openbmc.SensorThreshold",
6056 (GDBusMethodInfo **) &_sensor_threshold_method_info_pointers,
6057 (GDBusSignalInfo **) &_sensor_threshold_signal_info_pointers,
6058 (GDBusPropertyInfo **) &_sensor_threshold_property_info_pointers,
6059 NULL
6060 },
6061 "sensor-threshold",
6062};
6063
6064
6065/**
6066 * sensor_threshold_interface_info:
6067 *
6068 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> D-Bus interface.
6069 *
6070 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
6071 */
6072GDBusInterfaceInfo *
6073sensor_threshold_interface_info (void)
6074{
6075 return (GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct;
6076}
6077
6078/**
6079 * sensor_threshold_override_properties:
6080 * @klass: The class structure for a #GObject<!-- -->-derived class.
6081 * @property_id_begin: The property id to assign to the first overridden property.
6082 *
6083 * Overrides all #GObject properties in the #SensorThreshold interface for a concrete class.
6084 * The properties are overridden in the order they are defined.
6085 *
6086 * Returns: The last property id.
6087 */
6088guint
6089sensor_threshold_override_properties (GObjectClass *klass, guint property_id_begin)
6090{
6091 g_object_class_override_property (klass, property_id_begin++, "lower-critical");
6092 g_object_class_override_property (klass, property_id_begin++, "lower-warning");
6093 g_object_class_override_property (klass, property_id_begin++, "upper-warning");
6094 g_object_class_override_property (klass, property_id_begin++, "upper-critical");
6095 g_object_class_override_property (klass, property_id_begin++, "state");
6096 return property_id_begin - 1;
6097}
6098
6099
6100
6101/**
6102 * SensorThreshold:
6103 *
6104 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
6105 */
6106
6107/**
6108 * SensorThresholdIface:
6109 * @parent_iface: The parent interface.
6110 * @handle_get_state: Handler for the #SensorThreshold::handle-get-state signal.
6111 * @get_lower_critical: Getter for the #SensorThreshold:lower-critical property.
6112 * @get_lower_warning: Getter for the #SensorThreshold:lower-warning property.
6113 * @get_state: Getter for the #SensorThreshold:state property.
6114 * @get_upper_critical: Getter for the #SensorThreshold:upper-critical property.
6115 * @get_upper_warning: Getter for the #SensorThreshold:upper-warning property.
6116 * @critical: Handler for the #SensorThreshold::critical signal.
6117 * @normal: Handler for the #SensorThreshold::normal signal.
6118 * @warning: Handler for the #SensorThreshold::warning signal.
6119 *
6120 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
6121 */
6122
6123typedef SensorThresholdIface SensorThresholdInterface;
6124G_DEFINE_INTERFACE (SensorThreshold, sensor_threshold, G_TYPE_OBJECT);
6125
6126static void
6127sensor_threshold_default_init (SensorThresholdIface *iface)
6128{
6129 /* GObject signals for incoming D-Bus method calls: */
6130 /**
6131 * SensorThreshold::handle-get-state:
6132 * @object: A #SensorThreshold.
6133 * @invocation: A #GDBusMethodInvocation.
6134 *
6135 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method.
6136 *
6137 * 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.
6138 *
6139 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
6140 */
6141 g_signal_new ("handle-get-state",
6142 G_TYPE_FROM_INTERFACE (iface),
6143 G_SIGNAL_RUN_LAST,
6144 G_STRUCT_OFFSET (SensorThresholdIface, handle_get_state),
6145 g_signal_accumulator_true_handled,
6146 NULL,
6147 g_cclosure_marshal_generic,
6148 G_TYPE_BOOLEAN,
6149 1,
6150 G_TYPE_DBUS_METHOD_INVOCATION);
6151
6152 /* GObject signals for received D-Bus signals: */
6153 /**
6154 * SensorThreshold::warning:
6155 * @object: A #SensorThreshold.
6156 *
6157 * 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.
6158 *
6159 * 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.
6160 */
6161 g_signal_new ("warning",
6162 G_TYPE_FROM_INTERFACE (iface),
6163 G_SIGNAL_RUN_LAST,
6164 G_STRUCT_OFFSET (SensorThresholdIface, warning),
6165 NULL,
6166 NULL,
6167 g_cclosure_marshal_generic,
6168 G_TYPE_NONE,
6169 0);
6170
6171 /**
6172 * SensorThreshold::critical:
6173 * @object: A #SensorThreshold.
6174 *
6175 * 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.
6176 *
6177 * 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.
6178 */
6179 g_signal_new ("critical",
6180 G_TYPE_FROM_INTERFACE (iface),
6181 G_SIGNAL_RUN_LAST,
6182 G_STRUCT_OFFSET (SensorThresholdIface, critical),
6183 NULL,
6184 NULL,
6185 g_cclosure_marshal_generic,
6186 G_TYPE_NONE,
6187 0);
6188
6189 /**
6190 * SensorThreshold::normal:
6191 * @object: A #SensorThreshold.
6192 *
6193 * 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.
6194 *
6195 * 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.
6196 */
6197 g_signal_new ("normal",
6198 G_TYPE_FROM_INTERFACE (iface),
6199 G_SIGNAL_RUN_LAST,
6200 G_STRUCT_OFFSET (SensorThresholdIface, normal),
6201 NULL,
6202 NULL,
6203 g_cclosure_marshal_generic,
6204 G_TYPE_NONE,
6205 0);
6206
6207 /* GObject properties for D-Bus properties: */
6208 /**
6209 * SensorThreshold:lower-critical:
6210 *
6211 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link>.
6212 *
6213 * 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.
6214 */
6215 g_object_interface_install_property (iface,
6216 g_param_spec_variant ("lower-critical", "lower_critical", "lower_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6217 /**
6218 * SensorThreshold:lower-warning:
6219 *
6220 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link>.
6221 *
6222 * 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.
6223 */
6224 g_object_interface_install_property (iface,
6225 g_param_spec_variant ("lower-warning", "lower_warning", "lower_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6226 /**
6227 * SensorThreshold:upper-warning:
6228 *
6229 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link>.
6230 *
6231 * 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.
6232 */
6233 g_object_interface_install_property (iface,
6234 g_param_spec_variant ("upper-warning", "upper_warning", "upper_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6235 /**
6236 * SensorThreshold:upper-critical:
6237 *
6238 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link>.
6239 *
6240 * 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.
6241 */
6242 g_object_interface_install_property (iface,
6243 g_param_spec_variant ("upper-critical", "upper_critical", "upper_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6244 /**
6245 * SensorThreshold:state:
6246 *
6247 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link>.
6248 *
6249 * 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.
6250 */
6251 g_object_interface_install_property (iface,
6252 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6253}
6254
6255/**
6256 * sensor_threshold_get_lower_critical: (skip)
6257 * @object: A #SensorThreshold.
6258 *
6259 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property.
6260 *
6261 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6262 *
6263 * <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>
6264 *
6265 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6266 */
6267GVariant *
6268sensor_threshold_get_lower_critical (SensorThreshold *object)
6269{
6270 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_critical (object);
6271}
6272
6273/**
6274 * sensor_threshold_dup_lower_critical: (skip)
6275 * @object: A #SensorThreshold.
6276 *
6277 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property.
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 *
6281 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6282 */
6283GVariant *
6284sensor_threshold_dup_lower_critical (SensorThreshold *object)
6285{
6286 GVariant *value;
6287 g_object_get (G_OBJECT (object), "lower-critical", &value, NULL);
6288 return value;
6289}
6290
6291/**
6292 * sensor_threshold_set_lower_critical: (skip)
6293 * @object: A #SensorThreshold.
6294 * @value: The value to set.
6295 *
6296 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property to @value.
6297 *
6298 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6299 */
6300void
6301sensor_threshold_set_lower_critical (SensorThreshold *object, GVariant *value)
6302{
6303 g_object_set (G_OBJECT (object), "lower-critical", value, NULL);
6304}
6305
6306/**
6307 * sensor_threshold_get_lower_warning: (skip)
6308 * @object: A #SensorThreshold.
6309 *
6310 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property.
6311 *
6312 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6313 *
6314 * <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>
6315 *
6316 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6317 */
6318GVariant *
6319sensor_threshold_get_lower_warning (SensorThreshold *object)
6320{
6321 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_warning (object);
6322}
6323
6324/**
6325 * sensor_threshold_dup_lower_warning: (skip)
6326 * @object: A #SensorThreshold.
6327 *
6328 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property.
6329 *
6330 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6331 *
6332 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6333 */
6334GVariant *
6335sensor_threshold_dup_lower_warning (SensorThreshold *object)
6336{
6337 GVariant *value;
6338 g_object_get (G_OBJECT (object), "lower-warning", &value, NULL);
6339 return value;
6340}
6341
6342/**
6343 * sensor_threshold_set_lower_warning: (skip)
6344 * @object: A #SensorThreshold.
6345 * @value: The value to set.
6346 *
6347 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property to @value.
6348 *
6349 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6350 */
6351void
6352sensor_threshold_set_lower_warning (SensorThreshold *object, GVariant *value)
6353{
6354 g_object_set (G_OBJECT (object), "lower-warning", value, NULL);
6355}
6356
6357/**
6358 * sensor_threshold_get_upper_warning: (skip)
6359 * @object: A #SensorThreshold.
6360 *
6361 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property.
6362 *
6363 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6364 *
6365 * <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>
6366 *
6367 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6368 */
6369GVariant *
6370sensor_threshold_get_upper_warning (SensorThreshold *object)
6371{
6372 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_warning (object);
6373}
6374
6375/**
6376 * sensor_threshold_dup_upper_warning: (skip)
6377 * @object: A #SensorThreshold.
6378 *
6379 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property.
6380 *
6381 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6382 *
6383 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6384 */
6385GVariant *
6386sensor_threshold_dup_upper_warning (SensorThreshold *object)
6387{
6388 GVariant *value;
6389 g_object_get (G_OBJECT (object), "upper-warning", &value, NULL);
6390 return value;
6391}
6392
6393/**
6394 * sensor_threshold_set_upper_warning: (skip)
6395 * @object: A #SensorThreshold.
6396 * @value: The value to set.
6397 *
6398 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property to @value.
6399 *
6400 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6401 */
6402void
6403sensor_threshold_set_upper_warning (SensorThreshold *object, GVariant *value)
6404{
6405 g_object_set (G_OBJECT (object), "upper-warning", value, NULL);
6406}
6407
6408/**
6409 * sensor_threshold_get_upper_critical: (skip)
6410 * @object: A #SensorThreshold.
6411 *
6412 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property.
6413 *
6414 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6415 *
6416 * <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>
6417 *
6418 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6419 */
6420GVariant *
6421sensor_threshold_get_upper_critical (SensorThreshold *object)
6422{
6423 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_critical (object);
6424}
6425
6426/**
6427 * sensor_threshold_dup_upper_critical: (skip)
6428 * @object: A #SensorThreshold.
6429 *
6430 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property.
6431 *
6432 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6433 *
6434 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6435 */
6436GVariant *
6437sensor_threshold_dup_upper_critical (SensorThreshold *object)
6438{
6439 GVariant *value;
6440 g_object_get (G_OBJECT (object), "upper-critical", &value, NULL);
6441 return value;
6442}
6443
6444/**
6445 * sensor_threshold_set_upper_critical: (skip)
6446 * @object: A #SensorThreshold.
6447 * @value: The value to set.
6448 *
6449 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property to @value.
6450 *
6451 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6452 */
6453void
6454sensor_threshold_set_upper_critical (SensorThreshold *object, GVariant *value)
6455{
6456 g_object_set (G_OBJECT (object), "upper-critical", value, NULL);
6457}
6458
6459/**
6460 * sensor_threshold_get_state: (skip)
6461 * @object: A #SensorThreshold.
6462 *
6463 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property.
6464 *
6465 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
6466 *
6467 * Returns: The property value.
6468 */
6469guchar
6470sensor_threshold_get_state (SensorThreshold *object)
6471{
6472 return SENSOR_THRESHOLD_GET_IFACE (object)->get_state (object);
6473}
6474
6475/**
6476 * sensor_threshold_set_state: (skip)
6477 * @object: A #SensorThreshold.
6478 * @value: The value to set.
6479 *
6480 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property to @value.
6481 *
6482 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
6483 */
6484void
6485sensor_threshold_set_state (SensorThreshold *object, guchar value)
6486{
6487 g_object_set (G_OBJECT (object), "state", value, NULL);
6488}
6489
6490/**
6491 * sensor_threshold_emit_warning:
6492 * @object: A #SensorThreshold.
6493 *
6494 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Warning">"Warning"</link> D-Bus signal.
6495 */
6496void
6497sensor_threshold_emit_warning (
6498 SensorThreshold *object)
6499{
6500 g_signal_emit_by_name (object, "warning");
6501}
6502
6503/**
6504 * sensor_threshold_emit_critical:
6505 * @object: A #SensorThreshold.
6506 *
6507 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Critical">"Critical"</link> D-Bus signal.
6508 */
6509void
6510sensor_threshold_emit_critical (
6511 SensorThreshold *object)
6512{
6513 g_signal_emit_by_name (object, "critical");
6514}
6515
6516/**
6517 * sensor_threshold_emit_normal:
6518 * @object: A #SensorThreshold.
6519 *
6520 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Normal">"Normal"</link> D-Bus signal.
6521 */
6522void
6523sensor_threshold_emit_normal (
6524 SensorThreshold *object)
6525{
6526 g_signal_emit_by_name (object, "normal");
6527}
6528
6529/**
6530 * sensor_threshold_call_get_state:
6531 * @proxy: A #SensorThresholdProxy.
6532 * @cancellable: (allow-none): A #GCancellable or %NULL.
6533 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
6534 * @user_data: User data to pass to @callback.
6535 *
6536 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method on @proxy.
6537 * 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.
6538 * You can then call sensor_threshold_call_get_state_finish() to get the result of the operation.
6539 *
6540 * See sensor_threshold_call_get_state_sync() for the synchronous, blocking version of this method.
6541 */
6542void
6543sensor_threshold_call_get_state (
6544 SensorThreshold *proxy,
6545 GCancellable *cancellable,
6546 GAsyncReadyCallback callback,
6547 gpointer user_data)
6548{
6549 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
6550 "getState",
6551 g_variant_new ("()"),
6552 G_DBUS_CALL_FLAGS_NONE,
6553 -1,
6554 cancellable,
6555 callback,
6556 user_data);
6557}
6558
6559/**
6560 * sensor_threshold_call_get_state_finish:
6561 * @proxy: A #SensorThresholdProxy.
6562 * @out_state: (out): Return location for return parameter or %NULL to ignore.
6563 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_call_get_state().
6564 * @error: Return location for error or %NULL.
6565 *
6566 * Finishes an operation started with sensor_threshold_call_get_state().
6567 *
6568 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
6569 */
6570gboolean
6571sensor_threshold_call_get_state_finish (
6572 SensorThreshold *proxy,
6573 guchar *out_state,
6574 GAsyncResult *res,
6575 GError **error)
6576{
6577 GVariant *_ret;
6578 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
6579 if (_ret == NULL)
6580 goto _out;
6581 g_variant_get (_ret,
6582 "(y)",
6583 out_state);
6584 g_variant_unref (_ret);
6585_out:
6586 return _ret != NULL;
6587}
6588
6589/**
6590 * sensor_threshold_call_get_state_sync:
6591 * @proxy: A #SensorThresholdProxy.
6592 * @out_state: (out): Return location for return parameter or %NULL to ignore.
6593 * @cancellable: (allow-none): A #GCancellable or %NULL.
6594 * @error: Return location for error or %NULL.
6595 *
6596 * 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.
6597 *
6598 * See sensor_threshold_call_get_state() for the asynchronous version of this method.
6599 *
6600 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
6601 */
6602gboolean
6603sensor_threshold_call_get_state_sync (
6604 SensorThreshold *proxy,
6605 guchar *out_state,
6606 GCancellable *cancellable,
6607 GError **error)
6608{
6609 GVariant *_ret;
6610 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
6611 "getState",
6612 g_variant_new ("()"),
6613 G_DBUS_CALL_FLAGS_NONE,
6614 -1,
6615 cancellable,
6616 error);
6617 if (_ret == NULL)
6618 goto _out;
6619 g_variant_get (_ret,
6620 "(y)",
6621 out_state);
6622 g_variant_unref (_ret);
6623_out:
6624 return _ret != NULL;
6625}
6626
6627/**
6628 * sensor_threshold_complete_get_state:
6629 * @object: A #SensorThreshold.
6630 * @invocation: (transfer full): A #GDBusMethodInvocation.
6631 * @state: Parameter to return.
6632 *
6633 * 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.
6634 *
6635 * This method will free @invocation, you cannot use it afterwards.
6636 */
6637void
6638sensor_threshold_complete_get_state (
6639 SensorThreshold *object,
6640 GDBusMethodInvocation *invocation,
6641 guchar state)
6642{
6643 g_dbus_method_invocation_return_value (invocation,
6644 g_variant_new ("(y)",
6645 state));
6646}
6647
6648/* ------------------------------------------------------------------------ */
6649
6650/**
6651 * SensorThresholdProxy:
6652 *
6653 * The #SensorThresholdProxy structure contains only private data and should only be accessed using the provided API.
6654 */
6655
6656/**
6657 * SensorThresholdProxyClass:
6658 * @parent_class: The parent class.
6659 *
6660 * Class structure for #SensorThresholdProxy.
6661 */
6662
6663struct _SensorThresholdProxyPrivate
6664{
6665 GData *qdata;
6666};
6667
6668static void sensor_threshold_proxy_iface_init (SensorThresholdIface *iface);
6669
6670#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6671G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
6672 G_ADD_PRIVATE (SensorThresholdProxy)
6673 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init));
6674
6675#else
6676G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
6677 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init));
6678
6679#endif
6680static void
6681sensor_threshold_proxy_finalize (GObject *object)
6682{
6683 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6684 g_datalist_clear (&proxy->priv->qdata);
6685 G_OBJECT_CLASS (sensor_threshold_proxy_parent_class)->finalize (object);
6686}
6687
6688static void
6689sensor_threshold_proxy_get_property (GObject *object,
6690 guint prop_id,
6691 GValue *value,
6692 GParamSpec *pspec G_GNUC_UNUSED)
6693{
6694 const _ExtendedGDBusPropertyInfo *info;
6695 GVariant *variant;
6696 g_assert (prop_id != 0 && prop_id - 1 < 5);
6697 info = _sensor_threshold_property_info_pointers[prop_id - 1];
6698 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
6699 if (info->use_gvariant)
6700 {
6701 g_value_set_variant (value, variant);
6702 }
6703 else
6704 {
6705 if (variant != NULL)
6706 g_dbus_gvariant_to_gvalue (variant, value);
6707 }
6708 if (variant != NULL)
6709 g_variant_unref (variant);
6710}
6711
6712static void
6713sensor_threshold_proxy_set_property_cb (GDBusProxy *proxy,
6714 GAsyncResult *res,
6715 gpointer user_data)
6716{
6717 const _ExtendedGDBusPropertyInfo *info = user_data;
6718 GError *error;
6719 GVariant *_ret;
6720 error = NULL;
6721 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
6722 if (!_ret)
6723 {
6724 g_warning ("Error setting property '%s' on interface org.openbmc.SensorThreshold: %s (%s, %d)",
6725 info->parent_struct.name,
6726 error->message, g_quark_to_string (error->domain), error->code);
6727 g_error_free (error);
6728 }
6729 else
6730 {
6731 g_variant_unref (_ret);
6732 }
6733}
6734
6735static void
6736sensor_threshold_proxy_set_property (GObject *object,
6737 guint prop_id,
6738 const GValue *value,
6739 GParamSpec *pspec G_GNUC_UNUSED)
6740{
6741 const _ExtendedGDBusPropertyInfo *info;
6742 GVariant *variant;
6743 g_assert (prop_id != 0 && prop_id - 1 < 5);
6744 info = _sensor_threshold_property_info_pointers[prop_id - 1];
6745 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
6746 g_dbus_proxy_call (G_DBUS_PROXY (object),
6747 "org.freedesktop.DBus.Properties.Set",
6748 g_variant_new ("(ssv)", "org.openbmc.SensorThreshold", info->parent_struct.name, variant),
6749 G_DBUS_CALL_FLAGS_NONE,
6750 -1,
6751 NULL, (GAsyncReadyCallback) sensor_threshold_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
6752 g_variant_unref (variant);
6753}
6754
6755static void
6756sensor_threshold_proxy_g_signal (GDBusProxy *proxy,
6757 const gchar *sender_name G_GNUC_UNUSED,
6758 const gchar *signal_name,
6759 GVariant *parameters)
6760{
6761 _ExtendedGDBusSignalInfo *info;
6762 GVariantIter iter;
6763 GVariant *child;
6764 GValue *paramv;
6765 guint num_params;
6766 guint n;
6767 guint signal_id;
6768 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, signal_name);
6769 if (info == NULL)
6770 return;
6771 num_params = g_variant_n_children (parameters);
6772 paramv = g_new0 (GValue, num_params + 1);
6773 g_value_init (&paramv[0], TYPE_SENSOR_THRESHOLD);
6774 g_value_set_object (&paramv[0], proxy);
6775 g_variant_iter_init (&iter, parameters);
6776 n = 1;
6777 while ((child = g_variant_iter_next_value (&iter)) != NULL)
6778 {
6779 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
6780 if (arg_info->use_gvariant)
6781 {
6782 g_value_init (&paramv[n], G_TYPE_VARIANT);
6783 g_value_set_variant (&paramv[n], child);
6784 n++;
6785 }
6786 else
6787 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
6788 g_variant_unref (child);
6789 }
6790 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
6791 g_signal_emitv (paramv, signal_id, 0, NULL);
6792 for (n = 0; n < num_params + 1; n++)
6793 g_value_unset (&paramv[n]);
6794 g_free (paramv);
6795}
6796
6797static void
6798sensor_threshold_proxy_g_properties_changed (GDBusProxy *_proxy,
6799 GVariant *changed_properties,
6800 const gchar *const *invalidated_properties)
6801{
6802 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (_proxy);
6803 guint n;
6804 const gchar *key;
6805 GVariantIter *iter;
6806 _ExtendedGDBusPropertyInfo *info;
6807 g_variant_get (changed_properties, "a{sv}", &iter);
6808 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
6809 {
6810 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, key);
6811 g_datalist_remove_data (&proxy->priv->qdata, key);
6812 if (info != NULL)
6813 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
6814 }
6815 g_variant_iter_free (iter);
6816 for (n = 0; invalidated_properties[n] != NULL; n++)
6817 {
6818 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, invalidated_properties[n]);
6819 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
6820 if (info != NULL)
6821 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
6822 }
6823}
6824
6825static GVariant *
6826sensor_threshold_proxy_get_lower_critical (SensorThreshold *object)
6827{
6828 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6829 GVariant *variant;
6830 GVariant *value = NULL;
6831 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_critical");
6832 value = variant;
6833 if (variant != NULL)
6834 g_variant_unref (variant);
6835 return value;
6836}
6837
6838static GVariant *
6839sensor_threshold_proxy_get_lower_warning (SensorThreshold *object)
6840{
6841 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6842 GVariant *variant;
6843 GVariant *value = NULL;
6844 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_warning");
6845 value = variant;
6846 if (variant != NULL)
6847 g_variant_unref (variant);
6848 return value;
6849}
6850
6851static GVariant *
6852sensor_threshold_proxy_get_upper_warning (SensorThreshold *object)
6853{
6854 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6855 GVariant *variant;
6856 GVariant *value = NULL;
6857 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_warning");
6858 value = variant;
6859 if (variant != NULL)
6860 g_variant_unref (variant);
6861 return value;
6862}
6863
6864static GVariant *
6865sensor_threshold_proxy_get_upper_critical (SensorThreshold *object)
6866{
6867 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6868 GVariant *variant;
6869 GVariant *value = NULL;
6870 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_critical");
6871 value = variant;
6872 if (variant != NULL)
6873 g_variant_unref (variant);
6874 return value;
6875}
6876
6877static guchar
6878sensor_threshold_proxy_get_state (SensorThreshold *object)
6879{
6880 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6881 GVariant *variant;
6882 guchar value = 0;
6883 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
6884 if (variant != NULL)
6885 {
6886 value = g_variant_get_byte (variant);
6887 g_variant_unref (variant);
6888 }
6889 return value;
6890}
6891
6892static void
6893sensor_threshold_proxy_init (SensorThresholdProxy *proxy)
6894{
6895#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6896 proxy->priv = sensor_threshold_proxy_get_instance_private (proxy);
6897#else
6898 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_THRESHOLD_PROXY, SensorThresholdProxyPrivate);
6899#endif
6900
6901 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_threshold_interface_info ());
6902}
6903
6904static void
6905sensor_threshold_proxy_class_init (SensorThresholdProxyClass *klass)
6906{
6907 GObjectClass *gobject_class;
6908 GDBusProxyClass *proxy_class;
6909
6910 gobject_class = G_OBJECT_CLASS (klass);
6911 gobject_class->finalize = sensor_threshold_proxy_finalize;
6912 gobject_class->get_property = sensor_threshold_proxy_get_property;
6913 gobject_class->set_property = sensor_threshold_proxy_set_property;
6914
6915 proxy_class = G_DBUS_PROXY_CLASS (klass);
6916 proxy_class->g_signal = sensor_threshold_proxy_g_signal;
6917 proxy_class->g_properties_changed = sensor_threshold_proxy_g_properties_changed;
6918
6919 sensor_threshold_override_properties (gobject_class, 1);
6920
6921#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
6922 g_type_class_add_private (klass, sizeof (SensorThresholdProxyPrivate));
6923#endif
6924}
6925
6926static void
6927sensor_threshold_proxy_iface_init (SensorThresholdIface *iface)
6928{
6929 iface->get_lower_critical = sensor_threshold_proxy_get_lower_critical;
6930 iface->get_lower_warning = sensor_threshold_proxy_get_lower_warning;
6931 iface->get_upper_warning = sensor_threshold_proxy_get_upper_warning;
6932 iface->get_upper_critical = sensor_threshold_proxy_get_upper_critical;
6933 iface->get_state = sensor_threshold_proxy_get_state;
6934}
6935
6936/**
6937 * sensor_threshold_proxy_new:
6938 * @connection: A #GDBusConnection.
6939 * @flags: Flags from the #GDBusProxyFlags enumeration.
6940 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6941 * @object_path: An object path.
6942 * @cancellable: (allow-none): A #GCancellable or %NULL.
6943 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6944 * @user_data: User data to pass to @callback.
6945 *
6946 * 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.
6947 *
6948 * 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.
6949 * You can then call sensor_threshold_proxy_new_finish() to get the result of the operation.
6950 *
6951 * See sensor_threshold_proxy_new_sync() for the synchronous, blocking version of this constructor.
6952 */
6953void
6954sensor_threshold_proxy_new (
6955 GDBusConnection *connection,
6956 GDBusProxyFlags flags,
6957 const gchar *name,
6958 const gchar *object_path,
6959 GCancellable *cancellable,
6960 GAsyncReadyCallback callback,
6961 gpointer user_data)
6962{
6963 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);
6964}
6965
6966/**
6967 * sensor_threshold_proxy_new_finish:
6968 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new().
6969 * @error: Return location for error or %NULL
6970 *
6971 * Finishes an operation started with sensor_threshold_proxy_new().
6972 *
6973 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6974 */
6975SensorThreshold *
6976sensor_threshold_proxy_new_finish (
6977 GAsyncResult *res,
6978 GError **error)
6979{
6980 GObject *ret;
6981 GObject *source_object;
6982 source_object = g_async_result_get_source_object (res);
6983 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6984 g_object_unref (source_object);
6985 if (ret != NULL)
6986 return SENSOR_THRESHOLD (ret);
6987 else
6988 return NULL;
6989}
6990
6991/**
6992 * sensor_threshold_proxy_new_sync:
6993 * @connection: A #GDBusConnection.
6994 * @flags: Flags from the #GDBusProxyFlags enumeration.
6995 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6996 * @object_path: An object path.
6997 * @cancellable: (allow-none): A #GCancellable or %NULL.
6998 * @error: Return location for error or %NULL
6999 *
7000 * 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.
7001 *
7002 * The calling thread is blocked until a reply is received.
7003 *
7004 * See sensor_threshold_proxy_new() for the asynchronous version of this constructor.
7005 *
7006 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
7007 */
7008SensorThreshold *
7009sensor_threshold_proxy_new_sync (
7010 GDBusConnection *connection,
7011 GDBusProxyFlags flags,
7012 const gchar *name,
7013 const gchar *object_path,
7014 GCancellable *cancellable,
7015 GError **error)
7016{
7017 GInitable *ret;
7018 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);
7019 if (ret != NULL)
7020 return SENSOR_THRESHOLD (ret);
7021 else
7022 return NULL;
7023}
7024
7025
7026/**
7027 * sensor_threshold_proxy_new_for_bus:
7028 * @bus_type: A #GBusType.
7029 * @flags: Flags from the #GDBusProxyFlags enumeration.
7030 * @name: A bus name (well-known or unique).
7031 * @object_path: An object path.
7032 * @cancellable: (allow-none): A #GCancellable or %NULL.
7033 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
7034 * @user_data: User data to pass to @callback.
7035 *
7036 * Like sensor_threshold_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
7037 *
7038 * 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.
7039 * You can then call sensor_threshold_proxy_new_for_bus_finish() to get the result of the operation.
7040 *
7041 * See sensor_threshold_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
7042 */
7043void
7044sensor_threshold_proxy_new_for_bus (
7045 GBusType bus_type,
7046 GDBusProxyFlags flags,
7047 const gchar *name,
7048 const gchar *object_path,
7049 GCancellable *cancellable,
7050 GAsyncReadyCallback callback,
7051 gpointer user_data)
7052{
7053 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);
7054}
7055
7056/**
7057 * sensor_threshold_proxy_new_for_bus_finish:
7058 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new_for_bus().
7059 * @error: Return location for error or %NULL
7060 *
7061 * Finishes an operation started with sensor_threshold_proxy_new_for_bus().
7062 *
7063 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
7064 */
7065SensorThreshold *
7066sensor_threshold_proxy_new_for_bus_finish (
7067 GAsyncResult *res,
7068 GError **error)
7069{
7070 GObject *ret;
7071 GObject *source_object;
7072 source_object = g_async_result_get_source_object (res);
7073 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
7074 g_object_unref (source_object);
7075 if (ret != NULL)
7076 return SENSOR_THRESHOLD (ret);
7077 else
7078 return NULL;
7079}
7080
7081/**
7082 * sensor_threshold_proxy_new_for_bus_sync:
7083 * @bus_type: A #GBusType.
7084 * @flags: Flags from the #GDBusProxyFlags enumeration.
7085 * @name: A bus name (well-known or unique).
7086 * @object_path: An object path.
7087 * @cancellable: (allow-none): A #GCancellable or %NULL.
7088 * @error: Return location for error or %NULL
7089 *
7090 * Like sensor_threshold_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
7091 *
7092 * The calling thread is blocked until a reply is received.
7093 *
7094 * See sensor_threshold_proxy_new_for_bus() for the asynchronous version of this constructor.
7095 *
7096 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
7097 */
7098SensorThreshold *
7099sensor_threshold_proxy_new_for_bus_sync (
7100 GBusType bus_type,
7101 GDBusProxyFlags flags,
7102 const gchar *name,
7103 const gchar *object_path,
7104 GCancellable *cancellable,
7105 GError **error)
7106{
7107 GInitable *ret;
7108 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);
7109 if (ret != NULL)
7110 return SENSOR_THRESHOLD (ret);
7111 else
7112 return NULL;
7113}
7114
7115
7116/* ------------------------------------------------------------------------ */
7117
7118/**
7119 * SensorThresholdSkeleton:
7120 *
7121 * The #SensorThresholdSkeleton structure contains only private data and should only be accessed using the provided API.
7122 */
7123
7124/**
7125 * SensorThresholdSkeletonClass:
7126 * @parent_class: The parent class.
7127 *
7128 * Class structure for #SensorThresholdSkeleton.
7129 */
7130
7131struct _SensorThresholdSkeletonPrivate
7132{
7133 GValue *properties;
7134 GList *changed_properties;
7135 GSource *changed_properties_idle_source;
7136 GMainContext *context;
7137 GMutex lock;
7138};
7139
7140static void
7141_sensor_threshold_skeleton_handle_method_call (
7142 GDBusConnection *connection G_GNUC_UNUSED,
7143 const gchar *sender G_GNUC_UNUSED,
7144 const gchar *object_path G_GNUC_UNUSED,
7145 const gchar *interface_name,
7146 const gchar *method_name,
7147 GVariant *parameters,
7148 GDBusMethodInvocation *invocation,
7149 gpointer user_data)
7150{
7151 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7152 _ExtendedGDBusMethodInfo *info;
7153 GVariantIter iter;
7154 GVariant *child;
7155 GValue *paramv;
7156 guint num_params;
7157 guint num_extra;
7158 guint n;
7159 guint signal_id;
7160 GValue return_value = G_VALUE_INIT;
7161 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
7162 g_assert (info != NULL);
7163 num_params = g_variant_n_children (parameters);
7164 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
7165 n = 0;
7166 g_value_init (&paramv[n], TYPE_SENSOR_THRESHOLD);
7167 g_value_set_object (&paramv[n++], skeleton);
7168 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
7169 g_value_set_object (&paramv[n++], invocation);
7170 if (info->pass_fdlist)
7171 {
7172#ifdef G_OS_UNIX
7173 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
7174 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
7175#else
7176 g_assert_not_reached ();
7177#endif
7178 }
7179 g_variant_iter_init (&iter, parameters);
7180 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7181 {
7182 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
7183 if (arg_info->use_gvariant)
7184 {
7185 g_value_init (&paramv[n], G_TYPE_VARIANT);
7186 g_value_set_variant (&paramv[n], child);
7187 n++;
7188 }
7189 else
7190 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
7191 g_variant_unref (child);
7192 }
7193 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
7194 g_value_init (&return_value, G_TYPE_BOOLEAN);
7195 g_signal_emitv (paramv, signal_id, 0, &return_value);
7196 if (!g_value_get_boolean (&return_value))
7197 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);
7198 g_value_unset (&return_value);
7199 for (n = 0; n < num_params + num_extra; n++)
7200 g_value_unset (&paramv[n]);
7201 g_free (paramv);
7202}
7203
7204static GVariant *
7205_sensor_threshold_skeleton_handle_get_property (
7206 GDBusConnection *connection G_GNUC_UNUSED,
7207 const gchar *sender G_GNUC_UNUSED,
7208 const gchar *object_path G_GNUC_UNUSED,
7209 const gchar *interface_name G_GNUC_UNUSED,
7210 const gchar *property_name,
7211 GError **error,
7212 gpointer user_data)
7213{
7214 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7215 GValue value = G_VALUE_INIT;
7216 GParamSpec *pspec;
7217 _ExtendedGDBusPropertyInfo *info;
7218 GVariant *ret;
7219 ret = NULL;
7220 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
7221 g_assert (info != NULL);
7222 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
7223 if (pspec == NULL)
7224 {
7225 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
7226 }
7227 else
7228 {
7229 g_value_init (&value, pspec->value_type);
7230 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
7231 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
7232 g_value_unset (&value);
7233 }
7234 return ret;
7235}
7236
7237static gboolean
7238_sensor_threshold_skeleton_handle_set_property (
7239 GDBusConnection *connection G_GNUC_UNUSED,
7240 const gchar *sender G_GNUC_UNUSED,
7241 const gchar *object_path G_GNUC_UNUSED,
7242 const gchar *interface_name G_GNUC_UNUSED,
7243 const gchar *property_name,
7244 GVariant *variant,
7245 GError **error,
7246 gpointer user_data)
7247{
7248 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7249 GValue value = G_VALUE_INIT;
7250 GParamSpec *pspec;
7251 _ExtendedGDBusPropertyInfo *info;
7252 gboolean ret;
7253 ret = FALSE;
7254 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
7255 g_assert (info != NULL);
7256 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
7257 if (pspec == NULL)
7258 {
7259 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
7260 }
7261 else
7262 {
7263 if (info->use_gvariant)
7264 g_value_set_variant (&value, variant);
7265 else
7266 g_dbus_gvariant_to_gvalue (variant, &value);
7267 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
7268 g_value_unset (&value);
7269 ret = TRUE;
7270 }
7271 return ret;
7272}
7273
7274static const GDBusInterfaceVTable _sensor_threshold_skeleton_vtable =
7275{
7276 _sensor_threshold_skeleton_handle_method_call,
7277 _sensor_threshold_skeleton_handle_get_property,
7278 _sensor_threshold_skeleton_handle_set_property,
7279 {NULL}
7280};
7281
7282static GDBusInterfaceInfo *
7283sensor_threshold_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
7284{
7285 return sensor_threshold_interface_info ();
7286}
7287
7288static GDBusInterfaceVTable *
7289sensor_threshold_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
7290{
7291 return (GDBusInterfaceVTable *) &_sensor_threshold_skeleton_vtable;
7292}
7293
7294static GVariant *
7295sensor_threshold_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
7296{
7297 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
7298
7299 GVariantBuilder builder;
7300 guint n;
7301 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
7302 if (_sensor_threshold_interface_info.parent_struct.properties == NULL)
7303 goto out;
7304 for (n = 0; _sensor_threshold_interface_info.parent_struct.properties[n] != NULL; n++)
7305 {
7306 GDBusPropertyInfo *info = _sensor_threshold_interface_info.parent_struct.properties[n];
7307 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
7308 {
7309 GVariant *value;
7310 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);
7311 if (value != NULL)
7312 {
7313 g_variant_take_ref (value);
7314 g_variant_builder_add (&builder, "{sv}", info->name, value);
7315 g_variant_unref (value);
7316 }
7317 }
7318 }
7319out:
7320 return g_variant_builder_end (&builder);
7321}
7322
7323static gboolean _sensor_threshold_emit_changed (gpointer user_data);
7324
7325static void
7326sensor_threshold_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
7327{
7328 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
7329 gboolean emit_changed = FALSE;
7330
7331 g_mutex_lock (&skeleton->priv->lock);
7332 if (skeleton->priv->changed_properties_idle_source != NULL)
7333 {
7334 g_source_destroy (skeleton->priv->changed_properties_idle_source);
7335 skeleton->priv->changed_properties_idle_source = NULL;
7336 emit_changed = TRUE;
7337 }
7338 g_mutex_unlock (&skeleton->priv->lock);
7339
7340 if (emit_changed)
7341 _sensor_threshold_emit_changed (skeleton);
7342}
7343
7344static void
7345_sensor_threshold_on_signal_warning (
7346 SensorThreshold *object)
7347{
7348 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7349
7350 GList *connections, *l;
7351 GVariant *signal_variant;
7352 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7353
7354 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7355 for (l = connections; l != NULL; l = l->next)
7356 {
7357 GDBusConnection *connection = l->data;
7358 g_dbus_connection_emit_signal (connection,
7359 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Warning",
7360 signal_variant, NULL);
7361 }
7362 g_variant_unref (signal_variant);
7363 g_list_free_full (connections, g_object_unref);
7364}
7365
7366static void
7367_sensor_threshold_on_signal_critical (
7368 SensorThreshold *object)
7369{
7370 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7371
7372 GList *connections, *l;
7373 GVariant *signal_variant;
7374 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7375
7376 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7377 for (l = connections; l != NULL; l = l->next)
7378 {
7379 GDBusConnection *connection = l->data;
7380 g_dbus_connection_emit_signal (connection,
7381 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Critical",
7382 signal_variant, NULL);
7383 }
7384 g_variant_unref (signal_variant);
7385 g_list_free_full (connections, g_object_unref);
7386}
7387
7388static void
7389_sensor_threshold_on_signal_normal (
7390 SensorThreshold *object)
7391{
7392 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7393
7394 GList *connections, *l;
7395 GVariant *signal_variant;
7396 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7397
7398 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7399 for (l = connections; l != NULL; l = l->next)
7400 {
7401 GDBusConnection *connection = l->data;
7402 g_dbus_connection_emit_signal (connection,
7403 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Normal",
7404 signal_variant, NULL);
7405 }
7406 g_variant_unref (signal_variant);
7407 g_list_free_full (connections, g_object_unref);
7408}
7409
7410static void sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface);
7411#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7412G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
7413 G_ADD_PRIVATE (SensorThresholdSkeleton)
7414 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init));
7415
7416#else
7417G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
7418 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init));
7419
7420#endif
7421static void
7422sensor_threshold_skeleton_finalize (GObject *object)
7423{
7424 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7425 guint n;
7426 for (n = 0; n < 5; n++)
7427 g_value_unset (&skeleton->priv->properties[n]);
7428 g_free (skeleton->priv->properties);
7429 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
7430 if (skeleton->priv->changed_properties_idle_source != NULL)
7431 g_source_destroy (skeleton->priv->changed_properties_idle_source);
7432 g_main_context_unref (skeleton->priv->context);
7433 g_mutex_clear (&skeleton->priv->lock);
7434 G_OBJECT_CLASS (sensor_threshold_skeleton_parent_class)->finalize (object);
7435}
7436
7437static void
7438sensor_threshold_skeleton_get_property (GObject *object,
7439 guint prop_id,
7440 GValue *value,
7441 GParamSpec *pspec G_GNUC_UNUSED)
7442{
7443 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7444 g_assert (prop_id != 0 && prop_id - 1 < 5);
7445 g_mutex_lock (&skeleton->priv->lock);
7446 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
7447 g_mutex_unlock (&skeleton->priv->lock);
7448}
7449
7450static gboolean
7451_sensor_threshold_emit_changed (gpointer user_data)
7452{
7453 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7454 GList *l;
7455 GVariantBuilder builder;
7456 GVariantBuilder invalidated_builder;
7457 guint num_changes;
7458
7459 g_mutex_lock (&skeleton->priv->lock);
7460 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
7461 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
7462 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
7463 {
7464 ChangedProperty *cp = l->data;
7465 GVariant *variant;
7466 const GValue *cur_value;
7467
7468 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
7469 if (!_g_value_equal (cur_value, &cp->orig_value))
7470 {
7471 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
7472 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
7473 g_variant_unref (variant);
7474 num_changes++;
7475 }
7476 }
7477 if (num_changes > 0)
7478 {
7479 GList *connections, *ll;
7480 GVariant *signal_variant;
7481 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorThreshold",
7482 &builder, &invalidated_builder));
7483 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7484 for (ll = connections; ll != NULL; ll = ll->next)
7485 {
7486 GDBusConnection *connection = ll->data;
7487
7488 g_dbus_connection_emit_signal (connection,
7489 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
7490 "org.freedesktop.DBus.Properties",
7491 "PropertiesChanged",
7492 signal_variant,
7493 NULL);
7494 }
7495 g_variant_unref (signal_variant);
7496 g_list_free_full (connections, g_object_unref);
7497 }
7498 else
7499 {
7500 g_variant_builder_clear (&builder);
7501 g_variant_builder_clear (&invalidated_builder);
7502 }
7503 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
7504 skeleton->priv->changed_properties = NULL;
7505 skeleton->priv->changed_properties_idle_source = NULL;
7506 g_mutex_unlock (&skeleton->priv->lock);
7507 return FALSE;
7508}
7509
7510static void
7511_sensor_threshold_schedule_emit_changed (SensorThresholdSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
7512{
7513 ChangedProperty *cp;
7514 GList *l;
7515 cp = NULL;
7516 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
7517 {
7518 ChangedProperty *i_cp = l->data;
7519 if (i_cp->info == info)
7520 {
7521 cp = i_cp;
7522 break;
7523 }
7524 }
7525 if (cp == NULL)
7526 {
7527 cp = g_new0 (ChangedProperty, 1);
7528 cp->prop_id = prop_id;
7529 cp->info = info;
7530 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
7531 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
7532 g_value_copy (orig_value, &cp->orig_value);
7533 }
7534}
7535
7536static void
7537sensor_threshold_skeleton_notify (GObject *object,
7538 GParamSpec *pspec G_GNUC_UNUSED)
7539{
7540 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7541 g_mutex_lock (&skeleton->priv->lock);
7542 if (skeleton->priv->changed_properties != NULL &&
7543 skeleton->priv->changed_properties_idle_source == NULL)
7544 {
7545 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
7546 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
7547 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_threshold_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
7548 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
7549 g_source_unref (skeleton->priv->changed_properties_idle_source);
7550 }
7551 g_mutex_unlock (&skeleton->priv->lock);
7552}
7553
7554static void
7555sensor_threshold_skeleton_set_property (GObject *object,
7556 guint prop_id,
7557 const GValue *value,
7558 GParamSpec *pspec)
7559{
7560 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7561 g_assert (prop_id != 0 && prop_id - 1 < 5);
7562 g_mutex_lock (&skeleton->priv->lock);
7563 g_object_freeze_notify (object);
7564 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
7565 {
7566 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
7567 _sensor_threshold_schedule_emit_changed (skeleton, _sensor_threshold_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
7568 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
7569 g_object_notify_by_pspec (object, pspec);
7570 }
7571 g_mutex_unlock (&skeleton->priv->lock);
7572 g_object_thaw_notify (object);
7573}
7574
7575static void
7576sensor_threshold_skeleton_init (SensorThresholdSkeleton *skeleton)
7577{
7578#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7579 skeleton->priv = sensor_threshold_skeleton_get_instance_private (skeleton);
7580#else
7581 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_THRESHOLD_SKELETON, SensorThresholdSkeletonPrivate);
7582#endif
7583
7584 g_mutex_init (&skeleton->priv->lock);
7585 skeleton->priv->context = g_main_context_ref_thread_default ();
7586 skeleton->priv->properties = g_new0 (GValue, 5);
7587 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
7588 g_value_init (&skeleton->priv->properties[1], G_TYPE_VARIANT);
7589 g_value_init (&skeleton->priv->properties[2], G_TYPE_VARIANT);
7590 g_value_init (&skeleton->priv->properties[3], G_TYPE_VARIANT);
7591 g_value_init (&skeleton->priv->properties[4], G_TYPE_UCHAR);
7592}
7593
7594static GVariant *
7595sensor_threshold_skeleton_get_lower_critical (SensorThreshold *object)
7596{
7597 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7598 GVariant *value;
7599 g_mutex_lock (&skeleton->priv->lock);
7600 value = g_value_get_variant (&(skeleton->priv->properties[0]));
7601 g_mutex_unlock (&skeleton->priv->lock);
7602 return value;
7603}
7604
7605static GVariant *
7606sensor_threshold_skeleton_get_lower_warning (SensorThreshold *object)
7607{
7608 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7609 GVariant *value;
7610 g_mutex_lock (&skeleton->priv->lock);
7611 value = g_value_get_variant (&(skeleton->priv->properties[1]));
7612 g_mutex_unlock (&skeleton->priv->lock);
7613 return value;
7614}
7615
7616static GVariant *
7617sensor_threshold_skeleton_get_upper_warning (SensorThreshold *object)
7618{
7619 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7620 GVariant *value;
7621 g_mutex_lock (&skeleton->priv->lock);
7622 value = g_value_get_variant (&(skeleton->priv->properties[2]));
7623 g_mutex_unlock (&skeleton->priv->lock);
7624 return value;
7625}
7626
7627static GVariant *
7628sensor_threshold_skeleton_get_upper_critical (SensorThreshold *object)
7629{
7630 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7631 GVariant *value;
7632 g_mutex_lock (&skeleton->priv->lock);
7633 value = g_value_get_variant (&(skeleton->priv->properties[3]));
7634 g_mutex_unlock (&skeleton->priv->lock);
7635 return value;
7636}
7637
7638static guchar
7639sensor_threshold_skeleton_get_state (SensorThreshold *object)
7640{
7641 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7642 guchar value;
7643 g_mutex_lock (&skeleton->priv->lock);
7644 value = g_value_get_uchar (&(skeleton->priv->properties[4]));
7645 g_mutex_unlock (&skeleton->priv->lock);
7646 return value;
7647}
7648
7649static void
7650sensor_threshold_skeleton_class_init (SensorThresholdSkeletonClass *klass)
7651{
7652 GObjectClass *gobject_class;
7653 GDBusInterfaceSkeletonClass *skeleton_class;
7654
7655 gobject_class = G_OBJECT_CLASS (klass);
7656 gobject_class->finalize = sensor_threshold_skeleton_finalize;
7657 gobject_class->get_property = sensor_threshold_skeleton_get_property;
7658 gobject_class->set_property = sensor_threshold_skeleton_set_property;
7659 gobject_class->notify = sensor_threshold_skeleton_notify;
7660
7661
7662 sensor_threshold_override_properties (gobject_class, 1);
7663
7664 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
7665 skeleton_class->get_info = sensor_threshold_skeleton_dbus_interface_get_info;
7666 skeleton_class->get_properties = sensor_threshold_skeleton_dbus_interface_get_properties;
7667 skeleton_class->flush = sensor_threshold_skeleton_dbus_interface_flush;
7668 skeleton_class->get_vtable = sensor_threshold_skeleton_dbus_interface_get_vtable;
7669
7670#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
7671 g_type_class_add_private (klass, sizeof (SensorThresholdSkeletonPrivate));
7672#endif
7673}
7674
7675static void
7676sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface)
7677{
7678 iface->warning = _sensor_threshold_on_signal_warning;
7679 iface->critical = _sensor_threshold_on_signal_critical;
7680 iface->normal = _sensor_threshold_on_signal_normal;
7681 iface->get_lower_critical = sensor_threshold_skeleton_get_lower_critical;
7682 iface->get_lower_warning = sensor_threshold_skeleton_get_lower_warning;
7683 iface->get_upper_warning = sensor_threshold_skeleton_get_upper_warning;
7684 iface->get_upper_critical = sensor_threshold_skeleton_get_upper_critical;
7685 iface->get_state = sensor_threshold_skeleton_get_state;
7686}
7687
7688/**
7689 * sensor_threshold_skeleton_new:
7690 *
7691 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
7692 *
7693 * Returns: (transfer full) (type SensorThresholdSkeleton): The skeleton object.
7694 */
7695SensorThreshold *
7696sensor_threshold_skeleton_new (void)
7697{
7698 return SENSOR_THRESHOLD (g_object_new (TYPE_SENSOR_THRESHOLD_SKELETON, NULL));
7699}
7700
7701/* ------------------------------------------------------------------------
7702 * Code for interface org.openbmc.SensorI2c
7703 * ------------------------------------------------------------------------
7704 */
7705
7706/**
7707 * SECTION:SensorI2c
7708 * @title: SensorI2c
7709 * @short_description: Generated C code for the org.openbmc.SensorI2c D-Bus interface
7710 *
7711 * 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.
7712 */
7713
7714/* ---- Introspection data for org.openbmc.SensorI2c ---- */
7715
7716static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_dev_path =
7717{
7718 {
7719 -1,
7720 (gchar *) "dev_path",
7721 (gchar *) "s",
7722 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
7723 NULL
7724 },
7725 "dev-path",
7726 FALSE
7727};
7728
7729static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_address =
7730{
7731 {
7732 -1,
7733 (gchar *) "address",
7734 (gchar *) "s",
7735 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
7736 NULL
7737 },
7738 "address",
7739 FALSE
7740};
7741
7742static const _ExtendedGDBusPropertyInfo * const _sensor_i2c_property_info_pointers[] =
7743{
7744 &_sensor_i2c_property_info_dev_path,
7745 &_sensor_i2c_property_info_address,
7746 NULL
7747};
7748
7749static const _ExtendedGDBusInterfaceInfo _sensor_i2c_interface_info =
7750{
7751 {
7752 -1,
7753 (gchar *) "org.openbmc.SensorI2c",
7754 NULL,
7755 NULL,
7756 (GDBusPropertyInfo **) &_sensor_i2c_property_info_pointers,
7757 NULL
7758 },
7759 "sensor-i2c",
7760};
7761
7762
7763/**
7764 * sensor_i2c_interface_info:
7765 *
7766 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> D-Bus interface.
7767 *
7768 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
7769 */
7770GDBusInterfaceInfo *
7771sensor_i2c_interface_info (void)
7772{
7773 return (GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct;
7774}
7775
7776/**
7777 * sensor_i2c_override_properties:
7778 * @klass: The class structure for a #GObject<!-- -->-derived class.
7779 * @property_id_begin: The property id to assign to the first overridden property.
7780 *
7781 * Overrides all #GObject properties in the #SensorI2c interface for a concrete class.
7782 * The properties are overridden in the order they are defined.
7783 *
7784 * Returns: The last property id.
7785 */
7786guint
7787sensor_i2c_override_properties (GObjectClass *klass, guint property_id_begin)
7788{
7789 g_object_class_override_property (klass, property_id_begin++, "dev-path");
7790 g_object_class_override_property (klass, property_id_begin++, "address");
7791 return property_id_begin - 1;
7792}
7793
7794
7795
7796/**
7797 * SensorI2c:
7798 *
7799 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
7800 */
7801
7802/**
7803 * SensorI2cIface:
7804 * @parent_iface: The parent interface.
7805 * @get_address: Getter for the #SensorI2c:address property.
7806 * @get_dev_path: Getter for the #SensorI2c:dev-path property.
7807 *
7808 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
7809 */
7810
7811typedef SensorI2cIface SensorI2cInterface;
7812G_DEFINE_INTERFACE (SensorI2c, sensor_i2c, G_TYPE_OBJECT);
7813
7814static void
7815sensor_i2c_default_init (SensorI2cIface *iface)
7816{
7817 /* GObject properties for D-Bus properties: */
7818 /**
7819 * SensorI2c:dev-path:
7820 *
7821 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link>.
7822 *
7823 * 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.
7824 */
7825 g_object_interface_install_property (iface,
7826 g_param_spec_string ("dev-path", "dev_path", "dev_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
7827 /**
7828 * SensorI2c:address:
7829 *
7830 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link>.
7831 *
7832 * 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.
7833 */
7834 g_object_interface_install_property (iface,
7835 g_param_spec_string ("address", "address", "address", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
7836}
7837
7838/**
7839 * sensor_i2c_get_dev_path: (skip)
7840 * @object: A #SensorI2c.
7841 *
7842 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
7843 *
7844 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7845 *
7846 * <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>
7847 *
7848 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
7849 */
7850const gchar *
7851sensor_i2c_get_dev_path (SensorI2c *object)
7852{
7853 return SENSOR_I2C_GET_IFACE (object)->get_dev_path (object);
7854}
7855
7856/**
7857 * sensor_i2c_dup_dev_path: (skip)
7858 * @object: A #SensorI2c.
7859 *
7860 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
7861 *
7862 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7863 *
7864 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
7865 */
7866gchar *
7867sensor_i2c_dup_dev_path (SensorI2c *object)
7868{
7869 gchar *value;
7870 g_object_get (G_OBJECT (object), "dev-path", &value, NULL);
7871 return value;
7872}
7873
7874/**
7875 * sensor_i2c_set_dev_path: (skip)
7876 * @object: A #SensorI2c.
7877 * @value: The value to set.
7878 *
7879 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property to @value.
7880 *
7881 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7882 */
7883void
7884sensor_i2c_set_dev_path (SensorI2c *object, const gchar *value)
7885{
7886 g_object_set (G_OBJECT (object), "dev-path", value, NULL);
7887}
7888
7889/**
7890 * sensor_i2c_get_address: (skip)
7891 * @object: A #SensorI2c.
7892 *
7893 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
7894 *
7895 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7896 *
7897 * <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>
7898 *
7899 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
7900 */
7901const gchar *
7902sensor_i2c_get_address (SensorI2c *object)
7903{
7904 return SENSOR_I2C_GET_IFACE (object)->get_address (object);
7905}
7906
7907/**
7908 * sensor_i2c_dup_address: (skip)
7909 * @object: A #SensorI2c.
7910 *
7911 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
7912 *
7913 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7914 *
7915 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
7916 */
7917gchar *
7918sensor_i2c_dup_address (SensorI2c *object)
7919{
7920 gchar *value;
7921 g_object_get (G_OBJECT (object), "address", &value, NULL);
7922 return value;
7923}
7924
7925/**
7926 * sensor_i2c_set_address: (skip)
7927 * @object: A #SensorI2c.
7928 * @value: The value to set.
7929 *
7930 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property to @value.
7931 *
7932 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7933 */
7934void
7935sensor_i2c_set_address (SensorI2c *object, const gchar *value)
7936{
7937 g_object_set (G_OBJECT (object), "address", value, NULL);
7938}
7939
7940/* ------------------------------------------------------------------------ */
7941
7942/**
7943 * SensorI2cProxy:
7944 *
7945 * The #SensorI2cProxy structure contains only private data and should only be accessed using the provided API.
7946 */
7947
7948/**
7949 * SensorI2cProxyClass:
7950 * @parent_class: The parent class.
7951 *
7952 * Class structure for #SensorI2cProxy.
7953 */
7954
7955struct _SensorI2cProxyPrivate
7956{
7957 GData *qdata;
7958};
7959
7960static void sensor_i2c_proxy_iface_init (SensorI2cIface *iface);
7961
7962#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7963G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
7964 G_ADD_PRIVATE (SensorI2cProxy)
7965 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
7966
7967#else
7968G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
7969 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
7970
7971#endif
7972static void
7973sensor_i2c_proxy_finalize (GObject *object)
7974{
7975 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
7976 g_datalist_clear (&proxy->priv->qdata);
7977 G_OBJECT_CLASS (sensor_i2c_proxy_parent_class)->finalize (object);
7978}
7979
7980static void
7981sensor_i2c_proxy_get_property (GObject *object,
7982 guint prop_id,
7983 GValue *value,
7984 GParamSpec *pspec G_GNUC_UNUSED)
7985{
7986 const _ExtendedGDBusPropertyInfo *info;
7987 GVariant *variant;
7988 g_assert (prop_id != 0 && prop_id - 1 < 2);
7989 info = _sensor_i2c_property_info_pointers[prop_id - 1];
7990 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
7991 if (info->use_gvariant)
7992 {
7993 g_value_set_variant (value, variant);
7994 }
7995 else
7996 {
7997 if (variant != NULL)
7998 g_dbus_gvariant_to_gvalue (variant, value);
7999 }
8000 if (variant != NULL)
8001 g_variant_unref (variant);
8002}
8003
8004static void
8005sensor_i2c_proxy_set_property_cb (GDBusProxy *proxy,
8006 GAsyncResult *res,
8007 gpointer user_data)
8008{
8009 const _ExtendedGDBusPropertyInfo *info = user_data;
8010 GError *error;
8011 GVariant *_ret;
8012 error = NULL;
8013 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
8014 if (!_ret)
8015 {
8016 g_warning ("Error setting property '%s' on interface org.openbmc.SensorI2c: %s (%s, %d)",
8017 info->parent_struct.name,
8018 error->message, g_quark_to_string (error->domain), error->code);
8019 g_error_free (error);
8020 }
8021 else
8022 {
8023 g_variant_unref (_ret);
8024 }
8025}
8026
8027static void
8028sensor_i2c_proxy_set_property (GObject *object,
8029 guint prop_id,
8030 const GValue *value,
8031 GParamSpec *pspec G_GNUC_UNUSED)
8032{
8033 const _ExtendedGDBusPropertyInfo *info;
8034 GVariant *variant;
8035 g_assert (prop_id != 0 && prop_id - 1 < 2);
8036 info = _sensor_i2c_property_info_pointers[prop_id - 1];
8037 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
8038 g_dbus_proxy_call (G_DBUS_PROXY (object),
8039 "org.freedesktop.DBus.Properties.Set",
8040 g_variant_new ("(ssv)", "org.openbmc.SensorI2c", info->parent_struct.name, variant),
8041 G_DBUS_CALL_FLAGS_NONE,
8042 -1,
8043 NULL, (GAsyncReadyCallback) sensor_i2c_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
8044 g_variant_unref (variant);
8045}
8046
8047static void
8048sensor_i2c_proxy_g_signal (GDBusProxy *proxy,
8049 const gchar *sender_name G_GNUC_UNUSED,
8050 const gchar *signal_name,
8051 GVariant *parameters)
8052{
8053 _ExtendedGDBusSignalInfo *info;
8054 GVariantIter iter;
8055 GVariant *child;
8056 GValue *paramv;
8057 guint num_params;
8058 guint n;
8059 guint signal_id;
8060 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, signal_name);
8061 if (info == NULL)
8062 return;
8063 num_params = g_variant_n_children (parameters);
8064 paramv = g_new0 (GValue, num_params + 1);
8065 g_value_init (&paramv[0], TYPE_SENSOR_I2C);
8066 g_value_set_object (&paramv[0], proxy);
8067 g_variant_iter_init (&iter, parameters);
8068 n = 1;
8069 while ((child = g_variant_iter_next_value (&iter)) != NULL)
8070 {
8071 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
8072 if (arg_info->use_gvariant)
8073 {
8074 g_value_init (&paramv[n], G_TYPE_VARIANT);
8075 g_value_set_variant (&paramv[n], child);
8076 n++;
8077 }
8078 else
8079 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
8080 g_variant_unref (child);
8081 }
8082 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
8083 g_signal_emitv (paramv, signal_id, 0, NULL);
8084 for (n = 0; n < num_params + 1; n++)
8085 g_value_unset (&paramv[n]);
8086 g_free (paramv);
8087}
8088
8089static void
8090sensor_i2c_proxy_g_properties_changed (GDBusProxy *_proxy,
8091 GVariant *changed_properties,
8092 const gchar *const *invalidated_properties)
8093{
8094 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (_proxy);
8095 guint n;
8096 const gchar *key;
8097 GVariantIter *iter;
8098 _ExtendedGDBusPropertyInfo *info;
8099 g_variant_get (changed_properties, "a{sv}", &iter);
8100 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
8101 {
8102 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, key);
8103 g_datalist_remove_data (&proxy->priv->qdata, key);
8104 if (info != NULL)
8105 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
8106 }
8107 g_variant_iter_free (iter);
8108 for (n = 0; invalidated_properties[n] != NULL; n++)
8109 {
8110 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, invalidated_properties[n]);
8111 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
8112 if (info != NULL)
8113 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
8114 }
8115}
8116
8117static const gchar *
8118sensor_i2c_proxy_get_dev_path (SensorI2c *object)
8119{
8120 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
8121 GVariant *variant;
8122 const gchar *value = NULL;
8123 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "dev_path");
8124 if (variant != NULL)
8125 {
8126 value = g_variant_get_string (variant, NULL);
8127 g_variant_unref (variant);
8128 }
8129 return value;
8130}
8131
8132static const gchar *
8133sensor_i2c_proxy_get_address (SensorI2c *object)
8134{
8135 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
8136 GVariant *variant;
8137 const gchar *value = NULL;
8138 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "address");
8139 if (variant != NULL)
8140 {
8141 value = g_variant_get_string (variant, NULL);
8142 g_variant_unref (variant);
8143 }
8144 return value;
8145}
8146
8147static void
8148sensor_i2c_proxy_init (SensorI2cProxy *proxy)
8149{
8150#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8151 proxy->priv = sensor_i2c_proxy_get_instance_private (proxy);
8152#else
8153 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_I2C_PROXY, SensorI2cProxyPrivate);
8154#endif
8155
8156 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_i2c_interface_info ());
8157}
8158
8159static void
8160sensor_i2c_proxy_class_init (SensorI2cProxyClass *klass)
8161{
8162 GObjectClass *gobject_class;
8163 GDBusProxyClass *proxy_class;
8164
8165 gobject_class = G_OBJECT_CLASS (klass);
8166 gobject_class->finalize = sensor_i2c_proxy_finalize;
8167 gobject_class->get_property = sensor_i2c_proxy_get_property;
8168 gobject_class->set_property = sensor_i2c_proxy_set_property;
8169
8170 proxy_class = G_DBUS_PROXY_CLASS (klass);
8171 proxy_class->g_signal = sensor_i2c_proxy_g_signal;
8172 proxy_class->g_properties_changed = sensor_i2c_proxy_g_properties_changed;
8173
8174 sensor_i2c_override_properties (gobject_class, 1);
8175
8176#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8177 g_type_class_add_private (klass, sizeof (SensorI2cProxyPrivate));
8178#endif
8179}
8180
8181static void
8182sensor_i2c_proxy_iface_init (SensorI2cIface *iface)
8183{
8184 iface->get_dev_path = sensor_i2c_proxy_get_dev_path;
8185 iface->get_address = sensor_i2c_proxy_get_address;
8186}
8187
8188/**
8189 * sensor_i2c_proxy_new:
8190 * @connection: A #GDBusConnection.
8191 * @flags: Flags from the #GDBusProxyFlags enumeration.
8192 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
8193 * @object_path: An object path.
8194 * @cancellable: (allow-none): A #GCancellable or %NULL.
8195 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
8196 * @user_data: User data to pass to @callback.
8197 *
8198 * 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.
8199 *
8200 * 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.
8201 * You can then call sensor_i2c_proxy_new_finish() to get the result of the operation.
8202 *
8203 * See sensor_i2c_proxy_new_sync() for the synchronous, blocking version of this constructor.
8204 */
8205void
8206sensor_i2c_proxy_new (
8207 GDBusConnection *connection,
8208 GDBusProxyFlags flags,
8209 const gchar *name,
8210 const gchar *object_path,
8211 GCancellable *cancellable,
8212 GAsyncReadyCallback callback,
8213 gpointer user_data)
8214{
8215 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);
8216}
8217
8218/**
8219 * sensor_i2c_proxy_new_finish:
8220 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new().
8221 * @error: Return location for error or %NULL
8222 *
8223 * Finishes an operation started with sensor_i2c_proxy_new().
8224 *
8225 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8226 */
8227SensorI2c *
8228sensor_i2c_proxy_new_finish (
8229 GAsyncResult *res,
8230 GError **error)
8231{
8232 GObject *ret;
8233 GObject *source_object;
8234 source_object = g_async_result_get_source_object (res);
8235 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
8236 g_object_unref (source_object);
8237 if (ret != NULL)
8238 return SENSOR_I2C (ret);
8239 else
8240 return NULL;
8241}
8242
8243/**
8244 * sensor_i2c_proxy_new_sync:
8245 * @connection: A #GDBusConnection.
8246 * @flags: Flags from the #GDBusProxyFlags enumeration.
8247 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
8248 * @object_path: An object path.
8249 * @cancellable: (allow-none): A #GCancellable or %NULL.
8250 * @error: Return location for error or %NULL
8251 *
8252 * 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.
8253 *
8254 * The calling thread is blocked until a reply is received.
8255 *
8256 * See sensor_i2c_proxy_new() for the asynchronous version of this constructor.
8257 *
8258 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8259 */
8260SensorI2c *
8261sensor_i2c_proxy_new_sync (
8262 GDBusConnection *connection,
8263 GDBusProxyFlags flags,
8264 const gchar *name,
8265 const gchar *object_path,
8266 GCancellable *cancellable,
8267 GError **error)
8268{
8269 GInitable *ret;
8270 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);
8271 if (ret != NULL)
8272 return SENSOR_I2C (ret);
8273 else
8274 return NULL;
8275}
8276
8277
8278/**
8279 * sensor_i2c_proxy_new_for_bus:
8280 * @bus_type: A #GBusType.
8281 * @flags: Flags from the #GDBusProxyFlags enumeration.
8282 * @name: A bus name (well-known or unique).
8283 * @object_path: An object path.
8284 * @cancellable: (allow-none): A #GCancellable or %NULL.
8285 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
8286 * @user_data: User data to pass to @callback.
8287 *
8288 * Like sensor_i2c_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
8289 *
8290 * 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.
8291 * You can then call sensor_i2c_proxy_new_for_bus_finish() to get the result of the operation.
8292 *
8293 * See sensor_i2c_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
8294 */
8295void
8296sensor_i2c_proxy_new_for_bus (
8297 GBusType bus_type,
8298 GDBusProxyFlags flags,
8299 const gchar *name,
8300 const gchar *object_path,
8301 GCancellable *cancellable,
8302 GAsyncReadyCallback callback,
8303 gpointer user_data)
8304{
8305 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);
8306}
8307
8308/**
8309 * sensor_i2c_proxy_new_for_bus_finish:
8310 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new_for_bus().
8311 * @error: Return location for error or %NULL
8312 *
8313 * Finishes an operation started with sensor_i2c_proxy_new_for_bus().
8314 *
8315 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8316 */
8317SensorI2c *
8318sensor_i2c_proxy_new_for_bus_finish (
8319 GAsyncResult *res,
8320 GError **error)
8321{
8322 GObject *ret;
8323 GObject *source_object;
8324 source_object = g_async_result_get_source_object (res);
8325 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
8326 g_object_unref (source_object);
8327 if (ret != NULL)
8328 return SENSOR_I2C (ret);
8329 else
8330 return NULL;
8331}
8332
8333/**
8334 * sensor_i2c_proxy_new_for_bus_sync:
8335 * @bus_type: A #GBusType.
8336 * @flags: Flags from the #GDBusProxyFlags enumeration.
8337 * @name: A bus name (well-known or unique).
8338 * @object_path: An object path.
8339 * @cancellable: (allow-none): A #GCancellable or %NULL.
8340 * @error: Return location for error or %NULL
8341 *
8342 * Like sensor_i2c_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
8343 *
8344 * The calling thread is blocked until a reply is received.
8345 *
8346 * See sensor_i2c_proxy_new_for_bus() for the asynchronous version of this constructor.
8347 *
8348 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8349 */
8350SensorI2c *
8351sensor_i2c_proxy_new_for_bus_sync (
8352 GBusType bus_type,
8353 GDBusProxyFlags flags,
8354 const gchar *name,
8355 const gchar *object_path,
8356 GCancellable *cancellable,
8357 GError **error)
8358{
8359 GInitable *ret;
8360 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);
8361 if (ret != NULL)
8362 return SENSOR_I2C (ret);
8363 else
8364 return NULL;
8365}
8366
8367
8368/* ------------------------------------------------------------------------ */
8369
8370/**
8371 * SensorI2cSkeleton:
8372 *
8373 * The #SensorI2cSkeleton structure contains only private data and should only be accessed using the provided API.
8374 */
8375
8376/**
8377 * SensorI2cSkeletonClass:
8378 * @parent_class: The parent class.
8379 *
8380 * Class structure for #SensorI2cSkeleton.
8381 */
8382
8383struct _SensorI2cSkeletonPrivate
8384{
8385 GValue *properties;
8386 GList *changed_properties;
8387 GSource *changed_properties_idle_source;
8388 GMainContext *context;
8389 GMutex lock;
8390};
8391
8392static void
8393_sensor_i2c_skeleton_handle_method_call (
8394 GDBusConnection *connection G_GNUC_UNUSED,
8395 const gchar *sender G_GNUC_UNUSED,
8396 const gchar *object_path G_GNUC_UNUSED,
8397 const gchar *interface_name,
8398 const gchar *method_name,
8399 GVariant *parameters,
8400 GDBusMethodInvocation *invocation,
8401 gpointer user_data)
8402{
8403 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8404 _ExtendedGDBusMethodInfo *info;
8405 GVariantIter iter;
8406 GVariant *child;
8407 GValue *paramv;
8408 guint num_params;
8409 guint num_extra;
8410 guint n;
8411 guint signal_id;
8412 GValue return_value = G_VALUE_INIT;
8413 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
8414 g_assert (info != NULL);
8415 num_params = g_variant_n_children (parameters);
8416 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
8417 n = 0;
8418 g_value_init (&paramv[n], TYPE_SENSOR_I2C);
8419 g_value_set_object (&paramv[n++], skeleton);
8420 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
8421 g_value_set_object (&paramv[n++], invocation);
8422 if (info->pass_fdlist)
8423 {
8424#ifdef G_OS_UNIX
8425 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
8426 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
8427#else
8428 g_assert_not_reached ();
8429#endif
8430 }
8431 g_variant_iter_init (&iter, parameters);
8432 while ((child = g_variant_iter_next_value (&iter)) != NULL)
8433 {
8434 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
8435 if (arg_info->use_gvariant)
8436 {
8437 g_value_init (&paramv[n], G_TYPE_VARIANT);
8438 g_value_set_variant (&paramv[n], child);
8439 n++;
8440 }
8441 else
8442 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
8443 g_variant_unref (child);
8444 }
8445 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
8446 g_value_init (&return_value, G_TYPE_BOOLEAN);
8447 g_signal_emitv (paramv, signal_id, 0, &return_value);
8448 if (!g_value_get_boolean (&return_value))
8449 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);
8450 g_value_unset (&return_value);
8451 for (n = 0; n < num_params + num_extra; n++)
8452 g_value_unset (&paramv[n]);
8453 g_free (paramv);
8454}
8455
8456static GVariant *
8457_sensor_i2c_skeleton_handle_get_property (
8458 GDBusConnection *connection G_GNUC_UNUSED,
8459 const gchar *sender G_GNUC_UNUSED,
8460 const gchar *object_path G_GNUC_UNUSED,
8461 const gchar *interface_name G_GNUC_UNUSED,
8462 const gchar *property_name,
8463 GError **error,
8464 gpointer user_data)
8465{
8466 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8467 GValue value = G_VALUE_INIT;
8468 GParamSpec *pspec;
8469 _ExtendedGDBusPropertyInfo *info;
8470 GVariant *ret;
8471 ret = NULL;
8472 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
8473 g_assert (info != NULL);
8474 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
8475 if (pspec == NULL)
8476 {
8477 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
8478 }
8479 else
8480 {
8481 g_value_init (&value, pspec->value_type);
8482 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
8483 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
8484 g_value_unset (&value);
8485 }
8486 return ret;
8487}
8488
8489static gboolean
8490_sensor_i2c_skeleton_handle_set_property (
8491 GDBusConnection *connection G_GNUC_UNUSED,
8492 const gchar *sender G_GNUC_UNUSED,
8493 const gchar *object_path G_GNUC_UNUSED,
8494 const gchar *interface_name G_GNUC_UNUSED,
8495 const gchar *property_name,
8496 GVariant *variant,
8497 GError **error,
8498 gpointer user_data)
8499{
8500 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8501 GValue value = G_VALUE_INIT;
8502 GParamSpec *pspec;
8503 _ExtendedGDBusPropertyInfo *info;
8504 gboolean ret;
8505 ret = FALSE;
8506 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
8507 g_assert (info != NULL);
8508 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
8509 if (pspec == NULL)
8510 {
8511 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
8512 }
8513 else
8514 {
8515 if (info->use_gvariant)
8516 g_value_set_variant (&value, variant);
8517 else
8518 g_dbus_gvariant_to_gvalue (variant, &value);
8519 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
8520 g_value_unset (&value);
8521 ret = TRUE;
8522 }
8523 return ret;
8524}
8525
8526static const GDBusInterfaceVTable _sensor_i2c_skeleton_vtable =
8527{
8528 _sensor_i2c_skeleton_handle_method_call,
8529 _sensor_i2c_skeleton_handle_get_property,
8530 _sensor_i2c_skeleton_handle_set_property,
8531 {NULL}
8532};
8533
8534static GDBusInterfaceInfo *
8535sensor_i2c_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8536{
8537 return sensor_i2c_interface_info ();
8538}
8539
8540static GDBusInterfaceVTable *
8541sensor_i2c_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8542{
8543 return (GDBusInterfaceVTable *) &_sensor_i2c_skeleton_vtable;
8544}
8545
8546static GVariant *
8547sensor_i2c_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
8548{
8549 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
8550
8551 GVariantBuilder builder;
8552 guint n;
8553 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8554 if (_sensor_i2c_interface_info.parent_struct.properties == NULL)
8555 goto out;
8556 for (n = 0; _sensor_i2c_interface_info.parent_struct.properties[n] != NULL; n++)
8557 {
8558 GDBusPropertyInfo *info = _sensor_i2c_interface_info.parent_struct.properties[n];
8559 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
8560 {
8561 GVariant *value;
8562 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);
8563 if (value != NULL)
8564 {
8565 g_variant_take_ref (value);
8566 g_variant_builder_add (&builder, "{sv}", info->name, value);
8567 g_variant_unref (value);
8568 }
8569 }
8570 }
8571out:
8572 return g_variant_builder_end (&builder);
8573}
8574
8575static gboolean _sensor_i2c_emit_changed (gpointer user_data);
8576
8577static void
8578sensor_i2c_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
8579{
8580 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
8581 gboolean emit_changed = FALSE;
8582
8583 g_mutex_lock (&skeleton->priv->lock);
8584 if (skeleton->priv->changed_properties_idle_source != NULL)
8585 {
8586 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8587 skeleton->priv->changed_properties_idle_source = NULL;
8588 emit_changed = TRUE;
8589 }
8590 g_mutex_unlock (&skeleton->priv->lock);
8591
8592 if (emit_changed)
8593 _sensor_i2c_emit_changed (skeleton);
8594}
8595
8596static void sensor_i2c_skeleton_iface_init (SensorI2cIface *iface);
8597#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8598G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8599 G_ADD_PRIVATE (SensorI2cSkeleton)
8600 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
8601
8602#else
8603G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8604 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
8605
8606#endif
8607static void
8608sensor_i2c_skeleton_finalize (GObject *object)
8609{
8610 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8611 guint n;
8612 for (n = 0; n < 2; n++)
8613 g_value_unset (&skeleton->priv->properties[n]);
8614 g_free (skeleton->priv->properties);
8615 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
8616 if (skeleton->priv->changed_properties_idle_source != NULL)
8617 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8618 g_main_context_unref (skeleton->priv->context);
8619 g_mutex_clear (&skeleton->priv->lock);
8620 G_OBJECT_CLASS (sensor_i2c_skeleton_parent_class)->finalize (object);
8621}
8622
8623static void
8624sensor_i2c_skeleton_get_property (GObject *object,
8625 guint prop_id,
8626 GValue *value,
8627 GParamSpec *pspec G_GNUC_UNUSED)
8628{
8629 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8630 g_assert (prop_id != 0 && prop_id - 1 < 2);
8631 g_mutex_lock (&skeleton->priv->lock);
8632 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
8633 g_mutex_unlock (&skeleton->priv->lock);
8634}
8635
8636static gboolean
8637_sensor_i2c_emit_changed (gpointer user_data)
8638{
8639 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8640 GList *l;
8641 GVariantBuilder builder;
8642 GVariantBuilder invalidated_builder;
8643 guint num_changes;
8644
8645 g_mutex_lock (&skeleton->priv->lock);
8646 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8647 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
8648 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
8649 {
8650 ChangedProperty *cp = l->data;
8651 GVariant *variant;
8652 const GValue *cur_value;
8653
8654 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
8655 if (!_g_value_equal (cur_value, &cp->orig_value))
8656 {
8657 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
8658 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
8659 g_variant_unref (variant);
8660 num_changes++;
8661 }
8662 }
8663 if (num_changes > 0)
8664 {
8665 GList *connections, *ll;
8666 GVariant *signal_variant;
8667 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorI2c",
8668 &builder, &invalidated_builder));
8669 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
8670 for (ll = connections; ll != NULL; ll = ll->next)
8671 {
8672 GDBusConnection *connection = ll->data;
8673
8674 g_dbus_connection_emit_signal (connection,
8675 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
8676 "org.freedesktop.DBus.Properties",
8677 "PropertiesChanged",
8678 signal_variant,
8679 NULL);
8680 }
8681 g_variant_unref (signal_variant);
8682 g_list_free_full (connections, g_object_unref);
8683 }
8684 else
8685 {
8686 g_variant_builder_clear (&builder);
8687 g_variant_builder_clear (&invalidated_builder);
8688 }
8689 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
8690 skeleton->priv->changed_properties = NULL;
8691 skeleton->priv->changed_properties_idle_source = NULL;
8692 g_mutex_unlock (&skeleton->priv->lock);
8693 return FALSE;
8694}
8695
8696static void
8697_sensor_i2c_schedule_emit_changed (SensorI2cSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
8698{
8699 ChangedProperty *cp;
8700 GList *l;
8701 cp = NULL;
8702 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
8703 {
8704 ChangedProperty *i_cp = l->data;
8705 if (i_cp->info == info)
8706 {
8707 cp = i_cp;
8708 break;
8709 }
8710 }
8711 if (cp == NULL)
8712 {
8713 cp = g_new0 (ChangedProperty, 1);
8714 cp->prop_id = prop_id;
8715 cp->info = info;
8716 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
8717 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
8718 g_value_copy (orig_value, &cp->orig_value);
8719 }
8720}
8721
8722static void
8723sensor_i2c_skeleton_notify (GObject *object,
8724 GParamSpec *pspec G_GNUC_UNUSED)
8725{
8726 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8727 g_mutex_lock (&skeleton->priv->lock);
8728 if (skeleton->priv->changed_properties != NULL &&
8729 skeleton->priv->changed_properties_idle_source == NULL)
8730 {
8731 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
8732 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
8733 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_i2c_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
8734 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
8735 g_source_unref (skeleton->priv->changed_properties_idle_source);
8736 }
8737 g_mutex_unlock (&skeleton->priv->lock);
8738}
8739
8740static void
8741sensor_i2c_skeleton_set_property (GObject *object,
8742 guint prop_id,
8743 const GValue *value,
8744 GParamSpec *pspec)
8745{
8746 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8747 g_assert (prop_id != 0 && prop_id - 1 < 2);
8748 g_mutex_lock (&skeleton->priv->lock);
8749 g_object_freeze_notify (object);
8750 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
8751 {
8752 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
8753 _sensor_i2c_schedule_emit_changed (skeleton, _sensor_i2c_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
8754 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
8755 g_object_notify_by_pspec (object, pspec);
8756 }
8757 g_mutex_unlock (&skeleton->priv->lock);
8758 g_object_thaw_notify (object);
8759}
8760
8761static void
8762sensor_i2c_skeleton_init (SensorI2cSkeleton *skeleton)
8763{
8764#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8765 skeleton->priv = sensor_i2c_skeleton_get_instance_private (skeleton);
8766#else
8767 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_I2C_SKELETON, SensorI2cSkeletonPrivate);
8768#endif
8769
8770 g_mutex_init (&skeleton->priv->lock);
8771 skeleton->priv->context = g_main_context_ref_thread_default ();
8772 skeleton->priv->properties = g_new0 (GValue, 2);
8773 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
8774 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
8775}
8776
8777static const gchar *
8778sensor_i2c_skeleton_get_dev_path (SensorI2c *object)
8779{
8780 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8781 const gchar *value;
8782 g_mutex_lock (&skeleton->priv->lock);
8783 value = g_value_get_string (&(skeleton->priv->properties[0]));
8784 g_mutex_unlock (&skeleton->priv->lock);
8785 return value;
8786}
8787
8788static const gchar *
8789sensor_i2c_skeleton_get_address (SensorI2c *object)
8790{
8791 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8792 const gchar *value;
8793 g_mutex_lock (&skeleton->priv->lock);
8794 value = g_value_get_string (&(skeleton->priv->properties[1]));
8795 g_mutex_unlock (&skeleton->priv->lock);
8796 return value;
8797}
8798
8799static void
8800sensor_i2c_skeleton_class_init (SensorI2cSkeletonClass *klass)
8801{
8802 GObjectClass *gobject_class;
8803 GDBusInterfaceSkeletonClass *skeleton_class;
8804
8805 gobject_class = G_OBJECT_CLASS (klass);
8806 gobject_class->finalize = sensor_i2c_skeleton_finalize;
8807 gobject_class->get_property = sensor_i2c_skeleton_get_property;
8808 gobject_class->set_property = sensor_i2c_skeleton_set_property;
8809 gobject_class->notify = sensor_i2c_skeleton_notify;
8810
8811
8812 sensor_i2c_override_properties (gobject_class, 1);
8813
8814 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
8815 skeleton_class->get_info = sensor_i2c_skeleton_dbus_interface_get_info;
8816 skeleton_class->get_properties = sensor_i2c_skeleton_dbus_interface_get_properties;
8817 skeleton_class->flush = sensor_i2c_skeleton_dbus_interface_flush;
8818 skeleton_class->get_vtable = sensor_i2c_skeleton_dbus_interface_get_vtable;
8819
8820#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8821 g_type_class_add_private (klass, sizeof (SensorI2cSkeletonPrivate));
8822#endif
8823}
8824
8825static void
8826sensor_i2c_skeleton_iface_init (SensorI2cIface *iface)
8827{
8828 iface->get_dev_path = sensor_i2c_skeleton_get_dev_path;
8829 iface->get_address = sensor_i2c_skeleton_get_address;
8830}
8831
8832/**
8833 * sensor_i2c_skeleton_new:
8834 *
8835 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
8836 *
8837 * Returns: (transfer full) (type SensorI2cSkeleton): The skeleton object.
8838 */
8839SensorI2c *
8840sensor_i2c_skeleton_new (void)
8841{
8842 return SENSOR_I2C (g_object_new (TYPE_SENSOR_I2C_SKELETON, NULL));
8843}
8844
8845/* ------------------------------------------------------------------------
8846 * Code for interface org.openbmc.SensorMatch
8847 * ------------------------------------------------------------------------
8848 */
8849
8850/**
8851 * SECTION:SensorMatch
8852 * @title: SensorMatch
8853 * @short_description: Generated C code for the org.openbmc.SensorMatch D-Bus interface
8854 *
8855 * 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.
8856 */
8857
8858/* ---- Introspection data for org.openbmc.SensorMatch ---- */
8859
8860static const _ExtendedGDBusArgInfo _sensor_match_signal_info_sensor_match_ARG_state =
8861{
8862 {
8863 -1,
8864 (gchar *) "state",
8865 (gchar *) "y",
8866 NULL
8867 },
8868 FALSE
8869};
8870
8871static const _ExtendedGDBusArgInfo * const _sensor_match_signal_info_sensor_match_ARG_pointers[] =
8872{
8873 &_sensor_match_signal_info_sensor_match_ARG_state,
8874 NULL
8875};
8876
8877static const _ExtendedGDBusSignalInfo _sensor_match_signal_info_sensor_match =
8878{
8879 {
8880 -1,
8881 (gchar *) "SensorMatch",
8882 (GDBusArgInfo **) &_sensor_match_signal_info_sensor_match_ARG_pointers,
8883 NULL
8884 },
8885 "sensor-match"
8886};
8887
8888static const _ExtendedGDBusSignalInfo * const _sensor_match_signal_info_pointers[] =
8889{
8890 &_sensor_match_signal_info_sensor_match,
8891 NULL
8892};
8893
8894static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_match_value =
8895{
8896 {
8897 -1,
8898 (gchar *) "match_value",
8899 (gchar *) "v",
8900 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
8901 NULL
8902 },
8903 "match-value",
8904 FALSE
8905};
8906
8907static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_state =
8908{
8909 {
8910 -1,
8911 (gchar *) "state",
8912 (gchar *) "y",
8913 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
8914 NULL
8915 },
8916 "state",
8917 FALSE
8918};
8919
8920static const _ExtendedGDBusPropertyInfo * const _sensor_match_property_info_pointers[] =
8921{
8922 &_sensor_match_property_info_match_value,
8923 &_sensor_match_property_info_state,
8924 NULL
8925};
8926
8927static const _ExtendedGDBusInterfaceInfo _sensor_match_interface_info =
8928{
8929 {
8930 -1,
8931 (gchar *) "org.openbmc.SensorMatch",
8932 NULL,
8933 (GDBusSignalInfo **) &_sensor_match_signal_info_pointers,
8934 (GDBusPropertyInfo **) &_sensor_match_property_info_pointers,
8935 NULL
8936 },
8937 "sensor-match",
8938};
8939
8940
8941/**
8942 * sensor_match_interface_info:
8943 *
8944 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> D-Bus interface.
8945 *
8946 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
8947 */
8948GDBusInterfaceInfo *
8949sensor_match_interface_info (void)
8950{
8951 return (GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct;
8952}
8953
8954/**
8955 * sensor_match_override_properties:
8956 * @klass: The class structure for a #GObject<!-- -->-derived class.
8957 * @property_id_begin: The property id to assign to the first overridden property.
8958 *
8959 * Overrides all #GObject properties in the #SensorMatch interface for a concrete class.
8960 * The properties are overridden in the order they are defined.
8961 *
8962 * Returns: The last property id.
8963 */
8964guint
8965sensor_match_override_properties (GObjectClass *klass, guint property_id_begin)
8966{
8967 g_object_class_override_property (klass, property_id_begin++, "match-value");
8968 g_object_class_override_property (klass, property_id_begin++, "state");
8969 return property_id_begin - 1;
8970}
8971
8972
8973
8974/**
8975 * SensorMatch:
8976 *
8977 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
8978 */
8979
8980/**
8981 * SensorMatchIface:
8982 * @parent_iface: The parent interface.
8983 * @get_match_value: Getter for the #SensorMatch:match-value property.
8984 * @get_state: Getter for the #SensorMatch:state property.
8985 * @sensor_match: Handler for the #SensorMatch::sensor-match signal.
8986 *
8987 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
8988 */
8989
8990typedef SensorMatchIface SensorMatchInterface;
8991G_DEFINE_INTERFACE (SensorMatch, sensor_match, G_TYPE_OBJECT);
8992
8993static void
8994sensor_match_default_init (SensorMatchIface *iface)
8995{
8996 /* GObject signals for received D-Bus signals: */
8997 /**
8998 * SensorMatch::sensor-match:
8999 * @object: A #SensorMatch.
9000 * @arg_state: Argument.
9001 *
9002 * 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.
9003 *
9004 * 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.
9005 */
9006 g_signal_new ("sensor-match",
9007 G_TYPE_FROM_INTERFACE (iface),
9008 G_SIGNAL_RUN_LAST,
9009 G_STRUCT_OFFSET (SensorMatchIface, sensor_match),
9010 NULL,
9011 NULL,
9012 g_cclosure_marshal_generic,
9013 G_TYPE_NONE,
9014 1, G_TYPE_UCHAR);
9015
9016 /* GObject properties for D-Bus properties: */
9017 /**
9018 * SensorMatch:match-value:
9019 *
9020 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link>.
9021 *
9022 * 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.
9023 */
9024 g_object_interface_install_property (iface,
9025 g_param_spec_variant ("match-value", "match_value", "match_value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
9026 /**
9027 * SensorMatch:state:
9028 *
9029 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link>.
9030 *
9031 * 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.
9032 */
9033 g_object_interface_install_property (iface,
9034 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
9035}
9036
9037/**
9038 * sensor_match_get_match_value: (skip)
9039 * @object: A #SensorMatch.
9040 *
9041 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property.
9042 *
9043 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
9044 *
9045 * <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>
9046 *
9047 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
9048 */
9049GVariant *
9050sensor_match_get_match_value (SensorMatch *object)
9051{
9052 return SENSOR_MATCH_GET_IFACE (object)->get_match_value (object);
9053}
9054
9055/**
9056 * sensor_match_dup_match_value: (skip)
9057 * @object: A #SensorMatch.
9058 *
9059 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property.
9060 *
9061 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
9062 *
9063 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
9064 */
9065GVariant *
9066sensor_match_dup_match_value (SensorMatch *object)
9067{
9068 GVariant *value;
9069 g_object_get (G_OBJECT (object), "match-value", &value, NULL);
9070 return value;
9071}
9072
9073/**
9074 * sensor_match_set_match_value: (skip)
9075 * @object: A #SensorMatch.
9076 * @value: The value to set.
9077 *
9078 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property to @value.
9079 *
9080 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
9081 */
9082void
9083sensor_match_set_match_value (SensorMatch *object, GVariant *value)
9084{
9085 g_object_set (G_OBJECT (object), "match-value", value, NULL);
9086}
9087
9088/**
9089 * sensor_match_get_state: (skip)
9090 * @object: A #SensorMatch.
9091 *
9092 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property.
9093 *
9094 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
9095 *
9096 * Returns: The property value.
9097 */
9098guchar
9099sensor_match_get_state (SensorMatch *object)
9100{
9101 return SENSOR_MATCH_GET_IFACE (object)->get_state (object);
9102}
9103
9104/**
9105 * sensor_match_set_state: (skip)
9106 * @object: A #SensorMatch.
9107 * @value: The value to set.
9108 *
9109 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property to @value.
9110 *
9111 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
9112 */
9113void
9114sensor_match_set_state (SensorMatch *object, guchar value)
9115{
9116 g_object_set (G_OBJECT (object), "state", value, NULL);
9117}
9118
9119/**
9120 * sensor_match_emit_sensor_match:
9121 * @object: A #SensorMatch.
9122 * @arg_state: Argument to pass with the signal.
9123 *
9124 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorMatch.SensorMatch">"SensorMatch"</link> D-Bus signal.
9125 */
9126void
9127sensor_match_emit_sensor_match (
9128 SensorMatch *object,
9129 guchar arg_state)
9130{
9131 g_signal_emit_by_name (object, "sensor-match", arg_state);
9132}
9133
9134/* ------------------------------------------------------------------------ */
9135
9136/**
9137 * SensorMatchProxy:
9138 *
9139 * The #SensorMatchProxy structure contains only private data and should only be accessed using the provided API.
9140 */
9141
9142/**
9143 * SensorMatchProxyClass:
9144 * @parent_class: The parent class.
9145 *
9146 * Class structure for #SensorMatchProxy.
9147 */
9148
9149struct _SensorMatchProxyPrivate
9150{
9151 GData *qdata;
9152};
9153
9154static void sensor_match_proxy_iface_init (SensorMatchIface *iface);
9155
9156#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9157G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY,
9158 G_ADD_PRIVATE (SensorMatchProxy)
9159 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init));
9160
9161#else
9162G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY,
9163 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init));
9164
9165#endif
9166static void
9167sensor_match_proxy_finalize (GObject *object)
9168{
9169 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9170 g_datalist_clear (&proxy->priv->qdata);
9171 G_OBJECT_CLASS (sensor_match_proxy_parent_class)->finalize (object);
9172}
9173
9174static void
9175sensor_match_proxy_get_property (GObject *object,
9176 guint prop_id,
9177 GValue *value,
9178 GParamSpec *pspec G_GNUC_UNUSED)
9179{
9180 const _ExtendedGDBusPropertyInfo *info;
9181 GVariant *variant;
9182 g_assert (prop_id != 0 && prop_id - 1 < 2);
9183 info = _sensor_match_property_info_pointers[prop_id - 1];
9184 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
9185 if (info->use_gvariant)
9186 {
9187 g_value_set_variant (value, variant);
9188 }
9189 else
9190 {
9191 if (variant != NULL)
9192 g_dbus_gvariant_to_gvalue (variant, value);
9193 }
9194 if (variant != NULL)
9195 g_variant_unref (variant);
9196}
9197
9198static void
9199sensor_match_proxy_set_property_cb (GDBusProxy *proxy,
9200 GAsyncResult *res,
9201 gpointer user_data)
9202{
9203 const _ExtendedGDBusPropertyInfo *info = user_data;
9204 GError *error;
9205 GVariant *_ret;
9206 error = NULL;
9207 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
9208 if (!_ret)
9209 {
9210 g_warning ("Error setting property '%s' on interface org.openbmc.SensorMatch: %s (%s, %d)",
9211 info->parent_struct.name,
9212 error->message, g_quark_to_string (error->domain), error->code);
9213 g_error_free (error);
9214 }
9215 else
9216 {
9217 g_variant_unref (_ret);
9218 }
9219}
9220
9221static void
9222sensor_match_proxy_set_property (GObject *object,
9223 guint prop_id,
9224 const GValue *value,
9225 GParamSpec *pspec G_GNUC_UNUSED)
9226{
9227 const _ExtendedGDBusPropertyInfo *info;
9228 GVariant *variant;
9229 g_assert (prop_id != 0 && prop_id - 1 < 2);
9230 info = _sensor_match_property_info_pointers[prop_id - 1];
9231 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
9232 g_dbus_proxy_call (G_DBUS_PROXY (object),
9233 "org.freedesktop.DBus.Properties.Set",
9234 g_variant_new ("(ssv)", "org.openbmc.SensorMatch", info->parent_struct.name, variant),
9235 G_DBUS_CALL_FLAGS_NONE,
9236 -1,
9237 NULL, (GAsyncReadyCallback) sensor_match_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
9238 g_variant_unref (variant);
9239}
9240
9241static void
9242sensor_match_proxy_g_signal (GDBusProxy *proxy,
9243 const gchar *sender_name G_GNUC_UNUSED,
9244 const gchar *signal_name,
9245 GVariant *parameters)
9246{
9247 _ExtendedGDBusSignalInfo *info;
9248 GVariantIter iter;
9249 GVariant *child;
9250 GValue *paramv;
9251 guint num_params;
9252 guint n;
9253 guint signal_id;
9254 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, signal_name);
9255 if (info == NULL)
9256 return;
9257 num_params = g_variant_n_children (parameters);
9258 paramv = g_new0 (GValue, num_params + 1);
9259 g_value_init (&paramv[0], TYPE_SENSOR_MATCH);
9260 g_value_set_object (&paramv[0], proxy);
9261 g_variant_iter_init (&iter, parameters);
9262 n = 1;
9263 while ((child = g_variant_iter_next_value (&iter)) != NULL)
9264 {
9265 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
9266 if (arg_info->use_gvariant)
9267 {
9268 g_value_init (&paramv[n], G_TYPE_VARIANT);
9269 g_value_set_variant (&paramv[n], child);
9270 n++;
9271 }
9272 else
9273 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
9274 g_variant_unref (child);
9275 }
9276 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH);
9277 g_signal_emitv (paramv, signal_id, 0, NULL);
9278 for (n = 0; n < num_params + 1; n++)
9279 g_value_unset (&paramv[n]);
9280 g_free (paramv);
9281}
9282
9283static void
9284sensor_match_proxy_g_properties_changed (GDBusProxy *_proxy,
9285 GVariant *changed_properties,
9286 const gchar *const *invalidated_properties)
9287{
9288 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (_proxy);
9289 guint n;
9290 const gchar *key;
9291 GVariantIter *iter;
9292 _ExtendedGDBusPropertyInfo *info;
9293 g_variant_get (changed_properties, "a{sv}", &iter);
9294 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
9295 {
9296 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, key);
9297 g_datalist_remove_data (&proxy->priv->qdata, key);
9298 if (info != NULL)
9299 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
9300 }
9301 g_variant_iter_free (iter);
9302 for (n = 0; invalidated_properties[n] != NULL; n++)
9303 {
9304 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, invalidated_properties[n]);
9305 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
9306 if (info != NULL)
9307 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
9308 }
9309}
9310
9311static GVariant *
9312sensor_match_proxy_get_match_value (SensorMatch *object)
9313{
9314 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9315 GVariant *variant;
9316 GVariant *value = NULL;
9317 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "match_value");
9318 value = variant;
9319 if (variant != NULL)
9320 g_variant_unref (variant);
9321 return value;
9322}
9323
9324static guchar
9325sensor_match_proxy_get_state (SensorMatch *object)
9326{
9327 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9328 GVariant *variant;
9329 guchar value = 0;
9330 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
9331 if (variant != NULL)
9332 {
9333 value = g_variant_get_byte (variant);
9334 g_variant_unref (variant);
9335 }
9336 return value;
9337}
9338
9339static void
9340sensor_match_proxy_init (SensorMatchProxy *proxy)
9341{
9342#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9343 proxy->priv = sensor_match_proxy_get_instance_private (proxy);
9344#else
9345 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_MATCH_PROXY, SensorMatchProxyPrivate);
9346#endif
9347
9348 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_match_interface_info ());
9349}
9350
9351static void
9352sensor_match_proxy_class_init (SensorMatchProxyClass *klass)
9353{
9354 GObjectClass *gobject_class;
9355 GDBusProxyClass *proxy_class;
9356
9357 gobject_class = G_OBJECT_CLASS (klass);
9358 gobject_class->finalize = sensor_match_proxy_finalize;
9359 gobject_class->get_property = sensor_match_proxy_get_property;
9360 gobject_class->set_property = sensor_match_proxy_set_property;
9361
9362 proxy_class = G_DBUS_PROXY_CLASS (klass);
9363 proxy_class->g_signal = sensor_match_proxy_g_signal;
9364 proxy_class->g_properties_changed = sensor_match_proxy_g_properties_changed;
9365
9366 sensor_match_override_properties (gobject_class, 1);
9367
9368#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
9369 g_type_class_add_private (klass, sizeof (SensorMatchProxyPrivate));
9370#endif
9371}
9372
9373static void
9374sensor_match_proxy_iface_init (SensorMatchIface *iface)
9375{
9376 iface->get_match_value = sensor_match_proxy_get_match_value;
9377 iface->get_state = sensor_match_proxy_get_state;
9378}
9379
9380/**
9381 * sensor_match_proxy_new:
9382 * @connection: A #GDBusConnection.
9383 * @flags: Flags from the #GDBusProxyFlags enumeration.
9384 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
9385 * @object_path: An object path.
9386 * @cancellable: (allow-none): A #GCancellable or %NULL.
9387 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
9388 * @user_data: User data to pass to @callback.
9389 *
9390 * 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.
9391 *
9392 * 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.
9393 * You can then call sensor_match_proxy_new_finish() to get the result of the operation.
9394 *
9395 * See sensor_match_proxy_new_sync() for the synchronous, blocking version of this constructor.
9396 */
9397void
9398sensor_match_proxy_new (
9399 GDBusConnection *connection,
9400 GDBusProxyFlags flags,
9401 const gchar *name,
9402 const gchar *object_path,
9403 GCancellable *cancellable,
9404 GAsyncReadyCallback callback,
9405 gpointer user_data)
9406{
9407 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);
9408}
9409
9410/**
9411 * sensor_match_proxy_new_finish:
9412 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new().
9413 * @error: Return location for error or %NULL
9414 *
9415 * Finishes an operation started with sensor_match_proxy_new().
9416 *
9417 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9418 */
9419SensorMatch *
9420sensor_match_proxy_new_finish (
9421 GAsyncResult *res,
9422 GError **error)
9423{
9424 GObject *ret;
9425 GObject *source_object;
9426 source_object = g_async_result_get_source_object (res);
9427 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
9428 g_object_unref (source_object);
9429 if (ret != NULL)
9430 return SENSOR_MATCH (ret);
9431 else
9432 return NULL;
9433}
9434
9435/**
9436 * sensor_match_proxy_new_sync:
9437 * @connection: A #GDBusConnection.
9438 * @flags: Flags from the #GDBusProxyFlags enumeration.
9439 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
9440 * @object_path: An object path.
9441 * @cancellable: (allow-none): A #GCancellable or %NULL.
9442 * @error: Return location for error or %NULL
9443 *
9444 * 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.
9445 *
9446 * The calling thread is blocked until a reply is received.
9447 *
9448 * See sensor_match_proxy_new() for the asynchronous version of this constructor.
9449 *
9450 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9451 */
9452SensorMatch *
9453sensor_match_proxy_new_sync (
9454 GDBusConnection *connection,
9455 GDBusProxyFlags flags,
9456 const gchar *name,
9457 const gchar *object_path,
9458 GCancellable *cancellable,
9459 GError **error)
9460{
9461 GInitable *ret;
9462 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);
9463 if (ret != NULL)
9464 return SENSOR_MATCH (ret);
9465 else
9466 return NULL;
9467}
9468
9469
9470/**
9471 * sensor_match_proxy_new_for_bus:
9472 * @bus_type: A #GBusType.
9473 * @flags: Flags from the #GDBusProxyFlags enumeration.
9474 * @name: A bus name (well-known or unique).
9475 * @object_path: An object path.
9476 * @cancellable: (allow-none): A #GCancellable or %NULL.
9477 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
9478 * @user_data: User data to pass to @callback.
9479 *
9480 * Like sensor_match_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
9481 *
9482 * 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.
9483 * You can then call sensor_match_proxy_new_for_bus_finish() to get the result of the operation.
9484 *
9485 * See sensor_match_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
9486 */
9487void
9488sensor_match_proxy_new_for_bus (
9489 GBusType bus_type,
9490 GDBusProxyFlags flags,
9491 const gchar *name,
9492 const gchar *object_path,
9493 GCancellable *cancellable,
9494 GAsyncReadyCallback callback,
9495 gpointer user_data)
9496{
9497 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);
9498}
9499
9500/**
9501 * sensor_match_proxy_new_for_bus_finish:
9502 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new_for_bus().
9503 * @error: Return location for error or %NULL
9504 *
9505 * Finishes an operation started with sensor_match_proxy_new_for_bus().
9506 *
9507 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9508 */
9509SensorMatch *
9510sensor_match_proxy_new_for_bus_finish (
9511 GAsyncResult *res,
9512 GError **error)
9513{
9514 GObject *ret;
9515 GObject *source_object;
9516 source_object = g_async_result_get_source_object (res);
9517 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
9518 g_object_unref (source_object);
9519 if (ret != NULL)
9520 return SENSOR_MATCH (ret);
9521 else
9522 return NULL;
9523}
9524
9525/**
9526 * sensor_match_proxy_new_for_bus_sync:
9527 * @bus_type: A #GBusType.
9528 * @flags: Flags from the #GDBusProxyFlags enumeration.
9529 * @name: A bus name (well-known or unique).
9530 * @object_path: An object path.
9531 * @cancellable: (allow-none): A #GCancellable or %NULL.
9532 * @error: Return location for error or %NULL
9533 *
9534 * Like sensor_match_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
9535 *
9536 * The calling thread is blocked until a reply is received.
9537 *
9538 * See sensor_match_proxy_new_for_bus() for the asynchronous version of this constructor.
9539 *
9540 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9541 */
9542SensorMatch *
9543sensor_match_proxy_new_for_bus_sync (
9544 GBusType bus_type,
9545 GDBusProxyFlags flags,
9546 const gchar *name,
9547 const gchar *object_path,
9548 GCancellable *cancellable,
9549 GError **error)
9550{
9551 GInitable *ret;
9552 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);
9553 if (ret != NULL)
9554 return SENSOR_MATCH (ret);
9555 else
9556 return NULL;
9557}
9558
9559
9560/* ------------------------------------------------------------------------ */
9561
9562/**
9563 * SensorMatchSkeleton:
9564 *
9565 * The #SensorMatchSkeleton structure contains only private data and should only be accessed using the provided API.
9566 */
9567
9568/**
9569 * SensorMatchSkeletonClass:
9570 * @parent_class: The parent class.
9571 *
9572 * Class structure for #SensorMatchSkeleton.
9573 */
9574
9575struct _SensorMatchSkeletonPrivate
9576{
9577 GValue *properties;
9578 GList *changed_properties;
9579 GSource *changed_properties_idle_source;
9580 GMainContext *context;
9581 GMutex lock;
9582};
9583
9584static void
9585_sensor_match_skeleton_handle_method_call (
9586 GDBusConnection *connection G_GNUC_UNUSED,
9587 const gchar *sender G_GNUC_UNUSED,
9588 const gchar *object_path G_GNUC_UNUSED,
9589 const gchar *interface_name,
9590 const gchar *method_name,
9591 GVariant *parameters,
9592 GDBusMethodInvocation *invocation,
9593 gpointer user_data)
9594{
9595 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9596 _ExtendedGDBusMethodInfo *info;
9597 GVariantIter iter;
9598 GVariant *child;
9599 GValue *paramv;
9600 guint num_params;
9601 guint num_extra;
9602 guint n;
9603 guint signal_id;
9604 GValue return_value = G_VALUE_INIT;
9605 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
9606 g_assert (info != NULL);
9607 num_params = g_variant_n_children (parameters);
9608 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
9609 n = 0;
9610 g_value_init (&paramv[n], TYPE_SENSOR_MATCH);
9611 g_value_set_object (&paramv[n++], skeleton);
9612 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
9613 g_value_set_object (&paramv[n++], invocation);
9614 if (info->pass_fdlist)
9615 {
9616#ifdef G_OS_UNIX
9617 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
9618 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
9619#else
9620 g_assert_not_reached ();
9621#endif
9622 }
9623 g_variant_iter_init (&iter, parameters);
9624 while ((child = g_variant_iter_next_value (&iter)) != NULL)
9625 {
9626 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
9627 if (arg_info->use_gvariant)
9628 {
9629 g_value_init (&paramv[n], G_TYPE_VARIANT);
9630 g_value_set_variant (&paramv[n], child);
9631 n++;
9632 }
9633 else
9634 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
9635 g_variant_unref (child);
9636 }
9637 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH);
9638 g_value_init (&return_value, G_TYPE_BOOLEAN);
9639 g_signal_emitv (paramv, signal_id, 0, &return_value);
9640 if (!g_value_get_boolean (&return_value))
9641 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);
9642 g_value_unset (&return_value);
9643 for (n = 0; n < num_params + num_extra; n++)
9644 g_value_unset (&paramv[n]);
9645 g_free (paramv);
9646}
9647
9648static GVariant *
9649_sensor_match_skeleton_handle_get_property (
9650 GDBusConnection *connection G_GNUC_UNUSED,
9651 const gchar *sender G_GNUC_UNUSED,
9652 const gchar *object_path G_GNUC_UNUSED,
9653 const gchar *interface_name G_GNUC_UNUSED,
9654 const gchar *property_name,
9655 GError **error,
9656 gpointer user_data)
9657{
9658 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9659 GValue value = G_VALUE_INIT;
9660 GParamSpec *pspec;
9661 _ExtendedGDBusPropertyInfo *info;
9662 GVariant *ret;
9663 ret = NULL;
9664 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name);
9665 g_assert (info != NULL);
9666 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
9667 if (pspec == NULL)
9668 {
9669 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
9670 }
9671 else
9672 {
9673 g_value_init (&value, pspec->value_type);
9674 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
9675 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
9676 g_value_unset (&value);
9677 }
9678 return ret;
9679}
9680
9681static gboolean
9682_sensor_match_skeleton_handle_set_property (
9683 GDBusConnection *connection G_GNUC_UNUSED,
9684 const gchar *sender G_GNUC_UNUSED,
9685 const gchar *object_path G_GNUC_UNUSED,
9686 const gchar *interface_name G_GNUC_UNUSED,
9687 const gchar *property_name,
9688 GVariant *variant,
9689 GError **error,
9690 gpointer user_data)
9691{
9692 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9693 GValue value = G_VALUE_INIT;
9694 GParamSpec *pspec;
9695 _ExtendedGDBusPropertyInfo *info;
9696 gboolean ret;
9697 ret = FALSE;
9698 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name);
9699 g_assert (info != NULL);
9700 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
9701 if (pspec == NULL)
9702 {
9703 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
9704 }
9705 else
9706 {
9707 if (info->use_gvariant)
9708 g_value_set_variant (&value, variant);
9709 else
9710 g_dbus_gvariant_to_gvalue (variant, &value);
9711 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
9712 g_value_unset (&value);
9713 ret = TRUE;
9714 }
9715 return ret;
9716}
9717
9718static const GDBusInterfaceVTable _sensor_match_skeleton_vtable =
9719{
9720 _sensor_match_skeleton_handle_method_call,
9721 _sensor_match_skeleton_handle_get_property,
9722 _sensor_match_skeleton_handle_set_property,
9723 {NULL}
9724};
9725
9726static GDBusInterfaceInfo *
9727sensor_match_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
9728{
9729 return sensor_match_interface_info ();
9730}
9731
9732static GDBusInterfaceVTable *
9733sensor_match_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
9734{
9735 return (GDBusInterfaceVTable *) &_sensor_match_skeleton_vtable;
9736}
9737
9738static GVariant *
9739sensor_match_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
9740{
9741 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton);
9742
9743 GVariantBuilder builder;
9744 guint n;
9745 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
9746 if (_sensor_match_interface_info.parent_struct.properties == NULL)
9747 goto out;
9748 for (n = 0; _sensor_match_interface_info.parent_struct.properties[n] != NULL; n++)
9749 {
9750 GDBusPropertyInfo *info = _sensor_match_interface_info.parent_struct.properties[n];
9751 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
9752 {
9753 GVariant *value;
9754 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);
9755 if (value != NULL)
9756 {
9757 g_variant_take_ref (value);
9758 g_variant_builder_add (&builder, "{sv}", info->name, value);
9759 g_variant_unref (value);
9760 }
9761 }
9762 }
9763out:
9764 return g_variant_builder_end (&builder);
9765}
9766
9767static gboolean _sensor_match_emit_changed (gpointer user_data);
9768
9769static void
9770sensor_match_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
9771{
9772 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton);
9773 gboolean emit_changed = FALSE;
9774
9775 g_mutex_lock (&skeleton->priv->lock);
9776 if (skeleton->priv->changed_properties_idle_source != NULL)
9777 {
9778 g_source_destroy (skeleton->priv->changed_properties_idle_source);
9779 skeleton->priv->changed_properties_idle_source = NULL;
9780 emit_changed = TRUE;
9781 }
9782 g_mutex_unlock (&skeleton->priv->lock);
9783
9784 if (emit_changed)
9785 _sensor_match_emit_changed (skeleton);
9786}
9787
9788static void
9789_sensor_match_on_signal_sensor_match (
9790 SensorMatch *object,
9791 guchar arg_state)
9792{
9793 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9794
9795 GList *connections, *l;
9796 GVariant *signal_variant;
9797 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
9798
9799 signal_variant = g_variant_ref_sink (g_variant_new ("(y)",
9800 arg_state));
9801 for (l = connections; l != NULL; l = l->next)
9802 {
9803 GDBusConnection *connection = l->data;
9804 g_dbus_connection_emit_signal (connection,
9805 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorMatch", "SensorMatch",
9806 signal_variant, NULL);
9807 }
9808 g_variant_unref (signal_variant);
9809 g_list_free_full (connections, g_object_unref);
9810}
9811
9812static void sensor_match_skeleton_iface_init (SensorMatchIface *iface);
9813#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9814G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
9815 G_ADD_PRIVATE (SensorMatchSkeleton)
9816 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init));
9817
9818#else
9819G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
9820 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init));
9821
9822#endif
9823static void
9824sensor_match_skeleton_finalize (GObject *object)
9825{
9826 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9827 guint n;
9828 for (n = 0; n < 2; n++)
9829 g_value_unset (&skeleton->priv->properties[n]);
9830 g_free (skeleton->priv->properties);
9831 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
9832 if (skeleton->priv->changed_properties_idle_source != NULL)
9833 g_source_destroy (skeleton->priv->changed_properties_idle_source);
9834 g_main_context_unref (skeleton->priv->context);
9835 g_mutex_clear (&skeleton->priv->lock);
9836 G_OBJECT_CLASS (sensor_match_skeleton_parent_class)->finalize (object);
9837}
9838
9839static void
9840sensor_match_skeleton_get_property (GObject *object,
9841 guint prop_id,
9842 GValue *value,
9843 GParamSpec *pspec G_GNUC_UNUSED)
9844{
9845 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9846 g_assert (prop_id != 0 && prop_id - 1 < 2);
9847 g_mutex_lock (&skeleton->priv->lock);
9848 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
9849 g_mutex_unlock (&skeleton->priv->lock);
9850}
9851
9852static gboolean
9853_sensor_match_emit_changed (gpointer user_data)
9854{
9855 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9856 GList *l;
9857 GVariantBuilder builder;
9858 GVariantBuilder invalidated_builder;
9859 guint num_changes;
9860
9861 g_mutex_lock (&skeleton->priv->lock);
9862 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
9863 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
9864 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
9865 {
9866 ChangedProperty *cp = l->data;
9867 GVariant *variant;
9868 const GValue *cur_value;
9869
9870 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
9871 if (!_g_value_equal (cur_value, &cp->orig_value))
9872 {
9873 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
9874 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
9875 g_variant_unref (variant);
9876 num_changes++;
9877 }
9878 }
9879 if (num_changes > 0)
9880 {
9881 GList *connections, *ll;
9882 GVariant *signal_variant;
9883 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorMatch",
9884 &builder, &invalidated_builder));
9885 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
9886 for (ll = connections; ll != NULL; ll = ll->next)
9887 {
9888 GDBusConnection *connection = ll->data;
9889
9890 g_dbus_connection_emit_signal (connection,
9891 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
9892 "org.freedesktop.DBus.Properties",
9893 "PropertiesChanged",
9894 signal_variant,
9895 NULL);
9896 }
9897 g_variant_unref (signal_variant);
9898 g_list_free_full (connections, g_object_unref);
9899 }
9900 else
9901 {
9902 g_variant_builder_clear (&builder);
9903 g_variant_builder_clear (&invalidated_builder);
9904 }
9905 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
9906 skeleton->priv->changed_properties = NULL;
9907 skeleton->priv->changed_properties_idle_source = NULL;
9908 g_mutex_unlock (&skeleton->priv->lock);
9909 return FALSE;
9910}
9911
9912static void
9913_sensor_match_schedule_emit_changed (SensorMatchSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
9914{
9915 ChangedProperty *cp;
9916 GList *l;
9917 cp = NULL;
9918 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
9919 {
9920 ChangedProperty *i_cp = l->data;
9921 if (i_cp->info == info)
9922 {
9923 cp = i_cp;
9924 break;
9925 }
9926 }
9927 if (cp == NULL)
9928 {
9929 cp = g_new0 (ChangedProperty, 1);
9930 cp->prop_id = prop_id;
9931 cp->info = info;
9932 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
9933 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
9934 g_value_copy (orig_value, &cp->orig_value);
9935 }
9936}
9937
9938static void
9939sensor_match_skeleton_notify (GObject *object,
9940 GParamSpec *pspec G_GNUC_UNUSED)
9941{
9942 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9943 g_mutex_lock (&skeleton->priv->lock);
9944 if (skeleton->priv->changed_properties != NULL &&
9945 skeleton->priv->changed_properties_idle_source == NULL)
9946 {
9947 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
9948 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
9949 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_match_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
9950 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
9951 g_source_unref (skeleton->priv->changed_properties_idle_source);
9952 }
9953 g_mutex_unlock (&skeleton->priv->lock);
9954}
9955
9956static void
9957sensor_match_skeleton_set_property (GObject *object,
9958 guint prop_id,
9959 const GValue *value,
9960 GParamSpec *pspec)
9961{
9962 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9963 g_assert (prop_id != 0 && prop_id - 1 < 2);
9964 g_mutex_lock (&skeleton->priv->lock);
9965 g_object_freeze_notify (object);
9966 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
9967 {
9968 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
9969 _sensor_match_schedule_emit_changed (skeleton, _sensor_match_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
9970 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
9971 g_object_notify_by_pspec (object, pspec);
9972 }
9973 g_mutex_unlock (&skeleton->priv->lock);
9974 g_object_thaw_notify (object);
9975}
9976
9977static void
9978sensor_match_skeleton_init (SensorMatchSkeleton *skeleton)
9979{
9980#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9981 skeleton->priv = sensor_match_skeleton_get_instance_private (skeleton);
9982#else
9983 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_MATCH_SKELETON, SensorMatchSkeletonPrivate);
9984#endif
9985
9986 g_mutex_init (&skeleton->priv->lock);
9987 skeleton->priv->context = g_main_context_ref_thread_default ();
9988 skeleton->priv->properties = g_new0 (GValue, 2);
9989 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
9990 g_value_init (&skeleton->priv->properties[1], G_TYPE_UCHAR);
9991}
9992
9993static GVariant *
9994sensor_match_skeleton_get_match_value (SensorMatch *object)
9995{
9996 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9997 GVariant *value;
9998 g_mutex_lock (&skeleton->priv->lock);
9999 value = g_value_get_variant (&(skeleton->priv->properties[0]));
10000 g_mutex_unlock (&skeleton->priv->lock);
10001 return value;
10002}
10003
10004static guchar
10005sensor_match_skeleton_get_state (SensorMatch *object)
10006{
10007 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10008 guchar value;
10009 g_mutex_lock (&skeleton->priv->lock);
10010 value = g_value_get_uchar (&(skeleton->priv->properties[1]));
10011 g_mutex_unlock (&skeleton->priv->lock);
10012 return value;
10013}
10014
10015static void
10016sensor_match_skeleton_class_init (SensorMatchSkeletonClass *klass)
10017{
10018 GObjectClass *gobject_class;
10019 GDBusInterfaceSkeletonClass *skeleton_class;
10020
10021 gobject_class = G_OBJECT_CLASS (klass);
10022 gobject_class->finalize = sensor_match_skeleton_finalize;
10023 gobject_class->get_property = sensor_match_skeleton_get_property;
10024 gobject_class->set_property = sensor_match_skeleton_set_property;
10025 gobject_class->notify = sensor_match_skeleton_notify;
10026
10027
10028 sensor_match_override_properties (gobject_class, 1);
10029
10030 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
10031 skeleton_class->get_info = sensor_match_skeleton_dbus_interface_get_info;
10032 skeleton_class->get_properties = sensor_match_skeleton_dbus_interface_get_properties;
10033 skeleton_class->flush = sensor_match_skeleton_dbus_interface_flush;
10034 skeleton_class->get_vtable = sensor_match_skeleton_dbus_interface_get_vtable;
10035
10036#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
10037 g_type_class_add_private (klass, sizeof (SensorMatchSkeletonPrivate));
10038#endif
10039}
10040
10041static void
10042sensor_match_skeleton_iface_init (SensorMatchIface *iface)
10043{
10044 iface->sensor_match = _sensor_match_on_signal_sensor_match;
10045 iface->get_match_value = sensor_match_skeleton_get_match_value;
10046 iface->get_state = sensor_match_skeleton_get_state;
10047}
10048
10049/**
10050 * sensor_match_skeleton_new:
10051 *
10052 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
10053 *
10054 * Returns: (transfer full) (type SensorMatchSkeleton): The skeleton object.
10055 */
10056SensorMatch *
10057sensor_match_skeleton_new (void)
10058{
10059 return SENSOR_MATCH (g_object_new (TYPE_SENSOR_MATCH_SKELETON, NULL));
10060}
10061
10062/* ------------------------------------------------------------------------
10063 * Code for interface org.openbmc.Process
10064 * ------------------------------------------------------------------------
10065 */
10066
10067/**
10068 * SECTION:Process
10069 * @title: Process
10070 * @short_description: Generated C code for the org.openbmc.Process D-Bus interface
10071 *
10072 * 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.
10073 */
10074
10075/* ---- Introspection data for org.openbmc.Process ---- */
10076
10077static const _ExtendedGDBusMethodInfo _process_method_info_stop =
10078{
10079 {
10080 -1,
10081 (gchar *) "stop",
10082 NULL,
10083 NULL,
10084 NULL
10085 },
10086 "handle-stop",
10087 FALSE
10088};
10089
10090static const _ExtendedGDBusMethodInfo * const _process_method_info_pointers[] =
10091{
10092 &_process_method_info_stop,
10093 NULL
10094};
10095
10096static const _ExtendedGDBusInterfaceInfo _process_interface_info =
10097{
10098 {
10099 -1,
10100 (gchar *) "org.openbmc.Process",
10101 (GDBusMethodInfo **) &_process_method_info_pointers,
10102 NULL,
10103 NULL,
10104 NULL
10105 },
10106 "process",
10107};
10108
10109
10110/**
10111 * process_interface_info:
10112 *
10113 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> D-Bus interface.
10114 *
10115 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
10116 */
10117GDBusInterfaceInfo *
10118process_interface_info (void)
10119{
10120 return (GDBusInterfaceInfo *) &_process_interface_info.parent_struct;
10121}
10122
10123/**
10124 * process_override_properties:
10125 * @klass: The class structure for a #GObject<!-- -->-derived class.
10126 * @property_id_begin: The property id to assign to the first overridden property.
10127 *
10128 * Overrides all #GObject properties in the #Process interface for a concrete class.
10129 * The properties are overridden in the order they are defined.
10130 *
10131 * Returns: The last property id.
10132 */
10133guint
10134process_override_properties (GObjectClass *klass, guint property_id_begin)
10135{
10136 return property_id_begin - 1;
10137}
10138
10139
10140
10141/**
10142 * Process:
10143 *
10144 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
10145 */
10146
10147/**
10148 * ProcessIface:
10149 * @parent_iface: The parent interface.
10150 * @handle_stop: Handler for the #Process::handle-stop signal.
10151 *
10152 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
10153 */
10154
10155typedef ProcessIface ProcessInterface;
10156G_DEFINE_INTERFACE (Process, process, G_TYPE_OBJECT);
10157
10158static void
10159process_default_init (ProcessIface *iface)
10160{
10161 /* GObject signals for incoming D-Bus method calls: */
10162 /**
10163 * Process::handle-stop:
10164 * @object: A #Process.
10165 * @invocation: A #GDBusMethodInvocation.
10166 *
10167 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method.
10168 *
10169 * 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.
10170 *
10171 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
10172 */
10173 g_signal_new ("handle-stop",
10174 G_TYPE_FROM_INTERFACE (iface),
10175 G_SIGNAL_RUN_LAST,
10176 G_STRUCT_OFFSET (ProcessIface, handle_stop),
10177 g_signal_accumulator_true_handled,
10178 NULL,
10179 g_cclosure_marshal_generic,
10180 G_TYPE_BOOLEAN,
10181 1,
10182 G_TYPE_DBUS_METHOD_INVOCATION);
10183
10184}
10185
10186/**
10187 * process_call_stop:
10188 * @proxy: A #ProcessProxy.
10189 * @cancellable: (allow-none): A #GCancellable or %NULL.
10190 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
10191 * @user_data: User data to pass to @callback.
10192 *
10193 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method on @proxy.
10194 * 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.
10195 * You can then call process_call_stop_finish() to get the result of the operation.
10196 *
10197 * See process_call_stop_sync() for the synchronous, blocking version of this method.
10198 */
10199void
10200process_call_stop (
10201 Process *proxy,
10202 GCancellable *cancellable,
10203 GAsyncReadyCallback callback,
10204 gpointer user_data)
10205{
10206 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
10207 "stop",
10208 g_variant_new ("()"),
10209 G_DBUS_CALL_FLAGS_NONE,
10210 -1,
10211 cancellable,
10212 callback,
10213 user_data);
10214}
10215
10216/**
10217 * process_call_stop_finish:
10218 * @proxy: A #ProcessProxy.
10219 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_call_stop().
10220 * @error: Return location for error or %NULL.
10221 *
10222 * Finishes an operation started with process_call_stop().
10223 *
10224 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
10225 */
10226gboolean
10227process_call_stop_finish (
10228 Process *proxy,
10229 GAsyncResult *res,
10230 GError **error)
10231{
10232 GVariant *_ret;
10233 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
10234 if (_ret == NULL)
10235 goto _out;
10236 g_variant_get (_ret,
10237 "()");
10238 g_variant_unref (_ret);
10239_out:
10240 return _ret != NULL;
10241}
10242
10243/**
10244 * process_call_stop_sync:
10245 * @proxy: A #ProcessProxy.
10246 * @cancellable: (allow-none): A #GCancellable or %NULL.
10247 * @error: Return location for error or %NULL.
10248 *
10249 * 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.
10250 *
10251 * See process_call_stop() for the asynchronous version of this method.
10252 *
10253 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
10254 */
10255gboolean
10256process_call_stop_sync (
10257 Process *proxy,
10258 GCancellable *cancellable,
10259 GError **error)
10260{
10261 GVariant *_ret;
10262 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
10263 "stop",
10264 g_variant_new ("()"),
10265 G_DBUS_CALL_FLAGS_NONE,
10266 -1,
10267 cancellable,
10268 error);
10269 if (_ret == NULL)
10270 goto _out;
10271 g_variant_get (_ret,
10272 "()");
10273 g_variant_unref (_ret);
10274_out:
10275 return _ret != NULL;
10276}
10277
10278/**
10279 * process_complete_stop:
10280 * @object: A #Process.
10281 * @invocation: (transfer full): A #GDBusMethodInvocation.
10282 *
10283 * 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.
10284 *
10285 * This method will free @invocation, you cannot use it afterwards.
10286 */
10287void
10288process_complete_stop (
10289 Process *object,
10290 GDBusMethodInvocation *invocation)
10291{
10292 g_dbus_method_invocation_return_value (invocation,
10293 g_variant_new ("()"));
10294}
10295
10296/* ------------------------------------------------------------------------ */
10297
10298/**
10299 * ProcessProxy:
10300 *
10301 * The #ProcessProxy structure contains only private data and should only be accessed using the provided API.
10302 */
10303
10304/**
10305 * ProcessProxyClass:
10306 * @parent_class: The parent class.
10307 *
10308 * Class structure for #ProcessProxy.
10309 */
10310
10311struct _ProcessProxyPrivate
10312{
10313 GData *qdata;
10314};
10315
10316static void process_proxy_iface_init (ProcessIface *iface);
10317
10318#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10319G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY,
10320 G_ADD_PRIVATE (ProcessProxy)
10321 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init));
10322
10323#else
10324G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY,
10325 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init));
10326
10327#endif
10328static void
10329process_proxy_finalize (GObject *object)
10330{
10331 ProcessProxy *proxy = PROCESS_PROXY (object);
10332 g_datalist_clear (&proxy->priv->qdata);
10333 G_OBJECT_CLASS (process_proxy_parent_class)->finalize (object);
10334}
10335
10336static void
10337process_proxy_get_property (GObject *object,
10338 guint prop_id,
10339 GValue *value,
10340 GParamSpec *pspec G_GNUC_UNUSED)
10341{
10342}
10343
10344static void
10345process_proxy_set_property (GObject *object,
10346 guint prop_id,
10347 const GValue *value,
10348 GParamSpec *pspec G_GNUC_UNUSED)
10349{
10350}
10351
10352static void
10353process_proxy_g_signal (GDBusProxy *proxy,
10354 const gchar *sender_name G_GNUC_UNUSED,
10355 const gchar *signal_name,
10356 GVariant *parameters)
10357{
10358 _ExtendedGDBusSignalInfo *info;
10359 GVariantIter iter;
10360 GVariant *child;
10361 GValue *paramv;
10362 guint num_params;
10363 guint n;
10364 guint signal_id;
10365 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, signal_name);
10366 if (info == NULL)
10367 return;
10368 num_params = g_variant_n_children (parameters);
10369 paramv = g_new0 (GValue, num_params + 1);
10370 g_value_init (&paramv[0], TYPE_PROCESS);
10371 g_value_set_object (&paramv[0], proxy);
10372 g_variant_iter_init (&iter, parameters);
10373 n = 1;
10374 while ((child = g_variant_iter_next_value (&iter)) != NULL)
10375 {
10376 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
10377 if (arg_info->use_gvariant)
10378 {
10379 g_value_init (&paramv[n], G_TYPE_VARIANT);
10380 g_value_set_variant (&paramv[n], child);
10381 n++;
10382 }
10383 else
10384 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
10385 g_variant_unref (child);
10386 }
10387 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS);
10388 g_signal_emitv (paramv, signal_id, 0, NULL);
10389 for (n = 0; n < num_params + 1; n++)
10390 g_value_unset (&paramv[n]);
10391 g_free (paramv);
10392}
10393
10394static void
10395process_proxy_g_properties_changed (GDBusProxy *_proxy,
10396 GVariant *changed_properties,
10397 const gchar *const *invalidated_properties)
10398{
10399 ProcessProxy *proxy = PROCESS_PROXY (_proxy);
10400 guint n;
10401 const gchar *key;
10402 GVariantIter *iter;
10403 _ExtendedGDBusPropertyInfo *info;
10404 g_variant_get (changed_properties, "a{sv}", &iter);
10405 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
10406 {
10407 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, key);
10408 g_datalist_remove_data (&proxy->priv->qdata, key);
10409 if (info != NULL)
10410 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
10411 }
10412 g_variant_iter_free (iter);
10413 for (n = 0; invalidated_properties[n] != NULL; n++)
10414 {
10415 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, invalidated_properties[n]);
10416 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
10417 if (info != NULL)
10418 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
10419 }
10420}
10421
10422static void
10423process_proxy_init (ProcessProxy *proxy)
10424{
10425#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10426 proxy->priv = process_proxy_get_instance_private (proxy);
10427#else
10428 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_PROCESS_PROXY, ProcessProxyPrivate);
10429#endif
10430
10431 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), process_interface_info ());
10432}
10433
10434static void
10435process_proxy_class_init (ProcessProxyClass *klass)
10436{
10437 GObjectClass *gobject_class;
10438 GDBusProxyClass *proxy_class;
10439
10440 gobject_class = G_OBJECT_CLASS (klass);
10441 gobject_class->finalize = process_proxy_finalize;
10442 gobject_class->get_property = process_proxy_get_property;
10443 gobject_class->set_property = process_proxy_set_property;
10444
10445 proxy_class = G_DBUS_PROXY_CLASS (klass);
10446 proxy_class->g_signal = process_proxy_g_signal;
10447 proxy_class->g_properties_changed = process_proxy_g_properties_changed;
10448
10449#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
10450 g_type_class_add_private (klass, sizeof (ProcessProxyPrivate));
10451#endif
10452}
10453
10454static void
10455process_proxy_iface_init (ProcessIface *iface)
10456{
10457}
10458
10459/**
10460 * process_proxy_new:
10461 * @connection: A #GDBusConnection.
10462 * @flags: Flags from the #GDBusProxyFlags enumeration.
10463 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
10464 * @object_path: An object path.
10465 * @cancellable: (allow-none): A #GCancellable or %NULL.
10466 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
10467 * @user_data: User data to pass to @callback.
10468 *
10469 * 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.
10470 *
10471 * 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.
10472 * You can then call process_proxy_new_finish() to get the result of the operation.
10473 *
10474 * See process_proxy_new_sync() for the synchronous, blocking version of this constructor.
10475 */
10476void
10477process_proxy_new (
10478 GDBusConnection *connection,
10479 GDBusProxyFlags flags,
10480 const gchar *name,
10481 const gchar *object_path,
10482 GCancellable *cancellable,
10483 GAsyncReadyCallback callback,
10484 gpointer user_data)
10485{
10486 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);
10487}
10488
10489/**
10490 * process_proxy_new_finish:
10491 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new().
10492 * @error: Return location for error or %NULL
10493 *
10494 * Finishes an operation started with process_proxy_new().
10495 *
10496 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10497 */
10498Process *
10499process_proxy_new_finish (
10500 GAsyncResult *res,
10501 GError **error)
10502{
10503 GObject *ret;
10504 GObject *source_object;
10505 source_object = g_async_result_get_source_object (res);
10506 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
10507 g_object_unref (source_object);
10508 if (ret != NULL)
10509 return PROCESS (ret);
10510 else
10511 return NULL;
10512}
10513
10514/**
10515 * process_proxy_new_sync:
10516 * @connection: A #GDBusConnection.
10517 * @flags: Flags from the #GDBusProxyFlags enumeration.
10518 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
10519 * @object_path: An object path.
10520 * @cancellable: (allow-none): A #GCancellable or %NULL.
10521 * @error: Return location for error or %NULL
10522 *
10523 * 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.
10524 *
10525 * The calling thread is blocked until a reply is received.
10526 *
10527 * See process_proxy_new() for the asynchronous version of this constructor.
10528 *
10529 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10530 */
10531Process *
10532process_proxy_new_sync (
10533 GDBusConnection *connection,
10534 GDBusProxyFlags flags,
10535 const gchar *name,
10536 const gchar *object_path,
10537 GCancellable *cancellable,
10538 GError **error)
10539{
10540 GInitable *ret;
10541 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);
10542 if (ret != NULL)
10543 return PROCESS (ret);
10544 else
10545 return NULL;
10546}
10547
10548
10549/**
10550 * process_proxy_new_for_bus:
10551 * @bus_type: A #GBusType.
10552 * @flags: Flags from the #GDBusProxyFlags enumeration.
10553 * @name: A bus name (well-known or unique).
10554 * @object_path: An object path.
10555 * @cancellable: (allow-none): A #GCancellable or %NULL.
10556 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
10557 * @user_data: User data to pass to @callback.
10558 *
10559 * Like process_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
10560 *
10561 * 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.
10562 * You can then call process_proxy_new_for_bus_finish() to get the result of the operation.
10563 *
10564 * See process_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
10565 */
10566void
10567process_proxy_new_for_bus (
10568 GBusType bus_type,
10569 GDBusProxyFlags flags,
10570 const gchar *name,
10571 const gchar *object_path,
10572 GCancellable *cancellable,
10573 GAsyncReadyCallback callback,
10574 gpointer user_data)
10575{
10576 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);
10577}
10578
10579/**
10580 * process_proxy_new_for_bus_finish:
10581 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new_for_bus().
10582 * @error: Return location for error or %NULL
10583 *
10584 * Finishes an operation started with process_proxy_new_for_bus().
10585 *
10586 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10587 */
10588Process *
10589process_proxy_new_for_bus_finish (
10590 GAsyncResult *res,
10591 GError **error)
10592{
10593 GObject *ret;
10594 GObject *source_object;
10595 source_object = g_async_result_get_source_object (res);
10596 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
10597 g_object_unref (source_object);
10598 if (ret != NULL)
10599 return PROCESS (ret);
10600 else
10601 return NULL;
10602}
10603
10604/**
10605 * process_proxy_new_for_bus_sync:
10606 * @bus_type: A #GBusType.
10607 * @flags: Flags from the #GDBusProxyFlags enumeration.
10608 * @name: A bus name (well-known or unique).
10609 * @object_path: An object path.
10610 * @cancellable: (allow-none): A #GCancellable or %NULL.
10611 * @error: Return location for error or %NULL
10612 *
10613 * Like process_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
10614 *
10615 * The calling thread is blocked until a reply is received.
10616 *
10617 * See process_proxy_new_for_bus() for the asynchronous version of this constructor.
10618 *
10619 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10620 */
10621Process *
10622process_proxy_new_for_bus_sync (
10623 GBusType bus_type,
10624 GDBusProxyFlags flags,
10625 const gchar *name,
10626 const gchar *object_path,
10627 GCancellable *cancellable,
10628 GError **error)
10629{
10630 GInitable *ret;
10631 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);
10632 if (ret != NULL)
10633 return PROCESS (ret);
10634 else
10635 return NULL;
10636}
10637
10638
10639/* ------------------------------------------------------------------------ */
10640
10641/**
10642 * ProcessSkeleton:
10643 *
10644 * The #ProcessSkeleton structure contains only private data and should only be accessed using the provided API.
10645 */
10646
10647/**
10648 * ProcessSkeletonClass:
10649 * @parent_class: The parent class.
10650 *
10651 * Class structure for #ProcessSkeleton.
10652 */
10653
10654struct _ProcessSkeletonPrivate
10655{
10656 GValue *properties;
10657 GList *changed_properties;
10658 GSource *changed_properties_idle_source;
10659 GMainContext *context;
10660 GMutex lock;
10661};
10662
10663static void
10664_process_skeleton_handle_method_call (
10665 GDBusConnection *connection G_GNUC_UNUSED,
10666 const gchar *sender G_GNUC_UNUSED,
10667 const gchar *object_path G_GNUC_UNUSED,
10668 const gchar *interface_name,
10669 const gchar *method_name,
10670 GVariant *parameters,
10671 GDBusMethodInvocation *invocation,
10672 gpointer user_data)
10673{
10674 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
10675 _ExtendedGDBusMethodInfo *info;
10676 GVariantIter iter;
10677 GVariant *child;
10678 GValue *paramv;
10679 guint num_params;
10680 guint num_extra;
10681 guint n;
10682 guint signal_id;
10683 GValue return_value = G_VALUE_INIT;
10684 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
10685 g_assert (info != NULL);
10686 num_params = g_variant_n_children (parameters);
10687 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
10688 n = 0;
10689 g_value_init (&paramv[n], TYPE_PROCESS);
10690 g_value_set_object (&paramv[n++], skeleton);
10691 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
10692 g_value_set_object (&paramv[n++], invocation);
10693 if (info->pass_fdlist)
10694 {
10695#ifdef G_OS_UNIX
10696 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
10697 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
10698#else
10699 g_assert_not_reached ();
10700#endif
10701 }
10702 g_variant_iter_init (&iter, parameters);
10703 while ((child = g_variant_iter_next_value (&iter)) != NULL)
10704 {
10705 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
10706 if (arg_info->use_gvariant)
10707 {
10708 g_value_init (&paramv[n], G_TYPE_VARIANT);
10709 g_value_set_variant (&paramv[n], child);
10710 n++;
10711 }
10712 else
10713 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
10714 g_variant_unref (child);
10715 }
10716 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS);
10717 g_value_init (&return_value, G_TYPE_BOOLEAN);
10718 g_signal_emitv (paramv, signal_id, 0, &return_value);
10719 if (!g_value_get_boolean (&return_value))
10720 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);
10721 g_value_unset (&return_value);
10722 for (n = 0; n < num_params + num_extra; n++)
10723 g_value_unset (&paramv[n]);
10724 g_free (paramv);
10725}
10726
10727static GVariant *
10728_process_skeleton_handle_get_property (
10729 GDBusConnection *connection G_GNUC_UNUSED,
10730 const gchar *sender G_GNUC_UNUSED,
10731 const gchar *object_path G_GNUC_UNUSED,
10732 const gchar *interface_name G_GNUC_UNUSED,
10733 const gchar *property_name,
10734 GError **error,
10735 gpointer user_data)
10736{
10737 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
10738 GValue value = G_VALUE_INIT;
10739 GParamSpec *pspec;
10740 _ExtendedGDBusPropertyInfo *info;
10741 GVariant *ret;
10742 ret = NULL;
10743 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name);
10744 g_assert (info != NULL);
10745 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
10746 if (pspec == NULL)
10747 {
10748 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
10749 }
10750 else
10751 {
10752 g_value_init (&value, pspec->value_type);
10753 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
10754 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
10755 g_value_unset (&value);
10756 }
10757 return ret;
10758}
10759
10760static gboolean
10761_process_skeleton_handle_set_property (
10762 GDBusConnection *connection G_GNUC_UNUSED,
10763 const gchar *sender G_GNUC_UNUSED,
10764 const gchar *object_path G_GNUC_UNUSED,
10765 const gchar *interface_name G_GNUC_UNUSED,
10766 const gchar *property_name,
10767 GVariant *variant,
10768 GError **error,
10769 gpointer user_data)
10770{
10771 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
10772 GValue value = G_VALUE_INIT;
10773 GParamSpec *pspec;
10774 _ExtendedGDBusPropertyInfo *info;
10775 gboolean ret;
10776 ret = FALSE;
10777 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name);
10778 g_assert (info != NULL);
10779 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
10780 if (pspec == NULL)
10781 {
10782 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
10783 }
10784 else
10785 {
10786 if (info->use_gvariant)
10787 g_value_set_variant (&value, variant);
10788 else
10789 g_dbus_gvariant_to_gvalue (variant, &value);
10790 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
10791 g_value_unset (&value);
10792 ret = TRUE;
10793 }
10794 return ret;
10795}
10796
10797static const GDBusInterfaceVTable _process_skeleton_vtable =
10798{
10799 _process_skeleton_handle_method_call,
10800 _process_skeleton_handle_get_property,
10801 _process_skeleton_handle_set_property,
10802 {NULL}
10803};
10804
10805static GDBusInterfaceInfo *
10806process_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
10807{
10808 return process_interface_info ();
10809}
10810
10811static GDBusInterfaceVTable *
10812process_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
10813{
10814 return (GDBusInterfaceVTable *) &_process_skeleton_vtable;
10815}
10816
10817static GVariant *
10818process_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
10819{
10820 ProcessSkeleton *skeleton = PROCESS_SKELETON (_skeleton);
10821
10822 GVariantBuilder builder;
10823 guint n;
10824 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
10825 if (_process_interface_info.parent_struct.properties == NULL)
10826 goto out;
10827 for (n = 0; _process_interface_info.parent_struct.properties[n] != NULL; n++)
10828 {
10829 GDBusPropertyInfo *info = _process_interface_info.parent_struct.properties[n];
10830 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
10831 {
10832 GVariant *value;
10833 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);
10834 if (value != NULL)
10835 {
10836 g_variant_take_ref (value);
10837 g_variant_builder_add (&builder, "{sv}", info->name, value);
10838 g_variant_unref (value);
10839 }
10840 }
10841 }
10842out:
10843 return g_variant_builder_end (&builder);
10844}
10845
10846static void
10847process_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
10848{
10849}
10850
10851static void process_skeleton_iface_init (ProcessIface *iface);
10852#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10853G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
10854 G_ADD_PRIVATE (ProcessSkeleton)
10855 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init));
10856
10857#else
10858G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
10859 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init));
10860
10861#endif
10862static void
10863process_skeleton_finalize (GObject *object)
10864{
10865 ProcessSkeleton *skeleton = PROCESS_SKELETON (object);
10866 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
10867 if (skeleton->priv->changed_properties_idle_source != NULL)
10868 g_source_destroy (skeleton->priv->changed_properties_idle_source);
10869 g_main_context_unref (skeleton->priv->context);
10870 g_mutex_clear (&skeleton->priv->lock);
10871 G_OBJECT_CLASS (process_skeleton_parent_class)->finalize (object);
10872}
10873
10874static void
10875process_skeleton_init (ProcessSkeleton *skeleton)
10876{
10877#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10878 skeleton->priv = process_skeleton_get_instance_private (skeleton);
10879#else
10880 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_PROCESS_SKELETON, ProcessSkeletonPrivate);
10881#endif
10882
10883 g_mutex_init (&skeleton->priv->lock);
10884 skeleton->priv->context = g_main_context_ref_thread_default ();
10885}
10886
10887static void
10888process_skeleton_class_init (ProcessSkeletonClass *klass)
10889{
10890 GObjectClass *gobject_class;
10891 GDBusInterfaceSkeletonClass *skeleton_class;
10892
10893 gobject_class = G_OBJECT_CLASS (klass);
10894 gobject_class->finalize = process_skeleton_finalize;
10895
10896 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
10897 skeleton_class->get_info = process_skeleton_dbus_interface_get_info;
10898 skeleton_class->get_properties = process_skeleton_dbus_interface_get_properties;
10899 skeleton_class->flush = process_skeleton_dbus_interface_flush;
10900 skeleton_class->get_vtable = process_skeleton_dbus_interface_get_vtable;
10901
10902#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
10903 g_type_class_add_private (klass, sizeof (ProcessSkeletonPrivate));
10904#endif
10905}
10906
10907static void
10908process_skeleton_iface_init (ProcessIface *iface)
10909{
10910}
10911
10912/**
10913 * process_skeleton_new:
10914 *
10915 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
10916 *
10917 * Returns: (transfer full) (type ProcessSkeleton): The skeleton object.
10918 */
10919Process *
10920process_skeleton_new (void)
10921{
10922 return PROCESS (g_object_new (TYPE_PROCESS_SKELETON, NULL));
10923}
10924
10925/* ------------------------------------------------------------------------
10926 * Code for interface org.openbmc.Control
10927 * ------------------------------------------------------------------------
10928 */
10929
10930/**
10931 * SECTION:Control
10932 * @title: Control
10933 * @short_description: Generated C code for the org.openbmc.Control D-Bus interface
10934 *
10935 * 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.
10936 */
10937
10938/* ---- Introspection data for org.openbmc.Control ---- */
10939
10940static const _ExtendedGDBusMethodInfo _control_method_info_init =
10941{
10942 {
10943 -1,
10944 (gchar *) "init",
10945 NULL,
10946 NULL,
10947 NULL
10948 },
10949 "handle-init",
10950 FALSE
10951};
10952
10953static const _ExtendedGDBusMethodInfo * const _control_method_info_pointers[] =
10954{
10955 &_control_method_info_init,
10956 NULL
10957};
10958
10959static const _ExtendedGDBusArgInfo _control_signal_info_heartbeat_ARG_bus_name =
10960{
10961 {
10962 -1,
10963 (gchar *) "bus_name",
10964 (gchar *) "s",
10965 NULL
10966 },
10967 FALSE
10968};
10969
10970static const _ExtendedGDBusArgInfo * const _control_signal_info_heartbeat_ARG_pointers[] =
10971{
10972 &_control_signal_info_heartbeat_ARG_bus_name,
10973 NULL
10974};
10975
10976static const _ExtendedGDBusSignalInfo _control_signal_info_heartbeat =
10977{
10978 {
10979 -1,
10980 (gchar *) "Heartbeat",
10981 (GDBusArgInfo **) &_control_signal_info_heartbeat_ARG_pointers,
10982 NULL
10983 },
10984 "heartbeat"
10985};
10986
10987static const _ExtendedGDBusArgInfo _control_signal_info_goto_system_state_ARG_state_name =
10988{
10989 {
10990 -1,
10991 (gchar *) "state_name",
10992 (gchar *) "s",
10993 NULL
10994 },
10995 FALSE
10996};
10997
10998static const _ExtendedGDBusArgInfo * const _control_signal_info_goto_system_state_ARG_pointers[] =
10999{
11000 &_control_signal_info_goto_system_state_ARG_state_name,
11001 NULL
11002};
11003
11004static const _ExtendedGDBusSignalInfo _control_signal_info_goto_system_state =
11005{
11006 {
11007 -1,
11008 (gchar *) "GotoSystemState",
11009 (GDBusArgInfo **) &_control_signal_info_goto_system_state_ARG_pointers,
11010 NULL
11011 },
11012 "goto-system-state"
11013};
11014
11015static const _ExtendedGDBusSignalInfo * const _control_signal_info_pointers[] =
11016{
11017 &_control_signal_info_heartbeat,
11018 &_control_signal_info_goto_system_state,
11019 NULL
11020};
11021
11022static const _ExtendedGDBusPropertyInfo _control_property_info_poll_interval =
11023{
11024 {
11025 -1,
11026 (gchar *) "poll_interval",
11027 (gchar *) "i",
11028 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
11029 NULL
11030 },
11031 "poll-interval",
11032 FALSE
11033};
11034
11035static const _ExtendedGDBusPropertyInfo _control_property_info_heatbeat =
11036{
11037 {
11038 -1,
11039 (gchar *) "heatbeat",
11040 (gchar *) "i",
11041 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
11042 NULL
11043 },
11044 "heatbeat",
11045 FALSE
11046};
11047
11048static const _ExtendedGDBusPropertyInfo * const _control_property_info_pointers[] =
11049{
11050 &_control_property_info_poll_interval,
11051 &_control_property_info_heatbeat,
11052 NULL
11053};
11054
11055static const _ExtendedGDBusInterfaceInfo _control_interface_info =
11056{
11057 {
11058 -1,
11059 (gchar *) "org.openbmc.Control",
11060 (GDBusMethodInfo **) &_control_method_info_pointers,
11061 (GDBusSignalInfo **) &_control_signal_info_pointers,
11062 (GDBusPropertyInfo **) &_control_property_info_pointers,
11063 NULL
11064 },
11065 "control",
11066};
11067
11068
11069/**
11070 * control_interface_info:
11071 *
11072 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> D-Bus interface.
11073 *
11074 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
11075 */
11076GDBusInterfaceInfo *
11077control_interface_info (void)
11078{
11079 return (GDBusInterfaceInfo *) &_control_interface_info.parent_struct;
11080}
11081
11082/**
11083 * control_override_properties:
11084 * @klass: The class structure for a #GObject<!-- -->-derived class.
11085 * @property_id_begin: The property id to assign to the first overridden property.
11086 *
11087 * Overrides all #GObject properties in the #Control interface for a concrete class.
11088 * The properties are overridden in the order they are defined.
11089 *
11090 * Returns: The last property id.
11091 */
11092guint
11093control_override_properties (GObjectClass *klass, guint property_id_begin)
11094{
11095 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
11096 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
11097 return property_id_begin - 1;
11098}
11099
11100
11101
11102/**
11103 * Control:
11104 *
11105 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
11106 */
11107
11108/**
11109 * ControlIface:
11110 * @parent_iface: The parent interface.
11111 * @handle_init: Handler for the #Control::handle-init signal.
11112 * @get_heatbeat: Getter for the #Control:heatbeat property.
11113 * @get_poll_interval: Getter for the #Control:poll-interval property.
11114 * @goto_system_state: Handler for the #Control::goto-system-state signal.
11115 * @heartbeat: Handler for the #Control::heartbeat signal.
11116 *
11117 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
11118 */
11119
11120typedef ControlIface ControlInterface;
11121G_DEFINE_INTERFACE (Control, control, G_TYPE_OBJECT);
11122
11123static void
11124control_default_init (ControlIface *iface)
11125{
11126 /* GObject signals for incoming D-Bus method calls: */
11127 /**
11128 * Control::handle-init:
11129 * @object: A #Control.
11130 * @invocation: A #GDBusMethodInvocation.
11131 *
11132 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method.
11133 *
11134 * 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.
11135 *
11136 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
11137 */
11138 g_signal_new ("handle-init",
11139 G_TYPE_FROM_INTERFACE (iface),
11140 G_SIGNAL_RUN_LAST,
11141 G_STRUCT_OFFSET (ControlIface, handle_init),
11142 g_signal_accumulator_true_handled,
11143 NULL,
11144 g_cclosure_marshal_generic,
11145 G_TYPE_BOOLEAN,
11146 1,
11147 G_TYPE_DBUS_METHOD_INVOCATION);
11148
11149 /* GObject signals for received D-Bus signals: */
11150 /**
11151 * Control::heartbeat:
11152 * @object: A #Control.
11153 * @arg_bus_name: Argument.
11154 *
11155 * 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.
11156 *
11157 * 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.
11158 */
11159 g_signal_new ("heartbeat",
11160 G_TYPE_FROM_INTERFACE (iface),
11161 G_SIGNAL_RUN_LAST,
11162 G_STRUCT_OFFSET (ControlIface, heartbeat),
11163 NULL,
11164 NULL,
11165 g_cclosure_marshal_generic,
11166 G_TYPE_NONE,
11167 1, G_TYPE_STRING);
11168
11169 /**
11170 * Control::goto-system-state:
11171 * @object: A #Control.
11172 * @arg_state_name: Argument.
11173 *
11174 * 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.
11175 *
11176 * 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.
11177 */
11178 g_signal_new ("goto-system-state",
11179 G_TYPE_FROM_INTERFACE (iface),
11180 G_SIGNAL_RUN_LAST,
11181 G_STRUCT_OFFSET (ControlIface, goto_system_state),
11182 NULL,
11183 NULL,
11184 g_cclosure_marshal_generic,
11185 G_TYPE_NONE,
11186 1, G_TYPE_STRING);
11187
11188 /* GObject properties for D-Bus properties: */
11189 /**
11190 * Control:poll-interval:
11191 *
11192 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link>.
11193 *
11194 * 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.
11195 */
11196 g_object_interface_install_property (iface,
11197 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
11198 /**
11199 * Control:heatbeat:
11200 *
11201 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link>.
11202 *
11203 * 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.
11204 */
11205 g_object_interface_install_property (iface,
11206 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
11207}
11208
11209/**
11210 * control_get_poll_interval: (skip)
11211 * @object: A #Control.
11212 *
11213 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property.
11214 *
11215 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
11216 *
11217 * Returns: The property value.
11218 */
11219gint
11220control_get_poll_interval (Control *object)
11221{
11222 return CONTROL_GET_IFACE (object)->get_poll_interval (object);
11223}
11224
11225/**
11226 * control_set_poll_interval: (skip)
11227 * @object: A #Control.
11228 * @value: The value to set.
11229 *
11230 * Sets the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property to @value.
11231 *
11232 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
11233 */
11234void
11235control_set_poll_interval (Control *object, gint value)
11236{
11237 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
11238}
11239
11240/**
11241 * control_get_heatbeat: (skip)
11242 * @object: A #Control.
11243 *
11244 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property.
11245 *
11246 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
11247 *
11248 * Returns: The property value.
11249 */
11250gint
11251control_get_heatbeat (Control *object)
11252{
11253 return CONTROL_GET_IFACE (object)->get_heatbeat (object);
11254}
11255
11256/**
11257 * control_set_heatbeat: (skip)
11258 * @object: A #Control.
11259 * @value: The value to set.
11260 *
11261 * Sets the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property to @value.
11262 *
11263 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
11264 */
11265void
11266control_set_heatbeat (Control *object, gint value)
11267{
11268 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
11269}
11270
11271/**
11272 * control_emit_heartbeat:
11273 * @object: A #Control.
11274 * @arg_bus_name: Argument to pass with the signal.
11275 *
11276 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Heartbeat">"Heartbeat"</link> D-Bus signal.
11277 */
11278void
11279control_emit_heartbeat (
11280 Control *object,
11281 const gchar *arg_bus_name)
11282{
11283 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
11284}
11285
11286/**
11287 * control_emit_goto_system_state:
11288 * @object: A #Control.
11289 * @arg_state_name: Argument to pass with the signal.
11290 *
11291 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.GotoSystemState">"GotoSystemState"</link> D-Bus signal.
11292 */
11293void
11294control_emit_goto_system_state (
11295 Control *object,
11296 const gchar *arg_state_name)
11297{
11298 g_signal_emit_by_name (object, "goto-system-state", arg_state_name);
11299}
11300
11301/**
11302 * control_call_init:
11303 * @proxy: A #ControlProxy.
11304 * @cancellable: (allow-none): A #GCancellable or %NULL.
11305 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
11306 * @user_data: User data to pass to @callback.
11307 *
11308 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method on @proxy.
11309 * 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.
11310 * You can then call control_call_init_finish() to get the result of the operation.
11311 *
11312 * See control_call_init_sync() for the synchronous, blocking version of this method.
11313 */
11314void
11315control_call_init (
11316 Control *proxy,
11317 GCancellable *cancellable,
11318 GAsyncReadyCallback callback,
11319 gpointer user_data)
11320{
11321 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
11322 "init",
11323 g_variant_new ("()"),
11324 G_DBUS_CALL_FLAGS_NONE,
11325 -1,
11326 cancellable,
11327 callback,
11328 user_data);
11329}
11330
11331/**
11332 * control_call_init_finish:
11333 * @proxy: A #ControlProxy.
11334 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_call_init().
11335 * @error: Return location for error or %NULL.
11336 *
11337 * Finishes an operation started with control_call_init().
11338 *
11339 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11340 */
11341gboolean
11342control_call_init_finish (
11343 Control *proxy,
11344 GAsyncResult *res,
11345 GError **error)
11346{
11347 GVariant *_ret;
11348 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
11349 if (_ret == NULL)
11350 goto _out;
11351 g_variant_get (_ret,
11352 "()");
11353 g_variant_unref (_ret);
11354_out:
11355 return _ret != NULL;
11356}
11357
11358/**
11359 * control_call_init_sync:
11360 * @proxy: A #ControlProxy.
11361 * @cancellable: (allow-none): A #GCancellable or %NULL.
11362 * @error: Return location for error or %NULL.
11363 *
11364 * 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.
11365 *
11366 * See control_call_init() for the asynchronous version of this method.
11367 *
11368 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11369 */
11370gboolean
11371control_call_init_sync (
11372 Control *proxy,
11373 GCancellable *cancellable,
11374 GError **error)
11375{
11376 GVariant *_ret;
11377 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
11378 "init",
11379 g_variant_new ("()"),
11380 G_DBUS_CALL_FLAGS_NONE,
11381 -1,
11382 cancellable,
11383 error);
11384 if (_ret == NULL)
11385 goto _out;
11386 g_variant_get (_ret,
11387 "()");
11388 g_variant_unref (_ret);
11389_out:
11390 return _ret != NULL;
11391}
11392
11393/**
11394 * control_complete_init:
11395 * @object: A #Control.
11396 * @invocation: (transfer full): A #GDBusMethodInvocation.
11397 *
11398 * 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.
11399 *
11400 * This method will free @invocation, you cannot use it afterwards.
11401 */
11402void
11403control_complete_init (
11404 Control *object,
11405 GDBusMethodInvocation *invocation)
11406{
11407 g_dbus_method_invocation_return_value (invocation,
11408 g_variant_new ("()"));
11409}
11410
11411/* ------------------------------------------------------------------------ */
11412
11413/**
11414 * ControlProxy:
11415 *
11416 * The #ControlProxy structure contains only private data and should only be accessed using the provided API.
11417 */
11418
11419/**
11420 * ControlProxyClass:
11421 * @parent_class: The parent class.
11422 *
11423 * Class structure for #ControlProxy.
11424 */
11425
11426struct _ControlProxyPrivate
11427{
11428 GData *qdata;
11429};
11430
11431static void control_proxy_iface_init (ControlIface *iface);
11432
11433#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11434G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
11435 G_ADD_PRIVATE (ControlProxy)
11436 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init));
11437
11438#else
11439G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
11440 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init));
11441
11442#endif
11443static void
11444control_proxy_finalize (GObject *object)
11445{
11446 ControlProxy *proxy = CONTROL_PROXY (object);
11447 g_datalist_clear (&proxy->priv->qdata);
11448 G_OBJECT_CLASS (control_proxy_parent_class)->finalize (object);
11449}
11450
11451static void
11452control_proxy_get_property (GObject *object,
11453 guint prop_id,
11454 GValue *value,
11455 GParamSpec *pspec G_GNUC_UNUSED)
11456{
11457 const _ExtendedGDBusPropertyInfo *info;
11458 GVariant *variant;
11459 g_assert (prop_id != 0 && prop_id - 1 < 2);
11460 info = _control_property_info_pointers[prop_id - 1];
11461 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
11462 if (info->use_gvariant)
11463 {
11464 g_value_set_variant (value, variant);
11465 }
11466 else
11467 {
11468 if (variant != NULL)
11469 g_dbus_gvariant_to_gvalue (variant, value);
11470 }
11471 if (variant != NULL)
11472 g_variant_unref (variant);
11473}
11474
11475static void
11476control_proxy_set_property_cb (GDBusProxy *proxy,
11477 GAsyncResult *res,
11478 gpointer user_data)
11479{
11480 const _ExtendedGDBusPropertyInfo *info = user_data;
11481 GError *error;
11482 GVariant *_ret;
11483 error = NULL;
11484 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
11485 if (!_ret)
11486 {
11487 g_warning ("Error setting property '%s' on interface org.openbmc.Control: %s (%s, %d)",
11488 info->parent_struct.name,
11489 error->message, g_quark_to_string (error->domain), error->code);
11490 g_error_free (error);
11491 }
11492 else
11493 {
11494 g_variant_unref (_ret);
11495 }
11496}
11497
11498static void
11499control_proxy_set_property (GObject *object,
11500 guint prop_id,
11501 const GValue *value,
11502 GParamSpec *pspec G_GNUC_UNUSED)
11503{
11504 const _ExtendedGDBusPropertyInfo *info;
11505 GVariant *variant;
11506 g_assert (prop_id != 0 && prop_id - 1 < 2);
11507 info = _control_property_info_pointers[prop_id - 1];
11508 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
11509 g_dbus_proxy_call (G_DBUS_PROXY (object),
11510 "org.freedesktop.DBus.Properties.Set",
11511 g_variant_new ("(ssv)", "org.openbmc.Control", info->parent_struct.name, variant),
11512 G_DBUS_CALL_FLAGS_NONE,
11513 -1,
11514 NULL, (GAsyncReadyCallback) control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
11515 g_variant_unref (variant);
11516}
11517
11518static void
11519control_proxy_g_signal (GDBusProxy *proxy,
11520 const gchar *sender_name G_GNUC_UNUSED,
11521 const gchar *signal_name,
11522 GVariant *parameters)
11523{
11524 _ExtendedGDBusSignalInfo *info;
11525 GVariantIter iter;
11526 GVariant *child;
11527 GValue *paramv;
11528 guint num_params;
11529 guint n;
11530 guint signal_id;
11531 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, signal_name);
11532 if (info == NULL)
11533 return;
11534 num_params = g_variant_n_children (parameters);
11535 paramv = g_new0 (GValue, num_params + 1);
11536 g_value_init (&paramv[0], TYPE_CONTROL);
11537 g_value_set_object (&paramv[0], proxy);
11538 g_variant_iter_init (&iter, parameters);
11539 n = 1;
11540 while ((child = g_variant_iter_next_value (&iter)) != NULL)
11541 {
11542 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
11543 if (arg_info->use_gvariant)
11544 {
11545 g_value_init (&paramv[n], G_TYPE_VARIANT);
11546 g_value_set_variant (&paramv[n], child);
11547 n++;
11548 }
11549 else
11550 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
11551 g_variant_unref (child);
11552 }
11553 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
11554 g_signal_emitv (paramv, signal_id, 0, NULL);
11555 for (n = 0; n < num_params + 1; n++)
11556 g_value_unset (&paramv[n]);
11557 g_free (paramv);
11558}
11559
11560static void
11561control_proxy_g_properties_changed (GDBusProxy *_proxy,
11562 GVariant *changed_properties,
11563 const gchar *const *invalidated_properties)
11564{
11565 ControlProxy *proxy = CONTROL_PROXY (_proxy);
11566 guint n;
11567 const gchar *key;
11568 GVariantIter *iter;
11569 _ExtendedGDBusPropertyInfo *info;
11570 g_variant_get (changed_properties, "a{sv}", &iter);
11571 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
11572 {
11573 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, key);
11574 g_datalist_remove_data (&proxy->priv->qdata, key);
11575 if (info != NULL)
11576 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
11577 }
11578 g_variant_iter_free (iter);
11579 for (n = 0; invalidated_properties[n] != NULL; n++)
11580 {
11581 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, invalidated_properties[n]);
11582 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
11583 if (info != NULL)
11584 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
11585 }
11586}
11587
11588static gint
11589control_proxy_get_poll_interval (Control *object)
11590{
11591 ControlProxy *proxy = CONTROL_PROXY (object);
11592 GVariant *variant;
11593 gint value = 0;
11594 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
11595 if (variant != NULL)
11596 {
11597 value = g_variant_get_int32 (variant);
11598 g_variant_unref (variant);
11599 }
11600 return value;
11601}
11602
11603static gint
11604control_proxy_get_heatbeat (Control *object)
11605{
11606 ControlProxy *proxy = CONTROL_PROXY (object);
11607 GVariant *variant;
11608 gint value = 0;
11609 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
11610 if (variant != NULL)
11611 {
11612 value = g_variant_get_int32 (variant);
11613 g_variant_unref (variant);
11614 }
11615 return value;
11616}
11617
11618static void
11619control_proxy_init (ControlProxy *proxy)
11620{
11621#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11622 proxy->priv = control_proxy_get_instance_private (proxy);
11623#else
11624 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_PROXY, ControlProxyPrivate);
11625#endif
11626
11627 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_interface_info ());
11628}
11629
11630static void
11631control_proxy_class_init (ControlProxyClass *klass)
11632{
11633 GObjectClass *gobject_class;
11634 GDBusProxyClass *proxy_class;
11635
11636 gobject_class = G_OBJECT_CLASS (klass);
11637 gobject_class->finalize = control_proxy_finalize;
11638 gobject_class->get_property = control_proxy_get_property;
11639 gobject_class->set_property = control_proxy_set_property;
11640
11641 proxy_class = G_DBUS_PROXY_CLASS (klass);
11642 proxy_class->g_signal = control_proxy_g_signal;
11643 proxy_class->g_properties_changed = control_proxy_g_properties_changed;
11644
11645 control_override_properties (gobject_class, 1);
11646
11647#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
11648 g_type_class_add_private (klass, sizeof (ControlProxyPrivate));
11649#endif
11650}
11651
11652static void
11653control_proxy_iface_init (ControlIface *iface)
11654{
11655 iface->get_poll_interval = control_proxy_get_poll_interval;
11656 iface->get_heatbeat = control_proxy_get_heatbeat;
11657}
11658
11659/**
11660 * control_proxy_new:
11661 * @connection: A #GDBusConnection.
11662 * @flags: Flags from the #GDBusProxyFlags enumeration.
11663 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
11664 * @object_path: An object path.
11665 * @cancellable: (allow-none): A #GCancellable or %NULL.
11666 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
11667 * @user_data: User data to pass to @callback.
11668 *
11669 * 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.
11670 *
11671 * 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.
11672 * You can then call control_proxy_new_finish() to get the result of the operation.
11673 *
11674 * See control_proxy_new_sync() for the synchronous, blocking version of this constructor.
11675 */
11676void
11677control_proxy_new (
11678 GDBusConnection *connection,
11679 GDBusProxyFlags flags,
11680 const gchar *name,
11681 const gchar *object_path,
11682 GCancellable *cancellable,
11683 GAsyncReadyCallback callback,
11684 gpointer user_data)
11685{
11686 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);
11687}
11688
11689/**
11690 * control_proxy_new_finish:
11691 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new().
11692 * @error: Return location for error or %NULL
11693 *
11694 * Finishes an operation started with control_proxy_new().
11695 *
11696 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
11697 */
11698Control *
11699control_proxy_new_finish (
11700 GAsyncResult *res,
11701 GError **error)
11702{
11703 GObject *ret;
11704 GObject *source_object;
11705 source_object = g_async_result_get_source_object (res);
11706 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
11707 g_object_unref (source_object);
11708 if (ret != NULL)
11709 return CONTROL (ret);
11710 else
11711 return NULL;
11712}
11713
11714/**
11715 * control_proxy_new_sync:
11716 * @connection: A #GDBusConnection.
11717 * @flags: Flags from the #GDBusProxyFlags enumeration.
11718 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
11719 * @object_path: An object path.
11720 * @cancellable: (allow-none): A #GCancellable or %NULL.
11721 * @error: Return location for error or %NULL
11722 *
11723 * 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.
11724 *
11725 * The calling thread is blocked until a reply is received.
11726 *
11727 * See control_proxy_new() for the asynchronous version of this constructor.
11728 *
11729 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
11730 */
11731Control *
11732control_proxy_new_sync (
11733 GDBusConnection *connection,
11734 GDBusProxyFlags flags,
11735 const gchar *name,
11736 const gchar *object_path,
11737 GCancellable *cancellable,
11738 GError **error)
11739{
11740 GInitable *ret;
11741 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);
11742 if (ret != NULL)
11743 return CONTROL (ret);
11744 else
11745 return NULL;
11746}
11747
11748
11749/**
11750 * control_proxy_new_for_bus:
11751 * @bus_type: A #GBusType.
11752 * @flags: Flags from the #GDBusProxyFlags enumeration.
11753 * @name: A bus name (well-known or unique).
11754 * @object_path: An object path.
11755 * @cancellable: (allow-none): A #GCancellable or %NULL.
11756 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
11757 * @user_data: User data to pass to @callback.
11758 *
11759 * Like control_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
11760 *
11761 * 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.
11762 * You can then call control_proxy_new_for_bus_finish() to get the result of the operation.
11763 *
11764 * See control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
11765 */
11766void
11767control_proxy_new_for_bus (
11768 GBusType bus_type,
11769 GDBusProxyFlags flags,
11770 const gchar *name,
11771 const gchar *object_path,
11772 GCancellable *cancellable,
11773 GAsyncReadyCallback callback,
11774 gpointer user_data)
11775{
11776 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);
11777}
11778
11779/**
11780 * control_proxy_new_for_bus_finish:
11781 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new_for_bus().
11782 * @error: Return location for error or %NULL
11783 *
11784 * Finishes an operation started with control_proxy_new_for_bus().
11785 *
11786 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
11787 */
11788Control *
11789control_proxy_new_for_bus_finish (
11790 GAsyncResult *res,
11791 GError **error)
11792{
11793 GObject *ret;
11794 GObject *source_object;
11795 source_object = g_async_result_get_source_object (res);
11796 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
11797 g_object_unref (source_object);
11798 if (ret != NULL)
11799 return CONTROL (ret);
11800 else
11801 return NULL;
11802}
11803
11804/**
11805 * control_proxy_new_for_bus_sync:
11806 * @bus_type: A #GBusType.
11807 * @flags: Flags from the #GDBusProxyFlags enumeration.
11808 * @name: A bus name (well-known or unique).
11809 * @object_path: An object path.
11810 * @cancellable: (allow-none): A #GCancellable or %NULL.
11811 * @error: Return location for error or %NULL
11812 *
11813 * Like control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
11814 *
11815 * The calling thread is blocked until a reply is received.
11816 *
11817 * See control_proxy_new_for_bus() for the asynchronous version of this constructor.
11818 *
11819 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
11820 */
11821Control *
11822control_proxy_new_for_bus_sync (
11823 GBusType bus_type,
11824 GDBusProxyFlags flags,
11825 const gchar *name,
11826 const gchar *object_path,
11827 GCancellable *cancellable,
11828 GError **error)
11829{
11830 GInitable *ret;
11831 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);
11832 if (ret != NULL)
11833 return CONTROL (ret);
11834 else
11835 return NULL;
11836}
11837
11838
11839/* ------------------------------------------------------------------------ */
11840
11841/**
11842 * ControlSkeleton:
11843 *
11844 * The #ControlSkeleton structure contains only private data and should only be accessed using the provided API.
11845 */
11846
11847/**
11848 * ControlSkeletonClass:
11849 * @parent_class: The parent class.
11850 *
11851 * Class structure for #ControlSkeleton.
11852 */
11853
11854struct _ControlSkeletonPrivate
11855{
11856 GValue *properties;
11857 GList *changed_properties;
11858 GSource *changed_properties_idle_source;
11859 GMainContext *context;
11860 GMutex lock;
11861};
11862
11863static void
11864_control_skeleton_handle_method_call (
11865 GDBusConnection *connection G_GNUC_UNUSED,
11866 const gchar *sender G_GNUC_UNUSED,
11867 const gchar *object_path G_GNUC_UNUSED,
11868 const gchar *interface_name,
11869 const gchar *method_name,
11870 GVariant *parameters,
11871 GDBusMethodInvocation *invocation,
11872 gpointer user_data)
11873{
11874 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
11875 _ExtendedGDBusMethodInfo *info;
11876 GVariantIter iter;
11877 GVariant *child;
11878 GValue *paramv;
11879 guint num_params;
11880 guint num_extra;
11881 guint n;
11882 guint signal_id;
11883 GValue return_value = G_VALUE_INIT;
11884 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
11885 g_assert (info != NULL);
11886 num_params = g_variant_n_children (parameters);
11887 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
11888 n = 0;
11889 g_value_init (&paramv[n], TYPE_CONTROL);
11890 g_value_set_object (&paramv[n++], skeleton);
11891 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
11892 g_value_set_object (&paramv[n++], invocation);
11893 if (info->pass_fdlist)
11894 {
11895#ifdef G_OS_UNIX
11896 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
11897 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
11898#else
11899 g_assert_not_reached ();
11900#endif
11901 }
11902 g_variant_iter_init (&iter, parameters);
11903 while ((child = g_variant_iter_next_value (&iter)) != NULL)
11904 {
11905 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
11906 if (arg_info->use_gvariant)
11907 {
11908 g_value_init (&paramv[n], G_TYPE_VARIANT);
11909 g_value_set_variant (&paramv[n], child);
11910 n++;
11911 }
11912 else
11913 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
11914 g_variant_unref (child);
11915 }
11916 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
11917 g_value_init (&return_value, G_TYPE_BOOLEAN);
11918 g_signal_emitv (paramv, signal_id, 0, &return_value);
11919 if (!g_value_get_boolean (&return_value))
11920 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);
11921 g_value_unset (&return_value);
11922 for (n = 0; n < num_params + num_extra; n++)
11923 g_value_unset (&paramv[n]);
11924 g_free (paramv);
11925}
11926
11927static GVariant *
11928_control_skeleton_handle_get_property (
11929 GDBusConnection *connection G_GNUC_UNUSED,
11930 const gchar *sender G_GNUC_UNUSED,
11931 const gchar *object_path G_GNUC_UNUSED,
11932 const gchar *interface_name G_GNUC_UNUSED,
11933 const gchar *property_name,
11934 GError **error,
11935 gpointer user_data)
11936{
11937 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
11938 GValue value = G_VALUE_INIT;
11939 GParamSpec *pspec;
11940 _ExtendedGDBusPropertyInfo *info;
11941 GVariant *ret;
11942 ret = NULL;
11943 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
11944 g_assert (info != NULL);
11945 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
11946 if (pspec == NULL)
11947 {
11948 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
11949 }
11950 else
11951 {
11952 g_value_init (&value, pspec->value_type);
11953 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
11954 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
11955 g_value_unset (&value);
11956 }
11957 return ret;
11958}
11959
11960static gboolean
11961_control_skeleton_handle_set_property (
11962 GDBusConnection *connection G_GNUC_UNUSED,
11963 const gchar *sender G_GNUC_UNUSED,
11964 const gchar *object_path G_GNUC_UNUSED,
11965 const gchar *interface_name G_GNUC_UNUSED,
11966 const gchar *property_name,
11967 GVariant *variant,
11968 GError **error,
11969 gpointer user_data)
11970{
11971 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
11972 GValue value = G_VALUE_INIT;
11973 GParamSpec *pspec;
11974 _ExtendedGDBusPropertyInfo *info;
11975 gboolean ret;
11976 ret = FALSE;
11977 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
11978 g_assert (info != NULL);
11979 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
11980 if (pspec == NULL)
11981 {
11982 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
11983 }
11984 else
11985 {
11986 if (info->use_gvariant)
11987 g_value_set_variant (&value, variant);
11988 else
11989 g_dbus_gvariant_to_gvalue (variant, &value);
11990 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
11991 g_value_unset (&value);
11992 ret = TRUE;
11993 }
11994 return ret;
11995}
11996
11997static const GDBusInterfaceVTable _control_skeleton_vtable =
11998{
11999 _control_skeleton_handle_method_call,
12000 _control_skeleton_handle_get_property,
12001 _control_skeleton_handle_set_property,
12002 {NULL}
12003};
12004
12005static GDBusInterfaceInfo *
12006control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
12007{
12008 return control_interface_info ();
12009}
12010
12011static GDBusInterfaceVTable *
12012control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
12013{
12014 return (GDBusInterfaceVTable *) &_control_skeleton_vtable;
12015}
12016
12017static GVariant *
12018control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
12019{
12020 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
12021
12022 GVariantBuilder builder;
12023 guint n;
12024 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
12025 if (_control_interface_info.parent_struct.properties == NULL)
12026 goto out;
12027 for (n = 0; _control_interface_info.parent_struct.properties[n] != NULL; n++)
12028 {
12029 GDBusPropertyInfo *info = _control_interface_info.parent_struct.properties[n];
12030 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
12031 {
12032 GVariant *value;
12033 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);
12034 if (value != NULL)
12035 {
12036 g_variant_take_ref (value);
12037 g_variant_builder_add (&builder, "{sv}", info->name, value);
12038 g_variant_unref (value);
12039 }
12040 }
12041 }
12042out:
12043 return g_variant_builder_end (&builder);
12044}
12045
12046static gboolean _control_emit_changed (gpointer user_data);
12047
12048static void
12049control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
12050{
12051 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
12052 gboolean emit_changed = FALSE;
12053
12054 g_mutex_lock (&skeleton->priv->lock);
12055 if (skeleton->priv->changed_properties_idle_source != NULL)
12056 {
12057 g_source_destroy (skeleton->priv->changed_properties_idle_source);
12058 skeleton->priv->changed_properties_idle_source = NULL;
12059 emit_changed = TRUE;
12060 }
12061 g_mutex_unlock (&skeleton->priv->lock);
12062
12063 if (emit_changed)
12064 _control_emit_changed (skeleton);
12065}
12066
12067static void
12068_control_on_signal_heartbeat (
12069 Control *object,
12070 const gchar *arg_bus_name)
12071{
12072 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12073
12074 GList *connections, *l;
12075 GVariant *signal_variant;
12076 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
12077
12078 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
12079 arg_bus_name));
12080 for (l = connections; l != NULL; l = l->next)
12081 {
12082 GDBusConnection *connection = l->data;
12083 g_dbus_connection_emit_signal (connection,
12084 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Heartbeat",
12085 signal_variant, NULL);
12086 }
12087 g_variant_unref (signal_variant);
12088 g_list_free_full (connections, g_object_unref);
12089}
12090
12091static void
12092_control_on_signal_goto_system_state (
12093 Control *object,
12094 const gchar *arg_state_name)
12095{
12096 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12097
12098 GList *connections, *l;
12099 GVariant *signal_variant;
12100 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
12101
12102 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
12103 arg_state_name));
12104 for (l = connections; l != NULL; l = l->next)
12105 {
12106 GDBusConnection *connection = l->data;
12107 g_dbus_connection_emit_signal (connection,
12108 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "GotoSystemState",
12109 signal_variant, NULL);
12110 }
12111 g_variant_unref (signal_variant);
12112 g_list_free_full (connections, g_object_unref);
12113}
12114
12115static void control_skeleton_iface_init (ControlIface *iface);
12116#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12117G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
12118 G_ADD_PRIVATE (ControlSkeleton)
12119 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init));
12120
12121#else
12122G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
12123 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init));
12124
12125#endif
12126static void
12127control_skeleton_finalize (GObject *object)
12128{
12129 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12130 guint n;
12131 for (n = 0; n < 2; n++)
12132 g_value_unset (&skeleton->priv->properties[n]);
12133 g_free (skeleton->priv->properties);
12134 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
12135 if (skeleton->priv->changed_properties_idle_source != NULL)
12136 g_source_destroy (skeleton->priv->changed_properties_idle_source);
12137 g_main_context_unref (skeleton->priv->context);
12138 g_mutex_clear (&skeleton->priv->lock);
12139 G_OBJECT_CLASS (control_skeleton_parent_class)->finalize (object);
12140}
12141
12142static void
12143control_skeleton_get_property (GObject *object,
12144 guint prop_id,
12145 GValue *value,
12146 GParamSpec *pspec G_GNUC_UNUSED)
12147{
12148 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12149 g_assert (prop_id != 0 && prop_id - 1 < 2);
12150 g_mutex_lock (&skeleton->priv->lock);
12151 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
12152 g_mutex_unlock (&skeleton->priv->lock);
12153}
12154
12155static gboolean
12156_control_emit_changed (gpointer user_data)
12157{
12158 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
12159 GList *l;
12160 GVariantBuilder builder;
12161 GVariantBuilder invalidated_builder;
12162 guint num_changes;
12163
12164 g_mutex_lock (&skeleton->priv->lock);
12165 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
12166 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
12167 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
12168 {
12169 ChangedProperty *cp = l->data;
12170 GVariant *variant;
12171 const GValue *cur_value;
12172
12173 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
12174 if (!_g_value_equal (cur_value, &cp->orig_value))
12175 {
12176 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
12177 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
12178 g_variant_unref (variant);
12179 num_changes++;
12180 }
12181 }
12182 if (num_changes > 0)
12183 {
12184 GList *connections, *ll;
12185 GVariant *signal_variant;
12186 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Control",
12187 &builder, &invalidated_builder));
12188 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
12189 for (ll = connections; ll != NULL; ll = ll->next)
12190 {
12191 GDBusConnection *connection = ll->data;
12192
12193 g_dbus_connection_emit_signal (connection,
12194 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
12195 "org.freedesktop.DBus.Properties",
12196 "PropertiesChanged",
12197 signal_variant,
12198 NULL);
12199 }
12200 g_variant_unref (signal_variant);
12201 g_list_free_full (connections, g_object_unref);
12202 }
12203 else
12204 {
12205 g_variant_builder_clear (&builder);
12206 g_variant_builder_clear (&invalidated_builder);
12207 }
12208 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
12209 skeleton->priv->changed_properties = NULL;
12210 skeleton->priv->changed_properties_idle_source = NULL;
12211 g_mutex_unlock (&skeleton->priv->lock);
12212 return FALSE;
12213}
12214
12215static void
12216_control_schedule_emit_changed (ControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
12217{
12218 ChangedProperty *cp;
12219 GList *l;
12220 cp = NULL;
12221 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
12222 {
12223 ChangedProperty *i_cp = l->data;
12224 if (i_cp->info == info)
12225 {
12226 cp = i_cp;
12227 break;
12228 }
12229 }
12230 if (cp == NULL)
12231 {
12232 cp = g_new0 (ChangedProperty, 1);
12233 cp->prop_id = prop_id;
12234 cp->info = info;
12235 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
12236 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
12237 g_value_copy (orig_value, &cp->orig_value);
12238 }
12239}
12240
12241static void
12242control_skeleton_notify (GObject *object,
12243 GParamSpec *pspec G_GNUC_UNUSED)
12244{
12245 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12246 g_mutex_lock (&skeleton->priv->lock);
12247 if (skeleton->priv->changed_properties != NULL &&
12248 skeleton->priv->changed_properties_idle_source == NULL)
12249 {
12250 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
12251 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
12252 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
12253 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
12254 g_source_unref (skeleton->priv->changed_properties_idle_source);
12255 }
12256 g_mutex_unlock (&skeleton->priv->lock);
12257}
12258
12259static void
12260control_skeleton_set_property (GObject *object,
12261 guint prop_id,
12262 const GValue *value,
12263 GParamSpec *pspec)
12264{
12265 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12266 g_assert (prop_id != 0 && prop_id - 1 < 2);
12267 g_mutex_lock (&skeleton->priv->lock);
12268 g_object_freeze_notify (object);
12269 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
12270 {
12271 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
12272 _control_schedule_emit_changed (skeleton, _control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
12273 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
12274 g_object_notify_by_pspec (object, pspec);
12275 }
12276 g_mutex_unlock (&skeleton->priv->lock);
12277 g_object_thaw_notify (object);
12278}
12279
12280static void
12281control_skeleton_init (ControlSkeleton *skeleton)
12282{
12283#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12284 skeleton->priv = control_skeleton_get_instance_private (skeleton);
12285#else
12286 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_SKELETON, ControlSkeletonPrivate);
12287#endif
12288
12289 g_mutex_init (&skeleton->priv->lock);
12290 skeleton->priv->context = g_main_context_ref_thread_default ();
12291 skeleton->priv->properties = g_new0 (GValue, 2);
12292 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
12293 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
12294}
12295
12296static gint
12297control_skeleton_get_poll_interval (Control *object)
12298{
12299 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12300 gint value;
12301 g_mutex_lock (&skeleton->priv->lock);
12302 value = g_value_get_int (&(skeleton->priv->properties[0]));
12303 g_mutex_unlock (&skeleton->priv->lock);
12304 return value;
12305}
12306
12307static gint
12308control_skeleton_get_heatbeat (Control *object)
12309{
12310 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12311 gint value;
12312 g_mutex_lock (&skeleton->priv->lock);
12313 value = g_value_get_int (&(skeleton->priv->properties[1]));
12314 g_mutex_unlock (&skeleton->priv->lock);
12315 return value;
12316}
12317
12318static void
12319control_skeleton_class_init (ControlSkeletonClass *klass)
12320{
12321 GObjectClass *gobject_class;
12322 GDBusInterfaceSkeletonClass *skeleton_class;
12323
12324 gobject_class = G_OBJECT_CLASS (klass);
12325 gobject_class->finalize = control_skeleton_finalize;
12326 gobject_class->get_property = control_skeleton_get_property;
12327 gobject_class->set_property = control_skeleton_set_property;
12328 gobject_class->notify = control_skeleton_notify;
12329
12330
12331 control_override_properties (gobject_class, 1);
12332
12333 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
12334 skeleton_class->get_info = control_skeleton_dbus_interface_get_info;
12335 skeleton_class->get_properties = control_skeleton_dbus_interface_get_properties;
12336 skeleton_class->flush = control_skeleton_dbus_interface_flush;
12337 skeleton_class->get_vtable = control_skeleton_dbus_interface_get_vtable;
12338
12339#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
12340 g_type_class_add_private (klass, sizeof (ControlSkeletonPrivate));
12341#endif
12342}
12343
12344static void
12345control_skeleton_iface_init (ControlIface *iface)
12346{
12347 iface->heartbeat = _control_on_signal_heartbeat;
12348 iface->goto_system_state = _control_on_signal_goto_system_state;
12349 iface->get_poll_interval = control_skeleton_get_poll_interval;
12350 iface->get_heatbeat = control_skeleton_get_heatbeat;
12351}
12352
12353/**
12354 * control_skeleton_new:
12355 *
12356 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
12357 *
12358 * Returns: (transfer full) (type ControlSkeleton): The skeleton object.
12359 */
12360Control *
12361control_skeleton_new (void)
12362{
12363 return CONTROL (g_object_new (TYPE_CONTROL_SKELETON, NULL));
12364}
12365
12366/* ------------------------------------------------------------------------
12367 * Code for interface org.openbmc.control.Bmc
12368 * ------------------------------------------------------------------------
12369 */
12370
12371/**
12372 * SECTION:ControlBmc
12373 * @title: ControlBmc
12374 * @short_description: Generated C code for the org.openbmc.control.Bmc D-Bus interface
12375 *
12376 * 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.
12377 */
12378
12379/* ---- Introspection data for org.openbmc.control.Bmc ---- */
12380
12381static const _ExtendedGDBusMethodInfo _control_bmc_method_info_place_holder =
12382{
12383 {
12384 -1,
12385 (gchar *) "place_holder",
12386 NULL,
12387 NULL,
12388 NULL
12389 },
12390 "handle-place-holder",
12391 FALSE
12392};
12393
12394static const _ExtendedGDBusMethodInfo * const _control_bmc_method_info_pointers[] =
12395{
12396 &_control_bmc_method_info_place_holder,
12397 NULL
12398};
12399
12400static const _ExtendedGDBusInterfaceInfo _control_bmc_interface_info =
12401{
12402 {
12403 -1,
12404 (gchar *) "org.openbmc.control.Bmc",
12405 (GDBusMethodInfo **) &_control_bmc_method_info_pointers,
12406 NULL,
12407 NULL,
12408 NULL
12409 },
12410 "control-bmc",
12411};
12412
12413
12414/**
12415 * control_bmc_interface_info:
12416 *
12417 * 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.
12418 *
12419 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
12420 */
12421GDBusInterfaceInfo *
12422control_bmc_interface_info (void)
12423{
12424 return (GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct;
12425}
12426
12427/**
12428 * control_bmc_override_properties:
12429 * @klass: The class structure for a #GObject<!-- -->-derived class.
12430 * @property_id_begin: The property id to assign to the first overridden property.
12431 *
12432 * Overrides all #GObject properties in the #ControlBmc interface for a concrete class.
12433 * The properties are overridden in the order they are defined.
12434 *
12435 * Returns: The last property id.
12436 */
12437guint
12438control_bmc_override_properties (GObjectClass *klass, guint property_id_begin)
12439{
12440 return property_id_begin - 1;
12441}
12442
12443
12444
12445/**
12446 * ControlBmc:
12447 *
12448 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
12449 */
12450
12451/**
12452 * ControlBmcIface:
12453 * @parent_iface: The parent interface.
12454 * @handle_place_holder: Handler for the #ControlBmc::handle-place-holder signal.
12455 *
12456 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
12457 */
12458
12459typedef ControlBmcIface ControlBmcInterface;
12460G_DEFINE_INTERFACE (ControlBmc, control_bmc, G_TYPE_OBJECT);
12461
12462static void
12463control_bmc_default_init (ControlBmcIface *iface)
12464{
12465 /* GObject signals for incoming D-Bus method calls: */
12466 /**
12467 * ControlBmc::handle-place-holder:
12468 * @object: A #ControlBmc.
12469 * @invocation: A #GDBusMethodInvocation.
12470 *
12471 * 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.
12472 *
12473 * 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.
12474 *
12475 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
12476 */
12477 g_signal_new ("handle-place-holder",
12478 G_TYPE_FROM_INTERFACE (iface),
12479 G_SIGNAL_RUN_LAST,
12480 G_STRUCT_OFFSET (ControlBmcIface, handle_place_holder),
12481 g_signal_accumulator_true_handled,
12482 NULL,
12483 g_cclosure_marshal_generic,
12484 G_TYPE_BOOLEAN,
12485 1,
12486 G_TYPE_DBUS_METHOD_INVOCATION);
12487
12488}
12489
12490/**
12491 * control_bmc_call_place_holder:
12492 * @proxy: A #ControlBmcProxy.
12493 * @cancellable: (allow-none): A #GCancellable or %NULL.
12494 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
12495 * @user_data: User data to pass to @callback.
12496 *
12497 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.place_holder">place_holder()</link> D-Bus method on @proxy.
12498 * 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.
12499 * You can then call control_bmc_call_place_holder_finish() to get the result of the operation.
12500 *
12501 * See control_bmc_call_place_holder_sync() for the synchronous, blocking version of this method.
12502 */
12503void
12504control_bmc_call_place_holder (
12505 ControlBmc *proxy,
12506 GCancellable *cancellable,
12507 GAsyncReadyCallback callback,
12508 gpointer user_data)
12509{
12510 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
12511 "place_holder",
12512 g_variant_new ("()"),
12513 G_DBUS_CALL_FLAGS_NONE,
12514 -1,
12515 cancellable,
12516 callback,
12517 user_data);
12518}
12519
12520/**
12521 * control_bmc_call_place_holder_finish:
12522 * @proxy: A #ControlBmcProxy.
12523 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_call_place_holder().
12524 * @error: Return location for error or %NULL.
12525 *
12526 * Finishes an operation started with control_bmc_call_place_holder().
12527 *
12528 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
12529 */
12530gboolean
12531control_bmc_call_place_holder_finish (
12532 ControlBmc *proxy,
12533 GAsyncResult *res,
12534 GError **error)
12535{
12536 GVariant *_ret;
12537 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
12538 if (_ret == NULL)
12539 goto _out;
12540 g_variant_get (_ret,
12541 "()");
12542 g_variant_unref (_ret);
12543_out:
12544 return _ret != NULL;
12545}
12546
12547/**
12548 * control_bmc_call_place_holder_sync:
12549 * @proxy: A #ControlBmcProxy.
12550 * @cancellable: (allow-none): A #GCancellable or %NULL.
12551 * @error: Return location for error or %NULL.
12552 *
12553 * 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.
12554 *
12555 * See control_bmc_call_place_holder() for the asynchronous version of this method.
12556 *
12557 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
12558 */
12559gboolean
12560control_bmc_call_place_holder_sync (
12561 ControlBmc *proxy,
12562 GCancellable *cancellable,
12563 GError **error)
12564{
12565 GVariant *_ret;
12566 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
12567 "place_holder",
12568 g_variant_new ("()"),
12569 G_DBUS_CALL_FLAGS_NONE,
12570 -1,
12571 cancellable,
12572 error);
12573 if (_ret == NULL)
12574 goto _out;
12575 g_variant_get (_ret,
12576 "()");
12577 g_variant_unref (_ret);
12578_out:
12579 return _ret != NULL;
12580}
12581
12582/**
12583 * control_bmc_complete_place_holder:
12584 * @object: A #ControlBmc.
12585 * @invocation: (transfer full): A #GDBusMethodInvocation.
12586 *
12587 * 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.
12588 *
12589 * This method will free @invocation, you cannot use it afterwards.
12590 */
12591void
12592control_bmc_complete_place_holder (
12593 ControlBmc *object,
12594 GDBusMethodInvocation *invocation)
12595{
12596 g_dbus_method_invocation_return_value (invocation,
12597 g_variant_new ("()"));
12598}
12599
12600/* ------------------------------------------------------------------------ */
12601
12602/**
12603 * ControlBmcProxy:
12604 *
12605 * The #ControlBmcProxy structure contains only private data and should only be accessed using the provided API.
12606 */
12607
12608/**
12609 * ControlBmcProxyClass:
12610 * @parent_class: The parent class.
12611 *
12612 * Class structure for #ControlBmcProxy.
12613 */
12614
12615struct _ControlBmcProxyPrivate
12616{
12617 GData *qdata;
12618};
12619
12620static void control_bmc_proxy_iface_init (ControlBmcIface *iface);
12621
12622#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12623G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY,
12624 G_ADD_PRIVATE (ControlBmcProxy)
12625 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init));
12626
12627#else
12628G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY,
12629 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init));
12630
12631#endif
12632static void
12633control_bmc_proxy_finalize (GObject *object)
12634{
12635 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (object);
12636 g_datalist_clear (&proxy->priv->qdata);
12637 G_OBJECT_CLASS (control_bmc_proxy_parent_class)->finalize (object);
12638}
12639
12640static void
12641control_bmc_proxy_get_property (GObject *object,
12642 guint prop_id,
12643 GValue *value,
12644 GParamSpec *pspec G_GNUC_UNUSED)
12645{
12646}
12647
12648static void
12649control_bmc_proxy_set_property (GObject *object,
12650 guint prop_id,
12651 const GValue *value,
12652 GParamSpec *pspec G_GNUC_UNUSED)
12653{
12654}
12655
12656static void
12657control_bmc_proxy_g_signal (GDBusProxy *proxy,
12658 const gchar *sender_name G_GNUC_UNUSED,
12659 const gchar *signal_name,
12660 GVariant *parameters)
12661{
12662 _ExtendedGDBusSignalInfo *info;
12663 GVariantIter iter;
12664 GVariant *child;
12665 GValue *paramv;
12666 guint num_params;
12667 guint n;
12668 guint signal_id;
12669 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, signal_name);
12670 if (info == NULL)
12671 return;
12672 num_params = g_variant_n_children (parameters);
12673 paramv = g_new0 (GValue, num_params + 1);
12674 g_value_init (&paramv[0], TYPE_CONTROL_BMC);
12675 g_value_set_object (&paramv[0], proxy);
12676 g_variant_iter_init (&iter, parameters);
12677 n = 1;
12678 while ((child = g_variant_iter_next_value (&iter)) != NULL)
12679 {
12680 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
12681 if (arg_info->use_gvariant)
12682 {
12683 g_value_init (&paramv[n], G_TYPE_VARIANT);
12684 g_value_set_variant (&paramv[n], child);
12685 n++;
12686 }
12687 else
12688 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
12689 g_variant_unref (child);
12690 }
12691 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC);
12692 g_signal_emitv (paramv, signal_id, 0, NULL);
12693 for (n = 0; n < num_params + 1; n++)
12694 g_value_unset (&paramv[n]);
12695 g_free (paramv);
12696}
12697
12698static void
12699control_bmc_proxy_g_properties_changed (GDBusProxy *_proxy,
12700 GVariant *changed_properties,
12701 const gchar *const *invalidated_properties)
12702{
12703 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (_proxy);
12704 guint n;
12705 const gchar *key;
12706 GVariantIter *iter;
12707 _ExtendedGDBusPropertyInfo *info;
12708 g_variant_get (changed_properties, "a{sv}", &iter);
12709 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
12710 {
12711 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, key);
12712 g_datalist_remove_data (&proxy->priv->qdata, key);
12713 if (info != NULL)
12714 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
12715 }
12716 g_variant_iter_free (iter);
12717 for (n = 0; invalidated_properties[n] != NULL; n++)
12718 {
12719 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, invalidated_properties[n]);
12720 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
12721 if (info != NULL)
12722 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
12723 }
12724}
12725
12726static void
12727control_bmc_proxy_init (ControlBmcProxy *proxy)
12728{
12729#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12730 proxy->priv = control_bmc_proxy_get_instance_private (proxy);
12731#else
12732 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_BMC_PROXY, ControlBmcProxyPrivate);
12733#endif
12734
12735 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_bmc_interface_info ());
12736}
12737
12738static void
12739control_bmc_proxy_class_init (ControlBmcProxyClass *klass)
12740{
12741 GObjectClass *gobject_class;
12742 GDBusProxyClass *proxy_class;
12743
12744 gobject_class = G_OBJECT_CLASS (klass);
12745 gobject_class->finalize = control_bmc_proxy_finalize;
12746 gobject_class->get_property = control_bmc_proxy_get_property;
12747 gobject_class->set_property = control_bmc_proxy_set_property;
12748
12749 proxy_class = G_DBUS_PROXY_CLASS (klass);
12750 proxy_class->g_signal = control_bmc_proxy_g_signal;
12751 proxy_class->g_properties_changed = control_bmc_proxy_g_properties_changed;
12752
12753#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
12754 g_type_class_add_private (klass, sizeof (ControlBmcProxyPrivate));
12755#endif
12756}
12757
12758static void
12759control_bmc_proxy_iface_init (ControlBmcIface *iface)
12760{
12761}
12762
12763/**
12764 * control_bmc_proxy_new:
12765 * @connection: A #GDBusConnection.
12766 * @flags: Flags from the #GDBusProxyFlags enumeration.
12767 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
12768 * @object_path: An object path.
12769 * @cancellable: (allow-none): A #GCancellable or %NULL.
12770 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
12771 * @user_data: User data to pass to @callback.
12772 *
12773 * 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.
12774 *
12775 * 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.
12776 * You can then call control_bmc_proxy_new_finish() to get the result of the operation.
12777 *
12778 * See control_bmc_proxy_new_sync() for the synchronous, blocking version of this constructor.
12779 */
12780void
12781control_bmc_proxy_new (
12782 GDBusConnection *connection,
12783 GDBusProxyFlags flags,
12784 const gchar *name,
12785 const gchar *object_path,
12786 GCancellable *cancellable,
12787 GAsyncReadyCallback callback,
12788 gpointer user_data)
12789{
12790 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);
12791}
12792
12793/**
12794 * control_bmc_proxy_new_finish:
12795 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new().
12796 * @error: Return location for error or %NULL
12797 *
12798 * Finishes an operation started with control_bmc_proxy_new().
12799 *
12800 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
12801 */
12802ControlBmc *
12803control_bmc_proxy_new_finish (
12804 GAsyncResult *res,
12805 GError **error)
12806{
12807 GObject *ret;
12808 GObject *source_object;
12809 source_object = g_async_result_get_source_object (res);
12810 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
12811 g_object_unref (source_object);
12812 if (ret != NULL)
12813 return CONTROL_BMC (ret);
12814 else
12815 return NULL;
12816}
12817
12818/**
12819 * control_bmc_proxy_new_sync:
12820 * @connection: A #GDBusConnection.
12821 * @flags: Flags from the #GDBusProxyFlags enumeration.
12822 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
12823 * @object_path: An object path.
12824 * @cancellable: (allow-none): A #GCancellable or %NULL.
12825 * @error: Return location for error or %NULL
12826 *
12827 * 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.
12828 *
12829 * The calling thread is blocked until a reply is received.
12830 *
12831 * See control_bmc_proxy_new() for the asynchronous version of this constructor.
12832 *
12833 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
12834 */
12835ControlBmc *
12836control_bmc_proxy_new_sync (
12837 GDBusConnection *connection,
12838 GDBusProxyFlags flags,
12839 const gchar *name,
12840 const gchar *object_path,
12841 GCancellable *cancellable,
12842 GError **error)
12843{
12844 GInitable *ret;
12845 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);
12846 if (ret != NULL)
12847 return CONTROL_BMC (ret);
12848 else
12849 return NULL;
12850}
12851
12852
12853/**
12854 * control_bmc_proxy_new_for_bus:
12855 * @bus_type: A #GBusType.
12856 * @flags: Flags from the #GDBusProxyFlags enumeration.
12857 * @name: A bus name (well-known or unique).
12858 * @object_path: An object path.
12859 * @cancellable: (allow-none): A #GCancellable or %NULL.
12860 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
12861 * @user_data: User data to pass to @callback.
12862 *
12863 * Like control_bmc_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
12864 *
12865 * 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.
12866 * You can then call control_bmc_proxy_new_for_bus_finish() to get the result of the operation.
12867 *
12868 * See control_bmc_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
12869 */
12870void
12871control_bmc_proxy_new_for_bus (
12872 GBusType bus_type,
12873 GDBusProxyFlags flags,
12874 const gchar *name,
12875 const gchar *object_path,
12876 GCancellable *cancellable,
12877 GAsyncReadyCallback callback,
12878 gpointer user_data)
12879{
12880 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);
12881}
12882
12883/**
12884 * control_bmc_proxy_new_for_bus_finish:
12885 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new_for_bus().
12886 * @error: Return location for error or %NULL
12887 *
12888 * Finishes an operation started with control_bmc_proxy_new_for_bus().
12889 *
12890 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
12891 */
12892ControlBmc *
12893control_bmc_proxy_new_for_bus_finish (
12894 GAsyncResult *res,
12895 GError **error)
12896{
12897 GObject *ret;
12898 GObject *source_object;
12899 source_object = g_async_result_get_source_object (res);
12900 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
12901 g_object_unref (source_object);
12902 if (ret != NULL)
12903 return CONTROL_BMC (ret);
12904 else
12905 return NULL;
12906}
12907
12908/**
12909 * control_bmc_proxy_new_for_bus_sync:
12910 * @bus_type: A #GBusType.
12911 * @flags: Flags from the #GDBusProxyFlags enumeration.
12912 * @name: A bus name (well-known or unique).
12913 * @object_path: An object path.
12914 * @cancellable: (allow-none): A #GCancellable or %NULL.
12915 * @error: Return location for error or %NULL
12916 *
12917 * Like control_bmc_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
12918 *
12919 * The calling thread is blocked until a reply is received.
12920 *
12921 * See control_bmc_proxy_new_for_bus() for the asynchronous version of this constructor.
12922 *
12923 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
12924 */
12925ControlBmc *
12926control_bmc_proxy_new_for_bus_sync (
12927 GBusType bus_type,
12928 GDBusProxyFlags flags,
12929 const gchar *name,
12930 const gchar *object_path,
12931 GCancellable *cancellable,
12932 GError **error)
12933{
12934 GInitable *ret;
12935 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);
12936 if (ret != NULL)
12937 return CONTROL_BMC (ret);
12938 else
12939 return NULL;
12940}
12941
12942
12943/* ------------------------------------------------------------------------ */
12944
12945/**
12946 * ControlBmcSkeleton:
12947 *
12948 * The #ControlBmcSkeleton structure contains only private data and should only be accessed using the provided API.
12949 */
12950
12951/**
12952 * ControlBmcSkeletonClass:
12953 * @parent_class: The parent class.
12954 *
12955 * Class structure for #ControlBmcSkeleton.
12956 */
12957
12958struct _ControlBmcSkeletonPrivate
12959{
12960 GValue *properties;
12961 GList *changed_properties;
12962 GSource *changed_properties_idle_source;
12963 GMainContext *context;
12964 GMutex lock;
12965};
12966
12967static void
12968_control_bmc_skeleton_handle_method_call (
12969 GDBusConnection *connection G_GNUC_UNUSED,
12970 const gchar *sender G_GNUC_UNUSED,
12971 const gchar *object_path G_GNUC_UNUSED,
12972 const gchar *interface_name,
12973 const gchar *method_name,
12974 GVariant *parameters,
12975 GDBusMethodInvocation *invocation,
12976 gpointer user_data)
12977{
12978 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
12979 _ExtendedGDBusMethodInfo *info;
12980 GVariantIter iter;
12981 GVariant *child;
12982 GValue *paramv;
12983 guint num_params;
12984 guint num_extra;
12985 guint n;
12986 guint signal_id;
12987 GValue return_value = G_VALUE_INIT;
12988 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
12989 g_assert (info != NULL);
12990 num_params = g_variant_n_children (parameters);
12991 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
12992 n = 0;
12993 g_value_init (&paramv[n], TYPE_CONTROL_BMC);
12994 g_value_set_object (&paramv[n++], skeleton);
12995 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
12996 g_value_set_object (&paramv[n++], invocation);
12997 if (info->pass_fdlist)
12998 {
12999#ifdef G_OS_UNIX
13000 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
13001 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
13002#else
13003 g_assert_not_reached ();
13004#endif
13005 }
13006 g_variant_iter_init (&iter, parameters);
13007 while ((child = g_variant_iter_next_value (&iter)) != NULL)
13008 {
13009 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
13010 if (arg_info->use_gvariant)
13011 {
13012 g_value_init (&paramv[n], G_TYPE_VARIANT);
13013 g_value_set_variant (&paramv[n], child);
13014 n++;
13015 }
13016 else
13017 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
13018 g_variant_unref (child);
13019 }
13020 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC);
13021 g_value_init (&return_value, G_TYPE_BOOLEAN);
13022 g_signal_emitv (paramv, signal_id, 0, &return_value);
13023 if (!g_value_get_boolean (&return_value))
13024 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);
13025 g_value_unset (&return_value);
13026 for (n = 0; n < num_params + num_extra; n++)
13027 g_value_unset (&paramv[n]);
13028 g_free (paramv);
13029}
13030
13031static GVariant *
13032_control_bmc_skeleton_handle_get_property (
13033 GDBusConnection *connection G_GNUC_UNUSED,
13034 const gchar *sender G_GNUC_UNUSED,
13035 const gchar *object_path G_GNUC_UNUSED,
13036 const gchar *interface_name G_GNUC_UNUSED,
13037 const gchar *property_name,
13038 GError **error,
13039 gpointer user_data)
13040{
13041 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
13042 GValue value = G_VALUE_INIT;
13043 GParamSpec *pspec;
13044 _ExtendedGDBusPropertyInfo *info;
13045 GVariant *ret;
13046 ret = NULL;
13047 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name);
13048 g_assert (info != NULL);
13049 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
13050 if (pspec == NULL)
13051 {
13052 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
13053 }
13054 else
13055 {
13056 g_value_init (&value, pspec->value_type);
13057 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
13058 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
13059 g_value_unset (&value);
13060 }
13061 return ret;
13062}
13063
13064static gboolean
13065_control_bmc_skeleton_handle_set_property (
13066 GDBusConnection *connection G_GNUC_UNUSED,
13067 const gchar *sender G_GNUC_UNUSED,
13068 const gchar *object_path G_GNUC_UNUSED,
13069 const gchar *interface_name G_GNUC_UNUSED,
13070 const gchar *property_name,
13071 GVariant *variant,
13072 GError **error,
13073 gpointer user_data)
13074{
13075 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
13076 GValue value = G_VALUE_INIT;
13077 GParamSpec *pspec;
13078 _ExtendedGDBusPropertyInfo *info;
13079 gboolean ret;
13080 ret = FALSE;
13081 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name);
13082 g_assert (info != NULL);
13083 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
13084 if (pspec == NULL)
13085 {
13086 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
13087 }
13088 else
13089 {
13090 if (info->use_gvariant)
13091 g_value_set_variant (&value, variant);
13092 else
13093 g_dbus_gvariant_to_gvalue (variant, &value);
13094 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
13095 g_value_unset (&value);
13096 ret = TRUE;
13097 }
13098 return ret;
13099}
13100
13101static const GDBusInterfaceVTable _control_bmc_skeleton_vtable =
13102{
13103 _control_bmc_skeleton_handle_method_call,
13104 _control_bmc_skeleton_handle_get_property,
13105 _control_bmc_skeleton_handle_set_property,
13106 {NULL}
13107};
13108
13109static GDBusInterfaceInfo *
13110control_bmc_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
13111{
13112 return control_bmc_interface_info ();
13113}
13114
13115static GDBusInterfaceVTable *
13116control_bmc_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
13117{
13118 return (GDBusInterfaceVTable *) &_control_bmc_skeleton_vtable;
13119}
13120
13121static GVariant *
13122control_bmc_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
13123{
13124 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (_skeleton);
13125
13126 GVariantBuilder builder;
13127 guint n;
13128 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
13129 if (_control_bmc_interface_info.parent_struct.properties == NULL)
13130 goto out;
13131 for (n = 0; _control_bmc_interface_info.parent_struct.properties[n] != NULL; n++)
13132 {
13133 GDBusPropertyInfo *info = _control_bmc_interface_info.parent_struct.properties[n];
13134 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
13135 {
13136 GVariant *value;
13137 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);
13138 if (value != NULL)
13139 {
13140 g_variant_take_ref (value);
13141 g_variant_builder_add (&builder, "{sv}", info->name, value);
13142 g_variant_unref (value);
13143 }
13144 }
13145 }
13146out:
13147 return g_variant_builder_end (&builder);
13148}
13149
13150static void
13151control_bmc_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
13152{
13153}
13154
13155static void control_bmc_skeleton_iface_init (ControlBmcIface *iface);
13156#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13157G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
13158 G_ADD_PRIVATE (ControlBmcSkeleton)
13159 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init));
13160
13161#else
13162G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
13163 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init));
13164
13165#endif
13166static void
13167control_bmc_skeleton_finalize (GObject *object)
13168{
13169 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (object);
13170 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
13171 if (skeleton->priv->changed_properties_idle_source != NULL)
13172 g_source_destroy (skeleton->priv->changed_properties_idle_source);
13173 g_main_context_unref (skeleton->priv->context);
13174 g_mutex_clear (&skeleton->priv->lock);
13175 G_OBJECT_CLASS (control_bmc_skeleton_parent_class)->finalize (object);
13176}
13177
13178static void
13179control_bmc_skeleton_init (ControlBmcSkeleton *skeleton)
13180{
13181#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13182 skeleton->priv = control_bmc_skeleton_get_instance_private (skeleton);
13183#else
13184 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_BMC_SKELETON, ControlBmcSkeletonPrivate);
13185#endif
13186
13187 g_mutex_init (&skeleton->priv->lock);
13188 skeleton->priv->context = g_main_context_ref_thread_default ();
13189}
13190
13191static void
13192control_bmc_skeleton_class_init (ControlBmcSkeletonClass *klass)
13193{
13194 GObjectClass *gobject_class;
13195 GDBusInterfaceSkeletonClass *skeleton_class;
13196
13197 gobject_class = G_OBJECT_CLASS (klass);
13198 gobject_class->finalize = control_bmc_skeleton_finalize;
13199
13200 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
13201 skeleton_class->get_info = control_bmc_skeleton_dbus_interface_get_info;
13202 skeleton_class->get_properties = control_bmc_skeleton_dbus_interface_get_properties;
13203 skeleton_class->flush = control_bmc_skeleton_dbus_interface_flush;
13204 skeleton_class->get_vtable = control_bmc_skeleton_dbus_interface_get_vtable;
13205
13206#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
13207 g_type_class_add_private (klass, sizeof (ControlBmcSkeletonPrivate));
13208#endif
13209}
13210
13211static void
13212control_bmc_skeleton_iface_init (ControlBmcIface *iface)
13213{
13214}
13215
13216/**
13217 * control_bmc_skeleton_new:
13218 *
13219 * 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>.
13220 *
13221 * Returns: (transfer full) (type ControlBmcSkeleton): The skeleton object.
13222 */
13223ControlBmc *
13224control_bmc_skeleton_new (void)
13225{
13226 return CONTROL_BMC (g_object_new (TYPE_CONTROL_BMC_SKELETON, NULL));
13227}
13228
13229/* ------------------------------------------------------------------------
13230 * Code for interface org.openbmc.control.Host
13231 * ------------------------------------------------------------------------
13232 */
13233
13234/**
13235 * SECTION:ControlHost
13236 * @title: ControlHost
13237 * @short_description: Generated C code for the org.openbmc.control.Host D-Bus interface
13238 *
13239 * 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.
13240 */
13241
13242/* ---- Introspection data for org.openbmc.control.Host ---- */
13243
13244static const _ExtendedGDBusMethodInfo _control_host_method_info_boot =
13245{
13246 {
13247 -1,
13248 (gchar *) "boot",
13249 NULL,
13250 NULL,
13251 NULL
13252 },
13253 "handle-boot",
13254 FALSE
13255};
13256
13257static const _ExtendedGDBusMethodInfo _control_host_method_info_shutdown =
13258{
13259 {
13260 -1,
13261 (gchar *) "shutdown",
13262 NULL,
13263 NULL,
13264 NULL
13265 },
13266 "handle-shutdown",
13267 FALSE
13268};
13269
13270static const _ExtendedGDBusMethodInfo _control_host_method_info_reboot =
13271{
13272 {
13273 -1,
13274 (gchar *) "reboot",
13275 NULL,
13276 NULL,
13277 NULL
13278 },
13279 "handle-reboot",
13280 FALSE
13281};
13282
13283static const _ExtendedGDBusMethodInfo * const _control_host_method_info_pointers[] =
13284{
13285 &_control_host_method_info_boot,
13286 &_control_host_method_info_shutdown,
13287 &_control_host_method_info_reboot,
13288 NULL
13289};
13290
13291static const _ExtendedGDBusSignalInfo _control_host_signal_info_booted =
13292{
13293 {
13294 -1,
13295 (gchar *) "Booted",
13296 NULL,
13297 NULL
13298 },
13299 "booted"
13300};
13301
13302static const _ExtendedGDBusSignalInfo * const _control_host_signal_info_pointers[] =
13303{
13304 &_control_host_signal_info_booted,
13305 NULL
13306};
13307
13308static const _ExtendedGDBusInterfaceInfo _control_host_interface_info =
13309{
13310 {
13311 -1,
13312 (gchar *) "org.openbmc.control.Host",
13313 (GDBusMethodInfo **) &_control_host_method_info_pointers,
13314 (GDBusSignalInfo **) &_control_host_signal_info_pointers,
13315 NULL,
13316 NULL
13317 },
13318 "control-host",
13319};
13320
13321
13322/**
13323 * control_host_interface_info:
13324 *
13325 * 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.
13326 *
13327 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
13328 */
13329GDBusInterfaceInfo *
13330control_host_interface_info (void)
13331{
13332 return (GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct;
13333}
13334
13335/**
13336 * control_host_override_properties:
13337 * @klass: The class structure for a #GObject<!-- -->-derived class.
13338 * @property_id_begin: The property id to assign to the first overridden property.
13339 *
13340 * Overrides all #GObject properties in the #ControlHost interface for a concrete class.
13341 * The properties are overridden in the order they are defined.
13342 *
13343 * Returns: The last property id.
13344 */
13345guint
13346control_host_override_properties (GObjectClass *klass, guint property_id_begin)
13347{
13348 return property_id_begin - 1;
13349}
13350
13351
13352
13353/**
13354 * ControlHost:
13355 *
13356 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
13357 */
13358
13359/**
13360 * ControlHostIface:
13361 * @parent_iface: The parent interface.
13362 * @handle_boot: Handler for the #ControlHost::handle-boot signal.
13363 * @handle_reboot: Handler for the #ControlHost::handle-reboot signal.
13364 * @handle_shutdown: Handler for the #ControlHost::handle-shutdown signal.
13365 * @booted: Handler for the #ControlHost::booted signal.
13366 *
13367 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
13368 */
13369
13370typedef ControlHostIface ControlHostInterface;
13371G_DEFINE_INTERFACE (ControlHost, control_host, G_TYPE_OBJECT);
13372
13373static void
13374control_host_default_init (ControlHostIface *iface)
13375{
13376 /* GObject signals for incoming D-Bus method calls: */
13377 /**
13378 * ControlHost::handle-boot:
13379 * @object: A #ControlHost.
13380 * @invocation: A #GDBusMethodInvocation.
13381 *
13382 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method.
13383 *
13384 * 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.
13385 *
13386 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
13387 */
13388 g_signal_new ("handle-boot",
13389 G_TYPE_FROM_INTERFACE (iface),
13390 G_SIGNAL_RUN_LAST,
13391 G_STRUCT_OFFSET (ControlHostIface, handle_boot),
13392 g_signal_accumulator_true_handled,
13393 NULL,
13394 g_cclosure_marshal_generic,
13395 G_TYPE_BOOLEAN,
13396 1,
13397 G_TYPE_DBUS_METHOD_INVOCATION);
13398
13399 /**
13400 * ControlHost::handle-shutdown:
13401 * @object: A #ControlHost.
13402 * @invocation: A #GDBusMethodInvocation.
13403 *
13404 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method.
13405 *
13406 * 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.
13407 *
13408 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
13409 */
13410 g_signal_new ("handle-shutdown",
13411 G_TYPE_FROM_INTERFACE (iface),
13412 G_SIGNAL_RUN_LAST,
13413 G_STRUCT_OFFSET (ControlHostIface, handle_shutdown),
13414 g_signal_accumulator_true_handled,
13415 NULL,
13416 g_cclosure_marshal_generic,
13417 G_TYPE_BOOLEAN,
13418 1,
13419 G_TYPE_DBUS_METHOD_INVOCATION);
13420
13421 /**
13422 * ControlHost::handle-reboot:
13423 * @object: A #ControlHost.
13424 * @invocation: A #GDBusMethodInvocation.
13425 *
13426 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method.
13427 *
13428 * 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.
13429 *
13430 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
13431 */
13432 g_signal_new ("handle-reboot",
13433 G_TYPE_FROM_INTERFACE (iface),
13434 G_SIGNAL_RUN_LAST,
13435 G_STRUCT_OFFSET (ControlHostIface, handle_reboot),
13436 g_signal_accumulator_true_handled,
13437 NULL,
13438 g_cclosure_marshal_generic,
13439 G_TYPE_BOOLEAN,
13440 1,
13441 G_TYPE_DBUS_METHOD_INVOCATION);
13442
13443 /* GObject signals for received D-Bus signals: */
13444 /**
13445 * ControlHost::booted:
13446 * @object: A #ControlHost.
13447 *
13448 * 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.
13449 *
13450 * 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.
13451 */
13452 g_signal_new ("booted",
13453 G_TYPE_FROM_INTERFACE (iface),
13454 G_SIGNAL_RUN_LAST,
13455 G_STRUCT_OFFSET (ControlHostIface, booted),
13456 NULL,
13457 NULL,
13458 g_cclosure_marshal_generic,
13459 G_TYPE_NONE,
13460 0);
13461
13462}
13463
13464/**
13465 * control_host_emit_booted:
13466 * @object: A #ControlHost.
13467 *
13468 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Host.Booted">"Booted"</link> D-Bus signal.
13469 */
13470void
13471control_host_emit_booted (
13472 ControlHost *object)
13473{
13474 g_signal_emit_by_name (object, "booted");
13475}
13476
13477/**
13478 * control_host_call_boot:
13479 * @proxy: A #ControlHostProxy.
13480 * @cancellable: (allow-none): A #GCancellable or %NULL.
13481 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
13482 * @user_data: User data to pass to @callback.
13483 *
13484 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method on @proxy.
13485 * 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.
13486 * You can then call control_host_call_boot_finish() to get the result of the operation.
13487 *
13488 * See control_host_call_boot_sync() for the synchronous, blocking version of this method.
13489 */
13490void
13491control_host_call_boot (
13492 ControlHost *proxy,
13493 GCancellable *cancellable,
13494 GAsyncReadyCallback callback,
13495 gpointer user_data)
13496{
13497 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
13498 "boot",
13499 g_variant_new ("()"),
13500 G_DBUS_CALL_FLAGS_NONE,
13501 -1,
13502 cancellable,
13503 callback,
13504 user_data);
13505}
13506
13507/**
13508 * control_host_call_boot_finish:
13509 * @proxy: A #ControlHostProxy.
13510 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_boot().
13511 * @error: Return location for error or %NULL.
13512 *
13513 * Finishes an operation started with control_host_call_boot().
13514 *
13515 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13516 */
13517gboolean
13518control_host_call_boot_finish (
13519 ControlHost *proxy,
13520 GAsyncResult *res,
13521 GError **error)
13522{
13523 GVariant *_ret;
13524 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
13525 if (_ret == NULL)
13526 goto _out;
13527 g_variant_get (_ret,
13528 "()");
13529 g_variant_unref (_ret);
13530_out:
13531 return _ret != NULL;
13532}
13533
13534/**
13535 * control_host_call_boot_sync:
13536 * @proxy: A #ControlHostProxy.
13537 * @cancellable: (allow-none): A #GCancellable or %NULL.
13538 * @error: Return location for error or %NULL.
13539 *
13540 * 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.
13541 *
13542 * See control_host_call_boot() for the asynchronous version of this method.
13543 *
13544 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13545 */
13546gboolean
13547control_host_call_boot_sync (
13548 ControlHost *proxy,
13549 GCancellable *cancellable,
13550 GError **error)
13551{
13552 GVariant *_ret;
13553 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
13554 "boot",
13555 g_variant_new ("()"),
13556 G_DBUS_CALL_FLAGS_NONE,
13557 -1,
13558 cancellable,
13559 error);
13560 if (_ret == NULL)
13561 goto _out;
13562 g_variant_get (_ret,
13563 "()");
13564 g_variant_unref (_ret);
13565_out:
13566 return _ret != NULL;
13567}
13568
13569/**
13570 * control_host_call_shutdown:
13571 * @proxy: A #ControlHostProxy.
13572 * @cancellable: (allow-none): A #GCancellable or %NULL.
13573 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
13574 * @user_data: User data to pass to @callback.
13575 *
13576 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method on @proxy.
13577 * 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.
13578 * You can then call control_host_call_shutdown_finish() to get the result of the operation.
13579 *
13580 * See control_host_call_shutdown_sync() for the synchronous, blocking version of this method.
13581 */
13582void
13583control_host_call_shutdown (
13584 ControlHost *proxy,
13585 GCancellable *cancellable,
13586 GAsyncReadyCallback callback,
13587 gpointer user_data)
13588{
13589 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
13590 "shutdown",
13591 g_variant_new ("()"),
13592 G_DBUS_CALL_FLAGS_NONE,
13593 -1,
13594 cancellable,
13595 callback,
13596 user_data);
13597}
13598
13599/**
13600 * control_host_call_shutdown_finish:
13601 * @proxy: A #ControlHostProxy.
13602 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_shutdown().
13603 * @error: Return location for error or %NULL.
13604 *
13605 * Finishes an operation started with control_host_call_shutdown().
13606 *
13607 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13608 */
13609gboolean
13610control_host_call_shutdown_finish (
13611 ControlHost *proxy,
13612 GAsyncResult *res,
13613 GError **error)
13614{
13615 GVariant *_ret;
13616 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
13617 if (_ret == NULL)
13618 goto _out;
13619 g_variant_get (_ret,
13620 "()");
13621 g_variant_unref (_ret);
13622_out:
13623 return _ret != NULL;
13624}
13625
13626/**
13627 * control_host_call_shutdown_sync:
13628 * @proxy: A #ControlHostProxy.
13629 * @cancellable: (allow-none): A #GCancellable or %NULL.
13630 * @error: Return location for error or %NULL.
13631 *
13632 * 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.
13633 *
13634 * See control_host_call_shutdown() for the asynchronous version of this method.
13635 *
13636 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13637 */
13638gboolean
13639control_host_call_shutdown_sync (
13640 ControlHost *proxy,
13641 GCancellable *cancellable,
13642 GError **error)
13643{
13644 GVariant *_ret;
13645 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
13646 "shutdown",
13647 g_variant_new ("()"),
13648 G_DBUS_CALL_FLAGS_NONE,
13649 -1,
13650 cancellable,
13651 error);
13652 if (_ret == NULL)
13653 goto _out;
13654 g_variant_get (_ret,
13655 "()");
13656 g_variant_unref (_ret);
13657_out:
13658 return _ret != NULL;
13659}
13660
13661/**
13662 * control_host_call_reboot:
13663 * @proxy: A #ControlHostProxy.
13664 * @cancellable: (allow-none): A #GCancellable or %NULL.
13665 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
13666 * @user_data: User data to pass to @callback.
13667 *
13668 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method on @proxy.
13669 * 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.
13670 * You can then call control_host_call_reboot_finish() to get the result of the operation.
13671 *
13672 * See control_host_call_reboot_sync() for the synchronous, blocking version of this method.
13673 */
13674void
13675control_host_call_reboot (
13676 ControlHost *proxy,
13677 GCancellable *cancellable,
13678 GAsyncReadyCallback callback,
13679 gpointer user_data)
13680{
13681 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
13682 "reboot",
13683 g_variant_new ("()"),
13684 G_DBUS_CALL_FLAGS_NONE,
13685 -1,
13686 cancellable,
13687 callback,
13688 user_data);
13689}
13690
13691/**
13692 * control_host_call_reboot_finish:
13693 * @proxy: A #ControlHostProxy.
13694 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_reboot().
13695 * @error: Return location for error or %NULL.
13696 *
13697 * Finishes an operation started with control_host_call_reboot().
13698 *
13699 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13700 */
13701gboolean
13702control_host_call_reboot_finish (
13703 ControlHost *proxy,
13704 GAsyncResult *res,
13705 GError **error)
13706{
13707 GVariant *_ret;
13708 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
13709 if (_ret == NULL)
13710 goto _out;
13711 g_variant_get (_ret,
13712 "()");
13713 g_variant_unref (_ret);
13714_out:
13715 return _ret != NULL;
13716}
13717
13718/**
13719 * control_host_call_reboot_sync:
13720 * @proxy: A #ControlHostProxy.
13721 * @cancellable: (allow-none): A #GCancellable or %NULL.
13722 * @error: Return location for error or %NULL.
13723 *
13724 * 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.
13725 *
13726 * See control_host_call_reboot() for the asynchronous version of this method.
13727 *
13728 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13729 */
13730gboolean
13731control_host_call_reboot_sync (
13732 ControlHost *proxy,
13733 GCancellable *cancellable,
13734 GError **error)
13735{
13736 GVariant *_ret;
13737 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
13738 "reboot",
13739 g_variant_new ("()"),
13740 G_DBUS_CALL_FLAGS_NONE,
13741 -1,
13742 cancellable,
13743 error);
13744 if (_ret == NULL)
13745 goto _out;
13746 g_variant_get (_ret,
13747 "()");
13748 g_variant_unref (_ret);
13749_out:
13750 return _ret != NULL;
13751}
13752
13753/**
13754 * control_host_complete_boot:
13755 * @object: A #ControlHost.
13756 * @invocation: (transfer full): A #GDBusMethodInvocation.
13757 *
13758 * 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.
13759 *
13760 * This method will free @invocation, you cannot use it afterwards.
13761 */
13762void
13763control_host_complete_boot (
13764 ControlHost *object,
13765 GDBusMethodInvocation *invocation)
13766{
13767 g_dbus_method_invocation_return_value (invocation,
13768 g_variant_new ("()"));
13769}
13770
13771/**
13772 * control_host_complete_shutdown:
13773 * @object: A #ControlHost.
13774 * @invocation: (transfer full): A #GDBusMethodInvocation.
13775 *
13776 * 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.
13777 *
13778 * This method will free @invocation, you cannot use it afterwards.
13779 */
13780void
13781control_host_complete_shutdown (
13782 ControlHost *object,
13783 GDBusMethodInvocation *invocation)
13784{
13785 g_dbus_method_invocation_return_value (invocation,
13786 g_variant_new ("()"));
13787}
13788
13789/**
13790 * control_host_complete_reboot:
13791 * @object: A #ControlHost.
13792 * @invocation: (transfer full): A #GDBusMethodInvocation.
13793 *
13794 * 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.
13795 *
13796 * This method will free @invocation, you cannot use it afterwards.
13797 */
13798void
13799control_host_complete_reboot (
13800 ControlHost *object,
13801 GDBusMethodInvocation *invocation)
13802{
13803 g_dbus_method_invocation_return_value (invocation,
13804 g_variant_new ("()"));
13805}
13806
13807/* ------------------------------------------------------------------------ */
13808
13809/**
13810 * ControlHostProxy:
13811 *
13812 * The #ControlHostProxy structure contains only private data and should only be accessed using the provided API.
13813 */
13814
13815/**
13816 * ControlHostProxyClass:
13817 * @parent_class: The parent class.
13818 *
13819 * Class structure for #ControlHostProxy.
13820 */
13821
13822struct _ControlHostProxyPrivate
13823{
13824 GData *qdata;
13825};
13826
13827static void control_host_proxy_iface_init (ControlHostIface *iface);
13828
13829#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13830G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
13831 G_ADD_PRIVATE (ControlHostProxy)
13832 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
13833
13834#else
13835G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
13836 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
13837
13838#endif
13839static void
13840control_host_proxy_finalize (GObject *object)
13841{
13842 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object);
13843 g_datalist_clear (&proxy->priv->qdata);
13844 G_OBJECT_CLASS (control_host_proxy_parent_class)->finalize (object);
13845}
13846
13847static void
13848control_host_proxy_get_property (GObject *object,
13849 guint prop_id,
13850 GValue *value,
13851 GParamSpec *pspec G_GNUC_UNUSED)
13852{
13853}
13854
13855static void
13856control_host_proxy_set_property (GObject *object,
13857 guint prop_id,
13858 const GValue *value,
13859 GParamSpec *pspec G_GNUC_UNUSED)
13860{
13861}
13862
13863static void
13864control_host_proxy_g_signal (GDBusProxy *proxy,
13865 const gchar *sender_name G_GNUC_UNUSED,
13866 const gchar *signal_name,
13867 GVariant *parameters)
13868{
13869 _ExtendedGDBusSignalInfo *info;
13870 GVariantIter iter;
13871 GVariant *child;
13872 GValue *paramv;
13873 guint num_params;
13874 guint n;
13875 guint signal_id;
13876 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, signal_name);
13877 if (info == NULL)
13878 return;
13879 num_params = g_variant_n_children (parameters);
13880 paramv = g_new0 (GValue, num_params + 1);
13881 g_value_init (&paramv[0], TYPE_CONTROL_HOST);
13882 g_value_set_object (&paramv[0], proxy);
13883 g_variant_iter_init (&iter, parameters);
13884 n = 1;
13885 while ((child = g_variant_iter_next_value (&iter)) != NULL)
13886 {
13887 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
13888 if (arg_info->use_gvariant)
13889 {
13890 g_value_init (&paramv[n], G_TYPE_VARIANT);
13891 g_value_set_variant (&paramv[n], child);
13892 n++;
13893 }
13894 else
13895 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
13896 g_variant_unref (child);
13897 }
13898 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
13899 g_signal_emitv (paramv, signal_id, 0, NULL);
13900 for (n = 0; n < num_params + 1; n++)
13901 g_value_unset (&paramv[n]);
13902 g_free (paramv);
13903}
13904
13905static void
13906control_host_proxy_g_properties_changed (GDBusProxy *_proxy,
13907 GVariant *changed_properties,
13908 const gchar *const *invalidated_properties)
13909{
13910 ControlHostProxy *proxy = CONTROL_HOST_PROXY (_proxy);
13911 guint n;
13912 const gchar *key;
13913 GVariantIter *iter;
13914 _ExtendedGDBusPropertyInfo *info;
13915 g_variant_get (changed_properties, "a{sv}", &iter);
13916 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
13917 {
13918 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, key);
13919 g_datalist_remove_data (&proxy->priv->qdata, key);
13920 if (info != NULL)
13921 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
13922 }
13923 g_variant_iter_free (iter);
13924 for (n = 0; invalidated_properties[n] != NULL; n++)
13925 {
13926 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, invalidated_properties[n]);
13927 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
13928 if (info != NULL)
13929 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
13930 }
13931}
13932
13933static void
13934control_host_proxy_init (ControlHostProxy *proxy)
13935{
13936#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13937 proxy->priv = control_host_proxy_get_instance_private (proxy);
13938#else
13939 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_HOST_PROXY, ControlHostProxyPrivate);
13940#endif
13941
13942 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_host_interface_info ());
13943}
13944
13945static void
13946control_host_proxy_class_init (ControlHostProxyClass *klass)
13947{
13948 GObjectClass *gobject_class;
13949 GDBusProxyClass *proxy_class;
13950
13951 gobject_class = G_OBJECT_CLASS (klass);
13952 gobject_class->finalize = control_host_proxy_finalize;
13953 gobject_class->get_property = control_host_proxy_get_property;
13954 gobject_class->set_property = control_host_proxy_set_property;
13955
13956 proxy_class = G_DBUS_PROXY_CLASS (klass);
13957 proxy_class->g_signal = control_host_proxy_g_signal;
13958 proxy_class->g_properties_changed = control_host_proxy_g_properties_changed;
13959
13960#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
13961 g_type_class_add_private (klass, sizeof (ControlHostProxyPrivate));
13962#endif
13963}
13964
13965static void
13966control_host_proxy_iface_init (ControlHostIface *iface)
13967{
13968}
13969
13970/**
13971 * control_host_proxy_new:
13972 * @connection: A #GDBusConnection.
13973 * @flags: Flags from the #GDBusProxyFlags enumeration.
13974 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
13975 * @object_path: An object path.
13976 * @cancellable: (allow-none): A #GCancellable or %NULL.
13977 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
13978 * @user_data: User data to pass to @callback.
13979 *
13980 * 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.
13981 *
13982 * 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.
13983 * You can then call control_host_proxy_new_finish() to get the result of the operation.
13984 *
13985 * See control_host_proxy_new_sync() for the synchronous, blocking version of this constructor.
13986 */
13987void
13988control_host_proxy_new (
13989 GDBusConnection *connection,
13990 GDBusProxyFlags flags,
13991 const gchar *name,
13992 const gchar *object_path,
13993 GCancellable *cancellable,
13994 GAsyncReadyCallback callback,
13995 gpointer user_data)
13996{
13997 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);
13998}
13999
14000/**
14001 * control_host_proxy_new_finish:
14002 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new().
14003 * @error: Return location for error or %NULL
14004 *
14005 * Finishes an operation started with control_host_proxy_new().
14006 *
14007 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
14008 */
14009ControlHost *
14010control_host_proxy_new_finish (
14011 GAsyncResult *res,
14012 GError **error)
14013{
14014 GObject *ret;
14015 GObject *source_object;
14016 source_object = g_async_result_get_source_object (res);
14017 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
14018 g_object_unref (source_object);
14019 if (ret != NULL)
14020 return CONTROL_HOST (ret);
14021 else
14022 return NULL;
14023}
14024
14025/**
14026 * control_host_proxy_new_sync:
14027 * @connection: A #GDBusConnection.
14028 * @flags: Flags from the #GDBusProxyFlags enumeration.
14029 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
14030 * @object_path: An object path.
14031 * @cancellable: (allow-none): A #GCancellable or %NULL.
14032 * @error: Return location for error or %NULL
14033 *
14034 * 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.
14035 *
14036 * The calling thread is blocked until a reply is received.
14037 *
14038 * See control_host_proxy_new() for the asynchronous version of this constructor.
14039 *
14040 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
14041 */
14042ControlHost *
14043control_host_proxy_new_sync (
14044 GDBusConnection *connection,
14045 GDBusProxyFlags flags,
14046 const gchar *name,
14047 const gchar *object_path,
14048 GCancellable *cancellable,
14049 GError **error)
14050{
14051 GInitable *ret;
14052 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);
14053 if (ret != NULL)
14054 return CONTROL_HOST (ret);
14055 else
14056 return NULL;
14057}
14058
14059
14060/**
14061 * control_host_proxy_new_for_bus:
14062 * @bus_type: A #GBusType.
14063 * @flags: Flags from the #GDBusProxyFlags enumeration.
14064 * @name: A bus name (well-known or unique).
14065 * @object_path: An object path.
14066 * @cancellable: (allow-none): A #GCancellable or %NULL.
14067 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
14068 * @user_data: User data to pass to @callback.
14069 *
14070 * Like control_host_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
14071 *
14072 * 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.
14073 * You can then call control_host_proxy_new_for_bus_finish() to get the result of the operation.
14074 *
14075 * See control_host_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
14076 */
14077void
14078control_host_proxy_new_for_bus (
14079 GBusType bus_type,
14080 GDBusProxyFlags flags,
14081 const gchar *name,
14082 const gchar *object_path,
14083 GCancellable *cancellable,
14084 GAsyncReadyCallback callback,
14085 gpointer user_data)
14086{
14087 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);
14088}
14089
14090/**
14091 * control_host_proxy_new_for_bus_finish:
14092 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new_for_bus().
14093 * @error: Return location for error or %NULL
14094 *
14095 * Finishes an operation started with control_host_proxy_new_for_bus().
14096 *
14097 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
14098 */
14099ControlHost *
14100control_host_proxy_new_for_bus_finish (
14101 GAsyncResult *res,
14102 GError **error)
14103{
14104 GObject *ret;
14105 GObject *source_object;
14106 source_object = g_async_result_get_source_object (res);
14107 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
14108 g_object_unref (source_object);
14109 if (ret != NULL)
14110 return CONTROL_HOST (ret);
14111 else
14112 return NULL;
14113}
14114
14115/**
14116 * control_host_proxy_new_for_bus_sync:
14117 * @bus_type: A #GBusType.
14118 * @flags: Flags from the #GDBusProxyFlags enumeration.
14119 * @name: A bus name (well-known or unique).
14120 * @object_path: An object path.
14121 * @cancellable: (allow-none): A #GCancellable or %NULL.
14122 * @error: Return location for error or %NULL
14123 *
14124 * Like control_host_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
14125 *
14126 * The calling thread is blocked until a reply is received.
14127 *
14128 * See control_host_proxy_new_for_bus() for the asynchronous version of this constructor.
14129 *
14130 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
14131 */
14132ControlHost *
14133control_host_proxy_new_for_bus_sync (
14134 GBusType bus_type,
14135 GDBusProxyFlags flags,
14136 const gchar *name,
14137 const gchar *object_path,
14138 GCancellable *cancellable,
14139 GError **error)
14140{
14141 GInitable *ret;
14142 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);
14143 if (ret != NULL)
14144 return CONTROL_HOST (ret);
14145 else
14146 return NULL;
14147}
14148
14149
14150/* ------------------------------------------------------------------------ */
14151
14152/**
14153 * ControlHostSkeleton:
14154 *
14155 * The #ControlHostSkeleton structure contains only private data and should only be accessed using the provided API.
14156 */
14157
14158/**
14159 * ControlHostSkeletonClass:
14160 * @parent_class: The parent class.
14161 *
14162 * Class structure for #ControlHostSkeleton.
14163 */
14164
14165struct _ControlHostSkeletonPrivate
14166{
14167 GValue *properties;
14168 GList *changed_properties;
14169 GSource *changed_properties_idle_source;
14170 GMainContext *context;
14171 GMutex lock;
14172};
14173
14174static void
14175_control_host_skeleton_handle_method_call (
14176 GDBusConnection *connection G_GNUC_UNUSED,
14177 const gchar *sender G_GNUC_UNUSED,
14178 const gchar *object_path G_GNUC_UNUSED,
14179 const gchar *interface_name,
14180 const gchar *method_name,
14181 GVariant *parameters,
14182 GDBusMethodInvocation *invocation,
14183 gpointer user_data)
14184{
14185 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
14186 _ExtendedGDBusMethodInfo *info;
14187 GVariantIter iter;
14188 GVariant *child;
14189 GValue *paramv;
14190 guint num_params;
14191 guint num_extra;
14192 guint n;
14193 guint signal_id;
14194 GValue return_value = G_VALUE_INIT;
14195 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
14196 g_assert (info != NULL);
14197 num_params = g_variant_n_children (parameters);
14198 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
14199 n = 0;
14200 g_value_init (&paramv[n], TYPE_CONTROL_HOST);
14201 g_value_set_object (&paramv[n++], skeleton);
14202 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
14203 g_value_set_object (&paramv[n++], invocation);
14204 if (info->pass_fdlist)
14205 {
14206#ifdef G_OS_UNIX
14207 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
14208 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
14209#else
14210 g_assert_not_reached ();
14211#endif
14212 }
14213 g_variant_iter_init (&iter, parameters);
14214 while ((child = g_variant_iter_next_value (&iter)) != NULL)
14215 {
14216 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
14217 if (arg_info->use_gvariant)
14218 {
14219 g_value_init (&paramv[n], G_TYPE_VARIANT);
14220 g_value_set_variant (&paramv[n], child);
14221 n++;
14222 }
14223 else
14224 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
14225 g_variant_unref (child);
14226 }
14227 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
14228 g_value_init (&return_value, G_TYPE_BOOLEAN);
14229 g_signal_emitv (paramv, signal_id, 0, &return_value);
14230 if (!g_value_get_boolean (&return_value))
14231 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);
14232 g_value_unset (&return_value);
14233 for (n = 0; n < num_params + num_extra; n++)
14234 g_value_unset (&paramv[n]);
14235 g_free (paramv);
14236}
14237
14238static GVariant *
14239_control_host_skeleton_handle_get_property (
14240 GDBusConnection *connection G_GNUC_UNUSED,
14241 const gchar *sender G_GNUC_UNUSED,
14242 const gchar *object_path G_GNUC_UNUSED,
14243 const gchar *interface_name G_GNUC_UNUSED,
14244 const gchar *property_name,
14245 GError **error,
14246 gpointer user_data)
14247{
14248 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
14249 GValue value = G_VALUE_INIT;
14250 GParamSpec *pspec;
14251 _ExtendedGDBusPropertyInfo *info;
14252 GVariant *ret;
14253 ret = NULL;
14254 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
14255 g_assert (info != NULL);
14256 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
14257 if (pspec == NULL)
14258 {
14259 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
14260 }
14261 else
14262 {
14263 g_value_init (&value, pspec->value_type);
14264 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
14265 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
14266 g_value_unset (&value);
14267 }
14268 return ret;
14269}
14270
14271static gboolean
14272_control_host_skeleton_handle_set_property (
14273 GDBusConnection *connection G_GNUC_UNUSED,
14274 const gchar *sender G_GNUC_UNUSED,
14275 const gchar *object_path G_GNUC_UNUSED,
14276 const gchar *interface_name G_GNUC_UNUSED,
14277 const gchar *property_name,
14278 GVariant *variant,
14279 GError **error,
14280 gpointer user_data)
14281{
14282 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
14283 GValue value = G_VALUE_INIT;
14284 GParamSpec *pspec;
14285 _ExtendedGDBusPropertyInfo *info;
14286 gboolean ret;
14287 ret = FALSE;
14288 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
14289 g_assert (info != NULL);
14290 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
14291 if (pspec == NULL)
14292 {
14293 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
14294 }
14295 else
14296 {
14297 if (info->use_gvariant)
14298 g_value_set_variant (&value, variant);
14299 else
14300 g_dbus_gvariant_to_gvalue (variant, &value);
14301 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
14302 g_value_unset (&value);
14303 ret = TRUE;
14304 }
14305 return ret;
14306}
14307
14308static const GDBusInterfaceVTable _control_host_skeleton_vtable =
14309{
14310 _control_host_skeleton_handle_method_call,
14311 _control_host_skeleton_handle_get_property,
14312 _control_host_skeleton_handle_set_property,
14313 {NULL}
14314};
14315
14316static GDBusInterfaceInfo *
14317control_host_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
14318{
14319 return control_host_interface_info ();
14320}
14321
14322static GDBusInterfaceVTable *
14323control_host_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
14324{
14325 return (GDBusInterfaceVTable *) &_control_host_skeleton_vtable;
14326}
14327
14328static GVariant *
14329control_host_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
14330{
14331 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton);
14332
14333 GVariantBuilder builder;
14334 guint n;
14335 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
14336 if (_control_host_interface_info.parent_struct.properties == NULL)
14337 goto out;
14338 for (n = 0; _control_host_interface_info.parent_struct.properties[n] != NULL; n++)
14339 {
14340 GDBusPropertyInfo *info = _control_host_interface_info.parent_struct.properties[n];
14341 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
14342 {
14343 GVariant *value;
14344 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);
14345 if (value != NULL)
14346 {
14347 g_variant_take_ref (value);
14348 g_variant_builder_add (&builder, "{sv}", info->name, value);
14349 g_variant_unref (value);
14350 }
14351 }
14352 }
14353out:
14354 return g_variant_builder_end (&builder);
14355}
14356
14357static void
14358control_host_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
14359{
14360}
14361
14362static void
14363_control_host_on_signal_booted (
14364 ControlHost *object)
14365{
14366 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
14367
14368 GList *connections, *l;
14369 GVariant *signal_variant;
14370 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
14371
14372 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
14373 for (l = connections; l != NULL; l = l->next)
14374 {
14375 GDBusConnection *connection = l->data;
14376 g_dbus_connection_emit_signal (connection,
14377 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Host", "Booted",
14378 signal_variant, NULL);
14379 }
14380 g_variant_unref (signal_variant);
14381 g_list_free_full (connections, g_object_unref);
14382}
14383
14384static void control_host_skeleton_iface_init (ControlHostIface *iface);
14385#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14386G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
14387 G_ADD_PRIVATE (ControlHostSkeleton)
14388 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
14389
14390#else
14391G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
14392 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
14393
14394#endif
14395static void
14396control_host_skeleton_finalize (GObject *object)
14397{
14398 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
14399 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
14400 if (skeleton->priv->changed_properties_idle_source != NULL)
14401 g_source_destroy (skeleton->priv->changed_properties_idle_source);
14402 g_main_context_unref (skeleton->priv->context);
14403 g_mutex_clear (&skeleton->priv->lock);
14404 G_OBJECT_CLASS (control_host_skeleton_parent_class)->finalize (object);
14405}
14406
14407static void
14408control_host_skeleton_init (ControlHostSkeleton *skeleton)
14409{
14410#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14411 skeleton->priv = control_host_skeleton_get_instance_private (skeleton);
14412#else
14413 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_HOST_SKELETON, ControlHostSkeletonPrivate);
14414#endif
14415
14416 g_mutex_init (&skeleton->priv->lock);
14417 skeleton->priv->context = g_main_context_ref_thread_default ();
14418}
14419
14420static void
14421control_host_skeleton_class_init (ControlHostSkeletonClass *klass)
14422{
14423 GObjectClass *gobject_class;
14424 GDBusInterfaceSkeletonClass *skeleton_class;
14425
14426 gobject_class = G_OBJECT_CLASS (klass);
14427 gobject_class->finalize = control_host_skeleton_finalize;
14428
14429 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
14430 skeleton_class->get_info = control_host_skeleton_dbus_interface_get_info;
14431 skeleton_class->get_properties = control_host_skeleton_dbus_interface_get_properties;
14432 skeleton_class->flush = control_host_skeleton_dbus_interface_flush;
14433 skeleton_class->get_vtable = control_host_skeleton_dbus_interface_get_vtable;
14434
14435#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
14436 g_type_class_add_private (klass, sizeof (ControlHostSkeletonPrivate));
14437#endif
14438}
14439
14440static void
14441control_host_skeleton_iface_init (ControlHostIface *iface)
14442{
14443 iface->booted = _control_host_on_signal_booted;
14444}
14445
14446/**
14447 * control_host_skeleton_new:
14448 *
14449 * 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>.
14450 *
14451 * Returns: (transfer full) (type ControlHostSkeleton): The skeleton object.
14452 */
14453ControlHost *
14454control_host_skeleton_new (void)
14455{
14456 return CONTROL_HOST (g_object_new (TYPE_CONTROL_HOST_SKELETON, NULL));
14457}
14458
14459/* ------------------------------------------------------------------------
14460 * Code for interface org.openbmc.control.Power
14461 * ------------------------------------------------------------------------
14462 */
14463
14464/**
14465 * SECTION:ControlPower
14466 * @title: ControlPower
14467 * @short_description: Generated C code for the org.openbmc.control.Power D-Bus interface
14468 *
14469 * 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.
14470 */
14471
14472/* ---- Introspection data for org.openbmc.control.Power ---- */
14473
14474static const _ExtendedGDBusArgInfo _control_power_method_info_set_power_state_IN_ARG_state =
14475{
14476 {
14477 -1,
14478 (gchar *) "state",
14479 (gchar *) "i",
14480 NULL
14481 },
14482 FALSE
14483};
14484
14485static const _ExtendedGDBusArgInfo * const _control_power_method_info_set_power_state_IN_ARG_pointers[] =
14486{
14487 &_control_power_method_info_set_power_state_IN_ARG_state,
14488 NULL
14489};
14490
14491static const _ExtendedGDBusMethodInfo _control_power_method_info_set_power_state =
14492{
14493 {
14494 -1,
14495 (gchar *) "setPowerState",
14496 (GDBusArgInfo **) &_control_power_method_info_set_power_state_IN_ARG_pointers,
14497 NULL,
14498 NULL
14499 },
14500 "handle-set-power-state",
14501 FALSE
14502};
14503
14504static const _ExtendedGDBusArgInfo _control_power_method_info_get_power_state_OUT_ARG_state =
14505{
14506 {
14507 -1,
14508 (gchar *) "state",
14509 (gchar *) "i",
14510 NULL
14511 },
14512 FALSE
14513};
14514
14515static const _ExtendedGDBusArgInfo * const _control_power_method_info_get_power_state_OUT_ARG_pointers[] =
14516{
14517 &_control_power_method_info_get_power_state_OUT_ARG_state,
14518 NULL
14519};
14520
14521static const _ExtendedGDBusMethodInfo _control_power_method_info_get_power_state =
14522{
14523 {
14524 -1,
14525 (gchar *) "getPowerState",
14526 NULL,
14527 (GDBusArgInfo **) &_control_power_method_info_get_power_state_OUT_ARG_pointers,
14528 NULL
14529 },
14530 "handle-get-power-state",
14531 FALSE
14532};
14533
14534static const _ExtendedGDBusMethodInfo * const _control_power_method_info_pointers[] =
14535{
14536 &_control_power_method_info_set_power_state,
14537 &_control_power_method_info_get_power_state,
14538 NULL
14539};
14540
14541static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_good =
14542{
14543 {
14544 -1,
14545 (gchar *) "PowerGood",
14546 NULL,
14547 NULL
14548 },
14549 "power-good"
14550};
14551
14552static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_lost =
14553{
14554 {
14555 -1,
14556 (gchar *) "PowerLost",
14557 NULL,
14558 NULL
14559 },
14560 "power-lost"
14561};
14562
14563static const _ExtendedGDBusSignalInfo * const _control_power_signal_info_pointers[] =
14564{
14565 &_control_power_signal_info_power_good,
14566 &_control_power_signal_info_power_lost,
14567 NULL
14568};
14569
14570static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood =
14571{
14572 {
14573 -1,
14574 (gchar *) "pgood",
14575 (gchar *) "i",
14576 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
14577 NULL
14578 },
14579 "pgood",
14580 FALSE
14581};
14582
14583static const _ExtendedGDBusPropertyInfo _control_power_property_info_state =
14584{
14585 {
14586 -1,
14587 (gchar *) "state",
14588 (gchar *) "i",
14589 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
14590 NULL
14591 },
14592 "state",
14593 FALSE
14594};
14595
Norman James32e74e22015-09-15 21:28:06 -050014596static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood_timeout =
14597{
14598 {
14599 -1,
14600 (gchar *) "pgood_timeout",
14601 (gchar *) "i",
14602 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
14603 NULL
14604 },
14605 "pgood-timeout",
14606 FALSE
14607};
14608
Norman James362a80f2015-09-14 14:04:39 -050014609static const _ExtendedGDBusPropertyInfo * const _control_power_property_info_pointers[] =
14610{
14611 &_control_power_property_info_pgood,
14612 &_control_power_property_info_state,
Norman James32e74e22015-09-15 21:28:06 -050014613 &_control_power_property_info_pgood_timeout,
Norman James362a80f2015-09-14 14:04:39 -050014614 NULL
14615};
14616
14617static const _ExtendedGDBusInterfaceInfo _control_power_interface_info =
14618{
14619 {
14620 -1,
14621 (gchar *) "org.openbmc.control.Power",
14622 (GDBusMethodInfo **) &_control_power_method_info_pointers,
14623 (GDBusSignalInfo **) &_control_power_signal_info_pointers,
14624 (GDBusPropertyInfo **) &_control_power_property_info_pointers,
14625 NULL
14626 },
14627 "control-power",
14628};
14629
14630
14631/**
14632 * control_power_interface_info:
14633 *
14634 * 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.
14635 *
14636 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
14637 */
14638GDBusInterfaceInfo *
14639control_power_interface_info (void)
14640{
14641 return (GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct;
14642}
14643
14644/**
14645 * control_power_override_properties:
14646 * @klass: The class structure for a #GObject<!-- -->-derived class.
14647 * @property_id_begin: The property id to assign to the first overridden property.
14648 *
14649 * Overrides all #GObject properties in the #ControlPower interface for a concrete class.
14650 * The properties are overridden in the order they are defined.
14651 *
14652 * Returns: The last property id.
14653 */
14654guint
14655control_power_override_properties (GObjectClass *klass, guint property_id_begin)
14656{
14657 g_object_class_override_property (klass, property_id_begin++, "pgood");
14658 g_object_class_override_property (klass, property_id_begin++, "state");
Norman James32e74e22015-09-15 21:28:06 -050014659 g_object_class_override_property (klass, property_id_begin++, "pgood-timeout");
Norman James362a80f2015-09-14 14:04:39 -050014660 return property_id_begin - 1;
14661}
14662
14663
14664
14665/**
14666 * ControlPower:
14667 *
14668 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
14669 */
14670
14671/**
14672 * ControlPowerIface:
14673 * @parent_iface: The parent interface.
14674 * @handle_get_power_state: Handler for the #ControlPower::handle-get-power-state signal.
14675 * @handle_set_power_state: Handler for the #ControlPower::handle-set-power-state signal.
14676 * @get_pgood: Getter for the #ControlPower:pgood property.
Norman James32e74e22015-09-15 21:28:06 -050014677 * @get_pgood_timeout: Getter for the #ControlPower:pgood-timeout property.
Norman James362a80f2015-09-14 14:04:39 -050014678 * @get_state: Getter for the #ControlPower:state property.
14679 * @power_good: Handler for the #ControlPower::power-good signal.
14680 * @power_lost: Handler for the #ControlPower::power-lost signal.
14681 *
14682 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
14683 */
14684
14685typedef ControlPowerIface ControlPowerInterface;
14686G_DEFINE_INTERFACE (ControlPower, control_power, G_TYPE_OBJECT);
14687
14688static void
14689control_power_default_init (ControlPowerIface *iface)
14690{
14691 /* GObject signals for incoming D-Bus method calls: */
14692 /**
14693 * ControlPower::handle-set-power-state:
14694 * @object: A #ControlPower.
14695 * @invocation: A #GDBusMethodInvocation.
14696 * @arg_state: Argument passed by remote caller.
14697 *
14698 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method.
14699 *
14700 * 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.
14701 *
14702 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14703 */
14704 g_signal_new ("handle-set-power-state",
14705 G_TYPE_FROM_INTERFACE (iface),
14706 G_SIGNAL_RUN_LAST,
14707 G_STRUCT_OFFSET (ControlPowerIface, handle_set_power_state),
14708 g_signal_accumulator_true_handled,
14709 NULL,
14710 g_cclosure_marshal_generic,
14711 G_TYPE_BOOLEAN,
14712 2,
14713 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
14714
14715 /**
14716 * ControlPower::handle-get-power-state:
14717 * @object: A #ControlPower.
14718 * @invocation: A #GDBusMethodInvocation.
14719 *
14720 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method.
14721 *
14722 * 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.
14723 *
14724 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14725 */
14726 g_signal_new ("handle-get-power-state",
14727 G_TYPE_FROM_INTERFACE (iface),
14728 G_SIGNAL_RUN_LAST,
14729 G_STRUCT_OFFSET (ControlPowerIface, handle_get_power_state),
14730 g_signal_accumulator_true_handled,
14731 NULL,
14732 g_cclosure_marshal_generic,
14733 G_TYPE_BOOLEAN,
14734 1,
14735 G_TYPE_DBUS_METHOD_INVOCATION);
14736
14737 /* GObject signals for received D-Bus signals: */
14738 /**
14739 * ControlPower::power-good:
14740 * @object: A #ControlPower.
14741 *
14742 * 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.
14743 *
14744 * 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.
14745 */
14746 g_signal_new ("power-good",
14747 G_TYPE_FROM_INTERFACE (iface),
14748 G_SIGNAL_RUN_LAST,
14749 G_STRUCT_OFFSET (ControlPowerIface, power_good),
14750 NULL,
14751 NULL,
14752 g_cclosure_marshal_generic,
14753 G_TYPE_NONE,
14754 0);
14755
14756 /**
14757 * ControlPower::power-lost:
14758 * @object: A #ControlPower.
14759 *
14760 * 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.
14761 *
14762 * 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.
14763 */
14764 g_signal_new ("power-lost",
14765 G_TYPE_FROM_INTERFACE (iface),
14766 G_SIGNAL_RUN_LAST,
14767 G_STRUCT_OFFSET (ControlPowerIface, power_lost),
14768 NULL,
14769 NULL,
14770 g_cclosure_marshal_generic,
14771 G_TYPE_NONE,
14772 0);
14773
14774 /* GObject properties for D-Bus properties: */
14775 /**
14776 * ControlPower:pgood:
14777 *
14778 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link>.
14779 *
14780 * 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.
14781 */
14782 g_object_interface_install_property (iface,
14783 g_param_spec_int ("pgood", "pgood", "pgood", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
14784 /**
14785 * ControlPower:state:
14786 *
14787 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link>.
14788 *
14789 * 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.
14790 */
14791 g_object_interface_install_property (iface,
14792 g_param_spec_int ("state", "state", "state", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James32e74e22015-09-15 21:28:06 -050014793 /**
14794 * ControlPower:pgood-timeout:
14795 *
14796 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link>.
14797 *
14798 * 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.
14799 */
14800 g_object_interface_install_property (iface,
14801 g_param_spec_int ("pgood-timeout", "pgood_timeout", "pgood_timeout", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James362a80f2015-09-14 14:04:39 -050014802}
14803
14804/**
14805 * control_power_get_pgood: (skip)
14806 * @object: A #ControlPower.
14807 *
14808 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property.
14809 *
14810 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
14811 *
14812 * Returns: The property value.
14813 */
14814gint
14815control_power_get_pgood (ControlPower *object)
14816{
14817 return CONTROL_POWER_GET_IFACE (object)->get_pgood (object);
14818}
14819
14820/**
14821 * control_power_set_pgood: (skip)
14822 * @object: A #ControlPower.
14823 * @value: The value to set.
14824 *
14825 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property to @value.
14826 *
14827 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
14828 */
14829void
14830control_power_set_pgood (ControlPower *object, gint value)
14831{
14832 g_object_set (G_OBJECT (object), "pgood", value, NULL);
14833}
14834
14835/**
14836 * control_power_get_state: (skip)
14837 * @object: A #ControlPower.
14838 *
14839 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property.
14840 *
14841 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
14842 *
14843 * Returns: The property value.
14844 */
14845gint
14846control_power_get_state (ControlPower *object)
14847{
14848 return CONTROL_POWER_GET_IFACE (object)->get_state (object);
14849}
14850
14851/**
14852 * control_power_set_state: (skip)
14853 * @object: A #ControlPower.
14854 * @value: The value to set.
14855 *
14856 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property to @value.
14857 *
14858 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
14859 */
14860void
14861control_power_set_state (ControlPower *object, gint value)
14862{
14863 g_object_set (G_OBJECT (object), "state", value, NULL);
14864}
14865
14866/**
Norman James32e74e22015-09-15 21:28:06 -050014867 * control_power_get_pgood_timeout: (skip)
14868 * @object: A #ControlPower.
14869 *
14870 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property.
14871 *
14872 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
14873 *
14874 * Returns: The property value.
14875 */
14876gint
14877control_power_get_pgood_timeout (ControlPower *object)
14878{
14879 return CONTROL_POWER_GET_IFACE (object)->get_pgood_timeout (object);
14880}
14881
14882/**
14883 * control_power_set_pgood_timeout: (skip)
14884 * @object: A #ControlPower.
14885 * @value: The value to set.
14886 *
14887 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property to @value.
14888 *
14889 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
14890 */
14891void
14892control_power_set_pgood_timeout (ControlPower *object, gint value)
14893{
14894 g_object_set (G_OBJECT (object), "pgood-timeout", value, NULL);
14895}
14896
14897/**
Norman James362a80f2015-09-14 14:04:39 -050014898 * control_power_emit_power_good:
14899 * @object: A #ControlPower.
14900 *
14901 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerGood">"PowerGood"</link> D-Bus signal.
14902 */
14903void
14904control_power_emit_power_good (
14905 ControlPower *object)
14906{
14907 g_signal_emit_by_name (object, "power-good");
14908}
14909
14910/**
14911 * control_power_emit_power_lost:
14912 * @object: A #ControlPower.
14913 *
14914 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerLost">"PowerLost"</link> D-Bus signal.
14915 */
14916void
14917control_power_emit_power_lost (
14918 ControlPower *object)
14919{
14920 g_signal_emit_by_name (object, "power-lost");
14921}
14922
14923/**
14924 * control_power_call_set_power_state:
14925 * @proxy: A #ControlPowerProxy.
14926 * @arg_state: Argument to pass with the method invocation.
14927 * @cancellable: (allow-none): A #GCancellable or %NULL.
14928 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
14929 * @user_data: User data to pass to @callback.
14930 *
14931 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method on @proxy.
14932 * 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.
14933 * You can then call control_power_call_set_power_state_finish() to get the result of the operation.
14934 *
14935 * See control_power_call_set_power_state_sync() for the synchronous, blocking version of this method.
14936 */
14937void
14938control_power_call_set_power_state (
14939 ControlPower *proxy,
14940 gint arg_state,
14941 GCancellable *cancellable,
14942 GAsyncReadyCallback callback,
14943 gpointer user_data)
14944{
14945 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
14946 "setPowerState",
14947 g_variant_new ("(i)",
14948 arg_state),
14949 G_DBUS_CALL_FLAGS_NONE,
14950 -1,
14951 cancellable,
14952 callback,
14953 user_data);
14954}
14955
14956/**
14957 * control_power_call_set_power_state_finish:
14958 * @proxy: A #ControlPowerProxy.
14959 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_set_power_state().
14960 * @error: Return location for error or %NULL.
14961 *
14962 * Finishes an operation started with control_power_call_set_power_state().
14963 *
14964 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14965 */
14966gboolean
14967control_power_call_set_power_state_finish (
14968 ControlPower *proxy,
14969 GAsyncResult *res,
14970 GError **error)
14971{
14972 GVariant *_ret;
14973 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
14974 if (_ret == NULL)
14975 goto _out;
14976 g_variant_get (_ret,
14977 "()");
14978 g_variant_unref (_ret);
14979_out:
14980 return _ret != NULL;
14981}
14982
14983/**
14984 * control_power_call_set_power_state_sync:
14985 * @proxy: A #ControlPowerProxy.
14986 * @arg_state: Argument to pass with the method invocation.
14987 * @cancellable: (allow-none): A #GCancellable or %NULL.
14988 * @error: Return location for error or %NULL.
14989 *
14990 * 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.
14991 *
14992 * See control_power_call_set_power_state() for the asynchronous version of this method.
14993 *
14994 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14995 */
14996gboolean
14997control_power_call_set_power_state_sync (
14998 ControlPower *proxy,
14999 gint arg_state,
15000 GCancellable *cancellable,
15001 GError **error)
15002{
15003 GVariant *_ret;
15004 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
15005 "setPowerState",
15006 g_variant_new ("(i)",
15007 arg_state),
15008 G_DBUS_CALL_FLAGS_NONE,
15009 -1,
15010 cancellable,
15011 error);
15012 if (_ret == NULL)
15013 goto _out;
15014 g_variant_get (_ret,
15015 "()");
15016 g_variant_unref (_ret);
15017_out:
15018 return _ret != NULL;
15019}
15020
15021/**
15022 * control_power_call_get_power_state:
15023 * @proxy: A #ControlPowerProxy.
15024 * @cancellable: (allow-none): A #GCancellable or %NULL.
15025 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
15026 * @user_data: User data to pass to @callback.
15027 *
15028 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method on @proxy.
15029 * 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.
15030 * You can then call control_power_call_get_power_state_finish() to get the result of the operation.
15031 *
15032 * See control_power_call_get_power_state_sync() for the synchronous, blocking version of this method.
15033 */
15034void
15035control_power_call_get_power_state (
15036 ControlPower *proxy,
15037 GCancellable *cancellable,
15038 GAsyncReadyCallback callback,
15039 gpointer user_data)
15040{
15041 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
15042 "getPowerState",
15043 g_variant_new ("()"),
15044 G_DBUS_CALL_FLAGS_NONE,
15045 -1,
15046 cancellable,
15047 callback,
15048 user_data);
15049}
15050
15051/**
15052 * control_power_call_get_power_state_finish:
15053 * @proxy: A #ControlPowerProxy.
15054 * @out_state: (out): Return location for return parameter or %NULL to ignore.
15055 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_get_power_state().
15056 * @error: Return location for error or %NULL.
15057 *
15058 * Finishes an operation started with control_power_call_get_power_state().
15059 *
15060 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15061 */
15062gboolean
15063control_power_call_get_power_state_finish (
15064 ControlPower *proxy,
15065 gint *out_state,
15066 GAsyncResult *res,
15067 GError **error)
15068{
15069 GVariant *_ret;
15070 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
15071 if (_ret == NULL)
15072 goto _out;
15073 g_variant_get (_ret,
15074 "(i)",
15075 out_state);
15076 g_variant_unref (_ret);
15077_out:
15078 return _ret != NULL;
15079}
15080
15081/**
15082 * control_power_call_get_power_state_sync:
15083 * @proxy: A #ControlPowerProxy.
15084 * @out_state: (out): Return location for return parameter or %NULL to ignore.
15085 * @cancellable: (allow-none): A #GCancellable or %NULL.
15086 * @error: Return location for error or %NULL.
15087 *
15088 * 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.
15089 *
15090 * See control_power_call_get_power_state() for the asynchronous version of this method.
15091 *
15092 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15093 */
15094gboolean
15095control_power_call_get_power_state_sync (
15096 ControlPower *proxy,
15097 gint *out_state,
15098 GCancellable *cancellable,
15099 GError **error)
15100{
15101 GVariant *_ret;
15102 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
15103 "getPowerState",
15104 g_variant_new ("()"),
15105 G_DBUS_CALL_FLAGS_NONE,
15106 -1,
15107 cancellable,
15108 error);
15109 if (_ret == NULL)
15110 goto _out;
15111 g_variant_get (_ret,
15112 "(i)",
15113 out_state);
15114 g_variant_unref (_ret);
15115_out:
15116 return _ret != NULL;
15117}
15118
15119/**
15120 * control_power_complete_set_power_state:
15121 * @object: A #ControlPower.
15122 * @invocation: (transfer full): A #GDBusMethodInvocation.
15123 *
15124 * 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.
15125 *
15126 * This method will free @invocation, you cannot use it afterwards.
15127 */
15128void
15129control_power_complete_set_power_state (
15130 ControlPower *object,
15131 GDBusMethodInvocation *invocation)
15132{
15133 g_dbus_method_invocation_return_value (invocation,
15134 g_variant_new ("()"));
15135}
15136
15137/**
15138 * control_power_complete_get_power_state:
15139 * @object: A #ControlPower.
15140 * @invocation: (transfer full): A #GDBusMethodInvocation.
15141 * @state: Parameter to return.
15142 *
15143 * 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.
15144 *
15145 * This method will free @invocation, you cannot use it afterwards.
15146 */
15147void
15148control_power_complete_get_power_state (
15149 ControlPower *object,
15150 GDBusMethodInvocation *invocation,
15151 gint state)
15152{
15153 g_dbus_method_invocation_return_value (invocation,
15154 g_variant_new ("(i)",
15155 state));
15156}
15157
15158/* ------------------------------------------------------------------------ */
15159
15160/**
15161 * ControlPowerProxy:
15162 *
15163 * The #ControlPowerProxy structure contains only private data and should only be accessed using the provided API.
15164 */
15165
15166/**
15167 * ControlPowerProxyClass:
15168 * @parent_class: The parent class.
15169 *
15170 * Class structure for #ControlPowerProxy.
15171 */
15172
15173struct _ControlPowerProxyPrivate
15174{
15175 GData *qdata;
15176};
15177
15178static void control_power_proxy_iface_init (ControlPowerIface *iface);
15179
15180#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15181G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
15182 G_ADD_PRIVATE (ControlPowerProxy)
15183 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init));
15184
15185#else
15186G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
15187 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init));
15188
15189#endif
15190static void
15191control_power_proxy_finalize (GObject *object)
15192{
15193 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
15194 g_datalist_clear (&proxy->priv->qdata);
15195 G_OBJECT_CLASS (control_power_proxy_parent_class)->finalize (object);
15196}
15197
15198static void
15199control_power_proxy_get_property (GObject *object,
15200 guint prop_id,
15201 GValue *value,
15202 GParamSpec *pspec G_GNUC_UNUSED)
15203{
15204 const _ExtendedGDBusPropertyInfo *info;
15205 GVariant *variant;
Norman James32e74e22015-09-15 21:28:06 -050015206 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050015207 info = _control_power_property_info_pointers[prop_id - 1];
15208 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
15209 if (info->use_gvariant)
15210 {
15211 g_value_set_variant (value, variant);
15212 }
15213 else
15214 {
15215 if (variant != NULL)
15216 g_dbus_gvariant_to_gvalue (variant, value);
15217 }
15218 if (variant != NULL)
15219 g_variant_unref (variant);
15220}
15221
15222static void
15223control_power_proxy_set_property_cb (GDBusProxy *proxy,
15224 GAsyncResult *res,
15225 gpointer user_data)
15226{
15227 const _ExtendedGDBusPropertyInfo *info = user_data;
15228 GError *error;
15229 GVariant *_ret;
15230 error = NULL;
15231 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
15232 if (!_ret)
15233 {
15234 g_warning ("Error setting property '%s' on interface org.openbmc.control.Power: %s (%s, %d)",
15235 info->parent_struct.name,
15236 error->message, g_quark_to_string (error->domain), error->code);
15237 g_error_free (error);
15238 }
15239 else
15240 {
15241 g_variant_unref (_ret);
15242 }
15243}
15244
15245static void
15246control_power_proxy_set_property (GObject *object,
15247 guint prop_id,
15248 const GValue *value,
15249 GParamSpec *pspec G_GNUC_UNUSED)
15250{
15251 const _ExtendedGDBusPropertyInfo *info;
15252 GVariant *variant;
Norman James32e74e22015-09-15 21:28:06 -050015253 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050015254 info = _control_power_property_info_pointers[prop_id - 1];
15255 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
15256 g_dbus_proxy_call (G_DBUS_PROXY (object),
15257 "org.freedesktop.DBus.Properties.Set",
15258 g_variant_new ("(ssv)", "org.openbmc.control.Power", info->parent_struct.name, variant),
15259 G_DBUS_CALL_FLAGS_NONE,
15260 -1,
15261 NULL, (GAsyncReadyCallback) control_power_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
15262 g_variant_unref (variant);
15263}
15264
15265static void
15266control_power_proxy_g_signal (GDBusProxy *proxy,
15267 const gchar *sender_name G_GNUC_UNUSED,
15268 const gchar *signal_name,
15269 GVariant *parameters)
15270{
15271 _ExtendedGDBusSignalInfo *info;
15272 GVariantIter iter;
15273 GVariant *child;
15274 GValue *paramv;
15275 guint num_params;
15276 guint n;
15277 guint signal_id;
15278 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, signal_name);
15279 if (info == NULL)
15280 return;
15281 num_params = g_variant_n_children (parameters);
15282 paramv = g_new0 (GValue, num_params + 1);
15283 g_value_init (&paramv[0], TYPE_CONTROL_POWER);
15284 g_value_set_object (&paramv[0], proxy);
15285 g_variant_iter_init (&iter, parameters);
15286 n = 1;
15287 while ((child = g_variant_iter_next_value (&iter)) != NULL)
15288 {
15289 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
15290 if (arg_info->use_gvariant)
15291 {
15292 g_value_init (&paramv[n], G_TYPE_VARIANT);
15293 g_value_set_variant (&paramv[n], child);
15294 n++;
15295 }
15296 else
15297 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
15298 g_variant_unref (child);
15299 }
15300 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
15301 g_signal_emitv (paramv, signal_id, 0, NULL);
15302 for (n = 0; n < num_params + 1; n++)
15303 g_value_unset (&paramv[n]);
15304 g_free (paramv);
15305}
15306
15307static void
15308control_power_proxy_g_properties_changed (GDBusProxy *_proxy,
15309 GVariant *changed_properties,
15310 const gchar *const *invalidated_properties)
15311{
15312 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (_proxy);
15313 guint n;
15314 const gchar *key;
15315 GVariantIter *iter;
15316 _ExtendedGDBusPropertyInfo *info;
15317 g_variant_get (changed_properties, "a{sv}", &iter);
15318 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
15319 {
15320 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, key);
15321 g_datalist_remove_data (&proxy->priv->qdata, key);
15322 if (info != NULL)
15323 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
15324 }
15325 g_variant_iter_free (iter);
15326 for (n = 0; invalidated_properties[n] != NULL; n++)
15327 {
15328 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, invalidated_properties[n]);
15329 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
15330 if (info != NULL)
15331 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
15332 }
15333}
15334
15335static gint
15336control_power_proxy_get_pgood (ControlPower *object)
15337{
15338 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
15339 GVariant *variant;
15340 gint value = 0;
15341 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood");
15342 if (variant != NULL)
15343 {
15344 value = g_variant_get_int32 (variant);
15345 g_variant_unref (variant);
15346 }
15347 return value;
15348}
15349
15350static gint
15351control_power_proxy_get_state (ControlPower *object)
15352{
15353 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
15354 GVariant *variant;
15355 gint value = 0;
15356 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
15357 if (variant != NULL)
15358 {
15359 value = g_variant_get_int32 (variant);
15360 g_variant_unref (variant);
15361 }
15362 return value;
15363}
15364
Norman James32e74e22015-09-15 21:28:06 -050015365static gint
15366control_power_proxy_get_pgood_timeout (ControlPower *object)
15367{
15368 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
15369 GVariant *variant;
15370 gint value = 0;
15371 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood_timeout");
15372 if (variant != NULL)
15373 {
15374 value = g_variant_get_int32 (variant);
15375 g_variant_unref (variant);
15376 }
15377 return value;
15378}
15379
Norman James362a80f2015-09-14 14:04:39 -050015380static void
15381control_power_proxy_init (ControlPowerProxy *proxy)
15382{
15383#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15384 proxy->priv = control_power_proxy_get_instance_private (proxy);
15385#else
15386 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_POWER_PROXY, ControlPowerProxyPrivate);
15387#endif
15388
15389 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_power_interface_info ());
15390}
15391
15392static void
15393control_power_proxy_class_init (ControlPowerProxyClass *klass)
15394{
15395 GObjectClass *gobject_class;
15396 GDBusProxyClass *proxy_class;
15397
15398 gobject_class = G_OBJECT_CLASS (klass);
15399 gobject_class->finalize = control_power_proxy_finalize;
15400 gobject_class->get_property = control_power_proxy_get_property;
15401 gobject_class->set_property = control_power_proxy_set_property;
15402
15403 proxy_class = G_DBUS_PROXY_CLASS (klass);
15404 proxy_class->g_signal = control_power_proxy_g_signal;
15405 proxy_class->g_properties_changed = control_power_proxy_g_properties_changed;
15406
15407 control_power_override_properties (gobject_class, 1);
15408
15409#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
15410 g_type_class_add_private (klass, sizeof (ControlPowerProxyPrivate));
15411#endif
15412}
15413
15414static void
15415control_power_proxy_iface_init (ControlPowerIface *iface)
15416{
15417 iface->get_pgood = control_power_proxy_get_pgood;
15418 iface->get_state = control_power_proxy_get_state;
Norman James32e74e22015-09-15 21:28:06 -050015419 iface->get_pgood_timeout = control_power_proxy_get_pgood_timeout;
Norman James362a80f2015-09-14 14:04:39 -050015420}
15421
15422/**
15423 * control_power_proxy_new:
15424 * @connection: A #GDBusConnection.
15425 * @flags: Flags from the #GDBusProxyFlags enumeration.
15426 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
15427 * @object_path: An object path.
15428 * @cancellable: (allow-none): A #GCancellable or %NULL.
15429 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
15430 * @user_data: User data to pass to @callback.
15431 *
15432 * 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.
15433 *
15434 * 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.
15435 * You can then call control_power_proxy_new_finish() to get the result of the operation.
15436 *
15437 * See control_power_proxy_new_sync() for the synchronous, blocking version of this constructor.
15438 */
15439void
15440control_power_proxy_new (
15441 GDBusConnection *connection,
15442 GDBusProxyFlags flags,
15443 const gchar *name,
15444 const gchar *object_path,
15445 GCancellable *cancellable,
15446 GAsyncReadyCallback callback,
15447 gpointer user_data)
15448{
15449 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);
15450}
15451
15452/**
15453 * control_power_proxy_new_finish:
15454 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new().
15455 * @error: Return location for error or %NULL
15456 *
15457 * Finishes an operation started with control_power_proxy_new().
15458 *
15459 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
15460 */
15461ControlPower *
15462control_power_proxy_new_finish (
15463 GAsyncResult *res,
15464 GError **error)
15465{
15466 GObject *ret;
15467 GObject *source_object;
15468 source_object = g_async_result_get_source_object (res);
15469 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
15470 g_object_unref (source_object);
15471 if (ret != NULL)
15472 return CONTROL_POWER (ret);
15473 else
15474 return NULL;
15475}
15476
15477/**
15478 * control_power_proxy_new_sync:
15479 * @connection: A #GDBusConnection.
15480 * @flags: Flags from the #GDBusProxyFlags enumeration.
15481 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
15482 * @object_path: An object path.
15483 * @cancellable: (allow-none): A #GCancellable or %NULL.
15484 * @error: Return location for error or %NULL
15485 *
15486 * 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.
15487 *
15488 * The calling thread is blocked until a reply is received.
15489 *
15490 * See control_power_proxy_new() for the asynchronous version of this constructor.
15491 *
15492 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
15493 */
15494ControlPower *
15495control_power_proxy_new_sync (
15496 GDBusConnection *connection,
15497 GDBusProxyFlags flags,
15498 const gchar *name,
15499 const gchar *object_path,
15500 GCancellable *cancellable,
15501 GError **error)
15502{
15503 GInitable *ret;
15504 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);
15505 if (ret != NULL)
15506 return CONTROL_POWER (ret);
15507 else
15508 return NULL;
15509}
15510
15511
15512/**
15513 * control_power_proxy_new_for_bus:
15514 * @bus_type: A #GBusType.
15515 * @flags: Flags from the #GDBusProxyFlags enumeration.
15516 * @name: A bus name (well-known or unique).
15517 * @object_path: An object path.
15518 * @cancellable: (allow-none): A #GCancellable or %NULL.
15519 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
15520 * @user_data: User data to pass to @callback.
15521 *
15522 * Like control_power_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
15523 *
15524 * 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.
15525 * You can then call control_power_proxy_new_for_bus_finish() to get the result of the operation.
15526 *
15527 * See control_power_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
15528 */
15529void
15530control_power_proxy_new_for_bus (
15531 GBusType bus_type,
15532 GDBusProxyFlags flags,
15533 const gchar *name,
15534 const gchar *object_path,
15535 GCancellable *cancellable,
15536 GAsyncReadyCallback callback,
15537 gpointer user_data)
15538{
15539 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);
15540}
15541
15542/**
15543 * control_power_proxy_new_for_bus_finish:
15544 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new_for_bus().
15545 * @error: Return location for error or %NULL
15546 *
15547 * Finishes an operation started with control_power_proxy_new_for_bus().
15548 *
15549 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
15550 */
15551ControlPower *
15552control_power_proxy_new_for_bus_finish (
15553 GAsyncResult *res,
15554 GError **error)
15555{
15556 GObject *ret;
15557 GObject *source_object;
15558 source_object = g_async_result_get_source_object (res);
15559 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
15560 g_object_unref (source_object);
15561 if (ret != NULL)
15562 return CONTROL_POWER (ret);
15563 else
15564 return NULL;
15565}
15566
15567/**
15568 * control_power_proxy_new_for_bus_sync:
15569 * @bus_type: A #GBusType.
15570 * @flags: Flags from the #GDBusProxyFlags enumeration.
15571 * @name: A bus name (well-known or unique).
15572 * @object_path: An object path.
15573 * @cancellable: (allow-none): A #GCancellable or %NULL.
15574 * @error: Return location for error or %NULL
15575 *
15576 * Like control_power_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
15577 *
15578 * The calling thread is blocked until a reply is received.
15579 *
15580 * See control_power_proxy_new_for_bus() for the asynchronous version of this constructor.
15581 *
15582 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
15583 */
15584ControlPower *
15585control_power_proxy_new_for_bus_sync (
15586 GBusType bus_type,
15587 GDBusProxyFlags flags,
15588 const gchar *name,
15589 const gchar *object_path,
15590 GCancellable *cancellable,
15591 GError **error)
15592{
15593 GInitable *ret;
15594 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);
15595 if (ret != NULL)
15596 return CONTROL_POWER (ret);
15597 else
15598 return NULL;
15599}
15600
15601
15602/* ------------------------------------------------------------------------ */
15603
15604/**
15605 * ControlPowerSkeleton:
15606 *
15607 * The #ControlPowerSkeleton structure contains only private data and should only be accessed using the provided API.
15608 */
15609
15610/**
15611 * ControlPowerSkeletonClass:
15612 * @parent_class: The parent class.
15613 *
15614 * Class structure for #ControlPowerSkeleton.
15615 */
15616
15617struct _ControlPowerSkeletonPrivate
15618{
15619 GValue *properties;
15620 GList *changed_properties;
15621 GSource *changed_properties_idle_source;
15622 GMainContext *context;
15623 GMutex lock;
15624};
15625
15626static void
15627_control_power_skeleton_handle_method_call (
15628 GDBusConnection *connection G_GNUC_UNUSED,
15629 const gchar *sender G_GNUC_UNUSED,
15630 const gchar *object_path G_GNUC_UNUSED,
15631 const gchar *interface_name,
15632 const gchar *method_name,
15633 GVariant *parameters,
15634 GDBusMethodInvocation *invocation,
15635 gpointer user_data)
15636{
15637 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
15638 _ExtendedGDBusMethodInfo *info;
15639 GVariantIter iter;
15640 GVariant *child;
15641 GValue *paramv;
15642 guint num_params;
15643 guint num_extra;
15644 guint n;
15645 guint signal_id;
15646 GValue return_value = G_VALUE_INIT;
15647 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
15648 g_assert (info != NULL);
15649 num_params = g_variant_n_children (parameters);
15650 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
15651 n = 0;
15652 g_value_init (&paramv[n], TYPE_CONTROL_POWER);
15653 g_value_set_object (&paramv[n++], skeleton);
15654 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
15655 g_value_set_object (&paramv[n++], invocation);
15656 if (info->pass_fdlist)
15657 {
15658#ifdef G_OS_UNIX
15659 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
15660 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
15661#else
15662 g_assert_not_reached ();
15663#endif
15664 }
15665 g_variant_iter_init (&iter, parameters);
15666 while ((child = g_variant_iter_next_value (&iter)) != NULL)
15667 {
15668 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
15669 if (arg_info->use_gvariant)
15670 {
15671 g_value_init (&paramv[n], G_TYPE_VARIANT);
15672 g_value_set_variant (&paramv[n], child);
15673 n++;
15674 }
15675 else
15676 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
15677 g_variant_unref (child);
15678 }
15679 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
15680 g_value_init (&return_value, G_TYPE_BOOLEAN);
15681 g_signal_emitv (paramv, signal_id, 0, &return_value);
15682 if (!g_value_get_boolean (&return_value))
15683 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);
15684 g_value_unset (&return_value);
15685 for (n = 0; n < num_params + num_extra; n++)
15686 g_value_unset (&paramv[n]);
15687 g_free (paramv);
15688}
15689
15690static GVariant *
15691_control_power_skeleton_handle_get_property (
15692 GDBusConnection *connection G_GNUC_UNUSED,
15693 const gchar *sender G_GNUC_UNUSED,
15694 const gchar *object_path G_GNUC_UNUSED,
15695 const gchar *interface_name G_GNUC_UNUSED,
15696 const gchar *property_name,
15697 GError **error,
15698 gpointer user_data)
15699{
15700 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
15701 GValue value = G_VALUE_INIT;
15702 GParamSpec *pspec;
15703 _ExtendedGDBusPropertyInfo *info;
15704 GVariant *ret;
15705 ret = NULL;
15706 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
15707 g_assert (info != NULL);
15708 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
15709 if (pspec == NULL)
15710 {
15711 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
15712 }
15713 else
15714 {
15715 g_value_init (&value, pspec->value_type);
15716 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
15717 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
15718 g_value_unset (&value);
15719 }
15720 return ret;
15721}
15722
15723static gboolean
15724_control_power_skeleton_handle_set_property (
15725 GDBusConnection *connection G_GNUC_UNUSED,
15726 const gchar *sender G_GNUC_UNUSED,
15727 const gchar *object_path G_GNUC_UNUSED,
15728 const gchar *interface_name G_GNUC_UNUSED,
15729 const gchar *property_name,
15730 GVariant *variant,
15731 GError **error,
15732 gpointer user_data)
15733{
15734 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
15735 GValue value = G_VALUE_INIT;
15736 GParamSpec *pspec;
15737 _ExtendedGDBusPropertyInfo *info;
15738 gboolean ret;
15739 ret = FALSE;
15740 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
15741 g_assert (info != NULL);
15742 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
15743 if (pspec == NULL)
15744 {
15745 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
15746 }
15747 else
15748 {
15749 if (info->use_gvariant)
15750 g_value_set_variant (&value, variant);
15751 else
15752 g_dbus_gvariant_to_gvalue (variant, &value);
15753 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
15754 g_value_unset (&value);
15755 ret = TRUE;
15756 }
15757 return ret;
15758}
15759
15760static const GDBusInterfaceVTable _control_power_skeleton_vtable =
15761{
15762 _control_power_skeleton_handle_method_call,
15763 _control_power_skeleton_handle_get_property,
15764 _control_power_skeleton_handle_set_property,
15765 {NULL}
15766};
15767
15768static GDBusInterfaceInfo *
15769control_power_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
15770{
15771 return control_power_interface_info ();
15772}
15773
15774static GDBusInterfaceVTable *
15775control_power_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
15776{
15777 return (GDBusInterfaceVTable *) &_control_power_skeleton_vtable;
15778}
15779
15780static GVariant *
15781control_power_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
15782{
15783 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
15784
15785 GVariantBuilder builder;
15786 guint n;
15787 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
15788 if (_control_power_interface_info.parent_struct.properties == NULL)
15789 goto out;
15790 for (n = 0; _control_power_interface_info.parent_struct.properties[n] != NULL; n++)
15791 {
15792 GDBusPropertyInfo *info = _control_power_interface_info.parent_struct.properties[n];
15793 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
15794 {
15795 GVariant *value;
15796 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);
15797 if (value != NULL)
15798 {
15799 g_variant_take_ref (value);
15800 g_variant_builder_add (&builder, "{sv}", info->name, value);
15801 g_variant_unref (value);
15802 }
15803 }
15804 }
15805out:
15806 return g_variant_builder_end (&builder);
15807}
15808
15809static gboolean _control_power_emit_changed (gpointer user_data);
15810
15811static void
15812control_power_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
15813{
15814 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
15815 gboolean emit_changed = FALSE;
15816
15817 g_mutex_lock (&skeleton->priv->lock);
15818 if (skeleton->priv->changed_properties_idle_source != NULL)
15819 {
15820 g_source_destroy (skeleton->priv->changed_properties_idle_source);
15821 skeleton->priv->changed_properties_idle_source = NULL;
15822 emit_changed = TRUE;
15823 }
15824 g_mutex_unlock (&skeleton->priv->lock);
15825
15826 if (emit_changed)
15827 _control_power_emit_changed (skeleton);
15828}
15829
15830static void
15831_control_power_on_signal_power_good (
15832 ControlPower *object)
15833{
15834 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
15835
15836 GList *connections, *l;
15837 GVariant *signal_variant;
15838 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
15839
15840 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
15841 for (l = connections; l != NULL; l = l->next)
15842 {
15843 GDBusConnection *connection = l->data;
15844 g_dbus_connection_emit_signal (connection,
15845 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerGood",
15846 signal_variant, NULL);
15847 }
15848 g_variant_unref (signal_variant);
15849 g_list_free_full (connections, g_object_unref);
15850}
15851
15852static void
15853_control_power_on_signal_power_lost (
15854 ControlPower *object)
15855{
15856 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
15857
15858 GList *connections, *l;
15859 GVariant *signal_variant;
15860 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
15861
15862 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
15863 for (l = connections; l != NULL; l = l->next)
15864 {
15865 GDBusConnection *connection = l->data;
15866 g_dbus_connection_emit_signal (connection,
15867 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerLost",
15868 signal_variant, NULL);
15869 }
15870 g_variant_unref (signal_variant);
15871 g_list_free_full (connections, g_object_unref);
15872}
15873
15874static void control_power_skeleton_iface_init (ControlPowerIface *iface);
15875#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15876G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
15877 G_ADD_PRIVATE (ControlPowerSkeleton)
15878 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init));
15879
15880#else
15881G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
15882 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init));
15883
15884#endif
15885static void
15886control_power_skeleton_finalize (GObject *object)
15887{
15888 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
15889 guint n;
Norman James32e74e22015-09-15 21:28:06 -050015890 for (n = 0; n < 3; n++)
Norman James362a80f2015-09-14 14:04:39 -050015891 g_value_unset (&skeleton->priv->properties[n]);
15892 g_free (skeleton->priv->properties);
15893 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
15894 if (skeleton->priv->changed_properties_idle_source != NULL)
15895 g_source_destroy (skeleton->priv->changed_properties_idle_source);
15896 g_main_context_unref (skeleton->priv->context);
15897 g_mutex_clear (&skeleton->priv->lock);
15898 G_OBJECT_CLASS (control_power_skeleton_parent_class)->finalize (object);
15899}
15900
15901static void
15902control_power_skeleton_get_property (GObject *object,
15903 guint prop_id,
15904 GValue *value,
15905 GParamSpec *pspec G_GNUC_UNUSED)
15906{
15907 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
Norman James32e74e22015-09-15 21:28:06 -050015908 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050015909 g_mutex_lock (&skeleton->priv->lock);
15910 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
15911 g_mutex_unlock (&skeleton->priv->lock);
15912}
15913
15914static gboolean
15915_control_power_emit_changed (gpointer user_data)
15916{
15917 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
15918 GList *l;
15919 GVariantBuilder builder;
15920 GVariantBuilder invalidated_builder;
15921 guint num_changes;
15922
15923 g_mutex_lock (&skeleton->priv->lock);
15924 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
15925 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
15926 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
15927 {
15928 ChangedProperty *cp = l->data;
15929 GVariant *variant;
15930 const GValue *cur_value;
15931
15932 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
15933 if (!_g_value_equal (cur_value, &cp->orig_value))
15934 {
15935 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
15936 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
15937 g_variant_unref (variant);
15938 num_changes++;
15939 }
15940 }
15941 if (num_changes > 0)
15942 {
15943 GList *connections, *ll;
15944 GVariant *signal_variant;
15945 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.control.Power",
15946 &builder, &invalidated_builder));
15947 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
15948 for (ll = connections; ll != NULL; ll = ll->next)
15949 {
15950 GDBusConnection *connection = ll->data;
15951
15952 g_dbus_connection_emit_signal (connection,
15953 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
15954 "org.freedesktop.DBus.Properties",
15955 "PropertiesChanged",
15956 signal_variant,
15957 NULL);
15958 }
15959 g_variant_unref (signal_variant);
15960 g_list_free_full (connections, g_object_unref);
15961 }
15962 else
15963 {
15964 g_variant_builder_clear (&builder);
15965 g_variant_builder_clear (&invalidated_builder);
15966 }
15967 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
15968 skeleton->priv->changed_properties = NULL;
15969 skeleton->priv->changed_properties_idle_source = NULL;
15970 g_mutex_unlock (&skeleton->priv->lock);
15971 return FALSE;
15972}
15973
15974static void
15975_control_power_schedule_emit_changed (ControlPowerSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
15976{
15977 ChangedProperty *cp;
15978 GList *l;
15979 cp = NULL;
15980 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
15981 {
15982 ChangedProperty *i_cp = l->data;
15983 if (i_cp->info == info)
15984 {
15985 cp = i_cp;
15986 break;
15987 }
15988 }
15989 if (cp == NULL)
15990 {
15991 cp = g_new0 (ChangedProperty, 1);
15992 cp->prop_id = prop_id;
15993 cp->info = info;
15994 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
15995 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
15996 g_value_copy (orig_value, &cp->orig_value);
15997 }
15998}
15999
16000static void
16001control_power_skeleton_notify (GObject *object,
16002 GParamSpec *pspec G_GNUC_UNUSED)
16003{
16004 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
16005 g_mutex_lock (&skeleton->priv->lock);
16006 if (skeleton->priv->changed_properties != NULL &&
16007 skeleton->priv->changed_properties_idle_source == NULL)
16008 {
16009 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
16010 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
16011 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_power_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
16012 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
16013 g_source_unref (skeleton->priv->changed_properties_idle_source);
16014 }
16015 g_mutex_unlock (&skeleton->priv->lock);
16016}
16017
16018static void
16019control_power_skeleton_set_property (GObject *object,
16020 guint prop_id,
16021 const GValue *value,
16022 GParamSpec *pspec)
16023{
16024 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
Norman James32e74e22015-09-15 21:28:06 -050016025 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050016026 g_mutex_lock (&skeleton->priv->lock);
16027 g_object_freeze_notify (object);
16028 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
16029 {
16030 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
16031 _control_power_schedule_emit_changed (skeleton, _control_power_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
16032 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
16033 g_object_notify_by_pspec (object, pspec);
16034 }
16035 g_mutex_unlock (&skeleton->priv->lock);
16036 g_object_thaw_notify (object);
16037}
16038
16039static void
16040control_power_skeleton_init (ControlPowerSkeleton *skeleton)
16041{
16042#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16043 skeleton->priv = control_power_skeleton_get_instance_private (skeleton);
16044#else
16045 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_POWER_SKELETON, ControlPowerSkeletonPrivate);
16046#endif
16047
16048 g_mutex_init (&skeleton->priv->lock);
16049 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James32e74e22015-09-15 21:28:06 -050016050 skeleton->priv->properties = g_new0 (GValue, 3);
Norman James362a80f2015-09-14 14:04:39 -050016051 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
16052 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
Norman James32e74e22015-09-15 21:28:06 -050016053 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
Norman James362a80f2015-09-14 14:04:39 -050016054}
16055
16056static gint
16057control_power_skeleton_get_pgood (ControlPower *object)
16058{
16059 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
16060 gint value;
16061 g_mutex_lock (&skeleton->priv->lock);
16062 value = g_value_get_int (&(skeleton->priv->properties[0]));
16063 g_mutex_unlock (&skeleton->priv->lock);
16064 return value;
16065}
16066
16067static gint
16068control_power_skeleton_get_state (ControlPower *object)
16069{
16070 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
16071 gint value;
16072 g_mutex_lock (&skeleton->priv->lock);
16073 value = g_value_get_int (&(skeleton->priv->properties[1]));
16074 g_mutex_unlock (&skeleton->priv->lock);
16075 return value;
16076}
16077
Norman James32e74e22015-09-15 21:28:06 -050016078static gint
16079control_power_skeleton_get_pgood_timeout (ControlPower *object)
16080{
16081 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
16082 gint value;
16083 g_mutex_lock (&skeleton->priv->lock);
16084 value = g_value_get_int (&(skeleton->priv->properties[2]));
16085 g_mutex_unlock (&skeleton->priv->lock);
16086 return value;
16087}
16088
Norman James362a80f2015-09-14 14:04:39 -050016089static void
16090control_power_skeleton_class_init (ControlPowerSkeletonClass *klass)
16091{
16092 GObjectClass *gobject_class;
16093 GDBusInterfaceSkeletonClass *skeleton_class;
16094
16095 gobject_class = G_OBJECT_CLASS (klass);
16096 gobject_class->finalize = control_power_skeleton_finalize;
16097 gobject_class->get_property = control_power_skeleton_get_property;
16098 gobject_class->set_property = control_power_skeleton_set_property;
16099 gobject_class->notify = control_power_skeleton_notify;
16100
16101
16102 control_power_override_properties (gobject_class, 1);
16103
16104 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
16105 skeleton_class->get_info = control_power_skeleton_dbus_interface_get_info;
16106 skeleton_class->get_properties = control_power_skeleton_dbus_interface_get_properties;
16107 skeleton_class->flush = control_power_skeleton_dbus_interface_flush;
16108 skeleton_class->get_vtable = control_power_skeleton_dbus_interface_get_vtable;
16109
16110#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
16111 g_type_class_add_private (klass, sizeof (ControlPowerSkeletonPrivate));
16112#endif
16113}
16114
16115static void
16116control_power_skeleton_iface_init (ControlPowerIface *iface)
16117{
16118 iface->power_good = _control_power_on_signal_power_good;
16119 iface->power_lost = _control_power_on_signal_power_lost;
16120 iface->get_pgood = control_power_skeleton_get_pgood;
16121 iface->get_state = control_power_skeleton_get_state;
Norman James32e74e22015-09-15 21:28:06 -050016122 iface->get_pgood_timeout = control_power_skeleton_get_pgood_timeout;
Norman James362a80f2015-09-14 14:04:39 -050016123}
16124
16125/**
16126 * control_power_skeleton_new:
16127 *
16128 * 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>.
16129 *
16130 * Returns: (transfer full) (type ControlPowerSkeleton): The skeleton object.
16131 */
16132ControlPower *
16133control_power_skeleton_new (void)
16134{
16135 return CONTROL_POWER (g_object_new (TYPE_CONTROL_POWER_SKELETON, NULL));
16136}
16137
16138/* ------------------------------------------------------------------------
16139 * Code for interface org.openbmc.Watchdog
16140 * ------------------------------------------------------------------------
16141 */
16142
16143/**
16144 * SECTION:Watchdog
16145 * @title: Watchdog
16146 * @short_description: Generated C code for the org.openbmc.Watchdog D-Bus interface
16147 *
16148 * 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.
16149 */
16150
16151/* ---- Introspection data for org.openbmc.Watchdog ---- */
16152
16153static const _ExtendedGDBusMethodInfo _watchdog_method_info_start =
16154{
16155 {
16156 -1,
16157 (gchar *) "start",
16158 NULL,
16159 NULL,
16160 NULL
16161 },
16162 "handle-start",
16163 FALSE
16164};
16165
16166static const _ExtendedGDBusMethodInfo _watchdog_method_info_poke =
16167{
16168 {
16169 -1,
16170 (gchar *) "poke",
16171 NULL,
16172 NULL,
16173 NULL
16174 },
16175 "handle-poke",
16176 FALSE
16177};
16178
16179static const _ExtendedGDBusMethodInfo _watchdog_method_info_stop =
16180{
16181 {
16182 -1,
16183 (gchar *) "stop",
16184 NULL,
16185 NULL,
16186 NULL
16187 },
16188 "handle-stop",
16189 FALSE
16190};
16191
16192static const _ExtendedGDBusMethodInfo * const _watchdog_method_info_pointers[] =
16193{
16194 &_watchdog_method_info_start,
16195 &_watchdog_method_info_poke,
16196 &_watchdog_method_info_stop,
16197 NULL
16198};
16199
16200static const _ExtendedGDBusSignalInfo _watchdog_signal_info_watchdog_error =
16201{
16202 {
16203 -1,
16204 (gchar *) "WatchdogError",
16205 NULL,
16206 NULL
16207 },
16208 "watchdog-error"
16209};
16210
16211static const _ExtendedGDBusSignalInfo * const _watchdog_signal_info_pointers[] =
16212{
16213 &_watchdog_signal_info_watchdog_error,
16214 NULL
16215};
16216
16217static const _ExtendedGDBusPropertyInfo _watchdog_property_info_watchdog =
16218{
16219 {
16220 -1,
16221 (gchar *) "watchdog",
16222 (gchar *) "i",
16223 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
16224 NULL
16225 },
16226 "watchdog",
16227 FALSE
16228};
16229
16230static const _ExtendedGDBusPropertyInfo _watchdog_property_info_poll_interval =
16231{
16232 {
16233 -1,
16234 (gchar *) "poll_interval",
16235 (gchar *) "i",
16236 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
16237 NULL
16238 },
16239 "poll-interval",
16240 FALSE
16241};
16242
16243static const _ExtendedGDBusPropertyInfo * const _watchdog_property_info_pointers[] =
16244{
16245 &_watchdog_property_info_watchdog,
16246 &_watchdog_property_info_poll_interval,
16247 NULL
16248};
16249
16250static const _ExtendedGDBusInterfaceInfo _watchdog_interface_info =
16251{
16252 {
16253 -1,
16254 (gchar *) "org.openbmc.Watchdog",
16255 (GDBusMethodInfo **) &_watchdog_method_info_pointers,
16256 (GDBusSignalInfo **) &_watchdog_signal_info_pointers,
16257 (GDBusPropertyInfo **) &_watchdog_property_info_pointers,
16258 NULL
16259 },
16260 "watchdog",
16261};
16262
16263
16264/**
16265 * watchdog_interface_info:
16266 *
16267 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> D-Bus interface.
16268 *
16269 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
16270 */
16271GDBusInterfaceInfo *
16272watchdog_interface_info (void)
16273{
16274 return (GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct;
16275}
16276
16277/**
16278 * watchdog_override_properties:
16279 * @klass: The class structure for a #GObject<!-- -->-derived class.
16280 * @property_id_begin: The property id to assign to the first overridden property.
16281 *
16282 * Overrides all #GObject properties in the #Watchdog interface for a concrete class.
16283 * The properties are overridden in the order they are defined.
16284 *
16285 * Returns: The last property id.
16286 */
16287guint
16288watchdog_override_properties (GObjectClass *klass, guint property_id_begin)
16289{
16290 g_object_class_override_property (klass, property_id_begin++, "watchdog");
16291 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
16292 return property_id_begin - 1;
16293}
16294
16295
16296
16297/**
16298 * Watchdog:
16299 *
16300 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
16301 */
16302
16303/**
16304 * WatchdogIface:
16305 * @parent_iface: The parent interface.
16306 * @handle_poke: Handler for the #Watchdog::handle-poke signal.
16307 * @handle_start: Handler for the #Watchdog::handle-start signal.
16308 * @handle_stop: Handler for the #Watchdog::handle-stop signal.
16309 * @get_poll_interval: Getter for the #Watchdog:poll-interval property.
16310 * @get_watchdog: Getter for the #Watchdog:watchdog property.
16311 * @watchdog_error: Handler for the #Watchdog::watchdog-error signal.
16312 *
16313 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
16314 */
16315
16316typedef WatchdogIface WatchdogInterface;
16317G_DEFINE_INTERFACE (Watchdog, watchdog, G_TYPE_OBJECT);
16318
16319static void
16320watchdog_default_init (WatchdogIface *iface)
16321{
16322 /* GObject signals for incoming D-Bus method calls: */
16323 /**
16324 * Watchdog::handle-start:
16325 * @object: A #Watchdog.
16326 * @invocation: A #GDBusMethodInvocation.
16327 *
16328 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method.
16329 *
16330 * 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.
16331 *
16332 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
16333 */
16334 g_signal_new ("handle-start",
16335 G_TYPE_FROM_INTERFACE (iface),
16336 G_SIGNAL_RUN_LAST,
16337 G_STRUCT_OFFSET (WatchdogIface, handle_start),
16338 g_signal_accumulator_true_handled,
16339 NULL,
16340 g_cclosure_marshal_generic,
16341 G_TYPE_BOOLEAN,
16342 1,
16343 G_TYPE_DBUS_METHOD_INVOCATION);
16344
16345 /**
16346 * Watchdog::handle-poke:
16347 * @object: A #Watchdog.
16348 * @invocation: A #GDBusMethodInvocation.
16349 *
16350 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method.
16351 *
16352 * 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.
16353 *
16354 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
16355 */
16356 g_signal_new ("handle-poke",
16357 G_TYPE_FROM_INTERFACE (iface),
16358 G_SIGNAL_RUN_LAST,
16359 G_STRUCT_OFFSET (WatchdogIface, handle_poke),
16360 g_signal_accumulator_true_handled,
16361 NULL,
16362 g_cclosure_marshal_generic,
16363 G_TYPE_BOOLEAN,
16364 1,
16365 G_TYPE_DBUS_METHOD_INVOCATION);
16366
16367 /**
16368 * Watchdog::handle-stop:
16369 * @object: A #Watchdog.
16370 * @invocation: A #GDBusMethodInvocation.
16371 *
16372 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method.
16373 *
16374 * 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.
16375 *
16376 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
16377 */
16378 g_signal_new ("handle-stop",
16379 G_TYPE_FROM_INTERFACE (iface),
16380 G_SIGNAL_RUN_LAST,
16381 G_STRUCT_OFFSET (WatchdogIface, handle_stop),
16382 g_signal_accumulator_true_handled,
16383 NULL,
16384 g_cclosure_marshal_generic,
16385 G_TYPE_BOOLEAN,
16386 1,
16387 G_TYPE_DBUS_METHOD_INVOCATION);
16388
16389 /* GObject signals for received D-Bus signals: */
16390 /**
16391 * Watchdog::watchdog-error:
16392 * @object: A #Watchdog.
16393 *
16394 * 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.
16395 *
16396 * 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.
16397 */
16398 g_signal_new ("watchdog-error",
16399 G_TYPE_FROM_INTERFACE (iface),
16400 G_SIGNAL_RUN_LAST,
16401 G_STRUCT_OFFSET (WatchdogIface, watchdog_error),
16402 NULL,
16403 NULL,
16404 g_cclosure_marshal_generic,
16405 G_TYPE_NONE,
16406 0);
16407
16408 /* GObject properties for D-Bus properties: */
16409 /**
16410 * Watchdog:watchdog:
16411 *
16412 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link>.
16413 *
16414 * 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.
16415 */
16416 g_object_interface_install_property (iface,
16417 g_param_spec_int ("watchdog", "watchdog", "watchdog", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
16418 /**
16419 * Watchdog:poll-interval:
16420 *
16421 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link>.
16422 *
16423 * 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.
16424 */
16425 g_object_interface_install_property (iface,
16426 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
16427}
16428
16429/**
16430 * watchdog_get_watchdog: (skip)
16431 * @object: A #Watchdog.
16432 *
16433 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property.
16434 *
16435 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
16436 *
16437 * Returns: The property value.
16438 */
16439gint
16440watchdog_get_watchdog (Watchdog *object)
16441{
16442 return WATCHDOG_GET_IFACE (object)->get_watchdog (object);
16443}
16444
16445/**
16446 * watchdog_set_watchdog: (skip)
16447 * @object: A #Watchdog.
16448 * @value: The value to set.
16449 *
16450 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property to @value.
16451 *
16452 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
16453 */
16454void
16455watchdog_set_watchdog (Watchdog *object, gint value)
16456{
16457 g_object_set (G_OBJECT (object), "watchdog", value, NULL);
16458}
16459
16460/**
16461 * watchdog_get_poll_interval: (skip)
16462 * @object: A #Watchdog.
16463 *
16464 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property.
16465 *
16466 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
16467 *
16468 * Returns: The property value.
16469 */
16470gint
16471watchdog_get_poll_interval (Watchdog *object)
16472{
16473 return WATCHDOG_GET_IFACE (object)->get_poll_interval (object);
16474}
16475
16476/**
16477 * watchdog_set_poll_interval: (skip)
16478 * @object: A #Watchdog.
16479 * @value: The value to set.
16480 *
16481 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property to @value.
16482 *
16483 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
16484 */
16485void
16486watchdog_set_poll_interval (Watchdog *object, gint value)
16487{
16488 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
16489}
16490
16491/**
16492 * watchdog_emit_watchdog_error:
16493 * @object: A #Watchdog.
16494 *
16495 * Emits the <link linkend="gdbus-signal-org-openbmc-Watchdog.WatchdogError">"WatchdogError"</link> D-Bus signal.
16496 */
16497void
16498watchdog_emit_watchdog_error (
16499 Watchdog *object)
16500{
16501 g_signal_emit_by_name (object, "watchdog-error");
16502}
16503
16504/**
16505 * watchdog_call_start:
16506 * @proxy: A #WatchdogProxy.
16507 * @cancellable: (allow-none): A #GCancellable or %NULL.
16508 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
16509 * @user_data: User data to pass to @callback.
16510 *
16511 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method on @proxy.
16512 * 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.
16513 * You can then call watchdog_call_start_finish() to get the result of the operation.
16514 *
16515 * See watchdog_call_start_sync() for the synchronous, blocking version of this method.
16516 */
16517void
16518watchdog_call_start (
16519 Watchdog *proxy,
16520 GCancellable *cancellable,
16521 GAsyncReadyCallback callback,
16522 gpointer user_data)
16523{
16524 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
16525 "start",
16526 g_variant_new ("()"),
16527 G_DBUS_CALL_FLAGS_NONE,
16528 -1,
16529 cancellable,
16530 callback,
16531 user_data);
16532}
16533
16534/**
16535 * watchdog_call_start_finish:
16536 * @proxy: A #WatchdogProxy.
16537 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_start().
16538 * @error: Return location for error or %NULL.
16539 *
16540 * Finishes an operation started with watchdog_call_start().
16541 *
16542 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16543 */
16544gboolean
16545watchdog_call_start_finish (
16546 Watchdog *proxy,
16547 GAsyncResult *res,
16548 GError **error)
16549{
16550 GVariant *_ret;
16551 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
16552 if (_ret == NULL)
16553 goto _out;
16554 g_variant_get (_ret,
16555 "()");
16556 g_variant_unref (_ret);
16557_out:
16558 return _ret != NULL;
16559}
16560
16561/**
16562 * watchdog_call_start_sync:
16563 * @proxy: A #WatchdogProxy.
16564 * @cancellable: (allow-none): A #GCancellable or %NULL.
16565 * @error: Return location for error or %NULL.
16566 *
16567 * 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.
16568 *
16569 * See watchdog_call_start() for the asynchronous version of this method.
16570 *
16571 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16572 */
16573gboolean
16574watchdog_call_start_sync (
16575 Watchdog *proxy,
16576 GCancellable *cancellable,
16577 GError **error)
16578{
16579 GVariant *_ret;
16580 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
16581 "start",
16582 g_variant_new ("()"),
16583 G_DBUS_CALL_FLAGS_NONE,
16584 -1,
16585 cancellable,
16586 error);
16587 if (_ret == NULL)
16588 goto _out;
16589 g_variant_get (_ret,
16590 "()");
16591 g_variant_unref (_ret);
16592_out:
16593 return _ret != NULL;
16594}
16595
16596/**
16597 * watchdog_call_poke:
16598 * @proxy: A #WatchdogProxy.
16599 * @cancellable: (allow-none): A #GCancellable or %NULL.
16600 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
16601 * @user_data: User data to pass to @callback.
16602 *
16603 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method on @proxy.
16604 * 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.
16605 * You can then call watchdog_call_poke_finish() to get the result of the operation.
16606 *
16607 * See watchdog_call_poke_sync() for the synchronous, blocking version of this method.
16608 */
16609void
16610watchdog_call_poke (
16611 Watchdog *proxy,
16612 GCancellable *cancellable,
16613 GAsyncReadyCallback callback,
16614 gpointer user_data)
16615{
16616 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
16617 "poke",
16618 g_variant_new ("()"),
16619 G_DBUS_CALL_FLAGS_NONE,
16620 -1,
16621 cancellable,
16622 callback,
16623 user_data);
16624}
16625
16626/**
16627 * watchdog_call_poke_finish:
16628 * @proxy: A #WatchdogProxy.
16629 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_poke().
16630 * @error: Return location for error or %NULL.
16631 *
16632 * Finishes an operation started with watchdog_call_poke().
16633 *
16634 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16635 */
16636gboolean
16637watchdog_call_poke_finish (
16638 Watchdog *proxy,
16639 GAsyncResult *res,
16640 GError **error)
16641{
16642 GVariant *_ret;
16643 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
16644 if (_ret == NULL)
16645 goto _out;
16646 g_variant_get (_ret,
16647 "()");
16648 g_variant_unref (_ret);
16649_out:
16650 return _ret != NULL;
16651}
16652
16653/**
16654 * watchdog_call_poke_sync:
16655 * @proxy: A #WatchdogProxy.
16656 * @cancellable: (allow-none): A #GCancellable or %NULL.
16657 * @error: Return location for error or %NULL.
16658 *
16659 * 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.
16660 *
16661 * See watchdog_call_poke() for the asynchronous version of this method.
16662 *
16663 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16664 */
16665gboolean
16666watchdog_call_poke_sync (
16667 Watchdog *proxy,
16668 GCancellable *cancellable,
16669 GError **error)
16670{
16671 GVariant *_ret;
16672 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
16673 "poke",
16674 g_variant_new ("()"),
16675 G_DBUS_CALL_FLAGS_NONE,
16676 -1,
16677 cancellable,
16678 error);
16679 if (_ret == NULL)
16680 goto _out;
16681 g_variant_get (_ret,
16682 "()");
16683 g_variant_unref (_ret);
16684_out:
16685 return _ret != NULL;
16686}
16687
16688/**
16689 * watchdog_call_stop:
16690 * @proxy: A #WatchdogProxy.
16691 * @cancellable: (allow-none): A #GCancellable or %NULL.
16692 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
16693 * @user_data: User data to pass to @callback.
16694 *
16695 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method on @proxy.
16696 * 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.
16697 * You can then call watchdog_call_stop_finish() to get the result of the operation.
16698 *
16699 * See watchdog_call_stop_sync() for the synchronous, blocking version of this method.
16700 */
16701void
16702watchdog_call_stop (
16703 Watchdog *proxy,
16704 GCancellable *cancellable,
16705 GAsyncReadyCallback callback,
16706 gpointer user_data)
16707{
16708 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
16709 "stop",
16710 g_variant_new ("()"),
16711 G_DBUS_CALL_FLAGS_NONE,
16712 -1,
16713 cancellable,
16714 callback,
16715 user_data);
16716}
16717
16718/**
16719 * watchdog_call_stop_finish:
16720 * @proxy: A #WatchdogProxy.
16721 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_stop().
16722 * @error: Return location for error or %NULL.
16723 *
16724 * Finishes an operation started with watchdog_call_stop().
16725 *
16726 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16727 */
16728gboolean
16729watchdog_call_stop_finish (
16730 Watchdog *proxy,
16731 GAsyncResult *res,
16732 GError **error)
16733{
16734 GVariant *_ret;
16735 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
16736 if (_ret == NULL)
16737 goto _out;
16738 g_variant_get (_ret,
16739 "()");
16740 g_variant_unref (_ret);
16741_out:
16742 return _ret != NULL;
16743}
16744
16745/**
16746 * watchdog_call_stop_sync:
16747 * @proxy: A #WatchdogProxy.
16748 * @cancellable: (allow-none): A #GCancellable or %NULL.
16749 * @error: Return location for error or %NULL.
16750 *
16751 * 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.
16752 *
16753 * See watchdog_call_stop() for the asynchronous version of this method.
16754 *
16755 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16756 */
16757gboolean
16758watchdog_call_stop_sync (
16759 Watchdog *proxy,
16760 GCancellable *cancellable,
16761 GError **error)
16762{
16763 GVariant *_ret;
16764 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
16765 "stop",
16766 g_variant_new ("()"),
16767 G_DBUS_CALL_FLAGS_NONE,
16768 -1,
16769 cancellable,
16770 error);
16771 if (_ret == NULL)
16772 goto _out;
16773 g_variant_get (_ret,
16774 "()");
16775 g_variant_unref (_ret);
16776_out:
16777 return _ret != NULL;
16778}
16779
16780/**
16781 * watchdog_complete_start:
16782 * @object: A #Watchdog.
16783 * @invocation: (transfer full): A #GDBusMethodInvocation.
16784 *
16785 * 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.
16786 *
16787 * This method will free @invocation, you cannot use it afterwards.
16788 */
16789void
16790watchdog_complete_start (
16791 Watchdog *object,
16792 GDBusMethodInvocation *invocation)
16793{
16794 g_dbus_method_invocation_return_value (invocation,
16795 g_variant_new ("()"));
16796}
16797
16798/**
16799 * watchdog_complete_poke:
16800 * @object: A #Watchdog.
16801 * @invocation: (transfer full): A #GDBusMethodInvocation.
16802 *
16803 * 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.
16804 *
16805 * This method will free @invocation, you cannot use it afterwards.
16806 */
16807void
16808watchdog_complete_poke (
16809 Watchdog *object,
16810 GDBusMethodInvocation *invocation)
16811{
16812 g_dbus_method_invocation_return_value (invocation,
16813 g_variant_new ("()"));
16814}
16815
16816/**
16817 * watchdog_complete_stop:
16818 * @object: A #Watchdog.
16819 * @invocation: (transfer full): A #GDBusMethodInvocation.
16820 *
16821 * 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.
16822 *
16823 * This method will free @invocation, you cannot use it afterwards.
16824 */
16825void
16826watchdog_complete_stop (
16827 Watchdog *object,
16828 GDBusMethodInvocation *invocation)
16829{
16830 g_dbus_method_invocation_return_value (invocation,
16831 g_variant_new ("()"));
16832}
16833
16834/* ------------------------------------------------------------------------ */
16835
16836/**
16837 * WatchdogProxy:
16838 *
16839 * The #WatchdogProxy structure contains only private data and should only be accessed using the provided API.
16840 */
16841
16842/**
16843 * WatchdogProxyClass:
16844 * @parent_class: The parent class.
16845 *
16846 * Class structure for #WatchdogProxy.
16847 */
16848
16849struct _WatchdogProxyPrivate
16850{
16851 GData *qdata;
16852};
16853
16854static void watchdog_proxy_iface_init (WatchdogIface *iface);
16855
16856#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16857G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY,
16858 G_ADD_PRIVATE (WatchdogProxy)
16859 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init));
16860
16861#else
16862G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY,
16863 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init));
16864
16865#endif
16866static void
16867watchdog_proxy_finalize (GObject *object)
16868{
16869 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
16870 g_datalist_clear (&proxy->priv->qdata);
16871 G_OBJECT_CLASS (watchdog_proxy_parent_class)->finalize (object);
16872}
16873
16874static void
16875watchdog_proxy_get_property (GObject *object,
16876 guint prop_id,
16877 GValue *value,
16878 GParamSpec *pspec G_GNUC_UNUSED)
16879{
16880 const _ExtendedGDBusPropertyInfo *info;
16881 GVariant *variant;
16882 g_assert (prop_id != 0 && prop_id - 1 < 2);
16883 info = _watchdog_property_info_pointers[prop_id - 1];
16884 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
16885 if (info->use_gvariant)
16886 {
16887 g_value_set_variant (value, variant);
16888 }
16889 else
16890 {
16891 if (variant != NULL)
16892 g_dbus_gvariant_to_gvalue (variant, value);
16893 }
16894 if (variant != NULL)
16895 g_variant_unref (variant);
16896}
16897
16898static void
16899watchdog_proxy_set_property_cb (GDBusProxy *proxy,
16900 GAsyncResult *res,
16901 gpointer user_data)
16902{
16903 const _ExtendedGDBusPropertyInfo *info = user_data;
16904 GError *error;
16905 GVariant *_ret;
16906 error = NULL;
16907 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
16908 if (!_ret)
16909 {
16910 g_warning ("Error setting property '%s' on interface org.openbmc.Watchdog: %s (%s, %d)",
16911 info->parent_struct.name,
16912 error->message, g_quark_to_string (error->domain), error->code);
16913 g_error_free (error);
16914 }
16915 else
16916 {
16917 g_variant_unref (_ret);
16918 }
16919}
16920
16921static void
16922watchdog_proxy_set_property (GObject *object,
16923 guint prop_id,
16924 const GValue *value,
16925 GParamSpec *pspec G_GNUC_UNUSED)
16926{
16927 const _ExtendedGDBusPropertyInfo *info;
16928 GVariant *variant;
16929 g_assert (prop_id != 0 && prop_id - 1 < 2);
16930 info = _watchdog_property_info_pointers[prop_id - 1];
16931 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
16932 g_dbus_proxy_call (G_DBUS_PROXY (object),
16933 "org.freedesktop.DBus.Properties.Set",
16934 g_variant_new ("(ssv)", "org.openbmc.Watchdog", info->parent_struct.name, variant),
16935 G_DBUS_CALL_FLAGS_NONE,
16936 -1,
16937 NULL, (GAsyncReadyCallback) watchdog_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
16938 g_variant_unref (variant);
16939}
16940
16941static void
16942watchdog_proxy_g_signal (GDBusProxy *proxy,
16943 const gchar *sender_name G_GNUC_UNUSED,
16944 const gchar *signal_name,
16945 GVariant *parameters)
16946{
16947 _ExtendedGDBusSignalInfo *info;
16948 GVariantIter iter;
16949 GVariant *child;
16950 GValue *paramv;
16951 guint num_params;
16952 guint n;
16953 guint signal_id;
16954 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, signal_name);
16955 if (info == NULL)
16956 return;
16957 num_params = g_variant_n_children (parameters);
16958 paramv = g_new0 (GValue, num_params + 1);
16959 g_value_init (&paramv[0], TYPE_WATCHDOG);
16960 g_value_set_object (&paramv[0], proxy);
16961 g_variant_iter_init (&iter, parameters);
16962 n = 1;
16963 while ((child = g_variant_iter_next_value (&iter)) != NULL)
16964 {
16965 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
16966 if (arg_info->use_gvariant)
16967 {
16968 g_value_init (&paramv[n], G_TYPE_VARIANT);
16969 g_value_set_variant (&paramv[n], child);
16970 n++;
16971 }
16972 else
16973 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
16974 g_variant_unref (child);
16975 }
16976 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG);
16977 g_signal_emitv (paramv, signal_id, 0, NULL);
16978 for (n = 0; n < num_params + 1; n++)
16979 g_value_unset (&paramv[n]);
16980 g_free (paramv);
16981}
16982
16983static void
16984watchdog_proxy_g_properties_changed (GDBusProxy *_proxy,
16985 GVariant *changed_properties,
16986 const gchar *const *invalidated_properties)
16987{
16988 WatchdogProxy *proxy = WATCHDOG_PROXY (_proxy);
16989 guint n;
16990 const gchar *key;
16991 GVariantIter *iter;
16992 _ExtendedGDBusPropertyInfo *info;
16993 g_variant_get (changed_properties, "a{sv}", &iter);
16994 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
16995 {
16996 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, key);
16997 g_datalist_remove_data (&proxy->priv->qdata, key);
16998 if (info != NULL)
16999 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
17000 }
17001 g_variant_iter_free (iter);
17002 for (n = 0; invalidated_properties[n] != NULL; n++)
17003 {
17004 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, invalidated_properties[n]);
17005 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
17006 if (info != NULL)
17007 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
17008 }
17009}
17010
17011static gint
17012watchdog_proxy_get_watchdog (Watchdog *object)
17013{
17014 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
17015 GVariant *variant;
17016 gint value = 0;
17017 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "watchdog");
17018 if (variant != NULL)
17019 {
17020 value = g_variant_get_int32 (variant);
17021 g_variant_unref (variant);
17022 }
17023 return value;
17024}
17025
17026static gint
17027watchdog_proxy_get_poll_interval (Watchdog *object)
17028{
17029 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
17030 GVariant *variant;
17031 gint value = 0;
17032 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
17033 if (variant != NULL)
17034 {
17035 value = g_variant_get_int32 (variant);
17036 g_variant_unref (variant);
17037 }
17038 return value;
17039}
17040
17041static void
17042watchdog_proxy_init (WatchdogProxy *proxy)
17043{
17044#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17045 proxy->priv = watchdog_proxy_get_instance_private (proxy);
17046#else
17047 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_WATCHDOG_PROXY, WatchdogProxyPrivate);
17048#endif
17049
17050 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), watchdog_interface_info ());
17051}
17052
17053static void
17054watchdog_proxy_class_init (WatchdogProxyClass *klass)
17055{
17056 GObjectClass *gobject_class;
17057 GDBusProxyClass *proxy_class;
17058
17059 gobject_class = G_OBJECT_CLASS (klass);
17060 gobject_class->finalize = watchdog_proxy_finalize;
17061 gobject_class->get_property = watchdog_proxy_get_property;
17062 gobject_class->set_property = watchdog_proxy_set_property;
17063
17064 proxy_class = G_DBUS_PROXY_CLASS (klass);
17065 proxy_class->g_signal = watchdog_proxy_g_signal;
17066 proxy_class->g_properties_changed = watchdog_proxy_g_properties_changed;
17067
17068 watchdog_override_properties (gobject_class, 1);
17069
17070#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
17071 g_type_class_add_private (klass, sizeof (WatchdogProxyPrivate));
17072#endif
17073}
17074
17075static void
17076watchdog_proxy_iface_init (WatchdogIface *iface)
17077{
17078 iface->get_watchdog = watchdog_proxy_get_watchdog;
17079 iface->get_poll_interval = watchdog_proxy_get_poll_interval;
17080}
17081
17082/**
17083 * watchdog_proxy_new:
17084 * @connection: A #GDBusConnection.
17085 * @flags: Flags from the #GDBusProxyFlags enumeration.
17086 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
17087 * @object_path: An object path.
17088 * @cancellable: (allow-none): A #GCancellable or %NULL.
17089 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
17090 * @user_data: User data to pass to @callback.
17091 *
17092 * 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.
17093 *
17094 * 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.
17095 * You can then call watchdog_proxy_new_finish() to get the result of the operation.
17096 *
17097 * See watchdog_proxy_new_sync() for the synchronous, blocking version of this constructor.
17098 */
17099void
17100watchdog_proxy_new (
17101 GDBusConnection *connection,
17102 GDBusProxyFlags flags,
17103 const gchar *name,
17104 const gchar *object_path,
17105 GCancellable *cancellable,
17106 GAsyncReadyCallback callback,
17107 gpointer user_data)
17108{
17109 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);
17110}
17111
17112/**
17113 * watchdog_proxy_new_finish:
17114 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new().
17115 * @error: Return location for error or %NULL
17116 *
17117 * Finishes an operation started with watchdog_proxy_new().
17118 *
17119 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
17120 */
17121Watchdog *
17122watchdog_proxy_new_finish (
17123 GAsyncResult *res,
17124 GError **error)
17125{
17126 GObject *ret;
17127 GObject *source_object;
17128 source_object = g_async_result_get_source_object (res);
17129 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
17130 g_object_unref (source_object);
17131 if (ret != NULL)
17132 return WATCHDOG (ret);
17133 else
17134 return NULL;
17135}
17136
17137/**
17138 * watchdog_proxy_new_sync:
17139 * @connection: A #GDBusConnection.
17140 * @flags: Flags from the #GDBusProxyFlags enumeration.
17141 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
17142 * @object_path: An object path.
17143 * @cancellable: (allow-none): A #GCancellable or %NULL.
17144 * @error: Return location for error or %NULL
17145 *
17146 * 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.
17147 *
17148 * The calling thread is blocked until a reply is received.
17149 *
17150 * See watchdog_proxy_new() for the asynchronous version of this constructor.
17151 *
17152 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
17153 */
17154Watchdog *
17155watchdog_proxy_new_sync (
17156 GDBusConnection *connection,
17157 GDBusProxyFlags flags,
17158 const gchar *name,
17159 const gchar *object_path,
17160 GCancellable *cancellable,
17161 GError **error)
17162{
17163 GInitable *ret;
17164 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);
17165 if (ret != NULL)
17166 return WATCHDOG (ret);
17167 else
17168 return NULL;
17169}
17170
17171
17172/**
17173 * watchdog_proxy_new_for_bus:
17174 * @bus_type: A #GBusType.
17175 * @flags: Flags from the #GDBusProxyFlags enumeration.
17176 * @name: A bus name (well-known or unique).
17177 * @object_path: An object path.
17178 * @cancellable: (allow-none): A #GCancellable or %NULL.
17179 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
17180 * @user_data: User data to pass to @callback.
17181 *
17182 * Like watchdog_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
17183 *
17184 * 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.
17185 * You can then call watchdog_proxy_new_for_bus_finish() to get the result of the operation.
17186 *
17187 * See watchdog_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
17188 */
17189void
17190watchdog_proxy_new_for_bus (
17191 GBusType bus_type,
17192 GDBusProxyFlags flags,
17193 const gchar *name,
17194 const gchar *object_path,
17195 GCancellable *cancellable,
17196 GAsyncReadyCallback callback,
17197 gpointer user_data)
17198{
17199 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);
17200}
17201
17202/**
17203 * watchdog_proxy_new_for_bus_finish:
17204 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new_for_bus().
17205 * @error: Return location for error or %NULL
17206 *
17207 * Finishes an operation started with watchdog_proxy_new_for_bus().
17208 *
17209 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
17210 */
17211Watchdog *
17212watchdog_proxy_new_for_bus_finish (
17213 GAsyncResult *res,
17214 GError **error)
17215{
17216 GObject *ret;
17217 GObject *source_object;
17218 source_object = g_async_result_get_source_object (res);
17219 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
17220 g_object_unref (source_object);
17221 if (ret != NULL)
17222 return WATCHDOG (ret);
17223 else
17224 return NULL;
17225}
17226
17227/**
17228 * watchdog_proxy_new_for_bus_sync:
17229 * @bus_type: A #GBusType.
17230 * @flags: Flags from the #GDBusProxyFlags enumeration.
17231 * @name: A bus name (well-known or unique).
17232 * @object_path: An object path.
17233 * @cancellable: (allow-none): A #GCancellable or %NULL.
17234 * @error: Return location for error or %NULL
17235 *
17236 * Like watchdog_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
17237 *
17238 * The calling thread is blocked until a reply is received.
17239 *
17240 * See watchdog_proxy_new_for_bus() for the asynchronous version of this constructor.
17241 *
17242 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
17243 */
17244Watchdog *
17245watchdog_proxy_new_for_bus_sync (
17246 GBusType bus_type,
17247 GDBusProxyFlags flags,
17248 const gchar *name,
17249 const gchar *object_path,
17250 GCancellable *cancellable,
17251 GError **error)
17252{
17253 GInitable *ret;
17254 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);
17255 if (ret != NULL)
17256 return WATCHDOG (ret);
17257 else
17258 return NULL;
17259}
17260
17261
17262/* ------------------------------------------------------------------------ */
17263
17264/**
17265 * WatchdogSkeleton:
17266 *
17267 * The #WatchdogSkeleton structure contains only private data and should only be accessed using the provided API.
17268 */
17269
17270/**
17271 * WatchdogSkeletonClass:
17272 * @parent_class: The parent class.
17273 *
17274 * Class structure for #WatchdogSkeleton.
17275 */
17276
17277struct _WatchdogSkeletonPrivate
17278{
17279 GValue *properties;
17280 GList *changed_properties;
17281 GSource *changed_properties_idle_source;
17282 GMainContext *context;
17283 GMutex lock;
17284};
17285
17286static void
17287_watchdog_skeleton_handle_method_call (
17288 GDBusConnection *connection G_GNUC_UNUSED,
17289 const gchar *sender G_GNUC_UNUSED,
17290 const gchar *object_path G_GNUC_UNUSED,
17291 const gchar *interface_name,
17292 const gchar *method_name,
17293 GVariant *parameters,
17294 GDBusMethodInvocation *invocation,
17295 gpointer user_data)
17296{
17297 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
17298 _ExtendedGDBusMethodInfo *info;
17299 GVariantIter iter;
17300 GVariant *child;
17301 GValue *paramv;
17302 guint num_params;
17303 guint num_extra;
17304 guint n;
17305 guint signal_id;
17306 GValue return_value = G_VALUE_INIT;
17307 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
17308 g_assert (info != NULL);
17309 num_params = g_variant_n_children (parameters);
17310 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
17311 n = 0;
17312 g_value_init (&paramv[n], TYPE_WATCHDOG);
17313 g_value_set_object (&paramv[n++], skeleton);
17314 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
17315 g_value_set_object (&paramv[n++], invocation);
17316 if (info->pass_fdlist)
17317 {
17318#ifdef G_OS_UNIX
17319 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
17320 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
17321#else
17322 g_assert_not_reached ();
17323#endif
17324 }
17325 g_variant_iter_init (&iter, parameters);
17326 while ((child = g_variant_iter_next_value (&iter)) != NULL)
17327 {
17328 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
17329 if (arg_info->use_gvariant)
17330 {
17331 g_value_init (&paramv[n], G_TYPE_VARIANT);
17332 g_value_set_variant (&paramv[n], child);
17333 n++;
17334 }
17335 else
17336 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
17337 g_variant_unref (child);
17338 }
17339 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG);
17340 g_value_init (&return_value, G_TYPE_BOOLEAN);
17341 g_signal_emitv (paramv, signal_id, 0, &return_value);
17342 if (!g_value_get_boolean (&return_value))
17343 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);
17344 g_value_unset (&return_value);
17345 for (n = 0; n < num_params + num_extra; n++)
17346 g_value_unset (&paramv[n]);
17347 g_free (paramv);
17348}
17349
17350static GVariant *
17351_watchdog_skeleton_handle_get_property (
17352 GDBusConnection *connection G_GNUC_UNUSED,
17353 const gchar *sender G_GNUC_UNUSED,
17354 const gchar *object_path G_GNUC_UNUSED,
17355 const gchar *interface_name G_GNUC_UNUSED,
17356 const gchar *property_name,
17357 GError **error,
17358 gpointer user_data)
17359{
17360 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
17361 GValue value = G_VALUE_INIT;
17362 GParamSpec *pspec;
17363 _ExtendedGDBusPropertyInfo *info;
17364 GVariant *ret;
17365 ret = NULL;
17366 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name);
17367 g_assert (info != NULL);
17368 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
17369 if (pspec == NULL)
17370 {
17371 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
17372 }
17373 else
17374 {
17375 g_value_init (&value, pspec->value_type);
17376 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
17377 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
17378 g_value_unset (&value);
17379 }
17380 return ret;
17381}
17382
17383static gboolean
17384_watchdog_skeleton_handle_set_property (
17385 GDBusConnection *connection G_GNUC_UNUSED,
17386 const gchar *sender G_GNUC_UNUSED,
17387 const gchar *object_path G_GNUC_UNUSED,
17388 const gchar *interface_name G_GNUC_UNUSED,
17389 const gchar *property_name,
17390 GVariant *variant,
17391 GError **error,
17392 gpointer user_data)
17393{
17394 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
17395 GValue value = G_VALUE_INIT;
17396 GParamSpec *pspec;
17397 _ExtendedGDBusPropertyInfo *info;
17398 gboolean ret;
17399 ret = FALSE;
17400 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name);
17401 g_assert (info != NULL);
17402 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
17403 if (pspec == NULL)
17404 {
17405 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
17406 }
17407 else
17408 {
17409 if (info->use_gvariant)
17410 g_value_set_variant (&value, variant);
17411 else
17412 g_dbus_gvariant_to_gvalue (variant, &value);
17413 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
17414 g_value_unset (&value);
17415 ret = TRUE;
17416 }
17417 return ret;
17418}
17419
17420static const GDBusInterfaceVTable _watchdog_skeleton_vtable =
17421{
17422 _watchdog_skeleton_handle_method_call,
17423 _watchdog_skeleton_handle_get_property,
17424 _watchdog_skeleton_handle_set_property,
17425 {NULL}
17426};
17427
17428static GDBusInterfaceInfo *
17429watchdog_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
17430{
17431 return watchdog_interface_info ();
17432}
17433
17434static GDBusInterfaceVTable *
17435watchdog_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
17436{
17437 return (GDBusInterfaceVTable *) &_watchdog_skeleton_vtable;
17438}
17439
17440static GVariant *
17441watchdog_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
17442{
17443 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton);
17444
17445 GVariantBuilder builder;
17446 guint n;
17447 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
17448 if (_watchdog_interface_info.parent_struct.properties == NULL)
17449 goto out;
17450 for (n = 0; _watchdog_interface_info.parent_struct.properties[n] != NULL; n++)
17451 {
17452 GDBusPropertyInfo *info = _watchdog_interface_info.parent_struct.properties[n];
17453 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
17454 {
17455 GVariant *value;
17456 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);
17457 if (value != NULL)
17458 {
17459 g_variant_take_ref (value);
17460 g_variant_builder_add (&builder, "{sv}", info->name, value);
17461 g_variant_unref (value);
17462 }
17463 }
17464 }
17465out:
17466 return g_variant_builder_end (&builder);
17467}
17468
17469static gboolean _watchdog_emit_changed (gpointer user_data);
17470
17471static void
17472watchdog_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
17473{
17474 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton);
17475 gboolean emit_changed = FALSE;
17476
17477 g_mutex_lock (&skeleton->priv->lock);
17478 if (skeleton->priv->changed_properties_idle_source != NULL)
17479 {
17480 g_source_destroy (skeleton->priv->changed_properties_idle_source);
17481 skeleton->priv->changed_properties_idle_source = NULL;
17482 emit_changed = TRUE;
17483 }
17484 g_mutex_unlock (&skeleton->priv->lock);
17485
17486 if (emit_changed)
17487 _watchdog_emit_changed (skeleton);
17488}
17489
17490static void
17491_watchdog_on_signal_watchdog_error (
17492 Watchdog *object)
17493{
17494 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17495
17496 GList *connections, *l;
17497 GVariant *signal_variant;
17498 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
17499
17500 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
17501 for (l = connections; l != NULL; l = l->next)
17502 {
17503 GDBusConnection *connection = l->data;
17504 g_dbus_connection_emit_signal (connection,
17505 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Watchdog", "WatchdogError",
17506 signal_variant, NULL);
17507 }
17508 g_variant_unref (signal_variant);
17509 g_list_free_full (connections, g_object_unref);
17510}
17511
17512static void watchdog_skeleton_iface_init (WatchdogIface *iface);
17513#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17514G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
17515 G_ADD_PRIVATE (WatchdogSkeleton)
17516 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init));
17517
17518#else
17519G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
17520 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init));
17521
17522#endif
17523static void
17524watchdog_skeleton_finalize (GObject *object)
17525{
17526 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17527 guint n;
17528 for (n = 0; n < 2; n++)
17529 g_value_unset (&skeleton->priv->properties[n]);
17530 g_free (skeleton->priv->properties);
17531 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
17532 if (skeleton->priv->changed_properties_idle_source != NULL)
17533 g_source_destroy (skeleton->priv->changed_properties_idle_source);
17534 g_main_context_unref (skeleton->priv->context);
17535 g_mutex_clear (&skeleton->priv->lock);
17536 G_OBJECT_CLASS (watchdog_skeleton_parent_class)->finalize (object);
17537}
17538
17539static void
17540watchdog_skeleton_get_property (GObject *object,
17541 guint prop_id,
17542 GValue *value,
17543 GParamSpec *pspec G_GNUC_UNUSED)
17544{
17545 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17546 g_assert (prop_id != 0 && prop_id - 1 < 2);
17547 g_mutex_lock (&skeleton->priv->lock);
17548 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
17549 g_mutex_unlock (&skeleton->priv->lock);
17550}
17551
17552static gboolean
17553_watchdog_emit_changed (gpointer user_data)
17554{
17555 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
17556 GList *l;
17557 GVariantBuilder builder;
17558 GVariantBuilder invalidated_builder;
17559 guint num_changes;
17560
17561 g_mutex_lock (&skeleton->priv->lock);
17562 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
17563 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
17564 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
17565 {
17566 ChangedProperty *cp = l->data;
17567 GVariant *variant;
17568 const GValue *cur_value;
17569
17570 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
17571 if (!_g_value_equal (cur_value, &cp->orig_value))
17572 {
17573 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
17574 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
17575 g_variant_unref (variant);
17576 num_changes++;
17577 }
17578 }
17579 if (num_changes > 0)
17580 {
17581 GList *connections, *ll;
17582 GVariant *signal_variant;
17583 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Watchdog",
17584 &builder, &invalidated_builder));
17585 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
17586 for (ll = connections; ll != NULL; ll = ll->next)
17587 {
17588 GDBusConnection *connection = ll->data;
17589
17590 g_dbus_connection_emit_signal (connection,
17591 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
17592 "org.freedesktop.DBus.Properties",
17593 "PropertiesChanged",
17594 signal_variant,
17595 NULL);
17596 }
17597 g_variant_unref (signal_variant);
17598 g_list_free_full (connections, g_object_unref);
17599 }
17600 else
17601 {
17602 g_variant_builder_clear (&builder);
17603 g_variant_builder_clear (&invalidated_builder);
17604 }
17605 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
17606 skeleton->priv->changed_properties = NULL;
17607 skeleton->priv->changed_properties_idle_source = NULL;
17608 g_mutex_unlock (&skeleton->priv->lock);
17609 return FALSE;
17610}
17611
17612static void
17613_watchdog_schedule_emit_changed (WatchdogSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
17614{
17615 ChangedProperty *cp;
17616 GList *l;
17617 cp = NULL;
17618 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
17619 {
17620 ChangedProperty *i_cp = l->data;
17621 if (i_cp->info == info)
17622 {
17623 cp = i_cp;
17624 break;
17625 }
17626 }
17627 if (cp == NULL)
17628 {
17629 cp = g_new0 (ChangedProperty, 1);
17630 cp->prop_id = prop_id;
17631 cp->info = info;
17632 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
17633 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
17634 g_value_copy (orig_value, &cp->orig_value);
17635 }
17636}
17637
17638static void
17639watchdog_skeleton_notify (GObject *object,
17640 GParamSpec *pspec G_GNUC_UNUSED)
17641{
17642 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17643 g_mutex_lock (&skeleton->priv->lock);
17644 if (skeleton->priv->changed_properties != NULL &&
17645 skeleton->priv->changed_properties_idle_source == NULL)
17646 {
17647 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
17648 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
17649 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _watchdog_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
17650 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
17651 g_source_unref (skeleton->priv->changed_properties_idle_source);
17652 }
17653 g_mutex_unlock (&skeleton->priv->lock);
17654}
17655
17656static void
17657watchdog_skeleton_set_property (GObject *object,
17658 guint prop_id,
17659 const GValue *value,
17660 GParamSpec *pspec)
17661{
17662 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17663 g_assert (prop_id != 0 && prop_id - 1 < 2);
17664 g_mutex_lock (&skeleton->priv->lock);
17665 g_object_freeze_notify (object);
17666 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
17667 {
17668 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
17669 _watchdog_schedule_emit_changed (skeleton, _watchdog_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
17670 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
17671 g_object_notify_by_pspec (object, pspec);
17672 }
17673 g_mutex_unlock (&skeleton->priv->lock);
17674 g_object_thaw_notify (object);
17675}
17676
17677static void
17678watchdog_skeleton_init (WatchdogSkeleton *skeleton)
17679{
17680#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17681 skeleton->priv = watchdog_skeleton_get_instance_private (skeleton);
17682#else
17683 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_WATCHDOG_SKELETON, WatchdogSkeletonPrivate);
17684#endif
17685
17686 g_mutex_init (&skeleton->priv->lock);
17687 skeleton->priv->context = g_main_context_ref_thread_default ();
17688 skeleton->priv->properties = g_new0 (GValue, 2);
17689 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
17690 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
17691}
17692
17693static gint
17694watchdog_skeleton_get_watchdog (Watchdog *object)
17695{
17696 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17697 gint value;
17698 g_mutex_lock (&skeleton->priv->lock);
17699 value = g_value_get_int (&(skeleton->priv->properties[0]));
17700 g_mutex_unlock (&skeleton->priv->lock);
17701 return value;
17702}
17703
17704static gint
17705watchdog_skeleton_get_poll_interval (Watchdog *object)
17706{
17707 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17708 gint value;
17709 g_mutex_lock (&skeleton->priv->lock);
17710 value = g_value_get_int (&(skeleton->priv->properties[1]));
17711 g_mutex_unlock (&skeleton->priv->lock);
17712 return value;
17713}
17714
17715static void
17716watchdog_skeleton_class_init (WatchdogSkeletonClass *klass)
17717{
17718 GObjectClass *gobject_class;
17719 GDBusInterfaceSkeletonClass *skeleton_class;
17720
17721 gobject_class = G_OBJECT_CLASS (klass);
17722 gobject_class->finalize = watchdog_skeleton_finalize;
17723 gobject_class->get_property = watchdog_skeleton_get_property;
17724 gobject_class->set_property = watchdog_skeleton_set_property;
17725 gobject_class->notify = watchdog_skeleton_notify;
17726
17727
17728 watchdog_override_properties (gobject_class, 1);
17729
17730 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
17731 skeleton_class->get_info = watchdog_skeleton_dbus_interface_get_info;
17732 skeleton_class->get_properties = watchdog_skeleton_dbus_interface_get_properties;
17733 skeleton_class->flush = watchdog_skeleton_dbus_interface_flush;
17734 skeleton_class->get_vtable = watchdog_skeleton_dbus_interface_get_vtable;
17735
17736#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
17737 g_type_class_add_private (klass, sizeof (WatchdogSkeletonPrivate));
17738#endif
17739}
17740
17741static void
17742watchdog_skeleton_iface_init (WatchdogIface *iface)
17743{
17744 iface->watchdog_error = _watchdog_on_signal_watchdog_error;
17745 iface->get_watchdog = watchdog_skeleton_get_watchdog;
17746 iface->get_poll_interval = watchdog_skeleton_get_poll_interval;
17747}
17748
17749/**
17750 * watchdog_skeleton_new:
17751 *
17752 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
17753 *
17754 * Returns: (transfer full) (type WatchdogSkeleton): The skeleton object.
17755 */
17756Watchdog *
17757watchdog_skeleton_new (void)
17758{
17759 return WATCHDOG (g_object_new (TYPE_WATCHDOG_SKELETON, NULL));
17760}
17761
17762/* ------------------------------------------------------------------------
17763 * Code for interface org.openbmc.EventLog
17764 * ------------------------------------------------------------------------
17765 */
17766
17767/**
17768 * SECTION:EventLog
17769 * @title: EventLog
17770 * @short_description: Generated C code for the org.openbmc.EventLog D-Bus interface
17771 *
17772 * 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.
17773 */
17774
17775/* ---- Introspection data for org.openbmc.EventLog ---- */
17776
Norman James2d1ee892015-09-16 23:13:45 -050017777static const _ExtendedGDBusArgInfo _event_log_method_info_get_event_log_OUT_ARG_log =
17778{
17779 {
17780 -1,
17781 (gchar *) "log",
17782 (gchar *) "a(s)",
17783 NULL
17784 },
17785 FALSE
17786};
17787
17788static const _ExtendedGDBusArgInfo * const _event_log_method_info_get_event_log_OUT_ARG_pointers[] =
17789{
17790 &_event_log_method_info_get_event_log_OUT_ARG_log,
17791 NULL
17792};
17793
17794static const _ExtendedGDBusMethodInfo _event_log_method_info_get_event_log =
17795{
17796 {
17797 -1,
17798 (gchar *) "getEventLog",
17799 NULL,
17800 (GDBusArgInfo **) &_event_log_method_info_get_event_log_OUT_ARG_pointers,
17801 NULL
17802 },
17803 "handle-get-event-log",
17804 FALSE
17805};
17806
17807static const _ExtendedGDBusMethodInfo * const _event_log_method_info_pointers[] =
17808{
17809 &_event_log_method_info_get_event_log,
17810 NULL
17811};
17812
Norman James8abb50c2015-09-16 10:58:16 -050017813static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_priority =
Norman James362a80f2015-09-14 14:04:39 -050017814{
17815 {
17816 -1,
Norman James8abb50c2015-09-16 10:58:16 -050017817 (gchar *) "priority",
17818 (gchar *) "i",
Norman James362a80f2015-09-14 14:04:39 -050017819 NULL
17820 },
17821 FALSE
17822};
17823
Norman James362a80f2015-09-14 14:04:39 -050017824static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_message =
17825{
17826 {
17827 -1,
17828 (gchar *) "message",
Norman James32e74e22015-09-15 21:28:06 -050017829 (gchar *) "s",
Norman James362a80f2015-09-14 14:04:39 -050017830 NULL
17831 },
17832 FALSE
17833};
17834
Norman James88872672015-09-21 16:51:35 -050017835static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_rc =
17836{
17837 {
17838 -1,
17839 (gchar *) "rc",
17840 (gchar *) "i",
17841 NULL
17842 },
17843 FALSE
17844};
17845
Norman James362a80f2015-09-14 14:04:39 -050017846static const _ExtendedGDBusArgInfo * const _event_log_signal_info_event_log_ARG_pointers[] =
17847{
Norman James8abb50c2015-09-16 10:58:16 -050017848 &_event_log_signal_info_event_log_ARG_priority,
Norman James362a80f2015-09-14 14:04:39 -050017849 &_event_log_signal_info_event_log_ARG_message,
Norman James88872672015-09-21 16:51:35 -050017850 &_event_log_signal_info_event_log_ARG_rc,
Norman James362a80f2015-09-14 14:04:39 -050017851 NULL
17852};
17853
17854static const _ExtendedGDBusSignalInfo _event_log_signal_info_event_log =
17855{
17856 {
17857 -1,
17858 (gchar *) "EventLog",
17859 (GDBusArgInfo **) &_event_log_signal_info_event_log_ARG_pointers,
17860 NULL
17861 },
17862 "event-log"
17863};
17864
17865static const _ExtendedGDBusSignalInfo * const _event_log_signal_info_pointers[] =
17866{
17867 &_event_log_signal_info_event_log,
17868 NULL
17869};
17870
Norman James362a80f2015-09-14 14:04:39 -050017871static const _ExtendedGDBusInterfaceInfo _event_log_interface_info =
17872{
17873 {
17874 -1,
17875 (gchar *) "org.openbmc.EventLog",
Norman James2d1ee892015-09-16 23:13:45 -050017876 (GDBusMethodInfo **) &_event_log_method_info_pointers,
Norman James362a80f2015-09-14 14:04:39 -050017877 (GDBusSignalInfo **) &_event_log_signal_info_pointers,
Norman James32e74e22015-09-15 21:28:06 -050017878 NULL,
Norman James362a80f2015-09-14 14:04:39 -050017879 NULL
17880 },
17881 "event-log",
17882};
17883
17884
17885/**
17886 * event_log_interface_info:
17887 *
17888 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> D-Bus interface.
17889 *
17890 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
17891 */
17892GDBusInterfaceInfo *
17893event_log_interface_info (void)
17894{
17895 return (GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct;
17896}
17897
17898/**
17899 * event_log_override_properties:
17900 * @klass: The class structure for a #GObject<!-- -->-derived class.
17901 * @property_id_begin: The property id to assign to the first overridden property.
17902 *
17903 * Overrides all #GObject properties in the #EventLog interface for a concrete class.
17904 * The properties are overridden in the order they are defined.
17905 *
17906 * Returns: The last property id.
17907 */
17908guint
17909event_log_override_properties (GObjectClass *klass, guint property_id_begin)
17910{
Norman James362a80f2015-09-14 14:04:39 -050017911 return property_id_begin - 1;
17912}
17913
17914
17915
17916/**
17917 * EventLog:
17918 *
17919 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
17920 */
17921
17922/**
17923 * EventLogIface:
17924 * @parent_iface: The parent interface.
Norman James2d1ee892015-09-16 23:13:45 -050017925 * @handle_get_event_log: Handler for the #EventLog::handle-get-event-log signal.
Norman James362a80f2015-09-14 14:04:39 -050017926 * @event_log: Handler for the #EventLog::event-log signal.
17927 *
17928 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
17929 */
17930
17931typedef EventLogIface EventLogInterface;
17932G_DEFINE_INTERFACE (EventLog, event_log, G_TYPE_OBJECT);
17933
17934static void
17935event_log_default_init (EventLogIface *iface)
17936{
Norman James2d1ee892015-09-16 23:13:45 -050017937 /* GObject signals for incoming D-Bus method calls: */
17938 /**
17939 * EventLog::handle-get-event-log:
17940 * @object: A #EventLog.
17941 * @invocation: A #GDBusMethodInvocation.
17942 *
17943 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method.
17944 *
17945 * 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_event_log() 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.
17946 *
17947 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
17948 */
17949 g_signal_new ("handle-get-event-log",
17950 G_TYPE_FROM_INTERFACE (iface),
17951 G_SIGNAL_RUN_LAST,
17952 G_STRUCT_OFFSET (EventLogIface, handle_get_event_log),
17953 g_signal_accumulator_true_handled,
17954 NULL,
17955 g_cclosure_marshal_generic,
17956 G_TYPE_BOOLEAN,
17957 1,
17958 G_TYPE_DBUS_METHOD_INVOCATION);
17959
Norman James362a80f2015-09-14 14:04:39 -050017960 /* GObject signals for received D-Bus signals: */
17961 /**
17962 * EventLog::event-log:
17963 * @object: A #EventLog.
Norman James8abb50c2015-09-16 10:58:16 -050017964 * @arg_priority: Argument.
Norman James362a80f2015-09-14 14:04:39 -050017965 * @arg_message: Argument.
Norman James88872672015-09-21 16:51:35 -050017966 * @arg_rc: Argument.
Norman James362a80f2015-09-14 14:04:39 -050017967 *
17968 * 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.
17969 *
17970 * 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.
17971 */
17972 g_signal_new ("event-log",
17973 G_TYPE_FROM_INTERFACE (iface),
17974 G_SIGNAL_RUN_LAST,
17975 G_STRUCT_OFFSET (EventLogIface, event_log),
17976 NULL,
17977 NULL,
17978 g_cclosure_marshal_generic,
17979 G_TYPE_NONE,
Norman James88872672015-09-21 16:51:35 -050017980 3, G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT);
Norman James362a80f2015-09-14 14:04:39 -050017981
Norman James362a80f2015-09-14 14:04:39 -050017982}
17983
17984/**
17985 * event_log_emit_event_log:
17986 * @object: A #EventLog.
Norman James8abb50c2015-09-16 10:58:16 -050017987 * @arg_priority: Argument to pass with the signal.
Norman James362a80f2015-09-14 14:04:39 -050017988 * @arg_message: Argument to pass with the signal.
Norman James88872672015-09-21 16:51:35 -050017989 * @arg_rc: Argument to pass with the signal.
Norman James362a80f2015-09-14 14:04:39 -050017990 *
17991 * Emits the <link linkend="gdbus-signal-org-openbmc-EventLog.EventLog">"EventLog"</link> D-Bus signal.
17992 */
17993void
17994event_log_emit_event_log (
17995 EventLog *object,
Norman James8abb50c2015-09-16 10:58:16 -050017996 gint arg_priority,
Norman James88872672015-09-21 16:51:35 -050017997 const gchar *arg_message,
17998 gint arg_rc)
Norman James362a80f2015-09-14 14:04:39 -050017999{
Norman James88872672015-09-21 16:51:35 -050018000 g_signal_emit_by_name (object, "event-log", arg_priority, arg_message, arg_rc);
Norman James362a80f2015-09-14 14:04:39 -050018001}
18002
Norman James2d1ee892015-09-16 23:13:45 -050018003/**
18004 * event_log_call_get_event_log:
18005 * @proxy: A #EventLogProxy.
18006 * @cancellable: (allow-none): A #GCancellable or %NULL.
18007 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
18008 * @user_data: User data to pass to @callback.
18009 *
18010 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method on @proxy.
18011 * 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.
18012 * You can then call event_log_call_get_event_log_finish() to get the result of the operation.
18013 *
18014 * See event_log_call_get_event_log_sync() for the synchronous, blocking version of this method.
18015 */
18016void
18017event_log_call_get_event_log (
18018 EventLog *proxy,
18019 GCancellable *cancellable,
18020 GAsyncReadyCallback callback,
18021 gpointer user_data)
18022{
18023 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
18024 "getEventLog",
18025 g_variant_new ("()"),
18026 G_DBUS_CALL_FLAGS_NONE,
18027 -1,
18028 cancellable,
18029 callback,
18030 user_data);
18031}
18032
18033/**
18034 * event_log_call_get_event_log_finish:
18035 * @proxy: A #EventLogProxy.
18036 * @out_log: (out): Return location for return parameter or %NULL to ignore.
18037 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_call_get_event_log().
18038 * @error: Return location for error or %NULL.
18039 *
18040 * Finishes an operation started with event_log_call_get_event_log().
18041 *
18042 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18043 */
18044gboolean
18045event_log_call_get_event_log_finish (
18046 EventLog *proxy,
18047 GVariant **out_log,
18048 GAsyncResult *res,
18049 GError **error)
18050{
18051 GVariant *_ret;
18052 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
18053 if (_ret == NULL)
18054 goto _out;
18055 g_variant_get (_ret,
18056 "(@a(s))",
18057 out_log);
18058 g_variant_unref (_ret);
18059_out:
18060 return _ret != NULL;
18061}
18062
18063/**
18064 * event_log_call_get_event_log_sync:
18065 * @proxy: A #EventLogProxy.
18066 * @out_log: (out): Return location for return parameter or %NULL to ignore.
18067 * @cancellable: (allow-none): A #GCancellable or %NULL.
18068 * @error: Return location for error or %NULL.
18069 *
18070 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
18071 *
18072 * See event_log_call_get_event_log() for the asynchronous version of this method.
18073 *
18074 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18075 */
18076gboolean
18077event_log_call_get_event_log_sync (
18078 EventLog *proxy,
18079 GVariant **out_log,
18080 GCancellable *cancellable,
18081 GError **error)
18082{
18083 GVariant *_ret;
18084 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
18085 "getEventLog",
18086 g_variant_new ("()"),
18087 G_DBUS_CALL_FLAGS_NONE,
18088 -1,
18089 cancellable,
18090 error);
18091 if (_ret == NULL)
18092 goto _out;
18093 g_variant_get (_ret,
18094 "(@a(s))",
18095 out_log);
18096 g_variant_unref (_ret);
18097_out:
18098 return _ret != NULL;
18099}
18100
18101/**
18102 * event_log_complete_get_event_log:
18103 * @object: A #EventLog.
18104 * @invocation: (transfer full): A #GDBusMethodInvocation.
18105 * @log: Parameter to return.
18106 *
18107 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</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.
18108 *
18109 * This method will free @invocation, you cannot use it afterwards.
18110 */
18111void
18112event_log_complete_get_event_log (
18113 EventLog *object,
18114 GDBusMethodInvocation *invocation,
18115 GVariant *log)
18116{
18117 g_dbus_method_invocation_return_value (invocation,
18118 g_variant_new ("(@a(s))",
18119 log));
18120}
18121
Norman James362a80f2015-09-14 14:04:39 -050018122/* ------------------------------------------------------------------------ */
18123
18124/**
18125 * EventLogProxy:
18126 *
18127 * The #EventLogProxy structure contains only private data and should only be accessed using the provided API.
18128 */
18129
18130/**
18131 * EventLogProxyClass:
18132 * @parent_class: The parent class.
18133 *
18134 * Class structure for #EventLogProxy.
18135 */
18136
18137struct _EventLogProxyPrivate
18138{
18139 GData *qdata;
18140};
18141
18142static void event_log_proxy_iface_init (EventLogIface *iface);
18143
18144#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18145G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
18146 G_ADD_PRIVATE (EventLogProxy)
18147 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
18148
18149#else
18150G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
18151 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
18152
18153#endif
18154static void
18155event_log_proxy_finalize (GObject *object)
18156{
18157 EventLogProxy *proxy = EVENT_LOG_PROXY (object);
18158 g_datalist_clear (&proxy->priv->qdata);
18159 G_OBJECT_CLASS (event_log_proxy_parent_class)->finalize (object);
18160}
18161
18162static void
18163event_log_proxy_get_property (GObject *object,
18164 guint prop_id,
18165 GValue *value,
18166 GParamSpec *pspec G_GNUC_UNUSED)
18167{
Norman James362a80f2015-09-14 14:04:39 -050018168}
18169
18170static void
18171event_log_proxy_set_property (GObject *object,
18172 guint prop_id,
18173 const GValue *value,
18174 GParamSpec *pspec G_GNUC_UNUSED)
18175{
Norman James362a80f2015-09-14 14:04:39 -050018176}
18177
18178static void
18179event_log_proxy_g_signal (GDBusProxy *proxy,
18180 const gchar *sender_name G_GNUC_UNUSED,
18181 const gchar *signal_name,
18182 GVariant *parameters)
18183{
18184 _ExtendedGDBusSignalInfo *info;
18185 GVariantIter iter;
18186 GVariant *child;
18187 GValue *paramv;
18188 guint num_params;
18189 guint n;
18190 guint signal_id;
18191 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, signal_name);
18192 if (info == NULL)
18193 return;
18194 num_params = g_variant_n_children (parameters);
18195 paramv = g_new0 (GValue, num_params + 1);
18196 g_value_init (&paramv[0], TYPE_EVENT_LOG);
18197 g_value_set_object (&paramv[0], proxy);
18198 g_variant_iter_init (&iter, parameters);
18199 n = 1;
18200 while ((child = g_variant_iter_next_value (&iter)) != NULL)
18201 {
18202 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
18203 if (arg_info->use_gvariant)
18204 {
18205 g_value_init (&paramv[n], G_TYPE_VARIANT);
18206 g_value_set_variant (&paramv[n], child);
18207 n++;
18208 }
18209 else
18210 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
18211 g_variant_unref (child);
18212 }
18213 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
18214 g_signal_emitv (paramv, signal_id, 0, NULL);
18215 for (n = 0; n < num_params + 1; n++)
18216 g_value_unset (&paramv[n]);
18217 g_free (paramv);
18218}
18219
18220static void
18221event_log_proxy_g_properties_changed (GDBusProxy *_proxy,
18222 GVariant *changed_properties,
18223 const gchar *const *invalidated_properties)
18224{
18225 EventLogProxy *proxy = EVENT_LOG_PROXY (_proxy);
18226 guint n;
18227 const gchar *key;
18228 GVariantIter *iter;
18229 _ExtendedGDBusPropertyInfo *info;
18230 g_variant_get (changed_properties, "a{sv}", &iter);
18231 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
18232 {
18233 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, key);
18234 g_datalist_remove_data (&proxy->priv->qdata, key);
18235 if (info != NULL)
18236 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
18237 }
18238 g_variant_iter_free (iter);
18239 for (n = 0; invalidated_properties[n] != NULL; n++)
18240 {
18241 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, invalidated_properties[n]);
18242 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
18243 if (info != NULL)
18244 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
18245 }
18246}
18247
Norman James362a80f2015-09-14 14:04:39 -050018248static void
18249event_log_proxy_init (EventLogProxy *proxy)
18250{
18251#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18252 proxy->priv = event_log_proxy_get_instance_private (proxy);
18253#else
18254 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_EVENT_LOG_PROXY, EventLogProxyPrivate);
18255#endif
18256
18257 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), event_log_interface_info ());
18258}
18259
18260static void
18261event_log_proxy_class_init (EventLogProxyClass *klass)
18262{
18263 GObjectClass *gobject_class;
18264 GDBusProxyClass *proxy_class;
18265
18266 gobject_class = G_OBJECT_CLASS (klass);
18267 gobject_class->finalize = event_log_proxy_finalize;
18268 gobject_class->get_property = event_log_proxy_get_property;
18269 gobject_class->set_property = event_log_proxy_set_property;
18270
18271 proxy_class = G_DBUS_PROXY_CLASS (klass);
18272 proxy_class->g_signal = event_log_proxy_g_signal;
18273 proxy_class->g_properties_changed = event_log_proxy_g_properties_changed;
18274
Norman James362a80f2015-09-14 14:04:39 -050018275#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
18276 g_type_class_add_private (klass, sizeof (EventLogProxyPrivate));
18277#endif
18278}
18279
18280static void
18281event_log_proxy_iface_init (EventLogIface *iface)
18282{
Norman James362a80f2015-09-14 14:04:39 -050018283}
18284
18285/**
18286 * event_log_proxy_new:
18287 * @connection: A #GDBusConnection.
18288 * @flags: Flags from the #GDBusProxyFlags enumeration.
18289 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
18290 * @object_path: An object path.
18291 * @cancellable: (allow-none): A #GCancellable or %NULL.
18292 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
18293 * @user_data: User data to pass to @callback.
18294 *
18295 * 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.
18296 *
18297 * 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.
18298 * You can then call event_log_proxy_new_finish() to get the result of the operation.
18299 *
18300 * See event_log_proxy_new_sync() for the synchronous, blocking version of this constructor.
18301 */
18302void
18303event_log_proxy_new (
18304 GDBusConnection *connection,
18305 GDBusProxyFlags flags,
18306 const gchar *name,
18307 const gchar *object_path,
18308 GCancellable *cancellable,
18309 GAsyncReadyCallback callback,
18310 gpointer user_data)
18311{
18312 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);
18313}
18314
18315/**
18316 * event_log_proxy_new_finish:
18317 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new().
18318 * @error: Return location for error or %NULL
18319 *
18320 * Finishes an operation started with event_log_proxy_new().
18321 *
18322 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
18323 */
18324EventLog *
18325event_log_proxy_new_finish (
18326 GAsyncResult *res,
18327 GError **error)
18328{
18329 GObject *ret;
18330 GObject *source_object;
18331 source_object = g_async_result_get_source_object (res);
18332 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
18333 g_object_unref (source_object);
18334 if (ret != NULL)
18335 return EVENT_LOG (ret);
18336 else
18337 return NULL;
18338}
18339
18340/**
18341 * event_log_proxy_new_sync:
18342 * @connection: A #GDBusConnection.
18343 * @flags: Flags from the #GDBusProxyFlags enumeration.
18344 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
18345 * @object_path: An object path.
18346 * @cancellable: (allow-none): A #GCancellable or %NULL.
18347 * @error: Return location for error or %NULL
18348 *
18349 * 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.
18350 *
18351 * The calling thread is blocked until a reply is received.
18352 *
18353 * See event_log_proxy_new() for the asynchronous version of this constructor.
18354 *
18355 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
18356 */
18357EventLog *
18358event_log_proxy_new_sync (
18359 GDBusConnection *connection,
18360 GDBusProxyFlags flags,
18361 const gchar *name,
18362 const gchar *object_path,
18363 GCancellable *cancellable,
18364 GError **error)
18365{
18366 GInitable *ret;
18367 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);
18368 if (ret != NULL)
18369 return EVENT_LOG (ret);
18370 else
18371 return NULL;
18372}
18373
18374
18375/**
18376 * event_log_proxy_new_for_bus:
18377 * @bus_type: A #GBusType.
18378 * @flags: Flags from the #GDBusProxyFlags enumeration.
18379 * @name: A bus name (well-known or unique).
18380 * @object_path: An object path.
18381 * @cancellable: (allow-none): A #GCancellable or %NULL.
18382 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
18383 * @user_data: User data to pass to @callback.
18384 *
18385 * Like event_log_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
18386 *
18387 * 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.
18388 * You can then call event_log_proxy_new_for_bus_finish() to get the result of the operation.
18389 *
18390 * See event_log_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
18391 */
18392void
18393event_log_proxy_new_for_bus (
18394 GBusType bus_type,
18395 GDBusProxyFlags flags,
18396 const gchar *name,
18397 const gchar *object_path,
18398 GCancellable *cancellable,
18399 GAsyncReadyCallback callback,
18400 gpointer user_data)
18401{
18402 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);
18403}
18404
18405/**
18406 * event_log_proxy_new_for_bus_finish:
18407 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new_for_bus().
18408 * @error: Return location for error or %NULL
18409 *
18410 * Finishes an operation started with event_log_proxy_new_for_bus().
18411 *
18412 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
18413 */
18414EventLog *
18415event_log_proxy_new_for_bus_finish (
18416 GAsyncResult *res,
18417 GError **error)
18418{
18419 GObject *ret;
18420 GObject *source_object;
18421 source_object = g_async_result_get_source_object (res);
18422 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
18423 g_object_unref (source_object);
18424 if (ret != NULL)
18425 return EVENT_LOG (ret);
18426 else
18427 return NULL;
18428}
18429
18430/**
18431 * event_log_proxy_new_for_bus_sync:
18432 * @bus_type: A #GBusType.
18433 * @flags: Flags from the #GDBusProxyFlags enumeration.
18434 * @name: A bus name (well-known or unique).
18435 * @object_path: An object path.
18436 * @cancellable: (allow-none): A #GCancellable or %NULL.
18437 * @error: Return location for error or %NULL
18438 *
18439 * Like event_log_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
18440 *
18441 * The calling thread is blocked until a reply is received.
18442 *
18443 * See event_log_proxy_new_for_bus() for the asynchronous version of this constructor.
18444 *
18445 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
18446 */
18447EventLog *
18448event_log_proxy_new_for_bus_sync (
18449 GBusType bus_type,
18450 GDBusProxyFlags flags,
18451 const gchar *name,
18452 const gchar *object_path,
18453 GCancellable *cancellable,
18454 GError **error)
18455{
18456 GInitable *ret;
18457 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);
18458 if (ret != NULL)
18459 return EVENT_LOG (ret);
18460 else
18461 return NULL;
18462}
18463
18464
18465/* ------------------------------------------------------------------------ */
18466
18467/**
18468 * EventLogSkeleton:
18469 *
18470 * The #EventLogSkeleton structure contains only private data and should only be accessed using the provided API.
18471 */
18472
18473/**
18474 * EventLogSkeletonClass:
18475 * @parent_class: The parent class.
18476 *
18477 * Class structure for #EventLogSkeleton.
18478 */
18479
18480struct _EventLogSkeletonPrivate
18481{
18482 GValue *properties;
18483 GList *changed_properties;
18484 GSource *changed_properties_idle_source;
18485 GMainContext *context;
18486 GMutex lock;
18487};
18488
18489static void
18490_event_log_skeleton_handle_method_call (
18491 GDBusConnection *connection G_GNUC_UNUSED,
18492 const gchar *sender G_GNUC_UNUSED,
18493 const gchar *object_path G_GNUC_UNUSED,
18494 const gchar *interface_name,
18495 const gchar *method_name,
18496 GVariant *parameters,
18497 GDBusMethodInvocation *invocation,
18498 gpointer user_data)
18499{
18500 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
18501 _ExtendedGDBusMethodInfo *info;
18502 GVariantIter iter;
18503 GVariant *child;
18504 GValue *paramv;
18505 guint num_params;
18506 guint num_extra;
18507 guint n;
18508 guint signal_id;
18509 GValue return_value = G_VALUE_INIT;
18510 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
18511 g_assert (info != NULL);
18512 num_params = g_variant_n_children (parameters);
18513 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
18514 n = 0;
18515 g_value_init (&paramv[n], TYPE_EVENT_LOG);
18516 g_value_set_object (&paramv[n++], skeleton);
18517 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
18518 g_value_set_object (&paramv[n++], invocation);
18519 if (info->pass_fdlist)
18520 {
18521#ifdef G_OS_UNIX
18522 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
18523 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
18524#else
18525 g_assert_not_reached ();
18526#endif
18527 }
18528 g_variant_iter_init (&iter, parameters);
18529 while ((child = g_variant_iter_next_value (&iter)) != NULL)
18530 {
18531 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
18532 if (arg_info->use_gvariant)
18533 {
18534 g_value_init (&paramv[n], G_TYPE_VARIANT);
18535 g_value_set_variant (&paramv[n], child);
18536 n++;
18537 }
18538 else
18539 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
18540 g_variant_unref (child);
18541 }
18542 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
18543 g_value_init (&return_value, G_TYPE_BOOLEAN);
18544 g_signal_emitv (paramv, signal_id, 0, &return_value);
18545 if (!g_value_get_boolean (&return_value))
18546 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);
18547 g_value_unset (&return_value);
18548 for (n = 0; n < num_params + num_extra; n++)
18549 g_value_unset (&paramv[n]);
18550 g_free (paramv);
18551}
18552
18553static GVariant *
18554_event_log_skeleton_handle_get_property (
18555 GDBusConnection *connection G_GNUC_UNUSED,
18556 const gchar *sender G_GNUC_UNUSED,
18557 const gchar *object_path G_GNUC_UNUSED,
18558 const gchar *interface_name G_GNUC_UNUSED,
18559 const gchar *property_name,
18560 GError **error,
18561 gpointer user_data)
18562{
18563 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
18564 GValue value = G_VALUE_INIT;
18565 GParamSpec *pspec;
18566 _ExtendedGDBusPropertyInfo *info;
18567 GVariant *ret;
18568 ret = NULL;
18569 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
18570 g_assert (info != NULL);
18571 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
18572 if (pspec == NULL)
18573 {
18574 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
18575 }
18576 else
18577 {
18578 g_value_init (&value, pspec->value_type);
18579 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
18580 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
18581 g_value_unset (&value);
18582 }
18583 return ret;
18584}
18585
18586static gboolean
18587_event_log_skeleton_handle_set_property (
18588 GDBusConnection *connection G_GNUC_UNUSED,
18589 const gchar *sender G_GNUC_UNUSED,
18590 const gchar *object_path G_GNUC_UNUSED,
18591 const gchar *interface_name G_GNUC_UNUSED,
18592 const gchar *property_name,
18593 GVariant *variant,
18594 GError **error,
18595 gpointer user_data)
18596{
18597 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
18598 GValue value = G_VALUE_INIT;
18599 GParamSpec *pspec;
18600 _ExtendedGDBusPropertyInfo *info;
18601 gboolean ret;
18602 ret = FALSE;
18603 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
18604 g_assert (info != NULL);
18605 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
18606 if (pspec == NULL)
18607 {
18608 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
18609 }
18610 else
18611 {
18612 if (info->use_gvariant)
18613 g_value_set_variant (&value, variant);
18614 else
18615 g_dbus_gvariant_to_gvalue (variant, &value);
18616 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
18617 g_value_unset (&value);
18618 ret = TRUE;
18619 }
18620 return ret;
18621}
18622
18623static const GDBusInterfaceVTable _event_log_skeleton_vtable =
18624{
18625 _event_log_skeleton_handle_method_call,
18626 _event_log_skeleton_handle_get_property,
18627 _event_log_skeleton_handle_set_property,
18628 {NULL}
18629};
18630
18631static GDBusInterfaceInfo *
18632event_log_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
18633{
18634 return event_log_interface_info ();
18635}
18636
18637static GDBusInterfaceVTable *
18638event_log_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
18639{
18640 return (GDBusInterfaceVTable *) &_event_log_skeleton_vtable;
18641}
18642
18643static GVariant *
18644event_log_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
18645{
18646 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (_skeleton);
18647
18648 GVariantBuilder builder;
18649 guint n;
18650 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
18651 if (_event_log_interface_info.parent_struct.properties == NULL)
18652 goto out;
18653 for (n = 0; _event_log_interface_info.parent_struct.properties[n] != NULL; n++)
18654 {
18655 GDBusPropertyInfo *info = _event_log_interface_info.parent_struct.properties[n];
18656 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
18657 {
18658 GVariant *value;
18659 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);
18660 if (value != NULL)
18661 {
18662 g_variant_take_ref (value);
18663 g_variant_builder_add (&builder, "{sv}", info->name, value);
18664 g_variant_unref (value);
18665 }
18666 }
18667 }
18668out:
18669 return g_variant_builder_end (&builder);
18670}
18671
Norman James362a80f2015-09-14 14:04:39 -050018672static void
18673event_log_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
18674{
Norman James362a80f2015-09-14 14:04:39 -050018675}
18676
18677static void
18678_event_log_on_signal_event_log (
18679 EventLog *object,
Norman James8abb50c2015-09-16 10:58:16 -050018680 gint arg_priority,
Norman James88872672015-09-21 16:51:35 -050018681 const gchar *arg_message,
18682 gint arg_rc)
Norman James362a80f2015-09-14 14:04:39 -050018683{
18684 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
18685
18686 GList *connections, *l;
18687 GVariant *signal_variant;
18688 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
18689
Norman James88872672015-09-21 16:51:35 -050018690 signal_variant = g_variant_ref_sink (g_variant_new ("(isi)",
Norman James8abb50c2015-09-16 10:58:16 -050018691 arg_priority,
Norman James88872672015-09-21 16:51:35 -050018692 arg_message,
18693 arg_rc));
Norman James362a80f2015-09-14 14:04:39 -050018694 for (l = connections; l != NULL; l = l->next)
18695 {
18696 GDBusConnection *connection = l->data;
18697 g_dbus_connection_emit_signal (connection,
18698 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.EventLog", "EventLog",
18699 signal_variant, NULL);
18700 }
18701 g_variant_unref (signal_variant);
18702 g_list_free_full (connections, g_object_unref);
18703}
18704
18705static void event_log_skeleton_iface_init (EventLogIface *iface);
18706#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18707G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
18708 G_ADD_PRIVATE (EventLogSkeleton)
18709 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
18710
18711#else
18712G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
18713 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
18714
18715#endif
18716static void
18717event_log_skeleton_finalize (GObject *object)
18718{
18719 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
Norman James362a80f2015-09-14 14:04:39 -050018720 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
18721 if (skeleton->priv->changed_properties_idle_source != NULL)
18722 g_source_destroy (skeleton->priv->changed_properties_idle_source);
18723 g_main_context_unref (skeleton->priv->context);
18724 g_mutex_clear (&skeleton->priv->lock);
18725 G_OBJECT_CLASS (event_log_skeleton_parent_class)->finalize (object);
18726}
18727
18728static void
Norman James362a80f2015-09-14 14:04:39 -050018729event_log_skeleton_init (EventLogSkeleton *skeleton)
18730{
18731#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18732 skeleton->priv = event_log_skeleton_get_instance_private (skeleton);
18733#else
18734 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_EVENT_LOG_SKELETON, EventLogSkeletonPrivate);
18735#endif
18736
18737 g_mutex_init (&skeleton->priv->lock);
18738 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James362a80f2015-09-14 14:04:39 -050018739}
18740
18741static void
18742event_log_skeleton_class_init (EventLogSkeletonClass *klass)
18743{
18744 GObjectClass *gobject_class;
18745 GDBusInterfaceSkeletonClass *skeleton_class;
18746
18747 gobject_class = G_OBJECT_CLASS (klass);
18748 gobject_class->finalize = event_log_skeleton_finalize;
Norman James362a80f2015-09-14 14:04:39 -050018749
18750 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
18751 skeleton_class->get_info = event_log_skeleton_dbus_interface_get_info;
18752 skeleton_class->get_properties = event_log_skeleton_dbus_interface_get_properties;
18753 skeleton_class->flush = event_log_skeleton_dbus_interface_flush;
18754 skeleton_class->get_vtable = event_log_skeleton_dbus_interface_get_vtable;
18755
18756#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
18757 g_type_class_add_private (klass, sizeof (EventLogSkeletonPrivate));
18758#endif
18759}
18760
18761static void
18762event_log_skeleton_iface_init (EventLogIface *iface)
18763{
18764 iface->event_log = _event_log_on_signal_event_log;
Norman James362a80f2015-09-14 14:04:39 -050018765}
18766
18767/**
18768 * event_log_skeleton_new:
18769 *
18770 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
18771 *
18772 * Returns: (transfer full) (type EventLogSkeleton): The skeleton object.
18773 */
18774EventLog *
18775event_log_skeleton_new (void)
18776{
18777 return EVENT_LOG (g_object_new (TYPE_EVENT_LOG_SKELETON, NULL));
18778}
18779
18780/* ------------------------------------------------------------------------
18781 * Code for interface org.openbmc.Flash
18782 * ------------------------------------------------------------------------
18783 */
18784
18785/**
18786 * SECTION:Flash
18787 * @title: Flash
18788 * @short_description: Generated C code for the org.openbmc.Flash D-Bus interface
18789 *
18790 * 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.
18791 */
18792
18793/* ---- Introspection data for org.openbmc.Flash ---- */
18794
18795static const _ExtendedGDBusArgInfo _flash_method_info_update_via_file_IN_ARG_file =
18796{
18797 {
18798 -1,
18799 (gchar *) "file",
18800 (gchar *) "s",
18801 NULL
18802 },
18803 FALSE
18804};
18805
18806static const _ExtendedGDBusArgInfo * const _flash_method_info_update_via_file_IN_ARG_pointers[] =
18807{
18808 &_flash_method_info_update_via_file_IN_ARG_file,
18809 NULL
18810};
18811
18812static const _ExtendedGDBusMethodInfo _flash_method_info_update_via_file =
18813{
18814 {
18815 -1,
18816 (gchar *) "updateViaFile",
18817 (GDBusArgInfo **) &_flash_method_info_update_via_file_IN_ARG_pointers,
18818 NULL,
18819 NULL
18820 },
18821 "handle-update-via-file",
18822 FALSE
18823};
18824
18825static const _ExtendedGDBusArgInfo _flash_method_info_update_via_http_IN_ARG_url =
18826{
18827 {
18828 -1,
18829 (gchar *) "url",
18830 (gchar *) "s",
18831 NULL
18832 },
18833 FALSE
18834};
18835
18836static const _ExtendedGDBusArgInfo * const _flash_method_info_update_via_http_IN_ARG_pointers[] =
18837{
18838 &_flash_method_info_update_via_http_IN_ARG_url,
18839 NULL
18840};
18841
18842static const _ExtendedGDBusMethodInfo _flash_method_info_update_via_http =
18843{
18844 {
18845 -1,
18846 (gchar *) "updateViaHttp",
18847 (GDBusArgInfo **) &_flash_method_info_update_via_http_IN_ARG_pointers,
18848 NULL,
18849 NULL
18850 },
18851 "handle-update-via-http",
18852 FALSE
18853};
18854
18855static const _ExtendedGDBusMethodInfo _flash_method_info_erase =
18856{
18857 {
18858 -1,
18859 (gchar *) "erase",
18860 NULL,
18861 NULL,
18862 NULL
18863 },
18864 "handle-erase",
18865 FALSE
18866};
18867
18868static const _ExtendedGDBusMethodInfo _flash_method_info_init =
18869{
18870 {
18871 -1,
18872 (gchar *) "init",
18873 NULL,
18874 NULL,
18875 NULL
18876 },
18877 "handle-init",
18878 FALSE
18879};
18880
18881static const _ExtendedGDBusMethodInfo * const _flash_method_info_pointers[] =
18882{
18883 &_flash_method_info_update_via_file,
18884 &_flash_method_info_update_via_http,
18885 &_flash_method_info_erase,
18886 &_flash_method_info_init,
18887 NULL
18888};
18889
18890static const _ExtendedGDBusSignalInfo _flash_signal_info_updated =
18891{
18892 {
18893 -1,
18894 (gchar *) "Updated",
18895 NULL,
18896 NULL
18897 },
18898 "updated"
18899};
18900
18901static const _ExtendedGDBusSignalInfo * const _flash_signal_info_pointers[] =
18902{
18903 &_flash_signal_info_updated,
18904 NULL
18905};
18906
18907static const _ExtendedGDBusInterfaceInfo _flash_interface_info =
18908{
18909 {
18910 -1,
18911 (gchar *) "org.openbmc.Flash",
18912 (GDBusMethodInfo **) &_flash_method_info_pointers,
18913 (GDBusSignalInfo **) &_flash_signal_info_pointers,
18914 NULL,
18915 NULL
18916 },
18917 "flash",
18918};
18919
18920
18921/**
18922 * flash_interface_info:
18923 *
18924 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> D-Bus interface.
18925 *
18926 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
18927 */
18928GDBusInterfaceInfo *
18929flash_interface_info (void)
18930{
18931 return (GDBusInterfaceInfo *) &_flash_interface_info.parent_struct;
18932}
18933
18934/**
18935 * flash_override_properties:
18936 * @klass: The class structure for a #GObject<!-- -->-derived class.
18937 * @property_id_begin: The property id to assign to the first overridden property.
18938 *
18939 * Overrides all #GObject properties in the #Flash interface for a concrete class.
18940 * The properties are overridden in the order they are defined.
18941 *
18942 * Returns: The last property id.
18943 */
18944guint
18945flash_override_properties (GObjectClass *klass, guint property_id_begin)
18946{
18947 return property_id_begin - 1;
18948}
18949
18950
18951
18952/**
18953 * Flash:
18954 *
18955 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
18956 */
18957
18958/**
18959 * FlashIface:
18960 * @parent_iface: The parent interface.
18961 * @handle_erase: Handler for the #Flash::handle-erase signal.
18962 * @handle_init: Handler for the #Flash::handle-init signal.
18963 * @handle_update_via_file: Handler for the #Flash::handle-update-via-file signal.
18964 * @handle_update_via_http: Handler for the #Flash::handle-update-via-http signal.
18965 * @updated: Handler for the #Flash::updated signal.
18966 *
18967 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
18968 */
18969
18970typedef FlashIface FlashInterface;
18971G_DEFINE_INTERFACE (Flash, flash, G_TYPE_OBJECT);
18972
18973static void
18974flash_default_init (FlashIface *iface)
18975{
18976 /* GObject signals for incoming D-Bus method calls: */
18977 /**
18978 * Flash::handle-update-via-file:
18979 * @object: A #Flash.
18980 * @invocation: A #GDBusMethodInvocation.
18981 * @arg_file: Argument passed by remote caller.
18982 *
18983 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.updateViaFile">updateViaFile()</link> D-Bus method.
18984 *
18985 * 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.
18986 *
18987 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
18988 */
18989 g_signal_new ("handle-update-via-file",
18990 G_TYPE_FROM_INTERFACE (iface),
18991 G_SIGNAL_RUN_LAST,
18992 G_STRUCT_OFFSET (FlashIface, handle_update_via_file),
18993 g_signal_accumulator_true_handled,
18994 NULL,
18995 g_cclosure_marshal_generic,
18996 G_TYPE_BOOLEAN,
18997 2,
18998 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
18999
19000 /**
19001 * Flash::handle-update-via-http:
19002 * @object: A #Flash.
19003 * @invocation: A #GDBusMethodInvocation.
19004 * @arg_url: Argument passed by remote caller.
19005 *
19006 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.updateViaHttp">updateViaHttp()</link> D-Bus method.
19007 *
19008 * 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.
19009 *
19010 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
19011 */
19012 g_signal_new ("handle-update-via-http",
19013 G_TYPE_FROM_INTERFACE (iface),
19014 G_SIGNAL_RUN_LAST,
19015 G_STRUCT_OFFSET (FlashIface, handle_update_via_http),
19016 g_signal_accumulator_true_handled,
19017 NULL,
19018 g_cclosure_marshal_generic,
19019 G_TYPE_BOOLEAN,
19020 2,
19021 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
19022
19023 /**
19024 * Flash::handle-erase:
19025 * @object: A #Flash.
19026 * @invocation: A #GDBusMethodInvocation.
19027 *
19028 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.erase">erase()</link> D-Bus method.
19029 *
19030 * 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.
19031 *
19032 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
19033 */
19034 g_signal_new ("handle-erase",
19035 G_TYPE_FROM_INTERFACE (iface),
19036 G_SIGNAL_RUN_LAST,
19037 G_STRUCT_OFFSET (FlashIface, handle_erase),
19038 g_signal_accumulator_true_handled,
19039 NULL,
19040 g_cclosure_marshal_generic,
19041 G_TYPE_BOOLEAN,
19042 1,
19043 G_TYPE_DBUS_METHOD_INVOCATION);
19044
19045 /**
19046 * Flash::handle-init:
19047 * @object: A #Flash.
19048 * @invocation: A #GDBusMethodInvocation.
19049 *
19050 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method.
19051 *
19052 * 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.
19053 *
19054 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
19055 */
19056 g_signal_new ("handle-init",
19057 G_TYPE_FROM_INTERFACE (iface),
19058 G_SIGNAL_RUN_LAST,
19059 G_STRUCT_OFFSET (FlashIface, handle_init),
19060 g_signal_accumulator_true_handled,
19061 NULL,
19062 g_cclosure_marshal_generic,
19063 G_TYPE_BOOLEAN,
19064 1,
19065 G_TYPE_DBUS_METHOD_INVOCATION);
19066
19067 /* GObject signals for received D-Bus signals: */
19068 /**
19069 * Flash::updated:
19070 * @object: A #Flash.
19071 *
19072 * 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.
19073 *
19074 * 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.
19075 */
19076 g_signal_new ("updated",
19077 G_TYPE_FROM_INTERFACE (iface),
19078 G_SIGNAL_RUN_LAST,
19079 G_STRUCT_OFFSET (FlashIface, updated),
19080 NULL,
19081 NULL,
19082 g_cclosure_marshal_generic,
19083 G_TYPE_NONE,
19084 0);
19085
19086}
19087
19088/**
19089 * flash_emit_updated:
19090 * @object: A #Flash.
19091 *
19092 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Updated">"Updated"</link> D-Bus signal.
19093 */
19094void
19095flash_emit_updated (
19096 Flash *object)
19097{
19098 g_signal_emit_by_name (object, "updated");
19099}
19100
19101/**
19102 * flash_call_update_via_file:
19103 * @proxy: A #FlashProxy.
19104 * @arg_file: Argument to pass with the method invocation.
19105 * @cancellable: (allow-none): A #GCancellable or %NULL.
19106 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19107 * @user_data: User data to pass to @callback.
19108 *
19109 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaFile">updateViaFile()</link> D-Bus method on @proxy.
19110 * 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.
19111 * You can then call flash_call_update_via_file_finish() to get the result of the operation.
19112 *
19113 * See flash_call_update_via_file_sync() for the synchronous, blocking version of this method.
19114 */
19115void
19116flash_call_update_via_file (
19117 Flash *proxy,
19118 const gchar *arg_file,
19119 GCancellable *cancellable,
19120 GAsyncReadyCallback callback,
19121 gpointer user_data)
19122{
19123 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19124 "updateViaFile",
19125 g_variant_new ("(s)",
19126 arg_file),
19127 G_DBUS_CALL_FLAGS_NONE,
19128 -1,
19129 cancellable,
19130 callback,
19131 user_data);
19132}
19133
19134/**
19135 * flash_call_update_via_file_finish:
19136 * @proxy: A #FlashProxy.
19137 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update_via_file().
19138 * @error: Return location for error or %NULL.
19139 *
19140 * Finishes an operation started with flash_call_update_via_file().
19141 *
19142 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19143 */
19144gboolean
19145flash_call_update_via_file_finish (
19146 Flash *proxy,
19147 GAsyncResult *res,
19148 GError **error)
19149{
19150 GVariant *_ret;
19151 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19152 if (_ret == NULL)
19153 goto _out;
19154 g_variant_get (_ret,
19155 "()");
19156 g_variant_unref (_ret);
19157_out:
19158 return _ret != NULL;
19159}
19160
19161/**
19162 * flash_call_update_via_file_sync:
19163 * @proxy: A #FlashProxy.
19164 * @arg_file: Argument to pass with the method invocation.
19165 * @cancellable: (allow-none): A #GCancellable or %NULL.
19166 * @error: Return location for error or %NULL.
19167 *
19168 * 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.
19169 *
19170 * See flash_call_update_via_file() for the asynchronous version of this method.
19171 *
19172 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19173 */
19174gboolean
19175flash_call_update_via_file_sync (
19176 Flash *proxy,
19177 const gchar *arg_file,
19178 GCancellable *cancellable,
19179 GError **error)
19180{
19181 GVariant *_ret;
19182 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19183 "updateViaFile",
19184 g_variant_new ("(s)",
19185 arg_file),
19186 G_DBUS_CALL_FLAGS_NONE,
19187 -1,
19188 cancellable,
19189 error);
19190 if (_ret == NULL)
19191 goto _out;
19192 g_variant_get (_ret,
19193 "()");
19194 g_variant_unref (_ret);
19195_out:
19196 return _ret != NULL;
19197}
19198
19199/**
19200 * flash_call_update_via_http:
19201 * @proxy: A #FlashProxy.
19202 * @arg_url: Argument to pass with the method invocation.
19203 * @cancellable: (allow-none): A #GCancellable or %NULL.
19204 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19205 * @user_data: User data to pass to @callback.
19206 *
19207 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaHttp">updateViaHttp()</link> D-Bus method on @proxy.
19208 * 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.
19209 * You can then call flash_call_update_via_http_finish() to get the result of the operation.
19210 *
19211 * See flash_call_update_via_http_sync() for the synchronous, blocking version of this method.
19212 */
19213void
19214flash_call_update_via_http (
19215 Flash *proxy,
19216 const gchar *arg_url,
19217 GCancellable *cancellable,
19218 GAsyncReadyCallback callback,
19219 gpointer user_data)
19220{
19221 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19222 "updateViaHttp",
19223 g_variant_new ("(s)",
19224 arg_url),
19225 G_DBUS_CALL_FLAGS_NONE,
19226 -1,
19227 cancellable,
19228 callback,
19229 user_data);
19230}
19231
19232/**
19233 * flash_call_update_via_http_finish:
19234 * @proxy: A #FlashProxy.
19235 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update_via_http().
19236 * @error: Return location for error or %NULL.
19237 *
19238 * Finishes an operation started with flash_call_update_via_http().
19239 *
19240 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19241 */
19242gboolean
19243flash_call_update_via_http_finish (
19244 Flash *proxy,
19245 GAsyncResult *res,
19246 GError **error)
19247{
19248 GVariant *_ret;
19249 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19250 if (_ret == NULL)
19251 goto _out;
19252 g_variant_get (_ret,
19253 "()");
19254 g_variant_unref (_ret);
19255_out:
19256 return _ret != NULL;
19257}
19258
19259/**
19260 * flash_call_update_via_http_sync:
19261 * @proxy: A #FlashProxy.
19262 * @arg_url: Argument to pass with the method invocation.
19263 * @cancellable: (allow-none): A #GCancellable or %NULL.
19264 * @error: Return location for error or %NULL.
19265 *
19266 * 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.
19267 *
19268 * See flash_call_update_via_http() for the asynchronous version of this method.
19269 *
19270 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19271 */
19272gboolean
19273flash_call_update_via_http_sync (
19274 Flash *proxy,
19275 const gchar *arg_url,
19276 GCancellable *cancellable,
19277 GError **error)
19278{
19279 GVariant *_ret;
19280 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19281 "updateViaHttp",
19282 g_variant_new ("(s)",
19283 arg_url),
19284 G_DBUS_CALL_FLAGS_NONE,
19285 -1,
19286 cancellable,
19287 error);
19288 if (_ret == NULL)
19289 goto _out;
19290 g_variant_get (_ret,
19291 "()");
19292 g_variant_unref (_ret);
19293_out:
19294 return _ret != NULL;
19295}
19296
19297/**
19298 * flash_call_erase:
19299 * @proxy: A #FlashProxy.
19300 * @cancellable: (allow-none): A #GCancellable or %NULL.
19301 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19302 * @user_data: User data to pass to @callback.
19303 *
19304 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.erase">erase()</link> D-Bus method on @proxy.
19305 * 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.
19306 * You can then call flash_call_erase_finish() to get the result of the operation.
19307 *
19308 * See flash_call_erase_sync() for the synchronous, blocking version of this method.
19309 */
19310void
19311flash_call_erase (
19312 Flash *proxy,
19313 GCancellable *cancellable,
19314 GAsyncReadyCallback callback,
19315 gpointer user_data)
19316{
19317 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19318 "erase",
19319 g_variant_new ("()"),
19320 G_DBUS_CALL_FLAGS_NONE,
19321 -1,
19322 cancellable,
19323 callback,
19324 user_data);
19325}
19326
19327/**
19328 * flash_call_erase_finish:
19329 * @proxy: A #FlashProxy.
19330 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_erase().
19331 * @error: Return location for error or %NULL.
19332 *
19333 * Finishes an operation started with flash_call_erase().
19334 *
19335 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19336 */
19337gboolean
19338flash_call_erase_finish (
19339 Flash *proxy,
19340 GAsyncResult *res,
19341 GError **error)
19342{
19343 GVariant *_ret;
19344 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19345 if (_ret == NULL)
19346 goto _out;
19347 g_variant_get (_ret,
19348 "()");
19349 g_variant_unref (_ret);
19350_out:
19351 return _ret != NULL;
19352}
19353
19354/**
19355 * flash_call_erase_sync:
19356 * @proxy: A #FlashProxy.
19357 * @cancellable: (allow-none): A #GCancellable or %NULL.
19358 * @error: Return location for error or %NULL.
19359 *
19360 * 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.
19361 *
19362 * See flash_call_erase() for the asynchronous version of this method.
19363 *
19364 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19365 */
19366gboolean
19367flash_call_erase_sync (
19368 Flash *proxy,
19369 GCancellable *cancellable,
19370 GError **error)
19371{
19372 GVariant *_ret;
19373 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19374 "erase",
19375 g_variant_new ("()"),
19376 G_DBUS_CALL_FLAGS_NONE,
19377 -1,
19378 cancellable,
19379 error);
19380 if (_ret == NULL)
19381 goto _out;
19382 g_variant_get (_ret,
19383 "()");
19384 g_variant_unref (_ret);
19385_out:
19386 return _ret != NULL;
19387}
19388
19389/**
19390 * flash_call_init:
19391 * @proxy: A #FlashProxy.
19392 * @cancellable: (allow-none): A #GCancellable or %NULL.
19393 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19394 * @user_data: User data to pass to @callback.
19395 *
19396 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method on @proxy.
19397 * 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.
19398 * You can then call flash_call_init_finish() to get the result of the operation.
19399 *
19400 * See flash_call_init_sync() for the synchronous, blocking version of this method.
19401 */
19402void
19403flash_call_init (
19404 Flash *proxy,
19405 GCancellable *cancellable,
19406 GAsyncReadyCallback callback,
19407 gpointer user_data)
19408{
19409 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19410 "init",
19411 g_variant_new ("()"),
19412 G_DBUS_CALL_FLAGS_NONE,
19413 -1,
19414 cancellable,
19415 callback,
19416 user_data);
19417}
19418
19419/**
19420 * flash_call_init_finish:
19421 * @proxy: A #FlashProxy.
19422 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_init().
19423 * @error: Return location for error or %NULL.
19424 *
19425 * Finishes an operation started with flash_call_init().
19426 *
19427 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19428 */
19429gboolean
19430flash_call_init_finish (
19431 Flash *proxy,
19432 GAsyncResult *res,
19433 GError **error)
19434{
19435 GVariant *_ret;
19436 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19437 if (_ret == NULL)
19438 goto _out;
19439 g_variant_get (_ret,
19440 "()");
19441 g_variant_unref (_ret);
19442_out:
19443 return _ret != NULL;
19444}
19445
19446/**
19447 * flash_call_init_sync:
19448 * @proxy: A #FlashProxy.
19449 * @cancellable: (allow-none): A #GCancellable or %NULL.
19450 * @error: Return location for error or %NULL.
19451 *
19452 * 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.
19453 *
19454 * See flash_call_init() for the asynchronous version of this method.
19455 *
19456 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19457 */
19458gboolean
19459flash_call_init_sync (
19460 Flash *proxy,
19461 GCancellable *cancellable,
19462 GError **error)
19463{
19464 GVariant *_ret;
19465 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19466 "init",
19467 g_variant_new ("()"),
19468 G_DBUS_CALL_FLAGS_NONE,
19469 -1,
19470 cancellable,
19471 error);
19472 if (_ret == NULL)
19473 goto _out;
19474 g_variant_get (_ret,
19475 "()");
19476 g_variant_unref (_ret);
19477_out:
19478 return _ret != NULL;
19479}
19480
19481/**
19482 * flash_complete_update_via_file:
19483 * @object: A #Flash.
19484 * @invocation: (transfer full): A #GDBusMethodInvocation.
19485 *
19486 * 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.
19487 *
19488 * This method will free @invocation, you cannot use it afterwards.
19489 */
19490void
19491flash_complete_update_via_file (
19492 Flash *object,
19493 GDBusMethodInvocation *invocation)
19494{
19495 g_dbus_method_invocation_return_value (invocation,
19496 g_variant_new ("()"));
19497}
19498
19499/**
19500 * flash_complete_update_via_http:
19501 * @object: A #Flash.
19502 * @invocation: (transfer full): A #GDBusMethodInvocation.
19503 *
19504 * 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.
19505 *
19506 * This method will free @invocation, you cannot use it afterwards.
19507 */
19508void
19509flash_complete_update_via_http (
19510 Flash *object,
19511 GDBusMethodInvocation *invocation)
19512{
19513 g_dbus_method_invocation_return_value (invocation,
19514 g_variant_new ("()"));
19515}
19516
19517/**
19518 * flash_complete_erase:
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.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.
19523 *
19524 * This method will free @invocation, you cannot use it afterwards.
19525 */
19526void
19527flash_complete_erase (
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_init:
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.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.
19541 *
19542 * This method will free @invocation, you cannot use it afterwards.
19543 */
19544void
19545flash_complete_init (
19546 Flash *object,
19547 GDBusMethodInvocation *invocation)
19548{
19549 g_dbus_method_invocation_return_value (invocation,
19550 g_variant_new ("()"));
19551}
19552
19553/* ------------------------------------------------------------------------ */
19554
19555/**
19556 * FlashProxy:
19557 *
19558 * The #FlashProxy structure contains only private data and should only be accessed using the provided API.
19559 */
19560
19561/**
19562 * FlashProxyClass:
19563 * @parent_class: The parent class.
19564 *
19565 * Class structure for #FlashProxy.
19566 */
19567
19568struct _FlashProxyPrivate
19569{
19570 GData *qdata;
19571};
19572
19573static void flash_proxy_iface_init (FlashIface *iface);
19574
19575#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19576G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
19577 G_ADD_PRIVATE (FlashProxy)
19578 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
19579
19580#else
19581G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
19582 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
19583
19584#endif
19585static void
19586flash_proxy_finalize (GObject *object)
19587{
19588 FlashProxy *proxy = FLASH_PROXY (object);
19589 g_datalist_clear (&proxy->priv->qdata);
19590 G_OBJECT_CLASS (flash_proxy_parent_class)->finalize (object);
19591}
19592
19593static void
19594flash_proxy_get_property (GObject *object,
19595 guint prop_id,
19596 GValue *value,
19597 GParamSpec *pspec G_GNUC_UNUSED)
19598{
19599}
19600
19601static void
19602flash_proxy_set_property (GObject *object,
19603 guint prop_id,
19604 const GValue *value,
19605 GParamSpec *pspec G_GNUC_UNUSED)
19606{
19607}
19608
19609static void
19610flash_proxy_g_signal (GDBusProxy *proxy,
19611 const gchar *sender_name G_GNUC_UNUSED,
19612 const gchar *signal_name,
19613 GVariant *parameters)
19614{
19615 _ExtendedGDBusSignalInfo *info;
19616 GVariantIter iter;
19617 GVariant *child;
19618 GValue *paramv;
19619 guint num_params;
19620 guint n;
19621 guint signal_id;
19622 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, signal_name);
19623 if (info == NULL)
19624 return;
19625 num_params = g_variant_n_children (parameters);
19626 paramv = g_new0 (GValue, num_params + 1);
19627 g_value_init (&paramv[0], TYPE_FLASH);
19628 g_value_set_object (&paramv[0], proxy);
19629 g_variant_iter_init (&iter, parameters);
19630 n = 1;
19631 while ((child = g_variant_iter_next_value (&iter)) != NULL)
19632 {
19633 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
19634 if (arg_info->use_gvariant)
19635 {
19636 g_value_init (&paramv[n], G_TYPE_VARIANT);
19637 g_value_set_variant (&paramv[n], child);
19638 n++;
19639 }
19640 else
19641 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
19642 g_variant_unref (child);
19643 }
19644 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
19645 g_signal_emitv (paramv, signal_id, 0, NULL);
19646 for (n = 0; n < num_params + 1; n++)
19647 g_value_unset (&paramv[n]);
19648 g_free (paramv);
19649}
19650
19651static void
19652flash_proxy_g_properties_changed (GDBusProxy *_proxy,
19653 GVariant *changed_properties,
19654 const gchar *const *invalidated_properties)
19655{
19656 FlashProxy *proxy = FLASH_PROXY (_proxy);
19657 guint n;
19658 const gchar *key;
19659 GVariantIter *iter;
19660 _ExtendedGDBusPropertyInfo *info;
19661 g_variant_get (changed_properties, "a{sv}", &iter);
19662 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
19663 {
19664 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, key);
19665 g_datalist_remove_data (&proxy->priv->qdata, key);
19666 if (info != NULL)
19667 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
19668 }
19669 g_variant_iter_free (iter);
19670 for (n = 0; invalidated_properties[n] != NULL; n++)
19671 {
19672 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, invalidated_properties[n]);
19673 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
19674 if (info != NULL)
19675 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
19676 }
19677}
19678
19679static void
19680flash_proxy_init (FlashProxy *proxy)
19681{
19682#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19683 proxy->priv = flash_proxy_get_instance_private (proxy);
19684#else
19685 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_PROXY, FlashProxyPrivate);
19686#endif
19687
19688 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_interface_info ());
19689}
19690
19691static void
19692flash_proxy_class_init (FlashProxyClass *klass)
19693{
19694 GObjectClass *gobject_class;
19695 GDBusProxyClass *proxy_class;
19696
19697 gobject_class = G_OBJECT_CLASS (klass);
19698 gobject_class->finalize = flash_proxy_finalize;
19699 gobject_class->get_property = flash_proxy_get_property;
19700 gobject_class->set_property = flash_proxy_set_property;
19701
19702 proxy_class = G_DBUS_PROXY_CLASS (klass);
19703 proxy_class->g_signal = flash_proxy_g_signal;
19704 proxy_class->g_properties_changed = flash_proxy_g_properties_changed;
19705
19706#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
19707 g_type_class_add_private (klass, sizeof (FlashProxyPrivate));
19708#endif
19709}
19710
19711static void
19712flash_proxy_iface_init (FlashIface *iface)
19713{
19714}
19715
19716/**
19717 * flash_proxy_new:
19718 * @connection: A #GDBusConnection.
19719 * @flags: Flags from the #GDBusProxyFlags enumeration.
19720 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
19721 * @object_path: An object path.
19722 * @cancellable: (allow-none): A #GCancellable or %NULL.
19723 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
19724 * @user_data: User data to pass to @callback.
19725 *
19726 * 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.
19727 *
19728 * 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.
19729 * You can then call flash_proxy_new_finish() to get the result of the operation.
19730 *
19731 * See flash_proxy_new_sync() for the synchronous, blocking version of this constructor.
19732 */
19733void
19734flash_proxy_new (
19735 GDBusConnection *connection,
19736 GDBusProxyFlags flags,
19737 const gchar *name,
19738 const gchar *object_path,
19739 GCancellable *cancellable,
19740 GAsyncReadyCallback callback,
19741 gpointer user_data)
19742{
19743 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);
19744}
19745
19746/**
19747 * flash_proxy_new_finish:
19748 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new().
19749 * @error: Return location for error or %NULL
19750 *
19751 * Finishes an operation started with flash_proxy_new().
19752 *
19753 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
19754 */
19755Flash *
19756flash_proxy_new_finish (
19757 GAsyncResult *res,
19758 GError **error)
19759{
19760 GObject *ret;
19761 GObject *source_object;
19762 source_object = g_async_result_get_source_object (res);
19763 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
19764 g_object_unref (source_object);
19765 if (ret != NULL)
19766 return FLASH (ret);
19767 else
19768 return NULL;
19769}
19770
19771/**
19772 * flash_proxy_new_sync:
19773 * @connection: A #GDBusConnection.
19774 * @flags: Flags from the #GDBusProxyFlags enumeration.
19775 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
19776 * @object_path: An object path.
19777 * @cancellable: (allow-none): A #GCancellable or %NULL.
19778 * @error: Return location for error or %NULL
19779 *
19780 * 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.
19781 *
19782 * The calling thread is blocked until a reply is received.
19783 *
19784 * See flash_proxy_new() for the asynchronous version of this constructor.
19785 *
19786 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
19787 */
19788Flash *
19789flash_proxy_new_sync (
19790 GDBusConnection *connection,
19791 GDBusProxyFlags flags,
19792 const gchar *name,
19793 const gchar *object_path,
19794 GCancellable *cancellable,
19795 GError **error)
19796{
19797 GInitable *ret;
19798 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);
19799 if (ret != NULL)
19800 return FLASH (ret);
19801 else
19802 return NULL;
19803}
19804
19805
19806/**
19807 * flash_proxy_new_for_bus:
19808 * @bus_type: A #GBusType.
19809 * @flags: Flags from the #GDBusProxyFlags enumeration.
19810 * @name: A bus name (well-known or unique).
19811 * @object_path: An object path.
19812 * @cancellable: (allow-none): A #GCancellable or %NULL.
19813 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
19814 * @user_data: User data to pass to @callback.
19815 *
19816 * Like flash_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
19817 *
19818 * 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.
19819 * You can then call flash_proxy_new_for_bus_finish() to get the result of the operation.
19820 *
19821 * See flash_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
19822 */
19823void
19824flash_proxy_new_for_bus (
19825 GBusType bus_type,
19826 GDBusProxyFlags flags,
19827 const gchar *name,
19828 const gchar *object_path,
19829 GCancellable *cancellable,
19830 GAsyncReadyCallback callback,
19831 gpointer user_data)
19832{
19833 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);
19834}
19835
19836/**
19837 * flash_proxy_new_for_bus_finish:
19838 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new_for_bus().
19839 * @error: Return location for error or %NULL
19840 *
19841 * Finishes an operation started with flash_proxy_new_for_bus().
19842 *
19843 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
19844 */
19845Flash *
19846flash_proxy_new_for_bus_finish (
19847 GAsyncResult *res,
19848 GError **error)
19849{
19850 GObject *ret;
19851 GObject *source_object;
19852 source_object = g_async_result_get_source_object (res);
19853 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
19854 g_object_unref (source_object);
19855 if (ret != NULL)
19856 return FLASH (ret);
19857 else
19858 return NULL;
19859}
19860
19861/**
19862 * flash_proxy_new_for_bus_sync:
19863 * @bus_type: A #GBusType.
19864 * @flags: Flags from the #GDBusProxyFlags enumeration.
19865 * @name: A bus name (well-known or unique).
19866 * @object_path: An object path.
19867 * @cancellable: (allow-none): A #GCancellable or %NULL.
19868 * @error: Return location for error or %NULL
19869 *
19870 * Like flash_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
19871 *
19872 * The calling thread is blocked until a reply is received.
19873 *
19874 * See flash_proxy_new_for_bus() for the asynchronous version of this constructor.
19875 *
19876 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
19877 */
19878Flash *
19879flash_proxy_new_for_bus_sync (
19880 GBusType bus_type,
19881 GDBusProxyFlags flags,
19882 const gchar *name,
19883 const gchar *object_path,
19884 GCancellable *cancellable,
19885 GError **error)
19886{
19887 GInitable *ret;
19888 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);
19889 if (ret != NULL)
19890 return FLASH (ret);
19891 else
19892 return NULL;
19893}
19894
19895
19896/* ------------------------------------------------------------------------ */
19897
19898/**
19899 * FlashSkeleton:
19900 *
19901 * The #FlashSkeleton structure contains only private data and should only be accessed using the provided API.
19902 */
19903
19904/**
19905 * FlashSkeletonClass:
19906 * @parent_class: The parent class.
19907 *
19908 * Class structure for #FlashSkeleton.
19909 */
19910
19911struct _FlashSkeletonPrivate
19912{
19913 GValue *properties;
19914 GList *changed_properties;
19915 GSource *changed_properties_idle_source;
19916 GMainContext *context;
19917 GMutex lock;
19918};
19919
19920static void
19921_flash_skeleton_handle_method_call (
19922 GDBusConnection *connection G_GNUC_UNUSED,
19923 const gchar *sender G_GNUC_UNUSED,
19924 const gchar *object_path G_GNUC_UNUSED,
19925 const gchar *interface_name,
19926 const gchar *method_name,
19927 GVariant *parameters,
19928 GDBusMethodInvocation *invocation,
19929 gpointer user_data)
19930{
19931 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
19932 _ExtendedGDBusMethodInfo *info;
19933 GVariantIter iter;
19934 GVariant *child;
19935 GValue *paramv;
19936 guint num_params;
19937 guint num_extra;
19938 guint n;
19939 guint signal_id;
19940 GValue return_value = G_VALUE_INIT;
19941 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
19942 g_assert (info != NULL);
19943 num_params = g_variant_n_children (parameters);
19944 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
19945 n = 0;
19946 g_value_init (&paramv[n], TYPE_FLASH);
19947 g_value_set_object (&paramv[n++], skeleton);
19948 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
19949 g_value_set_object (&paramv[n++], invocation);
19950 if (info->pass_fdlist)
19951 {
19952#ifdef G_OS_UNIX
19953 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
19954 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
19955#else
19956 g_assert_not_reached ();
19957#endif
19958 }
19959 g_variant_iter_init (&iter, parameters);
19960 while ((child = g_variant_iter_next_value (&iter)) != NULL)
19961 {
19962 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
19963 if (arg_info->use_gvariant)
19964 {
19965 g_value_init (&paramv[n], G_TYPE_VARIANT);
19966 g_value_set_variant (&paramv[n], child);
19967 n++;
19968 }
19969 else
19970 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
19971 g_variant_unref (child);
19972 }
19973 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
19974 g_value_init (&return_value, G_TYPE_BOOLEAN);
19975 g_signal_emitv (paramv, signal_id, 0, &return_value);
19976 if (!g_value_get_boolean (&return_value))
19977 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);
19978 g_value_unset (&return_value);
19979 for (n = 0; n < num_params + num_extra; n++)
19980 g_value_unset (&paramv[n]);
19981 g_free (paramv);
19982}
19983
19984static GVariant *
19985_flash_skeleton_handle_get_property (
19986 GDBusConnection *connection G_GNUC_UNUSED,
19987 const gchar *sender G_GNUC_UNUSED,
19988 const gchar *object_path G_GNUC_UNUSED,
19989 const gchar *interface_name G_GNUC_UNUSED,
19990 const gchar *property_name,
19991 GError **error,
19992 gpointer user_data)
19993{
19994 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
19995 GValue value = G_VALUE_INIT;
19996 GParamSpec *pspec;
19997 _ExtendedGDBusPropertyInfo *info;
19998 GVariant *ret;
19999 ret = NULL;
20000 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
20001 g_assert (info != NULL);
20002 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
20003 if (pspec == NULL)
20004 {
20005 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
20006 }
20007 else
20008 {
20009 g_value_init (&value, pspec->value_type);
20010 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
20011 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
20012 g_value_unset (&value);
20013 }
20014 return ret;
20015}
20016
20017static gboolean
20018_flash_skeleton_handle_set_property (
20019 GDBusConnection *connection G_GNUC_UNUSED,
20020 const gchar *sender G_GNUC_UNUSED,
20021 const gchar *object_path G_GNUC_UNUSED,
20022 const gchar *interface_name G_GNUC_UNUSED,
20023 const gchar *property_name,
20024 GVariant *variant,
20025 GError **error,
20026 gpointer user_data)
20027{
20028 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
20029 GValue value = G_VALUE_INIT;
20030 GParamSpec *pspec;
20031 _ExtendedGDBusPropertyInfo *info;
20032 gboolean ret;
20033 ret = FALSE;
20034 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
20035 g_assert (info != NULL);
20036 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
20037 if (pspec == NULL)
20038 {
20039 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
20040 }
20041 else
20042 {
20043 if (info->use_gvariant)
20044 g_value_set_variant (&value, variant);
20045 else
20046 g_dbus_gvariant_to_gvalue (variant, &value);
20047 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
20048 g_value_unset (&value);
20049 ret = TRUE;
20050 }
20051 return ret;
20052}
20053
20054static const GDBusInterfaceVTable _flash_skeleton_vtable =
20055{
20056 _flash_skeleton_handle_method_call,
20057 _flash_skeleton_handle_get_property,
20058 _flash_skeleton_handle_set_property,
20059 {NULL}
20060};
20061
20062static GDBusInterfaceInfo *
20063flash_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
20064{
20065 return flash_interface_info ();
20066}
20067
20068static GDBusInterfaceVTable *
20069flash_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
20070{
20071 return (GDBusInterfaceVTable *) &_flash_skeleton_vtable;
20072}
20073
20074static GVariant *
20075flash_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
20076{
20077 FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton);
20078
20079 GVariantBuilder builder;
20080 guint n;
20081 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
20082 if (_flash_interface_info.parent_struct.properties == NULL)
20083 goto out;
20084 for (n = 0; _flash_interface_info.parent_struct.properties[n] != NULL; n++)
20085 {
20086 GDBusPropertyInfo *info = _flash_interface_info.parent_struct.properties[n];
20087 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
20088 {
20089 GVariant *value;
20090 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);
20091 if (value != NULL)
20092 {
20093 g_variant_take_ref (value);
20094 g_variant_builder_add (&builder, "{sv}", info->name, value);
20095 g_variant_unref (value);
20096 }
20097 }
20098 }
20099out:
20100 return g_variant_builder_end (&builder);
20101}
20102
20103static void
20104flash_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
20105{
20106}
20107
20108static void
20109_flash_on_signal_updated (
20110 Flash *object)
20111{
20112 FlashSkeleton *skeleton = FLASH_SKELETON (object);
20113
20114 GList *connections, *l;
20115 GVariant *signal_variant;
20116 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
20117
20118 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
20119 for (l = connections; l != NULL; l = l->next)
20120 {
20121 GDBusConnection *connection = l->data;
20122 g_dbus_connection_emit_signal (connection,
20123 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Updated",
20124 signal_variant, NULL);
20125 }
20126 g_variant_unref (signal_variant);
20127 g_list_free_full (connections, g_object_unref);
20128}
20129
20130static void flash_skeleton_iface_init (FlashIface *iface);
20131#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20132G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
20133 G_ADD_PRIVATE (FlashSkeleton)
20134 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
20135
20136#else
20137G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
20138 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
20139
20140#endif
20141static void
20142flash_skeleton_finalize (GObject *object)
20143{
20144 FlashSkeleton *skeleton = FLASH_SKELETON (object);
20145 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
20146 if (skeleton->priv->changed_properties_idle_source != NULL)
20147 g_source_destroy (skeleton->priv->changed_properties_idle_source);
20148 g_main_context_unref (skeleton->priv->context);
20149 g_mutex_clear (&skeleton->priv->lock);
20150 G_OBJECT_CLASS (flash_skeleton_parent_class)->finalize (object);
20151}
20152
20153static void
20154flash_skeleton_init (FlashSkeleton *skeleton)
20155{
20156#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20157 skeleton->priv = flash_skeleton_get_instance_private (skeleton);
20158#else
20159 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_SKELETON, FlashSkeletonPrivate);
20160#endif
20161
20162 g_mutex_init (&skeleton->priv->lock);
20163 skeleton->priv->context = g_main_context_ref_thread_default ();
20164}
20165
20166static void
20167flash_skeleton_class_init (FlashSkeletonClass *klass)
20168{
20169 GObjectClass *gobject_class;
20170 GDBusInterfaceSkeletonClass *skeleton_class;
20171
20172 gobject_class = G_OBJECT_CLASS (klass);
20173 gobject_class->finalize = flash_skeleton_finalize;
20174
20175 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
20176 skeleton_class->get_info = flash_skeleton_dbus_interface_get_info;
20177 skeleton_class->get_properties = flash_skeleton_dbus_interface_get_properties;
20178 skeleton_class->flush = flash_skeleton_dbus_interface_flush;
20179 skeleton_class->get_vtable = flash_skeleton_dbus_interface_get_vtable;
20180
20181#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
20182 g_type_class_add_private (klass, sizeof (FlashSkeletonPrivate));
20183#endif
20184}
20185
20186static void
20187flash_skeleton_iface_init (FlashIface *iface)
20188{
20189 iface->updated = _flash_on_signal_updated;
20190}
20191
20192/**
20193 * flash_skeleton_new:
20194 *
20195 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
20196 *
20197 * Returns: (transfer full) (type FlashSkeleton): The skeleton object.
20198 */
20199Flash *
20200flash_skeleton_new (void)
20201{
20202 return FLASH (g_object_new (TYPE_FLASH_SKELETON, NULL));
20203}
20204
20205/* ------------------------------------------------------------------------
20206 * Code for interface org.openbmc.Button
20207 * ------------------------------------------------------------------------
20208 */
20209
20210/**
20211 * SECTION:Button
20212 * @title: Button
20213 * @short_description: Generated C code for the org.openbmc.Button D-Bus interface
20214 *
20215 * 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.
20216 */
20217
20218/* ---- Introspection data for org.openbmc.Button ---- */
20219
20220static const _ExtendedGDBusArgInfo _button_method_info_is_on_OUT_ARG_state =
20221{
20222 {
20223 -1,
20224 (gchar *) "state",
20225 (gchar *) "b",
20226 NULL
20227 },
20228 FALSE
20229};
20230
20231static const _ExtendedGDBusArgInfo * const _button_method_info_is_on_OUT_ARG_pointers[] =
20232{
20233 &_button_method_info_is_on_OUT_ARG_state,
20234 NULL
20235};
20236
20237static const _ExtendedGDBusMethodInfo _button_method_info_is_on =
20238{
20239 {
20240 -1,
20241 (gchar *) "isOn",
20242 NULL,
20243 (GDBusArgInfo **) &_button_method_info_is_on_OUT_ARG_pointers,
20244 NULL
20245 },
20246 "handle-is-on",
20247 FALSE
20248};
20249
20250static const _ExtendedGDBusMethodInfo _button_method_info_sim_button_press =
20251{
20252 {
20253 -1,
20254 (gchar *) "simButtonPress",
20255 NULL,
20256 NULL,
20257 NULL
20258 },
20259 "handle-sim-button-press",
20260 FALSE
20261};
20262
20263static const _ExtendedGDBusMethodInfo _button_method_info_sim_button_long_press =
20264{
20265 {
20266 -1,
20267 (gchar *) "simButtonLongPress",
20268 NULL,
20269 NULL,
20270 NULL
20271 },
20272 "handle-sim-button-long-press",
20273 FALSE
20274};
20275
20276static const _ExtendedGDBusMethodInfo * const _button_method_info_pointers[] =
20277{
20278 &_button_method_info_is_on,
20279 &_button_method_info_sim_button_press,
20280 &_button_method_info_sim_button_long_press,
20281 NULL
20282};
20283
20284static const _ExtendedGDBusSignalInfo _button_signal_info_button_release =
20285{
20286 {
20287 -1,
20288 (gchar *) "ButtonRelease",
20289 NULL,
20290 NULL
20291 },
20292 "button-release"
20293};
20294
20295static const _ExtendedGDBusSignalInfo _button_signal_info_button_pressed =
20296{
20297 {
20298 -1,
20299 (gchar *) "ButtonPressed",
20300 NULL,
20301 NULL
20302 },
20303 "button-pressed"
20304};
20305
20306static const _ExtendedGDBusSignalInfo _button_signal_info_button_pressed_long =
20307{
20308 {
20309 -1,
20310 (gchar *) "ButtonPressedLong",
20311 NULL,
20312 NULL
20313 },
20314 "button-pressed-long"
20315};
20316
20317static const _ExtendedGDBusSignalInfo * const _button_signal_info_pointers[] =
20318{
20319 &_button_signal_info_button_release,
20320 &_button_signal_info_button_pressed,
20321 &_button_signal_info_button_pressed_long,
20322 NULL
20323};
20324
20325static const _ExtendedGDBusPropertyInfo _button_property_info_state =
20326{
20327 {
20328 -1,
20329 (gchar *) "state",
20330 (gchar *) "b",
20331 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
20332 NULL
20333 },
20334 "state",
20335 FALSE
20336};
20337
20338static const _ExtendedGDBusPropertyInfo * const _button_property_info_pointers[] =
20339{
20340 &_button_property_info_state,
20341 NULL
20342};
20343
20344static const _ExtendedGDBusInterfaceInfo _button_interface_info =
20345{
20346 {
20347 -1,
20348 (gchar *) "org.openbmc.Button",
20349 (GDBusMethodInfo **) &_button_method_info_pointers,
20350 (GDBusSignalInfo **) &_button_signal_info_pointers,
20351 (GDBusPropertyInfo **) &_button_property_info_pointers,
20352 NULL
20353 },
20354 "button",
20355};
20356
20357
20358/**
20359 * button_interface_info:
20360 *
20361 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> D-Bus interface.
20362 *
20363 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
20364 */
20365GDBusInterfaceInfo *
20366button_interface_info (void)
20367{
20368 return (GDBusInterfaceInfo *) &_button_interface_info.parent_struct;
20369}
20370
20371/**
20372 * button_override_properties:
20373 * @klass: The class structure for a #GObject<!-- -->-derived class.
20374 * @property_id_begin: The property id to assign to the first overridden property.
20375 *
20376 * Overrides all #GObject properties in the #Button interface for a concrete class.
20377 * The properties are overridden in the order they are defined.
20378 *
20379 * Returns: The last property id.
20380 */
20381guint
20382button_override_properties (GObjectClass *klass, guint property_id_begin)
20383{
20384 g_object_class_override_property (klass, property_id_begin++, "state");
20385 return property_id_begin - 1;
20386}
20387
20388
20389
20390/**
20391 * Button:
20392 *
20393 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
20394 */
20395
20396/**
20397 * ButtonIface:
20398 * @parent_iface: The parent interface.
20399 * @handle_is_on: Handler for the #Button::handle-is-on signal.
20400 * @handle_sim_button_long_press: Handler for the #Button::handle-sim-button-long-press signal.
20401 * @handle_sim_button_press: Handler for the #Button::handle-sim-button-press signal.
20402 * @get_state: Getter for the #Button:state property.
20403 * @button_pressed: Handler for the #Button::button-pressed signal.
20404 * @button_pressed_long: Handler for the #Button::button-pressed-long signal.
20405 * @button_release: Handler for the #Button::button-release signal.
20406 *
20407 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
20408 */
20409
20410typedef ButtonIface ButtonInterface;
20411G_DEFINE_INTERFACE (Button, button, G_TYPE_OBJECT);
20412
20413static void
20414button_default_init (ButtonIface *iface)
20415{
20416 /* GObject signals for incoming D-Bus method calls: */
20417 /**
20418 * Button::handle-is-on:
20419 * @object: A #Button.
20420 * @invocation: A #GDBusMethodInvocation.
20421 *
20422 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method.
20423 *
20424 * 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.
20425 *
20426 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
20427 */
20428 g_signal_new ("handle-is-on",
20429 G_TYPE_FROM_INTERFACE (iface),
20430 G_SIGNAL_RUN_LAST,
20431 G_STRUCT_OFFSET (ButtonIface, handle_is_on),
20432 g_signal_accumulator_true_handled,
20433 NULL,
20434 g_cclosure_marshal_generic,
20435 G_TYPE_BOOLEAN,
20436 1,
20437 G_TYPE_DBUS_METHOD_INVOCATION);
20438
20439 /**
20440 * Button::handle-sim-button-press:
20441 * @object: A #Button.
20442 * @invocation: A #GDBusMethodInvocation.
20443 *
20444 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method.
20445 *
20446 * 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.
20447 *
20448 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
20449 */
20450 g_signal_new ("handle-sim-button-press",
20451 G_TYPE_FROM_INTERFACE (iface),
20452 G_SIGNAL_RUN_LAST,
20453 G_STRUCT_OFFSET (ButtonIface, handle_sim_button_press),
20454 g_signal_accumulator_true_handled,
20455 NULL,
20456 g_cclosure_marshal_generic,
20457 G_TYPE_BOOLEAN,
20458 1,
20459 G_TYPE_DBUS_METHOD_INVOCATION);
20460
20461 /**
20462 * Button::handle-sim-button-long-press:
20463 * @object: A #Button.
20464 * @invocation: A #GDBusMethodInvocation.
20465 *
20466 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method.
20467 *
20468 * 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.
20469 *
20470 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
20471 */
20472 g_signal_new ("handle-sim-button-long-press",
20473 G_TYPE_FROM_INTERFACE (iface),
20474 G_SIGNAL_RUN_LAST,
20475 G_STRUCT_OFFSET (ButtonIface, handle_sim_button_long_press),
20476 g_signal_accumulator_true_handled,
20477 NULL,
20478 g_cclosure_marshal_generic,
20479 G_TYPE_BOOLEAN,
20480 1,
20481 G_TYPE_DBUS_METHOD_INVOCATION);
20482
20483 /* GObject signals for received D-Bus signals: */
20484 /**
20485 * Button::button-release:
20486 * @object: A #Button.
20487 *
20488 * 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.
20489 *
20490 * 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.
20491 */
20492 g_signal_new ("button-release",
20493 G_TYPE_FROM_INTERFACE (iface),
20494 G_SIGNAL_RUN_LAST,
20495 G_STRUCT_OFFSET (ButtonIface, button_release),
20496 NULL,
20497 NULL,
20498 g_cclosure_marshal_generic,
20499 G_TYPE_NONE,
20500 0);
20501
20502 /**
20503 * Button::button-pressed:
20504 * @object: A #Button.
20505 *
20506 * 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.
20507 *
20508 * 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.
20509 */
20510 g_signal_new ("button-pressed",
20511 G_TYPE_FROM_INTERFACE (iface),
20512 G_SIGNAL_RUN_LAST,
20513 G_STRUCT_OFFSET (ButtonIface, button_pressed),
20514 NULL,
20515 NULL,
20516 g_cclosure_marshal_generic,
20517 G_TYPE_NONE,
20518 0);
20519
20520 /**
20521 * Button::button-pressed-long:
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.ButtonPressedLong">"ButtonPressedLong"</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-pressed-long",
20529 G_TYPE_FROM_INTERFACE (iface),
20530 G_SIGNAL_RUN_LAST,
20531 G_STRUCT_OFFSET (ButtonIface, button_pressed_long),
20532 NULL,
20533 NULL,
20534 g_cclosure_marshal_generic,
20535 G_TYPE_NONE,
20536 0);
20537
20538 /* GObject properties for D-Bus properties: */
20539 /**
20540 * Button:state:
20541 *
20542 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link>.
20543 *
20544 * 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.
20545 */
20546 g_object_interface_install_property (iface,
20547 g_param_spec_boolean ("state", "state", "state", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
20548}
20549
20550/**
20551 * button_get_state: (skip)
20552 * @object: A #Button.
20553 *
20554 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property.
20555 *
20556 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
20557 *
20558 * Returns: The property value.
20559 */
20560gboolean
20561button_get_state (Button *object)
20562{
20563 return BUTTON_GET_IFACE (object)->get_state (object);
20564}
20565
20566/**
20567 * button_set_state: (skip)
20568 * @object: A #Button.
20569 * @value: The value to set.
20570 *
20571 * Sets the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property to @value.
20572 *
20573 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
20574 */
20575void
20576button_set_state (Button *object, gboolean value)
20577{
20578 g_object_set (G_OBJECT (object), "state", value, NULL);
20579}
20580
20581/**
20582 * button_emit_button_release:
20583 * @object: A #Button.
20584 *
20585 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonRelease">"ButtonRelease"</link> D-Bus signal.
20586 */
20587void
20588button_emit_button_release (
20589 Button *object)
20590{
20591 g_signal_emit_by_name (object, "button-release");
20592}
20593
20594/**
20595 * button_emit_button_pressed:
20596 * @object: A #Button.
20597 *
20598 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressed">"ButtonPressed"</link> D-Bus signal.
20599 */
20600void
20601button_emit_button_pressed (
20602 Button *object)
20603{
20604 g_signal_emit_by_name (object, "button-pressed");
20605}
20606
20607/**
20608 * button_emit_button_pressed_long:
20609 * @object: A #Button.
20610 *
20611 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressedLong">"ButtonPressedLong"</link> D-Bus signal.
20612 */
20613void
20614button_emit_button_pressed_long (
20615 Button *object)
20616{
20617 g_signal_emit_by_name (object, "button-pressed-long");
20618}
20619
20620/**
20621 * button_call_is_on:
20622 * @proxy: A #ButtonProxy.
20623 * @cancellable: (allow-none): A #GCancellable or %NULL.
20624 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
20625 * @user_data: User data to pass to @callback.
20626 *
20627 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method on @proxy.
20628 * 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.
20629 * You can then call button_call_is_on_finish() to get the result of the operation.
20630 *
20631 * See button_call_is_on_sync() for the synchronous, blocking version of this method.
20632 */
20633void
20634button_call_is_on (
20635 Button *proxy,
20636 GCancellable *cancellable,
20637 GAsyncReadyCallback callback,
20638 gpointer user_data)
20639{
20640 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
20641 "isOn",
20642 g_variant_new ("()"),
20643 G_DBUS_CALL_FLAGS_NONE,
20644 -1,
20645 cancellable,
20646 callback,
20647 user_data);
20648}
20649
20650/**
20651 * button_call_is_on_finish:
20652 * @proxy: A #ButtonProxy.
20653 * @out_state: (out): Return location for return parameter or %NULL to ignore.
20654 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_is_on().
20655 * @error: Return location for error or %NULL.
20656 *
20657 * Finishes an operation started with button_call_is_on().
20658 *
20659 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20660 */
20661gboolean
20662button_call_is_on_finish (
20663 Button *proxy,
20664 gboolean *out_state,
20665 GAsyncResult *res,
20666 GError **error)
20667{
20668 GVariant *_ret;
20669 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
20670 if (_ret == NULL)
20671 goto _out;
20672 g_variant_get (_ret,
20673 "(b)",
20674 out_state);
20675 g_variant_unref (_ret);
20676_out:
20677 return _ret != NULL;
20678}
20679
20680/**
20681 * button_call_is_on_sync:
20682 * @proxy: A #ButtonProxy.
20683 * @out_state: (out): Return location for return parameter or %NULL to ignore.
20684 * @cancellable: (allow-none): A #GCancellable or %NULL.
20685 * @error: Return location for error or %NULL.
20686 *
20687 * 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.
20688 *
20689 * See button_call_is_on() for the asynchronous version of this method.
20690 *
20691 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20692 */
20693gboolean
20694button_call_is_on_sync (
20695 Button *proxy,
20696 gboolean *out_state,
20697 GCancellable *cancellable,
20698 GError **error)
20699{
20700 GVariant *_ret;
20701 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
20702 "isOn",
20703 g_variant_new ("()"),
20704 G_DBUS_CALL_FLAGS_NONE,
20705 -1,
20706 cancellable,
20707 error);
20708 if (_ret == NULL)
20709 goto _out;
20710 g_variant_get (_ret,
20711 "(b)",
20712 out_state);
20713 g_variant_unref (_ret);
20714_out:
20715 return _ret != NULL;
20716}
20717
20718/**
20719 * button_call_sim_button_press:
20720 * @proxy: A #ButtonProxy.
20721 * @cancellable: (allow-none): A #GCancellable or %NULL.
20722 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
20723 * @user_data: User data to pass to @callback.
20724 *
20725 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method on @proxy.
20726 * 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.
20727 * You can then call button_call_sim_button_press_finish() to get the result of the operation.
20728 *
20729 * See button_call_sim_button_press_sync() for the synchronous, blocking version of this method.
20730 */
20731void
20732button_call_sim_button_press (
20733 Button *proxy,
20734 GCancellable *cancellable,
20735 GAsyncReadyCallback callback,
20736 gpointer user_data)
20737{
20738 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
20739 "simButtonPress",
20740 g_variant_new ("()"),
20741 G_DBUS_CALL_FLAGS_NONE,
20742 -1,
20743 cancellable,
20744 callback,
20745 user_data);
20746}
20747
20748/**
20749 * button_call_sim_button_press_finish:
20750 * @proxy: A #ButtonProxy.
20751 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_button_press().
20752 * @error: Return location for error or %NULL.
20753 *
20754 * Finishes an operation started with button_call_sim_button_press().
20755 *
20756 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20757 */
20758gboolean
20759button_call_sim_button_press_finish (
20760 Button *proxy,
20761 GAsyncResult *res,
20762 GError **error)
20763{
20764 GVariant *_ret;
20765 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
20766 if (_ret == NULL)
20767 goto _out;
20768 g_variant_get (_ret,
20769 "()");
20770 g_variant_unref (_ret);
20771_out:
20772 return _ret != NULL;
20773}
20774
20775/**
20776 * button_call_sim_button_press_sync:
20777 * @proxy: A #ButtonProxy.
20778 * @cancellable: (allow-none): A #GCancellable or %NULL.
20779 * @error: Return location for error or %NULL.
20780 *
20781 * 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.
20782 *
20783 * See button_call_sim_button_press() for the asynchronous version of this method.
20784 *
20785 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20786 */
20787gboolean
20788button_call_sim_button_press_sync (
20789 Button *proxy,
20790 GCancellable *cancellable,
20791 GError **error)
20792{
20793 GVariant *_ret;
20794 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
20795 "simButtonPress",
20796 g_variant_new ("()"),
20797 G_DBUS_CALL_FLAGS_NONE,
20798 -1,
20799 cancellable,
20800 error);
20801 if (_ret == NULL)
20802 goto _out;
20803 g_variant_get (_ret,
20804 "()");
20805 g_variant_unref (_ret);
20806_out:
20807 return _ret != NULL;
20808}
20809
20810/**
20811 * button_call_sim_button_long_press:
20812 * @proxy: A #ButtonProxy.
20813 * @cancellable: (allow-none): A #GCancellable or %NULL.
20814 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
20815 * @user_data: User data to pass to @callback.
20816 *
20817 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method on @proxy.
20818 * 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.
20819 * You can then call button_call_sim_button_long_press_finish() to get the result of the operation.
20820 *
20821 * See button_call_sim_button_long_press_sync() for the synchronous, blocking version of this method.
20822 */
20823void
20824button_call_sim_button_long_press (
20825 Button *proxy,
20826 GCancellable *cancellable,
20827 GAsyncReadyCallback callback,
20828 gpointer user_data)
20829{
20830 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
20831 "simButtonLongPress",
20832 g_variant_new ("()"),
20833 G_DBUS_CALL_FLAGS_NONE,
20834 -1,
20835 cancellable,
20836 callback,
20837 user_data);
20838}
20839
20840/**
20841 * button_call_sim_button_long_press_finish:
20842 * @proxy: A #ButtonProxy.
20843 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_button_long_press().
20844 * @error: Return location for error or %NULL.
20845 *
20846 * Finishes an operation started with button_call_sim_button_long_press().
20847 *
20848 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20849 */
20850gboolean
20851button_call_sim_button_long_press_finish (
20852 Button *proxy,
20853 GAsyncResult *res,
20854 GError **error)
20855{
20856 GVariant *_ret;
20857 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
20858 if (_ret == NULL)
20859 goto _out;
20860 g_variant_get (_ret,
20861 "()");
20862 g_variant_unref (_ret);
20863_out:
20864 return _ret != NULL;
20865}
20866
20867/**
20868 * button_call_sim_button_long_press_sync:
20869 * @proxy: A #ButtonProxy.
20870 * @cancellable: (allow-none): A #GCancellable or %NULL.
20871 * @error: Return location for error or %NULL.
20872 *
20873 * 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.
20874 *
20875 * See button_call_sim_button_long_press() for the asynchronous version of this method.
20876 *
20877 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20878 */
20879gboolean
20880button_call_sim_button_long_press_sync (
20881 Button *proxy,
20882 GCancellable *cancellable,
20883 GError **error)
20884{
20885 GVariant *_ret;
20886 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
20887 "simButtonLongPress",
20888 g_variant_new ("()"),
20889 G_DBUS_CALL_FLAGS_NONE,
20890 -1,
20891 cancellable,
20892 error);
20893 if (_ret == NULL)
20894 goto _out;
20895 g_variant_get (_ret,
20896 "()");
20897 g_variant_unref (_ret);
20898_out:
20899 return _ret != NULL;
20900}
20901
20902/**
20903 * button_complete_is_on:
20904 * @object: A #Button.
20905 * @invocation: (transfer full): A #GDBusMethodInvocation.
20906 * @state: Parameter to return.
20907 *
20908 * 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.
20909 *
20910 * This method will free @invocation, you cannot use it afterwards.
20911 */
20912void
20913button_complete_is_on (
20914 Button *object,
20915 GDBusMethodInvocation *invocation,
20916 gboolean state)
20917{
20918 g_dbus_method_invocation_return_value (invocation,
20919 g_variant_new ("(b)",
20920 state));
20921}
20922
20923/**
20924 * button_complete_sim_button_press:
20925 * @object: A #Button.
20926 * @invocation: (transfer full): A #GDBusMethodInvocation.
20927 *
20928 * 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.
20929 *
20930 * This method will free @invocation, you cannot use it afterwards.
20931 */
20932void
20933button_complete_sim_button_press (
20934 Button *object,
20935 GDBusMethodInvocation *invocation)
20936{
20937 g_dbus_method_invocation_return_value (invocation,
20938 g_variant_new ("()"));
20939}
20940
20941/**
20942 * button_complete_sim_button_long_press:
20943 * @object: A #Button.
20944 * @invocation: (transfer full): A #GDBusMethodInvocation.
20945 *
20946 * 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.
20947 *
20948 * This method will free @invocation, you cannot use it afterwards.
20949 */
20950void
20951button_complete_sim_button_long_press (
20952 Button *object,
20953 GDBusMethodInvocation *invocation)
20954{
20955 g_dbus_method_invocation_return_value (invocation,
20956 g_variant_new ("()"));
20957}
20958
20959/* ------------------------------------------------------------------------ */
20960
20961/**
20962 * ButtonProxy:
20963 *
20964 * The #ButtonProxy structure contains only private data and should only be accessed using the provided API.
20965 */
20966
20967/**
20968 * ButtonProxyClass:
20969 * @parent_class: The parent class.
20970 *
20971 * Class structure for #ButtonProxy.
20972 */
20973
20974struct _ButtonProxyPrivate
20975{
20976 GData *qdata;
20977};
20978
20979static void button_proxy_iface_init (ButtonIface *iface);
20980
20981#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20982G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
20983 G_ADD_PRIVATE (ButtonProxy)
20984 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
20985
20986#else
20987G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
20988 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
20989
20990#endif
20991static void
20992button_proxy_finalize (GObject *object)
20993{
20994 ButtonProxy *proxy = BUTTON_PROXY (object);
20995 g_datalist_clear (&proxy->priv->qdata);
20996 G_OBJECT_CLASS (button_proxy_parent_class)->finalize (object);
20997}
20998
20999static void
21000button_proxy_get_property (GObject *object,
21001 guint prop_id,
21002 GValue *value,
21003 GParamSpec *pspec G_GNUC_UNUSED)
21004{
21005 const _ExtendedGDBusPropertyInfo *info;
21006 GVariant *variant;
21007 g_assert (prop_id != 0 && prop_id - 1 < 1);
21008 info = _button_property_info_pointers[prop_id - 1];
21009 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
21010 if (info->use_gvariant)
21011 {
21012 g_value_set_variant (value, variant);
21013 }
21014 else
21015 {
21016 if (variant != NULL)
21017 g_dbus_gvariant_to_gvalue (variant, value);
21018 }
21019 if (variant != NULL)
21020 g_variant_unref (variant);
21021}
21022
21023static void
21024button_proxy_set_property_cb (GDBusProxy *proxy,
21025 GAsyncResult *res,
21026 gpointer user_data)
21027{
21028 const _ExtendedGDBusPropertyInfo *info = user_data;
21029 GError *error;
21030 GVariant *_ret;
21031 error = NULL;
21032 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
21033 if (!_ret)
21034 {
21035 g_warning ("Error setting property '%s' on interface org.openbmc.Button: %s (%s, %d)",
21036 info->parent_struct.name,
21037 error->message, g_quark_to_string (error->domain), error->code);
21038 g_error_free (error);
21039 }
21040 else
21041 {
21042 g_variant_unref (_ret);
21043 }
21044}
21045
21046static void
21047button_proxy_set_property (GObject *object,
21048 guint prop_id,
21049 const GValue *value,
21050 GParamSpec *pspec G_GNUC_UNUSED)
21051{
21052 const _ExtendedGDBusPropertyInfo *info;
21053 GVariant *variant;
21054 g_assert (prop_id != 0 && prop_id - 1 < 1);
21055 info = _button_property_info_pointers[prop_id - 1];
21056 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
21057 g_dbus_proxy_call (G_DBUS_PROXY (object),
21058 "org.freedesktop.DBus.Properties.Set",
21059 g_variant_new ("(ssv)", "org.openbmc.Button", info->parent_struct.name, variant),
21060 G_DBUS_CALL_FLAGS_NONE,
21061 -1,
21062 NULL, (GAsyncReadyCallback) button_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
21063 g_variant_unref (variant);
21064}
21065
21066static void
21067button_proxy_g_signal (GDBusProxy *proxy,
21068 const gchar *sender_name G_GNUC_UNUSED,
21069 const gchar *signal_name,
21070 GVariant *parameters)
21071{
21072 _ExtendedGDBusSignalInfo *info;
21073 GVariantIter iter;
21074 GVariant *child;
21075 GValue *paramv;
21076 guint num_params;
21077 guint n;
21078 guint signal_id;
21079 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, signal_name);
21080 if (info == NULL)
21081 return;
21082 num_params = g_variant_n_children (parameters);
21083 paramv = g_new0 (GValue, num_params + 1);
21084 g_value_init (&paramv[0], TYPE_BUTTON);
21085 g_value_set_object (&paramv[0], proxy);
21086 g_variant_iter_init (&iter, parameters);
21087 n = 1;
21088 while ((child = g_variant_iter_next_value (&iter)) != NULL)
21089 {
21090 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
21091 if (arg_info->use_gvariant)
21092 {
21093 g_value_init (&paramv[n], G_TYPE_VARIANT);
21094 g_value_set_variant (&paramv[n], child);
21095 n++;
21096 }
21097 else
21098 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
21099 g_variant_unref (child);
21100 }
21101 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
21102 g_signal_emitv (paramv, signal_id, 0, NULL);
21103 for (n = 0; n < num_params + 1; n++)
21104 g_value_unset (&paramv[n]);
21105 g_free (paramv);
21106}
21107
21108static void
21109button_proxy_g_properties_changed (GDBusProxy *_proxy,
21110 GVariant *changed_properties,
21111 const gchar *const *invalidated_properties)
21112{
21113 ButtonProxy *proxy = BUTTON_PROXY (_proxy);
21114 guint n;
21115 const gchar *key;
21116 GVariantIter *iter;
21117 _ExtendedGDBusPropertyInfo *info;
21118 g_variant_get (changed_properties, "a{sv}", &iter);
21119 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
21120 {
21121 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, key);
21122 g_datalist_remove_data (&proxy->priv->qdata, key);
21123 if (info != NULL)
21124 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
21125 }
21126 g_variant_iter_free (iter);
21127 for (n = 0; invalidated_properties[n] != NULL; n++)
21128 {
21129 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, invalidated_properties[n]);
21130 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
21131 if (info != NULL)
21132 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
21133 }
21134}
21135
21136static gboolean
21137button_proxy_get_state (Button *object)
21138{
21139 ButtonProxy *proxy = BUTTON_PROXY (object);
21140 GVariant *variant;
21141 gboolean value = 0;
21142 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
21143 if (variant != NULL)
21144 {
21145 value = g_variant_get_boolean (variant);
21146 g_variant_unref (variant);
21147 }
21148 return value;
21149}
21150
21151static void
21152button_proxy_init (ButtonProxy *proxy)
21153{
21154#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21155 proxy->priv = button_proxy_get_instance_private (proxy);
21156#else
21157 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_BUTTON_PROXY, ButtonProxyPrivate);
21158#endif
21159
21160 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), button_interface_info ());
21161}
21162
21163static void
21164button_proxy_class_init (ButtonProxyClass *klass)
21165{
21166 GObjectClass *gobject_class;
21167 GDBusProxyClass *proxy_class;
21168
21169 gobject_class = G_OBJECT_CLASS (klass);
21170 gobject_class->finalize = button_proxy_finalize;
21171 gobject_class->get_property = button_proxy_get_property;
21172 gobject_class->set_property = button_proxy_set_property;
21173
21174 proxy_class = G_DBUS_PROXY_CLASS (klass);
21175 proxy_class->g_signal = button_proxy_g_signal;
21176 proxy_class->g_properties_changed = button_proxy_g_properties_changed;
21177
21178 button_override_properties (gobject_class, 1);
21179
21180#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
21181 g_type_class_add_private (klass, sizeof (ButtonProxyPrivate));
21182#endif
21183}
21184
21185static void
21186button_proxy_iface_init (ButtonIface *iface)
21187{
21188 iface->get_state = button_proxy_get_state;
21189}
21190
21191/**
21192 * button_proxy_new:
21193 * @connection: A #GDBusConnection.
21194 * @flags: Flags from the #GDBusProxyFlags enumeration.
21195 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
21196 * @object_path: An object path.
21197 * @cancellable: (allow-none): A #GCancellable or %NULL.
21198 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
21199 * @user_data: User data to pass to @callback.
21200 *
21201 * 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.
21202 *
21203 * 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.
21204 * You can then call button_proxy_new_finish() to get the result of the operation.
21205 *
21206 * See button_proxy_new_sync() for the synchronous, blocking version of this constructor.
21207 */
21208void
21209button_proxy_new (
21210 GDBusConnection *connection,
21211 GDBusProxyFlags flags,
21212 const gchar *name,
21213 const gchar *object_path,
21214 GCancellable *cancellable,
21215 GAsyncReadyCallback callback,
21216 gpointer user_data)
21217{
21218 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);
21219}
21220
21221/**
21222 * button_proxy_new_finish:
21223 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new().
21224 * @error: Return location for error or %NULL
21225 *
21226 * Finishes an operation started with button_proxy_new().
21227 *
21228 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
21229 */
21230Button *
21231button_proxy_new_finish (
21232 GAsyncResult *res,
21233 GError **error)
21234{
21235 GObject *ret;
21236 GObject *source_object;
21237 source_object = g_async_result_get_source_object (res);
21238 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
21239 g_object_unref (source_object);
21240 if (ret != NULL)
21241 return BUTTON (ret);
21242 else
21243 return NULL;
21244}
21245
21246/**
21247 * button_proxy_new_sync:
21248 * @connection: A #GDBusConnection.
21249 * @flags: Flags from the #GDBusProxyFlags enumeration.
21250 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
21251 * @object_path: An object path.
21252 * @cancellable: (allow-none): A #GCancellable or %NULL.
21253 * @error: Return location for error or %NULL
21254 *
21255 * 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.
21256 *
21257 * The calling thread is blocked until a reply is received.
21258 *
21259 * See button_proxy_new() for the asynchronous version of this constructor.
21260 *
21261 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
21262 */
21263Button *
21264button_proxy_new_sync (
21265 GDBusConnection *connection,
21266 GDBusProxyFlags flags,
21267 const gchar *name,
21268 const gchar *object_path,
21269 GCancellable *cancellable,
21270 GError **error)
21271{
21272 GInitable *ret;
21273 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);
21274 if (ret != NULL)
21275 return BUTTON (ret);
21276 else
21277 return NULL;
21278}
21279
21280
21281/**
21282 * button_proxy_new_for_bus:
21283 * @bus_type: A #GBusType.
21284 * @flags: Flags from the #GDBusProxyFlags enumeration.
21285 * @name: A bus name (well-known or unique).
21286 * @object_path: An object path.
21287 * @cancellable: (allow-none): A #GCancellable or %NULL.
21288 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
21289 * @user_data: User data to pass to @callback.
21290 *
21291 * Like button_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
21292 *
21293 * 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.
21294 * You can then call button_proxy_new_for_bus_finish() to get the result of the operation.
21295 *
21296 * See button_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
21297 */
21298void
21299button_proxy_new_for_bus (
21300 GBusType bus_type,
21301 GDBusProxyFlags flags,
21302 const gchar *name,
21303 const gchar *object_path,
21304 GCancellable *cancellable,
21305 GAsyncReadyCallback callback,
21306 gpointer user_data)
21307{
21308 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);
21309}
21310
21311/**
21312 * button_proxy_new_for_bus_finish:
21313 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new_for_bus().
21314 * @error: Return location for error or %NULL
21315 *
21316 * Finishes an operation started with button_proxy_new_for_bus().
21317 *
21318 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
21319 */
21320Button *
21321button_proxy_new_for_bus_finish (
21322 GAsyncResult *res,
21323 GError **error)
21324{
21325 GObject *ret;
21326 GObject *source_object;
21327 source_object = g_async_result_get_source_object (res);
21328 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
21329 g_object_unref (source_object);
21330 if (ret != NULL)
21331 return BUTTON (ret);
21332 else
21333 return NULL;
21334}
21335
21336/**
21337 * button_proxy_new_for_bus_sync:
21338 * @bus_type: A #GBusType.
21339 * @flags: Flags from the #GDBusProxyFlags enumeration.
21340 * @name: A bus name (well-known or unique).
21341 * @object_path: An object path.
21342 * @cancellable: (allow-none): A #GCancellable or %NULL.
21343 * @error: Return location for error or %NULL
21344 *
21345 * Like button_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
21346 *
21347 * The calling thread is blocked until a reply is received.
21348 *
21349 * See button_proxy_new_for_bus() for the asynchronous version of this constructor.
21350 *
21351 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
21352 */
21353Button *
21354button_proxy_new_for_bus_sync (
21355 GBusType bus_type,
21356 GDBusProxyFlags flags,
21357 const gchar *name,
21358 const gchar *object_path,
21359 GCancellable *cancellable,
21360 GError **error)
21361{
21362 GInitable *ret;
21363 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);
21364 if (ret != NULL)
21365 return BUTTON (ret);
21366 else
21367 return NULL;
21368}
21369
21370
21371/* ------------------------------------------------------------------------ */
21372
21373/**
21374 * ButtonSkeleton:
21375 *
21376 * The #ButtonSkeleton structure contains only private data and should only be accessed using the provided API.
21377 */
21378
21379/**
21380 * ButtonSkeletonClass:
21381 * @parent_class: The parent class.
21382 *
21383 * Class structure for #ButtonSkeleton.
21384 */
21385
21386struct _ButtonSkeletonPrivate
21387{
21388 GValue *properties;
21389 GList *changed_properties;
21390 GSource *changed_properties_idle_source;
21391 GMainContext *context;
21392 GMutex lock;
21393};
21394
21395static void
21396_button_skeleton_handle_method_call (
21397 GDBusConnection *connection G_GNUC_UNUSED,
21398 const gchar *sender G_GNUC_UNUSED,
21399 const gchar *object_path G_GNUC_UNUSED,
21400 const gchar *interface_name,
21401 const gchar *method_name,
21402 GVariant *parameters,
21403 GDBusMethodInvocation *invocation,
21404 gpointer user_data)
21405{
21406 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
21407 _ExtendedGDBusMethodInfo *info;
21408 GVariantIter iter;
21409 GVariant *child;
21410 GValue *paramv;
21411 guint num_params;
21412 guint num_extra;
21413 guint n;
21414 guint signal_id;
21415 GValue return_value = G_VALUE_INIT;
21416 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
21417 g_assert (info != NULL);
21418 num_params = g_variant_n_children (parameters);
21419 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
21420 n = 0;
21421 g_value_init (&paramv[n], TYPE_BUTTON);
21422 g_value_set_object (&paramv[n++], skeleton);
21423 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
21424 g_value_set_object (&paramv[n++], invocation);
21425 if (info->pass_fdlist)
21426 {
21427#ifdef G_OS_UNIX
21428 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
21429 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
21430#else
21431 g_assert_not_reached ();
21432#endif
21433 }
21434 g_variant_iter_init (&iter, parameters);
21435 while ((child = g_variant_iter_next_value (&iter)) != NULL)
21436 {
21437 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
21438 if (arg_info->use_gvariant)
21439 {
21440 g_value_init (&paramv[n], G_TYPE_VARIANT);
21441 g_value_set_variant (&paramv[n], child);
21442 n++;
21443 }
21444 else
21445 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
21446 g_variant_unref (child);
21447 }
21448 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
21449 g_value_init (&return_value, G_TYPE_BOOLEAN);
21450 g_signal_emitv (paramv, signal_id, 0, &return_value);
21451 if (!g_value_get_boolean (&return_value))
21452 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);
21453 g_value_unset (&return_value);
21454 for (n = 0; n < num_params + num_extra; n++)
21455 g_value_unset (&paramv[n]);
21456 g_free (paramv);
21457}
21458
21459static GVariant *
21460_button_skeleton_handle_get_property (
21461 GDBusConnection *connection G_GNUC_UNUSED,
21462 const gchar *sender G_GNUC_UNUSED,
21463 const gchar *object_path G_GNUC_UNUSED,
21464 const gchar *interface_name G_GNUC_UNUSED,
21465 const gchar *property_name,
21466 GError **error,
21467 gpointer user_data)
21468{
21469 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
21470 GValue value = G_VALUE_INIT;
21471 GParamSpec *pspec;
21472 _ExtendedGDBusPropertyInfo *info;
21473 GVariant *ret;
21474 ret = NULL;
21475 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
21476 g_assert (info != NULL);
21477 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
21478 if (pspec == NULL)
21479 {
21480 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
21481 }
21482 else
21483 {
21484 g_value_init (&value, pspec->value_type);
21485 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
21486 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
21487 g_value_unset (&value);
21488 }
21489 return ret;
21490}
21491
21492static gboolean
21493_button_skeleton_handle_set_property (
21494 GDBusConnection *connection G_GNUC_UNUSED,
21495 const gchar *sender G_GNUC_UNUSED,
21496 const gchar *object_path G_GNUC_UNUSED,
21497 const gchar *interface_name G_GNUC_UNUSED,
21498 const gchar *property_name,
21499 GVariant *variant,
21500 GError **error,
21501 gpointer user_data)
21502{
21503 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
21504 GValue value = G_VALUE_INIT;
21505 GParamSpec *pspec;
21506 _ExtendedGDBusPropertyInfo *info;
21507 gboolean ret;
21508 ret = FALSE;
21509 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
21510 g_assert (info != NULL);
21511 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
21512 if (pspec == NULL)
21513 {
21514 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
21515 }
21516 else
21517 {
21518 if (info->use_gvariant)
21519 g_value_set_variant (&value, variant);
21520 else
21521 g_dbus_gvariant_to_gvalue (variant, &value);
21522 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
21523 g_value_unset (&value);
21524 ret = TRUE;
21525 }
21526 return ret;
21527}
21528
21529static const GDBusInterfaceVTable _button_skeleton_vtable =
21530{
21531 _button_skeleton_handle_method_call,
21532 _button_skeleton_handle_get_property,
21533 _button_skeleton_handle_set_property,
21534 {NULL}
21535};
21536
21537static GDBusInterfaceInfo *
21538button_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
21539{
21540 return button_interface_info ();
21541}
21542
21543static GDBusInterfaceVTable *
21544button_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
21545{
21546 return (GDBusInterfaceVTable *) &_button_skeleton_vtable;
21547}
21548
21549static GVariant *
21550button_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
21551{
21552 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
21553
21554 GVariantBuilder builder;
21555 guint n;
21556 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
21557 if (_button_interface_info.parent_struct.properties == NULL)
21558 goto out;
21559 for (n = 0; _button_interface_info.parent_struct.properties[n] != NULL; n++)
21560 {
21561 GDBusPropertyInfo *info = _button_interface_info.parent_struct.properties[n];
21562 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
21563 {
21564 GVariant *value;
21565 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);
21566 if (value != NULL)
21567 {
21568 g_variant_take_ref (value);
21569 g_variant_builder_add (&builder, "{sv}", info->name, value);
21570 g_variant_unref (value);
21571 }
21572 }
21573 }
21574out:
21575 return g_variant_builder_end (&builder);
21576}
21577
21578static gboolean _button_emit_changed (gpointer user_data);
21579
21580static void
21581button_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
21582{
21583 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
21584 gboolean emit_changed = FALSE;
21585
21586 g_mutex_lock (&skeleton->priv->lock);
21587 if (skeleton->priv->changed_properties_idle_source != NULL)
21588 {
21589 g_source_destroy (skeleton->priv->changed_properties_idle_source);
21590 skeleton->priv->changed_properties_idle_source = NULL;
21591 emit_changed = TRUE;
21592 }
21593 g_mutex_unlock (&skeleton->priv->lock);
21594
21595 if (emit_changed)
21596 _button_emit_changed (skeleton);
21597}
21598
21599static void
21600_button_on_signal_button_release (
21601 Button *object)
21602{
21603 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21604
21605 GList *connections, *l;
21606 GVariant *signal_variant;
21607 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
21608
21609 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
21610 for (l = connections; l != NULL; l = l->next)
21611 {
21612 GDBusConnection *connection = l->data;
21613 g_dbus_connection_emit_signal (connection,
21614 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonRelease",
21615 signal_variant, NULL);
21616 }
21617 g_variant_unref (signal_variant);
21618 g_list_free_full (connections, g_object_unref);
21619}
21620
21621static void
21622_button_on_signal_button_pressed (
21623 Button *object)
21624{
21625 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21626
21627 GList *connections, *l;
21628 GVariant *signal_variant;
21629 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
21630
21631 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
21632 for (l = connections; l != NULL; l = l->next)
21633 {
21634 GDBusConnection *connection = l->data;
21635 g_dbus_connection_emit_signal (connection,
21636 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonPressed",
21637 signal_variant, NULL);
21638 }
21639 g_variant_unref (signal_variant);
21640 g_list_free_full (connections, g_object_unref);
21641}
21642
21643static void
21644_button_on_signal_button_pressed_long (
21645 Button *object)
21646{
21647 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21648
21649 GList *connections, *l;
21650 GVariant *signal_variant;
21651 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
21652
21653 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
21654 for (l = connections; l != NULL; l = l->next)
21655 {
21656 GDBusConnection *connection = l->data;
21657 g_dbus_connection_emit_signal (connection,
21658 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonPressedLong",
21659 signal_variant, NULL);
21660 }
21661 g_variant_unref (signal_variant);
21662 g_list_free_full (connections, g_object_unref);
21663}
21664
21665static void button_skeleton_iface_init (ButtonIface *iface);
21666#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21667G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
21668 G_ADD_PRIVATE (ButtonSkeleton)
21669 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
21670
21671#else
21672G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
21673 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
21674
21675#endif
21676static void
21677button_skeleton_finalize (GObject *object)
21678{
21679 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21680 guint n;
21681 for (n = 0; n < 1; n++)
21682 g_value_unset (&skeleton->priv->properties[n]);
21683 g_free (skeleton->priv->properties);
21684 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
21685 if (skeleton->priv->changed_properties_idle_source != NULL)
21686 g_source_destroy (skeleton->priv->changed_properties_idle_source);
21687 g_main_context_unref (skeleton->priv->context);
21688 g_mutex_clear (&skeleton->priv->lock);
21689 G_OBJECT_CLASS (button_skeleton_parent_class)->finalize (object);
21690}
21691
21692static void
21693button_skeleton_get_property (GObject *object,
21694 guint prop_id,
21695 GValue *value,
21696 GParamSpec *pspec G_GNUC_UNUSED)
21697{
21698 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21699 g_assert (prop_id != 0 && prop_id - 1 < 1);
21700 g_mutex_lock (&skeleton->priv->lock);
21701 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
21702 g_mutex_unlock (&skeleton->priv->lock);
21703}
21704
21705static gboolean
21706_button_emit_changed (gpointer user_data)
21707{
21708 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
21709 GList *l;
21710 GVariantBuilder builder;
21711 GVariantBuilder invalidated_builder;
21712 guint num_changes;
21713
21714 g_mutex_lock (&skeleton->priv->lock);
21715 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
21716 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
21717 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
21718 {
21719 ChangedProperty *cp = l->data;
21720 GVariant *variant;
21721 const GValue *cur_value;
21722
21723 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
21724 if (!_g_value_equal (cur_value, &cp->orig_value))
21725 {
21726 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
21727 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
21728 g_variant_unref (variant);
21729 num_changes++;
21730 }
21731 }
21732 if (num_changes > 0)
21733 {
21734 GList *connections, *ll;
21735 GVariant *signal_variant;
21736 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Button",
21737 &builder, &invalidated_builder));
21738 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
21739 for (ll = connections; ll != NULL; ll = ll->next)
21740 {
21741 GDBusConnection *connection = ll->data;
21742
21743 g_dbus_connection_emit_signal (connection,
21744 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
21745 "org.freedesktop.DBus.Properties",
21746 "PropertiesChanged",
21747 signal_variant,
21748 NULL);
21749 }
21750 g_variant_unref (signal_variant);
21751 g_list_free_full (connections, g_object_unref);
21752 }
21753 else
21754 {
21755 g_variant_builder_clear (&builder);
21756 g_variant_builder_clear (&invalidated_builder);
21757 }
21758 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
21759 skeleton->priv->changed_properties = NULL;
21760 skeleton->priv->changed_properties_idle_source = NULL;
21761 g_mutex_unlock (&skeleton->priv->lock);
21762 return FALSE;
21763}
21764
21765static void
21766_button_schedule_emit_changed (ButtonSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
21767{
21768 ChangedProperty *cp;
21769 GList *l;
21770 cp = NULL;
21771 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
21772 {
21773 ChangedProperty *i_cp = l->data;
21774 if (i_cp->info == info)
21775 {
21776 cp = i_cp;
21777 break;
21778 }
21779 }
21780 if (cp == NULL)
21781 {
21782 cp = g_new0 (ChangedProperty, 1);
21783 cp->prop_id = prop_id;
21784 cp->info = info;
21785 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
21786 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
21787 g_value_copy (orig_value, &cp->orig_value);
21788 }
21789}
21790
21791static void
21792button_skeleton_notify (GObject *object,
21793 GParamSpec *pspec G_GNUC_UNUSED)
21794{
21795 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21796 g_mutex_lock (&skeleton->priv->lock);
21797 if (skeleton->priv->changed_properties != NULL &&
21798 skeleton->priv->changed_properties_idle_source == NULL)
21799 {
21800 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
21801 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
21802 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _button_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
21803 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
21804 g_source_unref (skeleton->priv->changed_properties_idle_source);
21805 }
21806 g_mutex_unlock (&skeleton->priv->lock);
21807}
21808
21809static void
21810button_skeleton_set_property (GObject *object,
21811 guint prop_id,
21812 const GValue *value,
21813 GParamSpec *pspec)
21814{
21815 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21816 g_assert (prop_id != 0 && prop_id - 1 < 1);
21817 g_mutex_lock (&skeleton->priv->lock);
21818 g_object_freeze_notify (object);
21819 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
21820 {
21821 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
21822 _button_schedule_emit_changed (skeleton, _button_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
21823 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
21824 g_object_notify_by_pspec (object, pspec);
21825 }
21826 g_mutex_unlock (&skeleton->priv->lock);
21827 g_object_thaw_notify (object);
21828}
21829
21830static void
21831button_skeleton_init (ButtonSkeleton *skeleton)
21832{
21833#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21834 skeleton->priv = button_skeleton_get_instance_private (skeleton);
21835#else
21836 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_BUTTON_SKELETON, ButtonSkeletonPrivate);
21837#endif
21838
21839 g_mutex_init (&skeleton->priv->lock);
21840 skeleton->priv->context = g_main_context_ref_thread_default ();
21841 skeleton->priv->properties = g_new0 (GValue, 1);
21842 g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN);
21843}
21844
21845static gboolean
21846button_skeleton_get_state (Button *object)
21847{
21848 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21849 gboolean value;
21850 g_mutex_lock (&skeleton->priv->lock);
21851 value = g_value_get_boolean (&(skeleton->priv->properties[0]));
21852 g_mutex_unlock (&skeleton->priv->lock);
21853 return value;
21854}
21855
21856static void
21857button_skeleton_class_init (ButtonSkeletonClass *klass)
21858{
21859 GObjectClass *gobject_class;
21860 GDBusInterfaceSkeletonClass *skeleton_class;
21861
21862 gobject_class = G_OBJECT_CLASS (klass);
21863 gobject_class->finalize = button_skeleton_finalize;
21864 gobject_class->get_property = button_skeleton_get_property;
21865 gobject_class->set_property = button_skeleton_set_property;
21866 gobject_class->notify = button_skeleton_notify;
21867
21868
21869 button_override_properties (gobject_class, 1);
21870
21871 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
21872 skeleton_class->get_info = button_skeleton_dbus_interface_get_info;
21873 skeleton_class->get_properties = button_skeleton_dbus_interface_get_properties;
21874 skeleton_class->flush = button_skeleton_dbus_interface_flush;
21875 skeleton_class->get_vtable = button_skeleton_dbus_interface_get_vtable;
21876
21877#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
21878 g_type_class_add_private (klass, sizeof (ButtonSkeletonPrivate));
21879#endif
21880}
21881
21882static void
21883button_skeleton_iface_init (ButtonIface *iface)
21884{
21885 iface->button_release = _button_on_signal_button_release;
21886 iface->button_pressed = _button_on_signal_button_pressed;
21887 iface->button_pressed_long = _button_on_signal_button_pressed_long;
21888 iface->get_state = button_skeleton_get_state;
21889}
21890
21891/**
21892 * button_skeleton_new:
21893 *
21894 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
21895 *
21896 * Returns: (transfer full) (type ButtonSkeleton): The skeleton object.
21897 */
21898Button *
21899button_skeleton_new (void)
21900{
21901 return BUTTON (g_object_new (TYPE_BUTTON_SKELETON, NULL));
21902}
21903
21904/* ------------------------------------------------------------------------
21905 * Code for interface org.openbmc.Led
21906 * ------------------------------------------------------------------------
21907 */
21908
21909/**
21910 * SECTION:Led
21911 * @title: Led
21912 * @short_description: Generated C code for the org.openbmc.Led D-Bus interface
21913 *
21914 * 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.
21915 */
21916
21917/* ---- Introspection data for org.openbmc.Led ---- */
21918
21919static const _ExtendedGDBusMethodInfo _led_method_info_set_on =
21920{
21921 {
21922 -1,
21923 (gchar *) "setOn",
21924 NULL,
21925 NULL,
21926 NULL
21927 },
21928 "handle-set-on",
21929 FALSE
21930};
21931
21932static const _ExtendedGDBusMethodInfo _led_method_info_set_off =
21933{
21934 {
21935 -1,
21936 (gchar *) "setOff",
21937 NULL,
21938 NULL,
21939 NULL
21940 },
21941 "handle-set-off",
21942 FALSE
21943};
21944
21945static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_slow =
21946{
21947 {
21948 -1,
21949 (gchar *) "setBlinkSlow",
21950 NULL,
21951 NULL,
21952 NULL
21953 },
21954 "handle-set-blink-slow",
21955 FALSE
21956};
21957
21958static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_fast =
21959{
21960 {
21961 -1,
21962 (gchar *) "setBlinkFast",
21963 NULL,
21964 NULL,
21965 NULL
21966 },
21967 "handle-set-blink-fast",
21968 FALSE
21969};
21970
21971static const _ExtendedGDBusMethodInfo * const _led_method_info_pointers[] =
21972{
21973 &_led_method_info_set_on,
21974 &_led_method_info_set_off,
21975 &_led_method_info_set_blink_slow,
21976 &_led_method_info_set_blink_fast,
21977 NULL
21978};
21979
21980static const _ExtendedGDBusPropertyInfo _led_property_info_color =
21981{
21982 {
21983 -1,
21984 (gchar *) "color",
21985 (gchar *) "i",
21986 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21987 NULL
21988 },
21989 "color",
21990 FALSE
21991};
21992
21993static const _ExtendedGDBusPropertyInfo _led_property_info_function =
21994{
21995 {
21996 -1,
21997 (gchar *) "function",
21998 (gchar *) "s",
21999 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
22000 NULL
22001 },
22002 "function",
22003 FALSE
22004};
22005
22006static const _ExtendedGDBusPropertyInfo * const _led_property_info_pointers[] =
22007{
22008 &_led_property_info_color,
22009 &_led_property_info_function,
22010 NULL
22011};
22012
22013static const _ExtendedGDBusInterfaceInfo _led_interface_info =
22014{
22015 {
22016 -1,
22017 (gchar *) "org.openbmc.Led",
22018 (GDBusMethodInfo **) &_led_method_info_pointers,
22019 NULL,
22020 (GDBusPropertyInfo **) &_led_property_info_pointers,
22021 NULL
22022 },
22023 "led",
22024};
22025
22026
22027/**
22028 * led_interface_info:
22029 *
22030 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> D-Bus interface.
22031 *
22032 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
22033 */
22034GDBusInterfaceInfo *
22035led_interface_info (void)
22036{
22037 return (GDBusInterfaceInfo *) &_led_interface_info.parent_struct;
22038}
22039
22040/**
22041 * led_override_properties:
22042 * @klass: The class structure for a #GObject<!-- -->-derived class.
22043 * @property_id_begin: The property id to assign to the first overridden property.
22044 *
22045 * Overrides all #GObject properties in the #Led interface for a concrete class.
22046 * The properties are overridden in the order they are defined.
22047 *
22048 * Returns: The last property id.
22049 */
22050guint
22051led_override_properties (GObjectClass *klass, guint property_id_begin)
22052{
22053 g_object_class_override_property (klass, property_id_begin++, "color");
22054 g_object_class_override_property (klass, property_id_begin++, "function");
22055 return property_id_begin - 1;
22056}
22057
22058
22059
22060/**
22061 * Led:
22062 *
22063 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
22064 */
22065
22066/**
22067 * LedIface:
22068 * @parent_iface: The parent interface.
22069 * @handle_set_blink_fast: Handler for the #Led::handle-set-blink-fast signal.
22070 * @handle_set_blink_slow: Handler for the #Led::handle-set-blink-slow signal.
22071 * @handle_set_off: Handler for the #Led::handle-set-off signal.
22072 * @handle_set_on: Handler for the #Led::handle-set-on signal.
22073 * @get_color: Getter for the #Led:color property.
22074 * @get_function: Getter for the #Led:function property.
22075 *
22076 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
22077 */
22078
22079typedef LedIface LedInterface;
22080G_DEFINE_INTERFACE (Led, led, G_TYPE_OBJECT);
22081
22082static void
22083led_default_init (LedIface *iface)
22084{
22085 /* GObject signals for incoming D-Bus method calls: */
22086 /**
22087 * Led::handle-set-on:
22088 * @object: A #Led.
22089 * @invocation: A #GDBusMethodInvocation.
22090 *
22091 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method.
22092 *
22093 * 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.
22094 *
22095 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
22096 */
22097 g_signal_new ("handle-set-on",
22098 G_TYPE_FROM_INTERFACE (iface),
22099 G_SIGNAL_RUN_LAST,
22100 G_STRUCT_OFFSET (LedIface, handle_set_on),
22101 g_signal_accumulator_true_handled,
22102 NULL,
22103 g_cclosure_marshal_generic,
22104 G_TYPE_BOOLEAN,
22105 1,
22106 G_TYPE_DBUS_METHOD_INVOCATION);
22107
22108 /**
22109 * Led::handle-set-off:
22110 * @object: A #Led.
22111 * @invocation: A #GDBusMethodInvocation.
22112 *
22113 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method.
22114 *
22115 * 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.
22116 *
22117 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
22118 */
22119 g_signal_new ("handle-set-off",
22120 G_TYPE_FROM_INTERFACE (iface),
22121 G_SIGNAL_RUN_LAST,
22122 G_STRUCT_OFFSET (LedIface, handle_set_off),
22123 g_signal_accumulator_true_handled,
22124 NULL,
22125 g_cclosure_marshal_generic,
22126 G_TYPE_BOOLEAN,
22127 1,
22128 G_TYPE_DBUS_METHOD_INVOCATION);
22129
22130 /**
22131 * Led::handle-set-blink-slow:
22132 * @object: A #Led.
22133 * @invocation: A #GDBusMethodInvocation.
22134 *
22135 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method.
22136 *
22137 * 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.
22138 *
22139 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
22140 */
22141 g_signal_new ("handle-set-blink-slow",
22142 G_TYPE_FROM_INTERFACE (iface),
22143 G_SIGNAL_RUN_LAST,
22144 G_STRUCT_OFFSET (LedIface, handle_set_blink_slow),
22145 g_signal_accumulator_true_handled,
22146 NULL,
22147 g_cclosure_marshal_generic,
22148 G_TYPE_BOOLEAN,
22149 1,
22150 G_TYPE_DBUS_METHOD_INVOCATION);
22151
22152 /**
22153 * Led::handle-set-blink-fast:
22154 * @object: A #Led.
22155 * @invocation: A #GDBusMethodInvocation.
22156 *
22157 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method.
22158 *
22159 * 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.
22160 *
22161 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
22162 */
22163 g_signal_new ("handle-set-blink-fast",
22164 G_TYPE_FROM_INTERFACE (iface),
22165 G_SIGNAL_RUN_LAST,
22166 G_STRUCT_OFFSET (LedIface, handle_set_blink_fast),
22167 g_signal_accumulator_true_handled,
22168 NULL,
22169 g_cclosure_marshal_generic,
22170 G_TYPE_BOOLEAN,
22171 1,
22172 G_TYPE_DBUS_METHOD_INVOCATION);
22173
22174 /* GObject properties for D-Bus properties: */
22175 /**
22176 * Led:color:
22177 *
22178 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link>.
22179 *
22180 * 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.
22181 */
22182 g_object_interface_install_property (iface,
22183 g_param_spec_int ("color", "color", "color", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
22184 /**
22185 * Led:function:
22186 *
22187 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link>.
22188 *
22189 * 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.
22190 */
22191 g_object_interface_install_property (iface,
22192 g_param_spec_string ("function", "function", "function", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
22193}
22194
22195/**
22196 * led_get_color: (skip)
22197 * @object: A #Led.
22198 *
22199 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property.
22200 *
22201 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22202 *
22203 * Returns: The property value.
22204 */
22205gint
22206led_get_color (Led *object)
22207{
22208 return LED_GET_IFACE (object)->get_color (object);
22209}
22210
22211/**
22212 * led_set_color: (skip)
22213 * @object: A #Led.
22214 * @value: The value to set.
22215 *
22216 * Sets the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property to @value.
22217 *
22218 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22219 */
22220void
22221led_set_color (Led *object, gint value)
22222{
22223 g_object_set (G_OBJECT (object), "color", value, NULL);
22224}
22225
22226/**
22227 * led_get_function: (skip)
22228 * @object: A #Led.
22229 *
22230 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
22231 *
22232 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22233 *
22234 * <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>
22235 *
22236 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
22237 */
22238const gchar *
22239led_get_function (Led *object)
22240{
22241 return LED_GET_IFACE (object)->get_function (object);
22242}
22243
22244/**
22245 * led_dup_function: (skip)
22246 * @object: A #Led.
22247 *
22248 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
22249 *
22250 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22251 *
22252 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22253 */
22254gchar *
22255led_dup_function (Led *object)
22256{
22257 gchar *value;
22258 g_object_get (G_OBJECT (object), "function", &value, NULL);
22259 return value;
22260}
22261
22262/**
22263 * led_set_function: (skip)
22264 * @object: A #Led.
22265 * @value: The value to set.
22266 *
22267 * Sets the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property to @value.
22268 *
22269 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22270 */
22271void
22272led_set_function (Led *object, const gchar *value)
22273{
22274 g_object_set (G_OBJECT (object), "function", value, NULL);
22275}
22276
22277/**
22278 * led_call_set_on:
22279 * @proxy: A #LedProxy.
22280 * @cancellable: (allow-none): A #GCancellable or %NULL.
22281 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22282 * @user_data: User data to pass to @callback.
22283 *
22284 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method on @proxy.
22285 * 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.
22286 * You can then call led_call_set_on_finish() to get the result of the operation.
22287 *
22288 * See led_call_set_on_sync() for the synchronous, blocking version of this method.
22289 */
22290void
22291led_call_set_on (
22292 Led *proxy,
22293 GCancellable *cancellable,
22294 GAsyncReadyCallback callback,
22295 gpointer user_data)
22296{
22297 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22298 "setOn",
22299 g_variant_new ("()"),
22300 G_DBUS_CALL_FLAGS_NONE,
22301 -1,
22302 cancellable,
22303 callback,
22304 user_data);
22305}
22306
22307/**
22308 * led_call_set_on_finish:
22309 * @proxy: A #LedProxy.
22310 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_on().
22311 * @error: Return location for error or %NULL.
22312 *
22313 * Finishes an operation started with led_call_set_on().
22314 *
22315 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22316 */
22317gboolean
22318led_call_set_on_finish (
22319 Led *proxy,
22320 GAsyncResult *res,
22321 GError **error)
22322{
22323 GVariant *_ret;
22324 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22325 if (_ret == NULL)
22326 goto _out;
22327 g_variant_get (_ret,
22328 "()");
22329 g_variant_unref (_ret);
22330_out:
22331 return _ret != NULL;
22332}
22333
22334/**
22335 * led_call_set_on_sync:
22336 * @proxy: A #LedProxy.
22337 * @cancellable: (allow-none): A #GCancellable or %NULL.
22338 * @error: Return location for error or %NULL.
22339 *
22340 * 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.
22341 *
22342 * See led_call_set_on() for the asynchronous version of this method.
22343 *
22344 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22345 */
22346gboolean
22347led_call_set_on_sync (
22348 Led *proxy,
22349 GCancellable *cancellable,
22350 GError **error)
22351{
22352 GVariant *_ret;
22353 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22354 "setOn",
22355 g_variant_new ("()"),
22356 G_DBUS_CALL_FLAGS_NONE,
22357 -1,
22358 cancellable,
22359 error);
22360 if (_ret == NULL)
22361 goto _out;
22362 g_variant_get (_ret,
22363 "()");
22364 g_variant_unref (_ret);
22365_out:
22366 return _ret != NULL;
22367}
22368
22369/**
22370 * led_call_set_off:
22371 * @proxy: A #LedProxy.
22372 * @cancellable: (allow-none): A #GCancellable or %NULL.
22373 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22374 * @user_data: User data to pass to @callback.
22375 *
22376 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method on @proxy.
22377 * 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.
22378 * You can then call led_call_set_off_finish() to get the result of the operation.
22379 *
22380 * See led_call_set_off_sync() for the synchronous, blocking version of this method.
22381 */
22382void
22383led_call_set_off (
22384 Led *proxy,
22385 GCancellable *cancellable,
22386 GAsyncReadyCallback callback,
22387 gpointer user_data)
22388{
22389 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22390 "setOff",
22391 g_variant_new ("()"),
22392 G_DBUS_CALL_FLAGS_NONE,
22393 -1,
22394 cancellable,
22395 callback,
22396 user_data);
22397}
22398
22399/**
22400 * led_call_set_off_finish:
22401 * @proxy: A #LedProxy.
22402 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_off().
22403 * @error: Return location for error or %NULL.
22404 *
22405 * Finishes an operation started with led_call_set_off().
22406 *
22407 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22408 */
22409gboolean
22410led_call_set_off_finish (
22411 Led *proxy,
22412 GAsyncResult *res,
22413 GError **error)
22414{
22415 GVariant *_ret;
22416 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22417 if (_ret == NULL)
22418 goto _out;
22419 g_variant_get (_ret,
22420 "()");
22421 g_variant_unref (_ret);
22422_out:
22423 return _ret != NULL;
22424}
22425
22426/**
22427 * led_call_set_off_sync:
22428 * @proxy: A #LedProxy.
22429 * @cancellable: (allow-none): A #GCancellable or %NULL.
22430 * @error: Return location for error or %NULL.
22431 *
22432 * 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.
22433 *
22434 * See led_call_set_off() for the asynchronous version of this method.
22435 *
22436 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22437 */
22438gboolean
22439led_call_set_off_sync (
22440 Led *proxy,
22441 GCancellable *cancellable,
22442 GError **error)
22443{
22444 GVariant *_ret;
22445 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22446 "setOff",
22447 g_variant_new ("()"),
22448 G_DBUS_CALL_FLAGS_NONE,
22449 -1,
22450 cancellable,
22451 error);
22452 if (_ret == NULL)
22453 goto _out;
22454 g_variant_get (_ret,
22455 "()");
22456 g_variant_unref (_ret);
22457_out:
22458 return _ret != NULL;
22459}
22460
22461/**
22462 * led_call_set_blink_slow:
22463 * @proxy: A #LedProxy.
22464 * @cancellable: (allow-none): A #GCancellable or %NULL.
22465 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22466 * @user_data: User data to pass to @callback.
22467 *
22468 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method on @proxy.
22469 * 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.
22470 * You can then call led_call_set_blink_slow_finish() to get the result of the operation.
22471 *
22472 * See led_call_set_blink_slow_sync() for the synchronous, blocking version of this method.
22473 */
22474void
22475led_call_set_blink_slow (
22476 Led *proxy,
22477 GCancellable *cancellable,
22478 GAsyncReadyCallback callback,
22479 gpointer user_data)
22480{
22481 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22482 "setBlinkSlow",
22483 g_variant_new ("()"),
22484 G_DBUS_CALL_FLAGS_NONE,
22485 -1,
22486 cancellable,
22487 callback,
22488 user_data);
22489}
22490
22491/**
22492 * led_call_set_blink_slow_finish:
22493 * @proxy: A #LedProxy.
22494 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_slow().
22495 * @error: Return location for error or %NULL.
22496 *
22497 * Finishes an operation started with led_call_set_blink_slow().
22498 *
22499 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22500 */
22501gboolean
22502led_call_set_blink_slow_finish (
22503 Led *proxy,
22504 GAsyncResult *res,
22505 GError **error)
22506{
22507 GVariant *_ret;
22508 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22509 if (_ret == NULL)
22510 goto _out;
22511 g_variant_get (_ret,
22512 "()");
22513 g_variant_unref (_ret);
22514_out:
22515 return _ret != NULL;
22516}
22517
22518/**
22519 * led_call_set_blink_slow_sync:
22520 * @proxy: A #LedProxy.
22521 * @cancellable: (allow-none): A #GCancellable or %NULL.
22522 * @error: Return location for error or %NULL.
22523 *
22524 * 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.
22525 *
22526 * See led_call_set_blink_slow() for the asynchronous version of this method.
22527 *
22528 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22529 */
22530gboolean
22531led_call_set_blink_slow_sync (
22532 Led *proxy,
22533 GCancellable *cancellable,
22534 GError **error)
22535{
22536 GVariant *_ret;
22537 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22538 "setBlinkSlow",
22539 g_variant_new ("()"),
22540 G_DBUS_CALL_FLAGS_NONE,
22541 -1,
22542 cancellable,
22543 error);
22544 if (_ret == NULL)
22545 goto _out;
22546 g_variant_get (_ret,
22547 "()");
22548 g_variant_unref (_ret);
22549_out:
22550 return _ret != NULL;
22551}
22552
22553/**
22554 * led_call_set_blink_fast:
22555 * @proxy: A #LedProxy.
22556 * @cancellable: (allow-none): A #GCancellable or %NULL.
22557 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22558 * @user_data: User data to pass to @callback.
22559 *
22560 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method on @proxy.
22561 * 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.
22562 * You can then call led_call_set_blink_fast_finish() to get the result of the operation.
22563 *
22564 * See led_call_set_blink_fast_sync() for the synchronous, blocking version of this method.
22565 */
22566void
22567led_call_set_blink_fast (
22568 Led *proxy,
22569 GCancellable *cancellable,
22570 GAsyncReadyCallback callback,
22571 gpointer user_data)
22572{
22573 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22574 "setBlinkFast",
22575 g_variant_new ("()"),
22576 G_DBUS_CALL_FLAGS_NONE,
22577 -1,
22578 cancellable,
22579 callback,
22580 user_data);
22581}
22582
22583/**
22584 * led_call_set_blink_fast_finish:
22585 * @proxy: A #LedProxy.
22586 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_fast().
22587 * @error: Return location for error or %NULL.
22588 *
22589 * Finishes an operation started with led_call_set_blink_fast().
22590 *
22591 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22592 */
22593gboolean
22594led_call_set_blink_fast_finish (
22595 Led *proxy,
22596 GAsyncResult *res,
22597 GError **error)
22598{
22599 GVariant *_ret;
22600 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22601 if (_ret == NULL)
22602 goto _out;
22603 g_variant_get (_ret,
22604 "()");
22605 g_variant_unref (_ret);
22606_out:
22607 return _ret != NULL;
22608}
22609
22610/**
22611 * led_call_set_blink_fast_sync:
22612 * @proxy: A #LedProxy.
22613 * @cancellable: (allow-none): A #GCancellable or %NULL.
22614 * @error: Return location for error or %NULL.
22615 *
22616 * 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.
22617 *
22618 * See led_call_set_blink_fast() for the asynchronous version of this method.
22619 *
22620 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22621 */
22622gboolean
22623led_call_set_blink_fast_sync (
22624 Led *proxy,
22625 GCancellable *cancellable,
22626 GError **error)
22627{
22628 GVariant *_ret;
22629 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22630 "setBlinkFast",
22631 g_variant_new ("()"),
22632 G_DBUS_CALL_FLAGS_NONE,
22633 -1,
22634 cancellable,
22635 error);
22636 if (_ret == NULL)
22637 goto _out;
22638 g_variant_get (_ret,
22639 "()");
22640 g_variant_unref (_ret);
22641_out:
22642 return _ret != NULL;
22643}
22644
22645/**
22646 * led_complete_set_on:
22647 * @object: A #Led.
22648 * @invocation: (transfer full): A #GDBusMethodInvocation.
22649 *
22650 * 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.
22651 *
22652 * This method will free @invocation, you cannot use it afterwards.
22653 */
22654void
22655led_complete_set_on (
22656 Led *object,
22657 GDBusMethodInvocation *invocation)
22658{
22659 g_dbus_method_invocation_return_value (invocation,
22660 g_variant_new ("()"));
22661}
22662
22663/**
22664 * led_complete_set_off:
22665 * @object: A #Led.
22666 * @invocation: (transfer full): A #GDBusMethodInvocation.
22667 *
22668 * 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.
22669 *
22670 * This method will free @invocation, you cannot use it afterwards.
22671 */
22672void
22673led_complete_set_off (
22674 Led *object,
22675 GDBusMethodInvocation *invocation)
22676{
22677 g_dbus_method_invocation_return_value (invocation,
22678 g_variant_new ("()"));
22679}
22680
22681/**
22682 * led_complete_set_blink_slow:
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.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.
22687 *
22688 * This method will free @invocation, you cannot use it afterwards.
22689 */
22690void
22691led_complete_set_blink_slow (
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_blink_fast:
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.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.
22705 *
22706 * This method will free @invocation, you cannot use it afterwards.
22707 */
22708void
22709led_complete_set_blink_fast (
22710 Led *object,
22711 GDBusMethodInvocation *invocation)
22712{
22713 g_dbus_method_invocation_return_value (invocation,
22714 g_variant_new ("()"));
22715}
22716
22717/* ------------------------------------------------------------------------ */
22718
22719/**
22720 * LedProxy:
22721 *
22722 * The #LedProxy structure contains only private data and should only be accessed using the provided API.
22723 */
22724
22725/**
22726 * LedProxyClass:
22727 * @parent_class: The parent class.
22728 *
22729 * Class structure for #LedProxy.
22730 */
22731
22732struct _LedProxyPrivate
22733{
22734 GData *qdata;
22735};
22736
22737static void led_proxy_iface_init (LedIface *iface);
22738
22739#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22740G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
22741 G_ADD_PRIVATE (LedProxy)
22742 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
22743
22744#else
22745G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
22746 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
22747
22748#endif
22749static void
22750led_proxy_finalize (GObject *object)
22751{
22752 LedProxy *proxy = LED_PROXY (object);
22753 g_datalist_clear (&proxy->priv->qdata);
22754 G_OBJECT_CLASS (led_proxy_parent_class)->finalize (object);
22755}
22756
22757static void
22758led_proxy_get_property (GObject *object,
22759 guint prop_id,
22760 GValue *value,
22761 GParamSpec *pspec G_GNUC_UNUSED)
22762{
22763 const _ExtendedGDBusPropertyInfo *info;
22764 GVariant *variant;
22765 g_assert (prop_id != 0 && prop_id - 1 < 2);
22766 info = _led_property_info_pointers[prop_id - 1];
22767 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
22768 if (info->use_gvariant)
22769 {
22770 g_value_set_variant (value, variant);
22771 }
22772 else
22773 {
22774 if (variant != NULL)
22775 g_dbus_gvariant_to_gvalue (variant, value);
22776 }
22777 if (variant != NULL)
22778 g_variant_unref (variant);
22779}
22780
22781static void
22782led_proxy_set_property_cb (GDBusProxy *proxy,
22783 GAsyncResult *res,
22784 gpointer user_data)
22785{
22786 const _ExtendedGDBusPropertyInfo *info = user_data;
22787 GError *error;
22788 GVariant *_ret;
22789 error = NULL;
22790 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
22791 if (!_ret)
22792 {
22793 g_warning ("Error setting property '%s' on interface org.openbmc.Led: %s (%s, %d)",
22794 info->parent_struct.name,
22795 error->message, g_quark_to_string (error->domain), error->code);
22796 g_error_free (error);
22797 }
22798 else
22799 {
22800 g_variant_unref (_ret);
22801 }
22802}
22803
22804static void
22805led_proxy_set_property (GObject *object,
22806 guint prop_id,
22807 const GValue *value,
22808 GParamSpec *pspec G_GNUC_UNUSED)
22809{
22810 const _ExtendedGDBusPropertyInfo *info;
22811 GVariant *variant;
22812 g_assert (prop_id != 0 && prop_id - 1 < 2);
22813 info = _led_property_info_pointers[prop_id - 1];
22814 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
22815 g_dbus_proxy_call (G_DBUS_PROXY (object),
22816 "org.freedesktop.DBus.Properties.Set",
22817 g_variant_new ("(ssv)", "org.openbmc.Led", info->parent_struct.name, variant),
22818 G_DBUS_CALL_FLAGS_NONE,
22819 -1,
22820 NULL, (GAsyncReadyCallback) led_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
22821 g_variant_unref (variant);
22822}
22823
22824static void
22825led_proxy_g_signal (GDBusProxy *proxy,
22826 const gchar *sender_name G_GNUC_UNUSED,
22827 const gchar *signal_name,
22828 GVariant *parameters)
22829{
22830 _ExtendedGDBusSignalInfo *info;
22831 GVariantIter iter;
22832 GVariant *child;
22833 GValue *paramv;
22834 guint num_params;
22835 guint n;
22836 guint signal_id;
22837 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, signal_name);
22838 if (info == NULL)
22839 return;
22840 num_params = g_variant_n_children (parameters);
22841 paramv = g_new0 (GValue, num_params + 1);
22842 g_value_init (&paramv[0], TYPE_LED);
22843 g_value_set_object (&paramv[0], proxy);
22844 g_variant_iter_init (&iter, parameters);
22845 n = 1;
22846 while ((child = g_variant_iter_next_value (&iter)) != NULL)
22847 {
22848 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
22849 if (arg_info->use_gvariant)
22850 {
22851 g_value_init (&paramv[n], G_TYPE_VARIANT);
22852 g_value_set_variant (&paramv[n], child);
22853 n++;
22854 }
22855 else
22856 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
22857 g_variant_unref (child);
22858 }
22859 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
22860 g_signal_emitv (paramv, signal_id, 0, NULL);
22861 for (n = 0; n < num_params + 1; n++)
22862 g_value_unset (&paramv[n]);
22863 g_free (paramv);
22864}
22865
22866static void
22867led_proxy_g_properties_changed (GDBusProxy *_proxy,
22868 GVariant *changed_properties,
22869 const gchar *const *invalidated_properties)
22870{
22871 LedProxy *proxy = LED_PROXY (_proxy);
22872 guint n;
22873 const gchar *key;
22874 GVariantIter *iter;
22875 _ExtendedGDBusPropertyInfo *info;
22876 g_variant_get (changed_properties, "a{sv}", &iter);
22877 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
22878 {
22879 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, key);
22880 g_datalist_remove_data (&proxy->priv->qdata, key);
22881 if (info != NULL)
22882 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
22883 }
22884 g_variant_iter_free (iter);
22885 for (n = 0; invalidated_properties[n] != NULL; n++)
22886 {
22887 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, invalidated_properties[n]);
22888 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
22889 if (info != NULL)
22890 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
22891 }
22892}
22893
22894static gint
22895led_proxy_get_color (Led *object)
22896{
22897 LedProxy *proxy = LED_PROXY (object);
22898 GVariant *variant;
22899 gint value = 0;
22900 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "color");
22901 if (variant != NULL)
22902 {
22903 value = g_variant_get_int32 (variant);
22904 g_variant_unref (variant);
22905 }
22906 return value;
22907}
22908
22909static const gchar *
22910led_proxy_get_function (Led *object)
22911{
22912 LedProxy *proxy = LED_PROXY (object);
22913 GVariant *variant;
22914 const gchar *value = NULL;
22915 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "function");
22916 if (variant != NULL)
22917 {
22918 value = g_variant_get_string (variant, NULL);
22919 g_variant_unref (variant);
22920 }
22921 return value;
22922}
22923
22924static void
22925led_proxy_init (LedProxy *proxy)
22926{
22927#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22928 proxy->priv = led_proxy_get_instance_private (proxy);
22929#else
22930 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_LED_PROXY, LedProxyPrivate);
22931#endif
22932
22933 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), led_interface_info ());
22934}
22935
22936static void
22937led_proxy_class_init (LedProxyClass *klass)
22938{
22939 GObjectClass *gobject_class;
22940 GDBusProxyClass *proxy_class;
22941
22942 gobject_class = G_OBJECT_CLASS (klass);
22943 gobject_class->finalize = led_proxy_finalize;
22944 gobject_class->get_property = led_proxy_get_property;
22945 gobject_class->set_property = led_proxy_set_property;
22946
22947 proxy_class = G_DBUS_PROXY_CLASS (klass);
22948 proxy_class->g_signal = led_proxy_g_signal;
22949 proxy_class->g_properties_changed = led_proxy_g_properties_changed;
22950
22951 led_override_properties (gobject_class, 1);
22952
22953#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
22954 g_type_class_add_private (klass, sizeof (LedProxyPrivate));
22955#endif
22956}
22957
22958static void
22959led_proxy_iface_init (LedIface *iface)
22960{
22961 iface->get_color = led_proxy_get_color;
22962 iface->get_function = led_proxy_get_function;
22963}
22964
22965/**
22966 * led_proxy_new:
22967 * @connection: A #GDBusConnection.
22968 * @flags: Flags from the #GDBusProxyFlags enumeration.
22969 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
22970 * @object_path: An object path.
22971 * @cancellable: (allow-none): A #GCancellable or %NULL.
22972 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
22973 * @user_data: User data to pass to @callback.
22974 *
22975 * 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.
22976 *
22977 * 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.
22978 * You can then call led_proxy_new_finish() to get the result of the operation.
22979 *
22980 * See led_proxy_new_sync() for the synchronous, blocking version of this constructor.
22981 */
22982void
22983led_proxy_new (
22984 GDBusConnection *connection,
22985 GDBusProxyFlags flags,
22986 const gchar *name,
22987 const gchar *object_path,
22988 GCancellable *cancellable,
22989 GAsyncReadyCallback callback,
22990 gpointer user_data)
22991{
22992 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);
22993}
22994
22995/**
22996 * led_proxy_new_finish:
22997 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new().
22998 * @error: Return location for error or %NULL
22999 *
23000 * Finishes an operation started with led_proxy_new().
23001 *
23002 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
23003 */
23004Led *
23005led_proxy_new_finish (
23006 GAsyncResult *res,
23007 GError **error)
23008{
23009 GObject *ret;
23010 GObject *source_object;
23011 source_object = g_async_result_get_source_object (res);
23012 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
23013 g_object_unref (source_object);
23014 if (ret != NULL)
23015 return LED (ret);
23016 else
23017 return NULL;
23018}
23019
23020/**
23021 * led_proxy_new_sync:
23022 * @connection: A #GDBusConnection.
23023 * @flags: Flags from the #GDBusProxyFlags enumeration.
23024 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
23025 * @object_path: An object path.
23026 * @cancellable: (allow-none): A #GCancellable or %NULL.
23027 * @error: Return location for error or %NULL
23028 *
23029 * 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.
23030 *
23031 * The calling thread is blocked until a reply is received.
23032 *
23033 * See led_proxy_new() for the asynchronous version of this constructor.
23034 *
23035 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
23036 */
23037Led *
23038led_proxy_new_sync (
23039 GDBusConnection *connection,
23040 GDBusProxyFlags flags,
23041 const gchar *name,
23042 const gchar *object_path,
23043 GCancellable *cancellable,
23044 GError **error)
23045{
23046 GInitable *ret;
23047 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);
23048 if (ret != NULL)
23049 return LED (ret);
23050 else
23051 return NULL;
23052}
23053
23054
23055/**
23056 * led_proxy_new_for_bus:
23057 * @bus_type: A #GBusType.
23058 * @flags: Flags from the #GDBusProxyFlags enumeration.
23059 * @name: A bus name (well-known or unique).
23060 * @object_path: An object path.
23061 * @cancellable: (allow-none): A #GCancellable or %NULL.
23062 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
23063 * @user_data: User data to pass to @callback.
23064 *
23065 * Like led_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
23066 *
23067 * 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.
23068 * You can then call led_proxy_new_for_bus_finish() to get the result of the operation.
23069 *
23070 * See led_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
23071 */
23072void
23073led_proxy_new_for_bus (
23074 GBusType bus_type,
23075 GDBusProxyFlags flags,
23076 const gchar *name,
23077 const gchar *object_path,
23078 GCancellable *cancellable,
23079 GAsyncReadyCallback callback,
23080 gpointer user_data)
23081{
23082 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);
23083}
23084
23085/**
23086 * led_proxy_new_for_bus_finish:
23087 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new_for_bus().
23088 * @error: Return location for error or %NULL
23089 *
23090 * Finishes an operation started with led_proxy_new_for_bus().
23091 *
23092 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
23093 */
23094Led *
23095led_proxy_new_for_bus_finish (
23096 GAsyncResult *res,
23097 GError **error)
23098{
23099 GObject *ret;
23100 GObject *source_object;
23101 source_object = g_async_result_get_source_object (res);
23102 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
23103 g_object_unref (source_object);
23104 if (ret != NULL)
23105 return LED (ret);
23106 else
23107 return NULL;
23108}
23109
23110/**
23111 * led_proxy_new_for_bus_sync:
23112 * @bus_type: A #GBusType.
23113 * @flags: Flags from the #GDBusProxyFlags enumeration.
23114 * @name: A bus name (well-known or unique).
23115 * @object_path: An object path.
23116 * @cancellable: (allow-none): A #GCancellable or %NULL.
23117 * @error: Return location for error or %NULL
23118 *
23119 * Like led_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
23120 *
23121 * The calling thread is blocked until a reply is received.
23122 *
23123 * See led_proxy_new_for_bus() for the asynchronous version of this constructor.
23124 *
23125 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
23126 */
23127Led *
23128led_proxy_new_for_bus_sync (
23129 GBusType bus_type,
23130 GDBusProxyFlags flags,
23131 const gchar *name,
23132 const gchar *object_path,
23133 GCancellable *cancellable,
23134 GError **error)
23135{
23136 GInitable *ret;
23137 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);
23138 if (ret != NULL)
23139 return LED (ret);
23140 else
23141 return NULL;
23142}
23143
23144
23145/* ------------------------------------------------------------------------ */
23146
23147/**
23148 * LedSkeleton:
23149 *
23150 * The #LedSkeleton structure contains only private data and should only be accessed using the provided API.
23151 */
23152
23153/**
23154 * LedSkeletonClass:
23155 * @parent_class: The parent class.
23156 *
23157 * Class structure for #LedSkeleton.
23158 */
23159
23160struct _LedSkeletonPrivate
23161{
23162 GValue *properties;
23163 GList *changed_properties;
23164 GSource *changed_properties_idle_source;
23165 GMainContext *context;
23166 GMutex lock;
23167};
23168
23169static void
23170_led_skeleton_handle_method_call (
23171 GDBusConnection *connection G_GNUC_UNUSED,
23172 const gchar *sender G_GNUC_UNUSED,
23173 const gchar *object_path G_GNUC_UNUSED,
23174 const gchar *interface_name,
23175 const gchar *method_name,
23176 GVariant *parameters,
23177 GDBusMethodInvocation *invocation,
23178 gpointer user_data)
23179{
23180 LedSkeleton *skeleton = LED_SKELETON (user_data);
23181 _ExtendedGDBusMethodInfo *info;
23182 GVariantIter iter;
23183 GVariant *child;
23184 GValue *paramv;
23185 guint num_params;
23186 guint num_extra;
23187 guint n;
23188 guint signal_id;
23189 GValue return_value = G_VALUE_INIT;
23190 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
23191 g_assert (info != NULL);
23192 num_params = g_variant_n_children (parameters);
23193 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
23194 n = 0;
23195 g_value_init (&paramv[n], TYPE_LED);
23196 g_value_set_object (&paramv[n++], skeleton);
23197 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
23198 g_value_set_object (&paramv[n++], invocation);
23199 if (info->pass_fdlist)
23200 {
23201#ifdef G_OS_UNIX
23202 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
23203 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
23204#else
23205 g_assert_not_reached ();
23206#endif
23207 }
23208 g_variant_iter_init (&iter, parameters);
23209 while ((child = g_variant_iter_next_value (&iter)) != NULL)
23210 {
23211 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
23212 if (arg_info->use_gvariant)
23213 {
23214 g_value_init (&paramv[n], G_TYPE_VARIANT);
23215 g_value_set_variant (&paramv[n], child);
23216 n++;
23217 }
23218 else
23219 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
23220 g_variant_unref (child);
23221 }
23222 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
23223 g_value_init (&return_value, G_TYPE_BOOLEAN);
23224 g_signal_emitv (paramv, signal_id, 0, &return_value);
23225 if (!g_value_get_boolean (&return_value))
23226 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);
23227 g_value_unset (&return_value);
23228 for (n = 0; n < num_params + num_extra; n++)
23229 g_value_unset (&paramv[n]);
23230 g_free (paramv);
23231}
23232
23233static GVariant *
23234_led_skeleton_handle_get_property (
23235 GDBusConnection *connection G_GNUC_UNUSED,
23236 const gchar *sender G_GNUC_UNUSED,
23237 const gchar *object_path G_GNUC_UNUSED,
23238 const gchar *interface_name G_GNUC_UNUSED,
23239 const gchar *property_name,
23240 GError **error,
23241 gpointer user_data)
23242{
23243 LedSkeleton *skeleton = LED_SKELETON (user_data);
23244 GValue value = G_VALUE_INIT;
23245 GParamSpec *pspec;
23246 _ExtendedGDBusPropertyInfo *info;
23247 GVariant *ret;
23248 ret = NULL;
23249 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
23250 g_assert (info != NULL);
23251 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
23252 if (pspec == NULL)
23253 {
23254 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
23255 }
23256 else
23257 {
23258 g_value_init (&value, pspec->value_type);
23259 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
23260 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
23261 g_value_unset (&value);
23262 }
23263 return ret;
23264}
23265
23266static gboolean
23267_led_skeleton_handle_set_property (
23268 GDBusConnection *connection G_GNUC_UNUSED,
23269 const gchar *sender G_GNUC_UNUSED,
23270 const gchar *object_path G_GNUC_UNUSED,
23271 const gchar *interface_name G_GNUC_UNUSED,
23272 const gchar *property_name,
23273 GVariant *variant,
23274 GError **error,
23275 gpointer user_data)
23276{
23277 LedSkeleton *skeleton = LED_SKELETON (user_data);
23278 GValue value = G_VALUE_INIT;
23279 GParamSpec *pspec;
23280 _ExtendedGDBusPropertyInfo *info;
23281 gboolean ret;
23282 ret = FALSE;
23283 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
23284 g_assert (info != NULL);
23285 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
23286 if (pspec == NULL)
23287 {
23288 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
23289 }
23290 else
23291 {
23292 if (info->use_gvariant)
23293 g_value_set_variant (&value, variant);
23294 else
23295 g_dbus_gvariant_to_gvalue (variant, &value);
23296 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
23297 g_value_unset (&value);
23298 ret = TRUE;
23299 }
23300 return ret;
23301}
23302
23303static const GDBusInterfaceVTable _led_skeleton_vtable =
23304{
23305 _led_skeleton_handle_method_call,
23306 _led_skeleton_handle_get_property,
23307 _led_skeleton_handle_set_property,
23308 {NULL}
23309};
23310
23311static GDBusInterfaceInfo *
23312led_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
23313{
23314 return led_interface_info ();
23315}
23316
23317static GDBusInterfaceVTable *
23318led_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
23319{
23320 return (GDBusInterfaceVTable *) &_led_skeleton_vtable;
23321}
23322
23323static GVariant *
23324led_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
23325{
23326 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
23327
23328 GVariantBuilder builder;
23329 guint n;
23330 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
23331 if (_led_interface_info.parent_struct.properties == NULL)
23332 goto out;
23333 for (n = 0; _led_interface_info.parent_struct.properties[n] != NULL; n++)
23334 {
23335 GDBusPropertyInfo *info = _led_interface_info.parent_struct.properties[n];
23336 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
23337 {
23338 GVariant *value;
23339 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);
23340 if (value != NULL)
23341 {
23342 g_variant_take_ref (value);
23343 g_variant_builder_add (&builder, "{sv}", info->name, value);
23344 g_variant_unref (value);
23345 }
23346 }
23347 }
23348out:
23349 return g_variant_builder_end (&builder);
23350}
23351
23352static gboolean _led_emit_changed (gpointer user_data);
23353
23354static void
23355led_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
23356{
23357 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
23358 gboolean emit_changed = FALSE;
23359
23360 g_mutex_lock (&skeleton->priv->lock);
23361 if (skeleton->priv->changed_properties_idle_source != NULL)
23362 {
23363 g_source_destroy (skeleton->priv->changed_properties_idle_source);
23364 skeleton->priv->changed_properties_idle_source = NULL;
23365 emit_changed = TRUE;
23366 }
23367 g_mutex_unlock (&skeleton->priv->lock);
23368
23369 if (emit_changed)
23370 _led_emit_changed (skeleton);
23371}
23372
23373static void led_skeleton_iface_init (LedIface *iface);
23374#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23375G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
23376 G_ADD_PRIVATE (LedSkeleton)
23377 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
23378
23379#else
23380G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
23381 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
23382
23383#endif
23384static void
23385led_skeleton_finalize (GObject *object)
23386{
23387 LedSkeleton *skeleton = LED_SKELETON (object);
23388 guint n;
23389 for (n = 0; n < 2; n++)
23390 g_value_unset (&skeleton->priv->properties[n]);
23391 g_free (skeleton->priv->properties);
23392 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
23393 if (skeleton->priv->changed_properties_idle_source != NULL)
23394 g_source_destroy (skeleton->priv->changed_properties_idle_source);
23395 g_main_context_unref (skeleton->priv->context);
23396 g_mutex_clear (&skeleton->priv->lock);
23397 G_OBJECT_CLASS (led_skeleton_parent_class)->finalize (object);
23398}
23399
23400static void
23401led_skeleton_get_property (GObject *object,
23402 guint prop_id,
23403 GValue *value,
23404 GParamSpec *pspec G_GNUC_UNUSED)
23405{
23406 LedSkeleton *skeleton = LED_SKELETON (object);
23407 g_assert (prop_id != 0 && prop_id - 1 < 2);
23408 g_mutex_lock (&skeleton->priv->lock);
23409 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
23410 g_mutex_unlock (&skeleton->priv->lock);
23411}
23412
23413static gboolean
23414_led_emit_changed (gpointer user_data)
23415{
23416 LedSkeleton *skeleton = LED_SKELETON (user_data);
23417 GList *l;
23418 GVariantBuilder builder;
23419 GVariantBuilder invalidated_builder;
23420 guint num_changes;
23421
23422 g_mutex_lock (&skeleton->priv->lock);
23423 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
23424 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
23425 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
23426 {
23427 ChangedProperty *cp = l->data;
23428 GVariant *variant;
23429 const GValue *cur_value;
23430
23431 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
23432 if (!_g_value_equal (cur_value, &cp->orig_value))
23433 {
23434 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
23435 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
23436 g_variant_unref (variant);
23437 num_changes++;
23438 }
23439 }
23440 if (num_changes > 0)
23441 {
23442 GList *connections, *ll;
23443 GVariant *signal_variant;
23444 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Led",
23445 &builder, &invalidated_builder));
23446 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
23447 for (ll = connections; ll != NULL; ll = ll->next)
23448 {
23449 GDBusConnection *connection = ll->data;
23450
23451 g_dbus_connection_emit_signal (connection,
23452 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
23453 "org.freedesktop.DBus.Properties",
23454 "PropertiesChanged",
23455 signal_variant,
23456 NULL);
23457 }
23458 g_variant_unref (signal_variant);
23459 g_list_free_full (connections, g_object_unref);
23460 }
23461 else
23462 {
23463 g_variant_builder_clear (&builder);
23464 g_variant_builder_clear (&invalidated_builder);
23465 }
23466 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
23467 skeleton->priv->changed_properties = NULL;
23468 skeleton->priv->changed_properties_idle_source = NULL;
23469 g_mutex_unlock (&skeleton->priv->lock);
23470 return FALSE;
23471}
23472
23473static void
23474_led_schedule_emit_changed (LedSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
23475{
23476 ChangedProperty *cp;
23477 GList *l;
23478 cp = NULL;
23479 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
23480 {
23481 ChangedProperty *i_cp = l->data;
23482 if (i_cp->info == info)
23483 {
23484 cp = i_cp;
23485 break;
23486 }
23487 }
23488 if (cp == NULL)
23489 {
23490 cp = g_new0 (ChangedProperty, 1);
23491 cp->prop_id = prop_id;
23492 cp->info = info;
23493 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
23494 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
23495 g_value_copy (orig_value, &cp->orig_value);
23496 }
23497}
23498
23499static void
23500led_skeleton_notify (GObject *object,
23501 GParamSpec *pspec G_GNUC_UNUSED)
23502{
23503 LedSkeleton *skeleton = LED_SKELETON (object);
23504 g_mutex_lock (&skeleton->priv->lock);
23505 if (skeleton->priv->changed_properties != NULL &&
23506 skeleton->priv->changed_properties_idle_source == NULL)
23507 {
23508 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
23509 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
23510 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _led_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
23511 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
23512 g_source_unref (skeleton->priv->changed_properties_idle_source);
23513 }
23514 g_mutex_unlock (&skeleton->priv->lock);
23515}
23516
23517static void
23518led_skeleton_set_property (GObject *object,
23519 guint prop_id,
23520 const GValue *value,
23521 GParamSpec *pspec)
23522{
23523 LedSkeleton *skeleton = LED_SKELETON (object);
23524 g_assert (prop_id != 0 && prop_id - 1 < 2);
23525 g_mutex_lock (&skeleton->priv->lock);
23526 g_object_freeze_notify (object);
23527 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
23528 {
23529 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
23530 _led_schedule_emit_changed (skeleton, _led_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
23531 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
23532 g_object_notify_by_pspec (object, pspec);
23533 }
23534 g_mutex_unlock (&skeleton->priv->lock);
23535 g_object_thaw_notify (object);
23536}
23537
23538static void
23539led_skeleton_init (LedSkeleton *skeleton)
23540{
23541#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23542 skeleton->priv = led_skeleton_get_instance_private (skeleton);
23543#else
23544 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_LED_SKELETON, LedSkeletonPrivate);
23545#endif
23546
23547 g_mutex_init (&skeleton->priv->lock);
23548 skeleton->priv->context = g_main_context_ref_thread_default ();
23549 skeleton->priv->properties = g_new0 (GValue, 2);
23550 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
23551 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
23552}
23553
23554static gint
23555led_skeleton_get_color (Led *object)
23556{
23557 LedSkeleton *skeleton = LED_SKELETON (object);
23558 gint value;
23559 g_mutex_lock (&skeleton->priv->lock);
23560 value = g_value_get_int (&(skeleton->priv->properties[0]));
23561 g_mutex_unlock (&skeleton->priv->lock);
23562 return value;
23563}
23564
23565static const gchar *
23566led_skeleton_get_function (Led *object)
23567{
23568 LedSkeleton *skeleton = LED_SKELETON (object);
23569 const gchar *value;
23570 g_mutex_lock (&skeleton->priv->lock);
23571 value = g_value_get_string (&(skeleton->priv->properties[1]));
23572 g_mutex_unlock (&skeleton->priv->lock);
23573 return value;
23574}
23575
23576static void
23577led_skeleton_class_init (LedSkeletonClass *klass)
23578{
23579 GObjectClass *gobject_class;
23580 GDBusInterfaceSkeletonClass *skeleton_class;
23581
23582 gobject_class = G_OBJECT_CLASS (klass);
23583 gobject_class->finalize = led_skeleton_finalize;
23584 gobject_class->get_property = led_skeleton_get_property;
23585 gobject_class->set_property = led_skeleton_set_property;
23586 gobject_class->notify = led_skeleton_notify;
23587
23588
23589 led_override_properties (gobject_class, 1);
23590
23591 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
23592 skeleton_class->get_info = led_skeleton_dbus_interface_get_info;
23593 skeleton_class->get_properties = led_skeleton_dbus_interface_get_properties;
23594 skeleton_class->flush = led_skeleton_dbus_interface_flush;
23595 skeleton_class->get_vtable = led_skeleton_dbus_interface_get_vtable;
23596
23597#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
23598 g_type_class_add_private (klass, sizeof (LedSkeletonPrivate));
23599#endif
23600}
23601
23602static void
23603led_skeleton_iface_init (LedIface *iface)
23604{
23605 iface->get_color = led_skeleton_get_color;
23606 iface->get_function = led_skeleton_get_function;
23607}
23608
23609/**
23610 * led_skeleton_new:
23611 *
23612 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
23613 *
23614 * Returns: (transfer full) (type LedSkeleton): The skeleton object.
23615 */
23616Led *
23617led_skeleton_new (void)
23618{
23619 return LED (g_object_new (TYPE_LED_SKELETON, NULL));
23620}
23621
23622/* ------------------------------------------------------------------------
23623 * Code for Object, ObjectProxy and ObjectSkeleton
23624 * ------------------------------------------------------------------------
23625 */
23626
23627/**
23628 * SECTION:Object
23629 * @title: Object
23630 * @short_description: Specialized GDBusObject types
23631 *
23632 * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
23633 */
23634
23635/**
23636 * Object:
23637 *
23638 * The #Object type is a specialized container of interfaces.
23639 */
23640
23641/**
23642 * ObjectIface:
23643 * @parent_iface: The parent interface.
23644 *
23645 * Virtual table for the #Object interface.
23646 */
23647
23648typedef ObjectIface ObjectInterface;
23649G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));
23650
23651static void
23652object_default_init (ObjectIface *iface)
23653{
23654 /**
23655 * Object:occ:
23656 *
23657 * 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.
23658 *
23659 * Connect to the #GObject::notify signal to get informed of property changes.
23660 */
23661 g_object_interface_install_property (iface, g_param_spec_object ("occ", "occ", "occ", TYPE_OCC, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23662
23663 /**
23664 * Object:fan:
23665 *
23666 * 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.
23667 *
23668 * Connect to the #GObject::notify signal to get informed of property changes.
23669 */
23670 g_object_interface_install_property (iface, g_param_spec_object ("fan", "fan", "fan", TYPE_FAN, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23671
23672 /**
23673 * Object:sensor-value:
23674 *
23675 * 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.
23676 *
23677 * Connect to the #GObject::notify signal to get informed of property changes.
23678 */
23679 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));
23680
23681 /**
23682 * Object:sensor-threshold:
23683 *
23684 * 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.
23685 *
23686 * Connect to the #GObject::notify signal to get informed of property changes.
23687 */
23688 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));
23689
23690 /**
23691 * Object:sensor-i2c:
23692 *
23693 * 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.
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 ("sensor-i2c", "sensor-i2c", "sensor-i2c", TYPE_SENSOR_I2C, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23698
23699 /**
23700 * Object:sensor-match:
23701 *
23702 * 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.
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 ("sensor-match", "sensor-match", "sensor-match", TYPE_SENSOR_MATCH, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23707
23708 /**
23709 * Object:process:
23710 *
23711 * 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.
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 ("process", "process", "process", TYPE_PROCESS, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23716
23717 /**
23718 * Object:control:
23719 *
23720 * 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.
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 ("control", "control", "control", TYPE_CONTROL, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23725
23726 /**
23727 * Object:control-bmc:
23728 *
23729 * 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.
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 ("control-bmc", "control-bmc", "control-bmc", TYPE_CONTROL_BMC, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23734
23735 /**
23736 * Object:control-host:
23737 *
23738 * 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.
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 ("control-host", "control-host", "control-host", TYPE_CONTROL_HOST, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23743
23744 /**
23745 * Object:control-power:
23746 *
23747 * 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.
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 ("control-power", "control-power", "control-power", TYPE_CONTROL_POWER, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23752
23753 /**
23754 * Object:watchdog:
23755 *
23756 * 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.
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 ("watchdog", "watchdog", "watchdog", TYPE_WATCHDOG, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23761
23762 /**
23763 * Object:event-log:
23764 *
23765 * 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.
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 ("event-log", "event-log", "event-log", TYPE_EVENT_LOG, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23770
23771 /**
23772 * Object:flash:
23773 *
23774 * 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.
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 ("flash", "flash", "flash", TYPE_FLASH, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23779
23780 /**
23781 * Object:button:
23782 *
23783 * 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.
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 ("button", "button", "button", TYPE_BUTTON, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23788
23789 /**
23790 * Object:led:
23791 *
23792 * 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.
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 ("led", "led", "led", TYPE_LED, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23797
23798}
23799
23800/**
23801 * object_get_occ:
23802 * @object: A #Object.
23803 *
23804 * 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.
23805 *
23806 * Returns: (transfer full): A #Occ that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23807 */
23808Occ *object_get_occ (Object *object)
23809{
23810 GDBusInterface *ret;
23811 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
23812 if (ret == NULL)
23813 return NULL;
23814 return OCC (ret);
23815}
23816
23817/**
23818 * object_get_fan:
23819 * @object: A #Object.
23820 *
23821 * 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.
23822 *
23823 * Returns: (transfer full): A #Fan that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23824 */
23825Fan *object_get_fan (Object *object)
23826{
23827 GDBusInterface *ret;
23828 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
23829 if (ret == NULL)
23830 return NULL;
23831 return FAN (ret);
23832}
23833
23834/**
23835 * object_get_sensor_value:
23836 * @object: A #Object.
23837 *
23838 * 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.
23839 *
23840 * Returns: (transfer full): A #SensorValue that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23841 */
23842SensorValue *object_get_sensor_value (Object *object)
23843{
23844 GDBusInterface *ret;
23845 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
23846 if (ret == NULL)
23847 return NULL;
23848 return SENSOR_VALUE (ret);
23849}
23850
23851/**
23852 * object_get_sensor_threshold:
23853 * @object: A #Object.
23854 *
23855 * 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.
23856 *
23857 * Returns: (transfer full): A #SensorThreshold that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23858 */
23859SensorThreshold *object_get_sensor_threshold (Object *object)
23860{
23861 GDBusInterface *ret;
23862 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
23863 if (ret == NULL)
23864 return NULL;
23865 return SENSOR_THRESHOLD (ret);
23866}
23867
23868/**
23869 * object_get_sensor_i2c:
23870 * @object: A #Object.
23871 *
23872 * 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.
23873 *
23874 * Returns: (transfer full): A #SensorI2c that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23875 */
23876SensorI2c *object_get_sensor_i2c (Object *object)
23877{
23878 GDBusInterface *ret;
23879 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
23880 if (ret == NULL)
23881 return NULL;
23882 return SENSOR_I2C (ret);
23883}
23884
23885/**
23886 * object_get_sensor_match:
23887 * @object: A #Object.
23888 *
23889 * 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.
23890 *
23891 * Returns: (transfer full): A #SensorMatch that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23892 */
23893SensorMatch *object_get_sensor_match (Object *object)
23894{
23895 GDBusInterface *ret;
23896 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
23897 if (ret == NULL)
23898 return NULL;
23899 return SENSOR_MATCH (ret);
23900}
23901
23902/**
23903 * object_get_process:
23904 * @object: A #Object.
23905 *
23906 * 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.
23907 *
23908 * Returns: (transfer full): A #Process that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23909 */
23910Process *object_get_process (Object *object)
23911{
23912 GDBusInterface *ret;
23913 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
23914 if (ret == NULL)
23915 return NULL;
23916 return PROCESS (ret);
23917}
23918
23919/**
23920 * object_get_control:
23921 * @object: A #Object.
23922 *
23923 * 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.
23924 *
23925 * Returns: (transfer full): A #Control that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23926 */
23927Control *object_get_control (Object *object)
23928{
23929 GDBusInterface *ret;
23930 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
23931 if (ret == NULL)
23932 return NULL;
23933 return CONTROL (ret);
23934}
23935
23936/**
23937 * object_get_control_bmc:
23938 * @object: A #Object.
23939 *
23940 * 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.
23941 *
23942 * Returns: (transfer full): A #ControlBmc that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23943 */
23944ControlBmc *object_get_control_bmc (Object *object)
23945{
23946 GDBusInterface *ret;
23947 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
23948 if (ret == NULL)
23949 return NULL;
23950 return CONTROL_BMC (ret);
23951}
23952
23953/**
23954 * object_get_control_host:
23955 * @object: A #Object.
23956 *
23957 * 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.
23958 *
23959 * Returns: (transfer full): A #ControlHost that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23960 */
23961ControlHost *object_get_control_host (Object *object)
23962{
23963 GDBusInterface *ret;
23964 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
23965 if (ret == NULL)
23966 return NULL;
23967 return CONTROL_HOST (ret);
23968}
23969
23970/**
23971 * object_get_control_power:
23972 * @object: A #Object.
23973 *
23974 * 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.
23975 *
23976 * Returns: (transfer full): A #ControlPower that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23977 */
23978ControlPower *object_get_control_power (Object *object)
23979{
23980 GDBusInterface *ret;
23981 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
23982 if (ret == NULL)
23983 return NULL;
23984 return CONTROL_POWER (ret);
23985}
23986
23987/**
23988 * object_get_watchdog:
23989 * @object: A #Object.
23990 *
23991 * 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.
23992 *
23993 * Returns: (transfer full): A #Watchdog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23994 */
23995Watchdog *object_get_watchdog (Object *object)
23996{
23997 GDBusInterface *ret;
23998 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
23999 if (ret == NULL)
24000 return NULL;
24001 return WATCHDOG (ret);
24002}
24003
24004/**
24005 * object_get_event_log:
24006 * @object: A #Object.
24007 *
24008 * 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.
24009 *
24010 * Returns: (transfer full): A #EventLog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24011 */
24012EventLog *object_get_event_log (Object *object)
24013{
24014 GDBusInterface *ret;
24015 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
24016 if (ret == NULL)
24017 return NULL;
24018 return EVENT_LOG (ret);
24019}
24020
24021/**
24022 * object_get_flash:
24023 * @object: A #Object.
24024 *
24025 * 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.
24026 *
24027 * Returns: (transfer full): A #Flash that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24028 */
24029Flash *object_get_flash (Object *object)
24030{
24031 GDBusInterface *ret;
24032 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
24033 if (ret == NULL)
24034 return NULL;
24035 return FLASH (ret);
24036}
24037
24038/**
24039 * object_get_button:
24040 * @object: A #Object.
24041 *
24042 * 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.
24043 *
24044 * Returns: (transfer full): A #Button that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24045 */
24046Button *object_get_button (Object *object)
24047{
24048 GDBusInterface *ret;
24049 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
24050 if (ret == NULL)
24051 return NULL;
24052 return BUTTON (ret);
24053}
24054
24055/**
24056 * object_get_led:
24057 * @object: A #Object.
24058 *
24059 * 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.
24060 *
24061 * Returns: (transfer full): A #Led that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24062 */
24063Led *object_get_led (Object *object)
24064{
24065 GDBusInterface *ret;
24066 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
24067 if (ret == NULL)
24068 return NULL;
24069 return LED (ret);
24070}
24071
24072
24073/**
24074 * object_peek_occ: (skip)
24075 * @object: A #Object.
24076 *
24077 * Like object_get_occ() but doesn't increase the reference count on the returned object.
24078 *
24079 * <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>
24080 *
24081 * 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.
24082 */
24083Occ *object_peek_occ (Object *object)
24084{
24085 GDBusInterface *ret;
24086 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
24087 if (ret == NULL)
24088 return NULL;
24089 g_object_unref (ret);
24090 return OCC (ret);
24091}
24092
24093/**
24094 * object_peek_fan: (skip)
24095 * @object: A #Object.
24096 *
24097 * Like object_get_fan() but doesn't increase the reference count on the returned object.
24098 *
24099 * <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>
24100 *
24101 * 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.
24102 */
24103Fan *object_peek_fan (Object *object)
24104{
24105 GDBusInterface *ret;
24106 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
24107 if (ret == NULL)
24108 return NULL;
24109 g_object_unref (ret);
24110 return FAN (ret);
24111}
24112
24113/**
24114 * object_peek_sensor_value: (skip)
24115 * @object: A #Object.
24116 *
24117 * Like object_get_sensor_value() but doesn't increase the reference count on the returned object.
24118 *
24119 * <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>
24120 *
24121 * 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.
24122 */
24123SensorValue *object_peek_sensor_value (Object *object)
24124{
24125 GDBusInterface *ret;
24126 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
24127 if (ret == NULL)
24128 return NULL;
24129 g_object_unref (ret);
24130 return SENSOR_VALUE (ret);
24131}
24132
24133/**
24134 * object_peek_sensor_threshold: (skip)
24135 * @object: A #Object.
24136 *
24137 * Like object_get_sensor_threshold() but doesn't increase the reference count on the returned object.
24138 *
24139 * <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>
24140 *
24141 * 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.
24142 */
24143SensorThreshold *object_peek_sensor_threshold (Object *object)
24144{
24145 GDBusInterface *ret;
24146 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
24147 if (ret == NULL)
24148 return NULL;
24149 g_object_unref (ret);
24150 return SENSOR_THRESHOLD (ret);
24151}
24152
24153/**
24154 * object_peek_sensor_i2c: (skip)
24155 * @object: A #Object.
24156 *
24157 * Like object_get_sensor_i2c() but doesn't increase the reference count on the returned object.
24158 *
24159 * <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>
24160 *
24161 * 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.
24162 */
24163SensorI2c *object_peek_sensor_i2c (Object *object)
24164{
24165 GDBusInterface *ret;
24166 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
24167 if (ret == NULL)
24168 return NULL;
24169 g_object_unref (ret);
24170 return SENSOR_I2C (ret);
24171}
24172
24173/**
24174 * object_peek_sensor_match: (skip)
24175 * @object: A #Object.
24176 *
24177 * Like object_get_sensor_match() but doesn't increase the reference count on the returned object.
24178 *
24179 * <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>
24180 *
24181 * 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.
24182 */
24183SensorMatch *object_peek_sensor_match (Object *object)
24184{
24185 GDBusInterface *ret;
24186 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
24187 if (ret == NULL)
24188 return NULL;
24189 g_object_unref (ret);
24190 return SENSOR_MATCH (ret);
24191}
24192
24193/**
24194 * object_peek_process: (skip)
24195 * @object: A #Object.
24196 *
24197 * Like object_get_process() but doesn't increase the reference count on the returned object.
24198 *
24199 * <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>
24200 *
24201 * 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.
24202 */
24203Process *object_peek_process (Object *object)
24204{
24205 GDBusInterface *ret;
24206 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
24207 if (ret == NULL)
24208 return NULL;
24209 g_object_unref (ret);
24210 return PROCESS (ret);
24211}
24212
24213/**
24214 * object_peek_control: (skip)
24215 * @object: A #Object.
24216 *
24217 * Like object_get_control() but doesn't increase the reference count on the returned object.
24218 *
24219 * <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>
24220 *
24221 * 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.
24222 */
24223Control *object_peek_control (Object *object)
24224{
24225 GDBusInterface *ret;
24226 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
24227 if (ret == NULL)
24228 return NULL;
24229 g_object_unref (ret);
24230 return CONTROL (ret);
24231}
24232
24233/**
24234 * object_peek_control_bmc: (skip)
24235 * @object: A #Object.
24236 *
24237 * Like object_get_control_bmc() but doesn't increase the reference count on the returned object.
24238 *
24239 * <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>
24240 *
24241 * 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.
24242 */
24243ControlBmc *object_peek_control_bmc (Object *object)
24244{
24245 GDBusInterface *ret;
24246 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
24247 if (ret == NULL)
24248 return NULL;
24249 g_object_unref (ret);
24250 return CONTROL_BMC (ret);
24251}
24252
24253/**
24254 * object_peek_control_host: (skip)
24255 * @object: A #Object.
24256 *
24257 * Like object_get_control_host() but doesn't increase the reference count on the returned object.
24258 *
24259 * <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>
24260 *
24261 * 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.
24262 */
24263ControlHost *object_peek_control_host (Object *object)
24264{
24265 GDBusInterface *ret;
24266 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
24267 if (ret == NULL)
24268 return NULL;
24269 g_object_unref (ret);
24270 return CONTROL_HOST (ret);
24271}
24272
24273/**
24274 * object_peek_control_power: (skip)
24275 * @object: A #Object.
24276 *
24277 * Like object_get_control_power() but doesn't increase the reference count on the returned object.
24278 *
24279 * <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>
24280 *
24281 * 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.
24282 */
24283ControlPower *object_peek_control_power (Object *object)
24284{
24285 GDBusInterface *ret;
24286 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
24287 if (ret == NULL)
24288 return NULL;
24289 g_object_unref (ret);
24290 return CONTROL_POWER (ret);
24291}
24292
24293/**
24294 * object_peek_watchdog: (skip)
24295 * @object: A #Object.
24296 *
24297 * Like object_get_watchdog() but doesn't increase the reference count on the returned object.
24298 *
24299 * <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>
24300 *
24301 * 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.
24302 */
24303Watchdog *object_peek_watchdog (Object *object)
24304{
24305 GDBusInterface *ret;
24306 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
24307 if (ret == NULL)
24308 return NULL;
24309 g_object_unref (ret);
24310 return WATCHDOG (ret);
24311}
24312
24313/**
24314 * object_peek_event_log: (skip)
24315 * @object: A #Object.
24316 *
24317 * Like object_get_event_log() but doesn't increase the reference count on the returned object.
24318 *
24319 * <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>
24320 *
24321 * 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.
24322 */
24323EventLog *object_peek_event_log (Object *object)
24324{
24325 GDBusInterface *ret;
24326 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
24327 if (ret == NULL)
24328 return NULL;
24329 g_object_unref (ret);
24330 return EVENT_LOG (ret);
24331}
24332
24333/**
24334 * object_peek_flash: (skip)
24335 * @object: A #Object.
24336 *
24337 * Like object_get_flash() but doesn't increase the reference count on the returned object.
24338 *
24339 * <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>
24340 *
24341 * 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.
24342 */
24343Flash *object_peek_flash (Object *object)
24344{
24345 GDBusInterface *ret;
24346 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
24347 if (ret == NULL)
24348 return NULL;
24349 g_object_unref (ret);
24350 return FLASH (ret);
24351}
24352
24353/**
24354 * object_peek_button: (skip)
24355 * @object: A #Object.
24356 *
24357 * Like object_get_button() but doesn't increase the reference count on the returned object.
24358 *
24359 * <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>
24360 *
24361 * 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.
24362 */
24363Button *object_peek_button (Object *object)
24364{
24365 GDBusInterface *ret;
24366 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
24367 if (ret == NULL)
24368 return NULL;
24369 g_object_unref (ret);
24370 return BUTTON (ret);
24371}
24372
24373/**
24374 * object_peek_led: (skip)
24375 * @object: A #Object.
24376 *
24377 * Like object_get_led() but doesn't increase the reference count on the returned object.
24378 *
24379 * <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>
24380 *
24381 * 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.
24382 */
24383Led *object_peek_led (Object *object)
24384{
24385 GDBusInterface *ret;
24386 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
24387 if (ret == NULL)
24388 return NULL;
24389 g_object_unref (ret);
24390 return LED (ret);
24391}
24392
24393
24394static void
24395object_notify (GDBusObject *object, GDBusInterface *interface)
24396{
24397 _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
24398 /* info can be NULL if the other end is using a D-Bus interface we don't know
24399 * anything about, for example old generated code in this process talking to
24400 * newer generated code in the other process. */
24401 if (info != NULL)
24402 g_object_notify (G_OBJECT (object), info->hyphen_name);
24403}
24404
24405/**
24406 * ObjectProxy:
24407 *
24408 * The #ObjectProxy structure contains only private data and should only be accessed using the provided API.
24409 */
24410
24411/**
24412 * ObjectProxyClass:
24413 * @parent_class: The parent class.
24414 *
24415 * Class structure for #ObjectProxy.
24416 */
24417
24418static void
24419object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
24420{
24421}
24422
24423static void
24424object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
24425{
24426 iface->interface_added = object_notify;
24427 iface->interface_removed = object_notify;
24428}
24429
24430
24431G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
24432 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init)
24433 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init));
24434
24435static void
24436object_proxy_init (ObjectProxy *object G_GNUC_UNUSED)
24437{
24438}
24439
24440static void
24441object_proxy_set_property (GObject *gobject,
24442 guint prop_id,
24443 const GValue *value G_GNUC_UNUSED,
24444 GParamSpec *pspec)
24445{
24446 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
24447}
24448
24449static void
24450object_proxy_get_property (GObject *gobject,
24451 guint prop_id,
24452 GValue *value,
24453 GParamSpec *pspec)
24454{
24455 ObjectProxy *object = OBJECT_PROXY (gobject);
24456 GDBusInterface *interface;
24457
24458 switch (prop_id)
24459 {
24460 case 1:
24461 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
24462 g_value_take_object (value, interface);
24463 break;
24464
24465 case 2:
24466 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
24467 g_value_take_object (value, interface);
24468 break;
24469
24470 case 3:
24471 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
24472 g_value_take_object (value, interface);
24473 break;
24474
24475 case 4:
24476 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
24477 g_value_take_object (value, interface);
24478 break;
24479
24480 case 5:
24481 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
24482 g_value_take_object (value, interface);
24483 break;
24484
24485 case 6:
24486 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
24487 g_value_take_object (value, interface);
24488 break;
24489
24490 case 7:
24491 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
24492 g_value_take_object (value, interface);
24493 break;
24494
24495 case 8:
24496 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
24497 g_value_take_object (value, interface);
24498 break;
24499
24500 case 9:
24501 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
24502 g_value_take_object (value, interface);
24503 break;
24504
24505 case 10:
24506 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
24507 g_value_take_object (value, interface);
24508 break;
24509
24510 case 11:
24511 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
24512 g_value_take_object (value, interface);
24513 break;
24514
24515 case 12:
24516 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
24517 g_value_take_object (value, interface);
24518 break;
24519
24520 case 13:
24521 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
24522 g_value_take_object (value, interface);
24523 break;
24524
24525 case 14:
24526 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
24527 g_value_take_object (value, interface);
24528 break;
24529
24530 case 15:
24531 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
24532 g_value_take_object (value, interface);
24533 break;
24534
24535 case 16:
24536 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
24537 g_value_take_object (value, interface);
24538 break;
24539
24540 default:
24541 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
24542 break;
24543 }
24544}
24545
24546static void
24547object_proxy_class_init (ObjectProxyClass *klass)
24548{
24549 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
24550
24551 gobject_class->set_property = object_proxy_set_property;
24552 gobject_class->get_property = object_proxy_get_property;
24553
24554 g_object_class_override_property (gobject_class, 1, "occ");
24555 g_object_class_override_property (gobject_class, 2, "fan");
24556 g_object_class_override_property (gobject_class, 3, "sensor-value");
24557 g_object_class_override_property (gobject_class, 4, "sensor-threshold");
24558 g_object_class_override_property (gobject_class, 5, "sensor-i2c");
24559 g_object_class_override_property (gobject_class, 6, "sensor-match");
24560 g_object_class_override_property (gobject_class, 7, "process");
24561 g_object_class_override_property (gobject_class, 8, "control");
24562 g_object_class_override_property (gobject_class, 9, "control-bmc");
24563 g_object_class_override_property (gobject_class, 10, "control-host");
24564 g_object_class_override_property (gobject_class, 11, "control-power");
24565 g_object_class_override_property (gobject_class, 12, "watchdog");
24566 g_object_class_override_property (gobject_class, 13, "event-log");
24567 g_object_class_override_property (gobject_class, 14, "flash");
24568 g_object_class_override_property (gobject_class, 15, "button");
24569 g_object_class_override_property (gobject_class, 16, "led");
24570}
24571
24572/**
24573 * object_proxy_new:
24574 * @connection: A #GDBusConnection.
24575 * @object_path: An object path.
24576 *
24577 * Creates a new proxy object.
24578 *
24579 * Returns: (transfer full): The proxy object.
24580 */
24581ObjectProxy *
24582object_proxy_new (GDBusConnection *connection,
24583 const gchar *object_path)
24584{
24585 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
24586 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
24587 return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
24588}
24589
24590/**
24591 * ObjectSkeleton:
24592 *
24593 * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API.
24594 */
24595
24596/**
24597 * ObjectSkeletonClass:
24598 * @parent_class: The parent class.
24599 *
24600 * Class structure for #ObjectSkeleton.
24601 */
24602
24603static void
24604object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
24605{
24606}
24607
24608
24609static void
24610object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
24611{
24612 iface->interface_added = object_notify;
24613 iface->interface_removed = object_notify;
24614}
24615
24616G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
24617 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init)
24618 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init));
24619
24620static void
24621object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED)
24622{
24623}
24624
24625static void
24626object_skeleton_set_property (GObject *gobject,
24627 guint prop_id,
24628 const GValue *value,
24629 GParamSpec *pspec)
24630{
24631 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
24632 GDBusInterfaceSkeleton *interface;
24633
24634 switch (prop_id)
24635 {
24636 case 1:
24637 interface = g_value_get_object (value);
24638 if (interface != NULL)
24639 {
24640 g_warn_if_fail (IS_OCC (interface));
24641 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24642 }
24643 else
24644 {
24645 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Occ");
24646 }
24647 break;
24648
24649 case 2:
24650 interface = g_value_get_object (value);
24651 if (interface != NULL)
24652 {
24653 g_warn_if_fail (IS_FAN (interface));
24654 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24655 }
24656 else
24657 {
24658 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Fan");
24659 }
24660 break;
24661
24662 case 3:
24663 interface = g_value_get_object (value);
24664 if (interface != NULL)
24665 {
24666 g_warn_if_fail (IS_SENSOR_VALUE (interface));
24667 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24668 }
24669 else
24670 {
24671 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorValue");
24672 }
24673 break;
24674
24675 case 4:
24676 interface = g_value_get_object (value);
24677 if (interface != NULL)
24678 {
24679 g_warn_if_fail (IS_SENSOR_THRESHOLD (interface));
24680 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24681 }
24682 else
24683 {
24684 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorThreshold");
24685 }
24686 break;
24687
24688 case 5:
24689 interface = g_value_get_object (value);
24690 if (interface != NULL)
24691 {
24692 g_warn_if_fail (IS_SENSOR_I2C (interface));
24693 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24694 }
24695 else
24696 {
24697 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorI2c");
24698 }
24699 break;
24700
24701 case 6:
24702 interface = g_value_get_object (value);
24703 if (interface != NULL)
24704 {
24705 g_warn_if_fail (IS_SENSOR_MATCH (interface));
24706 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24707 }
24708 else
24709 {
24710 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorMatch");
24711 }
24712 break;
24713
24714 case 7:
24715 interface = g_value_get_object (value);
24716 if (interface != NULL)
24717 {
24718 g_warn_if_fail (IS_PROCESS (interface));
24719 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24720 }
24721 else
24722 {
24723 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Process");
24724 }
24725 break;
24726
24727 case 8:
24728 interface = g_value_get_object (value);
24729 if (interface != NULL)
24730 {
24731 g_warn_if_fail (IS_CONTROL (interface));
24732 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24733 }
24734 else
24735 {
24736 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Control");
24737 }
24738 break;
24739
24740 case 9:
24741 interface = g_value_get_object (value);
24742 if (interface != NULL)
24743 {
24744 g_warn_if_fail (IS_CONTROL_BMC (interface));
24745 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24746 }
24747 else
24748 {
24749 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Bmc");
24750 }
24751 break;
24752
24753 case 10:
24754 interface = g_value_get_object (value);
24755 if (interface != NULL)
24756 {
24757 g_warn_if_fail (IS_CONTROL_HOST (interface));
24758 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24759 }
24760 else
24761 {
24762 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Host");
24763 }
24764 break;
24765
24766 case 11:
24767 interface = g_value_get_object (value);
24768 if (interface != NULL)
24769 {
24770 g_warn_if_fail (IS_CONTROL_POWER (interface));
24771 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24772 }
24773 else
24774 {
24775 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Power");
24776 }
24777 break;
24778
24779 case 12:
24780 interface = g_value_get_object (value);
24781 if (interface != NULL)
24782 {
24783 g_warn_if_fail (IS_WATCHDOG (interface));
24784 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24785 }
24786 else
24787 {
24788 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Watchdog");
24789 }
24790 break;
24791
24792 case 13:
24793 interface = g_value_get_object (value);
24794 if (interface != NULL)
24795 {
24796 g_warn_if_fail (IS_EVENT_LOG (interface));
24797 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24798 }
24799 else
24800 {
24801 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.EventLog");
24802 }
24803 break;
24804
24805 case 14:
24806 interface = g_value_get_object (value);
24807 if (interface != NULL)
24808 {
24809 g_warn_if_fail (IS_FLASH (interface));
24810 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24811 }
24812 else
24813 {
24814 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Flash");
24815 }
24816 break;
24817
24818 case 15:
24819 interface = g_value_get_object (value);
24820 if (interface != NULL)
24821 {
24822 g_warn_if_fail (IS_BUTTON (interface));
24823 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24824 }
24825 else
24826 {
24827 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Button");
24828 }
24829 break;
24830
24831 case 16:
24832 interface = g_value_get_object (value);
24833 if (interface != NULL)
24834 {
24835 g_warn_if_fail (IS_LED (interface));
24836 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24837 }
24838 else
24839 {
24840 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Led");
24841 }
24842 break;
24843
24844 default:
24845 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
24846 break;
24847 }
24848}
24849
24850static void
24851object_skeleton_get_property (GObject *gobject,
24852 guint prop_id,
24853 GValue *value,
24854 GParamSpec *pspec)
24855{
24856 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
24857 GDBusInterface *interface;
24858
24859 switch (prop_id)
24860 {
24861 case 1:
24862 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
24863 g_value_take_object (value, interface);
24864 break;
24865
24866 case 2:
24867 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
24868 g_value_take_object (value, interface);
24869 break;
24870
24871 case 3:
24872 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
24873 g_value_take_object (value, interface);
24874 break;
24875
24876 case 4:
24877 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
24878 g_value_take_object (value, interface);
24879 break;
24880
24881 case 5:
24882 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
24883 g_value_take_object (value, interface);
24884 break;
24885
24886 case 6:
24887 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
24888 g_value_take_object (value, interface);
24889 break;
24890
24891 case 7:
24892 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
24893 g_value_take_object (value, interface);
24894 break;
24895
24896 case 8:
24897 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
24898 g_value_take_object (value, interface);
24899 break;
24900
24901 case 9:
24902 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
24903 g_value_take_object (value, interface);
24904 break;
24905
24906 case 10:
24907 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
24908 g_value_take_object (value, interface);
24909 break;
24910
24911 case 11:
24912 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
24913 g_value_take_object (value, interface);
24914 break;
24915
24916 case 12:
24917 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
24918 g_value_take_object (value, interface);
24919 break;
24920
24921 case 13:
24922 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
24923 g_value_take_object (value, interface);
24924 break;
24925
24926 case 14:
24927 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
24928 g_value_take_object (value, interface);
24929 break;
24930
24931 case 15:
24932 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
24933 g_value_take_object (value, interface);
24934 break;
24935
24936 case 16:
24937 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
24938 g_value_take_object (value, interface);
24939 break;
24940
24941 default:
24942 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
24943 break;
24944 }
24945}
24946
24947static void
24948object_skeleton_class_init (ObjectSkeletonClass *klass)
24949{
24950 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
24951
24952 gobject_class->set_property = object_skeleton_set_property;
24953 gobject_class->get_property = object_skeleton_get_property;
24954
24955 g_object_class_override_property (gobject_class, 1, "occ");
24956 g_object_class_override_property (gobject_class, 2, "fan");
24957 g_object_class_override_property (gobject_class, 3, "sensor-value");
24958 g_object_class_override_property (gobject_class, 4, "sensor-threshold");
24959 g_object_class_override_property (gobject_class, 5, "sensor-i2c");
24960 g_object_class_override_property (gobject_class, 6, "sensor-match");
24961 g_object_class_override_property (gobject_class, 7, "process");
24962 g_object_class_override_property (gobject_class, 8, "control");
24963 g_object_class_override_property (gobject_class, 9, "control-bmc");
24964 g_object_class_override_property (gobject_class, 10, "control-host");
24965 g_object_class_override_property (gobject_class, 11, "control-power");
24966 g_object_class_override_property (gobject_class, 12, "watchdog");
24967 g_object_class_override_property (gobject_class, 13, "event-log");
24968 g_object_class_override_property (gobject_class, 14, "flash");
24969 g_object_class_override_property (gobject_class, 15, "button");
24970 g_object_class_override_property (gobject_class, 16, "led");
24971}
24972
24973/**
24974 * object_skeleton_new:
24975 * @object_path: An object path.
24976 *
24977 * Creates a new skeleton object.
24978 *
24979 * Returns: (transfer full): The skeleton object.
24980 */
24981ObjectSkeleton *
24982object_skeleton_new (const gchar *object_path)
24983{
24984 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
24985 return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
24986}
24987
24988/**
24989 * object_skeleton_set_occ:
24990 * @object: A #ObjectSkeleton.
24991 * @interface_: (allow-none): A #Occ or %NULL to clear the interface.
24992 *
24993 * 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.
24994 */
24995void object_skeleton_set_occ (ObjectSkeleton *object, Occ *interface_)
24996{
24997 g_object_set (G_OBJECT (object), "occ", interface_, NULL);
24998}
24999
25000/**
25001 * object_skeleton_set_fan:
25002 * @object: A #ObjectSkeleton.
25003 * @interface_: (allow-none): A #Fan or %NULL to clear the interface.
25004 *
25005 * 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.
25006 */
25007void object_skeleton_set_fan (ObjectSkeleton *object, Fan *interface_)
25008{
25009 g_object_set (G_OBJECT (object), "fan", interface_, NULL);
25010}
25011
25012/**
25013 * object_skeleton_set_sensor_value:
25014 * @object: A #ObjectSkeleton.
25015 * @interface_: (allow-none): A #SensorValue or %NULL to clear the interface.
25016 *
25017 * 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.
25018 */
25019void object_skeleton_set_sensor_value (ObjectSkeleton *object, SensorValue *interface_)
25020{
25021 g_object_set (G_OBJECT (object), "sensor-value", interface_, NULL);
25022}
25023
25024/**
25025 * object_skeleton_set_sensor_threshold:
25026 * @object: A #ObjectSkeleton.
25027 * @interface_: (allow-none): A #SensorThreshold or %NULL to clear the interface.
25028 *
25029 * 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.
25030 */
25031void object_skeleton_set_sensor_threshold (ObjectSkeleton *object, SensorThreshold *interface_)
25032{
25033 g_object_set (G_OBJECT (object), "sensor-threshold", interface_, NULL);
25034}
25035
25036/**
25037 * object_skeleton_set_sensor_i2c:
25038 * @object: A #ObjectSkeleton.
25039 * @interface_: (allow-none): A #SensorI2c or %NULL to clear the interface.
25040 *
25041 * 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.
25042 */
25043void object_skeleton_set_sensor_i2c (ObjectSkeleton *object, SensorI2c *interface_)
25044{
25045 g_object_set (G_OBJECT (object), "sensor-i2c", interface_, NULL);
25046}
25047
25048/**
25049 * object_skeleton_set_sensor_match:
25050 * @object: A #ObjectSkeleton.
25051 * @interface_: (allow-none): A #SensorMatch or %NULL to clear the interface.
25052 *
25053 * 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.
25054 */
25055void object_skeleton_set_sensor_match (ObjectSkeleton *object, SensorMatch *interface_)
25056{
25057 g_object_set (G_OBJECT (object), "sensor-match", interface_, NULL);
25058}
25059
25060/**
25061 * object_skeleton_set_process:
25062 * @object: A #ObjectSkeleton.
25063 * @interface_: (allow-none): A #Process or %NULL to clear the interface.
25064 *
25065 * 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.
25066 */
25067void object_skeleton_set_process (ObjectSkeleton *object, Process *interface_)
25068{
25069 g_object_set (G_OBJECT (object), "process", interface_, NULL);
25070}
25071
25072/**
25073 * object_skeleton_set_control:
25074 * @object: A #ObjectSkeleton.
25075 * @interface_: (allow-none): A #Control or %NULL to clear the interface.
25076 *
25077 * 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.
25078 */
25079void object_skeleton_set_control (ObjectSkeleton *object, Control *interface_)
25080{
25081 g_object_set (G_OBJECT (object), "control", interface_, NULL);
25082}
25083
25084/**
25085 * object_skeleton_set_control_bmc:
25086 * @object: A #ObjectSkeleton.
25087 * @interface_: (allow-none): A #ControlBmc or %NULL to clear the interface.
25088 *
25089 * 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.
25090 */
25091void object_skeleton_set_control_bmc (ObjectSkeleton *object, ControlBmc *interface_)
25092{
25093 g_object_set (G_OBJECT (object), "control-bmc", interface_, NULL);
25094}
25095
25096/**
25097 * object_skeleton_set_control_host:
25098 * @object: A #ObjectSkeleton.
25099 * @interface_: (allow-none): A #ControlHost or %NULL to clear the interface.
25100 *
25101 * 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.
25102 */
25103void object_skeleton_set_control_host (ObjectSkeleton *object, ControlHost *interface_)
25104{
25105 g_object_set (G_OBJECT (object), "control-host", interface_, NULL);
25106}
25107
25108/**
25109 * object_skeleton_set_control_power:
25110 * @object: A #ObjectSkeleton.
25111 * @interface_: (allow-none): A #ControlPower or %NULL to clear the interface.
25112 *
25113 * 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.
25114 */
25115void object_skeleton_set_control_power (ObjectSkeleton *object, ControlPower *interface_)
25116{
25117 g_object_set (G_OBJECT (object), "control-power", interface_, NULL);
25118}
25119
25120/**
25121 * object_skeleton_set_watchdog:
25122 * @object: A #ObjectSkeleton.
25123 * @interface_: (allow-none): A #Watchdog or %NULL to clear the interface.
25124 *
25125 * 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.
25126 */
25127void object_skeleton_set_watchdog (ObjectSkeleton *object, Watchdog *interface_)
25128{
25129 g_object_set (G_OBJECT (object), "watchdog", interface_, NULL);
25130}
25131
25132/**
25133 * object_skeleton_set_event_log:
25134 * @object: A #ObjectSkeleton.
25135 * @interface_: (allow-none): A #EventLog or %NULL to clear the interface.
25136 *
25137 * 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.
25138 */
25139void object_skeleton_set_event_log (ObjectSkeleton *object, EventLog *interface_)
25140{
25141 g_object_set (G_OBJECT (object), "event-log", interface_, NULL);
25142}
25143
25144/**
25145 * object_skeleton_set_flash:
25146 * @object: A #ObjectSkeleton.
25147 * @interface_: (allow-none): A #Flash or %NULL to clear the interface.
25148 *
25149 * 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.
25150 */
25151void object_skeleton_set_flash (ObjectSkeleton *object, Flash *interface_)
25152{
25153 g_object_set (G_OBJECT (object), "flash", interface_, NULL);
25154}
25155
25156/**
25157 * object_skeleton_set_button:
25158 * @object: A #ObjectSkeleton.
25159 * @interface_: (allow-none): A #Button or %NULL to clear the interface.
25160 *
25161 * 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.
25162 */
25163void object_skeleton_set_button (ObjectSkeleton *object, Button *interface_)
25164{
25165 g_object_set (G_OBJECT (object), "button", interface_, NULL);
25166}
25167
25168/**
25169 * object_skeleton_set_led:
25170 * @object: A #ObjectSkeleton.
25171 * @interface_: (allow-none): A #Led or %NULL to clear the interface.
25172 *
25173 * 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.
25174 */
25175void object_skeleton_set_led (ObjectSkeleton *object, Led *interface_)
25176{
25177 g_object_set (G_OBJECT (object), "led", interface_, NULL);
25178}
25179
25180
25181/* ------------------------------------------------------------------------
25182 * Code for ObjectManager client
25183 * ------------------------------------------------------------------------
25184 */
25185
25186/**
25187 * SECTION:ObjectManagerClient
25188 * @title: ObjectManagerClient
25189 * @short_description: Generated GDBusObjectManagerClient type
25190 *
25191 * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
25192 */
25193
25194/**
25195 * ObjectManagerClient:
25196 *
25197 * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API.
25198 */
25199
25200/**
25201 * ObjectManagerClientClass:
25202 * @parent_class: The parent class.
25203 *
25204 * Class structure for #ObjectManagerClient.
25205 */
25206
25207G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT);
25208
25209static void
25210object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED)
25211{
25212}
25213
25214static void
25215object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED)
25216{
25217}
25218
25219/**
25220 * object_manager_client_get_proxy_type:
25221 * @manager: A #GDBusObjectManagerClient.
25222 * @object_path: The object path of the remote object (unused).
25223 * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType.
25224 * @user_data: User data (unused).
25225 *
25226 * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types.
25227 *
25228 * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy.
25229 */
25230GType
25231object_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)
25232{
25233 static gsize once_init_value = 0;
25234 static GHashTable *lookup_hash;
25235 GType ret;
25236
25237 if (interface_name == NULL)
25238 return TYPE_OBJECT_PROXY;
25239 if (g_once_init_enter (&once_init_value))
25240 {
25241 lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
25242 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Occ", GSIZE_TO_POINTER (TYPE_OCC_PROXY));
25243 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Fan", GSIZE_TO_POINTER (TYPE_FAN_PROXY));
25244 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorValue", GSIZE_TO_POINTER (TYPE_SENSOR_VALUE_PROXY));
25245 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_THRESHOLD_PROXY));
25246 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorI2c", GSIZE_TO_POINTER (TYPE_SENSOR_I2C_PROXY));
25247 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorMatch", GSIZE_TO_POINTER (TYPE_SENSOR_MATCH_PROXY));
25248 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Process", GSIZE_TO_POINTER (TYPE_PROCESS_PROXY));
25249 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Control", GSIZE_TO_POINTER (TYPE_CONTROL_PROXY));
25250 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Bmc", GSIZE_TO_POINTER (TYPE_CONTROL_BMC_PROXY));
25251 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Host", GSIZE_TO_POINTER (TYPE_CONTROL_HOST_PROXY));
25252 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Power", GSIZE_TO_POINTER (TYPE_CONTROL_POWER_PROXY));
25253 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Watchdog", GSIZE_TO_POINTER (TYPE_WATCHDOG_PROXY));
25254 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.EventLog", GSIZE_TO_POINTER (TYPE_EVENT_LOG_PROXY));
25255 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Flash", GSIZE_TO_POINTER (TYPE_FLASH_PROXY));
25256 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Button", GSIZE_TO_POINTER (TYPE_BUTTON_PROXY));
25257 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Led", GSIZE_TO_POINTER (TYPE_LED_PROXY));
25258 g_once_init_leave (&once_init_value, 1);
25259 }
25260 ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
25261 if (ret == (GType) 0)
25262 ret = G_TYPE_DBUS_PROXY;
25263 return ret;
25264}
25265
25266/**
25267 * object_manager_client_new:
25268 * @connection: A #GDBusConnection.
25269 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
25270 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
25271 * @object_path: An object path.
25272 * @cancellable: (allow-none): A #GCancellable or %NULL.
25273 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
25274 * @user_data: User data to pass to @callback.
25275 *
25276 * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
25277 *
25278 * 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.
25279 * You can then call object_manager_client_new_finish() to get the result of the operation.
25280 *
25281 * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
25282 */
25283void
25284object_manager_client_new (
25285 GDBusConnection *connection,
25286 GDBusObjectManagerClientFlags flags,
25287 const gchar *name,
25288 const gchar *object_path,
25289 GCancellable *cancellable,
25290 GAsyncReadyCallback callback,
25291 gpointer user_data)
25292{
25293 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);
25294}
25295
25296/**
25297 * object_manager_client_new_finish:
25298 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new().
25299 * @error: Return location for error or %NULL
25300 *
25301 * Finishes an operation started with object_manager_client_new().
25302 *
25303 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
25304 */
25305GDBusObjectManager *
25306object_manager_client_new_finish (
25307 GAsyncResult *res,
25308 GError **error)
25309{
25310 GObject *ret;
25311 GObject *source_object;
25312 source_object = g_async_result_get_source_object (res);
25313 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
25314 g_object_unref (source_object);
25315 if (ret != NULL)
25316 return G_DBUS_OBJECT_MANAGER (ret);
25317 else
25318 return NULL;
25319}
25320
25321/**
25322 * object_manager_client_new_sync:
25323 * @connection: A #GDBusConnection.
25324 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
25325 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
25326 * @object_path: An object path.
25327 * @cancellable: (allow-none): A #GCancellable or %NULL.
25328 * @error: Return location for error or %NULL
25329 *
25330 * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
25331 *
25332 * The calling thread is blocked until a reply is received.
25333 *
25334 * See object_manager_client_new() for the asynchronous version of this constructor.
25335 *
25336 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
25337 */
25338GDBusObjectManager *
25339object_manager_client_new_sync (
25340 GDBusConnection *connection,
25341 GDBusObjectManagerClientFlags flags,
25342 const gchar *name,
25343 const gchar *object_path,
25344 GCancellable *cancellable,
25345 GError **error)
25346{
25347 GInitable *ret;
25348 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);
25349 if (ret != NULL)
25350 return G_DBUS_OBJECT_MANAGER (ret);
25351 else
25352 return NULL;
25353}
25354
25355
25356/**
25357 * object_manager_client_new_for_bus:
25358 * @bus_type: A #GBusType.
25359 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
25360 * @name: A bus name (well-known or unique).
25361 * @object_path: An object path.
25362 * @cancellable: (allow-none): A #GCancellable or %NULL.
25363 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
25364 * @user_data: User data to pass to @callback.
25365 *
25366 * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
25367 *
25368 * 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.
25369 * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation.
25370 *
25371 * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
25372 */
25373void
25374object_manager_client_new_for_bus (
25375 GBusType bus_type,
25376 GDBusObjectManagerClientFlags flags,
25377 const gchar *name,
25378 const gchar *object_path,
25379 GCancellable *cancellable,
25380 GAsyncReadyCallback callback,
25381 gpointer user_data)
25382{
25383 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);
25384}
25385
25386/**
25387 * object_manager_client_new_for_bus_finish:
25388 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus().
25389 * @error: Return location for error or %NULL
25390 *
25391 * Finishes an operation started with object_manager_client_new_for_bus().
25392 *
25393 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
25394 */
25395GDBusObjectManager *
25396object_manager_client_new_for_bus_finish (
25397 GAsyncResult *res,
25398 GError **error)
25399{
25400 GObject *ret;
25401 GObject *source_object;
25402 source_object = g_async_result_get_source_object (res);
25403 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
25404 g_object_unref (source_object);
25405 if (ret != NULL)
25406 return G_DBUS_OBJECT_MANAGER (ret);
25407 else
25408 return NULL;
25409}
25410
25411/**
25412 * object_manager_client_new_for_bus_sync:
25413 * @bus_type: A #GBusType.
25414 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
25415 * @name: A bus name (well-known or unique).
25416 * @object_path: An object path.
25417 * @cancellable: (allow-none): A #GCancellable or %NULL.
25418 * @error: Return location for error or %NULL
25419 *
25420 * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
25421 *
25422 * The calling thread is blocked until a reply is received.
25423 *
25424 * See object_manager_client_new_for_bus() for the asynchronous version of this constructor.
25425 *
25426 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
25427 */
25428GDBusObjectManager *
25429object_manager_client_new_for_bus_sync (
25430 GBusType bus_type,
25431 GDBusObjectManagerClientFlags flags,
25432 const gchar *name,
25433 const gchar *object_path,
25434 GCancellable *cancellable,
25435 GError **error)
25436{
25437 GInitable *ret;
25438 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);
25439 if (ret != NULL)
25440 return G_DBUS_OBJECT_MANAGER (ret);
25441 else
25442 return NULL;
25443}
25444
25445