blob: bbe94b7bb210017a35beb2a5e8933eabf5d67326 [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
Norman James19e45912015-10-04 20:19:41 -05003610static 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
Norman James362a80f2015-09-14 14:04:39 -05003640static const _ExtendedGDBusMethodInfo * const _sensor_value_method_info_pointers[] =
3641{
3642 &_sensor_value_method_info_init,
3643 &_sensor_value_method_info_get_value,
Norman James19e45912015-10-04 20:19:41 -05003644 &_sensor_value_method_info_set_value,
Norman James362a80f2015-09-14 14:04:39 -05003645 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
Norman James362a80f2015-09-14 14:04:39 -05003800static const _ExtendedGDBusPropertyInfo * const _sensor_value_property_info_pointers[] =
3801{
3802 &_sensor_value_property_info_value,
3803 &_sensor_value_property_info_units,
3804 &_sensor_value_property_info_poll_interval,
3805 &_sensor_value_property_info_heatbeat,
3806 &_sensor_value_property_info_settable,
Norman James362a80f2015-09-14 14:04:39 -05003807 NULL
3808};
3809
3810static const _ExtendedGDBusInterfaceInfo _sensor_value_interface_info =
3811{
3812 {
3813 -1,
3814 (gchar *) "org.openbmc.SensorValue",
3815 (GDBusMethodInfo **) &_sensor_value_method_info_pointers,
3816 (GDBusSignalInfo **) &_sensor_value_signal_info_pointers,
3817 (GDBusPropertyInfo **) &_sensor_value_property_info_pointers,
3818 NULL
3819 },
3820 "sensor-value",
3821};
3822
3823
3824/**
3825 * sensor_value_interface_info:
3826 *
3827 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> D-Bus interface.
3828 *
3829 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
3830 */
3831GDBusInterfaceInfo *
3832sensor_value_interface_info (void)
3833{
3834 return (GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct;
3835}
3836
3837/**
3838 * sensor_value_override_properties:
3839 * @klass: The class structure for a #GObject<!-- -->-derived class.
3840 * @property_id_begin: The property id to assign to the first overridden property.
3841 *
3842 * Overrides all #GObject properties in the #SensorValue interface for a concrete class.
3843 * The properties are overridden in the order they are defined.
3844 *
3845 * Returns: The last property id.
3846 */
3847guint
3848sensor_value_override_properties (GObjectClass *klass, guint property_id_begin)
3849{
3850 g_object_class_override_property (klass, property_id_begin++, "value");
3851 g_object_class_override_property (klass, property_id_begin++, "units");
3852 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
3853 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
3854 g_object_class_override_property (klass, property_id_begin++, "settable");
Norman James362a80f2015-09-14 14:04:39 -05003855 return property_id_begin - 1;
3856}
3857
3858
3859
3860/**
3861 * SensorValue:
3862 *
3863 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
3864 */
3865
3866/**
3867 * SensorValueIface:
3868 * @parent_iface: The parent interface.
3869 * @handle_get_value: Handler for the #SensorValue::handle-get-value signal.
3870 * @handle_init: Handler for the #SensorValue::handle-init signal.
Norman James19e45912015-10-04 20:19:41 -05003871 * @handle_set_value: Handler for the #SensorValue::handle-set-value signal.
Norman James362a80f2015-09-14 14:04:39 -05003872 * @get_heatbeat: Getter for the #SensorValue:heatbeat property.
Norman James362a80f2015-09-14 14:04:39 -05003873 * @get_poll_interval: Getter for the #SensorValue:poll-interval property.
3874 * @get_settable: Getter for the #SensorValue:settable property.
3875 * @get_units: Getter for the #SensorValue:units property.
3876 * @get_value: Getter for the #SensorValue:value property.
3877 * @changed: Handler for the #SensorValue::changed signal.
Norman James32e74e22015-09-15 21:28:06 -05003878 * @error: Handler for the #SensorValue::error signal.
Norman James362a80f2015-09-14 14:04:39 -05003879 * @heartbeat: Handler for the #SensorValue::heartbeat signal.
3880 *
3881 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
3882 */
3883
3884typedef SensorValueIface SensorValueInterface;
3885G_DEFINE_INTERFACE (SensorValue, sensor_value, G_TYPE_OBJECT);
3886
3887static void
3888sensor_value_default_init (SensorValueIface *iface)
3889{
3890 /* GObject signals for incoming D-Bus method calls: */
3891 /**
3892 * SensorValue::handle-init:
3893 * @object: A #SensorValue.
3894 * @invocation: A #GDBusMethodInvocation.
3895 *
3896 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method.
3897 *
3898 * 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.
3899 *
3900 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3901 */
3902 g_signal_new ("handle-init",
3903 G_TYPE_FROM_INTERFACE (iface),
3904 G_SIGNAL_RUN_LAST,
3905 G_STRUCT_OFFSET (SensorValueIface, handle_init),
3906 g_signal_accumulator_true_handled,
3907 NULL,
3908 g_cclosure_marshal_generic,
3909 G_TYPE_BOOLEAN,
3910 1,
3911 G_TYPE_DBUS_METHOD_INVOCATION);
3912
3913 /**
3914 * SensorValue::handle-get-value:
3915 * @object: A #SensorValue.
3916 * @invocation: A #GDBusMethodInvocation.
3917 *
3918 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method.
3919 *
3920 * 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.
3921 *
3922 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3923 */
3924 g_signal_new ("handle-get-value",
3925 G_TYPE_FROM_INTERFACE (iface),
3926 G_SIGNAL_RUN_LAST,
3927 G_STRUCT_OFFSET (SensorValueIface, handle_get_value),
3928 g_signal_accumulator_true_handled,
3929 NULL,
3930 g_cclosure_marshal_generic,
3931 G_TYPE_BOOLEAN,
3932 1,
3933 G_TYPE_DBUS_METHOD_INVOCATION);
3934
Norman James19e45912015-10-04 20:19:41 -05003935 /**
3936 * SensorValue::handle-set-value:
3937 * @object: A #SensorValue.
3938 * @invocation: A #GDBusMethodInvocation.
3939 * @arg_value: Argument passed by remote caller.
3940 *
3941 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method.
3942 *
3943 * 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.
3944 *
3945 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3946 */
3947 g_signal_new ("handle-set-value",
3948 G_TYPE_FROM_INTERFACE (iface),
3949 G_SIGNAL_RUN_LAST,
3950 G_STRUCT_OFFSET (SensorValueIface, handle_set_value),
3951 g_signal_accumulator_true_handled,
3952 NULL,
3953 g_cclosure_marshal_generic,
3954 G_TYPE_BOOLEAN,
3955 2,
3956 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT);
3957
Norman James362a80f2015-09-14 14:04:39 -05003958 /* GObject signals for received D-Bus signals: */
3959 /**
3960 * SensorValue::changed:
3961 * @object: A #SensorValue.
3962 * @arg_value: Argument.
3963 * @arg_units: Argument.
3964 *
3965 * 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.
3966 *
3967 * 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.
3968 */
3969 g_signal_new ("changed",
3970 G_TYPE_FROM_INTERFACE (iface),
3971 G_SIGNAL_RUN_LAST,
3972 G_STRUCT_OFFSET (SensorValueIface, changed),
3973 NULL,
3974 NULL,
3975 g_cclosure_marshal_generic,
3976 G_TYPE_NONE,
3977 2, G_TYPE_VARIANT, G_TYPE_STRING);
3978
3979 /**
Norman James32e74e22015-09-15 21:28:06 -05003980 * SensorValue::error:
3981 * @object: A #SensorValue.
3982 *
3983 * 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.
3984 *
3985 * 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.
3986 */
3987 g_signal_new ("error",
3988 G_TYPE_FROM_INTERFACE (iface),
3989 G_SIGNAL_RUN_LAST,
3990 G_STRUCT_OFFSET (SensorValueIface, error),
3991 NULL,
3992 NULL,
3993 g_cclosure_marshal_generic,
3994 G_TYPE_NONE,
3995 0);
3996
3997 /**
Norman James362a80f2015-09-14 14:04:39 -05003998 * SensorValue::heartbeat:
3999 * @object: A #SensorValue.
4000 * @arg_bus_name: Argument.
4001 *
4002 * 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.
4003 *
4004 * 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.
4005 */
4006 g_signal_new ("heartbeat",
4007 G_TYPE_FROM_INTERFACE (iface),
4008 G_SIGNAL_RUN_LAST,
4009 G_STRUCT_OFFSET (SensorValueIface, heartbeat),
4010 NULL,
4011 NULL,
4012 g_cclosure_marshal_generic,
4013 G_TYPE_NONE,
4014 1, G_TYPE_STRING);
4015
4016 /* GObject properties for D-Bus properties: */
4017 /**
4018 * SensorValue:value:
4019 *
4020 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link>.
4021 *
4022 * 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.
4023 */
4024 g_object_interface_install_property (iface,
4025 g_param_spec_variant ("value", "value", "value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4026 /**
4027 * SensorValue:units:
4028 *
4029 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link>.
4030 *
4031 * 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.
4032 */
4033 g_object_interface_install_property (iface,
4034 g_param_spec_string ("units", "units", "units", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4035 /**
4036 * SensorValue:poll-interval:
4037 *
4038 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link>.
4039 *
4040 * 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.
4041 */
4042 g_object_interface_install_property (iface,
4043 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4044 /**
4045 * SensorValue:heatbeat:
4046 *
4047 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link>.
4048 *
4049 * 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.
4050 */
4051 g_object_interface_install_property (iface,
4052 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4053 /**
4054 * SensorValue:settable:
4055 *
4056 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link>.
4057 *
4058 * 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.
4059 */
4060 g_object_interface_install_property (iface,
4061 g_param_spec_boolean ("settable", "settable", "settable", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James362a80f2015-09-14 14:04:39 -05004062}
4063
4064/**
4065 * sensor_value_get_value: (skip)
4066 * @object: A #SensorValue.
4067 *
4068 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property.
4069 *
4070 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4071 *
4072 * <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>
4073 *
4074 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
4075 */
4076GVariant *
4077sensor_value_get_value (SensorValue *object)
4078{
4079 return SENSOR_VALUE_GET_IFACE (object)->get_value (object);
4080}
4081
4082/**
4083 * sensor_value_dup_value: (skip)
4084 * @object: A #SensorValue.
4085 *
4086 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property.
4087 *
4088 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4089 *
4090 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
4091 */
4092GVariant *
4093sensor_value_dup_value (SensorValue *object)
4094{
4095 GVariant *value;
4096 g_object_get (G_OBJECT (object), "value", &value, NULL);
4097 return value;
4098}
4099
4100/**
4101 * sensor_value_set_value: (skip)
4102 * @object: A #SensorValue.
4103 * @value: The value to set.
4104 *
4105 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property to @value.
4106 *
4107 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4108 */
4109void
4110sensor_value_set_value (SensorValue *object, GVariant *value)
4111{
4112 g_object_set (G_OBJECT (object), "value", value, NULL);
4113}
4114
4115/**
4116 * sensor_value_get_units: (skip)
4117 * @object: A #SensorValue.
4118 *
4119 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property.
4120 *
4121 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4122 *
4123 * <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>
4124 *
4125 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
4126 */
4127const gchar *
4128sensor_value_get_units (SensorValue *object)
4129{
4130 return SENSOR_VALUE_GET_IFACE (object)->get_units (object);
4131}
4132
4133/**
4134 * sensor_value_dup_units: (skip)
4135 * @object: A #SensorValue.
4136 *
4137 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property.
4138 *
4139 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4140 *
4141 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
4142 */
4143gchar *
4144sensor_value_dup_units (SensorValue *object)
4145{
4146 gchar *value;
4147 g_object_get (G_OBJECT (object), "units", &value, NULL);
4148 return value;
4149}
4150
4151/**
4152 * sensor_value_set_units: (skip)
4153 * @object: A #SensorValue.
4154 * @value: The value to set.
4155 *
4156 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property to @value.
4157 *
4158 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4159 */
4160void
4161sensor_value_set_units (SensorValue *object, const gchar *value)
4162{
4163 g_object_set (G_OBJECT (object), "units", value, NULL);
4164}
4165
4166/**
4167 * sensor_value_get_poll_interval: (skip)
4168 * @object: A #SensorValue.
4169 *
4170 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property.
4171 *
4172 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4173 *
4174 * Returns: The property value.
4175 */
4176gint
4177sensor_value_get_poll_interval (SensorValue *object)
4178{
4179 return SENSOR_VALUE_GET_IFACE (object)->get_poll_interval (object);
4180}
4181
4182/**
4183 * sensor_value_set_poll_interval: (skip)
4184 * @object: A #SensorValue.
4185 * @value: The value to set.
4186 *
4187 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property to @value.
4188 *
4189 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4190 */
4191void
4192sensor_value_set_poll_interval (SensorValue *object, gint value)
4193{
4194 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
4195}
4196
4197/**
4198 * sensor_value_get_heatbeat: (skip)
4199 * @object: A #SensorValue.
4200 *
4201 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property.
4202 *
4203 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4204 *
4205 * Returns: The property value.
4206 */
4207gint
4208sensor_value_get_heatbeat (SensorValue *object)
4209{
4210 return SENSOR_VALUE_GET_IFACE (object)->get_heatbeat (object);
4211}
4212
4213/**
4214 * sensor_value_set_heatbeat: (skip)
4215 * @object: A #SensorValue.
4216 * @value: The value to set.
4217 *
4218 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property to @value.
4219 *
4220 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4221 */
4222void
4223sensor_value_set_heatbeat (SensorValue *object, gint value)
4224{
4225 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
4226}
4227
4228/**
4229 * sensor_value_get_settable: (skip)
4230 * @object: A #SensorValue.
4231 *
4232 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property.
4233 *
4234 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4235 *
4236 * Returns: The property value.
4237 */
4238gboolean
4239sensor_value_get_settable (SensorValue *object)
4240{
4241 return SENSOR_VALUE_GET_IFACE (object)->get_settable (object);
4242}
4243
4244/**
4245 * sensor_value_set_settable: (skip)
4246 * @object: A #SensorValue.
4247 * @value: The value to set.
4248 *
4249 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property to @value.
4250 *
4251 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4252 */
4253void
4254sensor_value_set_settable (SensorValue *object, gboolean value)
4255{
4256 g_object_set (G_OBJECT (object), "settable", value, NULL);
4257}
4258
4259/**
Norman James362a80f2015-09-14 14:04:39 -05004260 * sensor_value_emit_changed:
4261 * @object: A #SensorValue.
4262 * @arg_value: Argument to pass with the signal.
4263 * @arg_units: Argument to pass with the signal.
4264 *
4265 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Changed">"Changed"</link> D-Bus signal.
4266 */
4267void
4268sensor_value_emit_changed (
4269 SensorValue *object,
4270 GVariant *arg_value,
4271 const gchar *arg_units)
4272{
4273 g_signal_emit_by_name (object, "changed", arg_value, arg_units);
4274}
4275
4276/**
Norman James32e74e22015-09-15 21:28:06 -05004277 * sensor_value_emit_error:
4278 * @object: A #SensorValue.
4279 *
4280 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Error">"Error"</link> D-Bus signal.
4281 */
4282void
4283sensor_value_emit_error (
4284 SensorValue *object)
4285{
4286 g_signal_emit_by_name (object, "error");
4287}
4288
4289/**
Norman James362a80f2015-09-14 14:04:39 -05004290 * sensor_value_emit_heartbeat:
4291 * @object: A #SensorValue.
4292 * @arg_bus_name: Argument to pass with the signal.
4293 *
4294 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Heartbeat">"Heartbeat"</link> D-Bus signal.
4295 */
4296void
4297sensor_value_emit_heartbeat (
4298 SensorValue *object,
4299 const gchar *arg_bus_name)
4300{
4301 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
4302}
4303
4304/**
4305 * sensor_value_call_init:
4306 * @proxy: A #SensorValueProxy.
4307 * @cancellable: (allow-none): A #GCancellable or %NULL.
4308 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4309 * @user_data: User data to pass to @callback.
4310 *
4311 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method on @proxy.
4312 * 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.
4313 * You can then call sensor_value_call_init_finish() to get the result of the operation.
4314 *
4315 * See sensor_value_call_init_sync() for the synchronous, blocking version of this method.
4316 */
4317void
4318sensor_value_call_init (
4319 SensorValue *proxy,
4320 GCancellable *cancellable,
4321 GAsyncReadyCallback callback,
4322 gpointer user_data)
4323{
4324 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4325 "init",
4326 g_variant_new ("()"),
4327 G_DBUS_CALL_FLAGS_NONE,
4328 -1,
4329 cancellable,
4330 callback,
4331 user_data);
4332}
4333
4334/**
4335 * sensor_value_call_init_finish:
4336 * @proxy: A #SensorValueProxy.
4337 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_init().
4338 * @error: Return location for error or %NULL.
4339 *
4340 * Finishes an operation started with sensor_value_call_init().
4341 *
4342 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4343 */
4344gboolean
4345sensor_value_call_init_finish (
4346 SensorValue *proxy,
4347 GAsyncResult *res,
4348 GError **error)
4349{
4350 GVariant *_ret;
4351 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4352 if (_ret == NULL)
4353 goto _out;
4354 g_variant_get (_ret,
4355 "()");
4356 g_variant_unref (_ret);
4357_out:
4358 return _ret != NULL;
4359}
4360
4361/**
4362 * sensor_value_call_init_sync:
4363 * @proxy: A #SensorValueProxy.
4364 * @cancellable: (allow-none): A #GCancellable or %NULL.
4365 * @error: Return location for error or %NULL.
4366 *
4367 * 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.
4368 *
4369 * See sensor_value_call_init() for the asynchronous version of this method.
4370 *
4371 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4372 */
4373gboolean
4374sensor_value_call_init_sync (
4375 SensorValue *proxy,
4376 GCancellable *cancellable,
4377 GError **error)
4378{
4379 GVariant *_ret;
4380 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4381 "init",
4382 g_variant_new ("()"),
4383 G_DBUS_CALL_FLAGS_NONE,
4384 -1,
4385 cancellable,
4386 error);
4387 if (_ret == NULL)
4388 goto _out;
4389 g_variant_get (_ret,
4390 "()");
4391 g_variant_unref (_ret);
4392_out:
4393 return _ret != NULL;
4394}
4395
4396/**
4397 * sensor_value_call_get_value:
4398 * @proxy: A #SensorValueProxy.
4399 * @cancellable: (allow-none): A #GCancellable or %NULL.
4400 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4401 * @user_data: User data to pass to @callback.
4402 *
4403 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method on @proxy.
4404 * 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.
4405 * You can then call sensor_value_call_get_value_finish() to get the result of the operation.
4406 *
4407 * See sensor_value_call_get_value_sync() for the synchronous, blocking version of this method.
4408 */
4409void
4410sensor_value_call_get_value (
4411 SensorValue *proxy,
4412 GCancellable *cancellable,
4413 GAsyncReadyCallback callback,
4414 gpointer user_data)
4415{
4416 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4417 "getValue",
4418 g_variant_new ("()"),
4419 G_DBUS_CALL_FLAGS_NONE,
4420 -1,
4421 cancellable,
4422 callback,
4423 user_data);
4424}
4425
4426/**
4427 * sensor_value_call_get_value_finish:
4428 * @proxy: A #SensorValueProxy.
4429 * @out_value: (out): Return location for return parameter or %NULL to ignore.
4430 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_get_value().
4431 * @error: Return location for error or %NULL.
4432 *
4433 * Finishes an operation started with sensor_value_call_get_value().
4434 *
4435 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4436 */
4437gboolean
4438sensor_value_call_get_value_finish (
4439 SensorValue *proxy,
4440 GVariant **out_value,
4441 GAsyncResult *res,
4442 GError **error)
4443{
4444 GVariant *_ret;
4445 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4446 if (_ret == NULL)
4447 goto _out;
4448 g_variant_get (_ret,
4449 "(@v)",
4450 out_value);
4451 g_variant_unref (_ret);
4452_out:
4453 return _ret != NULL;
4454}
4455
4456/**
4457 * sensor_value_call_get_value_sync:
4458 * @proxy: A #SensorValueProxy.
4459 * @out_value: (out): Return location for return parameter or %NULL to ignore.
4460 * @cancellable: (allow-none): A #GCancellable or %NULL.
4461 * @error: Return location for error or %NULL.
4462 *
4463 * 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.
4464 *
4465 * See sensor_value_call_get_value() for the asynchronous version of this method.
4466 *
4467 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4468 */
4469gboolean
4470sensor_value_call_get_value_sync (
4471 SensorValue *proxy,
4472 GVariant **out_value,
4473 GCancellable *cancellable,
4474 GError **error)
4475{
4476 GVariant *_ret;
4477 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4478 "getValue",
4479 g_variant_new ("()"),
4480 G_DBUS_CALL_FLAGS_NONE,
4481 -1,
4482 cancellable,
4483 error);
4484 if (_ret == NULL)
4485 goto _out;
4486 g_variant_get (_ret,
4487 "(@v)",
4488 out_value);
4489 g_variant_unref (_ret);
4490_out:
4491 return _ret != NULL;
4492}
4493
4494/**
Norman James19e45912015-10-04 20:19:41 -05004495 * sensor_value_call_set_value:
4496 * @proxy: A #SensorValueProxy.
4497 * @arg_value: Argument to pass with the method invocation.
4498 * @cancellable: (allow-none): A #GCancellable or %NULL.
4499 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4500 * @user_data: User data to pass to @callback.
4501 *
4502 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method on @proxy.
4503 * 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.
4504 * You can then call sensor_value_call_set_value_finish() to get the result of the operation.
4505 *
4506 * See sensor_value_call_set_value_sync() for the synchronous, blocking version of this method.
4507 */
4508void
4509sensor_value_call_set_value (
4510 SensorValue *proxy,
4511 GVariant *arg_value,
4512 GCancellable *cancellable,
4513 GAsyncReadyCallback callback,
4514 gpointer user_data)
4515{
4516 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4517 "setValue",
4518 g_variant_new ("(@v)",
4519 arg_value),
4520 G_DBUS_CALL_FLAGS_NONE,
4521 -1,
4522 cancellable,
4523 callback,
4524 user_data);
4525}
4526
4527/**
4528 * sensor_value_call_set_value_finish:
4529 * @proxy: A #SensorValueProxy.
4530 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_set_value().
4531 * @error: Return location for error or %NULL.
4532 *
4533 * Finishes an operation started with sensor_value_call_set_value().
4534 *
4535 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4536 */
4537gboolean
4538sensor_value_call_set_value_finish (
4539 SensorValue *proxy,
4540 GAsyncResult *res,
4541 GError **error)
4542{
4543 GVariant *_ret;
4544 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4545 if (_ret == NULL)
4546 goto _out;
4547 g_variant_get (_ret,
4548 "()");
4549 g_variant_unref (_ret);
4550_out:
4551 return _ret != NULL;
4552}
4553
4554/**
4555 * sensor_value_call_set_value_sync:
4556 * @proxy: A #SensorValueProxy.
4557 * @arg_value: Argument to pass with the method invocation.
4558 * @cancellable: (allow-none): A #GCancellable or %NULL.
4559 * @error: Return location for error or %NULL.
4560 *
4561 * 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.
4562 *
4563 * See sensor_value_call_set_value() for the asynchronous version of this method.
4564 *
4565 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4566 */
4567gboolean
4568sensor_value_call_set_value_sync (
4569 SensorValue *proxy,
4570 GVariant *arg_value,
4571 GCancellable *cancellable,
4572 GError **error)
4573{
4574 GVariant *_ret;
4575 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4576 "setValue",
4577 g_variant_new ("(@v)",
4578 arg_value),
4579 G_DBUS_CALL_FLAGS_NONE,
4580 -1,
4581 cancellable,
4582 error);
4583 if (_ret == NULL)
4584 goto _out;
4585 g_variant_get (_ret,
4586 "()");
4587 g_variant_unref (_ret);
4588_out:
4589 return _ret != NULL;
4590}
4591
4592/**
Norman James362a80f2015-09-14 14:04:39 -05004593 * sensor_value_complete_init:
4594 * @object: A #SensorValue.
4595 * @invocation: (transfer full): A #GDBusMethodInvocation.
4596 *
4597 * 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.
4598 *
4599 * This method will free @invocation, you cannot use it afterwards.
4600 */
4601void
4602sensor_value_complete_init (
4603 SensorValue *object,
4604 GDBusMethodInvocation *invocation)
4605{
4606 g_dbus_method_invocation_return_value (invocation,
4607 g_variant_new ("()"));
4608}
4609
4610/**
4611 * sensor_value_complete_get_value:
4612 * @object: A #SensorValue.
4613 * @invocation: (transfer full): A #GDBusMethodInvocation.
4614 * @value: Parameter to return.
4615 *
4616 * 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.
4617 *
4618 * This method will free @invocation, you cannot use it afterwards.
4619 */
4620void
4621sensor_value_complete_get_value (
4622 SensorValue *object,
4623 GDBusMethodInvocation *invocation,
4624 GVariant *value)
4625{
4626 g_dbus_method_invocation_return_value (invocation,
4627 g_variant_new ("(@v)",
4628 value));
4629}
4630
Norman James19e45912015-10-04 20:19:41 -05004631/**
4632 * sensor_value_complete_set_value:
4633 * @object: A #SensorValue.
4634 * @invocation: (transfer full): A #GDBusMethodInvocation.
4635 *
4636 * 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.
4637 *
4638 * This method will free @invocation, you cannot use it afterwards.
4639 */
4640void
4641sensor_value_complete_set_value (
4642 SensorValue *object,
4643 GDBusMethodInvocation *invocation)
4644{
4645 g_dbus_method_invocation_return_value (invocation,
4646 g_variant_new ("()"));
4647}
4648
Norman James362a80f2015-09-14 14:04:39 -05004649/* ------------------------------------------------------------------------ */
4650
4651/**
4652 * SensorValueProxy:
4653 *
4654 * The #SensorValueProxy structure contains only private data and should only be accessed using the provided API.
4655 */
4656
4657/**
4658 * SensorValueProxyClass:
4659 * @parent_class: The parent class.
4660 *
4661 * Class structure for #SensorValueProxy.
4662 */
4663
4664struct _SensorValueProxyPrivate
4665{
4666 GData *qdata;
4667};
4668
4669static void sensor_value_proxy_iface_init (SensorValueIface *iface);
4670
4671#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4672G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
4673 G_ADD_PRIVATE (SensorValueProxy)
4674 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init));
4675
4676#else
4677G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
4678 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init));
4679
4680#endif
4681static void
4682sensor_value_proxy_finalize (GObject *object)
4683{
4684 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4685 g_datalist_clear (&proxy->priv->qdata);
4686 G_OBJECT_CLASS (sensor_value_proxy_parent_class)->finalize (object);
4687}
4688
4689static void
4690sensor_value_proxy_get_property (GObject *object,
4691 guint prop_id,
4692 GValue *value,
4693 GParamSpec *pspec G_GNUC_UNUSED)
4694{
4695 const _ExtendedGDBusPropertyInfo *info;
4696 GVariant *variant;
Norman Jamesdfdaca92015-09-27 22:11:15 -05004697 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05004698 info = _sensor_value_property_info_pointers[prop_id - 1];
4699 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
4700 if (info->use_gvariant)
4701 {
4702 g_value_set_variant (value, variant);
4703 }
4704 else
4705 {
4706 if (variant != NULL)
4707 g_dbus_gvariant_to_gvalue (variant, value);
4708 }
4709 if (variant != NULL)
4710 g_variant_unref (variant);
4711}
4712
4713static void
4714sensor_value_proxy_set_property_cb (GDBusProxy *proxy,
4715 GAsyncResult *res,
4716 gpointer user_data)
4717{
4718 const _ExtendedGDBusPropertyInfo *info = user_data;
4719 GError *error;
4720 GVariant *_ret;
4721 error = NULL;
4722 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
4723 if (!_ret)
4724 {
4725 g_warning ("Error setting property '%s' on interface org.openbmc.SensorValue: %s (%s, %d)",
4726 info->parent_struct.name,
4727 error->message, g_quark_to_string (error->domain), error->code);
4728 g_error_free (error);
4729 }
4730 else
4731 {
4732 g_variant_unref (_ret);
4733 }
4734}
4735
4736static void
4737sensor_value_proxy_set_property (GObject *object,
4738 guint prop_id,
4739 const GValue *value,
4740 GParamSpec *pspec G_GNUC_UNUSED)
4741{
4742 const _ExtendedGDBusPropertyInfo *info;
4743 GVariant *variant;
Norman Jamesdfdaca92015-09-27 22:11:15 -05004744 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05004745 info = _sensor_value_property_info_pointers[prop_id - 1];
4746 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
4747 g_dbus_proxy_call (G_DBUS_PROXY (object),
4748 "org.freedesktop.DBus.Properties.Set",
4749 g_variant_new ("(ssv)", "org.openbmc.SensorValue", info->parent_struct.name, variant),
4750 G_DBUS_CALL_FLAGS_NONE,
4751 -1,
4752 NULL, (GAsyncReadyCallback) sensor_value_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
4753 g_variant_unref (variant);
4754}
4755
4756static void
4757sensor_value_proxy_g_signal (GDBusProxy *proxy,
4758 const gchar *sender_name G_GNUC_UNUSED,
4759 const gchar *signal_name,
4760 GVariant *parameters)
4761{
4762 _ExtendedGDBusSignalInfo *info;
4763 GVariantIter iter;
4764 GVariant *child;
4765 GValue *paramv;
4766 guint num_params;
4767 guint n;
4768 guint signal_id;
4769 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, signal_name);
4770 if (info == NULL)
4771 return;
4772 num_params = g_variant_n_children (parameters);
4773 paramv = g_new0 (GValue, num_params + 1);
4774 g_value_init (&paramv[0], TYPE_SENSOR_VALUE);
4775 g_value_set_object (&paramv[0], proxy);
4776 g_variant_iter_init (&iter, parameters);
4777 n = 1;
4778 while ((child = g_variant_iter_next_value (&iter)) != NULL)
4779 {
4780 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
4781 if (arg_info->use_gvariant)
4782 {
4783 g_value_init (&paramv[n], G_TYPE_VARIANT);
4784 g_value_set_variant (&paramv[n], child);
4785 n++;
4786 }
4787 else
4788 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
4789 g_variant_unref (child);
4790 }
4791 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
4792 g_signal_emitv (paramv, signal_id, 0, NULL);
4793 for (n = 0; n < num_params + 1; n++)
4794 g_value_unset (&paramv[n]);
4795 g_free (paramv);
4796}
4797
4798static void
4799sensor_value_proxy_g_properties_changed (GDBusProxy *_proxy,
4800 GVariant *changed_properties,
4801 const gchar *const *invalidated_properties)
4802{
4803 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (_proxy);
4804 guint n;
4805 const gchar *key;
4806 GVariantIter *iter;
4807 _ExtendedGDBusPropertyInfo *info;
4808 g_variant_get (changed_properties, "a{sv}", &iter);
4809 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
4810 {
4811 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, key);
4812 g_datalist_remove_data (&proxy->priv->qdata, key);
4813 if (info != NULL)
4814 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4815 }
4816 g_variant_iter_free (iter);
4817 for (n = 0; invalidated_properties[n] != NULL; n++)
4818 {
4819 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, invalidated_properties[n]);
4820 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
4821 if (info != NULL)
4822 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4823 }
4824}
4825
4826static GVariant *
4827sensor_value_proxy_get_value (SensorValue *object)
4828{
4829 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4830 GVariant *variant;
4831 GVariant *value = NULL;
4832 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value");
4833 value = variant;
4834 if (variant != NULL)
4835 g_variant_unref (variant);
4836 return value;
4837}
4838
4839static const gchar *
4840sensor_value_proxy_get_units (SensorValue *object)
4841{
4842 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4843 GVariant *variant;
4844 const gchar *value = NULL;
4845 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units");
4846 if (variant != NULL)
4847 {
4848 value = g_variant_get_string (variant, NULL);
4849 g_variant_unref (variant);
4850 }
4851 return value;
4852}
4853
4854static gint
4855sensor_value_proxy_get_poll_interval (SensorValue *object)
4856{
4857 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4858 GVariant *variant;
4859 gint value = 0;
4860 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
4861 if (variant != NULL)
4862 {
4863 value = g_variant_get_int32 (variant);
4864 g_variant_unref (variant);
4865 }
4866 return value;
4867}
4868
4869static gint
4870sensor_value_proxy_get_heatbeat (SensorValue *object)
4871{
4872 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4873 GVariant *variant;
4874 gint value = 0;
4875 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
4876 if (variant != NULL)
4877 {
4878 value = g_variant_get_int32 (variant);
4879 g_variant_unref (variant);
4880 }
4881 return value;
4882}
4883
4884static gboolean
4885sensor_value_proxy_get_settable (SensorValue *object)
4886{
4887 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4888 GVariant *variant;
4889 gboolean value = 0;
4890 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "settable");
4891 if (variant != NULL)
4892 {
4893 value = g_variant_get_boolean (variant);
4894 g_variant_unref (variant);
4895 }
4896 return value;
4897}
4898
Norman James362a80f2015-09-14 14:04:39 -05004899static void
4900sensor_value_proxy_init (SensorValueProxy *proxy)
4901{
4902#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4903 proxy->priv = sensor_value_proxy_get_instance_private (proxy);
4904#else
4905 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_VALUE_PROXY, SensorValueProxyPrivate);
4906#endif
4907
4908 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_value_interface_info ());
4909}
4910
4911static void
4912sensor_value_proxy_class_init (SensorValueProxyClass *klass)
4913{
4914 GObjectClass *gobject_class;
4915 GDBusProxyClass *proxy_class;
4916
4917 gobject_class = G_OBJECT_CLASS (klass);
4918 gobject_class->finalize = sensor_value_proxy_finalize;
4919 gobject_class->get_property = sensor_value_proxy_get_property;
4920 gobject_class->set_property = sensor_value_proxy_set_property;
4921
4922 proxy_class = G_DBUS_PROXY_CLASS (klass);
4923 proxy_class->g_signal = sensor_value_proxy_g_signal;
4924 proxy_class->g_properties_changed = sensor_value_proxy_g_properties_changed;
4925
4926 sensor_value_override_properties (gobject_class, 1);
4927
4928#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
4929 g_type_class_add_private (klass, sizeof (SensorValueProxyPrivate));
4930#endif
4931}
4932
4933static void
4934sensor_value_proxy_iface_init (SensorValueIface *iface)
4935{
4936 iface->get_value = sensor_value_proxy_get_value;
4937 iface->get_units = sensor_value_proxy_get_units;
4938 iface->get_poll_interval = sensor_value_proxy_get_poll_interval;
4939 iface->get_heatbeat = sensor_value_proxy_get_heatbeat;
4940 iface->get_settable = sensor_value_proxy_get_settable;
Norman James362a80f2015-09-14 14:04:39 -05004941}
4942
4943/**
4944 * sensor_value_proxy_new:
4945 * @connection: A #GDBusConnection.
4946 * @flags: Flags from the #GDBusProxyFlags enumeration.
4947 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
4948 * @object_path: An object path.
4949 * @cancellable: (allow-none): A #GCancellable or %NULL.
4950 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
4951 * @user_data: User data to pass to @callback.
4952 *
4953 * 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.
4954 *
4955 * 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.
4956 * You can then call sensor_value_proxy_new_finish() to get the result of the operation.
4957 *
4958 * See sensor_value_proxy_new_sync() for the synchronous, blocking version of this constructor.
4959 */
4960void
4961sensor_value_proxy_new (
4962 GDBusConnection *connection,
4963 GDBusProxyFlags flags,
4964 const gchar *name,
4965 const gchar *object_path,
4966 GCancellable *cancellable,
4967 GAsyncReadyCallback callback,
4968 gpointer user_data)
4969{
4970 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);
4971}
4972
4973/**
4974 * sensor_value_proxy_new_finish:
4975 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new().
4976 * @error: Return location for error or %NULL
4977 *
4978 * Finishes an operation started with sensor_value_proxy_new().
4979 *
4980 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
4981 */
4982SensorValue *
4983sensor_value_proxy_new_finish (
4984 GAsyncResult *res,
4985 GError **error)
4986{
4987 GObject *ret;
4988 GObject *source_object;
4989 source_object = g_async_result_get_source_object (res);
4990 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
4991 g_object_unref (source_object);
4992 if (ret != NULL)
4993 return SENSOR_VALUE (ret);
4994 else
4995 return NULL;
4996}
4997
4998/**
4999 * sensor_value_proxy_new_sync:
5000 * @connection: A #GDBusConnection.
5001 * @flags: Flags from the #GDBusProxyFlags enumeration.
5002 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
5003 * @object_path: An object path.
5004 * @cancellable: (allow-none): A #GCancellable or %NULL.
5005 * @error: Return location for error or %NULL
5006 *
5007 * 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.
5008 *
5009 * The calling thread is blocked until a reply is received.
5010 *
5011 * See sensor_value_proxy_new() for the asynchronous version of this constructor.
5012 *
5013 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5014 */
5015SensorValue *
5016sensor_value_proxy_new_sync (
5017 GDBusConnection *connection,
5018 GDBusProxyFlags flags,
5019 const gchar *name,
5020 const gchar *object_path,
5021 GCancellable *cancellable,
5022 GError **error)
5023{
5024 GInitable *ret;
5025 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);
5026 if (ret != NULL)
5027 return SENSOR_VALUE (ret);
5028 else
5029 return NULL;
5030}
5031
5032
5033/**
5034 * sensor_value_proxy_new_for_bus:
5035 * @bus_type: A #GBusType.
5036 * @flags: Flags from the #GDBusProxyFlags enumeration.
5037 * @name: A bus name (well-known or unique).
5038 * @object_path: An object path.
5039 * @cancellable: (allow-none): A #GCancellable or %NULL.
5040 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
5041 * @user_data: User data to pass to @callback.
5042 *
5043 * Like sensor_value_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
5044 *
5045 * 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.
5046 * You can then call sensor_value_proxy_new_for_bus_finish() to get the result of the operation.
5047 *
5048 * See sensor_value_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
5049 */
5050void
5051sensor_value_proxy_new_for_bus (
5052 GBusType bus_type,
5053 GDBusProxyFlags flags,
5054 const gchar *name,
5055 const gchar *object_path,
5056 GCancellable *cancellable,
5057 GAsyncReadyCallback callback,
5058 gpointer user_data)
5059{
5060 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);
5061}
5062
5063/**
5064 * sensor_value_proxy_new_for_bus_finish:
5065 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new_for_bus().
5066 * @error: Return location for error or %NULL
5067 *
5068 * Finishes an operation started with sensor_value_proxy_new_for_bus().
5069 *
5070 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5071 */
5072SensorValue *
5073sensor_value_proxy_new_for_bus_finish (
5074 GAsyncResult *res,
5075 GError **error)
5076{
5077 GObject *ret;
5078 GObject *source_object;
5079 source_object = g_async_result_get_source_object (res);
5080 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
5081 g_object_unref (source_object);
5082 if (ret != NULL)
5083 return SENSOR_VALUE (ret);
5084 else
5085 return NULL;
5086}
5087
5088/**
5089 * sensor_value_proxy_new_for_bus_sync:
5090 * @bus_type: A #GBusType.
5091 * @flags: Flags from the #GDBusProxyFlags enumeration.
5092 * @name: A bus name (well-known or unique).
5093 * @object_path: An object path.
5094 * @cancellable: (allow-none): A #GCancellable or %NULL.
5095 * @error: Return location for error or %NULL
5096 *
5097 * Like sensor_value_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
5098 *
5099 * The calling thread is blocked until a reply is received.
5100 *
5101 * See sensor_value_proxy_new_for_bus() for the asynchronous version of this constructor.
5102 *
5103 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5104 */
5105SensorValue *
5106sensor_value_proxy_new_for_bus_sync (
5107 GBusType bus_type,
5108 GDBusProxyFlags flags,
5109 const gchar *name,
5110 const gchar *object_path,
5111 GCancellable *cancellable,
5112 GError **error)
5113{
5114 GInitable *ret;
5115 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);
5116 if (ret != NULL)
5117 return SENSOR_VALUE (ret);
5118 else
5119 return NULL;
5120}
5121
5122
5123/* ------------------------------------------------------------------------ */
5124
5125/**
5126 * SensorValueSkeleton:
5127 *
5128 * The #SensorValueSkeleton structure contains only private data and should only be accessed using the provided API.
5129 */
5130
5131/**
5132 * SensorValueSkeletonClass:
5133 * @parent_class: The parent class.
5134 *
5135 * Class structure for #SensorValueSkeleton.
5136 */
5137
5138struct _SensorValueSkeletonPrivate
5139{
5140 GValue *properties;
5141 GList *changed_properties;
5142 GSource *changed_properties_idle_source;
5143 GMainContext *context;
5144 GMutex lock;
5145};
5146
5147static void
5148_sensor_value_skeleton_handle_method_call (
5149 GDBusConnection *connection G_GNUC_UNUSED,
5150 const gchar *sender G_GNUC_UNUSED,
5151 const gchar *object_path G_GNUC_UNUSED,
5152 const gchar *interface_name,
5153 const gchar *method_name,
5154 GVariant *parameters,
5155 GDBusMethodInvocation *invocation,
5156 gpointer user_data)
5157{
5158 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5159 _ExtendedGDBusMethodInfo *info;
5160 GVariantIter iter;
5161 GVariant *child;
5162 GValue *paramv;
5163 guint num_params;
5164 guint num_extra;
5165 guint n;
5166 guint signal_id;
5167 GValue return_value = G_VALUE_INIT;
5168 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
5169 g_assert (info != NULL);
5170 num_params = g_variant_n_children (parameters);
5171 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
5172 n = 0;
5173 g_value_init (&paramv[n], TYPE_SENSOR_VALUE);
5174 g_value_set_object (&paramv[n++], skeleton);
5175 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
5176 g_value_set_object (&paramv[n++], invocation);
5177 if (info->pass_fdlist)
5178 {
5179#ifdef G_OS_UNIX
5180 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
5181 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
5182#else
5183 g_assert_not_reached ();
5184#endif
5185 }
5186 g_variant_iter_init (&iter, parameters);
5187 while ((child = g_variant_iter_next_value (&iter)) != NULL)
5188 {
5189 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
5190 if (arg_info->use_gvariant)
5191 {
5192 g_value_init (&paramv[n], G_TYPE_VARIANT);
5193 g_value_set_variant (&paramv[n], child);
5194 n++;
5195 }
5196 else
5197 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
5198 g_variant_unref (child);
5199 }
5200 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
5201 g_value_init (&return_value, G_TYPE_BOOLEAN);
5202 g_signal_emitv (paramv, signal_id, 0, &return_value);
5203 if (!g_value_get_boolean (&return_value))
5204 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);
5205 g_value_unset (&return_value);
5206 for (n = 0; n < num_params + num_extra; n++)
5207 g_value_unset (&paramv[n]);
5208 g_free (paramv);
5209}
5210
5211static GVariant *
5212_sensor_value_skeleton_handle_get_property (
5213 GDBusConnection *connection G_GNUC_UNUSED,
5214 const gchar *sender G_GNUC_UNUSED,
5215 const gchar *object_path G_GNUC_UNUSED,
5216 const gchar *interface_name G_GNUC_UNUSED,
5217 const gchar *property_name,
5218 GError **error,
5219 gpointer user_data)
5220{
5221 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5222 GValue value = G_VALUE_INIT;
5223 GParamSpec *pspec;
5224 _ExtendedGDBusPropertyInfo *info;
5225 GVariant *ret;
5226 ret = NULL;
5227 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
5228 g_assert (info != NULL);
5229 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5230 if (pspec == NULL)
5231 {
5232 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5233 }
5234 else
5235 {
5236 g_value_init (&value, pspec->value_type);
5237 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5238 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
5239 g_value_unset (&value);
5240 }
5241 return ret;
5242}
5243
5244static gboolean
5245_sensor_value_skeleton_handle_set_property (
5246 GDBusConnection *connection G_GNUC_UNUSED,
5247 const gchar *sender G_GNUC_UNUSED,
5248 const gchar *object_path G_GNUC_UNUSED,
5249 const gchar *interface_name G_GNUC_UNUSED,
5250 const gchar *property_name,
5251 GVariant *variant,
5252 GError **error,
5253 gpointer user_data)
5254{
5255 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5256 GValue value = G_VALUE_INIT;
5257 GParamSpec *pspec;
5258 _ExtendedGDBusPropertyInfo *info;
5259 gboolean ret;
5260 ret = FALSE;
5261 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
5262 g_assert (info != NULL);
5263 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5264 if (pspec == NULL)
5265 {
5266 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5267 }
5268 else
5269 {
5270 if (info->use_gvariant)
5271 g_value_set_variant (&value, variant);
5272 else
5273 g_dbus_gvariant_to_gvalue (variant, &value);
5274 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5275 g_value_unset (&value);
5276 ret = TRUE;
5277 }
5278 return ret;
5279}
5280
5281static const GDBusInterfaceVTable _sensor_value_skeleton_vtable =
5282{
5283 _sensor_value_skeleton_handle_method_call,
5284 _sensor_value_skeleton_handle_get_property,
5285 _sensor_value_skeleton_handle_set_property,
5286 {NULL}
5287};
5288
5289static GDBusInterfaceInfo *
5290sensor_value_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5291{
5292 return sensor_value_interface_info ();
5293}
5294
5295static GDBusInterfaceVTable *
5296sensor_value_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5297{
5298 return (GDBusInterfaceVTable *) &_sensor_value_skeleton_vtable;
5299}
5300
5301static GVariant *
5302sensor_value_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
5303{
5304 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
5305
5306 GVariantBuilder builder;
5307 guint n;
5308 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5309 if (_sensor_value_interface_info.parent_struct.properties == NULL)
5310 goto out;
5311 for (n = 0; _sensor_value_interface_info.parent_struct.properties[n] != NULL; n++)
5312 {
5313 GDBusPropertyInfo *info = _sensor_value_interface_info.parent_struct.properties[n];
5314 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
5315 {
5316 GVariant *value;
5317 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);
5318 if (value != NULL)
5319 {
5320 g_variant_take_ref (value);
5321 g_variant_builder_add (&builder, "{sv}", info->name, value);
5322 g_variant_unref (value);
5323 }
5324 }
5325 }
5326out:
5327 return g_variant_builder_end (&builder);
5328}
5329
5330static gboolean _sensor_value_emit_changed (gpointer user_data);
5331
5332static void
5333sensor_value_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
5334{
5335 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
5336 gboolean emit_changed = FALSE;
5337
5338 g_mutex_lock (&skeleton->priv->lock);
5339 if (skeleton->priv->changed_properties_idle_source != NULL)
5340 {
5341 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5342 skeleton->priv->changed_properties_idle_source = NULL;
5343 emit_changed = TRUE;
5344 }
5345 g_mutex_unlock (&skeleton->priv->lock);
5346
5347 if (emit_changed)
5348 _sensor_value_emit_changed (skeleton);
5349}
5350
5351static void
5352_sensor_value_on_signal_changed (
5353 SensorValue *object,
5354 GVariant *arg_value,
5355 const gchar *arg_units)
5356{
5357 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5358
5359 GList *connections, *l;
5360 GVariant *signal_variant;
5361 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5362
5363 signal_variant = g_variant_ref_sink (g_variant_new ("(@vs)",
5364 arg_value,
5365 arg_units));
5366 for (l = connections; l != NULL; l = l->next)
5367 {
5368 GDBusConnection *connection = l->data;
5369 g_dbus_connection_emit_signal (connection,
5370 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Changed",
5371 signal_variant, NULL);
5372 }
5373 g_variant_unref (signal_variant);
5374 g_list_free_full (connections, g_object_unref);
5375}
5376
5377static void
Norman James32e74e22015-09-15 21:28:06 -05005378_sensor_value_on_signal_error (
5379 SensorValue *object)
5380{
5381 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5382
5383 GList *connections, *l;
5384 GVariant *signal_variant;
5385 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5386
5387 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
5388 for (l = connections; l != NULL; l = l->next)
5389 {
5390 GDBusConnection *connection = l->data;
5391 g_dbus_connection_emit_signal (connection,
5392 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Error",
5393 signal_variant, NULL);
5394 }
5395 g_variant_unref (signal_variant);
5396 g_list_free_full (connections, g_object_unref);
5397}
5398
5399static void
Norman James362a80f2015-09-14 14:04:39 -05005400_sensor_value_on_signal_heartbeat (
5401 SensorValue *object,
5402 const gchar *arg_bus_name)
5403{
5404 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5405
5406 GList *connections, *l;
5407 GVariant *signal_variant;
5408 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5409
5410 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
5411 arg_bus_name));
5412 for (l = connections; l != NULL; l = l->next)
5413 {
5414 GDBusConnection *connection = l->data;
5415 g_dbus_connection_emit_signal (connection,
5416 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Heartbeat",
5417 signal_variant, NULL);
5418 }
5419 g_variant_unref (signal_variant);
5420 g_list_free_full (connections, g_object_unref);
5421}
5422
5423static void sensor_value_skeleton_iface_init (SensorValueIface *iface);
5424#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5425G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5426 G_ADD_PRIVATE (SensorValueSkeleton)
5427 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init));
5428
5429#else
5430G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5431 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init));
5432
5433#endif
5434static void
5435sensor_value_skeleton_finalize (GObject *object)
5436{
5437 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5438 guint n;
Norman Jamesdfdaca92015-09-27 22:11:15 -05005439 for (n = 0; n < 5; n++)
Norman James362a80f2015-09-14 14:04:39 -05005440 g_value_unset (&skeleton->priv->properties[n]);
5441 g_free (skeleton->priv->properties);
5442 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5443 if (skeleton->priv->changed_properties_idle_source != NULL)
5444 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5445 g_main_context_unref (skeleton->priv->context);
5446 g_mutex_clear (&skeleton->priv->lock);
5447 G_OBJECT_CLASS (sensor_value_skeleton_parent_class)->finalize (object);
5448}
5449
5450static void
5451sensor_value_skeleton_get_property (GObject *object,
5452 guint prop_id,
5453 GValue *value,
5454 GParamSpec *pspec G_GNUC_UNUSED)
5455{
5456 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman Jamesdfdaca92015-09-27 22:11:15 -05005457 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05005458 g_mutex_lock (&skeleton->priv->lock);
5459 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
5460 g_mutex_unlock (&skeleton->priv->lock);
5461}
5462
5463static gboolean
5464_sensor_value_emit_changed (gpointer user_data)
5465{
5466 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5467 GList *l;
5468 GVariantBuilder builder;
5469 GVariantBuilder invalidated_builder;
5470 guint num_changes;
5471
5472 g_mutex_lock (&skeleton->priv->lock);
5473 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5474 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
5475 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
5476 {
5477 ChangedProperty *cp = l->data;
5478 GVariant *variant;
5479 const GValue *cur_value;
5480
5481 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
5482 if (!_g_value_equal (cur_value, &cp->orig_value))
5483 {
5484 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
5485 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
5486 g_variant_unref (variant);
5487 num_changes++;
5488 }
5489 }
5490 if (num_changes > 0)
5491 {
5492 GList *connections, *ll;
5493 GVariant *signal_variant;
5494 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorValue",
5495 &builder, &invalidated_builder));
5496 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5497 for (ll = connections; ll != NULL; ll = ll->next)
5498 {
5499 GDBusConnection *connection = ll->data;
5500
5501 g_dbus_connection_emit_signal (connection,
5502 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
5503 "org.freedesktop.DBus.Properties",
5504 "PropertiesChanged",
5505 signal_variant,
5506 NULL);
5507 }
5508 g_variant_unref (signal_variant);
5509 g_list_free_full (connections, g_object_unref);
5510 }
5511 else
5512 {
5513 g_variant_builder_clear (&builder);
5514 g_variant_builder_clear (&invalidated_builder);
5515 }
5516 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5517 skeleton->priv->changed_properties = NULL;
5518 skeleton->priv->changed_properties_idle_source = NULL;
5519 g_mutex_unlock (&skeleton->priv->lock);
5520 return FALSE;
5521}
5522
5523static void
5524_sensor_value_schedule_emit_changed (SensorValueSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
5525{
5526 ChangedProperty *cp;
5527 GList *l;
5528 cp = NULL;
5529 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
5530 {
5531 ChangedProperty *i_cp = l->data;
5532 if (i_cp->info == info)
5533 {
5534 cp = i_cp;
5535 break;
5536 }
5537 }
5538 if (cp == NULL)
5539 {
5540 cp = g_new0 (ChangedProperty, 1);
5541 cp->prop_id = prop_id;
5542 cp->info = info;
5543 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
5544 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
5545 g_value_copy (orig_value, &cp->orig_value);
5546 }
5547}
5548
5549static void
5550sensor_value_skeleton_notify (GObject *object,
5551 GParamSpec *pspec G_GNUC_UNUSED)
5552{
5553 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5554 g_mutex_lock (&skeleton->priv->lock);
5555 if (skeleton->priv->changed_properties != NULL &&
5556 skeleton->priv->changed_properties_idle_source == NULL)
5557 {
5558 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
5559 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
5560 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_value_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
5561 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
5562 g_source_unref (skeleton->priv->changed_properties_idle_source);
5563 }
5564 g_mutex_unlock (&skeleton->priv->lock);
5565}
5566
5567static void
5568sensor_value_skeleton_set_property (GObject *object,
5569 guint prop_id,
5570 const GValue *value,
5571 GParamSpec *pspec)
5572{
5573 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman Jamesdfdaca92015-09-27 22:11:15 -05005574 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05005575 g_mutex_lock (&skeleton->priv->lock);
5576 g_object_freeze_notify (object);
5577 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
5578 {
5579 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
5580 _sensor_value_schedule_emit_changed (skeleton, _sensor_value_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
5581 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
5582 g_object_notify_by_pspec (object, pspec);
5583 }
5584 g_mutex_unlock (&skeleton->priv->lock);
5585 g_object_thaw_notify (object);
5586}
5587
5588static void
5589sensor_value_skeleton_init (SensorValueSkeleton *skeleton)
5590{
5591#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5592 skeleton->priv = sensor_value_skeleton_get_instance_private (skeleton);
5593#else
5594 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_VALUE_SKELETON, SensorValueSkeletonPrivate);
5595#endif
5596
5597 g_mutex_init (&skeleton->priv->lock);
5598 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman Jamesdfdaca92015-09-27 22:11:15 -05005599 skeleton->priv->properties = g_new0 (GValue, 5);
Norman James362a80f2015-09-14 14:04:39 -05005600 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
5601 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
5602 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
5603 g_value_init (&skeleton->priv->properties[3], G_TYPE_INT);
5604 g_value_init (&skeleton->priv->properties[4], G_TYPE_BOOLEAN);
Norman James362a80f2015-09-14 14:04:39 -05005605}
5606
5607static GVariant *
5608sensor_value_skeleton_get_value (SensorValue *object)
5609{
5610 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5611 GVariant *value;
5612 g_mutex_lock (&skeleton->priv->lock);
5613 value = g_value_get_variant (&(skeleton->priv->properties[0]));
5614 g_mutex_unlock (&skeleton->priv->lock);
5615 return value;
5616}
5617
5618static const gchar *
5619sensor_value_skeleton_get_units (SensorValue *object)
5620{
5621 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5622 const gchar *value;
5623 g_mutex_lock (&skeleton->priv->lock);
5624 value = g_value_get_string (&(skeleton->priv->properties[1]));
5625 g_mutex_unlock (&skeleton->priv->lock);
5626 return value;
5627}
5628
5629static gint
5630sensor_value_skeleton_get_poll_interval (SensorValue *object)
5631{
5632 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5633 gint value;
5634 g_mutex_lock (&skeleton->priv->lock);
5635 value = g_value_get_int (&(skeleton->priv->properties[2]));
5636 g_mutex_unlock (&skeleton->priv->lock);
5637 return value;
5638}
5639
5640static gint
5641sensor_value_skeleton_get_heatbeat (SensorValue *object)
5642{
5643 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5644 gint value;
5645 g_mutex_lock (&skeleton->priv->lock);
5646 value = g_value_get_int (&(skeleton->priv->properties[3]));
5647 g_mutex_unlock (&skeleton->priv->lock);
5648 return value;
5649}
5650
5651static gboolean
5652sensor_value_skeleton_get_settable (SensorValue *object)
5653{
5654 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5655 gboolean value;
5656 g_mutex_lock (&skeleton->priv->lock);
5657 value = g_value_get_boolean (&(skeleton->priv->properties[4]));
5658 g_mutex_unlock (&skeleton->priv->lock);
5659 return value;
5660}
5661
Norman James362a80f2015-09-14 14:04:39 -05005662static void
5663sensor_value_skeleton_class_init (SensorValueSkeletonClass *klass)
5664{
5665 GObjectClass *gobject_class;
5666 GDBusInterfaceSkeletonClass *skeleton_class;
5667
5668 gobject_class = G_OBJECT_CLASS (klass);
5669 gobject_class->finalize = sensor_value_skeleton_finalize;
5670 gobject_class->get_property = sensor_value_skeleton_get_property;
5671 gobject_class->set_property = sensor_value_skeleton_set_property;
5672 gobject_class->notify = sensor_value_skeleton_notify;
5673
5674
5675 sensor_value_override_properties (gobject_class, 1);
5676
5677 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
5678 skeleton_class->get_info = sensor_value_skeleton_dbus_interface_get_info;
5679 skeleton_class->get_properties = sensor_value_skeleton_dbus_interface_get_properties;
5680 skeleton_class->flush = sensor_value_skeleton_dbus_interface_flush;
5681 skeleton_class->get_vtable = sensor_value_skeleton_dbus_interface_get_vtable;
5682
5683#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
5684 g_type_class_add_private (klass, sizeof (SensorValueSkeletonPrivate));
5685#endif
5686}
5687
5688static void
5689sensor_value_skeleton_iface_init (SensorValueIface *iface)
5690{
5691 iface->changed = _sensor_value_on_signal_changed;
Norman James32e74e22015-09-15 21:28:06 -05005692 iface->error = _sensor_value_on_signal_error;
Norman James362a80f2015-09-14 14:04:39 -05005693 iface->heartbeat = _sensor_value_on_signal_heartbeat;
5694 iface->get_value = sensor_value_skeleton_get_value;
5695 iface->get_units = sensor_value_skeleton_get_units;
5696 iface->get_poll_interval = sensor_value_skeleton_get_poll_interval;
5697 iface->get_heatbeat = sensor_value_skeleton_get_heatbeat;
5698 iface->get_settable = sensor_value_skeleton_get_settable;
Norman James362a80f2015-09-14 14:04:39 -05005699}
5700
5701/**
5702 * sensor_value_skeleton_new:
5703 *
5704 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
5705 *
5706 * Returns: (transfer full) (type SensorValueSkeleton): The skeleton object.
5707 */
5708SensorValue *
5709sensor_value_skeleton_new (void)
5710{
5711 return SENSOR_VALUE (g_object_new (TYPE_SENSOR_VALUE_SKELETON, NULL));
5712}
5713
5714/* ------------------------------------------------------------------------
5715 * Code for interface org.openbmc.SensorThreshold
5716 * ------------------------------------------------------------------------
5717 */
5718
5719/**
5720 * SECTION:SensorThreshold
5721 * @title: SensorThreshold
5722 * @short_description: Generated C code for the org.openbmc.SensorThreshold D-Bus interface
5723 *
5724 * 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.
5725 */
5726
5727/* ---- Introspection data for org.openbmc.SensorThreshold ---- */
5728
5729static const _ExtendedGDBusArgInfo _sensor_threshold_method_info_get_state_OUT_ARG_state =
5730{
5731 {
5732 -1,
5733 (gchar *) "state",
5734 (gchar *) "y",
5735 NULL
5736 },
5737 FALSE
5738};
5739
5740static const _ExtendedGDBusArgInfo * const _sensor_threshold_method_info_get_state_OUT_ARG_pointers[] =
5741{
5742 &_sensor_threshold_method_info_get_state_OUT_ARG_state,
5743 NULL
5744};
5745
5746static const _ExtendedGDBusMethodInfo _sensor_threshold_method_info_get_state =
5747{
5748 {
5749 -1,
5750 (gchar *) "getState",
5751 NULL,
5752 (GDBusArgInfo **) &_sensor_threshold_method_info_get_state_OUT_ARG_pointers,
5753 NULL
5754 },
5755 "handle-get-state",
5756 FALSE
5757};
5758
5759static const _ExtendedGDBusMethodInfo * const _sensor_threshold_method_info_pointers[] =
5760{
5761 &_sensor_threshold_method_info_get_state,
5762 NULL
5763};
5764
5765static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_warning =
5766{
5767 {
5768 -1,
5769 (gchar *) "Warning",
5770 NULL,
5771 NULL
5772 },
5773 "warning"
5774};
5775
5776static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_critical =
5777{
5778 {
5779 -1,
5780 (gchar *) "Critical",
5781 NULL,
5782 NULL
5783 },
5784 "critical"
5785};
5786
5787static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_normal =
5788{
5789 {
5790 -1,
5791 (gchar *) "Normal",
5792 NULL,
5793 NULL
5794 },
5795 "normal"
5796};
5797
5798static const _ExtendedGDBusSignalInfo * const _sensor_threshold_signal_info_pointers[] =
5799{
5800 &_sensor_threshold_signal_info_warning,
5801 &_sensor_threshold_signal_info_critical,
5802 &_sensor_threshold_signal_info_normal,
5803 NULL
5804};
5805
5806static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_critical =
5807{
5808 {
5809 -1,
5810 (gchar *) "lower_critical",
5811 (gchar *) "v",
5812 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5813 NULL
5814 },
5815 "lower-critical",
5816 FALSE
5817};
5818
5819static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_warning =
5820{
5821 {
5822 -1,
5823 (gchar *) "lower_warning",
5824 (gchar *) "v",
5825 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5826 NULL
5827 },
5828 "lower-warning",
5829 FALSE
5830};
5831
5832static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_warning =
5833{
5834 {
5835 -1,
5836 (gchar *) "upper_warning",
5837 (gchar *) "v",
5838 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5839 NULL
5840 },
5841 "upper-warning",
5842 FALSE
5843};
5844
5845static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_critical =
5846{
5847 {
5848 -1,
5849 (gchar *) "upper_critical",
5850 (gchar *) "v",
5851 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5852 NULL
5853 },
5854 "upper-critical",
5855 FALSE
5856};
5857
5858static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_state =
5859{
5860 {
5861 -1,
5862 (gchar *) "state",
5863 (gchar *) "y",
5864 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
5865 NULL
5866 },
5867 "state",
5868 FALSE
5869};
5870
5871static const _ExtendedGDBusPropertyInfo * const _sensor_threshold_property_info_pointers[] =
5872{
5873 &_sensor_threshold_property_info_lower_critical,
5874 &_sensor_threshold_property_info_lower_warning,
5875 &_sensor_threshold_property_info_upper_warning,
5876 &_sensor_threshold_property_info_upper_critical,
5877 &_sensor_threshold_property_info_state,
5878 NULL
5879};
5880
5881static const _ExtendedGDBusInterfaceInfo _sensor_threshold_interface_info =
5882{
5883 {
5884 -1,
5885 (gchar *) "org.openbmc.SensorThreshold",
5886 (GDBusMethodInfo **) &_sensor_threshold_method_info_pointers,
5887 (GDBusSignalInfo **) &_sensor_threshold_signal_info_pointers,
5888 (GDBusPropertyInfo **) &_sensor_threshold_property_info_pointers,
5889 NULL
5890 },
5891 "sensor-threshold",
5892};
5893
5894
5895/**
5896 * sensor_threshold_interface_info:
5897 *
5898 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> D-Bus interface.
5899 *
5900 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
5901 */
5902GDBusInterfaceInfo *
5903sensor_threshold_interface_info (void)
5904{
5905 return (GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct;
5906}
5907
5908/**
5909 * sensor_threshold_override_properties:
5910 * @klass: The class structure for a #GObject<!-- -->-derived class.
5911 * @property_id_begin: The property id to assign to the first overridden property.
5912 *
5913 * Overrides all #GObject properties in the #SensorThreshold interface for a concrete class.
5914 * The properties are overridden in the order they are defined.
5915 *
5916 * Returns: The last property id.
5917 */
5918guint
5919sensor_threshold_override_properties (GObjectClass *klass, guint property_id_begin)
5920{
5921 g_object_class_override_property (klass, property_id_begin++, "lower-critical");
5922 g_object_class_override_property (klass, property_id_begin++, "lower-warning");
5923 g_object_class_override_property (klass, property_id_begin++, "upper-warning");
5924 g_object_class_override_property (klass, property_id_begin++, "upper-critical");
5925 g_object_class_override_property (klass, property_id_begin++, "state");
5926 return property_id_begin - 1;
5927}
5928
5929
5930
5931/**
5932 * SensorThreshold:
5933 *
5934 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
5935 */
5936
5937/**
5938 * SensorThresholdIface:
5939 * @parent_iface: The parent interface.
5940 * @handle_get_state: Handler for the #SensorThreshold::handle-get-state signal.
5941 * @get_lower_critical: Getter for the #SensorThreshold:lower-critical property.
5942 * @get_lower_warning: Getter for the #SensorThreshold:lower-warning property.
5943 * @get_state: Getter for the #SensorThreshold:state property.
5944 * @get_upper_critical: Getter for the #SensorThreshold:upper-critical property.
5945 * @get_upper_warning: Getter for the #SensorThreshold:upper-warning property.
5946 * @critical: Handler for the #SensorThreshold::critical signal.
5947 * @normal: Handler for the #SensorThreshold::normal signal.
5948 * @warning: Handler for the #SensorThreshold::warning signal.
5949 *
5950 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
5951 */
5952
5953typedef SensorThresholdIface SensorThresholdInterface;
5954G_DEFINE_INTERFACE (SensorThreshold, sensor_threshold, G_TYPE_OBJECT);
5955
5956static void
5957sensor_threshold_default_init (SensorThresholdIface *iface)
5958{
5959 /* GObject signals for incoming D-Bus method calls: */
5960 /**
5961 * SensorThreshold::handle-get-state:
5962 * @object: A #SensorThreshold.
5963 * @invocation: A #GDBusMethodInvocation.
5964 *
5965 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method.
5966 *
5967 * 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.
5968 *
5969 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
5970 */
5971 g_signal_new ("handle-get-state",
5972 G_TYPE_FROM_INTERFACE (iface),
5973 G_SIGNAL_RUN_LAST,
5974 G_STRUCT_OFFSET (SensorThresholdIface, handle_get_state),
5975 g_signal_accumulator_true_handled,
5976 NULL,
5977 g_cclosure_marshal_generic,
5978 G_TYPE_BOOLEAN,
5979 1,
5980 G_TYPE_DBUS_METHOD_INVOCATION);
5981
5982 /* GObject signals for received D-Bus signals: */
5983 /**
5984 * SensorThreshold::warning:
5985 * @object: A #SensorThreshold.
5986 *
5987 * 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.
5988 *
5989 * 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.
5990 */
5991 g_signal_new ("warning",
5992 G_TYPE_FROM_INTERFACE (iface),
5993 G_SIGNAL_RUN_LAST,
5994 G_STRUCT_OFFSET (SensorThresholdIface, warning),
5995 NULL,
5996 NULL,
5997 g_cclosure_marshal_generic,
5998 G_TYPE_NONE,
5999 0);
6000
6001 /**
6002 * SensorThreshold::critical:
6003 * @object: A #SensorThreshold.
6004 *
6005 * 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.
6006 *
6007 * 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.
6008 */
6009 g_signal_new ("critical",
6010 G_TYPE_FROM_INTERFACE (iface),
6011 G_SIGNAL_RUN_LAST,
6012 G_STRUCT_OFFSET (SensorThresholdIface, critical),
6013 NULL,
6014 NULL,
6015 g_cclosure_marshal_generic,
6016 G_TYPE_NONE,
6017 0);
6018
6019 /**
6020 * SensorThreshold::normal:
6021 * @object: A #SensorThreshold.
6022 *
6023 * 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.
6024 *
6025 * 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.
6026 */
6027 g_signal_new ("normal",
6028 G_TYPE_FROM_INTERFACE (iface),
6029 G_SIGNAL_RUN_LAST,
6030 G_STRUCT_OFFSET (SensorThresholdIface, normal),
6031 NULL,
6032 NULL,
6033 g_cclosure_marshal_generic,
6034 G_TYPE_NONE,
6035 0);
6036
6037 /* GObject properties for D-Bus properties: */
6038 /**
6039 * SensorThreshold:lower-critical:
6040 *
6041 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link>.
6042 *
6043 * 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.
6044 */
6045 g_object_interface_install_property (iface,
6046 g_param_spec_variant ("lower-critical", "lower_critical", "lower_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6047 /**
6048 * SensorThreshold:lower-warning:
6049 *
6050 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link>.
6051 *
6052 * 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.
6053 */
6054 g_object_interface_install_property (iface,
6055 g_param_spec_variant ("lower-warning", "lower_warning", "lower_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6056 /**
6057 * SensorThreshold:upper-warning:
6058 *
6059 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link>.
6060 *
6061 * 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.
6062 */
6063 g_object_interface_install_property (iface,
6064 g_param_spec_variant ("upper-warning", "upper_warning", "upper_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6065 /**
6066 * SensorThreshold:upper-critical:
6067 *
6068 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link>.
6069 *
6070 * 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.
6071 */
6072 g_object_interface_install_property (iface,
6073 g_param_spec_variant ("upper-critical", "upper_critical", "upper_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6074 /**
6075 * SensorThreshold:state:
6076 *
6077 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link>.
6078 *
6079 * 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.
6080 */
6081 g_object_interface_install_property (iface,
6082 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6083}
6084
6085/**
6086 * sensor_threshold_get_lower_critical: (skip)
6087 * @object: A #SensorThreshold.
6088 *
6089 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property.
6090 *
6091 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6092 *
6093 * <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>
6094 *
6095 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6096 */
6097GVariant *
6098sensor_threshold_get_lower_critical (SensorThreshold *object)
6099{
6100 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_critical (object);
6101}
6102
6103/**
6104 * sensor_threshold_dup_lower_critical: (skip)
6105 * @object: A #SensorThreshold.
6106 *
6107 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property.
6108 *
6109 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6110 *
6111 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6112 */
6113GVariant *
6114sensor_threshold_dup_lower_critical (SensorThreshold *object)
6115{
6116 GVariant *value;
6117 g_object_get (G_OBJECT (object), "lower-critical", &value, NULL);
6118 return value;
6119}
6120
6121/**
6122 * sensor_threshold_set_lower_critical: (skip)
6123 * @object: A #SensorThreshold.
6124 * @value: The value to set.
6125 *
6126 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property to @value.
6127 *
6128 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6129 */
6130void
6131sensor_threshold_set_lower_critical (SensorThreshold *object, GVariant *value)
6132{
6133 g_object_set (G_OBJECT (object), "lower-critical", value, NULL);
6134}
6135
6136/**
6137 * sensor_threshold_get_lower_warning: (skip)
6138 * @object: A #SensorThreshold.
6139 *
6140 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property.
6141 *
6142 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6143 *
6144 * <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>
6145 *
6146 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6147 */
6148GVariant *
6149sensor_threshold_get_lower_warning (SensorThreshold *object)
6150{
6151 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_warning (object);
6152}
6153
6154/**
6155 * sensor_threshold_dup_lower_warning: (skip)
6156 * @object: A #SensorThreshold.
6157 *
6158 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property.
6159 *
6160 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6161 *
6162 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6163 */
6164GVariant *
6165sensor_threshold_dup_lower_warning (SensorThreshold *object)
6166{
6167 GVariant *value;
6168 g_object_get (G_OBJECT (object), "lower-warning", &value, NULL);
6169 return value;
6170}
6171
6172/**
6173 * sensor_threshold_set_lower_warning: (skip)
6174 * @object: A #SensorThreshold.
6175 * @value: The value to set.
6176 *
6177 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property to @value.
6178 *
6179 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6180 */
6181void
6182sensor_threshold_set_lower_warning (SensorThreshold *object, GVariant *value)
6183{
6184 g_object_set (G_OBJECT (object), "lower-warning", value, NULL);
6185}
6186
6187/**
6188 * sensor_threshold_get_upper_warning: (skip)
6189 * @object: A #SensorThreshold.
6190 *
6191 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property.
6192 *
6193 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6194 *
6195 * <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>
6196 *
6197 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6198 */
6199GVariant *
6200sensor_threshold_get_upper_warning (SensorThreshold *object)
6201{
6202 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_warning (object);
6203}
6204
6205/**
6206 * sensor_threshold_dup_upper_warning: (skip)
6207 * @object: A #SensorThreshold.
6208 *
6209 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property.
6210 *
6211 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6212 *
6213 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6214 */
6215GVariant *
6216sensor_threshold_dup_upper_warning (SensorThreshold *object)
6217{
6218 GVariant *value;
6219 g_object_get (G_OBJECT (object), "upper-warning", &value, NULL);
6220 return value;
6221}
6222
6223/**
6224 * sensor_threshold_set_upper_warning: (skip)
6225 * @object: A #SensorThreshold.
6226 * @value: The value to set.
6227 *
6228 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property to @value.
6229 *
6230 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6231 */
6232void
6233sensor_threshold_set_upper_warning (SensorThreshold *object, GVariant *value)
6234{
6235 g_object_set (G_OBJECT (object), "upper-warning", value, NULL);
6236}
6237
6238/**
6239 * sensor_threshold_get_upper_critical: (skip)
6240 * @object: A #SensorThreshold.
6241 *
6242 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property.
6243 *
6244 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6245 *
6246 * <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>
6247 *
6248 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6249 */
6250GVariant *
6251sensor_threshold_get_upper_critical (SensorThreshold *object)
6252{
6253 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_critical (object);
6254}
6255
6256/**
6257 * sensor_threshold_dup_upper_critical: (skip)
6258 * @object: A #SensorThreshold.
6259 *
6260 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property.
6261 *
6262 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6263 *
6264 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6265 */
6266GVariant *
6267sensor_threshold_dup_upper_critical (SensorThreshold *object)
6268{
6269 GVariant *value;
6270 g_object_get (G_OBJECT (object), "upper-critical", &value, NULL);
6271 return value;
6272}
6273
6274/**
6275 * sensor_threshold_set_upper_critical: (skip)
6276 * @object: A #SensorThreshold.
6277 * @value: The value to set.
6278 *
6279 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property to @value.
6280 *
6281 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6282 */
6283void
6284sensor_threshold_set_upper_critical (SensorThreshold *object, GVariant *value)
6285{
6286 g_object_set (G_OBJECT (object), "upper-critical", value, NULL);
6287}
6288
6289/**
6290 * sensor_threshold_get_state: (skip)
6291 * @object: A #SensorThreshold.
6292 *
6293 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property.
6294 *
6295 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
6296 *
6297 * Returns: The property value.
6298 */
6299guchar
6300sensor_threshold_get_state (SensorThreshold *object)
6301{
6302 return SENSOR_THRESHOLD_GET_IFACE (object)->get_state (object);
6303}
6304
6305/**
6306 * sensor_threshold_set_state: (skip)
6307 * @object: A #SensorThreshold.
6308 * @value: The value to set.
6309 *
6310 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property to @value.
6311 *
6312 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
6313 */
6314void
6315sensor_threshold_set_state (SensorThreshold *object, guchar value)
6316{
6317 g_object_set (G_OBJECT (object), "state", value, NULL);
6318}
6319
6320/**
6321 * sensor_threshold_emit_warning:
6322 * @object: A #SensorThreshold.
6323 *
6324 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Warning">"Warning"</link> D-Bus signal.
6325 */
6326void
6327sensor_threshold_emit_warning (
6328 SensorThreshold *object)
6329{
6330 g_signal_emit_by_name (object, "warning");
6331}
6332
6333/**
6334 * sensor_threshold_emit_critical:
6335 * @object: A #SensorThreshold.
6336 *
6337 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Critical">"Critical"</link> D-Bus signal.
6338 */
6339void
6340sensor_threshold_emit_critical (
6341 SensorThreshold *object)
6342{
6343 g_signal_emit_by_name (object, "critical");
6344}
6345
6346/**
6347 * sensor_threshold_emit_normal:
6348 * @object: A #SensorThreshold.
6349 *
6350 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Normal">"Normal"</link> D-Bus signal.
6351 */
6352void
6353sensor_threshold_emit_normal (
6354 SensorThreshold *object)
6355{
6356 g_signal_emit_by_name (object, "normal");
6357}
6358
6359/**
6360 * sensor_threshold_call_get_state:
6361 * @proxy: A #SensorThresholdProxy.
6362 * @cancellable: (allow-none): A #GCancellable or %NULL.
6363 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
6364 * @user_data: User data to pass to @callback.
6365 *
6366 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method on @proxy.
6367 * 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.
6368 * You can then call sensor_threshold_call_get_state_finish() to get the result of the operation.
6369 *
6370 * See sensor_threshold_call_get_state_sync() for the synchronous, blocking version of this method.
6371 */
6372void
6373sensor_threshold_call_get_state (
6374 SensorThreshold *proxy,
6375 GCancellable *cancellable,
6376 GAsyncReadyCallback callback,
6377 gpointer user_data)
6378{
6379 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
6380 "getState",
6381 g_variant_new ("()"),
6382 G_DBUS_CALL_FLAGS_NONE,
6383 -1,
6384 cancellable,
6385 callback,
6386 user_data);
6387}
6388
6389/**
6390 * sensor_threshold_call_get_state_finish:
6391 * @proxy: A #SensorThresholdProxy.
6392 * @out_state: (out): Return location for return parameter or %NULL to ignore.
6393 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_call_get_state().
6394 * @error: Return location for error or %NULL.
6395 *
6396 * Finishes an operation started with sensor_threshold_call_get_state().
6397 *
6398 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
6399 */
6400gboolean
6401sensor_threshold_call_get_state_finish (
6402 SensorThreshold *proxy,
6403 guchar *out_state,
6404 GAsyncResult *res,
6405 GError **error)
6406{
6407 GVariant *_ret;
6408 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
6409 if (_ret == NULL)
6410 goto _out;
6411 g_variant_get (_ret,
6412 "(y)",
6413 out_state);
6414 g_variant_unref (_ret);
6415_out:
6416 return _ret != NULL;
6417}
6418
6419/**
6420 * sensor_threshold_call_get_state_sync:
6421 * @proxy: A #SensorThresholdProxy.
6422 * @out_state: (out): Return location for return parameter or %NULL to ignore.
6423 * @cancellable: (allow-none): A #GCancellable or %NULL.
6424 * @error: Return location for error or %NULL.
6425 *
6426 * 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.
6427 *
6428 * See sensor_threshold_call_get_state() for the asynchronous version of this method.
6429 *
6430 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
6431 */
6432gboolean
6433sensor_threshold_call_get_state_sync (
6434 SensorThreshold *proxy,
6435 guchar *out_state,
6436 GCancellable *cancellable,
6437 GError **error)
6438{
6439 GVariant *_ret;
6440 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
6441 "getState",
6442 g_variant_new ("()"),
6443 G_DBUS_CALL_FLAGS_NONE,
6444 -1,
6445 cancellable,
6446 error);
6447 if (_ret == NULL)
6448 goto _out;
6449 g_variant_get (_ret,
6450 "(y)",
6451 out_state);
6452 g_variant_unref (_ret);
6453_out:
6454 return _ret != NULL;
6455}
6456
6457/**
6458 * sensor_threshold_complete_get_state:
6459 * @object: A #SensorThreshold.
6460 * @invocation: (transfer full): A #GDBusMethodInvocation.
6461 * @state: Parameter to return.
6462 *
6463 * 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.
6464 *
6465 * This method will free @invocation, you cannot use it afterwards.
6466 */
6467void
6468sensor_threshold_complete_get_state (
6469 SensorThreshold *object,
6470 GDBusMethodInvocation *invocation,
6471 guchar state)
6472{
6473 g_dbus_method_invocation_return_value (invocation,
6474 g_variant_new ("(y)",
6475 state));
6476}
6477
6478/* ------------------------------------------------------------------------ */
6479
6480/**
6481 * SensorThresholdProxy:
6482 *
6483 * The #SensorThresholdProxy structure contains only private data and should only be accessed using the provided API.
6484 */
6485
6486/**
6487 * SensorThresholdProxyClass:
6488 * @parent_class: The parent class.
6489 *
6490 * Class structure for #SensorThresholdProxy.
6491 */
6492
6493struct _SensorThresholdProxyPrivate
6494{
6495 GData *qdata;
6496};
6497
6498static void sensor_threshold_proxy_iface_init (SensorThresholdIface *iface);
6499
6500#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6501G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
6502 G_ADD_PRIVATE (SensorThresholdProxy)
6503 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init));
6504
6505#else
6506G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
6507 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init));
6508
6509#endif
6510static void
6511sensor_threshold_proxy_finalize (GObject *object)
6512{
6513 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6514 g_datalist_clear (&proxy->priv->qdata);
6515 G_OBJECT_CLASS (sensor_threshold_proxy_parent_class)->finalize (object);
6516}
6517
6518static void
6519sensor_threshold_proxy_get_property (GObject *object,
6520 guint prop_id,
6521 GValue *value,
6522 GParamSpec *pspec G_GNUC_UNUSED)
6523{
6524 const _ExtendedGDBusPropertyInfo *info;
6525 GVariant *variant;
6526 g_assert (prop_id != 0 && prop_id - 1 < 5);
6527 info = _sensor_threshold_property_info_pointers[prop_id - 1];
6528 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
6529 if (info->use_gvariant)
6530 {
6531 g_value_set_variant (value, variant);
6532 }
6533 else
6534 {
6535 if (variant != NULL)
6536 g_dbus_gvariant_to_gvalue (variant, value);
6537 }
6538 if (variant != NULL)
6539 g_variant_unref (variant);
6540}
6541
6542static void
6543sensor_threshold_proxy_set_property_cb (GDBusProxy *proxy,
6544 GAsyncResult *res,
6545 gpointer user_data)
6546{
6547 const _ExtendedGDBusPropertyInfo *info = user_data;
6548 GError *error;
6549 GVariant *_ret;
6550 error = NULL;
6551 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
6552 if (!_ret)
6553 {
6554 g_warning ("Error setting property '%s' on interface org.openbmc.SensorThreshold: %s (%s, %d)",
6555 info->parent_struct.name,
6556 error->message, g_quark_to_string (error->domain), error->code);
6557 g_error_free (error);
6558 }
6559 else
6560 {
6561 g_variant_unref (_ret);
6562 }
6563}
6564
6565static void
6566sensor_threshold_proxy_set_property (GObject *object,
6567 guint prop_id,
6568 const GValue *value,
6569 GParamSpec *pspec G_GNUC_UNUSED)
6570{
6571 const _ExtendedGDBusPropertyInfo *info;
6572 GVariant *variant;
6573 g_assert (prop_id != 0 && prop_id - 1 < 5);
6574 info = _sensor_threshold_property_info_pointers[prop_id - 1];
6575 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
6576 g_dbus_proxy_call (G_DBUS_PROXY (object),
6577 "org.freedesktop.DBus.Properties.Set",
6578 g_variant_new ("(ssv)", "org.openbmc.SensorThreshold", info->parent_struct.name, variant),
6579 G_DBUS_CALL_FLAGS_NONE,
6580 -1,
6581 NULL, (GAsyncReadyCallback) sensor_threshold_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
6582 g_variant_unref (variant);
6583}
6584
6585static void
6586sensor_threshold_proxy_g_signal (GDBusProxy *proxy,
6587 const gchar *sender_name G_GNUC_UNUSED,
6588 const gchar *signal_name,
6589 GVariant *parameters)
6590{
6591 _ExtendedGDBusSignalInfo *info;
6592 GVariantIter iter;
6593 GVariant *child;
6594 GValue *paramv;
6595 guint num_params;
6596 guint n;
6597 guint signal_id;
6598 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, signal_name);
6599 if (info == NULL)
6600 return;
6601 num_params = g_variant_n_children (parameters);
6602 paramv = g_new0 (GValue, num_params + 1);
6603 g_value_init (&paramv[0], TYPE_SENSOR_THRESHOLD);
6604 g_value_set_object (&paramv[0], proxy);
6605 g_variant_iter_init (&iter, parameters);
6606 n = 1;
6607 while ((child = g_variant_iter_next_value (&iter)) != NULL)
6608 {
6609 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
6610 if (arg_info->use_gvariant)
6611 {
6612 g_value_init (&paramv[n], G_TYPE_VARIANT);
6613 g_value_set_variant (&paramv[n], child);
6614 n++;
6615 }
6616 else
6617 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
6618 g_variant_unref (child);
6619 }
6620 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
6621 g_signal_emitv (paramv, signal_id, 0, NULL);
6622 for (n = 0; n < num_params + 1; n++)
6623 g_value_unset (&paramv[n]);
6624 g_free (paramv);
6625}
6626
6627static void
6628sensor_threshold_proxy_g_properties_changed (GDBusProxy *_proxy,
6629 GVariant *changed_properties,
6630 const gchar *const *invalidated_properties)
6631{
6632 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (_proxy);
6633 guint n;
6634 const gchar *key;
6635 GVariantIter *iter;
6636 _ExtendedGDBusPropertyInfo *info;
6637 g_variant_get (changed_properties, "a{sv}", &iter);
6638 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
6639 {
6640 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, key);
6641 g_datalist_remove_data (&proxy->priv->qdata, key);
6642 if (info != NULL)
6643 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
6644 }
6645 g_variant_iter_free (iter);
6646 for (n = 0; invalidated_properties[n] != NULL; n++)
6647 {
6648 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, invalidated_properties[n]);
6649 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
6650 if (info != NULL)
6651 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
6652 }
6653}
6654
6655static GVariant *
6656sensor_threshold_proxy_get_lower_critical (SensorThreshold *object)
6657{
6658 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6659 GVariant *variant;
6660 GVariant *value = NULL;
6661 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_critical");
6662 value = variant;
6663 if (variant != NULL)
6664 g_variant_unref (variant);
6665 return value;
6666}
6667
6668static GVariant *
6669sensor_threshold_proxy_get_lower_warning (SensorThreshold *object)
6670{
6671 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6672 GVariant *variant;
6673 GVariant *value = NULL;
6674 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_warning");
6675 value = variant;
6676 if (variant != NULL)
6677 g_variant_unref (variant);
6678 return value;
6679}
6680
6681static GVariant *
6682sensor_threshold_proxy_get_upper_warning (SensorThreshold *object)
6683{
6684 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6685 GVariant *variant;
6686 GVariant *value = NULL;
6687 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_warning");
6688 value = variant;
6689 if (variant != NULL)
6690 g_variant_unref (variant);
6691 return value;
6692}
6693
6694static GVariant *
6695sensor_threshold_proxy_get_upper_critical (SensorThreshold *object)
6696{
6697 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6698 GVariant *variant;
6699 GVariant *value = NULL;
6700 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_critical");
6701 value = variant;
6702 if (variant != NULL)
6703 g_variant_unref (variant);
6704 return value;
6705}
6706
6707static guchar
6708sensor_threshold_proxy_get_state (SensorThreshold *object)
6709{
6710 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6711 GVariant *variant;
6712 guchar value = 0;
6713 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
6714 if (variant != NULL)
6715 {
6716 value = g_variant_get_byte (variant);
6717 g_variant_unref (variant);
6718 }
6719 return value;
6720}
6721
6722static void
6723sensor_threshold_proxy_init (SensorThresholdProxy *proxy)
6724{
6725#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6726 proxy->priv = sensor_threshold_proxy_get_instance_private (proxy);
6727#else
6728 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_THRESHOLD_PROXY, SensorThresholdProxyPrivate);
6729#endif
6730
6731 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_threshold_interface_info ());
6732}
6733
6734static void
6735sensor_threshold_proxy_class_init (SensorThresholdProxyClass *klass)
6736{
6737 GObjectClass *gobject_class;
6738 GDBusProxyClass *proxy_class;
6739
6740 gobject_class = G_OBJECT_CLASS (klass);
6741 gobject_class->finalize = sensor_threshold_proxy_finalize;
6742 gobject_class->get_property = sensor_threshold_proxy_get_property;
6743 gobject_class->set_property = sensor_threshold_proxy_set_property;
6744
6745 proxy_class = G_DBUS_PROXY_CLASS (klass);
6746 proxy_class->g_signal = sensor_threshold_proxy_g_signal;
6747 proxy_class->g_properties_changed = sensor_threshold_proxy_g_properties_changed;
6748
6749 sensor_threshold_override_properties (gobject_class, 1);
6750
6751#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
6752 g_type_class_add_private (klass, sizeof (SensorThresholdProxyPrivate));
6753#endif
6754}
6755
6756static void
6757sensor_threshold_proxy_iface_init (SensorThresholdIface *iface)
6758{
6759 iface->get_lower_critical = sensor_threshold_proxy_get_lower_critical;
6760 iface->get_lower_warning = sensor_threshold_proxy_get_lower_warning;
6761 iface->get_upper_warning = sensor_threshold_proxy_get_upper_warning;
6762 iface->get_upper_critical = sensor_threshold_proxy_get_upper_critical;
6763 iface->get_state = sensor_threshold_proxy_get_state;
6764}
6765
6766/**
6767 * sensor_threshold_proxy_new:
6768 * @connection: A #GDBusConnection.
6769 * @flags: Flags from the #GDBusProxyFlags enumeration.
6770 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6771 * @object_path: An object path.
6772 * @cancellable: (allow-none): A #GCancellable or %NULL.
6773 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6774 * @user_data: User data to pass to @callback.
6775 *
6776 * 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.
6777 *
6778 * 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.
6779 * You can then call sensor_threshold_proxy_new_finish() to get the result of the operation.
6780 *
6781 * See sensor_threshold_proxy_new_sync() for the synchronous, blocking version of this constructor.
6782 */
6783void
6784sensor_threshold_proxy_new (
6785 GDBusConnection *connection,
6786 GDBusProxyFlags flags,
6787 const gchar *name,
6788 const gchar *object_path,
6789 GCancellable *cancellable,
6790 GAsyncReadyCallback callback,
6791 gpointer user_data)
6792{
6793 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);
6794}
6795
6796/**
6797 * sensor_threshold_proxy_new_finish:
6798 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new().
6799 * @error: Return location for error or %NULL
6800 *
6801 * Finishes an operation started with sensor_threshold_proxy_new().
6802 *
6803 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6804 */
6805SensorThreshold *
6806sensor_threshold_proxy_new_finish (
6807 GAsyncResult *res,
6808 GError **error)
6809{
6810 GObject *ret;
6811 GObject *source_object;
6812 source_object = g_async_result_get_source_object (res);
6813 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6814 g_object_unref (source_object);
6815 if (ret != NULL)
6816 return SENSOR_THRESHOLD (ret);
6817 else
6818 return NULL;
6819}
6820
6821/**
6822 * sensor_threshold_proxy_new_sync:
6823 * @connection: A #GDBusConnection.
6824 * @flags: Flags from the #GDBusProxyFlags enumeration.
6825 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6826 * @object_path: An object path.
6827 * @cancellable: (allow-none): A #GCancellable or %NULL.
6828 * @error: Return location for error or %NULL
6829 *
6830 * 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.
6831 *
6832 * The calling thread is blocked until a reply is received.
6833 *
6834 * See sensor_threshold_proxy_new() for the asynchronous version of this constructor.
6835 *
6836 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6837 */
6838SensorThreshold *
6839sensor_threshold_proxy_new_sync (
6840 GDBusConnection *connection,
6841 GDBusProxyFlags flags,
6842 const gchar *name,
6843 const gchar *object_path,
6844 GCancellable *cancellable,
6845 GError **error)
6846{
6847 GInitable *ret;
6848 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);
6849 if (ret != NULL)
6850 return SENSOR_THRESHOLD (ret);
6851 else
6852 return NULL;
6853}
6854
6855
6856/**
6857 * sensor_threshold_proxy_new_for_bus:
6858 * @bus_type: A #GBusType.
6859 * @flags: Flags from the #GDBusProxyFlags enumeration.
6860 * @name: A bus name (well-known or unique).
6861 * @object_path: An object path.
6862 * @cancellable: (allow-none): A #GCancellable or %NULL.
6863 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6864 * @user_data: User data to pass to @callback.
6865 *
6866 * Like sensor_threshold_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
6867 *
6868 * 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.
6869 * You can then call sensor_threshold_proxy_new_for_bus_finish() to get the result of the operation.
6870 *
6871 * See sensor_threshold_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
6872 */
6873void
6874sensor_threshold_proxy_new_for_bus (
6875 GBusType bus_type,
6876 GDBusProxyFlags flags,
6877 const gchar *name,
6878 const gchar *object_path,
6879 GCancellable *cancellable,
6880 GAsyncReadyCallback callback,
6881 gpointer user_data)
6882{
6883 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);
6884}
6885
6886/**
6887 * sensor_threshold_proxy_new_for_bus_finish:
6888 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new_for_bus().
6889 * @error: Return location for error or %NULL
6890 *
6891 * Finishes an operation started with sensor_threshold_proxy_new_for_bus().
6892 *
6893 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6894 */
6895SensorThreshold *
6896sensor_threshold_proxy_new_for_bus_finish (
6897 GAsyncResult *res,
6898 GError **error)
6899{
6900 GObject *ret;
6901 GObject *source_object;
6902 source_object = g_async_result_get_source_object (res);
6903 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6904 g_object_unref (source_object);
6905 if (ret != NULL)
6906 return SENSOR_THRESHOLD (ret);
6907 else
6908 return NULL;
6909}
6910
6911/**
6912 * sensor_threshold_proxy_new_for_bus_sync:
6913 * @bus_type: A #GBusType.
6914 * @flags: Flags from the #GDBusProxyFlags enumeration.
6915 * @name: A bus name (well-known or unique).
6916 * @object_path: An object path.
6917 * @cancellable: (allow-none): A #GCancellable or %NULL.
6918 * @error: Return location for error or %NULL
6919 *
6920 * Like sensor_threshold_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
6921 *
6922 * The calling thread is blocked until a reply is received.
6923 *
6924 * See sensor_threshold_proxy_new_for_bus() for the asynchronous version of this constructor.
6925 *
6926 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6927 */
6928SensorThreshold *
6929sensor_threshold_proxy_new_for_bus_sync (
6930 GBusType bus_type,
6931 GDBusProxyFlags flags,
6932 const gchar *name,
6933 const gchar *object_path,
6934 GCancellable *cancellable,
6935 GError **error)
6936{
6937 GInitable *ret;
6938 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);
6939 if (ret != NULL)
6940 return SENSOR_THRESHOLD (ret);
6941 else
6942 return NULL;
6943}
6944
6945
6946/* ------------------------------------------------------------------------ */
6947
6948/**
6949 * SensorThresholdSkeleton:
6950 *
6951 * The #SensorThresholdSkeleton structure contains only private data and should only be accessed using the provided API.
6952 */
6953
6954/**
6955 * SensorThresholdSkeletonClass:
6956 * @parent_class: The parent class.
6957 *
6958 * Class structure for #SensorThresholdSkeleton.
6959 */
6960
6961struct _SensorThresholdSkeletonPrivate
6962{
6963 GValue *properties;
6964 GList *changed_properties;
6965 GSource *changed_properties_idle_source;
6966 GMainContext *context;
6967 GMutex lock;
6968};
6969
6970static void
6971_sensor_threshold_skeleton_handle_method_call (
6972 GDBusConnection *connection G_GNUC_UNUSED,
6973 const gchar *sender G_GNUC_UNUSED,
6974 const gchar *object_path G_GNUC_UNUSED,
6975 const gchar *interface_name,
6976 const gchar *method_name,
6977 GVariant *parameters,
6978 GDBusMethodInvocation *invocation,
6979 gpointer user_data)
6980{
6981 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
6982 _ExtendedGDBusMethodInfo *info;
6983 GVariantIter iter;
6984 GVariant *child;
6985 GValue *paramv;
6986 guint num_params;
6987 guint num_extra;
6988 guint n;
6989 guint signal_id;
6990 GValue return_value = G_VALUE_INIT;
6991 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
6992 g_assert (info != NULL);
6993 num_params = g_variant_n_children (parameters);
6994 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
6995 n = 0;
6996 g_value_init (&paramv[n], TYPE_SENSOR_THRESHOLD);
6997 g_value_set_object (&paramv[n++], skeleton);
6998 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
6999 g_value_set_object (&paramv[n++], invocation);
7000 if (info->pass_fdlist)
7001 {
7002#ifdef G_OS_UNIX
7003 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
7004 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
7005#else
7006 g_assert_not_reached ();
7007#endif
7008 }
7009 g_variant_iter_init (&iter, parameters);
7010 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7011 {
7012 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
7013 if (arg_info->use_gvariant)
7014 {
7015 g_value_init (&paramv[n], G_TYPE_VARIANT);
7016 g_value_set_variant (&paramv[n], child);
7017 n++;
7018 }
7019 else
7020 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
7021 g_variant_unref (child);
7022 }
7023 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
7024 g_value_init (&return_value, G_TYPE_BOOLEAN);
7025 g_signal_emitv (paramv, signal_id, 0, &return_value);
7026 if (!g_value_get_boolean (&return_value))
7027 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);
7028 g_value_unset (&return_value);
7029 for (n = 0; n < num_params + num_extra; n++)
7030 g_value_unset (&paramv[n]);
7031 g_free (paramv);
7032}
7033
7034static GVariant *
7035_sensor_threshold_skeleton_handle_get_property (
7036 GDBusConnection *connection G_GNUC_UNUSED,
7037 const gchar *sender G_GNUC_UNUSED,
7038 const gchar *object_path G_GNUC_UNUSED,
7039 const gchar *interface_name G_GNUC_UNUSED,
7040 const gchar *property_name,
7041 GError **error,
7042 gpointer user_data)
7043{
7044 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7045 GValue value = G_VALUE_INIT;
7046 GParamSpec *pspec;
7047 _ExtendedGDBusPropertyInfo *info;
7048 GVariant *ret;
7049 ret = NULL;
7050 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
7051 g_assert (info != NULL);
7052 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
7053 if (pspec == NULL)
7054 {
7055 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
7056 }
7057 else
7058 {
7059 g_value_init (&value, pspec->value_type);
7060 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
7061 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
7062 g_value_unset (&value);
7063 }
7064 return ret;
7065}
7066
7067static gboolean
7068_sensor_threshold_skeleton_handle_set_property (
7069 GDBusConnection *connection G_GNUC_UNUSED,
7070 const gchar *sender G_GNUC_UNUSED,
7071 const gchar *object_path G_GNUC_UNUSED,
7072 const gchar *interface_name G_GNUC_UNUSED,
7073 const gchar *property_name,
7074 GVariant *variant,
7075 GError **error,
7076 gpointer user_data)
7077{
7078 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7079 GValue value = G_VALUE_INIT;
7080 GParamSpec *pspec;
7081 _ExtendedGDBusPropertyInfo *info;
7082 gboolean ret;
7083 ret = FALSE;
7084 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
7085 g_assert (info != NULL);
7086 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
7087 if (pspec == NULL)
7088 {
7089 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
7090 }
7091 else
7092 {
7093 if (info->use_gvariant)
7094 g_value_set_variant (&value, variant);
7095 else
7096 g_dbus_gvariant_to_gvalue (variant, &value);
7097 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
7098 g_value_unset (&value);
7099 ret = TRUE;
7100 }
7101 return ret;
7102}
7103
7104static const GDBusInterfaceVTable _sensor_threshold_skeleton_vtable =
7105{
7106 _sensor_threshold_skeleton_handle_method_call,
7107 _sensor_threshold_skeleton_handle_get_property,
7108 _sensor_threshold_skeleton_handle_set_property,
7109 {NULL}
7110};
7111
7112static GDBusInterfaceInfo *
7113sensor_threshold_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
7114{
7115 return sensor_threshold_interface_info ();
7116}
7117
7118static GDBusInterfaceVTable *
7119sensor_threshold_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
7120{
7121 return (GDBusInterfaceVTable *) &_sensor_threshold_skeleton_vtable;
7122}
7123
7124static GVariant *
7125sensor_threshold_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
7126{
7127 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
7128
7129 GVariantBuilder builder;
7130 guint n;
7131 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
7132 if (_sensor_threshold_interface_info.parent_struct.properties == NULL)
7133 goto out;
7134 for (n = 0; _sensor_threshold_interface_info.parent_struct.properties[n] != NULL; n++)
7135 {
7136 GDBusPropertyInfo *info = _sensor_threshold_interface_info.parent_struct.properties[n];
7137 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
7138 {
7139 GVariant *value;
7140 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);
7141 if (value != NULL)
7142 {
7143 g_variant_take_ref (value);
7144 g_variant_builder_add (&builder, "{sv}", info->name, value);
7145 g_variant_unref (value);
7146 }
7147 }
7148 }
7149out:
7150 return g_variant_builder_end (&builder);
7151}
7152
7153static gboolean _sensor_threshold_emit_changed (gpointer user_data);
7154
7155static void
7156sensor_threshold_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
7157{
7158 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
7159 gboolean emit_changed = FALSE;
7160
7161 g_mutex_lock (&skeleton->priv->lock);
7162 if (skeleton->priv->changed_properties_idle_source != NULL)
7163 {
7164 g_source_destroy (skeleton->priv->changed_properties_idle_source);
7165 skeleton->priv->changed_properties_idle_source = NULL;
7166 emit_changed = TRUE;
7167 }
7168 g_mutex_unlock (&skeleton->priv->lock);
7169
7170 if (emit_changed)
7171 _sensor_threshold_emit_changed (skeleton);
7172}
7173
7174static void
7175_sensor_threshold_on_signal_warning (
7176 SensorThreshold *object)
7177{
7178 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7179
7180 GList *connections, *l;
7181 GVariant *signal_variant;
7182 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7183
7184 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7185 for (l = connections; l != NULL; l = l->next)
7186 {
7187 GDBusConnection *connection = l->data;
7188 g_dbus_connection_emit_signal (connection,
7189 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Warning",
7190 signal_variant, NULL);
7191 }
7192 g_variant_unref (signal_variant);
7193 g_list_free_full (connections, g_object_unref);
7194}
7195
7196static void
7197_sensor_threshold_on_signal_critical (
7198 SensorThreshold *object)
7199{
7200 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7201
7202 GList *connections, *l;
7203 GVariant *signal_variant;
7204 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7205
7206 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7207 for (l = connections; l != NULL; l = l->next)
7208 {
7209 GDBusConnection *connection = l->data;
7210 g_dbus_connection_emit_signal (connection,
7211 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Critical",
7212 signal_variant, NULL);
7213 }
7214 g_variant_unref (signal_variant);
7215 g_list_free_full (connections, g_object_unref);
7216}
7217
7218static void
7219_sensor_threshold_on_signal_normal (
7220 SensorThreshold *object)
7221{
7222 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7223
7224 GList *connections, *l;
7225 GVariant *signal_variant;
7226 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7227
7228 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7229 for (l = connections; l != NULL; l = l->next)
7230 {
7231 GDBusConnection *connection = l->data;
7232 g_dbus_connection_emit_signal (connection,
7233 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Normal",
7234 signal_variant, NULL);
7235 }
7236 g_variant_unref (signal_variant);
7237 g_list_free_full (connections, g_object_unref);
7238}
7239
7240static void sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface);
7241#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7242G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
7243 G_ADD_PRIVATE (SensorThresholdSkeleton)
7244 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init));
7245
7246#else
7247G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
7248 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init));
7249
7250#endif
7251static void
7252sensor_threshold_skeleton_finalize (GObject *object)
7253{
7254 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7255 guint n;
7256 for (n = 0; n < 5; n++)
7257 g_value_unset (&skeleton->priv->properties[n]);
7258 g_free (skeleton->priv->properties);
7259 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
7260 if (skeleton->priv->changed_properties_idle_source != NULL)
7261 g_source_destroy (skeleton->priv->changed_properties_idle_source);
7262 g_main_context_unref (skeleton->priv->context);
7263 g_mutex_clear (&skeleton->priv->lock);
7264 G_OBJECT_CLASS (sensor_threshold_skeleton_parent_class)->finalize (object);
7265}
7266
7267static void
7268sensor_threshold_skeleton_get_property (GObject *object,
7269 guint prop_id,
7270 GValue *value,
7271 GParamSpec *pspec G_GNUC_UNUSED)
7272{
7273 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7274 g_assert (prop_id != 0 && prop_id - 1 < 5);
7275 g_mutex_lock (&skeleton->priv->lock);
7276 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
7277 g_mutex_unlock (&skeleton->priv->lock);
7278}
7279
7280static gboolean
7281_sensor_threshold_emit_changed (gpointer user_data)
7282{
7283 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7284 GList *l;
7285 GVariantBuilder builder;
7286 GVariantBuilder invalidated_builder;
7287 guint num_changes;
7288
7289 g_mutex_lock (&skeleton->priv->lock);
7290 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
7291 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
7292 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
7293 {
7294 ChangedProperty *cp = l->data;
7295 GVariant *variant;
7296 const GValue *cur_value;
7297
7298 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
7299 if (!_g_value_equal (cur_value, &cp->orig_value))
7300 {
7301 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
7302 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
7303 g_variant_unref (variant);
7304 num_changes++;
7305 }
7306 }
7307 if (num_changes > 0)
7308 {
7309 GList *connections, *ll;
7310 GVariant *signal_variant;
7311 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorThreshold",
7312 &builder, &invalidated_builder));
7313 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7314 for (ll = connections; ll != NULL; ll = ll->next)
7315 {
7316 GDBusConnection *connection = ll->data;
7317
7318 g_dbus_connection_emit_signal (connection,
7319 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
7320 "org.freedesktop.DBus.Properties",
7321 "PropertiesChanged",
7322 signal_variant,
7323 NULL);
7324 }
7325 g_variant_unref (signal_variant);
7326 g_list_free_full (connections, g_object_unref);
7327 }
7328 else
7329 {
7330 g_variant_builder_clear (&builder);
7331 g_variant_builder_clear (&invalidated_builder);
7332 }
7333 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
7334 skeleton->priv->changed_properties = NULL;
7335 skeleton->priv->changed_properties_idle_source = NULL;
7336 g_mutex_unlock (&skeleton->priv->lock);
7337 return FALSE;
7338}
7339
7340static void
7341_sensor_threshold_schedule_emit_changed (SensorThresholdSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
7342{
7343 ChangedProperty *cp;
7344 GList *l;
7345 cp = NULL;
7346 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
7347 {
7348 ChangedProperty *i_cp = l->data;
7349 if (i_cp->info == info)
7350 {
7351 cp = i_cp;
7352 break;
7353 }
7354 }
7355 if (cp == NULL)
7356 {
7357 cp = g_new0 (ChangedProperty, 1);
7358 cp->prop_id = prop_id;
7359 cp->info = info;
7360 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
7361 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
7362 g_value_copy (orig_value, &cp->orig_value);
7363 }
7364}
7365
7366static void
7367sensor_threshold_skeleton_notify (GObject *object,
7368 GParamSpec *pspec G_GNUC_UNUSED)
7369{
7370 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7371 g_mutex_lock (&skeleton->priv->lock);
7372 if (skeleton->priv->changed_properties != NULL &&
7373 skeleton->priv->changed_properties_idle_source == NULL)
7374 {
7375 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
7376 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
7377 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_threshold_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
7378 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
7379 g_source_unref (skeleton->priv->changed_properties_idle_source);
7380 }
7381 g_mutex_unlock (&skeleton->priv->lock);
7382}
7383
7384static void
7385sensor_threshold_skeleton_set_property (GObject *object,
7386 guint prop_id,
7387 const GValue *value,
7388 GParamSpec *pspec)
7389{
7390 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7391 g_assert (prop_id != 0 && prop_id - 1 < 5);
7392 g_mutex_lock (&skeleton->priv->lock);
7393 g_object_freeze_notify (object);
7394 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
7395 {
7396 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
7397 _sensor_threshold_schedule_emit_changed (skeleton, _sensor_threshold_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
7398 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
7399 g_object_notify_by_pspec (object, pspec);
7400 }
7401 g_mutex_unlock (&skeleton->priv->lock);
7402 g_object_thaw_notify (object);
7403}
7404
7405static void
7406sensor_threshold_skeleton_init (SensorThresholdSkeleton *skeleton)
7407{
7408#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7409 skeleton->priv = sensor_threshold_skeleton_get_instance_private (skeleton);
7410#else
7411 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_THRESHOLD_SKELETON, SensorThresholdSkeletonPrivate);
7412#endif
7413
7414 g_mutex_init (&skeleton->priv->lock);
7415 skeleton->priv->context = g_main_context_ref_thread_default ();
7416 skeleton->priv->properties = g_new0 (GValue, 5);
7417 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
7418 g_value_init (&skeleton->priv->properties[1], G_TYPE_VARIANT);
7419 g_value_init (&skeleton->priv->properties[2], G_TYPE_VARIANT);
7420 g_value_init (&skeleton->priv->properties[3], G_TYPE_VARIANT);
7421 g_value_init (&skeleton->priv->properties[4], G_TYPE_UCHAR);
7422}
7423
7424static GVariant *
7425sensor_threshold_skeleton_get_lower_critical (SensorThreshold *object)
7426{
7427 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7428 GVariant *value;
7429 g_mutex_lock (&skeleton->priv->lock);
7430 value = g_value_get_variant (&(skeleton->priv->properties[0]));
7431 g_mutex_unlock (&skeleton->priv->lock);
7432 return value;
7433}
7434
7435static GVariant *
7436sensor_threshold_skeleton_get_lower_warning (SensorThreshold *object)
7437{
7438 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7439 GVariant *value;
7440 g_mutex_lock (&skeleton->priv->lock);
7441 value = g_value_get_variant (&(skeleton->priv->properties[1]));
7442 g_mutex_unlock (&skeleton->priv->lock);
7443 return value;
7444}
7445
7446static GVariant *
7447sensor_threshold_skeleton_get_upper_warning (SensorThreshold *object)
7448{
7449 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7450 GVariant *value;
7451 g_mutex_lock (&skeleton->priv->lock);
7452 value = g_value_get_variant (&(skeleton->priv->properties[2]));
7453 g_mutex_unlock (&skeleton->priv->lock);
7454 return value;
7455}
7456
7457static GVariant *
7458sensor_threshold_skeleton_get_upper_critical (SensorThreshold *object)
7459{
7460 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7461 GVariant *value;
7462 g_mutex_lock (&skeleton->priv->lock);
7463 value = g_value_get_variant (&(skeleton->priv->properties[3]));
7464 g_mutex_unlock (&skeleton->priv->lock);
7465 return value;
7466}
7467
7468static guchar
7469sensor_threshold_skeleton_get_state (SensorThreshold *object)
7470{
7471 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7472 guchar value;
7473 g_mutex_lock (&skeleton->priv->lock);
7474 value = g_value_get_uchar (&(skeleton->priv->properties[4]));
7475 g_mutex_unlock (&skeleton->priv->lock);
7476 return value;
7477}
7478
7479static void
7480sensor_threshold_skeleton_class_init (SensorThresholdSkeletonClass *klass)
7481{
7482 GObjectClass *gobject_class;
7483 GDBusInterfaceSkeletonClass *skeleton_class;
7484
7485 gobject_class = G_OBJECT_CLASS (klass);
7486 gobject_class->finalize = sensor_threshold_skeleton_finalize;
7487 gobject_class->get_property = sensor_threshold_skeleton_get_property;
7488 gobject_class->set_property = sensor_threshold_skeleton_set_property;
7489 gobject_class->notify = sensor_threshold_skeleton_notify;
7490
7491
7492 sensor_threshold_override_properties (gobject_class, 1);
7493
7494 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
7495 skeleton_class->get_info = sensor_threshold_skeleton_dbus_interface_get_info;
7496 skeleton_class->get_properties = sensor_threshold_skeleton_dbus_interface_get_properties;
7497 skeleton_class->flush = sensor_threshold_skeleton_dbus_interface_flush;
7498 skeleton_class->get_vtable = sensor_threshold_skeleton_dbus_interface_get_vtable;
7499
7500#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
7501 g_type_class_add_private (klass, sizeof (SensorThresholdSkeletonPrivate));
7502#endif
7503}
7504
7505static void
7506sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface)
7507{
7508 iface->warning = _sensor_threshold_on_signal_warning;
7509 iface->critical = _sensor_threshold_on_signal_critical;
7510 iface->normal = _sensor_threshold_on_signal_normal;
7511 iface->get_lower_critical = sensor_threshold_skeleton_get_lower_critical;
7512 iface->get_lower_warning = sensor_threshold_skeleton_get_lower_warning;
7513 iface->get_upper_warning = sensor_threshold_skeleton_get_upper_warning;
7514 iface->get_upper_critical = sensor_threshold_skeleton_get_upper_critical;
7515 iface->get_state = sensor_threshold_skeleton_get_state;
7516}
7517
7518/**
7519 * sensor_threshold_skeleton_new:
7520 *
7521 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
7522 *
7523 * Returns: (transfer full) (type SensorThresholdSkeleton): The skeleton object.
7524 */
7525SensorThreshold *
7526sensor_threshold_skeleton_new (void)
7527{
7528 return SENSOR_THRESHOLD (g_object_new (TYPE_SENSOR_THRESHOLD_SKELETON, NULL));
7529}
7530
7531/* ------------------------------------------------------------------------
7532 * Code for interface org.openbmc.SensorI2c
7533 * ------------------------------------------------------------------------
7534 */
7535
7536/**
7537 * SECTION:SensorI2c
7538 * @title: SensorI2c
7539 * @short_description: Generated C code for the org.openbmc.SensorI2c D-Bus interface
7540 *
7541 * 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.
7542 */
7543
7544/* ---- Introspection data for org.openbmc.SensorI2c ---- */
7545
7546static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_dev_path =
7547{
7548 {
7549 -1,
7550 (gchar *) "dev_path",
7551 (gchar *) "s",
7552 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
7553 NULL
7554 },
7555 "dev-path",
7556 FALSE
7557};
7558
7559static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_address =
7560{
7561 {
7562 -1,
7563 (gchar *) "address",
7564 (gchar *) "s",
7565 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
7566 NULL
7567 },
7568 "address",
7569 FALSE
7570};
7571
7572static const _ExtendedGDBusPropertyInfo * const _sensor_i2c_property_info_pointers[] =
7573{
7574 &_sensor_i2c_property_info_dev_path,
7575 &_sensor_i2c_property_info_address,
7576 NULL
7577};
7578
7579static const _ExtendedGDBusInterfaceInfo _sensor_i2c_interface_info =
7580{
7581 {
7582 -1,
7583 (gchar *) "org.openbmc.SensorI2c",
7584 NULL,
7585 NULL,
7586 (GDBusPropertyInfo **) &_sensor_i2c_property_info_pointers,
7587 NULL
7588 },
7589 "sensor-i2c",
7590};
7591
7592
7593/**
7594 * sensor_i2c_interface_info:
7595 *
7596 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> D-Bus interface.
7597 *
7598 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
7599 */
7600GDBusInterfaceInfo *
7601sensor_i2c_interface_info (void)
7602{
7603 return (GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct;
7604}
7605
7606/**
7607 * sensor_i2c_override_properties:
7608 * @klass: The class structure for a #GObject<!-- -->-derived class.
7609 * @property_id_begin: The property id to assign to the first overridden property.
7610 *
7611 * Overrides all #GObject properties in the #SensorI2c interface for a concrete class.
7612 * The properties are overridden in the order they are defined.
7613 *
7614 * Returns: The last property id.
7615 */
7616guint
7617sensor_i2c_override_properties (GObjectClass *klass, guint property_id_begin)
7618{
7619 g_object_class_override_property (klass, property_id_begin++, "dev-path");
7620 g_object_class_override_property (klass, property_id_begin++, "address");
7621 return property_id_begin - 1;
7622}
7623
7624
7625
7626/**
7627 * SensorI2c:
7628 *
7629 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
7630 */
7631
7632/**
7633 * SensorI2cIface:
7634 * @parent_iface: The parent interface.
7635 * @get_address: Getter for the #SensorI2c:address property.
7636 * @get_dev_path: Getter for the #SensorI2c:dev-path property.
7637 *
7638 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
7639 */
7640
7641typedef SensorI2cIface SensorI2cInterface;
7642G_DEFINE_INTERFACE (SensorI2c, sensor_i2c, G_TYPE_OBJECT);
7643
7644static void
7645sensor_i2c_default_init (SensorI2cIface *iface)
7646{
7647 /* GObject properties for D-Bus properties: */
7648 /**
7649 * SensorI2c:dev-path:
7650 *
7651 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link>.
7652 *
7653 * 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.
7654 */
7655 g_object_interface_install_property (iface,
7656 g_param_spec_string ("dev-path", "dev_path", "dev_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
7657 /**
7658 * SensorI2c:address:
7659 *
7660 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link>.
7661 *
7662 * 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.
7663 */
7664 g_object_interface_install_property (iface,
7665 g_param_spec_string ("address", "address", "address", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
7666}
7667
7668/**
7669 * sensor_i2c_get_dev_path: (skip)
7670 * @object: A #SensorI2c.
7671 *
7672 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
7673 *
7674 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7675 *
7676 * <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>
7677 *
7678 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
7679 */
7680const gchar *
7681sensor_i2c_get_dev_path (SensorI2c *object)
7682{
7683 return SENSOR_I2C_GET_IFACE (object)->get_dev_path (object);
7684}
7685
7686/**
7687 * sensor_i2c_dup_dev_path: (skip)
7688 * @object: A #SensorI2c.
7689 *
7690 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
7691 *
7692 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7693 *
7694 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
7695 */
7696gchar *
7697sensor_i2c_dup_dev_path (SensorI2c *object)
7698{
7699 gchar *value;
7700 g_object_get (G_OBJECT (object), "dev-path", &value, NULL);
7701 return value;
7702}
7703
7704/**
7705 * sensor_i2c_set_dev_path: (skip)
7706 * @object: A #SensorI2c.
7707 * @value: The value to set.
7708 *
7709 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property to @value.
7710 *
7711 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7712 */
7713void
7714sensor_i2c_set_dev_path (SensorI2c *object, const gchar *value)
7715{
7716 g_object_set (G_OBJECT (object), "dev-path", value, NULL);
7717}
7718
7719/**
7720 * sensor_i2c_get_address: (skip)
7721 * @object: A #SensorI2c.
7722 *
7723 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
7724 *
7725 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7726 *
7727 * <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>
7728 *
7729 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
7730 */
7731const gchar *
7732sensor_i2c_get_address (SensorI2c *object)
7733{
7734 return SENSOR_I2C_GET_IFACE (object)->get_address (object);
7735}
7736
7737/**
7738 * sensor_i2c_dup_address: (skip)
7739 * @object: A #SensorI2c.
7740 *
7741 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
7742 *
7743 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7744 *
7745 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
7746 */
7747gchar *
7748sensor_i2c_dup_address (SensorI2c *object)
7749{
7750 gchar *value;
7751 g_object_get (G_OBJECT (object), "address", &value, NULL);
7752 return value;
7753}
7754
7755/**
7756 * sensor_i2c_set_address: (skip)
7757 * @object: A #SensorI2c.
7758 * @value: The value to set.
7759 *
7760 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property to @value.
7761 *
7762 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7763 */
7764void
7765sensor_i2c_set_address (SensorI2c *object, const gchar *value)
7766{
7767 g_object_set (G_OBJECT (object), "address", value, NULL);
7768}
7769
7770/* ------------------------------------------------------------------------ */
7771
7772/**
7773 * SensorI2cProxy:
7774 *
7775 * The #SensorI2cProxy structure contains only private data and should only be accessed using the provided API.
7776 */
7777
7778/**
7779 * SensorI2cProxyClass:
7780 * @parent_class: The parent class.
7781 *
7782 * Class structure for #SensorI2cProxy.
7783 */
7784
7785struct _SensorI2cProxyPrivate
7786{
7787 GData *qdata;
7788};
7789
7790static void sensor_i2c_proxy_iface_init (SensorI2cIface *iface);
7791
7792#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7793G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
7794 G_ADD_PRIVATE (SensorI2cProxy)
7795 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
7796
7797#else
7798G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
7799 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
7800
7801#endif
7802static void
7803sensor_i2c_proxy_finalize (GObject *object)
7804{
7805 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
7806 g_datalist_clear (&proxy->priv->qdata);
7807 G_OBJECT_CLASS (sensor_i2c_proxy_parent_class)->finalize (object);
7808}
7809
7810static void
7811sensor_i2c_proxy_get_property (GObject *object,
7812 guint prop_id,
7813 GValue *value,
7814 GParamSpec *pspec G_GNUC_UNUSED)
7815{
7816 const _ExtendedGDBusPropertyInfo *info;
7817 GVariant *variant;
7818 g_assert (prop_id != 0 && prop_id - 1 < 2);
7819 info = _sensor_i2c_property_info_pointers[prop_id - 1];
7820 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
7821 if (info->use_gvariant)
7822 {
7823 g_value_set_variant (value, variant);
7824 }
7825 else
7826 {
7827 if (variant != NULL)
7828 g_dbus_gvariant_to_gvalue (variant, value);
7829 }
7830 if (variant != NULL)
7831 g_variant_unref (variant);
7832}
7833
7834static void
7835sensor_i2c_proxy_set_property_cb (GDBusProxy *proxy,
7836 GAsyncResult *res,
7837 gpointer user_data)
7838{
7839 const _ExtendedGDBusPropertyInfo *info = user_data;
7840 GError *error;
7841 GVariant *_ret;
7842 error = NULL;
7843 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
7844 if (!_ret)
7845 {
7846 g_warning ("Error setting property '%s' on interface org.openbmc.SensorI2c: %s (%s, %d)",
7847 info->parent_struct.name,
7848 error->message, g_quark_to_string (error->domain), error->code);
7849 g_error_free (error);
7850 }
7851 else
7852 {
7853 g_variant_unref (_ret);
7854 }
7855}
7856
7857static void
7858sensor_i2c_proxy_set_property (GObject *object,
7859 guint prop_id,
7860 const GValue *value,
7861 GParamSpec *pspec G_GNUC_UNUSED)
7862{
7863 const _ExtendedGDBusPropertyInfo *info;
7864 GVariant *variant;
7865 g_assert (prop_id != 0 && prop_id - 1 < 2);
7866 info = _sensor_i2c_property_info_pointers[prop_id - 1];
7867 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
7868 g_dbus_proxy_call (G_DBUS_PROXY (object),
7869 "org.freedesktop.DBus.Properties.Set",
7870 g_variant_new ("(ssv)", "org.openbmc.SensorI2c", info->parent_struct.name, variant),
7871 G_DBUS_CALL_FLAGS_NONE,
7872 -1,
7873 NULL, (GAsyncReadyCallback) sensor_i2c_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
7874 g_variant_unref (variant);
7875}
7876
7877static void
7878sensor_i2c_proxy_g_signal (GDBusProxy *proxy,
7879 const gchar *sender_name G_GNUC_UNUSED,
7880 const gchar *signal_name,
7881 GVariant *parameters)
7882{
7883 _ExtendedGDBusSignalInfo *info;
7884 GVariantIter iter;
7885 GVariant *child;
7886 GValue *paramv;
7887 guint num_params;
7888 guint n;
7889 guint signal_id;
7890 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, signal_name);
7891 if (info == NULL)
7892 return;
7893 num_params = g_variant_n_children (parameters);
7894 paramv = g_new0 (GValue, num_params + 1);
7895 g_value_init (&paramv[0], TYPE_SENSOR_I2C);
7896 g_value_set_object (&paramv[0], proxy);
7897 g_variant_iter_init (&iter, parameters);
7898 n = 1;
7899 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7900 {
7901 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
7902 if (arg_info->use_gvariant)
7903 {
7904 g_value_init (&paramv[n], G_TYPE_VARIANT);
7905 g_value_set_variant (&paramv[n], child);
7906 n++;
7907 }
7908 else
7909 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
7910 g_variant_unref (child);
7911 }
7912 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
7913 g_signal_emitv (paramv, signal_id, 0, NULL);
7914 for (n = 0; n < num_params + 1; n++)
7915 g_value_unset (&paramv[n]);
7916 g_free (paramv);
7917}
7918
7919static void
7920sensor_i2c_proxy_g_properties_changed (GDBusProxy *_proxy,
7921 GVariant *changed_properties,
7922 const gchar *const *invalidated_properties)
7923{
7924 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (_proxy);
7925 guint n;
7926 const gchar *key;
7927 GVariantIter *iter;
7928 _ExtendedGDBusPropertyInfo *info;
7929 g_variant_get (changed_properties, "a{sv}", &iter);
7930 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
7931 {
7932 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, key);
7933 g_datalist_remove_data (&proxy->priv->qdata, key);
7934 if (info != NULL)
7935 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7936 }
7937 g_variant_iter_free (iter);
7938 for (n = 0; invalidated_properties[n] != NULL; n++)
7939 {
7940 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, invalidated_properties[n]);
7941 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
7942 if (info != NULL)
7943 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7944 }
7945}
7946
7947static const gchar *
7948sensor_i2c_proxy_get_dev_path (SensorI2c *object)
7949{
7950 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
7951 GVariant *variant;
7952 const gchar *value = NULL;
7953 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "dev_path");
7954 if (variant != NULL)
7955 {
7956 value = g_variant_get_string (variant, NULL);
7957 g_variant_unref (variant);
7958 }
7959 return value;
7960}
7961
7962static const gchar *
7963sensor_i2c_proxy_get_address (SensorI2c *object)
7964{
7965 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
7966 GVariant *variant;
7967 const gchar *value = NULL;
7968 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "address");
7969 if (variant != NULL)
7970 {
7971 value = g_variant_get_string (variant, NULL);
7972 g_variant_unref (variant);
7973 }
7974 return value;
7975}
7976
7977static void
7978sensor_i2c_proxy_init (SensorI2cProxy *proxy)
7979{
7980#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7981 proxy->priv = sensor_i2c_proxy_get_instance_private (proxy);
7982#else
7983 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_I2C_PROXY, SensorI2cProxyPrivate);
7984#endif
7985
7986 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_i2c_interface_info ());
7987}
7988
7989static void
7990sensor_i2c_proxy_class_init (SensorI2cProxyClass *klass)
7991{
7992 GObjectClass *gobject_class;
7993 GDBusProxyClass *proxy_class;
7994
7995 gobject_class = G_OBJECT_CLASS (klass);
7996 gobject_class->finalize = sensor_i2c_proxy_finalize;
7997 gobject_class->get_property = sensor_i2c_proxy_get_property;
7998 gobject_class->set_property = sensor_i2c_proxy_set_property;
7999
8000 proxy_class = G_DBUS_PROXY_CLASS (klass);
8001 proxy_class->g_signal = sensor_i2c_proxy_g_signal;
8002 proxy_class->g_properties_changed = sensor_i2c_proxy_g_properties_changed;
8003
8004 sensor_i2c_override_properties (gobject_class, 1);
8005
8006#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8007 g_type_class_add_private (klass, sizeof (SensorI2cProxyPrivate));
8008#endif
8009}
8010
8011static void
8012sensor_i2c_proxy_iface_init (SensorI2cIface *iface)
8013{
8014 iface->get_dev_path = sensor_i2c_proxy_get_dev_path;
8015 iface->get_address = sensor_i2c_proxy_get_address;
8016}
8017
8018/**
8019 * sensor_i2c_proxy_new:
8020 * @connection: A #GDBusConnection.
8021 * @flags: Flags from the #GDBusProxyFlags enumeration.
8022 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
8023 * @object_path: An object path.
8024 * @cancellable: (allow-none): A #GCancellable or %NULL.
8025 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
8026 * @user_data: User data to pass to @callback.
8027 *
8028 * 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.
8029 *
8030 * 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.
8031 * You can then call sensor_i2c_proxy_new_finish() to get the result of the operation.
8032 *
8033 * See sensor_i2c_proxy_new_sync() for the synchronous, blocking version of this constructor.
8034 */
8035void
8036sensor_i2c_proxy_new (
8037 GDBusConnection *connection,
8038 GDBusProxyFlags flags,
8039 const gchar *name,
8040 const gchar *object_path,
8041 GCancellable *cancellable,
8042 GAsyncReadyCallback callback,
8043 gpointer user_data)
8044{
8045 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);
8046}
8047
8048/**
8049 * sensor_i2c_proxy_new_finish:
8050 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new().
8051 * @error: Return location for error or %NULL
8052 *
8053 * Finishes an operation started with sensor_i2c_proxy_new().
8054 *
8055 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8056 */
8057SensorI2c *
8058sensor_i2c_proxy_new_finish (
8059 GAsyncResult *res,
8060 GError **error)
8061{
8062 GObject *ret;
8063 GObject *source_object;
8064 source_object = g_async_result_get_source_object (res);
8065 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
8066 g_object_unref (source_object);
8067 if (ret != NULL)
8068 return SENSOR_I2C (ret);
8069 else
8070 return NULL;
8071}
8072
8073/**
8074 * sensor_i2c_proxy_new_sync:
8075 * @connection: A #GDBusConnection.
8076 * @flags: Flags from the #GDBusProxyFlags enumeration.
8077 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
8078 * @object_path: An object path.
8079 * @cancellable: (allow-none): A #GCancellable or %NULL.
8080 * @error: Return location for error or %NULL
8081 *
8082 * 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.
8083 *
8084 * The calling thread is blocked until a reply is received.
8085 *
8086 * See sensor_i2c_proxy_new() for the asynchronous version of this constructor.
8087 *
8088 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8089 */
8090SensorI2c *
8091sensor_i2c_proxy_new_sync (
8092 GDBusConnection *connection,
8093 GDBusProxyFlags flags,
8094 const gchar *name,
8095 const gchar *object_path,
8096 GCancellable *cancellable,
8097 GError **error)
8098{
8099 GInitable *ret;
8100 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);
8101 if (ret != NULL)
8102 return SENSOR_I2C (ret);
8103 else
8104 return NULL;
8105}
8106
8107
8108/**
8109 * sensor_i2c_proxy_new_for_bus:
8110 * @bus_type: A #GBusType.
8111 * @flags: Flags from the #GDBusProxyFlags enumeration.
8112 * @name: A bus name (well-known or unique).
8113 * @object_path: An object path.
8114 * @cancellable: (allow-none): A #GCancellable or %NULL.
8115 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
8116 * @user_data: User data to pass to @callback.
8117 *
8118 * Like sensor_i2c_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
8119 *
8120 * 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.
8121 * You can then call sensor_i2c_proxy_new_for_bus_finish() to get the result of the operation.
8122 *
8123 * See sensor_i2c_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
8124 */
8125void
8126sensor_i2c_proxy_new_for_bus (
8127 GBusType bus_type,
8128 GDBusProxyFlags flags,
8129 const gchar *name,
8130 const gchar *object_path,
8131 GCancellable *cancellable,
8132 GAsyncReadyCallback callback,
8133 gpointer user_data)
8134{
8135 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);
8136}
8137
8138/**
8139 * sensor_i2c_proxy_new_for_bus_finish:
8140 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new_for_bus().
8141 * @error: Return location for error or %NULL
8142 *
8143 * Finishes an operation started with sensor_i2c_proxy_new_for_bus().
8144 *
8145 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8146 */
8147SensorI2c *
8148sensor_i2c_proxy_new_for_bus_finish (
8149 GAsyncResult *res,
8150 GError **error)
8151{
8152 GObject *ret;
8153 GObject *source_object;
8154 source_object = g_async_result_get_source_object (res);
8155 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
8156 g_object_unref (source_object);
8157 if (ret != NULL)
8158 return SENSOR_I2C (ret);
8159 else
8160 return NULL;
8161}
8162
8163/**
8164 * sensor_i2c_proxy_new_for_bus_sync:
8165 * @bus_type: A #GBusType.
8166 * @flags: Flags from the #GDBusProxyFlags enumeration.
8167 * @name: A bus name (well-known or unique).
8168 * @object_path: An object path.
8169 * @cancellable: (allow-none): A #GCancellable or %NULL.
8170 * @error: Return location for error or %NULL
8171 *
8172 * Like sensor_i2c_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
8173 *
8174 * The calling thread is blocked until a reply is received.
8175 *
8176 * See sensor_i2c_proxy_new_for_bus() for the asynchronous version of this constructor.
8177 *
8178 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8179 */
8180SensorI2c *
8181sensor_i2c_proxy_new_for_bus_sync (
8182 GBusType bus_type,
8183 GDBusProxyFlags flags,
8184 const gchar *name,
8185 const gchar *object_path,
8186 GCancellable *cancellable,
8187 GError **error)
8188{
8189 GInitable *ret;
8190 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);
8191 if (ret != NULL)
8192 return SENSOR_I2C (ret);
8193 else
8194 return NULL;
8195}
8196
8197
8198/* ------------------------------------------------------------------------ */
8199
8200/**
8201 * SensorI2cSkeleton:
8202 *
8203 * The #SensorI2cSkeleton structure contains only private data and should only be accessed using the provided API.
8204 */
8205
8206/**
8207 * SensorI2cSkeletonClass:
8208 * @parent_class: The parent class.
8209 *
8210 * Class structure for #SensorI2cSkeleton.
8211 */
8212
8213struct _SensorI2cSkeletonPrivate
8214{
8215 GValue *properties;
8216 GList *changed_properties;
8217 GSource *changed_properties_idle_source;
8218 GMainContext *context;
8219 GMutex lock;
8220};
8221
8222static void
8223_sensor_i2c_skeleton_handle_method_call (
8224 GDBusConnection *connection G_GNUC_UNUSED,
8225 const gchar *sender G_GNUC_UNUSED,
8226 const gchar *object_path G_GNUC_UNUSED,
8227 const gchar *interface_name,
8228 const gchar *method_name,
8229 GVariant *parameters,
8230 GDBusMethodInvocation *invocation,
8231 gpointer user_data)
8232{
8233 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8234 _ExtendedGDBusMethodInfo *info;
8235 GVariantIter iter;
8236 GVariant *child;
8237 GValue *paramv;
8238 guint num_params;
8239 guint num_extra;
8240 guint n;
8241 guint signal_id;
8242 GValue return_value = G_VALUE_INIT;
8243 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
8244 g_assert (info != NULL);
8245 num_params = g_variant_n_children (parameters);
8246 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
8247 n = 0;
8248 g_value_init (&paramv[n], TYPE_SENSOR_I2C);
8249 g_value_set_object (&paramv[n++], skeleton);
8250 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
8251 g_value_set_object (&paramv[n++], invocation);
8252 if (info->pass_fdlist)
8253 {
8254#ifdef G_OS_UNIX
8255 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
8256 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
8257#else
8258 g_assert_not_reached ();
8259#endif
8260 }
8261 g_variant_iter_init (&iter, parameters);
8262 while ((child = g_variant_iter_next_value (&iter)) != NULL)
8263 {
8264 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
8265 if (arg_info->use_gvariant)
8266 {
8267 g_value_init (&paramv[n], G_TYPE_VARIANT);
8268 g_value_set_variant (&paramv[n], child);
8269 n++;
8270 }
8271 else
8272 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
8273 g_variant_unref (child);
8274 }
8275 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
8276 g_value_init (&return_value, G_TYPE_BOOLEAN);
8277 g_signal_emitv (paramv, signal_id, 0, &return_value);
8278 if (!g_value_get_boolean (&return_value))
8279 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);
8280 g_value_unset (&return_value);
8281 for (n = 0; n < num_params + num_extra; n++)
8282 g_value_unset (&paramv[n]);
8283 g_free (paramv);
8284}
8285
8286static GVariant *
8287_sensor_i2c_skeleton_handle_get_property (
8288 GDBusConnection *connection G_GNUC_UNUSED,
8289 const gchar *sender G_GNUC_UNUSED,
8290 const gchar *object_path G_GNUC_UNUSED,
8291 const gchar *interface_name G_GNUC_UNUSED,
8292 const gchar *property_name,
8293 GError **error,
8294 gpointer user_data)
8295{
8296 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8297 GValue value = G_VALUE_INIT;
8298 GParamSpec *pspec;
8299 _ExtendedGDBusPropertyInfo *info;
8300 GVariant *ret;
8301 ret = NULL;
8302 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
8303 g_assert (info != NULL);
8304 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
8305 if (pspec == NULL)
8306 {
8307 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
8308 }
8309 else
8310 {
8311 g_value_init (&value, pspec->value_type);
8312 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
8313 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
8314 g_value_unset (&value);
8315 }
8316 return ret;
8317}
8318
8319static gboolean
8320_sensor_i2c_skeleton_handle_set_property (
8321 GDBusConnection *connection G_GNUC_UNUSED,
8322 const gchar *sender G_GNUC_UNUSED,
8323 const gchar *object_path G_GNUC_UNUSED,
8324 const gchar *interface_name G_GNUC_UNUSED,
8325 const gchar *property_name,
8326 GVariant *variant,
8327 GError **error,
8328 gpointer user_data)
8329{
8330 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8331 GValue value = G_VALUE_INIT;
8332 GParamSpec *pspec;
8333 _ExtendedGDBusPropertyInfo *info;
8334 gboolean ret;
8335 ret = FALSE;
8336 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
8337 g_assert (info != NULL);
8338 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
8339 if (pspec == NULL)
8340 {
8341 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
8342 }
8343 else
8344 {
8345 if (info->use_gvariant)
8346 g_value_set_variant (&value, variant);
8347 else
8348 g_dbus_gvariant_to_gvalue (variant, &value);
8349 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
8350 g_value_unset (&value);
8351 ret = TRUE;
8352 }
8353 return ret;
8354}
8355
8356static const GDBusInterfaceVTable _sensor_i2c_skeleton_vtable =
8357{
8358 _sensor_i2c_skeleton_handle_method_call,
8359 _sensor_i2c_skeleton_handle_get_property,
8360 _sensor_i2c_skeleton_handle_set_property,
8361 {NULL}
8362};
8363
8364static GDBusInterfaceInfo *
8365sensor_i2c_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8366{
8367 return sensor_i2c_interface_info ();
8368}
8369
8370static GDBusInterfaceVTable *
8371sensor_i2c_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8372{
8373 return (GDBusInterfaceVTable *) &_sensor_i2c_skeleton_vtable;
8374}
8375
8376static GVariant *
8377sensor_i2c_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
8378{
8379 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
8380
8381 GVariantBuilder builder;
8382 guint n;
8383 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8384 if (_sensor_i2c_interface_info.parent_struct.properties == NULL)
8385 goto out;
8386 for (n = 0; _sensor_i2c_interface_info.parent_struct.properties[n] != NULL; n++)
8387 {
8388 GDBusPropertyInfo *info = _sensor_i2c_interface_info.parent_struct.properties[n];
8389 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
8390 {
8391 GVariant *value;
8392 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);
8393 if (value != NULL)
8394 {
8395 g_variant_take_ref (value);
8396 g_variant_builder_add (&builder, "{sv}", info->name, value);
8397 g_variant_unref (value);
8398 }
8399 }
8400 }
8401out:
8402 return g_variant_builder_end (&builder);
8403}
8404
8405static gboolean _sensor_i2c_emit_changed (gpointer user_data);
8406
8407static void
8408sensor_i2c_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
8409{
8410 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
8411 gboolean emit_changed = FALSE;
8412
8413 g_mutex_lock (&skeleton->priv->lock);
8414 if (skeleton->priv->changed_properties_idle_source != NULL)
8415 {
8416 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8417 skeleton->priv->changed_properties_idle_source = NULL;
8418 emit_changed = TRUE;
8419 }
8420 g_mutex_unlock (&skeleton->priv->lock);
8421
8422 if (emit_changed)
8423 _sensor_i2c_emit_changed (skeleton);
8424}
8425
8426static void sensor_i2c_skeleton_iface_init (SensorI2cIface *iface);
8427#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8428G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8429 G_ADD_PRIVATE (SensorI2cSkeleton)
8430 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
8431
8432#else
8433G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8434 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
8435
8436#endif
8437static void
8438sensor_i2c_skeleton_finalize (GObject *object)
8439{
8440 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8441 guint n;
8442 for (n = 0; n < 2; n++)
8443 g_value_unset (&skeleton->priv->properties[n]);
8444 g_free (skeleton->priv->properties);
8445 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
8446 if (skeleton->priv->changed_properties_idle_source != NULL)
8447 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8448 g_main_context_unref (skeleton->priv->context);
8449 g_mutex_clear (&skeleton->priv->lock);
8450 G_OBJECT_CLASS (sensor_i2c_skeleton_parent_class)->finalize (object);
8451}
8452
8453static void
8454sensor_i2c_skeleton_get_property (GObject *object,
8455 guint prop_id,
8456 GValue *value,
8457 GParamSpec *pspec G_GNUC_UNUSED)
8458{
8459 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8460 g_assert (prop_id != 0 && prop_id - 1 < 2);
8461 g_mutex_lock (&skeleton->priv->lock);
8462 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
8463 g_mutex_unlock (&skeleton->priv->lock);
8464}
8465
8466static gboolean
8467_sensor_i2c_emit_changed (gpointer user_data)
8468{
8469 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8470 GList *l;
8471 GVariantBuilder builder;
8472 GVariantBuilder invalidated_builder;
8473 guint num_changes;
8474
8475 g_mutex_lock (&skeleton->priv->lock);
8476 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8477 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
8478 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
8479 {
8480 ChangedProperty *cp = l->data;
8481 GVariant *variant;
8482 const GValue *cur_value;
8483
8484 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
8485 if (!_g_value_equal (cur_value, &cp->orig_value))
8486 {
8487 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
8488 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
8489 g_variant_unref (variant);
8490 num_changes++;
8491 }
8492 }
8493 if (num_changes > 0)
8494 {
8495 GList *connections, *ll;
8496 GVariant *signal_variant;
8497 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorI2c",
8498 &builder, &invalidated_builder));
8499 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
8500 for (ll = connections; ll != NULL; ll = ll->next)
8501 {
8502 GDBusConnection *connection = ll->data;
8503
8504 g_dbus_connection_emit_signal (connection,
8505 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
8506 "org.freedesktop.DBus.Properties",
8507 "PropertiesChanged",
8508 signal_variant,
8509 NULL);
8510 }
8511 g_variant_unref (signal_variant);
8512 g_list_free_full (connections, g_object_unref);
8513 }
8514 else
8515 {
8516 g_variant_builder_clear (&builder);
8517 g_variant_builder_clear (&invalidated_builder);
8518 }
8519 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
8520 skeleton->priv->changed_properties = NULL;
8521 skeleton->priv->changed_properties_idle_source = NULL;
8522 g_mutex_unlock (&skeleton->priv->lock);
8523 return FALSE;
8524}
8525
8526static void
8527_sensor_i2c_schedule_emit_changed (SensorI2cSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
8528{
8529 ChangedProperty *cp;
8530 GList *l;
8531 cp = NULL;
8532 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
8533 {
8534 ChangedProperty *i_cp = l->data;
8535 if (i_cp->info == info)
8536 {
8537 cp = i_cp;
8538 break;
8539 }
8540 }
8541 if (cp == NULL)
8542 {
8543 cp = g_new0 (ChangedProperty, 1);
8544 cp->prop_id = prop_id;
8545 cp->info = info;
8546 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
8547 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
8548 g_value_copy (orig_value, &cp->orig_value);
8549 }
8550}
8551
8552static void
8553sensor_i2c_skeleton_notify (GObject *object,
8554 GParamSpec *pspec G_GNUC_UNUSED)
8555{
8556 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8557 g_mutex_lock (&skeleton->priv->lock);
8558 if (skeleton->priv->changed_properties != NULL &&
8559 skeleton->priv->changed_properties_idle_source == NULL)
8560 {
8561 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
8562 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
8563 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_i2c_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
8564 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
8565 g_source_unref (skeleton->priv->changed_properties_idle_source);
8566 }
8567 g_mutex_unlock (&skeleton->priv->lock);
8568}
8569
8570static void
8571sensor_i2c_skeleton_set_property (GObject *object,
8572 guint prop_id,
8573 const GValue *value,
8574 GParamSpec *pspec)
8575{
8576 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8577 g_assert (prop_id != 0 && prop_id - 1 < 2);
8578 g_mutex_lock (&skeleton->priv->lock);
8579 g_object_freeze_notify (object);
8580 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
8581 {
8582 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
8583 _sensor_i2c_schedule_emit_changed (skeleton, _sensor_i2c_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
8584 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
8585 g_object_notify_by_pspec (object, pspec);
8586 }
8587 g_mutex_unlock (&skeleton->priv->lock);
8588 g_object_thaw_notify (object);
8589}
8590
8591static void
8592sensor_i2c_skeleton_init (SensorI2cSkeleton *skeleton)
8593{
8594#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8595 skeleton->priv = sensor_i2c_skeleton_get_instance_private (skeleton);
8596#else
8597 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_I2C_SKELETON, SensorI2cSkeletonPrivate);
8598#endif
8599
8600 g_mutex_init (&skeleton->priv->lock);
8601 skeleton->priv->context = g_main_context_ref_thread_default ();
8602 skeleton->priv->properties = g_new0 (GValue, 2);
8603 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
8604 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
8605}
8606
8607static const gchar *
8608sensor_i2c_skeleton_get_dev_path (SensorI2c *object)
8609{
8610 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8611 const gchar *value;
8612 g_mutex_lock (&skeleton->priv->lock);
8613 value = g_value_get_string (&(skeleton->priv->properties[0]));
8614 g_mutex_unlock (&skeleton->priv->lock);
8615 return value;
8616}
8617
8618static const gchar *
8619sensor_i2c_skeleton_get_address (SensorI2c *object)
8620{
8621 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8622 const gchar *value;
8623 g_mutex_lock (&skeleton->priv->lock);
8624 value = g_value_get_string (&(skeleton->priv->properties[1]));
8625 g_mutex_unlock (&skeleton->priv->lock);
8626 return value;
8627}
8628
8629static void
8630sensor_i2c_skeleton_class_init (SensorI2cSkeletonClass *klass)
8631{
8632 GObjectClass *gobject_class;
8633 GDBusInterfaceSkeletonClass *skeleton_class;
8634
8635 gobject_class = G_OBJECT_CLASS (klass);
8636 gobject_class->finalize = sensor_i2c_skeleton_finalize;
8637 gobject_class->get_property = sensor_i2c_skeleton_get_property;
8638 gobject_class->set_property = sensor_i2c_skeleton_set_property;
8639 gobject_class->notify = sensor_i2c_skeleton_notify;
8640
8641
8642 sensor_i2c_override_properties (gobject_class, 1);
8643
8644 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
8645 skeleton_class->get_info = sensor_i2c_skeleton_dbus_interface_get_info;
8646 skeleton_class->get_properties = sensor_i2c_skeleton_dbus_interface_get_properties;
8647 skeleton_class->flush = sensor_i2c_skeleton_dbus_interface_flush;
8648 skeleton_class->get_vtable = sensor_i2c_skeleton_dbus_interface_get_vtable;
8649
8650#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8651 g_type_class_add_private (klass, sizeof (SensorI2cSkeletonPrivate));
8652#endif
8653}
8654
8655static void
8656sensor_i2c_skeleton_iface_init (SensorI2cIface *iface)
8657{
8658 iface->get_dev_path = sensor_i2c_skeleton_get_dev_path;
8659 iface->get_address = sensor_i2c_skeleton_get_address;
8660}
8661
8662/**
8663 * sensor_i2c_skeleton_new:
8664 *
8665 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
8666 *
8667 * Returns: (transfer full) (type SensorI2cSkeleton): The skeleton object.
8668 */
8669SensorI2c *
8670sensor_i2c_skeleton_new (void)
8671{
8672 return SENSOR_I2C (g_object_new (TYPE_SENSOR_I2C_SKELETON, NULL));
8673}
8674
8675/* ------------------------------------------------------------------------
8676 * Code for interface org.openbmc.SensorMatch
8677 * ------------------------------------------------------------------------
8678 */
8679
8680/**
8681 * SECTION:SensorMatch
8682 * @title: SensorMatch
8683 * @short_description: Generated C code for the org.openbmc.SensorMatch D-Bus interface
8684 *
8685 * 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.
8686 */
8687
8688/* ---- Introspection data for org.openbmc.SensorMatch ---- */
8689
8690static const _ExtendedGDBusArgInfo _sensor_match_signal_info_sensor_match_ARG_state =
8691{
8692 {
8693 -1,
8694 (gchar *) "state",
8695 (gchar *) "y",
8696 NULL
8697 },
8698 FALSE
8699};
8700
8701static const _ExtendedGDBusArgInfo * const _sensor_match_signal_info_sensor_match_ARG_pointers[] =
8702{
8703 &_sensor_match_signal_info_sensor_match_ARG_state,
8704 NULL
8705};
8706
8707static const _ExtendedGDBusSignalInfo _sensor_match_signal_info_sensor_match =
8708{
8709 {
8710 -1,
8711 (gchar *) "SensorMatch",
8712 (GDBusArgInfo **) &_sensor_match_signal_info_sensor_match_ARG_pointers,
8713 NULL
8714 },
8715 "sensor-match"
8716};
8717
8718static const _ExtendedGDBusSignalInfo * const _sensor_match_signal_info_pointers[] =
8719{
8720 &_sensor_match_signal_info_sensor_match,
8721 NULL
8722};
8723
8724static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_match_value =
8725{
8726 {
8727 -1,
8728 (gchar *) "match_value",
8729 (gchar *) "v",
8730 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
8731 NULL
8732 },
8733 "match-value",
8734 FALSE
8735};
8736
8737static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_state =
8738{
8739 {
8740 -1,
8741 (gchar *) "state",
8742 (gchar *) "y",
8743 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
8744 NULL
8745 },
8746 "state",
8747 FALSE
8748};
8749
8750static const _ExtendedGDBusPropertyInfo * const _sensor_match_property_info_pointers[] =
8751{
8752 &_sensor_match_property_info_match_value,
8753 &_sensor_match_property_info_state,
8754 NULL
8755};
8756
8757static const _ExtendedGDBusInterfaceInfo _sensor_match_interface_info =
8758{
8759 {
8760 -1,
8761 (gchar *) "org.openbmc.SensorMatch",
8762 NULL,
8763 (GDBusSignalInfo **) &_sensor_match_signal_info_pointers,
8764 (GDBusPropertyInfo **) &_sensor_match_property_info_pointers,
8765 NULL
8766 },
8767 "sensor-match",
8768};
8769
8770
8771/**
8772 * sensor_match_interface_info:
8773 *
8774 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> D-Bus interface.
8775 *
8776 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
8777 */
8778GDBusInterfaceInfo *
8779sensor_match_interface_info (void)
8780{
8781 return (GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct;
8782}
8783
8784/**
8785 * sensor_match_override_properties:
8786 * @klass: The class structure for a #GObject<!-- -->-derived class.
8787 * @property_id_begin: The property id to assign to the first overridden property.
8788 *
8789 * Overrides all #GObject properties in the #SensorMatch interface for a concrete class.
8790 * The properties are overridden in the order they are defined.
8791 *
8792 * Returns: The last property id.
8793 */
8794guint
8795sensor_match_override_properties (GObjectClass *klass, guint property_id_begin)
8796{
8797 g_object_class_override_property (klass, property_id_begin++, "match-value");
8798 g_object_class_override_property (klass, property_id_begin++, "state");
8799 return property_id_begin - 1;
8800}
8801
8802
8803
8804/**
8805 * SensorMatch:
8806 *
8807 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
8808 */
8809
8810/**
8811 * SensorMatchIface:
8812 * @parent_iface: The parent interface.
8813 * @get_match_value: Getter for the #SensorMatch:match-value property.
8814 * @get_state: Getter for the #SensorMatch:state property.
8815 * @sensor_match: Handler for the #SensorMatch::sensor-match signal.
8816 *
8817 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
8818 */
8819
8820typedef SensorMatchIface SensorMatchInterface;
8821G_DEFINE_INTERFACE (SensorMatch, sensor_match, G_TYPE_OBJECT);
8822
8823static void
8824sensor_match_default_init (SensorMatchIface *iface)
8825{
8826 /* GObject signals for received D-Bus signals: */
8827 /**
8828 * SensorMatch::sensor-match:
8829 * @object: A #SensorMatch.
8830 * @arg_state: Argument.
8831 *
8832 * 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.
8833 *
8834 * 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.
8835 */
8836 g_signal_new ("sensor-match",
8837 G_TYPE_FROM_INTERFACE (iface),
8838 G_SIGNAL_RUN_LAST,
8839 G_STRUCT_OFFSET (SensorMatchIface, sensor_match),
8840 NULL,
8841 NULL,
8842 g_cclosure_marshal_generic,
8843 G_TYPE_NONE,
8844 1, G_TYPE_UCHAR);
8845
8846 /* GObject properties for D-Bus properties: */
8847 /**
8848 * SensorMatch:match-value:
8849 *
8850 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link>.
8851 *
8852 * 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.
8853 */
8854 g_object_interface_install_property (iface,
8855 g_param_spec_variant ("match-value", "match_value", "match_value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
8856 /**
8857 * SensorMatch:state:
8858 *
8859 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link>.
8860 *
8861 * 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.
8862 */
8863 g_object_interface_install_property (iface,
8864 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
8865}
8866
8867/**
8868 * sensor_match_get_match_value: (skip)
8869 * @object: A #SensorMatch.
8870 *
8871 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property.
8872 *
8873 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
8874 *
8875 * <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>
8876 *
8877 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
8878 */
8879GVariant *
8880sensor_match_get_match_value (SensorMatch *object)
8881{
8882 return SENSOR_MATCH_GET_IFACE (object)->get_match_value (object);
8883}
8884
8885/**
8886 * sensor_match_dup_match_value: (skip)
8887 * @object: A #SensorMatch.
8888 *
8889 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property.
8890 *
8891 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
8892 *
8893 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
8894 */
8895GVariant *
8896sensor_match_dup_match_value (SensorMatch *object)
8897{
8898 GVariant *value;
8899 g_object_get (G_OBJECT (object), "match-value", &value, NULL);
8900 return value;
8901}
8902
8903/**
8904 * sensor_match_set_match_value: (skip)
8905 * @object: A #SensorMatch.
8906 * @value: The value to set.
8907 *
8908 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property to @value.
8909 *
8910 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
8911 */
8912void
8913sensor_match_set_match_value (SensorMatch *object, GVariant *value)
8914{
8915 g_object_set (G_OBJECT (object), "match-value", value, NULL);
8916}
8917
8918/**
8919 * sensor_match_get_state: (skip)
8920 * @object: A #SensorMatch.
8921 *
8922 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property.
8923 *
8924 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
8925 *
8926 * Returns: The property value.
8927 */
8928guchar
8929sensor_match_get_state (SensorMatch *object)
8930{
8931 return SENSOR_MATCH_GET_IFACE (object)->get_state (object);
8932}
8933
8934/**
8935 * sensor_match_set_state: (skip)
8936 * @object: A #SensorMatch.
8937 * @value: The value to set.
8938 *
8939 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property to @value.
8940 *
8941 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
8942 */
8943void
8944sensor_match_set_state (SensorMatch *object, guchar value)
8945{
8946 g_object_set (G_OBJECT (object), "state", value, NULL);
8947}
8948
8949/**
8950 * sensor_match_emit_sensor_match:
8951 * @object: A #SensorMatch.
8952 * @arg_state: Argument to pass with the signal.
8953 *
8954 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorMatch.SensorMatch">"SensorMatch"</link> D-Bus signal.
8955 */
8956void
8957sensor_match_emit_sensor_match (
8958 SensorMatch *object,
8959 guchar arg_state)
8960{
8961 g_signal_emit_by_name (object, "sensor-match", arg_state);
8962}
8963
8964/* ------------------------------------------------------------------------ */
8965
8966/**
8967 * SensorMatchProxy:
8968 *
8969 * The #SensorMatchProxy structure contains only private data and should only be accessed using the provided API.
8970 */
8971
8972/**
8973 * SensorMatchProxyClass:
8974 * @parent_class: The parent class.
8975 *
8976 * Class structure for #SensorMatchProxy.
8977 */
8978
8979struct _SensorMatchProxyPrivate
8980{
8981 GData *qdata;
8982};
8983
8984static void sensor_match_proxy_iface_init (SensorMatchIface *iface);
8985
8986#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8987G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY,
8988 G_ADD_PRIVATE (SensorMatchProxy)
8989 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init));
8990
8991#else
8992G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY,
8993 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init));
8994
8995#endif
8996static void
8997sensor_match_proxy_finalize (GObject *object)
8998{
8999 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9000 g_datalist_clear (&proxy->priv->qdata);
9001 G_OBJECT_CLASS (sensor_match_proxy_parent_class)->finalize (object);
9002}
9003
9004static void
9005sensor_match_proxy_get_property (GObject *object,
9006 guint prop_id,
9007 GValue *value,
9008 GParamSpec *pspec G_GNUC_UNUSED)
9009{
9010 const _ExtendedGDBusPropertyInfo *info;
9011 GVariant *variant;
9012 g_assert (prop_id != 0 && prop_id - 1 < 2);
9013 info = _sensor_match_property_info_pointers[prop_id - 1];
9014 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
9015 if (info->use_gvariant)
9016 {
9017 g_value_set_variant (value, variant);
9018 }
9019 else
9020 {
9021 if (variant != NULL)
9022 g_dbus_gvariant_to_gvalue (variant, value);
9023 }
9024 if (variant != NULL)
9025 g_variant_unref (variant);
9026}
9027
9028static void
9029sensor_match_proxy_set_property_cb (GDBusProxy *proxy,
9030 GAsyncResult *res,
9031 gpointer user_data)
9032{
9033 const _ExtendedGDBusPropertyInfo *info = user_data;
9034 GError *error;
9035 GVariant *_ret;
9036 error = NULL;
9037 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
9038 if (!_ret)
9039 {
9040 g_warning ("Error setting property '%s' on interface org.openbmc.SensorMatch: %s (%s, %d)",
9041 info->parent_struct.name,
9042 error->message, g_quark_to_string (error->domain), error->code);
9043 g_error_free (error);
9044 }
9045 else
9046 {
9047 g_variant_unref (_ret);
9048 }
9049}
9050
9051static void
9052sensor_match_proxy_set_property (GObject *object,
9053 guint prop_id,
9054 const GValue *value,
9055 GParamSpec *pspec G_GNUC_UNUSED)
9056{
9057 const _ExtendedGDBusPropertyInfo *info;
9058 GVariant *variant;
9059 g_assert (prop_id != 0 && prop_id - 1 < 2);
9060 info = _sensor_match_property_info_pointers[prop_id - 1];
9061 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
9062 g_dbus_proxy_call (G_DBUS_PROXY (object),
9063 "org.freedesktop.DBus.Properties.Set",
9064 g_variant_new ("(ssv)", "org.openbmc.SensorMatch", info->parent_struct.name, variant),
9065 G_DBUS_CALL_FLAGS_NONE,
9066 -1,
9067 NULL, (GAsyncReadyCallback) sensor_match_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
9068 g_variant_unref (variant);
9069}
9070
9071static void
9072sensor_match_proxy_g_signal (GDBusProxy *proxy,
9073 const gchar *sender_name G_GNUC_UNUSED,
9074 const gchar *signal_name,
9075 GVariant *parameters)
9076{
9077 _ExtendedGDBusSignalInfo *info;
9078 GVariantIter iter;
9079 GVariant *child;
9080 GValue *paramv;
9081 guint num_params;
9082 guint n;
9083 guint signal_id;
9084 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, signal_name);
9085 if (info == NULL)
9086 return;
9087 num_params = g_variant_n_children (parameters);
9088 paramv = g_new0 (GValue, num_params + 1);
9089 g_value_init (&paramv[0], TYPE_SENSOR_MATCH);
9090 g_value_set_object (&paramv[0], proxy);
9091 g_variant_iter_init (&iter, parameters);
9092 n = 1;
9093 while ((child = g_variant_iter_next_value (&iter)) != NULL)
9094 {
9095 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
9096 if (arg_info->use_gvariant)
9097 {
9098 g_value_init (&paramv[n], G_TYPE_VARIANT);
9099 g_value_set_variant (&paramv[n], child);
9100 n++;
9101 }
9102 else
9103 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
9104 g_variant_unref (child);
9105 }
9106 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH);
9107 g_signal_emitv (paramv, signal_id, 0, NULL);
9108 for (n = 0; n < num_params + 1; n++)
9109 g_value_unset (&paramv[n]);
9110 g_free (paramv);
9111}
9112
9113static void
9114sensor_match_proxy_g_properties_changed (GDBusProxy *_proxy,
9115 GVariant *changed_properties,
9116 const gchar *const *invalidated_properties)
9117{
9118 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (_proxy);
9119 guint n;
9120 const gchar *key;
9121 GVariantIter *iter;
9122 _ExtendedGDBusPropertyInfo *info;
9123 g_variant_get (changed_properties, "a{sv}", &iter);
9124 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
9125 {
9126 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, key);
9127 g_datalist_remove_data (&proxy->priv->qdata, key);
9128 if (info != NULL)
9129 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
9130 }
9131 g_variant_iter_free (iter);
9132 for (n = 0; invalidated_properties[n] != NULL; n++)
9133 {
9134 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, invalidated_properties[n]);
9135 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
9136 if (info != NULL)
9137 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
9138 }
9139}
9140
9141static GVariant *
9142sensor_match_proxy_get_match_value (SensorMatch *object)
9143{
9144 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9145 GVariant *variant;
9146 GVariant *value = NULL;
9147 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "match_value");
9148 value = variant;
9149 if (variant != NULL)
9150 g_variant_unref (variant);
9151 return value;
9152}
9153
9154static guchar
9155sensor_match_proxy_get_state (SensorMatch *object)
9156{
9157 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9158 GVariant *variant;
9159 guchar value = 0;
9160 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
9161 if (variant != NULL)
9162 {
9163 value = g_variant_get_byte (variant);
9164 g_variant_unref (variant);
9165 }
9166 return value;
9167}
9168
9169static void
9170sensor_match_proxy_init (SensorMatchProxy *proxy)
9171{
9172#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9173 proxy->priv = sensor_match_proxy_get_instance_private (proxy);
9174#else
9175 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_MATCH_PROXY, SensorMatchProxyPrivate);
9176#endif
9177
9178 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_match_interface_info ());
9179}
9180
9181static void
9182sensor_match_proxy_class_init (SensorMatchProxyClass *klass)
9183{
9184 GObjectClass *gobject_class;
9185 GDBusProxyClass *proxy_class;
9186
9187 gobject_class = G_OBJECT_CLASS (klass);
9188 gobject_class->finalize = sensor_match_proxy_finalize;
9189 gobject_class->get_property = sensor_match_proxy_get_property;
9190 gobject_class->set_property = sensor_match_proxy_set_property;
9191
9192 proxy_class = G_DBUS_PROXY_CLASS (klass);
9193 proxy_class->g_signal = sensor_match_proxy_g_signal;
9194 proxy_class->g_properties_changed = sensor_match_proxy_g_properties_changed;
9195
9196 sensor_match_override_properties (gobject_class, 1);
9197
9198#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
9199 g_type_class_add_private (klass, sizeof (SensorMatchProxyPrivate));
9200#endif
9201}
9202
9203static void
9204sensor_match_proxy_iface_init (SensorMatchIface *iface)
9205{
9206 iface->get_match_value = sensor_match_proxy_get_match_value;
9207 iface->get_state = sensor_match_proxy_get_state;
9208}
9209
9210/**
9211 * sensor_match_proxy_new:
9212 * @connection: A #GDBusConnection.
9213 * @flags: Flags from the #GDBusProxyFlags enumeration.
9214 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
9215 * @object_path: An object path.
9216 * @cancellable: (allow-none): A #GCancellable or %NULL.
9217 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
9218 * @user_data: User data to pass to @callback.
9219 *
9220 * 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.
9221 *
9222 * 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.
9223 * You can then call sensor_match_proxy_new_finish() to get the result of the operation.
9224 *
9225 * See sensor_match_proxy_new_sync() for the synchronous, blocking version of this constructor.
9226 */
9227void
9228sensor_match_proxy_new (
9229 GDBusConnection *connection,
9230 GDBusProxyFlags flags,
9231 const gchar *name,
9232 const gchar *object_path,
9233 GCancellable *cancellable,
9234 GAsyncReadyCallback callback,
9235 gpointer user_data)
9236{
9237 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);
9238}
9239
9240/**
9241 * sensor_match_proxy_new_finish:
9242 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new().
9243 * @error: Return location for error or %NULL
9244 *
9245 * Finishes an operation started with sensor_match_proxy_new().
9246 *
9247 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9248 */
9249SensorMatch *
9250sensor_match_proxy_new_finish (
9251 GAsyncResult *res,
9252 GError **error)
9253{
9254 GObject *ret;
9255 GObject *source_object;
9256 source_object = g_async_result_get_source_object (res);
9257 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
9258 g_object_unref (source_object);
9259 if (ret != NULL)
9260 return SENSOR_MATCH (ret);
9261 else
9262 return NULL;
9263}
9264
9265/**
9266 * sensor_match_proxy_new_sync:
9267 * @connection: A #GDBusConnection.
9268 * @flags: Flags from the #GDBusProxyFlags enumeration.
9269 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
9270 * @object_path: An object path.
9271 * @cancellable: (allow-none): A #GCancellable or %NULL.
9272 * @error: Return location for error or %NULL
9273 *
9274 * 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.
9275 *
9276 * The calling thread is blocked until a reply is received.
9277 *
9278 * See sensor_match_proxy_new() for the asynchronous version of this constructor.
9279 *
9280 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9281 */
9282SensorMatch *
9283sensor_match_proxy_new_sync (
9284 GDBusConnection *connection,
9285 GDBusProxyFlags flags,
9286 const gchar *name,
9287 const gchar *object_path,
9288 GCancellable *cancellable,
9289 GError **error)
9290{
9291 GInitable *ret;
9292 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);
9293 if (ret != NULL)
9294 return SENSOR_MATCH (ret);
9295 else
9296 return NULL;
9297}
9298
9299
9300/**
9301 * sensor_match_proxy_new_for_bus:
9302 * @bus_type: A #GBusType.
9303 * @flags: Flags from the #GDBusProxyFlags enumeration.
9304 * @name: A bus name (well-known or unique).
9305 * @object_path: An object path.
9306 * @cancellable: (allow-none): A #GCancellable or %NULL.
9307 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
9308 * @user_data: User data to pass to @callback.
9309 *
9310 * Like sensor_match_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
9311 *
9312 * 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.
9313 * You can then call sensor_match_proxy_new_for_bus_finish() to get the result of the operation.
9314 *
9315 * See sensor_match_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
9316 */
9317void
9318sensor_match_proxy_new_for_bus (
9319 GBusType bus_type,
9320 GDBusProxyFlags flags,
9321 const gchar *name,
9322 const gchar *object_path,
9323 GCancellable *cancellable,
9324 GAsyncReadyCallback callback,
9325 gpointer user_data)
9326{
9327 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);
9328}
9329
9330/**
9331 * sensor_match_proxy_new_for_bus_finish:
9332 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new_for_bus().
9333 * @error: Return location for error or %NULL
9334 *
9335 * Finishes an operation started with sensor_match_proxy_new_for_bus().
9336 *
9337 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9338 */
9339SensorMatch *
9340sensor_match_proxy_new_for_bus_finish (
9341 GAsyncResult *res,
9342 GError **error)
9343{
9344 GObject *ret;
9345 GObject *source_object;
9346 source_object = g_async_result_get_source_object (res);
9347 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
9348 g_object_unref (source_object);
9349 if (ret != NULL)
9350 return SENSOR_MATCH (ret);
9351 else
9352 return NULL;
9353}
9354
9355/**
9356 * sensor_match_proxy_new_for_bus_sync:
9357 * @bus_type: A #GBusType.
9358 * @flags: Flags from the #GDBusProxyFlags enumeration.
9359 * @name: A bus name (well-known or unique).
9360 * @object_path: An object path.
9361 * @cancellable: (allow-none): A #GCancellable or %NULL.
9362 * @error: Return location for error or %NULL
9363 *
9364 * Like sensor_match_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
9365 *
9366 * The calling thread is blocked until a reply is received.
9367 *
9368 * See sensor_match_proxy_new_for_bus() for the asynchronous version of this constructor.
9369 *
9370 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9371 */
9372SensorMatch *
9373sensor_match_proxy_new_for_bus_sync (
9374 GBusType bus_type,
9375 GDBusProxyFlags flags,
9376 const gchar *name,
9377 const gchar *object_path,
9378 GCancellable *cancellable,
9379 GError **error)
9380{
9381 GInitable *ret;
9382 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);
9383 if (ret != NULL)
9384 return SENSOR_MATCH (ret);
9385 else
9386 return NULL;
9387}
9388
9389
9390/* ------------------------------------------------------------------------ */
9391
9392/**
9393 * SensorMatchSkeleton:
9394 *
9395 * The #SensorMatchSkeleton structure contains only private data and should only be accessed using the provided API.
9396 */
9397
9398/**
9399 * SensorMatchSkeletonClass:
9400 * @parent_class: The parent class.
9401 *
9402 * Class structure for #SensorMatchSkeleton.
9403 */
9404
9405struct _SensorMatchSkeletonPrivate
9406{
9407 GValue *properties;
9408 GList *changed_properties;
9409 GSource *changed_properties_idle_source;
9410 GMainContext *context;
9411 GMutex lock;
9412};
9413
9414static void
9415_sensor_match_skeleton_handle_method_call (
9416 GDBusConnection *connection G_GNUC_UNUSED,
9417 const gchar *sender G_GNUC_UNUSED,
9418 const gchar *object_path G_GNUC_UNUSED,
9419 const gchar *interface_name,
9420 const gchar *method_name,
9421 GVariant *parameters,
9422 GDBusMethodInvocation *invocation,
9423 gpointer user_data)
9424{
9425 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9426 _ExtendedGDBusMethodInfo *info;
9427 GVariantIter iter;
9428 GVariant *child;
9429 GValue *paramv;
9430 guint num_params;
9431 guint num_extra;
9432 guint n;
9433 guint signal_id;
9434 GValue return_value = G_VALUE_INIT;
9435 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
9436 g_assert (info != NULL);
9437 num_params = g_variant_n_children (parameters);
9438 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
9439 n = 0;
9440 g_value_init (&paramv[n], TYPE_SENSOR_MATCH);
9441 g_value_set_object (&paramv[n++], skeleton);
9442 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
9443 g_value_set_object (&paramv[n++], invocation);
9444 if (info->pass_fdlist)
9445 {
9446#ifdef G_OS_UNIX
9447 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
9448 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
9449#else
9450 g_assert_not_reached ();
9451#endif
9452 }
9453 g_variant_iter_init (&iter, parameters);
9454 while ((child = g_variant_iter_next_value (&iter)) != NULL)
9455 {
9456 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
9457 if (arg_info->use_gvariant)
9458 {
9459 g_value_init (&paramv[n], G_TYPE_VARIANT);
9460 g_value_set_variant (&paramv[n], child);
9461 n++;
9462 }
9463 else
9464 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
9465 g_variant_unref (child);
9466 }
9467 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH);
9468 g_value_init (&return_value, G_TYPE_BOOLEAN);
9469 g_signal_emitv (paramv, signal_id, 0, &return_value);
9470 if (!g_value_get_boolean (&return_value))
9471 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);
9472 g_value_unset (&return_value);
9473 for (n = 0; n < num_params + num_extra; n++)
9474 g_value_unset (&paramv[n]);
9475 g_free (paramv);
9476}
9477
9478static GVariant *
9479_sensor_match_skeleton_handle_get_property (
9480 GDBusConnection *connection G_GNUC_UNUSED,
9481 const gchar *sender G_GNUC_UNUSED,
9482 const gchar *object_path G_GNUC_UNUSED,
9483 const gchar *interface_name G_GNUC_UNUSED,
9484 const gchar *property_name,
9485 GError **error,
9486 gpointer user_data)
9487{
9488 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9489 GValue value = G_VALUE_INIT;
9490 GParamSpec *pspec;
9491 _ExtendedGDBusPropertyInfo *info;
9492 GVariant *ret;
9493 ret = NULL;
9494 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name);
9495 g_assert (info != NULL);
9496 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
9497 if (pspec == NULL)
9498 {
9499 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
9500 }
9501 else
9502 {
9503 g_value_init (&value, pspec->value_type);
9504 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
9505 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
9506 g_value_unset (&value);
9507 }
9508 return ret;
9509}
9510
9511static gboolean
9512_sensor_match_skeleton_handle_set_property (
9513 GDBusConnection *connection G_GNUC_UNUSED,
9514 const gchar *sender G_GNUC_UNUSED,
9515 const gchar *object_path G_GNUC_UNUSED,
9516 const gchar *interface_name G_GNUC_UNUSED,
9517 const gchar *property_name,
9518 GVariant *variant,
9519 GError **error,
9520 gpointer user_data)
9521{
9522 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9523 GValue value = G_VALUE_INIT;
9524 GParamSpec *pspec;
9525 _ExtendedGDBusPropertyInfo *info;
9526 gboolean ret;
9527 ret = FALSE;
9528 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name);
9529 g_assert (info != NULL);
9530 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
9531 if (pspec == NULL)
9532 {
9533 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
9534 }
9535 else
9536 {
9537 if (info->use_gvariant)
9538 g_value_set_variant (&value, variant);
9539 else
9540 g_dbus_gvariant_to_gvalue (variant, &value);
9541 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
9542 g_value_unset (&value);
9543 ret = TRUE;
9544 }
9545 return ret;
9546}
9547
9548static const GDBusInterfaceVTable _sensor_match_skeleton_vtable =
9549{
9550 _sensor_match_skeleton_handle_method_call,
9551 _sensor_match_skeleton_handle_get_property,
9552 _sensor_match_skeleton_handle_set_property,
9553 {NULL}
9554};
9555
9556static GDBusInterfaceInfo *
9557sensor_match_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
9558{
9559 return sensor_match_interface_info ();
9560}
9561
9562static GDBusInterfaceVTable *
9563sensor_match_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
9564{
9565 return (GDBusInterfaceVTable *) &_sensor_match_skeleton_vtable;
9566}
9567
9568static GVariant *
9569sensor_match_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
9570{
9571 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton);
9572
9573 GVariantBuilder builder;
9574 guint n;
9575 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
9576 if (_sensor_match_interface_info.parent_struct.properties == NULL)
9577 goto out;
9578 for (n = 0; _sensor_match_interface_info.parent_struct.properties[n] != NULL; n++)
9579 {
9580 GDBusPropertyInfo *info = _sensor_match_interface_info.parent_struct.properties[n];
9581 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
9582 {
9583 GVariant *value;
9584 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);
9585 if (value != NULL)
9586 {
9587 g_variant_take_ref (value);
9588 g_variant_builder_add (&builder, "{sv}", info->name, value);
9589 g_variant_unref (value);
9590 }
9591 }
9592 }
9593out:
9594 return g_variant_builder_end (&builder);
9595}
9596
9597static gboolean _sensor_match_emit_changed (gpointer user_data);
9598
9599static void
9600sensor_match_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
9601{
9602 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton);
9603 gboolean emit_changed = FALSE;
9604
9605 g_mutex_lock (&skeleton->priv->lock);
9606 if (skeleton->priv->changed_properties_idle_source != NULL)
9607 {
9608 g_source_destroy (skeleton->priv->changed_properties_idle_source);
9609 skeleton->priv->changed_properties_idle_source = NULL;
9610 emit_changed = TRUE;
9611 }
9612 g_mutex_unlock (&skeleton->priv->lock);
9613
9614 if (emit_changed)
9615 _sensor_match_emit_changed (skeleton);
9616}
9617
9618static void
9619_sensor_match_on_signal_sensor_match (
9620 SensorMatch *object,
9621 guchar arg_state)
9622{
9623 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9624
9625 GList *connections, *l;
9626 GVariant *signal_variant;
9627 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
9628
9629 signal_variant = g_variant_ref_sink (g_variant_new ("(y)",
9630 arg_state));
9631 for (l = connections; l != NULL; l = l->next)
9632 {
9633 GDBusConnection *connection = l->data;
9634 g_dbus_connection_emit_signal (connection,
9635 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorMatch", "SensorMatch",
9636 signal_variant, NULL);
9637 }
9638 g_variant_unref (signal_variant);
9639 g_list_free_full (connections, g_object_unref);
9640}
9641
9642static void sensor_match_skeleton_iface_init (SensorMatchIface *iface);
9643#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9644G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
9645 G_ADD_PRIVATE (SensorMatchSkeleton)
9646 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init));
9647
9648#else
9649G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
9650 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init));
9651
9652#endif
9653static void
9654sensor_match_skeleton_finalize (GObject *object)
9655{
9656 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9657 guint n;
9658 for (n = 0; n < 2; n++)
9659 g_value_unset (&skeleton->priv->properties[n]);
9660 g_free (skeleton->priv->properties);
9661 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
9662 if (skeleton->priv->changed_properties_idle_source != NULL)
9663 g_source_destroy (skeleton->priv->changed_properties_idle_source);
9664 g_main_context_unref (skeleton->priv->context);
9665 g_mutex_clear (&skeleton->priv->lock);
9666 G_OBJECT_CLASS (sensor_match_skeleton_parent_class)->finalize (object);
9667}
9668
9669static void
9670sensor_match_skeleton_get_property (GObject *object,
9671 guint prop_id,
9672 GValue *value,
9673 GParamSpec *pspec G_GNUC_UNUSED)
9674{
9675 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9676 g_assert (prop_id != 0 && prop_id - 1 < 2);
9677 g_mutex_lock (&skeleton->priv->lock);
9678 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
9679 g_mutex_unlock (&skeleton->priv->lock);
9680}
9681
9682static gboolean
9683_sensor_match_emit_changed (gpointer user_data)
9684{
9685 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9686 GList *l;
9687 GVariantBuilder builder;
9688 GVariantBuilder invalidated_builder;
9689 guint num_changes;
9690
9691 g_mutex_lock (&skeleton->priv->lock);
9692 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
9693 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
9694 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
9695 {
9696 ChangedProperty *cp = l->data;
9697 GVariant *variant;
9698 const GValue *cur_value;
9699
9700 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
9701 if (!_g_value_equal (cur_value, &cp->orig_value))
9702 {
9703 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
9704 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
9705 g_variant_unref (variant);
9706 num_changes++;
9707 }
9708 }
9709 if (num_changes > 0)
9710 {
9711 GList *connections, *ll;
9712 GVariant *signal_variant;
9713 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorMatch",
9714 &builder, &invalidated_builder));
9715 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
9716 for (ll = connections; ll != NULL; ll = ll->next)
9717 {
9718 GDBusConnection *connection = ll->data;
9719
9720 g_dbus_connection_emit_signal (connection,
9721 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
9722 "org.freedesktop.DBus.Properties",
9723 "PropertiesChanged",
9724 signal_variant,
9725 NULL);
9726 }
9727 g_variant_unref (signal_variant);
9728 g_list_free_full (connections, g_object_unref);
9729 }
9730 else
9731 {
9732 g_variant_builder_clear (&builder);
9733 g_variant_builder_clear (&invalidated_builder);
9734 }
9735 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
9736 skeleton->priv->changed_properties = NULL;
9737 skeleton->priv->changed_properties_idle_source = NULL;
9738 g_mutex_unlock (&skeleton->priv->lock);
9739 return FALSE;
9740}
9741
9742static void
9743_sensor_match_schedule_emit_changed (SensorMatchSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
9744{
9745 ChangedProperty *cp;
9746 GList *l;
9747 cp = NULL;
9748 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
9749 {
9750 ChangedProperty *i_cp = l->data;
9751 if (i_cp->info == info)
9752 {
9753 cp = i_cp;
9754 break;
9755 }
9756 }
9757 if (cp == NULL)
9758 {
9759 cp = g_new0 (ChangedProperty, 1);
9760 cp->prop_id = prop_id;
9761 cp->info = info;
9762 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
9763 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
9764 g_value_copy (orig_value, &cp->orig_value);
9765 }
9766}
9767
9768static void
9769sensor_match_skeleton_notify (GObject *object,
9770 GParamSpec *pspec G_GNUC_UNUSED)
9771{
9772 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9773 g_mutex_lock (&skeleton->priv->lock);
9774 if (skeleton->priv->changed_properties != NULL &&
9775 skeleton->priv->changed_properties_idle_source == NULL)
9776 {
9777 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
9778 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
9779 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_match_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
9780 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
9781 g_source_unref (skeleton->priv->changed_properties_idle_source);
9782 }
9783 g_mutex_unlock (&skeleton->priv->lock);
9784}
9785
9786static void
9787sensor_match_skeleton_set_property (GObject *object,
9788 guint prop_id,
9789 const GValue *value,
9790 GParamSpec *pspec)
9791{
9792 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9793 g_assert (prop_id != 0 && prop_id - 1 < 2);
9794 g_mutex_lock (&skeleton->priv->lock);
9795 g_object_freeze_notify (object);
9796 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
9797 {
9798 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
9799 _sensor_match_schedule_emit_changed (skeleton, _sensor_match_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
9800 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
9801 g_object_notify_by_pspec (object, pspec);
9802 }
9803 g_mutex_unlock (&skeleton->priv->lock);
9804 g_object_thaw_notify (object);
9805}
9806
9807static void
9808sensor_match_skeleton_init (SensorMatchSkeleton *skeleton)
9809{
9810#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9811 skeleton->priv = sensor_match_skeleton_get_instance_private (skeleton);
9812#else
9813 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_MATCH_SKELETON, SensorMatchSkeletonPrivate);
9814#endif
9815
9816 g_mutex_init (&skeleton->priv->lock);
9817 skeleton->priv->context = g_main_context_ref_thread_default ();
9818 skeleton->priv->properties = g_new0 (GValue, 2);
9819 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
9820 g_value_init (&skeleton->priv->properties[1], G_TYPE_UCHAR);
9821}
9822
9823static GVariant *
9824sensor_match_skeleton_get_match_value (SensorMatch *object)
9825{
9826 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9827 GVariant *value;
9828 g_mutex_lock (&skeleton->priv->lock);
9829 value = g_value_get_variant (&(skeleton->priv->properties[0]));
9830 g_mutex_unlock (&skeleton->priv->lock);
9831 return value;
9832}
9833
9834static guchar
9835sensor_match_skeleton_get_state (SensorMatch *object)
9836{
9837 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9838 guchar value;
9839 g_mutex_lock (&skeleton->priv->lock);
9840 value = g_value_get_uchar (&(skeleton->priv->properties[1]));
9841 g_mutex_unlock (&skeleton->priv->lock);
9842 return value;
9843}
9844
9845static void
9846sensor_match_skeleton_class_init (SensorMatchSkeletonClass *klass)
9847{
9848 GObjectClass *gobject_class;
9849 GDBusInterfaceSkeletonClass *skeleton_class;
9850
9851 gobject_class = G_OBJECT_CLASS (klass);
9852 gobject_class->finalize = sensor_match_skeleton_finalize;
9853 gobject_class->get_property = sensor_match_skeleton_get_property;
9854 gobject_class->set_property = sensor_match_skeleton_set_property;
9855 gobject_class->notify = sensor_match_skeleton_notify;
9856
9857
9858 sensor_match_override_properties (gobject_class, 1);
9859
9860 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
9861 skeleton_class->get_info = sensor_match_skeleton_dbus_interface_get_info;
9862 skeleton_class->get_properties = sensor_match_skeleton_dbus_interface_get_properties;
9863 skeleton_class->flush = sensor_match_skeleton_dbus_interface_flush;
9864 skeleton_class->get_vtable = sensor_match_skeleton_dbus_interface_get_vtable;
9865
9866#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
9867 g_type_class_add_private (klass, sizeof (SensorMatchSkeletonPrivate));
9868#endif
9869}
9870
9871static void
9872sensor_match_skeleton_iface_init (SensorMatchIface *iface)
9873{
9874 iface->sensor_match = _sensor_match_on_signal_sensor_match;
9875 iface->get_match_value = sensor_match_skeleton_get_match_value;
9876 iface->get_state = sensor_match_skeleton_get_state;
9877}
9878
9879/**
9880 * sensor_match_skeleton_new:
9881 *
9882 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
9883 *
9884 * Returns: (transfer full) (type SensorMatchSkeleton): The skeleton object.
9885 */
9886SensorMatch *
9887sensor_match_skeleton_new (void)
9888{
9889 return SENSOR_MATCH (g_object_new (TYPE_SENSOR_MATCH_SKELETON, NULL));
9890}
9891
9892/* ------------------------------------------------------------------------
9893 * Code for interface org.openbmc.Process
9894 * ------------------------------------------------------------------------
9895 */
9896
9897/**
9898 * SECTION:Process
9899 * @title: Process
9900 * @short_description: Generated C code for the org.openbmc.Process D-Bus interface
9901 *
9902 * 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.
9903 */
9904
9905/* ---- Introspection data for org.openbmc.Process ---- */
9906
9907static const _ExtendedGDBusMethodInfo _process_method_info_stop =
9908{
9909 {
9910 -1,
9911 (gchar *) "stop",
9912 NULL,
9913 NULL,
9914 NULL
9915 },
9916 "handle-stop",
9917 FALSE
9918};
9919
9920static const _ExtendedGDBusMethodInfo * const _process_method_info_pointers[] =
9921{
9922 &_process_method_info_stop,
9923 NULL
9924};
9925
9926static const _ExtendedGDBusInterfaceInfo _process_interface_info =
9927{
9928 {
9929 -1,
9930 (gchar *) "org.openbmc.Process",
9931 (GDBusMethodInfo **) &_process_method_info_pointers,
9932 NULL,
9933 NULL,
9934 NULL
9935 },
9936 "process",
9937};
9938
9939
9940/**
9941 * process_interface_info:
9942 *
9943 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> D-Bus interface.
9944 *
9945 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
9946 */
9947GDBusInterfaceInfo *
9948process_interface_info (void)
9949{
9950 return (GDBusInterfaceInfo *) &_process_interface_info.parent_struct;
9951}
9952
9953/**
9954 * process_override_properties:
9955 * @klass: The class structure for a #GObject<!-- -->-derived class.
9956 * @property_id_begin: The property id to assign to the first overridden property.
9957 *
9958 * Overrides all #GObject properties in the #Process interface for a concrete class.
9959 * The properties are overridden in the order they are defined.
9960 *
9961 * Returns: The last property id.
9962 */
9963guint
9964process_override_properties (GObjectClass *klass, guint property_id_begin)
9965{
9966 return property_id_begin - 1;
9967}
9968
9969
9970
9971/**
9972 * Process:
9973 *
9974 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
9975 */
9976
9977/**
9978 * ProcessIface:
9979 * @parent_iface: The parent interface.
9980 * @handle_stop: Handler for the #Process::handle-stop signal.
9981 *
9982 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
9983 */
9984
9985typedef ProcessIface ProcessInterface;
9986G_DEFINE_INTERFACE (Process, process, G_TYPE_OBJECT);
9987
9988static void
9989process_default_init (ProcessIface *iface)
9990{
9991 /* GObject signals for incoming D-Bus method calls: */
9992 /**
9993 * Process::handle-stop:
9994 * @object: A #Process.
9995 * @invocation: A #GDBusMethodInvocation.
9996 *
9997 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method.
9998 *
9999 * 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.
10000 *
10001 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
10002 */
10003 g_signal_new ("handle-stop",
10004 G_TYPE_FROM_INTERFACE (iface),
10005 G_SIGNAL_RUN_LAST,
10006 G_STRUCT_OFFSET (ProcessIface, handle_stop),
10007 g_signal_accumulator_true_handled,
10008 NULL,
10009 g_cclosure_marshal_generic,
10010 G_TYPE_BOOLEAN,
10011 1,
10012 G_TYPE_DBUS_METHOD_INVOCATION);
10013
10014}
10015
10016/**
10017 * process_call_stop:
10018 * @proxy: A #ProcessProxy.
10019 * @cancellable: (allow-none): A #GCancellable or %NULL.
10020 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
10021 * @user_data: User data to pass to @callback.
10022 *
10023 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method on @proxy.
10024 * 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.
10025 * You can then call process_call_stop_finish() to get the result of the operation.
10026 *
10027 * See process_call_stop_sync() for the synchronous, blocking version of this method.
10028 */
10029void
10030process_call_stop (
10031 Process *proxy,
10032 GCancellable *cancellable,
10033 GAsyncReadyCallback callback,
10034 gpointer user_data)
10035{
10036 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
10037 "stop",
10038 g_variant_new ("()"),
10039 G_DBUS_CALL_FLAGS_NONE,
10040 -1,
10041 cancellable,
10042 callback,
10043 user_data);
10044}
10045
10046/**
10047 * process_call_stop_finish:
10048 * @proxy: A #ProcessProxy.
10049 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_call_stop().
10050 * @error: Return location for error or %NULL.
10051 *
10052 * Finishes an operation started with process_call_stop().
10053 *
10054 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
10055 */
10056gboolean
10057process_call_stop_finish (
10058 Process *proxy,
10059 GAsyncResult *res,
10060 GError **error)
10061{
10062 GVariant *_ret;
10063 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
10064 if (_ret == NULL)
10065 goto _out;
10066 g_variant_get (_ret,
10067 "()");
10068 g_variant_unref (_ret);
10069_out:
10070 return _ret != NULL;
10071}
10072
10073/**
10074 * process_call_stop_sync:
10075 * @proxy: A #ProcessProxy.
10076 * @cancellable: (allow-none): A #GCancellable or %NULL.
10077 * @error: Return location for error or %NULL.
10078 *
10079 * 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.
10080 *
10081 * See process_call_stop() for the asynchronous version of this method.
10082 *
10083 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
10084 */
10085gboolean
10086process_call_stop_sync (
10087 Process *proxy,
10088 GCancellable *cancellable,
10089 GError **error)
10090{
10091 GVariant *_ret;
10092 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
10093 "stop",
10094 g_variant_new ("()"),
10095 G_DBUS_CALL_FLAGS_NONE,
10096 -1,
10097 cancellable,
10098 error);
10099 if (_ret == NULL)
10100 goto _out;
10101 g_variant_get (_ret,
10102 "()");
10103 g_variant_unref (_ret);
10104_out:
10105 return _ret != NULL;
10106}
10107
10108/**
10109 * process_complete_stop:
10110 * @object: A #Process.
10111 * @invocation: (transfer full): A #GDBusMethodInvocation.
10112 *
10113 * 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.
10114 *
10115 * This method will free @invocation, you cannot use it afterwards.
10116 */
10117void
10118process_complete_stop (
10119 Process *object,
10120 GDBusMethodInvocation *invocation)
10121{
10122 g_dbus_method_invocation_return_value (invocation,
10123 g_variant_new ("()"));
10124}
10125
10126/* ------------------------------------------------------------------------ */
10127
10128/**
10129 * ProcessProxy:
10130 *
10131 * The #ProcessProxy structure contains only private data and should only be accessed using the provided API.
10132 */
10133
10134/**
10135 * ProcessProxyClass:
10136 * @parent_class: The parent class.
10137 *
10138 * Class structure for #ProcessProxy.
10139 */
10140
10141struct _ProcessProxyPrivate
10142{
10143 GData *qdata;
10144};
10145
10146static void process_proxy_iface_init (ProcessIface *iface);
10147
10148#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10149G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY,
10150 G_ADD_PRIVATE (ProcessProxy)
10151 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init));
10152
10153#else
10154G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY,
10155 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init));
10156
10157#endif
10158static void
10159process_proxy_finalize (GObject *object)
10160{
10161 ProcessProxy *proxy = PROCESS_PROXY (object);
10162 g_datalist_clear (&proxy->priv->qdata);
10163 G_OBJECT_CLASS (process_proxy_parent_class)->finalize (object);
10164}
10165
10166static void
10167process_proxy_get_property (GObject *object,
10168 guint prop_id,
10169 GValue *value,
10170 GParamSpec *pspec G_GNUC_UNUSED)
10171{
10172}
10173
10174static void
10175process_proxy_set_property (GObject *object,
10176 guint prop_id,
10177 const GValue *value,
10178 GParamSpec *pspec G_GNUC_UNUSED)
10179{
10180}
10181
10182static void
10183process_proxy_g_signal (GDBusProxy *proxy,
10184 const gchar *sender_name G_GNUC_UNUSED,
10185 const gchar *signal_name,
10186 GVariant *parameters)
10187{
10188 _ExtendedGDBusSignalInfo *info;
10189 GVariantIter iter;
10190 GVariant *child;
10191 GValue *paramv;
10192 guint num_params;
10193 guint n;
10194 guint signal_id;
10195 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, signal_name);
10196 if (info == NULL)
10197 return;
10198 num_params = g_variant_n_children (parameters);
10199 paramv = g_new0 (GValue, num_params + 1);
10200 g_value_init (&paramv[0], TYPE_PROCESS);
10201 g_value_set_object (&paramv[0], proxy);
10202 g_variant_iter_init (&iter, parameters);
10203 n = 1;
10204 while ((child = g_variant_iter_next_value (&iter)) != NULL)
10205 {
10206 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
10207 if (arg_info->use_gvariant)
10208 {
10209 g_value_init (&paramv[n], G_TYPE_VARIANT);
10210 g_value_set_variant (&paramv[n], child);
10211 n++;
10212 }
10213 else
10214 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
10215 g_variant_unref (child);
10216 }
10217 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS);
10218 g_signal_emitv (paramv, signal_id, 0, NULL);
10219 for (n = 0; n < num_params + 1; n++)
10220 g_value_unset (&paramv[n]);
10221 g_free (paramv);
10222}
10223
10224static void
10225process_proxy_g_properties_changed (GDBusProxy *_proxy,
10226 GVariant *changed_properties,
10227 const gchar *const *invalidated_properties)
10228{
10229 ProcessProxy *proxy = PROCESS_PROXY (_proxy);
10230 guint n;
10231 const gchar *key;
10232 GVariantIter *iter;
10233 _ExtendedGDBusPropertyInfo *info;
10234 g_variant_get (changed_properties, "a{sv}", &iter);
10235 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
10236 {
10237 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, key);
10238 g_datalist_remove_data (&proxy->priv->qdata, key);
10239 if (info != NULL)
10240 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
10241 }
10242 g_variant_iter_free (iter);
10243 for (n = 0; invalidated_properties[n] != NULL; n++)
10244 {
10245 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, invalidated_properties[n]);
10246 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
10247 if (info != NULL)
10248 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
10249 }
10250}
10251
10252static void
10253process_proxy_init (ProcessProxy *proxy)
10254{
10255#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10256 proxy->priv = process_proxy_get_instance_private (proxy);
10257#else
10258 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_PROCESS_PROXY, ProcessProxyPrivate);
10259#endif
10260
10261 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), process_interface_info ());
10262}
10263
10264static void
10265process_proxy_class_init (ProcessProxyClass *klass)
10266{
10267 GObjectClass *gobject_class;
10268 GDBusProxyClass *proxy_class;
10269
10270 gobject_class = G_OBJECT_CLASS (klass);
10271 gobject_class->finalize = process_proxy_finalize;
10272 gobject_class->get_property = process_proxy_get_property;
10273 gobject_class->set_property = process_proxy_set_property;
10274
10275 proxy_class = G_DBUS_PROXY_CLASS (klass);
10276 proxy_class->g_signal = process_proxy_g_signal;
10277 proxy_class->g_properties_changed = process_proxy_g_properties_changed;
10278
10279#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
10280 g_type_class_add_private (klass, sizeof (ProcessProxyPrivate));
10281#endif
10282}
10283
10284static void
10285process_proxy_iface_init (ProcessIface *iface)
10286{
10287}
10288
10289/**
10290 * process_proxy_new:
10291 * @connection: A #GDBusConnection.
10292 * @flags: Flags from the #GDBusProxyFlags enumeration.
10293 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
10294 * @object_path: An object path.
10295 * @cancellable: (allow-none): A #GCancellable or %NULL.
10296 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
10297 * @user_data: User data to pass to @callback.
10298 *
10299 * 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.
10300 *
10301 * 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.
10302 * You can then call process_proxy_new_finish() to get the result of the operation.
10303 *
10304 * See process_proxy_new_sync() for the synchronous, blocking version of this constructor.
10305 */
10306void
10307process_proxy_new (
10308 GDBusConnection *connection,
10309 GDBusProxyFlags flags,
10310 const gchar *name,
10311 const gchar *object_path,
10312 GCancellable *cancellable,
10313 GAsyncReadyCallback callback,
10314 gpointer user_data)
10315{
10316 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);
10317}
10318
10319/**
10320 * process_proxy_new_finish:
10321 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new().
10322 * @error: Return location for error or %NULL
10323 *
10324 * Finishes an operation started with process_proxy_new().
10325 *
10326 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10327 */
10328Process *
10329process_proxy_new_finish (
10330 GAsyncResult *res,
10331 GError **error)
10332{
10333 GObject *ret;
10334 GObject *source_object;
10335 source_object = g_async_result_get_source_object (res);
10336 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
10337 g_object_unref (source_object);
10338 if (ret != NULL)
10339 return PROCESS (ret);
10340 else
10341 return NULL;
10342}
10343
10344/**
10345 * process_proxy_new_sync:
10346 * @connection: A #GDBusConnection.
10347 * @flags: Flags from the #GDBusProxyFlags enumeration.
10348 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
10349 * @object_path: An object path.
10350 * @cancellable: (allow-none): A #GCancellable or %NULL.
10351 * @error: Return location for error or %NULL
10352 *
10353 * 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.
10354 *
10355 * The calling thread is blocked until a reply is received.
10356 *
10357 * See process_proxy_new() for the asynchronous version of this constructor.
10358 *
10359 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10360 */
10361Process *
10362process_proxy_new_sync (
10363 GDBusConnection *connection,
10364 GDBusProxyFlags flags,
10365 const gchar *name,
10366 const gchar *object_path,
10367 GCancellable *cancellable,
10368 GError **error)
10369{
10370 GInitable *ret;
10371 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);
10372 if (ret != NULL)
10373 return PROCESS (ret);
10374 else
10375 return NULL;
10376}
10377
10378
10379/**
10380 * process_proxy_new_for_bus:
10381 * @bus_type: A #GBusType.
10382 * @flags: Flags from the #GDBusProxyFlags enumeration.
10383 * @name: A bus name (well-known or unique).
10384 * @object_path: An object path.
10385 * @cancellable: (allow-none): A #GCancellable or %NULL.
10386 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
10387 * @user_data: User data to pass to @callback.
10388 *
10389 * Like process_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
10390 *
10391 * 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.
10392 * You can then call process_proxy_new_for_bus_finish() to get the result of the operation.
10393 *
10394 * See process_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
10395 */
10396void
10397process_proxy_new_for_bus (
10398 GBusType bus_type,
10399 GDBusProxyFlags flags,
10400 const gchar *name,
10401 const gchar *object_path,
10402 GCancellable *cancellable,
10403 GAsyncReadyCallback callback,
10404 gpointer user_data)
10405{
10406 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);
10407}
10408
10409/**
10410 * process_proxy_new_for_bus_finish:
10411 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new_for_bus().
10412 * @error: Return location for error or %NULL
10413 *
10414 * Finishes an operation started with process_proxy_new_for_bus().
10415 *
10416 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10417 */
10418Process *
10419process_proxy_new_for_bus_finish (
10420 GAsyncResult *res,
10421 GError **error)
10422{
10423 GObject *ret;
10424 GObject *source_object;
10425 source_object = g_async_result_get_source_object (res);
10426 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
10427 g_object_unref (source_object);
10428 if (ret != NULL)
10429 return PROCESS (ret);
10430 else
10431 return NULL;
10432}
10433
10434/**
10435 * process_proxy_new_for_bus_sync:
10436 * @bus_type: A #GBusType.
10437 * @flags: Flags from the #GDBusProxyFlags enumeration.
10438 * @name: A bus name (well-known or unique).
10439 * @object_path: An object path.
10440 * @cancellable: (allow-none): A #GCancellable or %NULL.
10441 * @error: Return location for error or %NULL
10442 *
10443 * Like process_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
10444 *
10445 * The calling thread is blocked until a reply is received.
10446 *
10447 * See process_proxy_new_for_bus() for the asynchronous version of this constructor.
10448 *
10449 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10450 */
10451Process *
10452process_proxy_new_for_bus_sync (
10453 GBusType bus_type,
10454 GDBusProxyFlags flags,
10455 const gchar *name,
10456 const gchar *object_path,
10457 GCancellable *cancellable,
10458 GError **error)
10459{
10460 GInitable *ret;
10461 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);
10462 if (ret != NULL)
10463 return PROCESS (ret);
10464 else
10465 return NULL;
10466}
10467
10468
10469/* ------------------------------------------------------------------------ */
10470
10471/**
10472 * ProcessSkeleton:
10473 *
10474 * The #ProcessSkeleton structure contains only private data and should only be accessed using the provided API.
10475 */
10476
10477/**
10478 * ProcessSkeletonClass:
10479 * @parent_class: The parent class.
10480 *
10481 * Class structure for #ProcessSkeleton.
10482 */
10483
10484struct _ProcessSkeletonPrivate
10485{
10486 GValue *properties;
10487 GList *changed_properties;
10488 GSource *changed_properties_idle_source;
10489 GMainContext *context;
10490 GMutex lock;
10491};
10492
10493static void
10494_process_skeleton_handle_method_call (
10495 GDBusConnection *connection G_GNUC_UNUSED,
10496 const gchar *sender G_GNUC_UNUSED,
10497 const gchar *object_path G_GNUC_UNUSED,
10498 const gchar *interface_name,
10499 const gchar *method_name,
10500 GVariant *parameters,
10501 GDBusMethodInvocation *invocation,
10502 gpointer user_data)
10503{
10504 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
10505 _ExtendedGDBusMethodInfo *info;
10506 GVariantIter iter;
10507 GVariant *child;
10508 GValue *paramv;
10509 guint num_params;
10510 guint num_extra;
10511 guint n;
10512 guint signal_id;
10513 GValue return_value = G_VALUE_INIT;
10514 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
10515 g_assert (info != NULL);
10516 num_params = g_variant_n_children (parameters);
10517 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
10518 n = 0;
10519 g_value_init (&paramv[n], TYPE_PROCESS);
10520 g_value_set_object (&paramv[n++], skeleton);
10521 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
10522 g_value_set_object (&paramv[n++], invocation);
10523 if (info->pass_fdlist)
10524 {
10525#ifdef G_OS_UNIX
10526 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
10527 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
10528#else
10529 g_assert_not_reached ();
10530#endif
10531 }
10532 g_variant_iter_init (&iter, parameters);
10533 while ((child = g_variant_iter_next_value (&iter)) != NULL)
10534 {
10535 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
10536 if (arg_info->use_gvariant)
10537 {
10538 g_value_init (&paramv[n], G_TYPE_VARIANT);
10539 g_value_set_variant (&paramv[n], child);
10540 n++;
10541 }
10542 else
10543 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
10544 g_variant_unref (child);
10545 }
10546 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS);
10547 g_value_init (&return_value, G_TYPE_BOOLEAN);
10548 g_signal_emitv (paramv, signal_id, 0, &return_value);
10549 if (!g_value_get_boolean (&return_value))
10550 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);
10551 g_value_unset (&return_value);
10552 for (n = 0; n < num_params + num_extra; n++)
10553 g_value_unset (&paramv[n]);
10554 g_free (paramv);
10555}
10556
10557static GVariant *
10558_process_skeleton_handle_get_property (
10559 GDBusConnection *connection G_GNUC_UNUSED,
10560 const gchar *sender G_GNUC_UNUSED,
10561 const gchar *object_path G_GNUC_UNUSED,
10562 const gchar *interface_name G_GNUC_UNUSED,
10563 const gchar *property_name,
10564 GError **error,
10565 gpointer user_data)
10566{
10567 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
10568 GValue value = G_VALUE_INIT;
10569 GParamSpec *pspec;
10570 _ExtendedGDBusPropertyInfo *info;
10571 GVariant *ret;
10572 ret = NULL;
10573 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name);
10574 g_assert (info != NULL);
10575 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
10576 if (pspec == NULL)
10577 {
10578 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
10579 }
10580 else
10581 {
10582 g_value_init (&value, pspec->value_type);
10583 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
10584 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
10585 g_value_unset (&value);
10586 }
10587 return ret;
10588}
10589
10590static gboolean
10591_process_skeleton_handle_set_property (
10592 GDBusConnection *connection G_GNUC_UNUSED,
10593 const gchar *sender G_GNUC_UNUSED,
10594 const gchar *object_path G_GNUC_UNUSED,
10595 const gchar *interface_name G_GNUC_UNUSED,
10596 const gchar *property_name,
10597 GVariant *variant,
10598 GError **error,
10599 gpointer user_data)
10600{
10601 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
10602 GValue value = G_VALUE_INIT;
10603 GParamSpec *pspec;
10604 _ExtendedGDBusPropertyInfo *info;
10605 gboolean ret;
10606 ret = FALSE;
10607 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name);
10608 g_assert (info != NULL);
10609 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
10610 if (pspec == NULL)
10611 {
10612 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
10613 }
10614 else
10615 {
10616 if (info->use_gvariant)
10617 g_value_set_variant (&value, variant);
10618 else
10619 g_dbus_gvariant_to_gvalue (variant, &value);
10620 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
10621 g_value_unset (&value);
10622 ret = TRUE;
10623 }
10624 return ret;
10625}
10626
10627static const GDBusInterfaceVTable _process_skeleton_vtable =
10628{
10629 _process_skeleton_handle_method_call,
10630 _process_skeleton_handle_get_property,
10631 _process_skeleton_handle_set_property,
10632 {NULL}
10633};
10634
10635static GDBusInterfaceInfo *
10636process_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
10637{
10638 return process_interface_info ();
10639}
10640
10641static GDBusInterfaceVTable *
10642process_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
10643{
10644 return (GDBusInterfaceVTable *) &_process_skeleton_vtable;
10645}
10646
10647static GVariant *
10648process_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
10649{
10650 ProcessSkeleton *skeleton = PROCESS_SKELETON (_skeleton);
10651
10652 GVariantBuilder builder;
10653 guint n;
10654 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
10655 if (_process_interface_info.parent_struct.properties == NULL)
10656 goto out;
10657 for (n = 0; _process_interface_info.parent_struct.properties[n] != NULL; n++)
10658 {
10659 GDBusPropertyInfo *info = _process_interface_info.parent_struct.properties[n];
10660 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
10661 {
10662 GVariant *value;
10663 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);
10664 if (value != NULL)
10665 {
10666 g_variant_take_ref (value);
10667 g_variant_builder_add (&builder, "{sv}", info->name, value);
10668 g_variant_unref (value);
10669 }
10670 }
10671 }
10672out:
10673 return g_variant_builder_end (&builder);
10674}
10675
10676static void
10677process_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
10678{
10679}
10680
10681static void process_skeleton_iface_init (ProcessIface *iface);
10682#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10683G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
10684 G_ADD_PRIVATE (ProcessSkeleton)
10685 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init));
10686
10687#else
10688G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
10689 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init));
10690
10691#endif
10692static void
10693process_skeleton_finalize (GObject *object)
10694{
10695 ProcessSkeleton *skeleton = PROCESS_SKELETON (object);
10696 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
10697 if (skeleton->priv->changed_properties_idle_source != NULL)
10698 g_source_destroy (skeleton->priv->changed_properties_idle_source);
10699 g_main_context_unref (skeleton->priv->context);
10700 g_mutex_clear (&skeleton->priv->lock);
10701 G_OBJECT_CLASS (process_skeleton_parent_class)->finalize (object);
10702}
10703
10704static void
10705process_skeleton_init (ProcessSkeleton *skeleton)
10706{
10707#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10708 skeleton->priv = process_skeleton_get_instance_private (skeleton);
10709#else
10710 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_PROCESS_SKELETON, ProcessSkeletonPrivate);
10711#endif
10712
10713 g_mutex_init (&skeleton->priv->lock);
10714 skeleton->priv->context = g_main_context_ref_thread_default ();
10715}
10716
10717static void
10718process_skeleton_class_init (ProcessSkeletonClass *klass)
10719{
10720 GObjectClass *gobject_class;
10721 GDBusInterfaceSkeletonClass *skeleton_class;
10722
10723 gobject_class = G_OBJECT_CLASS (klass);
10724 gobject_class->finalize = process_skeleton_finalize;
10725
10726 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
10727 skeleton_class->get_info = process_skeleton_dbus_interface_get_info;
10728 skeleton_class->get_properties = process_skeleton_dbus_interface_get_properties;
10729 skeleton_class->flush = process_skeleton_dbus_interface_flush;
10730 skeleton_class->get_vtable = process_skeleton_dbus_interface_get_vtable;
10731
10732#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
10733 g_type_class_add_private (klass, sizeof (ProcessSkeletonPrivate));
10734#endif
10735}
10736
10737static void
10738process_skeleton_iface_init (ProcessIface *iface)
10739{
10740}
10741
10742/**
10743 * process_skeleton_new:
10744 *
10745 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
10746 *
10747 * Returns: (transfer full) (type ProcessSkeleton): The skeleton object.
10748 */
10749Process *
10750process_skeleton_new (void)
10751{
10752 return PROCESS (g_object_new (TYPE_PROCESS_SKELETON, NULL));
10753}
10754
10755/* ------------------------------------------------------------------------
10756 * Code for interface org.openbmc.Control
10757 * ------------------------------------------------------------------------
10758 */
10759
10760/**
10761 * SECTION:Control
10762 * @title: Control
10763 * @short_description: Generated C code for the org.openbmc.Control D-Bus interface
10764 *
10765 * 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.
10766 */
10767
10768/* ---- Introspection data for org.openbmc.Control ---- */
10769
10770static const _ExtendedGDBusMethodInfo _control_method_info_init =
10771{
10772 {
10773 -1,
10774 (gchar *) "init",
10775 NULL,
10776 NULL,
10777 NULL
10778 },
10779 "handle-init",
10780 FALSE
10781};
10782
10783static const _ExtendedGDBusMethodInfo * const _control_method_info_pointers[] =
10784{
10785 &_control_method_info_init,
10786 NULL
10787};
10788
10789static const _ExtendedGDBusArgInfo _control_signal_info_heartbeat_ARG_bus_name =
10790{
10791 {
10792 -1,
10793 (gchar *) "bus_name",
10794 (gchar *) "s",
10795 NULL
10796 },
10797 FALSE
10798};
10799
10800static const _ExtendedGDBusArgInfo * const _control_signal_info_heartbeat_ARG_pointers[] =
10801{
10802 &_control_signal_info_heartbeat_ARG_bus_name,
10803 NULL
10804};
10805
10806static const _ExtendedGDBusSignalInfo _control_signal_info_heartbeat =
10807{
10808 {
10809 -1,
10810 (gchar *) "Heartbeat",
10811 (GDBusArgInfo **) &_control_signal_info_heartbeat_ARG_pointers,
10812 NULL
10813 },
10814 "heartbeat"
10815};
10816
10817static const _ExtendedGDBusArgInfo _control_signal_info_goto_system_state_ARG_state_name =
10818{
10819 {
10820 -1,
10821 (gchar *) "state_name",
10822 (gchar *) "s",
10823 NULL
10824 },
10825 FALSE
10826};
10827
10828static const _ExtendedGDBusArgInfo * const _control_signal_info_goto_system_state_ARG_pointers[] =
10829{
10830 &_control_signal_info_goto_system_state_ARG_state_name,
10831 NULL
10832};
10833
10834static const _ExtendedGDBusSignalInfo _control_signal_info_goto_system_state =
10835{
10836 {
10837 -1,
10838 (gchar *) "GotoSystemState",
10839 (GDBusArgInfo **) &_control_signal_info_goto_system_state_ARG_pointers,
10840 NULL
10841 },
10842 "goto-system-state"
10843};
10844
10845static const _ExtendedGDBusSignalInfo * const _control_signal_info_pointers[] =
10846{
10847 &_control_signal_info_heartbeat,
10848 &_control_signal_info_goto_system_state,
10849 NULL
10850};
10851
10852static const _ExtendedGDBusPropertyInfo _control_property_info_poll_interval =
10853{
10854 {
10855 -1,
10856 (gchar *) "poll_interval",
10857 (gchar *) "i",
10858 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
10859 NULL
10860 },
10861 "poll-interval",
10862 FALSE
10863};
10864
10865static const _ExtendedGDBusPropertyInfo _control_property_info_heatbeat =
10866{
10867 {
10868 -1,
10869 (gchar *) "heatbeat",
10870 (gchar *) "i",
10871 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
10872 NULL
10873 },
10874 "heatbeat",
10875 FALSE
10876};
10877
10878static const _ExtendedGDBusPropertyInfo * const _control_property_info_pointers[] =
10879{
10880 &_control_property_info_poll_interval,
10881 &_control_property_info_heatbeat,
10882 NULL
10883};
10884
10885static const _ExtendedGDBusInterfaceInfo _control_interface_info =
10886{
10887 {
10888 -1,
10889 (gchar *) "org.openbmc.Control",
10890 (GDBusMethodInfo **) &_control_method_info_pointers,
10891 (GDBusSignalInfo **) &_control_signal_info_pointers,
10892 (GDBusPropertyInfo **) &_control_property_info_pointers,
10893 NULL
10894 },
10895 "control",
10896};
10897
10898
10899/**
10900 * control_interface_info:
10901 *
10902 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> D-Bus interface.
10903 *
10904 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
10905 */
10906GDBusInterfaceInfo *
10907control_interface_info (void)
10908{
10909 return (GDBusInterfaceInfo *) &_control_interface_info.parent_struct;
10910}
10911
10912/**
10913 * control_override_properties:
10914 * @klass: The class structure for a #GObject<!-- -->-derived class.
10915 * @property_id_begin: The property id to assign to the first overridden property.
10916 *
10917 * Overrides all #GObject properties in the #Control interface for a concrete class.
10918 * The properties are overridden in the order they are defined.
10919 *
10920 * Returns: The last property id.
10921 */
10922guint
10923control_override_properties (GObjectClass *klass, guint property_id_begin)
10924{
10925 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
10926 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
10927 return property_id_begin - 1;
10928}
10929
10930
10931
10932/**
10933 * Control:
10934 *
10935 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
10936 */
10937
10938/**
10939 * ControlIface:
10940 * @parent_iface: The parent interface.
10941 * @handle_init: Handler for the #Control::handle-init signal.
10942 * @get_heatbeat: Getter for the #Control:heatbeat property.
10943 * @get_poll_interval: Getter for the #Control:poll-interval property.
10944 * @goto_system_state: Handler for the #Control::goto-system-state signal.
10945 * @heartbeat: Handler for the #Control::heartbeat signal.
10946 *
10947 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
10948 */
10949
10950typedef ControlIface ControlInterface;
10951G_DEFINE_INTERFACE (Control, control, G_TYPE_OBJECT);
10952
10953static void
10954control_default_init (ControlIface *iface)
10955{
10956 /* GObject signals for incoming D-Bus method calls: */
10957 /**
10958 * Control::handle-init:
10959 * @object: A #Control.
10960 * @invocation: A #GDBusMethodInvocation.
10961 *
10962 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method.
10963 *
10964 * 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.
10965 *
10966 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
10967 */
10968 g_signal_new ("handle-init",
10969 G_TYPE_FROM_INTERFACE (iface),
10970 G_SIGNAL_RUN_LAST,
10971 G_STRUCT_OFFSET (ControlIface, handle_init),
10972 g_signal_accumulator_true_handled,
10973 NULL,
10974 g_cclosure_marshal_generic,
10975 G_TYPE_BOOLEAN,
10976 1,
10977 G_TYPE_DBUS_METHOD_INVOCATION);
10978
10979 /* GObject signals for received D-Bus signals: */
10980 /**
10981 * Control::heartbeat:
10982 * @object: A #Control.
10983 * @arg_bus_name: Argument.
10984 *
10985 * 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.
10986 *
10987 * 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.
10988 */
10989 g_signal_new ("heartbeat",
10990 G_TYPE_FROM_INTERFACE (iface),
10991 G_SIGNAL_RUN_LAST,
10992 G_STRUCT_OFFSET (ControlIface, heartbeat),
10993 NULL,
10994 NULL,
10995 g_cclosure_marshal_generic,
10996 G_TYPE_NONE,
10997 1, G_TYPE_STRING);
10998
10999 /**
11000 * Control::goto-system-state:
11001 * @object: A #Control.
11002 * @arg_state_name: Argument.
11003 *
11004 * 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.
11005 *
11006 * 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.
11007 */
11008 g_signal_new ("goto-system-state",
11009 G_TYPE_FROM_INTERFACE (iface),
11010 G_SIGNAL_RUN_LAST,
11011 G_STRUCT_OFFSET (ControlIface, goto_system_state),
11012 NULL,
11013 NULL,
11014 g_cclosure_marshal_generic,
11015 G_TYPE_NONE,
11016 1, G_TYPE_STRING);
11017
11018 /* GObject properties for D-Bus properties: */
11019 /**
11020 * Control:poll-interval:
11021 *
11022 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link>.
11023 *
11024 * 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.
11025 */
11026 g_object_interface_install_property (iface,
11027 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
11028 /**
11029 * Control:heatbeat:
11030 *
11031 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link>.
11032 *
11033 * 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.
11034 */
11035 g_object_interface_install_property (iface,
11036 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
11037}
11038
11039/**
11040 * control_get_poll_interval: (skip)
11041 * @object: A #Control.
11042 *
11043 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property.
11044 *
11045 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
11046 *
11047 * Returns: The property value.
11048 */
11049gint
11050control_get_poll_interval (Control *object)
11051{
11052 return CONTROL_GET_IFACE (object)->get_poll_interval (object);
11053}
11054
11055/**
11056 * control_set_poll_interval: (skip)
11057 * @object: A #Control.
11058 * @value: The value to set.
11059 *
11060 * Sets the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property to @value.
11061 *
11062 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
11063 */
11064void
11065control_set_poll_interval (Control *object, gint value)
11066{
11067 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
11068}
11069
11070/**
11071 * control_get_heatbeat: (skip)
11072 * @object: A #Control.
11073 *
11074 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property.
11075 *
11076 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
11077 *
11078 * Returns: The property value.
11079 */
11080gint
11081control_get_heatbeat (Control *object)
11082{
11083 return CONTROL_GET_IFACE (object)->get_heatbeat (object);
11084}
11085
11086/**
11087 * control_set_heatbeat: (skip)
11088 * @object: A #Control.
11089 * @value: The value to set.
11090 *
11091 * Sets the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property to @value.
11092 *
11093 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
11094 */
11095void
11096control_set_heatbeat (Control *object, gint value)
11097{
11098 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
11099}
11100
11101/**
11102 * control_emit_heartbeat:
11103 * @object: A #Control.
11104 * @arg_bus_name: Argument to pass with the signal.
11105 *
11106 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Heartbeat">"Heartbeat"</link> D-Bus signal.
11107 */
11108void
11109control_emit_heartbeat (
11110 Control *object,
11111 const gchar *arg_bus_name)
11112{
11113 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
11114}
11115
11116/**
11117 * control_emit_goto_system_state:
11118 * @object: A #Control.
11119 * @arg_state_name: Argument to pass with the signal.
11120 *
11121 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.GotoSystemState">"GotoSystemState"</link> D-Bus signal.
11122 */
11123void
11124control_emit_goto_system_state (
11125 Control *object,
11126 const gchar *arg_state_name)
11127{
11128 g_signal_emit_by_name (object, "goto-system-state", arg_state_name);
11129}
11130
11131/**
11132 * control_call_init:
11133 * @proxy: A #ControlProxy.
11134 * @cancellable: (allow-none): A #GCancellable or %NULL.
11135 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
11136 * @user_data: User data to pass to @callback.
11137 *
11138 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method on @proxy.
11139 * 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.
11140 * You can then call control_call_init_finish() to get the result of the operation.
11141 *
11142 * See control_call_init_sync() for the synchronous, blocking version of this method.
11143 */
11144void
11145control_call_init (
11146 Control *proxy,
11147 GCancellable *cancellable,
11148 GAsyncReadyCallback callback,
11149 gpointer user_data)
11150{
11151 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
11152 "init",
11153 g_variant_new ("()"),
11154 G_DBUS_CALL_FLAGS_NONE,
11155 -1,
11156 cancellable,
11157 callback,
11158 user_data);
11159}
11160
11161/**
11162 * control_call_init_finish:
11163 * @proxy: A #ControlProxy.
11164 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_call_init().
11165 * @error: Return location for error or %NULL.
11166 *
11167 * Finishes an operation started with control_call_init().
11168 *
11169 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11170 */
11171gboolean
11172control_call_init_finish (
11173 Control *proxy,
11174 GAsyncResult *res,
11175 GError **error)
11176{
11177 GVariant *_ret;
11178 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
11179 if (_ret == NULL)
11180 goto _out;
11181 g_variant_get (_ret,
11182 "()");
11183 g_variant_unref (_ret);
11184_out:
11185 return _ret != NULL;
11186}
11187
11188/**
11189 * control_call_init_sync:
11190 * @proxy: A #ControlProxy.
11191 * @cancellable: (allow-none): A #GCancellable or %NULL.
11192 * @error: Return location for error or %NULL.
11193 *
11194 * 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.
11195 *
11196 * See control_call_init() for the asynchronous version of this method.
11197 *
11198 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11199 */
11200gboolean
11201control_call_init_sync (
11202 Control *proxy,
11203 GCancellable *cancellable,
11204 GError **error)
11205{
11206 GVariant *_ret;
11207 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
11208 "init",
11209 g_variant_new ("()"),
11210 G_DBUS_CALL_FLAGS_NONE,
11211 -1,
11212 cancellable,
11213 error);
11214 if (_ret == NULL)
11215 goto _out;
11216 g_variant_get (_ret,
11217 "()");
11218 g_variant_unref (_ret);
11219_out:
11220 return _ret != NULL;
11221}
11222
11223/**
11224 * control_complete_init:
11225 * @object: A #Control.
11226 * @invocation: (transfer full): A #GDBusMethodInvocation.
11227 *
11228 * 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.
11229 *
11230 * This method will free @invocation, you cannot use it afterwards.
11231 */
11232void
11233control_complete_init (
11234 Control *object,
11235 GDBusMethodInvocation *invocation)
11236{
11237 g_dbus_method_invocation_return_value (invocation,
11238 g_variant_new ("()"));
11239}
11240
11241/* ------------------------------------------------------------------------ */
11242
11243/**
11244 * ControlProxy:
11245 *
11246 * The #ControlProxy structure contains only private data and should only be accessed using the provided API.
11247 */
11248
11249/**
11250 * ControlProxyClass:
11251 * @parent_class: The parent class.
11252 *
11253 * Class structure for #ControlProxy.
11254 */
11255
11256struct _ControlProxyPrivate
11257{
11258 GData *qdata;
11259};
11260
11261static void control_proxy_iface_init (ControlIface *iface);
11262
11263#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11264G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
11265 G_ADD_PRIVATE (ControlProxy)
11266 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init));
11267
11268#else
11269G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
11270 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init));
11271
11272#endif
11273static void
11274control_proxy_finalize (GObject *object)
11275{
11276 ControlProxy *proxy = CONTROL_PROXY (object);
11277 g_datalist_clear (&proxy->priv->qdata);
11278 G_OBJECT_CLASS (control_proxy_parent_class)->finalize (object);
11279}
11280
11281static void
11282control_proxy_get_property (GObject *object,
11283 guint prop_id,
11284 GValue *value,
11285 GParamSpec *pspec G_GNUC_UNUSED)
11286{
11287 const _ExtendedGDBusPropertyInfo *info;
11288 GVariant *variant;
11289 g_assert (prop_id != 0 && prop_id - 1 < 2);
11290 info = _control_property_info_pointers[prop_id - 1];
11291 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
11292 if (info->use_gvariant)
11293 {
11294 g_value_set_variant (value, variant);
11295 }
11296 else
11297 {
11298 if (variant != NULL)
11299 g_dbus_gvariant_to_gvalue (variant, value);
11300 }
11301 if (variant != NULL)
11302 g_variant_unref (variant);
11303}
11304
11305static void
11306control_proxy_set_property_cb (GDBusProxy *proxy,
11307 GAsyncResult *res,
11308 gpointer user_data)
11309{
11310 const _ExtendedGDBusPropertyInfo *info = user_data;
11311 GError *error;
11312 GVariant *_ret;
11313 error = NULL;
11314 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
11315 if (!_ret)
11316 {
11317 g_warning ("Error setting property '%s' on interface org.openbmc.Control: %s (%s, %d)",
11318 info->parent_struct.name,
11319 error->message, g_quark_to_string (error->domain), error->code);
11320 g_error_free (error);
11321 }
11322 else
11323 {
11324 g_variant_unref (_ret);
11325 }
11326}
11327
11328static void
11329control_proxy_set_property (GObject *object,
11330 guint prop_id,
11331 const GValue *value,
11332 GParamSpec *pspec G_GNUC_UNUSED)
11333{
11334 const _ExtendedGDBusPropertyInfo *info;
11335 GVariant *variant;
11336 g_assert (prop_id != 0 && prop_id - 1 < 2);
11337 info = _control_property_info_pointers[prop_id - 1];
11338 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
11339 g_dbus_proxy_call (G_DBUS_PROXY (object),
11340 "org.freedesktop.DBus.Properties.Set",
11341 g_variant_new ("(ssv)", "org.openbmc.Control", info->parent_struct.name, variant),
11342 G_DBUS_CALL_FLAGS_NONE,
11343 -1,
11344 NULL, (GAsyncReadyCallback) control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
11345 g_variant_unref (variant);
11346}
11347
11348static void
11349control_proxy_g_signal (GDBusProxy *proxy,
11350 const gchar *sender_name G_GNUC_UNUSED,
11351 const gchar *signal_name,
11352 GVariant *parameters)
11353{
11354 _ExtendedGDBusSignalInfo *info;
11355 GVariantIter iter;
11356 GVariant *child;
11357 GValue *paramv;
11358 guint num_params;
11359 guint n;
11360 guint signal_id;
11361 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, signal_name);
11362 if (info == NULL)
11363 return;
11364 num_params = g_variant_n_children (parameters);
11365 paramv = g_new0 (GValue, num_params + 1);
11366 g_value_init (&paramv[0], TYPE_CONTROL);
11367 g_value_set_object (&paramv[0], proxy);
11368 g_variant_iter_init (&iter, parameters);
11369 n = 1;
11370 while ((child = g_variant_iter_next_value (&iter)) != NULL)
11371 {
11372 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
11373 if (arg_info->use_gvariant)
11374 {
11375 g_value_init (&paramv[n], G_TYPE_VARIANT);
11376 g_value_set_variant (&paramv[n], child);
11377 n++;
11378 }
11379 else
11380 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
11381 g_variant_unref (child);
11382 }
11383 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
11384 g_signal_emitv (paramv, signal_id, 0, NULL);
11385 for (n = 0; n < num_params + 1; n++)
11386 g_value_unset (&paramv[n]);
11387 g_free (paramv);
11388}
11389
11390static void
11391control_proxy_g_properties_changed (GDBusProxy *_proxy,
11392 GVariant *changed_properties,
11393 const gchar *const *invalidated_properties)
11394{
11395 ControlProxy *proxy = CONTROL_PROXY (_proxy);
11396 guint n;
11397 const gchar *key;
11398 GVariantIter *iter;
11399 _ExtendedGDBusPropertyInfo *info;
11400 g_variant_get (changed_properties, "a{sv}", &iter);
11401 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
11402 {
11403 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, key);
11404 g_datalist_remove_data (&proxy->priv->qdata, key);
11405 if (info != NULL)
11406 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
11407 }
11408 g_variant_iter_free (iter);
11409 for (n = 0; invalidated_properties[n] != NULL; n++)
11410 {
11411 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, invalidated_properties[n]);
11412 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
11413 if (info != NULL)
11414 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
11415 }
11416}
11417
11418static gint
11419control_proxy_get_poll_interval (Control *object)
11420{
11421 ControlProxy *proxy = CONTROL_PROXY (object);
11422 GVariant *variant;
11423 gint value = 0;
11424 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
11425 if (variant != NULL)
11426 {
11427 value = g_variant_get_int32 (variant);
11428 g_variant_unref (variant);
11429 }
11430 return value;
11431}
11432
11433static gint
11434control_proxy_get_heatbeat (Control *object)
11435{
11436 ControlProxy *proxy = CONTROL_PROXY (object);
11437 GVariant *variant;
11438 gint value = 0;
11439 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
11440 if (variant != NULL)
11441 {
11442 value = g_variant_get_int32 (variant);
11443 g_variant_unref (variant);
11444 }
11445 return value;
11446}
11447
11448static void
11449control_proxy_init (ControlProxy *proxy)
11450{
11451#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11452 proxy->priv = control_proxy_get_instance_private (proxy);
11453#else
11454 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_PROXY, ControlProxyPrivate);
11455#endif
11456
11457 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_interface_info ());
11458}
11459
11460static void
11461control_proxy_class_init (ControlProxyClass *klass)
11462{
11463 GObjectClass *gobject_class;
11464 GDBusProxyClass *proxy_class;
11465
11466 gobject_class = G_OBJECT_CLASS (klass);
11467 gobject_class->finalize = control_proxy_finalize;
11468 gobject_class->get_property = control_proxy_get_property;
11469 gobject_class->set_property = control_proxy_set_property;
11470
11471 proxy_class = G_DBUS_PROXY_CLASS (klass);
11472 proxy_class->g_signal = control_proxy_g_signal;
11473 proxy_class->g_properties_changed = control_proxy_g_properties_changed;
11474
11475 control_override_properties (gobject_class, 1);
11476
11477#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
11478 g_type_class_add_private (klass, sizeof (ControlProxyPrivate));
11479#endif
11480}
11481
11482static void
11483control_proxy_iface_init (ControlIface *iface)
11484{
11485 iface->get_poll_interval = control_proxy_get_poll_interval;
11486 iface->get_heatbeat = control_proxy_get_heatbeat;
11487}
11488
11489/**
11490 * control_proxy_new:
11491 * @connection: A #GDBusConnection.
11492 * @flags: Flags from the #GDBusProxyFlags enumeration.
11493 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
11494 * @object_path: An object path.
11495 * @cancellable: (allow-none): A #GCancellable or %NULL.
11496 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
11497 * @user_data: User data to pass to @callback.
11498 *
11499 * 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.
11500 *
11501 * 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.
11502 * You can then call control_proxy_new_finish() to get the result of the operation.
11503 *
11504 * See control_proxy_new_sync() for the synchronous, blocking version of this constructor.
11505 */
11506void
11507control_proxy_new (
11508 GDBusConnection *connection,
11509 GDBusProxyFlags flags,
11510 const gchar *name,
11511 const gchar *object_path,
11512 GCancellable *cancellable,
11513 GAsyncReadyCallback callback,
11514 gpointer user_data)
11515{
11516 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);
11517}
11518
11519/**
11520 * control_proxy_new_finish:
11521 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new().
11522 * @error: Return location for error or %NULL
11523 *
11524 * Finishes an operation started with control_proxy_new().
11525 *
11526 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
11527 */
11528Control *
11529control_proxy_new_finish (
11530 GAsyncResult *res,
11531 GError **error)
11532{
11533 GObject *ret;
11534 GObject *source_object;
11535 source_object = g_async_result_get_source_object (res);
11536 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
11537 g_object_unref (source_object);
11538 if (ret != NULL)
11539 return CONTROL (ret);
11540 else
11541 return NULL;
11542}
11543
11544/**
11545 * control_proxy_new_sync:
11546 * @connection: A #GDBusConnection.
11547 * @flags: Flags from the #GDBusProxyFlags enumeration.
11548 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
11549 * @object_path: An object path.
11550 * @cancellable: (allow-none): A #GCancellable or %NULL.
11551 * @error: Return location for error or %NULL
11552 *
11553 * 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.
11554 *
11555 * The calling thread is blocked until a reply is received.
11556 *
11557 * See control_proxy_new() for the asynchronous version of this constructor.
11558 *
11559 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
11560 */
11561Control *
11562control_proxy_new_sync (
11563 GDBusConnection *connection,
11564 GDBusProxyFlags flags,
11565 const gchar *name,
11566 const gchar *object_path,
11567 GCancellable *cancellable,
11568 GError **error)
11569{
11570 GInitable *ret;
11571 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);
11572 if (ret != NULL)
11573 return CONTROL (ret);
11574 else
11575 return NULL;
11576}
11577
11578
11579/**
11580 * control_proxy_new_for_bus:
11581 * @bus_type: A #GBusType.
11582 * @flags: Flags from the #GDBusProxyFlags enumeration.
11583 * @name: A bus name (well-known or unique).
11584 * @object_path: An object path.
11585 * @cancellable: (allow-none): A #GCancellable or %NULL.
11586 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
11587 * @user_data: User data to pass to @callback.
11588 *
11589 * Like control_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
11590 *
11591 * 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.
11592 * You can then call control_proxy_new_for_bus_finish() to get the result of the operation.
11593 *
11594 * See control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
11595 */
11596void
11597control_proxy_new_for_bus (
11598 GBusType bus_type,
11599 GDBusProxyFlags flags,
11600 const gchar *name,
11601 const gchar *object_path,
11602 GCancellable *cancellable,
11603 GAsyncReadyCallback callback,
11604 gpointer user_data)
11605{
11606 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);
11607}
11608
11609/**
11610 * control_proxy_new_for_bus_finish:
11611 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new_for_bus().
11612 * @error: Return location for error or %NULL
11613 *
11614 * Finishes an operation started with control_proxy_new_for_bus().
11615 *
11616 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
11617 */
11618Control *
11619control_proxy_new_for_bus_finish (
11620 GAsyncResult *res,
11621 GError **error)
11622{
11623 GObject *ret;
11624 GObject *source_object;
11625 source_object = g_async_result_get_source_object (res);
11626 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
11627 g_object_unref (source_object);
11628 if (ret != NULL)
11629 return CONTROL (ret);
11630 else
11631 return NULL;
11632}
11633
11634/**
11635 * control_proxy_new_for_bus_sync:
11636 * @bus_type: A #GBusType.
11637 * @flags: Flags from the #GDBusProxyFlags enumeration.
11638 * @name: A bus name (well-known or unique).
11639 * @object_path: An object path.
11640 * @cancellable: (allow-none): A #GCancellable or %NULL.
11641 * @error: Return location for error or %NULL
11642 *
11643 * Like control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
11644 *
11645 * The calling thread is blocked until a reply is received.
11646 *
11647 * See control_proxy_new_for_bus() for the asynchronous version of this constructor.
11648 *
11649 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
11650 */
11651Control *
11652control_proxy_new_for_bus_sync (
11653 GBusType bus_type,
11654 GDBusProxyFlags flags,
11655 const gchar *name,
11656 const gchar *object_path,
11657 GCancellable *cancellable,
11658 GError **error)
11659{
11660 GInitable *ret;
11661 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);
11662 if (ret != NULL)
11663 return CONTROL (ret);
11664 else
11665 return NULL;
11666}
11667
11668
11669/* ------------------------------------------------------------------------ */
11670
11671/**
11672 * ControlSkeleton:
11673 *
11674 * The #ControlSkeleton structure contains only private data and should only be accessed using the provided API.
11675 */
11676
11677/**
11678 * ControlSkeletonClass:
11679 * @parent_class: The parent class.
11680 *
11681 * Class structure for #ControlSkeleton.
11682 */
11683
11684struct _ControlSkeletonPrivate
11685{
11686 GValue *properties;
11687 GList *changed_properties;
11688 GSource *changed_properties_idle_source;
11689 GMainContext *context;
11690 GMutex lock;
11691};
11692
11693static void
11694_control_skeleton_handle_method_call (
11695 GDBusConnection *connection G_GNUC_UNUSED,
11696 const gchar *sender G_GNUC_UNUSED,
11697 const gchar *object_path G_GNUC_UNUSED,
11698 const gchar *interface_name,
11699 const gchar *method_name,
11700 GVariant *parameters,
11701 GDBusMethodInvocation *invocation,
11702 gpointer user_data)
11703{
11704 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
11705 _ExtendedGDBusMethodInfo *info;
11706 GVariantIter iter;
11707 GVariant *child;
11708 GValue *paramv;
11709 guint num_params;
11710 guint num_extra;
11711 guint n;
11712 guint signal_id;
11713 GValue return_value = G_VALUE_INIT;
11714 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
11715 g_assert (info != NULL);
11716 num_params = g_variant_n_children (parameters);
11717 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
11718 n = 0;
11719 g_value_init (&paramv[n], TYPE_CONTROL);
11720 g_value_set_object (&paramv[n++], skeleton);
11721 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
11722 g_value_set_object (&paramv[n++], invocation);
11723 if (info->pass_fdlist)
11724 {
11725#ifdef G_OS_UNIX
11726 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
11727 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
11728#else
11729 g_assert_not_reached ();
11730#endif
11731 }
11732 g_variant_iter_init (&iter, parameters);
11733 while ((child = g_variant_iter_next_value (&iter)) != NULL)
11734 {
11735 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
11736 if (arg_info->use_gvariant)
11737 {
11738 g_value_init (&paramv[n], G_TYPE_VARIANT);
11739 g_value_set_variant (&paramv[n], child);
11740 n++;
11741 }
11742 else
11743 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
11744 g_variant_unref (child);
11745 }
11746 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
11747 g_value_init (&return_value, G_TYPE_BOOLEAN);
11748 g_signal_emitv (paramv, signal_id, 0, &return_value);
11749 if (!g_value_get_boolean (&return_value))
11750 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);
11751 g_value_unset (&return_value);
11752 for (n = 0; n < num_params + num_extra; n++)
11753 g_value_unset (&paramv[n]);
11754 g_free (paramv);
11755}
11756
11757static GVariant *
11758_control_skeleton_handle_get_property (
11759 GDBusConnection *connection G_GNUC_UNUSED,
11760 const gchar *sender G_GNUC_UNUSED,
11761 const gchar *object_path G_GNUC_UNUSED,
11762 const gchar *interface_name G_GNUC_UNUSED,
11763 const gchar *property_name,
11764 GError **error,
11765 gpointer user_data)
11766{
11767 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
11768 GValue value = G_VALUE_INIT;
11769 GParamSpec *pspec;
11770 _ExtendedGDBusPropertyInfo *info;
11771 GVariant *ret;
11772 ret = NULL;
11773 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
11774 g_assert (info != NULL);
11775 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
11776 if (pspec == NULL)
11777 {
11778 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
11779 }
11780 else
11781 {
11782 g_value_init (&value, pspec->value_type);
11783 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
11784 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
11785 g_value_unset (&value);
11786 }
11787 return ret;
11788}
11789
11790static gboolean
11791_control_skeleton_handle_set_property (
11792 GDBusConnection *connection G_GNUC_UNUSED,
11793 const gchar *sender G_GNUC_UNUSED,
11794 const gchar *object_path G_GNUC_UNUSED,
11795 const gchar *interface_name G_GNUC_UNUSED,
11796 const gchar *property_name,
11797 GVariant *variant,
11798 GError **error,
11799 gpointer user_data)
11800{
11801 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
11802 GValue value = G_VALUE_INIT;
11803 GParamSpec *pspec;
11804 _ExtendedGDBusPropertyInfo *info;
11805 gboolean ret;
11806 ret = FALSE;
11807 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
11808 g_assert (info != NULL);
11809 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
11810 if (pspec == NULL)
11811 {
11812 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
11813 }
11814 else
11815 {
11816 if (info->use_gvariant)
11817 g_value_set_variant (&value, variant);
11818 else
11819 g_dbus_gvariant_to_gvalue (variant, &value);
11820 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
11821 g_value_unset (&value);
11822 ret = TRUE;
11823 }
11824 return ret;
11825}
11826
11827static const GDBusInterfaceVTable _control_skeleton_vtable =
11828{
11829 _control_skeleton_handle_method_call,
11830 _control_skeleton_handle_get_property,
11831 _control_skeleton_handle_set_property,
11832 {NULL}
11833};
11834
11835static GDBusInterfaceInfo *
11836control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
11837{
11838 return control_interface_info ();
11839}
11840
11841static GDBusInterfaceVTable *
11842control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
11843{
11844 return (GDBusInterfaceVTable *) &_control_skeleton_vtable;
11845}
11846
11847static GVariant *
11848control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
11849{
11850 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
11851
11852 GVariantBuilder builder;
11853 guint n;
11854 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
11855 if (_control_interface_info.parent_struct.properties == NULL)
11856 goto out;
11857 for (n = 0; _control_interface_info.parent_struct.properties[n] != NULL; n++)
11858 {
11859 GDBusPropertyInfo *info = _control_interface_info.parent_struct.properties[n];
11860 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
11861 {
11862 GVariant *value;
11863 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);
11864 if (value != NULL)
11865 {
11866 g_variant_take_ref (value);
11867 g_variant_builder_add (&builder, "{sv}", info->name, value);
11868 g_variant_unref (value);
11869 }
11870 }
11871 }
11872out:
11873 return g_variant_builder_end (&builder);
11874}
11875
11876static gboolean _control_emit_changed (gpointer user_data);
11877
11878static void
11879control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
11880{
11881 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
11882 gboolean emit_changed = FALSE;
11883
11884 g_mutex_lock (&skeleton->priv->lock);
11885 if (skeleton->priv->changed_properties_idle_source != NULL)
11886 {
11887 g_source_destroy (skeleton->priv->changed_properties_idle_source);
11888 skeleton->priv->changed_properties_idle_source = NULL;
11889 emit_changed = TRUE;
11890 }
11891 g_mutex_unlock (&skeleton->priv->lock);
11892
11893 if (emit_changed)
11894 _control_emit_changed (skeleton);
11895}
11896
11897static void
11898_control_on_signal_heartbeat (
11899 Control *object,
11900 const gchar *arg_bus_name)
11901{
11902 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
11903
11904 GList *connections, *l;
11905 GVariant *signal_variant;
11906 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
11907
11908 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
11909 arg_bus_name));
11910 for (l = connections; l != NULL; l = l->next)
11911 {
11912 GDBusConnection *connection = l->data;
11913 g_dbus_connection_emit_signal (connection,
11914 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Heartbeat",
11915 signal_variant, NULL);
11916 }
11917 g_variant_unref (signal_variant);
11918 g_list_free_full (connections, g_object_unref);
11919}
11920
11921static void
11922_control_on_signal_goto_system_state (
11923 Control *object,
11924 const gchar *arg_state_name)
11925{
11926 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
11927
11928 GList *connections, *l;
11929 GVariant *signal_variant;
11930 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
11931
11932 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
11933 arg_state_name));
11934 for (l = connections; l != NULL; l = l->next)
11935 {
11936 GDBusConnection *connection = l->data;
11937 g_dbus_connection_emit_signal (connection,
11938 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "GotoSystemState",
11939 signal_variant, NULL);
11940 }
11941 g_variant_unref (signal_variant);
11942 g_list_free_full (connections, g_object_unref);
11943}
11944
11945static void control_skeleton_iface_init (ControlIface *iface);
11946#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11947G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
11948 G_ADD_PRIVATE (ControlSkeleton)
11949 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init));
11950
11951#else
11952G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
11953 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init));
11954
11955#endif
11956static void
11957control_skeleton_finalize (GObject *object)
11958{
11959 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
11960 guint n;
11961 for (n = 0; n < 2; n++)
11962 g_value_unset (&skeleton->priv->properties[n]);
11963 g_free (skeleton->priv->properties);
11964 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
11965 if (skeleton->priv->changed_properties_idle_source != NULL)
11966 g_source_destroy (skeleton->priv->changed_properties_idle_source);
11967 g_main_context_unref (skeleton->priv->context);
11968 g_mutex_clear (&skeleton->priv->lock);
11969 G_OBJECT_CLASS (control_skeleton_parent_class)->finalize (object);
11970}
11971
11972static void
11973control_skeleton_get_property (GObject *object,
11974 guint prop_id,
11975 GValue *value,
11976 GParamSpec *pspec G_GNUC_UNUSED)
11977{
11978 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
11979 g_assert (prop_id != 0 && prop_id - 1 < 2);
11980 g_mutex_lock (&skeleton->priv->lock);
11981 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
11982 g_mutex_unlock (&skeleton->priv->lock);
11983}
11984
11985static gboolean
11986_control_emit_changed (gpointer user_data)
11987{
11988 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
11989 GList *l;
11990 GVariantBuilder builder;
11991 GVariantBuilder invalidated_builder;
11992 guint num_changes;
11993
11994 g_mutex_lock (&skeleton->priv->lock);
11995 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
11996 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
11997 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
11998 {
11999 ChangedProperty *cp = l->data;
12000 GVariant *variant;
12001 const GValue *cur_value;
12002
12003 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
12004 if (!_g_value_equal (cur_value, &cp->orig_value))
12005 {
12006 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
12007 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
12008 g_variant_unref (variant);
12009 num_changes++;
12010 }
12011 }
12012 if (num_changes > 0)
12013 {
12014 GList *connections, *ll;
12015 GVariant *signal_variant;
12016 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Control",
12017 &builder, &invalidated_builder));
12018 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
12019 for (ll = connections; ll != NULL; ll = ll->next)
12020 {
12021 GDBusConnection *connection = ll->data;
12022
12023 g_dbus_connection_emit_signal (connection,
12024 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
12025 "org.freedesktop.DBus.Properties",
12026 "PropertiesChanged",
12027 signal_variant,
12028 NULL);
12029 }
12030 g_variant_unref (signal_variant);
12031 g_list_free_full (connections, g_object_unref);
12032 }
12033 else
12034 {
12035 g_variant_builder_clear (&builder);
12036 g_variant_builder_clear (&invalidated_builder);
12037 }
12038 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
12039 skeleton->priv->changed_properties = NULL;
12040 skeleton->priv->changed_properties_idle_source = NULL;
12041 g_mutex_unlock (&skeleton->priv->lock);
12042 return FALSE;
12043}
12044
12045static void
12046_control_schedule_emit_changed (ControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
12047{
12048 ChangedProperty *cp;
12049 GList *l;
12050 cp = NULL;
12051 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
12052 {
12053 ChangedProperty *i_cp = l->data;
12054 if (i_cp->info == info)
12055 {
12056 cp = i_cp;
12057 break;
12058 }
12059 }
12060 if (cp == NULL)
12061 {
12062 cp = g_new0 (ChangedProperty, 1);
12063 cp->prop_id = prop_id;
12064 cp->info = info;
12065 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
12066 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
12067 g_value_copy (orig_value, &cp->orig_value);
12068 }
12069}
12070
12071static void
12072control_skeleton_notify (GObject *object,
12073 GParamSpec *pspec G_GNUC_UNUSED)
12074{
12075 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12076 g_mutex_lock (&skeleton->priv->lock);
12077 if (skeleton->priv->changed_properties != NULL &&
12078 skeleton->priv->changed_properties_idle_source == NULL)
12079 {
12080 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
12081 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
12082 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
12083 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
12084 g_source_unref (skeleton->priv->changed_properties_idle_source);
12085 }
12086 g_mutex_unlock (&skeleton->priv->lock);
12087}
12088
12089static void
12090control_skeleton_set_property (GObject *object,
12091 guint prop_id,
12092 const GValue *value,
12093 GParamSpec *pspec)
12094{
12095 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12096 g_assert (prop_id != 0 && prop_id - 1 < 2);
12097 g_mutex_lock (&skeleton->priv->lock);
12098 g_object_freeze_notify (object);
12099 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
12100 {
12101 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
12102 _control_schedule_emit_changed (skeleton, _control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
12103 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
12104 g_object_notify_by_pspec (object, pspec);
12105 }
12106 g_mutex_unlock (&skeleton->priv->lock);
12107 g_object_thaw_notify (object);
12108}
12109
12110static void
12111control_skeleton_init (ControlSkeleton *skeleton)
12112{
12113#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12114 skeleton->priv = control_skeleton_get_instance_private (skeleton);
12115#else
12116 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_SKELETON, ControlSkeletonPrivate);
12117#endif
12118
12119 g_mutex_init (&skeleton->priv->lock);
12120 skeleton->priv->context = g_main_context_ref_thread_default ();
12121 skeleton->priv->properties = g_new0 (GValue, 2);
12122 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
12123 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
12124}
12125
12126static gint
12127control_skeleton_get_poll_interval (Control *object)
12128{
12129 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12130 gint value;
12131 g_mutex_lock (&skeleton->priv->lock);
12132 value = g_value_get_int (&(skeleton->priv->properties[0]));
12133 g_mutex_unlock (&skeleton->priv->lock);
12134 return value;
12135}
12136
12137static gint
12138control_skeleton_get_heatbeat (Control *object)
12139{
12140 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12141 gint value;
12142 g_mutex_lock (&skeleton->priv->lock);
12143 value = g_value_get_int (&(skeleton->priv->properties[1]));
12144 g_mutex_unlock (&skeleton->priv->lock);
12145 return value;
12146}
12147
12148static void
12149control_skeleton_class_init (ControlSkeletonClass *klass)
12150{
12151 GObjectClass *gobject_class;
12152 GDBusInterfaceSkeletonClass *skeleton_class;
12153
12154 gobject_class = G_OBJECT_CLASS (klass);
12155 gobject_class->finalize = control_skeleton_finalize;
12156 gobject_class->get_property = control_skeleton_get_property;
12157 gobject_class->set_property = control_skeleton_set_property;
12158 gobject_class->notify = control_skeleton_notify;
12159
12160
12161 control_override_properties (gobject_class, 1);
12162
12163 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
12164 skeleton_class->get_info = control_skeleton_dbus_interface_get_info;
12165 skeleton_class->get_properties = control_skeleton_dbus_interface_get_properties;
12166 skeleton_class->flush = control_skeleton_dbus_interface_flush;
12167 skeleton_class->get_vtable = control_skeleton_dbus_interface_get_vtable;
12168
12169#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
12170 g_type_class_add_private (klass, sizeof (ControlSkeletonPrivate));
12171#endif
12172}
12173
12174static void
12175control_skeleton_iface_init (ControlIface *iface)
12176{
12177 iface->heartbeat = _control_on_signal_heartbeat;
12178 iface->goto_system_state = _control_on_signal_goto_system_state;
12179 iface->get_poll_interval = control_skeleton_get_poll_interval;
12180 iface->get_heatbeat = control_skeleton_get_heatbeat;
12181}
12182
12183/**
12184 * control_skeleton_new:
12185 *
12186 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
12187 *
12188 * Returns: (transfer full) (type ControlSkeleton): The skeleton object.
12189 */
12190Control *
12191control_skeleton_new (void)
12192{
12193 return CONTROL (g_object_new (TYPE_CONTROL_SKELETON, NULL));
12194}
12195
12196/* ------------------------------------------------------------------------
12197 * Code for interface org.openbmc.control.Bmc
12198 * ------------------------------------------------------------------------
12199 */
12200
12201/**
12202 * SECTION:ControlBmc
12203 * @title: ControlBmc
12204 * @short_description: Generated C code for the org.openbmc.control.Bmc D-Bus interface
12205 *
12206 * 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.
12207 */
12208
12209/* ---- Introspection data for org.openbmc.control.Bmc ---- */
12210
12211static const _ExtendedGDBusMethodInfo _control_bmc_method_info_place_holder =
12212{
12213 {
12214 -1,
12215 (gchar *) "place_holder",
12216 NULL,
12217 NULL,
12218 NULL
12219 },
12220 "handle-place-holder",
12221 FALSE
12222};
12223
12224static const _ExtendedGDBusMethodInfo * const _control_bmc_method_info_pointers[] =
12225{
12226 &_control_bmc_method_info_place_holder,
12227 NULL
12228};
12229
12230static const _ExtendedGDBusInterfaceInfo _control_bmc_interface_info =
12231{
12232 {
12233 -1,
12234 (gchar *) "org.openbmc.control.Bmc",
12235 (GDBusMethodInfo **) &_control_bmc_method_info_pointers,
12236 NULL,
12237 NULL,
12238 NULL
12239 },
12240 "control-bmc",
12241};
12242
12243
12244/**
12245 * control_bmc_interface_info:
12246 *
12247 * 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.
12248 *
12249 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
12250 */
12251GDBusInterfaceInfo *
12252control_bmc_interface_info (void)
12253{
12254 return (GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct;
12255}
12256
12257/**
12258 * control_bmc_override_properties:
12259 * @klass: The class structure for a #GObject<!-- -->-derived class.
12260 * @property_id_begin: The property id to assign to the first overridden property.
12261 *
12262 * Overrides all #GObject properties in the #ControlBmc interface for a concrete class.
12263 * The properties are overridden in the order they are defined.
12264 *
12265 * Returns: The last property id.
12266 */
12267guint
12268control_bmc_override_properties (GObjectClass *klass, guint property_id_begin)
12269{
12270 return property_id_begin - 1;
12271}
12272
12273
12274
12275/**
12276 * ControlBmc:
12277 *
12278 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
12279 */
12280
12281/**
12282 * ControlBmcIface:
12283 * @parent_iface: The parent interface.
12284 * @handle_place_holder: Handler for the #ControlBmc::handle-place-holder signal.
12285 *
12286 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
12287 */
12288
12289typedef ControlBmcIface ControlBmcInterface;
12290G_DEFINE_INTERFACE (ControlBmc, control_bmc, G_TYPE_OBJECT);
12291
12292static void
12293control_bmc_default_init (ControlBmcIface *iface)
12294{
12295 /* GObject signals for incoming D-Bus method calls: */
12296 /**
12297 * ControlBmc::handle-place-holder:
12298 * @object: A #ControlBmc.
12299 * @invocation: A #GDBusMethodInvocation.
12300 *
12301 * 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.
12302 *
12303 * 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.
12304 *
12305 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
12306 */
12307 g_signal_new ("handle-place-holder",
12308 G_TYPE_FROM_INTERFACE (iface),
12309 G_SIGNAL_RUN_LAST,
12310 G_STRUCT_OFFSET (ControlBmcIface, handle_place_holder),
12311 g_signal_accumulator_true_handled,
12312 NULL,
12313 g_cclosure_marshal_generic,
12314 G_TYPE_BOOLEAN,
12315 1,
12316 G_TYPE_DBUS_METHOD_INVOCATION);
12317
12318}
12319
12320/**
12321 * control_bmc_call_place_holder:
12322 * @proxy: A #ControlBmcProxy.
12323 * @cancellable: (allow-none): A #GCancellable or %NULL.
12324 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
12325 * @user_data: User data to pass to @callback.
12326 *
12327 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.place_holder">place_holder()</link> D-Bus method on @proxy.
12328 * 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.
12329 * You can then call control_bmc_call_place_holder_finish() to get the result of the operation.
12330 *
12331 * See control_bmc_call_place_holder_sync() for the synchronous, blocking version of this method.
12332 */
12333void
12334control_bmc_call_place_holder (
12335 ControlBmc *proxy,
12336 GCancellable *cancellable,
12337 GAsyncReadyCallback callback,
12338 gpointer user_data)
12339{
12340 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
12341 "place_holder",
12342 g_variant_new ("()"),
12343 G_DBUS_CALL_FLAGS_NONE,
12344 -1,
12345 cancellable,
12346 callback,
12347 user_data);
12348}
12349
12350/**
12351 * control_bmc_call_place_holder_finish:
12352 * @proxy: A #ControlBmcProxy.
12353 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_call_place_holder().
12354 * @error: Return location for error or %NULL.
12355 *
12356 * Finishes an operation started with control_bmc_call_place_holder().
12357 *
12358 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
12359 */
12360gboolean
12361control_bmc_call_place_holder_finish (
12362 ControlBmc *proxy,
12363 GAsyncResult *res,
12364 GError **error)
12365{
12366 GVariant *_ret;
12367 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
12368 if (_ret == NULL)
12369 goto _out;
12370 g_variant_get (_ret,
12371 "()");
12372 g_variant_unref (_ret);
12373_out:
12374 return _ret != NULL;
12375}
12376
12377/**
12378 * control_bmc_call_place_holder_sync:
12379 * @proxy: A #ControlBmcProxy.
12380 * @cancellable: (allow-none): A #GCancellable or %NULL.
12381 * @error: Return location for error or %NULL.
12382 *
12383 * 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.
12384 *
12385 * See control_bmc_call_place_holder() for the asynchronous version of this method.
12386 *
12387 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
12388 */
12389gboolean
12390control_bmc_call_place_holder_sync (
12391 ControlBmc *proxy,
12392 GCancellable *cancellable,
12393 GError **error)
12394{
12395 GVariant *_ret;
12396 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
12397 "place_holder",
12398 g_variant_new ("()"),
12399 G_DBUS_CALL_FLAGS_NONE,
12400 -1,
12401 cancellable,
12402 error);
12403 if (_ret == NULL)
12404 goto _out;
12405 g_variant_get (_ret,
12406 "()");
12407 g_variant_unref (_ret);
12408_out:
12409 return _ret != NULL;
12410}
12411
12412/**
12413 * control_bmc_complete_place_holder:
12414 * @object: A #ControlBmc.
12415 * @invocation: (transfer full): A #GDBusMethodInvocation.
12416 *
12417 * 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.
12418 *
12419 * This method will free @invocation, you cannot use it afterwards.
12420 */
12421void
12422control_bmc_complete_place_holder (
12423 ControlBmc *object,
12424 GDBusMethodInvocation *invocation)
12425{
12426 g_dbus_method_invocation_return_value (invocation,
12427 g_variant_new ("()"));
12428}
12429
12430/* ------------------------------------------------------------------------ */
12431
12432/**
12433 * ControlBmcProxy:
12434 *
12435 * The #ControlBmcProxy structure contains only private data and should only be accessed using the provided API.
12436 */
12437
12438/**
12439 * ControlBmcProxyClass:
12440 * @parent_class: The parent class.
12441 *
12442 * Class structure for #ControlBmcProxy.
12443 */
12444
12445struct _ControlBmcProxyPrivate
12446{
12447 GData *qdata;
12448};
12449
12450static void control_bmc_proxy_iface_init (ControlBmcIface *iface);
12451
12452#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12453G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY,
12454 G_ADD_PRIVATE (ControlBmcProxy)
12455 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init));
12456
12457#else
12458G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY,
12459 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init));
12460
12461#endif
12462static void
12463control_bmc_proxy_finalize (GObject *object)
12464{
12465 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (object);
12466 g_datalist_clear (&proxy->priv->qdata);
12467 G_OBJECT_CLASS (control_bmc_proxy_parent_class)->finalize (object);
12468}
12469
12470static void
12471control_bmc_proxy_get_property (GObject *object,
12472 guint prop_id,
12473 GValue *value,
12474 GParamSpec *pspec G_GNUC_UNUSED)
12475{
12476}
12477
12478static void
12479control_bmc_proxy_set_property (GObject *object,
12480 guint prop_id,
12481 const GValue *value,
12482 GParamSpec *pspec G_GNUC_UNUSED)
12483{
12484}
12485
12486static void
12487control_bmc_proxy_g_signal (GDBusProxy *proxy,
12488 const gchar *sender_name G_GNUC_UNUSED,
12489 const gchar *signal_name,
12490 GVariant *parameters)
12491{
12492 _ExtendedGDBusSignalInfo *info;
12493 GVariantIter iter;
12494 GVariant *child;
12495 GValue *paramv;
12496 guint num_params;
12497 guint n;
12498 guint signal_id;
12499 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, signal_name);
12500 if (info == NULL)
12501 return;
12502 num_params = g_variant_n_children (parameters);
12503 paramv = g_new0 (GValue, num_params + 1);
12504 g_value_init (&paramv[0], TYPE_CONTROL_BMC);
12505 g_value_set_object (&paramv[0], proxy);
12506 g_variant_iter_init (&iter, parameters);
12507 n = 1;
12508 while ((child = g_variant_iter_next_value (&iter)) != NULL)
12509 {
12510 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
12511 if (arg_info->use_gvariant)
12512 {
12513 g_value_init (&paramv[n], G_TYPE_VARIANT);
12514 g_value_set_variant (&paramv[n], child);
12515 n++;
12516 }
12517 else
12518 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
12519 g_variant_unref (child);
12520 }
12521 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC);
12522 g_signal_emitv (paramv, signal_id, 0, NULL);
12523 for (n = 0; n < num_params + 1; n++)
12524 g_value_unset (&paramv[n]);
12525 g_free (paramv);
12526}
12527
12528static void
12529control_bmc_proxy_g_properties_changed (GDBusProxy *_proxy,
12530 GVariant *changed_properties,
12531 const gchar *const *invalidated_properties)
12532{
12533 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (_proxy);
12534 guint n;
12535 const gchar *key;
12536 GVariantIter *iter;
12537 _ExtendedGDBusPropertyInfo *info;
12538 g_variant_get (changed_properties, "a{sv}", &iter);
12539 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
12540 {
12541 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, key);
12542 g_datalist_remove_data (&proxy->priv->qdata, key);
12543 if (info != NULL)
12544 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
12545 }
12546 g_variant_iter_free (iter);
12547 for (n = 0; invalidated_properties[n] != NULL; n++)
12548 {
12549 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, invalidated_properties[n]);
12550 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
12551 if (info != NULL)
12552 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
12553 }
12554}
12555
12556static void
12557control_bmc_proxy_init (ControlBmcProxy *proxy)
12558{
12559#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12560 proxy->priv = control_bmc_proxy_get_instance_private (proxy);
12561#else
12562 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_BMC_PROXY, ControlBmcProxyPrivate);
12563#endif
12564
12565 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_bmc_interface_info ());
12566}
12567
12568static void
12569control_bmc_proxy_class_init (ControlBmcProxyClass *klass)
12570{
12571 GObjectClass *gobject_class;
12572 GDBusProxyClass *proxy_class;
12573
12574 gobject_class = G_OBJECT_CLASS (klass);
12575 gobject_class->finalize = control_bmc_proxy_finalize;
12576 gobject_class->get_property = control_bmc_proxy_get_property;
12577 gobject_class->set_property = control_bmc_proxy_set_property;
12578
12579 proxy_class = G_DBUS_PROXY_CLASS (klass);
12580 proxy_class->g_signal = control_bmc_proxy_g_signal;
12581 proxy_class->g_properties_changed = control_bmc_proxy_g_properties_changed;
12582
12583#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
12584 g_type_class_add_private (klass, sizeof (ControlBmcProxyPrivate));
12585#endif
12586}
12587
12588static void
12589control_bmc_proxy_iface_init (ControlBmcIface *iface)
12590{
12591}
12592
12593/**
12594 * control_bmc_proxy_new:
12595 * @connection: A #GDBusConnection.
12596 * @flags: Flags from the #GDBusProxyFlags enumeration.
12597 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
12598 * @object_path: An object path.
12599 * @cancellable: (allow-none): A #GCancellable or %NULL.
12600 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
12601 * @user_data: User data to pass to @callback.
12602 *
12603 * 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.
12604 *
12605 * 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.
12606 * You can then call control_bmc_proxy_new_finish() to get the result of the operation.
12607 *
12608 * See control_bmc_proxy_new_sync() for the synchronous, blocking version of this constructor.
12609 */
12610void
12611control_bmc_proxy_new (
12612 GDBusConnection *connection,
12613 GDBusProxyFlags flags,
12614 const gchar *name,
12615 const gchar *object_path,
12616 GCancellable *cancellable,
12617 GAsyncReadyCallback callback,
12618 gpointer user_data)
12619{
12620 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);
12621}
12622
12623/**
12624 * control_bmc_proxy_new_finish:
12625 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new().
12626 * @error: Return location for error or %NULL
12627 *
12628 * Finishes an operation started with control_bmc_proxy_new().
12629 *
12630 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
12631 */
12632ControlBmc *
12633control_bmc_proxy_new_finish (
12634 GAsyncResult *res,
12635 GError **error)
12636{
12637 GObject *ret;
12638 GObject *source_object;
12639 source_object = g_async_result_get_source_object (res);
12640 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
12641 g_object_unref (source_object);
12642 if (ret != NULL)
12643 return CONTROL_BMC (ret);
12644 else
12645 return NULL;
12646}
12647
12648/**
12649 * control_bmc_proxy_new_sync:
12650 * @connection: A #GDBusConnection.
12651 * @flags: Flags from the #GDBusProxyFlags enumeration.
12652 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
12653 * @object_path: An object path.
12654 * @cancellable: (allow-none): A #GCancellable or %NULL.
12655 * @error: Return location for error or %NULL
12656 *
12657 * 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.
12658 *
12659 * The calling thread is blocked until a reply is received.
12660 *
12661 * See control_bmc_proxy_new() for the asynchronous version of this constructor.
12662 *
12663 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
12664 */
12665ControlBmc *
12666control_bmc_proxy_new_sync (
12667 GDBusConnection *connection,
12668 GDBusProxyFlags flags,
12669 const gchar *name,
12670 const gchar *object_path,
12671 GCancellable *cancellable,
12672 GError **error)
12673{
12674 GInitable *ret;
12675 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);
12676 if (ret != NULL)
12677 return CONTROL_BMC (ret);
12678 else
12679 return NULL;
12680}
12681
12682
12683/**
12684 * control_bmc_proxy_new_for_bus:
12685 * @bus_type: A #GBusType.
12686 * @flags: Flags from the #GDBusProxyFlags enumeration.
12687 * @name: A bus name (well-known or unique).
12688 * @object_path: An object path.
12689 * @cancellable: (allow-none): A #GCancellable or %NULL.
12690 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
12691 * @user_data: User data to pass to @callback.
12692 *
12693 * Like control_bmc_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
12694 *
12695 * 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.
12696 * You can then call control_bmc_proxy_new_for_bus_finish() to get the result of the operation.
12697 *
12698 * See control_bmc_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
12699 */
12700void
12701control_bmc_proxy_new_for_bus (
12702 GBusType bus_type,
12703 GDBusProxyFlags flags,
12704 const gchar *name,
12705 const gchar *object_path,
12706 GCancellable *cancellable,
12707 GAsyncReadyCallback callback,
12708 gpointer user_data)
12709{
12710 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);
12711}
12712
12713/**
12714 * control_bmc_proxy_new_for_bus_finish:
12715 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new_for_bus().
12716 * @error: Return location for error or %NULL
12717 *
12718 * Finishes an operation started with control_bmc_proxy_new_for_bus().
12719 *
12720 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
12721 */
12722ControlBmc *
12723control_bmc_proxy_new_for_bus_finish (
12724 GAsyncResult *res,
12725 GError **error)
12726{
12727 GObject *ret;
12728 GObject *source_object;
12729 source_object = g_async_result_get_source_object (res);
12730 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
12731 g_object_unref (source_object);
12732 if (ret != NULL)
12733 return CONTROL_BMC (ret);
12734 else
12735 return NULL;
12736}
12737
12738/**
12739 * control_bmc_proxy_new_for_bus_sync:
12740 * @bus_type: A #GBusType.
12741 * @flags: Flags from the #GDBusProxyFlags enumeration.
12742 * @name: A bus name (well-known or unique).
12743 * @object_path: An object path.
12744 * @cancellable: (allow-none): A #GCancellable or %NULL.
12745 * @error: Return location for error or %NULL
12746 *
12747 * Like control_bmc_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
12748 *
12749 * The calling thread is blocked until a reply is received.
12750 *
12751 * See control_bmc_proxy_new_for_bus() for the asynchronous version of this constructor.
12752 *
12753 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
12754 */
12755ControlBmc *
12756control_bmc_proxy_new_for_bus_sync (
12757 GBusType bus_type,
12758 GDBusProxyFlags flags,
12759 const gchar *name,
12760 const gchar *object_path,
12761 GCancellable *cancellable,
12762 GError **error)
12763{
12764 GInitable *ret;
12765 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);
12766 if (ret != NULL)
12767 return CONTROL_BMC (ret);
12768 else
12769 return NULL;
12770}
12771
12772
12773/* ------------------------------------------------------------------------ */
12774
12775/**
12776 * ControlBmcSkeleton:
12777 *
12778 * The #ControlBmcSkeleton structure contains only private data and should only be accessed using the provided API.
12779 */
12780
12781/**
12782 * ControlBmcSkeletonClass:
12783 * @parent_class: The parent class.
12784 *
12785 * Class structure for #ControlBmcSkeleton.
12786 */
12787
12788struct _ControlBmcSkeletonPrivate
12789{
12790 GValue *properties;
12791 GList *changed_properties;
12792 GSource *changed_properties_idle_source;
12793 GMainContext *context;
12794 GMutex lock;
12795};
12796
12797static void
12798_control_bmc_skeleton_handle_method_call (
12799 GDBusConnection *connection G_GNUC_UNUSED,
12800 const gchar *sender G_GNUC_UNUSED,
12801 const gchar *object_path G_GNUC_UNUSED,
12802 const gchar *interface_name,
12803 const gchar *method_name,
12804 GVariant *parameters,
12805 GDBusMethodInvocation *invocation,
12806 gpointer user_data)
12807{
12808 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
12809 _ExtendedGDBusMethodInfo *info;
12810 GVariantIter iter;
12811 GVariant *child;
12812 GValue *paramv;
12813 guint num_params;
12814 guint num_extra;
12815 guint n;
12816 guint signal_id;
12817 GValue return_value = G_VALUE_INIT;
12818 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
12819 g_assert (info != NULL);
12820 num_params = g_variant_n_children (parameters);
12821 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
12822 n = 0;
12823 g_value_init (&paramv[n], TYPE_CONTROL_BMC);
12824 g_value_set_object (&paramv[n++], skeleton);
12825 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
12826 g_value_set_object (&paramv[n++], invocation);
12827 if (info->pass_fdlist)
12828 {
12829#ifdef G_OS_UNIX
12830 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
12831 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
12832#else
12833 g_assert_not_reached ();
12834#endif
12835 }
12836 g_variant_iter_init (&iter, parameters);
12837 while ((child = g_variant_iter_next_value (&iter)) != NULL)
12838 {
12839 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
12840 if (arg_info->use_gvariant)
12841 {
12842 g_value_init (&paramv[n], G_TYPE_VARIANT);
12843 g_value_set_variant (&paramv[n], child);
12844 n++;
12845 }
12846 else
12847 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
12848 g_variant_unref (child);
12849 }
12850 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC);
12851 g_value_init (&return_value, G_TYPE_BOOLEAN);
12852 g_signal_emitv (paramv, signal_id, 0, &return_value);
12853 if (!g_value_get_boolean (&return_value))
12854 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);
12855 g_value_unset (&return_value);
12856 for (n = 0; n < num_params + num_extra; n++)
12857 g_value_unset (&paramv[n]);
12858 g_free (paramv);
12859}
12860
12861static GVariant *
12862_control_bmc_skeleton_handle_get_property (
12863 GDBusConnection *connection G_GNUC_UNUSED,
12864 const gchar *sender G_GNUC_UNUSED,
12865 const gchar *object_path G_GNUC_UNUSED,
12866 const gchar *interface_name G_GNUC_UNUSED,
12867 const gchar *property_name,
12868 GError **error,
12869 gpointer user_data)
12870{
12871 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
12872 GValue value = G_VALUE_INIT;
12873 GParamSpec *pspec;
12874 _ExtendedGDBusPropertyInfo *info;
12875 GVariant *ret;
12876 ret = NULL;
12877 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name);
12878 g_assert (info != NULL);
12879 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
12880 if (pspec == NULL)
12881 {
12882 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
12883 }
12884 else
12885 {
12886 g_value_init (&value, pspec->value_type);
12887 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
12888 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
12889 g_value_unset (&value);
12890 }
12891 return ret;
12892}
12893
12894static gboolean
12895_control_bmc_skeleton_handle_set_property (
12896 GDBusConnection *connection G_GNUC_UNUSED,
12897 const gchar *sender G_GNUC_UNUSED,
12898 const gchar *object_path G_GNUC_UNUSED,
12899 const gchar *interface_name G_GNUC_UNUSED,
12900 const gchar *property_name,
12901 GVariant *variant,
12902 GError **error,
12903 gpointer user_data)
12904{
12905 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
12906 GValue value = G_VALUE_INIT;
12907 GParamSpec *pspec;
12908 _ExtendedGDBusPropertyInfo *info;
12909 gboolean ret;
12910 ret = FALSE;
12911 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name);
12912 g_assert (info != NULL);
12913 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
12914 if (pspec == NULL)
12915 {
12916 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
12917 }
12918 else
12919 {
12920 if (info->use_gvariant)
12921 g_value_set_variant (&value, variant);
12922 else
12923 g_dbus_gvariant_to_gvalue (variant, &value);
12924 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
12925 g_value_unset (&value);
12926 ret = TRUE;
12927 }
12928 return ret;
12929}
12930
12931static const GDBusInterfaceVTable _control_bmc_skeleton_vtable =
12932{
12933 _control_bmc_skeleton_handle_method_call,
12934 _control_bmc_skeleton_handle_get_property,
12935 _control_bmc_skeleton_handle_set_property,
12936 {NULL}
12937};
12938
12939static GDBusInterfaceInfo *
12940control_bmc_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
12941{
12942 return control_bmc_interface_info ();
12943}
12944
12945static GDBusInterfaceVTable *
12946control_bmc_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
12947{
12948 return (GDBusInterfaceVTable *) &_control_bmc_skeleton_vtable;
12949}
12950
12951static GVariant *
12952control_bmc_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
12953{
12954 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (_skeleton);
12955
12956 GVariantBuilder builder;
12957 guint n;
12958 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
12959 if (_control_bmc_interface_info.parent_struct.properties == NULL)
12960 goto out;
12961 for (n = 0; _control_bmc_interface_info.parent_struct.properties[n] != NULL; n++)
12962 {
12963 GDBusPropertyInfo *info = _control_bmc_interface_info.parent_struct.properties[n];
12964 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
12965 {
12966 GVariant *value;
12967 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);
12968 if (value != NULL)
12969 {
12970 g_variant_take_ref (value);
12971 g_variant_builder_add (&builder, "{sv}", info->name, value);
12972 g_variant_unref (value);
12973 }
12974 }
12975 }
12976out:
12977 return g_variant_builder_end (&builder);
12978}
12979
12980static void
12981control_bmc_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
12982{
12983}
12984
12985static void control_bmc_skeleton_iface_init (ControlBmcIface *iface);
12986#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12987G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
12988 G_ADD_PRIVATE (ControlBmcSkeleton)
12989 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init));
12990
12991#else
12992G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
12993 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init));
12994
12995#endif
12996static void
12997control_bmc_skeleton_finalize (GObject *object)
12998{
12999 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (object);
13000 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
13001 if (skeleton->priv->changed_properties_idle_source != NULL)
13002 g_source_destroy (skeleton->priv->changed_properties_idle_source);
13003 g_main_context_unref (skeleton->priv->context);
13004 g_mutex_clear (&skeleton->priv->lock);
13005 G_OBJECT_CLASS (control_bmc_skeleton_parent_class)->finalize (object);
13006}
13007
13008static void
13009control_bmc_skeleton_init (ControlBmcSkeleton *skeleton)
13010{
13011#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13012 skeleton->priv = control_bmc_skeleton_get_instance_private (skeleton);
13013#else
13014 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_BMC_SKELETON, ControlBmcSkeletonPrivate);
13015#endif
13016
13017 g_mutex_init (&skeleton->priv->lock);
13018 skeleton->priv->context = g_main_context_ref_thread_default ();
13019}
13020
13021static void
13022control_bmc_skeleton_class_init (ControlBmcSkeletonClass *klass)
13023{
13024 GObjectClass *gobject_class;
13025 GDBusInterfaceSkeletonClass *skeleton_class;
13026
13027 gobject_class = G_OBJECT_CLASS (klass);
13028 gobject_class->finalize = control_bmc_skeleton_finalize;
13029
13030 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
13031 skeleton_class->get_info = control_bmc_skeleton_dbus_interface_get_info;
13032 skeleton_class->get_properties = control_bmc_skeleton_dbus_interface_get_properties;
13033 skeleton_class->flush = control_bmc_skeleton_dbus_interface_flush;
13034 skeleton_class->get_vtable = control_bmc_skeleton_dbus_interface_get_vtable;
13035
13036#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
13037 g_type_class_add_private (klass, sizeof (ControlBmcSkeletonPrivate));
13038#endif
13039}
13040
13041static void
13042control_bmc_skeleton_iface_init (ControlBmcIface *iface)
13043{
13044}
13045
13046/**
13047 * control_bmc_skeleton_new:
13048 *
13049 * 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>.
13050 *
13051 * Returns: (transfer full) (type ControlBmcSkeleton): The skeleton object.
13052 */
13053ControlBmc *
13054control_bmc_skeleton_new (void)
13055{
13056 return CONTROL_BMC (g_object_new (TYPE_CONTROL_BMC_SKELETON, NULL));
13057}
13058
13059/* ------------------------------------------------------------------------
13060 * Code for interface org.openbmc.control.Host
13061 * ------------------------------------------------------------------------
13062 */
13063
13064/**
13065 * SECTION:ControlHost
13066 * @title: ControlHost
13067 * @short_description: Generated C code for the org.openbmc.control.Host D-Bus interface
13068 *
13069 * 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.
13070 */
13071
13072/* ---- Introspection data for org.openbmc.control.Host ---- */
13073
13074static const _ExtendedGDBusMethodInfo _control_host_method_info_boot =
13075{
13076 {
13077 -1,
13078 (gchar *) "boot",
13079 NULL,
13080 NULL,
13081 NULL
13082 },
13083 "handle-boot",
13084 FALSE
13085};
13086
13087static const _ExtendedGDBusMethodInfo _control_host_method_info_shutdown =
13088{
13089 {
13090 -1,
13091 (gchar *) "shutdown",
13092 NULL,
13093 NULL,
13094 NULL
13095 },
13096 "handle-shutdown",
13097 FALSE
13098};
13099
13100static const _ExtendedGDBusMethodInfo _control_host_method_info_reboot =
13101{
13102 {
13103 -1,
13104 (gchar *) "reboot",
13105 NULL,
13106 NULL,
13107 NULL
13108 },
13109 "handle-reboot",
13110 FALSE
13111};
13112
13113static const _ExtendedGDBusMethodInfo * const _control_host_method_info_pointers[] =
13114{
13115 &_control_host_method_info_boot,
13116 &_control_host_method_info_shutdown,
13117 &_control_host_method_info_reboot,
13118 NULL
13119};
13120
13121static const _ExtendedGDBusSignalInfo _control_host_signal_info_booted =
13122{
13123 {
13124 -1,
13125 (gchar *) "Booted",
13126 NULL,
13127 NULL
13128 },
13129 "booted"
13130};
13131
13132static const _ExtendedGDBusSignalInfo * const _control_host_signal_info_pointers[] =
13133{
13134 &_control_host_signal_info_booted,
13135 NULL
13136};
13137
13138static const _ExtendedGDBusInterfaceInfo _control_host_interface_info =
13139{
13140 {
13141 -1,
13142 (gchar *) "org.openbmc.control.Host",
13143 (GDBusMethodInfo **) &_control_host_method_info_pointers,
13144 (GDBusSignalInfo **) &_control_host_signal_info_pointers,
13145 NULL,
13146 NULL
13147 },
13148 "control-host",
13149};
13150
13151
13152/**
13153 * control_host_interface_info:
13154 *
13155 * 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.
13156 *
13157 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
13158 */
13159GDBusInterfaceInfo *
13160control_host_interface_info (void)
13161{
13162 return (GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct;
13163}
13164
13165/**
13166 * control_host_override_properties:
13167 * @klass: The class structure for a #GObject<!-- -->-derived class.
13168 * @property_id_begin: The property id to assign to the first overridden property.
13169 *
13170 * Overrides all #GObject properties in the #ControlHost interface for a concrete class.
13171 * The properties are overridden in the order they are defined.
13172 *
13173 * Returns: The last property id.
13174 */
13175guint
13176control_host_override_properties (GObjectClass *klass, guint property_id_begin)
13177{
13178 return property_id_begin - 1;
13179}
13180
13181
13182
13183/**
13184 * ControlHost:
13185 *
13186 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
13187 */
13188
13189/**
13190 * ControlHostIface:
13191 * @parent_iface: The parent interface.
13192 * @handle_boot: Handler for the #ControlHost::handle-boot signal.
13193 * @handle_reboot: Handler for the #ControlHost::handle-reboot signal.
13194 * @handle_shutdown: Handler for the #ControlHost::handle-shutdown signal.
13195 * @booted: Handler for the #ControlHost::booted signal.
13196 *
13197 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
13198 */
13199
13200typedef ControlHostIface ControlHostInterface;
13201G_DEFINE_INTERFACE (ControlHost, control_host, G_TYPE_OBJECT);
13202
13203static void
13204control_host_default_init (ControlHostIface *iface)
13205{
13206 /* GObject signals for incoming D-Bus method calls: */
13207 /**
13208 * ControlHost::handle-boot:
13209 * @object: A #ControlHost.
13210 * @invocation: A #GDBusMethodInvocation.
13211 *
13212 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method.
13213 *
13214 * 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.
13215 *
13216 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
13217 */
13218 g_signal_new ("handle-boot",
13219 G_TYPE_FROM_INTERFACE (iface),
13220 G_SIGNAL_RUN_LAST,
13221 G_STRUCT_OFFSET (ControlHostIface, handle_boot),
13222 g_signal_accumulator_true_handled,
13223 NULL,
13224 g_cclosure_marshal_generic,
13225 G_TYPE_BOOLEAN,
13226 1,
13227 G_TYPE_DBUS_METHOD_INVOCATION);
13228
13229 /**
13230 * ControlHost::handle-shutdown:
13231 * @object: A #ControlHost.
13232 * @invocation: A #GDBusMethodInvocation.
13233 *
13234 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method.
13235 *
13236 * 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.
13237 *
13238 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
13239 */
13240 g_signal_new ("handle-shutdown",
13241 G_TYPE_FROM_INTERFACE (iface),
13242 G_SIGNAL_RUN_LAST,
13243 G_STRUCT_OFFSET (ControlHostIface, handle_shutdown),
13244 g_signal_accumulator_true_handled,
13245 NULL,
13246 g_cclosure_marshal_generic,
13247 G_TYPE_BOOLEAN,
13248 1,
13249 G_TYPE_DBUS_METHOD_INVOCATION);
13250
13251 /**
13252 * ControlHost::handle-reboot:
13253 * @object: A #ControlHost.
13254 * @invocation: A #GDBusMethodInvocation.
13255 *
13256 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method.
13257 *
13258 * 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.
13259 *
13260 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
13261 */
13262 g_signal_new ("handle-reboot",
13263 G_TYPE_FROM_INTERFACE (iface),
13264 G_SIGNAL_RUN_LAST,
13265 G_STRUCT_OFFSET (ControlHostIface, handle_reboot),
13266 g_signal_accumulator_true_handled,
13267 NULL,
13268 g_cclosure_marshal_generic,
13269 G_TYPE_BOOLEAN,
13270 1,
13271 G_TYPE_DBUS_METHOD_INVOCATION);
13272
13273 /* GObject signals for received D-Bus signals: */
13274 /**
13275 * ControlHost::booted:
13276 * @object: A #ControlHost.
13277 *
13278 * 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.
13279 *
13280 * 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.
13281 */
13282 g_signal_new ("booted",
13283 G_TYPE_FROM_INTERFACE (iface),
13284 G_SIGNAL_RUN_LAST,
13285 G_STRUCT_OFFSET (ControlHostIface, booted),
13286 NULL,
13287 NULL,
13288 g_cclosure_marshal_generic,
13289 G_TYPE_NONE,
13290 0);
13291
13292}
13293
13294/**
13295 * control_host_emit_booted:
13296 * @object: A #ControlHost.
13297 *
13298 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Host.Booted">"Booted"</link> D-Bus signal.
13299 */
13300void
13301control_host_emit_booted (
13302 ControlHost *object)
13303{
13304 g_signal_emit_by_name (object, "booted");
13305}
13306
13307/**
13308 * control_host_call_boot:
13309 * @proxy: A #ControlHostProxy.
13310 * @cancellable: (allow-none): A #GCancellable or %NULL.
13311 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
13312 * @user_data: User data to pass to @callback.
13313 *
13314 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method on @proxy.
13315 * 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.
13316 * You can then call control_host_call_boot_finish() to get the result of the operation.
13317 *
13318 * See control_host_call_boot_sync() for the synchronous, blocking version of this method.
13319 */
13320void
13321control_host_call_boot (
13322 ControlHost *proxy,
13323 GCancellable *cancellable,
13324 GAsyncReadyCallback callback,
13325 gpointer user_data)
13326{
13327 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
13328 "boot",
13329 g_variant_new ("()"),
13330 G_DBUS_CALL_FLAGS_NONE,
13331 -1,
13332 cancellable,
13333 callback,
13334 user_data);
13335}
13336
13337/**
13338 * control_host_call_boot_finish:
13339 * @proxy: A #ControlHostProxy.
13340 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_boot().
13341 * @error: Return location for error or %NULL.
13342 *
13343 * Finishes an operation started with control_host_call_boot().
13344 *
13345 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13346 */
13347gboolean
13348control_host_call_boot_finish (
13349 ControlHost *proxy,
13350 GAsyncResult *res,
13351 GError **error)
13352{
13353 GVariant *_ret;
13354 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
13355 if (_ret == NULL)
13356 goto _out;
13357 g_variant_get (_ret,
13358 "()");
13359 g_variant_unref (_ret);
13360_out:
13361 return _ret != NULL;
13362}
13363
13364/**
13365 * control_host_call_boot_sync:
13366 * @proxy: A #ControlHostProxy.
13367 * @cancellable: (allow-none): A #GCancellable or %NULL.
13368 * @error: Return location for error or %NULL.
13369 *
13370 * 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.
13371 *
13372 * See control_host_call_boot() for the asynchronous version of this method.
13373 *
13374 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13375 */
13376gboolean
13377control_host_call_boot_sync (
13378 ControlHost *proxy,
13379 GCancellable *cancellable,
13380 GError **error)
13381{
13382 GVariant *_ret;
13383 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
13384 "boot",
13385 g_variant_new ("()"),
13386 G_DBUS_CALL_FLAGS_NONE,
13387 -1,
13388 cancellable,
13389 error);
13390 if (_ret == NULL)
13391 goto _out;
13392 g_variant_get (_ret,
13393 "()");
13394 g_variant_unref (_ret);
13395_out:
13396 return _ret != NULL;
13397}
13398
13399/**
13400 * control_host_call_shutdown:
13401 * @proxy: A #ControlHostProxy.
13402 * @cancellable: (allow-none): A #GCancellable or %NULL.
13403 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
13404 * @user_data: User data to pass to @callback.
13405 *
13406 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method on @proxy.
13407 * 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.
13408 * You can then call control_host_call_shutdown_finish() to get the result of the operation.
13409 *
13410 * See control_host_call_shutdown_sync() for the synchronous, blocking version of this method.
13411 */
13412void
13413control_host_call_shutdown (
13414 ControlHost *proxy,
13415 GCancellable *cancellable,
13416 GAsyncReadyCallback callback,
13417 gpointer user_data)
13418{
13419 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
13420 "shutdown",
13421 g_variant_new ("()"),
13422 G_DBUS_CALL_FLAGS_NONE,
13423 -1,
13424 cancellable,
13425 callback,
13426 user_data);
13427}
13428
13429/**
13430 * control_host_call_shutdown_finish:
13431 * @proxy: A #ControlHostProxy.
13432 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_shutdown().
13433 * @error: Return location for error or %NULL.
13434 *
13435 * Finishes an operation started with control_host_call_shutdown().
13436 *
13437 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13438 */
13439gboolean
13440control_host_call_shutdown_finish (
13441 ControlHost *proxy,
13442 GAsyncResult *res,
13443 GError **error)
13444{
13445 GVariant *_ret;
13446 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
13447 if (_ret == NULL)
13448 goto _out;
13449 g_variant_get (_ret,
13450 "()");
13451 g_variant_unref (_ret);
13452_out:
13453 return _ret != NULL;
13454}
13455
13456/**
13457 * control_host_call_shutdown_sync:
13458 * @proxy: A #ControlHostProxy.
13459 * @cancellable: (allow-none): A #GCancellable or %NULL.
13460 * @error: Return location for error or %NULL.
13461 *
13462 * 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.
13463 *
13464 * See control_host_call_shutdown() for the asynchronous version of this method.
13465 *
13466 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13467 */
13468gboolean
13469control_host_call_shutdown_sync (
13470 ControlHost *proxy,
13471 GCancellable *cancellable,
13472 GError **error)
13473{
13474 GVariant *_ret;
13475 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
13476 "shutdown",
13477 g_variant_new ("()"),
13478 G_DBUS_CALL_FLAGS_NONE,
13479 -1,
13480 cancellable,
13481 error);
13482 if (_ret == NULL)
13483 goto _out;
13484 g_variant_get (_ret,
13485 "()");
13486 g_variant_unref (_ret);
13487_out:
13488 return _ret != NULL;
13489}
13490
13491/**
13492 * control_host_call_reboot:
13493 * @proxy: A #ControlHostProxy.
13494 * @cancellable: (allow-none): A #GCancellable or %NULL.
13495 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
13496 * @user_data: User data to pass to @callback.
13497 *
13498 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method on @proxy.
13499 * 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.
13500 * You can then call control_host_call_reboot_finish() to get the result of the operation.
13501 *
13502 * See control_host_call_reboot_sync() for the synchronous, blocking version of this method.
13503 */
13504void
13505control_host_call_reboot (
13506 ControlHost *proxy,
13507 GCancellable *cancellable,
13508 GAsyncReadyCallback callback,
13509 gpointer user_data)
13510{
13511 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
13512 "reboot",
13513 g_variant_new ("()"),
13514 G_DBUS_CALL_FLAGS_NONE,
13515 -1,
13516 cancellable,
13517 callback,
13518 user_data);
13519}
13520
13521/**
13522 * control_host_call_reboot_finish:
13523 * @proxy: A #ControlHostProxy.
13524 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_reboot().
13525 * @error: Return location for error or %NULL.
13526 *
13527 * Finishes an operation started with control_host_call_reboot().
13528 *
13529 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13530 */
13531gboolean
13532control_host_call_reboot_finish (
13533 ControlHost *proxy,
13534 GAsyncResult *res,
13535 GError **error)
13536{
13537 GVariant *_ret;
13538 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
13539 if (_ret == NULL)
13540 goto _out;
13541 g_variant_get (_ret,
13542 "()");
13543 g_variant_unref (_ret);
13544_out:
13545 return _ret != NULL;
13546}
13547
13548/**
13549 * control_host_call_reboot_sync:
13550 * @proxy: A #ControlHostProxy.
13551 * @cancellable: (allow-none): A #GCancellable or %NULL.
13552 * @error: Return location for error or %NULL.
13553 *
13554 * 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.
13555 *
13556 * See control_host_call_reboot() for the asynchronous version of this method.
13557 *
13558 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13559 */
13560gboolean
13561control_host_call_reboot_sync (
13562 ControlHost *proxy,
13563 GCancellable *cancellable,
13564 GError **error)
13565{
13566 GVariant *_ret;
13567 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
13568 "reboot",
13569 g_variant_new ("()"),
13570 G_DBUS_CALL_FLAGS_NONE,
13571 -1,
13572 cancellable,
13573 error);
13574 if (_ret == NULL)
13575 goto _out;
13576 g_variant_get (_ret,
13577 "()");
13578 g_variant_unref (_ret);
13579_out:
13580 return _ret != NULL;
13581}
13582
13583/**
13584 * control_host_complete_boot:
13585 * @object: A #ControlHost.
13586 * @invocation: (transfer full): A #GDBusMethodInvocation.
13587 *
13588 * 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.
13589 *
13590 * This method will free @invocation, you cannot use it afterwards.
13591 */
13592void
13593control_host_complete_boot (
13594 ControlHost *object,
13595 GDBusMethodInvocation *invocation)
13596{
13597 g_dbus_method_invocation_return_value (invocation,
13598 g_variant_new ("()"));
13599}
13600
13601/**
13602 * control_host_complete_shutdown:
13603 * @object: A #ControlHost.
13604 * @invocation: (transfer full): A #GDBusMethodInvocation.
13605 *
13606 * 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.
13607 *
13608 * This method will free @invocation, you cannot use it afterwards.
13609 */
13610void
13611control_host_complete_shutdown (
13612 ControlHost *object,
13613 GDBusMethodInvocation *invocation)
13614{
13615 g_dbus_method_invocation_return_value (invocation,
13616 g_variant_new ("()"));
13617}
13618
13619/**
13620 * control_host_complete_reboot:
13621 * @object: A #ControlHost.
13622 * @invocation: (transfer full): A #GDBusMethodInvocation.
13623 *
13624 * 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.
13625 *
13626 * This method will free @invocation, you cannot use it afterwards.
13627 */
13628void
13629control_host_complete_reboot (
13630 ControlHost *object,
13631 GDBusMethodInvocation *invocation)
13632{
13633 g_dbus_method_invocation_return_value (invocation,
13634 g_variant_new ("()"));
13635}
13636
13637/* ------------------------------------------------------------------------ */
13638
13639/**
13640 * ControlHostProxy:
13641 *
13642 * The #ControlHostProxy structure contains only private data and should only be accessed using the provided API.
13643 */
13644
13645/**
13646 * ControlHostProxyClass:
13647 * @parent_class: The parent class.
13648 *
13649 * Class structure for #ControlHostProxy.
13650 */
13651
13652struct _ControlHostProxyPrivate
13653{
13654 GData *qdata;
13655};
13656
13657static void control_host_proxy_iface_init (ControlHostIface *iface);
13658
13659#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13660G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
13661 G_ADD_PRIVATE (ControlHostProxy)
13662 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
13663
13664#else
13665G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
13666 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
13667
13668#endif
13669static void
13670control_host_proxy_finalize (GObject *object)
13671{
13672 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object);
13673 g_datalist_clear (&proxy->priv->qdata);
13674 G_OBJECT_CLASS (control_host_proxy_parent_class)->finalize (object);
13675}
13676
13677static void
13678control_host_proxy_get_property (GObject *object,
13679 guint prop_id,
13680 GValue *value,
13681 GParamSpec *pspec G_GNUC_UNUSED)
13682{
13683}
13684
13685static void
13686control_host_proxy_set_property (GObject *object,
13687 guint prop_id,
13688 const GValue *value,
13689 GParamSpec *pspec G_GNUC_UNUSED)
13690{
13691}
13692
13693static void
13694control_host_proxy_g_signal (GDBusProxy *proxy,
13695 const gchar *sender_name G_GNUC_UNUSED,
13696 const gchar *signal_name,
13697 GVariant *parameters)
13698{
13699 _ExtendedGDBusSignalInfo *info;
13700 GVariantIter iter;
13701 GVariant *child;
13702 GValue *paramv;
13703 guint num_params;
13704 guint n;
13705 guint signal_id;
13706 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, signal_name);
13707 if (info == NULL)
13708 return;
13709 num_params = g_variant_n_children (parameters);
13710 paramv = g_new0 (GValue, num_params + 1);
13711 g_value_init (&paramv[0], TYPE_CONTROL_HOST);
13712 g_value_set_object (&paramv[0], proxy);
13713 g_variant_iter_init (&iter, parameters);
13714 n = 1;
13715 while ((child = g_variant_iter_next_value (&iter)) != NULL)
13716 {
13717 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
13718 if (arg_info->use_gvariant)
13719 {
13720 g_value_init (&paramv[n], G_TYPE_VARIANT);
13721 g_value_set_variant (&paramv[n], child);
13722 n++;
13723 }
13724 else
13725 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
13726 g_variant_unref (child);
13727 }
13728 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
13729 g_signal_emitv (paramv, signal_id, 0, NULL);
13730 for (n = 0; n < num_params + 1; n++)
13731 g_value_unset (&paramv[n]);
13732 g_free (paramv);
13733}
13734
13735static void
13736control_host_proxy_g_properties_changed (GDBusProxy *_proxy,
13737 GVariant *changed_properties,
13738 const gchar *const *invalidated_properties)
13739{
13740 ControlHostProxy *proxy = CONTROL_HOST_PROXY (_proxy);
13741 guint n;
13742 const gchar *key;
13743 GVariantIter *iter;
13744 _ExtendedGDBusPropertyInfo *info;
13745 g_variant_get (changed_properties, "a{sv}", &iter);
13746 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
13747 {
13748 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, key);
13749 g_datalist_remove_data (&proxy->priv->qdata, key);
13750 if (info != NULL)
13751 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
13752 }
13753 g_variant_iter_free (iter);
13754 for (n = 0; invalidated_properties[n] != NULL; n++)
13755 {
13756 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, invalidated_properties[n]);
13757 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
13758 if (info != NULL)
13759 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
13760 }
13761}
13762
13763static void
13764control_host_proxy_init (ControlHostProxy *proxy)
13765{
13766#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13767 proxy->priv = control_host_proxy_get_instance_private (proxy);
13768#else
13769 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_HOST_PROXY, ControlHostProxyPrivate);
13770#endif
13771
13772 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_host_interface_info ());
13773}
13774
13775static void
13776control_host_proxy_class_init (ControlHostProxyClass *klass)
13777{
13778 GObjectClass *gobject_class;
13779 GDBusProxyClass *proxy_class;
13780
13781 gobject_class = G_OBJECT_CLASS (klass);
13782 gobject_class->finalize = control_host_proxy_finalize;
13783 gobject_class->get_property = control_host_proxy_get_property;
13784 gobject_class->set_property = control_host_proxy_set_property;
13785
13786 proxy_class = G_DBUS_PROXY_CLASS (klass);
13787 proxy_class->g_signal = control_host_proxy_g_signal;
13788 proxy_class->g_properties_changed = control_host_proxy_g_properties_changed;
13789
13790#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
13791 g_type_class_add_private (klass, sizeof (ControlHostProxyPrivate));
13792#endif
13793}
13794
13795static void
13796control_host_proxy_iface_init (ControlHostIface *iface)
13797{
13798}
13799
13800/**
13801 * control_host_proxy_new:
13802 * @connection: A #GDBusConnection.
13803 * @flags: Flags from the #GDBusProxyFlags enumeration.
13804 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
13805 * @object_path: An object path.
13806 * @cancellable: (allow-none): A #GCancellable or %NULL.
13807 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
13808 * @user_data: User data to pass to @callback.
13809 *
13810 * 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.
13811 *
13812 * 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.
13813 * You can then call control_host_proxy_new_finish() to get the result of the operation.
13814 *
13815 * See control_host_proxy_new_sync() for the synchronous, blocking version of this constructor.
13816 */
13817void
13818control_host_proxy_new (
13819 GDBusConnection *connection,
13820 GDBusProxyFlags flags,
13821 const gchar *name,
13822 const gchar *object_path,
13823 GCancellable *cancellable,
13824 GAsyncReadyCallback callback,
13825 gpointer user_data)
13826{
13827 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);
13828}
13829
13830/**
13831 * control_host_proxy_new_finish:
13832 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new().
13833 * @error: Return location for error or %NULL
13834 *
13835 * Finishes an operation started with control_host_proxy_new().
13836 *
13837 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
13838 */
13839ControlHost *
13840control_host_proxy_new_finish (
13841 GAsyncResult *res,
13842 GError **error)
13843{
13844 GObject *ret;
13845 GObject *source_object;
13846 source_object = g_async_result_get_source_object (res);
13847 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
13848 g_object_unref (source_object);
13849 if (ret != NULL)
13850 return CONTROL_HOST (ret);
13851 else
13852 return NULL;
13853}
13854
13855/**
13856 * control_host_proxy_new_sync:
13857 * @connection: A #GDBusConnection.
13858 * @flags: Flags from the #GDBusProxyFlags enumeration.
13859 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
13860 * @object_path: An object path.
13861 * @cancellable: (allow-none): A #GCancellable or %NULL.
13862 * @error: Return location for error or %NULL
13863 *
13864 * 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.
13865 *
13866 * The calling thread is blocked until a reply is received.
13867 *
13868 * See control_host_proxy_new() for the asynchronous version of this constructor.
13869 *
13870 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
13871 */
13872ControlHost *
13873control_host_proxy_new_sync (
13874 GDBusConnection *connection,
13875 GDBusProxyFlags flags,
13876 const gchar *name,
13877 const gchar *object_path,
13878 GCancellable *cancellable,
13879 GError **error)
13880{
13881 GInitable *ret;
13882 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);
13883 if (ret != NULL)
13884 return CONTROL_HOST (ret);
13885 else
13886 return NULL;
13887}
13888
13889
13890/**
13891 * control_host_proxy_new_for_bus:
13892 * @bus_type: A #GBusType.
13893 * @flags: Flags from the #GDBusProxyFlags enumeration.
13894 * @name: A bus name (well-known or unique).
13895 * @object_path: An object path.
13896 * @cancellable: (allow-none): A #GCancellable or %NULL.
13897 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
13898 * @user_data: User data to pass to @callback.
13899 *
13900 * Like control_host_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
13901 *
13902 * 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.
13903 * You can then call control_host_proxy_new_for_bus_finish() to get the result of the operation.
13904 *
13905 * See control_host_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
13906 */
13907void
13908control_host_proxy_new_for_bus (
13909 GBusType bus_type,
13910 GDBusProxyFlags flags,
13911 const gchar *name,
13912 const gchar *object_path,
13913 GCancellable *cancellable,
13914 GAsyncReadyCallback callback,
13915 gpointer user_data)
13916{
13917 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);
13918}
13919
13920/**
13921 * control_host_proxy_new_for_bus_finish:
13922 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new_for_bus().
13923 * @error: Return location for error or %NULL
13924 *
13925 * Finishes an operation started with control_host_proxy_new_for_bus().
13926 *
13927 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
13928 */
13929ControlHost *
13930control_host_proxy_new_for_bus_finish (
13931 GAsyncResult *res,
13932 GError **error)
13933{
13934 GObject *ret;
13935 GObject *source_object;
13936 source_object = g_async_result_get_source_object (res);
13937 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
13938 g_object_unref (source_object);
13939 if (ret != NULL)
13940 return CONTROL_HOST (ret);
13941 else
13942 return NULL;
13943}
13944
13945/**
13946 * control_host_proxy_new_for_bus_sync:
13947 * @bus_type: A #GBusType.
13948 * @flags: Flags from the #GDBusProxyFlags enumeration.
13949 * @name: A bus name (well-known or unique).
13950 * @object_path: An object path.
13951 * @cancellable: (allow-none): A #GCancellable or %NULL.
13952 * @error: Return location for error or %NULL
13953 *
13954 * Like control_host_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
13955 *
13956 * The calling thread is blocked until a reply is received.
13957 *
13958 * See control_host_proxy_new_for_bus() for the asynchronous version of this constructor.
13959 *
13960 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
13961 */
13962ControlHost *
13963control_host_proxy_new_for_bus_sync (
13964 GBusType bus_type,
13965 GDBusProxyFlags flags,
13966 const gchar *name,
13967 const gchar *object_path,
13968 GCancellable *cancellable,
13969 GError **error)
13970{
13971 GInitable *ret;
13972 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);
13973 if (ret != NULL)
13974 return CONTROL_HOST (ret);
13975 else
13976 return NULL;
13977}
13978
13979
13980/* ------------------------------------------------------------------------ */
13981
13982/**
13983 * ControlHostSkeleton:
13984 *
13985 * The #ControlHostSkeleton structure contains only private data and should only be accessed using the provided API.
13986 */
13987
13988/**
13989 * ControlHostSkeletonClass:
13990 * @parent_class: The parent class.
13991 *
13992 * Class structure for #ControlHostSkeleton.
13993 */
13994
13995struct _ControlHostSkeletonPrivate
13996{
13997 GValue *properties;
13998 GList *changed_properties;
13999 GSource *changed_properties_idle_source;
14000 GMainContext *context;
14001 GMutex lock;
14002};
14003
14004static void
14005_control_host_skeleton_handle_method_call (
14006 GDBusConnection *connection G_GNUC_UNUSED,
14007 const gchar *sender G_GNUC_UNUSED,
14008 const gchar *object_path G_GNUC_UNUSED,
14009 const gchar *interface_name,
14010 const gchar *method_name,
14011 GVariant *parameters,
14012 GDBusMethodInvocation *invocation,
14013 gpointer user_data)
14014{
14015 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
14016 _ExtendedGDBusMethodInfo *info;
14017 GVariantIter iter;
14018 GVariant *child;
14019 GValue *paramv;
14020 guint num_params;
14021 guint num_extra;
14022 guint n;
14023 guint signal_id;
14024 GValue return_value = G_VALUE_INIT;
14025 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
14026 g_assert (info != NULL);
14027 num_params = g_variant_n_children (parameters);
14028 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
14029 n = 0;
14030 g_value_init (&paramv[n], TYPE_CONTROL_HOST);
14031 g_value_set_object (&paramv[n++], skeleton);
14032 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
14033 g_value_set_object (&paramv[n++], invocation);
14034 if (info->pass_fdlist)
14035 {
14036#ifdef G_OS_UNIX
14037 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
14038 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
14039#else
14040 g_assert_not_reached ();
14041#endif
14042 }
14043 g_variant_iter_init (&iter, parameters);
14044 while ((child = g_variant_iter_next_value (&iter)) != NULL)
14045 {
14046 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
14047 if (arg_info->use_gvariant)
14048 {
14049 g_value_init (&paramv[n], G_TYPE_VARIANT);
14050 g_value_set_variant (&paramv[n], child);
14051 n++;
14052 }
14053 else
14054 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
14055 g_variant_unref (child);
14056 }
14057 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
14058 g_value_init (&return_value, G_TYPE_BOOLEAN);
14059 g_signal_emitv (paramv, signal_id, 0, &return_value);
14060 if (!g_value_get_boolean (&return_value))
14061 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);
14062 g_value_unset (&return_value);
14063 for (n = 0; n < num_params + num_extra; n++)
14064 g_value_unset (&paramv[n]);
14065 g_free (paramv);
14066}
14067
14068static GVariant *
14069_control_host_skeleton_handle_get_property (
14070 GDBusConnection *connection G_GNUC_UNUSED,
14071 const gchar *sender G_GNUC_UNUSED,
14072 const gchar *object_path G_GNUC_UNUSED,
14073 const gchar *interface_name G_GNUC_UNUSED,
14074 const gchar *property_name,
14075 GError **error,
14076 gpointer user_data)
14077{
14078 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
14079 GValue value = G_VALUE_INIT;
14080 GParamSpec *pspec;
14081 _ExtendedGDBusPropertyInfo *info;
14082 GVariant *ret;
14083 ret = NULL;
14084 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
14085 g_assert (info != NULL);
14086 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
14087 if (pspec == NULL)
14088 {
14089 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
14090 }
14091 else
14092 {
14093 g_value_init (&value, pspec->value_type);
14094 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
14095 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
14096 g_value_unset (&value);
14097 }
14098 return ret;
14099}
14100
14101static gboolean
14102_control_host_skeleton_handle_set_property (
14103 GDBusConnection *connection G_GNUC_UNUSED,
14104 const gchar *sender G_GNUC_UNUSED,
14105 const gchar *object_path G_GNUC_UNUSED,
14106 const gchar *interface_name G_GNUC_UNUSED,
14107 const gchar *property_name,
14108 GVariant *variant,
14109 GError **error,
14110 gpointer user_data)
14111{
14112 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
14113 GValue value = G_VALUE_INIT;
14114 GParamSpec *pspec;
14115 _ExtendedGDBusPropertyInfo *info;
14116 gboolean ret;
14117 ret = FALSE;
14118 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
14119 g_assert (info != NULL);
14120 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
14121 if (pspec == NULL)
14122 {
14123 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
14124 }
14125 else
14126 {
14127 if (info->use_gvariant)
14128 g_value_set_variant (&value, variant);
14129 else
14130 g_dbus_gvariant_to_gvalue (variant, &value);
14131 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
14132 g_value_unset (&value);
14133 ret = TRUE;
14134 }
14135 return ret;
14136}
14137
14138static const GDBusInterfaceVTable _control_host_skeleton_vtable =
14139{
14140 _control_host_skeleton_handle_method_call,
14141 _control_host_skeleton_handle_get_property,
14142 _control_host_skeleton_handle_set_property,
14143 {NULL}
14144};
14145
14146static GDBusInterfaceInfo *
14147control_host_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
14148{
14149 return control_host_interface_info ();
14150}
14151
14152static GDBusInterfaceVTable *
14153control_host_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
14154{
14155 return (GDBusInterfaceVTable *) &_control_host_skeleton_vtable;
14156}
14157
14158static GVariant *
14159control_host_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
14160{
14161 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton);
14162
14163 GVariantBuilder builder;
14164 guint n;
14165 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
14166 if (_control_host_interface_info.parent_struct.properties == NULL)
14167 goto out;
14168 for (n = 0; _control_host_interface_info.parent_struct.properties[n] != NULL; n++)
14169 {
14170 GDBusPropertyInfo *info = _control_host_interface_info.parent_struct.properties[n];
14171 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
14172 {
14173 GVariant *value;
14174 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);
14175 if (value != NULL)
14176 {
14177 g_variant_take_ref (value);
14178 g_variant_builder_add (&builder, "{sv}", info->name, value);
14179 g_variant_unref (value);
14180 }
14181 }
14182 }
14183out:
14184 return g_variant_builder_end (&builder);
14185}
14186
14187static void
14188control_host_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
14189{
14190}
14191
14192static void
14193_control_host_on_signal_booted (
14194 ControlHost *object)
14195{
14196 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
14197
14198 GList *connections, *l;
14199 GVariant *signal_variant;
14200 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
14201
14202 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
14203 for (l = connections; l != NULL; l = l->next)
14204 {
14205 GDBusConnection *connection = l->data;
14206 g_dbus_connection_emit_signal (connection,
14207 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Host", "Booted",
14208 signal_variant, NULL);
14209 }
14210 g_variant_unref (signal_variant);
14211 g_list_free_full (connections, g_object_unref);
14212}
14213
14214static void control_host_skeleton_iface_init (ControlHostIface *iface);
14215#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14216G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
14217 G_ADD_PRIVATE (ControlHostSkeleton)
14218 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
14219
14220#else
14221G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
14222 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
14223
14224#endif
14225static void
14226control_host_skeleton_finalize (GObject *object)
14227{
14228 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
14229 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
14230 if (skeleton->priv->changed_properties_idle_source != NULL)
14231 g_source_destroy (skeleton->priv->changed_properties_idle_source);
14232 g_main_context_unref (skeleton->priv->context);
14233 g_mutex_clear (&skeleton->priv->lock);
14234 G_OBJECT_CLASS (control_host_skeleton_parent_class)->finalize (object);
14235}
14236
14237static void
14238control_host_skeleton_init (ControlHostSkeleton *skeleton)
14239{
14240#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14241 skeleton->priv = control_host_skeleton_get_instance_private (skeleton);
14242#else
14243 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_HOST_SKELETON, ControlHostSkeletonPrivate);
14244#endif
14245
14246 g_mutex_init (&skeleton->priv->lock);
14247 skeleton->priv->context = g_main_context_ref_thread_default ();
14248}
14249
14250static void
14251control_host_skeleton_class_init (ControlHostSkeletonClass *klass)
14252{
14253 GObjectClass *gobject_class;
14254 GDBusInterfaceSkeletonClass *skeleton_class;
14255
14256 gobject_class = G_OBJECT_CLASS (klass);
14257 gobject_class->finalize = control_host_skeleton_finalize;
14258
14259 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
14260 skeleton_class->get_info = control_host_skeleton_dbus_interface_get_info;
14261 skeleton_class->get_properties = control_host_skeleton_dbus_interface_get_properties;
14262 skeleton_class->flush = control_host_skeleton_dbus_interface_flush;
14263 skeleton_class->get_vtable = control_host_skeleton_dbus_interface_get_vtable;
14264
14265#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
14266 g_type_class_add_private (klass, sizeof (ControlHostSkeletonPrivate));
14267#endif
14268}
14269
14270static void
14271control_host_skeleton_iface_init (ControlHostIface *iface)
14272{
14273 iface->booted = _control_host_on_signal_booted;
14274}
14275
14276/**
14277 * control_host_skeleton_new:
14278 *
14279 * 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>.
14280 *
14281 * Returns: (transfer full) (type ControlHostSkeleton): The skeleton object.
14282 */
14283ControlHost *
14284control_host_skeleton_new (void)
14285{
14286 return CONTROL_HOST (g_object_new (TYPE_CONTROL_HOST_SKELETON, NULL));
14287}
14288
14289/* ------------------------------------------------------------------------
14290 * Code for interface org.openbmc.control.Power
14291 * ------------------------------------------------------------------------
14292 */
14293
14294/**
14295 * SECTION:ControlPower
14296 * @title: ControlPower
14297 * @short_description: Generated C code for the org.openbmc.control.Power D-Bus interface
14298 *
14299 * 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.
14300 */
14301
14302/* ---- Introspection data for org.openbmc.control.Power ---- */
14303
14304static const _ExtendedGDBusArgInfo _control_power_method_info_set_power_state_IN_ARG_state =
14305{
14306 {
14307 -1,
14308 (gchar *) "state",
14309 (gchar *) "i",
14310 NULL
14311 },
14312 FALSE
14313};
14314
14315static const _ExtendedGDBusArgInfo * const _control_power_method_info_set_power_state_IN_ARG_pointers[] =
14316{
14317 &_control_power_method_info_set_power_state_IN_ARG_state,
14318 NULL
14319};
14320
14321static const _ExtendedGDBusMethodInfo _control_power_method_info_set_power_state =
14322{
14323 {
14324 -1,
14325 (gchar *) "setPowerState",
14326 (GDBusArgInfo **) &_control_power_method_info_set_power_state_IN_ARG_pointers,
14327 NULL,
14328 NULL
14329 },
14330 "handle-set-power-state",
14331 FALSE
14332};
14333
14334static const _ExtendedGDBusArgInfo _control_power_method_info_get_power_state_OUT_ARG_state =
14335{
14336 {
14337 -1,
14338 (gchar *) "state",
14339 (gchar *) "i",
14340 NULL
14341 },
14342 FALSE
14343};
14344
14345static const _ExtendedGDBusArgInfo * const _control_power_method_info_get_power_state_OUT_ARG_pointers[] =
14346{
14347 &_control_power_method_info_get_power_state_OUT_ARG_state,
14348 NULL
14349};
14350
14351static const _ExtendedGDBusMethodInfo _control_power_method_info_get_power_state =
14352{
14353 {
14354 -1,
14355 (gchar *) "getPowerState",
14356 NULL,
14357 (GDBusArgInfo **) &_control_power_method_info_get_power_state_OUT_ARG_pointers,
14358 NULL
14359 },
14360 "handle-get-power-state",
14361 FALSE
14362};
14363
14364static const _ExtendedGDBusMethodInfo * const _control_power_method_info_pointers[] =
14365{
14366 &_control_power_method_info_set_power_state,
14367 &_control_power_method_info_get_power_state,
14368 NULL
14369};
14370
14371static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_good =
14372{
14373 {
14374 -1,
14375 (gchar *) "PowerGood",
14376 NULL,
14377 NULL
14378 },
14379 "power-good"
14380};
14381
14382static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_lost =
14383{
14384 {
14385 -1,
14386 (gchar *) "PowerLost",
14387 NULL,
14388 NULL
14389 },
14390 "power-lost"
14391};
14392
14393static const _ExtendedGDBusSignalInfo * const _control_power_signal_info_pointers[] =
14394{
14395 &_control_power_signal_info_power_good,
14396 &_control_power_signal_info_power_lost,
14397 NULL
14398};
14399
14400static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood =
14401{
14402 {
14403 -1,
14404 (gchar *) "pgood",
14405 (gchar *) "i",
14406 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
14407 NULL
14408 },
14409 "pgood",
14410 FALSE
14411};
14412
14413static const _ExtendedGDBusPropertyInfo _control_power_property_info_state =
14414{
14415 {
14416 -1,
14417 (gchar *) "state",
14418 (gchar *) "i",
14419 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
14420 NULL
14421 },
14422 "state",
14423 FALSE
14424};
14425
Norman James32e74e22015-09-15 21:28:06 -050014426static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood_timeout =
14427{
14428 {
14429 -1,
14430 (gchar *) "pgood_timeout",
14431 (gchar *) "i",
14432 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
14433 NULL
14434 },
14435 "pgood-timeout",
14436 FALSE
14437};
14438
Norman James362a80f2015-09-14 14:04:39 -050014439static const _ExtendedGDBusPropertyInfo * const _control_power_property_info_pointers[] =
14440{
14441 &_control_power_property_info_pgood,
14442 &_control_power_property_info_state,
Norman James32e74e22015-09-15 21:28:06 -050014443 &_control_power_property_info_pgood_timeout,
Norman James362a80f2015-09-14 14:04:39 -050014444 NULL
14445};
14446
14447static const _ExtendedGDBusInterfaceInfo _control_power_interface_info =
14448{
14449 {
14450 -1,
14451 (gchar *) "org.openbmc.control.Power",
14452 (GDBusMethodInfo **) &_control_power_method_info_pointers,
14453 (GDBusSignalInfo **) &_control_power_signal_info_pointers,
14454 (GDBusPropertyInfo **) &_control_power_property_info_pointers,
14455 NULL
14456 },
14457 "control-power",
14458};
14459
14460
14461/**
14462 * control_power_interface_info:
14463 *
14464 * 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.
14465 *
14466 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
14467 */
14468GDBusInterfaceInfo *
14469control_power_interface_info (void)
14470{
14471 return (GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct;
14472}
14473
14474/**
14475 * control_power_override_properties:
14476 * @klass: The class structure for a #GObject<!-- -->-derived class.
14477 * @property_id_begin: The property id to assign to the first overridden property.
14478 *
14479 * Overrides all #GObject properties in the #ControlPower interface for a concrete class.
14480 * The properties are overridden in the order they are defined.
14481 *
14482 * Returns: The last property id.
14483 */
14484guint
14485control_power_override_properties (GObjectClass *klass, guint property_id_begin)
14486{
14487 g_object_class_override_property (klass, property_id_begin++, "pgood");
14488 g_object_class_override_property (klass, property_id_begin++, "state");
Norman James32e74e22015-09-15 21:28:06 -050014489 g_object_class_override_property (klass, property_id_begin++, "pgood-timeout");
Norman James362a80f2015-09-14 14:04:39 -050014490 return property_id_begin - 1;
14491}
14492
14493
14494
14495/**
14496 * ControlPower:
14497 *
14498 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
14499 */
14500
14501/**
14502 * ControlPowerIface:
14503 * @parent_iface: The parent interface.
14504 * @handle_get_power_state: Handler for the #ControlPower::handle-get-power-state signal.
14505 * @handle_set_power_state: Handler for the #ControlPower::handle-set-power-state signal.
14506 * @get_pgood: Getter for the #ControlPower:pgood property.
Norman James32e74e22015-09-15 21:28:06 -050014507 * @get_pgood_timeout: Getter for the #ControlPower:pgood-timeout property.
Norman James362a80f2015-09-14 14:04:39 -050014508 * @get_state: Getter for the #ControlPower:state property.
14509 * @power_good: Handler for the #ControlPower::power-good signal.
14510 * @power_lost: Handler for the #ControlPower::power-lost signal.
14511 *
14512 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
14513 */
14514
14515typedef ControlPowerIface ControlPowerInterface;
14516G_DEFINE_INTERFACE (ControlPower, control_power, G_TYPE_OBJECT);
14517
14518static void
14519control_power_default_init (ControlPowerIface *iface)
14520{
14521 /* GObject signals for incoming D-Bus method calls: */
14522 /**
14523 * ControlPower::handle-set-power-state:
14524 * @object: A #ControlPower.
14525 * @invocation: A #GDBusMethodInvocation.
14526 * @arg_state: Argument passed by remote caller.
14527 *
14528 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method.
14529 *
14530 * 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.
14531 *
14532 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14533 */
14534 g_signal_new ("handle-set-power-state",
14535 G_TYPE_FROM_INTERFACE (iface),
14536 G_SIGNAL_RUN_LAST,
14537 G_STRUCT_OFFSET (ControlPowerIface, handle_set_power_state),
14538 g_signal_accumulator_true_handled,
14539 NULL,
14540 g_cclosure_marshal_generic,
14541 G_TYPE_BOOLEAN,
14542 2,
14543 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
14544
14545 /**
14546 * ControlPower::handle-get-power-state:
14547 * @object: A #ControlPower.
14548 * @invocation: A #GDBusMethodInvocation.
14549 *
14550 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method.
14551 *
14552 * 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.
14553 *
14554 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14555 */
14556 g_signal_new ("handle-get-power-state",
14557 G_TYPE_FROM_INTERFACE (iface),
14558 G_SIGNAL_RUN_LAST,
14559 G_STRUCT_OFFSET (ControlPowerIface, handle_get_power_state),
14560 g_signal_accumulator_true_handled,
14561 NULL,
14562 g_cclosure_marshal_generic,
14563 G_TYPE_BOOLEAN,
14564 1,
14565 G_TYPE_DBUS_METHOD_INVOCATION);
14566
14567 /* GObject signals for received D-Bus signals: */
14568 /**
14569 * ControlPower::power-good:
14570 * @object: A #ControlPower.
14571 *
14572 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-control-Power.PowerGood">"PowerGood"</link> is received.
14573 *
14574 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal.
14575 */
14576 g_signal_new ("power-good",
14577 G_TYPE_FROM_INTERFACE (iface),
14578 G_SIGNAL_RUN_LAST,
14579 G_STRUCT_OFFSET (ControlPowerIface, power_good),
14580 NULL,
14581 NULL,
14582 g_cclosure_marshal_generic,
14583 G_TYPE_NONE,
14584 0);
14585
14586 /**
14587 * ControlPower::power-lost:
14588 * @object: A #ControlPower.
14589 *
14590 * 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.
14591 *
14592 * 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.
14593 */
14594 g_signal_new ("power-lost",
14595 G_TYPE_FROM_INTERFACE (iface),
14596 G_SIGNAL_RUN_LAST,
14597 G_STRUCT_OFFSET (ControlPowerIface, power_lost),
14598 NULL,
14599 NULL,
14600 g_cclosure_marshal_generic,
14601 G_TYPE_NONE,
14602 0);
14603
14604 /* GObject properties for D-Bus properties: */
14605 /**
14606 * ControlPower:pgood:
14607 *
14608 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link>.
14609 *
14610 * 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.
14611 */
14612 g_object_interface_install_property (iface,
14613 g_param_spec_int ("pgood", "pgood", "pgood", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
14614 /**
14615 * ControlPower:state:
14616 *
14617 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link>.
14618 *
14619 * 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.
14620 */
14621 g_object_interface_install_property (iface,
14622 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 -050014623 /**
14624 * ControlPower:pgood-timeout:
14625 *
14626 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link>.
14627 *
14628 * 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.
14629 */
14630 g_object_interface_install_property (iface,
14631 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 -050014632}
14633
14634/**
14635 * control_power_get_pgood: (skip)
14636 * @object: A #ControlPower.
14637 *
14638 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property.
14639 *
14640 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
14641 *
14642 * Returns: The property value.
14643 */
14644gint
14645control_power_get_pgood (ControlPower *object)
14646{
14647 return CONTROL_POWER_GET_IFACE (object)->get_pgood (object);
14648}
14649
14650/**
14651 * control_power_set_pgood: (skip)
14652 * @object: A #ControlPower.
14653 * @value: The value to set.
14654 *
14655 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property to @value.
14656 *
14657 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
14658 */
14659void
14660control_power_set_pgood (ControlPower *object, gint value)
14661{
14662 g_object_set (G_OBJECT (object), "pgood", value, NULL);
14663}
14664
14665/**
14666 * control_power_get_state: (skip)
14667 * @object: A #ControlPower.
14668 *
14669 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property.
14670 *
14671 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
14672 *
14673 * Returns: The property value.
14674 */
14675gint
14676control_power_get_state (ControlPower *object)
14677{
14678 return CONTROL_POWER_GET_IFACE (object)->get_state (object);
14679}
14680
14681/**
14682 * control_power_set_state: (skip)
14683 * @object: A #ControlPower.
14684 * @value: The value to set.
14685 *
14686 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property to @value.
14687 *
14688 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
14689 */
14690void
14691control_power_set_state (ControlPower *object, gint value)
14692{
14693 g_object_set (G_OBJECT (object), "state", value, NULL);
14694}
14695
14696/**
Norman James32e74e22015-09-15 21:28:06 -050014697 * control_power_get_pgood_timeout: (skip)
14698 * @object: A #ControlPower.
14699 *
14700 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property.
14701 *
14702 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
14703 *
14704 * Returns: The property value.
14705 */
14706gint
14707control_power_get_pgood_timeout (ControlPower *object)
14708{
14709 return CONTROL_POWER_GET_IFACE (object)->get_pgood_timeout (object);
14710}
14711
14712/**
14713 * control_power_set_pgood_timeout: (skip)
14714 * @object: A #ControlPower.
14715 * @value: The value to set.
14716 *
14717 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property to @value.
14718 *
14719 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
14720 */
14721void
14722control_power_set_pgood_timeout (ControlPower *object, gint value)
14723{
14724 g_object_set (G_OBJECT (object), "pgood-timeout", value, NULL);
14725}
14726
14727/**
Norman James362a80f2015-09-14 14:04:39 -050014728 * control_power_emit_power_good:
14729 * @object: A #ControlPower.
14730 *
14731 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerGood">"PowerGood"</link> D-Bus signal.
14732 */
14733void
14734control_power_emit_power_good (
14735 ControlPower *object)
14736{
14737 g_signal_emit_by_name (object, "power-good");
14738}
14739
14740/**
14741 * control_power_emit_power_lost:
14742 * @object: A #ControlPower.
14743 *
14744 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerLost">"PowerLost"</link> D-Bus signal.
14745 */
14746void
14747control_power_emit_power_lost (
14748 ControlPower *object)
14749{
14750 g_signal_emit_by_name (object, "power-lost");
14751}
14752
14753/**
14754 * control_power_call_set_power_state:
14755 * @proxy: A #ControlPowerProxy.
14756 * @arg_state: Argument to pass with the method invocation.
14757 * @cancellable: (allow-none): A #GCancellable or %NULL.
14758 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
14759 * @user_data: User data to pass to @callback.
14760 *
14761 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method on @proxy.
14762 * 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.
14763 * You can then call control_power_call_set_power_state_finish() to get the result of the operation.
14764 *
14765 * See control_power_call_set_power_state_sync() for the synchronous, blocking version of this method.
14766 */
14767void
14768control_power_call_set_power_state (
14769 ControlPower *proxy,
14770 gint arg_state,
14771 GCancellable *cancellable,
14772 GAsyncReadyCallback callback,
14773 gpointer user_data)
14774{
14775 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
14776 "setPowerState",
14777 g_variant_new ("(i)",
14778 arg_state),
14779 G_DBUS_CALL_FLAGS_NONE,
14780 -1,
14781 cancellable,
14782 callback,
14783 user_data);
14784}
14785
14786/**
14787 * control_power_call_set_power_state_finish:
14788 * @proxy: A #ControlPowerProxy.
14789 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_set_power_state().
14790 * @error: Return location for error or %NULL.
14791 *
14792 * Finishes an operation started with control_power_call_set_power_state().
14793 *
14794 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14795 */
14796gboolean
14797control_power_call_set_power_state_finish (
14798 ControlPower *proxy,
14799 GAsyncResult *res,
14800 GError **error)
14801{
14802 GVariant *_ret;
14803 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
14804 if (_ret == NULL)
14805 goto _out;
14806 g_variant_get (_ret,
14807 "()");
14808 g_variant_unref (_ret);
14809_out:
14810 return _ret != NULL;
14811}
14812
14813/**
14814 * control_power_call_set_power_state_sync:
14815 * @proxy: A #ControlPowerProxy.
14816 * @arg_state: Argument to pass with the method invocation.
14817 * @cancellable: (allow-none): A #GCancellable or %NULL.
14818 * @error: Return location for error or %NULL.
14819 *
14820 * 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.
14821 *
14822 * See control_power_call_set_power_state() for the asynchronous version of this method.
14823 *
14824 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14825 */
14826gboolean
14827control_power_call_set_power_state_sync (
14828 ControlPower *proxy,
14829 gint arg_state,
14830 GCancellable *cancellable,
14831 GError **error)
14832{
14833 GVariant *_ret;
14834 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
14835 "setPowerState",
14836 g_variant_new ("(i)",
14837 arg_state),
14838 G_DBUS_CALL_FLAGS_NONE,
14839 -1,
14840 cancellable,
14841 error);
14842 if (_ret == NULL)
14843 goto _out;
14844 g_variant_get (_ret,
14845 "()");
14846 g_variant_unref (_ret);
14847_out:
14848 return _ret != NULL;
14849}
14850
14851/**
14852 * control_power_call_get_power_state:
14853 * @proxy: A #ControlPowerProxy.
14854 * @cancellable: (allow-none): A #GCancellable or %NULL.
14855 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
14856 * @user_data: User data to pass to @callback.
14857 *
14858 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method on @proxy.
14859 * 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.
14860 * You can then call control_power_call_get_power_state_finish() to get the result of the operation.
14861 *
14862 * See control_power_call_get_power_state_sync() for the synchronous, blocking version of this method.
14863 */
14864void
14865control_power_call_get_power_state (
14866 ControlPower *proxy,
14867 GCancellable *cancellable,
14868 GAsyncReadyCallback callback,
14869 gpointer user_data)
14870{
14871 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
14872 "getPowerState",
14873 g_variant_new ("()"),
14874 G_DBUS_CALL_FLAGS_NONE,
14875 -1,
14876 cancellable,
14877 callback,
14878 user_data);
14879}
14880
14881/**
14882 * control_power_call_get_power_state_finish:
14883 * @proxy: A #ControlPowerProxy.
14884 * @out_state: (out): Return location for return parameter or %NULL to ignore.
14885 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_get_power_state().
14886 * @error: Return location for error or %NULL.
14887 *
14888 * Finishes an operation started with control_power_call_get_power_state().
14889 *
14890 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14891 */
14892gboolean
14893control_power_call_get_power_state_finish (
14894 ControlPower *proxy,
14895 gint *out_state,
14896 GAsyncResult *res,
14897 GError **error)
14898{
14899 GVariant *_ret;
14900 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
14901 if (_ret == NULL)
14902 goto _out;
14903 g_variant_get (_ret,
14904 "(i)",
14905 out_state);
14906 g_variant_unref (_ret);
14907_out:
14908 return _ret != NULL;
14909}
14910
14911/**
14912 * control_power_call_get_power_state_sync:
14913 * @proxy: A #ControlPowerProxy.
14914 * @out_state: (out): Return location for return parameter or %NULL to ignore.
14915 * @cancellable: (allow-none): A #GCancellable or %NULL.
14916 * @error: Return location for error or %NULL.
14917 *
14918 * 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.
14919 *
14920 * See control_power_call_get_power_state() for the asynchronous version of this method.
14921 *
14922 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14923 */
14924gboolean
14925control_power_call_get_power_state_sync (
14926 ControlPower *proxy,
14927 gint *out_state,
14928 GCancellable *cancellable,
14929 GError **error)
14930{
14931 GVariant *_ret;
14932 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
14933 "getPowerState",
14934 g_variant_new ("()"),
14935 G_DBUS_CALL_FLAGS_NONE,
14936 -1,
14937 cancellable,
14938 error);
14939 if (_ret == NULL)
14940 goto _out;
14941 g_variant_get (_ret,
14942 "(i)",
14943 out_state);
14944 g_variant_unref (_ret);
14945_out:
14946 return _ret != NULL;
14947}
14948
14949/**
14950 * control_power_complete_set_power_state:
14951 * @object: A #ControlPower.
14952 * @invocation: (transfer full): A #GDBusMethodInvocation.
14953 *
14954 * 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.
14955 *
14956 * This method will free @invocation, you cannot use it afterwards.
14957 */
14958void
14959control_power_complete_set_power_state (
14960 ControlPower *object,
14961 GDBusMethodInvocation *invocation)
14962{
14963 g_dbus_method_invocation_return_value (invocation,
14964 g_variant_new ("()"));
14965}
14966
14967/**
14968 * control_power_complete_get_power_state:
14969 * @object: A #ControlPower.
14970 * @invocation: (transfer full): A #GDBusMethodInvocation.
14971 * @state: Parameter to return.
14972 *
14973 * 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.
14974 *
14975 * This method will free @invocation, you cannot use it afterwards.
14976 */
14977void
14978control_power_complete_get_power_state (
14979 ControlPower *object,
14980 GDBusMethodInvocation *invocation,
14981 gint state)
14982{
14983 g_dbus_method_invocation_return_value (invocation,
14984 g_variant_new ("(i)",
14985 state));
14986}
14987
14988/* ------------------------------------------------------------------------ */
14989
14990/**
14991 * ControlPowerProxy:
14992 *
14993 * The #ControlPowerProxy structure contains only private data and should only be accessed using the provided API.
14994 */
14995
14996/**
14997 * ControlPowerProxyClass:
14998 * @parent_class: The parent class.
14999 *
15000 * Class structure for #ControlPowerProxy.
15001 */
15002
15003struct _ControlPowerProxyPrivate
15004{
15005 GData *qdata;
15006};
15007
15008static void control_power_proxy_iface_init (ControlPowerIface *iface);
15009
15010#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15011G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
15012 G_ADD_PRIVATE (ControlPowerProxy)
15013 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init));
15014
15015#else
15016G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
15017 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init));
15018
15019#endif
15020static void
15021control_power_proxy_finalize (GObject *object)
15022{
15023 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
15024 g_datalist_clear (&proxy->priv->qdata);
15025 G_OBJECT_CLASS (control_power_proxy_parent_class)->finalize (object);
15026}
15027
15028static void
15029control_power_proxy_get_property (GObject *object,
15030 guint prop_id,
15031 GValue *value,
15032 GParamSpec *pspec G_GNUC_UNUSED)
15033{
15034 const _ExtendedGDBusPropertyInfo *info;
15035 GVariant *variant;
Norman James32e74e22015-09-15 21:28:06 -050015036 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050015037 info = _control_power_property_info_pointers[prop_id - 1];
15038 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
15039 if (info->use_gvariant)
15040 {
15041 g_value_set_variant (value, variant);
15042 }
15043 else
15044 {
15045 if (variant != NULL)
15046 g_dbus_gvariant_to_gvalue (variant, value);
15047 }
15048 if (variant != NULL)
15049 g_variant_unref (variant);
15050}
15051
15052static void
15053control_power_proxy_set_property_cb (GDBusProxy *proxy,
15054 GAsyncResult *res,
15055 gpointer user_data)
15056{
15057 const _ExtendedGDBusPropertyInfo *info = user_data;
15058 GError *error;
15059 GVariant *_ret;
15060 error = NULL;
15061 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
15062 if (!_ret)
15063 {
15064 g_warning ("Error setting property '%s' on interface org.openbmc.control.Power: %s (%s, %d)",
15065 info->parent_struct.name,
15066 error->message, g_quark_to_string (error->domain), error->code);
15067 g_error_free (error);
15068 }
15069 else
15070 {
15071 g_variant_unref (_ret);
15072 }
15073}
15074
15075static void
15076control_power_proxy_set_property (GObject *object,
15077 guint prop_id,
15078 const GValue *value,
15079 GParamSpec *pspec G_GNUC_UNUSED)
15080{
15081 const _ExtendedGDBusPropertyInfo *info;
15082 GVariant *variant;
Norman James32e74e22015-09-15 21:28:06 -050015083 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050015084 info = _control_power_property_info_pointers[prop_id - 1];
15085 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
15086 g_dbus_proxy_call (G_DBUS_PROXY (object),
15087 "org.freedesktop.DBus.Properties.Set",
15088 g_variant_new ("(ssv)", "org.openbmc.control.Power", info->parent_struct.name, variant),
15089 G_DBUS_CALL_FLAGS_NONE,
15090 -1,
15091 NULL, (GAsyncReadyCallback) control_power_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
15092 g_variant_unref (variant);
15093}
15094
15095static void
15096control_power_proxy_g_signal (GDBusProxy *proxy,
15097 const gchar *sender_name G_GNUC_UNUSED,
15098 const gchar *signal_name,
15099 GVariant *parameters)
15100{
15101 _ExtendedGDBusSignalInfo *info;
15102 GVariantIter iter;
15103 GVariant *child;
15104 GValue *paramv;
15105 guint num_params;
15106 guint n;
15107 guint signal_id;
15108 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, signal_name);
15109 if (info == NULL)
15110 return;
15111 num_params = g_variant_n_children (parameters);
15112 paramv = g_new0 (GValue, num_params + 1);
15113 g_value_init (&paramv[0], TYPE_CONTROL_POWER);
15114 g_value_set_object (&paramv[0], proxy);
15115 g_variant_iter_init (&iter, parameters);
15116 n = 1;
15117 while ((child = g_variant_iter_next_value (&iter)) != NULL)
15118 {
15119 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
15120 if (arg_info->use_gvariant)
15121 {
15122 g_value_init (&paramv[n], G_TYPE_VARIANT);
15123 g_value_set_variant (&paramv[n], child);
15124 n++;
15125 }
15126 else
15127 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
15128 g_variant_unref (child);
15129 }
15130 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
15131 g_signal_emitv (paramv, signal_id, 0, NULL);
15132 for (n = 0; n < num_params + 1; n++)
15133 g_value_unset (&paramv[n]);
15134 g_free (paramv);
15135}
15136
15137static void
15138control_power_proxy_g_properties_changed (GDBusProxy *_proxy,
15139 GVariant *changed_properties,
15140 const gchar *const *invalidated_properties)
15141{
15142 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (_proxy);
15143 guint n;
15144 const gchar *key;
15145 GVariantIter *iter;
15146 _ExtendedGDBusPropertyInfo *info;
15147 g_variant_get (changed_properties, "a{sv}", &iter);
15148 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
15149 {
15150 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, key);
15151 g_datalist_remove_data (&proxy->priv->qdata, key);
15152 if (info != NULL)
15153 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
15154 }
15155 g_variant_iter_free (iter);
15156 for (n = 0; invalidated_properties[n] != NULL; n++)
15157 {
15158 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, invalidated_properties[n]);
15159 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
15160 if (info != NULL)
15161 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
15162 }
15163}
15164
15165static gint
15166control_power_proxy_get_pgood (ControlPower *object)
15167{
15168 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
15169 GVariant *variant;
15170 gint value = 0;
15171 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood");
15172 if (variant != NULL)
15173 {
15174 value = g_variant_get_int32 (variant);
15175 g_variant_unref (variant);
15176 }
15177 return value;
15178}
15179
15180static gint
15181control_power_proxy_get_state (ControlPower *object)
15182{
15183 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
15184 GVariant *variant;
15185 gint value = 0;
15186 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
15187 if (variant != NULL)
15188 {
15189 value = g_variant_get_int32 (variant);
15190 g_variant_unref (variant);
15191 }
15192 return value;
15193}
15194
Norman James32e74e22015-09-15 21:28:06 -050015195static gint
15196control_power_proxy_get_pgood_timeout (ControlPower *object)
15197{
15198 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
15199 GVariant *variant;
15200 gint value = 0;
15201 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood_timeout");
15202 if (variant != NULL)
15203 {
15204 value = g_variant_get_int32 (variant);
15205 g_variant_unref (variant);
15206 }
15207 return value;
15208}
15209
Norman James362a80f2015-09-14 14:04:39 -050015210static void
15211control_power_proxy_init (ControlPowerProxy *proxy)
15212{
15213#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15214 proxy->priv = control_power_proxy_get_instance_private (proxy);
15215#else
15216 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_POWER_PROXY, ControlPowerProxyPrivate);
15217#endif
15218
15219 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_power_interface_info ());
15220}
15221
15222static void
15223control_power_proxy_class_init (ControlPowerProxyClass *klass)
15224{
15225 GObjectClass *gobject_class;
15226 GDBusProxyClass *proxy_class;
15227
15228 gobject_class = G_OBJECT_CLASS (klass);
15229 gobject_class->finalize = control_power_proxy_finalize;
15230 gobject_class->get_property = control_power_proxy_get_property;
15231 gobject_class->set_property = control_power_proxy_set_property;
15232
15233 proxy_class = G_DBUS_PROXY_CLASS (klass);
15234 proxy_class->g_signal = control_power_proxy_g_signal;
15235 proxy_class->g_properties_changed = control_power_proxy_g_properties_changed;
15236
15237 control_power_override_properties (gobject_class, 1);
15238
15239#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
15240 g_type_class_add_private (klass, sizeof (ControlPowerProxyPrivate));
15241#endif
15242}
15243
15244static void
15245control_power_proxy_iface_init (ControlPowerIface *iface)
15246{
15247 iface->get_pgood = control_power_proxy_get_pgood;
15248 iface->get_state = control_power_proxy_get_state;
Norman James32e74e22015-09-15 21:28:06 -050015249 iface->get_pgood_timeout = control_power_proxy_get_pgood_timeout;
Norman James362a80f2015-09-14 14:04:39 -050015250}
15251
15252/**
15253 * control_power_proxy_new:
15254 * @connection: A #GDBusConnection.
15255 * @flags: Flags from the #GDBusProxyFlags enumeration.
15256 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
15257 * @object_path: An object path.
15258 * @cancellable: (allow-none): A #GCancellable or %NULL.
15259 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
15260 * @user_data: User data to pass to @callback.
15261 *
15262 * 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.
15263 *
15264 * 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.
15265 * You can then call control_power_proxy_new_finish() to get the result of the operation.
15266 *
15267 * See control_power_proxy_new_sync() for the synchronous, blocking version of this constructor.
15268 */
15269void
15270control_power_proxy_new (
15271 GDBusConnection *connection,
15272 GDBusProxyFlags flags,
15273 const gchar *name,
15274 const gchar *object_path,
15275 GCancellable *cancellable,
15276 GAsyncReadyCallback callback,
15277 gpointer user_data)
15278{
15279 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);
15280}
15281
15282/**
15283 * control_power_proxy_new_finish:
15284 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new().
15285 * @error: Return location for error or %NULL
15286 *
15287 * Finishes an operation started with control_power_proxy_new().
15288 *
15289 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
15290 */
15291ControlPower *
15292control_power_proxy_new_finish (
15293 GAsyncResult *res,
15294 GError **error)
15295{
15296 GObject *ret;
15297 GObject *source_object;
15298 source_object = g_async_result_get_source_object (res);
15299 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
15300 g_object_unref (source_object);
15301 if (ret != NULL)
15302 return CONTROL_POWER (ret);
15303 else
15304 return NULL;
15305}
15306
15307/**
15308 * control_power_proxy_new_sync:
15309 * @connection: A #GDBusConnection.
15310 * @flags: Flags from the #GDBusProxyFlags enumeration.
15311 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
15312 * @object_path: An object path.
15313 * @cancellable: (allow-none): A #GCancellable or %NULL.
15314 * @error: Return location for error or %NULL
15315 *
15316 * 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.
15317 *
15318 * The calling thread is blocked until a reply is received.
15319 *
15320 * See control_power_proxy_new() for the asynchronous version of this constructor.
15321 *
15322 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
15323 */
15324ControlPower *
15325control_power_proxy_new_sync (
15326 GDBusConnection *connection,
15327 GDBusProxyFlags flags,
15328 const gchar *name,
15329 const gchar *object_path,
15330 GCancellable *cancellable,
15331 GError **error)
15332{
15333 GInitable *ret;
15334 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);
15335 if (ret != NULL)
15336 return CONTROL_POWER (ret);
15337 else
15338 return NULL;
15339}
15340
15341
15342/**
15343 * control_power_proxy_new_for_bus:
15344 * @bus_type: A #GBusType.
15345 * @flags: Flags from the #GDBusProxyFlags enumeration.
15346 * @name: A bus name (well-known or unique).
15347 * @object_path: An object path.
15348 * @cancellable: (allow-none): A #GCancellable or %NULL.
15349 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
15350 * @user_data: User data to pass to @callback.
15351 *
15352 * Like control_power_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
15353 *
15354 * 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.
15355 * You can then call control_power_proxy_new_for_bus_finish() to get the result of the operation.
15356 *
15357 * See control_power_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
15358 */
15359void
15360control_power_proxy_new_for_bus (
15361 GBusType bus_type,
15362 GDBusProxyFlags flags,
15363 const gchar *name,
15364 const gchar *object_path,
15365 GCancellable *cancellable,
15366 GAsyncReadyCallback callback,
15367 gpointer user_data)
15368{
15369 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);
15370}
15371
15372/**
15373 * control_power_proxy_new_for_bus_finish:
15374 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new_for_bus().
15375 * @error: Return location for error or %NULL
15376 *
15377 * Finishes an operation started with control_power_proxy_new_for_bus().
15378 *
15379 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
15380 */
15381ControlPower *
15382control_power_proxy_new_for_bus_finish (
15383 GAsyncResult *res,
15384 GError **error)
15385{
15386 GObject *ret;
15387 GObject *source_object;
15388 source_object = g_async_result_get_source_object (res);
15389 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
15390 g_object_unref (source_object);
15391 if (ret != NULL)
15392 return CONTROL_POWER (ret);
15393 else
15394 return NULL;
15395}
15396
15397/**
15398 * control_power_proxy_new_for_bus_sync:
15399 * @bus_type: A #GBusType.
15400 * @flags: Flags from the #GDBusProxyFlags enumeration.
15401 * @name: A bus name (well-known or unique).
15402 * @object_path: An object path.
15403 * @cancellable: (allow-none): A #GCancellable or %NULL.
15404 * @error: Return location for error or %NULL
15405 *
15406 * Like control_power_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
15407 *
15408 * The calling thread is blocked until a reply is received.
15409 *
15410 * See control_power_proxy_new_for_bus() for the asynchronous version of this constructor.
15411 *
15412 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
15413 */
15414ControlPower *
15415control_power_proxy_new_for_bus_sync (
15416 GBusType bus_type,
15417 GDBusProxyFlags flags,
15418 const gchar *name,
15419 const gchar *object_path,
15420 GCancellable *cancellable,
15421 GError **error)
15422{
15423 GInitable *ret;
15424 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);
15425 if (ret != NULL)
15426 return CONTROL_POWER (ret);
15427 else
15428 return NULL;
15429}
15430
15431
15432/* ------------------------------------------------------------------------ */
15433
15434/**
15435 * ControlPowerSkeleton:
15436 *
15437 * The #ControlPowerSkeleton structure contains only private data and should only be accessed using the provided API.
15438 */
15439
15440/**
15441 * ControlPowerSkeletonClass:
15442 * @parent_class: The parent class.
15443 *
15444 * Class structure for #ControlPowerSkeleton.
15445 */
15446
15447struct _ControlPowerSkeletonPrivate
15448{
15449 GValue *properties;
15450 GList *changed_properties;
15451 GSource *changed_properties_idle_source;
15452 GMainContext *context;
15453 GMutex lock;
15454};
15455
15456static void
15457_control_power_skeleton_handle_method_call (
15458 GDBusConnection *connection G_GNUC_UNUSED,
15459 const gchar *sender G_GNUC_UNUSED,
15460 const gchar *object_path G_GNUC_UNUSED,
15461 const gchar *interface_name,
15462 const gchar *method_name,
15463 GVariant *parameters,
15464 GDBusMethodInvocation *invocation,
15465 gpointer user_data)
15466{
15467 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
15468 _ExtendedGDBusMethodInfo *info;
15469 GVariantIter iter;
15470 GVariant *child;
15471 GValue *paramv;
15472 guint num_params;
15473 guint num_extra;
15474 guint n;
15475 guint signal_id;
15476 GValue return_value = G_VALUE_INIT;
15477 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
15478 g_assert (info != NULL);
15479 num_params = g_variant_n_children (parameters);
15480 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
15481 n = 0;
15482 g_value_init (&paramv[n], TYPE_CONTROL_POWER);
15483 g_value_set_object (&paramv[n++], skeleton);
15484 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
15485 g_value_set_object (&paramv[n++], invocation);
15486 if (info->pass_fdlist)
15487 {
15488#ifdef G_OS_UNIX
15489 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
15490 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
15491#else
15492 g_assert_not_reached ();
15493#endif
15494 }
15495 g_variant_iter_init (&iter, parameters);
15496 while ((child = g_variant_iter_next_value (&iter)) != NULL)
15497 {
15498 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
15499 if (arg_info->use_gvariant)
15500 {
15501 g_value_init (&paramv[n], G_TYPE_VARIANT);
15502 g_value_set_variant (&paramv[n], child);
15503 n++;
15504 }
15505 else
15506 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
15507 g_variant_unref (child);
15508 }
15509 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
15510 g_value_init (&return_value, G_TYPE_BOOLEAN);
15511 g_signal_emitv (paramv, signal_id, 0, &return_value);
15512 if (!g_value_get_boolean (&return_value))
15513 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);
15514 g_value_unset (&return_value);
15515 for (n = 0; n < num_params + num_extra; n++)
15516 g_value_unset (&paramv[n]);
15517 g_free (paramv);
15518}
15519
15520static GVariant *
15521_control_power_skeleton_handle_get_property (
15522 GDBusConnection *connection G_GNUC_UNUSED,
15523 const gchar *sender G_GNUC_UNUSED,
15524 const gchar *object_path G_GNUC_UNUSED,
15525 const gchar *interface_name G_GNUC_UNUSED,
15526 const gchar *property_name,
15527 GError **error,
15528 gpointer user_data)
15529{
15530 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
15531 GValue value = G_VALUE_INIT;
15532 GParamSpec *pspec;
15533 _ExtendedGDBusPropertyInfo *info;
15534 GVariant *ret;
15535 ret = NULL;
15536 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
15537 g_assert (info != NULL);
15538 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
15539 if (pspec == NULL)
15540 {
15541 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
15542 }
15543 else
15544 {
15545 g_value_init (&value, pspec->value_type);
15546 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
15547 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
15548 g_value_unset (&value);
15549 }
15550 return ret;
15551}
15552
15553static gboolean
15554_control_power_skeleton_handle_set_property (
15555 GDBusConnection *connection G_GNUC_UNUSED,
15556 const gchar *sender G_GNUC_UNUSED,
15557 const gchar *object_path G_GNUC_UNUSED,
15558 const gchar *interface_name G_GNUC_UNUSED,
15559 const gchar *property_name,
15560 GVariant *variant,
15561 GError **error,
15562 gpointer user_data)
15563{
15564 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
15565 GValue value = G_VALUE_INIT;
15566 GParamSpec *pspec;
15567 _ExtendedGDBusPropertyInfo *info;
15568 gboolean ret;
15569 ret = FALSE;
15570 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
15571 g_assert (info != NULL);
15572 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
15573 if (pspec == NULL)
15574 {
15575 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
15576 }
15577 else
15578 {
15579 if (info->use_gvariant)
15580 g_value_set_variant (&value, variant);
15581 else
15582 g_dbus_gvariant_to_gvalue (variant, &value);
15583 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
15584 g_value_unset (&value);
15585 ret = TRUE;
15586 }
15587 return ret;
15588}
15589
15590static const GDBusInterfaceVTable _control_power_skeleton_vtable =
15591{
15592 _control_power_skeleton_handle_method_call,
15593 _control_power_skeleton_handle_get_property,
15594 _control_power_skeleton_handle_set_property,
15595 {NULL}
15596};
15597
15598static GDBusInterfaceInfo *
15599control_power_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
15600{
15601 return control_power_interface_info ();
15602}
15603
15604static GDBusInterfaceVTable *
15605control_power_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
15606{
15607 return (GDBusInterfaceVTable *) &_control_power_skeleton_vtable;
15608}
15609
15610static GVariant *
15611control_power_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
15612{
15613 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
15614
15615 GVariantBuilder builder;
15616 guint n;
15617 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
15618 if (_control_power_interface_info.parent_struct.properties == NULL)
15619 goto out;
15620 for (n = 0; _control_power_interface_info.parent_struct.properties[n] != NULL; n++)
15621 {
15622 GDBusPropertyInfo *info = _control_power_interface_info.parent_struct.properties[n];
15623 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
15624 {
15625 GVariant *value;
15626 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);
15627 if (value != NULL)
15628 {
15629 g_variant_take_ref (value);
15630 g_variant_builder_add (&builder, "{sv}", info->name, value);
15631 g_variant_unref (value);
15632 }
15633 }
15634 }
15635out:
15636 return g_variant_builder_end (&builder);
15637}
15638
15639static gboolean _control_power_emit_changed (gpointer user_data);
15640
15641static void
15642control_power_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
15643{
15644 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
15645 gboolean emit_changed = FALSE;
15646
15647 g_mutex_lock (&skeleton->priv->lock);
15648 if (skeleton->priv->changed_properties_idle_source != NULL)
15649 {
15650 g_source_destroy (skeleton->priv->changed_properties_idle_source);
15651 skeleton->priv->changed_properties_idle_source = NULL;
15652 emit_changed = TRUE;
15653 }
15654 g_mutex_unlock (&skeleton->priv->lock);
15655
15656 if (emit_changed)
15657 _control_power_emit_changed (skeleton);
15658}
15659
15660static void
15661_control_power_on_signal_power_good (
15662 ControlPower *object)
15663{
15664 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
15665
15666 GList *connections, *l;
15667 GVariant *signal_variant;
15668 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
15669
15670 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
15671 for (l = connections; l != NULL; l = l->next)
15672 {
15673 GDBusConnection *connection = l->data;
15674 g_dbus_connection_emit_signal (connection,
15675 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerGood",
15676 signal_variant, NULL);
15677 }
15678 g_variant_unref (signal_variant);
15679 g_list_free_full (connections, g_object_unref);
15680}
15681
15682static void
15683_control_power_on_signal_power_lost (
15684 ControlPower *object)
15685{
15686 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
15687
15688 GList *connections, *l;
15689 GVariant *signal_variant;
15690 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
15691
15692 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
15693 for (l = connections; l != NULL; l = l->next)
15694 {
15695 GDBusConnection *connection = l->data;
15696 g_dbus_connection_emit_signal (connection,
15697 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerLost",
15698 signal_variant, NULL);
15699 }
15700 g_variant_unref (signal_variant);
15701 g_list_free_full (connections, g_object_unref);
15702}
15703
15704static void control_power_skeleton_iface_init (ControlPowerIface *iface);
15705#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15706G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
15707 G_ADD_PRIVATE (ControlPowerSkeleton)
15708 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init));
15709
15710#else
15711G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
15712 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init));
15713
15714#endif
15715static void
15716control_power_skeleton_finalize (GObject *object)
15717{
15718 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
15719 guint n;
Norman James32e74e22015-09-15 21:28:06 -050015720 for (n = 0; n < 3; n++)
Norman James362a80f2015-09-14 14:04:39 -050015721 g_value_unset (&skeleton->priv->properties[n]);
15722 g_free (skeleton->priv->properties);
15723 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
15724 if (skeleton->priv->changed_properties_idle_source != NULL)
15725 g_source_destroy (skeleton->priv->changed_properties_idle_source);
15726 g_main_context_unref (skeleton->priv->context);
15727 g_mutex_clear (&skeleton->priv->lock);
15728 G_OBJECT_CLASS (control_power_skeleton_parent_class)->finalize (object);
15729}
15730
15731static void
15732control_power_skeleton_get_property (GObject *object,
15733 guint prop_id,
15734 GValue *value,
15735 GParamSpec *pspec G_GNUC_UNUSED)
15736{
15737 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
Norman James32e74e22015-09-15 21:28:06 -050015738 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050015739 g_mutex_lock (&skeleton->priv->lock);
15740 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
15741 g_mutex_unlock (&skeleton->priv->lock);
15742}
15743
15744static gboolean
15745_control_power_emit_changed (gpointer user_data)
15746{
15747 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
15748 GList *l;
15749 GVariantBuilder builder;
15750 GVariantBuilder invalidated_builder;
15751 guint num_changes;
15752
15753 g_mutex_lock (&skeleton->priv->lock);
15754 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
15755 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
15756 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
15757 {
15758 ChangedProperty *cp = l->data;
15759 GVariant *variant;
15760 const GValue *cur_value;
15761
15762 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
15763 if (!_g_value_equal (cur_value, &cp->orig_value))
15764 {
15765 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
15766 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
15767 g_variant_unref (variant);
15768 num_changes++;
15769 }
15770 }
15771 if (num_changes > 0)
15772 {
15773 GList *connections, *ll;
15774 GVariant *signal_variant;
15775 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.control.Power",
15776 &builder, &invalidated_builder));
15777 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
15778 for (ll = connections; ll != NULL; ll = ll->next)
15779 {
15780 GDBusConnection *connection = ll->data;
15781
15782 g_dbus_connection_emit_signal (connection,
15783 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
15784 "org.freedesktop.DBus.Properties",
15785 "PropertiesChanged",
15786 signal_variant,
15787 NULL);
15788 }
15789 g_variant_unref (signal_variant);
15790 g_list_free_full (connections, g_object_unref);
15791 }
15792 else
15793 {
15794 g_variant_builder_clear (&builder);
15795 g_variant_builder_clear (&invalidated_builder);
15796 }
15797 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
15798 skeleton->priv->changed_properties = NULL;
15799 skeleton->priv->changed_properties_idle_source = NULL;
15800 g_mutex_unlock (&skeleton->priv->lock);
15801 return FALSE;
15802}
15803
15804static void
15805_control_power_schedule_emit_changed (ControlPowerSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
15806{
15807 ChangedProperty *cp;
15808 GList *l;
15809 cp = NULL;
15810 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
15811 {
15812 ChangedProperty *i_cp = l->data;
15813 if (i_cp->info == info)
15814 {
15815 cp = i_cp;
15816 break;
15817 }
15818 }
15819 if (cp == NULL)
15820 {
15821 cp = g_new0 (ChangedProperty, 1);
15822 cp->prop_id = prop_id;
15823 cp->info = info;
15824 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
15825 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
15826 g_value_copy (orig_value, &cp->orig_value);
15827 }
15828}
15829
15830static void
15831control_power_skeleton_notify (GObject *object,
15832 GParamSpec *pspec G_GNUC_UNUSED)
15833{
15834 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
15835 g_mutex_lock (&skeleton->priv->lock);
15836 if (skeleton->priv->changed_properties != NULL &&
15837 skeleton->priv->changed_properties_idle_source == NULL)
15838 {
15839 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
15840 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
15841 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_power_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
15842 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
15843 g_source_unref (skeleton->priv->changed_properties_idle_source);
15844 }
15845 g_mutex_unlock (&skeleton->priv->lock);
15846}
15847
15848static void
15849control_power_skeleton_set_property (GObject *object,
15850 guint prop_id,
15851 const GValue *value,
15852 GParamSpec *pspec)
15853{
15854 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
Norman James32e74e22015-09-15 21:28:06 -050015855 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050015856 g_mutex_lock (&skeleton->priv->lock);
15857 g_object_freeze_notify (object);
15858 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
15859 {
15860 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
15861 _control_power_schedule_emit_changed (skeleton, _control_power_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
15862 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
15863 g_object_notify_by_pspec (object, pspec);
15864 }
15865 g_mutex_unlock (&skeleton->priv->lock);
15866 g_object_thaw_notify (object);
15867}
15868
15869static void
15870control_power_skeleton_init (ControlPowerSkeleton *skeleton)
15871{
15872#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15873 skeleton->priv = control_power_skeleton_get_instance_private (skeleton);
15874#else
15875 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_POWER_SKELETON, ControlPowerSkeletonPrivate);
15876#endif
15877
15878 g_mutex_init (&skeleton->priv->lock);
15879 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James32e74e22015-09-15 21:28:06 -050015880 skeleton->priv->properties = g_new0 (GValue, 3);
Norman James362a80f2015-09-14 14:04:39 -050015881 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
15882 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
Norman James32e74e22015-09-15 21:28:06 -050015883 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
Norman James362a80f2015-09-14 14:04:39 -050015884}
15885
15886static gint
15887control_power_skeleton_get_pgood (ControlPower *object)
15888{
15889 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
15890 gint value;
15891 g_mutex_lock (&skeleton->priv->lock);
15892 value = g_value_get_int (&(skeleton->priv->properties[0]));
15893 g_mutex_unlock (&skeleton->priv->lock);
15894 return value;
15895}
15896
15897static gint
15898control_power_skeleton_get_state (ControlPower *object)
15899{
15900 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
15901 gint value;
15902 g_mutex_lock (&skeleton->priv->lock);
15903 value = g_value_get_int (&(skeleton->priv->properties[1]));
15904 g_mutex_unlock (&skeleton->priv->lock);
15905 return value;
15906}
15907
Norman James32e74e22015-09-15 21:28:06 -050015908static gint
15909control_power_skeleton_get_pgood_timeout (ControlPower *object)
15910{
15911 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
15912 gint value;
15913 g_mutex_lock (&skeleton->priv->lock);
15914 value = g_value_get_int (&(skeleton->priv->properties[2]));
15915 g_mutex_unlock (&skeleton->priv->lock);
15916 return value;
15917}
15918
Norman James362a80f2015-09-14 14:04:39 -050015919static void
15920control_power_skeleton_class_init (ControlPowerSkeletonClass *klass)
15921{
15922 GObjectClass *gobject_class;
15923 GDBusInterfaceSkeletonClass *skeleton_class;
15924
15925 gobject_class = G_OBJECT_CLASS (klass);
15926 gobject_class->finalize = control_power_skeleton_finalize;
15927 gobject_class->get_property = control_power_skeleton_get_property;
15928 gobject_class->set_property = control_power_skeleton_set_property;
15929 gobject_class->notify = control_power_skeleton_notify;
15930
15931
15932 control_power_override_properties (gobject_class, 1);
15933
15934 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
15935 skeleton_class->get_info = control_power_skeleton_dbus_interface_get_info;
15936 skeleton_class->get_properties = control_power_skeleton_dbus_interface_get_properties;
15937 skeleton_class->flush = control_power_skeleton_dbus_interface_flush;
15938 skeleton_class->get_vtable = control_power_skeleton_dbus_interface_get_vtable;
15939
15940#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
15941 g_type_class_add_private (klass, sizeof (ControlPowerSkeletonPrivate));
15942#endif
15943}
15944
15945static void
15946control_power_skeleton_iface_init (ControlPowerIface *iface)
15947{
15948 iface->power_good = _control_power_on_signal_power_good;
15949 iface->power_lost = _control_power_on_signal_power_lost;
15950 iface->get_pgood = control_power_skeleton_get_pgood;
15951 iface->get_state = control_power_skeleton_get_state;
Norman James32e74e22015-09-15 21:28:06 -050015952 iface->get_pgood_timeout = control_power_skeleton_get_pgood_timeout;
Norman James362a80f2015-09-14 14:04:39 -050015953}
15954
15955/**
15956 * control_power_skeleton_new:
15957 *
15958 * 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>.
15959 *
15960 * Returns: (transfer full) (type ControlPowerSkeleton): The skeleton object.
15961 */
15962ControlPower *
15963control_power_skeleton_new (void)
15964{
15965 return CONTROL_POWER (g_object_new (TYPE_CONTROL_POWER_SKELETON, NULL));
15966}
15967
15968/* ------------------------------------------------------------------------
15969 * Code for interface org.openbmc.Watchdog
15970 * ------------------------------------------------------------------------
15971 */
15972
15973/**
15974 * SECTION:Watchdog
15975 * @title: Watchdog
15976 * @short_description: Generated C code for the org.openbmc.Watchdog D-Bus interface
15977 *
15978 * 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.
15979 */
15980
15981/* ---- Introspection data for org.openbmc.Watchdog ---- */
15982
15983static const _ExtendedGDBusMethodInfo _watchdog_method_info_start =
15984{
15985 {
15986 -1,
15987 (gchar *) "start",
15988 NULL,
15989 NULL,
15990 NULL
15991 },
15992 "handle-start",
15993 FALSE
15994};
15995
15996static const _ExtendedGDBusMethodInfo _watchdog_method_info_poke =
15997{
15998 {
15999 -1,
16000 (gchar *) "poke",
16001 NULL,
16002 NULL,
16003 NULL
16004 },
16005 "handle-poke",
16006 FALSE
16007};
16008
16009static const _ExtendedGDBusMethodInfo _watchdog_method_info_stop =
16010{
16011 {
16012 -1,
16013 (gchar *) "stop",
16014 NULL,
16015 NULL,
16016 NULL
16017 },
16018 "handle-stop",
16019 FALSE
16020};
16021
16022static const _ExtendedGDBusMethodInfo * const _watchdog_method_info_pointers[] =
16023{
16024 &_watchdog_method_info_start,
16025 &_watchdog_method_info_poke,
16026 &_watchdog_method_info_stop,
16027 NULL
16028};
16029
16030static const _ExtendedGDBusSignalInfo _watchdog_signal_info_watchdog_error =
16031{
16032 {
16033 -1,
16034 (gchar *) "WatchdogError",
16035 NULL,
16036 NULL
16037 },
16038 "watchdog-error"
16039};
16040
16041static const _ExtendedGDBusSignalInfo * const _watchdog_signal_info_pointers[] =
16042{
16043 &_watchdog_signal_info_watchdog_error,
16044 NULL
16045};
16046
16047static const _ExtendedGDBusPropertyInfo _watchdog_property_info_watchdog =
16048{
16049 {
16050 -1,
16051 (gchar *) "watchdog",
16052 (gchar *) "i",
16053 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
16054 NULL
16055 },
16056 "watchdog",
16057 FALSE
16058};
16059
16060static const _ExtendedGDBusPropertyInfo _watchdog_property_info_poll_interval =
16061{
16062 {
16063 -1,
16064 (gchar *) "poll_interval",
16065 (gchar *) "i",
16066 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
16067 NULL
16068 },
16069 "poll-interval",
16070 FALSE
16071};
16072
16073static const _ExtendedGDBusPropertyInfo * const _watchdog_property_info_pointers[] =
16074{
16075 &_watchdog_property_info_watchdog,
16076 &_watchdog_property_info_poll_interval,
16077 NULL
16078};
16079
16080static const _ExtendedGDBusInterfaceInfo _watchdog_interface_info =
16081{
16082 {
16083 -1,
16084 (gchar *) "org.openbmc.Watchdog",
16085 (GDBusMethodInfo **) &_watchdog_method_info_pointers,
16086 (GDBusSignalInfo **) &_watchdog_signal_info_pointers,
16087 (GDBusPropertyInfo **) &_watchdog_property_info_pointers,
16088 NULL
16089 },
16090 "watchdog",
16091};
16092
16093
16094/**
16095 * watchdog_interface_info:
16096 *
16097 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> D-Bus interface.
16098 *
16099 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
16100 */
16101GDBusInterfaceInfo *
16102watchdog_interface_info (void)
16103{
16104 return (GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct;
16105}
16106
16107/**
16108 * watchdog_override_properties:
16109 * @klass: The class structure for a #GObject<!-- -->-derived class.
16110 * @property_id_begin: The property id to assign to the first overridden property.
16111 *
16112 * Overrides all #GObject properties in the #Watchdog interface for a concrete class.
16113 * The properties are overridden in the order they are defined.
16114 *
16115 * Returns: The last property id.
16116 */
16117guint
16118watchdog_override_properties (GObjectClass *klass, guint property_id_begin)
16119{
16120 g_object_class_override_property (klass, property_id_begin++, "watchdog");
16121 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
16122 return property_id_begin - 1;
16123}
16124
16125
16126
16127/**
16128 * Watchdog:
16129 *
16130 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
16131 */
16132
16133/**
16134 * WatchdogIface:
16135 * @parent_iface: The parent interface.
16136 * @handle_poke: Handler for the #Watchdog::handle-poke signal.
16137 * @handle_start: Handler for the #Watchdog::handle-start signal.
16138 * @handle_stop: Handler for the #Watchdog::handle-stop signal.
16139 * @get_poll_interval: Getter for the #Watchdog:poll-interval property.
16140 * @get_watchdog: Getter for the #Watchdog:watchdog property.
16141 * @watchdog_error: Handler for the #Watchdog::watchdog-error signal.
16142 *
16143 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
16144 */
16145
16146typedef WatchdogIface WatchdogInterface;
16147G_DEFINE_INTERFACE (Watchdog, watchdog, G_TYPE_OBJECT);
16148
16149static void
16150watchdog_default_init (WatchdogIface *iface)
16151{
16152 /* GObject signals for incoming D-Bus method calls: */
16153 /**
16154 * Watchdog::handle-start:
16155 * @object: A #Watchdog.
16156 * @invocation: A #GDBusMethodInvocation.
16157 *
16158 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method.
16159 *
16160 * 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.
16161 *
16162 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
16163 */
16164 g_signal_new ("handle-start",
16165 G_TYPE_FROM_INTERFACE (iface),
16166 G_SIGNAL_RUN_LAST,
16167 G_STRUCT_OFFSET (WatchdogIface, handle_start),
16168 g_signal_accumulator_true_handled,
16169 NULL,
16170 g_cclosure_marshal_generic,
16171 G_TYPE_BOOLEAN,
16172 1,
16173 G_TYPE_DBUS_METHOD_INVOCATION);
16174
16175 /**
16176 * Watchdog::handle-poke:
16177 * @object: A #Watchdog.
16178 * @invocation: A #GDBusMethodInvocation.
16179 *
16180 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method.
16181 *
16182 * 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.
16183 *
16184 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
16185 */
16186 g_signal_new ("handle-poke",
16187 G_TYPE_FROM_INTERFACE (iface),
16188 G_SIGNAL_RUN_LAST,
16189 G_STRUCT_OFFSET (WatchdogIface, handle_poke),
16190 g_signal_accumulator_true_handled,
16191 NULL,
16192 g_cclosure_marshal_generic,
16193 G_TYPE_BOOLEAN,
16194 1,
16195 G_TYPE_DBUS_METHOD_INVOCATION);
16196
16197 /**
16198 * Watchdog::handle-stop:
16199 * @object: A #Watchdog.
16200 * @invocation: A #GDBusMethodInvocation.
16201 *
16202 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method.
16203 *
16204 * 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.
16205 *
16206 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
16207 */
16208 g_signal_new ("handle-stop",
16209 G_TYPE_FROM_INTERFACE (iface),
16210 G_SIGNAL_RUN_LAST,
16211 G_STRUCT_OFFSET (WatchdogIface, handle_stop),
16212 g_signal_accumulator_true_handled,
16213 NULL,
16214 g_cclosure_marshal_generic,
16215 G_TYPE_BOOLEAN,
16216 1,
16217 G_TYPE_DBUS_METHOD_INVOCATION);
16218
16219 /* GObject signals for received D-Bus signals: */
16220 /**
16221 * Watchdog::watchdog-error:
16222 * @object: A #Watchdog.
16223 *
16224 * 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.
16225 *
16226 * 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.
16227 */
16228 g_signal_new ("watchdog-error",
16229 G_TYPE_FROM_INTERFACE (iface),
16230 G_SIGNAL_RUN_LAST,
16231 G_STRUCT_OFFSET (WatchdogIface, watchdog_error),
16232 NULL,
16233 NULL,
16234 g_cclosure_marshal_generic,
16235 G_TYPE_NONE,
16236 0);
16237
16238 /* GObject properties for D-Bus properties: */
16239 /**
16240 * Watchdog:watchdog:
16241 *
16242 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link>.
16243 *
16244 * 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.
16245 */
16246 g_object_interface_install_property (iface,
16247 g_param_spec_int ("watchdog", "watchdog", "watchdog", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
16248 /**
16249 * Watchdog:poll-interval:
16250 *
16251 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link>.
16252 *
16253 * 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.
16254 */
16255 g_object_interface_install_property (iface,
16256 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
16257}
16258
16259/**
16260 * watchdog_get_watchdog: (skip)
16261 * @object: A #Watchdog.
16262 *
16263 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property.
16264 *
16265 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
16266 *
16267 * Returns: The property value.
16268 */
16269gint
16270watchdog_get_watchdog (Watchdog *object)
16271{
16272 return WATCHDOG_GET_IFACE (object)->get_watchdog (object);
16273}
16274
16275/**
16276 * watchdog_set_watchdog: (skip)
16277 * @object: A #Watchdog.
16278 * @value: The value to set.
16279 *
16280 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property to @value.
16281 *
16282 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
16283 */
16284void
16285watchdog_set_watchdog (Watchdog *object, gint value)
16286{
16287 g_object_set (G_OBJECT (object), "watchdog", value, NULL);
16288}
16289
16290/**
16291 * watchdog_get_poll_interval: (skip)
16292 * @object: A #Watchdog.
16293 *
16294 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property.
16295 *
16296 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
16297 *
16298 * Returns: The property value.
16299 */
16300gint
16301watchdog_get_poll_interval (Watchdog *object)
16302{
16303 return WATCHDOG_GET_IFACE (object)->get_poll_interval (object);
16304}
16305
16306/**
16307 * watchdog_set_poll_interval: (skip)
16308 * @object: A #Watchdog.
16309 * @value: The value to set.
16310 *
16311 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property to @value.
16312 *
16313 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
16314 */
16315void
16316watchdog_set_poll_interval (Watchdog *object, gint value)
16317{
16318 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
16319}
16320
16321/**
16322 * watchdog_emit_watchdog_error:
16323 * @object: A #Watchdog.
16324 *
16325 * Emits the <link linkend="gdbus-signal-org-openbmc-Watchdog.WatchdogError">"WatchdogError"</link> D-Bus signal.
16326 */
16327void
16328watchdog_emit_watchdog_error (
16329 Watchdog *object)
16330{
16331 g_signal_emit_by_name (object, "watchdog-error");
16332}
16333
16334/**
16335 * watchdog_call_start:
16336 * @proxy: A #WatchdogProxy.
16337 * @cancellable: (allow-none): A #GCancellable or %NULL.
16338 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
16339 * @user_data: User data to pass to @callback.
16340 *
16341 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method on @proxy.
16342 * 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.
16343 * You can then call watchdog_call_start_finish() to get the result of the operation.
16344 *
16345 * See watchdog_call_start_sync() for the synchronous, blocking version of this method.
16346 */
16347void
16348watchdog_call_start (
16349 Watchdog *proxy,
16350 GCancellable *cancellable,
16351 GAsyncReadyCallback callback,
16352 gpointer user_data)
16353{
16354 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
16355 "start",
16356 g_variant_new ("()"),
16357 G_DBUS_CALL_FLAGS_NONE,
16358 -1,
16359 cancellable,
16360 callback,
16361 user_data);
16362}
16363
16364/**
16365 * watchdog_call_start_finish:
16366 * @proxy: A #WatchdogProxy.
16367 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_start().
16368 * @error: Return location for error or %NULL.
16369 *
16370 * Finishes an operation started with watchdog_call_start().
16371 *
16372 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16373 */
16374gboolean
16375watchdog_call_start_finish (
16376 Watchdog *proxy,
16377 GAsyncResult *res,
16378 GError **error)
16379{
16380 GVariant *_ret;
16381 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
16382 if (_ret == NULL)
16383 goto _out;
16384 g_variant_get (_ret,
16385 "()");
16386 g_variant_unref (_ret);
16387_out:
16388 return _ret != NULL;
16389}
16390
16391/**
16392 * watchdog_call_start_sync:
16393 * @proxy: A #WatchdogProxy.
16394 * @cancellable: (allow-none): A #GCancellable or %NULL.
16395 * @error: Return location for error or %NULL.
16396 *
16397 * 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.
16398 *
16399 * See watchdog_call_start() for the asynchronous version of this method.
16400 *
16401 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16402 */
16403gboolean
16404watchdog_call_start_sync (
16405 Watchdog *proxy,
16406 GCancellable *cancellable,
16407 GError **error)
16408{
16409 GVariant *_ret;
16410 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
16411 "start",
16412 g_variant_new ("()"),
16413 G_DBUS_CALL_FLAGS_NONE,
16414 -1,
16415 cancellable,
16416 error);
16417 if (_ret == NULL)
16418 goto _out;
16419 g_variant_get (_ret,
16420 "()");
16421 g_variant_unref (_ret);
16422_out:
16423 return _ret != NULL;
16424}
16425
16426/**
16427 * watchdog_call_poke:
16428 * @proxy: A #WatchdogProxy.
16429 * @cancellable: (allow-none): A #GCancellable or %NULL.
16430 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
16431 * @user_data: User data to pass to @callback.
16432 *
16433 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method on @proxy.
16434 * 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.
16435 * You can then call watchdog_call_poke_finish() to get the result of the operation.
16436 *
16437 * See watchdog_call_poke_sync() for the synchronous, blocking version of this method.
16438 */
16439void
16440watchdog_call_poke (
16441 Watchdog *proxy,
16442 GCancellable *cancellable,
16443 GAsyncReadyCallback callback,
16444 gpointer user_data)
16445{
16446 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
16447 "poke",
16448 g_variant_new ("()"),
16449 G_DBUS_CALL_FLAGS_NONE,
16450 -1,
16451 cancellable,
16452 callback,
16453 user_data);
16454}
16455
16456/**
16457 * watchdog_call_poke_finish:
16458 * @proxy: A #WatchdogProxy.
16459 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_poke().
16460 * @error: Return location for error or %NULL.
16461 *
16462 * Finishes an operation started with watchdog_call_poke().
16463 *
16464 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16465 */
16466gboolean
16467watchdog_call_poke_finish (
16468 Watchdog *proxy,
16469 GAsyncResult *res,
16470 GError **error)
16471{
16472 GVariant *_ret;
16473 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
16474 if (_ret == NULL)
16475 goto _out;
16476 g_variant_get (_ret,
16477 "()");
16478 g_variant_unref (_ret);
16479_out:
16480 return _ret != NULL;
16481}
16482
16483/**
16484 * watchdog_call_poke_sync:
16485 * @proxy: A #WatchdogProxy.
16486 * @cancellable: (allow-none): A #GCancellable or %NULL.
16487 * @error: Return location for error or %NULL.
16488 *
16489 * 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.
16490 *
16491 * See watchdog_call_poke() for the asynchronous version of this method.
16492 *
16493 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16494 */
16495gboolean
16496watchdog_call_poke_sync (
16497 Watchdog *proxy,
16498 GCancellable *cancellable,
16499 GError **error)
16500{
16501 GVariant *_ret;
16502 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
16503 "poke",
16504 g_variant_new ("()"),
16505 G_DBUS_CALL_FLAGS_NONE,
16506 -1,
16507 cancellable,
16508 error);
16509 if (_ret == NULL)
16510 goto _out;
16511 g_variant_get (_ret,
16512 "()");
16513 g_variant_unref (_ret);
16514_out:
16515 return _ret != NULL;
16516}
16517
16518/**
16519 * watchdog_call_stop:
16520 * @proxy: A #WatchdogProxy.
16521 * @cancellable: (allow-none): A #GCancellable or %NULL.
16522 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
16523 * @user_data: User data to pass to @callback.
16524 *
16525 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method on @proxy.
16526 * 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.
16527 * You can then call watchdog_call_stop_finish() to get the result of the operation.
16528 *
16529 * See watchdog_call_stop_sync() for the synchronous, blocking version of this method.
16530 */
16531void
16532watchdog_call_stop (
16533 Watchdog *proxy,
16534 GCancellable *cancellable,
16535 GAsyncReadyCallback callback,
16536 gpointer user_data)
16537{
16538 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
16539 "stop",
16540 g_variant_new ("()"),
16541 G_DBUS_CALL_FLAGS_NONE,
16542 -1,
16543 cancellable,
16544 callback,
16545 user_data);
16546}
16547
16548/**
16549 * watchdog_call_stop_finish:
16550 * @proxy: A #WatchdogProxy.
16551 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_stop().
16552 * @error: Return location for error or %NULL.
16553 *
16554 * Finishes an operation started with watchdog_call_stop().
16555 *
16556 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16557 */
16558gboolean
16559watchdog_call_stop_finish (
16560 Watchdog *proxy,
16561 GAsyncResult *res,
16562 GError **error)
16563{
16564 GVariant *_ret;
16565 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
16566 if (_ret == NULL)
16567 goto _out;
16568 g_variant_get (_ret,
16569 "()");
16570 g_variant_unref (_ret);
16571_out:
16572 return _ret != NULL;
16573}
16574
16575/**
16576 * watchdog_call_stop_sync:
16577 * @proxy: A #WatchdogProxy.
16578 * @cancellable: (allow-none): A #GCancellable or %NULL.
16579 * @error: Return location for error or %NULL.
16580 *
16581 * 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.
16582 *
16583 * See watchdog_call_stop() for the asynchronous version of this method.
16584 *
16585 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16586 */
16587gboolean
16588watchdog_call_stop_sync (
16589 Watchdog *proxy,
16590 GCancellable *cancellable,
16591 GError **error)
16592{
16593 GVariant *_ret;
16594 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
16595 "stop",
16596 g_variant_new ("()"),
16597 G_DBUS_CALL_FLAGS_NONE,
16598 -1,
16599 cancellable,
16600 error);
16601 if (_ret == NULL)
16602 goto _out;
16603 g_variant_get (_ret,
16604 "()");
16605 g_variant_unref (_ret);
16606_out:
16607 return _ret != NULL;
16608}
16609
16610/**
16611 * watchdog_complete_start:
16612 * @object: A #Watchdog.
16613 * @invocation: (transfer full): A #GDBusMethodInvocation.
16614 *
16615 * 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.
16616 *
16617 * This method will free @invocation, you cannot use it afterwards.
16618 */
16619void
16620watchdog_complete_start (
16621 Watchdog *object,
16622 GDBusMethodInvocation *invocation)
16623{
16624 g_dbus_method_invocation_return_value (invocation,
16625 g_variant_new ("()"));
16626}
16627
16628/**
16629 * watchdog_complete_poke:
16630 * @object: A #Watchdog.
16631 * @invocation: (transfer full): A #GDBusMethodInvocation.
16632 *
16633 * 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.
16634 *
16635 * This method will free @invocation, you cannot use it afterwards.
16636 */
16637void
16638watchdog_complete_poke (
16639 Watchdog *object,
16640 GDBusMethodInvocation *invocation)
16641{
16642 g_dbus_method_invocation_return_value (invocation,
16643 g_variant_new ("()"));
16644}
16645
16646/**
16647 * watchdog_complete_stop:
16648 * @object: A #Watchdog.
16649 * @invocation: (transfer full): A #GDBusMethodInvocation.
16650 *
16651 * 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.
16652 *
16653 * This method will free @invocation, you cannot use it afterwards.
16654 */
16655void
16656watchdog_complete_stop (
16657 Watchdog *object,
16658 GDBusMethodInvocation *invocation)
16659{
16660 g_dbus_method_invocation_return_value (invocation,
16661 g_variant_new ("()"));
16662}
16663
16664/* ------------------------------------------------------------------------ */
16665
16666/**
16667 * WatchdogProxy:
16668 *
16669 * The #WatchdogProxy structure contains only private data and should only be accessed using the provided API.
16670 */
16671
16672/**
16673 * WatchdogProxyClass:
16674 * @parent_class: The parent class.
16675 *
16676 * Class structure for #WatchdogProxy.
16677 */
16678
16679struct _WatchdogProxyPrivate
16680{
16681 GData *qdata;
16682};
16683
16684static void watchdog_proxy_iface_init (WatchdogIface *iface);
16685
16686#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16687G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY,
16688 G_ADD_PRIVATE (WatchdogProxy)
16689 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init));
16690
16691#else
16692G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY,
16693 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init));
16694
16695#endif
16696static void
16697watchdog_proxy_finalize (GObject *object)
16698{
16699 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
16700 g_datalist_clear (&proxy->priv->qdata);
16701 G_OBJECT_CLASS (watchdog_proxy_parent_class)->finalize (object);
16702}
16703
16704static void
16705watchdog_proxy_get_property (GObject *object,
16706 guint prop_id,
16707 GValue *value,
16708 GParamSpec *pspec G_GNUC_UNUSED)
16709{
16710 const _ExtendedGDBusPropertyInfo *info;
16711 GVariant *variant;
16712 g_assert (prop_id != 0 && prop_id - 1 < 2);
16713 info = _watchdog_property_info_pointers[prop_id - 1];
16714 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
16715 if (info->use_gvariant)
16716 {
16717 g_value_set_variant (value, variant);
16718 }
16719 else
16720 {
16721 if (variant != NULL)
16722 g_dbus_gvariant_to_gvalue (variant, value);
16723 }
16724 if (variant != NULL)
16725 g_variant_unref (variant);
16726}
16727
16728static void
16729watchdog_proxy_set_property_cb (GDBusProxy *proxy,
16730 GAsyncResult *res,
16731 gpointer user_data)
16732{
16733 const _ExtendedGDBusPropertyInfo *info = user_data;
16734 GError *error;
16735 GVariant *_ret;
16736 error = NULL;
16737 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
16738 if (!_ret)
16739 {
16740 g_warning ("Error setting property '%s' on interface org.openbmc.Watchdog: %s (%s, %d)",
16741 info->parent_struct.name,
16742 error->message, g_quark_to_string (error->domain), error->code);
16743 g_error_free (error);
16744 }
16745 else
16746 {
16747 g_variant_unref (_ret);
16748 }
16749}
16750
16751static void
16752watchdog_proxy_set_property (GObject *object,
16753 guint prop_id,
16754 const GValue *value,
16755 GParamSpec *pspec G_GNUC_UNUSED)
16756{
16757 const _ExtendedGDBusPropertyInfo *info;
16758 GVariant *variant;
16759 g_assert (prop_id != 0 && prop_id - 1 < 2);
16760 info = _watchdog_property_info_pointers[prop_id - 1];
16761 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
16762 g_dbus_proxy_call (G_DBUS_PROXY (object),
16763 "org.freedesktop.DBus.Properties.Set",
16764 g_variant_new ("(ssv)", "org.openbmc.Watchdog", info->parent_struct.name, variant),
16765 G_DBUS_CALL_FLAGS_NONE,
16766 -1,
16767 NULL, (GAsyncReadyCallback) watchdog_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
16768 g_variant_unref (variant);
16769}
16770
16771static void
16772watchdog_proxy_g_signal (GDBusProxy *proxy,
16773 const gchar *sender_name G_GNUC_UNUSED,
16774 const gchar *signal_name,
16775 GVariant *parameters)
16776{
16777 _ExtendedGDBusSignalInfo *info;
16778 GVariantIter iter;
16779 GVariant *child;
16780 GValue *paramv;
16781 guint num_params;
16782 guint n;
16783 guint signal_id;
16784 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, signal_name);
16785 if (info == NULL)
16786 return;
16787 num_params = g_variant_n_children (parameters);
16788 paramv = g_new0 (GValue, num_params + 1);
16789 g_value_init (&paramv[0], TYPE_WATCHDOG);
16790 g_value_set_object (&paramv[0], proxy);
16791 g_variant_iter_init (&iter, parameters);
16792 n = 1;
16793 while ((child = g_variant_iter_next_value (&iter)) != NULL)
16794 {
16795 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
16796 if (arg_info->use_gvariant)
16797 {
16798 g_value_init (&paramv[n], G_TYPE_VARIANT);
16799 g_value_set_variant (&paramv[n], child);
16800 n++;
16801 }
16802 else
16803 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
16804 g_variant_unref (child);
16805 }
16806 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG);
16807 g_signal_emitv (paramv, signal_id, 0, NULL);
16808 for (n = 0; n < num_params + 1; n++)
16809 g_value_unset (&paramv[n]);
16810 g_free (paramv);
16811}
16812
16813static void
16814watchdog_proxy_g_properties_changed (GDBusProxy *_proxy,
16815 GVariant *changed_properties,
16816 const gchar *const *invalidated_properties)
16817{
16818 WatchdogProxy *proxy = WATCHDOG_PROXY (_proxy);
16819 guint n;
16820 const gchar *key;
16821 GVariantIter *iter;
16822 _ExtendedGDBusPropertyInfo *info;
16823 g_variant_get (changed_properties, "a{sv}", &iter);
16824 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
16825 {
16826 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, key);
16827 g_datalist_remove_data (&proxy->priv->qdata, key);
16828 if (info != NULL)
16829 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
16830 }
16831 g_variant_iter_free (iter);
16832 for (n = 0; invalidated_properties[n] != NULL; n++)
16833 {
16834 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, invalidated_properties[n]);
16835 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
16836 if (info != NULL)
16837 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
16838 }
16839}
16840
16841static gint
16842watchdog_proxy_get_watchdog (Watchdog *object)
16843{
16844 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
16845 GVariant *variant;
16846 gint value = 0;
16847 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "watchdog");
16848 if (variant != NULL)
16849 {
16850 value = g_variant_get_int32 (variant);
16851 g_variant_unref (variant);
16852 }
16853 return value;
16854}
16855
16856static gint
16857watchdog_proxy_get_poll_interval (Watchdog *object)
16858{
16859 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
16860 GVariant *variant;
16861 gint value = 0;
16862 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
16863 if (variant != NULL)
16864 {
16865 value = g_variant_get_int32 (variant);
16866 g_variant_unref (variant);
16867 }
16868 return value;
16869}
16870
16871static void
16872watchdog_proxy_init (WatchdogProxy *proxy)
16873{
16874#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16875 proxy->priv = watchdog_proxy_get_instance_private (proxy);
16876#else
16877 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_WATCHDOG_PROXY, WatchdogProxyPrivate);
16878#endif
16879
16880 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), watchdog_interface_info ());
16881}
16882
16883static void
16884watchdog_proxy_class_init (WatchdogProxyClass *klass)
16885{
16886 GObjectClass *gobject_class;
16887 GDBusProxyClass *proxy_class;
16888
16889 gobject_class = G_OBJECT_CLASS (klass);
16890 gobject_class->finalize = watchdog_proxy_finalize;
16891 gobject_class->get_property = watchdog_proxy_get_property;
16892 gobject_class->set_property = watchdog_proxy_set_property;
16893
16894 proxy_class = G_DBUS_PROXY_CLASS (klass);
16895 proxy_class->g_signal = watchdog_proxy_g_signal;
16896 proxy_class->g_properties_changed = watchdog_proxy_g_properties_changed;
16897
16898 watchdog_override_properties (gobject_class, 1);
16899
16900#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
16901 g_type_class_add_private (klass, sizeof (WatchdogProxyPrivate));
16902#endif
16903}
16904
16905static void
16906watchdog_proxy_iface_init (WatchdogIface *iface)
16907{
16908 iface->get_watchdog = watchdog_proxy_get_watchdog;
16909 iface->get_poll_interval = watchdog_proxy_get_poll_interval;
16910}
16911
16912/**
16913 * watchdog_proxy_new:
16914 * @connection: A #GDBusConnection.
16915 * @flags: Flags from the #GDBusProxyFlags enumeration.
16916 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
16917 * @object_path: An object path.
16918 * @cancellable: (allow-none): A #GCancellable or %NULL.
16919 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
16920 * @user_data: User data to pass to @callback.
16921 *
16922 * 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.
16923 *
16924 * 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.
16925 * You can then call watchdog_proxy_new_finish() to get the result of the operation.
16926 *
16927 * See watchdog_proxy_new_sync() for the synchronous, blocking version of this constructor.
16928 */
16929void
16930watchdog_proxy_new (
16931 GDBusConnection *connection,
16932 GDBusProxyFlags flags,
16933 const gchar *name,
16934 const gchar *object_path,
16935 GCancellable *cancellable,
16936 GAsyncReadyCallback callback,
16937 gpointer user_data)
16938{
16939 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);
16940}
16941
16942/**
16943 * watchdog_proxy_new_finish:
16944 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new().
16945 * @error: Return location for error or %NULL
16946 *
16947 * Finishes an operation started with watchdog_proxy_new().
16948 *
16949 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
16950 */
16951Watchdog *
16952watchdog_proxy_new_finish (
16953 GAsyncResult *res,
16954 GError **error)
16955{
16956 GObject *ret;
16957 GObject *source_object;
16958 source_object = g_async_result_get_source_object (res);
16959 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
16960 g_object_unref (source_object);
16961 if (ret != NULL)
16962 return WATCHDOG (ret);
16963 else
16964 return NULL;
16965}
16966
16967/**
16968 * watchdog_proxy_new_sync:
16969 * @connection: A #GDBusConnection.
16970 * @flags: Flags from the #GDBusProxyFlags enumeration.
16971 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
16972 * @object_path: An object path.
16973 * @cancellable: (allow-none): A #GCancellable or %NULL.
16974 * @error: Return location for error or %NULL
16975 *
16976 * 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.
16977 *
16978 * The calling thread is blocked until a reply is received.
16979 *
16980 * See watchdog_proxy_new() for the asynchronous version of this constructor.
16981 *
16982 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
16983 */
16984Watchdog *
16985watchdog_proxy_new_sync (
16986 GDBusConnection *connection,
16987 GDBusProxyFlags flags,
16988 const gchar *name,
16989 const gchar *object_path,
16990 GCancellable *cancellable,
16991 GError **error)
16992{
16993 GInitable *ret;
16994 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);
16995 if (ret != NULL)
16996 return WATCHDOG (ret);
16997 else
16998 return NULL;
16999}
17000
17001
17002/**
17003 * watchdog_proxy_new_for_bus:
17004 * @bus_type: A #GBusType.
17005 * @flags: Flags from the #GDBusProxyFlags enumeration.
17006 * @name: A bus name (well-known or unique).
17007 * @object_path: An object path.
17008 * @cancellable: (allow-none): A #GCancellable or %NULL.
17009 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
17010 * @user_data: User data to pass to @callback.
17011 *
17012 * Like watchdog_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
17013 *
17014 * 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.
17015 * You can then call watchdog_proxy_new_for_bus_finish() to get the result of the operation.
17016 *
17017 * See watchdog_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
17018 */
17019void
17020watchdog_proxy_new_for_bus (
17021 GBusType bus_type,
17022 GDBusProxyFlags flags,
17023 const gchar *name,
17024 const gchar *object_path,
17025 GCancellable *cancellable,
17026 GAsyncReadyCallback callback,
17027 gpointer user_data)
17028{
17029 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);
17030}
17031
17032/**
17033 * watchdog_proxy_new_for_bus_finish:
17034 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new_for_bus().
17035 * @error: Return location for error or %NULL
17036 *
17037 * Finishes an operation started with watchdog_proxy_new_for_bus().
17038 *
17039 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
17040 */
17041Watchdog *
17042watchdog_proxy_new_for_bus_finish (
17043 GAsyncResult *res,
17044 GError **error)
17045{
17046 GObject *ret;
17047 GObject *source_object;
17048 source_object = g_async_result_get_source_object (res);
17049 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
17050 g_object_unref (source_object);
17051 if (ret != NULL)
17052 return WATCHDOG (ret);
17053 else
17054 return NULL;
17055}
17056
17057/**
17058 * watchdog_proxy_new_for_bus_sync:
17059 * @bus_type: A #GBusType.
17060 * @flags: Flags from the #GDBusProxyFlags enumeration.
17061 * @name: A bus name (well-known or unique).
17062 * @object_path: An object path.
17063 * @cancellable: (allow-none): A #GCancellable or %NULL.
17064 * @error: Return location for error or %NULL
17065 *
17066 * Like watchdog_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
17067 *
17068 * The calling thread is blocked until a reply is received.
17069 *
17070 * See watchdog_proxy_new_for_bus() for the asynchronous version of this constructor.
17071 *
17072 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
17073 */
17074Watchdog *
17075watchdog_proxy_new_for_bus_sync (
17076 GBusType bus_type,
17077 GDBusProxyFlags flags,
17078 const gchar *name,
17079 const gchar *object_path,
17080 GCancellable *cancellable,
17081 GError **error)
17082{
17083 GInitable *ret;
17084 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);
17085 if (ret != NULL)
17086 return WATCHDOG (ret);
17087 else
17088 return NULL;
17089}
17090
17091
17092/* ------------------------------------------------------------------------ */
17093
17094/**
17095 * WatchdogSkeleton:
17096 *
17097 * The #WatchdogSkeleton structure contains only private data and should only be accessed using the provided API.
17098 */
17099
17100/**
17101 * WatchdogSkeletonClass:
17102 * @parent_class: The parent class.
17103 *
17104 * Class structure for #WatchdogSkeleton.
17105 */
17106
17107struct _WatchdogSkeletonPrivate
17108{
17109 GValue *properties;
17110 GList *changed_properties;
17111 GSource *changed_properties_idle_source;
17112 GMainContext *context;
17113 GMutex lock;
17114};
17115
17116static void
17117_watchdog_skeleton_handle_method_call (
17118 GDBusConnection *connection G_GNUC_UNUSED,
17119 const gchar *sender G_GNUC_UNUSED,
17120 const gchar *object_path G_GNUC_UNUSED,
17121 const gchar *interface_name,
17122 const gchar *method_name,
17123 GVariant *parameters,
17124 GDBusMethodInvocation *invocation,
17125 gpointer user_data)
17126{
17127 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
17128 _ExtendedGDBusMethodInfo *info;
17129 GVariantIter iter;
17130 GVariant *child;
17131 GValue *paramv;
17132 guint num_params;
17133 guint num_extra;
17134 guint n;
17135 guint signal_id;
17136 GValue return_value = G_VALUE_INIT;
17137 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
17138 g_assert (info != NULL);
17139 num_params = g_variant_n_children (parameters);
17140 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
17141 n = 0;
17142 g_value_init (&paramv[n], TYPE_WATCHDOG);
17143 g_value_set_object (&paramv[n++], skeleton);
17144 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
17145 g_value_set_object (&paramv[n++], invocation);
17146 if (info->pass_fdlist)
17147 {
17148#ifdef G_OS_UNIX
17149 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
17150 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
17151#else
17152 g_assert_not_reached ();
17153#endif
17154 }
17155 g_variant_iter_init (&iter, parameters);
17156 while ((child = g_variant_iter_next_value (&iter)) != NULL)
17157 {
17158 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
17159 if (arg_info->use_gvariant)
17160 {
17161 g_value_init (&paramv[n], G_TYPE_VARIANT);
17162 g_value_set_variant (&paramv[n], child);
17163 n++;
17164 }
17165 else
17166 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
17167 g_variant_unref (child);
17168 }
17169 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG);
17170 g_value_init (&return_value, G_TYPE_BOOLEAN);
17171 g_signal_emitv (paramv, signal_id, 0, &return_value);
17172 if (!g_value_get_boolean (&return_value))
17173 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);
17174 g_value_unset (&return_value);
17175 for (n = 0; n < num_params + num_extra; n++)
17176 g_value_unset (&paramv[n]);
17177 g_free (paramv);
17178}
17179
17180static GVariant *
17181_watchdog_skeleton_handle_get_property (
17182 GDBusConnection *connection G_GNUC_UNUSED,
17183 const gchar *sender G_GNUC_UNUSED,
17184 const gchar *object_path G_GNUC_UNUSED,
17185 const gchar *interface_name G_GNUC_UNUSED,
17186 const gchar *property_name,
17187 GError **error,
17188 gpointer user_data)
17189{
17190 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
17191 GValue value = G_VALUE_INIT;
17192 GParamSpec *pspec;
17193 _ExtendedGDBusPropertyInfo *info;
17194 GVariant *ret;
17195 ret = NULL;
17196 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name);
17197 g_assert (info != NULL);
17198 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
17199 if (pspec == NULL)
17200 {
17201 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
17202 }
17203 else
17204 {
17205 g_value_init (&value, pspec->value_type);
17206 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
17207 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
17208 g_value_unset (&value);
17209 }
17210 return ret;
17211}
17212
17213static gboolean
17214_watchdog_skeleton_handle_set_property (
17215 GDBusConnection *connection G_GNUC_UNUSED,
17216 const gchar *sender G_GNUC_UNUSED,
17217 const gchar *object_path G_GNUC_UNUSED,
17218 const gchar *interface_name G_GNUC_UNUSED,
17219 const gchar *property_name,
17220 GVariant *variant,
17221 GError **error,
17222 gpointer user_data)
17223{
17224 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
17225 GValue value = G_VALUE_INIT;
17226 GParamSpec *pspec;
17227 _ExtendedGDBusPropertyInfo *info;
17228 gboolean ret;
17229 ret = FALSE;
17230 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name);
17231 g_assert (info != NULL);
17232 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
17233 if (pspec == NULL)
17234 {
17235 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
17236 }
17237 else
17238 {
17239 if (info->use_gvariant)
17240 g_value_set_variant (&value, variant);
17241 else
17242 g_dbus_gvariant_to_gvalue (variant, &value);
17243 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
17244 g_value_unset (&value);
17245 ret = TRUE;
17246 }
17247 return ret;
17248}
17249
17250static const GDBusInterfaceVTable _watchdog_skeleton_vtable =
17251{
17252 _watchdog_skeleton_handle_method_call,
17253 _watchdog_skeleton_handle_get_property,
17254 _watchdog_skeleton_handle_set_property,
17255 {NULL}
17256};
17257
17258static GDBusInterfaceInfo *
17259watchdog_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
17260{
17261 return watchdog_interface_info ();
17262}
17263
17264static GDBusInterfaceVTable *
17265watchdog_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
17266{
17267 return (GDBusInterfaceVTable *) &_watchdog_skeleton_vtable;
17268}
17269
17270static GVariant *
17271watchdog_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
17272{
17273 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton);
17274
17275 GVariantBuilder builder;
17276 guint n;
17277 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
17278 if (_watchdog_interface_info.parent_struct.properties == NULL)
17279 goto out;
17280 for (n = 0; _watchdog_interface_info.parent_struct.properties[n] != NULL; n++)
17281 {
17282 GDBusPropertyInfo *info = _watchdog_interface_info.parent_struct.properties[n];
17283 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
17284 {
17285 GVariant *value;
17286 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);
17287 if (value != NULL)
17288 {
17289 g_variant_take_ref (value);
17290 g_variant_builder_add (&builder, "{sv}", info->name, value);
17291 g_variant_unref (value);
17292 }
17293 }
17294 }
17295out:
17296 return g_variant_builder_end (&builder);
17297}
17298
17299static gboolean _watchdog_emit_changed (gpointer user_data);
17300
17301static void
17302watchdog_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
17303{
17304 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton);
17305 gboolean emit_changed = FALSE;
17306
17307 g_mutex_lock (&skeleton->priv->lock);
17308 if (skeleton->priv->changed_properties_idle_source != NULL)
17309 {
17310 g_source_destroy (skeleton->priv->changed_properties_idle_source);
17311 skeleton->priv->changed_properties_idle_source = NULL;
17312 emit_changed = TRUE;
17313 }
17314 g_mutex_unlock (&skeleton->priv->lock);
17315
17316 if (emit_changed)
17317 _watchdog_emit_changed (skeleton);
17318}
17319
17320static void
17321_watchdog_on_signal_watchdog_error (
17322 Watchdog *object)
17323{
17324 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17325
17326 GList *connections, *l;
17327 GVariant *signal_variant;
17328 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
17329
17330 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
17331 for (l = connections; l != NULL; l = l->next)
17332 {
17333 GDBusConnection *connection = l->data;
17334 g_dbus_connection_emit_signal (connection,
17335 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Watchdog", "WatchdogError",
17336 signal_variant, NULL);
17337 }
17338 g_variant_unref (signal_variant);
17339 g_list_free_full (connections, g_object_unref);
17340}
17341
17342static void watchdog_skeleton_iface_init (WatchdogIface *iface);
17343#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17344G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
17345 G_ADD_PRIVATE (WatchdogSkeleton)
17346 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init));
17347
17348#else
17349G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
17350 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init));
17351
17352#endif
17353static void
17354watchdog_skeleton_finalize (GObject *object)
17355{
17356 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17357 guint n;
17358 for (n = 0; n < 2; n++)
17359 g_value_unset (&skeleton->priv->properties[n]);
17360 g_free (skeleton->priv->properties);
17361 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
17362 if (skeleton->priv->changed_properties_idle_source != NULL)
17363 g_source_destroy (skeleton->priv->changed_properties_idle_source);
17364 g_main_context_unref (skeleton->priv->context);
17365 g_mutex_clear (&skeleton->priv->lock);
17366 G_OBJECT_CLASS (watchdog_skeleton_parent_class)->finalize (object);
17367}
17368
17369static void
17370watchdog_skeleton_get_property (GObject *object,
17371 guint prop_id,
17372 GValue *value,
17373 GParamSpec *pspec G_GNUC_UNUSED)
17374{
17375 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17376 g_assert (prop_id != 0 && prop_id - 1 < 2);
17377 g_mutex_lock (&skeleton->priv->lock);
17378 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
17379 g_mutex_unlock (&skeleton->priv->lock);
17380}
17381
17382static gboolean
17383_watchdog_emit_changed (gpointer user_data)
17384{
17385 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
17386 GList *l;
17387 GVariantBuilder builder;
17388 GVariantBuilder invalidated_builder;
17389 guint num_changes;
17390
17391 g_mutex_lock (&skeleton->priv->lock);
17392 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
17393 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
17394 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
17395 {
17396 ChangedProperty *cp = l->data;
17397 GVariant *variant;
17398 const GValue *cur_value;
17399
17400 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
17401 if (!_g_value_equal (cur_value, &cp->orig_value))
17402 {
17403 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
17404 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
17405 g_variant_unref (variant);
17406 num_changes++;
17407 }
17408 }
17409 if (num_changes > 0)
17410 {
17411 GList *connections, *ll;
17412 GVariant *signal_variant;
17413 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Watchdog",
17414 &builder, &invalidated_builder));
17415 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
17416 for (ll = connections; ll != NULL; ll = ll->next)
17417 {
17418 GDBusConnection *connection = ll->data;
17419
17420 g_dbus_connection_emit_signal (connection,
17421 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
17422 "org.freedesktop.DBus.Properties",
17423 "PropertiesChanged",
17424 signal_variant,
17425 NULL);
17426 }
17427 g_variant_unref (signal_variant);
17428 g_list_free_full (connections, g_object_unref);
17429 }
17430 else
17431 {
17432 g_variant_builder_clear (&builder);
17433 g_variant_builder_clear (&invalidated_builder);
17434 }
17435 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
17436 skeleton->priv->changed_properties = NULL;
17437 skeleton->priv->changed_properties_idle_source = NULL;
17438 g_mutex_unlock (&skeleton->priv->lock);
17439 return FALSE;
17440}
17441
17442static void
17443_watchdog_schedule_emit_changed (WatchdogSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
17444{
17445 ChangedProperty *cp;
17446 GList *l;
17447 cp = NULL;
17448 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
17449 {
17450 ChangedProperty *i_cp = l->data;
17451 if (i_cp->info == info)
17452 {
17453 cp = i_cp;
17454 break;
17455 }
17456 }
17457 if (cp == NULL)
17458 {
17459 cp = g_new0 (ChangedProperty, 1);
17460 cp->prop_id = prop_id;
17461 cp->info = info;
17462 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
17463 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
17464 g_value_copy (orig_value, &cp->orig_value);
17465 }
17466}
17467
17468static void
17469watchdog_skeleton_notify (GObject *object,
17470 GParamSpec *pspec G_GNUC_UNUSED)
17471{
17472 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17473 g_mutex_lock (&skeleton->priv->lock);
17474 if (skeleton->priv->changed_properties != NULL &&
17475 skeleton->priv->changed_properties_idle_source == NULL)
17476 {
17477 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
17478 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
17479 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _watchdog_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
17480 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
17481 g_source_unref (skeleton->priv->changed_properties_idle_source);
17482 }
17483 g_mutex_unlock (&skeleton->priv->lock);
17484}
17485
17486static void
17487watchdog_skeleton_set_property (GObject *object,
17488 guint prop_id,
17489 const GValue *value,
17490 GParamSpec *pspec)
17491{
17492 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17493 g_assert (prop_id != 0 && prop_id - 1 < 2);
17494 g_mutex_lock (&skeleton->priv->lock);
17495 g_object_freeze_notify (object);
17496 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
17497 {
17498 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
17499 _watchdog_schedule_emit_changed (skeleton, _watchdog_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
17500 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
17501 g_object_notify_by_pspec (object, pspec);
17502 }
17503 g_mutex_unlock (&skeleton->priv->lock);
17504 g_object_thaw_notify (object);
17505}
17506
17507static void
17508watchdog_skeleton_init (WatchdogSkeleton *skeleton)
17509{
17510#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17511 skeleton->priv = watchdog_skeleton_get_instance_private (skeleton);
17512#else
17513 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_WATCHDOG_SKELETON, WatchdogSkeletonPrivate);
17514#endif
17515
17516 g_mutex_init (&skeleton->priv->lock);
17517 skeleton->priv->context = g_main_context_ref_thread_default ();
17518 skeleton->priv->properties = g_new0 (GValue, 2);
17519 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
17520 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
17521}
17522
17523static gint
17524watchdog_skeleton_get_watchdog (Watchdog *object)
17525{
17526 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17527 gint value;
17528 g_mutex_lock (&skeleton->priv->lock);
17529 value = g_value_get_int (&(skeleton->priv->properties[0]));
17530 g_mutex_unlock (&skeleton->priv->lock);
17531 return value;
17532}
17533
17534static gint
17535watchdog_skeleton_get_poll_interval (Watchdog *object)
17536{
17537 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17538 gint value;
17539 g_mutex_lock (&skeleton->priv->lock);
17540 value = g_value_get_int (&(skeleton->priv->properties[1]));
17541 g_mutex_unlock (&skeleton->priv->lock);
17542 return value;
17543}
17544
17545static void
17546watchdog_skeleton_class_init (WatchdogSkeletonClass *klass)
17547{
17548 GObjectClass *gobject_class;
17549 GDBusInterfaceSkeletonClass *skeleton_class;
17550
17551 gobject_class = G_OBJECT_CLASS (klass);
17552 gobject_class->finalize = watchdog_skeleton_finalize;
17553 gobject_class->get_property = watchdog_skeleton_get_property;
17554 gobject_class->set_property = watchdog_skeleton_set_property;
17555 gobject_class->notify = watchdog_skeleton_notify;
17556
17557
17558 watchdog_override_properties (gobject_class, 1);
17559
17560 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
17561 skeleton_class->get_info = watchdog_skeleton_dbus_interface_get_info;
17562 skeleton_class->get_properties = watchdog_skeleton_dbus_interface_get_properties;
17563 skeleton_class->flush = watchdog_skeleton_dbus_interface_flush;
17564 skeleton_class->get_vtable = watchdog_skeleton_dbus_interface_get_vtable;
17565
17566#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
17567 g_type_class_add_private (klass, sizeof (WatchdogSkeletonPrivate));
17568#endif
17569}
17570
17571static void
17572watchdog_skeleton_iface_init (WatchdogIface *iface)
17573{
17574 iface->watchdog_error = _watchdog_on_signal_watchdog_error;
17575 iface->get_watchdog = watchdog_skeleton_get_watchdog;
17576 iface->get_poll_interval = watchdog_skeleton_get_poll_interval;
17577}
17578
17579/**
17580 * watchdog_skeleton_new:
17581 *
17582 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
17583 *
17584 * Returns: (transfer full) (type WatchdogSkeleton): The skeleton object.
17585 */
17586Watchdog *
17587watchdog_skeleton_new (void)
17588{
17589 return WATCHDOG (g_object_new (TYPE_WATCHDOG_SKELETON, NULL));
17590}
17591
17592/* ------------------------------------------------------------------------
17593 * Code for interface org.openbmc.EventLog
17594 * ------------------------------------------------------------------------
17595 */
17596
17597/**
17598 * SECTION:EventLog
17599 * @title: EventLog
17600 * @short_description: Generated C code for the org.openbmc.EventLog D-Bus interface
17601 *
17602 * 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.
17603 */
17604
17605/* ---- Introspection data for org.openbmc.EventLog ---- */
17606
Norman James2d1ee892015-09-16 23:13:45 -050017607static const _ExtendedGDBusArgInfo _event_log_method_info_get_event_log_OUT_ARG_log =
17608{
17609 {
17610 -1,
17611 (gchar *) "log",
17612 (gchar *) "a(s)",
17613 NULL
17614 },
17615 FALSE
17616};
17617
17618static const _ExtendedGDBusArgInfo * const _event_log_method_info_get_event_log_OUT_ARG_pointers[] =
17619{
17620 &_event_log_method_info_get_event_log_OUT_ARG_log,
17621 NULL
17622};
17623
17624static const _ExtendedGDBusMethodInfo _event_log_method_info_get_event_log =
17625{
17626 {
17627 -1,
17628 (gchar *) "getEventLog",
17629 NULL,
17630 (GDBusArgInfo **) &_event_log_method_info_get_event_log_OUT_ARG_pointers,
17631 NULL
17632 },
17633 "handle-get-event-log",
17634 FALSE
17635};
17636
17637static const _ExtendedGDBusMethodInfo * const _event_log_method_info_pointers[] =
17638{
17639 &_event_log_method_info_get_event_log,
17640 NULL
17641};
17642
Norman James8abb50c2015-09-16 10:58:16 -050017643static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_priority =
Norman James362a80f2015-09-14 14:04:39 -050017644{
17645 {
17646 -1,
Norman James8abb50c2015-09-16 10:58:16 -050017647 (gchar *) "priority",
17648 (gchar *) "i",
Norman James362a80f2015-09-14 14:04:39 -050017649 NULL
17650 },
17651 FALSE
17652};
17653
Norman James362a80f2015-09-14 14:04:39 -050017654static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_message =
17655{
17656 {
17657 -1,
17658 (gchar *) "message",
Norman James32e74e22015-09-15 21:28:06 -050017659 (gchar *) "s",
Norman James362a80f2015-09-14 14:04:39 -050017660 NULL
17661 },
17662 FALSE
17663};
17664
Norman James88872672015-09-21 16:51:35 -050017665static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_rc =
17666{
17667 {
17668 -1,
17669 (gchar *) "rc",
17670 (gchar *) "i",
17671 NULL
17672 },
17673 FALSE
17674};
17675
Norman James362a80f2015-09-14 14:04:39 -050017676static const _ExtendedGDBusArgInfo * const _event_log_signal_info_event_log_ARG_pointers[] =
17677{
Norman James8abb50c2015-09-16 10:58:16 -050017678 &_event_log_signal_info_event_log_ARG_priority,
Norman James362a80f2015-09-14 14:04:39 -050017679 &_event_log_signal_info_event_log_ARG_message,
Norman James88872672015-09-21 16:51:35 -050017680 &_event_log_signal_info_event_log_ARG_rc,
Norman James362a80f2015-09-14 14:04:39 -050017681 NULL
17682};
17683
17684static const _ExtendedGDBusSignalInfo _event_log_signal_info_event_log =
17685{
17686 {
17687 -1,
17688 (gchar *) "EventLog",
17689 (GDBusArgInfo **) &_event_log_signal_info_event_log_ARG_pointers,
17690 NULL
17691 },
17692 "event-log"
17693};
17694
17695static const _ExtendedGDBusSignalInfo * const _event_log_signal_info_pointers[] =
17696{
17697 &_event_log_signal_info_event_log,
17698 NULL
17699};
17700
Norman James362a80f2015-09-14 14:04:39 -050017701static const _ExtendedGDBusInterfaceInfo _event_log_interface_info =
17702{
17703 {
17704 -1,
17705 (gchar *) "org.openbmc.EventLog",
Norman James2d1ee892015-09-16 23:13:45 -050017706 (GDBusMethodInfo **) &_event_log_method_info_pointers,
Norman James362a80f2015-09-14 14:04:39 -050017707 (GDBusSignalInfo **) &_event_log_signal_info_pointers,
Norman James32e74e22015-09-15 21:28:06 -050017708 NULL,
Norman James362a80f2015-09-14 14:04:39 -050017709 NULL
17710 },
17711 "event-log",
17712};
17713
17714
17715/**
17716 * event_log_interface_info:
17717 *
17718 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> D-Bus interface.
17719 *
17720 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
17721 */
17722GDBusInterfaceInfo *
17723event_log_interface_info (void)
17724{
17725 return (GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct;
17726}
17727
17728/**
17729 * event_log_override_properties:
17730 * @klass: The class structure for a #GObject<!-- -->-derived class.
17731 * @property_id_begin: The property id to assign to the first overridden property.
17732 *
17733 * Overrides all #GObject properties in the #EventLog interface for a concrete class.
17734 * The properties are overridden in the order they are defined.
17735 *
17736 * Returns: The last property id.
17737 */
17738guint
17739event_log_override_properties (GObjectClass *klass, guint property_id_begin)
17740{
Norman James362a80f2015-09-14 14:04:39 -050017741 return property_id_begin - 1;
17742}
17743
17744
17745
17746/**
17747 * EventLog:
17748 *
17749 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
17750 */
17751
17752/**
17753 * EventLogIface:
17754 * @parent_iface: The parent interface.
Norman James2d1ee892015-09-16 23:13:45 -050017755 * @handle_get_event_log: Handler for the #EventLog::handle-get-event-log signal.
Norman James362a80f2015-09-14 14:04:39 -050017756 * @event_log: Handler for the #EventLog::event-log signal.
17757 *
17758 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
17759 */
17760
17761typedef EventLogIface EventLogInterface;
17762G_DEFINE_INTERFACE (EventLog, event_log, G_TYPE_OBJECT);
17763
17764static void
17765event_log_default_init (EventLogIface *iface)
17766{
Norman James2d1ee892015-09-16 23:13:45 -050017767 /* GObject signals for incoming D-Bus method calls: */
17768 /**
17769 * EventLog::handle-get-event-log:
17770 * @object: A #EventLog.
17771 * @invocation: A #GDBusMethodInvocation.
17772 *
17773 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method.
17774 *
17775 * 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.
17776 *
17777 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
17778 */
17779 g_signal_new ("handle-get-event-log",
17780 G_TYPE_FROM_INTERFACE (iface),
17781 G_SIGNAL_RUN_LAST,
17782 G_STRUCT_OFFSET (EventLogIface, handle_get_event_log),
17783 g_signal_accumulator_true_handled,
17784 NULL,
17785 g_cclosure_marshal_generic,
17786 G_TYPE_BOOLEAN,
17787 1,
17788 G_TYPE_DBUS_METHOD_INVOCATION);
17789
Norman James362a80f2015-09-14 14:04:39 -050017790 /* GObject signals for received D-Bus signals: */
17791 /**
17792 * EventLog::event-log:
17793 * @object: A #EventLog.
Norman James8abb50c2015-09-16 10:58:16 -050017794 * @arg_priority: Argument.
Norman James362a80f2015-09-14 14:04:39 -050017795 * @arg_message: Argument.
Norman James88872672015-09-21 16:51:35 -050017796 * @arg_rc: Argument.
Norman James362a80f2015-09-14 14:04:39 -050017797 *
17798 * 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.
17799 *
17800 * 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.
17801 */
17802 g_signal_new ("event-log",
17803 G_TYPE_FROM_INTERFACE (iface),
17804 G_SIGNAL_RUN_LAST,
17805 G_STRUCT_OFFSET (EventLogIface, event_log),
17806 NULL,
17807 NULL,
17808 g_cclosure_marshal_generic,
17809 G_TYPE_NONE,
Norman James88872672015-09-21 16:51:35 -050017810 3, G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT);
Norman James362a80f2015-09-14 14:04:39 -050017811
Norman James362a80f2015-09-14 14:04:39 -050017812}
17813
17814/**
17815 * event_log_emit_event_log:
17816 * @object: A #EventLog.
Norman James8abb50c2015-09-16 10:58:16 -050017817 * @arg_priority: Argument to pass with the signal.
Norman James362a80f2015-09-14 14:04:39 -050017818 * @arg_message: Argument to pass with the signal.
Norman James88872672015-09-21 16:51:35 -050017819 * @arg_rc: Argument to pass with the signal.
Norman James362a80f2015-09-14 14:04:39 -050017820 *
17821 * Emits the <link linkend="gdbus-signal-org-openbmc-EventLog.EventLog">"EventLog"</link> D-Bus signal.
17822 */
17823void
17824event_log_emit_event_log (
17825 EventLog *object,
Norman James8abb50c2015-09-16 10:58:16 -050017826 gint arg_priority,
Norman James88872672015-09-21 16:51:35 -050017827 const gchar *arg_message,
17828 gint arg_rc)
Norman James362a80f2015-09-14 14:04:39 -050017829{
Norman James88872672015-09-21 16:51:35 -050017830 g_signal_emit_by_name (object, "event-log", arg_priority, arg_message, arg_rc);
Norman James362a80f2015-09-14 14:04:39 -050017831}
17832
Norman James2d1ee892015-09-16 23:13:45 -050017833/**
17834 * event_log_call_get_event_log:
17835 * @proxy: A #EventLogProxy.
17836 * @cancellable: (allow-none): A #GCancellable or %NULL.
17837 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
17838 * @user_data: User data to pass to @callback.
17839 *
17840 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method on @proxy.
17841 * 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.
17842 * You can then call event_log_call_get_event_log_finish() to get the result of the operation.
17843 *
17844 * See event_log_call_get_event_log_sync() for the synchronous, blocking version of this method.
17845 */
17846void
17847event_log_call_get_event_log (
17848 EventLog *proxy,
17849 GCancellable *cancellable,
17850 GAsyncReadyCallback callback,
17851 gpointer user_data)
17852{
17853 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
17854 "getEventLog",
17855 g_variant_new ("()"),
17856 G_DBUS_CALL_FLAGS_NONE,
17857 -1,
17858 cancellable,
17859 callback,
17860 user_data);
17861}
17862
17863/**
17864 * event_log_call_get_event_log_finish:
17865 * @proxy: A #EventLogProxy.
17866 * @out_log: (out): Return location for return parameter or %NULL to ignore.
17867 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_call_get_event_log().
17868 * @error: Return location for error or %NULL.
17869 *
17870 * Finishes an operation started with event_log_call_get_event_log().
17871 *
17872 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
17873 */
17874gboolean
17875event_log_call_get_event_log_finish (
17876 EventLog *proxy,
17877 GVariant **out_log,
17878 GAsyncResult *res,
17879 GError **error)
17880{
17881 GVariant *_ret;
17882 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
17883 if (_ret == NULL)
17884 goto _out;
17885 g_variant_get (_ret,
17886 "(@a(s))",
17887 out_log);
17888 g_variant_unref (_ret);
17889_out:
17890 return _ret != NULL;
17891}
17892
17893/**
17894 * event_log_call_get_event_log_sync:
17895 * @proxy: A #EventLogProxy.
17896 * @out_log: (out): Return location for return parameter or %NULL to ignore.
17897 * @cancellable: (allow-none): A #GCancellable or %NULL.
17898 * @error: Return location for error or %NULL.
17899 *
17900 * 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.
17901 *
17902 * See event_log_call_get_event_log() for the asynchronous version of this method.
17903 *
17904 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
17905 */
17906gboolean
17907event_log_call_get_event_log_sync (
17908 EventLog *proxy,
17909 GVariant **out_log,
17910 GCancellable *cancellable,
17911 GError **error)
17912{
17913 GVariant *_ret;
17914 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
17915 "getEventLog",
17916 g_variant_new ("()"),
17917 G_DBUS_CALL_FLAGS_NONE,
17918 -1,
17919 cancellable,
17920 error);
17921 if (_ret == NULL)
17922 goto _out;
17923 g_variant_get (_ret,
17924 "(@a(s))",
17925 out_log);
17926 g_variant_unref (_ret);
17927_out:
17928 return _ret != NULL;
17929}
17930
17931/**
17932 * event_log_complete_get_event_log:
17933 * @object: A #EventLog.
17934 * @invocation: (transfer full): A #GDBusMethodInvocation.
17935 * @log: Parameter to return.
17936 *
17937 * 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.
17938 *
17939 * This method will free @invocation, you cannot use it afterwards.
17940 */
17941void
17942event_log_complete_get_event_log (
17943 EventLog *object,
17944 GDBusMethodInvocation *invocation,
17945 GVariant *log)
17946{
17947 g_dbus_method_invocation_return_value (invocation,
17948 g_variant_new ("(@a(s))",
17949 log));
17950}
17951
Norman James362a80f2015-09-14 14:04:39 -050017952/* ------------------------------------------------------------------------ */
17953
17954/**
17955 * EventLogProxy:
17956 *
17957 * The #EventLogProxy structure contains only private data and should only be accessed using the provided API.
17958 */
17959
17960/**
17961 * EventLogProxyClass:
17962 * @parent_class: The parent class.
17963 *
17964 * Class structure for #EventLogProxy.
17965 */
17966
17967struct _EventLogProxyPrivate
17968{
17969 GData *qdata;
17970};
17971
17972static void event_log_proxy_iface_init (EventLogIface *iface);
17973
17974#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17975G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
17976 G_ADD_PRIVATE (EventLogProxy)
17977 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
17978
17979#else
17980G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
17981 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
17982
17983#endif
17984static void
17985event_log_proxy_finalize (GObject *object)
17986{
17987 EventLogProxy *proxy = EVENT_LOG_PROXY (object);
17988 g_datalist_clear (&proxy->priv->qdata);
17989 G_OBJECT_CLASS (event_log_proxy_parent_class)->finalize (object);
17990}
17991
17992static void
17993event_log_proxy_get_property (GObject *object,
17994 guint prop_id,
17995 GValue *value,
17996 GParamSpec *pspec G_GNUC_UNUSED)
17997{
Norman James362a80f2015-09-14 14:04:39 -050017998}
17999
18000static void
18001event_log_proxy_set_property (GObject *object,
18002 guint prop_id,
18003 const GValue *value,
18004 GParamSpec *pspec G_GNUC_UNUSED)
18005{
Norman James362a80f2015-09-14 14:04:39 -050018006}
18007
18008static void
18009event_log_proxy_g_signal (GDBusProxy *proxy,
18010 const gchar *sender_name G_GNUC_UNUSED,
18011 const gchar *signal_name,
18012 GVariant *parameters)
18013{
18014 _ExtendedGDBusSignalInfo *info;
18015 GVariantIter iter;
18016 GVariant *child;
18017 GValue *paramv;
18018 guint num_params;
18019 guint n;
18020 guint signal_id;
18021 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, signal_name);
18022 if (info == NULL)
18023 return;
18024 num_params = g_variant_n_children (parameters);
18025 paramv = g_new0 (GValue, num_params + 1);
18026 g_value_init (&paramv[0], TYPE_EVENT_LOG);
18027 g_value_set_object (&paramv[0], proxy);
18028 g_variant_iter_init (&iter, parameters);
18029 n = 1;
18030 while ((child = g_variant_iter_next_value (&iter)) != NULL)
18031 {
18032 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
18033 if (arg_info->use_gvariant)
18034 {
18035 g_value_init (&paramv[n], G_TYPE_VARIANT);
18036 g_value_set_variant (&paramv[n], child);
18037 n++;
18038 }
18039 else
18040 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
18041 g_variant_unref (child);
18042 }
18043 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
18044 g_signal_emitv (paramv, signal_id, 0, NULL);
18045 for (n = 0; n < num_params + 1; n++)
18046 g_value_unset (&paramv[n]);
18047 g_free (paramv);
18048}
18049
18050static void
18051event_log_proxy_g_properties_changed (GDBusProxy *_proxy,
18052 GVariant *changed_properties,
18053 const gchar *const *invalidated_properties)
18054{
18055 EventLogProxy *proxy = EVENT_LOG_PROXY (_proxy);
18056 guint n;
18057 const gchar *key;
18058 GVariantIter *iter;
18059 _ExtendedGDBusPropertyInfo *info;
18060 g_variant_get (changed_properties, "a{sv}", &iter);
18061 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
18062 {
18063 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, key);
18064 g_datalist_remove_data (&proxy->priv->qdata, key);
18065 if (info != NULL)
18066 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
18067 }
18068 g_variant_iter_free (iter);
18069 for (n = 0; invalidated_properties[n] != NULL; n++)
18070 {
18071 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, invalidated_properties[n]);
18072 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
18073 if (info != NULL)
18074 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
18075 }
18076}
18077
Norman James362a80f2015-09-14 14:04:39 -050018078static void
18079event_log_proxy_init (EventLogProxy *proxy)
18080{
18081#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18082 proxy->priv = event_log_proxy_get_instance_private (proxy);
18083#else
18084 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_EVENT_LOG_PROXY, EventLogProxyPrivate);
18085#endif
18086
18087 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), event_log_interface_info ());
18088}
18089
18090static void
18091event_log_proxy_class_init (EventLogProxyClass *klass)
18092{
18093 GObjectClass *gobject_class;
18094 GDBusProxyClass *proxy_class;
18095
18096 gobject_class = G_OBJECT_CLASS (klass);
18097 gobject_class->finalize = event_log_proxy_finalize;
18098 gobject_class->get_property = event_log_proxy_get_property;
18099 gobject_class->set_property = event_log_proxy_set_property;
18100
18101 proxy_class = G_DBUS_PROXY_CLASS (klass);
18102 proxy_class->g_signal = event_log_proxy_g_signal;
18103 proxy_class->g_properties_changed = event_log_proxy_g_properties_changed;
18104
Norman James362a80f2015-09-14 14:04:39 -050018105#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
18106 g_type_class_add_private (klass, sizeof (EventLogProxyPrivate));
18107#endif
18108}
18109
18110static void
18111event_log_proxy_iface_init (EventLogIface *iface)
18112{
Norman James362a80f2015-09-14 14:04:39 -050018113}
18114
18115/**
18116 * event_log_proxy_new:
18117 * @connection: A #GDBusConnection.
18118 * @flags: Flags from the #GDBusProxyFlags enumeration.
18119 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
18120 * @object_path: An object path.
18121 * @cancellable: (allow-none): A #GCancellable or %NULL.
18122 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
18123 * @user_data: User data to pass to @callback.
18124 *
18125 * 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.
18126 *
18127 * 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.
18128 * You can then call event_log_proxy_new_finish() to get the result of the operation.
18129 *
18130 * See event_log_proxy_new_sync() for the synchronous, blocking version of this constructor.
18131 */
18132void
18133event_log_proxy_new (
18134 GDBusConnection *connection,
18135 GDBusProxyFlags flags,
18136 const gchar *name,
18137 const gchar *object_path,
18138 GCancellable *cancellable,
18139 GAsyncReadyCallback callback,
18140 gpointer user_data)
18141{
18142 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);
18143}
18144
18145/**
18146 * event_log_proxy_new_finish:
18147 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new().
18148 * @error: Return location for error or %NULL
18149 *
18150 * Finishes an operation started with event_log_proxy_new().
18151 *
18152 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
18153 */
18154EventLog *
18155event_log_proxy_new_finish (
18156 GAsyncResult *res,
18157 GError **error)
18158{
18159 GObject *ret;
18160 GObject *source_object;
18161 source_object = g_async_result_get_source_object (res);
18162 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
18163 g_object_unref (source_object);
18164 if (ret != NULL)
18165 return EVENT_LOG (ret);
18166 else
18167 return NULL;
18168}
18169
18170/**
18171 * event_log_proxy_new_sync:
18172 * @connection: A #GDBusConnection.
18173 * @flags: Flags from the #GDBusProxyFlags enumeration.
18174 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
18175 * @object_path: An object path.
18176 * @cancellable: (allow-none): A #GCancellable or %NULL.
18177 * @error: Return location for error or %NULL
18178 *
18179 * 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.
18180 *
18181 * The calling thread is blocked until a reply is received.
18182 *
18183 * See event_log_proxy_new() for the asynchronous version of this constructor.
18184 *
18185 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
18186 */
18187EventLog *
18188event_log_proxy_new_sync (
18189 GDBusConnection *connection,
18190 GDBusProxyFlags flags,
18191 const gchar *name,
18192 const gchar *object_path,
18193 GCancellable *cancellable,
18194 GError **error)
18195{
18196 GInitable *ret;
18197 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);
18198 if (ret != NULL)
18199 return EVENT_LOG (ret);
18200 else
18201 return NULL;
18202}
18203
18204
18205/**
18206 * event_log_proxy_new_for_bus:
18207 * @bus_type: A #GBusType.
18208 * @flags: Flags from the #GDBusProxyFlags enumeration.
18209 * @name: A bus name (well-known or unique).
18210 * @object_path: An object path.
18211 * @cancellable: (allow-none): A #GCancellable or %NULL.
18212 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
18213 * @user_data: User data to pass to @callback.
18214 *
18215 * Like event_log_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
18216 *
18217 * 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.
18218 * You can then call event_log_proxy_new_for_bus_finish() to get the result of the operation.
18219 *
18220 * See event_log_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
18221 */
18222void
18223event_log_proxy_new_for_bus (
18224 GBusType bus_type,
18225 GDBusProxyFlags flags,
18226 const gchar *name,
18227 const gchar *object_path,
18228 GCancellable *cancellable,
18229 GAsyncReadyCallback callback,
18230 gpointer user_data)
18231{
18232 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);
18233}
18234
18235/**
18236 * event_log_proxy_new_for_bus_finish:
18237 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new_for_bus().
18238 * @error: Return location for error or %NULL
18239 *
18240 * Finishes an operation started with event_log_proxy_new_for_bus().
18241 *
18242 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
18243 */
18244EventLog *
18245event_log_proxy_new_for_bus_finish (
18246 GAsyncResult *res,
18247 GError **error)
18248{
18249 GObject *ret;
18250 GObject *source_object;
18251 source_object = g_async_result_get_source_object (res);
18252 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
18253 g_object_unref (source_object);
18254 if (ret != NULL)
18255 return EVENT_LOG (ret);
18256 else
18257 return NULL;
18258}
18259
18260/**
18261 * event_log_proxy_new_for_bus_sync:
18262 * @bus_type: A #GBusType.
18263 * @flags: Flags from the #GDBusProxyFlags enumeration.
18264 * @name: A bus name (well-known or unique).
18265 * @object_path: An object path.
18266 * @cancellable: (allow-none): A #GCancellable or %NULL.
18267 * @error: Return location for error or %NULL
18268 *
18269 * Like event_log_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
18270 *
18271 * The calling thread is blocked until a reply is received.
18272 *
18273 * See event_log_proxy_new_for_bus() for the asynchronous version of this constructor.
18274 *
18275 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
18276 */
18277EventLog *
18278event_log_proxy_new_for_bus_sync (
18279 GBusType bus_type,
18280 GDBusProxyFlags flags,
18281 const gchar *name,
18282 const gchar *object_path,
18283 GCancellable *cancellable,
18284 GError **error)
18285{
18286 GInitable *ret;
18287 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);
18288 if (ret != NULL)
18289 return EVENT_LOG (ret);
18290 else
18291 return NULL;
18292}
18293
18294
18295/* ------------------------------------------------------------------------ */
18296
18297/**
18298 * EventLogSkeleton:
18299 *
18300 * The #EventLogSkeleton structure contains only private data and should only be accessed using the provided API.
18301 */
18302
18303/**
18304 * EventLogSkeletonClass:
18305 * @parent_class: The parent class.
18306 *
18307 * Class structure for #EventLogSkeleton.
18308 */
18309
18310struct _EventLogSkeletonPrivate
18311{
18312 GValue *properties;
18313 GList *changed_properties;
18314 GSource *changed_properties_idle_source;
18315 GMainContext *context;
18316 GMutex lock;
18317};
18318
18319static void
18320_event_log_skeleton_handle_method_call (
18321 GDBusConnection *connection G_GNUC_UNUSED,
18322 const gchar *sender G_GNUC_UNUSED,
18323 const gchar *object_path G_GNUC_UNUSED,
18324 const gchar *interface_name,
18325 const gchar *method_name,
18326 GVariant *parameters,
18327 GDBusMethodInvocation *invocation,
18328 gpointer user_data)
18329{
18330 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
18331 _ExtendedGDBusMethodInfo *info;
18332 GVariantIter iter;
18333 GVariant *child;
18334 GValue *paramv;
18335 guint num_params;
18336 guint num_extra;
18337 guint n;
18338 guint signal_id;
18339 GValue return_value = G_VALUE_INIT;
18340 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
18341 g_assert (info != NULL);
18342 num_params = g_variant_n_children (parameters);
18343 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
18344 n = 0;
18345 g_value_init (&paramv[n], TYPE_EVENT_LOG);
18346 g_value_set_object (&paramv[n++], skeleton);
18347 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
18348 g_value_set_object (&paramv[n++], invocation);
18349 if (info->pass_fdlist)
18350 {
18351#ifdef G_OS_UNIX
18352 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
18353 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
18354#else
18355 g_assert_not_reached ();
18356#endif
18357 }
18358 g_variant_iter_init (&iter, parameters);
18359 while ((child = g_variant_iter_next_value (&iter)) != NULL)
18360 {
18361 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
18362 if (arg_info->use_gvariant)
18363 {
18364 g_value_init (&paramv[n], G_TYPE_VARIANT);
18365 g_value_set_variant (&paramv[n], child);
18366 n++;
18367 }
18368 else
18369 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
18370 g_variant_unref (child);
18371 }
18372 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
18373 g_value_init (&return_value, G_TYPE_BOOLEAN);
18374 g_signal_emitv (paramv, signal_id, 0, &return_value);
18375 if (!g_value_get_boolean (&return_value))
18376 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);
18377 g_value_unset (&return_value);
18378 for (n = 0; n < num_params + num_extra; n++)
18379 g_value_unset (&paramv[n]);
18380 g_free (paramv);
18381}
18382
18383static GVariant *
18384_event_log_skeleton_handle_get_property (
18385 GDBusConnection *connection G_GNUC_UNUSED,
18386 const gchar *sender G_GNUC_UNUSED,
18387 const gchar *object_path G_GNUC_UNUSED,
18388 const gchar *interface_name G_GNUC_UNUSED,
18389 const gchar *property_name,
18390 GError **error,
18391 gpointer user_data)
18392{
18393 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
18394 GValue value = G_VALUE_INIT;
18395 GParamSpec *pspec;
18396 _ExtendedGDBusPropertyInfo *info;
18397 GVariant *ret;
18398 ret = NULL;
18399 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
18400 g_assert (info != NULL);
18401 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
18402 if (pspec == NULL)
18403 {
18404 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
18405 }
18406 else
18407 {
18408 g_value_init (&value, pspec->value_type);
18409 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
18410 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
18411 g_value_unset (&value);
18412 }
18413 return ret;
18414}
18415
18416static gboolean
18417_event_log_skeleton_handle_set_property (
18418 GDBusConnection *connection G_GNUC_UNUSED,
18419 const gchar *sender G_GNUC_UNUSED,
18420 const gchar *object_path G_GNUC_UNUSED,
18421 const gchar *interface_name G_GNUC_UNUSED,
18422 const gchar *property_name,
18423 GVariant *variant,
18424 GError **error,
18425 gpointer user_data)
18426{
18427 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
18428 GValue value = G_VALUE_INIT;
18429 GParamSpec *pspec;
18430 _ExtendedGDBusPropertyInfo *info;
18431 gboolean ret;
18432 ret = FALSE;
18433 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
18434 g_assert (info != NULL);
18435 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
18436 if (pspec == NULL)
18437 {
18438 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
18439 }
18440 else
18441 {
18442 if (info->use_gvariant)
18443 g_value_set_variant (&value, variant);
18444 else
18445 g_dbus_gvariant_to_gvalue (variant, &value);
18446 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
18447 g_value_unset (&value);
18448 ret = TRUE;
18449 }
18450 return ret;
18451}
18452
18453static const GDBusInterfaceVTable _event_log_skeleton_vtable =
18454{
18455 _event_log_skeleton_handle_method_call,
18456 _event_log_skeleton_handle_get_property,
18457 _event_log_skeleton_handle_set_property,
18458 {NULL}
18459};
18460
18461static GDBusInterfaceInfo *
18462event_log_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
18463{
18464 return event_log_interface_info ();
18465}
18466
18467static GDBusInterfaceVTable *
18468event_log_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
18469{
18470 return (GDBusInterfaceVTable *) &_event_log_skeleton_vtable;
18471}
18472
18473static GVariant *
18474event_log_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
18475{
18476 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (_skeleton);
18477
18478 GVariantBuilder builder;
18479 guint n;
18480 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
18481 if (_event_log_interface_info.parent_struct.properties == NULL)
18482 goto out;
18483 for (n = 0; _event_log_interface_info.parent_struct.properties[n] != NULL; n++)
18484 {
18485 GDBusPropertyInfo *info = _event_log_interface_info.parent_struct.properties[n];
18486 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
18487 {
18488 GVariant *value;
18489 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);
18490 if (value != NULL)
18491 {
18492 g_variant_take_ref (value);
18493 g_variant_builder_add (&builder, "{sv}", info->name, value);
18494 g_variant_unref (value);
18495 }
18496 }
18497 }
18498out:
18499 return g_variant_builder_end (&builder);
18500}
18501
Norman James362a80f2015-09-14 14:04:39 -050018502static void
18503event_log_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
18504{
Norman James362a80f2015-09-14 14:04:39 -050018505}
18506
18507static void
18508_event_log_on_signal_event_log (
18509 EventLog *object,
Norman James8abb50c2015-09-16 10:58:16 -050018510 gint arg_priority,
Norman James88872672015-09-21 16:51:35 -050018511 const gchar *arg_message,
18512 gint arg_rc)
Norman James362a80f2015-09-14 14:04:39 -050018513{
18514 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
18515
18516 GList *connections, *l;
18517 GVariant *signal_variant;
18518 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
18519
Norman James88872672015-09-21 16:51:35 -050018520 signal_variant = g_variant_ref_sink (g_variant_new ("(isi)",
Norman James8abb50c2015-09-16 10:58:16 -050018521 arg_priority,
Norman James88872672015-09-21 16:51:35 -050018522 arg_message,
18523 arg_rc));
Norman James362a80f2015-09-14 14:04:39 -050018524 for (l = connections; l != NULL; l = l->next)
18525 {
18526 GDBusConnection *connection = l->data;
18527 g_dbus_connection_emit_signal (connection,
18528 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.EventLog", "EventLog",
18529 signal_variant, NULL);
18530 }
18531 g_variant_unref (signal_variant);
18532 g_list_free_full (connections, g_object_unref);
18533}
18534
18535static void event_log_skeleton_iface_init (EventLogIface *iface);
18536#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18537G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
18538 G_ADD_PRIVATE (EventLogSkeleton)
18539 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
18540
18541#else
18542G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
18543 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
18544
18545#endif
18546static void
18547event_log_skeleton_finalize (GObject *object)
18548{
18549 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
Norman James362a80f2015-09-14 14:04:39 -050018550 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
18551 if (skeleton->priv->changed_properties_idle_source != NULL)
18552 g_source_destroy (skeleton->priv->changed_properties_idle_source);
18553 g_main_context_unref (skeleton->priv->context);
18554 g_mutex_clear (&skeleton->priv->lock);
18555 G_OBJECT_CLASS (event_log_skeleton_parent_class)->finalize (object);
18556}
18557
18558static void
Norman James362a80f2015-09-14 14:04:39 -050018559event_log_skeleton_init (EventLogSkeleton *skeleton)
18560{
18561#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18562 skeleton->priv = event_log_skeleton_get_instance_private (skeleton);
18563#else
18564 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_EVENT_LOG_SKELETON, EventLogSkeletonPrivate);
18565#endif
18566
18567 g_mutex_init (&skeleton->priv->lock);
18568 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James362a80f2015-09-14 14:04:39 -050018569}
18570
18571static void
18572event_log_skeleton_class_init (EventLogSkeletonClass *klass)
18573{
18574 GObjectClass *gobject_class;
18575 GDBusInterfaceSkeletonClass *skeleton_class;
18576
18577 gobject_class = G_OBJECT_CLASS (klass);
18578 gobject_class->finalize = event_log_skeleton_finalize;
Norman James362a80f2015-09-14 14:04:39 -050018579
18580 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
18581 skeleton_class->get_info = event_log_skeleton_dbus_interface_get_info;
18582 skeleton_class->get_properties = event_log_skeleton_dbus_interface_get_properties;
18583 skeleton_class->flush = event_log_skeleton_dbus_interface_flush;
18584 skeleton_class->get_vtable = event_log_skeleton_dbus_interface_get_vtable;
18585
18586#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
18587 g_type_class_add_private (klass, sizeof (EventLogSkeletonPrivate));
18588#endif
18589}
18590
18591static void
18592event_log_skeleton_iface_init (EventLogIface *iface)
18593{
18594 iface->event_log = _event_log_on_signal_event_log;
Norman James362a80f2015-09-14 14:04:39 -050018595}
18596
18597/**
18598 * event_log_skeleton_new:
18599 *
18600 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
18601 *
18602 * Returns: (transfer full) (type EventLogSkeleton): The skeleton object.
18603 */
18604EventLog *
18605event_log_skeleton_new (void)
18606{
18607 return EVENT_LOG (g_object_new (TYPE_EVENT_LOG_SKELETON, NULL));
18608}
18609
18610/* ------------------------------------------------------------------------
18611 * Code for interface org.openbmc.Flash
18612 * ------------------------------------------------------------------------
18613 */
18614
18615/**
18616 * SECTION:Flash
18617 * @title: Flash
18618 * @short_description: Generated C code for the org.openbmc.Flash D-Bus interface
18619 *
18620 * 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.
18621 */
18622
18623/* ---- Introspection data for org.openbmc.Flash ---- */
18624
18625static const _ExtendedGDBusArgInfo _flash_method_info_update_via_file_IN_ARG_file =
18626{
18627 {
18628 -1,
18629 (gchar *) "file",
18630 (gchar *) "s",
18631 NULL
18632 },
18633 FALSE
18634};
18635
18636static const _ExtendedGDBusArgInfo * const _flash_method_info_update_via_file_IN_ARG_pointers[] =
18637{
18638 &_flash_method_info_update_via_file_IN_ARG_file,
18639 NULL
18640};
18641
18642static const _ExtendedGDBusMethodInfo _flash_method_info_update_via_file =
18643{
18644 {
18645 -1,
18646 (gchar *) "updateViaFile",
18647 (GDBusArgInfo **) &_flash_method_info_update_via_file_IN_ARG_pointers,
18648 NULL,
18649 NULL
18650 },
18651 "handle-update-via-file",
18652 FALSE
18653};
18654
18655static const _ExtendedGDBusArgInfo _flash_method_info_update_via_http_IN_ARG_url =
18656{
18657 {
18658 -1,
18659 (gchar *) "url",
18660 (gchar *) "s",
18661 NULL
18662 },
18663 FALSE
18664};
18665
18666static const _ExtendedGDBusArgInfo * const _flash_method_info_update_via_http_IN_ARG_pointers[] =
18667{
18668 &_flash_method_info_update_via_http_IN_ARG_url,
18669 NULL
18670};
18671
18672static const _ExtendedGDBusMethodInfo _flash_method_info_update_via_http =
18673{
18674 {
18675 -1,
18676 (gchar *) "updateViaHttp",
18677 (GDBusArgInfo **) &_flash_method_info_update_via_http_IN_ARG_pointers,
18678 NULL,
18679 NULL
18680 },
18681 "handle-update-via-http",
18682 FALSE
18683};
18684
18685static const _ExtendedGDBusMethodInfo _flash_method_info_erase =
18686{
18687 {
18688 -1,
18689 (gchar *) "erase",
18690 NULL,
18691 NULL,
18692 NULL
18693 },
18694 "handle-erase",
18695 FALSE
18696};
18697
18698static const _ExtendedGDBusMethodInfo _flash_method_info_init =
18699{
18700 {
18701 -1,
18702 (gchar *) "init",
18703 NULL,
18704 NULL,
18705 NULL
18706 },
18707 "handle-init",
18708 FALSE
18709};
18710
18711static const _ExtendedGDBusMethodInfo * const _flash_method_info_pointers[] =
18712{
18713 &_flash_method_info_update_via_file,
18714 &_flash_method_info_update_via_http,
18715 &_flash_method_info_erase,
18716 &_flash_method_info_init,
18717 NULL
18718};
18719
18720static const _ExtendedGDBusSignalInfo _flash_signal_info_updated =
18721{
18722 {
18723 -1,
18724 (gchar *) "Updated",
18725 NULL,
18726 NULL
18727 },
18728 "updated"
18729};
18730
18731static const _ExtendedGDBusSignalInfo * const _flash_signal_info_pointers[] =
18732{
18733 &_flash_signal_info_updated,
18734 NULL
18735};
18736
18737static const _ExtendedGDBusInterfaceInfo _flash_interface_info =
18738{
18739 {
18740 -1,
18741 (gchar *) "org.openbmc.Flash",
18742 (GDBusMethodInfo **) &_flash_method_info_pointers,
18743 (GDBusSignalInfo **) &_flash_signal_info_pointers,
18744 NULL,
18745 NULL
18746 },
18747 "flash",
18748};
18749
18750
18751/**
18752 * flash_interface_info:
18753 *
18754 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> D-Bus interface.
18755 *
18756 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
18757 */
18758GDBusInterfaceInfo *
18759flash_interface_info (void)
18760{
18761 return (GDBusInterfaceInfo *) &_flash_interface_info.parent_struct;
18762}
18763
18764/**
18765 * flash_override_properties:
18766 * @klass: The class structure for a #GObject<!-- -->-derived class.
18767 * @property_id_begin: The property id to assign to the first overridden property.
18768 *
18769 * Overrides all #GObject properties in the #Flash interface for a concrete class.
18770 * The properties are overridden in the order they are defined.
18771 *
18772 * Returns: The last property id.
18773 */
18774guint
18775flash_override_properties (GObjectClass *klass, guint property_id_begin)
18776{
18777 return property_id_begin - 1;
18778}
18779
18780
18781
18782/**
18783 * Flash:
18784 *
18785 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
18786 */
18787
18788/**
18789 * FlashIface:
18790 * @parent_iface: The parent interface.
18791 * @handle_erase: Handler for the #Flash::handle-erase signal.
18792 * @handle_init: Handler for the #Flash::handle-init signal.
18793 * @handle_update_via_file: Handler for the #Flash::handle-update-via-file signal.
18794 * @handle_update_via_http: Handler for the #Flash::handle-update-via-http signal.
18795 * @updated: Handler for the #Flash::updated signal.
18796 *
18797 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
18798 */
18799
18800typedef FlashIface FlashInterface;
18801G_DEFINE_INTERFACE (Flash, flash, G_TYPE_OBJECT);
18802
18803static void
18804flash_default_init (FlashIface *iface)
18805{
18806 /* GObject signals for incoming D-Bus method calls: */
18807 /**
18808 * Flash::handle-update-via-file:
18809 * @object: A #Flash.
18810 * @invocation: A #GDBusMethodInvocation.
18811 * @arg_file: Argument passed by remote caller.
18812 *
18813 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.updateViaFile">updateViaFile()</link> D-Bus method.
18814 *
18815 * 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.
18816 *
18817 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
18818 */
18819 g_signal_new ("handle-update-via-file",
18820 G_TYPE_FROM_INTERFACE (iface),
18821 G_SIGNAL_RUN_LAST,
18822 G_STRUCT_OFFSET (FlashIface, handle_update_via_file),
18823 g_signal_accumulator_true_handled,
18824 NULL,
18825 g_cclosure_marshal_generic,
18826 G_TYPE_BOOLEAN,
18827 2,
18828 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
18829
18830 /**
18831 * Flash::handle-update-via-http:
18832 * @object: A #Flash.
18833 * @invocation: A #GDBusMethodInvocation.
18834 * @arg_url: Argument passed by remote caller.
18835 *
18836 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.updateViaHttp">updateViaHttp()</link> D-Bus method.
18837 *
18838 * 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.
18839 *
18840 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
18841 */
18842 g_signal_new ("handle-update-via-http",
18843 G_TYPE_FROM_INTERFACE (iface),
18844 G_SIGNAL_RUN_LAST,
18845 G_STRUCT_OFFSET (FlashIface, handle_update_via_http),
18846 g_signal_accumulator_true_handled,
18847 NULL,
18848 g_cclosure_marshal_generic,
18849 G_TYPE_BOOLEAN,
18850 2,
18851 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
18852
18853 /**
18854 * Flash::handle-erase:
18855 * @object: A #Flash.
18856 * @invocation: A #GDBusMethodInvocation.
18857 *
18858 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.erase">erase()</link> D-Bus method.
18859 *
18860 * 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.
18861 *
18862 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
18863 */
18864 g_signal_new ("handle-erase",
18865 G_TYPE_FROM_INTERFACE (iface),
18866 G_SIGNAL_RUN_LAST,
18867 G_STRUCT_OFFSET (FlashIface, handle_erase),
18868 g_signal_accumulator_true_handled,
18869 NULL,
18870 g_cclosure_marshal_generic,
18871 G_TYPE_BOOLEAN,
18872 1,
18873 G_TYPE_DBUS_METHOD_INVOCATION);
18874
18875 /**
18876 * Flash::handle-init:
18877 * @object: A #Flash.
18878 * @invocation: A #GDBusMethodInvocation.
18879 *
18880 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method.
18881 *
18882 * 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.
18883 *
18884 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
18885 */
18886 g_signal_new ("handle-init",
18887 G_TYPE_FROM_INTERFACE (iface),
18888 G_SIGNAL_RUN_LAST,
18889 G_STRUCT_OFFSET (FlashIface, handle_init),
18890 g_signal_accumulator_true_handled,
18891 NULL,
18892 g_cclosure_marshal_generic,
18893 G_TYPE_BOOLEAN,
18894 1,
18895 G_TYPE_DBUS_METHOD_INVOCATION);
18896
18897 /* GObject signals for received D-Bus signals: */
18898 /**
18899 * Flash::updated:
18900 * @object: A #Flash.
18901 *
18902 * 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.
18903 *
18904 * 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.
18905 */
18906 g_signal_new ("updated",
18907 G_TYPE_FROM_INTERFACE (iface),
18908 G_SIGNAL_RUN_LAST,
18909 G_STRUCT_OFFSET (FlashIface, updated),
18910 NULL,
18911 NULL,
18912 g_cclosure_marshal_generic,
18913 G_TYPE_NONE,
18914 0);
18915
18916}
18917
18918/**
18919 * flash_emit_updated:
18920 * @object: A #Flash.
18921 *
18922 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Updated">"Updated"</link> D-Bus signal.
18923 */
18924void
18925flash_emit_updated (
18926 Flash *object)
18927{
18928 g_signal_emit_by_name (object, "updated");
18929}
18930
18931/**
18932 * flash_call_update_via_file:
18933 * @proxy: A #FlashProxy.
18934 * @arg_file: Argument to pass with the method invocation.
18935 * @cancellable: (allow-none): A #GCancellable or %NULL.
18936 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
18937 * @user_data: User data to pass to @callback.
18938 *
18939 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaFile">updateViaFile()</link> D-Bus method on @proxy.
18940 * 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.
18941 * You can then call flash_call_update_via_file_finish() to get the result of the operation.
18942 *
18943 * See flash_call_update_via_file_sync() for the synchronous, blocking version of this method.
18944 */
18945void
18946flash_call_update_via_file (
18947 Flash *proxy,
18948 const gchar *arg_file,
18949 GCancellable *cancellable,
18950 GAsyncReadyCallback callback,
18951 gpointer user_data)
18952{
18953 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
18954 "updateViaFile",
18955 g_variant_new ("(s)",
18956 arg_file),
18957 G_DBUS_CALL_FLAGS_NONE,
18958 -1,
18959 cancellable,
18960 callback,
18961 user_data);
18962}
18963
18964/**
18965 * flash_call_update_via_file_finish:
18966 * @proxy: A #FlashProxy.
18967 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update_via_file().
18968 * @error: Return location for error or %NULL.
18969 *
18970 * Finishes an operation started with flash_call_update_via_file().
18971 *
18972 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18973 */
18974gboolean
18975flash_call_update_via_file_finish (
18976 Flash *proxy,
18977 GAsyncResult *res,
18978 GError **error)
18979{
18980 GVariant *_ret;
18981 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
18982 if (_ret == NULL)
18983 goto _out;
18984 g_variant_get (_ret,
18985 "()");
18986 g_variant_unref (_ret);
18987_out:
18988 return _ret != NULL;
18989}
18990
18991/**
18992 * flash_call_update_via_file_sync:
18993 * @proxy: A #FlashProxy.
18994 * @arg_file: Argument to pass with the method invocation.
18995 * @cancellable: (allow-none): A #GCancellable or %NULL.
18996 * @error: Return location for error or %NULL.
18997 *
18998 * 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.
18999 *
19000 * See flash_call_update_via_file() for the asynchronous version of this method.
19001 *
19002 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19003 */
19004gboolean
19005flash_call_update_via_file_sync (
19006 Flash *proxy,
19007 const gchar *arg_file,
19008 GCancellable *cancellable,
19009 GError **error)
19010{
19011 GVariant *_ret;
19012 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19013 "updateViaFile",
19014 g_variant_new ("(s)",
19015 arg_file),
19016 G_DBUS_CALL_FLAGS_NONE,
19017 -1,
19018 cancellable,
19019 error);
19020 if (_ret == NULL)
19021 goto _out;
19022 g_variant_get (_ret,
19023 "()");
19024 g_variant_unref (_ret);
19025_out:
19026 return _ret != NULL;
19027}
19028
19029/**
19030 * flash_call_update_via_http:
19031 * @proxy: A #FlashProxy.
19032 * @arg_url: Argument to pass with the method invocation.
19033 * @cancellable: (allow-none): A #GCancellable or %NULL.
19034 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19035 * @user_data: User data to pass to @callback.
19036 *
19037 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaHttp">updateViaHttp()</link> D-Bus method on @proxy.
19038 * 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.
19039 * You can then call flash_call_update_via_http_finish() to get the result of the operation.
19040 *
19041 * See flash_call_update_via_http_sync() for the synchronous, blocking version of this method.
19042 */
19043void
19044flash_call_update_via_http (
19045 Flash *proxy,
19046 const gchar *arg_url,
19047 GCancellable *cancellable,
19048 GAsyncReadyCallback callback,
19049 gpointer user_data)
19050{
19051 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19052 "updateViaHttp",
19053 g_variant_new ("(s)",
19054 arg_url),
19055 G_DBUS_CALL_FLAGS_NONE,
19056 -1,
19057 cancellable,
19058 callback,
19059 user_data);
19060}
19061
19062/**
19063 * flash_call_update_via_http_finish:
19064 * @proxy: A #FlashProxy.
19065 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update_via_http().
19066 * @error: Return location for error or %NULL.
19067 *
19068 * Finishes an operation started with flash_call_update_via_http().
19069 *
19070 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19071 */
19072gboolean
19073flash_call_update_via_http_finish (
19074 Flash *proxy,
19075 GAsyncResult *res,
19076 GError **error)
19077{
19078 GVariant *_ret;
19079 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19080 if (_ret == NULL)
19081 goto _out;
19082 g_variant_get (_ret,
19083 "()");
19084 g_variant_unref (_ret);
19085_out:
19086 return _ret != NULL;
19087}
19088
19089/**
19090 * flash_call_update_via_http_sync:
19091 * @proxy: A #FlashProxy.
19092 * @arg_url: Argument to pass with the method invocation.
19093 * @cancellable: (allow-none): A #GCancellable or %NULL.
19094 * @error: Return location for error or %NULL.
19095 *
19096 * 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.
19097 *
19098 * See flash_call_update_via_http() for the asynchronous version of this method.
19099 *
19100 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19101 */
19102gboolean
19103flash_call_update_via_http_sync (
19104 Flash *proxy,
19105 const gchar *arg_url,
19106 GCancellable *cancellable,
19107 GError **error)
19108{
19109 GVariant *_ret;
19110 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19111 "updateViaHttp",
19112 g_variant_new ("(s)",
19113 arg_url),
19114 G_DBUS_CALL_FLAGS_NONE,
19115 -1,
19116 cancellable,
19117 error);
19118 if (_ret == NULL)
19119 goto _out;
19120 g_variant_get (_ret,
19121 "()");
19122 g_variant_unref (_ret);
19123_out:
19124 return _ret != NULL;
19125}
19126
19127/**
19128 * flash_call_erase:
19129 * @proxy: A #FlashProxy.
19130 * @cancellable: (allow-none): A #GCancellable or %NULL.
19131 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19132 * @user_data: User data to pass to @callback.
19133 *
19134 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.erase">erase()</link> D-Bus method on @proxy.
19135 * 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.
19136 * You can then call flash_call_erase_finish() to get the result of the operation.
19137 *
19138 * See flash_call_erase_sync() for the synchronous, blocking version of this method.
19139 */
19140void
19141flash_call_erase (
19142 Flash *proxy,
19143 GCancellable *cancellable,
19144 GAsyncReadyCallback callback,
19145 gpointer user_data)
19146{
19147 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19148 "erase",
19149 g_variant_new ("()"),
19150 G_DBUS_CALL_FLAGS_NONE,
19151 -1,
19152 cancellable,
19153 callback,
19154 user_data);
19155}
19156
19157/**
19158 * flash_call_erase_finish:
19159 * @proxy: A #FlashProxy.
19160 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_erase().
19161 * @error: Return location for error or %NULL.
19162 *
19163 * Finishes an operation started with flash_call_erase().
19164 *
19165 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19166 */
19167gboolean
19168flash_call_erase_finish (
19169 Flash *proxy,
19170 GAsyncResult *res,
19171 GError **error)
19172{
19173 GVariant *_ret;
19174 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19175 if (_ret == NULL)
19176 goto _out;
19177 g_variant_get (_ret,
19178 "()");
19179 g_variant_unref (_ret);
19180_out:
19181 return _ret != NULL;
19182}
19183
19184/**
19185 * flash_call_erase_sync:
19186 * @proxy: A #FlashProxy.
19187 * @cancellable: (allow-none): A #GCancellable or %NULL.
19188 * @error: Return location for error or %NULL.
19189 *
19190 * 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.
19191 *
19192 * See flash_call_erase() for the asynchronous version of this method.
19193 *
19194 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19195 */
19196gboolean
19197flash_call_erase_sync (
19198 Flash *proxy,
19199 GCancellable *cancellable,
19200 GError **error)
19201{
19202 GVariant *_ret;
19203 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19204 "erase",
19205 g_variant_new ("()"),
19206 G_DBUS_CALL_FLAGS_NONE,
19207 -1,
19208 cancellable,
19209 error);
19210 if (_ret == NULL)
19211 goto _out;
19212 g_variant_get (_ret,
19213 "()");
19214 g_variant_unref (_ret);
19215_out:
19216 return _ret != NULL;
19217}
19218
19219/**
19220 * flash_call_init:
19221 * @proxy: A #FlashProxy.
19222 * @cancellable: (allow-none): A #GCancellable or %NULL.
19223 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19224 * @user_data: User data to pass to @callback.
19225 *
19226 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method on @proxy.
19227 * 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.
19228 * You can then call flash_call_init_finish() to get the result of the operation.
19229 *
19230 * See flash_call_init_sync() for the synchronous, blocking version of this method.
19231 */
19232void
19233flash_call_init (
19234 Flash *proxy,
19235 GCancellable *cancellable,
19236 GAsyncReadyCallback callback,
19237 gpointer user_data)
19238{
19239 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19240 "init",
19241 g_variant_new ("()"),
19242 G_DBUS_CALL_FLAGS_NONE,
19243 -1,
19244 cancellable,
19245 callback,
19246 user_data);
19247}
19248
19249/**
19250 * flash_call_init_finish:
19251 * @proxy: A #FlashProxy.
19252 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_init().
19253 * @error: Return location for error or %NULL.
19254 *
19255 * Finishes an operation started with flash_call_init().
19256 *
19257 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19258 */
19259gboolean
19260flash_call_init_finish (
19261 Flash *proxy,
19262 GAsyncResult *res,
19263 GError **error)
19264{
19265 GVariant *_ret;
19266 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19267 if (_ret == NULL)
19268 goto _out;
19269 g_variant_get (_ret,
19270 "()");
19271 g_variant_unref (_ret);
19272_out:
19273 return _ret != NULL;
19274}
19275
19276/**
19277 * flash_call_init_sync:
19278 * @proxy: A #FlashProxy.
19279 * @cancellable: (allow-none): A #GCancellable or %NULL.
19280 * @error: Return location for error or %NULL.
19281 *
19282 * 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.
19283 *
19284 * See flash_call_init() for the asynchronous version of this method.
19285 *
19286 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19287 */
19288gboolean
19289flash_call_init_sync (
19290 Flash *proxy,
19291 GCancellable *cancellable,
19292 GError **error)
19293{
19294 GVariant *_ret;
19295 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19296 "init",
19297 g_variant_new ("()"),
19298 G_DBUS_CALL_FLAGS_NONE,
19299 -1,
19300 cancellable,
19301 error);
19302 if (_ret == NULL)
19303 goto _out;
19304 g_variant_get (_ret,
19305 "()");
19306 g_variant_unref (_ret);
19307_out:
19308 return _ret != NULL;
19309}
19310
19311/**
19312 * flash_complete_update_via_file:
19313 * @object: A #Flash.
19314 * @invocation: (transfer full): A #GDBusMethodInvocation.
19315 *
19316 * 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.
19317 *
19318 * This method will free @invocation, you cannot use it afterwards.
19319 */
19320void
19321flash_complete_update_via_file (
19322 Flash *object,
19323 GDBusMethodInvocation *invocation)
19324{
19325 g_dbus_method_invocation_return_value (invocation,
19326 g_variant_new ("()"));
19327}
19328
19329/**
19330 * flash_complete_update_via_http:
19331 * @object: A #Flash.
19332 * @invocation: (transfer full): A #GDBusMethodInvocation.
19333 *
19334 * 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.
19335 *
19336 * This method will free @invocation, you cannot use it afterwards.
19337 */
19338void
19339flash_complete_update_via_http (
19340 Flash *object,
19341 GDBusMethodInvocation *invocation)
19342{
19343 g_dbus_method_invocation_return_value (invocation,
19344 g_variant_new ("()"));
19345}
19346
19347/**
19348 * flash_complete_erase:
19349 * @object: A #Flash.
19350 * @invocation: (transfer full): A #GDBusMethodInvocation.
19351 *
19352 * 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.
19353 *
19354 * This method will free @invocation, you cannot use it afterwards.
19355 */
19356void
19357flash_complete_erase (
19358 Flash *object,
19359 GDBusMethodInvocation *invocation)
19360{
19361 g_dbus_method_invocation_return_value (invocation,
19362 g_variant_new ("()"));
19363}
19364
19365/**
19366 * flash_complete_init:
19367 * @object: A #Flash.
19368 * @invocation: (transfer full): A #GDBusMethodInvocation.
19369 *
19370 * 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.
19371 *
19372 * This method will free @invocation, you cannot use it afterwards.
19373 */
19374void
19375flash_complete_init (
19376 Flash *object,
19377 GDBusMethodInvocation *invocation)
19378{
19379 g_dbus_method_invocation_return_value (invocation,
19380 g_variant_new ("()"));
19381}
19382
19383/* ------------------------------------------------------------------------ */
19384
19385/**
19386 * FlashProxy:
19387 *
19388 * The #FlashProxy structure contains only private data and should only be accessed using the provided API.
19389 */
19390
19391/**
19392 * FlashProxyClass:
19393 * @parent_class: The parent class.
19394 *
19395 * Class structure for #FlashProxy.
19396 */
19397
19398struct _FlashProxyPrivate
19399{
19400 GData *qdata;
19401};
19402
19403static void flash_proxy_iface_init (FlashIface *iface);
19404
19405#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19406G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
19407 G_ADD_PRIVATE (FlashProxy)
19408 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
19409
19410#else
19411G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
19412 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
19413
19414#endif
19415static void
19416flash_proxy_finalize (GObject *object)
19417{
19418 FlashProxy *proxy = FLASH_PROXY (object);
19419 g_datalist_clear (&proxy->priv->qdata);
19420 G_OBJECT_CLASS (flash_proxy_parent_class)->finalize (object);
19421}
19422
19423static void
19424flash_proxy_get_property (GObject *object,
19425 guint prop_id,
19426 GValue *value,
19427 GParamSpec *pspec G_GNUC_UNUSED)
19428{
19429}
19430
19431static void
19432flash_proxy_set_property (GObject *object,
19433 guint prop_id,
19434 const GValue *value,
19435 GParamSpec *pspec G_GNUC_UNUSED)
19436{
19437}
19438
19439static void
19440flash_proxy_g_signal (GDBusProxy *proxy,
19441 const gchar *sender_name G_GNUC_UNUSED,
19442 const gchar *signal_name,
19443 GVariant *parameters)
19444{
19445 _ExtendedGDBusSignalInfo *info;
19446 GVariantIter iter;
19447 GVariant *child;
19448 GValue *paramv;
19449 guint num_params;
19450 guint n;
19451 guint signal_id;
19452 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, signal_name);
19453 if (info == NULL)
19454 return;
19455 num_params = g_variant_n_children (parameters);
19456 paramv = g_new0 (GValue, num_params + 1);
19457 g_value_init (&paramv[0], TYPE_FLASH);
19458 g_value_set_object (&paramv[0], proxy);
19459 g_variant_iter_init (&iter, parameters);
19460 n = 1;
19461 while ((child = g_variant_iter_next_value (&iter)) != NULL)
19462 {
19463 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
19464 if (arg_info->use_gvariant)
19465 {
19466 g_value_init (&paramv[n], G_TYPE_VARIANT);
19467 g_value_set_variant (&paramv[n], child);
19468 n++;
19469 }
19470 else
19471 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
19472 g_variant_unref (child);
19473 }
19474 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
19475 g_signal_emitv (paramv, signal_id, 0, NULL);
19476 for (n = 0; n < num_params + 1; n++)
19477 g_value_unset (&paramv[n]);
19478 g_free (paramv);
19479}
19480
19481static void
19482flash_proxy_g_properties_changed (GDBusProxy *_proxy,
19483 GVariant *changed_properties,
19484 const gchar *const *invalidated_properties)
19485{
19486 FlashProxy *proxy = FLASH_PROXY (_proxy);
19487 guint n;
19488 const gchar *key;
19489 GVariantIter *iter;
19490 _ExtendedGDBusPropertyInfo *info;
19491 g_variant_get (changed_properties, "a{sv}", &iter);
19492 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
19493 {
19494 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, key);
19495 g_datalist_remove_data (&proxy->priv->qdata, key);
19496 if (info != NULL)
19497 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
19498 }
19499 g_variant_iter_free (iter);
19500 for (n = 0; invalidated_properties[n] != NULL; n++)
19501 {
19502 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, invalidated_properties[n]);
19503 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
19504 if (info != NULL)
19505 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
19506 }
19507}
19508
19509static void
19510flash_proxy_init (FlashProxy *proxy)
19511{
19512#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19513 proxy->priv = flash_proxy_get_instance_private (proxy);
19514#else
19515 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_PROXY, FlashProxyPrivate);
19516#endif
19517
19518 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_interface_info ());
19519}
19520
19521static void
19522flash_proxy_class_init (FlashProxyClass *klass)
19523{
19524 GObjectClass *gobject_class;
19525 GDBusProxyClass *proxy_class;
19526
19527 gobject_class = G_OBJECT_CLASS (klass);
19528 gobject_class->finalize = flash_proxy_finalize;
19529 gobject_class->get_property = flash_proxy_get_property;
19530 gobject_class->set_property = flash_proxy_set_property;
19531
19532 proxy_class = G_DBUS_PROXY_CLASS (klass);
19533 proxy_class->g_signal = flash_proxy_g_signal;
19534 proxy_class->g_properties_changed = flash_proxy_g_properties_changed;
19535
19536#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
19537 g_type_class_add_private (klass, sizeof (FlashProxyPrivate));
19538#endif
19539}
19540
19541static void
19542flash_proxy_iface_init (FlashIface *iface)
19543{
19544}
19545
19546/**
19547 * flash_proxy_new:
19548 * @connection: A #GDBusConnection.
19549 * @flags: Flags from the #GDBusProxyFlags enumeration.
19550 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
19551 * @object_path: An object path.
19552 * @cancellable: (allow-none): A #GCancellable or %NULL.
19553 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
19554 * @user_data: User data to pass to @callback.
19555 *
19556 * 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.
19557 *
19558 * 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.
19559 * You can then call flash_proxy_new_finish() to get the result of the operation.
19560 *
19561 * See flash_proxy_new_sync() for the synchronous, blocking version of this constructor.
19562 */
19563void
19564flash_proxy_new (
19565 GDBusConnection *connection,
19566 GDBusProxyFlags flags,
19567 const gchar *name,
19568 const gchar *object_path,
19569 GCancellable *cancellable,
19570 GAsyncReadyCallback callback,
19571 gpointer user_data)
19572{
19573 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);
19574}
19575
19576/**
19577 * flash_proxy_new_finish:
19578 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new().
19579 * @error: Return location for error or %NULL
19580 *
19581 * Finishes an operation started with flash_proxy_new().
19582 *
19583 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
19584 */
19585Flash *
19586flash_proxy_new_finish (
19587 GAsyncResult *res,
19588 GError **error)
19589{
19590 GObject *ret;
19591 GObject *source_object;
19592 source_object = g_async_result_get_source_object (res);
19593 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
19594 g_object_unref (source_object);
19595 if (ret != NULL)
19596 return FLASH (ret);
19597 else
19598 return NULL;
19599}
19600
19601/**
19602 * flash_proxy_new_sync:
19603 * @connection: A #GDBusConnection.
19604 * @flags: Flags from the #GDBusProxyFlags enumeration.
19605 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
19606 * @object_path: An object path.
19607 * @cancellable: (allow-none): A #GCancellable or %NULL.
19608 * @error: Return location for error or %NULL
19609 *
19610 * 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.
19611 *
19612 * The calling thread is blocked until a reply is received.
19613 *
19614 * See flash_proxy_new() for the asynchronous version of this constructor.
19615 *
19616 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
19617 */
19618Flash *
19619flash_proxy_new_sync (
19620 GDBusConnection *connection,
19621 GDBusProxyFlags flags,
19622 const gchar *name,
19623 const gchar *object_path,
19624 GCancellable *cancellable,
19625 GError **error)
19626{
19627 GInitable *ret;
19628 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);
19629 if (ret != NULL)
19630 return FLASH (ret);
19631 else
19632 return NULL;
19633}
19634
19635
19636/**
19637 * flash_proxy_new_for_bus:
19638 * @bus_type: A #GBusType.
19639 * @flags: Flags from the #GDBusProxyFlags enumeration.
19640 * @name: A bus name (well-known or unique).
19641 * @object_path: An object path.
19642 * @cancellable: (allow-none): A #GCancellable or %NULL.
19643 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
19644 * @user_data: User data to pass to @callback.
19645 *
19646 * Like flash_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
19647 *
19648 * 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.
19649 * You can then call flash_proxy_new_for_bus_finish() to get the result of the operation.
19650 *
19651 * See flash_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
19652 */
19653void
19654flash_proxy_new_for_bus (
19655 GBusType bus_type,
19656 GDBusProxyFlags flags,
19657 const gchar *name,
19658 const gchar *object_path,
19659 GCancellable *cancellable,
19660 GAsyncReadyCallback callback,
19661 gpointer user_data)
19662{
19663 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);
19664}
19665
19666/**
19667 * flash_proxy_new_for_bus_finish:
19668 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new_for_bus().
19669 * @error: Return location for error or %NULL
19670 *
19671 * Finishes an operation started with flash_proxy_new_for_bus().
19672 *
19673 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
19674 */
19675Flash *
19676flash_proxy_new_for_bus_finish (
19677 GAsyncResult *res,
19678 GError **error)
19679{
19680 GObject *ret;
19681 GObject *source_object;
19682 source_object = g_async_result_get_source_object (res);
19683 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
19684 g_object_unref (source_object);
19685 if (ret != NULL)
19686 return FLASH (ret);
19687 else
19688 return NULL;
19689}
19690
19691/**
19692 * flash_proxy_new_for_bus_sync:
19693 * @bus_type: A #GBusType.
19694 * @flags: Flags from the #GDBusProxyFlags enumeration.
19695 * @name: A bus name (well-known or unique).
19696 * @object_path: An object path.
19697 * @cancellable: (allow-none): A #GCancellable or %NULL.
19698 * @error: Return location for error or %NULL
19699 *
19700 * Like flash_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
19701 *
19702 * The calling thread is blocked until a reply is received.
19703 *
19704 * See flash_proxy_new_for_bus() for the asynchronous version of this constructor.
19705 *
19706 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
19707 */
19708Flash *
19709flash_proxy_new_for_bus_sync (
19710 GBusType bus_type,
19711 GDBusProxyFlags flags,
19712 const gchar *name,
19713 const gchar *object_path,
19714 GCancellable *cancellable,
19715 GError **error)
19716{
19717 GInitable *ret;
19718 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);
19719 if (ret != NULL)
19720 return FLASH (ret);
19721 else
19722 return NULL;
19723}
19724
19725
19726/* ------------------------------------------------------------------------ */
19727
19728/**
19729 * FlashSkeleton:
19730 *
19731 * The #FlashSkeleton structure contains only private data and should only be accessed using the provided API.
19732 */
19733
19734/**
19735 * FlashSkeletonClass:
19736 * @parent_class: The parent class.
19737 *
19738 * Class structure for #FlashSkeleton.
19739 */
19740
19741struct _FlashSkeletonPrivate
19742{
19743 GValue *properties;
19744 GList *changed_properties;
19745 GSource *changed_properties_idle_source;
19746 GMainContext *context;
19747 GMutex lock;
19748};
19749
19750static void
19751_flash_skeleton_handle_method_call (
19752 GDBusConnection *connection G_GNUC_UNUSED,
19753 const gchar *sender G_GNUC_UNUSED,
19754 const gchar *object_path G_GNUC_UNUSED,
19755 const gchar *interface_name,
19756 const gchar *method_name,
19757 GVariant *parameters,
19758 GDBusMethodInvocation *invocation,
19759 gpointer user_data)
19760{
19761 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
19762 _ExtendedGDBusMethodInfo *info;
19763 GVariantIter iter;
19764 GVariant *child;
19765 GValue *paramv;
19766 guint num_params;
19767 guint num_extra;
19768 guint n;
19769 guint signal_id;
19770 GValue return_value = G_VALUE_INIT;
19771 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
19772 g_assert (info != NULL);
19773 num_params = g_variant_n_children (parameters);
19774 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
19775 n = 0;
19776 g_value_init (&paramv[n], TYPE_FLASH);
19777 g_value_set_object (&paramv[n++], skeleton);
19778 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
19779 g_value_set_object (&paramv[n++], invocation);
19780 if (info->pass_fdlist)
19781 {
19782#ifdef G_OS_UNIX
19783 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
19784 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
19785#else
19786 g_assert_not_reached ();
19787#endif
19788 }
19789 g_variant_iter_init (&iter, parameters);
19790 while ((child = g_variant_iter_next_value (&iter)) != NULL)
19791 {
19792 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
19793 if (arg_info->use_gvariant)
19794 {
19795 g_value_init (&paramv[n], G_TYPE_VARIANT);
19796 g_value_set_variant (&paramv[n], child);
19797 n++;
19798 }
19799 else
19800 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
19801 g_variant_unref (child);
19802 }
19803 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
19804 g_value_init (&return_value, G_TYPE_BOOLEAN);
19805 g_signal_emitv (paramv, signal_id, 0, &return_value);
19806 if (!g_value_get_boolean (&return_value))
19807 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);
19808 g_value_unset (&return_value);
19809 for (n = 0; n < num_params + num_extra; n++)
19810 g_value_unset (&paramv[n]);
19811 g_free (paramv);
19812}
19813
19814static GVariant *
19815_flash_skeleton_handle_get_property (
19816 GDBusConnection *connection G_GNUC_UNUSED,
19817 const gchar *sender G_GNUC_UNUSED,
19818 const gchar *object_path G_GNUC_UNUSED,
19819 const gchar *interface_name G_GNUC_UNUSED,
19820 const gchar *property_name,
19821 GError **error,
19822 gpointer user_data)
19823{
19824 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
19825 GValue value = G_VALUE_INIT;
19826 GParamSpec *pspec;
19827 _ExtendedGDBusPropertyInfo *info;
19828 GVariant *ret;
19829 ret = NULL;
19830 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
19831 g_assert (info != NULL);
19832 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
19833 if (pspec == NULL)
19834 {
19835 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
19836 }
19837 else
19838 {
19839 g_value_init (&value, pspec->value_type);
19840 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
19841 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
19842 g_value_unset (&value);
19843 }
19844 return ret;
19845}
19846
19847static gboolean
19848_flash_skeleton_handle_set_property (
19849 GDBusConnection *connection G_GNUC_UNUSED,
19850 const gchar *sender G_GNUC_UNUSED,
19851 const gchar *object_path G_GNUC_UNUSED,
19852 const gchar *interface_name G_GNUC_UNUSED,
19853 const gchar *property_name,
19854 GVariant *variant,
19855 GError **error,
19856 gpointer user_data)
19857{
19858 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
19859 GValue value = G_VALUE_INIT;
19860 GParamSpec *pspec;
19861 _ExtendedGDBusPropertyInfo *info;
19862 gboolean ret;
19863 ret = FALSE;
19864 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
19865 g_assert (info != NULL);
19866 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
19867 if (pspec == NULL)
19868 {
19869 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
19870 }
19871 else
19872 {
19873 if (info->use_gvariant)
19874 g_value_set_variant (&value, variant);
19875 else
19876 g_dbus_gvariant_to_gvalue (variant, &value);
19877 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
19878 g_value_unset (&value);
19879 ret = TRUE;
19880 }
19881 return ret;
19882}
19883
19884static const GDBusInterfaceVTable _flash_skeleton_vtable =
19885{
19886 _flash_skeleton_handle_method_call,
19887 _flash_skeleton_handle_get_property,
19888 _flash_skeleton_handle_set_property,
19889 {NULL}
19890};
19891
19892static GDBusInterfaceInfo *
19893flash_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
19894{
19895 return flash_interface_info ();
19896}
19897
19898static GDBusInterfaceVTable *
19899flash_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
19900{
19901 return (GDBusInterfaceVTable *) &_flash_skeleton_vtable;
19902}
19903
19904static GVariant *
19905flash_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
19906{
19907 FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton);
19908
19909 GVariantBuilder builder;
19910 guint n;
19911 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
19912 if (_flash_interface_info.parent_struct.properties == NULL)
19913 goto out;
19914 for (n = 0; _flash_interface_info.parent_struct.properties[n] != NULL; n++)
19915 {
19916 GDBusPropertyInfo *info = _flash_interface_info.parent_struct.properties[n];
19917 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
19918 {
19919 GVariant *value;
19920 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);
19921 if (value != NULL)
19922 {
19923 g_variant_take_ref (value);
19924 g_variant_builder_add (&builder, "{sv}", info->name, value);
19925 g_variant_unref (value);
19926 }
19927 }
19928 }
19929out:
19930 return g_variant_builder_end (&builder);
19931}
19932
19933static void
19934flash_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
19935{
19936}
19937
19938static void
19939_flash_on_signal_updated (
19940 Flash *object)
19941{
19942 FlashSkeleton *skeleton = FLASH_SKELETON (object);
19943
19944 GList *connections, *l;
19945 GVariant *signal_variant;
19946 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
19947
19948 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
19949 for (l = connections; l != NULL; l = l->next)
19950 {
19951 GDBusConnection *connection = l->data;
19952 g_dbus_connection_emit_signal (connection,
19953 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Updated",
19954 signal_variant, NULL);
19955 }
19956 g_variant_unref (signal_variant);
19957 g_list_free_full (connections, g_object_unref);
19958}
19959
19960static void flash_skeleton_iface_init (FlashIface *iface);
19961#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19962G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
19963 G_ADD_PRIVATE (FlashSkeleton)
19964 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
19965
19966#else
19967G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
19968 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
19969
19970#endif
19971static void
19972flash_skeleton_finalize (GObject *object)
19973{
19974 FlashSkeleton *skeleton = FLASH_SKELETON (object);
19975 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
19976 if (skeleton->priv->changed_properties_idle_source != NULL)
19977 g_source_destroy (skeleton->priv->changed_properties_idle_source);
19978 g_main_context_unref (skeleton->priv->context);
19979 g_mutex_clear (&skeleton->priv->lock);
19980 G_OBJECT_CLASS (flash_skeleton_parent_class)->finalize (object);
19981}
19982
19983static void
19984flash_skeleton_init (FlashSkeleton *skeleton)
19985{
19986#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19987 skeleton->priv = flash_skeleton_get_instance_private (skeleton);
19988#else
19989 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_SKELETON, FlashSkeletonPrivate);
19990#endif
19991
19992 g_mutex_init (&skeleton->priv->lock);
19993 skeleton->priv->context = g_main_context_ref_thread_default ();
19994}
19995
19996static void
19997flash_skeleton_class_init (FlashSkeletonClass *klass)
19998{
19999 GObjectClass *gobject_class;
20000 GDBusInterfaceSkeletonClass *skeleton_class;
20001
20002 gobject_class = G_OBJECT_CLASS (klass);
20003 gobject_class->finalize = flash_skeleton_finalize;
20004
20005 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
20006 skeleton_class->get_info = flash_skeleton_dbus_interface_get_info;
20007 skeleton_class->get_properties = flash_skeleton_dbus_interface_get_properties;
20008 skeleton_class->flush = flash_skeleton_dbus_interface_flush;
20009 skeleton_class->get_vtable = flash_skeleton_dbus_interface_get_vtable;
20010
20011#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
20012 g_type_class_add_private (klass, sizeof (FlashSkeletonPrivate));
20013#endif
20014}
20015
20016static void
20017flash_skeleton_iface_init (FlashIface *iface)
20018{
20019 iface->updated = _flash_on_signal_updated;
20020}
20021
20022/**
20023 * flash_skeleton_new:
20024 *
20025 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
20026 *
20027 * Returns: (transfer full) (type FlashSkeleton): The skeleton object.
20028 */
20029Flash *
20030flash_skeleton_new (void)
20031{
20032 return FLASH (g_object_new (TYPE_FLASH_SKELETON, NULL));
20033}
20034
20035/* ------------------------------------------------------------------------
20036 * Code for interface org.openbmc.Button
20037 * ------------------------------------------------------------------------
20038 */
20039
20040/**
20041 * SECTION:Button
20042 * @title: Button
20043 * @short_description: Generated C code for the org.openbmc.Button D-Bus interface
20044 *
20045 * 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.
20046 */
20047
20048/* ---- Introspection data for org.openbmc.Button ---- */
20049
20050static const _ExtendedGDBusArgInfo _button_method_info_is_on_OUT_ARG_state =
20051{
20052 {
20053 -1,
20054 (gchar *) "state",
20055 (gchar *) "b",
20056 NULL
20057 },
20058 FALSE
20059};
20060
20061static const _ExtendedGDBusArgInfo * const _button_method_info_is_on_OUT_ARG_pointers[] =
20062{
20063 &_button_method_info_is_on_OUT_ARG_state,
20064 NULL
20065};
20066
20067static const _ExtendedGDBusMethodInfo _button_method_info_is_on =
20068{
20069 {
20070 -1,
20071 (gchar *) "isOn",
20072 NULL,
20073 (GDBusArgInfo **) &_button_method_info_is_on_OUT_ARG_pointers,
20074 NULL
20075 },
20076 "handle-is-on",
20077 FALSE
20078};
20079
20080static const _ExtendedGDBusMethodInfo _button_method_info_sim_button_press =
20081{
20082 {
20083 -1,
20084 (gchar *) "simButtonPress",
20085 NULL,
20086 NULL,
20087 NULL
20088 },
20089 "handle-sim-button-press",
20090 FALSE
20091};
20092
20093static const _ExtendedGDBusMethodInfo _button_method_info_sim_button_long_press =
20094{
20095 {
20096 -1,
20097 (gchar *) "simButtonLongPress",
20098 NULL,
20099 NULL,
20100 NULL
20101 },
20102 "handle-sim-button-long-press",
20103 FALSE
20104};
20105
20106static const _ExtendedGDBusMethodInfo * const _button_method_info_pointers[] =
20107{
20108 &_button_method_info_is_on,
20109 &_button_method_info_sim_button_press,
20110 &_button_method_info_sim_button_long_press,
20111 NULL
20112};
20113
20114static const _ExtendedGDBusSignalInfo _button_signal_info_button_release =
20115{
20116 {
20117 -1,
20118 (gchar *) "ButtonRelease",
20119 NULL,
20120 NULL
20121 },
20122 "button-release"
20123};
20124
20125static const _ExtendedGDBusSignalInfo _button_signal_info_button_pressed =
20126{
20127 {
20128 -1,
20129 (gchar *) "ButtonPressed",
20130 NULL,
20131 NULL
20132 },
20133 "button-pressed"
20134};
20135
20136static const _ExtendedGDBusSignalInfo _button_signal_info_button_pressed_long =
20137{
20138 {
20139 -1,
20140 (gchar *) "ButtonPressedLong",
20141 NULL,
20142 NULL
20143 },
20144 "button-pressed-long"
20145};
20146
20147static const _ExtendedGDBusSignalInfo * const _button_signal_info_pointers[] =
20148{
20149 &_button_signal_info_button_release,
20150 &_button_signal_info_button_pressed,
20151 &_button_signal_info_button_pressed_long,
20152 NULL
20153};
20154
20155static const _ExtendedGDBusPropertyInfo _button_property_info_state =
20156{
20157 {
20158 -1,
20159 (gchar *) "state",
20160 (gchar *) "b",
20161 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
20162 NULL
20163 },
20164 "state",
20165 FALSE
20166};
20167
20168static const _ExtendedGDBusPropertyInfo * const _button_property_info_pointers[] =
20169{
20170 &_button_property_info_state,
20171 NULL
20172};
20173
20174static const _ExtendedGDBusInterfaceInfo _button_interface_info =
20175{
20176 {
20177 -1,
20178 (gchar *) "org.openbmc.Button",
20179 (GDBusMethodInfo **) &_button_method_info_pointers,
20180 (GDBusSignalInfo **) &_button_signal_info_pointers,
20181 (GDBusPropertyInfo **) &_button_property_info_pointers,
20182 NULL
20183 },
20184 "button",
20185};
20186
20187
20188/**
20189 * button_interface_info:
20190 *
20191 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> D-Bus interface.
20192 *
20193 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
20194 */
20195GDBusInterfaceInfo *
20196button_interface_info (void)
20197{
20198 return (GDBusInterfaceInfo *) &_button_interface_info.parent_struct;
20199}
20200
20201/**
20202 * button_override_properties:
20203 * @klass: The class structure for a #GObject<!-- -->-derived class.
20204 * @property_id_begin: The property id to assign to the first overridden property.
20205 *
20206 * Overrides all #GObject properties in the #Button interface for a concrete class.
20207 * The properties are overridden in the order they are defined.
20208 *
20209 * Returns: The last property id.
20210 */
20211guint
20212button_override_properties (GObjectClass *klass, guint property_id_begin)
20213{
20214 g_object_class_override_property (klass, property_id_begin++, "state");
20215 return property_id_begin - 1;
20216}
20217
20218
20219
20220/**
20221 * Button:
20222 *
20223 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
20224 */
20225
20226/**
20227 * ButtonIface:
20228 * @parent_iface: The parent interface.
20229 * @handle_is_on: Handler for the #Button::handle-is-on signal.
20230 * @handle_sim_button_long_press: Handler for the #Button::handle-sim-button-long-press signal.
20231 * @handle_sim_button_press: Handler for the #Button::handle-sim-button-press signal.
20232 * @get_state: Getter for the #Button:state property.
20233 * @button_pressed: Handler for the #Button::button-pressed signal.
20234 * @button_pressed_long: Handler for the #Button::button-pressed-long signal.
20235 * @button_release: Handler for the #Button::button-release signal.
20236 *
20237 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
20238 */
20239
20240typedef ButtonIface ButtonInterface;
20241G_DEFINE_INTERFACE (Button, button, G_TYPE_OBJECT);
20242
20243static void
20244button_default_init (ButtonIface *iface)
20245{
20246 /* GObject signals for incoming D-Bus method calls: */
20247 /**
20248 * Button::handle-is-on:
20249 * @object: A #Button.
20250 * @invocation: A #GDBusMethodInvocation.
20251 *
20252 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method.
20253 *
20254 * 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.
20255 *
20256 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
20257 */
20258 g_signal_new ("handle-is-on",
20259 G_TYPE_FROM_INTERFACE (iface),
20260 G_SIGNAL_RUN_LAST,
20261 G_STRUCT_OFFSET (ButtonIface, handle_is_on),
20262 g_signal_accumulator_true_handled,
20263 NULL,
20264 g_cclosure_marshal_generic,
20265 G_TYPE_BOOLEAN,
20266 1,
20267 G_TYPE_DBUS_METHOD_INVOCATION);
20268
20269 /**
20270 * Button::handle-sim-button-press:
20271 * @object: A #Button.
20272 * @invocation: A #GDBusMethodInvocation.
20273 *
20274 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method.
20275 *
20276 * 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.
20277 *
20278 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
20279 */
20280 g_signal_new ("handle-sim-button-press",
20281 G_TYPE_FROM_INTERFACE (iface),
20282 G_SIGNAL_RUN_LAST,
20283 G_STRUCT_OFFSET (ButtonIface, handle_sim_button_press),
20284 g_signal_accumulator_true_handled,
20285 NULL,
20286 g_cclosure_marshal_generic,
20287 G_TYPE_BOOLEAN,
20288 1,
20289 G_TYPE_DBUS_METHOD_INVOCATION);
20290
20291 /**
20292 * Button::handle-sim-button-long-press:
20293 * @object: A #Button.
20294 * @invocation: A #GDBusMethodInvocation.
20295 *
20296 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method.
20297 *
20298 * 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.
20299 *
20300 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
20301 */
20302 g_signal_new ("handle-sim-button-long-press",
20303 G_TYPE_FROM_INTERFACE (iface),
20304 G_SIGNAL_RUN_LAST,
20305 G_STRUCT_OFFSET (ButtonIface, handle_sim_button_long_press),
20306 g_signal_accumulator_true_handled,
20307 NULL,
20308 g_cclosure_marshal_generic,
20309 G_TYPE_BOOLEAN,
20310 1,
20311 G_TYPE_DBUS_METHOD_INVOCATION);
20312
20313 /* GObject signals for received D-Bus signals: */
20314 /**
20315 * Button::button-release:
20316 * @object: A #Button.
20317 *
20318 * 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.
20319 *
20320 * 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.
20321 */
20322 g_signal_new ("button-release",
20323 G_TYPE_FROM_INTERFACE (iface),
20324 G_SIGNAL_RUN_LAST,
20325 G_STRUCT_OFFSET (ButtonIface, button_release),
20326 NULL,
20327 NULL,
20328 g_cclosure_marshal_generic,
20329 G_TYPE_NONE,
20330 0);
20331
20332 /**
20333 * Button::button-pressed:
20334 * @object: A #Button.
20335 *
20336 * 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.
20337 *
20338 * 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.
20339 */
20340 g_signal_new ("button-pressed",
20341 G_TYPE_FROM_INTERFACE (iface),
20342 G_SIGNAL_RUN_LAST,
20343 G_STRUCT_OFFSET (ButtonIface, button_pressed),
20344 NULL,
20345 NULL,
20346 g_cclosure_marshal_generic,
20347 G_TYPE_NONE,
20348 0);
20349
20350 /**
20351 * Button::button-pressed-long:
20352 * @object: A #Button.
20353 *
20354 * 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.
20355 *
20356 * 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.
20357 */
20358 g_signal_new ("button-pressed-long",
20359 G_TYPE_FROM_INTERFACE (iface),
20360 G_SIGNAL_RUN_LAST,
20361 G_STRUCT_OFFSET (ButtonIface, button_pressed_long),
20362 NULL,
20363 NULL,
20364 g_cclosure_marshal_generic,
20365 G_TYPE_NONE,
20366 0);
20367
20368 /* GObject properties for D-Bus properties: */
20369 /**
20370 * Button:state:
20371 *
20372 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link>.
20373 *
20374 * 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.
20375 */
20376 g_object_interface_install_property (iface,
20377 g_param_spec_boolean ("state", "state", "state", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
20378}
20379
20380/**
20381 * button_get_state: (skip)
20382 * @object: A #Button.
20383 *
20384 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property.
20385 *
20386 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
20387 *
20388 * Returns: The property value.
20389 */
20390gboolean
20391button_get_state (Button *object)
20392{
20393 return BUTTON_GET_IFACE (object)->get_state (object);
20394}
20395
20396/**
20397 * button_set_state: (skip)
20398 * @object: A #Button.
20399 * @value: The value to set.
20400 *
20401 * Sets the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property to @value.
20402 *
20403 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
20404 */
20405void
20406button_set_state (Button *object, gboolean value)
20407{
20408 g_object_set (G_OBJECT (object), "state", value, NULL);
20409}
20410
20411/**
20412 * button_emit_button_release:
20413 * @object: A #Button.
20414 *
20415 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonRelease">"ButtonRelease"</link> D-Bus signal.
20416 */
20417void
20418button_emit_button_release (
20419 Button *object)
20420{
20421 g_signal_emit_by_name (object, "button-release");
20422}
20423
20424/**
20425 * button_emit_button_pressed:
20426 * @object: A #Button.
20427 *
20428 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressed">"ButtonPressed"</link> D-Bus signal.
20429 */
20430void
20431button_emit_button_pressed (
20432 Button *object)
20433{
20434 g_signal_emit_by_name (object, "button-pressed");
20435}
20436
20437/**
20438 * button_emit_button_pressed_long:
20439 * @object: A #Button.
20440 *
20441 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressedLong">"ButtonPressedLong"</link> D-Bus signal.
20442 */
20443void
20444button_emit_button_pressed_long (
20445 Button *object)
20446{
20447 g_signal_emit_by_name (object, "button-pressed-long");
20448}
20449
20450/**
20451 * button_call_is_on:
20452 * @proxy: A #ButtonProxy.
20453 * @cancellable: (allow-none): A #GCancellable or %NULL.
20454 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
20455 * @user_data: User data to pass to @callback.
20456 *
20457 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method on @proxy.
20458 * 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.
20459 * You can then call button_call_is_on_finish() to get the result of the operation.
20460 *
20461 * See button_call_is_on_sync() for the synchronous, blocking version of this method.
20462 */
20463void
20464button_call_is_on (
20465 Button *proxy,
20466 GCancellable *cancellable,
20467 GAsyncReadyCallback callback,
20468 gpointer user_data)
20469{
20470 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
20471 "isOn",
20472 g_variant_new ("()"),
20473 G_DBUS_CALL_FLAGS_NONE,
20474 -1,
20475 cancellable,
20476 callback,
20477 user_data);
20478}
20479
20480/**
20481 * button_call_is_on_finish:
20482 * @proxy: A #ButtonProxy.
20483 * @out_state: (out): Return location for return parameter or %NULL to ignore.
20484 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_is_on().
20485 * @error: Return location for error or %NULL.
20486 *
20487 * Finishes an operation started with button_call_is_on().
20488 *
20489 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20490 */
20491gboolean
20492button_call_is_on_finish (
20493 Button *proxy,
20494 gboolean *out_state,
20495 GAsyncResult *res,
20496 GError **error)
20497{
20498 GVariant *_ret;
20499 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
20500 if (_ret == NULL)
20501 goto _out;
20502 g_variant_get (_ret,
20503 "(b)",
20504 out_state);
20505 g_variant_unref (_ret);
20506_out:
20507 return _ret != NULL;
20508}
20509
20510/**
20511 * button_call_is_on_sync:
20512 * @proxy: A #ButtonProxy.
20513 * @out_state: (out): Return location for return parameter or %NULL to ignore.
20514 * @cancellable: (allow-none): A #GCancellable or %NULL.
20515 * @error: Return location for error or %NULL.
20516 *
20517 * 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.
20518 *
20519 * See button_call_is_on() for the asynchronous version of this method.
20520 *
20521 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20522 */
20523gboolean
20524button_call_is_on_sync (
20525 Button *proxy,
20526 gboolean *out_state,
20527 GCancellable *cancellable,
20528 GError **error)
20529{
20530 GVariant *_ret;
20531 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
20532 "isOn",
20533 g_variant_new ("()"),
20534 G_DBUS_CALL_FLAGS_NONE,
20535 -1,
20536 cancellable,
20537 error);
20538 if (_ret == NULL)
20539 goto _out;
20540 g_variant_get (_ret,
20541 "(b)",
20542 out_state);
20543 g_variant_unref (_ret);
20544_out:
20545 return _ret != NULL;
20546}
20547
20548/**
20549 * button_call_sim_button_press:
20550 * @proxy: A #ButtonProxy.
20551 * @cancellable: (allow-none): A #GCancellable or %NULL.
20552 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
20553 * @user_data: User data to pass to @callback.
20554 *
20555 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method on @proxy.
20556 * 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.
20557 * You can then call button_call_sim_button_press_finish() to get the result of the operation.
20558 *
20559 * See button_call_sim_button_press_sync() for the synchronous, blocking version of this method.
20560 */
20561void
20562button_call_sim_button_press (
20563 Button *proxy,
20564 GCancellable *cancellable,
20565 GAsyncReadyCallback callback,
20566 gpointer user_data)
20567{
20568 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
20569 "simButtonPress",
20570 g_variant_new ("()"),
20571 G_DBUS_CALL_FLAGS_NONE,
20572 -1,
20573 cancellable,
20574 callback,
20575 user_data);
20576}
20577
20578/**
20579 * button_call_sim_button_press_finish:
20580 * @proxy: A #ButtonProxy.
20581 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_button_press().
20582 * @error: Return location for error or %NULL.
20583 *
20584 * Finishes an operation started with button_call_sim_button_press().
20585 *
20586 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20587 */
20588gboolean
20589button_call_sim_button_press_finish (
20590 Button *proxy,
20591 GAsyncResult *res,
20592 GError **error)
20593{
20594 GVariant *_ret;
20595 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
20596 if (_ret == NULL)
20597 goto _out;
20598 g_variant_get (_ret,
20599 "()");
20600 g_variant_unref (_ret);
20601_out:
20602 return _ret != NULL;
20603}
20604
20605/**
20606 * button_call_sim_button_press_sync:
20607 * @proxy: A #ButtonProxy.
20608 * @cancellable: (allow-none): A #GCancellable or %NULL.
20609 * @error: Return location for error or %NULL.
20610 *
20611 * 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.
20612 *
20613 * See button_call_sim_button_press() for the asynchronous version of this method.
20614 *
20615 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20616 */
20617gboolean
20618button_call_sim_button_press_sync (
20619 Button *proxy,
20620 GCancellable *cancellable,
20621 GError **error)
20622{
20623 GVariant *_ret;
20624 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
20625 "simButtonPress",
20626 g_variant_new ("()"),
20627 G_DBUS_CALL_FLAGS_NONE,
20628 -1,
20629 cancellable,
20630 error);
20631 if (_ret == NULL)
20632 goto _out;
20633 g_variant_get (_ret,
20634 "()");
20635 g_variant_unref (_ret);
20636_out:
20637 return _ret != NULL;
20638}
20639
20640/**
20641 * button_call_sim_button_long_press:
20642 * @proxy: A #ButtonProxy.
20643 * @cancellable: (allow-none): A #GCancellable or %NULL.
20644 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
20645 * @user_data: User data to pass to @callback.
20646 *
20647 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method on @proxy.
20648 * 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.
20649 * You can then call button_call_sim_button_long_press_finish() to get the result of the operation.
20650 *
20651 * See button_call_sim_button_long_press_sync() for the synchronous, blocking version of this method.
20652 */
20653void
20654button_call_sim_button_long_press (
20655 Button *proxy,
20656 GCancellable *cancellable,
20657 GAsyncReadyCallback callback,
20658 gpointer user_data)
20659{
20660 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
20661 "simButtonLongPress",
20662 g_variant_new ("()"),
20663 G_DBUS_CALL_FLAGS_NONE,
20664 -1,
20665 cancellable,
20666 callback,
20667 user_data);
20668}
20669
20670/**
20671 * button_call_sim_button_long_press_finish:
20672 * @proxy: A #ButtonProxy.
20673 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_button_long_press().
20674 * @error: Return location for error or %NULL.
20675 *
20676 * Finishes an operation started with button_call_sim_button_long_press().
20677 *
20678 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20679 */
20680gboolean
20681button_call_sim_button_long_press_finish (
20682 Button *proxy,
20683 GAsyncResult *res,
20684 GError **error)
20685{
20686 GVariant *_ret;
20687 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
20688 if (_ret == NULL)
20689 goto _out;
20690 g_variant_get (_ret,
20691 "()");
20692 g_variant_unref (_ret);
20693_out:
20694 return _ret != NULL;
20695}
20696
20697/**
20698 * button_call_sim_button_long_press_sync:
20699 * @proxy: A #ButtonProxy.
20700 * @cancellable: (allow-none): A #GCancellable or %NULL.
20701 * @error: Return location for error or %NULL.
20702 *
20703 * 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.
20704 *
20705 * See button_call_sim_button_long_press() for the asynchronous version of this method.
20706 *
20707 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20708 */
20709gboolean
20710button_call_sim_button_long_press_sync (
20711 Button *proxy,
20712 GCancellable *cancellable,
20713 GError **error)
20714{
20715 GVariant *_ret;
20716 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
20717 "simButtonLongPress",
20718 g_variant_new ("()"),
20719 G_DBUS_CALL_FLAGS_NONE,
20720 -1,
20721 cancellable,
20722 error);
20723 if (_ret == NULL)
20724 goto _out;
20725 g_variant_get (_ret,
20726 "()");
20727 g_variant_unref (_ret);
20728_out:
20729 return _ret != NULL;
20730}
20731
20732/**
20733 * button_complete_is_on:
20734 * @object: A #Button.
20735 * @invocation: (transfer full): A #GDBusMethodInvocation.
20736 * @state: Parameter to return.
20737 *
20738 * 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.
20739 *
20740 * This method will free @invocation, you cannot use it afterwards.
20741 */
20742void
20743button_complete_is_on (
20744 Button *object,
20745 GDBusMethodInvocation *invocation,
20746 gboolean state)
20747{
20748 g_dbus_method_invocation_return_value (invocation,
20749 g_variant_new ("(b)",
20750 state));
20751}
20752
20753/**
20754 * button_complete_sim_button_press:
20755 * @object: A #Button.
20756 * @invocation: (transfer full): A #GDBusMethodInvocation.
20757 *
20758 * 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.
20759 *
20760 * This method will free @invocation, you cannot use it afterwards.
20761 */
20762void
20763button_complete_sim_button_press (
20764 Button *object,
20765 GDBusMethodInvocation *invocation)
20766{
20767 g_dbus_method_invocation_return_value (invocation,
20768 g_variant_new ("()"));
20769}
20770
20771/**
20772 * button_complete_sim_button_long_press:
20773 * @object: A #Button.
20774 * @invocation: (transfer full): A #GDBusMethodInvocation.
20775 *
20776 * 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.
20777 *
20778 * This method will free @invocation, you cannot use it afterwards.
20779 */
20780void
20781button_complete_sim_button_long_press (
20782 Button *object,
20783 GDBusMethodInvocation *invocation)
20784{
20785 g_dbus_method_invocation_return_value (invocation,
20786 g_variant_new ("()"));
20787}
20788
20789/* ------------------------------------------------------------------------ */
20790
20791/**
20792 * ButtonProxy:
20793 *
20794 * The #ButtonProxy structure contains only private data and should only be accessed using the provided API.
20795 */
20796
20797/**
20798 * ButtonProxyClass:
20799 * @parent_class: The parent class.
20800 *
20801 * Class structure for #ButtonProxy.
20802 */
20803
20804struct _ButtonProxyPrivate
20805{
20806 GData *qdata;
20807};
20808
20809static void button_proxy_iface_init (ButtonIface *iface);
20810
20811#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20812G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
20813 G_ADD_PRIVATE (ButtonProxy)
20814 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
20815
20816#else
20817G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
20818 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
20819
20820#endif
20821static void
20822button_proxy_finalize (GObject *object)
20823{
20824 ButtonProxy *proxy = BUTTON_PROXY (object);
20825 g_datalist_clear (&proxy->priv->qdata);
20826 G_OBJECT_CLASS (button_proxy_parent_class)->finalize (object);
20827}
20828
20829static void
20830button_proxy_get_property (GObject *object,
20831 guint prop_id,
20832 GValue *value,
20833 GParamSpec *pspec G_GNUC_UNUSED)
20834{
20835 const _ExtendedGDBusPropertyInfo *info;
20836 GVariant *variant;
20837 g_assert (prop_id != 0 && prop_id - 1 < 1);
20838 info = _button_property_info_pointers[prop_id - 1];
20839 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
20840 if (info->use_gvariant)
20841 {
20842 g_value_set_variant (value, variant);
20843 }
20844 else
20845 {
20846 if (variant != NULL)
20847 g_dbus_gvariant_to_gvalue (variant, value);
20848 }
20849 if (variant != NULL)
20850 g_variant_unref (variant);
20851}
20852
20853static void
20854button_proxy_set_property_cb (GDBusProxy *proxy,
20855 GAsyncResult *res,
20856 gpointer user_data)
20857{
20858 const _ExtendedGDBusPropertyInfo *info = user_data;
20859 GError *error;
20860 GVariant *_ret;
20861 error = NULL;
20862 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
20863 if (!_ret)
20864 {
20865 g_warning ("Error setting property '%s' on interface org.openbmc.Button: %s (%s, %d)",
20866 info->parent_struct.name,
20867 error->message, g_quark_to_string (error->domain), error->code);
20868 g_error_free (error);
20869 }
20870 else
20871 {
20872 g_variant_unref (_ret);
20873 }
20874}
20875
20876static void
20877button_proxy_set_property (GObject *object,
20878 guint prop_id,
20879 const GValue *value,
20880 GParamSpec *pspec G_GNUC_UNUSED)
20881{
20882 const _ExtendedGDBusPropertyInfo *info;
20883 GVariant *variant;
20884 g_assert (prop_id != 0 && prop_id - 1 < 1);
20885 info = _button_property_info_pointers[prop_id - 1];
20886 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
20887 g_dbus_proxy_call (G_DBUS_PROXY (object),
20888 "org.freedesktop.DBus.Properties.Set",
20889 g_variant_new ("(ssv)", "org.openbmc.Button", info->parent_struct.name, variant),
20890 G_DBUS_CALL_FLAGS_NONE,
20891 -1,
20892 NULL, (GAsyncReadyCallback) button_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
20893 g_variant_unref (variant);
20894}
20895
20896static void
20897button_proxy_g_signal (GDBusProxy *proxy,
20898 const gchar *sender_name G_GNUC_UNUSED,
20899 const gchar *signal_name,
20900 GVariant *parameters)
20901{
20902 _ExtendedGDBusSignalInfo *info;
20903 GVariantIter iter;
20904 GVariant *child;
20905 GValue *paramv;
20906 guint num_params;
20907 guint n;
20908 guint signal_id;
20909 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, signal_name);
20910 if (info == NULL)
20911 return;
20912 num_params = g_variant_n_children (parameters);
20913 paramv = g_new0 (GValue, num_params + 1);
20914 g_value_init (&paramv[0], TYPE_BUTTON);
20915 g_value_set_object (&paramv[0], proxy);
20916 g_variant_iter_init (&iter, parameters);
20917 n = 1;
20918 while ((child = g_variant_iter_next_value (&iter)) != NULL)
20919 {
20920 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
20921 if (arg_info->use_gvariant)
20922 {
20923 g_value_init (&paramv[n], G_TYPE_VARIANT);
20924 g_value_set_variant (&paramv[n], child);
20925 n++;
20926 }
20927 else
20928 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
20929 g_variant_unref (child);
20930 }
20931 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
20932 g_signal_emitv (paramv, signal_id, 0, NULL);
20933 for (n = 0; n < num_params + 1; n++)
20934 g_value_unset (&paramv[n]);
20935 g_free (paramv);
20936}
20937
20938static void
20939button_proxy_g_properties_changed (GDBusProxy *_proxy,
20940 GVariant *changed_properties,
20941 const gchar *const *invalidated_properties)
20942{
20943 ButtonProxy *proxy = BUTTON_PROXY (_proxy);
20944 guint n;
20945 const gchar *key;
20946 GVariantIter *iter;
20947 _ExtendedGDBusPropertyInfo *info;
20948 g_variant_get (changed_properties, "a{sv}", &iter);
20949 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
20950 {
20951 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, key);
20952 g_datalist_remove_data (&proxy->priv->qdata, key);
20953 if (info != NULL)
20954 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
20955 }
20956 g_variant_iter_free (iter);
20957 for (n = 0; invalidated_properties[n] != NULL; n++)
20958 {
20959 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, invalidated_properties[n]);
20960 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
20961 if (info != NULL)
20962 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
20963 }
20964}
20965
20966static gboolean
20967button_proxy_get_state (Button *object)
20968{
20969 ButtonProxy *proxy = BUTTON_PROXY (object);
20970 GVariant *variant;
20971 gboolean value = 0;
20972 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
20973 if (variant != NULL)
20974 {
20975 value = g_variant_get_boolean (variant);
20976 g_variant_unref (variant);
20977 }
20978 return value;
20979}
20980
20981static void
20982button_proxy_init (ButtonProxy *proxy)
20983{
20984#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20985 proxy->priv = button_proxy_get_instance_private (proxy);
20986#else
20987 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_BUTTON_PROXY, ButtonProxyPrivate);
20988#endif
20989
20990 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), button_interface_info ());
20991}
20992
20993static void
20994button_proxy_class_init (ButtonProxyClass *klass)
20995{
20996 GObjectClass *gobject_class;
20997 GDBusProxyClass *proxy_class;
20998
20999 gobject_class = G_OBJECT_CLASS (klass);
21000 gobject_class->finalize = button_proxy_finalize;
21001 gobject_class->get_property = button_proxy_get_property;
21002 gobject_class->set_property = button_proxy_set_property;
21003
21004 proxy_class = G_DBUS_PROXY_CLASS (klass);
21005 proxy_class->g_signal = button_proxy_g_signal;
21006 proxy_class->g_properties_changed = button_proxy_g_properties_changed;
21007
21008 button_override_properties (gobject_class, 1);
21009
21010#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
21011 g_type_class_add_private (klass, sizeof (ButtonProxyPrivate));
21012#endif
21013}
21014
21015static void
21016button_proxy_iface_init (ButtonIface *iface)
21017{
21018 iface->get_state = button_proxy_get_state;
21019}
21020
21021/**
21022 * button_proxy_new:
21023 * @connection: A #GDBusConnection.
21024 * @flags: Flags from the #GDBusProxyFlags enumeration.
21025 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
21026 * @object_path: An object path.
21027 * @cancellable: (allow-none): A #GCancellable or %NULL.
21028 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
21029 * @user_data: User data to pass to @callback.
21030 *
21031 * 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.
21032 *
21033 * 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.
21034 * You can then call button_proxy_new_finish() to get the result of the operation.
21035 *
21036 * See button_proxy_new_sync() for the synchronous, blocking version of this constructor.
21037 */
21038void
21039button_proxy_new (
21040 GDBusConnection *connection,
21041 GDBusProxyFlags flags,
21042 const gchar *name,
21043 const gchar *object_path,
21044 GCancellable *cancellable,
21045 GAsyncReadyCallback callback,
21046 gpointer user_data)
21047{
21048 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);
21049}
21050
21051/**
21052 * button_proxy_new_finish:
21053 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new().
21054 * @error: Return location for error or %NULL
21055 *
21056 * Finishes an operation started with button_proxy_new().
21057 *
21058 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
21059 */
21060Button *
21061button_proxy_new_finish (
21062 GAsyncResult *res,
21063 GError **error)
21064{
21065 GObject *ret;
21066 GObject *source_object;
21067 source_object = g_async_result_get_source_object (res);
21068 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
21069 g_object_unref (source_object);
21070 if (ret != NULL)
21071 return BUTTON (ret);
21072 else
21073 return NULL;
21074}
21075
21076/**
21077 * button_proxy_new_sync:
21078 * @connection: A #GDBusConnection.
21079 * @flags: Flags from the #GDBusProxyFlags enumeration.
21080 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
21081 * @object_path: An object path.
21082 * @cancellable: (allow-none): A #GCancellable or %NULL.
21083 * @error: Return location for error or %NULL
21084 *
21085 * 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.
21086 *
21087 * The calling thread is blocked until a reply is received.
21088 *
21089 * See button_proxy_new() for the asynchronous version of this constructor.
21090 *
21091 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
21092 */
21093Button *
21094button_proxy_new_sync (
21095 GDBusConnection *connection,
21096 GDBusProxyFlags flags,
21097 const gchar *name,
21098 const gchar *object_path,
21099 GCancellable *cancellable,
21100 GError **error)
21101{
21102 GInitable *ret;
21103 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);
21104 if (ret != NULL)
21105 return BUTTON (ret);
21106 else
21107 return NULL;
21108}
21109
21110
21111/**
21112 * button_proxy_new_for_bus:
21113 * @bus_type: A #GBusType.
21114 * @flags: Flags from the #GDBusProxyFlags enumeration.
21115 * @name: A bus name (well-known or unique).
21116 * @object_path: An object path.
21117 * @cancellable: (allow-none): A #GCancellable or %NULL.
21118 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
21119 * @user_data: User data to pass to @callback.
21120 *
21121 * Like button_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
21122 *
21123 * 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.
21124 * You can then call button_proxy_new_for_bus_finish() to get the result of the operation.
21125 *
21126 * See button_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
21127 */
21128void
21129button_proxy_new_for_bus (
21130 GBusType bus_type,
21131 GDBusProxyFlags flags,
21132 const gchar *name,
21133 const gchar *object_path,
21134 GCancellable *cancellable,
21135 GAsyncReadyCallback callback,
21136 gpointer user_data)
21137{
21138 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);
21139}
21140
21141/**
21142 * button_proxy_new_for_bus_finish:
21143 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new_for_bus().
21144 * @error: Return location for error or %NULL
21145 *
21146 * Finishes an operation started with button_proxy_new_for_bus().
21147 *
21148 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
21149 */
21150Button *
21151button_proxy_new_for_bus_finish (
21152 GAsyncResult *res,
21153 GError **error)
21154{
21155 GObject *ret;
21156 GObject *source_object;
21157 source_object = g_async_result_get_source_object (res);
21158 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
21159 g_object_unref (source_object);
21160 if (ret != NULL)
21161 return BUTTON (ret);
21162 else
21163 return NULL;
21164}
21165
21166/**
21167 * button_proxy_new_for_bus_sync:
21168 * @bus_type: A #GBusType.
21169 * @flags: Flags from the #GDBusProxyFlags enumeration.
21170 * @name: A bus name (well-known or unique).
21171 * @object_path: An object path.
21172 * @cancellable: (allow-none): A #GCancellable or %NULL.
21173 * @error: Return location for error or %NULL
21174 *
21175 * Like button_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
21176 *
21177 * The calling thread is blocked until a reply is received.
21178 *
21179 * See button_proxy_new_for_bus() for the asynchronous version of this constructor.
21180 *
21181 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
21182 */
21183Button *
21184button_proxy_new_for_bus_sync (
21185 GBusType bus_type,
21186 GDBusProxyFlags flags,
21187 const gchar *name,
21188 const gchar *object_path,
21189 GCancellable *cancellable,
21190 GError **error)
21191{
21192 GInitable *ret;
21193 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);
21194 if (ret != NULL)
21195 return BUTTON (ret);
21196 else
21197 return NULL;
21198}
21199
21200
21201/* ------------------------------------------------------------------------ */
21202
21203/**
21204 * ButtonSkeleton:
21205 *
21206 * The #ButtonSkeleton structure contains only private data and should only be accessed using the provided API.
21207 */
21208
21209/**
21210 * ButtonSkeletonClass:
21211 * @parent_class: The parent class.
21212 *
21213 * Class structure for #ButtonSkeleton.
21214 */
21215
21216struct _ButtonSkeletonPrivate
21217{
21218 GValue *properties;
21219 GList *changed_properties;
21220 GSource *changed_properties_idle_source;
21221 GMainContext *context;
21222 GMutex lock;
21223};
21224
21225static void
21226_button_skeleton_handle_method_call (
21227 GDBusConnection *connection G_GNUC_UNUSED,
21228 const gchar *sender G_GNUC_UNUSED,
21229 const gchar *object_path G_GNUC_UNUSED,
21230 const gchar *interface_name,
21231 const gchar *method_name,
21232 GVariant *parameters,
21233 GDBusMethodInvocation *invocation,
21234 gpointer user_data)
21235{
21236 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
21237 _ExtendedGDBusMethodInfo *info;
21238 GVariantIter iter;
21239 GVariant *child;
21240 GValue *paramv;
21241 guint num_params;
21242 guint num_extra;
21243 guint n;
21244 guint signal_id;
21245 GValue return_value = G_VALUE_INIT;
21246 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
21247 g_assert (info != NULL);
21248 num_params = g_variant_n_children (parameters);
21249 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
21250 n = 0;
21251 g_value_init (&paramv[n], TYPE_BUTTON);
21252 g_value_set_object (&paramv[n++], skeleton);
21253 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
21254 g_value_set_object (&paramv[n++], invocation);
21255 if (info->pass_fdlist)
21256 {
21257#ifdef G_OS_UNIX
21258 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
21259 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
21260#else
21261 g_assert_not_reached ();
21262#endif
21263 }
21264 g_variant_iter_init (&iter, parameters);
21265 while ((child = g_variant_iter_next_value (&iter)) != NULL)
21266 {
21267 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
21268 if (arg_info->use_gvariant)
21269 {
21270 g_value_init (&paramv[n], G_TYPE_VARIANT);
21271 g_value_set_variant (&paramv[n], child);
21272 n++;
21273 }
21274 else
21275 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
21276 g_variant_unref (child);
21277 }
21278 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
21279 g_value_init (&return_value, G_TYPE_BOOLEAN);
21280 g_signal_emitv (paramv, signal_id, 0, &return_value);
21281 if (!g_value_get_boolean (&return_value))
21282 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);
21283 g_value_unset (&return_value);
21284 for (n = 0; n < num_params + num_extra; n++)
21285 g_value_unset (&paramv[n]);
21286 g_free (paramv);
21287}
21288
21289static GVariant *
21290_button_skeleton_handle_get_property (
21291 GDBusConnection *connection G_GNUC_UNUSED,
21292 const gchar *sender G_GNUC_UNUSED,
21293 const gchar *object_path G_GNUC_UNUSED,
21294 const gchar *interface_name G_GNUC_UNUSED,
21295 const gchar *property_name,
21296 GError **error,
21297 gpointer user_data)
21298{
21299 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
21300 GValue value = G_VALUE_INIT;
21301 GParamSpec *pspec;
21302 _ExtendedGDBusPropertyInfo *info;
21303 GVariant *ret;
21304 ret = NULL;
21305 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
21306 g_assert (info != NULL);
21307 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
21308 if (pspec == NULL)
21309 {
21310 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
21311 }
21312 else
21313 {
21314 g_value_init (&value, pspec->value_type);
21315 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
21316 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
21317 g_value_unset (&value);
21318 }
21319 return ret;
21320}
21321
21322static gboolean
21323_button_skeleton_handle_set_property (
21324 GDBusConnection *connection G_GNUC_UNUSED,
21325 const gchar *sender G_GNUC_UNUSED,
21326 const gchar *object_path G_GNUC_UNUSED,
21327 const gchar *interface_name G_GNUC_UNUSED,
21328 const gchar *property_name,
21329 GVariant *variant,
21330 GError **error,
21331 gpointer user_data)
21332{
21333 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
21334 GValue value = G_VALUE_INIT;
21335 GParamSpec *pspec;
21336 _ExtendedGDBusPropertyInfo *info;
21337 gboolean ret;
21338 ret = FALSE;
21339 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
21340 g_assert (info != NULL);
21341 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
21342 if (pspec == NULL)
21343 {
21344 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
21345 }
21346 else
21347 {
21348 if (info->use_gvariant)
21349 g_value_set_variant (&value, variant);
21350 else
21351 g_dbus_gvariant_to_gvalue (variant, &value);
21352 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
21353 g_value_unset (&value);
21354 ret = TRUE;
21355 }
21356 return ret;
21357}
21358
21359static const GDBusInterfaceVTable _button_skeleton_vtable =
21360{
21361 _button_skeleton_handle_method_call,
21362 _button_skeleton_handle_get_property,
21363 _button_skeleton_handle_set_property,
21364 {NULL}
21365};
21366
21367static GDBusInterfaceInfo *
21368button_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
21369{
21370 return button_interface_info ();
21371}
21372
21373static GDBusInterfaceVTable *
21374button_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
21375{
21376 return (GDBusInterfaceVTable *) &_button_skeleton_vtable;
21377}
21378
21379static GVariant *
21380button_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
21381{
21382 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
21383
21384 GVariantBuilder builder;
21385 guint n;
21386 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
21387 if (_button_interface_info.parent_struct.properties == NULL)
21388 goto out;
21389 for (n = 0; _button_interface_info.parent_struct.properties[n] != NULL; n++)
21390 {
21391 GDBusPropertyInfo *info = _button_interface_info.parent_struct.properties[n];
21392 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
21393 {
21394 GVariant *value;
21395 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);
21396 if (value != NULL)
21397 {
21398 g_variant_take_ref (value);
21399 g_variant_builder_add (&builder, "{sv}", info->name, value);
21400 g_variant_unref (value);
21401 }
21402 }
21403 }
21404out:
21405 return g_variant_builder_end (&builder);
21406}
21407
21408static gboolean _button_emit_changed (gpointer user_data);
21409
21410static void
21411button_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
21412{
21413 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
21414 gboolean emit_changed = FALSE;
21415
21416 g_mutex_lock (&skeleton->priv->lock);
21417 if (skeleton->priv->changed_properties_idle_source != NULL)
21418 {
21419 g_source_destroy (skeleton->priv->changed_properties_idle_source);
21420 skeleton->priv->changed_properties_idle_source = NULL;
21421 emit_changed = TRUE;
21422 }
21423 g_mutex_unlock (&skeleton->priv->lock);
21424
21425 if (emit_changed)
21426 _button_emit_changed (skeleton);
21427}
21428
21429static void
21430_button_on_signal_button_release (
21431 Button *object)
21432{
21433 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21434
21435 GList *connections, *l;
21436 GVariant *signal_variant;
21437 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
21438
21439 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
21440 for (l = connections; l != NULL; l = l->next)
21441 {
21442 GDBusConnection *connection = l->data;
21443 g_dbus_connection_emit_signal (connection,
21444 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonRelease",
21445 signal_variant, NULL);
21446 }
21447 g_variant_unref (signal_variant);
21448 g_list_free_full (connections, g_object_unref);
21449}
21450
21451static void
21452_button_on_signal_button_pressed (
21453 Button *object)
21454{
21455 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21456
21457 GList *connections, *l;
21458 GVariant *signal_variant;
21459 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
21460
21461 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
21462 for (l = connections; l != NULL; l = l->next)
21463 {
21464 GDBusConnection *connection = l->data;
21465 g_dbus_connection_emit_signal (connection,
21466 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonPressed",
21467 signal_variant, NULL);
21468 }
21469 g_variant_unref (signal_variant);
21470 g_list_free_full (connections, g_object_unref);
21471}
21472
21473static void
21474_button_on_signal_button_pressed_long (
21475 Button *object)
21476{
21477 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21478
21479 GList *connections, *l;
21480 GVariant *signal_variant;
21481 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
21482
21483 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
21484 for (l = connections; l != NULL; l = l->next)
21485 {
21486 GDBusConnection *connection = l->data;
21487 g_dbus_connection_emit_signal (connection,
21488 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonPressedLong",
21489 signal_variant, NULL);
21490 }
21491 g_variant_unref (signal_variant);
21492 g_list_free_full (connections, g_object_unref);
21493}
21494
21495static void button_skeleton_iface_init (ButtonIface *iface);
21496#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21497G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
21498 G_ADD_PRIVATE (ButtonSkeleton)
21499 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
21500
21501#else
21502G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
21503 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
21504
21505#endif
21506static void
21507button_skeleton_finalize (GObject *object)
21508{
21509 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21510 guint n;
21511 for (n = 0; n < 1; n++)
21512 g_value_unset (&skeleton->priv->properties[n]);
21513 g_free (skeleton->priv->properties);
21514 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
21515 if (skeleton->priv->changed_properties_idle_source != NULL)
21516 g_source_destroy (skeleton->priv->changed_properties_idle_source);
21517 g_main_context_unref (skeleton->priv->context);
21518 g_mutex_clear (&skeleton->priv->lock);
21519 G_OBJECT_CLASS (button_skeleton_parent_class)->finalize (object);
21520}
21521
21522static void
21523button_skeleton_get_property (GObject *object,
21524 guint prop_id,
21525 GValue *value,
21526 GParamSpec *pspec G_GNUC_UNUSED)
21527{
21528 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21529 g_assert (prop_id != 0 && prop_id - 1 < 1);
21530 g_mutex_lock (&skeleton->priv->lock);
21531 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
21532 g_mutex_unlock (&skeleton->priv->lock);
21533}
21534
21535static gboolean
21536_button_emit_changed (gpointer user_data)
21537{
21538 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
21539 GList *l;
21540 GVariantBuilder builder;
21541 GVariantBuilder invalidated_builder;
21542 guint num_changes;
21543
21544 g_mutex_lock (&skeleton->priv->lock);
21545 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
21546 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
21547 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
21548 {
21549 ChangedProperty *cp = l->data;
21550 GVariant *variant;
21551 const GValue *cur_value;
21552
21553 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
21554 if (!_g_value_equal (cur_value, &cp->orig_value))
21555 {
21556 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
21557 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
21558 g_variant_unref (variant);
21559 num_changes++;
21560 }
21561 }
21562 if (num_changes > 0)
21563 {
21564 GList *connections, *ll;
21565 GVariant *signal_variant;
21566 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Button",
21567 &builder, &invalidated_builder));
21568 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
21569 for (ll = connections; ll != NULL; ll = ll->next)
21570 {
21571 GDBusConnection *connection = ll->data;
21572
21573 g_dbus_connection_emit_signal (connection,
21574 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
21575 "org.freedesktop.DBus.Properties",
21576 "PropertiesChanged",
21577 signal_variant,
21578 NULL);
21579 }
21580 g_variant_unref (signal_variant);
21581 g_list_free_full (connections, g_object_unref);
21582 }
21583 else
21584 {
21585 g_variant_builder_clear (&builder);
21586 g_variant_builder_clear (&invalidated_builder);
21587 }
21588 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
21589 skeleton->priv->changed_properties = NULL;
21590 skeleton->priv->changed_properties_idle_source = NULL;
21591 g_mutex_unlock (&skeleton->priv->lock);
21592 return FALSE;
21593}
21594
21595static void
21596_button_schedule_emit_changed (ButtonSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
21597{
21598 ChangedProperty *cp;
21599 GList *l;
21600 cp = NULL;
21601 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
21602 {
21603 ChangedProperty *i_cp = l->data;
21604 if (i_cp->info == info)
21605 {
21606 cp = i_cp;
21607 break;
21608 }
21609 }
21610 if (cp == NULL)
21611 {
21612 cp = g_new0 (ChangedProperty, 1);
21613 cp->prop_id = prop_id;
21614 cp->info = info;
21615 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
21616 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
21617 g_value_copy (orig_value, &cp->orig_value);
21618 }
21619}
21620
21621static void
21622button_skeleton_notify (GObject *object,
21623 GParamSpec *pspec G_GNUC_UNUSED)
21624{
21625 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21626 g_mutex_lock (&skeleton->priv->lock);
21627 if (skeleton->priv->changed_properties != NULL &&
21628 skeleton->priv->changed_properties_idle_source == NULL)
21629 {
21630 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
21631 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
21632 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _button_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
21633 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
21634 g_source_unref (skeleton->priv->changed_properties_idle_source);
21635 }
21636 g_mutex_unlock (&skeleton->priv->lock);
21637}
21638
21639static void
21640button_skeleton_set_property (GObject *object,
21641 guint prop_id,
21642 const GValue *value,
21643 GParamSpec *pspec)
21644{
21645 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21646 g_assert (prop_id != 0 && prop_id - 1 < 1);
21647 g_mutex_lock (&skeleton->priv->lock);
21648 g_object_freeze_notify (object);
21649 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
21650 {
21651 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
21652 _button_schedule_emit_changed (skeleton, _button_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
21653 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
21654 g_object_notify_by_pspec (object, pspec);
21655 }
21656 g_mutex_unlock (&skeleton->priv->lock);
21657 g_object_thaw_notify (object);
21658}
21659
21660static void
21661button_skeleton_init (ButtonSkeleton *skeleton)
21662{
21663#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21664 skeleton->priv = button_skeleton_get_instance_private (skeleton);
21665#else
21666 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_BUTTON_SKELETON, ButtonSkeletonPrivate);
21667#endif
21668
21669 g_mutex_init (&skeleton->priv->lock);
21670 skeleton->priv->context = g_main_context_ref_thread_default ();
21671 skeleton->priv->properties = g_new0 (GValue, 1);
21672 g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN);
21673}
21674
21675static gboolean
21676button_skeleton_get_state (Button *object)
21677{
21678 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
21679 gboolean value;
21680 g_mutex_lock (&skeleton->priv->lock);
21681 value = g_value_get_boolean (&(skeleton->priv->properties[0]));
21682 g_mutex_unlock (&skeleton->priv->lock);
21683 return value;
21684}
21685
21686static void
21687button_skeleton_class_init (ButtonSkeletonClass *klass)
21688{
21689 GObjectClass *gobject_class;
21690 GDBusInterfaceSkeletonClass *skeleton_class;
21691
21692 gobject_class = G_OBJECT_CLASS (klass);
21693 gobject_class->finalize = button_skeleton_finalize;
21694 gobject_class->get_property = button_skeleton_get_property;
21695 gobject_class->set_property = button_skeleton_set_property;
21696 gobject_class->notify = button_skeleton_notify;
21697
21698
21699 button_override_properties (gobject_class, 1);
21700
21701 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
21702 skeleton_class->get_info = button_skeleton_dbus_interface_get_info;
21703 skeleton_class->get_properties = button_skeleton_dbus_interface_get_properties;
21704 skeleton_class->flush = button_skeleton_dbus_interface_flush;
21705 skeleton_class->get_vtable = button_skeleton_dbus_interface_get_vtable;
21706
21707#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
21708 g_type_class_add_private (klass, sizeof (ButtonSkeletonPrivate));
21709#endif
21710}
21711
21712static void
21713button_skeleton_iface_init (ButtonIface *iface)
21714{
21715 iface->button_release = _button_on_signal_button_release;
21716 iface->button_pressed = _button_on_signal_button_pressed;
21717 iface->button_pressed_long = _button_on_signal_button_pressed_long;
21718 iface->get_state = button_skeleton_get_state;
21719}
21720
21721/**
21722 * button_skeleton_new:
21723 *
21724 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
21725 *
21726 * Returns: (transfer full) (type ButtonSkeleton): The skeleton object.
21727 */
21728Button *
21729button_skeleton_new (void)
21730{
21731 return BUTTON (g_object_new (TYPE_BUTTON_SKELETON, NULL));
21732}
21733
21734/* ------------------------------------------------------------------------
21735 * Code for interface org.openbmc.Led
21736 * ------------------------------------------------------------------------
21737 */
21738
21739/**
21740 * SECTION:Led
21741 * @title: Led
21742 * @short_description: Generated C code for the org.openbmc.Led D-Bus interface
21743 *
21744 * 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.
21745 */
21746
21747/* ---- Introspection data for org.openbmc.Led ---- */
21748
21749static const _ExtendedGDBusMethodInfo _led_method_info_set_on =
21750{
21751 {
21752 -1,
21753 (gchar *) "setOn",
21754 NULL,
21755 NULL,
21756 NULL
21757 },
21758 "handle-set-on",
21759 FALSE
21760};
21761
21762static const _ExtendedGDBusMethodInfo _led_method_info_set_off =
21763{
21764 {
21765 -1,
21766 (gchar *) "setOff",
21767 NULL,
21768 NULL,
21769 NULL
21770 },
21771 "handle-set-off",
21772 FALSE
21773};
21774
21775static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_slow =
21776{
21777 {
21778 -1,
21779 (gchar *) "setBlinkSlow",
21780 NULL,
21781 NULL,
21782 NULL
21783 },
21784 "handle-set-blink-slow",
21785 FALSE
21786};
21787
21788static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_fast =
21789{
21790 {
21791 -1,
21792 (gchar *) "setBlinkFast",
21793 NULL,
21794 NULL,
21795 NULL
21796 },
21797 "handle-set-blink-fast",
21798 FALSE
21799};
21800
21801static const _ExtendedGDBusMethodInfo * const _led_method_info_pointers[] =
21802{
21803 &_led_method_info_set_on,
21804 &_led_method_info_set_off,
21805 &_led_method_info_set_blink_slow,
21806 &_led_method_info_set_blink_fast,
21807 NULL
21808};
21809
21810static const _ExtendedGDBusPropertyInfo _led_property_info_color =
21811{
21812 {
21813 -1,
21814 (gchar *) "color",
21815 (gchar *) "i",
21816 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21817 NULL
21818 },
21819 "color",
21820 FALSE
21821};
21822
21823static const _ExtendedGDBusPropertyInfo _led_property_info_function =
21824{
21825 {
21826 -1,
21827 (gchar *) "function",
21828 (gchar *) "s",
21829 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21830 NULL
21831 },
21832 "function",
21833 FALSE
21834};
21835
21836static const _ExtendedGDBusPropertyInfo * const _led_property_info_pointers[] =
21837{
21838 &_led_property_info_color,
21839 &_led_property_info_function,
21840 NULL
21841};
21842
21843static const _ExtendedGDBusInterfaceInfo _led_interface_info =
21844{
21845 {
21846 -1,
21847 (gchar *) "org.openbmc.Led",
21848 (GDBusMethodInfo **) &_led_method_info_pointers,
21849 NULL,
21850 (GDBusPropertyInfo **) &_led_property_info_pointers,
21851 NULL
21852 },
21853 "led",
21854};
21855
21856
21857/**
21858 * led_interface_info:
21859 *
21860 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> D-Bus interface.
21861 *
21862 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
21863 */
21864GDBusInterfaceInfo *
21865led_interface_info (void)
21866{
21867 return (GDBusInterfaceInfo *) &_led_interface_info.parent_struct;
21868}
21869
21870/**
21871 * led_override_properties:
21872 * @klass: The class structure for a #GObject<!-- -->-derived class.
21873 * @property_id_begin: The property id to assign to the first overridden property.
21874 *
21875 * Overrides all #GObject properties in the #Led interface for a concrete class.
21876 * The properties are overridden in the order they are defined.
21877 *
21878 * Returns: The last property id.
21879 */
21880guint
21881led_override_properties (GObjectClass *klass, guint property_id_begin)
21882{
21883 g_object_class_override_property (klass, property_id_begin++, "color");
21884 g_object_class_override_property (klass, property_id_begin++, "function");
21885 return property_id_begin - 1;
21886}
21887
21888
21889
21890/**
21891 * Led:
21892 *
21893 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
21894 */
21895
21896/**
21897 * LedIface:
21898 * @parent_iface: The parent interface.
21899 * @handle_set_blink_fast: Handler for the #Led::handle-set-blink-fast signal.
21900 * @handle_set_blink_slow: Handler for the #Led::handle-set-blink-slow signal.
21901 * @handle_set_off: Handler for the #Led::handle-set-off signal.
21902 * @handle_set_on: Handler for the #Led::handle-set-on signal.
21903 * @get_color: Getter for the #Led:color property.
21904 * @get_function: Getter for the #Led:function property.
21905 *
21906 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
21907 */
21908
21909typedef LedIface LedInterface;
21910G_DEFINE_INTERFACE (Led, led, G_TYPE_OBJECT);
21911
21912static void
21913led_default_init (LedIface *iface)
21914{
21915 /* GObject signals for incoming D-Bus method calls: */
21916 /**
21917 * Led::handle-set-on:
21918 * @object: A #Led.
21919 * @invocation: A #GDBusMethodInvocation.
21920 *
21921 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method.
21922 *
21923 * 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.
21924 *
21925 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21926 */
21927 g_signal_new ("handle-set-on",
21928 G_TYPE_FROM_INTERFACE (iface),
21929 G_SIGNAL_RUN_LAST,
21930 G_STRUCT_OFFSET (LedIface, handle_set_on),
21931 g_signal_accumulator_true_handled,
21932 NULL,
21933 g_cclosure_marshal_generic,
21934 G_TYPE_BOOLEAN,
21935 1,
21936 G_TYPE_DBUS_METHOD_INVOCATION);
21937
21938 /**
21939 * Led::handle-set-off:
21940 * @object: A #Led.
21941 * @invocation: A #GDBusMethodInvocation.
21942 *
21943 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method.
21944 *
21945 * 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.
21946 *
21947 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21948 */
21949 g_signal_new ("handle-set-off",
21950 G_TYPE_FROM_INTERFACE (iface),
21951 G_SIGNAL_RUN_LAST,
21952 G_STRUCT_OFFSET (LedIface, handle_set_off),
21953 g_signal_accumulator_true_handled,
21954 NULL,
21955 g_cclosure_marshal_generic,
21956 G_TYPE_BOOLEAN,
21957 1,
21958 G_TYPE_DBUS_METHOD_INVOCATION);
21959
21960 /**
21961 * Led::handle-set-blink-slow:
21962 * @object: A #Led.
21963 * @invocation: A #GDBusMethodInvocation.
21964 *
21965 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method.
21966 *
21967 * 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.
21968 *
21969 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21970 */
21971 g_signal_new ("handle-set-blink-slow",
21972 G_TYPE_FROM_INTERFACE (iface),
21973 G_SIGNAL_RUN_LAST,
21974 G_STRUCT_OFFSET (LedIface, handle_set_blink_slow),
21975 g_signal_accumulator_true_handled,
21976 NULL,
21977 g_cclosure_marshal_generic,
21978 G_TYPE_BOOLEAN,
21979 1,
21980 G_TYPE_DBUS_METHOD_INVOCATION);
21981
21982 /**
21983 * Led::handle-set-blink-fast:
21984 * @object: A #Led.
21985 * @invocation: A #GDBusMethodInvocation.
21986 *
21987 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method.
21988 *
21989 * 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.
21990 *
21991 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21992 */
21993 g_signal_new ("handle-set-blink-fast",
21994 G_TYPE_FROM_INTERFACE (iface),
21995 G_SIGNAL_RUN_LAST,
21996 G_STRUCT_OFFSET (LedIface, handle_set_blink_fast),
21997 g_signal_accumulator_true_handled,
21998 NULL,
21999 g_cclosure_marshal_generic,
22000 G_TYPE_BOOLEAN,
22001 1,
22002 G_TYPE_DBUS_METHOD_INVOCATION);
22003
22004 /* GObject properties for D-Bus properties: */
22005 /**
22006 * Led:color:
22007 *
22008 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link>.
22009 *
22010 * 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.
22011 */
22012 g_object_interface_install_property (iface,
22013 g_param_spec_int ("color", "color", "color", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
22014 /**
22015 * Led:function:
22016 *
22017 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link>.
22018 *
22019 * 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.
22020 */
22021 g_object_interface_install_property (iface,
22022 g_param_spec_string ("function", "function", "function", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
22023}
22024
22025/**
22026 * led_get_color: (skip)
22027 * @object: A #Led.
22028 *
22029 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property.
22030 *
22031 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22032 *
22033 * Returns: The property value.
22034 */
22035gint
22036led_get_color (Led *object)
22037{
22038 return LED_GET_IFACE (object)->get_color (object);
22039}
22040
22041/**
22042 * led_set_color: (skip)
22043 * @object: A #Led.
22044 * @value: The value to set.
22045 *
22046 * Sets the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property to @value.
22047 *
22048 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22049 */
22050void
22051led_set_color (Led *object, gint value)
22052{
22053 g_object_set (G_OBJECT (object), "color", value, NULL);
22054}
22055
22056/**
22057 * led_get_function: (skip)
22058 * @object: A #Led.
22059 *
22060 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
22061 *
22062 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22063 *
22064 * <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>
22065 *
22066 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
22067 */
22068const gchar *
22069led_get_function (Led *object)
22070{
22071 return LED_GET_IFACE (object)->get_function (object);
22072}
22073
22074/**
22075 * led_dup_function: (skip)
22076 * @object: A #Led.
22077 *
22078 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
22079 *
22080 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22081 *
22082 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22083 */
22084gchar *
22085led_dup_function (Led *object)
22086{
22087 gchar *value;
22088 g_object_get (G_OBJECT (object), "function", &value, NULL);
22089 return value;
22090}
22091
22092/**
22093 * led_set_function: (skip)
22094 * @object: A #Led.
22095 * @value: The value to set.
22096 *
22097 * Sets the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property to @value.
22098 *
22099 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22100 */
22101void
22102led_set_function (Led *object, const gchar *value)
22103{
22104 g_object_set (G_OBJECT (object), "function", value, NULL);
22105}
22106
22107/**
22108 * led_call_set_on:
22109 * @proxy: A #LedProxy.
22110 * @cancellable: (allow-none): A #GCancellable or %NULL.
22111 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22112 * @user_data: User data to pass to @callback.
22113 *
22114 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method on @proxy.
22115 * 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.
22116 * You can then call led_call_set_on_finish() to get the result of the operation.
22117 *
22118 * See led_call_set_on_sync() for the synchronous, blocking version of this method.
22119 */
22120void
22121led_call_set_on (
22122 Led *proxy,
22123 GCancellable *cancellable,
22124 GAsyncReadyCallback callback,
22125 gpointer user_data)
22126{
22127 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22128 "setOn",
22129 g_variant_new ("()"),
22130 G_DBUS_CALL_FLAGS_NONE,
22131 -1,
22132 cancellable,
22133 callback,
22134 user_data);
22135}
22136
22137/**
22138 * led_call_set_on_finish:
22139 * @proxy: A #LedProxy.
22140 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_on().
22141 * @error: Return location for error or %NULL.
22142 *
22143 * Finishes an operation started with led_call_set_on().
22144 *
22145 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22146 */
22147gboolean
22148led_call_set_on_finish (
22149 Led *proxy,
22150 GAsyncResult *res,
22151 GError **error)
22152{
22153 GVariant *_ret;
22154 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22155 if (_ret == NULL)
22156 goto _out;
22157 g_variant_get (_ret,
22158 "()");
22159 g_variant_unref (_ret);
22160_out:
22161 return _ret != NULL;
22162}
22163
22164/**
22165 * led_call_set_on_sync:
22166 * @proxy: A #LedProxy.
22167 * @cancellable: (allow-none): A #GCancellable or %NULL.
22168 * @error: Return location for error or %NULL.
22169 *
22170 * 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.
22171 *
22172 * See led_call_set_on() for the asynchronous version of this method.
22173 *
22174 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22175 */
22176gboolean
22177led_call_set_on_sync (
22178 Led *proxy,
22179 GCancellable *cancellable,
22180 GError **error)
22181{
22182 GVariant *_ret;
22183 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22184 "setOn",
22185 g_variant_new ("()"),
22186 G_DBUS_CALL_FLAGS_NONE,
22187 -1,
22188 cancellable,
22189 error);
22190 if (_ret == NULL)
22191 goto _out;
22192 g_variant_get (_ret,
22193 "()");
22194 g_variant_unref (_ret);
22195_out:
22196 return _ret != NULL;
22197}
22198
22199/**
22200 * led_call_set_off:
22201 * @proxy: A #LedProxy.
22202 * @cancellable: (allow-none): A #GCancellable or %NULL.
22203 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22204 * @user_data: User data to pass to @callback.
22205 *
22206 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method on @proxy.
22207 * 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.
22208 * You can then call led_call_set_off_finish() to get the result of the operation.
22209 *
22210 * See led_call_set_off_sync() for the synchronous, blocking version of this method.
22211 */
22212void
22213led_call_set_off (
22214 Led *proxy,
22215 GCancellable *cancellable,
22216 GAsyncReadyCallback callback,
22217 gpointer user_data)
22218{
22219 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22220 "setOff",
22221 g_variant_new ("()"),
22222 G_DBUS_CALL_FLAGS_NONE,
22223 -1,
22224 cancellable,
22225 callback,
22226 user_data);
22227}
22228
22229/**
22230 * led_call_set_off_finish:
22231 * @proxy: A #LedProxy.
22232 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_off().
22233 * @error: Return location for error or %NULL.
22234 *
22235 * Finishes an operation started with led_call_set_off().
22236 *
22237 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22238 */
22239gboolean
22240led_call_set_off_finish (
22241 Led *proxy,
22242 GAsyncResult *res,
22243 GError **error)
22244{
22245 GVariant *_ret;
22246 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22247 if (_ret == NULL)
22248 goto _out;
22249 g_variant_get (_ret,
22250 "()");
22251 g_variant_unref (_ret);
22252_out:
22253 return _ret != NULL;
22254}
22255
22256/**
22257 * led_call_set_off_sync:
22258 * @proxy: A #LedProxy.
22259 * @cancellable: (allow-none): A #GCancellable or %NULL.
22260 * @error: Return location for error or %NULL.
22261 *
22262 * 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.
22263 *
22264 * See led_call_set_off() for the asynchronous version of this method.
22265 *
22266 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22267 */
22268gboolean
22269led_call_set_off_sync (
22270 Led *proxy,
22271 GCancellable *cancellable,
22272 GError **error)
22273{
22274 GVariant *_ret;
22275 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22276 "setOff",
22277 g_variant_new ("()"),
22278 G_DBUS_CALL_FLAGS_NONE,
22279 -1,
22280 cancellable,
22281 error);
22282 if (_ret == NULL)
22283 goto _out;
22284 g_variant_get (_ret,
22285 "()");
22286 g_variant_unref (_ret);
22287_out:
22288 return _ret != NULL;
22289}
22290
22291/**
22292 * led_call_set_blink_slow:
22293 * @proxy: A #LedProxy.
22294 * @cancellable: (allow-none): A #GCancellable or %NULL.
22295 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22296 * @user_data: User data to pass to @callback.
22297 *
22298 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method on @proxy.
22299 * 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.
22300 * You can then call led_call_set_blink_slow_finish() to get the result of the operation.
22301 *
22302 * See led_call_set_blink_slow_sync() for the synchronous, blocking version of this method.
22303 */
22304void
22305led_call_set_blink_slow (
22306 Led *proxy,
22307 GCancellable *cancellable,
22308 GAsyncReadyCallback callback,
22309 gpointer user_data)
22310{
22311 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22312 "setBlinkSlow",
22313 g_variant_new ("()"),
22314 G_DBUS_CALL_FLAGS_NONE,
22315 -1,
22316 cancellable,
22317 callback,
22318 user_data);
22319}
22320
22321/**
22322 * led_call_set_blink_slow_finish:
22323 * @proxy: A #LedProxy.
22324 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_slow().
22325 * @error: Return location for error or %NULL.
22326 *
22327 * Finishes an operation started with led_call_set_blink_slow().
22328 *
22329 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22330 */
22331gboolean
22332led_call_set_blink_slow_finish (
22333 Led *proxy,
22334 GAsyncResult *res,
22335 GError **error)
22336{
22337 GVariant *_ret;
22338 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22339 if (_ret == NULL)
22340 goto _out;
22341 g_variant_get (_ret,
22342 "()");
22343 g_variant_unref (_ret);
22344_out:
22345 return _ret != NULL;
22346}
22347
22348/**
22349 * led_call_set_blink_slow_sync:
22350 * @proxy: A #LedProxy.
22351 * @cancellable: (allow-none): A #GCancellable or %NULL.
22352 * @error: Return location for error or %NULL.
22353 *
22354 * 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.
22355 *
22356 * See led_call_set_blink_slow() for the asynchronous version of this method.
22357 *
22358 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22359 */
22360gboolean
22361led_call_set_blink_slow_sync (
22362 Led *proxy,
22363 GCancellable *cancellable,
22364 GError **error)
22365{
22366 GVariant *_ret;
22367 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22368 "setBlinkSlow",
22369 g_variant_new ("()"),
22370 G_DBUS_CALL_FLAGS_NONE,
22371 -1,
22372 cancellable,
22373 error);
22374 if (_ret == NULL)
22375 goto _out;
22376 g_variant_get (_ret,
22377 "()");
22378 g_variant_unref (_ret);
22379_out:
22380 return _ret != NULL;
22381}
22382
22383/**
22384 * led_call_set_blink_fast:
22385 * @proxy: A #LedProxy.
22386 * @cancellable: (allow-none): A #GCancellable or %NULL.
22387 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22388 * @user_data: User data to pass to @callback.
22389 *
22390 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method on @proxy.
22391 * 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.
22392 * You can then call led_call_set_blink_fast_finish() to get the result of the operation.
22393 *
22394 * See led_call_set_blink_fast_sync() for the synchronous, blocking version of this method.
22395 */
22396void
22397led_call_set_blink_fast (
22398 Led *proxy,
22399 GCancellable *cancellable,
22400 GAsyncReadyCallback callback,
22401 gpointer user_data)
22402{
22403 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22404 "setBlinkFast",
22405 g_variant_new ("()"),
22406 G_DBUS_CALL_FLAGS_NONE,
22407 -1,
22408 cancellable,
22409 callback,
22410 user_data);
22411}
22412
22413/**
22414 * led_call_set_blink_fast_finish:
22415 * @proxy: A #LedProxy.
22416 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_fast().
22417 * @error: Return location for error or %NULL.
22418 *
22419 * Finishes an operation started with led_call_set_blink_fast().
22420 *
22421 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22422 */
22423gboolean
22424led_call_set_blink_fast_finish (
22425 Led *proxy,
22426 GAsyncResult *res,
22427 GError **error)
22428{
22429 GVariant *_ret;
22430 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22431 if (_ret == NULL)
22432 goto _out;
22433 g_variant_get (_ret,
22434 "()");
22435 g_variant_unref (_ret);
22436_out:
22437 return _ret != NULL;
22438}
22439
22440/**
22441 * led_call_set_blink_fast_sync:
22442 * @proxy: A #LedProxy.
22443 * @cancellable: (allow-none): A #GCancellable or %NULL.
22444 * @error: Return location for error or %NULL.
22445 *
22446 * 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.
22447 *
22448 * See led_call_set_blink_fast() for the asynchronous version of this method.
22449 *
22450 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22451 */
22452gboolean
22453led_call_set_blink_fast_sync (
22454 Led *proxy,
22455 GCancellable *cancellable,
22456 GError **error)
22457{
22458 GVariant *_ret;
22459 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22460 "setBlinkFast",
22461 g_variant_new ("()"),
22462 G_DBUS_CALL_FLAGS_NONE,
22463 -1,
22464 cancellable,
22465 error);
22466 if (_ret == NULL)
22467 goto _out;
22468 g_variant_get (_ret,
22469 "()");
22470 g_variant_unref (_ret);
22471_out:
22472 return _ret != NULL;
22473}
22474
22475/**
22476 * led_complete_set_on:
22477 * @object: A #Led.
22478 * @invocation: (transfer full): A #GDBusMethodInvocation.
22479 *
22480 * 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.
22481 *
22482 * This method will free @invocation, you cannot use it afterwards.
22483 */
22484void
22485led_complete_set_on (
22486 Led *object,
22487 GDBusMethodInvocation *invocation)
22488{
22489 g_dbus_method_invocation_return_value (invocation,
22490 g_variant_new ("()"));
22491}
22492
22493/**
22494 * led_complete_set_off:
22495 * @object: A #Led.
22496 * @invocation: (transfer full): A #GDBusMethodInvocation.
22497 *
22498 * 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.
22499 *
22500 * This method will free @invocation, you cannot use it afterwards.
22501 */
22502void
22503led_complete_set_off (
22504 Led *object,
22505 GDBusMethodInvocation *invocation)
22506{
22507 g_dbus_method_invocation_return_value (invocation,
22508 g_variant_new ("()"));
22509}
22510
22511/**
22512 * led_complete_set_blink_slow:
22513 * @object: A #Led.
22514 * @invocation: (transfer full): A #GDBusMethodInvocation.
22515 *
22516 * 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.
22517 *
22518 * This method will free @invocation, you cannot use it afterwards.
22519 */
22520void
22521led_complete_set_blink_slow (
22522 Led *object,
22523 GDBusMethodInvocation *invocation)
22524{
22525 g_dbus_method_invocation_return_value (invocation,
22526 g_variant_new ("()"));
22527}
22528
22529/**
22530 * led_complete_set_blink_fast:
22531 * @object: A #Led.
22532 * @invocation: (transfer full): A #GDBusMethodInvocation.
22533 *
22534 * 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.
22535 *
22536 * This method will free @invocation, you cannot use it afterwards.
22537 */
22538void
22539led_complete_set_blink_fast (
22540 Led *object,
22541 GDBusMethodInvocation *invocation)
22542{
22543 g_dbus_method_invocation_return_value (invocation,
22544 g_variant_new ("()"));
22545}
22546
22547/* ------------------------------------------------------------------------ */
22548
22549/**
22550 * LedProxy:
22551 *
22552 * The #LedProxy structure contains only private data and should only be accessed using the provided API.
22553 */
22554
22555/**
22556 * LedProxyClass:
22557 * @parent_class: The parent class.
22558 *
22559 * Class structure for #LedProxy.
22560 */
22561
22562struct _LedProxyPrivate
22563{
22564 GData *qdata;
22565};
22566
22567static void led_proxy_iface_init (LedIface *iface);
22568
22569#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22570G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
22571 G_ADD_PRIVATE (LedProxy)
22572 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
22573
22574#else
22575G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
22576 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
22577
22578#endif
22579static void
22580led_proxy_finalize (GObject *object)
22581{
22582 LedProxy *proxy = LED_PROXY (object);
22583 g_datalist_clear (&proxy->priv->qdata);
22584 G_OBJECT_CLASS (led_proxy_parent_class)->finalize (object);
22585}
22586
22587static void
22588led_proxy_get_property (GObject *object,
22589 guint prop_id,
22590 GValue *value,
22591 GParamSpec *pspec G_GNUC_UNUSED)
22592{
22593 const _ExtendedGDBusPropertyInfo *info;
22594 GVariant *variant;
22595 g_assert (prop_id != 0 && prop_id - 1 < 2);
22596 info = _led_property_info_pointers[prop_id - 1];
22597 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
22598 if (info->use_gvariant)
22599 {
22600 g_value_set_variant (value, variant);
22601 }
22602 else
22603 {
22604 if (variant != NULL)
22605 g_dbus_gvariant_to_gvalue (variant, value);
22606 }
22607 if (variant != NULL)
22608 g_variant_unref (variant);
22609}
22610
22611static void
22612led_proxy_set_property_cb (GDBusProxy *proxy,
22613 GAsyncResult *res,
22614 gpointer user_data)
22615{
22616 const _ExtendedGDBusPropertyInfo *info = user_data;
22617 GError *error;
22618 GVariant *_ret;
22619 error = NULL;
22620 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
22621 if (!_ret)
22622 {
22623 g_warning ("Error setting property '%s' on interface org.openbmc.Led: %s (%s, %d)",
22624 info->parent_struct.name,
22625 error->message, g_quark_to_string (error->domain), error->code);
22626 g_error_free (error);
22627 }
22628 else
22629 {
22630 g_variant_unref (_ret);
22631 }
22632}
22633
22634static void
22635led_proxy_set_property (GObject *object,
22636 guint prop_id,
22637 const GValue *value,
22638 GParamSpec *pspec G_GNUC_UNUSED)
22639{
22640 const _ExtendedGDBusPropertyInfo *info;
22641 GVariant *variant;
22642 g_assert (prop_id != 0 && prop_id - 1 < 2);
22643 info = _led_property_info_pointers[prop_id - 1];
22644 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
22645 g_dbus_proxy_call (G_DBUS_PROXY (object),
22646 "org.freedesktop.DBus.Properties.Set",
22647 g_variant_new ("(ssv)", "org.openbmc.Led", info->parent_struct.name, variant),
22648 G_DBUS_CALL_FLAGS_NONE,
22649 -1,
22650 NULL, (GAsyncReadyCallback) led_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
22651 g_variant_unref (variant);
22652}
22653
22654static void
22655led_proxy_g_signal (GDBusProxy *proxy,
22656 const gchar *sender_name G_GNUC_UNUSED,
22657 const gchar *signal_name,
22658 GVariant *parameters)
22659{
22660 _ExtendedGDBusSignalInfo *info;
22661 GVariantIter iter;
22662 GVariant *child;
22663 GValue *paramv;
22664 guint num_params;
22665 guint n;
22666 guint signal_id;
22667 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, signal_name);
22668 if (info == NULL)
22669 return;
22670 num_params = g_variant_n_children (parameters);
22671 paramv = g_new0 (GValue, num_params + 1);
22672 g_value_init (&paramv[0], TYPE_LED);
22673 g_value_set_object (&paramv[0], proxy);
22674 g_variant_iter_init (&iter, parameters);
22675 n = 1;
22676 while ((child = g_variant_iter_next_value (&iter)) != NULL)
22677 {
22678 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
22679 if (arg_info->use_gvariant)
22680 {
22681 g_value_init (&paramv[n], G_TYPE_VARIANT);
22682 g_value_set_variant (&paramv[n], child);
22683 n++;
22684 }
22685 else
22686 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
22687 g_variant_unref (child);
22688 }
22689 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
22690 g_signal_emitv (paramv, signal_id, 0, NULL);
22691 for (n = 0; n < num_params + 1; n++)
22692 g_value_unset (&paramv[n]);
22693 g_free (paramv);
22694}
22695
22696static void
22697led_proxy_g_properties_changed (GDBusProxy *_proxy,
22698 GVariant *changed_properties,
22699 const gchar *const *invalidated_properties)
22700{
22701 LedProxy *proxy = LED_PROXY (_proxy);
22702 guint n;
22703 const gchar *key;
22704 GVariantIter *iter;
22705 _ExtendedGDBusPropertyInfo *info;
22706 g_variant_get (changed_properties, "a{sv}", &iter);
22707 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
22708 {
22709 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, key);
22710 g_datalist_remove_data (&proxy->priv->qdata, key);
22711 if (info != NULL)
22712 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
22713 }
22714 g_variant_iter_free (iter);
22715 for (n = 0; invalidated_properties[n] != NULL; n++)
22716 {
22717 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, invalidated_properties[n]);
22718 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
22719 if (info != NULL)
22720 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
22721 }
22722}
22723
22724static gint
22725led_proxy_get_color (Led *object)
22726{
22727 LedProxy *proxy = LED_PROXY (object);
22728 GVariant *variant;
22729 gint value = 0;
22730 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "color");
22731 if (variant != NULL)
22732 {
22733 value = g_variant_get_int32 (variant);
22734 g_variant_unref (variant);
22735 }
22736 return value;
22737}
22738
22739static const gchar *
22740led_proxy_get_function (Led *object)
22741{
22742 LedProxy *proxy = LED_PROXY (object);
22743 GVariant *variant;
22744 const gchar *value = NULL;
22745 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "function");
22746 if (variant != NULL)
22747 {
22748 value = g_variant_get_string (variant, NULL);
22749 g_variant_unref (variant);
22750 }
22751 return value;
22752}
22753
22754static void
22755led_proxy_init (LedProxy *proxy)
22756{
22757#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22758 proxy->priv = led_proxy_get_instance_private (proxy);
22759#else
22760 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_LED_PROXY, LedProxyPrivate);
22761#endif
22762
22763 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), led_interface_info ());
22764}
22765
22766static void
22767led_proxy_class_init (LedProxyClass *klass)
22768{
22769 GObjectClass *gobject_class;
22770 GDBusProxyClass *proxy_class;
22771
22772 gobject_class = G_OBJECT_CLASS (klass);
22773 gobject_class->finalize = led_proxy_finalize;
22774 gobject_class->get_property = led_proxy_get_property;
22775 gobject_class->set_property = led_proxy_set_property;
22776
22777 proxy_class = G_DBUS_PROXY_CLASS (klass);
22778 proxy_class->g_signal = led_proxy_g_signal;
22779 proxy_class->g_properties_changed = led_proxy_g_properties_changed;
22780
22781 led_override_properties (gobject_class, 1);
22782
22783#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
22784 g_type_class_add_private (klass, sizeof (LedProxyPrivate));
22785#endif
22786}
22787
22788static void
22789led_proxy_iface_init (LedIface *iface)
22790{
22791 iface->get_color = led_proxy_get_color;
22792 iface->get_function = led_proxy_get_function;
22793}
22794
22795/**
22796 * led_proxy_new:
22797 * @connection: A #GDBusConnection.
22798 * @flags: Flags from the #GDBusProxyFlags enumeration.
22799 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
22800 * @object_path: An object path.
22801 * @cancellable: (allow-none): A #GCancellable or %NULL.
22802 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
22803 * @user_data: User data to pass to @callback.
22804 *
22805 * 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.
22806 *
22807 * 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.
22808 * You can then call led_proxy_new_finish() to get the result of the operation.
22809 *
22810 * See led_proxy_new_sync() for the synchronous, blocking version of this constructor.
22811 */
22812void
22813led_proxy_new (
22814 GDBusConnection *connection,
22815 GDBusProxyFlags flags,
22816 const gchar *name,
22817 const gchar *object_path,
22818 GCancellable *cancellable,
22819 GAsyncReadyCallback callback,
22820 gpointer user_data)
22821{
22822 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);
22823}
22824
22825/**
22826 * led_proxy_new_finish:
22827 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new().
22828 * @error: Return location for error or %NULL
22829 *
22830 * Finishes an operation started with led_proxy_new().
22831 *
22832 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
22833 */
22834Led *
22835led_proxy_new_finish (
22836 GAsyncResult *res,
22837 GError **error)
22838{
22839 GObject *ret;
22840 GObject *source_object;
22841 source_object = g_async_result_get_source_object (res);
22842 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
22843 g_object_unref (source_object);
22844 if (ret != NULL)
22845 return LED (ret);
22846 else
22847 return NULL;
22848}
22849
22850/**
22851 * led_proxy_new_sync:
22852 * @connection: A #GDBusConnection.
22853 * @flags: Flags from the #GDBusProxyFlags enumeration.
22854 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
22855 * @object_path: An object path.
22856 * @cancellable: (allow-none): A #GCancellable or %NULL.
22857 * @error: Return location for error or %NULL
22858 *
22859 * 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.
22860 *
22861 * The calling thread is blocked until a reply is received.
22862 *
22863 * See led_proxy_new() for the asynchronous version of this constructor.
22864 *
22865 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
22866 */
22867Led *
22868led_proxy_new_sync (
22869 GDBusConnection *connection,
22870 GDBusProxyFlags flags,
22871 const gchar *name,
22872 const gchar *object_path,
22873 GCancellable *cancellable,
22874 GError **error)
22875{
22876 GInitable *ret;
22877 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);
22878 if (ret != NULL)
22879 return LED (ret);
22880 else
22881 return NULL;
22882}
22883
22884
22885/**
22886 * led_proxy_new_for_bus:
22887 * @bus_type: A #GBusType.
22888 * @flags: Flags from the #GDBusProxyFlags enumeration.
22889 * @name: A bus name (well-known or unique).
22890 * @object_path: An object path.
22891 * @cancellable: (allow-none): A #GCancellable or %NULL.
22892 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
22893 * @user_data: User data to pass to @callback.
22894 *
22895 * Like led_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
22896 *
22897 * 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.
22898 * You can then call led_proxy_new_for_bus_finish() to get the result of the operation.
22899 *
22900 * See led_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
22901 */
22902void
22903led_proxy_new_for_bus (
22904 GBusType bus_type,
22905 GDBusProxyFlags flags,
22906 const gchar *name,
22907 const gchar *object_path,
22908 GCancellable *cancellable,
22909 GAsyncReadyCallback callback,
22910 gpointer user_data)
22911{
22912 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);
22913}
22914
22915/**
22916 * led_proxy_new_for_bus_finish:
22917 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new_for_bus().
22918 * @error: Return location for error or %NULL
22919 *
22920 * Finishes an operation started with led_proxy_new_for_bus().
22921 *
22922 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
22923 */
22924Led *
22925led_proxy_new_for_bus_finish (
22926 GAsyncResult *res,
22927 GError **error)
22928{
22929 GObject *ret;
22930 GObject *source_object;
22931 source_object = g_async_result_get_source_object (res);
22932 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
22933 g_object_unref (source_object);
22934 if (ret != NULL)
22935 return LED (ret);
22936 else
22937 return NULL;
22938}
22939
22940/**
22941 * led_proxy_new_for_bus_sync:
22942 * @bus_type: A #GBusType.
22943 * @flags: Flags from the #GDBusProxyFlags enumeration.
22944 * @name: A bus name (well-known or unique).
22945 * @object_path: An object path.
22946 * @cancellable: (allow-none): A #GCancellable or %NULL.
22947 * @error: Return location for error or %NULL
22948 *
22949 * Like led_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
22950 *
22951 * The calling thread is blocked until a reply is received.
22952 *
22953 * See led_proxy_new_for_bus() for the asynchronous version of this constructor.
22954 *
22955 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
22956 */
22957Led *
22958led_proxy_new_for_bus_sync (
22959 GBusType bus_type,
22960 GDBusProxyFlags flags,
22961 const gchar *name,
22962 const gchar *object_path,
22963 GCancellable *cancellable,
22964 GError **error)
22965{
22966 GInitable *ret;
22967 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);
22968 if (ret != NULL)
22969 return LED (ret);
22970 else
22971 return NULL;
22972}
22973
22974
22975/* ------------------------------------------------------------------------ */
22976
22977/**
22978 * LedSkeleton:
22979 *
22980 * The #LedSkeleton structure contains only private data and should only be accessed using the provided API.
22981 */
22982
22983/**
22984 * LedSkeletonClass:
22985 * @parent_class: The parent class.
22986 *
22987 * Class structure for #LedSkeleton.
22988 */
22989
22990struct _LedSkeletonPrivate
22991{
22992 GValue *properties;
22993 GList *changed_properties;
22994 GSource *changed_properties_idle_source;
22995 GMainContext *context;
22996 GMutex lock;
22997};
22998
22999static void
23000_led_skeleton_handle_method_call (
23001 GDBusConnection *connection G_GNUC_UNUSED,
23002 const gchar *sender G_GNUC_UNUSED,
23003 const gchar *object_path G_GNUC_UNUSED,
23004 const gchar *interface_name,
23005 const gchar *method_name,
23006 GVariant *parameters,
23007 GDBusMethodInvocation *invocation,
23008 gpointer user_data)
23009{
23010 LedSkeleton *skeleton = LED_SKELETON (user_data);
23011 _ExtendedGDBusMethodInfo *info;
23012 GVariantIter iter;
23013 GVariant *child;
23014 GValue *paramv;
23015 guint num_params;
23016 guint num_extra;
23017 guint n;
23018 guint signal_id;
23019 GValue return_value = G_VALUE_INIT;
23020 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
23021 g_assert (info != NULL);
23022 num_params = g_variant_n_children (parameters);
23023 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
23024 n = 0;
23025 g_value_init (&paramv[n], TYPE_LED);
23026 g_value_set_object (&paramv[n++], skeleton);
23027 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
23028 g_value_set_object (&paramv[n++], invocation);
23029 if (info->pass_fdlist)
23030 {
23031#ifdef G_OS_UNIX
23032 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
23033 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
23034#else
23035 g_assert_not_reached ();
23036#endif
23037 }
23038 g_variant_iter_init (&iter, parameters);
23039 while ((child = g_variant_iter_next_value (&iter)) != NULL)
23040 {
23041 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
23042 if (arg_info->use_gvariant)
23043 {
23044 g_value_init (&paramv[n], G_TYPE_VARIANT);
23045 g_value_set_variant (&paramv[n], child);
23046 n++;
23047 }
23048 else
23049 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
23050 g_variant_unref (child);
23051 }
23052 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
23053 g_value_init (&return_value, G_TYPE_BOOLEAN);
23054 g_signal_emitv (paramv, signal_id, 0, &return_value);
23055 if (!g_value_get_boolean (&return_value))
23056 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);
23057 g_value_unset (&return_value);
23058 for (n = 0; n < num_params + num_extra; n++)
23059 g_value_unset (&paramv[n]);
23060 g_free (paramv);
23061}
23062
23063static GVariant *
23064_led_skeleton_handle_get_property (
23065 GDBusConnection *connection G_GNUC_UNUSED,
23066 const gchar *sender G_GNUC_UNUSED,
23067 const gchar *object_path G_GNUC_UNUSED,
23068 const gchar *interface_name G_GNUC_UNUSED,
23069 const gchar *property_name,
23070 GError **error,
23071 gpointer user_data)
23072{
23073 LedSkeleton *skeleton = LED_SKELETON (user_data);
23074 GValue value = G_VALUE_INIT;
23075 GParamSpec *pspec;
23076 _ExtendedGDBusPropertyInfo *info;
23077 GVariant *ret;
23078 ret = NULL;
23079 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
23080 g_assert (info != NULL);
23081 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
23082 if (pspec == NULL)
23083 {
23084 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
23085 }
23086 else
23087 {
23088 g_value_init (&value, pspec->value_type);
23089 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
23090 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
23091 g_value_unset (&value);
23092 }
23093 return ret;
23094}
23095
23096static gboolean
23097_led_skeleton_handle_set_property (
23098 GDBusConnection *connection G_GNUC_UNUSED,
23099 const gchar *sender G_GNUC_UNUSED,
23100 const gchar *object_path G_GNUC_UNUSED,
23101 const gchar *interface_name G_GNUC_UNUSED,
23102 const gchar *property_name,
23103 GVariant *variant,
23104 GError **error,
23105 gpointer user_data)
23106{
23107 LedSkeleton *skeleton = LED_SKELETON (user_data);
23108 GValue value = G_VALUE_INIT;
23109 GParamSpec *pspec;
23110 _ExtendedGDBusPropertyInfo *info;
23111 gboolean ret;
23112 ret = FALSE;
23113 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
23114 g_assert (info != NULL);
23115 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
23116 if (pspec == NULL)
23117 {
23118 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
23119 }
23120 else
23121 {
23122 if (info->use_gvariant)
23123 g_value_set_variant (&value, variant);
23124 else
23125 g_dbus_gvariant_to_gvalue (variant, &value);
23126 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
23127 g_value_unset (&value);
23128 ret = TRUE;
23129 }
23130 return ret;
23131}
23132
23133static const GDBusInterfaceVTable _led_skeleton_vtable =
23134{
23135 _led_skeleton_handle_method_call,
23136 _led_skeleton_handle_get_property,
23137 _led_skeleton_handle_set_property,
23138 {NULL}
23139};
23140
23141static GDBusInterfaceInfo *
23142led_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
23143{
23144 return led_interface_info ();
23145}
23146
23147static GDBusInterfaceVTable *
23148led_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
23149{
23150 return (GDBusInterfaceVTable *) &_led_skeleton_vtable;
23151}
23152
23153static GVariant *
23154led_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
23155{
23156 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
23157
23158 GVariantBuilder builder;
23159 guint n;
23160 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
23161 if (_led_interface_info.parent_struct.properties == NULL)
23162 goto out;
23163 for (n = 0; _led_interface_info.parent_struct.properties[n] != NULL; n++)
23164 {
23165 GDBusPropertyInfo *info = _led_interface_info.parent_struct.properties[n];
23166 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
23167 {
23168 GVariant *value;
23169 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);
23170 if (value != NULL)
23171 {
23172 g_variant_take_ref (value);
23173 g_variant_builder_add (&builder, "{sv}", info->name, value);
23174 g_variant_unref (value);
23175 }
23176 }
23177 }
23178out:
23179 return g_variant_builder_end (&builder);
23180}
23181
23182static gboolean _led_emit_changed (gpointer user_data);
23183
23184static void
23185led_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
23186{
23187 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
23188 gboolean emit_changed = FALSE;
23189
23190 g_mutex_lock (&skeleton->priv->lock);
23191 if (skeleton->priv->changed_properties_idle_source != NULL)
23192 {
23193 g_source_destroy (skeleton->priv->changed_properties_idle_source);
23194 skeleton->priv->changed_properties_idle_source = NULL;
23195 emit_changed = TRUE;
23196 }
23197 g_mutex_unlock (&skeleton->priv->lock);
23198
23199 if (emit_changed)
23200 _led_emit_changed (skeleton);
23201}
23202
23203static void led_skeleton_iface_init (LedIface *iface);
23204#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23205G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
23206 G_ADD_PRIVATE (LedSkeleton)
23207 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
23208
23209#else
23210G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
23211 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
23212
23213#endif
23214static void
23215led_skeleton_finalize (GObject *object)
23216{
23217 LedSkeleton *skeleton = LED_SKELETON (object);
23218 guint n;
23219 for (n = 0; n < 2; n++)
23220 g_value_unset (&skeleton->priv->properties[n]);
23221 g_free (skeleton->priv->properties);
23222 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
23223 if (skeleton->priv->changed_properties_idle_source != NULL)
23224 g_source_destroy (skeleton->priv->changed_properties_idle_source);
23225 g_main_context_unref (skeleton->priv->context);
23226 g_mutex_clear (&skeleton->priv->lock);
23227 G_OBJECT_CLASS (led_skeleton_parent_class)->finalize (object);
23228}
23229
23230static void
23231led_skeleton_get_property (GObject *object,
23232 guint prop_id,
23233 GValue *value,
23234 GParamSpec *pspec G_GNUC_UNUSED)
23235{
23236 LedSkeleton *skeleton = LED_SKELETON (object);
23237 g_assert (prop_id != 0 && prop_id - 1 < 2);
23238 g_mutex_lock (&skeleton->priv->lock);
23239 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
23240 g_mutex_unlock (&skeleton->priv->lock);
23241}
23242
23243static gboolean
23244_led_emit_changed (gpointer user_data)
23245{
23246 LedSkeleton *skeleton = LED_SKELETON (user_data);
23247 GList *l;
23248 GVariantBuilder builder;
23249 GVariantBuilder invalidated_builder;
23250 guint num_changes;
23251
23252 g_mutex_lock (&skeleton->priv->lock);
23253 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
23254 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
23255 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
23256 {
23257 ChangedProperty *cp = l->data;
23258 GVariant *variant;
23259 const GValue *cur_value;
23260
23261 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
23262 if (!_g_value_equal (cur_value, &cp->orig_value))
23263 {
23264 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
23265 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
23266 g_variant_unref (variant);
23267 num_changes++;
23268 }
23269 }
23270 if (num_changes > 0)
23271 {
23272 GList *connections, *ll;
23273 GVariant *signal_variant;
23274 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Led",
23275 &builder, &invalidated_builder));
23276 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
23277 for (ll = connections; ll != NULL; ll = ll->next)
23278 {
23279 GDBusConnection *connection = ll->data;
23280
23281 g_dbus_connection_emit_signal (connection,
23282 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
23283 "org.freedesktop.DBus.Properties",
23284 "PropertiesChanged",
23285 signal_variant,
23286 NULL);
23287 }
23288 g_variant_unref (signal_variant);
23289 g_list_free_full (connections, g_object_unref);
23290 }
23291 else
23292 {
23293 g_variant_builder_clear (&builder);
23294 g_variant_builder_clear (&invalidated_builder);
23295 }
23296 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
23297 skeleton->priv->changed_properties = NULL;
23298 skeleton->priv->changed_properties_idle_source = NULL;
23299 g_mutex_unlock (&skeleton->priv->lock);
23300 return FALSE;
23301}
23302
23303static void
23304_led_schedule_emit_changed (LedSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
23305{
23306 ChangedProperty *cp;
23307 GList *l;
23308 cp = NULL;
23309 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
23310 {
23311 ChangedProperty *i_cp = l->data;
23312 if (i_cp->info == info)
23313 {
23314 cp = i_cp;
23315 break;
23316 }
23317 }
23318 if (cp == NULL)
23319 {
23320 cp = g_new0 (ChangedProperty, 1);
23321 cp->prop_id = prop_id;
23322 cp->info = info;
23323 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
23324 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
23325 g_value_copy (orig_value, &cp->orig_value);
23326 }
23327}
23328
23329static void
23330led_skeleton_notify (GObject *object,
23331 GParamSpec *pspec G_GNUC_UNUSED)
23332{
23333 LedSkeleton *skeleton = LED_SKELETON (object);
23334 g_mutex_lock (&skeleton->priv->lock);
23335 if (skeleton->priv->changed_properties != NULL &&
23336 skeleton->priv->changed_properties_idle_source == NULL)
23337 {
23338 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
23339 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
23340 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _led_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
23341 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
23342 g_source_unref (skeleton->priv->changed_properties_idle_source);
23343 }
23344 g_mutex_unlock (&skeleton->priv->lock);
23345}
23346
23347static void
23348led_skeleton_set_property (GObject *object,
23349 guint prop_id,
23350 const GValue *value,
23351 GParamSpec *pspec)
23352{
23353 LedSkeleton *skeleton = LED_SKELETON (object);
23354 g_assert (prop_id != 0 && prop_id - 1 < 2);
23355 g_mutex_lock (&skeleton->priv->lock);
23356 g_object_freeze_notify (object);
23357 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
23358 {
23359 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
23360 _led_schedule_emit_changed (skeleton, _led_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
23361 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
23362 g_object_notify_by_pspec (object, pspec);
23363 }
23364 g_mutex_unlock (&skeleton->priv->lock);
23365 g_object_thaw_notify (object);
23366}
23367
23368static void
23369led_skeleton_init (LedSkeleton *skeleton)
23370{
23371#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23372 skeleton->priv = led_skeleton_get_instance_private (skeleton);
23373#else
23374 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_LED_SKELETON, LedSkeletonPrivate);
23375#endif
23376
23377 g_mutex_init (&skeleton->priv->lock);
23378 skeleton->priv->context = g_main_context_ref_thread_default ();
23379 skeleton->priv->properties = g_new0 (GValue, 2);
23380 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
23381 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
23382}
23383
23384static gint
23385led_skeleton_get_color (Led *object)
23386{
23387 LedSkeleton *skeleton = LED_SKELETON (object);
23388 gint value;
23389 g_mutex_lock (&skeleton->priv->lock);
23390 value = g_value_get_int (&(skeleton->priv->properties[0]));
23391 g_mutex_unlock (&skeleton->priv->lock);
23392 return value;
23393}
23394
23395static const gchar *
23396led_skeleton_get_function (Led *object)
23397{
23398 LedSkeleton *skeleton = LED_SKELETON (object);
23399 const gchar *value;
23400 g_mutex_lock (&skeleton->priv->lock);
23401 value = g_value_get_string (&(skeleton->priv->properties[1]));
23402 g_mutex_unlock (&skeleton->priv->lock);
23403 return value;
23404}
23405
23406static void
23407led_skeleton_class_init (LedSkeletonClass *klass)
23408{
23409 GObjectClass *gobject_class;
23410 GDBusInterfaceSkeletonClass *skeleton_class;
23411
23412 gobject_class = G_OBJECT_CLASS (klass);
23413 gobject_class->finalize = led_skeleton_finalize;
23414 gobject_class->get_property = led_skeleton_get_property;
23415 gobject_class->set_property = led_skeleton_set_property;
23416 gobject_class->notify = led_skeleton_notify;
23417
23418
23419 led_override_properties (gobject_class, 1);
23420
23421 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
23422 skeleton_class->get_info = led_skeleton_dbus_interface_get_info;
23423 skeleton_class->get_properties = led_skeleton_dbus_interface_get_properties;
23424 skeleton_class->flush = led_skeleton_dbus_interface_flush;
23425 skeleton_class->get_vtable = led_skeleton_dbus_interface_get_vtable;
23426
23427#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
23428 g_type_class_add_private (klass, sizeof (LedSkeletonPrivate));
23429#endif
23430}
23431
23432static void
23433led_skeleton_iface_init (LedIface *iface)
23434{
23435 iface->get_color = led_skeleton_get_color;
23436 iface->get_function = led_skeleton_get_function;
23437}
23438
23439/**
23440 * led_skeleton_new:
23441 *
23442 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
23443 *
23444 * Returns: (transfer full) (type LedSkeleton): The skeleton object.
23445 */
23446Led *
23447led_skeleton_new (void)
23448{
23449 return LED (g_object_new (TYPE_LED_SKELETON, NULL));
23450}
23451
23452/* ------------------------------------------------------------------------
23453 * Code for Object, ObjectProxy and ObjectSkeleton
23454 * ------------------------------------------------------------------------
23455 */
23456
23457/**
23458 * SECTION:Object
23459 * @title: Object
23460 * @short_description: Specialized GDBusObject types
23461 *
23462 * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
23463 */
23464
23465/**
23466 * Object:
23467 *
23468 * The #Object type is a specialized container of interfaces.
23469 */
23470
23471/**
23472 * ObjectIface:
23473 * @parent_iface: The parent interface.
23474 *
23475 * Virtual table for the #Object interface.
23476 */
23477
23478typedef ObjectIface ObjectInterface;
23479G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));
23480
23481static void
23482object_default_init (ObjectIface *iface)
23483{
23484 /**
23485 * Object:occ:
23486 *
23487 * 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.
23488 *
23489 * Connect to the #GObject::notify signal to get informed of property changes.
23490 */
23491 g_object_interface_install_property (iface, g_param_spec_object ("occ", "occ", "occ", TYPE_OCC, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23492
23493 /**
23494 * Object:fan:
23495 *
23496 * 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.
23497 *
23498 * Connect to the #GObject::notify signal to get informed of property changes.
23499 */
23500 g_object_interface_install_property (iface, g_param_spec_object ("fan", "fan", "fan", TYPE_FAN, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23501
23502 /**
23503 * Object:sensor-value:
23504 *
23505 * 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.
23506 *
23507 * Connect to the #GObject::notify signal to get informed of property changes.
23508 */
23509 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));
23510
23511 /**
23512 * Object:sensor-threshold:
23513 *
23514 * 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.
23515 *
23516 * Connect to the #GObject::notify signal to get informed of property changes.
23517 */
23518 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));
23519
23520 /**
23521 * Object:sensor-i2c:
23522 *
23523 * 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.
23524 *
23525 * Connect to the #GObject::notify signal to get informed of property changes.
23526 */
23527 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));
23528
23529 /**
23530 * Object:sensor-match:
23531 *
23532 * 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.
23533 *
23534 * Connect to the #GObject::notify signal to get informed of property changes.
23535 */
23536 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));
23537
23538 /**
23539 * Object:process:
23540 *
23541 * 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.
23542 *
23543 * Connect to the #GObject::notify signal to get informed of property changes.
23544 */
23545 g_object_interface_install_property (iface, g_param_spec_object ("process", "process", "process", TYPE_PROCESS, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23546
23547 /**
23548 * Object:control:
23549 *
23550 * 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.
23551 *
23552 * Connect to the #GObject::notify signal to get informed of property changes.
23553 */
23554 g_object_interface_install_property (iface, g_param_spec_object ("control", "control", "control", TYPE_CONTROL, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23555
23556 /**
23557 * Object:control-bmc:
23558 *
23559 * 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.
23560 *
23561 * Connect to the #GObject::notify signal to get informed of property changes.
23562 */
23563 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));
23564
23565 /**
23566 * Object:control-host:
23567 *
23568 * 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.
23569 *
23570 * Connect to the #GObject::notify signal to get informed of property changes.
23571 */
23572 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));
23573
23574 /**
23575 * Object:control-power:
23576 *
23577 * 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.
23578 *
23579 * Connect to the #GObject::notify signal to get informed of property changes.
23580 */
23581 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));
23582
23583 /**
23584 * Object:watchdog:
23585 *
23586 * 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.
23587 *
23588 * Connect to the #GObject::notify signal to get informed of property changes.
23589 */
23590 g_object_interface_install_property (iface, g_param_spec_object ("watchdog", "watchdog", "watchdog", TYPE_WATCHDOG, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23591
23592 /**
23593 * Object:event-log:
23594 *
23595 * 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.
23596 *
23597 * Connect to the #GObject::notify signal to get informed of property changes.
23598 */
23599 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));
23600
23601 /**
23602 * Object:flash:
23603 *
23604 * 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.
23605 *
23606 * Connect to the #GObject::notify signal to get informed of property changes.
23607 */
23608 g_object_interface_install_property (iface, g_param_spec_object ("flash", "flash", "flash", TYPE_FLASH, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23609
23610 /**
23611 * Object:button:
23612 *
23613 * 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.
23614 *
23615 * Connect to the #GObject::notify signal to get informed of property changes.
23616 */
23617 g_object_interface_install_property (iface, g_param_spec_object ("button", "button", "button", TYPE_BUTTON, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23618
23619 /**
23620 * Object:led:
23621 *
23622 * 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.
23623 *
23624 * Connect to the #GObject::notify signal to get informed of property changes.
23625 */
23626 g_object_interface_install_property (iface, g_param_spec_object ("led", "led", "led", TYPE_LED, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
23627
23628}
23629
23630/**
23631 * object_get_occ:
23632 * @object: A #Object.
23633 *
23634 * 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.
23635 *
23636 * Returns: (transfer full): A #Occ that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23637 */
23638Occ *object_get_occ (Object *object)
23639{
23640 GDBusInterface *ret;
23641 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
23642 if (ret == NULL)
23643 return NULL;
23644 return OCC (ret);
23645}
23646
23647/**
23648 * object_get_fan:
23649 * @object: A #Object.
23650 *
23651 * 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.
23652 *
23653 * Returns: (transfer full): A #Fan that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23654 */
23655Fan *object_get_fan (Object *object)
23656{
23657 GDBusInterface *ret;
23658 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
23659 if (ret == NULL)
23660 return NULL;
23661 return FAN (ret);
23662}
23663
23664/**
23665 * object_get_sensor_value:
23666 * @object: A #Object.
23667 *
23668 * 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.
23669 *
23670 * Returns: (transfer full): A #SensorValue that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23671 */
23672SensorValue *object_get_sensor_value (Object *object)
23673{
23674 GDBusInterface *ret;
23675 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
23676 if (ret == NULL)
23677 return NULL;
23678 return SENSOR_VALUE (ret);
23679}
23680
23681/**
23682 * object_get_sensor_threshold:
23683 * @object: A #Object.
23684 *
23685 * 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.
23686 *
23687 * Returns: (transfer full): A #SensorThreshold that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23688 */
23689SensorThreshold *object_get_sensor_threshold (Object *object)
23690{
23691 GDBusInterface *ret;
23692 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
23693 if (ret == NULL)
23694 return NULL;
23695 return SENSOR_THRESHOLD (ret);
23696}
23697
23698/**
23699 * object_get_sensor_i2c:
23700 * @object: A #Object.
23701 *
23702 * 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.
23703 *
23704 * Returns: (transfer full): A #SensorI2c that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23705 */
23706SensorI2c *object_get_sensor_i2c (Object *object)
23707{
23708 GDBusInterface *ret;
23709 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
23710 if (ret == NULL)
23711 return NULL;
23712 return SENSOR_I2C (ret);
23713}
23714
23715/**
23716 * object_get_sensor_match:
23717 * @object: A #Object.
23718 *
23719 * 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.
23720 *
23721 * Returns: (transfer full): A #SensorMatch that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23722 */
23723SensorMatch *object_get_sensor_match (Object *object)
23724{
23725 GDBusInterface *ret;
23726 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
23727 if (ret == NULL)
23728 return NULL;
23729 return SENSOR_MATCH (ret);
23730}
23731
23732/**
23733 * object_get_process:
23734 * @object: A #Object.
23735 *
23736 * 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.
23737 *
23738 * Returns: (transfer full): A #Process that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23739 */
23740Process *object_get_process (Object *object)
23741{
23742 GDBusInterface *ret;
23743 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
23744 if (ret == NULL)
23745 return NULL;
23746 return PROCESS (ret);
23747}
23748
23749/**
23750 * object_get_control:
23751 * @object: A #Object.
23752 *
23753 * 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.
23754 *
23755 * Returns: (transfer full): A #Control that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23756 */
23757Control *object_get_control (Object *object)
23758{
23759 GDBusInterface *ret;
23760 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
23761 if (ret == NULL)
23762 return NULL;
23763 return CONTROL (ret);
23764}
23765
23766/**
23767 * object_get_control_bmc:
23768 * @object: A #Object.
23769 *
23770 * 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.
23771 *
23772 * Returns: (transfer full): A #ControlBmc that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23773 */
23774ControlBmc *object_get_control_bmc (Object *object)
23775{
23776 GDBusInterface *ret;
23777 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
23778 if (ret == NULL)
23779 return NULL;
23780 return CONTROL_BMC (ret);
23781}
23782
23783/**
23784 * object_get_control_host:
23785 * @object: A #Object.
23786 *
23787 * 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.
23788 *
23789 * Returns: (transfer full): A #ControlHost that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23790 */
23791ControlHost *object_get_control_host (Object *object)
23792{
23793 GDBusInterface *ret;
23794 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
23795 if (ret == NULL)
23796 return NULL;
23797 return CONTROL_HOST (ret);
23798}
23799
23800/**
23801 * object_get_control_power:
23802 * @object: A #Object.
23803 *
23804 * 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.
23805 *
23806 * Returns: (transfer full): A #ControlPower that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23807 */
23808ControlPower *object_get_control_power (Object *object)
23809{
23810 GDBusInterface *ret;
23811 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
23812 if (ret == NULL)
23813 return NULL;
23814 return CONTROL_POWER (ret);
23815}
23816
23817/**
23818 * object_get_watchdog:
23819 * @object: A #Object.
23820 *
23821 * 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.
23822 *
23823 * Returns: (transfer full): A #Watchdog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23824 */
23825Watchdog *object_get_watchdog (Object *object)
23826{
23827 GDBusInterface *ret;
23828 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
23829 if (ret == NULL)
23830 return NULL;
23831 return WATCHDOG (ret);
23832}
23833
23834/**
23835 * object_get_event_log:
23836 * @object: A #Object.
23837 *
23838 * 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.
23839 *
23840 * Returns: (transfer full): A #EventLog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23841 */
23842EventLog *object_get_event_log (Object *object)
23843{
23844 GDBusInterface *ret;
23845 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
23846 if (ret == NULL)
23847 return NULL;
23848 return EVENT_LOG (ret);
23849}
23850
23851/**
23852 * object_get_flash:
23853 * @object: A #Object.
23854 *
23855 * 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.
23856 *
23857 * Returns: (transfer full): A #Flash that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23858 */
23859Flash *object_get_flash (Object *object)
23860{
23861 GDBusInterface *ret;
23862 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
23863 if (ret == NULL)
23864 return NULL;
23865 return FLASH (ret);
23866}
23867
23868/**
23869 * object_get_button:
23870 * @object: A #Object.
23871 *
23872 * 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.
23873 *
23874 * Returns: (transfer full): A #Button that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23875 */
23876Button *object_get_button (Object *object)
23877{
23878 GDBusInterface *ret;
23879 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
23880 if (ret == NULL)
23881 return NULL;
23882 return BUTTON (ret);
23883}
23884
23885/**
23886 * object_get_led:
23887 * @object: A #Object.
23888 *
23889 * 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.
23890 *
23891 * Returns: (transfer full): A #Led that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
23892 */
23893Led *object_get_led (Object *object)
23894{
23895 GDBusInterface *ret;
23896 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
23897 if (ret == NULL)
23898 return NULL;
23899 return LED (ret);
23900}
23901
23902
23903/**
23904 * object_peek_occ: (skip)
23905 * @object: A #Object.
23906 *
23907 * Like object_get_occ() but doesn't increase the reference count on the returned object.
23908 *
23909 * <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>
23910 *
23911 * 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.
23912 */
23913Occ *object_peek_occ (Object *object)
23914{
23915 GDBusInterface *ret;
23916 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
23917 if (ret == NULL)
23918 return NULL;
23919 g_object_unref (ret);
23920 return OCC (ret);
23921}
23922
23923/**
23924 * object_peek_fan: (skip)
23925 * @object: A #Object.
23926 *
23927 * Like object_get_fan() but doesn't increase the reference count on the returned object.
23928 *
23929 * <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>
23930 *
23931 * 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.
23932 */
23933Fan *object_peek_fan (Object *object)
23934{
23935 GDBusInterface *ret;
23936 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
23937 if (ret == NULL)
23938 return NULL;
23939 g_object_unref (ret);
23940 return FAN (ret);
23941}
23942
23943/**
23944 * object_peek_sensor_value: (skip)
23945 * @object: A #Object.
23946 *
23947 * Like object_get_sensor_value() but doesn't increase the reference count on the returned object.
23948 *
23949 * <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>
23950 *
23951 * 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.
23952 */
23953SensorValue *object_peek_sensor_value (Object *object)
23954{
23955 GDBusInterface *ret;
23956 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
23957 if (ret == NULL)
23958 return NULL;
23959 g_object_unref (ret);
23960 return SENSOR_VALUE (ret);
23961}
23962
23963/**
23964 * object_peek_sensor_threshold: (skip)
23965 * @object: A #Object.
23966 *
23967 * Like object_get_sensor_threshold() but doesn't increase the reference count on the returned object.
23968 *
23969 * <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>
23970 *
23971 * 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.
23972 */
23973SensorThreshold *object_peek_sensor_threshold (Object *object)
23974{
23975 GDBusInterface *ret;
23976 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
23977 if (ret == NULL)
23978 return NULL;
23979 g_object_unref (ret);
23980 return SENSOR_THRESHOLD (ret);
23981}
23982
23983/**
23984 * object_peek_sensor_i2c: (skip)
23985 * @object: A #Object.
23986 *
23987 * Like object_get_sensor_i2c() but doesn't increase the reference count on the returned object.
23988 *
23989 * <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>
23990 *
23991 * 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.
23992 */
23993SensorI2c *object_peek_sensor_i2c (Object *object)
23994{
23995 GDBusInterface *ret;
23996 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
23997 if (ret == NULL)
23998 return NULL;
23999 g_object_unref (ret);
24000 return SENSOR_I2C (ret);
24001}
24002
24003/**
24004 * object_peek_sensor_match: (skip)
24005 * @object: A #Object.
24006 *
24007 * Like object_get_sensor_match() but doesn't increase the reference count on the returned object.
24008 *
24009 * <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>
24010 *
24011 * 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.
24012 */
24013SensorMatch *object_peek_sensor_match (Object *object)
24014{
24015 GDBusInterface *ret;
24016 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
24017 if (ret == NULL)
24018 return NULL;
24019 g_object_unref (ret);
24020 return SENSOR_MATCH (ret);
24021}
24022
24023/**
24024 * object_peek_process: (skip)
24025 * @object: A #Object.
24026 *
24027 * Like object_get_process() but doesn't increase the reference count on the returned object.
24028 *
24029 * <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>
24030 *
24031 * 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.
24032 */
24033Process *object_peek_process (Object *object)
24034{
24035 GDBusInterface *ret;
24036 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
24037 if (ret == NULL)
24038 return NULL;
24039 g_object_unref (ret);
24040 return PROCESS (ret);
24041}
24042
24043/**
24044 * object_peek_control: (skip)
24045 * @object: A #Object.
24046 *
24047 * Like object_get_control() but doesn't increase the reference count on the returned object.
24048 *
24049 * <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>
24050 *
24051 * 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.
24052 */
24053Control *object_peek_control (Object *object)
24054{
24055 GDBusInterface *ret;
24056 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
24057 if (ret == NULL)
24058 return NULL;
24059 g_object_unref (ret);
24060 return CONTROL (ret);
24061}
24062
24063/**
24064 * object_peek_control_bmc: (skip)
24065 * @object: A #Object.
24066 *
24067 * Like object_get_control_bmc() but doesn't increase the reference count on the returned object.
24068 *
24069 * <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>
24070 *
24071 * 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.
24072 */
24073ControlBmc *object_peek_control_bmc (Object *object)
24074{
24075 GDBusInterface *ret;
24076 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
24077 if (ret == NULL)
24078 return NULL;
24079 g_object_unref (ret);
24080 return CONTROL_BMC (ret);
24081}
24082
24083/**
24084 * object_peek_control_host: (skip)
24085 * @object: A #Object.
24086 *
24087 * Like object_get_control_host() but doesn't increase the reference count on the returned object.
24088 *
24089 * <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>
24090 *
24091 * 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.
24092 */
24093ControlHost *object_peek_control_host (Object *object)
24094{
24095 GDBusInterface *ret;
24096 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
24097 if (ret == NULL)
24098 return NULL;
24099 g_object_unref (ret);
24100 return CONTROL_HOST (ret);
24101}
24102
24103/**
24104 * object_peek_control_power: (skip)
24105 * @object: A #Object.
24106 *
24107 * Like object_get_control_power() but doesn't increase the reference count on the returned object.
24108 *
24109 * <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>
24110 *
24111 * 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.
24112 */
24113ControlPower *object_peek_control_power (Object *object)
24114{
24115 GDBusInterface *ret;
24116 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
24117 if (ret == NULL)
24118 return NULL;
24119 g_object_unref (ret);
24120 return CONTROL_POWER (ret);
24121}
24122
24123/**
24124 * object_peek_watchdog: (skip)
24125 * @object: A #Object.
24126 *
24127 * Like object_get_watchdog() but doesn't increase the reference count on the returned object.
24128 *
24129 * <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>
24130 *
24131 * 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.
24132 */
24133Watchdog *object_peek_watchdog (Object *object)
24134{
24135 GDBusInterface *ret;
24136 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
24137 if (ret == NULL)
24138 return NULL;
24139 g_object_unref (ret);
24140 return WATCHDOG (ret);
24141}
24142
24143/**
24144 * object_peek_event_log: (skip)
24145 * @object: A #Object.
24146 *
24147 * Like object_get_event_log() but doesn't increase the reference count on the returned object.
24148 *
24149 * <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>
24150 *
24151 * 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.
24152 */
24153EventLog *object_peek_event_log (Object *object)
24154{
24155 GDBusInterface *ret;
24156 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
24157 if (ret == NULL)
24158 return NULL;
24159 g_object_unref (ret);
24160 return EVENT_LOG (ret);
24161}
24162
24163/**
24164 * object_peek_flash: (skip)
24165 * @object: A #Object.
24166 *
24167 * Like object_get_flash() but doesn't increase the reference count on the returned object.
24168 *
24169 * <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>
24170 *
24171 * 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.
24172 */
24173Flash *object_peek_flash (Object *object)
24174{
24175 GDBusInterface *ret;
24176 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
24177 if (ret == NULL)
24178 return NULL;
24179 g_object_unref (ret);
24180 return FLASH (ret);
24181}
24182
24183/**
24184 * object_peek_button: (skip)
24185 * @object: A #Object.
24186 *
24187 * Like object_get_button() but doesn't increase the reference count on the returned object.
24188 *
24189 * <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>
24190 *
24191 * 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.
24192 */
24193Button *object_peek_button (Object *object)
24194{
24195 GDBusInterface *ret;
24196 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
24197 if (ret == NULL)
24198 return NULL;
24199 g_object_unref (ret);
24200 return BUTTON (ret);
24201}
24202
24203/**
24204 * object_peek_led: (skip)
24205 * @object: A #Object.
24206 *
24207 * Like object_get_led() but doesn't increase the reference count on the returned object.
24208 *
24209 * <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>
24210 *
24211 * 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.
24212 */
24213Led *object_peek_led (Object *object)
24214{
24215 GDBusInterface *ret;
24216 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
24217 if (ret == NULL)
24218 return NULL;
24219 g_object_unref (ret);
24220 return LED (ret);
24221}
24222
24223
24224static void
24225object_notify (GDBusObject *object, GDBusInterface *interface)
24226{
24227 _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
24228 /* info can be NULL if the other end is using a D-Bus interface we don't know
24229 * anything about, for example old generated code in this process talking to
24230 * newer generated code in the other process. */
24231 if (info != NULL)
24232 g_object_notify (G_OBJECT (object), info->hyphen_name);
24233}
24234
24235/**
24236 * ObjectProxy:
24237 *
24238 * The #ObjectProxy structure contains only private data and should only be accessed using the provided API.
24239 */
24240
24241/**
24242 * ObjectProxyClass:
24243 * @parent_class: The parent class.
24244 *
24245 * Class structure for #ObjectProxy.
24246 */
24247
24248static void
24249object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
24250{
24251}
24252
24253static void
24254object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
24255{
24256 iface->interface_added = object_notify;
24257 iface->interface_removed = object_notify;
24258}
24259
24260
24261G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
24262 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init)
24263 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init));
24264
24265static void
24266object_proxy_init (ObjectProxy *object G_GNUC_UNUSED)
24267{
24268}
24269
24270static void
24271object_proxy_set_property (GObject *gobject,
24272 guint prop_id,
24273 const GValue *value G_GNUC_UNUSED,
24274 GParamSpec *pspec)
24275{
24276 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
24277}
24278
24279static void
24280object_proxy_get_property (GObject *gobject,
24281 guint prop_id,
24282 GValue *value,
24283 GParamSpec *pspec)
24284{
24285 ObjectProxy *object = OBJECT_PROXY (gobject);
24286 GDBusInterface *interface;
24287
24288 switch (prop_id)
24289 {
24290 case 1:
24291 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
24292 g_value_take_object (value, interface);
24293 break;
24294
24295 case 2:
24296 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
24297 g_value_take_object (value, interface);
24298 break;
24299
24300 case 3:
24301 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
24302 g_value_take_object (value, interface);
24303 break;
24304
24305 case 4:
Norman Jamesdfdaca92015-09-27 22:11:15 -050024306 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman James362a80f2015-09-14 14:04:39 -050024307 g_value_take_object (value, interface);
24308 break;
24309
Norman James19e45912015-10-04 20:19:41 -050024310 case 5:
Norman Jamesdfdaca92015-09-27 22:11:15 -050024311 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman James362a80f2015-09-14 14:04:39 -050024312 g_value_take_object (value, interface);
24313 break;
24314
Norman James19e45912015-10-04 20:19:41 -050024315 case 6:
Norman Jamesdfdaca92015-09-27 22:11:15 -050024316 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
Norman James362a80f2015-09-14 14:04:39 -050024317 g_value_take_object (value, interface);
24318 break;
24319
Norman James19e45912015-10-04 20:19:41 -050024320 case 7:
Norman Jamesdfdaca92015-09-27 22:11:15 -050024321 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
Norman James362a80f2015-09-14 14:04:39 -050024322 g_value_take_object (value, interface);
24323 break;
24324
Norman James19e45912015-10-04 20:19:41 -050024325 case 8:
Norman Jamesdfdaca92015-09-27 22:11:15 -050024326 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
Norman James362a80f2015-09-14 14:04:39 -050024327 g_value_take_object (value, interface);
24328 break;
24329
Norman James19e45912015-10-04 20:19:41 -050024330 case 9:
Norman Jamesdfdaca92015-09-27 22:11:15 -050024331 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
Norman James362a80f2015-09-14 14:04:39 -050024332 g_value_take_object (value, interface);
24333 break;
24334
Norman James19e45912015-10-04 20:19:41 -050024335 case 10:
Norman Jamesdfdaca92015-09-27 22:11:15 -050024336 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
Norman James362a80f2015-09-14 14:04:39 -050024337 g_value_take_object (value, interface);
24338 break;
24339
Norman James19e45912015-10-04 20:19:41 -050024340 case 11:
Norman Jamesdfdaca92015-09-27 22:11:15 -050024341 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
Norman James362a80f2015-09-14 14:04:39 -050024342 g_value_take_object (value, interface);
24343 break;
24344
Norman James19e45912015-10-04 20:19:41 -050024345 case 12:
Norman Jamesdfdaca92015-09-27 22:11:15 -050024346 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
Norman James362a80f2015-09-14 14:04:39 -050024347 g_value_take_object (value, interface);
24348 break;
24349
Norman James19e45912015-10-04 20:19:41 -050024350 case 13:
Norman Jamesdfdaca92015-09-27 22:11:15 -050024351 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
Norman James362a80f2015-09-14 14:04:39 -050024352 g_value_take_object (value, interface);
24353 break;
24354
Norman James19e45912015-10-04 20:19:41 -050024355 case 14:
Norman Jamesdfdaca92015-09-27 22:11:15 -050024356 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
Norman James362a80f2015-09-14 14:04:39 -050024357 g_value_take_object (value, interface);
24358 break;
24359
Norman James19e45912015-10-04 20:19:41 -050024360 case 15:
Norman Jamesdfdaca92015-09-27 22:11:15 -050024361 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
24362 g_value_take_object (value, interface);
24363 break;
24364
Norman James19e45912015-10-04 20:19:41 -050024365 case 16:
Norman James362a80f2015-09-14 14:04:39 -050024366 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
24367 g_value_take_object (value, interface);
24368 break;
24369
24370 default:
24371 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
24372 break;
24373 }
24374}
24375
24376static void
24377object_proxy_class_init (ObjectProxyClass *klass)
24378{
24379 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
24380
24381 gobject_class->set_property = object_proxy_set_property;
24382 gobject_class->get_property = object_proxy_get_property;
24383
24384 g_object_class_override_property (gobject_class, 1, "occ");
24385 g_object_class_override_property (gobject_class, 2, "fan");
24386 g_object_class_override_property (gobject_class, 3, "sensor-value");
Norman James19e45912015-10-04 20:19:41 -050024387 g_object_class_override_property (gobject_class, 4, "sensor-threshold");
24388 g_object_class_override_property (gobject_class, 5, "sensor-i2c");
24389 g_object_class_override_property (gobject_class, 6, "sensor-match");
24390 g_object_class_override_property (gobject_class, 7, "process");
24391 g_object_class_override_property (gobject_class, 8, "control");
24392 g_object_class_override_property (gobject_class, 9, "control-bmc");
24393 g_object_class_override_property (gobject_class, 10, "control-host");
24394 g_object_class_override_property (gobject_class, 11, "control-power");
24395 g_object_class_override_property (gobject_class, 12, "watchdog");
24396 g_object_class_override_property (gobject_class, 13, "event-log");
24397 g_object_class_override_property (gobject_class, 14, "flash");
24398 g_object_class_override_property (gobject_class, 15, "button");
24399 g_object_class_override_property (gobject_class, 16, "led");
Norman James362a80f2015-09-14 14:04:39 -050024400}
24401
24402/**
24403 * object_proxy_new:
24404 * @connection: A #GDBusConnection.
24405 * @object_path: An object path.
24406 *
24407 * Creates a new proxy object.
24408 *
24409 * Returns: (transfer full): The proxy object.
24410 */
24411ObjectProxy *
24412object_proxy_new (GDBusConnection *connection,
24413 const gchar *object_path)
24414{
24415 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
24416 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
24417 return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
24418}
24419
24420/**
24421 * ObjectSkeleton:
24422 *
24423 * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API.
24424 */
24425
24426/**
24427 * ObjectSkeletonClass:
24428 * @parent_class: The parent class.
24429 *
24430 * Class structure for #ObjectSkeleton.
24431 */
24432
24433static void
24434object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
24435{
24436}
24437
24438
24439static void
24440object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
24441{
24442 iface->interface_added = object_notify;
24443 iface->interface_removed = object_notify;
24444}
24445
24446G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
24447 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init)
24448 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init));
24449
24450static void
24451object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED)
24452{
24453}
24454
24455static void
24456object_skeleton_set_property (GObject *gobject,
24457 guint prop_id,
24458 const GValue *value,
24459 GParamSpec *pspec)
24460{
24461 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
24462 GDBusInterfaceSkeleton *interface;
24463
24464 switch (prop_id)
24465 {
24466 case 1:
24467 interface = g_value_get_object (value);
24468 if (interface != NULL)
24469 {
24470 g_warn_if_fail (IS_OCC (interface));
24471 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24472 }
24473 else
24474 {
24475 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Occ");
24476 }
24477 break;
24478
24479 case 2:
24480 interface = g_value_get_object (value);
24481 if (interface != NULL)
24482 {
24483 g_warn_if_fail (IS_FAN (interface));
24484 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24485 }
24486 else
24487 {
24488 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Fan");
24489 }
24490 break;
24491
24492 case 3:
24493 interface = g_value_get_object (value);
24494 if (interface != NULL)
24495 {
24496 g_warn_if_fail (IS_SENSOR_VALUE (interface));
24497 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24498 }
24499 else
24500 {
24501 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorValue");
24502 }
24503 break;
24504
24505 case 4:
24506 interface = g_value_get_object (value);
24507 if (interface != NULL)
24508 {
24509 g_warn_if_fail (IS_SENSOR_THRESHOLD (interface));
24510 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24511 }
24512 else
24513 {
24514 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorThreshold");
24515 }
24516 break;
24517
Norman James19e45912015-10-04 20:19:41 -050024518 case 5:
Norman James362a80f2015-09-14 14:04:39 -050024519 interface = g_value_get_object (value);
24520 if (interface != NULL)
24521 {
24522 g_warn_if_fail (IS_SENSOR_I2C (interface));
24523 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24524 }
24525 else
24526 {
24527 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorI2c");
24528 }
24529 break;
24530
Norman James19e45912015-10-04 20:19:41 -050024531 case 6:
Norman James362a80f2015-09-14 14:04:39 -050024532 interface = g_value_get_object (value);
24533 if (interface != NULL)
24534 {
24535 g_warn_if_fail (IS_SENSOR_MATCH (interface));
24536 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24537 }
24538 else
24539 {
24540 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorMatch");
24541 }
24542 break;
24543
Norman James19e45912015-10-04 20:19:41 -050024544 case 7:
Norman James362a80f2015-09-14 14:04:39 -050024545 interface = g_value_get_object (value);
24546 if (interface != NULL)
24547 {
24548 g_warn_if_fail (IS_PROCESS (interface));
24549 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24550 }
24551 else
24552 {
24553 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Process");
24554 }
24555 break;
24556
Norman James19e45912015-10-04 20:19:41 -050024557 case 8:
Norman James362a80f2015-09-14 14:04:39 -050024558 interface = g_value_get_object (value);
24559 if (interface != NULL)
24560 {
24561 g_warn_if_fail (IS_CONTROL (interface));
24562 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24563 }
24564 else
24565 {
24566 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Control");
24567 }
24568 break;
24569
Norman James19e45912015-10-04 20:19:41 -050024570 case 9:
Norman James362a80f2015-09-14 14:04:39 -050024571 interface = g_value_get_object (value);
24572 if (interface != NULL)
24573 {
24574 g_warn_if_fail (IS_CONTROL_BMC (interface));
24575 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24576 }
24577 else
24578 {
24579 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Bmc");
24580 }
24581 break;
24582
Norman James19e45912015-10-04 20:19:41 -050024583 case 10:
Norman James362a80f2015-09-14 14:04:39 -050024584 interface = g_value_get_object (value);
24585 if (interface != NULL)
24586 {
24587 g_warn_if_fail (IS_CONTROL_HOST (interface));
24588 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24589 }
24590 else
24591 {
24592 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Host");
24593 }
24594 break;
24595
Norman James19e45912015-10-04 20:19:41 -050024596 case 11:
Norman James362a80f2015-09-14 14:04:39 -050024597 interface = g_value_get_object (value);
24598 if (interface != NULL)
24599 {
24600 g_warn_if_fail (IS_CONTROL_POWER (interface));
24601 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24602 }
24603 else
24604 {
24605 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Power");
24606 }
24607 break;
24608
Norman James19e45912015-10-04 20:19:41 -050024609 case 12:
Norman James362a80f2015-09-14 14:04:39 -050024610 interface = g_value_get_object (value);
24611 if (interface != NULL)
24612 {
24613 g_warn_if_fail (IS_WATCHDOG (interface));
24614 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24615 }
24616 else
24617 {
24618 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Watchdog");
24619 }
24620 break;
24621
Norman James19e45912015-10-04 20:19:41 -050024622 case 13:
Norman James362a80f2015-09-14 14:04:39 -050024623 interface = g_value_get_object (value);
24624 if (interface != NULL)
24625 {
24626 g_warn_if_fail (IS_EVENT_LOG (interface));
24627 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24628 }
24629 else
24630 {
24631 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.EventLog");
24632 }
24633 break;
24634
Norman James19e45912015-10-04 20:19:41 -050024635 case 14:
Norman James362a80f2015-09-14 14:04:39 -050024636 interface = g_value_get_object (value);
24637 if (interface != NULL)
24638 {
24639 g_warn_if_fail (IS_FLASH (interface));
24640 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24641 }
24642 else
24643 {
24644 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Flash");
24645 }
24646 break;
24647
Norman James19e45912015-10-04 20:19:41 -050024648 case 15:
Norman James362a80f2015-09-14 14:04:39 -050024649 interface = g_value_get_object (value);
24650 if (interface != NULL)
24651 {
24652 g_warn_if_fail (IS_BUTTON (interface));
24653 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24654 }
24655 else
24656 {
24657 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Button");
24658 }
24659 break;
24660
Norman James19e45912015-10-04 20:19:41 -050024661 case 16:
Norman James362a80f2015-09-14 14:04:39 -050024662 interface = g_value_get_object (value);
24663 if (interface != NULL)
24664 {
24665 g_warn_if_fail (IS_LED (interface));
24666 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
24667 }
24668 else
24669 {
24670 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Led");
24671 }
24672 break;
24673
24674 default:
24675 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
24676 break;
24677 }
24678}
24679
24680static void
24681object_skeleton_get_property (GObject *gobject,
24682 guint prop_id,
24683 GValue *value,
24684 GParamSpec *pspec)
24685{
24686 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
24687 GDBusInterface *interface;
24688
24689 switch (prop_id)
24690 {
24691 case 1:
24692 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
24693 g_value_take_object (value, interface);
24694 break;
24695
24696 case 2:
24697 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
24698 g_value_take_object (value, interface);
24699 break;
24700
24701 case 3:
24702 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
24703 g_value_take_object (value, interface);
24704 break;
24705
24706 case 4:
Norman Jamesdfdaca92015-09-27 22:11:15 -050024707 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman James362a80f2015-09-14 14:04:39 -050024708 g_value_take_object (value, interface);
24709 break;
24710
Norman James19e45912015-10-04 20:19:41 -050024711 case 5:
Norman Jamesdfdaca92015-09-27 22:11:15 -050024712 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman James362a80f2015-09-14 14:04:39 -050024713 g_value_take_object (value, interface);
24714 break;
24715
Norman James19e45912015-10-04 20:19:41 -050024716 case 6:
Norman Jamesdfdaca92015-09-27 22:11:15 -050024717 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
Norman James362a80f2015-09-14 14:04:39 -050024718 g_value_take_object (value, interface);
24719 break;
24720
Norman James19e45912015-10-04 20:19:41 -050024721 case 7:
Norman Jamesdfdaca92015-09-27 22:11:15 -050024722 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
Norman James362a80f2015-09-14 14:04:39 -050024723 g_value_take_object (value, interface);
24724 break;
24725
Norman James19e45912015-10-04 20:19:41 -050024726 case 8:
Norman Jamesdfdaca92015-09-27 22:11:15 -050024727 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
Norman James362a80f2015-09-14 14:04:39 -050024728 g_value_take_object (value, interface);
24729 break;
24730
Norman James19e45912015-10-04 20:19:41 -050024731 case 9:
Norman Jamesdfdaca92015-09-27 22:11:15 -050024732 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
Norman James362a80f2015-09-14 14:04:39 -050024733 g_value_take_object (value, interface);
24734 break;
24735
Norman James19e45912015-10-04 20:19:41 -050024736 case 10:
Norman Jamesdfdaca92015-09-27 22:11:15 -050024737 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
Norman James362a80f2015-09-14 14:04:39 -050024738 g_value_take_object (value, interface);
24739 break;
24740
Norman James19e45912015-10-04 20:19:41 -050024741 case 11:
Norman Jamesdfdaca92015-09-27 22:11:15 -050024742 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
Norman James362a80f2015-09-14 14:04:39 -050024743 g_value_take_object (value, interface);
24744 break;
24745
Norman James19e45912015-10-04 20:19:41 -050024746 case 12:
Norman Jamesdfdaca92015-09-27 22:11:15 -050024747 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
Norman James362a80f2015-09-14 14:04:39 -050024748 g_value_take_object (value, interface);
24749 break;
24750
Norman James19e45912015-10-04 20:19:41 -050024751 case 13:
Norman Jamesdfdaca92015-09-27 22:11:15 -050024752 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
Norman James362a80f2015-09-14 14:04:39 -050024753 g_value_take_object (value, interface);
24754 break;
24755
Norman James19e45912015-10-04 20:19:41 -050024756 case 14:
Norman Jamesdfdaca92015-09-27 22:11:15 -050024757 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
Norman James362a80f2015-09-14 14:04:39 -050024758 g_value_take_object (value, interface);
24759 break;
24760
Norman James19e45912015-10-04 20:19:41 -050024761 case 15:
Norman Jamesdfdaca92015-09-27 22:11:15 -050024762 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
24763 g_value_take_object (value, interface);
24764 break;
24765
Norman James19e45912015-10-04 20:19:41 -050024766 case 16:
Norman James362a80f2015-09-14 14:04:39 -050024767 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
24768 g_value_take_object (value, interface);
24769 break;
24770
24771 default:
24772 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
24773 break;
24774 }
24775}
24776
24777static void
24778object_skeleton_class_init (ObjectSkeletonClass *klass)
24779{
24780 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
24781
24782 gobject_class->set_property = object_skeleton_set_property;
24783 gobject_class->get_property = object_skeleton_get_property;
24784
24785 g_object_class_override_property (gobject_class, 1, "occ");
24786 g_object_class_override_property (gobject_class, 2, "fan");
24787 g_object_class_override_property (gobject_class, 3, "sensor-value");
Norman James19e45912015-10-04 20:19:41 -050024788 g_object_class_override_property (gobject_class, 4, "sensor-threshold");
24789 g_object_class_override_property (gobject_class, 5, "sensor-i2c");
24790 g_object_class_override_property (gobject_class, 6, "sensor-match");
24791 g_object_class_override_property (gobject_class, 7, "process");
24792 g_object_class_override_property (gobject_class, 8, "control");
24793 g_object_class_override_property (gobject_class, 9, "control-bmc");
24794 g_object_class_override_property (gobject_class, 10, "control-host");
24795 g_object_class_override_property (gobject_class, 11, "control-power");
24796 g_object_class_override_property (gobject_class, 12, "watchdog");
24797 g_object_class_override_property (gobject_class, 13, "event-log");
24798 g_object_class_override_property (gobject_class, 14, "flash");
24799 g_object_class_override_property (gobject_class, 15, "button");
24800 g_object_class_override_property (gobject_class, 16, "led");
Norman James362a80f2015-09-14 14:04:39 -050024801}
24802
24803/**
24804 * object_skeleton_new:
24805 * @object_path: An object path.
24806 *
24807 * Creates a new skeleton object.
24808 *
24809 * Returns: (transfer full): The skeleton object.
24810 */
24811ObjectSkeleton *
24812object_skeleton_new (const gchar *object_path)
24813{
24814 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
24815 return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
24816}
24817
24818/**
24819 * object_skeleton_set_occ:
24820 * @object: A #ObjectSkeleton.
24821 * @interface_: (allow-none): A #Occ or %NULL to clear the interface.
24822 *
24823 * 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.
24824 */
24825void object_skeleton_set_occ (ObjectSkeleton *object, Occ *interface_)
24826{
24827 g_object_set (G_OBJECT (object), "occ", interface_, NULL);
24828}
24829
24830/**
24831 * object_skeleton_set_fan:
24832 * @object: A #ObjectSkeleton.
24833 * @interface_: (allow-none): A #Fan or %NULL to clear the interface.
24834 *
24835 * 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.
24836 */
24837void object_skeleton_set_fan (ObjectSkeleton *object, Fan *interface_)
24838{
24839 g_object_set (G_OBJECT (object), "fan", interface_, NULL);
24840}
24841
24842/**
24843 * object_skeleton_set_sensor_value:
24844 * @object: A #ObjectSkeleton.
24845 * @interface_: (allow-none): A #SensorValue or %NULL to clear the interface.
24846 *
24847 * 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.
24848 */
24849void object_skeleton_set_sensor_value (ObjectSkeleton *object, SensorValue *interface_)
24850{
24851 g_object_set (G_OBJECT (object), "sensor-value", interface_, NULL);
24852}
24853
24854/**
24855 * object_skeleton_set_sensor_threshold:
24856 * @object: A #ObjectSkeleton.
24857 * @interface_: (allow-none): A #SensorThreshold or %NULL to clear the interface.
24858 *
24859 * 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.
24860 */
24861void object_skeleton_set_sensor_threshold (ObjectSkeleton *object, SensorThreshold *interface_)
24862{
24863 g_object_set (G_OBJECT (object), "sensor-threshold", interface_, NULL);
24864}
24865
24866/**
24867 * object_skeleton_set_sensor_i2c:
24868 * @object: A #ObjectSkeleton.
24869 * @interface_: (allow-none): A #SensorI2c or %NULL to clear the interface.
24870 *
24871 * 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.
24872 */
24873void object_skeleton_set_sensor_i2c (ObjectSkeleton *object, SensorI2c *interface_)
24874{
24875 g_object_set (G_OBJECT (object), "sensor-i2c", interface_, NULL);
24876}
24877
24878/**
24879 * object_skeleton_set_sensor_match:
24880 * @object: A #ObjectSkeleton.
24881 * @interface_: (allow-none): A #SensorMatch or %NULL to clear the interface.
24882 *
24883 * 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.
24884 */
24885void object_skeleton_set_sensor_match (ObjectSkeleton *object, SensorMatch *interface_)
24886{
24887 g_object_set (G_OBJECT (object), "sensor-match", interface_, NULL);
24888}
24889
24890/**
24891 * object_skeleton_set_process:
24892 * @object: A #ObjectSkeleton.
24893 * @interface_: (allow-none): A #Process or %NULL to clear the interface.
24894 *
24895 * 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.
24896 */
24897void object_skeleton_set_process (ObjectSkeleton *object, Process *interface_)
24898{
24899 g_object_set (G_OBJECT (object), "process", interface_, NULL);
24900}
24901
24902/**
24903 * object_skeleton_set_control:
24904 * @object: A #ObjectSkeleton.
24905 * @interface_: (allow-none): A #Control or %NULL to clear the interface.
24906 *
24907 * 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.
24908 */
24909void object_skeleton_set_control (ObjectSkeleton *object, Control *interface_)
24910{
24911 g_object_set (G_OBJECT (object), "control", interface_, NULL);
24912}
24913
24914/**
24915 * object_skeleton_set_control_bmc:
24916 * @object: A #ObjectSkeleton.
24917 * @interface_: (allow-none): A #ControlBmc or %NULL to clear the interface.
24918 *
24919 * 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.
24920 */
24921void object_skeleton_set_control_bmc (ObjectSkeleton *object, ControlBmc *interface_)
24922{
24923 g_object_set (G_OBJECT (object), "control-bmc", interface_, NULL);
24924}
24925
24926/**
24927 * object_skeleton_set_control_host:
24928 * @object: A #ObjectSkeleton.
24929 * @interface_: (allow-none): A #ControlHost or %NULL to clear the interface.
24930 *
24931 * 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.
24932 */
24933void object_skeleton_set_control_host (ObjectSkeleton *object, ControlHost *interface_)
24934{
24935 g_object_set (G_OBJECT (object), "control-host", interface_, NULL);
24936}
24937
24938/**
24939 * object_skeleton_set_control_power:
24940 * @object: A #ObjectSkeleton.
24941 * @interface_: (allow-none): A #ControlPower or %NULL to clear the interface.
24942 *
24943 * 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.
24944 */
24945void object_skeleton_set_control_power (ObjectSkeleton *object, ControlPower *interface_)
24946{
24947 g_object_set (G_OBJECT (object), "control-power", interface_, NULL);
24948}
24949
24950/**
24951 * object_skeleton_set_watchdog:
24952 * @object: A #ObjectSkeleton.
24953 * @interface_: (allow-none): A #Watchdog or %NULL to clear the interface.
24954 *
24955 * 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.
24956 */
24957void object_skeleton_set_watchdog (ObjectSkeleton *object, Watchdog *interface_)
24958{
24959 g_object_set (G_OBJECT (object), "watchdog", interface_, NULL);
24960}
24961
24962/**
24963 * object_skeleton_set_event_log:
24964 * @object: A #ObjectSkeleton.
24965 * @interface_: (allow-none): A #EventLog or %NULL to clear the interface.
24966 *
24967 * 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.
24968 */
24969void object_skeleton_set_event_log (ObjectSkeleton *object, EventLog *interface_)
24970{
24971 g_object_set (G_OBJECT (object), "event-log", interface_, NULL);
24972}
24973
24974/**
24975 * object_skeleton_set_flash:
24976 * @object: A #ObjectSkeleton.
24977 * @interface_: (allow-none): A #Flash or %NULL to clear the interface.
24978 *
24979 * 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.
24980 */
24981void object_skeleton_set_flash (ObjectSkeleton *object, Flash *interface_)
24982{
24983 g_object_set (G_OBJECT (object), "flash", interface_, NULL);
24984}
24985
24986/**
24987 * object_skeleton_set_button:
24988 * @object: A #ObjectSkeleton.
24989 * @interface_: (allow-none): A #Button or %NULL to clear the interface.
24990 *
24991 * 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.
24992 */
24993void object_skeleton_set_button (ObjectSkeleton *object, Button *interface_)
24994{
24995 g_object_set (G_OBJECT (object), "button", interface_, NULL);
24996}
24997
24998/**
24999 * object_skeleton_set_led:
25000 * @object: A #ObjectSkeleton.
25001 * @interface_: (allow-none): A #Led or %NULL to clear the interface.
25002 *
25003 * 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.
25004 */
25005void object_skeleton_set_led (ObjectSkeleton *object, Led *interface_)
25006{
25007 g_object_set (G_OBJECT (object), "led", interface_, NULL);
25008}
25009
25010
25011/* ------------------------------------------------------------------------
25012 * Code for ObjectManager client
25013 * ------------------------------------------------------------------------
25014 */
25015
25016/**
25017 * SECTION:ObjectManagerClient
25018 * @title: ObjectManagerClient
25019 * @short_description: Generated GDBusObjectManagerClient type
25020 *
25021 * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
25022 */
25023
25024/**
25025 * ObjectManagerClient:
25026 *
25027 * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API.
25028 */
25029
25030/**
25031 * ObjectManagerClientClass:
25032 * @parent_class: The parent class.
25033 *
25034 * Class structure for #ObjectManagerClient.
25035 */
25036
25037G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT);
25038
25039static void
25040object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED)
25041{
25042}
25043
25044static void
25045object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED)
25046{
25047}
25048
25049/**
25050 * object_manager_client_get_proxy_type:
25051 * @manager: A #GDBusObjectManagerClient.
25052 * @object_path: The object path of the remote object (unused).
25053 * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType.
25054 * @user_data: User data (unused).
25055 *
25056 * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types.
25057 *
25058 * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy.
25059 */
25060GType
25061object_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)
25062{
25063 static gsize once_init_value = 0;
25064 static GHashTable *lookup_hash;
25065 GType ret;
25066
25067 if (interface_name == NULL)
25068 return TYPE_OBJECT_PROXY;
25069 if (g_once_init_enter (&once_init_value))
25070 {
25071 lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
25072 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Occ", GSIZE_TO_POINTER (TYPE_OCC_PROXY));
25073 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Fan", GSIZE_TO_POINTER (TYPE_FAN_PROXY));
25074 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorValue", GSIZE_TO_POINTER (TYPE_SENSOR_VALUE_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050025075 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_THRESHOLD_PROXY));
25076 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorI2c", GSIZE_TO_POINTER (TYPE_SENSOR_I2C_PROXY));
25077 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorMatch", GSIZE_TO_POINTER (TYPE_SENSOR_MATCH_PROXY));
25078 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Process", GSIZE_TO_POINTER (TYPE_PROCESS_PROXY));
25079 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Control", GSIZE_TO_POINTER (TYPE_CONTROL_PROXY));
25080 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Bmc", GSIZE_TO_POINTER (TYPE_CONTROL_BMC_PROXY));
25081 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Host", GSIZE_TO_POINTER (TYPE_CONTROL_HOST_PROXY));
25082 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Power", GSIZE_TO_POINTER (TYPE_CONTROL_POWER_PROXY));
25083 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Watchdog", GSIZE_TO_POINTER (TYPE_WATCHDOG_PROXY));
25084 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.EventLog", GSIZE_TO_POINTER (TYPE_EVENT_LOG_PROXY));
25085 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Flash", GSIZE_TO_POINTER (TYPE_FLASH_PROXY));
25086 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Button", GSIZE_TO_POINTER (TYPE_BUTTON_PROXY));
25087 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Led", GSIZE_TO_POINTER (TYPE_LED_PROXY));
25088 g_once_init_leave (&once_init_value, 1);
25089 }
25090 ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
25091 if (ret == (GType) 0)
25092 ret = G_TYPE_DBUS_PROXY;
25093 return ret;
25094}
25095
25096/**
25097 * object_manager_client_new:
25098 * @connection: A #GDBusConnection.
25099 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
25100 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
25101 * @object_path: An object path.
25102 * @cancellable: (allow-none): A #GCancellable or %NULL.
25103 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
25104 * @user_data: User data to pass to @callback.
25105 *
25106 * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
25107 *
25108 * 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.
25109 * You can then call object_manager_client_new_finish() to get the result of the operation.
25110 *
25111 * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
25112 */
25113void
25114object_manager_client_new (
25115 GDBusConnection *connection,
25116 GDBusObjectManagerClientFlags flags,
25117 const gchar *name,
25118 const gchar *object_path,
25119 GCancellable *cancellable,
25120 GAsyncReadyCallback callback,
25121 gpointer user_data)
25122{
25123 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);
25124}
25125
25126/**
25127 * object_manager_client_new_finish:
25128 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new().
25129 * @error: Return location for error or %NULL
25130 *
25131 * Finishes an operation started with object_manager_client_new().
25132 *
25133 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
25134 */
25135GDBusObjectManager *
25136object_manager_client_new_finish (
25137 GAsyncResult *res,
25138 GError **error)
25139{
25140 GObject *ret;
25141 GObject *source_object;
25142 source_object = g_async_result_get_source_object (res);
25143 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
25144 g_object_unref (source_object);
25145 if (ret != NULL)
25146 return G_DBUS_OBJECT_MANAGER (ret);
25147 else
25148 return NULL;
25149}
25150
25151/**
25152 * object_manager_client_new_sync:
25153 * @connection: A #GDBusConnection.
25154 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
25155 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
25156 * @object_path: An object path.
25157 * @cancellable: (allow-none): A #GCancellable or %NULL.
25158 * @error: Return location for error or %NULL
25159 *
25160 * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
25161 *
25162 * The calling thread is blocked until a reply is received.
25163 *
25164 * See object_manager_client_new() for the asynchronous version of this constructor.
25165 *
25166 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
25167 */
25168GDBusObjectManager *
25169object_manager_client_new_sync (
25170 GDBusConnection *connection,
25171 GDBusObjectManagerClientFlags flags,
25172 const gchar *name,
25173 const gchar *object_path,
25174 GCancellable *cancellable,
25175 GError **error)
25176{
25177 GInitable *ret;
25178 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);
25179 if (ret != NULL)
25180 return G_DBUS_OBJECT_MANAGER (ret);
25181 else
25182 return NULL;
25183}
25184
25185
25186/**
25187 * object_manager_client_new_for_bus:
25188 * @bus_type: A #GBusType.
25189 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
25190 * @name: A bus name (well-known or unique).
25191 * @object_path: An object path.
25192 * @cancellable: (allow-none): A #GCancellable or %NULL.
25193 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
25194 * @user_data: User data to pass to @callback.
25195 *
25196 * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
25197 *
25198 * 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.
25199 * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation.
25200 *
25201 * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
25202 */
25203void
25204object_manager_client_new_for_bus (
25205 GBusType bus_type,
25206 GDBusObjectManagerClientFlags flags,
25207 const gchar *name,
25208 const gchar *object_path,
25209 GCancellable *cancellable,
25210 GAsyncReadyCallback callback,
25211 gpointer user_data)
25212{
25213 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);
25214}
25215
25216/**
25217 * object_manager_client_new_for_bus_finish:
25218 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus().
25219 * @error: Return location for error or %NULL
25220 *
25221 * Finishes an operation started with object_manager_client_new_for_bus().
25222 *
25223 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
25224 */
25225GDBusObjectManager *
25226object_manager_client_new_for_bus_finish (
25227 GAsyncResult *res,
25228 GError **error)
25229{
25230 GObject *ret;
25231 GObject *source_object;
25232 source_object = g_async_result_get_source_object (res);
25233 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
25234 g_object_unref (source_object);
25235 if (ret != NULL)
25236 return G_DBUS_OBJECT_MANAGER (ret);
25237 else
25238 return NULL;
25239}
25240
25241/**
25242 * object_manager_client_new_for_bus_sync:
25243 * @bus_type: A #GBusType.
25244 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
25245 * @name: A bus name (well-known or unique).
25246 * @object_path: An object path.
25247 * @cancellable: (allow-none): A #GCancellable or %NULL.
25248 * @error: Return location for error or %NULL
25249 *
25250 * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
25251 *
25252 * The calling thread is blocked until a reply is received.
25253 *
25254 * See object_manager_client_new_for_bus() for the asynchronous version of this constructor.
25255 *
25256 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
25257 */
25258GDBusObjectManager *
25259object_manager_client_new_for_bus_sync (
25260 GBusType bus_type,
25261 GDBusObjectManagerClientFlags flags,
25262 const gchar *name,
25263 const gchar *object_path,
25264 GCancellable *cancellable,
25265 GError **error)
25266{
25267 GInitable *ret;
25268 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);
25269 if (ret != NULL)
25270 return G_DBUS_OBJECT_MANAGER (ret);
25271 else
25272 return NULL;
25273}
25274
25275