blob: cf605780569df7d755c4d5634bcfcb1f09929380 [file] [log] [blame]
Norman James362a80f2015-09-14 14:04:39 -05001/*
Adriana Kobylak2cb27752015-10-19 16:23:14 -05002 * Generated by gdbus-codegen 2.44.1. DO NOT EDIT.
Norman James362a80f2015-09-14 14:04:39 -05003 *
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/* ------------------------------------------------------------------------
Adriana Kobylaka153aaa2015-10-19 16:29:12 -0500152<<<<<<< HEAD
Norman James362a80f2015-09-14 14:04:39 -0500153 * Code for interface org.openbmc.Occ
154 * ------------------------------------------------------------------------
155 */
156
157/**
158 * SECTION:Occ
159 * @title: Occ
160 * @short_description: Generated C code for the org.openbmc.Occ D-Bus interface
161 *
162 * 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.
163 */
164
165/* ---- Introspection data for org.openbmc.Occ ---- */
166
167static const _ExtendedGDBusMethodInfo _occ_method_info_init =
168{
169 {
170 -1,
171 (gchar *) "init",
172 NULL,
173 NULL,
174 NULL
175 },
176 "handle-init",
177 FALSE
178};
179
180static const _ExtendedGDBusMethodInfo _occ_method_info_collect =
181{
182 {
183 -1,
184 (gchar *) "collect",
185 NULL,
186 NULL,
187 NULL
188 },
189 "handle-collect",
190 FALSE
191};
192
193static const _ExtendedGDBusMethodInfo * const _occ_method_info_pointers[] =
194{
195 &_occ_method_info_init,
196 &_occ_method_info_collect,
197 NULL
198};
199
200static const _ExtendedGDBusPropertyInfo _occ_property_info_state =
201{
202 {
203 -1,
204 (gchar *) "state",
205 (gchar *) "s",
206 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
207 NULL
208 },
209 "state",
210 FALSE
211};
212
Norman James2d1ee892015-09-16 23:13:45 -0500213static const _ExtendedGDBusPropertyInfo _occ_property_info_instance_name =
214{
215 {
216 -1,
217 (gchar *) "instance_name",
218 (gchar *) "s",
219 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
220 NULL
221 },
222 "instance-name",
223 FALSE
224};
225
Norman James362a80f2015-09-14 14:04:39 -0500226static const _ExtendedGDBusPropertyInfo _occ_property_info_poll_interval =
227{
228 {
229 -1,
230 (gchar *) "poll_interval",
231 (gchar *) "i",
232 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
233 NULL
234 },
235 "poll-interval",
236 FALSE
237};
238
239static const _ExtendedGDBusPropertyInfo * const _occ_property_info_pointers[] =
240{
241 &_occ_property_info_state,
Norman James2d1ee892015-09-16 23:13:45 -0500242 &_occ_property_info_instance_name,
Norman James362a80f2015-09-14 14:04:39 -0500243 &_occ_property_info_poll_interval,
244 NULL
245};
246
247static const _ExtendedGDBusInterfaceInfo _occ_interface_info =
248{
249 {
250 -1,
251 (gchar *) "org.openbmc.Occ",
252 (GDBusMethodInfo **) &_occ_method_info_pointers,
253 NULL,
254 (GDBusPropertyInfo **) &_occ_property_info_pointers,
255 NULL
256 },
257 "occ",
258};
259
260
261/**
262 * occ_interface_info:
263 *
264 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link> D-Bus interface.
265 *
266 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
267 */
268GDBusInterfaceInfo *
269occ_interface_info (void)
270{
271 return (GDBusInterfaceInfo *) &_occ_interface_info.parent_struct;
272}
273
274/**
275 * occ_override_properties:
276 * @klass: The class structure for a #GObject<!-- -->-derived class.
277 * @property_id_begin: The property id to assign to the first overridden property.
278 *
279 * Overrides all #GObject properties in the #Occ interface for a concrete class.
280 * The properties are overridden in the order they are defined.
281 *
282 * Returns: The last property id.
283 */
284guint
285occ_override_properties (GObjectClass *klass, guint property_id_begin)
286{
287 g_object_class_override_property (klass, property_id_begin++, "state");
Norman James2d1ee892015-09-16 23:13:45 -0500288 g_object_class_override_property (klass, property_id_begin++, "instance-name");
Norman James362a80f2015-09-14 14:04:39 -0500289 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
290 return property_id_begin - 1;
291}
292
293
294
295/**
296 * Occ:
297 *
298 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>.
299 */
300
301/**
302 * OccIface:
303 * @parent_iface: The parent interface.
304 * @handle_collect: Handler for the #Occ::handle-collect signal.
305 * @handle_init: Handler for the #Occ::handle-init signal.
Norman James2d1ee892015-09-16 23:13:45 -0500306 * @get_instance_name: Getter for the #Occ:instance-name property.
Norman James362a80f2015-09-14 14:04:39 -0500307 * @get_poll_interval: Getter for the #Occ:poll-interval property.
308 * @get_state: Getter for the #Occ:state property.
309 *
310 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>.
311 */
312
313typedef OccIface OccInterface;
314G_DEFINE_INTERFACE (Occ, occ, G_TYPE_OBJECT);
315
316static void
317occ_default_init (OccIface *iface)
318{
319 /* GObject signals for incoming D-Bus method calls: */
320 /**
321 * Occ::handle-init:
322 * @object: A #Occ.
323 * @invocation: A #GDBusMethodInvocation.
324 *
325 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Occ.init">init()</link> D-Bus method.
326 *
327 * 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.
328 *
329 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
330 */
331 g_signal_new ("handle-init",
332 G_TYPE_FROM_INTERFACE (iface),
333 G_SIGNAL_RUN_LAST,
334 G_STRUCT_OFFSET (OccIface, handle_init),
335 g_signal_accumulator_true_handled,
336 NULL,
337 g_cclosure_marshal_generic,
338 G_TYPE_BOOLEAN,
339 1,
340 G_TYPE_DBUS_METHOD_INVOCATION);
341
342 /**
343 * Occ::handle-collect:
344 * @object: A #Occ.
345 * @invocation: A #GDBusMethodInvocation.
346 *
347 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Occ.collect">collect()</link> D-Bus method.
348 *
349 * 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.
350 *
351 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
352 */
353 g_signal_new ("handle-collect",
354 G_TYPE_FROM_INTERFACE (iface),
355 G_SIGNAL_RUN_LAST,
356 G_STRUCT_OFFSET (OccIface, handle_collect),
357 g_signal_accumulator_true_handled,
358 NULL,
359 g_cclosure_marshal_generic,
360 G_TYPE_BOOLEAN,
361 1,
362 G_TYPE_DBUS_METHOD_INVOCATION);
363
364 /* GObject properties for D-Bus properties: */
365 /**
366 * Occ:state:
367 *
368 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Occ.state">"state"</link>.
369 *
370 * 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.
371 */
372 g_object_interface_install_property (iface,
373 g_param_spec_string ("state", "state", "state", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
374 /**
Norman James2d1ee892015-09-16 23:13:45 -0500375 * Occ:instance-name:
376 *
377 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Occ.instance_name">"instance_name"</link>.
378 *
379 * 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.
380 */
381 g_object_interface_install_property (iface,
382 g_param_spec_string ("instance-name", "instance_name", "instance_name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
383 /**
Norman James362a80f2015-09-14 14:04:39 -0500384 * Occ:poll-interval:
385 *
386 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Occ.poll_interval">"poll_interval"</link>.
387 *
388 * 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.
389 */
390 g_object_interface_install_property (iface,
391 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
392}
393
394/**
395 * occ_get_state: (skip)
396 * @object: A #Occ.
397 *
398 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Occ.state">"state"</link> D-Bus property.
399 *
400 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
401 *
402 * <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>
403 *
404 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
405 */
406const gchar *
407occ_get_state (Occ *object)
408{
409 return OCC_GET_IFACE (object)->get_state (object);
410}
411
412/**
413 * occ_dup_state: (skip)
414 * @object: A #Occ.
415 *
416 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Occ.state">"state"</link> D-Bus property.
417 *
418 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
419 *
420 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
421 */
422gchar *
423occ_dup_state (Occ *object)
424{
425 gchar *value;
426 g_object_get (G_OBJECT (object), "state", &value, NULL);
427 return value;
428}
429
430/**
431 * occ_set_state: (skip)
432 * @object: A #Occ.
433 * @value: The value to set.
434 *
435 * Sets the <link linkend="gdbus-property-org-openbmc-Occ.state">"state"</link> D-Bus property to @value.
436 *
437 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
438 */
439void
440occ_set_state (Occ *object, const gchar *value)
441{
442 g_object_set (G_OBJECT (object), "state", value, NULL);
443}
444
445/**
Norman James2d1ee892015-09-16 23:13:45 -0500446 * occ_get_instance_name: (skip)
447 * @object: A #Occ.
448 *
449 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Occ.instance_name">"instance_name"</link> D-Bus property.
450 *
451 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
452 *
453 * <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>
454 *
455 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
456 */
457const gchar *
458occ_get_instance_name (Occ *object)
459{
460 return OCC_GET_IFACE (object)->get_instance_name (object);
461}
462
463/**
464 * occ_dup_instance_name: (skip)
465 * @object: A #Occ.
466 *
467 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Occ.instance_name">"instance_name"</link> D-Bus property.
468 *
469 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
470 *
471 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
472 */
473gchar *
474occ_dup_instance_name (Occ *object)
475{
476 gchar *value;
477 g_object_get (G_OBJECT (object), "instance-name", &value, NULL);
478 return value;
479}
480
481/**
482 * occ_set_instance_name: (skip)
483 * @object: A #Occ.
484 * @value: The value to set.
485 *
486 * Sets the <link linkend="gdbus-property-org-openbmc-Occ.instance_name">"instance_name"</link> D-Bus property to @value.
487 *
488 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
489 */
490void
491occ_set_instance_name (Occ *object, const gchar *value)
492{
493 g_object_set (G_OBJECT (object), "instance-name", value, NULL);
494}
495
496/**
Norman James362a80f2015-09-14 14:04:39 -0500497 * occ_get_poll_interval: (skip)
498 * @object: A #Occ.
499 *
500 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Occ.poll_interval">"poll_interval"</link> D-Bus property.
501 *
502 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
503 *
504 * Returns: The property value.
505 */
506gint
507occ_get_poll_interval (Occ *object)
508{
509 return OCC_GET_IFACE (object)->get_poll_interval (object);
510}
511
512/**
513 * occ_set_poll_interval: (skip)
514 * @object: A #Occ.
515 * @value: The value to set.
516 *
517 * Sets the <link linkend="gdbus-property-org-openbmc-Occ.poll_interval">"poll_interval"</link> D-Bus property to @value.
518 *
519 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
520 */
521void
522occ_set_poll_interval (Occ *object, gint value)
523{
524 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
525}
526
527/**
528 * occ_call_init:
529 * @proxy: A #OccProxy.
530 * @cancellable: (allow-none): A #GCancellable or %NULL.
531 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
532 * @user_data: User data to pass to @callback.
533 *
534 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Occ.init">init()</link> D-Bus method on @proxy.
535 * 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.
536 * You can then call occ_call_init_finish() to get the result of the operation.
537 *
538 * See occ_call_init_sync() for the synchronous, blocking version of this method.
539 */
540void
541occ_call_init (
542 Occ *proxy,
543 GCancellable *cancellable,
544 GAsyncReadyCallback callback,
545 gpointer user_data)
546{
547 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
548 "init",
549 g_variant_new ("()"),
550 G_DBUS_CALL_FLAGS_NONE,
551 -1,
552 cancellable,
553 callback,
554 user_data);
555}
556
557/**
558 * occ_call_init_finish:
559 * @proxy: A #OccProxy.
560 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to occ_call_init().
561 * @error: Return location for error or %NULL.
562 *
563 * Finishes an operation started with occ_call_init().
564 *
565 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
566 */
567gboolean
568occ_call_init_finish (
569 Occ *proxy,
570 GAsyncResult *res,
571 GError **error)
572{
573 GVariant *_ret;
574 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
575 if (_ret == NULL)
576 goto _out;
577 g_variant_get (_ret,
578 "()");
579 g_variant_unref (_ret);
580_out:
581 return _ret != NULL;
582}
583
584/**
585 * occ_call_init_sync:
586 * @proxy: A #OccProxy.
587 * @cancellable: (allow-none): A #GCancellable or %NULL.
588 * @error: Return location for error or %NULL.
589 *
590 * 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.
591 *
592 * See occ_call_init() for the asynchronous version of this method.
593 *
594 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
595 */
596gboolean
597occ_call_init_sync (
598 Occ *proxy,
599 GCancellable *cancellable,
600 GError **error)
601{
602 GVariant *_ret;
603 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
604 "init",
605 g_variant_new ("()"),
606 G_DBUS_CALL_FLAGS_NONE,
607 -1,
608 cancellable,
609 error);
610 if (_ret == NULL)
611 goto _out;
612 g_variant_get (_ret,
613 "()");
614 g_variant_unref (_ret);
615_out:
616 return _ret != NULL;
617}
618
619/**
620 * occ_call_collect:
621 * @proxy: A #OccProxy.
622 * @cancellable: (allow-none): A #GCancellable or %NULL.
623 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
624 * @user_data: User data to pass to @callback.
625 *
626 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Occ.collect">collect()</link> D-Bus method on @proxy.
627 * 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.
628 * You can then call occ_call_collect_finish() to get the result of the operation.
629 *
630 * See occ_call_collect_sync() for the synchronous, blocking version of this method.
631 */
632void
633occ_call_collect (
634 Occ *proxy,
635 GCancellable *cancellable,
636 GAsyncReadyCallback callback,
637 gpointer user_data)
638{
639 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
640 "collect",
641 g_variant_new ("()"),
642 G_DBUS_CALL_FLAGS_NONE,
643 -1,
644 cancellable,
645 callback,
646 user_data);
647}
648
649/**
650 * occ_call_collect_finish:
651 * @proxy: A #OccProxy.
652 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to occ_call_collect().
653 * @error: Return location for error or %NULL.
654 *
655 * Finishes an operation started with occ_call_collect().
656 *
657 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
658 */
659gboolean
660occ_call_collect_finish (
661 Occ *proxy,
662 GAsyncResult *res,
663 GError **error)
664{
665 GVariant *_ret;
666 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
667 if (_ret == NULL)
668 goto _out;
669 g_variant_get (_ret,
670 "()");
671 g_variant_unref (_ret);
672_out:
673 return _ret != NULL;
674}
675
676/**
677 * occ_call_collect_sync:
678 * @proxy: A #OccProxy.
679 * @cancellable: (allow-none): A #GCancellable or %NULL.
680 * @error: Return location for error or %NULL.
681 *
682 * 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.
683 *
684 * See occ_call_collect() for the asynchronous version of this method.
685 *
686 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
687 */
688gboolean
689occ_call_collect_sync (
690 Occ *proxy,
691 GCancellable *cancellable,
692 GError **error)
693{
694 GVariant *_ret;
695 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
696 "collect",
697 g_variant_new ("()"),
698 G_DBUS_CALL_FLAGS_NONE,
699 -1,
700 cancellable,
701 error);
702 if (_ret == NULL)
703 goto _out;
704 g_variant_get (_ret,
705 "()");
706 g_variant_unref (_ret);
707_out:
708 return _ret != NULL;
709}
710
711/**
712 * occ_complete_init:
713 * @object: A #Occ.
714 * @invocation: (transfer full): A #GDBusMethodInvocation.
715 *
716 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-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.
717 *
718 * This method will free @invocation, you cannot use it afterwards.
719 */
720void
721occ_complete_init (
722 Occ *object,
723 GDBusMethodInvocation *invocation)
724{
725 g_dbus_method_invocation_return_value (invocation,
726 g_variant_new ("()"));
727}
728
729/**
730 * occ_complete_collect:
731 * @object: A #Occ.
732 * @invocation: (transfer full): A #GDBusMethodInvocation.
733 *
734 * 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.
735 *
736 * This method will free @invocation, you cannot use it afterwards.
737 */
738void
739occ_complete_collect (
740 Occ *object,
741 GDBusMethodInvocation *invocation)
742{
743 g_dbus_method_invocation_return_value (invocation,
744 g_variant_new ("()"));
745}
746
747/* ------------------------------------------------------------------------ */
748
749/**
750 * OccProxy:
751 *
752 * The #OccProxy structure contains only private data and should only be accessed using the provided API.
753 */
754
755/**
756 * OccProxyClass:
757 * @parent_class: The parent class.
758 *
759 * Class structure for #OccProxy.
760 */
761
762struct _OccProxyPrivate
763{
764 GData *qdata;
765};
766
767static void occ_proxy_iface_init (OccIface *iface);
768
769#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
770G_DEFINE_TYPE_WITH_CODE (OccProxy, occ_proxy, G_TYPE_DBUS_PROXY,
771 G_ADD_PRIVATE (OccProxy)
772 G_IMPLEMENT_INTERFACE (TYPE_OCC, occ_proxy_iface_init));
773
774#else
775G_DEFINE_TYPE_WITH_CODE (OccProxy, occ_proxy, G_TYPE_DBUS_PROXY,
776 G_IMPLEMENT_INTERFACE (TYPE_OCC, occ_proxy_iface_init));
777
778#endif
779static void
780occ_proxy_finalize (GObject *object)
781{
782 OccProxy *proxy = OCC_PROXY (object);
783 g_datalist_clear (&proxy->priv->qdata);
784 G_OBJECT_CLASS (occ_proxy_parent_class)->finalize (object);
785}
786
787static void
788occ_proxy_get_property (GObject *object,
789 guint prop_id,
790 GValue *value,
791 GParamSpec *pspec G_GNUC_UNUSED)
792{
793 const _ExtendedGDBusPropertyInfo *info;
794 GVariant *variant;
Norman James2d1ee892015-09-16 23:13:45 -0500795 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -0500796 info = _occ_property_info_pointers[prop_id - 1];
797 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
798 if (info->use_gvariant)
799 {
800 g_value_set_variant (value, variant);
801 }
802 else
803 {
804 if (variant != NULL)
805 g_dbus_gvariant_to_gvalue (variant, value);
806 }
807 if (variant != NULL)
808 g_variant_unref (variant);
809}
810
811static void
812occ_proxy_set_property_cb (GDBusProxy *proxy,
813 GAsyncResult *res,
814 gpointer user_data)
815{
816 const _ExtendedGDBusPropertyInfo *info = user_data;
817 GError *error;
818 GVariant *_ret;
819 error = NULL;
820 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
821 if (!_ret)
822 {
823 g_warning ("Error setting property '%s' on interface org.openbmc.Occ: %s (%s, %d)",
824 info->parent_struct.name,
825 error->message, g_quark_to_string (error->domain), error->code);
826 g_error_free (error);
827 }
828 else
829 {
830 g_variant_unref (_ret);
831 }
832}
833
834static void
835occ_proxy_set_property (GObject *object,
836 guint prop_id,
837 const GValue *value,
838 GParamSpec *pspec G_GNUC_UNUSED)
839{
840 const _ExtendedGDBusPropertyInfo *info;
841 GVariant *variant;
Norman James2d1ee892015-09-16 23:13:45 -0500842 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -0500843 info = _occ_property_info_pointers[prop_id - 1];
844 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
845 g_dbus_proxy_call (G_DBUS_PROXY (object),
846 "org.freedesktop.DBus.Properties.Set",
847 g_variant_new ("(ssv)", "org.openbmc.Occ", info->parent_struct.name, variant),
848 G_DBUS_CALL_FLAGS_NONE,
849 -1,
850 NULL, (GAsyncReadyCallback) occ_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
851 g_variant_unref (variant);
852}
853
854static void
855occ_proxy_g_signal (GDBusProxy *proxy,
856 const gchar *sender_name G_GNUC_UNUSED,
857 const gchar *signal_name,
858 GVariant *parameters)
859{
860 _ExtendedGDBusSignalInfo *info;
861 GVariantIter iter;
862 GVariant *child;
863 GValue *paramv;
864 guint num_params;
865 guint n;
866 guint signal_id;
867 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_occ_interface_info.parent_struct, signal_name);
868 if (info == NULL)
869 return;
870 num_params = g_variant_n_children (parameters);
871 paramv = g_new0 (GValue, num_params + 1);
872 g_value_init (&paramv[0], TYPE_OCC);
873 g_value_set_object (&paramv[0], proxy);
874 g_variant_iter_init (&iter, parameters);
875 n = 1;
876 while ((child = g_variant_iter_next_value (&iter)) != NULL)
877 {
878 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
879 if (arg_info->use_gvariant)
880 {
881 g_value_init (&paramv[n], G_TYPE_VARIANT);
882 g_value_set_variant (&paramv[n], child);
883 n++;
884 }
885 else
886 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
887 g_variant_unref (child);
888 }
889 signal_id = g_signal_lookup (info->signal_name, TYPE_OCC);
890 g_signal_emitv (paramv, signal_id, 0, NULL);
891 for (n = 0; n < num_params + 1; n++)
892 g_value_unset (&paramv[n]);
893 g_free (paramv);
894}
895
896static void
897occ_proxy_g_properties_changed (GDBusProxy *_proxy,
898 GVariant *changed_properties,
899 const gchar *const *invalidated_properties)
900{
901 OccProxy *proxy = OCC_PROXY (_proxy);
902 guint n;
903 const gchar *key;
904 GVariantIter *iter;
905 _ExtendedGDBusPropertyInfo *info;
906 g_variant_get (changed_properties, "a{sv}", &iter);
907 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
908 {
909 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_occ_interface_info.parent_struct, key);
910 g_datalist_remove_data (&proxy->priv->qdata, key);
911 if (info != NULL)
912 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
913 }
914 g_variant_iter_free (iter);
915 for (n = 0; invalidated_properties[n] != NULL; n++)
916 {
917 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_occ_interface_info.parent_struct, invalidated_properties[n]);
918 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
919 if (info != NULL)
920 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
921 }
922}
923
924static const gchar *
925occ_proxy_get_state (Occ *object)
926{
927 OccProxy *proxy = OCC_PROXY (object);
928 GVariant *variant;
929 const gchar *value = NULL;
930 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
931 if (variant != NULL)
932 {
933 value = g_variant_get_string (variant, NULL);
934 g_variant_unref (variant);
935 }
936 return value;
937}
938
Norman James2d1ee892015-09-16 23:13:45 -0500939static const gchar *
940occ_proxy_get_instance_name (Occ *object)
941{
942 OccProxy *proxy = OCC_PROXY (object);
943 GVariant *variant;
944 const gchar *value = NULL;
945 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "instance_name");
946 if (variant != NULL)
947 {
948 value = g_variant_get_string (variant, NULL);
949 g_variant_unref (variant);
950 }
951 return value;
952}
953
Norman James362a80f2015-09-14 14:04:39 -0500954static gint
955occ_proxy_get_poll_interval (Occ *object)
956{
957 OccProxy *proxy = OCC_PROXY (object);
958 GVariant *variant;
959 gint value = 0;
960 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
961 if (variant != NULL)
962 {
963 value = g_variant_get_int32 (variant);
964 g_variant_unref (variant);
965 }
966 return value;
967}
968
969static void
970occ_proxy_init (OccProxy *proxy)
971{
972#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
973 proxy->priv = occ_proxy_get_instance_private (proxy);
974#else
975 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_OCC_PROXY, OccProxyPrivate);
976#endif
977
978 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), occ_interface_info ());
979}
980
981static void
982occ_proxy_class_init (OccProxyClass *klass)
983{
984 GObjectClass *gobject_class;
985 GDBusProxyClass *proxy_class;
986
987 gobject_class = G_OBJECT_CLASS (klass);
988 gobject_class->finalize = occ_proxy_finalize;
989 gobject_class->get_property = occ_proxy_get_property;
990 gobject_class->set_property = occ_proxy_set_property;
991
992 proxy_class = G_DBUS_PROXY_CLASS (klass);
993 proxy_class->g_signal = occ_proxy_g_signal;
994 proxy_class->g_properties_changed = occ_proxy_g_properties_changed;
995
996 occ_override_properties (gobject_class, 1);
997
998#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
999 g_type_class_add_private (klass, sizeof (OccProxyPrivate));
1000#endif
1001}
1002
1003static void
1004occ_proxy_iface_init (OccIface *iface)
1005{
1006 iface->get_state = occ_proxy_get_state;
Norman James2d1ee892015-09-16 23:13:45 -05001007 iface->get_instance_name = occ_proxy_get_instance_name;
Norman James362a80f2015-09-14 14:04:39 -05001008 iface->get_poll_interval = occ_proxy_get_poll_interval;
1009}
1010
1011/**
1012 * occ_proxy_new:
1013 * @connection: A #GDBusConnection.
1014 * @flags: Flags from the #GDBusProxyFlags enumeration.
1015 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1016 * @object_path: An object path.
1017 * @cancellable: (allow-none): A #GCancellable or %NULL.
1018 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1019 * @user_data: User data to pass to @callback.
1020 *
1021 * 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.
1022 *
1023 * 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.
1024 * You can then call occ_proxy_new_finish() to get the result of the operation.
1025 *
1026 * See occ_proxy_new_sync() for the synchronous, blocking version of this constructor.
1027 */
1028void
1029occ_proxy_new (
1030 GDBusConnection *connection,
1031 GDBusProxyFlags flags,
1032 const gchar *name,
1033 const gchar *object_path,
1034 GCancellable *cancellable,
1035 GAsyncReadyCallback callback,
1036 gpointer user_data)
1037{
1038 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);
1039}
1040
1041/**
1042 * occ_proxy_new_finish:
1043 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to occ_proxy_new().
1044 * @error: Return location for error or %NULL
1045 *
1046 * Finishes an operation started with occ_proxy_new().
1047 *
1048 * Returns: (transfer full) (type OccProxy): The constructed proxy object or %NULL if @error is set.
1049 */
1050Occ *
1051occ_proxy_new_finish (
1052 GAsyncResult *res,
1053 GError **error)
1054{
1055 GObject *ret;
1056 GObject *source_object;
1057 source_object = g_async_result_get_source_object (res);
1058 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1059 g_object_unref (source_object);
1060 if (ret != NULL)
1061 return OCC (ret);
1062 else
1063 return NULL;
1064}
1065
1066/**
1067 * occ_proxy_new_sync:
1068 * @connection: A #GDBusConnection.
1069 * @flags: Flags from the #GDBusProxyFlags enumeration.
1070 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1071 * @object_path: An object path.
1072 * @cancellable: (allow-none): A #GCancellable or %NULL.
1073 * @error: Return location for error or %NULL
1074 *
1075 * 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.
1076 *
1077 * The calling thread is blocked until a reply is received.
1078 *
1079 * See occ_proxy_new() for the asynchronous version of this constructor.
1080 *
1081 * Returns: (transfer full) (type OccProxy): The constructed proxy object or %NULL if @error is set.
1082 */
1083Occ *
1084occ_proxy_new_sync (
1085 GDBusConnection *connection,
1086 GDBusProxyFlags flags,
1087 const gchar *name,
1088 const gchar *object_path,
1089 GCancellable *cancellable,
1090 GError **error)
1091{
1092 GInitable *ret;
1093 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);
1094 if (ret != NULL)
1095 return OCC (ret);
1096 else
1097 return NULL;
1098}
1099
1100
1101/**
1102 * occ_proxy_new_for_bus:
1103 * @bus_type: A #GBusType.
1104 * @flags: Flags from the #GDBusProxyFlags enumeration.
1105 * @name: A bus name (well-known or unique).
1106 * @object_path: An object path.
1107 * @cancellable: (allow-none): A #GCancellable or %NULL.
1108 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1109 * @user_data: User data to pass to @callback.
1110 *
1111 * Like occ_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
1112 *
1113 * 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.
1114 * You can then call occ_proxy_new_for_bus_finish() to get the result of the operation.
1115 *
1116 * See occ_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
1117 */
1118void
1119occ_proxy_new_for_bus (
1120 GBusType bus_type,
1121 GDBusProxyFlags flags,
1122 const gchar *name,
1123 const gchar *object_path,
1124 GCancellable *cancellable,
1125 GAsyncReadyCallback callback,
1126 gpointer user_data)
1127{
1128 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);
1129}
1130
1131/**
1132 * occ_proxy_new_for_bus_finish:
1133 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to occ_proxy_new_for_bus().
1134 * @error: Return location for error or %NULL
1135 *
1136 * Finishes an operation started with occ_proxy_new_for_bus().
1137 *
1138 * Returns: (transfer full) (type OccProxy): The constructed proxy object or %NULL if @error is set.
1139 */
1140Occ *
1141occ_proxy_new_for_bus_finish (
1142 GAsyncResult *res,
1143 GError **error)
1144{
1145 GObject *ret;
1146 GObject *source_object;
1147 source_object = g_async_result_get_source_object (res);
1148 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1149 g_object_unref (source_object);
1150 if (ret != NULL)
1151 return OCC (ret);
1152 else
1153 return NULL;
1154}
1155
1156/**
1157 * occ_proxy_new_for_bus_sync:
1158 * @bus_type: A #GBusType.
1159 * @flags: Flags from the #GDBusProxyFlags enumeration.
1160 * @name: A bus name (well-known or unique).
1161 * @object_path: An object path.
1162 * @cancellable: (allow-none): A #GCancellable or %NULL.
1163 * @error: Return location for error or %NULL
1164 *
1165 * Like occ_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
1166 *
1167 * The calling thread is blocked until a reply is received.
1168 *
1169 * See occ_proxy_new_for_bus() for the asynchronous version of this constructor.
1170 *
1171 * Returns: (transfer full) (type OccProxy): The constructed proxy object or %NULL if @error is set.
1172 */
1173Occ *
1174occ_proxy_new_for_bus_sync (
1175 GBusType bus_type,
1176 GDBusProxyFlags flags,
1177 const gchar *name,
1178 const gchar *object_path,
1179 GCancellable *cancellable,
1180 GError **error)
1181{
1182 GInitable *ret;
1183 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);
1184 if (ret != NULL)
1185 return OCC (ret);
1186 else
1187 return NULL;
1188}
1189
1190
1191/* ------------------------------------------------------------------------ */
1192
1193/**
1194 * OccSkeleton:
1195 *
1196 * The #OccSkeleton structure contains only private data and should only be accessed using the provided API.
1197 */
1198
1199/**
1200 * OccSkeletonClass:
1201 * @parent_class: The parent class.
1202 *
1203 * Class structure for #OccSkeleton.
1204 */
1205
1206struct _OccSkeletonPrivate
1207{
1208 GValue *properties;
1209 GList *changed_properties;
1210 GSource *changed_properties_idle_source;
1211 GMainContext *context;
1212 GMutex lock;
1213};
1214
1215static void
1216_occ_skeleton_handle_method_call (
1217 GDBusConnection *connection G_GNUC_UNUSED,
1218 const gchar *sender G_GNUC_UNUSED,
1219 const gchar *object_path G_GNUC_UNUSED,
1220 const gchar *interface_name,
1221 const gchar *method_name,
1222 GVariant *parameters,
1223 GDBusMethodInvocation *invocation,
1224 gpointer user_data)
1225{
1226 OccSkeleton *skeleton = OCC_SKELETON (user_data);
1227 _ExtendedGDBusMethodInfo *info;
1228 GVariantIter iter;
1229 GVariant *child;
1230 GValue *paramv;
1231 guint num_params;
1232 guint num_extra;
1233 guint n;
1234 guint signal_id;
1235 GValue return_value = G_VALUE_INIT;
1236 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
1237 g_assert (info != NULL);
1238 num_params = g_variant_n_children (parameters);
1239 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
1240 n = 0;
1241 g_value_init (&paramv[n], TYPE_OCC);
1242 g_value_set_object (&paramv[n++], skeleton);
1243 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
1244 g_value_set_object (&paramv[n++], invocation);
1245 if (info->pass_fdlist)
1246 {
1247#ifdef G_OS_UNIX
1248 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
1249 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
1250#else
1251 g_assert_not_reached ();
1252#endif
1253 }
1254 g_variant_iter_init (&iter, parameters);
1255 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1256 {
1257 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
1258 if (arg_info->use_gvariant)
1259 {
1260 g_value_init (&paramv[n], G_TYPE_VARIANT);
1261 g_value_set_variant (&paramv[n], child);
1262 n++;
1263 }
1264 else
1265 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
1266 g_variant_unref (child);
1267 }
1268 signal_id = g_signal_lookup (info->signal_name, TYPE_OCC);
1269 g_value_init (&return_value, G_TYPE_BOOLEAN);
1270 g_signal_emitv (paramv, signal_id, 0, &return_value);
1271 if (!g_value_get_boolean (&return_value))
1272 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);
1273 g_value_unset (&return_value);
1274 for (n = 0; n < num_params + num_extra; n++)
1275 g_value_unset (&paramv[n]);
1276 g_free (paramv);
1277}
1278
1279static GVariant *
1280_occ_skeleton_handle_get_property (
1281 GDBusConnection *connection G_GNUC_UNUSED,
1282 const gchar *sender G_GNUC_UNUSED,
1283 const gchar *object_path G_GNUC_UNUSED,
1284 const gchar *interface_name G_GNUC_UNUSED,
1285 const gchar *property_name,
1286 GError **error,
1287 gpointer user_data)
1288{
1289 OccSkeleton *skeleton = OCC_SKELETON (user_data);
1290 GValue value = G_VALUE_INIT;
1291 GParamSpec *pspec;
1292 _ExtendedGDBusPropertyInfo *info;
1293 GVariant *ret;
1294 ret = NULL;
1295 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_occ_interface_info.parent_struct, property_name);
1296 g_assert (info != NULL);
1297 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1298 if (pspec == NULL)
1299 {
1300 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1301 }
1302 else
1303 {
1304 g_value_init (&value, pspec->value_type);
1305 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1306 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
1307 g_value_unset (&value);
1308 }
1309 return ret;
1310}
1311
1312static gboolean
1313_occ_skeleton_handle_set_property (
1314 GDBusConnection *connection G_GNUC_UNUSED,
1315 const gchar *sender G_GNUC_UNUSED,
1316 const gchar *object_path G_GNUC_UNUSED,
1317 const gchar *interface_name G_GNUC_UNUSED,
1318 const gchar *property_name,
1319 GVariant *variant,
1320 GError **error,
1321 gpointer user_data)
1322{
1323 OccSkeleton *skeleton = OCC_SKELETON (user_data);
1324 GValue value = G_VALUE_INIT;
1325 GParamSpec *pspec;
1326 _ExtendedGDBusPropertyInfo *info;
1327 gboolean ret;
1328 ret = FALSE;
1329 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_occ_interface_info.parent_struct, property_name);
1330 g_assert (info != NULL);
1331 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1332 if (pspec == NULL)
1333 {
1334 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1335 }
1336 else
1337 {
1338 if (info->use_gvariant)
1339 g_value_set_variant (&value, variant);
1340 else
1341 g_dbus_gvariant_to_gvalue (variant, &value);
1342 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1343 g_value_unset (&value);
1344 ret = TRUE;
1345 }
1346 return ret;
1347}
1348
1349static const GDBusInterfaceVTable _occ_skeleton_vtable =
1350{
1351 _occ_skeleton_handle_method_call,
1352 _occ_skeleton_handle_get_property,
1353 _occ_skeleton_handle_set_property,
1354 {NULL}
1355};
1356
1357static GDBusInterfaceInfo *
1358occ_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1359{
1360 return occ_interface_info ();
1361}
1362
1363static GDBusInterfaceVTable *
1364occ_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1365{
1366 return (GDBusInterfaceVTable *) &_occ_skeleton_vtable;
1367}
1368
1369static GVariant *
1370occ_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
1371{
1372 OccSkeleton *skeleton = OCC_SKELETON (_skeleton);
1373
1374 GVariantBuilder builder;
1375 guint n;
1376 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1377 if (_occ_interface_info.parent_struct.properties == NULL)
1378 goto out;
1379 for (n = 0; _occ_interface_info.parent_struct.properties[n] != NULL; n++)
1380 {
1381 GDBusPropertyInfo *info = _occ_interface_info.parent_struct.properties[n];
1382 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
1383 {
1384 GVariant *value;
1385 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);
1386 if (value != NULL)
1387 {
1388 g_variant_take_ref (value);
1389 g_variant_builder_add (&builder, "{sv}", info->name, value);
1390 g_variant_unref (value);
1391 }
1392 }
1393 }
1394out:
1395 return g_variant_builder_end (&builder);
1396}
1397
1398static gboolean _occ_emit_changed (gpointer user_data);
1399
1400static void
1401occ_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
1402{
1403 OccSkeleton *skeleton = OCC_SKELETON (_skeleton);
1404 gboolean emit_changed = FALSE;
1405
1406 g_mutex_lock (&skeleton->priv->lock);
1407 if (skeleton->priv->changed_properties_idle_source != NULL)
1408 {
1409 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1410 skeleton->priv->changed_properties_idle_source = NULL;
1411 emit_changed = TRUE;
1412 }
1413 g_mutex_unlock (&skeleton->priv->lock);
1414
1415 if (emit_changed)
1416 _occ_emit_changed (skeleton);
1417}
1418
1419static void occ_skeleton_iface_init (OccIface *iface);
1420#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1421G_DEFINE_TYPE_WITH_CODE (OccSkeleton, occ_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1422 G_ADD_PRIVATE (OccSkeleton)
1423 G_IMPLEMENT_INTERFACE (TYPE_OCC, occ_skeleton_iface_init));
1424
1425#else
1426G_DEFINE_TYPE_WITH_CODE (OccSkeleton, occ_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1427 G_IMPLEMENT_INTERFACE (TYPE_OCC, occ_skeleton_iface_init));
1428
1429#endif
1430static void
1431occ_skeleton_finalize (GObject *object)
1432{
1433 OccSkeleton *skeleton = OCC_SKELETON (object);
1434 guint n;
Norman James2d1ee892015-09-16 23:13:45 -05001435 for (n = 0; n < 3; n++)
Norman James362a80f2015-09-14 14:04:39 -05001436 g_value_unset (&skeleton->priv->properties[n]);
1437 g_free (skeleton->priv->properties);
1438 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1439 if (skeleton->priv->changed_properties_idle_source != NULL)
1440 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1441 g_main_context_unref (skeleton->priv->context);
1442 g_mutex_clear (&skeleton->priv->lock);
1443 G_OBJECT_CLASS (occ_skeleton_parent_class)->finalize (object);
1444}
1445
1446static void
1447occ_skeleton_get_property (GObject *object,
1448 guint prop_id,
1449 GValue *value,
1450 GParamSpec *pspec G_GNUC_UNUSED)
1451{
1452 OccSkeleton *skeleton = OCC_SKELETON (object);
Norman James2d1ee892015-09-16 23:13:45 -05001453 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -05001454 g_mutex_lock (&skeleton->priv->lock);
1455 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
1456 g_mutex_unlock (&skeleton->priv->lock);
1457}
1458
1459static gboolean
1460_occ_emit_changed (gpointer user_data)
1461{
1462 OccSkeleton *skeleton = OCC_SKELETON (user_data);
1463 GList *l;
1464 GVariantBuilder builder;
1465 GVariantBuilder invalidated_builder;
1466 guint num_changes;
1467
1468 g_mutex_lock (&skeleton->priv->lock);
1469 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1470 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
1471 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
1472 {
1473 ChangedProperty *cp = l->data;
1474 GVariant *variant;
1475 const GValue *cur_value;
1476
1477 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
1478 if (!_g_value_equal (cur_value, &cp->orig_value))
1479 {
1480 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
1481 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
1482 g_variant_unref (variant);
1483 num_changes++;
1484 }
1485 }
1486 if (num_changes > 0)
1487 {
1488 GList *connections, *ll;
1489 GVariant *signal_variant;
1490 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Occ",
1491 &builder, &invalidated_builder));
1492 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
1493 for (ll = connections; ll != NULL; ll = ll->next)
1494 {
1495 GDBusConnection *connection = ll->data;
1496
1497 g_dbus_connection_emit_signal (connection,
1498 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
1499 "org.freedesktop.DBus.Properties",
1500 "PropertiesChanged",
1501 signal_variant,
1502 NULL);
1503 }
1504 g_variant_unref (signal_variant);
1505 g_list_free_full (connections, g_object_unref);
1506 }
1507 else
1508 {
1509 g_variant_builder_clear (&builder);
1510 g_variant_builder_clear (&invalidated_builder);
1511 }
1512 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1513 skeleton->priv->changed_properties = NULL;
1514 skeleton->priv->changed_properties_idle_source = NULL;
1515 g_mutex_unlock (&skeleton->priv->lock);
1516 return FALSE;
1517}
1518
1519static void
1520_occ_schedule_emit_changed (OccSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
1521{
1522 ChangedProperty *cp;
1523 GList *l;
1524 cp = NULL;
1525 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
1526 {
1527 ChangedProperty *i_cp = l->data;
1528 if (i_cp->info == info)
1529 {
1530 cp = i_cp;
1531 break;
1532 }
1533 }
1534 if (cp == NULL)
1535 {
1536 cp = g_new0 (ChangedProperty, 1);
1537 cp->prop_id = prop_id;
1538 cp->info = info;
1539 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
1540 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
1541 g_value_copy (orig_value, &cp->orig_value);
1542 }
1543}
1544
1545static void
1546occ_skeleton_notify (GObject *object,
1547 GParamSpec *pspec G_GNUC_UNUSED)
1548{
1549 OccSkeleton *skeleton = OCC_SKELETON (object);
1550 g_mutex_lock (&skeleton->priv->lock);
1551 if (skeleton->priv->changed_properties != NULL &&
1552 skeleton->priv->changed_properties_idle_source == NULL)
1553 {
1554 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
1555 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
1556 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _occ_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylak2cb27752015-10-19 16:23:14 -05001557 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _occ_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -05001558 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
1559 g_source_unref (skeleton->priv->changed_properties_idle_source);
1560 }
1561 g_mutex_unlock (&skeleton->priv->lock);
1562}
1563
1564static void
1565occ_skeleton_set_property (GObject *object,
1566 guint prop_id,
1567 const GValue *value,
1568 GParamSpec *pspec)
1569{
1570 OccSkeleton *skeleton = OCC_SKELETON (object);
Norman James2d1ee892015-09-16 23:13:45 -05001571 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -05001572 g_mutex_lock (&skeleton->priv->lock);
1573 g_object_freeze_notify (object);
1574 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
1575 {
1576 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
1577 _occ_schedule_emit_changed (skeleton, _occ_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
1578 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
1579 g_object_notify_by_pspec (object, pspec);
1580 }
1581 g_mutex_unlock (&skeleton->priv->lock);
1582 g_object_thaw_notify (object);
1583}
1584
1585static void
1586occ_skeleton_init (OccSkeleton *skeleton)
1587{
1588#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1589 skeleton->priv = occ_skeleton_get_instance_private (skeleton);
1590#else
1591 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_OCC_SKELETON, OccSkeletonPrivate);
1592#endif
1593
1594 g_mutex_init (&skeleton->priv->lock);
1595 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James2d1ee892015-09-16 23:13:45 -05001596 skeleton->priv->properties = g_new0 (GValue, 3);
Norman James362a80f2015-09-14 14:04:39 -05001597 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
Norman James2d1ee892015-09-16 23:13:45 -05001598 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
1599 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
Norman James362a80f2015-09-14 14:04:39 -05001600}
1601
1602static const gchar *
1603occ_skeleton_get_state (Occ *object)
1604{
1605 OccSkeleton *skeleton = OCC_SKELETON (object);
1606 const gchar *value;
1607 g_mutex_lock (&skeleton->priv->lock);
1608 value = g_value_get_string (&(skeleton->priv->properties[0]));
1609 g_mutex_unlock (&skeleton->priv->lock);
1610 return value;
1611}
1612
Norman James2d1ee892015-09-16 23:13:45 -05001613static const gchar *
1614occ_skeleton_get_instance_name (Occ *object)
1615{
1616 OccSkeleton *skeleton = OCC_SKELETON (object);
1617 const gchar *value;
1618 g_mutex_lock (&skeleton->priv->lock);
1619 value = g_value_get_string (&(skeleton->priv->properties[1]));
1620 g_mutex_unlock (&skeleton->priv->lock);
1621 return value;
1622}
1623
Norman James362a80f2015-09-14 14:04:39 -05001624static gint
1625occ_skeleton_get_poll_interval (Occ *object)
1626{
1627 OccSkeleton *skeleton = OCC_SKELETON (object);
1628 gint value;
1629 g_mutex_lock (&skeleton->priv->lock);
Norman James2d1ee892015-09-16 23:13:45 -05001630 value = g_value_get_int (&(skeleton->priv->properties[2]));
Norman James362a80f2015-09-14 14:04:39 -05001631 g_mutex_unlock (&skeleton->priv->lock);
1632 return value;
1633}
1634
1635static void
1636occ_skeleton_class_init (OccSkeletonClass *klass)
1637{
1638 GObjectClass *gobject_class;
1639 GDBusInterfaceSkeletonClass *skeleton_class;
1640
1641 gobject_class = G_OBJECT_CLASS (klass);
1642 gobject_class->finalize = occ_skeleton_finalize;
1643 gobject_class->get_property = occ_skeleton_get_property;
1644 gobject_class->set_property = occ_skeleton_set_property;
1645 gobject_class->notify = occ_skeleton_notify;
1646
1647
1648 occ_override_properties (gobject_class, 1);
1649
1650 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
1651 skeleton_class->get_info = occ_skeleton_dbus_interface_get_info;
1652 skeleton_class->get_properties = occ_skeleton_dbus_interface_get_properties;
1653 skeleton_class->flush = occ_skeleton_dbus_interface_flush;
1654 skeleton_class->get_vtable = occ_skeleton_dbus_interface_get_vtable;
1655
1656#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1657 g_type_class_add_private (klass, sizeof (OccSkeletonPrivate));
1658#endif
1659}
1660
1661static void
1662occ_skeleton_iface_init (OccIface *iface)
1663{
1664 iface->get_state = occ_skeleton_get_state;
Norman James2d1ee892015-09-16 23:13:45 -05001665 iface->get_instance_name = occ_skeleton_get_instance_name;
Norman James362a80f2015-09-14 14:04:39 -05001666 iface->get_poll_interval = occ_skeleton_get_poll_interval;
1667}
1668
1669/**
1670 * occ_skeleton_new:
1671 *
1672 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>.
1673 *
1674 * Returns: (transfer full) (type OccSkeleton): The skeleton object.
1675 */
1676Occ *
1677occ_skeleton_new (void)
1678{
1679 return OCC (g_object_new (TYPE_OCC_SKELETON, NULL));
1680}
1681
1682/* ------------------------------------------------------------------------
Adriana Kobylaka153aaa2015-10-19 16:29:12 -05001683=======
1684>>>>>>> upstream/master
Norman James362a80f2015-09-14 14:04:39 -05001685 * Code for interface org.openbmc.Fan
1686 * ------------------------------------------------------------------------
1687 */
1688
1689/**
1690 * SECTION:Fan
1691 * @title: Fan
1692 * @short_description: Generated C code for the org.openbmc.Fan D-Bus interface
1693 *
1694 * 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.
1695 */
1696
1697/* ---- Introspection data for org.openbmc.Fan ---- */
1698
1699static const _ExtendedGDBusArgInfo _fan_method_info_set_cooling_zone_IN_ARG_cooling_zone =
1700{
1701 {
1702 -1,
1703 (gchar *) "cooling_zone",
1704 (gchar *) "i",
1705 NULL
1706 },
1707 FALSE
1708};
1709
1710static const _ExtendedGDBusArgInfo * const _fan_method_info_set_cooling_zone_IN_ARG_pointers[] =
1711{
1712 &_fan_method_info_set_cooling_zone_IN_ARG_cooling_zone,
1713 NULL
1714};
1715
1716static const _ExtendedGDBusMethodInfo _fan_method_info_set_cooling_zone =
1717{
1718 {
1719 -1,
1720 (gchar *) "setCoolingZone",
1721 (GDBusArgInfo **) &_fan_method_info_set_cooling_zone_IN_ARG_pointers,
1722 NULL,
1723 NULL
1724 },
1725 "handle-set-cooling-zone",
1726 FALSE
1727};
1728
1729static const _ExtendedGDBusArgInfo _fan_method_info_get_speed_OUT_ARG_speed =
1730{
1731 {
1732 -1,
1733 (gchar *) "speed",
1734 (gchar *) "i",
1735 NULL
1736 },
1737 FALSE
1738};
1739
1740static const _ExtendedGDBusArgInfo * const _fan_method_info_get_speed_OUT_ARG_pointers[] =
1741{
1742 &_fan_method_info_get_speed_OUT_ARG_speed,
1743 NULL
1744};
1745
1746static const _ExtendedGDBusMethodInfo _fan_method_info_get_speed =
1747{
1748 {
1749 -1,
1750 (gchar *) "getSpeed",
1751 NULL,
1752 (GDBusArgInfo **) &_fan_method_info_get_speed_OUT_ARG_pointers,
1753 NULL
1754 },
1755 "handle-get-speed",
1756 FALSE
1757};
1758
1759static const _ExtendedGDBusArgInfo _fan_method_info_set_speed_IN_ARG_speed =
1760{
1761 {
1762 -1,
1763 (gchar *) "speed",
1764 (gchar *) "i",
1765 NULL
1766 },
1767 FALSE
1768};
1769
1770static const _ExtendedGDBusArgInfo * const _fan_method_info_set_speed_IN_ARG_pointers[] =
1771{
1772 &_fan_method_info_set_speed_IN_ARG_speed,
1773 NULL
1774};
1775
1776static const _ExtendedGDBusMethodInfo _fan_method_info_set_speed =
1777{
1778 {
1779 -1,
1780 (gchar *) "setSpeed",
1781 (GDBusArgInfo **) &_fan_method_info_set_speed_IN_ARG_pointers,
1782 NULL,
1783 NULL
1784 },
1785 "handle-set-speed",
1786 FALSE
1787};
1788
1789static const _ExtendedGDBusMethodInfo * const _fan_method_info_pointers[] =
1790{
1791 &_fan_method_info_set_cooling_zone,
1792 &_fan_method_info_get_speed,
1793 &_fan_method_info_set_speed,
1794 NULL
1795};
1796
1797static const _ExtendedGDBusArgInfo _fan_signal_info_speed_changed_ARG_speed =
1798{
1799 {
1800 -1,
1801 (gchar *) "speed",
1802 (gchar *) "i",
1803 NULL
1804 },
1805 FALSE
1806};
1807
1808static const _ExtendedGDBusArgInfo * const _fan_signal_info_speed_changed_ARG_pointers[] =
1809{
1810 &_fan_signal_info_speed_changed_ARG_speed,
1811 NULL
1812};
1813
1814static const _ExtendedGDBusSignalInfo _fan_signal_info_speed_changed =
1815{
1816 {
1817 -1,
1818 (gchar *) "SpeedChanged",
1819 (GDBusArgInfo **) &_fan_signal_info_speed_changed_ARG_pointers,
1820 NULL
1821 },
1822 "speed-changed"
1823};
1824
1825static const _ExtendedGDBusSignalInfo _fan_signal_info_tach_error =
1826{
1827 {
1828 -1,
1829 (gchar *) "TachError",
1830 NULL,
1831 NULL
1832 },
1833 "tach-error"
1834};
1835
1836static const _ExtendedGDBusSignalInfo * const _fan_signal_info_pointers[] =
1837{
1838 &_fan_signal_info_speed_changed,
1839 &_fan_signal_info_tach_error,
1840 NULL
1841};
1842
1843static const _ExtendedGDBusPropertyInfo _fan_property_info_speed =
1844{
1845 {
1846 -1,
1847 (gchar *) "speed",
1848 (gchar *) "i",
1849 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
1850 NULL
1851 },
1852 "speed",
1853 FALSE
1854};
1855
1856static const _ExtendedGDBusPropertyInfo _fan_property_info_cooling_zone =
1857{
1858 {
1859 -1,
1860 (gchar *) "cooling_zone",
1861 (gchar *) "i",
1862 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
1863 NULL
1864 },
1865 "cooling-zone",
1866 FALSE
1867};
1868
1869static const _ExtendedGDBusPropertyInfo _fan_property_info_pwm_num =
1870{
1871 {
1872 -1,
1873 (gchar *) "pwm_num",
1874 (gchar *) "i",
1875 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
1876 NULL
1877 },
1878 "pwm-num",
1879 FALSE
1880};
1881
1882static const _ExtendedGDBusPropertyInfo * const _fan_property_info_pointers[] =
1883{
1884 &_fan_property_info_speed,
1885 &_fan_property_info_cooling_zone,
1886 &_fan_property_info_pwm_num,
1887 NULL
1888};
1889
1890static const _ExtendedGDBusInterfaceInfo _fan_interface_info =
1891{
1892 {
1893 -1,
1894 (gchar *) "org.openbmc.Fan",
1895 (GDBusMethodInfo **) &_fan_method_info_pointers,
1896 (GDBusSignalInfo **) &_fan_signal_info_pointers,
1897 (GDBusPropertyInfo **) &_fan_property_info_pointers,
1898 NULL
1899 },
1900 "fan",
1901};
1902
1903
1904/**
1905 * fan_interface_info:
1906 *
1907 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> D-Bus interface.
1908 *
1909 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
1910 */
1911GDBusInterfaceInfo *
1912fan_interface_info (void)
1913{
1914 return (GDBusInterfaceInfo *) &_fan_interface_info.parent_struct;
1915}
1916
1917/**
1918 * fan_override_properties:
1919 * @klass: The class structure for a #GObject<!-- -->-derived class.
1920 * @property_id_begin: The property id to assign to the first overridden property.
1921 *
1922 * Overrides all #GObject properties in the #Fan interface for a concrete class.
1923 * The properties are overridden in the order they are defined.
1924 *
1925 * Returns: The last property id.
1926 */
1927guint
1928fan_override_properties (GObjectClass *klass, guint property_id_begin)
1929{
1930 g_object_class_override_property (klass, property_id_begin++, "speed");
1931 g_object_class_override_property (klass, property_id_begin++, "cooling-zone");
1932 g_object_class_override_property (klass, property_id_begin++, "pwm-num");
1933 return property_id_begin - 1;
1934}
1935
1936
1937
1938/**
1939 * Fan:
1940 *
1941 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
1942 */
1943
1944/**
1945 * FanIface:
1946 * @parent_iface: The parent interface.
1947 * @handle_get_speed: Handler for the #Fan::handle-get-speed signal.
1948 * @handle_set_cooling_zone: Handler for the #Fan::handle-set-cooling-zone signal.
1949 * @handle_set_speed: Handler for the #Fan::handle-set-speed signal.
1950 * @get_cooling_zone: Getter for the #Fan:cooling-zone property.
1951 * @get_pwm_num: Getter for the #Fan:pwm-num property.
1952 * @get_speed: Getter for the #Fan:speed property.
1953 * @speed_changed: Handler for the #Fan::speed-changed signal.
1954 * @tach_error: Handler for the #Fan::tach-error signal.
1955 *
1956 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
1957 */
1958
1959typedef FanIface FanInterface;
1960G_DEFINE_INTERFACE (Fan, fan, G_TYPE_OBJECT);
1961
1962static void
1963fan_default_init (FanIface *iface)
1964{
1965 /* GObject signals for incoming D-Bus method calls: */
1966 /**
1967 * Fan::handle-set-cooling-zone:
1968 * @object: A #Fan.
1969 * @invocation: A #GDBusMethodInvocation.
1970 * @arg_cooling_zone: Argument passed by remote caller.
1971 *
1972 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method.
1973 *
1974 * 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.
1975 *
1976 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
1977 */
1978 g_signal_new ("handle-set-cooling-zone",
1979 G_TYPE_FROM_INTERFACE (iface),
1980 G_SIGNAL_RUN_LAST,
1981 G_STRUCT_OFFSET (FanIface, handle_set_cooling_zone),
1982 g_signal_accumulator_true_handled,
1983 NULL,
1984 g_cclosure_marshal_generic,
1985 G_TYPE_BOOLEAN,
1986 2,
1987 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
1988
1989 /**
1990 * Fan::handle-get-speed:
1991 * @object: A #Fan.
1992 * @invocation: A #GDBusMethodInvocation.
1993 *
1994 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method.
1995 *
1996 * 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.
1997 *
1998 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
1999 */
2000 g_signal_new ("handle-get-speed",
2001 G_TYPE_FROM_INTERFACE (iface),
2002 G_SIGNAL_RUN_LAST,
2003 G_STRUCT_OFFSET (FanIface, handle_get_speed),
2004 g_signal_accumulator_true_handled,
2005 NULL,
2006 g_cclosure_marshal_generic,
2007 G_TYPE_BOOLEAN,
2008 1,
2009 G_TYPE_DBUS_METHOD_INVOCATION);
2010
2011 /**
2012 * Fan::handle-set-speed:
2013 * @object: A #Fan.
2014 * @invocation: A #GDBusMethodInvocation.
2015 * @arg_speed: Argument passed by remote caller.
2016 *
2017 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method.
2018 *
2019 * 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.
2020 *
2021 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
2022 */
2023 g_signal_new ("handle-set-speed",
2024 G_TYPE_FROM_INTERFACE (iface),
2025 G_SIGNAL_RUN_LAST,
2026 G_STRUCT_OFFSET (FanIface, handle_set_speed),
2027 g_signal_accumulator_true_handled,
2028 NULL,
2029 g_cclosure_marshal_generic,
2030 G_TYPE_BOOLEAN,
2031 2,
2032 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
2033
2034 /* GObject signals for received D-Bus signals: */
2035 /**
2036 * Fan::speed-changed:
2037 * @object: A #Fan.
2038 * @arg_speed: Argument.
2039 *
2040 * 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.
2041 *
2042 * 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.
2043 */
2044 g_signal_new ("speed-changed",
2045 G_TYPE_FROM_INTERFACE (iface),
2046 G_SIGNAL_RUN_LAST,
2047 G_STRUCT_OFFSET (FanIface, speed_changed),
2048 NULL,
2049 NULL,
2050 g_cclosure_marshal_generic,
2051 G_TYPE_NONE,
2052 1, G_TYPE_INT);
2053
2054 /**
2055 * Fan::tach-error:
2056 * @object: A #Fan.
2057 *
2058 * 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.
2059 *
2060 * 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.
2061 */
2062 g_signal_new ("tach-error",
2063 G_TYPE_FROM_INTERFACE (iface),
2064 G_SIGNAL_RUN_LAST,
2065 G_STRUCT_OFFSET (FanIface, tach_error),
2066 NULL,
2067 NULL,
2068 g_cclosure_marshal_generic,
2069 G_TYPE_NONE,
2070 0);
2071
2072 /* GObject properties for D-Bus properties: */
2073 /**
2074 * Fan:speed:
2075 *
2076 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link>.
2077 *
2078 * 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.
2079 */
2080 g_object_interface_install_property (iface,
2081 g_param_spec_int ("speed", "speed", "speed", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2082 /**
2083 * Fan:cooling-zone:
2084 *
2085 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link>.
2086 *
2087 * 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.
2088 */
2089 g_object_interface_install_property (iface,
2090 g_param_spec_int ("cooling-zone", "cooling_zone", "cooling_zone", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2091 /**
2092 * Fan:pwm-num:
2093 *
2094 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link>.
2095 *
2096 * 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.
2097 */
2098 g_object_interface_install_property (iface,
2099 g_param_spec_int ("pwm-num", "pwm_num", "pwm_num", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2100}
2101
2102/**
2103 * fan_get_speed: (skip)
2104 * @object: A #Fan.
2105 *
2106 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property.
2107 *
2108 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2109 *
2110 * Returns: The property value.
2111 */
2112gint
2113fan_get_speed (Fan *object)
2114{
2115 return FAN_GET_IFACE (object)->get_speed (object);
2116}
2117
2118/**
2119 * fan_set_speed: (skip)
2120 * @object: A #Fan.
2121 * @value: The value to set.
2122 *
2123 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property to @value.
2124 *
2125 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2126 */
2127void
2128fan_set_speed (Fan *object, gint value)
2129{
2130 g_object_set (G_OBJECT (object), "speed", value, NULL);
2131}
2132
2133/**
2134 * fan_get_cooling_zone: (skip)
2135 * @object: A #Fan.
2136 *
2137 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property.
2138 *
2139 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2140 *
2141 * Returns: The property value.
2142 */
2143gint
2144fan_get_cooling_zone (Fan *object)
2145{
2146 return FAN_GET_IFACE (object)->get_cooling_zone (object);
2147}
2148
2149/**
2150 * fan_set_cooling_zone: (skip)
2151 * @object: A #Fan.
2152 * @value: The value to set.
2153 *
2154 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property to @value.
2155 *
2156 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2157 */
2158void
2159fan_set_cooling_zone (Fan *object, gint value)
2160{
2161 g_object_set (G_OBJECT (object), "cooling-zone", value, NULL);
2162}
2163
2164/**
2165 * fan_get_pwm_num: (skip)
2166 * @object: A #Fan.
2167 *
2168 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property.
2169 *
2170 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2171 *
2172 * Returns: The property value.
2173 */
2174gint
2175fan_get_pwm_num (Fan *object)
2176{
2177 return FAN_GET_IFACE (object)->get_pwm_num (object);
2178}
2179
2180/**
2181 * fan_set_pwm_num: (skip)
2182 * @object: A #Fan.
2183 * @value: The value to set.
2184 *
2185 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property to @value.
2186 *
2187 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2188 */
2189void
2190fan_set_pwm_num (Fan *object, gint value)
2191{
2192 g_object_set (G_OBJECT (object), "pwm-num", value, NULL);
2193}
2194
2195/**
2196 * fan_emit_speed_changed:
2197 * @object: A #Fan.
2198 * @arg_speed: Argument to pass with the signal.
2199 *
2200 * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.SpeedChanged">"SpeedChanged"</link> D-Bus signal.
2201 */
2202void
2203fan_emit_speed_changed (
2204 Fan *object,
2205 gint arg_speed)
2206{
2207 g_signal_emit_by_name (object, "speed-changed", arg_speed);
2208}
2209
2210/**
2211 * fan_emit_tach_error:
2212 * @object: A #Fan.
2213 *
2214 * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.TachError">"TachError"</link> D-Bus signal.
2215 */
2216void
2217fan_emit_tach_error (
2218 Fan *object)
2219{
2220 g_signal_emit_by_name (object, "tach-error");
2221}
2222
2223/**
2224 * fan_call_set_cooling_zone:
2225 * @proxy: A #FanProxy.
2226 * @arg_cooling_zone: Argument to pass with the method invocation.
2227 * @cancellable: (allow-none): A #GCancellable or %NULL.
2228 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2229 * @user_data: User data to pass to @callback.
2230 *
2231 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method on @proxy.
2232 * 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.
2233 * You can then call fan_call_set_cooling_zone_finish() to get the result of the operation.
2234 *
2235 * See fan_call_set_cooling_zone_sync() for the synchronous, blocking version of this method.
2236 */
2237void
2238fan_call_set_cooling_zone (
2239 Fan *proxy,
2240 gint arg_cooling_zone,
2241 GCancellable *cancellable,
2242 GAsyncReadyCallback callback,
2243 gpointer user_data)
2244{
2245 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2246 "setCoolingZone",
2247 g_variant_new ("(i)",
2248 arg_cooling_zone),
2249 G_DBUS_CALL_FLAGS_NONE,
2250 -1,
2251 cancellable,
2252 callback,
2253 user_data);
2254}
2255
2256/**
2257 * fan_call_set_cooling_zone_finish:
2258 * @proxy: A #FanProxy.
2259 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_cooling_zone().
2260 * @error: Return location for error or %NULL.
2261 *
2262 * Finishes an operation started with fan_call_set_cooling_zone().
2263 *
2264 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2265 */
2266gboolean
2267fan_call_set_cooling_zone_finish (
2268 Fan *proxy,
2269 GAsyncResult *res,
2270 GError **error)
2271{
2272 GVariant *_ret;
2273 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2274 if (_ret == NULL)
2275 goto _out;
2276 g_variant_get (_ret,
2277 "()");
2278 g_variant_unref (_ret);
2279_out:
2280 return _ret != NULL;
2281}
2282
2283/**
2284 * fan_call_set_cooling_zone_sync:
2285 * @proxy: A #FanProxy.
2286 * @arg_cooling_zone: Argument to pass with the method invocation.
2287 * @cancellable: (allow-none): A #GCancellable or %NULL.
2288 * @error: Return location for error or %NULL.
2289 *
2290 * 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.
2291 *
2292 * See fan_call_set_cooling_zone() for the asynchronous version of this method.
2293 *
2294 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2295 */
2296gboolean
2297fan_call_set_cooling_zone_sync (
2298 Fan *proxy,
2299 gint arg_cooling_zone,
2300 GCancellable *cancellable,
2301 GError **error)
2302{
2303 GVariant *_ret;
2304 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2305 "setCoolingZone",
2306 g_variant_new ("(i)",
2307 arg_cooling_zone),
2308 G_DBUS_CALL_FLAGS_NONE,
2309 -1,
2310 cancellable,
2311 error);
2312 if (_ret == NULL)
2313 goto _out;
2314 g_variant_get (_ret,
2315 "()");
2316 g_variant_unref (_ret);
2317_out:
2318 return _ret != NULL;
2319}
2320
2321/**
2322 * fan_call_get_speed:
2323 * @proxy: A #FanProxy.
2324 * @cancellable: (allow-none): A #GCancellable or %NULL.
2325 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2326 * @user_data: User data to pass to @callback.
2327 *
2328 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method on @proxy.
2329 * 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.
2330 * You can then call fan_call_get_speed_finish() to get the result of the operation.
2331 *
2332 * See fan_call_get_speed_sync() for the synchronous, blocking version of this method.
2333 */
2334void
2335fan_call_get_speed (
2336 Fan *proxy,
2337 GCancellable *cancellable,
2338 GAsyncReadyCallback callback,
2339 gpointer user_data)
2340{
2341 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2342 "getSpeed",
2343 g_variant_new ("()"),
2344 G_DBUS_CALL_FLAGS_NONE,
2345 -1,
2346 cancellable,
2347 callback,
2348 user_data);
2349}
2350
2351/**
2352 * fan_call_get_speed_finish:
2353 * @proxy: A #FanProxy.
2354 * @out_speed: (out): Return location for return parameter or %NULL to ignore.
2355 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_get_speed().
2356 * @error: Return location for error or %NULL.
2357 *
2358 * Finishes an operation started with fan_call_get_speed().
2359 *
2360 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2361 */
2362gboolean
2363fan_call_get_speed_finish (
2364 Fan *proxy,
2365 gint *out_speed,
2366 GAsyncResult *res,
2367 GError **error)
2368{
2369 GVariant *_ret;
2370 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2371 if (_ret == NULL)
2372 goto _out;
2373 g_variant_get (_ret,
2374 "(i)",
2375 out_speed);
2376 g_variant_unref (_ret);
2377_out:
2378 return _ret != NULL;
2379}
2380
2381/**
2382 * fan_call_get_speed_sync:
2383 * @proxy: A #FanProxy.
2384 * @out_speed: (out): Return location for return parameter or %NULL to ignore.
2385 * @cancellable: (allow-none): A #GCancellable or %NULL.
2386 * @error: Return location for error or %NULL.
2387 *
2388 * 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.
2389 *
2390 * See fan_call_get_speed() for the asynchronous version of this method.
2391 *
2392 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2393 */
2394gboolean
2395fan_call_get_speed_sync (
2396 Fan *proxy,
2397 gint *out_speed,
2398 GCancellable *cancellable,
2399 GError **error)
2400{
2401 GVariant *_ret;
2402 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2403 "getSpeed",
2404 g_variant_new ("()"),
2405 G_DBUS_CALL_FLAGS_NONE,
2406 -1,
2407 cancellable,
2408 error);
2409 if (_ret == NULL)
2410 goto _out;
2411 g_variant_get (_ret,
2412 "(i)",
2413 out_speed);
2414 g_variant_unref (_ret);
2415_out:
2416 return _ret != NULL;
2417}
2418
2419/**
2420 * fan_call_set_speed:
2421 * @proxy: A #FanProxy.
2422 * @arg_speed: Argument to pass with the method invocation.
2423 * @cancellable: (allow-none): A #GCancellable or %NULL.
2424 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2425 * @user_data: User data to pass to @callback.
2426 *
2427 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method on @proxy.
2428 * 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.
2429 * You can then call fan_call_set_speed_finish() to get the result of the operation.
2430 *
2431 * See fan_call_set_speed_sync() for the synchronous, blocking version of this method.
2432 */
2433void
2434fan_call_set_speed (
2435 Fan *proxy,
2436 gint arg_speed,
2437 GCancellable *cancellable,
2438 GAsyncReadyCallback callback,
2439 gpointer user_data)
2440{
2441 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2442 "setSpeed",
2443 g_variant_new ("(i)",
2444 arg_speed),
2445 G_DBUS_CALL_FLAGS_NONE,
2446 -1,
2447 cancellable,
2448 callback,
2449 user_data);
2450}
2451
2452/**
2453 * fan_call_set_speed_finish:
2454 * @proxy: A #FanProxy.
2455 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_speed().
2456 * @error: Return location for error or %NULL.
2457 *
2458 * Finishes an operation started with fan_call_set_speed().
2459 *
2460 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2461 */
2462gboolean
2463fan_call_set_speed_finish (
2464 Fan *proxy,
2465 GAsyncResult *res,
2466 GError **error)
2467{
2468 GVariant *_ret;
2469 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2470 if (_ret == NULL)
2471 goto _out;
2472 g_variant_get (_ret,
2473 "()");
2474 g_variant_unref (_ret);
2475_out:
2476 return _ret != NULL;
2477}
2478
2479/**
2480 * fan_call_set_speed_sync:
2481 * @proxy: A #FanProxy.
2482 * @arg_speed: Argument to pass with the method invocation.
2483 * @cancellable: (allow-none): A #GCancellable or %NULL.
2484 * @error: Return location for error or %NULL.
2485 *
2486 * 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.
2487 *
2488 * See fan_call_set_speed() for the asynchronous version of this method.
2489 *
2490 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2491 */
2492gboolean
2493fan_call_set_speed_sync (
2494 Fan *proxy,
2495 gint arg_speed,
2496 GCancellable *cancellable,
2497 GError **error)
2498{
2499 GVariant *_ret;
2500 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2501 "setSpeed",
2502 g_variant_new ("(i)",
2503 arg_speed),
2504 G_DBUS_CALL_FLAGS_NONE,
2505 -1,
2506 cancellable,
2507 error);
2508 if (_ret == NULL)
2509 goto _out;
2510 g_variant_get (_ret,
2511 "()");
2512 g_variant_unref (_ret);
2513_out:
2514 return _ret != NULL;
2515}
2516
2517/**
2518 * fan_complete_set_cooling_zone:
2519 * @object: A #Fan.
2520 * @invocation: (transfer full): A #GDBusMethodInvocation.
2521 *
2522 * 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.
2523 *
2524 * This method will free @invocation, you cannot use it afterwards.
2525 */
2526void
2527fan_complete_set_cooling_zone (
2528 Fan *object,
2529 GDBusMethodInvocation *invocation)
2530{
2531 g_dbus_method_invocation_return_value (invocation,
2532 g_variant_new ("()"));
2533}
2534
2535/**
2536 * fan_complete_get_speed:
2537 * @object: A #Fan.
2538 * @invocation: (transfer full): A #GDBusMethodInvocation.
2539 * @speed: Parameter to return.
2540 *
2541 * 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.
2542 *
2543 * This method will free @invocation, you cannot use it afterwards.
2544 */
2545void
2546fan_complete_get_speed (
2547 Fan *object,
2548 GDBusMethodInvocation *invocation,
2549 gint speed)
2550{
2551 g_dbus_method_invocation_return_value (invocation,
2552 g_variant_new ("(i)",
2553 speed));
2554}
2555
2556/**
2557 * fan_complete_set_speed:
2558 * @object: A #Fan.
2559 * @invocation: (transfer full): A #GDBusMethodInvocation.
2560 *
2561 * 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.
2562 *
2563 * This method will free @invocation, you cannot use it afterwards.
2564 */
2565void
2566fan_complete_set_speed (
2567 Fan *object,
2568 GDBusMethodInvocation *invocation)
2569{
2570 g_dbus_method_invocation_return_value (invocation,
2571 g_variant_new ("()"));
2572}
2573
2574/* ------------------------------------------------------------------------ */
2575
2576/**
2577 * FanProxy:
2578 *
2579 * The #FanProxy structure contains only private data and should only be accessed using the provided API.
2580 */
2581
2582/**
2583 * FanProxyClass:
2584 * @parent_class: The parent class.
2585 *
2586 * Class structure for #FanProxy.
2587 */
2588
2589struct _FanProxyPrivate
2590{
2591 GData *qdata;
2592};
2593
2594static void fan_proxy_iface_init (FanIface *iface);
2595
2596#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2597G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY,
2598 G_ADD_PRIVATE (FanProxy)
2599 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init));
2600
2601#else
2602G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY,
2603 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init));
2604
2605#endif
2606static void
2607fan_proxy_finalize (GObject *object)
2608{
2609 FanProxy *proxy = FAN_PROXY (object);
2610 g_datalist_clear (&proxy->priv->qdata);
2611 G_OBJECT_CLASS (fan_proxy_parent_class)->finalize (object);
2612}
2613
2614static void
2615fan_proxy_get_property (GObject *object,
2616 guint prop_id,
2617 GValue *value,
2618 GParamSpec *pspec G_GNUC_UNUSED)
2619{
2620 const _ExtendedGDBusPropertyInfo *info;
2621 GVariant *variant;
2622 g_assert (prop_id != 0 && prop_id - 1 < 3);
2623 info = _fan_property_info_pointers[prop_id - 1];
2624 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
2625 if (info->use_gvariant)
2626 {
2627 g_value_set_variant (value, variant);
2628 }
2629 else
2630 {
2631 if (variant != NULL)
2632 g_dbus_gvariant_to_gvalue (variant, value);
2633 }
2634 if (variant != NULL)
2635 g_variant_unref (variant);
2636}
2637
2638static void
2639fan_proxy_set_property_cb (GDBusProxy *proxy,
2640 GAsyncResult *res,
2641 gpointer user_data)
2642{
2643 const _ExtendedGDBusPropertyInfo *info = user_data;
2644 GError *error;
2645 GVariant *_ret;
2646 error = NULL;
2647 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
2648 if (!_ret)
2649 {
2650 g_warning ("Error setting property '%s' on interface org.openbmc.Fan: %s (%s, %d)",
2651 info->parent_struct.name,
2652 error->message, g_quark_to_string (error->domain), error->code);
2653 g_error_free (error);
2654 }
2655 else
2656 {
2657 g_variant_unref (_ret);
2658 }
2659}
2660
2661static void
2662fan_proxy_set_property (GObject *object,
2663 guint prop_id,
2664 const GValue *value,
2665 GParamSpec *pspec G_GNUC_UNUSED)
2666{
2667 const _ExtendedGDBusPropertyInfo *info;
2668 GVariant *variant;
2669 g_assert (prop_id != 0 && prop_id - 1 < 3);
2670 info = _fan_property_info_pointers[prop_id - 1];
2671 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
2672 g_dbus_proxy_call (G_DBUS_PROXY (object),
2673 "org.freedesktop.DBus.Properties.Set",
2674 g_variant_new ("(ssv)", "org.openbmc.Fan", info->parent_struct.name, variant),
2675 G_DBUS_CALL_FLAGS_NONE,
2676 -1,
2677 NULL, (GAsyncReadyCallback) fan_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
2678 g_variant_unref (variant);
2679}
2680
2681static void
2682fan_proxy_g_signal (GDBusProxy *proxy,
2683 const gchar *sender_name G_GNUC_UNUSED,
2684 const gchar *signal_name,
2685 GVariant *parameters)
2686{
2687 _ExtendedGDBusSignalInfo *info;
2688 GVariantIter iter;
2689 GVariant *child;
2690 GValue *paramv;
2691 guint num_params;
2692 guint n;
2693 guint signal_id;
2694 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, signal_name);
2695 if (info == NULL)
2696 return;
2697 num_params = g_variant_n_children (parameters);
2698 paramv = g_new0 (GValue, num_params + 1);
2699 g_value_init (&paramv[0], TYPE_FAN);
2700 g_value_set_object (&paramv[0], proxy);
2701 g_variant_iter_init (&iter, parameters);
2702 n = 1;
2703 while ((child = g_variant_iter_next_value (&iter)) != NULL)
2704 {
2705 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
2706 if (arg_info->use_gvariant)
2707 {
2708 g_value_init (&paramv[n], G_TYPE_VARIANT);
2709 g_value_set_variant (&paramv[n], child);
2710 n++;
2711 }
2712 else
2713 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
2714 g_variant_unref (child);
2715 }
2716 signal_id = g_signal_lookup (info->signal_name, TYPE_FAN);
2717 g_signal_emitv (paramv, signal_id, 0, NULL);
2718 for (n = 0; n < num_params + 1; n++)
2719 g_value_unset (&paramv[n]);
2720 g_free (paramv);
2721}
2722
2723static void
2724fan_proxy_g_properties_changed (GDBusProxy *_proxy,
2725 GVariant *changed_properties,
2726 const gchar *const *invalidated_properties)
2727{
2728 FanProxy *proxy = FAN_PROXY (_proxy);
2729 guint n;
2730 const gchar *key;
2731 GVariantIter *iter;
2732 _ExtendedGDBusPropertyInfo *info;
2733 g_variant_get (changed_properties, "a{sv}", &iter);
2734 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
2735 {
2736 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, key);
2737 g_datalist_remove_data (&proxy->priv->qdata, key);
2738 if (info != NULL)
2739 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
2740 }
2741 g_variant_iter_free (iter);
2742 for (n = 0; invalidated_properties[n] != NULL; n++)
2743 {
2744 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, invalidated_properties[n]);
2745 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
2746 if (info != NULL)
2747 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
2748 }
2749}
2750
2751static gint
2752fan_proxy_get_speed (Fan *object)
2753{
2754 FanProxy *proxy = FAN_PROXY (object);
2755 GVariant *variant;
2756 gint value = 0;
2757 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "speed");
2758 if (variant != NULL)
2759 {
2760 value = g_variant_get_int32 (variant);
2761 g_variant_unref (variant);
2762 }
2763 return value;
2764}
2765
2766static gint
2767fan_proxy_get_cooling_zone (Fan *object)
2768{
2769 FanProxy *proxy = FAN_PROXY (object);
2770 GVariant *variant;
2771 gint value = 0;
2772 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "cooling_zone");
2773 if (variant != NULL)
2774 {
2775 value = g_variant_get_int32 (variant);
2776 g_variant_unref (variant);
2777 }
2778 return value;
2779}
2780
2781static gint
2782fan_proxy_get_pwm_num (Fan *object)
2783{
2784 FanProxy *proxy = FAN_PROXY (object);
2785 GVariant *variant;
2786 gint value = 0;
2787 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pwm_num");
2788 if (variant != NULL)
2789 {
2790 value = g_variant_get_int32 (variant);
2791 g_variant_unref (variant);
2792 }
2793 return value;
2794}
2795
2796static void
2797fan_proxy_init (FanProxy *proxy)
2798{
2799#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2800 proxy->priv = fan_proxy_get_instance_private (proxy);
2801#else
2802 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FAN_PROXY, FanProxyPrivate);
2803#endif
2804
2805 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), fan_interface_info ());
2806}
2807
2808static void
2809fan_proxy_class_init (FanProxyClass *klass)
2810{
2811 GObjectClass *gobject_class;
2812 GDBusProxyClass *proxy_class;
2813
2814 gobject_class = G_OBJECT_CLASS (klass);
2815 gobject_class->finalize = fan_proxy_finalize;
2816 gobject_class->get_property = fan_proxy_get_property;
2817 gobject_class->set_property = fan_proxy_set_property;
2818
2819 proxy_class = G_DBUS_PROXY_CLASS (klass);
2820 proxy_class->g_signal = fan_proxy_g_signal;
2821 proxy_class->g_properties_changed = fan_proxy_g_properties_changed;
2822
2823 fan_override_properties (gobject_class, 1);
2824
2825#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
2826 g_type_class_add_private (klass, sizeof (FanProxyPrivate));
2827#endif
2828}
2829
2830static void
2831fan_proxy_iface_init (FanIface *iface)
2832{
2833 iface->get_speed = fan_proxy_get_speed;
2834 iface->get_cooling_zone = fan_proxy_get_cooling_zone;
2835 iface->get_pwm_num = fan_proxy_get_pwm_num;
2836}
2837
2838/**
2839 * fan_proxy_new:
2840 * @connection: A #GDBusConnection.
2841 * @flags: Flags from the #GDBusProxyFlags enumeration.
2842 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
2843 * @object_path: An object path.
2844 * @cancellable: (allow-none): A #GCancellable or %NULL.
2845 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
2846 * @user_data: User data to pass to @callback.
2847 *
2848 * 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.
2849 *
2850 * 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.
2851 * You can then call fan_proxy_new_finish() to get the result of the operation.
2852 *
2853 * See fan_proxy_new_sync() for the synchronous, blocking version of this constructor.
2854 */
2855void
2856fan_proxy_new (
2857 GDBusConnection *connection,
2858 GDBusProxyFlags flags,
2859 const gchar *name,
2860 const gchar *object_path,
2861 GCancellable *cancellable,
2862 GAsyncReadyCallback callback,
2863 gpointer user_data)
2864{
2865 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);
2866}
2867
2868/**
2869 * fan_proxy_new_finish:
2870 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new().
2871 * @error: Return location for error or %NULL
2872 *
2873 * Finishes an operation started with fan_proxy_new().
2874 *
2875 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2876 */
2877Fan *
2878fan_proxy_new_finish (
2879 GAsyncResult *res,
2880 GError **error)
2881{
2882 GObject *ret;
2883 GObject *source_object;
2884 source_object = g_async_result_get_source_object (res);
2885 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
2886 g_object_unref (source_object);
2887 if (ret != NULL)
2888 return FAN (ret);
2889 else
2890 return NULL;
2891}
2892
2893/**
2894 * fan_proxy_new_sync:
2895 * @connection: A #GDBusConnection.
2896 * @flags: Flags from the #GDBusProxyFlags enumeration.
2897 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
2898 * @object_path: An object path.
2899 * @cancellable: (allow-none): A #GCancellable or %NULL.
2900 * @error: Return location for error or %NULL
2901 *
2902 * 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.
2903 *
2904 * The calling thread is blocked until a reply is received.
2905 *
2906 * See fan_proxy_new() for the asynchronous version of this constructor.
2907 *
2908 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2909 */
2910Fan *
2911fan_proxy_new_sync (
2912 GDBusConnection *connection,
2913 GDBusProxyFlags flags,
2914 const gchar *name,
2915 const gchar *object_path,
2916 GCancellable *cancellable,
2917 GError **error)
2918{
2919 GInitable *ret;
2920 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);
2921 if (ret != NULL)
2922 return FAN (ret);
2923 else
2924 return NULL;
2925}
2926
2927
2928/**
2929 * fan_proxy_new_for_bus:
2930 * @bus_type: A #GBusType.
2931 * @flags: Flags from the #GDBusProxyFlags enumeration.
2932 * @name: A bus name (well-known or unique).
2933 * @object_path: An object path.
2934 * @cancellable: (allow-none): A #GCancellable or %NULL.
2935 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
2936 * @user_data: User data to pass to @callback.
2937 *
2938 * Like fan_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
2939 *
2940 * 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.
2941 * You can then call fan_proxy_new_for_bus_finish() to get the result of the operation.
2942 *
2943 * See fan_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
2944 */
2945void
2946fan_proxy_new_for_bus (
2947 GBusType bus_type,
2948 GDBusProxyFlags flags,
2949 const gchar *name,
2950 const gchar *object_path,
2951 GCancellable *cancellable,
2952 GAsyncReadyCallback callback,
2953 gpointer user_data)
2954{
2955 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);
2956}
2957
2958/**
2959 * fan_proxy_new_for_bus_finish:
2960 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new_for_bus().
2961 * @error: Return location for error or %NULL
2962 *
2963 * Finishes an operation started with fan_proxy_new_for_bus().
2964 *
2965 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2966 */
2967Fan *
2968fan_proxy_new_for_bus_finish (
2969 GAsyncResult *res,
2970 GError **error)
2971{
2972 GObject *ret;
2973 GObject *source_object;
2974 source_object = g_async_result_get_source_object (res);
2975 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
2976 g_object_unref (source_object);
2977 if (ret != NULL)
2978 return FAN (ret);
2979 else
2980 return NULL;
2981}
2982
2983/**
2984 * fan_proxy_new_for_bus_sync:
2985 * @bus_type: A #GBusType.
2986 * @flags: Flags from the #GDBusProxyFlags enumeration.
2987 * @name: A bus name (well-known or unique).
2988 * @object_path: An object path.
2989 * @cancellable: (allow-none): A #GCancellable or %NULL.
2990 * @error: Return location for error or %NULL
2991 *
2992 * Like fan_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
2993 *
2994 * The calling thread is blocked until a reply is received.
2995 *
2996 * See fan_proxy_new_for_bus() for the asynchronous version of this constructor.
2997 *
2998 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2999 */
3000Fan *
3001fan_proxy_new_for_bus_sync (
3002 GBusType bus_type,
3003 GDBusProxyFlags flags,
3004 const gchar *name,
3005 const gchar *object_path,
3006 GCancellable *cancellable,
3007 GError **error)
3008{
3009 GInitable *ret;
3010 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);
3011 if (ret != NULL)
3012 return FAN (ret);
3013 else
3014 return NULL;
3015}
3016
3017
3018/* ------------------------------------------------------------------------ */
3019
3020/**
3021 * FanSkeleton:
3022 *
3023 * The #FanSkeleton structure contains only private data and should only be accessed using the provided API.
3024 */
3025
3026/**
3027 * FanSkeletonClass:
3028 * @parent_class: The parent class.
3029 *
3030 * Class structure for #FanSkeleton.
3031 */
3032
3033struct _FanSkeletonPrivate
3034{
3035 GValue *properties;
3036 GList *changed_properties;
3037 GSource *changed_properties_idle_source;
3038 GMainContext *context;
3039 GMutex lock;
3040};
3041
3042static void
3043_fan_skeleton_handle_method_call (
3044 GDBusConnection *connection G_GNUC_UNUSED,
3045 const gchar *sender G_GNUC_UNUSED,
3046 const gchar *object_path G_GNUC_UNUSED,
3047 const gchar *interface_name,
3048 const gchar *method_name,
3049 GVariant *parameters,
3050 GDBusMethodInvocation *invocation,
3051 gpointer user_data)
3052{
3053 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3054 _ExtendedGDBusMethodInfo *info;
3055 GVariantIter iter;
3056 GVariant *child;
3057 GValue *paramv;
3058 guint num_params;
3059 guint num_extra;
3060 guint n;
3061 guint signal_id;
3062 GValue return_value = G_VALUE_INIT;
3063 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
3064 g_assert (info != NULL);
3065 num_params = g_variant_n_children (parameters);
3066 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
3067 n = 0;
3068 g_value_init (&paramv[n], TYPE_FAN);
3069 g_value_set_object (&paramv[n++], skeleton);
3070 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
3071 g_value_set_object (&paramv[n++], invocation);
3072 if (info->pass_fdlist)
3073 {
3074#ifdef G_OS_UNIX
3075 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
3076 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
3077#else
3078 g_assert_not_reached ();
3079#endif
3080 }
3081 g_variant_iter_init (&iter, parameters);
3082 while ((child = g_variant_iter_next_value (&iter)) != NULL)
3083 {
3084 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
3085 if (arg_info->use_gvariant)
3086 {
3087 g_value_init (&paramv[n], G_TYPE_VARIANT);
3088 g_value_set_variant (&paramv[n], child);
3089 n++;
3090 }
3091 else
3092 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
3093 g_variant_unref (child);
3094 }
3095 signal_id = g_signal_lookup (info->signal_name, TYPE_FAN);
3096 g_value_init (&return_value, G_TYPE_BOOLEAN);
3097 g_signal_emitv (paramv, signal_id, 0, &return_value);
3098 if (!g_value_get_boolean (&return_value))
3099 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);
3100 g_value_unset (&return_value);
3101 for (n = 0; n < num_params + num_extra; n++)
3102 g_value_unset (&paramv[n]);
3103 g_free (paramv);
3104}
3105
3106static GVariant *
3107_fan_skeleton_handle_get_property (
3108 GDBusConnection *connection G_GNUC_UNUSED,
3109 const gchar *sender G_GNUC_UNUSED,
3110 const gchar *object_path G_GNUC_UNUSED,
3111 const gchar *interface_name G_GNUC_UNUSED,
3112 const gchar *property_name,
3113 GError **error,
3114 gpointer user_data)
3115{
3116 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3117 GValue value = G_VALUE_INIT;
3118 GParamSpec *pspec;
3119 _ExtendedGDBusPropertyInfo *info;
3120 GVariant *ret;
3121 ret = NULL;
3122 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name);
3123 g_assert (info != NULL);
3124 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3125 if (pspec == NULL)
3126 {
3127 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3128 }
3129 else
3130 {
3131 g_value_init (&value, pspec->value_type);
3132 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3133 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
3134 g_value_unset (&value);
3135 }
3136 return ret;
3137}
3138
3139static gboolean
3140_fan_skeleton_handle_set_property (
3141 GDBusConnection *connection G_GNUC_UNUSED,
3142 const gchar *sender G_GNUC_UNUSED,
3143 const gchar *object_path G_GNUC_UNUSED,
3144 const gchar *interface_name G_GNUC_UNUSED,
3145 const gchar *property_name,
3146 GVariant *variant,
3147 GError **error,
3148 gpointer user_data)
3149{
3150 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3151 GValue value = G_VALUE_INIT;
3152 GParamSpec *pspec;
3153 _ExtendedGDBusPropertyInfo *info;
3154 gboolean ret;
3155 ret = FALSE;
3156 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name);
3157 g_assert (info != NULL);
3158 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3159 if (pspec == NULL)
3160 {
3161 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3162 }
3163 else
3164 {
3165 if (info->use_gvariant)
3166 g_value_set_variant (&value, variant);
3167 else
3168 g_dbus_gvariant_to_gvalue (variant, &value);
3169 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3170 g_value_unset (&value);
3171 ret = TRUE;
3172 }
3173 return ret;
3174}
3175
3176static const GDBusInterfaceVTable _fan_skeleton_vtable =
3177{
3178 _fan_skeleton_handle_method_call,
3179 _fan_skeleton_handle_get_property,
3180 _fan_skeleton_handle_set_property,
3181 {NULL}
3182};
3183
3184static GDBusInterfaceInfo *
3185fan_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3186{
3187 return fan_interface_info ();
3188}
3189
3190static GDBusInterfaceVTable *
3191fan_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3192{
3193 return (GDBusInterfaceVTable *) &_fan_skeleton_vtable;
3194}
3195
3196static GVariant *
3197fan_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
3198{
3199 FanSkeleton *skeleton = FAN_SKELETON (_skeleton);
3200
3201 GVariantBuilder builder;
3202 guint n;
3203 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3204 if (_fan_interface_info.parent_struct.properties == NULL)
3205 goto out;
3206 for (n = 0; _fan_interface_info.parent_struct.properties[n] != NULL; n++)
3207 {
3208 GDBusPropertyInfo *info = _fan_interface_info.parent_struct.properties[n];
3209 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
3210 {
3211 GVariant *value;
3212 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);
3213 if (value != NULL)
3214 {
3215 g_variant_take_ref (value);
3216 g_variant_builder_add (&builder, "{sv}", info->name, value);
3217 g_variant_unref (value);
3218 }
3219 }
3220 }
3221out:
3222 return g_variant_builder_end (&builder);
3223}
3224
3225static gboolean _fan_emit_changed (gpointer user_data);
3226
3227static void
3228fan_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
3229{
3230 FanSkeleton *skeleton = FAN_SKELETON (_skeleton);
3231 gboolean emit_changed = FALSE;
3232
3233 g_mutex_lock (&skeleton->priv->lock);
3234 if (skeleton->priv->changed_properties_idle_source != NULL)
3235 {
3236 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3237 skeleton->priv->changed_properties_idle_source = NULL;
3238 emit_changed = TRUE;
3239 }
3240 g_mutex_unlock (&skeleton->priv->lock);
3241
3242 if (emit_changed)
3243 _fan_emit_changed (skeleton);
3244}
3245
3246static void
3247_fan_on_signal_speed_changed (
3248 Fan *object,
3249 gint arg_speed)
3250{
3251 FanSkeleton *skeleton = FAN_SKELETON (object);
3252
3253 GList *connections, *l;
3254 GVariant *signal_variant;
3255 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3256
3257 signal_variant = g_variant_ref_sink (g_variant_new ("(i)",
3258 arg_speed));
3259 for (l = connections; l != NULL; l = l->next)
3260 {
3261 GDBusConnection *connection = l->data;
3262 g_dbus_connection_emit_signal (connection,
3263 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "SpeedChanged",
3264 signal_variant, NULL);
3265 }
3266 g_variant_unref (signal_variant);
3267 g_list_free_full (connections, g_object_unref);
3268}
3269
3270static void
3271_fan_on_signal_tach_error (
3272 Fan *object)
3273{
3274 FanSkeleton *skeleton = FAN_SKELETON (object);
3275
3276 GList *connections, *l;
3277 GVariant *signal_variant;
3278 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3279
3280 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
3281 for (l = connections; l != NULL; l = l->next)
3282 {
3283 GDBusConnection *connection = l->data;
3284 g_dbus_connection_emit_signal (connection,
3285 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "TachError",
3286 signal_variant, NULL);
3287 }
3288 g_variant_unref (signal_variant);
3289 g_list_free_full (connections, g_object_unref);
3290}
3291
3292static void fan_skeleton_iface_init (FanIface *iface);
3293#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3294G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3295 G_ADD_PRIVATE (FanSkeleton)
3296 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init));
3297
3298#else
3299G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3300 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init));
3301
3302#endif
3303static void
3304fan_skeleton_finalize (GObject *object)
3305{
3306 FanSkeleton *skeleton = FAN_SKELETON (object);
3307 guint n;
3308 for (n = 0; n < 3; n++)
3309 g_value_unset (&skeleton->priv->properties[n]);
3310 g_free (skeleton->priv->properties);
3311 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3312 if (skeleton->priv->changed_properties_idle_source != NULL)
3313 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3314 g_main_context_unref (skeleton->priv->context);
3315 g_mutex_clear (&skeleton->priv->lock);
3316 G_OBJECT_CLASS (fan_skeleton_parent_class)->finalize (object);
3317}
3318
3319static void
3320fan_skeleton_get_property (GObject *object,
3321 guint prop_id,
3322 GValue *value,
3323 GParamSpec *pspec G_GNUC_UNUSED)
3324{
3325 FanSkeleton *skeleton = FAN_SKELETON (object);
3326 g_assert (prop_id != 0 && prop_id - 1 < 3);
3327 g_mutex_lock (&skeleton->priv->lock);
3328 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
3329 g_mutex_unlock (&skeleton->priv->lock);
3330}
3331
3332static gboolean
3333_fan_emit_changed (gpointer user_data)
3334{
3335 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3336 GList *l;
3337 GVariantBuilder builder;
3338 GVariantBuilder invalidated_builder;
3339 guint num_changes;
3340
3341 g_mutex_lock (&skeleton->priv->lock);
3342 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3343 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
3344 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
3345 {
3346 ChangedProperty *cp = l->data;
3347 GVariant *variant;
3348 const GValue *cur_value;
3349
3350 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
3351 if (!_g_value_equal (cur_value, &cp->orig_value))
3352 {
3353 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
3354 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
3355 g_variant_unref (variant);
3356 num_changes++;
3357 }
3358 }
3359 if (num_changes > 0)
3360 {
3361 GList *connections, *ll;
3362 GVariant *signal_variant;
3363 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Fan",
3364 &builder, &invalidated_builder));
3365 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3366 for (ll = connections; ll != NULL; ll = ll->next)
3367 {
3368 GDBusConnection *connection = ll->data;
3369
3370 g_dbus_connection_emit_signal (connection,
3371 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
3372 "org.freedesktop.DBus.Properties",
3373 "PropertiesChanged",
3374 signal_variant,
3375 NULL);
3376 }
3377 g_variant_unref (signal_variant);
3378 g_list_free_full (connections, g_object_unref);
3379 }
3380 else
3381 {
3382 g_variant_builder_clear (&builder);
3383 g_variant_builder_clear (&invalidated_builder);
3384 }
3385 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3386 skeleton->priv->changed_properties = NULL;
3387 skeleton->priv->changed_properties_idle_source = NULL;
3388 g_mutex_unlock (&skeleton->priv->lock);
3389 return FALSE;
3390}
3391
3392static void
3393_fan_schedule_emit_changed (FanSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
3394{
3395 ChangedProperty *cp;
3396 GList *l;
3397 cp = NULL;
3398 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
3399 {
3400 ChangedProperty *i_cp = l->data;
3401 if (i_cp->info == info)
3402 {
3403 cp = i_cp;
3404 break;
3405 }
3406 }
3407 if (cp == NULL)
3408 {
3409 cp = g_new0 (ChangedProperty, 1);
3410 cp->prop_id = prop_id;
3411 cp->info = info;
3412 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
3413 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
3414 g_value_copy (orig_value, &cp->orig_value);
3415 }
3416}
3417
3418static void
3419fan_skeleton_notify (GObject *object,
3420 GParamSpec *pspec G_GNUC_UNUSED)
3421{
3422 FanSkeleton *skeleton = FAN_SKELETON (object);
3423 g_mutex_lock (&skeleton->priv->lock);
3424 if (skeleton->priv->changed_properties != NULL &&
3425 skeleton->priv->changed_properties_idle_source == NULL)
3426 {
3427 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
3428 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
3429 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _fan_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylak2cb27752015-10-19 16:23:14 -05003430 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _fan_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -05003431 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
3432 g_source_unref (skeleton->priv->changed_properties_idle_source);
3433 }
3434 g_mutex_unlock (&skeleton->priv->lock);
3435}
3436
3437static void
3438fan_skeleton_set_property (GObject *object,
3439 guint prop_id,
3440 const GValue *value,
3441 GParamSpec *pspec)
3442{
3443 FanSkeleton *skeleton = FAN_SKELETON (object);
3444 g_assert (prop_id != 0 && prop_id - 1 < 3);
3445 g_mutex_lock (&skeleton->priv->lock);
3446 g_object_freeze_notify (object);
3447 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
3448 {
3449 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
3450 _fan_schedule_emit_changed (skeleton, _fan_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
3451 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
3452 g_object_notify_by_pspec (object, pspec);
3453 }
3454 g_mutex_unlock (&skeleton->priv->lock);
3455 g_object_thaw_notify (object);
3456}
3457
3458static void
3459fan_skeleton_init (FanSkeleton *skeleton)
3460{
3461#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3462 skeleton->priv = fan_skeleton_get_instance_private (skeleton);
3463#else
3464 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FAN_SKELETON, FanSkeletonPrivate);
3465#endif
3466
3467 g_mutex_init (&skeleton->priv->lock);
3468 skeleton->priv->context = g_main_context_ref_thread_default ();
3469 skeleton->priv->properties = g_new0 (GValue, 3);
3470 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
3471 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
3472 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
3473}
3474
3475static gint
3476fan_skeleton_get_speed (Fan *object)
3477{
3478 FanSkeleton *skeleton = FAN_SKELETON (object);
3479 gint value;
3480 g_mutex_lock (&skeleton->priv->lock);
3481 value = g_value_get_int (&(skeleton->priv->properties[0]));
3482 g_mutex_unlock (&skeleton->priv->lock);
3483 return value;
3484}
3485
3486static gint
3487fan_skeleton_get_cooling_zone (Fan *object)
3488{
3489 FanSkeleton *skeleton = FAN_SKELETON (object);
3490 gint value;
3491 g_mutex_lock (&skeleton->priv->lock);
3492 value = g_value_get_int (&(skeleton->priv->properties[1]));
3493 g_mutex_unlock (&skeleton->priv->lock);
3494 return value;
3495}
3496
3497static gint
3498fan_skeleton_get_pwm_num (Fan *object)
3499{
3500 FanSkeleton *skeleton = FAN_SKELETON (object);
3501 gint value;
3502 g_mutex_lock (&skeleton->priv->lock);
3503 value = g_value_get_int (&(skeleton->priv->properties[2]));
3504 g_mutex_unlock (&skeleton->priv->lock);
3505 return value;
3506}
3507
3508static void
3509fan_skeleton_class_init (FanSkeletonClass *klass)
3510{
3511 GObjectClass *gobject_class;
3512 GDBusInterfaceSkeletonClass *skeleton_class;
3513
3514 gobject_class = G_OBJECT_CLASS (klass);
3515 gobject_class->finalize = fan_skeleton_finalize;
3516 gobject_class->get_property = fan_skeleton_get_property;
3517 gobject_class->set_property = fan_skeleton_set_property;
3518 gobject_class->notify = fan_skeleton_notify;
3519
3520
3521 fan_override_properties (gobject_class, 1);
3522
3523 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
3524 skeleton_class->get_info = fan_skeleton_dbus_interface_get_info;
3525 skeleton_class->get_properties = fan_skeleton_dbus_interface_get_properties;
3526 skeleton_class->flush = fan_skeleton_dbus_interface_flush;
3527 skeleton_class->get_vtable = fan_skeleton_dbus_interface_get_vtable;
3528
3529#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
3530 g_type_class_add_private (klass, sizeof (FanSkeletonPrivate));
3531#endif
3532}
3533
3534static void
3535fan_skeleton_iface_init (FanIface *iface)
3536{
3537 iface->speed_changed = _fan_on_signal_speed_changed;
3538 iface->tach_error = _fan_on_signal_tach_error;
3539 iface->get_speed = fan_skeleton_get_speed;
3540 iface->get_cooling_zone = fan_skeleton_get_cooling_zone;
3541 iface->get_pwm_num = fan_skeleton_get_pwm_num;
3542}
3543
3544/**
3545 * fan_skeleton_new:
3546 *
3547 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
3548 *
3549 * Returns: (transfer full) (type FanSkeleton): The skeleton object.
3550 */
3551Fan *
3552fan_skeleton_new (void)
3553{
3554 return FAN (g_object_new (TYPE_FAN_SKELETON, NULL));
3555}
3556
3557/* ------------------------------------------------------------------------
3558 * Code for interface org.openbmc.SensorValue
3559 * ------------------------------------------------------------------------
3560 */
3561
3562/**
3563 * SECTION:SensorValue
3564 * @title: SensorValue
3565 * @short_description: Generated C code for the org.openbmc.SensorValue D-Bus interface
3566 *
3567 * 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.
3568 */
3569
3570/* ---- Introspection data for org.openbmc.SensorValue ---- */
3571
3572static const _ExtendedGDBusMethodInfo _sensor_value_method_info_init =
3573{
3574 {
3575 -1,
3576 (gchar *) "init",
3577 NULL,
3578 NULL,
3579 NULL
3580 },
3581 "handle-init",
3582 FALSE
3583};
3584
3585static const _ExtendedGDBusArgInfo _sensor_value_method_info_get_value_OUT_ARG_value =
3586{
3587 {
3588 -1,
3589 (gchar *) "value",
3590 (gchar *) "v",
3591 NULL
3592 },
3593 FALSE
3594};
3595
3596static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_get_value_OUT_ARG_pointers[] =
3597{
3598 &_sensor_value_method_info_get_value_OUT_ARG_value,
3599 NULL
3600};
3601
3602static const _ExtendedGDBusMethodInfo _sensor_value_method_info_get_value =
3603{
3604 {
3605 -1,
3606 (gchar *) "getValue",
3607 NULL,
3608 (GDBusArgInfo **) &_sensor_value_method_info_get_value_OUT_ARG_pointers,
3609 NULL
3610 },
3611 "handle-get-value",
3612 FALSE
3613};
3614
Norman James19e45912015-10-04 20:19:41 -05003615static const _ExtendedGDBusArgInfo _sensor_value_method_info_set_value_IN_ARG_value =
3616{
3617 {
3618 -1,
3619 (gchar *) "value",
3620 (gchar *) "v",
3621 NULL
3622 },
3623 FALSE
3624};
3625
3626static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_set_value_IN_ARG_pointers[] =
3627{
3628 &_sensor_value_method_info_set_value_IN_ARG_value,
3629 NULL
3630};
3631
3632static const _ExtendedGDBusMethodInfo _sensor_value_method_info_set_value =
3633{
3634 {
3635 -1,
3636 (gchar *) "setValue",
3637 (GDBusArgInfo **) &_sensor_value_method_info_set_value_IN_ARG_pointers,
3638 NULL,
3639 NULL
3640 },
3641 "handle-set-value",
3642 FALSE
3643};
3644
Norman James362a80f2015-09-14 14:04:39 -05003645static const _ExtendedGDBusMethodInfo * const _sensor_value_method_info_pointers[] =
3646{
3647 &_sensor_value_method_info_init,
3648 &_sensor_value_method_info_get_value,
Norman James19e45912015-10-04 20:19:41 -05003649 &_sensor_value_method_info_set_value,
Norman James362a80f2015-09-14 14:04:39 -05003650 NULL
3651};
3652
3653static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_value =
3654{
3655 {
3656 -1,
3657 (gchar *) "value",
3658 (gchar *) "v",
3659 NULL
3660 },
3661 FALSE
3662};
3663
3664static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_units =
3665{
3666 {
3667 -1,
3668 (gchar *) "units",
3669 (gchar *) "s",
3670 NULL
3671 },
3672 FALSE
3673};
3674
3675static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_changed_ARG_pointers[] =
3676{
3677 &_sensor_value_signal_info_changed_ARG_value,
3678 &_sensor_value_signal_info_changed_ARG_units,
3679 NULL
3680};
3681
3682static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_changed =
3683{
3684 {
3685 -1,
3686 (gchar *) "Changed",
3687 (GDBusArgInfo **) &_sensor_value_signal_info_changed_ARG_pointers,
3688 NULL
3689 },
3690 "changed"
3691};
3692
Norman James32e74e22015-09-15 21:28:06 -05003693static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_error =
3694{
3695 {
3696 -1,
3697 (gchar *) "Error",
3698 NULL,
3699 NULL
3700 },
3701 "error"
3702};
3703
Norman James362a80f2015-09-14 14:04:39 -05003704static const _ExtendedGDBusArgInfo _sensor_value_signal_info_heartbeat_ARG_bus_name =
3705{
3706 {
3707 -1,
3708 (gchar *) "bus_name",
3709 (gchar *) "s",
3710 NULL
3711 },
3712 FALSE
3713};
3714
3715static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_heartbeat_ARG_pointers[] =
3716{
3717 &_sensor_value_signal_info_heartbeat_ARG_bus_name,
3718 NULL
3719};
3720
3721static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_heartbeat =
3722{
3723 {
3724 -1,
3725 (gchar *) "Heartbeat",
3726 (GDBusArgInfo **) &_sensor_value_signal_info_heartbeat_ARG_pointers,
3727 NULL
3728 },
3729 "heartbeat"
3730};
3731
3732static const _ExtendedGDBusSignalInfo * const _sensor_value_signal_info_pointers[] =
3733{
3734 &_sensor_value_signal_info_changed,
Norman James32e74e22015-09-15 21:28:06 -05003735 &_sensor_value_signal_info_error,
Norman James362a80f2015-09-14 14:04:39 -05003736 &_sensor_value_signal_info_heartbeat,
3737 NULL
3738};
3739
3740static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_value =
3741{
3742 {
3743 -1,
3744 (gchar *) "value",
3745 (gchar *) "v",
3746 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3747 NULL
3748 },
3749 "value",
3750 FALSE
3751};
3752
3753static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_units =
3754{
3755 {
3756 -1,
3757 (gchar *) "units",
3758 (gchar *) "s",
3759 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3760 NULL
3761 },
3762 "units",
3763 FALSE
3764};
3765
3766static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_poll_interval =
3767{
3768 {
3769 -1,
3770 (gchar *) "poll_interval",
3771 (gchar *) "i",
3772 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
3773 NULL
3774 },
3775 "poll-interval",
3776 FALSE
3777};
3778
3779static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_heatbeat =
3780{
3781 {
3782 -1,
3783 (gchar *) "heatbeat",
3784 (gchar *) "i",
3785 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3786 NULL
3787 },
3788 "heatbeat",
3789 FALSE
3790};
3791
3792static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_settable =
3793{
3794 {
3795 -1,
3796 (gchar *) "settable",
3797 (gchar *) "b",
3798 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3799 NULL
3800 },
3801 "settable",
3802 FALSE
3803};
3804
Norman James362a80f2015-09-14 14:04:39 -05003805static const _ExtendedGDBusPropertyInfo * const _sensor_value_property_info_pointers[] =
3806{
3807 &_sensor_value_property_info_value,
3808 &_sensor_value_property_info_units,
3809 &_sensor_value_property_info_poll_interval,
3810 &_sensor_value_property_info_heatbeat,
3811 &_sensor_value_property_info_settable,
Norman James362a80f2015-09-14 14:04:39 -05003812 NULL
3813};
3814
3815static const _ExtendedGDBusInterfaceInfo _sensor_value_interface_info =
3816{
3817 {
3818 -1,
3819 (gchar *) "org.openbmc.SensorValue",
3820 (GDBusMethodInfo **) &_sensor_value_method_info_pointers,
3821 (GDBusSignalInfo **) &_sensor_value_signal_info_pointers,
3822 (GDBusPropertyInfo **) &_sensor_value_property_info_pointers,
3823 NULL
3824 },
3825 "sensor-value",
3826};
3827
3828
3829/**
3830 * sensor_value_interface_info:
3831 *
3832 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> D-Bus interface.
3833 *
3834 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
3835 */
3836GDBusInterfaceInfo *
3837sensor_value_interface_info (void)
3838{
3839 return (GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct;
3840}
3841
3842/**
3843 * sensor_value_override_properties:
3844 * @klass: The class structure for a #GObject<!-- -->-derived class.
3845 * @property_id_begin: The property id to assign to the first overridden property.
3846 *
3847 * Overrides all #GObject properties in the #SensorValue interface for a concrete class.
3848 * The properties are overridden in the order they are defined.
3849 *
3850 * Returns: The last property id.
3851 */
3852guint
3853sensor_value_override_properties (GObjectClass *klass, guint property_id_begin)
3854{
3855 g_object_class_override_property (klass, property_id_begin++, "value");
3856 g_object_class_override_property (klass, property_id_begin++, "units");
3857 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
3858 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
3859 g_object_class_override_property (klass, property_id_begin++, "settable");
Norman James362a80f2015-09-14 14:04:39 -05003860 return property_id_begin - 1;
3861}
3862
3863
3864
3865/**
3866 * SensorValue:
3867 *
3868 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
3869 */
3870
3871/**
3872 * SensorValueIface:
3873 * @parent_iface: The parent interface.
3874 * @handle_get_value: Handler for the #SensorValue::handle-get-value signal.
3875 * @handle_init: Handler for the #SensorValue::handle-init signal.
Norman James19e45912015-10-04 20:19:41 -05003876 * @handle_set_value: Handler for the #SensorValue::handle-set-value signal.
Norman James362a80f2015-09-14 14:04:39 -05003877 * @get_heatbeat: Getter for the #SensorValue:heatbeat property.
Norman James362a80f2015-09-14 14:04:39 -05003878 * @get_poll_interval: Getter for the #SensorValue:poll-interval property.
3879 * @get_settable: Getter for the #SensorValue:settable property.
3880 * @get_units: Getter for the #SensorValue:units property.
3881 * @get_value: Getter for the #SensorValue:value property.
3882 * @changed: Handler for the #SensorValue::changed signal.
Norman James32e74e22015-09-15 21:28:06 -05003883 * @error: Handler for the #SensorValue::error signal.
Norman James362a80f2015-09-14 14:04:39 -05003884 * @heartbeat: Handler for the #SensorValue::heartbeat signal.
3885 *
3886 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
3887 */
3888
3889typedef SensorValueIface SensorValueInterface;
3890G_DEFINE_INTERFACE (SensorValue, sensor_value, G_TYPE_OBJECT);
3891
3892static void
3893sensor_value_default_init (SensorValueIface *iface)
3894{
3895 /* GObject signals for incoming D-Bus method calls: */
3896 /**
3897 * SensorValue::handle-init:
3898 * @object: A #SensorValue.
3899 * @invocation: A #GDBusMethodInvocation.
3900 *
3901 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method.
3902 *
3903 * 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.
3904 *
3905 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3906 */
3907 g_signal_new ("handle-init",
3908 G_TYPE_FROM_INTERFACE (iface),
3909 G_SIGNAL_RUN_LAST,
3910 G_STRUCT_OFFSET (SensorValueIface, handle_init),
3911 g_signal_accumulator_true_handled,
3912 NULL,
3913 g_cclosure_marshal_generic,
3914 G_TYPE_BOOLEAN,
3915 1,
3916 G_TYPE_DBUS_METHOD_INVOCATION);
3917
3918 /**
3919 * SensorValue::handle-get-value:
3920 * @object: A #SensorValue.
3921 * @invocation: A #GDBusMethodInvocation.
3922 *
3923 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method.
3924 *
3925 * 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.
3926 *
3927 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3928 */
3929 g_signal_new ("handle-get-value",
3930 G_TYPE_FROM_INTERFACE (iface),
3931 G_SIGNAL_RUN_LAST,
3932 G_STRUCT_OFFSET (SensorValueIface, handle_get_value),
3933 g_signal_accumulator_true_handled,
3934 NULL,
3935 g_cclosure_marshal_generic,
3936 G_TYPE_BOOLEAN,
3937 1,
3938 G_TYPE_DBUS_METHOD_INVOCATION);
3939
Norman James19e45912015-10-04 20:19:41 -05003940 /**
3941 * SensorValue::handle-set-value:
3942 * @object: A #SensorValue.
3943 * @invocation: A #GDBusMethodInvocation.
3944 * @arg_value: Argument passed by remote caller.
3945 *
3946 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method.
3947 *
3948 * 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.
3949 *
3950 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3951 */
3952 g_signal_new ("handle-set-value",
3953 G_TYPE_FROM_INTERFACE (iface),
3954 G_SIGNAL_RUN_LAST,
3955 G_STRUCT_OFFSET (SensorValueIface, handle_set_value),
3956 g_signal_accumulator_true_handled,
3957 NULL,
3958 g_cclosure_marshal_generic,
3959 G_TYPE_BOOLEAN,
3960 2,
3961 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT);
3962
Norman James362a80f2015-09-14 14:04:39 -05003963 /* GObject signals for received D-Bus signals: */
3964 /**
3965 * SensorValue::changed:
3966 * @object: A #SensorValue.
3967 * @arg_value: Argument.
3968 * @arg_units: Argument.
3969 *
3970 * 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.
3971 *
3972 * 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.
3973 */
3974 g_signal_new ("changed",
3975 G_TYPE_FROM_INTERFACE (iface),
3976 G_SIGNAL_RUN_LAST,
3977 G_STRUCT_OFFSET (SensorValueIface, changed),
3978 NULL,
3979 NULL,
3980 g_cclosure_marshal_generic,
3981 G_TYPE_NONE,
3982 2, G_TYPE_VARIANT, G_TYPE_STRING);
3983
3984 /**
Norman James32e74e22015-09-15 21:28:06 -05003985 * SensorValue::error:
3986 * @object: A #SensorValue.
3987 *
3988 * 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.
3989 *
3990 * 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.
3991 */
3992 g_signal_new ("error",
3993 G_TYPE_FROM_INTERFACE (iface),
3994 G_SIGNAL_RUN_LAST,
3995 G_STRUCT_OFFSET (SensorValueIface, error),
3996 NULL,
3997 NULL,
3998 g_cclosure_marshal_generic,
3999 G_TYPE_NONE,
4000 0);
4001
4002 /**
Norman James362a80f2015-09-14 14:04:39 -05004003 * SensorValue::heartbeat:
4004 * @object: A #SensorValue.
4005 * @arg_bus_name: Argument.
4006 *
4007 * 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.
4008 *
4009 * 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.
4010 */
4011 g_signal_new ("heartbeat",
4012 G_TYPE_FROM_INTERFACE (iface),
4013 G_SIGNAL_RUN_LAST,
4014 G_STRUCT_OFFSET (SensorValueIface, heartbeat),
4015 NULL,
4016 NULL,
4017 g_cclosure_marshal_generic,
4018 G_TYPE_NONE,
4019 1, G_TYPE_STRING);
4020
4021 /* GObject properties for D-Bus properties: */
4022 /**
4023 * SensorValue:value:
4024 *
4025 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link>.
4026 *
4027 * 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.
4028 */
4029 g_object_interface_install_property (iface,
4030 g_param_spec_variant ("value", "value", "value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4031 /**
4032 * SensorValue:units:
4033 *
4034 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link>.
4035 *
4036 * 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.
4037 */
4038 g_object_interface_install_property (iface,
4039 g_param_spec_string ("units", "units", "units", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4040 /**
4041 * SensorValue:poll-interval:
4042 *
4043 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link>.
4044 *
4045 * 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.
4046 */
4047 g_object_interface_install_property (iface,
4048 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4049 /**
4050 * SensorValue:heatbeat:
4051 *
4052 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link>.
4053 *
4054 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
4055 */
4056 g_object_interface_install_property (iface,
4057 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4058 /**
4059 * SensorValue:settable:
4060 *
4061 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link>.
4062 *
4063 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
4064 */
4065 g_object_interface_install_property (iface,
4066 g_param_spec_boolean ("settable", "settable", "settable", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James362a80f2015-09-14 14:04:39 -05004067}
4068
4069/**
4070 * sensor_value_get_value: (skip)
4071 * @object: A #SensorValue.
4072 *
4073 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property.
4074 *
4075 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4076 *
4077 * <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>
4078 *
4079 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
4080 */
4081GVariant *
4082sensor_value_get_value (SensorValue *object)
4083{
4084 return SENSOR_VALUE_GET_IFACE (object)->get_value (object);
4085}
4086
4087/**
4088 * sensor_value_dup_value: (skip)
4089 * @object: A #SensorValue.
4090 *
4091 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property.
4092 *
4093 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4094 *
4095 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
4096 */
4097GVariant *
4098sensor_value_dup_value (SensorValue *object)
4099{
4100 GVariant *value;
4101 g_object_get (G_OBJECT (object), "value", &value, NULL);
4102 return value;
4103}
4104
4105/**
4106 * sensor_value_set_value: (skip)
4107 * @object: A #SensorValue.
4108 * @value: The value to set.
4109 *
4110 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property to @value.
4111 *
4112 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4113 */
4114void
4115sensor_value_set_value (SensorValue *object, GVariant *value)
4116{
4117 g_object_set (G_OBJECT (object), "value", value, NULL);
4118}
4119
4120/**
4121 * sensor_value_get_units: (skip)
4122 * @object: A #SensorValue.
4123 *
4124 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property.
4125 *
4126 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4127 *
4128 * <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>
4129 *
4130 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
4131 */
4132const gchar *
4133sensor_value_get_units (SensorValue *object)
4134{
4135 return SENSOR_VALUE_GET_IFACE (object)->get_units (object);
4136}
4137
4138/**
4139 * sensor_value_dup_units: (skip)
4140 * @object: A #SensorValue.
4141 *
4142 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property.
4143 *
4144 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4145 *
4146 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
4147 */
4148gchar *
4149sensor_value_dup_units (SensorValue *object)
4150{
4151 gchar *value;
4152 g_object_get (G_OBJECT (object), "units", &value, NULL);
4153 return value;
4154}
4155
4156/**
4157 * sensor_value_set_units: (skip)
4158 * @object: A #SensorValue.
4159 * @value: The value to set.
4160 *
4161 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property to @value.
4162 *
4163 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4164 */
4165void
4166sensor_value_set_units (SensorValue *object, const gchar *value)
4167{
4168 g_object_set (G_OBJECT (object), "units", value, NULL);
4169}
4170
4171/**
4172 * sensor_value_get_poll_interval: (skip)
4173 * @object: A #SensorValue.
4174 *
4175 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property.
4176 *
4177 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4178 *
4179 * Returns: The property value.
4180 */
4181gint
4182sensor_value_get_poll_interval (SensorValue *object)
4183{
4184 return SENSOR_VALUE_GET_IFACE (object)->get_poll_interval (object);
4185}
4186
4187/**
4188 * sensor_value_set_poll_interval: (skip)
4189 * @object: A #SensorValue.
4190 * @value: The value to set.
4191 *
4192 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property to @value.
4193 *
4194 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4195 */
4196void
4197sensor_value_set_poll_interval (SensorValue *object, gint value)
4198{
4199 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
4200}
4201
4202/**
4203 * sensor_value_get_heatbeat: (skip)
4204 * @object: A #SensorValue.
4205 *
4206 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property.
4207 *
4208 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4209 *
4210 * Returns: The property value.
4211 */
4212gint
4213sensor_value_get_heatbeat (SensorValue *object)
4214{
4215 return SENSOR_VALUE_GET_IFACE (object)->get_heatbeat (object);
4216}
4217
4218/**
4219 * sensor_value_set_heatbeat: (skip)
4220 * @object: A #SensorValue.
4221 * @value: The value to set.
4222 *
4223 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property to @value.
4224 *
4225 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4226 */
4227void
4228sensor_value_set_heatbeat (SensorValue *object, gint value)
4229{
4230 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
4231}
4232
4233/**
4234 * sensor_value_get_settable: (skip)
4235 * @object: A #SensorValue.
4236 *
4237 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property.
4238 *
4239 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4240 *
4241 * Returns: The property value.
4242 */
4243gboolean
4244sensor_value_get_settable (SensorValue *object)
4245{
4246 return SENSOR_VALUE_GET_IFACE (object)->get_settable (object);
4247}
4248
4249/**
4250 * sensor_value_set_settable: (skip)
4251 * @object: A #SensorValue.
4252 * @value: The value to set.
4253 *
4254 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property to @value.
4255 *
4256 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4257 */
4258void
4259sensor_value_set_settable (SensorValue *object, gboolean value)
4260{
4261 g_object_set (G_OBJECT (object), "settable", value, NULL);
4262}
4263
4264/**
Norman James362a80f2015-09-14 14:04:39 -05004265 * sensor_value_emit_changed:
4266 * @object: A #SensorValue.
4267 * @arg_value: Argument to pass with the signal.
4268 * @arg_units: Argument to pass with the signal.
4269 *
4270 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Changed">"Changed"</link> D-Bus signal.
4271 */
4272void
4273sensor_value_emit_changed (
4274 SensorValue *object,
4275 GVariant *arg_value,
4276 const gchar *arg_units)
4277{
4278 g_signal_emit_by_name (object, "changed", arg_value, arg_units);
4279}
4280
4281/**
Norman James32e74e22015-09-15 21:28:06 -05004282 * sensor_value_emit_error:
4283 * @object: A #SensorValue.
4284 *
4285 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Error">"Error"</link> D-Bus signal.
4286 */
4287void
4288sensor_value_emit_error (
4289 SensorValue *object)
4290{
4291 g_signal_emit_by_name (object, "error");
4292}
4293
4294/**
Norman James362a80f2015-09-14 14:04:39 -05004295 * sensor_value_emit_heartbeat:
4296 * @object: A #SensorValue.
4297 * @arg_bus_name: Argument to pass with the signal.
4298 *
4299 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Heartbeat">"Heartbeat"</link> D-Bus signal.
4300 */
4301void
4302sensor_value_emit_heartbeat (
4303 SensorValue *object,
4304 const gchar *arg_bus_name)
4305{
4306 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
4307}
4308
4309/**
4310 * sensor_value_call_init:
4311 * @proxy: A #SensorValueProxy.
4312 * @cancellable: (allow-none): A #GCancellable or %NULL.
4313 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4314 * @user_data: User data to pass to @callback.
4315 *
4316 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method on @proxy.
4317 * 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.
4318 * You can then call sensor_value_call_init_finish() to get the result of the operation.
4319 *
4320 * See sensor_value_call_init_sync() for the synchronous, blocking version of this method.
4321 */
4322void
4323sensor_value_call_init (
4324 SensorValue *proxy,
4325 GCancellable *cancellable,
4326 GAsyncReadyCallback callback,
4327 gpointer user_data)
4328{
4329 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4330 "init",
4331 g_variant_new ("()"),
4332 G_DBUS_CALL_FLAGS_NONE,
4333 -1,
4334 cancellable,
4335 callback,
4336 user_data);
4337}
4338
4339/**
4340 * sensor_value_call_init_finish:
4341 * @proxy: A #SensorValueProxy.
4342 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_init().
4343 * @error: Return location for error or %NULL.
4344 *
4345 * Finishes an operation started with sensor_value_call_init().
4346 *
4347 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4348 */
4349gboolean
4350sensor_value_call_init_finish (
4351 SensorValue *proxy,
4352 GAsyncResult *res,
4353 GError **error)
4354{
4355 GVariant *_ret;
4356 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4357 if (_ret == NULL)
4358 goto _out;
4359 g_variant_get (_ret,
4360 "()");
4361 g_variant_unref (_ret);
4362_out:
4363 return _ret != NULL;
4364}
4365
4366/**
4367 * sensor_value_call_init_sync:
4368 * @proxy: A #SensorValueProxy.
4369 * @cancellable: (allow-none): A #GCancellable or %NULL.
4370 * @error: Return location for error or %NULL.
4371 *
4372 * 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.
4373 *
4374 * See sensor_value_call_init() for the asynchronous version of this method.
4375 *
4376 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4377 */
4378gboolean
4379sensor_value_call_init_sync (
4380 SensorValue *proxy,
4381 GCancellable *cancellable,
4382 GError **error)
4383{
4384 GVariant *_ret;
4385 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4386 "init",
4387 g_variant_new ("()"),
4388 G_DBUS_CALL_FLAGS_NONE,
4389 -1,
4390 cancellable,
4391 error);
4392 if (_ret == NULL)
4393 goto _out;
4394 g_variant_get (_ret,
4395 "()");
4396 g_variant_unref (_ret);
4397_out:
4398 return _ret != NULL;
4399}
4400
4401/**
4402 * sensor_value_call_get_value:
4403 * @proxy: A #SensorValueProxy.
4404 * @cancellable: (allow-none): A #GCancellable or %NULL.
4405 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4406 * @user_data: User data to pass to @callback.
4407 *
4408 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method on @proxy.
4409 * 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.
4410 * You can then call sensor_value_call_get_value_finish() to get the result of the operation.
4411 *
4412 * See sensor_value_call_get_value_sync() for the synchronous, blocking version of this method.
4413 */
4414void
4415sensor_value_call_get_value (
4416 SensorValue *proxy,
4417 GCancellable *cancellable,
4418 GAsyncReadyCallback callback,
4419 gpointer user_data)
4420{
4421 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4422 "getValue",
4423 g_variant_new ("()"),
4424 G_DBUS_CALL_FLAGS_NONE,
4425 -1,
4426 cancellable,
4427 callback,
4428 user_data);
4429}
4430
4431/**
4432 * sensor_value_call_get_value_finish:
4433 * @proxy: A #SensorValueProxy.
4434 * @out_value: (out): Return location for return parameter or %NULL to ignore.
4435 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_get_value().
4436 * @error: Return location for error or %NULL.
4437 *
4438 * Finishes an operation started with sensor_value_call_get_value().
4439 *
4440 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4441 */
4442gboolean
4443sensor_value_call_get_value_finish (
4444 SensorValue *proxy,
4445 GVariant **out_value,
4446 GAsyncResult *res,
4447 GError **error)
4448{
4449 GVariant *_ret;
4450 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4451 if (_ret == NULL)
4452 goto _out;
4453 g_variant_get (_ret,
4454 "(@v)",
4455 out_value);
4456 g_variant_unref (_ret);
4457_out:
4458 return _ret != NULL;
4459}
4460
4461/**
4462 * sensor_value_call_get_value_sync:
4463 * @proxy: A #SensorValueProxy.
4464 * @out_value: (out): Return location for return parameter or %NULL to ignore.
4465 * @cancellable: (allow-none): A #GCancellable or %NULL.
4466 * @error: Return location for error or %NULL.
4467 *
4468 * 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.
4469 *
4470 * See sensor_value_call_get_value() for the asynchronous version of this method.
4471 *
4472 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4473 */
4474gboolean
4475sensor_value_call_get_value_sync (
4476 SensorValue *proxy,
4477 GVariant **out_value,
4478 GCancellable *cancellable,
4479 GError **error)
4480{
4481 GVariant *_ret;
4482 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4483 "getValue",
4484 g_variant_new ("()"),
4485 G_DBUS_CALL_FLAGS_NONE,
4486 -1,
4487 cancellable,
4488 error);
4489 if (_ret == NULL)
4490 goto _out;
4491 g_variant_get (_ret,
4492 "(@v)",
4493 out_value);
4494 g_variant_unref (_ret);
4495_out:
4496 return _ret != NULL;
4497}
4498
4499/**
Norman James19e45912015-10-04 20:19:41 -05004500 * sensor_value_call_set_value:
4501 * @proxy: A #SensorValueProxy.
4502 * @arg_value: Argument to pass with the method invocation.
4503 * @cancellable: (allow-none): A #GCancellable or %NULL.
4504 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4505 * @user_data: User data to pass to @callback.
4506 *
4507 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method on @proxy.
4508 * 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.
4509 * You can then call sensor_value_call_set_value_finish() to get the result of the operation.
4510 *
4511 * See sensor_value_call_set_value_sync() for the synchronous, blocking version of this method.
4512 */
4513void
4514sensor_value_call_set_value (
4515 SensorValue *proxy,
4516 GVariant *arg_value,
4517 GCancellable *cancellable,
4518 GAsyncReadyCallback callback,
4519 gpointer user_data)
4520{
4521 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4522 "setValue",
4523 g_variant_new ("(@v)",
4524 arg_value),
4525 G_DBUS_CALL_FLAGS_NONE,
4526 -1,
4527 cancellable,
4528 callback,
4529 user_data);
4530}
4531
4532/**
4533 * sensor_value_call_set_value_finish:
4534 * @proxy: A #SensorValueProxy.
4535 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_set_value().
4536 * @error: Return location for error or %NULL.
4537 *
4538 * Finishes an operation started with sensor_value_call_set_value().
4539 *
4540 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4541 */
4542gboolean
4543sensor_value_call_set_value_finish (
4544 SensorValue *proxy,
4545 GAsyncResult *res,
4546 GError **error)
4547{
4548 GVariant *_ret;
4549 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4550 if (_ret == NULL)
4551 goto _out;
4552 g_variant_get (_ret,
4553 "()");
4554 g_variant_unref (_ret);
4555_out:
4556 return _ret != NULL;
4557}
4558
4559/**
4560 * sensor_value_call_set_value_sync:
4561 * @proxy: A #SensorValueProxy.
4562 * @arg_value: Argument to pass with the method invocation.
4563 * @cancellable: (allow-none): A #GCancellable or %NULL.
4564 * @error: Return location for error or %NULL.
4565 *
4566 * 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.
4567 *
4568 * See sensor_value_call_set_value() for the asynchronous version of this method.
4569 *
4570 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4571 */
4572gboolean
4573sensor_value_call_set_value_sync (
4574 SensorValue *proxy,
4575 GVariant *arg_value,
4576 GCancellable *cancellable,
4577 GError **error)
4578{
4579 GVariant *_ret;
4580 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4581 "setValue",
4582 g_variant_new ("(@v)",
4583 arg_value),
4584 G_DBUS_CALL_FLAGS_NONE,
4585 -1,
4586 cancellable,
4587 error);
4588 if (_ret == NULL)
4589 goto _out;
4590 g_variant_get (_ret,
4591 "()");
4592 g_variant_unref (_ret);
4593_out:
4594 return _ret != NULL;
4595}
4596
4597/**
Norman James362a80f2015-09-14 14:04:39 -05004598 * sensor_value_complete_init:
4599 * @object: A #SensorValue.
4600 * @invocation: (transfer full): A #GDBusMethodInvocation.
4601 *
4602 * 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.
4603 *
4604 * This method will free @invocation, you cannot use it afterwards.
4605 */
4606void
4607sensor_value_complete_init (
4608 SensorValue *object,
4609 GDBusMethodInvocation *invocation)
4610{
4611 g_dbus_method_invocation_return_value (invocation,
4612 g_variant_new ("()"));
4613}
4614
4615/**
4616 * sensor_value_complete_get_value:
4617 * @object: A #SensorValue.
4618 * @invocation: (transfer full): A #GDBusMethodInvocation.
4619 * @value: Parameter to return.
4620 *
4621 * 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.
4622 *
4623 * This method will free @invocation, you cannot use it afterwards.
4624 */
4625void
4626sensor_value_complete_get_value (
4627 SensorValue *object,
4628 GDBusMethodInvocation *invocation,
4629 GVariant *value)
4630{
4631 g_dbus_method_invocation_return_value (invocation,
4632 g_variant_new ("(@v)",
4633 value));
4634}
4635
Norman James19e45912015-10-04 20:19:41 -05004636/**
4637 * sensor_value_complete_set_value:
4638 * @object: A #SensorValue.
4639 * @invocation: (transfer full): A #GDBusMethodInvocation.
4640 *
4641 * 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.
4642 *
4643 * This method will free @invocation, you cannot use it afterwards.
4644 */
4645void
4646sensor_value_complete_set_value (
4647 SensorValue *object,
4648 GDBusMethodInvocation *invocation)
4649{
4650 g_dbus_method_invocation_return_value (invocation,
4651 g_variant_new ("()"));
4652}
4653
Norman James362a80f2015-09-14 14:04:39 -05004654/* ------------------------------------------------------------------------ */
4655
4656/**
4657 * SensorValueProxy:
4658 *
4659 * The #SensorValueProxy structure contains only private data and should only be accessed using the provided API.
4660 */
4661
4662/**
4663 * SensorValueProxyClass:
4664 * @parent_class: The parent class.
4665 *
4666 * Class structure for #SensorValueProxy.
4667 */
4668
4669struct _SensorValueProxyPrivate
4670{
4671 GData *qdata;
4672};
4673
4674static void sensor_value_proxy_iface_init (SensorValueIface *iface);
4675
4676#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4677G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
4678 G_ADD_PRIVATE (SensorValueProxy)
4679 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init));
4680
4681#else
4682G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
4683 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init));
4684
4685#endif
4686static void
4687sensor_value_proxy_finalize (GObject *object)
4688{
4689 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4690 g_datalist_clear (&proxy->priv->qdata);
4691 G_OBJECT_CLASS (sensor_value_proxy_parent_class)->finalize (object);
4692}
4693
4694static void
4695sensor_value_proxy_get_property (GObject *object,
4696 guint prop_id,
4697 GValue *value,
4698 GParamSpec *pspec G_GNUC_UNUSED)
4699{
4700 const _ExtendedGDBusPropertyInfo *info;
4701 GVariant *variant;
Norman Jamesdfdaca92015-09-27 22:11:15 -05004702 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05004703 info = _sensor_value_property_info_pointers[prop_id - 1];
4704 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
4705 if (info->use_gvariant)
4706 {
4707 g_value_set_variant (value, variant);
4708 }
4709 else
4710 {
4711 if (variant != NULL)
4712 g_dbus_gvariant_to_gvalue (variant, value);
4713 }
4714 if (variant != NULL)
4715 g_variant_unref (variant);
4716}
4717
4718static void
4719sensor_value_proxy_set_property_cb (GDBusProxy *proxy,
4720 GAsyncResult *res,
4721 gpointer user_data)
4722{
4723 const _ExtendedGDBusPropertyInfo *info = user_data;
4724 GError *error;
4725 GVariant *_ret;
4726 error = NULL;
4727 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
4728 if (!_ret)
4729 {
4730 g_warning ("Error setting property '%s' on interface org.openbmc.SensorValue: %s (%s, %d)",
4731 info->parent_struct.name,
4732 error->message, g_quark_to_string (error->domain), error->code);
4733 g_error_free (error);
4734 }
4735 else
4736 {
4737 g_variant_unref (_ret);
4738 }
4739}
4740
4741static void
4742sensor_value_proxy_set_property (GObject *object,
4743 guint prop_id,
4744 const GValue *value,
4745 GParamSpec *pspec G_GNUC_UNUSED)
4746{
4747 const _ExtendedGDBusPropertyInfo *info;
4748 GVariant *variant;
Norman Jamesdfdaca92015-09-27 22:11:15 -05004749 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05004750 info = _sensor_value_property_info_pointers[prop_id - 1];
4751 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
4752 g_dbus_proxy_call (G_DBUS_PROXY (object),
4753 "org.freedesktop.DBus.Properties.Set",
4754 g_variant_new ("(ssv)", "org.openbmc.SensorValue", info->parent_struct.name, variant),
4755 G_DBUS_CALL_FLAGS_NONE,
4756 -1,
4757 NULL, (GAsyncReadyCallback) sensor_value_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
4758 g_variant_unref (variant);
4759}
4760
4761static void
4762sensor_value_proxy_g_signal (GDBusProxy *proxy,
4763 const gchar *sender_name G_GNUC_UNUSED,
4764 const gchar *signal_name,
4765 GVariant *parameters)
4766{
4767 _ExtendedGDBusSignalInfo *info;
4768 GVariantIter iter;
4769 GVariant *child;
4770 GValue *paramv;
4771 guint num_params;
4772 guint n;
4773 guint signal_id;
4774 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, signal_name);
4775 if (info == NULL)
4776 return;
4777 num_params = g_variant_n_children (parameters);
4778 paramv = g_new0 (GValue, num_params + 1);
4779 g_value_init (&paramv[0], TYPE_SENSOR_VALUE);
4780 g_value_set_object (&paramv[0], proxy);
4781 g_variant_iter_init (&iter, parameters);
4782 n = 1;
4783 while ((child = g_variant_iter_next_value (&iter)) != NULL)
4784 {
4785 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
4786 if (arg_info->use_gvariant)
4787 {
4788 g_value_init (&paramv[n], G_TYPE_VARIANT);
4789 g_value_set_variant (&paramv[n], child);
4790 n++;
4791 }
4792 else
4793 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
4794 g_variant_unref (child);
4795 }
4796 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
4797 g_signal_emitv (paramv, signal_id, 0, NULL);
4798 for (n = 0; n < num_params + 1; n++)
4799 g_value_unset (&paramv[n]);
4800 g_free (paramv);
4801}
4802
4803static void
4804sensor_value_proxy_g_properties_changed (GDBusProxy *_proxy,
4805 GVariant *changed_properties,
4806 const gchar *const *invalidated_properties)
4807{
4808 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (_proxy);
4809 guint n;
4810 const gchar *key;
4811 GVariantIter *iter;
4812 _ExtendedGDBusPropertyInfo *info;
4813 g_variant_get (changed_properties, "a{sv}", &iter);
4814 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
4815 {
4816 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, key);
4817 g_datalist_remove_data (&proxy->priv->qdata, key);
4818 if (info != NULL)
4819 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4820 }
4821 g_variant_iter_free (iter);
4822 for (n = 0; invalidated_properties[n] != NULL; n++)
4823 {
4824 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, invalidated_properties[n]);
4825 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
4826 if (info != NULL)
4827 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4828 }
4829}
4830
4831static GVariant *
4832sensor_value_proxy_get_value (SensorValue *object)
4833{
4834 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4835 GVariant *variant;
4836 GVariant *value = NULL;
4837 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value");
4838 value = variant;
4839 if (variant != NULL)
4840 g_variant_unref (variant);
4841 return value;
4842}
4843
4844static const gchar *
4845sensor_value_proxy_get_units (SensorValue *object)
4846{
4847 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4848 GVariant *variant;
4849 const gchar *value = NULL;
4850 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units");
4851 if (variant != NULL)
4852 {
4853 value = g_variant_get_string (variant, NULL);
4854 g_variant_unref (variant);
4855 }
4856 return value;
4857}
4858
4859static gint
4860sensor_value_proxy_get_poll_interval (SensorValue *object)
4861{
4862 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4863 GVariant *variant;
4864 gint value = 0;
4865 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
4866 if (variant != NULL)
4867 {
4868 value = g_variant_get_int32 (variant);
4869 g_variant_unref (variant);
4870 }
4871 return value;
4872}
4873
4874static gint
4875sensor_value_proxy_get_heatbeat (SensorValue *object)
4876{
4877 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4878 GVariant *variant;
4879 gint value = 0;
4880 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
4881 if (variant != NULL)
4882 {
4883 value = g_variant_get_int32 (variant);
4884 g_variant_unref (variant);
4885 }
4886 return value;
4887}
4888
4889static gboolean
4890sensor_value_proxy_get_settable (SensorValue *object)
4891{
4892 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4893 GVariant *variant;
4894 gboolean value = 0;
4895 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "settable");
4896 if (variant != NULL)
4897 {
4898 value = g_variant_get_boolean (variant);
4899 g_variant_unref (variant);
4900 }
4901 return value;
4902}
4903
Norman James362a80f2015-09-14 14:04:39 -05004904static void
4905sensor_value_proxy_init (SensorValueProxy *proxy)
4906{
4907#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4908 proxy->priv = sensor_value_proxy_get_instance_private (proxy);
4909#else
4910 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_VALUE_PROXY, SensorValueProxyPrivate);
4911#endif
4912
4913 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_value_interface_info ());
4914}
4915
4916static void
4917sensor_value_proxy_class_init (SensorValueProxyClass *klass)
4918{
4919 GObjectClass *gobject_class;
4920 GDBusProxyClass *proxy_class;
4921
4922 gobject_class = G_OBJECT_CLASS (klass);
4923 gobject_class->finalize = sensor_value_proxy_finalize;
4924 gobject_class->get_property = sensor_value_proxy_get_property;
4925 gobject_class->set_property = sensor_value_proxy_set_property;
4926
4927 proxy_class = G_DBUS_PROXY_CLASS (klass);
4928 proxy_class->g_signal = sensor_value_proxy_g_signal;
4929 proxy_class->g_properties_changed = sensor_value_proxy_g_properties_changed;
4930
4931 sensor_value_override_properties (gobject_class, 1);
4932
4933#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
4934 g_type_class_add_private (klass, sizeof (SensorValueProxyPrivate));
4935#endif
4936}
4937
4938static void
4939sensor_value_proxy_iface_init (SensorValueIface *iface)
4940{
4941 iface->get_value = sensor_value_proxy_get_value;
4942 iface->get_units = sensor_value_proxy_get_units;
4943 iface->get_poll_interval = sensor_value_proxy_get_poll_interval;
4944 iface->get_heatbeat = sensor_value_proxy_get_heatbeat;
4945 iface->get_settable = sensor_value_proxy_get_settable;
Norman James362a80f2015-09-14 14:04:39 -05004946}
4947
4948/**
4949 * sensor_value_proxy_new:
4950 * @connection: A #GDBusConnection.
4951 * @flags: Flags from the #GDBusProxyFlags enumeration.
4952 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
4953 * @object_path: An object path.
4954 * @cancellable: (allow-none): A #GCancellable or %NULL.
4955 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
4956 * @user_data: User data to pass to @callback.
4957 *
4958 * 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.
4959 *
4960 * 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.
4961 * You can then call sensor_value_proxy_new_finish() to get the result of the operation.
4962 *
4963 * See sensor_value_proxy_new_sync() for the synchronous, blocking version of this constructor.
4964 */
4965void
4966sensor_value_proxy_new (
4967 GDBusConnection *connection,
4968 GDBusProxyFlags flags,
4969 const gchar *name,
4970 const gchar *object_path,
4971 GCancellable *cancellable,
4972 GAsyncReadyCallback callback,
4973 gpointer user_data)
4974{
4975 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);
4976}
4977
4978/**
4979 * sensor_value_proxy_new_finish:
4980 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new().
4981 * @error: Return location for error or %NULL
4982 *
4983 * Finishes an operation started with sensor_value_proxy_new().
4984 *
4985 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
4986 */
4987SensorValue *
4988sensor_value_proxy_new_finish (
4989 GAsyncResult *res,
4990 GError **error)
4991{
4992 GObject *ret;
4993 GObject *source_object;
4994 source_object = g_async_result_get_source_object (res);
4995 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
4996 g_object_unref (source_object);
4997 if (ret != NULL)
4998 return SENSOR_VALUE (ret);
4999 else
5000 return NULL;
5001}
5002
5003/**
5004 * sensor_value_proxy_new_sync:
5005 * @connection: A #GDBusConnection.
5006 * @flags: Flags from the #GDBusProxyFlags enumeration.
5007 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
5008 * @object_path: An object path.
5009 * @cancellable: (allow-none): A #GCancellable or %NULL.
5010 * @error: Return location for error or %NULL
5011 *
5012 * 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.
5013 *
5014 * The calling thread is blocked until a reply is received.
5015 *
5016 * See sensor_value_proxy_new() for the asynchronous version of this constructor.
5017 *
5018 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5019 */
5020SensorValue *
5021sensor_value_proxy_new_sync (
5022 GDBusConnection *connection,
5023 GDBusProxyFlags flags,
5024 const gchar *name,
5025 const gchar *object_path,
5026 GCancellable *cancellable,
5027 GError **error)
5028{
5029 GInitable *ret;
5030 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);
5031 if (ret != NULL)
5032 return SENSOR_VALUE (ret);
5033 else
5034 return NULL;
5035}
5036
5037
5038/**
5039 * sensor_value_proxy_new_for_bus:
5040 * @bus_type: A #GBusType.
5041 * @flags: Flags from the #GDBusProxyFlags enumeration.
5042 * @name: A bus name (well-known or unique).
5043 * @object_path: An object path.
5044 * @cancellable: (allow-none): A #GCancellable or %NULL.
5045 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
5046 * @user_data: User data to pass to @callback.
5047 *
5048 * Like sensor_value_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
5049 *
5050 * 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.
5051 * You can then call sensor_value_proxy_new_for_bus_finish() to get the result of the operation.
5052 *
5053 * See sensor_value_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
5054 */
5055void
5056sensor_value_proxy_new_for_bus (
5057 GBusType bus_type,
5058 GDBusProxyFlags flags,
5059 const gchar *name,
5060 const gchar *object_path,
5061 GCancellable *cancellable,
5062 GAsyncReadyCallback callback,
5063 gpointer user_data)
5064{
5065 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);
5066}
5067
5068/**
5069 * sensor_value_proxy_new_for_bus_finish:
5070 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new_for_bus().
5071 * @error: Return location for error or %NULL
5072 *
5073 * Finishes an operation started with sensor_value_proxy_new_for_bus().
5074 *
5075 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5076 */
5077SensorValue *
5078sensor_value_proxy_new_for_bus_finish (
5079 GAsyncResult *res,
5080 GError **error)
5081{
5082 GObject *ret;
5083 GObject *source_object;
5084 source_object = g_async_result_get_source_object (res);
5085 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
5086 g_object_unref (source_object);
5087 if (ret != NULL)
5088 return SENSOR_VALUE (ret);
5089 else
5090 return NULL;
5091}
5092
5093/**
5094 * sensor_value_proxy_new_for_bus_sync:
5095 * @bus_type: A #GBusType.
5096 * @flags: Flags from the #GDBusProxyFlags enumeration.
5097 * @name: A bus name (well-known or unique).
5098 * @object_path: An object path.
5099 * @cancellable: (allow-none): A #GCancellable or %NULL.
5100 * @error: Return location for error or %NULL
5101 *
5102 * Like sensor_value_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
5103 *
5104 * The calling thread is blocked until a reply is received.
5105 *
5106 * See sensor_value_proxy_new_for_bus() for the asynchronous version of this constructor.
5107 *
5108 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5109 */
5110SensorValue *
5111sensor_value_proxy_new_for_bus_sync (
5112 GBusType bus_type,
5113 GDBusProxyFlags flags,
5114 const gchar *name,
5115 const gchar *object_path,
5116 GCancellable *cancellable,
5117 GError **error)
5118{
5119 GInitable *ret;
5120 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);
5121 if (ret != NULL)
5122 return SENSOR_VALUE (ret);
5123 else
5124 return NULL;
5125}
5126
5127
5128/* ------------------------------------------------------------------------ */
5129
5130/**
5131 * SensorValueSkeleton:
5132 *
5133 * The #SensorValueSkeleton structure contains only private data and should only be accessed using the provided API.
5134 */
5135
5136/**
5137 * SensorValueSkeletonClass:
5138 * @parent_class: The parent class.
5139 *
5140 * Class structure for #SensorValueSkeleton.
5141 */
5142
5143struct _SensorValueSkeletonPrivate
5144{
5145 GValue *properties;
5146 GList *changed_properties;
5147 GSource *changed_properties_idle_source;
5148 GMainContext *context;
5149 GMutex lock;
5150};
5151
5152static void
5153_sensor_value_skeleton_handle_method_call (
5154 GDBusConnection *connection G_GNUC_UNUSED,
5155 const gchar *sender G_GNUC_UNUSED,
5156 const gchar *object_path G_GNUC_UNUSED,
5157 const gchar *interface_name,
5158 const gchar *method_name,
5159 GVariant *parameters,
5160 GDBusMethodInvocation *invocation,
5161 gpointer user_data)
5162{
5163 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5164 _ExtendedGDBusMethodInfo *info;
5165 GVariantIter iter;
5166 GVariant *child;
5167 GValue *paramv;
5168 guint num_params;
5169 guint num_extra;
5170 guint n;
5171 guint signal_id;
5172 GValue return_value = G_VALUE_INIT;
5173 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
5174 g_assert (info != NULL);
5175 num_params = g_variant_n_children (parameters);
5176 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
5177 n = 0;
5178 g_value_init (&paramv[n], TYPE_SENSOR_VALUE);
5179 g_value_set_object (&paramv[n++], skeleton);
5180 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
5181 g_value_set_object (&paramv[n++], invocation);
5182 if (info->pass_fdlist)
5183 {
5184#ifdef G_OS_UNIX
5185 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
5186 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
5187#else
5188 g_assert_not_reached ();
5189#endif
5190 }
5191 g_variant_iter_init (&iter, parameters);
5192 while ((child = g_variant_iter_next_value (&iter)) != NULL)
5193 {
5194 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
5195 if (arg_info->use_gvariant)
5196 {
5197 g_value_init (&paramv[n], G_TYPE_VARIANT);
5198 g_value_set_variant (&paramv[n], child);
5199 n++;
5200 }
5201 else
5202 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
5203 g_variant_unref (child);
5204 }
5205 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
5206 g_value_init (&return_value, G_TYPE_BOOLEAN);
5207 g_signal_emitv (paramv, signal_id, 0, &return_value);
5208 if (!g_value_get_boolean (&return_value))
5209 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);
5210 g_value_unset (&return_value);
5211 for (n = 0; n < num_params + num_extra; n++)
5212 g_value_unset (&paramv[n]);
5213 g_free (paramv);
5214}
5215
5216static GVariant *
5217_sensor_value_skeleton_handle_get_property (
5218 GDBusConnection *connection G_GNUC_UNUSED,
5219 const gchar *sender G_GNUC_UNUSED,
5220 const gchar *object_path G_GNUC_UNUSED,
5221 const gchar *interface_name G_GNUC_UNUSED,
5222 const gchar *property_name,
5223 GError **error,
5224 gpointer user_data)
5225{
5226 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5227 GValue value = G_VALUE_INIT;
5228 GParamSpec *pspec;
5229 _ExtendedGDBusPropertyInfo *info;
5230 GVariant *ret;
5231 ret = NULL;
5232 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
5233 g_assert (info != NULL);
5234 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5235 if (pspec == NULL)
5236 {
5237 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5238 }
5239 else
5240 {
5241 g_value_init (&value, pspec->value_type);
5242 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5243 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
5244 g_value_unset (&value);
5245 }
5246 return ret;
5247}
5248
5249static gboolean
5250_sensor_value_skeleton_handle_set_property (
5251 GDBusConnection *connection G_GNUC_UNUSED,
5252 const gchar *sender G_GNUC_UNUSED,
5253 const gchar *object_path G_GNUC_UNUSED,
5254 const gchar *interface_name G_GNUC_UNUSED,
5255 const gchar *property_name,
5256 GVariant *variant,
5257 GError **error,
5258 gpointer user_data)
5259{
5260 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5261 GValue value = G_VALUE_INIT;
5262 GParamSpec *pspec;
5263 _ExtendedGDBusPropertyInfo *info;
5264 gboolean ret;
5265 ret = FALSE;
5266 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
5267 g_assert (info != NULL);
5268 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5269 if (pspec == NULL)
5270 {
5271 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5272 }
5273 else
5274 {
5275 if (info->use_gvariant)
5276 g_value_set_variant (&value, variant);
5277 else
5278 g_dbus_gvariant_to_gvalue (variant, &value);
5279 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5280 g_value_unset (&value);
5281 ret = TRUE;
5282 }
5283 return ret;
5284}
5285
5286static const GDBusInterfaceVTable _sensor_value_skeleton_vtable =
5287{
5288 _sensor_value_skeleton_handle_method_call,
5289 _sensor_value_skeleton_handle_get_property,
5290 _sensor_value_skeleton_handle_set_property,
5291 {NULL}
5292};
5293
5294static GDBusInterfaceInfo *
5295sensor_value_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5296{
5297 return sensor_value_interface_info ();
5298}
5299
5300static GDBusInterfaceVTable *
5301sensor_value_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5302{
5303 return (GDBusInterfaceVTable *) &_sensor_value_skeleton_vtable;
5304}
5305
5306static GVariant *
5307sensor_value_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
5308{
5309 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
5310
5311 GVariantBuilder builder;
5312 guint n;
5313 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5314 if (_sensor_value_interface_info.parent_struct.properties == NULL)
5315 goto out;
5316 for (n = 0; _sensor_value_interface_info.parent_struct.properties[n] != NULL; n++)
5317 {
5318 GDBusPropertyInfo *info = _sensor_value_interface_info.parent_struct.properties[n];
5319 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
5320 {
5321 GVariant *value;
5322 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);
5323 if (value != NULL)
5324 {
5325 g_variant_take_ref (value);
5326 g_variant_builder_add (&builder, "{sv}", info->name, value);
5327 g_variant_unref (value);
5328 }
5329 }
5330 }
5331out:
5332 return g_variant_builder_end (&builder);
5333}
5334
5335static gboolean _sensor_value_emit_changed (gpointer user_data);
5336
5337static void
5338sensor_value_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
5339{
5340 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
5341 gboolean emit_changed = FALSE;
5342
5343 g_mutex_lock (&skeleton->priv->lock);
5344 if (skeleton->priv->changed_properties_idle_source != NULL)
5345 {
5346 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5347 skeleton->priv->changed_properties_idle_source = NULL;
5348 emit_changed = TRUE;
5349 }
5350 g_mutex_unlock (&skeleton->priv->lock);
5351
5352 if (emit_changed)
5353 _sensor_value_emit_changed (skeleton);
5354}
5355
5356static void
5357_sensor_value_on_signal_changed (
5358 SensorValue *object,
5359 GVariant *arg_value,
5360 const gchar *arg_units)
5361{
5362 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5363
5364 GList *connections, *l;
5365 GVariant *signal_variant;
5366 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5367
5368 signal_variant = g_variant_ref_sink (g_variant_new ("(@vs)",
5369 arg_value,
5370 arg_units));
5371 for (l = connections; l != NULL; l = l->next)
5372 {
5373 GDBusConnection *connection = l->data;
5374 g_dbus_connection_emit_signal (connection,
5375 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Changed",
5376 signal_variant, NULL);
5377 }
5378 g_variant_unref (signal_variant);
5379 g_list_free_full (connections, g_object_unref);
5380}
5381
5382static void
Norman James32e74e22015-09-15 21:28:06 -05005383_sensor_value_on_signal_error (
5384 SensorValue *object)
5385{
5386 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5387
5388 GList *connections, *l;
5389 GVariant *signal_variant;
5390 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5391
5392 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
5393 for (l = connections; l != NULL; l = l->next)
5394 {
5395 GDBusConnection *connection = l->data;
5396 g_dbus_connection_emit_signal (connection,
5397 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Error",
5398 signal_variant, NULL);
5399 }
5400 g_variant_unref (signal_variant);
5401 g_list_free_full (connections, g_object_unref);
5402}
5403
5404static void
Norman James362a80f2015-09-14 14:04:39 -05005405_sensor_value_on_signal_heartbeat (
5406 SensorValue *object,
5407 const gchar *arg_bus_name)
5408{
5409 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5410
5411 GList *connections, *l;
5412 GVariant *signal_variant;
5413 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5414
5415 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
5416 arg_bus_name));
5417 for (l = connections; l != NULL; l = l->next)
5418 {
5419 GDBusConnection *connection = l->data;
5420 g_dbus_connection_emit_signal (connection,
5421 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Heartbeat",
5422 signal_variant, NULL);
5423 }
5424 g_variant_unref (signal_variant);
5425 g_list_free_full (connections, g_object_unref);
5426}
5427
5428static void sensor_value_skeleton_iface_init (SensorValueIface *iface);
5429#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5430G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5431 G_ADD_PRIVATE (SensorValueSkeleton)
5432 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init));
5433
5434#else
5435G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5436 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init));
5437
5438#endif
5439static void
5440sensor_value_skeleton_finalize (GObject *object)
5441{
5442 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5443 guint n;
Norman Jamesdfdaca92015-09-27 22:11:15 -05005444 for (n = 0; n < 5; n++)
Norman James362a80f2015-09-14 14:04:39 -05005445 g_value_unset (&skeleton->priv->properties[n]);
5446 g_free (skeleton->priv->properties);
5447 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5448 if (skeleton->priv->changed_properties_idle_source != NULL)
5449 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5450 g_main_context_unref (skeleton->priv->context);
5451 g_mutex_clear (&skeleton->priv->lock);
5452 G_OBJECT_CLASS (sensor_value_skeleton_parent_class)->finalize (object);
5453}
5454
5455static void
5456sensor_value_skeleton_get_property (GObject *object,
5457 guint prop_id,
5458 GValue *value,
5459 GParamSpec *pspec G_GNUC_UNUSED)
5460{
5461 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman Jamesdfdaca92015-09-27 22:11:15 -05005462 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05005463 g_mutex_lock (&skeleton->priv->lock);
5464 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
5465 g_mutex_unlock (&skeleton->priv->lock);
5466}
5467
5468static gboolean
5469_sensor_value_emit_changed (gpointer user_data)
5470{
5471 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5472 GList *l;
5473 GVariantBuilder builder;
5474 GVariantBuilder invalidated_builder;
5475 guint num_changes;
5476
5477 g_mutex_lock (&skeleton->priv->lock);
5478 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5479 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
5480 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
5481 {
5482 ChangedProperty *cp = l->data;
5483 GVariant *variant;
5484 const GValue *cur_value;
5485
5486 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
5487 if (!_g_value_equal (cur_value, &cp->orig_value))
5488 {
5489 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
5490 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
5491 g_variant_unref (variant);
5492 num_changes++;
5493 }
5494 }
5495 if (num_changes > 0)
5496 {
5497 GList *connections, *ll;
5498 GVariant *signal_variant;
5499 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorValue",
5500 &builder, &invalidated_builder));
5501 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5502 for (ll = connections; ll != NULL; ll = ll->next)
5503 {
5504 GDBusConnection *connection = ll->data;
5505
5506 g_dbus_connection_emit_signal (connection,
5507 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
5508 "org.freedesktop.DBus.Properties",
5509 "PropertiesChanged",
5510 signal_variant,
5511 NULL);
5512 }
5513 g_variant_unref (signal_variant);
5514 g_list_free_full (connections, g_object_unref);
5515 }
5516 else
5517 {
5518 g_variant_builder_clear (&builder);
5519 g_variant_builder_clear (&invalidated_builder);
5520 }
5521 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5522 skeleton->priv->changed_properties = NULL;
5523 skeleton->priv->changed_properties_idle_source = NULL;
5524 g_mutex_unlock (&skeleton->priv->lock);
5525 return FALSE;
5526}
5527
5528static void
5529_sensor_value_schedule_emit_changed (SensorValueSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
5530{
5531 ChangedProperty *cp;
5532 GList *l;
5533 cp = NULL;
5534 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
5535 {
5536 ChangedProperty *i_cp = l->data;
5537 if (i_cp->info == info)
5538 {
5539 cp = i_cp;
5540 break;
5541 }
5542 }
5543 if (cp == NULL)
5544 {
5545 cp = g_new0 (ChangedProperty, 1);
5546 cp->prop_id = prop_id;
5547 cp->info = info;
5548 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
5549 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
5550 g_value_copy (orig_value, &cp->orig_value);
5551 }
5552}
5553
5554static void
5555sensor_value_skeleton_notify (GObject *object,
5556 GParamSpec *pspec G_GNUC_UNUSED)
5557{
5558 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5559 g_mutex_lock (&skeleton->priv->lock);
5560 if (skeleton->priv->changed_properties != NULL &&
5561 skeleton->priv->changed_properties_idle_source == NULL)
5562 {
5563 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
5564 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
5565 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_value_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylak2cb27752015-10-19 16:23:14 -05005566 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _sensor_value_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -05005567 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
5568 g_source_unref (skeleton->priv->changed_properties_idle_source);
5569 }
5570 g_mutex_unlock (&skeleton->priv->lock);
5571}
5572
5573static void
5574sensor_value_skeleton_set_property (GObject *object,
5575 guint prop_id,
5576 const GValue *value,
5577 GParamSpec *pspec)
5578{
5579 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman Jamesdfdaca92015-09-27 22:11:15 -05005580 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05005581 g_mutex_lock (&skeleton->priv->lock);
5582 g_object_freeze_notify (object);
5583 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
5584 {
5585 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
5586 _sensor_value_schedule_emit_changed (skeleton, _sensor_value_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
5587 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
5588 g_object_notify_by_pspec (object, pspec);
5589 }
5590 g_mutex_unlock (&skeleton->priv->lock);
5591 g_object_thaw_notify (object);
5592}
5593
5594static void
5595sensor_value_skeleton_init (SensorValueSkeleton *skeleton)
5596{
5597#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5598 skeleton->priv = sensor_value_skeleton_get_instance_private (skeleton);
5599#else
5600 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_VALUE_SKELETON, SensorValueSkeletonPrivate);
5601#endif
5602
5603 g_mutex_init (&skeleton->priv->lock);
5604 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman Jamesdfdaca92015-09-27 22:11:15 -05005605 skeleton->priv->properties = g_new0 (GValue, 5);
Norman James362a80f2015-09-14 14:04:39 -05005606 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
5607 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
5608 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
5609 g_value_init (&skeleton->priv->properties[3], G_TYPE_INT);
5610 g_value_init (&skeleton->priv->properties[4], G_TYPE_BOOLEAN);
Norman James362a80f2015-09-14 14:04:39 -05005611}
5612
5613static GVariant *
5614sensor_value_skeleton_get_value (SensorValue *object)
5615{
5616 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5617 GVariant *value;
5618 g_mutex_lock (&skeleton->priv->lock);
5619 value = g_value_get_variant (&(skeleton->priv->properties[0]));
5620 g_mutex_unlock (&skeleton->priv->lock);
5621 return value;
5622}
5623
5624static const gchar *
5625sensor_value_skeleton_get_units (SensorValue *object)
5626{
5627 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5628 const gchar *value;
5629 g_mutex_lock (&skeleton->priv->lock);
5630 value = g_value_get_string (&(skeleton->priv->properties[1]));
5631 g_mutex_unlock (&skeleton->priv->lock);
5632 return value;
5633}
5634
5635static gint
5636sensor_value_skeleton_get_poll_interval (SensorValue *object)
5637{
5638 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5639 gint value;
5640 g_mutex_lock (&skeleton->priv->lock);
5641 value = g_value_get_int (&(skeleton->priv->properties[2]));
5642 g_mutex_unlock (&skeleton->priv->lock);
5643 return value;
5644}
5645
5646static gint
5647sensor_value_skeleton_get_heatbeat (SensorValue *object)
5648{
5649 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5650 gint value;
5651 g_mutex_lock (&skeleton->priv->lock);
5652 value = g_value_get_int (&(skeleton->priv->properties[3]));
5653 g_mutex_unlock (&skeleton->priv->lock);
5654 return value;
5655}
5656
5657static gboolean
5658sensor_value_skeleton_get_settable (SensorValue *object)
5659{
5660 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5661 gboolean value;
5662 g_mutex_lock (&skeleton->priv->lock);
5663 value = g_value_get_boolean (&(skeleton->priv->properties[4]));
5664 g_mutex_unlock (&skeleton->priv->lock);
5665 return value;
5666}
5667
Norman James362a80f2015-09-14 14:04:39 -05005668static void
5669sensor_value_skeleton_class_init (SensorValueSkeletonClass *klass)
5670{
5671 GObjectClass *gobject_class;
5672 GDBusInterfaceSkeletonClass *skeleton_class;
5673
5674 gobject_class = G_OBJECT_CLASS (klass);
5675 gobject_class->finalize = sensor_value_skeleton_finalize;
5676 gobject_class->get_property = sensor_value_skeleton_get_property;
5677 gobject_class->set_property = sensor_value_skeleton_set_property;
5678 gobject_class->notify = sensor_value_skeleton_notify;
5679
5680
5681 sensor_value_override_properties (gobject_class, 1);
5682
5683 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
5684 skeleton_class->get_info = sensor_value_skeleton_dbus_interface_get_info;
5685 skeleton_class->get_properties = sensor_value_skeleton_dbus_interface_get_properties;
5686 skeleton_class->flush = sensor_value_skeleton_dbus_interface_flush;
5687 skeleton_class->get_vtable = sensor_value_skeleton_dbus_interface_get_vtable;
5688
5689#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
5690 g_type_class_add_private (klass, sizeof (SensorValueSkeletonPrivate));
5691#endif
5692}
5693
5694static void
5695sensor_value_skeleton_iface_init (SensorValueIface *iface)
5696{
5697 iface->changed = _sensor_value_on_signal_changed;
Norman James32e74e22015-09-15 21:28:06 -05005698 iface->error = _sensor_value_on_signal_error;
Norman James362a80f2015-09-14 14:04:39 -05005699 iface->heartbeat = _sensor_value_on_signal_heartbeat;
5700 iface->get_value = sensor_value_skeleton_get_value;
5701 iface->get_units = sensor_value_skeleton_get_units;
5702 iface->get_poll_interval = sensor_value_skeleton_get_poll_interval;
5703 iface->get_heatbeat = sensor_value_skeleton_get_heatbeat;
5704 iface->get_settable = sensor_value_skeleton_get_settable;
Norman James362a80f2015-09-14 14:04:39 -05005705}
5706
5707/**
5708 * sensor_value_skeleton_new:
5709 *
5710 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
5711 *
5712 * Returns: (transfer full) (type SensorValueSkeleton): The skeleton object.
5713 */
5714SensorValue *
5715sensor_value_skeleton_new (void)
5716{
5717 return SENSOR_VALUE (g_object_new (TYPE_SENSOR_VALUE_SKELETON, NULL));
5718}
5719
5720/* ------------------------------------------------------------------------
5721 * Code for interface org.openbmc.SensorThreshold
5722 * ------------------------------------------------------------------------
5723 */
5724
5725/**
5726 * SECTION:SensorThreshold
5727 * @title: SensorThreshold
5728 * @short_description: Generated C code for the org.openbmc.SensorThreshold D-Bus interface
5729 *
5730 * 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.
5731 */
5732
5733/* ---- Introspection data for org.openbmc.SensorThreshold ---- */
5734
5735static const _ExtendedGDBusArgInfo _sensor_threshold_method_info_get_state_OUT_ARG_state =
5736{
5737 {
5738 -1,
5739 (gchar *) "state",
5740 (gchar *) "y",
5741 NULL
5742 },
5743 FALSE
5744};
5745
5746static const _ExtendedGDBusArgInfo * const _sensor_threshold_method_info_get_state_OUT_ARG_pointers[] =
5747{
5748 &_sensor_threshold_method_info_get_state_OUT_ARG_state,
5749 NULL
5750};
5751
5752static const _ExtendedGDBusMethodInfo _sensor_threshold_method_info_get_state =
5753{
5754 {
5755 -1,
5756 (gchar *) "getState",
5757 NULL,
5758 (GDBusArgInfo **) &_sensor_threshold_method_info_get_state_OUT_ARG_pointers,
5759 NULL
5760 },
5761 "handle-get-state",
5762 FALSE
5763};
5764
5765static const _ExtendedGDBusMethodInfo * const _sensor_threshold_method_info_pointers[] =
5766{
5767 &_sensor_threshold_method_info_get_state,
5768 NULL
5769};
5770
5771static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_warning =
5772{
5773 {
5774 -1,
5775 (gchar *) "Warning",
5776 NULL,
5777 NULL
5778 },
5779 "warning"
5780};
5781
5782static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_critical =
5783{
5784 {
5785 -1,
5786 (gchar *) "Critical",
5787 NULL,
5788 NULL
5789 },
5790 "critical"
5791};
5792
5793static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_normal =
5794{
5795 {
5796 -1,
5797 (gchar *) "Normal",
5798 NULL,
5799 NULL
5800 },
5801 "normal"
5802};
5803
5804static const _ExtendedGDBusSignalInfo * const _sensor_threshold_signal_info_pointers[] =
5805{
5806 &_sensor_threshold_signal_info_warning,
5807 &_sensor_threshold_signal_info_critical,
5808 &_sensor_threshold_signal_info_normal,
5809 NULL
5810};
5811
5812static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_critical =
5813{
5814 {
5815 -1,
5816 (gchar *) "lower_critical",
5817 (gchar *) "v",
5818 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5819 NULL
5820 },
5821 "lower-critical",
5822 FALSE
5823};
5824
5825static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_warning =
5826{
5827 {
5828 -1,
5829 (gchar *) "lower_warning",
5830 (gchar *) "v",
5831 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5832 NULL
5833 },
5834 "lower-warning",
5835 FALSE
5836};
5837
5838static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_warning =
5839{
5840 {
5841 -1,
5842 (gchar *) "upper_warning",
5843 (gchar *) "v",
5844 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5845 NULL
5846 },
5847 "upper-warning",
5848 FALSE
5849};
5850
5851static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_critical =
5852{
5853 {
5854 -1,
5855 (gchar *) "upper_critical",
5856 (gchar *) "v",
5857 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5858 NULL
5859 },
5860 "upper-critical",
5861 FALSE
5862};
5863
5864static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_state =
5865{
5866 {
5867 -1,
5868 (gchar *) "state",
5869 (gchar *) "y",
5870 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
5871 NULL
5872 },
5873 "state",
5874 FALSE
5875};
5876
5877static const _ExtendedGDBusPropertyInfo * const _sensor_threshold_property_info_pointers[] =
5878{
5879 &_sensor_threshold_property_info_lower_critical,
5880 &_sensor_threshold_property_info_lower_warning,
5881 &_sensor_threshold_property_info_upper_warning,
5882 &_sensor_threshold_property_info_upper_critical,
5883 &_sensor_threshold_property_info_state,
5884 NULL
5885};
5886
5887static const _ExtendedGDBusInterfaceInfo _sensor_threshold_interface_info =
5888{
5889 {
5890 -1,
5891 (gchar *) "org.openbmc.SensorThreshold",
5892 (GDBusMethodInfo **) &_sensor_threshold_method_info_pointers,
5893 (GDBusSignalInfo **) &_sensor_threshold_signal_info_pointers,
5894 (GDBusPropertyInfo **) &_sensor_threshold_property_info_pointers,
5895 NULL
5896 },
5897 "sensor-threshold",
5898};
5899
5900
5901/**
5902 * sensor_threshold_interface_info:
5903 *
5904 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> D-Bus interface.
5905 *
5906 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
5907 */
5908GDBusInterfaceInfo *
5909sensor_threshold_interface_info (void)
5910{
5911 return (GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct;
5912}
5913
5914/**
5915 * sensor_threshold_override_properties:
5916 * @klass: The class structure for a #GObject<!-- -->-derived class.
5917 * @property_id_begin: The property id to assign to the first overridden property.
5918 *
5919 * Overrides all #GObject properties in the #SensorThreshold interface for a concrete class.
5920 * The properties are overridden in the order they are defined.
5921 *
5922 * Returns: The last property id.
5923 */
5924guint
5925sensor_threshold_override_properties (GObjectClass *klass, guint property_id_begin)
5926{
5927 g_object_class_override_property (klass, property_id_begin++, "lower-critical");
5928 g_object_class_override_property (klass, property_id_begin++, "lower-warning");
5929 g_object_class_override_property (klass, property_id_begin++, "upper-warning");
5930 g_object_class_override_property (klass, property_id_begin++, "upper-critical");
5931 g_object_class_override_property (klass, property_id_begin++, "state");
5932 return property_id_begin - 1;
5933}
5934
5935
5936
5937/**
5938 * SensorThreshold:
5939 *
5940 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
5941 */
5942
5943/**
5944 * SensorThresholdIface:
5945 * @parent_iface: The parent interface.
5946 * @handle_get_state: Handler for the #SensorThreshold::handle-get-state signal.
5947 * @get_lower_critical: Getter for the #SensorThreshold:lower-critical property.
5948 * @get_lower_warning: Getter for the #SensorThreshold:lower-warning property.
5949 * @get_state: Getter for the #SensorThreshold:state property.
5950 * @get_upper_critical: Getter for the #SensorThreshold:upper-critical property.
5951 * @get_upper_warning: Getter for the #SensorThreshold:upper-warning property.
5952 * @critical: Handler for the #SensorThreshold::critical signal.
5953 * @normal: Handler for the #SensorThreshold::normal signal.
5954 * @warning: Handler for the #SensorThreshold::warning signal.
5955 *
5956 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
5957 */
5958
5959typedef SensorThresholdIface SensorThresholdInterface;
5960G_DEFINE_INTERFACE (SensorThreshold, sensor_threshold, G_TYPE_OBJECT);
5961
5962static void
5963sensor_threshold_default_init (SensorThresholdIface *iface)
5964{
5965 /* GObject signals for incoming D-Bus method calls: */
5966 /**
5967 * SensorThreshold::handle-get-state:
5968 * @object: A #SensorThreshold.
5969 * @invocation: A #GDBusMethodInvocation.
5970 *
5971 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method.
5972 *
5973 * 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.
5974 *
5975 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
5976 */
5977 g_signal_new ("handle-get-state",
5978 G_TYPE_FROM_INTERFACE (iface),
5979 G_SIGNAL_RUN_LAST,
5980 G_STRUCT_OFFSET (SensorThresholdIface, handle_get_state),
5981 g_signal_accumulator_true_handled,
5982 NULL,
5983 g_cclosure_marshal_generic,
5984 G_TYPE_BOOLEAN,
5985 1,
5986 G_TYPE_DBUS_METHOD_INVOCATION);
5987
5988 /* GObject signals for received D-Bus signals: */
5989 /**
5990 * SensorThreshold::warning:
5991 * @object: A #SensorThreshold.
5992 *
5993 * 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.
5994 *
5995 * 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.
5996 */
5997 g_signal_new ("warning",
5998 G_TYPE_FROM_INTERFACE (iface),
5999 G_SIGNAL_RUN_LAST,
6000 G_STRUCT_OFFSET (SensorThresholdIface, warning),
6001 NULL,
6002 NULL,
6003 g_cclosure_marshal_generic,
6004 G_TYPE_NONE,
6005 0);
6006
6007 /**
6008 * SensorThreshold::critical:
6009 * @object: A #SensorThreshold.
6010 *
6011 * 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.
6012 *
6013 * 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.
6014 */
6015 g_signal_new ("critical",
6016 G_TYPE_FROM_INTERFACE (iface),
6017 G_SIGNAL_RUN_LAST,
6018 G_STRUCT_OFFSET (SensorThresholdIface, critical),
6019 NULL,
6020 NULL,
6021 g_cclosure_marshal_generic,
6022 G_TYPE_NONE,
6023 0);
6024
6025 /**
6026 * SensorThreshold::normal:
6027 * @object: A #SensorThreshold.
6028 *
6029 * 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.
6030 *
6031 * 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.
6032 */
6033 g_signal_new ("normal",
6034 G_TYPE_FROM_INTERFACE (iface),
6035 G_SIGNAL_RUN_LAST,
6036 G_STRUCT_OFFSET (SensorThresholdIface, normal),
6037 NULL,
6038 NULL,
6039 g_cclosure_marshal_generic,
6040 G_TYPE_NONE,
6041 0);
6042
6043 /* GObject properties for D-Bus properties: */
6044 /**
6045 * SensorThreshold:lower-critical:
6046 *
6047 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link>.
6048 *
6049 * 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.
6050 */
6051 g_object_interface_install_property (iface,
6052 g_param_spec_variant ("lower-critical", "lower_critical", "lower_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6053 /**
6054 * SensorThreshold:lower-warning:
6055 *
6056 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link>.
6057 *
6058 * 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.
6059 */
6060 g_object_interface_install_property (iface,
6061 g_param_spec_variant ("lower-warning", "lower_warning", "lower_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6062 /**
6063 * SensorThreshold:upper-warning:
6064 *
6065 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link>.
6066 *
6067 * 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.
6068 */
6069 g_object_interface_install_property (iface,
6070 g_param_spec_variant ("upper-warning", "upper_warning", "upper_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6071 /**
6072 * SensorThreshold:upper-critical:
6073 *
6074 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link>.
6075 *
6076 * 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.
6077 */
6078 g_object_interface_install_property (iface,
6079 g_param_spec_variant ("upper-critical", "upper_critical", "upper_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6080 /**
6081 * SensorThreshold:state:
6082 *
6083 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link>.
6084 *
6085 * 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.
6086 */
6087 g_object_interface_install_property (iface,
6088 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6089}
6090
6091/**
6092 * sensor_threshold_get_lower_critical: (skip)
6093 * @object: A #SensorThreshold.
6094 *
6095 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property.
6096 *
6097 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6098 *
6099 * <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>
6100 *
6101 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6102 */
6103GVariant *
6104sensor_threshold_get_lower_critical (SensorThreshold *object)
6105{
6106 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_critical (object);
6107}
6108
6109/**
6110 * sensor_threshold_dup_lower_critical: (skip)
6111 * @object: A #SensorThreshold.
6112 *
6113 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property.
6114 *
6115 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6116 *
6117 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6118 */
6119GVariant *
6120sensor_threshold_dup_lower_critical (SensorThreshold *object)
6121{
6122 GVariant *value;
6123 g_object_get (G_OBJECT (object), "lower-critical", &value, NULL);
6124 return value;
6125}
6126
6127/**
6128 * sensor_threshold_set_lower_critical: (skip)
6129 * @object: A #SensorThreshold.
6130 * @value: The value to set.
6131 *
6132 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property to @value.
6133 *
6134 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6135 */
6136void
6137sensor_threshold_set_lower_critical (SensorThreshold *object, GVariant *value)
6138{
6139 g_object_set (G_OBJECT (object), "lower-critical", value, NULL);
6140}
6141
6142/**
6143 * sensor_threshold_get_lower_warning: (skip)
6144 * @object: A #SensorThreshold.
6145 *
6146 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property.
6147 *
6148 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6149 *
6150 * <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>
6151 *
6152 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6153 */
6154GVariant *
6155sensor_threshold_get_lower_warning (SensorThreshold *object)
6156{
6157 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_warning (object);
6158}
6159
6160/**
6161 * sensor_threshold_dup_lower_warning: (skip)
6162 * @object: A #SensorThreshold.
6163 *
6164 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property.
6165 *
6166 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6167 *
6168 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6169 */
6170GVariant *
6171sensor_threshold_dup_lower_warning (SensorThreshold *object)
6172{
6173 GVariant *value;
6174 g_object_get (G_OBJECT (object), "lower-warning", &value, NULL);
6175 return value;
6176}
6177
6178/**
6179 * sensor_threshold_set_lower_warning: (skip)
6180 * @object: A #SensorThreshold.
6181 * @value: The value to set.
6182 *
6183 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property to @value.
6184 *
6185 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6186 */
6187void
6188sensor_threshold_set_lower_warning (SensorThreshold *object, GVariant *value)
6189{
6190 g_object_set (G_OBJECT (object), "lower-warning", value, NULL);
6191}
6192
6193/**
6194 * sensor_threshold_get_upper_warning: (skip)
6195 * @object: A #SensorThreshold.
6196 *
6197 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property.
6198 *
6199 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6200 *
6201 * <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>
6202 *
6203 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6204 */
6205GVariant *
6206sensor_threshold_get_upper_warning (SensorThreshold *object)
6207{
6208 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_warning (object);
6209}
6210
6211/**
6212 * sensor_threshold_dup_upper_warning: (skip)
6213 * @object: A #SensorThreshold.
6214 *
6215 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property.
6216 *
6217 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6218 *
6219 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6220 */
6221GVariant *
6222sensor_threshold_dup_upper_warning (SensorThreshold *object)
6223{
6224 GVariant *value;
6225 g_object_get (G_OBJECT (object), "upper-warning", &value, NULL);
6226 return value;
6227}
6228
6229/**
6230 * sensor_threshold_set_upper_warning: (skip)
6231 * @object: A #SensorThreshold.
6232 * @value: The value to set.
6233 *
6234 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property to @value.
6235 *
6236 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6237 */
6238void
6239sensor_threshold_set_upper_warning (SensorThreshold *object, GVariant *value)
6240{
6241 g_object_set (G_OBJECT (object), "upper-warning", value, NULL);
6242}
6243
6244/**
6245 * sensor_threshold_get_upper_critical: (skip)
6246 * @object: A #SensorThreshold.
6247 *
6248 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property.
6249 *
6250 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6251 *
6252 * <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>
6253 *
6254 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6255 */
6256GVariant *
6257sensor_threshold_get_upper_critical (SensorThreshold *object)
6258{
6259 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_critical (object);
6260}
6261
6262/**
6263 * sensor_threshold_dup_upper_critical: (skip)
6264 * @object: A #SensorThreshold.
6265 *
6266 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property.
6267 *
6268 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6269 *
6270 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6271 */
6272GVariant *
6273sensor_threshold_dup_upper_critical (SensorThreshold *object)
6274{
6275 GVariant *value;
6276 g_object_get (G_OBJECT (object), "upper-critical", &value, NULL);
6277 return value;
6278}
6279
6280/**
6281 * sensor_threshold_set_upper_critical: (skip)
6282 * @object: A #SensorThreshold.
6283 * @value: The value to set.
6284 *
6285 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property to @value.
6286 *
6287 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6288 */
6289void
6290sensor_threshold_set_upper_critical (SensorThreshold *object, GVariant *value)
6291{
6292 g_object_set (G_OBJECT (object), "upper-critical", value, NULL);
6293}
6294
6295/**
6296 * sensor_threshold_get_state: (skip)
6297 * @object: A #SensorThreshold.
6298 *
6299 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property.
6300 *
6301 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
6302 *
6303 * Returns: The property value.
6304 */
6305guchar
6306sensor_threshold_get_state (SensorThreshold *object)
6307{
6308 return SENSOR_THRESHOLD_GET_IFACE (object)->get_state (object);
6309}
6310
6311/**
6312 * sensor_threshold_set_state: (skip)
6313 * @object: A #SensorThreshold.
6314 * @value: The value to set.
6315 *
6316 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property to @value.
6317 *
6318 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
6319 */
6320void
6321sensor_threshold_set_state (SensorThreshold *object, guchar value)
6322{
6323 g_object_set (G_OBJECT (object), "state", value, NULL);
6324}
6325
6326/**
6327 * sensor_threshold_emit_warning:
6328 * @object: A #SensorThreshold.
6329 *
6330 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Warning">"Warning"</link> D-Bus signal.
6331 */
6332void
6333sensor_threshold_emit_warning (
6334 SensorThreshold *object)
6335{
6336 g_signal_emit_by_name (object, "warning");
6337}
6338
6339/**
6340 * sensor_threshold_emit_critical:
6341 * @object: A #SensorThreshold.
6342 *
6343 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Critical">"Critical"</link> D-Bus signal.
6344 */
6345void
6346sensor_threshold_emit_critical (
6347 SensorThreshold *object)
6348{
6349 g_signal_emit_by_name (object, "critical");
6350}
6351
6352/**
6353 * sensor_threshold_emit_normal:
6354 * @object: A #SensorThreshold.
6355 *
6356 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Normal">"Normal"</link> D-Bus signal.
6357 */
6358void
6359sensor_threshold_emit_normal (
6360 SensorThreshold *object)
6361{
6362 g_signal_emit_by_name (object, "normal");
6363}
6364
6365/**
6366 * sensor_threshold_call_get_state:
6367 * @proxy: A #SensorThresholdProxy.
6368 * @cancellable: (allow-none): A #GCancellable or %NULL.
6369 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
6370 * @user_data: User data to pass to @callback.
6371 *
6372 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method on @proxy.
6373 * 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.
6374 * You can then call sensor_threshold_call_get_state_finish() to get the result of the operation.
6375 *
6376 * See sensor_threshold_call_get_state_sync() for the synchronous, blocking version of this method.
6377 */
6378void
6379sensor_threshold_call_get_state (
6380 SensorThreshold *proxy,
6381 GCancellable *cancellable,
6382 GAsyncReadyCallback callback,
6383 gpointer user_data)
6384{
6385 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
6386 "getState",
6387 g_variant_new ("()"),
6388 G_DBUS_CALL_FLAGS_NONE,
6389 -1,
6390 cancellable,
6391 callback,
6392 user_data);
6393}
6394
6395/**
6396 * sensor_threshold_call_get_state_finish:
6397 * @proxy: A #SensorThresholdProxy.
6398 * @out_state: (out): Return location for return parameter or %NULL to ignore.
6399 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_call_get_state().
6400 * @error: Return location for error or %NULL.
6401 *
6402 * Finishes an operation started with sensor_threshold_call_get_state().
6403 *
6404 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
6405 */
6406gboolean
6407sensor_threshold_call_get_state_finish (
6408 SensorThreshold *proxy,
6409 guchar *out_state,
6410 GAsyncResult *res,
6411 GError **error)
6412{
6413 GVariant *_ret;
6414 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
6415 if (_ret == NULL)
6416 goto _out;
6417 g_variant_get (_ret,
6418 "(y)",
6419 out_state);
6420 g_variant_unref (_ret);
6421_out:
6422 return _ret != NULL;
6423}
6424
6425/**
6426 * sensor_threshold_call_get_state_sync:
6427 * @proxy: A #SensorThresholdProxy.
6428 * @out_state: (out): Return location for return parameter or %NULL to ignore.
6429 * @cancellable: (allow-none): A #GCancellable or %NULL.
6430 * @error: Return location for error or %NULL.
6431 *
6432 * 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.
6433 *
6434 * See sensor_threshold_call_get_state() for the asynchronous version of this method.
6435 *
6436 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
6437 */
6438gboolean
6439sensor_threshold_call_get_state_sync (
6440 SensorThreshold *proxy,
6441 guchar *out_state,
6442 GCancellable *cancellable,
6443 GError **error)
6444{
6445 GVariant *_ret;
6446 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
6447 "getState",
6448 g_variant_new ("()"),
6449 G_DBUS_CALL_FLAGS_NONE,
6450 -1,
6451 cancellable,
6452 error);
6453 if (_ret == NULL)
6454 goto _out;
6455 g_variant_get (_ret,
6456 "(y)",
6457 out_state);
6458 g_variant_unref (_ret);
6459_out:
6460 return _ret != NULL;
6461}
6462
6463/**
6464 * sensor_threshold_complete_get_state:
6465 * @object: A #SensorThreshold.
6466 * @invocation: (transfer full): A #GDBusMethodInvocation.
6467 * @state: Parameter to return.
6468 *
6469 * 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.
6470 *
6471 * This method will free @invocation, you cannot use it afterwards.
6472 */
6473void
6474sensor_threshold_complete_get_state (
6475 SensorThreshold *object,
6476 GDBusMethodInvocation *invocation,
6477 guchar state)
6478{
6479 g_dbus_method_invocation_return_value (invocation,
6480 g_variant_new ("(y)",
6481 state));
6482}
6483
6484/* ------------------------------------------------------------------------ */
6485
6486/**
6487 * SensorThresholdProxy:
6488 *
6489 * The #SensorThresholdProxy structure contains only private data and should only be accessed using the provided API.
6490 */
6491
6492/**
6493 * SensorThresholdProxyClass:
6494 * @parent_class: The parent class.
6495 *
6496 * Class structure for #SensorThresholdProxy.
6497 */
6498
6499struct _SensorThresholdProxyPrivate
6500{
6501 GData *qdata;
6502};
6503
6504static void sensor_threshold_proxy_iface_init (SensorThresholdIface *iface);
6505
6506#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6507G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
6508 G_ADD_PRIVATE (SensorThresholdProxy)
6509 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init));
6510
6511#else
6512G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
6513 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init));
6514
6515#endif
6516static void
6517sensor_threshold_proxy_finalize (GObject *object)
6518{
6519 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6520 g_datalist_clear (&proxy->priv->qdata);
6521 G_OBJECT_CLASS (sensor_threshold_proxy_parent_class)->finalize (object);
6522}
6523
6524static void
6525sensor_threshold_proxy_get_property (GObject *object,
6526 guint prop_id,
6527 GValue *value,
6528 GParamSpec *pspec G_GNUC_UNUSED)
6529{
6530 const _ExtendedGDBusPropertyInfo *info;
6531 GVariant *variant;
6532 g_assert (prop_id != 0 && prop_id - 1 < 5);
6533 info = _sensor_threshold_property_info_pointers[prop_id - 1];
6534 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
6535 if (info->use_gvariant)
6536 {
6537 g_value_set_variant (value, variant);
6538 }
6539 else
6540 {
6541 if (variant != NULL)
6542 g_dbus_gvariant_to_gvalue (variant, value);
6543 }
6544 if (variant != NULL)
6545 g_variant_unref (variant);
6546}
6547
6548static void
6549sensor_threshold_proxy_set_property_cb (GDBusProxy *proxy,
6550 GAsyncResult *res,
6551 gpointer user_data)
6552{
6553 const _ExtendedGDBusPropertyInfo *info = user_data;
6554 GError *error;
6555 GVariant *_ret;
6556 error = NULL;
6557 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
6558 if (!_ret)
6559 {
6560 g_warning ("Error setting property '%s' on interface org.openbmc.SensorThreshold: %s (%s, %d)",
6561 info->parent_struct.name,
6562 error->message, g_quark_to_string (error->domain), error->code);
6563 g_error_free (error);
6564 }
6565 else
6566 {
6567 g_variant_unref (_ret);
6568 }
6569}
6570
6571static void
6572sensor_threshold_proxy_set_property (GObject *object,
6573 guint prop_id,
6574 const GValue *value,
6575 GParamSpec *pspec G_GNUC_UNUSED)
6576{
6577 const _ExtendedGDBusPropertyInfo *info;
6578 GVariant *variant;
6579 g_assert (prop_id != 0 && prop_id - 1 < 5);
6580 info = _sensor_threshold_property_info_pointers[prop_id - 1];
6581 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
6582 g_dbus_proxy_call (G_DBUS_PROXY (object),
6583 "org.freedesktop.DBus.Properties.Set",
6584 g_variant_new ("(ssv)", "org.openbmc.SensorThreshold", info->parent_struct.name, variant),
6585 G_DBUS_CALL_FLAGS_NONE,
6586 -1,
6587 NULL, (GAsyncReadyCallback) sensor_threshold_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
6588 g_variant_unref (variant);
6589}
6590
6591static void
6592sensor_threshold_proxy_g_signal (GDBusProxy *proxy,
6593 const gchar *sender_name G_GNUC_UNUSED,
6594 const gchar *signal_name,
6595 GVariant *parameters)
6596{
6597 _ExtendedGDBusSignalInfo *info;
6598 GVariantIter iter;
6599 GVariant *child;
6600 GValue *paramv;
6601 guint num_params;
6602 guint n;
6603 guint signal_id;
6604 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, signal_name);
6605 if (info == NULL)
6606 return;
6607 num_params = g_variant_n_children (parameters);
6608 paramv = g_new0 (GValue, num_params + 1);
6609 g_value_init (&paramv[0], TYPE_SENSOR_THRESHOLD);
6610 g_value_set_object (&paramv[0], proxy);
6611 g_variant_iter_init (&iter, parameters);
6612 n = 1;
6613 while ((child = g_variant_iter_next_value (&iter)) != NULL)
6614 {
6615 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
6616 if (arg_info->use_gvariant)
6617 {
6618 g_value_init (&paramv[n], G_TYPE_VARIANT);
6619 g_value_set_variant (&paramv[n], child);
6620 n++;
6621 }
6622 else
6623 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
6624 g_variant_unref (child);
6625 }
6626 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
6627 g_signal_emitv (paramv, signal_id, 0, NULL);
6628 for (n = 0; n < num_params + 1; n++)
6629 g_value_unset (&paramv[n]);
6630 g_free (paramv);
6631}
6632
6633static void
6634sensor_threshold_proxy_g_properties_changed (GDBusProxy *_proxy,
6635 GVariant *changed_properties,
6636 const gchar *const *invalidated_properties)
6637{
6638 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (_proxy);
6639 guint n;
6640 const gchar *key;
6641 GVariantIter *iter;
6642 _ExtendedGDBusPropertyInfo *info;
6643 g_variant_get (changed_properties, "a{sv}", &iter);
6644 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
6645 {
6646 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, key);
6647 g_datalist_remove_data (&proxy->priv->qdata, key);
6648 if (info != NULL)
6649 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
6650 }
6651 g_variant_iter_free (iter);
6652 for (n = 0; invalidated_properties[n] != NULL; n++)
6653 {
6654 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, invalidated_properties[n]);
6655 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
6656 if (info != NULL)
6657 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
6658 }
6659}
6660
6661static GVariant *
6662sensor_threshold_proxy_get_lower_critical (SensorThreshold *object)
6663{
6664 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6665 GVariant *variant;
6666 GVariant *value = NULL;
6667 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_critical");
6668 value = variant;
6669 if (variant != NULL)
6670 g_variant_unref (variant);
6671 return value;
6672}
6673
6674static GVariant *
6675sensor_threshold_proxy_get_lower_warning (SensorThreshold *object)
6676{
6677 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6678 GVariant *variant;
6679 GVariant *value = NULL;
6680 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_warning");
6681 value = variant;
6682 if (variant != NULL)
6683 g_variant_unref (variant);
6684 return value;
6685}
6686
6687static GVariant *
6688sensor_threshold_proxy_get_upper_warning (SensorThreshold *object)
6689{
6690 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6691 GVariant *variant;
6692 GVariant *value = NULL;
6693 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_warning");
6694 value = variant;
6695 if (variant != NULL)
6696 g_variant_unref (variant);
6697 return value;
6698}
6699
6700static GVariant *
6701sensor_threshold_proxy_get_upper_critical (SensorThreshold *object)
6702{
6703 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6704 GVariant *variant;
6705 GVariant *value = NULL;
6706 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_critical");
6707 value = variant;
6708 if (variant != NULL)
6709 g_variant_unref (variant);
6710 return value;
6711}
6712
6713static guchar
6714sensor_threshold_proxy_get_state (SensorThreshold *object)
6715{
6716 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6717 GVariant *variant;
6718 guchar value = 0;
6719 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
6720 if (variant != NULL)
6721 {
6722 value = g_variant_get_byte (variant);
6723 g_variant_unref (variant);
6724 }
6725 return value;
6726}
6727
6728static void
6729sensor_threshold_proxy_init (SensorThresholdProxy *proxy)
6730{
6731#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6732 proxy->priv = sensor_threshold_proxy_get_instance_private (proxy);
6733#else
6734 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_THRESHOLD_PROXY, SensorThresholdProxyPrivate);
6735#endif
6736
6737 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_threshold_interface_info ());
6738}
6739
6740static void
6741sensor_threshold_proxy_class_init (SensorThresholdProxyClass *klass)
6742{
6743 GObjectClass *gobject_class;
6744 GDBusProxyClass *proxy_class;
6745
6746 gobject_class = G_OBJECT_CLASS (klass);
6747 gobject_class->finalize = sensor_threshold_proxy_finalize;
6748 gobject_class->get_property = sensor_threshold_proxy_get_property;
6749 gobject_class->set_property = sensor_threshold_proxy_set_property;
6750
6751 proxy_class = G_DBUS_PROXY_CLASS (klass);
6752 proxy_class->g_signal = sensor_threshold_proxy_g_signal;
6753 proxy_class->g_properties_changed = sensor_threshold_proxy_g_properties_changed;
6754
6755 sensor_threshold_override_properties (gobject_class, 1);
6756
6757#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
6758 g_type_class_add_private (klass, sizeof (SensorThresholdProxyPrivate));
6759#endif
6760}
6761
6762static void
6763sensor_threshold_proxy_iface_init (SensorThresholdIface *iface)
6764{
6765 iface->get_lower_critical = sensor_threshold_proxy_get_lower_critical;
6766 iface->get_lower_warning = sensor_threshold_proxy_get_lower_warning;
6767 iface->get_upper_warning = sensor_threshold_proxy_get_upper_warning;
6768 iface->get_upper_critical = sensor_threshold_proxy_get_upper_critical;
6769 iface->get_state = sensor_threshold_proxy_get_state;
6770}
6771
6772/**
6773 * sensor_threshold_proxy_new:
6774 * @connection: A #GDBusConnection.
6775 * @flags: Flags from the #GDBusProxyFlags enumeration.
6776 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6777 * @object_path: An object path.
6778 * @cancellable: (allow-none): A #GCancellable or %NULL.
6779 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6780 * @user_data: User data to pass to @callback.
6781 *
6782 * 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.
6783 *
6784 * 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.
6785 * You can then call sensor_threshold_proxy_new_finish() to get the result of the operation.
6786 *
6787 * See sensor_threshold_proxy_new_sync() for the synchronous, blocking version of this constructor.
6788 */
6789void
6790sensor_threshold_proxy_new (
6791 GDBusConnection *connection,
6792 GDBusProxyFlags flags,
6793 const gchar *name,
6794 const gchar *object_path,
6795 GCancellable *cancellable,
6796 GAsyncReadyCallback callback,
6797 gpointer user_data)
6798{
6799 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);
6800}
6801
6802/**
6803 * sensor_threshold_proxy_new_finish:
6804 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new().
6805 * @error: Return location for error or %NULL
6806 *
6807 * Finishes an operation started with sensor_threshold_proxy_new().
6808 *
6809 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6810 */
6811SensorThreshold *
6812sensor_threshold_proxy_new_finish (
6813 GAsyncResult *res,
6814 GError **error)
6815{
6816 GObject *ret;
6817 GObject *source_object;
6818 source_object = g_async_result_get_source_object (res);
6819 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6820 g_object_unref (source_object);
6821 if (ret != NULL)
6822 return SENSOR_THRESHOLD (ret);
6823 else
6824 return NULL;
6825}
6826
6827/**
6828 * sensor_threshold_proxy_new_sync:
6829 * @connection: A #GDBusConnection.
6830 * @flags: Flags from the #GDBusProxyFlags enumeration.
6831 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6832 * @object_path: An object path.
6833 * @cancellable: (allow-none): A #GCancellable or %NULL.
6834 * @error: Return location for error or %NULL
6835 *
6836 * 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.
6837 *
6838 * The calling thread is blocked until a reply is received.
6839 *
6840 * See sensor_threshold_proxy_new() for the asynchronous version of this constructor.
6841 *
6842 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6843 */
6844SensorThreshold *
6845sensor_threshold_proxy_new_sync (
6846 GDBusConnection *connection,
6847 GDBusProxyFlags flags,
6848 const gchar *name,
6849 const gchar *object_path,
6850 GCancellable *cancellable,
6851 GError **error)
6852{
6853 GInitable *ret;
6854 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);
6855 if (ret != NULL)
6856 return SENSOR_THRESHOLD (ret);
6857 else
6858 return NULL;
6859}
6860
6861
6862/**
6863 * sensor_threshold_proxy_new_for_bus:
6864 * @bus_type: A #GBusType.
6865 * @flags: Flags from the #GDBusProxyFlags enumeration.
6866 * @name: A bus name (well-known or unique).
6867 * @object_path: An object path.
6868 * @cancellable: (allow-none): A #GCancellable or %NULL.
6869 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6870 * @user_data: User data to pass to @callback.
6871 *
6872 * Like sensor_threshold_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
6873 *
6874 * 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.
6875 * You can then call sensor_threshold_proxy_new_for_bus_finish() to get the result of the operation.
6876 *
6877 * See sensor_threshold_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
6878 */
6879void
6880sensor_threshold_proxy_new_for_bus (
6881 GBusType bus_type,
6882 GDBusProxyFlags flags,
6883 const gchar *name,
6884 const gchar *object_path,
6885 GCancellable *cancellable,
6886 GAsyncReadyCallback callback,
6887 gpointer user_data)
6888{
6889 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);
6890}
6891
6892/**
6893 * sensor_threshold_proxy_new_for_bus_finish:
6894 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new_for_bus().
6895 * @error: Return location for error or %NULL
6896 *
6897 * Finishes an operation started with sensor_threshold_proxy_new_for_bus().
6898 *
6899 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6900 */
6901SensorThreshold *
6902sensor_threshold_proxy_new_for_bus_finish (
6903 GAsyncResult *res,
6904 GError **error)
6905{
6906 GObject *ret;
6907 GObject *source_object;
6908 source_object = g_async_result_get_source_object (res);
6909 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6910 g_object_unref (source_object);
6911 if (ret != NULL)
6912 return SENSOR_THRESHOLD (ret);
6913 else
6914 return NULL;
6915}
6916
6917/**
6918 * sensor_threshold_proxy_new_for_bus_sync:
6919 * @bus_type: A #GBusType.
6920 * @flags: Flags from the #GDBusProxyFlags enumeration.
6921 * @name: A bus name (well-known or unique).
6922 * @object_path: An object path.
6923 * @cancellable: (allow-none): A #GCancellable or %NULL.
6924 * @error: Return location for error or %NULL
6925 *
6926 * Like sensor_threshold_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
6927 *
6928 * The calling thread is blocked until a reply is received.
6929 *
6930 * See sensor_threshold_proxy_new_for_bus() for the asynchronous version of this constructor.
6931 *
6932 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6933 */
6934SensorThreshold *
6935sensor_threshold_proxy_new_for_bus_sync (
6936 GBusType bus_type,
6937 GDBusProxyFlags flags,
6938 const gchar *name,
6939 const gchar *object_path,
6940 GCancellable *cancellable,
6941 GError **error)
6942{
6943 GInitable *ret;
6944 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);
6945 if (ret != NULL)
6946 return SENSOR_THRESHOLD (ret);
6947 else
6948 return NULL;
6949}
6950
6951
6952/* ------------------------------------------------------------------------ */
6953
6954/**
6955 * SensorThresholdSkeleton:
6956 *
6957 * The #SensorThresholdSkeleton structure contains only private data and should only be accessed using the provided API.
6958 */
6959
6960/**
6961 * SensorThresholdSkeletonClass:
6962 * @parent_class: The parent class.
6963 *
6964 * Class structure for #SensorThresholdSkeleton.
6965 */
6966
6967struct _SensorThresholdSkeletonPrivate
6968{
6969 GValue *properties;
6970 GList *changed_properties;
6971 GSource *changed_properties_idle_source;
6972 GMainContext *context;
6973 GMutex lock;
6974};
6975
6976static void
6977_sensor_threshold_skeleton_handle_method_call (
6978 GDBusConnection *connection G_GNUC_UNUSED,
6979 const gchar *sender G_GNUC_UNUSED,
6980 const gchar *object_path G_GNUC_UNUSED,
6981 const gchar *interface_name,
6982 const gchar *method_name,
6983 GVariant *parameters,
6984 GDBusMethodInvocation *invocation,
6985 gpointer user_data)
6986{
6987 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
6988 _ExtendedGDBusMethodInfo *info;
6989 GVariantIter iter;
6990 GVariant *child;
6991 GValue *paramv;
6992 guint num_params;
6993 guint num_extra;
6994 guint n;
6995 guint signal_id;
6996 GValue return_value = G_VALUE_INIT;
6997 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
6998 g_assert (info != NULL);
6999 num_params = g_variant_n_children (parameters);
7000 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
7001 n = 0;
7002 g_value_init (&paramv[n], TYPE_SENSOR_THRESHOLD);
7003 g_value_set_object (&paramv[n++], skeleton);
7004 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
7005 g_value_set_object (&paramv[n++], invocation);
7006 if (info->pass_fdlist)
7007 {
7008#ifdef G_OS_UNIX
7009 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
7010 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
7011#else
7012 g_assert_not_reached ();
7013#endif
7014 }
7015 g_variant_iter_init (&iter, parameters);
7016 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7017 {
7018 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
7019 if (arg_info->use_gvariant)
7020 {
7021 g_value_init (&paramv[n], G_TYPE_VARIANT);
7022 g_value_set_variant (&paramv[n], child);
7023 n++;
7024 }
7025 else
7026 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
7027 g_variant_unref (child);
7028 }
7029 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
7030 g_value_init (&return_value, G_TYPE_BOOLEAN);
7031 g_signal_emitv (paramv, signal_id, 0, &return_value);
7032 if (!g_value_get_boolean (&return_value))
7033 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);
7034 g_value_unset (&return_value);
7035 for (n = 0; n < num_params + num_extra; n++)
7036 g_value_unset (&paramv[n]);
7037 g_free (paramv);
7038}
7039
7040static GVariant *
7041_sensor_threshold_skeleton_handle_get_property (
7042 GDBusConnection *connection G_GNUC_UNUSED,
7043 const gchar *sender G_GNUC_UNUSED,
7044 const gchar *object_path G_GNUC_UNUSED,
7045 const gchar *interface_name G_GNUC_UNUSED,
7046 const gchar *property_name,
7047 GError **error,
7048 gpointer user_data)
7049{
7050 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7051 GValue value = G_VALUE_INIT;
7052 GParamSpec *pspec;
7053 _ExtendedGDBusPropertyInfo *info;
7054 GVariant *ret;
7055 ret = NULL;
7056 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
7057 g_assert (info != NULL);
7058 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
7059 if (pspec == NULL)
7060 {
7061 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
7062 }
7063 else
7064 {
7065 g_value_init (&value, pspec->value_type);
7066 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
7067 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
7068 g_value_unset (&value);
7069 }
7070 return ret;
7071}
7072
7073static gboolean
7074_sensor_threshold_skeleton_handle_set_property (
7075 GDBusConnection *connection G_GNUC_UNUSED,
7076 const gchar *sender G_GNUC_UNUSED,
7077 const gchar *object_path G_GNUC_UNUSED,
7078 const gchar *interface_name G_GNUC_UNUSED,
7079 const gchar *property_name,
7080 GVariant *variant,
7081 GError **error,
7082 gpointer user_data)
7083{
7084 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7085 GValue value = G_VALUE_INIT;
7086 GParamSpec *pspec;
7087 _ExtendedGDBusPropertyInfo *info;
7088 gboolean ret;
7089 ret = FALSE;
7090 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
7091 g_assert (info != NULL);
7092 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
7093 if (pspec == NULL)
7094 {
7095 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
7096 }
7097 else
7098 {
7099 if (info->use_gvariant)
7100 g_value_set_variant (&value, variant);
7101 else
7102 g_dbus_gvariant_to_gvalue (variant, &value);
7103 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
7104 g_value_unset (&value);
7105 ret = TRUE;
7106 }
7107 return ret;
7108}
7109
7110static const GDBusInterfaceVTable _sensor_threshold_skeleton_vtable =
7111{
7112 _sensor_threshold_skeleton_handle_method_call,
7113 _sensor_threshold_skeleton_handle_get_property,
7114 _sensor_threshold_skeleton_handle_set_property,
7115 {NULL}
7116};
7117
7118static GDBusInterfaceInfo *
7119sensor_threshold_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
7120{
7121 return sensor_threshold_interface_info ();
7122}
7123
7124static GDBusInterfaceVTable *
7125sensor_threshold_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
7126{
7127 return (GDBusInterfaceVTable *) &_sensor_threshold_skeleton_vtable;
7128}
7129
7130static GVariant *
7131sensor_threshold_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
7132{
7133 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
7134
7135 GVariantBuilder builder;
7136 guint n;
7137 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
7138 if (_sensor_threshold_interface_info.parent_struct.properties == NULL)
7139 goto out;
7140 for (n = 0; _sensor_threshold_interface_info.parent_struct.properties[n] != NULL; n++)
7141 {
7142 GDBusPropertyInfo *info = _sensor_threshold_interface_info.parent_struct.properties[n];
7143 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
7144 {
7145 GVariant *value;
7146 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);
7147 if (value != NULL)
7148 {
7149 g_variant_take_ref (value);
7150 g_variant_builder_add (&builder, "{sv}", info->name, value);
7151 g_variant_unref (value);
7152 }
7153 }
7154 }
7155out:
7156 return g_variant_builder_end (&builder);
7157}
7158
7159static gboolean _sensor_threshold_emit_changed (gpointer user_data);
7160
7161static void
7162sensor_threshold_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
7163{
7164 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
7165 gboolean emit_changed = FALSE;
7166
7167 g_mutex_lock (&skeleton->priv->lock);
7168 if (skeleton->priv->changed_properties_idle_source != NULL)
7169 {
7170 g_source_destroy (skeleton->priv->changed_properties_idle_source);
7171 skeleton->priv->changed_properties_idle_source = NULL;
7172 emit_changed = TRUE;
7173 }
7174 g_mutex_unlock (&skeleton->priv->lock);
7175
7176 if (emit_changed)
7177 _sensor_threshold_emit_changed (skeleton);
7178}
7179
7180static void
7181_sensor_threshold_on_signal_warning (
7182 SensorThreshold *object)
7183{
7184 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7185
7186 GList *connections, *l;
7187 GVariant *signal_variant;
7188 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7189
7190 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7191 for (l = connections; l != NULL; l = l->next)
7192 {
7193 GDBusConnection *connection = l->data;
7194 g_dbus_connection_emit_signal (connection,
7195 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Warning",
7196 signal_variant, NULL);
7197 }
7198 g_variant_unref (signal_variant);
7199 g_list_free_full (connections, g_object_unref);
7200}
7201
7202static void
7203_sensor_threshold_on_signal_critical (
7204 SensorThreshold *object)
7205{
7206 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7207
7208 GList *connections, *l;
7209 GVariant *signal_variant;
7210 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7211
7212 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7213 for (l = connections; l != NULL; l = l->next)
7214 {
7215 GDBusConnection *connection = l->data;
7216 g_dbus_connection_emit_signal (connection,
7217 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Critical",
7218 signal_variant, NULL);
7219 }
7220 g_variant_unref (signal_variant);
7221 g_list_free_full (connections, g_object_unref);
7222}
7223
7224static void
7225_sensor_threshold_on_signal_normal (
7226 SensorThreshold *object)
7227{
7228 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7229
7230 GList *connections, *l;
7231 GVariant *signal_variant;
7232 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7233
7234 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7235 for (l = connections; l != NULL; l = l->next)
7236 {
7237 GDBusConnection *connection = l->data;
7238 g_dbus_connection_emit_signal (connection,
7239 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Normal",
7240 signal_variant, NULL);
7241 }
7242 g_variant_unref (signal_variant);
7243 g_list_free_full (connections, g_object_unref);
7244}
7245
7246static void sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface);
7247#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7248G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
7249 G_ADD_PRIVATE (SensorThresholdSkeleton)
7250 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init));
7251
7252#else
7253G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
7254 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init));
7255
7256#endif
7257static void
7258sensor_threshold_skeleton_finalize (GObject *object)
7259{
7260 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7261 guint n;
7262 for (n = 0; n < 5; n++)
7263 g_value_unset (&skeleton->priv->properties[n]);
7264 g_free (skeleton->priv->properties);
7265 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
7266 if (skeleton->priv->changed_properties_idle_source != NULL)
7267 g_source_destroy (skeleton->priv->changed_properties_idle_source);
7268 g_main_context_unref (skeleton->priv->context);
7269 g_mutex_clear (&skeleton->priv->lock);
7270 G_OBJECT_CLASS (sensor_threshold_skeleton_parent_class)->finalize (object);
7271}
7272
7273static void
7274sensor_threshold_skeleton_get_property (GObject *object,
7275 guint prop_id,
7276 GValue *value,
7277 GParamSpec *pspec G_GNUC_UNUSED)
7278{
7279 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7280 g_assert (prop_id != 0 && prop_id - 1 < 5);
7281 g_mutex_lock (&skeleton->priv->lock);
7282 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
7283 g_mutex_unlock (&skeleton->priv->lock);
7284}
7285
7286static gboolean
7287_sensor_threshold_emit_changed (gpointer user_data)
7288{
7289 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7290 GList *l;
7291 GVariantBuilder builder;
7292 GVariantBuilder invalidated_builder;
7293 guint num_changes;
7294
7295 g_mutex_lock (&skeleton->priv->lock);
7296 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
7297 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
7298 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
7299 {
7300 ChangedProperty *cp = l->data;
7301 GVariant *variant;
7302 const GValue *cur_value;
7303
7304 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
7305 if (!_g_value_equal (cur_value, &cp->orig_value))
7306 {
7307 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
7308 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
7309 g_variant_unref (variant);
7310 num_changes++;
7311 }
7312 }
7313 if (num_changes > 0)
7314 {
7315 GList *connections, *ll;
7316 GVariant *signal_variant;
7317 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorThreshold",
7318 &builder, &invalidated_builder));
7319 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7320 for (ll = connections; ll != NULL; ll = ll->next)
7321 {
7322 GDBusConnection *connection = ll->data;
7323
7324 g_dbus_connection_emit_signal (connection,
7325 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
7326 "org.freedesktop.DBus.Properties",
7327 "PropertiesChanged",
7328 signal_variant,
7329 NULL);
7330 }
7331 g_variant_unref (signal_variant);
7332 g_list_free_full (connections, g_object_unref);
7333 }
7334 else
7335 {
7336 g_variant_builder_clear (&builder);
7337 g_variant_builder_clear (&invalidated_builder);
7338 }
7339 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
7340 skeleton->priv->changed_properties = NULL;
7341 skeleton->priv->changed_properties_idle_source = NULL;
7342 g_mutex_unlock (&skeleton->priv->lock);
7343 return FALSE;
7344}
7345
7346static void
7347_sensor_threshold_schedule_emit_changed (SensorThresholdSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
7348{
7349 ChangedProperty *cp;
7350 GList *l;
7351 cp = NULL;
7352 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
7353 {
7354 ChangedProperty *i_cp = l->data;
7355 if (i_cp->info == info)
7356 {
7357 cp = i_cp;
7358 break;
7359 }
7360 }
7361 if (cp == NULL)
7362 {
7363 cp = g_new0 (ChangedProperty, 1);
7364 cp->prop_id = prop_id;
7365 cp->info = info;
7366 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
7367 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
7368 g_value_copy (orig_value, &cp->orig_value);
7369 }
7370}
7371
7372static void
7373sensor_threshold_skeleton_notify (GObject *object,
7374 GParamSpec *pspec G_GNUC_UNUSED)
7375{
7376 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7377 g_mutex_lock (&skeleton->priv->lock);
7378 if (skeleton->priv->changed_properties != NULL &&
7379 skeleton->priv->changed_properties_idle_source == NULL)
7380 {
7381 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
7382 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
7383 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_threshold_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylak2cb27752015-10-19 16:23:14 -05007384 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _sensor_threshold_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -05007385 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
7386 g_source_unref (skeleton->priv->changed_properties_idle_source);
7387 }
7388 g_mutex_unlock (&skeleton->priv->lock);
7389}
7390
7391static void
7392sensor_threshold_skeleton_set_property (GObject *object,
7393 guint prop_id,
7394 const GValue *value,
7395 GParamSpec *pspec)
7396{
7397 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7398 g_assert (prop_id != 0 && prop_id - 1 < 5);
7399 g_mutex_lock (&skeleton->priv->lock);
7400 g_object_freeze_notify (object);
7401 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
7402 {
7403 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
7404 _sensor_threshold_schedule_emit_changed (skeleton, _sensor_threshold_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
7405 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
7406 g_object_notify_by_pspec (object, pspec);
7407 }
7408 g_mutex_unlock (&skeleton->priv->lock);
7409 g_object_thaw_notify (object);
7410}
7411
7412static void
7413sensor_threshold_skeleton_init (SensorThresholdSkeleton *skeleton)
7414{
7415#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7416 skeleton->priv = sensor_threshold_skeleton_get_instance_private (skeleton);
7417#else
7418 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_THRESHOLD_SKELETON, SensorThresholdSkeletonPrivate);
7419#endif
7420
7421 g_mutex_init (&skeleton->priv->lock);
7422 skeleton->priv->context = g_main_context_ref_thread_default ();
7423 skeleton->priv->properties = g_new0 (GValue, 5);
7424 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
7425 g_value_init (&skeleton->priv->properties[1], G_TYPE_VARIANT);
7426 g_value_init (&skeleton->priv->properties[2], G_TYPE_VARIANT);
7427 g_value_init (&skeleton->priv->properties[3], G_TYPE_VARIANT);
7428 g_value_init (&skeleton->priv->properties[4], G_TYPE_UCHAR);
7429}
7430
7431static GVariant *
7432sensor_threshold_skeleton_get_lower_critical (SensorThreshold *object)
7433{
7434 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7435 GVariant *value;
7436 g_mutex_lock (&skeleton->priv->lock);
7437 value = g_value_get_variant (&(skeleton->priv->properties[0]));
7438 g_mutex_unlock (&skeleton->priv->lock);
7439 return value;
7440}
7441
7442static GVariant *
7443sensor_threshold_skeleton_get_lower_warning (SensorThreshold *object)
7444{
7445 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7446 GVariant *value;
7447 g_mutex_lock (&skeleton->priv->lock);
7448 value = g_value_get_variant (&(skeleton->priv->properties[1]));
7449 g_mutex_unlock (&skeleton->priv->lock);
7450 return value;
7451}
7452
7453static GVariant *
7454sensor_threshold_skeleton_get_upper_warning (SensorThreshold *object)
7455{
7456 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7457 GVariant *value;
7458 g_mutex_lock (&skeleton->priv->lock);
7459 value = g_value_get_variant (&(skeleton->priv->properties[2]));
7460 g_mutex_unlock (&skeleton->priv->lock);
7461 return value;
7462}
7463
7464static GVariant *
7465sensor_threshold_skeleton_get_upper_critical (SensorThreshold *object)
7466{
7467 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7468 GVariant *value;
7469 g_mutex_lock (&skeleton->priv->lock);
7470 value = g_value_get_variant (&(skeleton->priv->properties[3]));
7471 g_mutex_unlock (&skeleton->priv->lock);
7472 return value;
7473}
7474
7475static guchar
7476sensor_threshold_skeleton_get_state (SensorThreshold *object)
7477{
7478 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7479 guchar value;
7480 g_mutex_lock (&skeleton->priv->lock);
7481 value = g_value_get_uchar (&(skeleton->priv->properties[4]));
7482 g_mutex_unlock (&skeleton->priv->lock);
7483 return value;
7484}
7485
7486static void
7487sensor_threshold_skeleton_class_init (SensorThresholdSkeletonClass *klass)
7488{
7489 GObjectClass *gobject_class;
7490 GDBusInterfaceSkeletonClass *skeleton_class;
7491
7492 gobject_class = G_OBJECT_CLASS (klass);
7493 gobject_class->finalize = sensor_threshold_skeleton_finalize;
7494 gobject_class->get_property = sensor_threshold_skeleton_get_property;
7495 gobject_class->set_property = sensor_threshold_skeleton_set_property;
7496 gobject_class->notify = sensor_threshold_skeleton_notify;
7497
7498
7499 sensor_threshold_override_properties (gobject_class, 1);
7500
7501 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
7502 skeleton_class->get_info = sensor_threshold_skeleton_dbus_interface_get_info;
7503 skeleton_class->get_properties = sensor_threshold_skeleton_dbus_interface_get_properties;
7504 skeleton_class->flush = sensor_threshold_skeleton_dbus_interface_flush;
7505 skeleton_class->get_vtable = sensor_threshold_skeleton_dbus_interface_get_vtable;
7506
7507#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
7508 g_type_class_add_private (klass, sizeof (SensorThresholdSkeletonPrivate));
7509#endif
7510}
7511
7512static void
7513sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface)
7514{
7515 iface->warning = _sensor_threshold_on_signal_warning;
7516 iface->critical = _sensor_threshold_on_signal_critical;
7517 iface->normal = _sensor_threshold_on_signal_normal;
7518 iface->get_lower_critical = sensor_threshold_skeleton_get_lower_critical;
7519 iface->get_lower_warning = sensor_threshold_skeleton_get_lower_warning;
7520 iface->get_upper_warning = sensor_threshold_skeleton_get_upper_warning;
7521 iface->get_upper_critical = sensor_threshold_skeleton_get_upper_critical;
7522 iface->get_state = sensor_threshold_skeleton_get_state;
7523}
7524
7525/**
7526 * sensor_threshold_skeleton_new:
7527 *
7528 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
7529 *
7530 * Returns: (transfer full) (type SensorThresholdSkeleton): The skeleton object.
7531 */
7532SensorThreshold *
7533sensor_threshold_skeleton_new (void)
7534{
7535 return SENSOR_THRESHOLD (g_object_new (TYPE_SENSOR_THRESHOLD_SKELETON, NULL));
7536}
7537
7538/* ------------------------------------------------------------------------
7539 * Code for interface org.openbmc.SensorI2c
7540 * ------------------------------------------------------------------------
7541 */
7542
7543/**
7544 * SECTION:SensorI2c
7545 * @title: SensorI2c
7546 * @short_description: Generated C code for the org.openbmc.SensorI2c D-Bus interface
7547 *
7548 * 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.
7549 */
7550
7551/* ---- Introspection data for org.openbmc.SensorI2c ---- */
7552
7553static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_dev_path =
7554{
7555 {
7556 -1,
7557 (gchar *) "dev_path",
7558 (gchar *) "s",
7559 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
7560 NULL
7561 },
7562 "dev-path",
7563 FALSE
7564};
7565
7566static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_address =
7567{
7568 {
7569 -1,
7570 (gchar *) "address",
7571 (gchar *) "s",
7572 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
7573 NULL
7574 },
7575 "address",
7576 FALSE
7577};
7578
7579static const _ExtendedGDBusPropertyInfo * const _sensor_i2c_property_info_pointers[] =
7580{
7581 &_sensor_i2c_property_info_dev_path,
7582 &_sensor_i2c_property_info_address,
7583 NULL
7584};
7585
7586static const _ExtendedGDBusInterfaceInfo _sensor_i2c_interface_info =
7587{
7588 {
7589 -1,
7590 (gchar *) "org.openbmc.SensorI2c",
7591 NULL,
7592 NULL,
7593 (GDBusPropertyInfo **) &_sensor_i2c_property_info_pointers,
7594 NULL
7595 },
7596 "sensor-i2c",
7597};
7598
7599
7600/**
7601 * sensor_i2c_interface_info:
7602 *
7603 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> D-Bus interface.
7604 *
7605 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
7606 */
7607GDBusInterfaceInfo *
7608sensor_i2c_interface_info (void)
7609{
7610 return (GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct;
7611}
7612
7613/**
7614 * sensor_i2c_override_properties:
7615 * @klass: The class structure for a #GObject<!-- -->-derived class.
7616 * @property_id_begin: The property id to assign to the first overridden property.
7617 *
7618 * Overrides all #GObject properties in the #SensorI2c interface for a concrete class.
7619 * The properties are overridden in the order they are defined.
7620 *
7621 * Returns: The last property id.
7622 */
7623guint
7624sensor_i2c_override_properties (GObjectClass *klass, guint property_id_begin)
7625{
7626 g_object_class_override_property (klass, property_id_begin++, "dev-path");
7627 g_object_class_override_property (klass, property_id_begin++, "address");
7628 return property_id_begin - 1;
7629}
7630
7631
7632
7633/**
7634 * SensorI2c:
7635 *
7636 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
7637 */
7638
7639/**
7640 * SensorI2cIface:
7641 * @parent_iface: The parent interface.
7642 * @get_address: Getter for the #SensorI2c:address property.
7643 * @get_dev_path: Getter for the #SensorI2c:dev-path property.
7644 *
7645 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
7646 */
7647
7648typedef SensorI2cIface SensorI2cInterface;
7649G_DEFINE_INTERFACE (SensorI2c, sensor_i2c, G_TYPE_OBJECT);
7650
7651static void
7652sensor_i2c_default_init (SensorI2cIface *iface)
7653{
7654 /* GObject properties for D-Bus properties: */
7655 /**
7656 * SensorI2c:dev-path:
7657 *
7658 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link>.
7659 *
7660 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
7661 */
7662 g_object_interface_install_property (iface,
7663 g_param_spec_string ("dev-path", "dev_path", "dev_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
7664 /**
7665 * SensorI2c:address:
7666 *
7667 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link>.
7668 *
7669 * 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.
7670 */
7671 g_object_interface_install_property (iface,
7672 g_param_spec_string ("address", "address", "address", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
7673}
7674
7675/**
7676 * sensor_i2c_get_dev_path: (skip)
7677 * @object: A #SensorI2c.
7678 *
7679 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
7680 *
7681 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7682 *
7683 * <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>
7684 *
7685 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
7686 */
7687const gchar *
7688sensor_i2c_get_dev_path (SensorI2c *object)
7689{
7690 return SENSOR_I2C_GET_IFACE (object)->get_dev_path (object);
7691}
7692
7693/**
7694 * sensor_i2c_dup_dev_path: (skip)
7695 * @object: A #SensorI2c.
7696 *
7697 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
7698 *
7699 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7700 *
7701 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
7702 */
7703gchar *
7704sensor_i2c_dup_dev_path (SensorI2c *object)
7705{
7706 gchar *value;
7707 g_object_get (G_OBJECT (object), "dev-path", &value, NULL);
7708 return value;
7709}
7710
7711/**
7712 * sensor_i2c_set_dev_path: (skip)
7713 * @object: A #SensorI2c.
7714 * @value: The value to set.
7715 *
7716 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property to @value.
7717 *
7718 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7719 */
7720void
7721sensor_i2c_set_dev_path (SensorI2c *object, const gchar *value)
7722{
7723 g_object_set (G_OBJECT (object), "dev-path", value, NULL);
7724}
7725
7726/**
7727 * sensor_i2c_get_address: (skip)
7728 * @object: A #SensorI2c.
7729 *
7730 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
7731 *
7732 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7733 *
7734 * <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>
7735 *
7736 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
7737 */
7738const gchar *
7739sensor_i2c_get_address (SensorI2c *object)
7740{
7741 return SENSOR_I2C_GET_IFACE (object)->get_address (object);
7742}
7743
7744/**
7745 * sensor_i2c_dup_address: (skip)
7746 * @object: A #SensorI2c.
7747 *
7748 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
7749 *
7750 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7751 *
7752 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
7753 */
7754gchar *
7755sensor_i2c_dup_address (SensorI2c *object)
7756{
7757 gchar *value;
7758 g_object_get (G_OBJECT (object), "address", &value, NULL);
7759 return value;
7760}
7761
7762/**
7763 * sensor_i2c_set_address: (skip)
7764 * @object: A #SensorI2c.
7765 * @value: The value to set.
7766 *
7767 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property to @value.
7768 *
7769 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7770 */
7771void
7772sensor_i2c_set_address (SensorI2c *object, const gchar *value)
7773{
7774 g_object_set (G_OBJECT (object), "address", value, NULL);
7775}
7776
7777/* ------------------------------------------------------------------------ */
7778
7779/**
7780 * SensorI2cProxy:
7781 *
7782 * The #SensorI2cProxy structure contains only private data and should only be accessed using the provided API.
7783 */
7784
7785/**
7786 * SensorI2cProxyClass:
7787 * @parent_class: The parent class.
7788 *
7789 * Class structure for #SensorI2cProxy.
7790 */
7791
7792struct _SensorI2cProxyPrivate
7793{
7794 GData *qdata;
7795};
7796
7797static void sensor_i2c_proxy_iface_init (SensorI2cIface *iface);
7798
7799#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7800G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
7801 G_ADD_PRIVATE (SensorI2cProxy)
7802 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
7803
7804#else
7805G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
7806 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
7807
7808#endif
7809static void
7810sensor_i2c_proxy_finalize (GObject *object)
7811{
7812 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
7813 g_datalist_clear (&proxy->priv->qdata);
7814 G_OBJECT_CLASS (sensor_i2c_proxy_parent_class)->finalize (object);
7815}
7816
7817static void
7818sensor_i2c_proxy_get_property (GObject *object,
7819 guint prop_id,
7820 GValue *value,
7821 GParamSpec *pspec G_GNUC_UNUSED)
7822{
7823 const _ExtendedGDBusPropertyInfo *info;
7824 GVariant *variant;
7825 g_assert (prop_id != 0 && prop_id - 1 < 2);
7826 info = _sensor_i2c_property_info_pointers[prop_id - 1];
7827 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
7828 if (info->use_gvariant)
7829 {
7830 g_value_set_variant (value, variant);
7831 }
7832 else
7833 {
7834 if (variant != NULL)
7835 g_dbus_gvariant_to_gvalue (variant, value);
7836 }
7837 if (variant != NULL)
7838 g_variant_unref (variant);
7839}
7840
7841static void
7842sensor_i2c_proxy_set_property_cb (GDBusProxy *proxy,
7843 GAsyncResult *res,
7844 gpointer user_data)
7845{
7846 const _ExtendedGDBusPropertyInfo *info = user_data;
7847 GError *error;
7848 GVariant *_ret;
7849 error = NULL;
7850 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
7851 if (!_ret)
7852 {
7853 g_warning ("Error setting property '%s' on interface org.openbmc.SensorI2c: %s (%s, %d)",
7854 info->parent_struct.name,
7855 error->message, g_quark_to_string (error->domain), error->code);
7856 g_error_free (error);
7857 }
7858 else
7859 {
7860 g_variant_unref (_ret);
7861 }
7862}
7863
7864static void
7865sensor_i2c_proxy_set_property (GObject *object,
7866 guint prop_id,
7867 const GValue *value,
7868 GParamSpec *pspec G_GNUC_UNUSED)
7869{
7870 const _ExtendedGDBusPropertyInfo *info;
7871 GVariant *variant;
7872 g_assert (prop_id != 0 && prop_id - 1 < 2);
7873 info = _sensor_i2c_property_info_pointers[prop_id - 1];
7874 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
7875 g_dbus_proxy_call (G_DBUS_PROXY (object),
7876 "org.freedesktop.DBus.Properties.Set",
7877 g_variant_new ("(ssv)", "org.openbmc.SensorI2c", info->parent_struct.name, variant),
7878 G_DBUS_CALL_FLAGS_NONE,
7879 -1,
7880 NULL, (GAsyncReadyCallback) sensor_i2c_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
7881 g_variant_unref (variant);
7882}
7883
7884static void
7885sensor_i2c_proxy_g_signal (GDBusProxy *proxy,
7886 const gchar *sender_name G_GNUC_UNUSED,
7887 const gchar *signal_name,
7888 GVariant *parameters)
7889{
7890 _ExtendedGDBusSignalInfo *info;
7891 GVariantIter iter;
7892 GVariant *child;
7893 GValue *paramv;
7894 guint num_params;
7895 guint n;
7896 guint signal_id;
7897 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, signal_name);
7898 if (info == NULL)
7899 return;
7900 num_params = g_variant_n_children (parameters);
7901 paramv = g_new0 (GValue, num_params + 1);
7902 g_value_init (&paramv[0], TYPE_SENSOR_I2C);
7903 g_value_set_object (&paramv[0], proxy);
7904 g_variant_iter_init (&iter, parameters);
7905 n = 1;
7906 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7907 {
7908 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
7909 if (arg_info->use_gvariant)
7910 {
7911 g_value_init (&paramv[n], G_TYPE_VARIANT);
7912 g_value_set_variant (&paramv[n], child);
7913 n++;
7914 }
7915 else
7916 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
7917 g_variant_unref (child);
7918 }
7919 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
7920 g_signal_emitv (paramv, signal_id, 0, NULL);
7921 for (n = 0; n < num_params + 1; n++)
7922 g_value_unset (&paramv[n]);
7923 g_free (paramv);
7924}
7925
7926static void
7927sensor_i2c_proxy_g_properties_changed (GDBusProxy *_proxy,
7928 GVariant *changed_properties,
7929 const gchar *const *invalidated_properties)
7930{
7931 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (_proxy);
7932 guint n;
7933 const gchar *key;
7934 GVariantIter *iter;
7935 _ExtendedGDBusPropertyInfo *info;
7936 g_variant_get (changed_properties, "a{sv}", &iter);
7937 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
7938 {
7939 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, key);
7940 g_datalist_remove_data (&proxy->priv->qdata, key);
7941 if (info != NULL)
7942 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7943 }
7944 g_variant_iter_free (iter);
7945 for (n = 0; invalidated_properties[n] != NULL; n++)
7946 {
7947 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, invalidated_properties[n]);
7948 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
7949 if (info != NULL)
7950 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7951 }
7952}
7953
7954static const gchar *
7955sensor_i2c_proxy_get_dev_path (SensorI2c *object)
7956{
7957 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
7958 GVariant *variant;
7959 const gchar *value = NULL;
7960 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "dev_path");
7961 if (variant != NULL)
7962 {
7963 value = g_variant_get_string (variant, NULL);
7964 g_variant_unref (variant);
7965 }
7966 return value;
7967}
7968
7969static const gchar *
7970sensor_i2c_proxy_get_address (SensorI2c *object)
7971{
7972 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
7973 GVariant *variant;
7974 const gchar *value = NULL;
7975 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "address");
7976 if (variant != NULL)
7977 {
7978 value = g_variant_get_string (variant, NULL);
7979 g_variant_unref (variant);
7980 }
7981 return value;
7982}
7983
7984static void
7985sensor_i2c_proxy_init (SensorI2cProxy *proxy)
7986{
7987#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7988 proxy->priv = sensor_i2c_proxy_get_instance_private (proxy);
7989#else
7990 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_I2C_PROXY, SensorI2cProxyPrivate);
7991#endif
7992
7993 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_i2c_interface_info ());
7994}
7995
7996static void
7997sensor_i2c_proxy_class_init (SensorI2cProxyClass *klass)
7998{
7999 GObjectClass *gobject_class;
8000 GDBusProxyClass *proxy_class;
8001
8002 gobject_class = G_OBJECT_CLASS (klass);
8003 gobject_class->finalize = sensor_i2c_proxy_finalize;
8004 gobject_class->get_property = sensor_i2c_proxy_get_property;
8005 gobject_class->set_property = sensor_i2c_proxy_set_property;
8006
8007 proxy_class = G_DBUS_PROXY_CLASS (klass);
8008 proxy_class->g_signal = sensor_i2c_proxy_g_signal;
8009 proxy_class->g_properties_changed = sensor_i2c_proxy_g_properties_changed;
8010
8011 sensor_i2c_override_properties (gobject_class, 1);
8012
8013#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8014 g_type_class_add_private (klass, sizeof (SensorI2cProxyPrivate));
8015#endif
8016}
8017
8018static void
8019sensor_i2c_proxy_iface_init (SensorI2cIface *iface)
8020{
8021 iface->get_dev_path = sensor_i2c_proxy_get_dev_path;
8022 iface->get_address = sensor_i2c_proxy_get_address;
8023}
8024
8025/**
8026 * sensor_i2c_proxy_new:
8027 * @connection: A #GDBusConnection.
8028 * @flags: Flags from the #GDBusProxyFlags enumeration.
8029 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
8030 * @object_path: An object path.
8031 * @cancellable: (allow-none): A #GCancellable or %NULL.
8032 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
8033 * @user_data: User data to pass to @callback.
8034 *
8035 * 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.
8036 *
8037 * 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.
8038 * You can then call sensor_i2c_proxy_new_finish() to get the result of the operation.
8039 *
8040 * See sensor_i2c_proxy_new_sync() for the synchronous, blocking version of this constructor.
8041 */
8042void
8043sensor_i2c_proxy_new (
8044 GDBusConnection *connection,
8045 GDBusProxyFlags flags,
8046 const gchar *name,
8047 const gchar *object_path,
8048 GCancellable *cancellable,
8049 GAsyncReadyCallback callback,
8050 gpointer user_data)
8051{
8052 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);
8053}
8054
8055/**
8056 * sensor_i2c_proxy_new_finish:
8057 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new().
8058 * @error: Return location for error or %NULL
8059 *
8060 * Finishes an operation started with sensor_i2c_proxy_new().
8061 *
8062 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8063 */
8064SensorI2c *
8065sensor_i2c_proxy_new_finish (
8066 GAsyncResult *res,
8067 GError **error)
8068{
8069 GObject *ret;
8070 GObject *source_object;
8071 source_object = g_async_result_get_source_object (res);
8072 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
8073 g_object_unref (source_object);
8074 if (ret != NULL)
8075 return SENSOR_I2C (ret);
8076 else
8077 return NULL;
8078}
8079
8080/**
8081 * sensor_i2c_proxy_new_sync:
8082 * @connection: A #GDBusConnection.
8083 * @flags: Flags from the #GDBusProxyFlags enumeration.
8084 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
8085 * @object_path: An object path.
8086 * @cancellable: (allow-none): A #GCancellable or %NULL.
8087 * @error: Return location for error or %NULL
8088 *
8089 * 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.
8090 *
8091 * The calling thread is blocked until a reply is received.
8092 *
8093 * See sensor_i2c_proxy_new() for the asynchronous version of this constructor.
8094 *
8095 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8096 */
8097SensorI2c *
8098sensor_i2c_proxy_new_sync (
8099 GDBusConnection *connection,
8100 GDBusProxyFlags flags,
8101 const gchar *name,
8102 const gchar *object_path,
8103 GCancellable *cancellable,
8104 GError **error)
8105{
8106 GInitable *ret;
8107 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);
8108 if (ret != NULL)
8109 return SENSOR_I2C (ret);
8110 else
8111 return NULL;
8112}
8113
8114
8115/**
8116 * sensor_i2c_proxy_new_for_bus:
8117 * @bus_type: A #GBusType.
8118 * @flags: Flags from the #GDBusProxyFlags enumeration.
8119 * @name: A bus name (well-known or unique).
8120 * @object_path: An object path.
8121 * @cancellable: (allow-none): A #GCancellable or %NULL.
8122 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
8123 * @user_data: User data to pass to @callback.
8124 *
8125 * Like sensor_i2c_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
8126 *
8127 * 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.
8128 * You can then call sensor_i2c_proxy_new_for_bus_finish() to get the result of the operation.
8129 *
8130 * See sensor_i2c_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
8131 */
8132void
8133sensor_i2c_proxy_new_for_bus (
8134 GBusType bus_type,
8135 GDBusProxyFlags flags,
8136 const gchar *name,
8137 const gchar *object_path,
8138 GCancellable *cancellable,
8139 GAsyncReadyCallback callback,
8140 gpointer user_data)
8141{
8142 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);
8143}
8144
8145/**
8146 * sensor_i2c_proxy_new_for_bus_finish:
8147 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new_for_bus().
8148 * @error: Return location for error or %NULL
8149 *
8150 * Finishes an operation started with sensor_i2c_proxy_new_for_bus().
8151 *
8152 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8153 */
8154SensorI2c *
8155sensor_i2c_proxy_new_for_bus_finish (
8156 GAsyncResult *res,
8157 GError **error)
8158{
8159 GObject *ret;
8160 GObject *source_object;
8161 source_object = g_async_result_get_source_object (res);
8162 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
8163 g_object_unref (source_object);
8164 if (ret != NULL)
8165 return SENSOR_I2C (ret);
8166 else
8167 return NULL;
8168}
8169
8170/**
8171 * sensor_i2c_proxy_new_for_bus_sync:
8172 * @bus_type: A #GBusType.
8173 * @flags: Flags from the #GDBusProxyFlags enumeration.
8174 * @name: A bus name (well-known or unique).
8175 * @object_path: An object path.
8176 * @cancellable: (allow-none): A #GCancellable or %NULL.
8177 * @error: Return location for error or %NULL
8178 *
8179 * Like sensor_i2c_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
8180 *
8181 * The calling thread is blocked until a reply is received.
8182 *
8183 * See sensor_i2c_proxy_new_for_bus() for the asynchronous version of this constructor.
8184 *
8185 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8186 */
8187SensorI2c *
8188sensor_i2c_proxy_new_for_bus_sync (
8189 GBusType bus_type,
8190 GDBusProxyFlags flags,
8191 const gchar *name,
8192 const gchar *object_path,
8193 GCancellable *cancellable,
8194 GError **error)
8195{
8196 GInitable *ret;
8197 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);
8198 if (ret != NULL)
8199 return SENSOR_I2C (ret);
8200 else
8201 return NULL;
8202}
8203
8204
8205/* ------------------------------------------------------------------------ */
8206
8207/**
8208 * SensorI2cSkeleton:
8209 *
8210 * The #SensorI2cSkeleton structure contains only private data and should only be accessed using the provided API.
8211 */
8212
8213/**
8214 * SensorI2cSkeletonClass:
8215 * @parent_class: The parent class.
8216 *
8217 * Class structure for #SensorI2cSkeleton.
8218 */
8219
8220struct _SensorI2cSkeletonPrivate
8221{
8222 GValue *properties;
8223 GList *changed_properties;
8224 GSource *changed_properties_idle_source;
8225 GMainContext *context;
8226 GMutex lock;
8227};
8228
8229static void
8230_sensor_i2c_skeleton_handle_method_call (
8231 GDBusConnection *connection G_GNUC_UNUSED,
8232 const gchar *sender G_GNUC_UNUSED,
8233 const gchar *object_path G_GNUC_UNUSED,
8234 const gchar *interface_name,
8235 const gchar *method_name,
8236 GVariant *parameters,
8237 GDBusMethodInvocation *invocation,
8238 gpointer user_data)
8239{
8240 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8241 _ExtendedGDBusMethodInfo *info;
8242 GVariantIter iter;
8243 GVariant *child;
8244 GValue *paramv;
8245 guint num_params;
8246 guint num_extra;
8247 guint n;
8248 guint signal_id;
8249 GValue return_value = G_VALUE_INIT;
8250 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
8251 g_assert (info != NULL);
8252 num_params = g_variant_n_children (parameters);
8253 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
8254 n = 0;
8255 g_value_init (&paramv[n], TYPE_SENSOR_I2C);
8256 g_value_set_object (&paramv[n++], skeleton);
8257 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
8258 g_value_set_object (&paramv[n++], invocation);
8259 if (info->pass_fdlist)
8260 {
8261#ifdef G_OS_UNIX
8262 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
8263 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
8264#else
8265 g_assert_not_reached ();
8266#endif
8267 }
8268 g_variant_iter_init (&iter, parameters);
8269 while ((child = g_variant_iter_next_value (&iter)) != NULL)
8270 {
8271 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
8272 if (arg_info->use_gvariant)
8273 {
8274 g_value_init (&paramv[n], G_TYPE_VARIANT);
8275 g_value_set_variant (&paramv[n], child);
8276 n++;
8277 }
8278 else
8279 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
8280 g_variant_unref (child);
8281 }
8282 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
8283 g_value_init (&return_value, G_TYPE_BOOLEAN);
8284 g_signal_emitv (paramv, signal_id, 0, &return_value);
8285 if (!g_value_get_boolean (&return_value))
8286 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);
8287 g_value_unset (&return_value);
8288 for (n = 0; n < num_params + num_extra; n++)
8289 g_value_unset (&paramv[n]);
8290 g_free (paramv);
8291}
8292
8293static GVariant *
8294_sensor_i2c_skeleton_handle_get_property (
8295 GDBusConnection *connection G_GNUC_UNUSED,
8296 const gchar *sender G_GNUC_UNUSED,
8297 const gchar *object_path G_GNUC_UNUSED,
8298 const gchar *interface_name G_GNUC_UNUSED,
8299 const gchar *property_name,
8300 GError **error,
8301 gpointer user_data)
8302{
8303 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8304 GValue value = G_VALUE_INIT;
8305 GParamSpec *pspec;
8306 _ExtendedGDBusPropertyInfo *info;
8307 GVariant *ret;
8308 ret = NULL;
8309 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
8310 g_assert (info != NULL);
8311 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
8312 if (pspec == NULL)
8313 {
8314 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
8315 }
8316 else
8317 {
8318 g_value_init (&value, pspec->value_type);
8319 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
8320 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
8321 g_value_unset (&value);
8322 }
8323 return ret;
8324}
8325
8326static gboolean
8327_sensor_i2c_skeleton_handle_set_property (
8328 GDBusConnection *connection G_GNUC_UNUSED,
8329 const gchar *sender G_GNUC_UNUSED,
8330 const gchar *object_path G_GNUC_UNUSED,
8331 const gchar *interface_name G_GNUC_UNUSED,
8332 const gchar *property_name,
8333 GVariant *variant,
8334 GError **error,
8335 gpointer user_data)
8336{
8337 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8338 GValue value = G_VALUE_INIT;
8339 GParamSpec *pspec;
8340 _ExtendedGDBusPropertyInfo *info;
8341 gboolean ret;
8342 ret = FALSE;
8343 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
8344 g_assert (info != NULL);
8345 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
8346 if (pspec == NULL)
8347 {
8348 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
8349 }
8350 else
8351 {
8352 if (info->use_gvariant)
8353 g_value_set_variant (&value, variant);
8354 else
8355 g_dbus_gvariant_to_gvalue (variant, &value);
8356 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
8357 g_value_unset (&value);
8358 ret = TRUE;
8359 }
8360 return ret;
8361}
8362
8363static const GDBusInterfaceVTable _sensor_i2c_skeleton_vtable =
8364{
8365 _sensor_i2c_skeleton_handle_method_call,
8366 _sensor_i2c_skeleton_handle_get_property,
8367 _sensor_i2c_skeleton_handle_set_property,
8368 {NULL}
8369};
8370
8371static GDBusInterfaceInfo *
8372sensor_i2c_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8373{
8374 return sensor_i2c_interface_info ();
8375}
8376
8377static GDBusInterfaceVTable *
8378sensor_i2c_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8379{
8380 return (GDBusInterfaceVTable *) &_sensor_i2c_skeleton_vtable;
8381}
8382
8383static GVariant *
8384sensor_i2c_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
8385{
8386 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
8387
8388 GVariantBuilder builder;
8389 guint n;
8390 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8391 if (_sensor_i2c_interface_info.parent_struct.properties == NULL)
8392 goto out;
8393 for (n = 0; _sensor_i2c_interface_info.parent_struct.properties[n] != NULL; n++)
8394 {
8395 GDBusPropertyInfo *info = _sensor_i2c_interface_info.parent_struct.properties[n];
8396 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
8397 {
8398 GVariant *value;
8399 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);
8400 if (value != NULL)
8401 {
8402 g_variant_take_ref (value);
8403 g_variant_builder_add (&builder, "{sv}", info->name, value);
8404 g_variant_unref (value);
8405 }
8406 }
8407 }
8408out:
8409 return g_variant_builder_end (&builder);
8410}
8411
8412static gboolean _sensor_i2c_emit_changed (gpointer user_data);
8413
8414static void
8415sensor_i2c_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
8416{
8417 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
8418 gboolean emit_changed = FALSE;
8419
8420 g_mutex_lock (&skeleton->priv->lock);
8421 if (skeleton->priv->changed_properties_idle_source != NULL)
8422 {
8423 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8424 skeleton->priv->changed_properties_idle_source = NULL;
8425 emit_changed = TRUE;
8426 }
8427 g_mutex_unlock (&skeleton->priv->lock);
8428
8429 if (emit_changed)
8430 _sensor_i2c_emit_changed (skeleton);
8431}
8432
8433static void sensor_i2c_skeleton_iface_init (SensorI2cIface *iface);
8434#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8435G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8436 G_ADD_PRIVATE (SensorI2cSkeleton)
8437 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
8438
8439#else
8440G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8441 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
8442
8443#endif
8444static void
8445sensor_i2c_skeleton_finalize (GObject *object)
8446{
8447 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8448 guint n;
8449 for (n = 0; n < 2; n++)
8450 g_value_unset (&skeleton->priv->properties[n]);
8451 g_free (skeleton->priv->properties);
8452 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
8453 if (skeleton->priv->changed_properties_idle_source != NULL)
8454 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8455 g_main_context_unref (skeleton->priv->context);
8456 g_mutex_clear (&skeleton->priv->lock);
8457 G_OBJECT_CLASS (sensor_i2c_skeleton_parent_class)->finalize (object);
8458}
8459
8460static void
8461sensor_i2c_skeleton_get_property (GObject *object,
8462 guint prop_id,
8463 GValue *value,
8464 GParamSpec *pspec G_GNUC_UNUSED)
8465{
8466 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8467 g_assert (prop_id != 0 && prop_id - 1 < 2);
8468 g_mutex_lock (&skeleton->priv->lock);
8469 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
8470 g_mutex_unlock (&skeleton->priv->lock);
8471}
8472
8473static gboolean
8474_sensor_i2c_emit_changed (gpointer user_data)
8475{
8476 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8477 GList *l;
8478 GVariantBuilder builder;
8479 GVariantBuilder invalidated_builder;
8480 guint num_changes;
8481
8482 g_mutex_lock (&skeleton->priv->lock);
8483 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8484 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
8485 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
8486 {
8487 ChangedProperty *cp = l->data;
8488 GVariant *variant;
8489 const GValue *cur_value;
8490
8491 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
8492 if (!_g_value_equal (cur_value, &cp->orig_value))
8493 {
8494 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
8495 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
8496 g_variant_unref (variant);
8497 num_changes++;
8498 }
8499 }
8500 if (num_changes > 0)
8501 {
8502 GList *connections, *ll;
8503 GVariant *signal_variant;
8504 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorI2c",
8505 &builder, &invalidated_builder));
8506 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
8507 for (ll = connections; ll != NULL; ll = ll->next)
8508 {
8509 GDBusConnection *connection = ll->data;
8510
8511 g_dbus_connection_emit_signal (connection,
8512 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
8513 "org.freedesktop.DBus.Properties",
8514 "PropertiesChanged",
8515 signal_variant,
8516 NULL);
8517 }
8518 g_variant_unref (signal_variant);
8519 g_list_free_full (connections, g_object_unref);
8520 }
8521 else
8522 {
8523 g_variant_builder_clear (&builder);
8524 g_variant_builder_clear (&invalidated_builder);
8525 }
8526 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
8527 skeleton->priv->changed_properties = NULL;
8528 skeleton->priv->changed_properties_idle_source = NULL;
8529 g_mutex_unlock (&skeleton->priv->lock);
8530 return FALSE;
8531}
8532
8533static void
8534_sensor_i2c_schedule_emit_changed (SensorI2cSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
8535{
8536 ChangedProperty *cp;
8537 GList *l;
8538 cp = NULL;
8539 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
8540 {
8541 ChangedProperty *i_cp = l->data;
8542 if (i_cp->info == info)
8543 {
8544 cp = i_cp;
8545 break;
8546 }
8547 }
8548 if (cp == NULL)
8549 {
8550 cp = g_new0 (ChangedProperty, 1);
8551 cp->prop_id = prop_id;
8552 cp->info = info;
8553 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
8554 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
8555 g_value_copy (orig_value, &cp->orig_value);
8556 }
8557}
8558
8559static void
8560sensor_i2c_skeleton_notify (GObject *object,
8561 GParamSpec *pspec G_GNUC_UNUSED)
8562{
8563 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8564 g_mutex_lock (&skeleton->priv->lock);
8565 if (skeleton->priv->changed_properties != NULL &&
8566 skeleton->priv->changed_properties_idle_source == NULL)
8567 {
8568 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
8569 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
8570 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_i2c_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylak2cb27752015-10-19 16:23:14 -05008571 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _sensor_i2c_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -05008572 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
8573 g_source_unref (skeleton->priv->changed_properties_idle_source);
8574 }
8575 g_mutex_unlock (&skeleton->priv->lock);
8576}
8577
8578static void
8579sensor_i2c_skeleton_set_property (GObject *object,
8580 guint prop_id,
8581 const GValue *value,
8582 GParamSpec *pspec)
8583{
8584 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8585 g_assert (prop_id != 0 && prop_id - 1 < 2);
8586 g_mutex_lock (&skeleton->priv->lock);
8587 g_object_freeze_notify (object);
8588 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
8589 {
8590 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
8591 _sensor_i2c_schedule_emit_changed (skeleton, _sensor_i2c_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
8592 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
8593 g_object_notify_by_pspec (object, pspec);
8594 }
8595 g_mutex_unlock (&skeleton->priv->lock);
8596 g_object_thaw_notify (object);
8597}
8598
8599static void
8600sensor_i2c_skeleton_init (SensorI2cSkeleton *skeleton)
8601{
8602#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8603 skeleton->priv = sensor_i2c_skeleton_get_instance_private (skeleton);
8604#else
8605 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_I2C_SKELETON, SensorI2cSkeletonPrivate);
8606#endif
8607
8608 g_mutex_init (&skeleton->priv->lock);
8609 skeleton->priv->context = g_main_context_ref_thread_default ();
8610 skeleton->priv->properties = g_new0 (GValue, 2);
8611 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
8612 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
8613}
8614
8615static const gchar *
8616sensor_i2c_skeleton_get_dev_path (SensorI2c *object)
8617{
8618 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8619 const gchar *value;
8620 g_mutex_lock (&skeleton->priv->lock);
8621 value = g_value_get_string (&(skeleton->priv->properties[0]));
8622 g_mutex_unlock (&skeleton->priv->lock);
8623 return value;
8624}
8625
8626static const gchar *
8627sensor_i2c_skeleton_get_address (SensorI2c *object)
8628{
8629 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8630 const gchar *value;
8631 g_mutex_lock (&skeleton->priv->lock);
8632 value = g_value_get_string (&(skeleton->priv->properties[1]));
8633 g_mutex_unlock (&skeleton->priv->lock);
8634 return value;
8635}
8636
8637static void
8638sensor_i2c_skeleton_class_init (SensorI2cSkeletonClass *klass)
8639{
8640 GObjectClass *gobject_class;
8641 GDBusInterfaceSkeletonClass *skeleton_class;
8642
8643 gobject_class = G_OBJECT_CLASS (klass);
8644 gobject_class->finalize = sensor_i2c_skeleton_finalize;
8645 gobject_class->get_property = sensor_i2c_skeleton_get_property;
8646 gobject_class->set_property = sensor_i2c_skeleton_set_property;
8647 gobject_class->notify = sensor_i2c_skeleton_notify;
8648
8649
8650 sensor_i2c_override_properties (gobject_class, 1);
8651
8652 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
8653 skeleton_class->get_info = sensor_i2c_skeleton_dbus_interface_get_info;
8654 skeleton_class->get_properties = sensor_i2c_skeleton_dbus_interface_get_properties;
8655 skeleton_class->flush = sensor_i2c_skeleton_dbus_interface_flush;
8656 skeleton_class->get_vtable = sensor_i2c_skeleton_dbus_interface_get_vtable;
8657
8658#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8659 g_type_class_add_private (klass, sizeof (SensorI2cSkeletonPrivate));
8660#endif
8661}
8662
8663static void
8664sensor_i2c_skeleton_iface_init (SensorI2cIface *iface)
8665{
8666 iface->get_dev_path = sensor_i2c_skeleton_get_dev_path;
8667 iface->get_address = sensor_i2c_skeleton_get_address;
8668}
8669
8670/**
8671 * sensor_i2c_skeleton_new:
8672 *
8673 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
8674 *
8675 * Returns: (transfer full) (type SensorI2cSkeleton): The skeleton object.
8676 */
8677SensorI2c *
8678sensor_i2c_skeleton_new (void)
8679{
8680 return SENSOR_I2C (g_object_new (TYPE_SENSOR_I2C_SKELETON, NULL));
8681}
8682
8683/* ------------------------------------------------------------------------
8684 * Code for interface org.openbmc.SensorMatch
8685 * ------------------------------------------------------------------------
8686 */
8687
8688/**
8689 * SECTION:SensorMatch
8690 * @title: SensorMatch
8691 * @short_description: Generated C code for the org.openbmc.SensorMatch D-Bus interface
8692 *
8693 * 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.
8694 */
8695
8696/* ---- Introspection data for org.openbmc.SensorMatch ---- */
8697
8698static const _ExtendedGDBusArgInfo _sensor_match_signal_info_sensor_match_ARG_state =
8699{
8700 {
8701 -1,
8702 (gchar *) "state",
8703 (gchar *) "y",
8704 NULL
8705 },
8706 FALSE
8707};
8708
8709static const _ExtendedGDBusArgInfo * const _sensor_match_signal_info_sensor_match_ARG_pointers[] =
8710{
8711 &_sensor_match_signal_info_sensor_match_ARG_state,
8712 NULL
8713};
8714
8715static const _ExtendedGDBusSignalInfo _sensor_match_signal_info_sensor_match =
8716{
8717 {
8718 -1,
8719 (gchar *) "SensorMatch",
8720 (GDBusArgInfo **) &_sensor_match_signal_info_sensor_match_ARG_pointers,
8721 NULL
8722 },
8723 "sensor-match"
8724};
8725
8726static const _ExtendedGDBusSignalInfo * const _sensor_match_signal_info_pointers[] =
8727{
8728 &_sensor_match_signal_info_sensor_match,
8729 NULL
8730};
8731
8732static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_match_value =
8733{
8734 {
8735 -1,
8736 (gchar *) "match_value",
8737 (gchar *) "v",
8738 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
8739 NULL
8740 },
8741 "match-value",
8742 FALSE
8743};
8744
8745static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_state =
8746{
8747 {
8748 -1,
8749 (gchar *) "state",
8750 (gchar *) "y",
8751 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
8752 NULL
8753 },
8754 "state",
8755 FALSE
8756};
8757
8758static const _ExtendedGDBusPropertyInfo * const _sensor_match_property_info_pointers[] =
8759{
8760 &_sensor_match_property_info_match_value,
8761 &_sensor_match_property_info_state,
8762 NULL
8763};
8764
8765static const _ExtendedGDBusInterfaceInfo _sensor_match_interface_info =
8766{
8767 {
8768 -1,
8769 (gchar *) "org.openbmc.SensorMatch",
8770 NULL,
8771 (GDBusSignalInfo **) &_sensor_match_signal_info_pointers,
8772 (GDBusPropertyInfo **) &_sensor_match_property_info_pointers,
8773 NULL
8774 },
8775 "sensor-match",
8776};
8777
8778
8779/**
8780 * sensor_match_interface_info:
8781 *
8782 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> D-Bus interface.
8783 *
8784 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
8785 */
8786GDBusInterfaceInfo *
8787sensor_match_interface_info (void)
8788{
8789 return (GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct;
8790}
8791
8792/**
8793 * sensor_match_override_properties:
8794 * @klass: The class structure for a #GObject<!-- -->-derived class.
8795 * @property_id_begin: The property id to assign to the first overridden property.
8796 *
8797 * Overrides all #GObject properties in the #SensorMatch interface for a concrete class.
8798 * The properties are overridden in the order they are defined.
8799 *
8800 * Returns: The last property id.
8801 */
8802guint
8803sensor_match_override_properties (GObjectClass *klass, guint property_id_begin)
8804{
8805 g_object_class_override_property (klass, property_id_begin++, "match-value");
8806 g_object_class_override_property (klass, property_id_begin++, "state");
8807 return property_id_begin - 1;
8808}
8809
8810
8811
8812/**
8813 * SensorMatch:
8814 *
8815 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
8816 */
8817
8818/**
8819 * SensorMatchIface:
8820 * @parent_iface: The parent interface.
8821 * @get_match_value: Getter for the #SensorMatch:match-value property.
8822 * @get_state: Getter for the #SensorMatch:state property.
8823 * @sensor_match: Handler for the #SensorMatch::sensor-match signal.
8824 *
8825 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
8826 */
8827
8828typedef SensorMatchIface SensorMatchInterface;
8829G_DEFINE_INTERFACE (SensorMatch, sensor_match, G_TYPE_OBJECT);
8830
8831static void
8832sensor_match_default_init (SensorMatchIface *iface)
8833{
8834 /* GObject signals for received D-Bus signals: */
8835 /**
8836 * SensorMatch::sensor-match:
8837 * @object: A #SensorMatch.
8838 * @arg_state: Argument.
8839 *
8840 * 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.
8841 *
8842 * 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.
8843 */
8844 g_signal_new ("sensor-match",
8845 G_TYPE_FROM_INTERFACE (iface),
8846 G_SIGNAL_RUN_LAST,
8847 G_STRUCT_OFFSET (SensorMatchIface, sensor_match),
8848 NULL,
8849 NULL,
8850 g_cclosure_marshal_generic,
8851 G_TYPE_NONE,
8852 1, G_TYPE_UCHAR);
8853
8854 /* GObject properties for D-Bus properties: */
8855 /**
8856 * SensorMatch:match-value:
8857 *
8858 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link>.
8859 *
8860 * 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.
8861 */
8862 g_object_interface_install_property (iface,
8863 g_param_spec_variant ("match-value", "match_value", "match_value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
8864 /**
8865 * SensorMatch:state:
8866 *
8867 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link>.
8868 *
8869 * 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.
8870 */
8871 g_object_interface_install_property (iface,
8872 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
8873}
8874
8875/**
8876 * sensor_match_get_match_value: (skip)
8877 * @object: A #SensorMatch.
8878 *
8879 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property.
8880 *
8881 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
8882 *
8883 * <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>
8884 *
8885 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
8886 */
8887GVariant *
8888sensor_match_get_match_value (SensorMatch *object)
8889{
8890 return SENSOR_MATCH_GET_IFACE (object)->get_match_value (object);
8891}
8892
8893/**
8894 * sensor_match_dup_match_value: (skip)
8895 * @object: A #SensorMatch.
8896 *
8897 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property.
8898 *
8899 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
8900 *
8901 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
8902 */
8903GVariant *
8904sensor_match_dup_match_value (SensorMatch *object)
8905{
8906 GVariant *value;
8907 g_object_get (G_OBJECT (object), "match-value", &value, NULL);
8908 return value;
8909}
8910
8911/**
8912 * sensor_match_set_match_value: (skip)
8913 * @object: A #SensorMatch.
8914 * @value: The value to set.
8915 *
8916 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property to @value.
8917 *
8918 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
8919 */
8920void
8921sensor_match_set_match_value (SensorMatch *object, GVariant *value)
8922{
8923 g_object_set (G_OBJECT (object), "match-value", value, NULL);
8924}
8925
8926/**
8927 * sensor_match_get_state: (skip)
8928 * @object: A #SensorMatch.
8929 *
8930 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property.
8931 *
8932 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
8933 *
8934 * Returns: The property value.
8935 */
8936guchar
8937sensor_match_get_state (SensorMatch *object)
8938{
8939 return SENSOR_MATCH_GET_IFACE (object)->get_state (object);
8940}
8941
8942/**
8943 * sensor_match_set_state: (skip)
8944 * @object: A #SensorMatch.
8945 * @value: The value to set.
8946 *
8947 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property to @value.
8948 *
8949 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
8950 */
8951void
8952sensor_match_set_state (SensorMatch *object, guchar value)
8953{
8954 g_object_set (G_OBJECT (object), "state", value, NULL);
8955}
8956
8957/**
8958 * sensor_match_emit_sensor_match:
8959 * @object: A #SensorMatch.
8960 * @arg_state: Argument to pass with the signal.
8961 *
8962 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorMatch.SensorMatch">"SensorMatch"</link> D-Bus signal.
8963 */
8964void
8965sensor_match_emit_sensor_match (
8966 SensorMatch *object,
8967 guchar arg_state)
8968{
8969 g_signal_emit_by_name (object, "sensor-match", arg_state);
8970}
8971
8972/* ------------------------------------------------------------------------ */
8973
8974/**
8975 * SensorMatchProxy:
8976 *
8977 * The #SensorMatchProxy structure contains only private data and should only be accessed using the provided API.
8978 */
8979
8980/**
8981 * SensorMatchProxyClass:
8982 * @parent_class: The parent class.
8983 *
8984 * Class structure for #SensorMatchProxy.
8985 */
8986
8987struct _SensorMatchProxyPrivate
8988{
8989 GData *qdata;
8990};
8991
8992static void sensor_match_proxy_iface_init (SensorMatchIface *iface);
8993
8994#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8995G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY,
8996 G_ADD_PRIVATE (SensorMatchProxy)
8997 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init));
8998
8999#else
9000G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY,
9001 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init));
9002
9003#endif
9004static void
9005sensor_match_proxy_finalize (GObject *object)
9006{
9007 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9008 g_datalist_clear (&proxy->priv->qdata);
9009 G_OBJECT_CLASS (sensor_match_proxy_parent_class)->finalize (object);
9010}
9011
9012static void
9013sensor_match_proxy_get_property (GObject *object,
9014 guint prop_id,
9015 GValue *value,
9016 GParamSpec *pspec G_GNUC_UNUSED)
9017{
9018 const _ExtendedGDBusPropertyInfo *info;
9019 GVariant *variant;
9020 g_assert (prop_id != 0 && prop_id - 1 < 2);
9021 info = _sensor_match_property_info_pointers[prop_id - 1];
9022 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
9023 if (info->use_gvariant)
9024 {
9025 g_value_set_variant (value, variant);
9026 }
9027 else
9028 {
9029 if (variant != NULL)
9030 g_dbus_gvariant_to_gvalue (variant, value);
9031 }
9032 if (variant != NULL)
9033 g_variant_unref (variant);
9034}
9035
9036static void
9037sensor_match_proxy_set_property_cb (GDBusProxy *proxy,
9038 GAsyncResult *res,
9039 gpointer user_data)
9040{
9041 const _ExtendedGDBusPropertyInfo *info = user_data;
9042 GError *error;
9043 GVariant *_ret;
9044 error = NULL;
9045 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
9046 if (!_ret)
9047 {
9048 g_warning ("Error setting property '%s' on interface org.openbmc.SensorMatch: %s (%s, %d)",
9049 info->parent_struct.name,
9050 error->message, g_quark_to_string (error->domain), error->code);
9051 g_error_free (error);
9052 }
9053 else
9054 {
9055 g_variant_unref (_ret);
9056 }
9057}
9058
9059static void
9060sensor_match_proxy_set_property (GObject *object,
9061 guint prop_id,
9062 const GValue *value,
9063 GParamSpec *pspec G_GNUC_UNUSED)
9064{
9065 const _ExtendedGDBusPropertyInfo *info;
9066 GVariant *variant;
9067 g_assert (prop_id != 0 && prop_id - 1 < 2);
9068 info = _sensor_match_property_info_pointers[prop_id - 1];
9069 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
9070 g_dbus_proxy_call (G_DBUS_PROXY (object),
9071 "org.freedesktop.DBus.Properties.Set",
9072 g_variant_new ("(ssv)", "org.openbmc.SensorMatch", info->parent_struct.name, variant),
9073 G_DBUS_CALL_FLAGS_NONE,
9074 -1,
9075 NULL, (GAsyncReadyCallback) sensor_match_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
9076 g_variant_unref (variant);
9077}
9078
9079static void
9080sensor_match_proxy_g_signal (GDBusProxy *proxy,
9081 const gchar *sender_name G_GNUC_UNUSED,
9082 const gchar *signal_name,
9083 GVariant *parameters)
9084{
9085 _ExtendedGDBusSignalInfo *info;
9086 GVariantIter iter;
9087 GVariant *child;
9088 GValue *paramv;
9089 guint num_params;
9090 guint n;
9091 guint signal_id;
9092 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, signal_name);
9093 if (info == NULL)
9094 return;
9095 num_params = g_variant_n_children (parameters);
9096 paramv = g_new0 (GValue, num_params + 1);
9097 g_value_init (&paramv[0], TYPE_SENSOR_MATCH);
9098 g_value_set_object (&paramv[0], proxy);
9099 g_variant_iter_init (&iter, parameters);
9100 n = 1;
9101 while ((child = g_variant_iter_next_value (&iter)) != NULL)
9102 {
9103 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
9104 if (arg_info->use_gvariant)
9105 {
9106 g_value_init (&paramv[n], G_TYPE_VARIANT);
9107 g_value_set_variant (&paramv[n], child);
9108 n++;
9109 }
9110 else
9111 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
9112 g_variant_unref (child);
9113 }
9114 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH);
9115 g_signal_emitv (paramv, signal_id, 0, NULL);
9116 for (n = 0; n < num_params + 1; n++)
9117 g_value_unset (&paramv[n]);
9118 g_free (paramv);
9119}
9120
9121static void
9122sensor_match_proxy_g_properties_changed (GDBusProxy *_proxy,
9123 GVariant *changed_properties,
9124 const gchar *const *invalidated_properties)
9125{
9126 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (_proxy);
9127 guint n;
9128 const gchar *key;
9129 GVariantIter *iter;
9130 _ExtendedGDBusPropertyInfo *info;
9131 g_variant_get (changed_properties, "a{sv}", &iter);
9132 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
9133 {
9134 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, key);
9135 g_datalist_remove_data (&proxy->priv->qdata, key);
9136 if (info != NULL)
9137 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
9138 }
9139 g_variant_iter_free (iter);
9140 for (n = 0; invalidated_properties[n] != NULL; n++)
9141 {
9142 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, invalidated_properties[n]);
9143 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
9144 if (info != NULL)
9145 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
9146 }
9147}
9148
9149static GVariant *
9150sensor_match_proxy_get_match_value (SensorMatch *object)
9151{
9152 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9153 GVariant *variant;
9154 GVariant *value = NULL;
9155 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "match_value");
9156 value = variant;
9157 if (variant != NULL)
9158 g_variant_unref (variant);
9159 return value;
9160}
9161
9162static guchar
9163sensor_match_proxy_get_state (SensorMatch *object)
9164{
9165 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9166 GVariant *variant;
9167 guchar value = 0;
9168 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
9169 if (variant != NULL)
9170 {
9171 value = g_variant_get_byte (variant);
9172 g_variant_unref (variant);
9173 }
9174 return value;
9175}
9176
9177static void
9178sensor_match_proxy_init (SensorMatchProxy *proxy)
9179{
9180#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9181 proxy->priv = sensor_match_proxy_get_instance_private (proxy);
9182#else
9183 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_MATCH_PROXY, SensorMatchProxyPrivate);
9184#endif
9185
9186 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_match_interface_info ());
9187}
9188
9189static void
9190sensor_match_proxy_class_init (SensorMatchProxyClass *klass)
9191{
9192 GObjectClass *gobject_class;
9193 GDBusProxyClass *proxy_class;
9194
9195 gobject_class = G_OBJECT_CLASS (klass);
9196 gobject_class->finalize = sensor_match_proxy_finalize;
9197 gobject_class->get_property = sensor_match_proxy_get_property;
9198 gobject_class->set_property = sensor_match_proxy_set_property;
9199
9200 proxy_class = G_DBUS_PROXY_CLASS (klass);
9201 proxy_class->g_signal = sensor_match_proxy_g_signal;
9202 proxy_class->g_properties_changed = sensor_match_proxy_g_properties_changed;
9203
9204 sensor_match_override_properties (gobject_class, 1);
9205
9206#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
9207 g_type_class_add_private (klass, sizeof (SensorMatchProxyPrivate));
9208#endif
9209}
9210
9211static void
9212sensor_match_proxy_iface_init (SensorMatchIface *iface)
9213{
9214 iface->get_match_value = sensor_match_proxy_get_match_value;
9215 iface->get_state = sensor_match_proxy_get_state;
9216}
9217
9218/**
9219 * sensor_match_proxy_new:
9220 * @connection: A #GDBusConnection.
9221 * @flags: Flags from the #GDBusProxyFlags enumeration.
9222 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
9223 * @object_path: An object path.
9224 * @cancellable: (allow-none): A #GCancellable or %NULL.
9225 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
9226 * @user_data: User data to pass to @callback.
9227 *
9228 * 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.
9229 *
9230 * 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.
9231 * You can then call sensor_match_proxy_new_finish() to get the result of the operation.
9232 *
9233 * See sensor_match_proxy_new_sync() for the synchronous, blocking version of this constructor.
9234 */
9235void
9236sensor_match_proxy_new (
9237 GDBusConnection *connection,
9238 GDBusProxyFlags flags,
9239 const gchar *name,
9240 const gchar *object_path,
9241 GCancellable *cancellable,
9242 GAsyncReadyCallback callback,
9243 gpointer user_data)
9244{
9245 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);
9246}
9247
9248/**
9249 * sensor_match_proxy_new_finish:
9250 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new().
9251 * @error: Return location for error or %NULL
9252 *
9253 * Finishes an operation started with sensor_match_proxy_new().
9254 *
9255 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9256 */
9257SensorMatch *
9258sensor_match_proxy_new_finish (
9259 GAsyncResult *res,
9260 GError **error)
9261{
9262 GObject *ret;
9263 GObject *source_object;
9264 source_object = g_async_result_get_source_object (res);
9265 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
9266 g_object_unref (source_object);
9267 if (ret != NULL)
9268 return SENSOR_MATCH (ret);
9269 else
9270 return NULL;
9271}
9272
9273/**
9274 * sensor_match_proxy_new_sync:
9275 * @connection: A #GDBusConnection.
9276 * @flags: Flags from the #GDBusProxyFlags enumeration.
9277 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
9278 * @object_path: An object path.
9279 * @cancellable: (allow-none): A #GCancellable or %NULL.
9280 * @error: Return location for error or %NULL
9281 *
9282 * 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.
9283 *
9284 * The calling thread is blocked until a reply is received.
9285 *
9286 * See sensor_match_proxy_new() for the asynchronous version of this constructor.
9287 *
9288 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9289 */
9290SensorMatch *
9291sensor_match_proxy_new_sync (
9292 GDBusConnection *connection,
9293 GDBusProxyFlags flags,
9294 const gchar *name,
9295 const gchar *object_path,
9296 GCancellable *cancellable,
9297 GError **error)
9298{
9299 GInitable *ret;
9300 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);
9301 if (ret != NULL)
9302 return SENSOR_MATCH (ret);
9303 else
9304 return NULL;
9305}
9306
9307
9308/**
9309 * sensor_match_proxy_new_for_bus:
9310 * @bus_type: A #GBusType.
9311 * @flags: Flags from the #GDBusProxyFlags enumeration.
9312 * @name: A bus name (well-known or unique).
9313 * @object_path: An object path.
9314 * @cancellable: (allow-none): A #GCancellable or %NULL.
9315 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
9316 * @user_data: User data to pass to @callback.
9317 *
9318 * Like sensor_match_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
9319 *
9320 * 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.
9321 * You can then call sensor_match_proxy_new_for_bus_finish() to get the result of the operation.
9322 *
9323 * See sensor_match_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
9324 */
9325void
9326sensor_match_proxy_new_for_bus (
9327 GBusType bus_type,
9328 GDBusProxyFlags flags,
9329 const gchar *name,
9330 const gchar *object_path,
9331 GCancellable *cancellable,
9332 GAsyncReadyCallback callback,
9333 gpointer user_data)
9334{
9335 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);
9336}
9337
9338/**
9339 * sensor_match_proxy_new_for_bus_finish:
9340 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new_for_bus().
9341 * @error: Return location for error or %NULL
9342 *
9343 * Finishes an operation started with sensor_match_proxy_new_for_bus().
9344 *
9345 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9346 */
9347SensorMatch *
9348sensor_match_proxy_new_for_bus_finish (
9349 GAsyncResult *res,
9350 GError **error)
9351{
9352 GObject *ret;
9353 GObject *source_object;
9354 source_object = g_async_result_get_source_object (res);
9355 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
9356 g_object_unref (source_object);
9357 if (ret != NULL)
9358 return SENSOR_MATCH (ret);
9359 else
9360 return NULL;
9361}
9362
9363/**
9364 * sensor_match_proxy_new_for_bus_sync:
9365 * @bus_type: A #GBusType.
9366 * @flags: Flags from the #GDBusProxyFlags enumeration.
9367 * @name: A bus name (well-known or unique).
9368 * @object_path: An object path.
9369 * @cancellable: (allow-none): A #GCancellable or %NULL.
9370 * @error: Return location for error or %NULL
9371 *
9372 * Like sensor_match_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
9373 *
9374 * The calling thread is blocked until a reply is received.
9375 *
9376 * See sensor_match_proxy_new_for_bus() for the asynchronous version of this constructor.
9377 *
9378 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9379 */
9380SensorMatch *
9381sensor_match_proxy_new_for_bus_sync (
9382 GBusType bus_type,
9383 GDBusProxyFlags flags,
9384 const gchar *name,
9385 const gchar *object_path,
9386 GCancellable *cancellable,
9387 GError **error)
9388{
9389 GInitable *ret;
9390 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);
9391 if (ret != NULL)
9392 return SENSOR_MATCH (ret);
9393 else
9394 return NULL;
9395}
9396
9397
9398/* ------------------------------------------------------------------------ */
9399
9400/**
9401 * SensorMatchSkeleton:
9402 *
9403 * The #SensorMatchSkeleton structure contains only private data and should only be accessed using the provided API.
9404 */
9405
9406/**
9407 * SensorMatchSkeletonClass:
9408 * @parent_class: The parent class.
9409 *
9410 * Class structure for #SensorMatchSkeleton.
9411 */
9412
9413struct _SensorMatchSkeletonPrivate
9414{
9415 GValue *properties;
9416 GList *changed_properties;
9417 GSource *changed_properties_idle_source;
9418 GMainContext *context;
9419 GMutex lock;
9420};
9421
9422static void
9423_sensor_match_skeleton_handle_method_call (
9424 GDBusConnection *connection G_GNUC_UNUSED,
9425 const gchar *sender G_GNUC_UNUSED,
9426 const gchar *object_path G_GNUC_UNUSED,
9427 const gchar *interface_name,
9428 const gchar *method_name,
9429 GVariant *parameters,
9430 GDBusMethodInvocation *invocation,
9431 gpointer user_data)
9432{
9433 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9434 _ExtendedGDBusMethodInfo *info;
9435 GVariantIter iter;
9436 GVariant *child;
9437 GValue *paramv;
9438 guint num_params;
9439 guint num_extra;
9440 guint n;
9441 guint signal_id;
9442 GValue return_value = G_VALUE_INIT;
9443 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
9444 g_assert (info != NULL);
9445 num_params = g_variant_n_children (parameters);
9446 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
9447 n = 0;
9448 g_value_init (&paramv[n], TYPE_SENSOR_MATCH);
9449 g_value_set_object (&paramv[n++], skeleton);
9450 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
9451 g_value_set_object (&paramv[n++], invocation);
9452 if (info->pass_fdlist)
9453 {
9454#ifdef G_OS_UNIX
9455 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
9456 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
9457#else
9458 g_assert_not_reached ();
9459#endif
9460 }
9461 g_variant_iter_init (&iter, parameters);
9462 while ((child = g_variant_iter_next_value (&iter)) != NULL)
9463 {
9464 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
9465 if (arg_info->use_gvariant)
9466 {
9467 g_value_init (&paramv[n], G_TYPE_VARIANT);
9468 g_value_set_variant (&paramv[n], child);
9469 n++;
9470 }
9471 else
9472 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
9473 g_variant_unref (child);
9474 }
9475 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH);
9476 g_value_init (&return_value, G_TYPE_BOOLEAN);
9477 g_signal_emitv (paramv, signal_id, 0, &return_value);
9478 if (!g_value_get_boolean (&return_value))
9479 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);
9480 g_value_unset (&return_value);
9481 for (n = 0; n < num_params + num_extra; n++)
9482 g_value_unset (&paramv[n]);
9483 g_free (paramv);
9484}
9485
9486static GVariant *
9487_sensor_match_skeleton_handle_get_property (
9488 GDBusConnection *connection G_GNUC_UNUSED,
9489 const gchar *sender G_GNUC_UNUSED,
9490 const gchar *object_path G_GNUC_UNUSED,
9491 const gchar *interface_name G_GNUC_UNUSED,
9492 const gchar *property_name,
9493 GError **error,
9494 gpointer user_data)
9495{
9496 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9497 GValue value = G_VALUE_INIT;
9498 GParamSpec *pspec;
9499 _ExtendedGDBusPropertyInfo *info;
9500 GVariant *ret;
9501 ret = NULL;
9502 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name);
9503 g_assert (info != NULL);
9504 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
9505 if (pspec == NULL)
9506 {
9507 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
9508 }
9509 else
9510 {
9511 g_value_init (&value, pspec->value_type);
9512 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
9513 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
9514 g_value_unset (&value);
9515 }
9516 return ret;
9517}
9518
9519static gboolean
9520_sensor_match_skeleton_handle_set_property (
9521 GDBusConnection *connection G_GNUC_UNUSED,
9522 const gchar *sender G_GNUC_UNUSED,
9523 const gchar *object_path G_GNUC_UNUSED,
9524 const gchar *interface_name G_GNUC_UNUSED,
9525 const gchar *property_name,
9526 GVariant *variant,
9527 GError **error,
9528 gpointer user_data)
9529{
9530 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9531 GValue value = G_VALUE_INIT;
9532 GParamSpec *pspec;
9533 _ExtendedGDBusPropertyInfo *info;
9534 gboolean ret;
9535 ret = FALSE;
9536 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name);
9537 g_assert (info != NULL);
9538 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
9539 if (pspec == NULL)
9540 {
9541 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
9542 }
9543 else
9544 {
9545 if (info->use_gvariant)
9546 g_value_set_variant (&value, variant);
9547 else
9548 g_dbus_gvariant_to_gvalue (variant, &value);
9549 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
9550 g_value_unset (&value);
9551 ret = TRUE;
9552 }
9553 return ret;
9554}
9555
9556static const GDBusInterfaceVTable _sensor_match_skeleton_vtable =
9557{
9558 _sensor_match_skeleton_handle_method_call,
9559 _sensor_match_skeleton_handle_get_property,
9560 _sensor_match_skeleton_handle_set_property,
9561 {NULL}
9562};
9563
9564static GDBusInterfaceInfo *
9565sensor_match_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
9566{
9567 return sensor_match_interface_info ();
9568}
9569
9570static GDBusInterfaceVTable *
9571sensor_match_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
9572{
9573 return (GDBusInterfaceVTable *) &_sensor_match_skeleton_vtable;
9574}
9575
9576static GVariant *
9577sensor_match_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
9578{
9579 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton);
9580
9581 GVariantBuilder builder;
9582 guint n;
9583 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
9584 if (_sensor_match_interface_info.parent_struct.properties == NULL)
9585 goto out;
9586 for (n = 0; _sensor_match_interface_info.parent_struct.properties[n] != NULL; n++)
9587 {
9588 GDBusPropertyInfo *info = _sensor_match_interface_info.parent_struct.properties[n];
9589 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
9590 {
9591 GVariant *value;
9592 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);
9593 if (value != NULL)
9594 {
9595 g_variant_take_ref (value);
9596 g_variant_builder_add (&builder, "{sv}", info->name, value);
9597 g_variant_unref (value);
9598 }
9599 }
9600 }
9601out:
9602 return g_variant_builder_end (&builder);
9603}
9604
9605static gboolean _sensor_match_emit_changed (gpointer user_data);
9606
9607static void
9608sensor_match_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
9609{
9610 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton);
9611 gboolean emit_changed = FALSE;
9612
9613 g_mutex_lock (&skeleton->priv->lock);
9614 if (skeleton->priv->changed_properties_idle_source != NULL)
9615 {
9616 g_source_destroy (skeleton->priv->changed_properties_idle_source);
9617 skeleton->priv->changed_properties_idle_source = NULL;
9618 emit_changed = TRUE;
9619 }
9620 g_mutex_unlock (&skeleton->priv->lock);
9621
9622 if (emit_changed)
9623 _sensor_match_emit_changed (skeleton);
9624}
9625
9626static void
9627_sensor_match_on_signal_sensor_match (
9628 SensorMatch *object,
9629 guchar arg_state)
9630{
9631 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9632
9633 GList *connections, *l;
9634 GVariant *signal_variant;
9635 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
9636
9637 signal_variant = g_variant_ref_sink (g_variant_new ("(y)",
9638 arg_state));
9639 for (l = connections; l != NULL; l = l->next)
9640 {
9641 GDBusConnection *connection = l->data;
9642 g_dbus_connection_emit_signal (connection,
9643 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorMatch", "SensorMatch",
9644 signal_variant, NULL);
9645 }
9646 g_variant_unref (signal_variant);
9647 g_list_free_full (connections, g_object_unref);
9648}
9649
9650static void sensor_match_skeleton_iface_init (SensorMatchIface *iface);
9651#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9652G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
9653 G_ADD_PRIVATE (SensorMatchSkeleton)
9654 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init));
9655
9656#else
9657G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
9658 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init));
9659
9660#endif
9661static void
9662sensor_match_skeleton_finalize (GObject *object)
9663{
9664 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9665 guint n;
9666 for (n = 0; n < 2; n++)
9667 g_value_unset (&skeleton->priv->properties[n]);
9668 g_free (skeleton->priv->properties);
9669 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
9670 if (skeleton->priv->changed_properties_idle_source != NULL)
9671 g_source_destroy (skeleton->priv->changed_properties_idle_source);
9672 g_main_context_unref (skeleton->priv->context);
9673 g_mutex_clear (&skeleton->priv->lock);
9674 G_OBJECT_CLASS (sensor_match_skeleton_parent_class)->finalize (object);
9675}
9676
9677static void
9678sensor_match_skeleton_get_property (GObject *object,
9679 guint prop_id,
9680 GValue *value,
9681 GParamSpec *pspec G_GNUC_UNUSED)
9682{
9683 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9684 g_assert (prop_id != 0 && prop_id - 1 < 2);
9685 g_mutex_lock (&skeleton->priv->lock);
9686 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
9687 g_mutex_unlock (&skeleton->priv->lock);
9688}
9689
9690static gboolean
9691_sensor_match_emit_changed (gpointer user_data)
9692{
9693 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9694 GList *l;
9695 GVariantBuilder builder;
9696 GVariantBuilder invalidated_builder;
9697 guint num_changes;
9698
9699 g_mutex_lock (&skeleton->priv->lock);
9700 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
9701 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
9702 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
9703 {
9704 ChangedProperty *cp = l->data;
9705 GVariant *variant;
9706 const GValue *cur_value;
9707
9708 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
9709 if (!_g_value_equal (cur_value, &cp->orig_value))
9710 {
9711 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
9712 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
9713 g_variant_unref (variant);
9714 num_changes++;
9715 }
9716 }
9717 if (num_changes > 0)
9718 {
9719 GList *connections, *ll;
9720 GVariant *signal_variant;
9721 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorMatch",
9722 &builder, &invalidated_builder));
9723 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
9724 for (ll = connections; ll != NULL; ll = ll->next)
9725 {
9726 GDBusConnection *connection = ll->data;
9727
9728 g_dbus_connection_emit_signal (connection,
9729 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
9730 "org.freedesktop.DBus.Properties",
9731 "PropertiesChanged",
9732 signal_variant,
9733 NULL);
9734 }
9735 g_variant_unref (signal_variant);
9736 g_list_free_full (connections, g_object_unref);
9737 }
9738 else
9739 {
9740 g_variant_builder_clear (&builder);
9741 g_variant_builder_clear (&invalidated_builder);
9742 }
9743 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
9744 skeleton->priv->changed_properties = NULL;
9745 skeleton->priv->changed_properties_idle_source = NULL;
9746 g_mutex_unlock (&skeleton->priv->lock);
9747 return FALSE;
9748}
9749
9750static void
9751_sensor_match_schedule_emit_changed (SensorMatchSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
9752{
9753 ChangedProperty *cp;
9754 GList *l;
9755 cp = NULL;
9756 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
9757 {
9758 ChangedProperty *i_cp = l->data;
9759 if (i_cp->info == info)
9760 {
9761 cp = i_cp;
9762 break;
9763 }
9764 }
9765 if (cp == NULL)
9766 {
9767 cp = g_new0 (ChangedProperty, 1);
9768 cp->prop_id = prop_id;
9769 cp->info = info;
9770 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
9771 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
9772 g_value_copy (orig_value, &cp->orig_value);
9773 }
9774}
9775
9776static void
9777sensor_match_skeleton_notify (GObject *object,
9778 GParamSpec *pspec G_GNUC_UNUSED)
9779{
9780 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9781 g_mutex_lock (&skeleton->priv->lock);
9782 if (skeleton->priv->changed_properties != NULL &&
9783 skeleton->priv->changed_properties_idle_source == NULL)
9784 {
9785 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
9786 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
9787 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_match_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylak2cb27752015-10-19 16:23:14 -05009788 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _sensor_match_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -05009789 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
9790 g_source_unref (skeleton->priv->changed_properties_idle_source);
9791 }
9792 g_mutex_unlock (&skeleton->priv->lock);
9793}
9794
9795static void
9796sensor_match_skeleton_set_property (GObject *object,
9797 guint prop_id,
9798 const GValue *value,
9799 GParamSpec *pspec)
9800{
9801 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9802 g_assert (prop_id != 0 && prop_id - 1 < 2);
9803 g_mutex_lock (&skeleton->priv->lock);
9804 g_object_freeze_notify (object);
9805 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
9806 {
9807 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
9808 _sensor_match_schedule_emit_changed (skeleton, _sensor_match_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
9809 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
9810 g_object_notify_by_pspec (object, pspec);
9811 }
9812 g_mutex_unlock (&skeleton->priv->lock);
9813 g_object_thaw_notify (object);
9814}
9815
9816static void
9817sensor_match_skeleton_init (SensorMatchSkeleton *skeleton)
9818{
9819#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9820 skeleton->priv = sensor_match_skeleton_get_instance_private (skeleton);
9821#else
9822 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_MATCH_SKELETON, SensorMatchSkeletonPrivate);
9823#endif
9824
9825 g_mutex_init (&skeleton->priv->lock);
9826 skeleton->priv->context = g_main_context_ref_thread_default ();
9827 skeleton->priv->properties = g_new0 (GValue, 2);
9828 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
9829 g_value_init (&skeleton->priv->properties[1], G_TYPE_UCHAR);
9830}
9831
9832static GVariant *
9833sensor_match_skeleton_get_match_value (SensorMatch *object)
9834{
9835 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9836 GVariant *value;
9837 g_mutex_lock (&skeleton->priv->lock);
9838 value = g_value_get_variant (&(skeleton->priv->properties[0]));
9839 g_mutex_unlock (&skeleton->priv->lock);
9840 return value;
9841}
9842
9843static guchar
9844sensor_match_skeleton_get_state (SensorMatch *object)
9845{
9846 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9847 guchar value;
9848 g_mutex_lock (&skeleton->priv->lock);
9849 value = g_value_get_uchar (&(skeleton->priv->properties[1]));
9850 g_mutex_unlock (&skeleton->priv->lock);
9851 return value;
9852}
9853
9854static void
9855sensor_match_skeleton_class_init (SensorMatchSkeletonClass *klass)
9856{
9857 GObjectClass *gobject_class;
9858 GDBusInterfaceSkeletonClass *skeleton_class;
9859
9860 gobject_class = G_OBJECT_CLASS (klass);
9861 gobject_class->finalize = sensor_match_skeleton_finalize;
9862 gobject_class->get_property = sensor_match_skeleton_get_property;
9863 gobject_class->set_property = sensor_match_skeleton_set_property;
9864 gobject_class->notify = sensor_match_skeleton_notify;
9865
9866
9867 sensor_match_override_properties (gobject_class, 1);
9868
9869 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
9870 skeleton_class->get_info = sensor_match_skeleton_dbus_interface_get_info;
9871 skeleton_class->get_properties = sensor_match_skeleton_dbus_interface_get_properties;
9872 skeleton_class->flush = sensor_match_skeleton_dbus_interface_flush;
9873 skeleton_class->get_vtable = sensor_match_skeleton_dbus_interface_get_vtable;
9874
9875#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
9876 g_type_class_add_private (klass, sizeof (SensorMatchSkeletonPrivate));
9877#endif
9878}
9879
9880static void
9881sensor_match_skeleton_iface_init (SensorMatchIface *iface)
9882{
9883 iface->sensor_match = _sensor_match_on_signal_sensor_match;
9884 iface->get_match_value = sensor_match_skeleton_get_match_value;
9885 iface->get_state = sensor_match_skeleton_get_state;
9886}
9887
9888/**
9889 * sensor_match_skeleton_new:
9890 *
9891 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
9892 *
9893 * Returns: (transfer full) (type SensorMatchSkeleton): The skeleton object.
9894 */
9895SensorMatch *
9896sensor_match_skeleton_new (void)
9897{
9898 return SENSOR_MATCH (g_object_new (TYPE_SENSOR_MATCH_SKELETON, NULL));
9899}
9900
9901/* ------------------------------------------------------------------------
9902 * Code for interface org.openbmc.Process
9903 * ------------------------------------------------------------------------
9904 */
9905
9906/**
9907 * SECTION:Process
9908 * @title: Process
9909 * @short_description: Generated C code for the org.openbmc.Process D-Bus interface
9910 *
9911 * 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.
9912 */
9913
9914/* ---- Introspection data for org.openbmc.Process ---- */
9915
9916static const _ExtendedGDBusMethodInfo _process_method_info_stop =
9917{
9918 {
9919 -1,
9920 (gchar *) "stop",
9921 NULL,
9922 NULL,
9923 NULL
9924 },
9925 "handle-stop",
9926 FALSE
9927};
9928
9929static const _ExtendedGDBusMethodInfo * const _process_method_info_pointers[] =
9930{
9931 &_process_method_info_stop,
9932 NULL
9933};
9934
9935static const _ExtendedGDBusInterfaceInfo _process_interface_info =
9936{
9937 {
9938 -1,
9939 (gchar *) "org.openbmc.Process",
9940 (GDBusMethodInfo **) &_process_method_info_pointers,
9941 NULL,
9942 NULL,
9943 NULL
9944 },
9945 "process",
9946};
9947
9948
9949/**
9950 * process_interface_info:
9951 *
9952 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> D-Bus interface.
9953 *
9954 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
9955 */
9956GDBusInterfaceInfo *
9957process_interface_info (void)
9958{
9959 return (GDBusInterfaceInfo *) &_process_interface_info.parent_struct;
9960}
9961
9962/**
9963 * process_override_properties:
9964 * @klass: The class structure for a #GObject<!-- -->-derived class.
9965 * @property_id_begin: The property id to assign to the first overridden property.
9966 *
9967 * Overrides all #GObject properties in the #Process interface for a concrete class.
9968 * The properties are overridden in the order they are defined.
9969 *
9970 * Returns: The last property id.
9971 */
9972guint
9973process_override_properties (GObjectClass *klass, guint property_id_begin)
9974{
9975 return property_id_begin - 1;
9976}
9977
9978
9979
9980/**
9981 * Process:
9982 *
9983 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
9984 */
9985
9986/**
9987 * ProcessIface:
9988 * @parent_iface: The parent interface.
9989 * @handle_stop: Handler for the #Process::handle-stop signal.
9990 *
9991 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
9992 */
9993
9994typedef ProcessIface ProcessInterface;
9995G_DEFINE_INTERFACE (Process, process, G_TYPE_OBJECT);
9996
9997static void
9998process_default_init (ProcessIface *iface)
9999{
10000 /* GObject signals for incoming D-Bus method calls: */
10001 /**
10002 * Process::handle-stop:
10003 * @object: A #Process.
10004 * @invocation: A #GDBusMethodInvocation.
10005 *
10006 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method.
10007 *
10008 * 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.
10009 *
10010 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
10011 */
10012 g_signal_new ("handle-stop",
10013 G_TYPE_FROM_INTERFACE (iface),
10014 G_SIGNAL_RUN_LAST,
10015 G_STRUCT_OFFSET (ProcessIface, handle_stop),
10016 g_signal_accumulator_true_handled,
10017 NULL,
10018 g_cclosure_marshal_generic,
10019 G_TYPE_BOOLEAN,
10020 1,
10021 G_TYPE_DBUS_METHOD_INVOCATION);
10022
10023}
10024
10025/**
10026 * process_call_stop:
10027 * @proxy: A #ProcessProxy.
10028 * @cancellable: (allow-none): A #GCancellable or %NULL.
10029 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
10030 * @user_data: User data to pass to @callback.
10031 *
10032 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method on @proxy.
10033 * 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.
10034 * You can then call process_call_stop_finish() to get the result of the operation.
10035 *
10036 * See process_call_stop_sync() for the synchronous, blocking version of this method.
10037 */
10038void
10039process_call_stop (
10040 Process *proxy,
10041 GCancellable *cancellable,
10042 GAsyncReadyCallback callback,
10043 gpointer user_data)
10044{
10045 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
10046 "stop",
10047 g_variant_new ("()"),
10048 G_DBUS_CALL_FLAGS_NONE,
10049 -1,
10050 cancellable,
10051 callback,
10052 user_data);
10053}
10054
10055/**
10056 * process_call_stop_finish:
10057 * @proxy: A #ProcessProxy.
10058 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_call_stop().
10059 * @error: Return location for error or %NULL.
10060 *
10061 * Finishes an operation started with process_call_stop().
10062 *
10063 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
10064 */
10065gboolean
10066process_call_stop_finish (
10067 Process *proxy,
10068 GAsyncResult *res,
10069 GError **error)
10070{
10071 GVariant *_ret;
10072 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
10073 if (_ret == NULL)
10074 goto _out;
10075 g_variant_get (_ret,
10076 "()");
10077 g_variant_unref (_ret);
10078_out:
10079 return _ret != NULL;
10080}
10081
10082/**
10083 * process_call_stop_sync:
10084 * @proxy: A #ProcessProxy.
10085 * @cancellable: (allow-none): A #GCancellable or %NULL.
10086 * @error: Return location for error or %NULL.
10087 *
10088 * 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.
10089 *
10090 * See process_call_stop() for the asynchronous version of this method.
10091 *
10092 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
10093 */
10094gboolean
10095process_call_stop_sync (
10096 Process *proxy,
10097 GCancellable *cancellable,
10098 GError **error)
10099{
10100 GVariant *_ret;
10101 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
10102 "stop",
10103 g_variant_new ("()"),
10104 G_DBUS_CALL_FLAGS_NONE,
10105 -1,
10106 cancellable,
10107 error);
10108 if (_ret == NULL)
10109 goto _out;
10110 g_variant_get (_ret,
10111 "()");
10112 g_variant_unref (_ret);
10113_out:
10114 return _ret != NULL;
10115}
10116
10117/**
10118 * process_complete_stop:
10119 * @object: A #Process.
10120 * @invocation: (transfer full): A #GDBusMethodInvocation.
10121 *
10122 * 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.
10123 *
10124 * This method will free @invocation, you cannot use it afterwards.
10125 */
10126void
10127process_complete_stop (
10128 Process *object,
10129 GDBusMethodInvocation *invocation)
10130{
10131 g_dbus_method_invocation_return_value (invocation,
10132 g_variant_new ("()"));
10133}
10134
10135/* ------------------------------------------------------------------------ */
10136
10137/**
10138 * ProcessProxy:
10139 *
10140 * The #ProcessProxy structure contains only private data and should only be accessed using the provided API.
10141 */
10142
10143/**
10144 * ProcessProxyClass:
10145 * @parent_class: The parent class.
10146 *
10147 * Class structure for #ProcessProxy.
10148 */
10149
10150struct _ProcessProxyPrivate
10151{
10152 GData *qdata;
10153};
10154
10155static void process_proxy_iface_init (ProcessIface *iface);
10156
10157#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10158G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY,
10159 G_ADD_PRIVATE (ProcessProxy)
10160 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init));
10161
10162#else
10163G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY,
10164 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init));
10165
10166#endif
10167static void
10168process_proxy_finalize (GObject *object)
10169{
10170 ProcessProxy *proxy = PROCESS_PROXY (object);
10171 g_datalist_clear (&proxy->priv->qdata);
10172 G_OBJECT_CLASS (process_proxy_parent_class)->finalize (object);
10173}
10174
10175static void
10176process_proxy_get_property (GObject *object,
10177 guint prop_id,
10178 GValue *value,
10179 GParamSpec *pspec G_GNUC_UNUSED)
10180{
10181}
10182
10183static void
10184process_proxy_set_property (GObject *object,
10185 guint prop_id,
10186 const GValue *value,
10187 GParamSpec *pspec G_GNUC_UNUSED)
10188{
10189}
10190
10191static void
10192process_proxy_g_signal (GDBusProxy *proxy,
10193 const gchar *sender_name G_GNUC_UNUSED,
10194 const gchar *signal_name,
10195 GVariant *parameters)
10196{
10197 _ExtendedGDBusSignalInfo *info;
10198 GVariantIter iter;
10199 GVariant *child;
10200 GValue *paramv;
10201 guint num_params;
10202 guint n;
10203 guint signal_id;
10204 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, signal_name);
10205 if (info == NULL)
10206 return;
10207 num_params = g_variant_n_children (parameters);
10208 paramv = g_new0 (GValue, num_params + 1);
10209 g_value_init (&paramv[0], TYPE_PROCESS);
10210 g_value_set_object (&paramv[0], proxy);
10211 g_variant_iter_init (&iter, parameters);
10212 n = 1;
10213 while ((child = g_variant_iter_next_value (&iter)) != NULL)
10214 {
10215 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
10216 if (arg_info->use_gvariant)
10217 {
10218 g_value_init (&paramv[n], G_TYPE_VARIANT);
10219 g_value_set_variant (&paramv[n], child);
10220 n++;
10221 }
10222 else
10223 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
10224 g_variant_unref (child);
10225 }
10226 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS);
10227 g_signal_emitv (paramv, signal_id, 0, NULL);
10228 for (n = 0; n < num_params + 1; n++)
10229 g_value_unset (&paramv[n]);
10230 g_free (paramv);
10231}
10232
10233static void
10234process_proxy_g_properties_changed (GDBusProxy *_proxy,
10235 GVariant *changed_properties,
10236 const gchar *const *invalidated_properties)
10237{
10238 ProcessProxy *proxy = PROCESS_PROXY (_proxy);
10239 guint n;
10240 const gchar *key;
10241 GVariantIter *iter;
10242 _ExtendedGDBusPropertyInfo *info;
10243 g_variant_get (changed_properties, "a{sv}", &iter);
10244 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
10245 {
10246 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, key);
10247 g_datalist_remove_data (&proxy->priv->qdata, key);
10248 if (info != NULL)
10249 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
10250 }
10251 g_variant_iter_free (iter);
10252 for (n = 0; invalidated_properties[n] != NULL; n++)
10253 {
10254 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, invalidated_properties[n]);
10255 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
10256 if (info != NULL)
10257 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
10258 }
10259}
10260
10261static void
10262process_proxy_init (ProcessProxy *proxy)
10263{
10264#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10265 proxy->priv = process_proxy_get_instance_private (proxy);
10266#else
10267 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_PROCESS_PROXY, ProcessProxyPrivate);
10268#endif
10269
10270 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), process_interface_info ());
10271}
10272
10273static void
10274process_proxy_class_init (ProcessProxyClass *klass)
10275{
10276 GObjectClass *gobject_class;
10277 GDBusProxyClass *proxy_class;
10278
10279 gobject_class = G_OBJECT_CLASS (klass);
10280 gobject_class->finalize = process_proxy_finalize;
10281 gobject_class->get_property = process_proxy_get_property;
10282 gobject_class->set_property = process_proxy_set_property;
10283
10284 proxy_class = G_DBUS_PROXY_CLASS (klass);
10285 proxy_class->g_signal = process_proxy_g_signal;
10286 proxy_class->g_properties_changed = process_proxy_g_properties_changed;
10287
10288#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
10289 g_type_class_add_private (klass, sizeof (ProcessProxyPrivate));
10290#endif
10291}
10292
10293static void
10294process_proxy_iface_init (ProcessIface *iface)
10295{
10296}
10297
10298/**
10299 * process_proxy_new:
10300 * @connection: A #GDBusConnection.
10301 * @flags: Flags from the #GDBusProxyFlags enumeration.
10302 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
10303 * @object_path: An object path.
10304 * @cancellable: (allow-none): A #GCancellable or %NULL.
10305 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
10306 * @user_data: User data to pass to @callback.
10307 *
10308 * 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.
10309 *
10310 * 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.
10311 * You can then call process_proxy_new_finish() to get the result of the operation.
10312 *
10313 * See process_proxy_new_sync() for the synchronous, blocking version of this constructor.
10314 */
10315void
10316process_proxy_new (
10317 GDBusConnection *connection,
10318 GDBusProxyFlags flags,
10319 const gchar *name,
10320 const gchar *object_path,
10321 GCancellable *cancellable,
10322 GAsyncReadyCallback callback,
10323 gpointer user_data)
10324{
10325 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);
10326}
10327
10328/**
10329 * process_proxy_new_finish:
10330 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new().
10331 * @error: Return location for error or %NULL
10332 *
10333 * Finishes an operation started with process_proxy_new().
10334 *
10335 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10336 */
10337Process *
10338process_proxy_new_finish (
10339 GAsyncResult *res,
10340 GError **error)
10341{
10342 GObject *ret;
10343 GObject *source_object;
10344 source_object = g_async_result_get_source_object (res);
10345 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
10346 g_object_unref (source_object);
10347 if (ret != NULL)
10348 return PROCESS (ret);
10349 else
10350 return NULL;
10351}
10352
10353/**
10354 * process_proxy_new_sync:
10355 * @connection: A #GDBusConnection.
10356 * @flags: Flags from the #GDBusProxyFlags enumeration.
10357 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
10358 * @object_path: An object path.
10359 * @cancellable: (allow-none): A #GCancellable or %NULL.
10360 * @error: Return location for error or %NULL
10361 *
10362 * 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.
10363 *
10364 * The calling thread is blocked until a reply is received.
10365 *
10366 * See process_proxy_new() for the asynchronous version of this constructor.
10367 *
10368 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10369 */
10370Process *
10371process_proxy_new_sync (
10372 GDBusConnection *connection,
10373 GDBusProxyFlags flags,
10374 const gchar *name,
10375 const gchar *object_path,
10376 GCancellable *cancellable,
10377 GError **error)
10378{
10379 GInitable *ret;
10380 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);
10381 if (ret != NULL)
10382 return PROCESS (ret);
10383 else
10384 return NULL;
10385}
10386
10387
10388/**
10389 * process_proxy_new_for_bus:
10390 * @bus_type: A #GBusType.
10391 * @flags: Flags from the #GDBusProxyFlags enumeration.
10392 * @name: A bus name (well-known or unique).
10393 * @object_path: An object path.
10394 * @cancellable: (allow-none): A #GCancellable or %NULL.
10395 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
10396 * @user_data: User data to pass to @callback.
10397 *
10398 * Like process_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
10399 *
10400 * 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.
10401 * You can then call process_proxy_new_for_bus_finish() to get the result of the operation.
10402 *
10403 * See process_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
10404 */
10405void
10406process_proxy_new_for_bus (
10407 GBusType bus_type,
10408 GDBusProxyFlags flags,
10409 const gchar *name,
10410 const gchar *object_path,
10411 GCancellable *cancellable,
10412 GAsyncReadyCallback callback,
10413 gpointer user_data)
10414{
10415 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);
10416}
10417
10418/**
10419 * process_proxy_new_for_bus_finish:
10420 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new_for_bus().
10421 * @error: Return location for error or %NULL
10422 *
10423 * Finishes an operation started with process_proxy_new_for_bus().
10424 *
10425 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10426 */
10427Process *
10428process_proxy_new_for_bus_finish (
10429 GAsyncResult *res,
10430 GError **error)
10431{
10432 GObject *ret;
10433 GObject *source_object;
10434 source_object = g_async_result_get_source_object (res);
10435 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
10436 g_object_unref (source_object);
10437 if (ret != NULL)
10438 return PROCESS (ret);
10439 else
10440 return NULL;
10441}
10442
10443/**
10444 * process_proxy_new_for_bus_sync:
10445 * @bus_type: A #GBusType.
10446 * @flags: Flags from the #GDBusProxyFlags enumeration.
10447 * @name: A bus name (well-known or unique).
10448 * @object_path: An object path.
10449 * @cancellable: (allow-none): A #GCancellable or %NULL.
10450 * @error: Return location for error or %NULL
10451 *
10452 * Like process_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
10453 *
10454 * The calling thread is blocked until a reply is received.
10455 *
10456 * See process_proxy_new_for_bus() for the asynchronous version of this constructor.
10457 *
10458 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10459 */
10460Process *
10461process_proxy_new_for_bus_sync (
10462 GBusType bus_type,
10463 GDBusProxyFlags flags,
10464 const gchar *name,
10465 const gchar *object_path,
10466 GCancellable *cancellable,
10467 GError **error)
10468{
10469 GInitable *ret;
10470 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);
10471 if (ret != NULL)
10472 return PROCESS (ret);
10473 else
10474 return NULL;
10475}
10476
10477
10478/* ------------------------------------------------------------------------ */
10479
10480/**
10481 * ProcessSkeleton:
10482 *
10483 * The #ProcessSkeleton structure contains only private data and should only be accessed using the provided API.
10484 */
10485
10486/**
10487 * ProcessSkeletonClass:
10488 * @parent_class: The parent class.
10489 *
10490 * Class structure for #ProcessSkeleton.
10491 */
10492
10493struct _ProcessSkeletonPrivate
10494{
10495 GValue *properties;
10496 GList *changed_properties;
10497 GSource *changed_properties_idle_source;
10498 GMainContext *context;
10499 GMutex lock;
10500};
10501
10502static void
10503_process_skeleton_handle_method_call (
10504 GDBusConnection *connection G_GNUC_UNUSED,
10505 const gchar *sender G_GNUC_UNUSED,
10506 const gchar *object_path G_GNUC_UNUSED,
10507 const gchar *interface_name,
10508 const gchar *method_name,
10509 GVariant *parameters,
10510 GDBusMethodInvocation *invocation,
10511 gpointer user_data)
10512{
10513 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
10514 _ExtendedGDBusMethodInfo *info;
10515 GVariantIter iter;
10516 GVariant *child;
10517 GValue *paramv;
10518 guint num_params;
10519 guint num_extra;
10520 guint n;
10521 guint signal_id;
10522 GValue return_value = G_VALUE_INIT;
10523 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
10524 g_assert (info != NULL);
10525 num_params = g_variant_n_children (parameters);
10526 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
10527 n = 0;
10528 g_value_init (&paramv[n], TYPE_PROCESS);
10529 g_value_set_object (&paramv[n++], skeleton);
10530 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
10531 g_value_set_object (&paramv[n++], invocation);
10532 if (info->pass_fdlist)
10533 {
10534#ifdef G_OS_UNIX
10535 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
10536 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
10537#else
10538 g_assert_not_reached ();
10539#endif
10540 }
10541 g_variant_iter_init (&iter, parameters);
10542 while ((child = g_variant_iter_next_value (&iter)) != NULL)
10543 {
10544 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
10545 if (arg_info->use_gvariant)
10546 {
10547 g_value_init (&paramv[n], G_TYPE_VARIANT);
10548 g_value_set_variant (&paramv[n], child);
10549 n++;
10550 }
10551 else
10552 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
10553 g_variant_unref (child);
10554 }
10555 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS);
10556 g_value_init (&return_value, G_TYPE_BOOLEAN);
10557 g_signal_emitv (paramv, signal_id, 0, &return_value);
10558 if (!g_value_get_boolean (&return_value))
10559 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);
10560 g_value_unset (&return_value);
10561 for (n = 0; n < num_params + num_extra; n++)
10562 g_value_unset (&paramv[n]);
10563 g_free (paramv);
10564}
10565
10566static GVariant *
10567_process_skeleton_handle_get_property (
10568 GDBusConnection *connection G_GNUC_UNUSED,
10569 const gchar *sender G_GNUC_UNUSED,
10570 const gchar *object_path G_GNUC_UNUSED,
10571 const gchar *interface_name G_GNUC_UNUSED,
10572 const gchar *property_name,
10573 GError **error,
10574 gpointer user_data)
10575{
10576 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
10577 GValue value = G_VALUE_INIT;
10578 GParamSpec *pspec;
10579 _ExtendedGDBusPropertyInfo *info;
10580 GVariant *ret;
10581 ret = NULL;
10582 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name);
10583 g_assert (info != NULL);
10584 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
10585 if (pspec == NULL)
10586 {
10587 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
10588 }
10589 else
10590 {
10591 g_value_init (&value, pspec->value_type);
10592 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
10593 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
10594 g_value_unset (&value);
10595 }
10596 return ret;
10597}
10598
10599static gboolean
10600_process_skeleton_handle_set_property (
10601 GDBusConnection *connection G_GNUC_UNUSED,
10602 const gchar *sender G_GNUC_UNUSED,
10603 const gchar *object_path G_GNUC_UNUSED,
10604 const gchar *interface_name G_GNUC_UNUSED,
10605 const gchar *property_name,
10606 GVariant *variant,
10607 GError **error,
10608 gpointer user_data)
10609{
10610 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
10611 GValue value = G_VALUE_INIT;
10612 GParamSpec *pspec;
10613 _ExtendedGDBusPropertyInfo *info;
10614 gboolean ret;
10615 ret = FALSE;
10616 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name);
10617 g_assert (info != NULL);
10618 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
10619 if (pspec == NULL)
10620 {
10621 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
10622 }
10623 else
10624 {
10625 if (info->use_gvariant)
10626 g_value_set_variant (&value, variant);
10627 else
10628 g_dbus_gvariant_to_gvalue (variant, &value);
10629 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
10630 g_value_unset (&value);
10631 ret = TRUE;
10632 }
10633 return ret;
10634}
10635
10636static const GDBusInterfaceVTable _process_skeleton_vtable =
10637{
10638 _process_skeleton_handle_method_call,
10639 _process_skeleton_handle_get_property,
10640 _process_skeleton_handle_set_property,
10641 {NULL}
10642};
10643
10644static GDBusInterfaceInfo *
10645process_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
10646{
10647 return process_interface_info ();
10648}
10649
10650static GDBusInterfaceVTable *
10651process_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
10652{
10653 return (GDBusInterfaceVTable *) &_process_skeleton_vtable;
10654}
10655
10656static GVariant *
10657process_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
10658{
10659 ProcessSkeleton *skeleton = PROCESS_SKELETON (_skeleton);
10660
10661 GVariantBuilder builder;
10662 guint n;
10663 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
10664 if (_process_interface_info.parent_struct.properties == NULL)
10665 goto out;
10666 for (n = 0; _process_interface_info.parent_struct.properties[n] != NULL; n++)
10667 {
10668 GDBusPropertyInfo *info = _process_interface_info.parent_struct.properties[n];
10669 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
10670 {
10671 GVariant *value;
10672 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);
10673 if (value != NULL)
10674 {
10675 g_variant_take_ref (value);
10676 g_variant_builder_add (&builder, "{sv}", info->name, value);
10677 g_variant_unref (value);
10678 }
10679 }
10680 }
10681out:
10682 return g_variant_builder_end (&builder);
10683}
10684
10685static void
10686process_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
10687{
10688}
10689
10690static void process_skeleton_iface_init (ProcessIface *iface);
10691#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10692G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
10693 G_ADD_PRIVATE (ProcessSkeleton)
10694 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init));
10695
10696#else
10697G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
10698 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init));
10699
10700#endif
10701static void
10702process_skeleton_finalize (GObject *object)
10703{
10704 ProcessSkeleton *skeleton = PROCESS_SKELETON (object);
10705 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
10706 if (skeleton->priv->changed_properties_idle_source != NULL)
10707 g_source_destroy (skeleton->priv->changed_properties_idle_source);
10708 g_main_context_unref (skeleton->priv->context);
10709 g_mutex_clear (&skeleton->priv->lock);
10710 G_OBJECT_CLASS (process_skeleton_parent_class)->finalize (object);
10711}
10712
10713static void
10714process_skeleton_init (ProcessSkeleton *skeleton)
10715{
10716#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10717 skeleton->priv = process_skeleton_get_instance_private (skeleton);
10718#else
10719 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_PROCESS_SKELETON, ProcessSkeletonPrivate);
10720#endif
10721
10722 g_mutex_init (&skeleton->priv->lock);
10723 skeleton->priv->context = g_main_context_ref_thread_default ();
10724}
10725
10726static void
10727process_skeleton_class_init (ProcessSkeletonClass *klass)
10728{
10729 GObjectClass *gobject_class;
10730 GDBusInterfaceSkeletonClass *skeleton_class;
10731
10732 gobject_class = G_OBJECT_CLASS (klass);
10733 gobject_class->finalize = process_skeleton_finalize;
10734
10735 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
10736 skeleton_class->get_info = process_skeleton_dbus_interface_get_info;
10737 skeleton_class->get_properties = process_skeleton_dbus_interface_get_properties;
10738 skeleton_class->flush = process_skeleton_dbus_interface_flush;
10739 skeleton_class->get_vtable = process_skeleton_dbus_interface_get_vtable;
10740
10741#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
10742 g_type_class_add_private (klass, sizeof (ProcessSkeletonPrivate));
10743#endif
10744}
10745
10746static void
10747process_skeleton_iface_init (ProcessIface *iface)
10748{
10749}
10750
10751/**
10752 * process_skeleton_new:
10753 *
10754 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
10755 *
10756 * Returns: (transfer full) (type ProcessSkeleton): The skeleton object.
10757 */
10758Process *
10759process_skeleton_new (void)
10760{
10761 return PROCESS (g_object_new (TYPE_PROCESS_SKELETON, NULL));
10762}
10763
10764/* ------------------------------------------------------------------------
Norman James18998182015-10-11 21:54:53 -050010765 * Code for interface org.openbmc.SharedResource
10766 * ------------------------------------------------------------------------
10767 */
10768
10769/**
10770 * SECTION:SharedResource
10771 * @title: SharedResource
10772 * @short_description: Generated C code for the org.openbmc.SharedResource D-Bus interface
10773 *
10774 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> D-Bus interface in C.
10775 */
10776
10777/* ---- Introspection data for org.openbmc.SharedResource ---- */
10778
10779static const _ExtendedGDBusArgInfo _shared_resource_method_info_lock_IN_ARG_name =
10780{
10781 {
10782 -1,
10783 (gchar *) "name",
10784 (gchar *) "s",
10785 NULL
10786 },
10787 FALSE
10788};
10789
10790static const _ExtendedGDBusArgInfo * const _shared_resource_method_info_lock_IN_ARG_pointers[] =
10791{
10792 &_shared_resource_method_info_lock_IN_ARG_name,
10793 NULL
10794};
10795
10796static const _ExtendedGDBusMethodInfo _shared_resource_method_info_lock =
10797{
10798 {
10799 -1,
10800 (gchar *) "lock",
10801 (GDBusArgInfo **) &_shared_resource_method_info_lock_IN_ARG_pointers,
10802 NULL,
10803 NULL
10804 },
10805 "handle-lock",
10806 FALSE
10807};
10808
10809static const _ExtendedGDBusMethodInfo _shared_resource_method_info_unlock =
10810{
10811 {
10812 -1,
10813 (gchar *) "unlock",
10814 NULL,
10815 NULL,
10816 NULL
10817 },
10818 "handle-unlock",
10819 FALSE
10820};
10821
10822static const _ExtendedGDBusArgInfo _shared_resource_method_info_is_locked_OUT_ARG_lock =
10823{
10824 {
10825 -1,
10826 (gchar *) "lock",
10827 (gchar *) "b",
10828 NULL
10829 },
10830 FALSE
10831};
10832
10833static const _ExtendedGDBusArgInfo _shared_resource_method_info_is_locked_OUT_ARG_name =
10834{
10835 {
10836 -1,
10837 (gchar *) "name",
10838 (gchar *) "s",
10839 NULL
10840 },
10841 FALSE
10842};
10843
10844static const _ExtendedGDBusArgInfo * const _shared_resource_method_info_is_locked_OUT_ARG_pointers[] =
10845{
10846 &_shared_resource_method_info_is_locked_OUT_ARG_lock,
10847 &_shared_resource_method_info_is_locked_OUT_ARG_name,
10848 NULL
10849};
10850
10851static const _ExtendedGDBusMethodInfo _shared_resource_method_info_is_locked =
10852{
10853 {
10854 -1,
10855 (gchar *) "isLocked",
10856 NULL,
10857 (GDBusArgInfo **) &_shared_resource_method_info_is_locked_OUT_ARG_pointers,
10858 NULL
10859 },
10860 "handle-is-locked",
10861 FALSE
10862};
10863
10864static const _ExtendedGDBusMethodInfo * const _shared_resource_method_info_pointers[] =
10865{
10866 &_shared_resource_method_info_lock,
10867 &_shared_resource_method_info_unlock,
10868 &_shared_resource_method_info_is_locked,
10869 NULL
10870};
10871
10872static const _ExtendedGDBusPropertyInfo _shared_resource_property_info_lock =
10873{
10874 {
10875 -1,
10876 (gchar *) "lock",
10877 (gchar *) "b",
10878 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
10879 NULL
10880 },
10881 "lock",
10882 FALSE
10883};
10884
10885static const _ExtendedGDBusPropertyInfo _shared_resource_property_info_name =
10886{
10887 {
10888 -1,
10889 (gchar *) "name",
10890 (gchar *) "s",
10891 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
10892 NULL
10893 },
10894 "name",
10895 FALSE
10896};
10897
10898static const _ExtendedGDBusPropertyInfo * const _shared_resource_property_info_pointers[] =
10899{
10900 &_shared_resource_property_info_lock,
10901 &_shared_resource_property_info_name,
10902 NULL
10903};
10904
10905static const _ExtendedGDBusInterfaceInfo _shared_resource_interface_info =
10906{
10907 {
10908 -1,
10909 (gchar *) "org.openbmc.SharedResource",
10910 (GDBusMethodInfo **) &_shared_resource_method_info_pointers,
10911 NULL,
10912 (GDBusPropertyInfo **) &_shared_resource_property_info_pointers,
10913 NULL
10914 },
10915 "shared-resource",
10916};
10917
10918
10919/**
10920 * shared_resource_interface_info:
10921 *
10922 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> D-Bus interface.
10923 *
10924 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
10925 */
10926GDBusInterfaceInfo *
10927shared_resource_interface_info (void)
10928{
10929 return (GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct;
10930}
10931
10932/**
10933 * shared_resource_override_properties:
10934 * @klass: The class structure for a #GObject<!-- -->-derived class.
10935 * @property_id_begin: The property id to assign to the first overridden property.
10936 *
10937 * Overrides all #GObject properties in the #SharedResource interface for a concrete class.
10938 * The properties are overridden in the order they are defined.
10939 *
10940 * Returns: The last property id.
10941 */
10942guint
10943shared_resource_override_properties (GObjectClass *klass, guint property_id_begin)
10944{
10945 g_object_class_override_property (klass, property_id_begin++, "lock");
10946 g_object_class_override_property (klass, property_id_begin++, "name");
10947 return property_id_begin - 1;
10948}
10949
10950
10951
10952/**
10953 * SharedResource:
10954 *
10955 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>.
10956 */
10957
10958/**
10959 * SharedResourceIface:
10960 * @parent_iface: The parent interface.
10961 * @handle_is_locked: Handler for the #SharedResource::handle-is-locked signal.
10962 * @handle_lock: Handler for the #SharedResource::handle-lock signal.
10963 * @handle_unlock: Handler for the #SharedResource::handle-unlock signal.
10964 * @get_lock: Getter for the #SharedResource:lock property.
10965 * @get_name: Getter for the #SharedResource:name property.
10966 *
10967 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>.
10968 */
10969
10970typedef SharedResourceIface SharedResourceInterface;
10971G_DEFINE_INTERFACE (SharedResource, shared_resource, G_TYPE_OBJECT);
10972
10973static void
10974shared_resource_default_init (SharedResourceIface *iface)
10975{
10976 /* GObject signals for incoming D-Bus method calls: */
10977 /**
10978 * SharedResource::handle-lock:
10979 * @object: A #SharedResource.
10980 * @invocation: A #GDBusMethodInvocation.
10981 * @arg_name: Argument passed by remote caller.
10982 *
10983 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method.
10984 *
10985 * 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 shared_resource_complete_lock() 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.
10986 *
10987 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
10988 */
10989 g_signal_new ("handle-lock",
10990 G_TYPE_FROM_INTERFACE (iface),
10991 G_SIGNAL_RUN_LAST,
10992 G_STRUCT_OFFSET (SharedResourceIface, handle_lock),
10993 g_signal_accumulator_true_handled,
10994 NULL,
10995 g_cclosure_marshal_generic,
10996 G_TYPE_BOOLEAN,
10997 2,
10998 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
10999
11000 /**
11001 * SharedResource::handle-unlock:
11002 * @object: A #SharedResource.
11003 * @invocation: A #GDBusMethodInvocation.
11004 *
11005 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method.
11006 *
11007 * 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 shared_resource_complete_unlock() 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.
11008 *
11009 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
11010 */
11011 g_signal_new ("handle-unlock",
11012 G_TYPE_FROM_INTERFACE (iface),
11013 G_SIGNAL_RUN_LAST,
11014 G_STRUCT_OFFSET (SharedResourceIface, handle_unlock),
11015 g_signal_accumulator_true_handled,
11016 NULL,
11017 g_cclosure_marshal_generic,
11018 G_TYPE_BOOLEAN,
11019 1,
11020 G_TYPE_DBUS_METHOD_INVOCATION);
11021
11022 /**
11023 * SharedResource::handle-is-locked:
11024 * @object: A #SharedResource.
11025 * @invocation: A #GDBusMethodInvocation.
11026 *
11027 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method.
11028 *
11029 * 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 shared_resource_complete_is_locked() 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.
11030 *
11031 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
11032 */
11033 g_signal_new ("handle-is-locked",
11034 G_TYPE_FROM_INTERFACE (iface),
11035 G_SIGNAL_RUN_LAST,
11036 G_STRUCT_OFFSET (SharedResourceIface, handle_is_locked),
11037 g_signal_accumulator_true_handled,
11038 NULL,
11039 g_cclosure_marshal_generic,
11040 G_TYPE_BOOLEAN,
11041 1,
11042 G_TYPE_DBUS_METHOD_INVOCATION);
11043
11044 /* GObject properties for D-Bus properties: */
11045 /**
11046 * SharedResource:lock:
11047 *
11048 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link>.
11049 *
11050 * 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.
11051 */
11052 g_object_interface_install_property (iface,
11053 g_param_spec_boolean ("lock", "lock", "lock", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
11054 /**
11055 * SharedResource:name:
11056 *
11057 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link>.
11058 *
11059 * 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.
11060 */
11061 g_object_interface_install_property (iface,
11062 g_param_spec_string ("name", "name", "name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
11063}
11064
11065/**
11066 * shared_resource_get_lock: (skip)
11067 * @object: A #SharedResource.
11068 *
11069 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link> D-Bus property.
11070 *
11071 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
11072 *
11073 * Returns: The property value.
11074 */
11075gboolean
11076shared_resource_get_lock (SharedResource *object)
11077{
11078 return SHARED_RESOURCE_GET_IFACE (object)->get_lock (object);
11079}
11080
11081/**
11082 * shared_resource_set_lock: (skip)
11083 * @object: A #SharedResource.
11084 * @value: The value to set.
11085 *
11086 * Sets the <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link> D-Bus property to @value.
11087 *
11088 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
11089 */
11090void
11091shared_resource_set_lock (SharedResource *object, gboolean value)
11092{
11093 g_object_set (G_OBJECT (object), "lock", value, NULL);
11094}
11095
11096/**
11097 * shared_resource_get_name: (skip)
11098 * @object: A #SharedResource.
11099 *
11100 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property.
11101 *
11102 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
11103 *
11104 * <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 shared_resource_dup_name() if on another thread.</warning>
11105 *
11106 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
11107 */
11108const gchar *
11109shared_resource_get_name (SharedResource *object)
11110{
11111 return SHARED_RESOURCE_GET_IFACE (object)->get_name (object);
11112}
11113
11114/**
11115 * shared_resource_dup_name: (skip)
11116 * @object: A #SharedResource.
11117 *
11118 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property.
11119 *
11120 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
11121 *
11122 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
11123 */
11124gchar *
11125shared_resource_dup_name (SharedResource *object)
11126{
11127 gchar *value;
11128 g_object_get (G_OBJECT (object), "name", &value, NULL);
11129 return value;
11130}
11131
11132/**
11133 * shared_resource_set_name: (skip)
11134 * @object: A #SharedResource.
11135 * @value: The value to set.
11136 *
11137 * Sets the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property to @value.
11138 *
11139 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
11140 */
11141void
11142shared_resource_set_name (SharedResource *object, const gchar *value)
11143{
11144 g_object_set (G_OBJECT (object), "name", value, NULL);
11145}
11146
11147/**
11148 * shared_resource_call_lock:
11149 * @proxy: A #SharedResourceProxy.
11150 * @arg_name: Argument to pass with the method invocation.
11151 * @cancellable: (allow-none): A #GCancellable or %NULL.
11152 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
11153 * @user_data: User data to pass to @callback.
11154 *
11155 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method on @proxy.
11156 * 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.
11157 * You can then call shared_resource_call_lock_finish() to get the result of the operation.
11158 *
11159 * See shared_resource_call_lock_sync() for the synchronous, blocking version of this method.
11160 */
11161void
11162shared_resource_call_lock (
11163 SharedResource *proxy,
11164 const gchar *arg_name,
11165 GCancellable *cancellable,
11166 GAsyncReadyCallback callback,
11167 gpointer user_data)
11168{
11169 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
11170 "lock",
11171 g_variant_new ("(s)",
11172 arg_name),
11173 G_DBUS_CALL_FLAGS_NONE,
11174 -1,
11175 cancellable,
11176 callback,
11177 user_data);
11178}
11179
11180/**
11181 * shared_resource_call_lock_finish:
11182 * @proxy: A #SharedResourceProxy.
11183 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_lock().
11184 * @error: Return location for error or %NULL.
11185 *
11186 * Finishes an operation started with shared_resource_call_lock().
11187 *
11188 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11189 */
11190gboolean
11191shared_resource_call_lock_finish (
11192 SharedResource *proxy,
11193 GAsyncResult *res,
11194 GError **error)
11195{
11196 GVariant *_ret;
11197 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
11198 if (_ret == NULL)
11199 goto _out;
11200 g_variant_get (_ret,
11201 "()");
11202 g_variant_unref (_ret);
11203_out:
11204 return _ret != NULL;
11205}
11206
11207/**
11208 * shared_resource_call_lock_sync:
11209 * @proxy: A #SharedResourceProxy.
11210 * @arg_name: Argument to pass with the method invocation.
11211 * @cancellable: (allow-none): A #GCancellable or %NULL.
11212 * @error: Return location for error or %NULL.
11213 *
11214 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
11215 *
11216 * See shared_resource_call_lock() for the asynchronous version of this method.
11217 *
11218 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11219 */
11220gboolean
11221shared_resource_call_lock_sync (
11222 SharedResource *proxy,
11223 const gchar *arg_name,
11224 GCancellable *cancellable,
11225 GError **error)
11226{
11227 GVariant *_ret;
11228 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
11229 "lock",
11230 g_variant_new ("(s)",
11231 arg_name),
11232 G_DBUS_CALL_FLAGS_NONE,
11233 -1,
11234 cancellable,
11235 error);
11236 if (_ret == NULL)
11237 goto _out;
11238 g_variant_get (_ret,
11239 "()");
11240 g_variant_unref (_ret);
11241_out:
11242 return _ret != NULL;
11243}
11244
11245/**
11246 * shared_resource_call_unlock:
11247 * @proxy: A #SharedResourceProxy.
11248 * @cancellable: (allow-none): A #GCancellable or %NULL.
11249 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
11250 * @user_data: User data to pass to @callback.
11251 *
11252 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method on @proxy.
11253 * 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.
11254 * You can then call shared_resource_call_unlock_finish() to get the result of the operation.
11255 *
11256 * See shared_resource_call_unlock_sync() for the synchronous, blocking version of this method.
11257 */
11258void
11259shared_resource_call_unlock (
11260 SharedResource *proxy,
11261 GCancellable *cancellable,
11262 GAsyncReadyCallback callback,
11263 gpointer user_data)
11264{
11265 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
11266 "unlock",
11267 g_variant_new ("()"),
11268 G_DBUS_CALL_FLAGS_NONE,
11269 -1,
11270 cancellable,
11271 callback,
11272 user_data);
11273}
11274
11275/**
11276 * shared_resource_call_unlock_finish:
11277 * @proxy: A #SharedResourceProxy.
11278 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_unlock().
11279 * @error: Return location for error or %NULL.
11280 *
11281 * Finishes an operation started with shared_resource_call_unlock().
11282 *
11283 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11284 */
11285gboolean
11286shared_resource_call_unlock_finish (
11287 SharedResource *proxy,
11288 GAsyncResult *res,
11289 GError **error)
11290{
11291 GVariant *_ret;
11292 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
11293 if (_ret == NULL)
11294 goto _out;
11295 g_variant_get (_ret,
11296 "()");
11297 g_variant_unref (_ret);
11298_out:
11299 return _ret != NULL;
11300}
11301
11302/**
11303 * shared_resource_call_unlock_sync:
11304 * @proxy: A #SharedResourceProxy.
11305 * @cancellable: (allow-none): A #GCancellable or %NULL.
11306 * @error: Return location for error or %NULL.
11307 *
11308 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
11309 *
11310 * See shared_resource_call_unlock() for the asynchronous version of this method.
11311 *
11312 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11313 */
11314gboolean
11315shared_resource_call_unlock_sync (
11316 SharedResource *proxy,
11317 GCancellable *cancellable,
11318 GError **error)
11319{
11320 GVariant *_ret;
11321 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
11322 "unlock",
11323 g_variant_new ("()"),
11324 G_DBUS_CALL_FLAGS_NONE,
11325 -1,
11326 cancellable,
11327 error);
11328 if (_ret == NULL)
11329 goto _out;
11330 g_variant_get (_ret,
11331 "()");
11332 g_variant_unref (_ret);
11333_out:
11334 return _ret != NULL;
11335}
11336
11337/**
11338 * shared_resource_call_is_locked:
11339 * @proxy: A #SharedResourceProxy.
11340 * @cancellable: (allow-none): A #GCancellable or %NULL.
11341 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
11342 * @user_data: User data to pass to @callback.
11343 *
11344 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method on @proxy.
11345 * 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.
11346 * You can then call shared_resource_call_is_locked_finish() to get the result of the operation.
11347 *
11348 * See shared_resource_call_is_locked_sync() for the synchronous, blocking version of this method.
11349 */
11350void
11351shared_resource_call_is_locked (
11352 SharedResource *proxy,
11353 GCancellable *cancellable,
11354 GAsyncReadyCallback callback,
11355 gpointer user_data)
11356{
11357 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
11358 "isLocked",
11359 g_variant_new ("()"),
11360 G_DBUS_CALL_FLAGS_NONE,
11361 -1,
11362 cancellable,
11363 callback,
11364 user_data);
11365}
11366
11367/**
11368 * shared_resource_call_is_locked_finish:
11369 * @proxy: A #SharedResourceProxy.
11370 * @out_lock: (out): Return location for return parameter or %NULL to ignore.
11371 * @out_name: (out): Return location for return parameter or %NULL to ignore.
11372 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_is_locked().
11373 * @error: Return location for error or %NULL.
11374 *
11375 * Finishes an operation started with shared_resource_call_is_locked().
11376 *
11377 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11378 */
11379gboolean
11380shared_resource_call_is_locked_finish (
11381 SharedResource *proxy,
11382 gboolean *out_lock,
11383 gchar **out_name,
11384 GAsyncResult *res,
11385 GError **error)
11386{
11387 GVariant *_ret;
11388 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
11389 if (_ret == NULL)
11390 goto _out;
11391 g_variant_get (_ret,
11392 "(bs)",
11393 out_lock,
11394 out_name);
11395 g_variant_unref (_ret);
11396_out:
11397 return _ret != NULL;
11398}
11399
11400/**
11401 * shared_resource_call_is_locked_sync:
11402 * @proxy: A #SharedResourceProxy.
11403 * @out_lock: (out): Return location for return parameter or %NULL to ignore.
11404 * @out_name: (out): Return location for return parameter or %NULL to ignore.
11405 * @cancellable: (allow-none): A #GCancellable or %NULL.
11406 * @error: Return location for error or %NULL.
11407 *
11408 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
11409 *
11410 * See shared_resource_call_is_locked() for the asynchronous version of this method.
11411 *
11412 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11413 */
11414gboolean
11415shared_resource_call_is_locked_sync (
11416 SharedResource *proxy,
11417 gboolean *out_lock,
11418 gchar **out_name,
11419 GCancellable *cancellable,
11420 GError **error)
11421{
11422 GVariant *_ret;
11423 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
11424 "isLocked",
11425 g_variant_new ("()"),
11426 G_DBUS_CALL_FLAGS_NONE,
11427 -1,
11428 cancellable,
11429 error);
11430 if (_ret == NULL)
11431 goto _out;
11432 g_variant_get (_ret,
11433 "(bs)",
11434 out_lock,
11435 out_name);
11436 g_variant_unref (_ret);
11437_out:
11438 return _ret != NULL;
11439}
11440
11441/**
11442 * shared_resource_complete_lock:
11443 * @object: A #SharedResource.
11444 * @invocation: (transfer full): A #GDBusMethodInvocation.
11445 *
11446 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</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.
11447 *
11448 * This method will free @invocation, you cannot use it afterwards.
11449 */
11450void
11451shared_resource_complete_lock (
11452 SharedResource *object,
11453 GDBusMethodInvocation *invocation)
11454{
11455 g_dbus_method_invocation_return_value (invocation,
11456 g_variant_new ("()"));
11457}
11458
11459/**
11460 * shared_resource_complete_unlock:
11461 * @object: A #SharedResource.
11462 * @invocation: (transfer full): A #GDBusMethodInvocation.
11463 *
11464 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</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.
11465 *
11466 * This method will free @invocation, you cannot use it afterwards.
11467 */
11468void
11469shared_resource_complete_unlock (
11470 SharedResource *object,
11471 GDBusMethodInvocation *invocation)
11472{
11473 g_dbus_method_invocation_return_value (invocation,
11474 g_variant_new ("()"));
11475}
11476
11477/**
11478 * shared_resource_complete_is_locked:
11479 * @object: A #SharedResource.
11480 * @invocation: (transfer full): A #GDBusMethodInvocation.
11481 * @lock: Parameter to return.
11482 * @name: Parameter to return.
11483 *
11484 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</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.
11485 *
11486 * This method will free @invocation, you cannot use it afterwards.
11487 */
11488void
11489shared_resource_complete_is_locked (
11490 SharedResource *object,
11491 GDBusMethodInvocation *invocation,
11492 gboolean lock,
11493 const gchar *name)
11494{
11495 g_dbus_method_invocation_return_value (invocation,
11496 g_variant_new ("(bs)",
11497 lock,
11498 name));
11499}
11500
11501/* ------------------------------------------------------------------------ */
11502
11503/**
11504 * SharedResourceProxy:
11505 *
11506 * The #SharedResourceProxy structure contains only private data and should only be accessed using the provided API.
11507 */
11508
11509/**
11510 * SharedResourceProxyClass:
11511 * @parent_class: The parent class.
11512 *
11513 * Class structure for #SharedResourceProxy.
11514 */
11515
11516struct _SharedResourceProxyPrivate
11517{
11518 GData *qdata;
11519};
11520
11521static void shared_resource_proxy_iface_init (SharedResourceIface *iface);
11522
11523#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11524G_DEFINE_TYPE_WITH_CODE (SharedResourceProxy, shared_resource_proxy, G_TYPE_DBUS_PROXY,
11525 G_ADD_PRIVATE (SharedResourceProxy)
11526 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_proxy_iface_init));
11527
11528#else
11529G_DEFINE_TYPE_WITH_CODE (SharedResourceProxy, shared_resource_proxy, G_TYPE_DBUS_PROXY,
11530 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_proxy_iface_init));
11531
11532#endif
11533static void
11534shared_resource_proxy_finalize (GObject *object)
11535{
11536 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object);
11537 g_datalist_clear (&proxy->priv->qdata);
11538 G_OBJECT_CLASS (shared_resource_proxy_parent_class)->finalize (object);
11539}
11540
11541static void
11542shared_resource_proxy_get_property (GObject *object,
11543 guint prop_id,
11544 GValue *value,
11545 GParamSpec *pspec G_GNUC_UNUSED)
11546{
11547 const _ExtendedGDBusPropertyInfo *info;
11548 GVariant *variant;
11549 g_assert (prop_id != 0 && prop_id - 1 < 2);
11550 info = _shared_resource_property_info_pointers[prop_id - 1];
11551 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
11552 if (info->use_gvariant)
11553 {
11554 g_value_set_variant (value, variant);
11555 }
11556 else
11557 {
11558 if (variant != NULL)
11559 g_dbus_gvariant_to_gvalue (variant, value);
11560 }
11561 if (variant != NULL)
11562 g_variant_unref (variant);
11563}
11564
11565static void
11566shared_resource_proxy_set_property_cb (GDBusProxy *proxy,
11567 GAsyncResult *res,
11568 gpointer user_data)
11569{
11570 const _ExtendedGDBusPropertyInfo *info = user_data;
11571 GError *error;
11572 GVariant *_ret;
11573 error = NULL;
11574 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
11575 if (!_ret)
11576 {
11577 g_warning ("Error setting property '%s' on interface org.openbmc.SharedResource: %s (%s, %d)",
11578 info->parent_struct.name,
11579 error->message, g_quark_to_string (error->domain), error->code);
11580 g_error_free (error);
11581 }
11582 else
11583 {
11584 g_variant_unref (_ret);
11585 }
11586}
11587
11588static void
11589shared_resource_proxy_set_property (GObject *object,
11590 guint prop_id,
11591 const GValue *value,
11592 GParamSpec *pspec G_GNUC_UNUSED)
11593{
11594 const _ExtendedGDBusPropertyInfo *info;
11595 GVariant *variant;
11596 g_assert (prop_id != 0 && prop_id - 1 < 2);
11597 info = _shared_resource_property_info_pointers[prop_id - 1];
11598 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
11599 g_dbus_proxy_call (G_DBUS_PROXY (object),
11600 "org.freedesktop.DBus.Properties.Set",
11601 g_variant_new ("(ssv)", "org.openbmc.SharedResource", info->parent_struct.name, variant),
11602 G_DBUS_CALL_FLAGS_NONE,
11603 -1,
11604 NULL, (GAsyncReadyCallback) shared_resource_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
11605 g_variant_unref (variant);
11606}
11607
11608static void
11609shared_resource_proxy_g_signal (GDBusProxy *proxy,
11610 const gchar *sender_name G_GNUC_UNUSED,
11611 const gchar *signal_name,
11612 GVariant *parameters)
11613{
11614 _ExtendedGDBusSignalInfo *info;
11615 GVariantIter iter;
11616 GVariant *child;
11617 GValue *paramv;
11618 guint num_params;
11619 guint n;
11620 guint signal_id;
11621 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, signal_name);
11622 if (info == NULL)
11623 return;
11624 num_params = g_variant_n_children (parameters);
11625 paramv = g_new0 (GValue, num_params + 1);
11626 g_value_init (&paramv[0], TYPE_SHARED_RESOURCE);
11627 g_value_set_object (&paramv[0], proxy);
11628 g_variant_iter_init (&iter, parameters);
11629 n = 1;
11630 while ((child = g_variant_iter_next_value (&iter)) != NULL)
11631 {
11632 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
11633 if (arg_info->use_gvariant)
11634 {
11635 g_value_init (&paramv[n], G_TYPE_VARIANT);
11636 g_value_set_variant (&paramv[n], child);
11637 n++;
11638 }
11639 else
11640 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
11641 g_variant_unref (child);
11642 }
11643 signal_id = g_signal_lookup (info->signal_name, TYPE_SHARED_RESOURCE);
11644 g_signal_emitv (paramv, signal_id, 0, NULL);
11645 for (n = 0; n < num_params + 1; n++)
11646 g_value_unset (&paramv[n]);
11647 g_free (paramv);
11648}
11649
11650static void
11651shared_resource_proxy_g_properties_changed (GDBusProxy *_proxy,
11652 GVariant *changed_properties,
11653 const gchar *const *invalidated_properties)
11654{
11655 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (_proxy);
11656 guint n;
11657 const gchar *key;
11658 GVariantIter *iter;
11659 _ExtendedGDBusPropertyInfo *info;
11660 g_variant_get (changed_properties, "a{sv}", &iter);
11661 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
11662 {
11663 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, key);
11664 g_datalist_remove_data (&proxy->priv->qdata, key);
11665 if (info != NULL)
11666 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
11667 }
11668 g_variant_iter_free (iter);
11669 for (n = 0; invalidated_properties[n] != NULL; n++)
11670 {
11671 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, invalidated_properties[n]);
11672 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
11673 if (info != NULL)
11674 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
11675 }
11676}
11677
11678static gboolean
11679shared_resource_proxy_get_lock (SharedResource *object)
11680{
11681 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object);
11682 GVariant *variant;
11683 gboolean value = 0;
11684 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lock");
11685 if (variant != NULL)
11686 {
11687 value = g_variant_get_boolean (variant);
11688 g_variant_unref (variant);
11689 }
11690 return value;
11691}
11692
11693static const gchar *
11694shared_resource_proxy_get_name (SharedResource *object)
11695{
11696 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object);
11697 GVariant *variant;
11698 const gchar *value = NULL;
11699 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "name");
11700 if (variant != NULL)
11701 {
11702 value = g_variant_get_string (variant, NULL);
11703 g_variant_unref (variant);
11704 }
11705 return value;
11706}
11707
11708static void
11709shared_resource_proxy_init (SharedResourceProxy *proxy)
11710{
11711#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11712 proxy->priv = shared_resource_proxy_get_instance_private (proxy);
11713#else
11714 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SHARED_RESOURCE_PROXY, SharedResourceProxyPrivate);
11715#endif
11716
11717 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), shared_resource_interface_info ());
11718}
11719
11720static void
11721shared_resource_proxy_class_init (SharedResourceProxyClass *klass)
11722{
11723 GObjectClass *gobject_class;
11724 GDBusProxyClass *proxy_class;
11725
11726 gobject_class = G_OBJECT_CLASS (klass);
11727 gobject_class->finalize = shared_resource_proxy_finalize;
11728 gobject_class->get_property = shared_resource_proxy_get_property;
11729 gobject_class->set_property = shared_resource_proxy_set_property;
11730
11731 proxy_class = G_DBUS_PROXY_CLASS (klass);
11732 proxy_class->g_signal = shared_resource_proxy_g_signal;
11733 proxy_class->g_properties_changed = shared_resource_proxy_g_properties_changed;
11734
11735 shared_resource_override_properties (gobject_class, 1);
11736
11737#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
11738 g_type_class_add_private (klass, sizeof (SharedResourceProxyPrivate));
11739#endif
11740}
11741
11742static void
11743shared_resource_proxy_iface_init (SharedResourceIface *iface)
11744{
11745 iface->get_lock = shared_resource_proxy_get_lock;
11746 iface->get_name = shared_resource_proxy_get_name;
11747}
11748
11749/**
11750 * shared_resource_proxy_new:
11751 * @connection: A #GDBusConnection.
11752 * @flags: Flags from the #GDBusProxyFlags enumeration.
11753 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
11754 * @object_path: An object path.
11755 * @cancellable: (allow-none): A #GCancellable or %NULL.
11756 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
11757 * @user_data: User data to pass to @callback.
11758 *
11759 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>. See g_dbus_proxy_new() for more details.
11760 *
11761 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
11762 * You can then call shared_resource_proxy_new_finish() to get the result of the operation.
11763 *
11764 * See shared_resource_proxy_new_sync() for the synchronous, blocking version of this constructor.
11765 */
11766void
11767shared_resource_proxy_new (
11768 GDBusConnection *connection,
11769 GDBusProxyFlags flags,
11770 const gchar *name,
11771 const gchar *object_path,
11772 GCancellable *cancellable,
11773 GAsyncReadyCallback callback,
11774 gpointer user_data)
11775{
11776 g_async_initable_new_async (TYPE_SHARED_RESOURCE_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.SharedResource", NULL);
11777}
11778
11779/**
11780 * shared_resource_proxy_new_finish:
11781 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_proxy_new().
11782 * @error: Return location for error or %NULL
11783 *
11784 * Finishes an operation started with shared_resource_proxy_new().
11785 *
11786 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
11787 */
11788SharedResource *
11789shared_resource_proxy_new_finish (
11790 GAsyncResult *res,
11791 GError **error)
11792{
11793 GObject *ret;
11794 GObject *source_object;
11795 source_object = g_async_result_get_source_object (res);
11796 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
11797 g_object_unref (source_object);
11798 if (ret != NULL)
11799 return SHARED_RESOURCE (ret);
11800 else
11801 return NULL;
11802}
11803
11804/**
11805 * shared_resource_proxy_new_sync:
11806 * @connection: A #GDBusConnection.
11807 * @flags: Flags from the #GDBusProxyFlags enumeration.
11808 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
11809 * @object_path: An object path.
11810 * @cancellable: (allow-none): A #GCancellable or %NULL.
11811 * @error: Return location for error or %NULL
11812 *
11813 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>. See g_dbus_proxy_new_sync() for more details.
11814 *
11815 * The calling thread is blocked until a reply is received.
11816 *
11817 * See shared_resource_proxy_new() for the asynchronous version of this constructor.
11818 *
11819 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
11820 */
11821SharedResource *
11822shared_resource_proxy_new_sync (
11823 GDBusConnection *connection,
11824 GDBusProxyFlags flags,
11825 const gchar *name,
11826 const gchar *object_path,
11827 GCancellable *cancellable,
11828 GError **error)
11829{
11830 GInitable *ret;
11831 ret = g_initable_new (TYPE_SHARED_RESOURCE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SharedResource", NULL);
11832 if (ret != NULL)
11833 return SHARED_RESOURCE (ret);
11834 else
11835 return NULL;
11836}
11837
11838
11839/**
11840 * shared_resource_proxy_new_for_bus:
11841 * @bus_type: A #GBusType.
11842 * @flags: Flags from the #GDBusProxyFlags enumeration.
11843 * @name: A bus name (well-known or unique).
11844 * @object_path: An object path.
11845 * @cancellable: (allow-none): A #GCancellable or %NULL.
11846 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
11847 * @user_data: User data to pass to @callback.
11848 *
11849 * Like shared_resource_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
11850 *
11851 * 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.
11852 * You can then call shared_resource_proxy_new_for_bus_finish() to get the result of the operation.
11853 *
11854 * See shared_resource_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
11855 */
11856void
11857shared_resource_proxy_new_for_bus (
11858 GBusType bus_type,
11859 GDBusProxyFlags flags,
11860 const gchar *name,
11861 const gchar *object_path,
11862 GCancellable *cancellable,
11863 GAsyncReadyCallback callback,
11864 gpointer user_data)
11865{
11866 g_async_initable_new_async (TYPE_SHARED_RESOURCE_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.SharedResource", NULL);
11867}
11868
11869/**
11870 * shared_resource_proxy_new_for_bus_finish:
11871 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_proxy_new_for_bus().
11872 * @error: Return location for error or %NULL
11873 *
11874 * Finishes an operation started with shared_resource_proxy_new_for_bus().
11875 *
11876 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
11877 */
11878SharedResource *
11879shared_resource_proxy_new_for_bus_finish (
11880 GAsyncResult *res,
11881 GError **error)
11882{
11883 GObject *ret;
11884 GObject *source_object;
11885 source_object = g_async_result_get_source_object (res);
11886 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
11887 g_object_unref (source_object);
11888 if (ret != NULL)
11889 return SHARED_RESOURCE (ret);
11890 else
11891 return NULL;
11892}
11893
11894/**
11895 * shared_resource_proxy_new_for_bus_sync:
11896 * @bus_type: A #GBusType.
11897 * @flags: Flags from the #GDBusProxyFlags enumeration.
11898 * @name: A bus name (well-known or unique).
11899 * @object_path: An object path.
11900 * @cancellable: (allow-none): A #GCancellable or %NULL.
11901 * @error: Return location for error or %NULL
11902 *
11903 * Like shared_resource_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
11904 *
11905 * The calling thread is blocked until a reply is received.
11906 *
11907 * See shared_resource_proxy_new_for_bus() for the asynchronous version of this constructor.
11908 *
11909 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
11910 */
11911SharedResource *
11912shared_resource_proxy_new_for_bus_sync (
11913 GBusType bus_type,
11914 GDBusProxyFlags flags,
11915 const gchar *name,
11916 const gchar *object_path,
11917 GCancellable *cancellable,
11918 GError **error)
11919{
11920 GInitable *ret;
11921 ret = g_initable_new (TYPE_SHARED_RESOURCE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SharedResource", NULL);
11922 if (ret != NULL)
11923 return SHARED_RESOURCE (ret);
11924 else
11925 return NULL;
11926}
11927
11928
11929/* ------------------------------------------------------------------------ */
11930
11931/**
11932 * SharedResourceSkeleton:
11933 *
11934 * The #SharedResourceSkeleton structure contains only private data and should only be accessed using the provided API.
11935 */
11936
11937/**
11938 * SharedResourceSkeletonClass:
11939 * @parent_class: The parent class.
11940 *
11941 * Class structure for #SharedResourceSkeleton.
11942 */
11943
11944struct _SharedResourceSkeletonPrivate
11945{
11946 GValue *properties;
11947 GList *changed_properties;
11948 GSource *changed_properties_idle_source;
11949 GMainContext *context;
11950 GMutex lock;
11951};
11952
11953static void
11954_shared_resource_skeleton_handle_method_call (
11955 GDBusConnection *connection G_GNUC_UNUSED,
11956 const gchar *sender G_GNUC_UNUSED,
11957 const gchar *object_path G_GNUC_UNUSED,
11958 const gchar *interface_name,
11959 const gchar *method_name,
11960 GVariant *parameters,
11961 GDBusMethodInvocation *invocation,
11962 gpointer user_data)
11963{
11964 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
11965 _ExtendedGDBusMethodInfo *info;
11966 GVariantIter iter;
11967 GVariant *child;
11968 GValue *paramv;
11969 guint num_params;
11970 guint num_extra;
11971 guint n;
11972 guint signal_id;
11973 GValue return_value = G_VALUE_INIT;
11974 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
11975 g_assert (info != NULL);
11976 num_params = g_variant_n_children (parameters);
11977 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
11978 n = 0;
11979 g_value_init (&paramv[n], TYPE_SHARED_RESOURCE);
11980 g_value_set_object (&paramv[n++], skeleton);
11981 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
11982 g_value_set_object (&paramv[n++], invocation);
11983 if (info->pass_fdlist)
11984 {
11985#ifdef G_OS_UNIX
11986 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
11987 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
11988#else
11989 g_assert_not_reached ();
11990#endif
11991 }
11992 g_variant_iter_init (&iter, parameters);
11993 while ((child = g_variant_iter_next_value (&iter)) != NULL)
11994 {
11995 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
11996 if (arg_info->use_gvariant)
11997 {
11998 g_value_init (&paramv[n], G_TYPE_VARIANT);
11999 g_value_set_variant (&paramv[n], child);
12000 n++;
12001 }
12002 else
12003 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
12004 g_variant_unref (child);
12005 }
12006 signal_id = g_signal_lookup (info->signal_name, TYPE_SHARED_RESOURCE);
12007 g_value_init (&return_value, G_TYPE_BOOLEAN);
12008 g_signal_emitv (paramv, signal_id, 0, &return_value);
12009 if (!g_value_get_boolean (&return_value))
12010 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);
12011 g_value_unset (&return_value);
12012 for (n = 0; n < num_params + num_extra; n++)
12013 g_value_unset (&paramv[n]);
12014 g_free (paramv);
12015}
12016
12017static GVariant *
12018_shared_resource_skeleton_handle_get_property (
12019 GDBusConnection *connection G_GNUC_UNUSED,
12020 const gchar *sender G_GNUC_UNUSED,
12021 const gchar *object_path G_GNUC_UNUSED,
12022 const gchar *interface_name G_GNUC_UNUSED,
12023 const gchar *property_name,
12024 GError **error,
12025 gpointer user_data)
12026{
12027 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
12028 GValue value = G_VALUE_INIT;
12029 GParamSpec *pspec;
12030 _ExtendedGDBusPropertyInfo *info;
12031 GVariant *ret;
12032 ret = NULL;
12033 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, property_name);
12034 g_assert (info != NULL);
12035 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
12036 if (pspec == NULL)
12037 {
12038 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
12039 }
12040 else
12041 {
12042 g_value_init (&value, pspec->value_type);
12043 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
12044 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
12045 g_value_unset (&value);
12046 }
12047 return ret;
12048}
12049
12050static gboolean
12051_shared_resource_skeleton_handle_set_property (
12052 GDBusConnection *connection G_GNUC_UNUSED,
12053 const gchar *sender G_GNUC_UNUSED,
12054 const gchar *object_path G_GNUC_UNUSED,
12055 const gchar *interface_name G_GNUC_UNUSED,
12056 const gchar *property_name,
12057 GVariant *variant,
12058 GError **error,
12059 gpointer user_data)
12060{
12061 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
12062 GValue value = G_VALUE_INIT;
12063 GParamSpec *pspec;
12064 _ExtendedGDBusPropertyInfo *info;
12065 gboolean ret;
12066 ret = FALSE;
12067 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, property_name);
12068 g_assert (info != NULL);
12069 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
12070 if (pspec == NULL)
12071 {
12072 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
12073 }
12074 else
12075 {
12076 if (info->use_gvariant)
12077 g_value_set_variant (&value, variant);
12078 else
12079 g_dbus_gvariant_to_gvalue (variant, &value);
12080 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
12081 g_value_unset (&value);
12082 ret = TRUE;
12083 }
12084 return ret;
12085}
12086
12087static const GDBusInterfaceVTable _shared_resource_skeleton_vtable =
12088{
12089 _shared_resource_skeleton_handle_method_call,
12090 _shared_resource_skeleton_handle_get_property,
12091 _shared_resource_skeleton_handle_set_property,
12092 {NULL}
12093};
12094
12095static GDBusInterfaceInfo *
12096shared_resource_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
12097{
12098 return shared_resource_interface_info ();
12099}
12100
12101static GDBusInterfaceVTable *
12102shared_resource_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
12103{
12104 return (GDBusInterfaceVTable *) &_shared_resource_skeleton_vtable;
12105}
12106
12107static GVariant *
12108shared_resource_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
12109{
12110 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (_skeleton);
12111
12112 GVariantBuilder builder;
12113 guint n;
12114 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
12115 if (_shared_resource_interface_info.parent_struct.properties == NULL)
12116 goto out;
12117 for (n = 0; _shared_resource_interface_info.parent_struct.properties[n] != NULL; n++)
12118 {
12119 GDBusPropertyInfo *info = _shared_resource_interface_info.parent_struct.properties[n];
12120 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
12121 {
12122 GVariant *value;
12123 value = _shared_resource_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.SharedResource", info->name, NULL, skeleton);
12124 if (value != NULL)
12125 {
12126 g_variant_take_ref (value);
12127 g_variant_builder_add (&builder, "{sv}", info->name, value);
12128 g_variant_unref (value);
12129 }
12130 }
12131 }
12132out:
12133 return g_variant_builder_end (&builder);
12134}
12135
12136static gboolean _shared_resource_emit_changed (gpointer user_data);
12137
12138static void
12139shared_resource_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
12140{
12141 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (_skeleton);
12142 gboolean emit_changed = FALSE;
12143
12144 g_mutex_lock (&skeleton->priv->lock);
12145 if (skeleton->priv->changed_properties_idle_source != NULL)
12146 {
12147 g_source_destroy (skeleton->priv->changed_properties_idle_source);
12148 skeleton->priv->changed_properties_idle_source = NULL;
12149 emit_changed = TRUE;
12150 }
12151 g_mutex_unlock (&skeleton->priv->lock);
12152
12153 if (emit_changed)
12154 _shared_resource_emit_changed (skeleton);
12155}
12156
12157static void shared_resource_skeleton_iface_init (SharedResourceIface *iface);
12158#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12159G_DEFINE_TYPE_WITH_CODE (SharedResourceSkeleton, shared_resource_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
12160 G_ADD_PRIVATE (SharedResourceSkeleton)
12161 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_skeleton_iface_init));
12162
12163#else
12164G_DEFINE_TYPE_WITH_CODE (SharedResourceSkeleton, shared_resource_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
12165 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_skeleton_iface_init));
12166
12167#endif
12168static void
12169shared_resource_skeleton_finalize (GObject *object)
12170{
12171 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12172 guint n;
12173 for (n = 0; n < 2; n++)
12174 g_value_unset (&skeleton->priv->properties[n]);
12175 g_free (skeleton->priv->properties);
12176 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
12177 if (skeleton->priv->changed_properties_idle_source != NULL)
12178 g_source_destroy (skeleton->priv->changed_properties_idle_source);
12179 g_main_context_unref (skeleton->priv->context);
12180 g_mutex_clear (&skeleton->priv->lock);
12181 G_OBJECT_CLASS (shared_resource_skeleton_parent_class)->finalize (object);
12182}
12183
12184static void
12185shared_resource_skeleton_get_property (GObject *object,
12186 guint prop_id,
12187 GValue *value,
12188 GParamSpec *pspec G_GNUC_UNUSED)
12189{
12190 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12191 g_assert (prop_id != 0 && prop_id - 1 < 2);
12192 g_mutex_lock (&skeleton->priv->lock);
12193 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
12194 g_mutex_unlock (&skeleton->priv->lock);
12195}
12196
12197static gboolean
12198_shared_resource_emit_changed (gpointer user_data)
12199{
12200 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
12201 GList *l;
12202 GVariantBuilder builder;
12203 GVariantBuilder invalidated_builder;
12204 guint num_changes;
12205
12206 g_mutex_lock (&skeleton->priv->lock);
12207 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
12208 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
12209 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
12210 {
12211 ChangedProperty *cp = l->data;
12212 GVariant *variant;
12213 const GValue *cur_value;
12214
12215 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
12216 if (!_g_value_equal (cur_value, &cp->orig_value))
12217 {
12218 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
12219 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
12220 g_variant_unref (variant);
12221 num_changes++;
12222 }
12223 }
12224 if (num_changes > 0)
12225 {
12226 GList *connections, *ll;
12227 GVariant *signal_variant;
12228 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SharedResource",
12229 &builder, &invalidated_builder));
12230 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
12231 for (ll = connections; ll != NULL; ll = ll->next)
12232 {
12233 GDBusConnection *connection = ll->data;
12234
12235 g_dbus_connection_emit_signal (connection,
12236 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
12237 "org.freedesktop.DBus.Properties",
12238 "PropertiesChanged",
12239 signal_variant,
12240 NULL);
12241 }
12242 g_variant_unref (signal_variant);
12243 g_list_free_full (connections, g_object_unref);
12244 }
12245 else
12246 {
12247 g_variant_builder_clear (&builder);
12248 g_variant_builder_clear (&invalidated_builder);
12249 }
12250 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
12251 skeleton->priv->changed_properties = NULL;
12252 skeleton->priv->changed_properties_idle_source = NULL;
12253 g_mutex_unlock (&skeleton->priv->lock);
12254 return FALSE;
12255}
12256
12257static void
12258_shared_resource_schedule_emit_changed (SharedResourceSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
12259{
12260 ChangedProperty *cp;
12261 GList *l;
12262 cp = NULL;
12263 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
12264 {
12265 ChangedProperty *i_cp = l->data;
12266 if (i_cp->info == info)
12267 {
12268 cp = i_cp;
12269 break;
12270 }
12271 }
12272 if (cp == NULL)
12273 {
12274 cp = g_new0 (ChangedProperty, 1);
12275 cp->prop_id = prop_id;
12276 cp->info = info;
12277 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
12278 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
12279 g_value_copy (orig_value, &cp->orig_value);
12280 }
12281}
12282
12283static void
12284shared_resource_skeleton_notify (GObject *object,
12285 GParamSpec *pspec G_GNUC_UNUSED)
12286{
12287 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12288 g_mutex_lock (&skeleton->priv->lock);
12289 if (skeleton->priv->changed_properties != NULL &&
12290 skeleton->priv->changed_properties_idle_source == NULL)
12291 {
12292 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
12293 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
12294 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _shared_resource_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylak2cb27752015-10-19 16:23:14 -050012295 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _shared_resource_emit_changed");
Norman James18998182015-10-11 21:54:53 -050012296 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
12297 g_source_unref (skeleton->priv->changed_properties_idle_source);
12298 }
12299 g_mutex_unlock (&skeleton->priv->lock);
12300}
12301
12302static void
12303shared_resource_skeleton_set_property (GObject *object,
12304 guint prop_id,
12305 const GValue *value,
12306 GParamSpec *pspec)
12307{
12308 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12309 g_assert (prop_id != 0 && prop_id - 1 < 2);
12310 g_mutex_lock (&skeleton->priv->lock);
12311 g_object_freeze_notify (object);
12312 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
12313 {
12314 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
12315 _shared_resource_schedule_emit_changed (skeleton, _shared_resource_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
12316 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
12317 g_object_notify_by_pspec (object, pspec);
12318 }
12319 g_mutex_unlock (&skeleton->priv->lock);
12320 g_object_thaw_notify (object);
12321}
12322
12323static void
12324shared_resource_skeleton_init (SharedResourceSkeleton *skeleton)
12325{
12326#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12327 skeleton->priv = shared_resource_skeleton_get_instance_private (skeleton);
12328#else
12329 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SHARED_RESOURCE_SKELETON, SharedResourceSkeletonPrivate);
12330#endif
12331
12332 g_mutex_init (&skeleton->priv->lock);
12333 skeleton->priv->context = g_main_context_ref_thread_default ();
12334 skeleton->priv->properties = g_new0 (GValue, 2);
12335 g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN);
12336 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
12337}
12338
12339static gboolean
12340shared_resource_skeleton_get_lock (SharedResource *object)
12341{
12342 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12343 gboolean value;
12344 g_mutex_lock (&skeleton->priv->lock);
12345 value = g_value_get_boolean (&(skeleton->priv->properties[0]));
12346 g_mutex_unlock (&skeleton->priv->lock);
12347 return value;
12348}
12349
12350static const gchar *
12351shared_resource_skeleton_get_name (SharedResource *object)
12352{
12353 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12354 const gchar *value;
12355 g_mutex_lock (&skeleton->priv->lock);
12356 value = g_value_get_string (&(skeleton->priv->properties[1]));
12357 g_mutex_unlock (&skeleton->priv->lock);
12358 return value;
12359}
12360
12361static void
12362shared_resource_skeleton_class_init (SharedResourceSkeletonClass *klass)
12363{
12364 GObjectClass *gobject_class;
12365 GDBusInterfaceSkeletonClass *skeleton_class;
12366
12367 gobject_class = G_OBJECT_CLASS (klass);
12368 gobject_class->finalize = shared_resource_skeleton_finalize;
12369 gobject_class->get_property = shared_resource_skeleton_get_property;
12370 gobject_class->set_property = shared_resource_skeleton_set_property;
12371 gobject_class->notify = shared_resource_skeleton_notify;
12372
12373
12374 shared_resource_override_properties (gobject_class, 1);
12375
12376 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
12377 skeleton_class->get_info = shared_resource_skeleton_dbus_interface_get_info;
12378 skeleton_class->get_properties = shared_resource_skeleton_dbus_interface_get_properties;
12379 skeleton_class->flush = shared_resource_skeleton_dbus_interface_flush;
12380 skeleton_class->get_vtable = shared_resource_skeleton_dbus_interface_get_vtable;
12381
12382#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
12383 g_type_class_add_private (klass, sizeof (SharedResourceSkeletonPrivate));
12384#endif
12385}
12386
12387static void
12388shared_resource_skeleton_iface_init (SharedResourceIface *iface)
12389{
12390 iface->get_lock = shared_resource_skeleton_get_lock;
12391 iface->get_name = shared_resource_skeleton_get_name;
12392}
12393
12394/**
12395 * shared_resource_skeleton_new:
12396 *
12397 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>.
12398 *
12399 * Returns: (transfer full) (type SharedResourceSkeleton): The skeleton object.
12400 */
12401SharedResource *
12402shared_resource_skeleton_new (void)
12403{
12404 return SHARED_RESOURCE (g_object_new (TYPE_SHARED_RESOURCE_SKELETON, NULL));
12405}
12406
12407/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050012408 * Code for interface org.openbmc.Control
12409 * ------------------------------------------------------------------------
12410 */
12411
12412/**
12413 * SECTION:Control
12414 * @title: Control
12415 * @short_description: Generated C code for the org.openbmc.Control D-Bus interface
12416 *
12417 * 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.
12418 */
12419
12420/* ---- Introspection data for org.openbmc.Control ---- */
12421
12422static const _ExtendedGDBusMethodInfo _control_method_info_init =
12423{
12424 {
12425 -1,
12426 (gchar *) "init",
12427 NULL,
12428 NULL,
12429 NULL
12430 },
12431 "handle-init",
12432 FALSE
12433};
12434
12435static const _ExtendedGDBusMethodInfo * const _control_method_info_pointers[] =
12436{
12437 &_control_method_info_init,
12438 NULL
12439};
12440
12441static const _ExtendedGDBusArgInfo _control_signal_info_heartbeat_ARG_bus_name =
12442{
12443 {
12444 -1,
12445 (gchar *) "bus_name",
12446 (gchar *) "s",
12447 NULL
12448 },
12449 FALSE
12450};
12451
12452static const _ExtendedGDBusArgInfo * const _control_signal_info_heartbeat_ARG_pointers[] =
12453{
12454 &_control_signal_info_heartbeat_ARG_bus_name,
12455 NULL
12456};
12457
12458static const _ExtendedGDBusSignalInfo _control_signal_info_heartbeat =
12459{
12460 {
12461 -1,
12462 (gchar *) "Heartbeat",
12463 (GDBusArgInfo **) &_control_signal_info_heartbeat_ARG_pointers,
12464 NULL
12465 },
12466 "heartbeat"
12467};
12468
12469static const _ExtendedGDBusArgInfo _control_signal_info_goto_system_state_ARG_state_name =
12470{
12471 {
12472 -1,
12473 (gchar *) "state_name",
12474 (gchar *) "s",
12475 NULL
12476 },
12477 FALSE
12478};
12479
12480static const _ExtendedGDBusArgInfo * const _control_signal_info_goto_system_state_ARG_pointers[] =
12481{
12482 &_control_signal_info_goto_system_state_ARG_state_name,
12483 NULL
12484};
12485
12486static const _ExtendedGDBusSignalInfo _control_signal_info_goto_system_state =
12487{
12488 {
12489 -1,
12490 (gchar *) "GotoSystemState",
12491 (GDBusArgInfo **) &_control_signal_info_goto_system_state_ARG_pointers,
12492 NULL
12493 },
12494 "goto-system-state"
12495};
12496
Norman Jamesa3e47c42015-10-18 14:43:10 -050012497static const _ExtendedGDBusSignalInfo _control_signal_info_started =
12498{
12499 {
12500 -1,
12501 (gchar *) "Started",
12502 NULL,
12503 NULL
12504 },
12505 "started"
12506};
12507
Norman James362a80f2015-09-14 14:04:39 -050012508static const _ExtendedGDBusSignalInfo * const _control_signal_info_pointers[] =
12509{
12510 &_control_signal_info_heartbeat,
12511 &_control_signal_info_goto_system_state,
Norman Jamesa3e47c42015-10-18 14:43:10 -050012512 &_control_signal_info_started,
Norman James362a80f2015-09-14 14:04:39 -050012513 NULL
12514};
12515
12516static const _ExtendedGDBusPropertyInfo _control_property_info_poll_interval =
12517{
12518 {
12519 -1,
12520 (gchar *) "poll_interval",
12521 (gchar *) "i",
12522 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
12523 NULL
12524 },
12525 "poll-interval",
12526 FALSE
12527};
12528
12529static const _ExtendedGDBusPropertyInfo _control_property_info_heatbeat =
12530{
12531 {
12532 -1,
12533 (gchar *) "heatbeat",
12534 (gchar *) "i",
12535 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
12536 NULL
12537 },
12538 "heatbeat",
12539 FALSE
12540};
12541
12542static const _ExtendedGDBusPropertyInfo * const _control_property_info_pointers[] =
12543{
12544 &_control_property_info_poll_interval,
12545 &_control_property_info_heatbeat,
12546 NULL
12547};
12548
12549static const _ExtendedGDBusInterfaceInfo _control_interface_info =
12550{
12551 {
12552 -1,
12553 (gchar *) "org.openbmc.Control",
12554 (GDBusMethodInfo **) &_control_method_info_pointers,
12555 (GDBusSignalInfo **) &_control_signal_info_pointers,
12556 (GDBusPropertyInfo **) &_control_property_info_pointers,
12557 NULL
12558 },
12559 "control",
12560};
12561
12562
12563/**
12564 * control_interface_info:
12565 *
12566 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> D-Bus interface.
12567 *
12568 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
12569 */
12570GDBusInterfaceInfo *
12571control_interface_info (void)
12572{
12573 return (GDBusInterfaceInfo *) &_control_interface_info.parent_struct;
12574}
12575
12576/**
12577 * control_override_properties:
12578 * @klass: The class structure for a #GObject<!-- -->-derived class.
12579 * @property_id_begin: The property id to assign to the first overridden property.
12580 *
12581 * Overrides all #GObject properties in the #Control interface for a concrete class.
12582 * The properties are overridden in the order they are defined.
12583 *
12584 * Returns: The last property id.
12585 */
12586guint
12587control_override_properties (GObjectClass *klass, guint property_id_begin)
12588{
12589 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
12590 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
12591 return property_id_begin - 1;
12592}
12593
12594
12595
12596/**
12597 * Control:
12598 *
12599 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
12600 */
12601
12602/**
12603 * ControlIface:
12604 * @parent_iface: The parent interface.
12605 * @handle_init: Handler for the #Control::handle-init signal.
12606 * @get_heatbeat: Getter for the #Control:heatbeat property.
12607 * @get_poll_interval: Getter for the #Control:poll-interval property.
12608 * @goto_system_state: Handler for the #Control::goto-system-state signal.
12609 * @heartbeat: Handler for the #Control::heartbeat signal.
Norman Jamesa3e47c42015-10-18 14:43:10 -050012610 * @started: Handler for the #Control::started signal.
Norman James362a80f2015-09-14 14:04:39 -050012611 *
12612 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
12613 */
12614
12615typedef ControlIface ControlInterface;
12616G_DEFINE_INTERFACE (Control, control, G_TYPE_OBJECT);
12617
12618static void
12619control_default_init (ControlIface *iface)
12620{
12621 /* GObject signals for incoming D-Bus method calls: */
12622 /**
12623 * Control::handle-init:
12624 * @object: A #Control.
12625 * @invocation: A #GDBusMethodInvocation.
12626 *
12627 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method.
12628 *
12629 * 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.
12630 *
12631 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
12632 */
12633 g_signal_new ("handle-init",
12634 G_TYPE_FROM_INTERFACE (iface),
12635 G_SIGNAL_RUN_LAST,
12636 G_STRUCT_OFFSET (ControlIface, handle_init),
12637 g_signal_accumulator_true_handled,
12638 NULL,
12639 g_cclosure_marshal_generic,
12640 G_TYPE_BOOLEAN,
12641 1,
12642 G_TYPE_DBUS_METHOD_INVOCATION);
12643
12644 /* GObject signals for received D-Bus signals: */
12645 /**
12646 * Control::heartbeat:
12647 * @object: A #Control.
12648 * @arg_bus_name: Argument.
12649 *
12650 * 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.
12651 *
12652 * 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.
12653 */
12654 g_signal_new ("heartbeat",
12655 G_TYPE_FROM_INTERFACE (iface),
12656 G_SIGNAL_RUN_LAST,
12657 G_STRUCT_OFFSET (ControlIface, heartbeat),
12658 NULL,
12659 NULL,
12660 g_cclosure_marshal_generic,
12661 G_TYPE_NONE,
12662 1, G_TYPE_STRING);
12663
12664 /**
12665 * Control::goto-system-state:
12666 * @object: A #Control.
12667 * @arg_state_name: Argument.
12668 *
12669 * 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.
12670 *
12671 * 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.
12672 */
12673 g_signal_new ("goto-system-state",
12674 G_TYPE_FROM_INTERFACE (iface),
12675 G_SIGNAL_RUN_LAST,
12676 G_STRUCT_OFFSET (ControlIface, goto_system_state),
12677 NULL,
12678 NULL,
12679 g_cclosure_marshal_generic,
12680 G_TYPE_NONE,
12681 1, G_TYPE_STRING);
12682
Norman Jamesa3e47c42015-10-18 14:43:10 -050012683 /**
12684 * Control::started:
12685 * @object: A #Control.
12686 *
12687 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Control.Started">"Started"</link> is received.
12688 *
12689 * 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.
12690 */
12691 g_signal_new ("started",
12692 G_TYPE_FROM_INTERFACE (iface),
12693 G_SIGNAL_RUN_LAST,
12694 G_STRUCT_OFFSET (ControlIface, started),
12695 NULL,
12696 NULL,
12697 g_cclosure_marshal_generic,
12698 G_TYPE_NONE,
12699 0);
12700
Norman James362a80f2015-09-14 14:04:39 -050012701 /* GObject properties for D-Bus properties: */
12702 /**
12703 * Control:poll-interval:
12704 *
12705 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link>.
12706 *
12707 * 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.
12708 */
12709 g_object_interface_install_property (iface,
12710 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
12711 /**
12712 * Control:heatbeat:
12713 *
12714 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link>.
12715 *
12716 * 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.
12717 */
12718 g_object_interface_install_property (iface,
12719 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
12720}
12721
12722/**
12723 * control_get_poll_interval: (skip)
12724 * @object: A #Control.
12725 *
12726 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property.
12727 *
12728 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
12729 *
12730 * Returns: The property value.
12731 */
12732gint
12733control_get_poll_interval (Control *object)
12734{
12735 return CONTROL_GET_IFACE (object)->get_poll_interval (object);
12736}
12737
12738/**
12739 * control_set_poll_interval: (skip)
12740 * @object: A #Control.
12741 * @value: The value to set.
12742 *
12743 * Sets the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property to @value.
12744 *
12745 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
12746 */
12747void
12748control_set_poll_interval (Control *object, gint value)
12749{
12750 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
12751}
12752
12753/**
12754 * control_get_heatbeat: (skip)
12755 * @object: A #Control.
12756 *
12757 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property.
12758 *
12759 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
12760 *
12761 * Returns: The property value.
12762 */
12763gint
12764control_get_heatbeat (Control *object)
12765{
12766 return CONTROL_GET_IFACE (object)->get_heatbeat (object);
12767}
12768
12769/**
12770 * control_set_heatbeat: (skip)
12771 * @object: A #Control.
12772 * @value: The value to set.
12773 *
12774 * Sets the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property to @value.
12775 *
12776 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
12777 */
12778void
12779control_set_heatbeat (Control *object, gint value)
12780{
12781 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
12782}
12783
12784/**
12785 * control_emit_heartbeat:
12786 * @object: A #Control.
12787 * @arg_bus_name: Argument to pass with the signal.
12788 *
12789 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Heartbeat">"Heartbeat"</link> D-Bus signal.
12790 */
12791void
12792control_emit_heartbeat (
12793 Control *object,
12794 const gchar *arg_bus_name)
12795{
12796 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
12797}
12798
12799/**
12800 * control_emit_goto_system_state:
12801 * @object: A #Control.
12802 * @arg_state_name: Argument to pass with the signal.
12803 *
12804 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.GotoSystemState">"GotoSystemState"</link> D-Bus signal.
12805 */
12806void
12807control_emit_goto_system_state (
12808 Control *object,
12809 const gchar *arg_state_name)
12810{
12811 g_signal_emit_by_name (object, "goto-system-state", arg_state_name);
12812}
12813
12814/**
Norman Jamesa3e47c42015-10-18 14:43:10 -050012815 * control_emit_started:
12816 * @object: A #Control.
12817 *
12818 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Started">"Started"</link> D-Bus signal.
12819 */
12820void
12821control_emit_started (
12822 Control *object)
12823{
12824 g_signal_emit_by_name (object, "started");
12825}
12826
12827/**
Norman James362a80f2015-09-14 14:04:39 -050012828 * control_call_init:
12829 * @proxy: A #ControlProxy.
12830 * @cancellable: (allow-none): A #GCancellable or %NULL.
12831 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
12832 * @user_data: User data to pass to @callback.
12833 *
12834 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method on @proxy.
12835 * 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.
12836 * You can then call control_call_init_finish() to get the result of the operation.
12837 *
12838 * See control_call_init_sync() for the synchronous, blocking version of this method.
12839 */
12840void
12841control_call_init (
12842 Control *proxy,
12843 GCancellable *cancellable,
12844 GAsyncReadyCallback callback,
12845 gpointer user_data)
12846{
12847 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
12848 "init",
12849 g_variant_new ("()"),
12850 G_DBUS_CALL_FLAGS_NONE,
12851 -1,
12852 cancellable,
12853 callback,
12854 user_data);
12855}
12856
12857/**
12858 * control_call_init_finish:
12859 * @proxy: A #ControlProxy.
12860 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_call_init().
12861 * @error: Return location for error or %NULL.
12862 *
12863 * Finishes an operation started with control_call_init().
12864 *
12865 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
12866 */
12867gboolean
12868control_call_init_finish (
12869 Control *proxy,
12870 GAsyncResult *res,
12871 GError **error)
12872{
12873 GVariant *_ret;
12874 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
12875 if (_ret == NULL)
12876 goto _out;
12877 g_variant_get (_ret,
12878 "()");
12879 g_variant_unref (_ret);
12880_out:
12881 return _ret != NULL;
12882}
12883
12884/**
12885 * control_call_init_sync:
12886 * @proxy: A #ControlProxy.
12887 * @cancellable: (allow-none): A #GCancellable or %NULL.
12888 * @error: Return location for error or %NULL.
12889 *
12890 * 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.
12891 *
12892 * See control_call_init() for the asynchronous version of this method.
12893 *
12894 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
12895 */
12896gboolean
12897control_call_init_sync (
12898 Control *proxy,
12899 GCancellable *cancellable,
12900 GError **error)
12901{
12902 GVariant *_ret;
12903 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
12904 "init",
12905 g_variant_new ("()"),
12906 G_DBUS_CALL_FLAGS_NONE,
12907 -1,
12908 cancellable,
12909 error);
12910 if (_ret == NULL)
12911 goto _out;
12912 g_variant_get (_ret,
12913 "()");
12914 g_variant_unref (_ret);
12915_out:
12916 return _ret != NULL;
12917}
12918
12919/**
12920 * control_complete_init:
12921 * @object: A #Control.
12922 * @invocation: (transfer full): A #GDBusMethodInvocation.
12923 *
12924 * 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.
12925 *
12926 * This method will free @invocation, you cannot use it afterwards.
12927 */
12928void
12929control_complete_init (
12930 Control *object,
12931 GDBusMethodInvocation *invocation)
12932{
12933 g_dbus_method_invocation_return_value (invocation,
12934 g_variant_new ("()"));
12935}
12936
12937/* ------------------------------------------------------------------------ */
12938
12939/**
12940 * ControlProxy:
12941 *
12942 * The #ControlProxy structure contains only private data and should only be accessed using the provided API.
12943 */
12944
12945/**
12946 * ControlProxyClass:
12947 * @parent_class: The parent class.
12948 *
12949 * Class structure for #ControlProxy.
12950 */
12951
12952struct _ControlProxyPrivate
12953{
12954 GData *qdata;
12955};
12956
12957static void control_proxy_iface_init (ControlIface *iface);
12958
12959#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12960G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
12961 G_ADD_PRIVATE (ControlProxy)
12962 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init));
12963
12964#else
12965G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
12966 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init));
12967
12968#endif
12969static void
12970control_proxy_finalize (GObject *object)
12971{
12972 ControlProxy *proxy = CONTROL_PROXY (object);
12973 g_datalist_clear (&proxy->priv->qdata);
12974 G_OBJECT_CLASS (control_proxy_parent_class)->finalize (object);
12975}
12976
12977static void
12978control_proxy_get_property (GObject *object,
12979 guint prop_id,
12980 GValue *value,
12981 GParamSpec *pspec G_GNUC_UNUSED)
12982{
12983 const _ExtendedGDBusPropertyInfo *info;
12984 GVariant *variant;
12985 g_assert (prop_id != 0 && prop_id - 1 < 2);
12986 info = _control_property_info_pointers[prop_id - 1];
12987 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
12988 if (info->use_gvariant)
12989 {
12990 g_value_set_variant (value, variant);
12991 }
12992 else
12993 {
12994 if (variant != NULL)
12995 g_dbus_gvariant_to_gvalue (variant, value);
12996 }
12997 if (variant != NULL)
12998 g_variant_unref (variant);
12999}
13000
13001static void
13002control_proxy_set_property_cb (GDBusProxy *proxy,
13003 GAsyncResult *res,
13004 gpointer user_data)
13005{
13006 const _ExtendedGDBusPropertyInfo *info = user_data;
13007 GError *error;
13008 GVariant *_ret;
13009 error = NULL;
13010 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
13011 if (!_ret)
13012 {
13013 g_warning ("Error setting property '%s' on interface org.openbmc.Control: %s (%s, %d)",
13014 info->parent_struct.name,
13015 error->message, g_quark_to_string (error->domain), error->code);
13016 g_error_free (error);
13017 }
13018 else
13019 {
13020 g_variant_unref (_ret);
13021 }
13022}
13023
13024static void
13025control_proxy_set_property (GObject *object,
13026 guint prop_id,
13027 const GValue *value,
13028 GParamSpec *pspec G_GNUC_UNUSED)
13029{
13030 const _ExtendedGDBusPropertyInfo *info;
13031 GVariant *variant;
13032 g_assert (prop_id != 0 && prop_id - 1 < 2);
13033 info = _control_property_info_pointers[prop_id - 1];
13034 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
13035 g_dbus_proxy_call (G_DBUS_PROXY (object),
13036 "org.freedesktop.DBus.Properties.Set",
13037 g_variant_new ("(ssv)", "org.openbmc.Control", info->parent_struct.name, variant),
13038 G_DBUS_CALL_FLAGS_NONE,
13039 -1,
13040 NULL, (GAsyncReadyCallback) control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
13041 g_variant_unref (variant);
13042}
13043
13044static void
13045control_proxy_g_signal (GDBusProxy *proxy,
13046 const gchar *sender_name G_GNUC_UNUSED,
13047 const gchar *signal_name,
13048 GVariant *parameters)
13049{
13050 _ExtendedGDBusSignalInfo *info;
13051 GVariantIter iter;
13052 GVariant *child;
13053 GValue *paramv;
13054 guint num_params;
13055 guint n;
13056 guint signal_id;
13057 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, signal_name);
13058 if (info == NULL)
13059 return;
13060 num_params = g_variant_n_children (parameters);
13061 paramv = g_new0 (GValue, num_params + 1);
13062 g_value_init (&paramv[0], TYPE_CONTROL);
13063 g_value_set_object (&paramv[0], proxy);
13064 g_variant_iter_init (&iter, parameters);
13065 n = 1;
13066 while ((child = g_variant_iter_next_value (&iter)) != NULL)
13067 {
13068 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
13069 if (arg_info->use_gvariant)
13070 {
13071 g_value_init (&paramv[n], G_TYPE_VARIANT);
13072 g_value_set_variant (&paramv[n], child);
13073 n++;
13074 }
13075 else
13076 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
13077 g_variant_unref (child);
13078 }
13079 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
13080 g_signal_emitv (paramv, signal_id, 0, NULL);
13081 for (n = 0; n < num_params + 1; n++)
13082 g_value_unset (&paramv[n]);
13083 g_free (paramv);
13084}
13085
13086static void
13087control_proxy_g_properties_changed (GDBusProxy *_proxy,
13088 GVariant *changed_properties,
13089 const gchar *const *invalidated_properties)
13090{
13091 ControlProxy *proxy = CONTROL_PROXY (_proxy);
13092 guint n;
13093 const gchar *key;
13094 GVariantIter *iter;
13095 _ExtendedGDBusPropertyInfo *info;
13096 g_variant_get (changed_properties, "a{sv}", &iter);
13097 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
13098 {
13099 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, key);
13100 g_datalist_remove_data (&proxy->priv->qdata, key);
13101 if (info != NULL)
13102 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
13103 }
13104 g_variant_iter_free (iter);
13105 for (n = 0; invalidated_properties[n] != NULL; n++)
13106 {
13107 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, invalidated_properties[n]);
13108 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
13109 if (info != NULL)
13110 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
13111 }
13112}
13113
13114static gint
13115control_proxy_get_poll_interval (Control *object)
13116{
13117 ControlProxy *proxy = CONTROL_PROXY (object);
13118 GVariant *variant;
13119 gint value = 0;
13120 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
13121 if (variant != NULL)
13122 {
13123 value = g_variant_get_int32 (variant);
13124 g_variant_unref (variant);
13125 }
13126 return value;
13127}
13128
13129static gint
13130control_proxy_get_heatbeat (Control *object)
13131{
13132 ControlProxy *proxy = CONTROL_PROXY (object);
13133 GVariant *variant;
13134 gint value = 0;
13135 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
13136 if (variant != NULL)
13137 {
13138 value = g_variant_get_int32 (variant);
13139 g_variant_unref (variant);
13140 }
13141 return value;
13142}
13143
13144static void
13145control_proxy_init (ControlProxy *proxy)
13146{
13147#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13148 proxy->priv = control_proxy_get_instance_private (proxy);
13149#else
13150 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_PROXY, ControlProxyPrivate);
13151#endif
13152
13153 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_interface_info ());
13154}
13155
13156static void
13157control_proxy_class_init (ControlProxyClass *klass)
13158{
13159 GObjectClass *gobject_class;
13160 GDBusProxyClass *proxy_class;
13161
13162 gobject_class = G_OBJECT_CLASS (klass);
13163 gobject_class->finalize = control_proxy_finalize;
13164 gobject_class->get_property = control_proxy_get_property;
13165 gobject_class->set_property = control_proxy_set_property;
13166
13167 proxy_class = G_DBUS_PROXY_CLASS (klass);
13168 proxy_class->g_signal = control_proxy_g_signal;
13169 proxy_class->g_properties_changed = control_proxy_g_properties_changed;
13170
13171 control_override_properties (gobject_class, 1);
13172
13173#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
13174 g_type_class_add_private (klass, sizeof (ControlProxyPrivate));
13175#endif
13176}
13177
13178static void
13179control_proxy_iface_init (ControlIface *iface)
13180{
13181 iface->get_poll_interval = control_proxy_get_poll_interval;
13182 iface->get_heatbeat = control_proxy_get_heatbeat;
13183}
13184
13185/**
13186 * control_proxy_new:
13187 * @connection: A #GDBusConnection.
13188 * @flags: Flags from the #GDBusProxyFlags enumeration.
13189 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
13190 * @object_path: An object path.
13191 * @cancellable: (allow-none): A #GCancellable or %NULL.
13192 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
13193 * @user_data: User data to pass to @callback.
13194 *
13195 * 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.
13196 *
13197 * 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.
13198 * You can then call control_proxy_new_finish() to get the result of the operation.
13199 *
13200 * See control_proxy_new_sync() for the synchronous, blocking version of this constructor.
13201 */
13202void
13203control_proxy_new (
13204 GDBusConnection *connection,
13205 GDBusProxyFlags flags,
13206 const gchar *name,
13207 const gchar *object_path,
13208 GCancellable *cancellable,
13209 GAsyncReadyCallback callback,
13210 gpointer user_data)
13211{
13212 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);
13213}
13214
13215/**
13216 * control_proxy_new_finish:
13217 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new().
13218 * @error: Return location for error or %NULL
13219 *
13220 * Finishes an operation started with control_proxy_new().
13221 *
13222 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
13223 */
13224Control *
13225control_proxy_new_finish (
13226 GAsyncResult *res,
13227 GError **error)
13228{
13229 GObject *ret;
13230 GObject *source_object;
13231 source_object = g_async_result_get_source_object (res);
13232 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
13233 g_object_unref (source_object);
13234 if (ret != NULL)
13235 return CONTROL (ret);
13236 else
13237 return NULL;
13238}
13239
13240/**
13241 * control_proxy_new_sync:
13242 * @connection: A #GDBusConnection.
13243 * @flags: Flags from the #GDBusProxyFlags enumeration.
13244 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
13245 * @object_path: An object path.
13246 * @cancellable: (allow-none): A #GCancellable or %NULL.
13247 * @error: Return location for error or %NULL
13248 *
13249 * 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.
13250 *
13251 * The calling thread is blocked until a reply is received.
13252 *
13253 * See control_proxy_new() for the asynchronous version of this constructor.
13254 *
13255 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
13256 */
13257Control *
13258control_proxy_new_sync (
13259 GDBusConnection *connection,
13260 GDBusProxyFlags flags,
13261 const gchar *name,
13262 const gchar *object_path,
13263 GCancellable *cancellable,
13264 GError **error)
13265{
13266 GInitable *ret;
13267 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);
13268 if (ret != NULL)
13269 return CONTROL (ret);
13270 else
13271 return NULL;
13272}
13273
13274
13275/**
13276 * control_proxy_new_for_bus:
13277 * @bus_type: A #GBusType.
13278 * @flags: Flags from the #GDBusProxyFlags enumeration.
13279 * @name: A bus name (well-known or unique).
13280 * @object_path: An object path.
13281 * @cancellable: (allow-none): A #GCancellable or %NULL.
13282 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
13283 * @user_data: User data to pass to @callback.
13284 *
13285 * Like control_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
13286 *
13287 * 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.
13288 * You can then call control_proxy_new_for_bus_finish() to get the result of the operation.
13289 *
13290 * See control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
13291 */
13292void
13293control_proxy_new_for_bus (
13294 GBusType bus_type,
13295 GDBusProxyFlags flags,
13296 const gchar *name,
13297 const gchar *object_path,
13298 GCancellable *cancellable,
13299 GAsyncReadyCallback callback,
13300 gpointer user_data)
13301{
13302 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);
13303}
13304
13305/**
13306 * control_proxy_new_for_bus_finish:
13307 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new_for_bus().
13308 * @error: Return location for error or %NULL
13309 *
13310 * Finishes an operation started with control_proxy_new_for_bus().
13311 *
13312 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
13313 */
13314Control *
13315control_proxy_new_for_bus_finish (
13316 GAsyncResult *res,
13317 GError **error)
13318{
13319 GObject *ret;
13320 GObject *source_object;
13321 source_object = g_async_result_get_source_object (res);
13322 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
13323 g_object_unref (source_object);
13324 if (ret != NULL)
13325 return CONTROL (ret);
13326 else
13327 return NULL;
13328}
13329
13330/**
13331 * control_proxy_new_for_bus_sync:
13332 * @bus_type: A #GBusType.
13333 * @flags: Flags from the #GDBusProxyFlags enumeration.
13334 * @name: A bus name (well-known or unique).
13335 * @object_path: An object path.
13336 * @cancellable: (allow-none): A #GCancellable or %NULL.
13337 * @error: Return location for error or %NULL
13338 *
13339 * Like control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
13340 *
13341 * The calling thread is blocked until a reply is received.
13342 *
13343 * See control_proxy_new_for_bus() for the asynchronous version of this constructor.
13344 *
13345 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
13346 */
13347Control *
13348control_proxy_new_for_bus_sync (
13349 GBusType bus_type,
13350 GDBusProxyFlags flags,
13351 const gchar *name,
13352 const gchar *object_path,
13353 GCancellable *cancellable,
13354 GError **error)
13355{
13356 GInitable *ret;
13357 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);
13358 if (ret != NULL)
13359 return CONTROL (ret);
13360 else
13361 return NULL;
13362}
13363
13364
13365/* ------------------------------------------------------------------------ */
13366
13367/**
13368 * ControlSkeleton:
13369 *
13370 * The #ControlSkeleton structure contains only private data and should only be accessed using the provided API.
13371 */
13372
13373/**
13374 * ControlSkeletonClass:
13375 * @parent_class: The parent class.
13376 *
13377 * Class structure for #ControlSkeleton.
13378 */
13379
13380struct _ControlSkeletonPrivate
13381{
13382 GValue *properties;
13383 GList *changed_properties;
13384 GSource *changed_properties_idle_source;
13385 GMainContext *context;
13386 GMutex lock;
13387};
13388
13389static void
13390_control_skeleton_handle_method_call (
13391 GDBusConnection *connection G_GNUC_UNUSED,
13392 const gchar *sender G_GNUC_UNUSED,
13393 const gchar *object_path G_GNUC_UNUSED,
13394 const gchar *interface_name,
13395 const gchar *method_name,
13396 GVariant *parameters,
13397 GDBusMethodInvocation *invocation,
13398 gpointer user_data)
13399{
13400 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
13401 _ExtendedGDBusMethodInfo *info;
13402 GVariantIter iter;
13403 GVariant *child;
13404 GValue *paramv;
13405 guint num_params;
13406 guint num_extra;
13407 guint n;
13408 guint signal_id;
13409 GValue return_value = G_VALUE_INIT;
13410 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
13411 g_assert (info != NULL);
13412 num_params = g_variant_n_children (parameters);
13413 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
13414 n = 0;
13415 g_value_init (&paramv[n], TYPE_CONTROL);
13416 g_value_set_object (&paramv[n++], skeleton);
13417 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
13418 g_value_set_object (&paramv[n++], invocation);
13419 if (info->pass_fdlist)
13420 {
13421#ifdef G_OS_UNIX
13422 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
13423 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
13424#else
13425 g_assert_not_reached ();
13426#endif
13427 }
13428 g_variant_iter_init (&iter, parameters);
13429 while ((child = g_variant_iter_next_value (&iter)) != NULL)
13430 {
13431 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
13432 if (arg_info->use_gvariant)
13433 {
13434 g_value_init (&paramv[n], G_TYPE_VARIANT);
13435 g_value_set_variant (&paramv[n], child);
13436 n++;
13437 }
13438 else
13439 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
13440 g_variant_unref (child);
13441 }
13442 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
13443 g_value_init (&return_value, G_TYPE_BOOLEAN);
13444 g_signal_emitv (paramv, signal_id, 0, &return_value);
13445 if (!g_value_get_boolean (&return_value))
13446 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);
13447 g_value_unset (&return_value);
13448 for (n = 0; n < num_params + num_extra; n++)
13449 g_value_unset (&paramv[n]);
13450 g_free (paramv);
13451}
13452
13453static GVariant *
13454_control_skeleton_handle_get_property (
13455 GDBusConnection *connection G_GNUC_UNUSED,
13456 const gchar *sender G_GNUC_UNUSED,
13457 const gchar *object_path G_GNUC_UNUSED,
13458 const gchar *interface_name G_GNUC_UNUSED,
13459 const gchar *property_name,
13460 GError **error,
13461 gpointer user_data)
13462{
13463 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
13464 GValue value = G_VALUE_INIT;
13465 GParamSpec *pspec;
13466 _ExtendedGDBusPropertyInfo *info;
13467 GVariant *ret;
13468 ret = NULL;
13469 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
13470 g_assert (info != NULL);
13471 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
13472 if (pspec == NULL)
13473 {
13474 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
13475 }
13476 else
13477 {
13478 g_value_init (&value, pspec->value_type);
13479 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
13480 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
13481 g_value_unset (&value);
13482 }
13483 return ret;
13484}
13485
13486static gboolean
13487_control_skeleton_handle_set_property (
13488 GDBusConnection *connection G_GNUC_UNUSED,
13489 const gchar *sender G_GNUC_UNUSED,
13490 const gchar *object_path G_GNUC_UNUSED,
13491 const gchar *interface_name G_GNUC_UNUSED,
13492 const gchar *property_name,
13493 GVariant *variant,
13494 GError **error,
13495 gpointer user_data)
13496{
13497 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
13498 GValue value = G_VALUE_INIT;
13499 GParamSpec *pspec;
13500 _ExtendedGDBusPropertyInfo *info;
13501 gboolean ret;
13502 ret = FALSE;
13503 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
13504 g_assert (info != NULL);
13505 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
13506 if (pspec == NULL)
13507 {
13508 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
13509 }
13510 else
13511 {
13512 if (info->use_gvariant)
13513 g_value_set_variant (&value, variant);
13514 else
13515 g_dbus_gvariant_to_gvalue (variant, &value);
13516 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
13517 g_value_unset (&value);
13518 ret = TRUE;
13519 }
13520 return ret;
13521}
13522
13523static const GDBusInterfaceVTable _control_skeleton_vtable =
13524{
13525 _control_skeleton_handle_method_call,
13526 _control_skeleton_handle_get_property,
13527 _control_skeleton_handle_set_property,
13528 {NULL}
13529};
13530
13531static GDBusInterfaceInfo *
13532control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
13533{
13534 return control_interface_info ();
13535}
13536
13537static GDBusInterfaceVTable *
13538control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
13539{
13540 return (GDBusInterfaceVTable *) &_control_skeleton_vtable;
13541}
13542
13543static GVariant *
13544control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
13545{
13546 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
13547
13548 GVariantBuilder builder;
13549 guint n;
13550 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
13551 if (_control_interface_info.parent_struct.properties == NULL)
13552 goto out;
13553 for (n = 0; _control_interface_info.parent_struct.properties[n] != NULL; n++)
13554 {
13555 GDBusPropertyInfo *info = _control_interface_info.parent_struct.properties[n];
13556 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
13557 {
13558 GVariant *value;
13559 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);
13560 if (value != NULL)
13561 {
13562 g_variant_take_ref (value);
13563 g_variant_builder_add (&builder, "{sv}", info->name, value);
13564 g_variant_unref (value);
13565 }
13566 }
13567 }
13568out:
13569 return g_variant_builder_end (&builder);
13570}
13571
13572static gboolean _control_emit_changed (gpointer user_data);
13573
13574static void
13575control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
13576{
13577 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
13578 gboolean emit_changed = FALSE;
13579
13580 g_mutex_lock (&skeleton->priv->lock);
13581 if (skeleton->priv->changed_properties_idle_source != NULL)
13582 {
13583 g_source_destroy (skeleton->priv->changed_properties_idle_source);
13584 skeleton->priv->changed_properties_idle_source = NULL;
13585 emit_changed = TRUE;
13586 }
13587 g_mutex_unlock (&skeleton->priv->lock);
13588
13589 if (emit_changed)
13590 _control_emit_changed (skeleton);
13591}
13592
13593static void
13594_control_on_signal_heartbeat (
13595 Control *object,
13596 const gchar *arg_bus_name)
13597{
13598 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13599
13600 GList *connections, *l;
13601 GVariant *signal_variant;
13602 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
13603
13604 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
13605 arg_bus_name));
13606 for (l = connections; l != NULL; l = l->next)
13607 {
13608 GDBusConnection *connection = l->data;
13609 g_dbus_connection_emit_signal (connection,
13610 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Heartbeat",
13611 signal_variant, NULL);
13612 }
13613 g_variant_unref (signal_variant);
13614 g_list_free_full (connections, g_object_unref);
13615}
13616
13617static void
13618_control_on_signal_goto_system_state (
13619 Control *object,
13620 const gchar *arg_state_name)
13621{
13622 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13623
13624 GList *connections, *l;
13625 GVariant *signal_variant;
13626 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
13627
13628 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
13629 arg_state_name));
13630 for (l = connections; l != NULL; l = l->next)
13631 {
13632 GDBusConnection *connection = l->data;
13633 g_dbus_connection_emit_signal (connection,
13634 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "GotoSystemState",
13635 signal_variant, NULL);
13636 }
13637 g_variant_unref (signal_variant);
13638 g_list_free_full (connections, g_object_unref);
13639}
13640
Norman Jamesa3e47c42015-10-18 14:43:10 -050013641static void
13642_control_on_signal_started (
13643 Control *object)
13644{
13645 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13646
13647 GList *connections, *l;
13648 GVariant *signal_variant;
13649 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
13650
13651 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
13652 for (l = connections; l != NULL; l = l->next)
13653 {
13654 GDBusConnection *connection = l->data;
13655 g_dbus_connection_emit_signal (connection,
13656 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Started",
13657 signal_variant, NULL);
13658 }
13659 g_variant_unref (signal_variant);
13660 g_list_free_full (connections, g_object_unref);
13661}
13662
Norman James362a80f2015-09-14 14:04:39 -050013663static void control_skeleton_iface_init (ControlIface *iface);
13664#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13665G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
13666 G_ADD_PRIVATE (ControlSkeleton)
13667 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init));
13668
13669#else
13670G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
13671 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init));
13672
13673#endif
13674static void
13675control_skeleton_finalize (GObject *object)
13676{
13677 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13678 guint n;
13679 for (n = 0; n < 2; n++)
13680 g_value_unset (&skeleton->priv->properties[n]);
13681 g_free (skeleton->priv->properties);
13682 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
13683 if (skeleton->priv->changed_properties_idle_source != NULL)
13684 g_source_destroy (skeleton->priv->changed_properties_idle_source);
13685 g_main_context_unref (skeleton->priv->context);
13686 g_mutex_clear (&skeleton->priv->lock);
13687 G_OBJECT_CLASS (control_skeleton_parent_class)->finalize (object);
13688}
13689
13690static void
13691control_skeleton_get_property (GObject *object,
13692 guint prop_id,
13693 GValue *value,
13694 GParamSpec *pspec G_GNUC_UNUSED)
13695{
13696 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13697 g_assert (prop_id != 0 && prop_id - 1 < 2);
13698 g_mutex_lock (&skeleton->priv->lock);
13699 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
13700 g_mutex_unlock (&skeleton->priv->lock);
13701}
13702
13703static gboolean
13704_control_emit_changed (gpointer user_data)
13705{
13706 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
13707 GList *l;
13708 GVariantBuilder builder;
13709 GVariantBuilder invalidated_builder;
13710 guint num_changes;
13711
13712 g_mutex_lock (&skeleton->priv->lock);
13713 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
13714 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
13715 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
13716 {
13717 ChangedProperty *cp = l->data;
13718 GVariant *variant;
13719 const GValue *cur_value;
13720
13721 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
13722 if (!_g_value_equal (cur_value, &cp->orig_value))
13723 {
13724 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
13725 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
13726 g_variant_unref (variant);
13727 num_changes++;
13728 }
13729 }
13730 if (num_changes > 0)
13731 {
13732 GList *connections, *ll;
13733 GVariant *signal_variant;
13734 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Control",
13735 &builder, &invalidated_builder));
13736 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
13737 for (ll = connections; ll != NULL; ll = ll->next)
13738 {
13739 GDBusConnection *connection = ll->data;
13740
13741 g_dbus_connection_emit_signal (connection,
13742 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
13743 "org.freedesktop.DBus.Properties",
13744 "PropertiesChanged",
13745 signal_variant,
13746 NULL);
13747 }
13748 g_variant_unref (signal_variant);
13749 g_list_free_full (connections, g_object_unref);
13750 }
13751 else
13752 {
13753 g_variant_builder_clear (&builder);
13754 g_variant_builder_clear (&invalidated_builder);
13755 }
13756 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
13757 skeleton->priv->changed_properties = NULL;
13758 skeleton->priv->changed_properties_idle_source = NULL;
13759 g_mutex_unlock (&skeleton->priv->lock);
13760 return FALSE;
13761}
13762
13763static void
13764_control_schedule_emit_changed (ControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
13765{
13766 ChangedProperty *cp;
13767 GList *l;
13768 cp = NULL;
13769 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
13770 {
13771 ChangedProperty *i_cp = l->data;
13772 if (i_cp->info == info)
13773 {
13774 cp = i_cp;
13775 break;
13776 }
13777 }
13778 if (cp == NULL)
13779 {
13780 cp = g_new0 (ChangedProperty, 1);
13781 cp->prop_id = prop_id;
13782 cp->info = info;
13783 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
13784 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
13785 g_value_copy (orig_value, &cp->orig_value);
13786 }
13787}
13788
13789static void
13790control_skeleton_notify (GObject *object,
13791 GParamSpec *pspec G_GNUC_UNUSED)
13792{
13793 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13794 g_mutex_lock (&skeleton->priv->lock);
13795 if (skeleton->priv->changed_properties != NULL &&
13796 skeleton->priv->changed_properties_idle_source == NULL)
13797 {
13798 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
13799 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
13800 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylak2cb27752015-10-19 16:23:14 -050013801 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _control_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -050013802 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
13803 g_source_unref (skeleton->priv->changed_properties_idle_source);
13804 }
13805 g_mutex_unlock (&skeleton->priv->lock);
13806}
13807
13808static void
13809control_skeleton_set_property (GObject *object,
13810 guint prop_id,
13811 const GValue *value,
13812 GParamSpec *pspec)
13813{
13814 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13815 g_assert (prop_id != 0 && prop_id - 1 < 2);
13816 g_mutex_lock (&skeleton->priv->lock);
13817 g_object_freeze_notify (object);
13818 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
13819 {
13820 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
13821 _control_schedule_emit_changed (skeleton, _control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
13822 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
13823 g_object_notify_by_pspec (object, pspec);
13824 }
13825 g_mutex_unlock (&skeleton->priv->lock);
13826 g_object_thaw_notify (object);
13827}
13828
13829static void
13830control_skeleton_init (ControlSkeleton *skeleton)
13831{
13832#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13833 skeleton->priv = control_skeleton_get_instance_private (skeleton);
13834#else
13835 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_SKELETON, ControlSkeletonPrivate);
13836#endif
13837
13838 g_mutex_init (&skeleton->priv->lock);
13839 skeleton->priv->context = g_main_context_ref_thread_default ();
13840 skeleton->priv->properties = g_new0 (GValue, 2);
13841 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
13842 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
13843}
13844
13845static gint
13846control_skeleton_get_poll_interval (Control *object)
13847{
13848 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13849 gint value;
13850 g_mutex_lock (&skeleton->priv->lock);
13851 value = g_value_get_int (&(skeleton->priv->properties[0]));
13852 g_mutex_unlock (&skeleton->priv->lock);
13853 return value;
13854}
13855
13856static gint
13857control_skeleton_get_heatbeat (Control *object)
13858{
13859 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13860 gint value;
13861 g_mutex_lock (&skeleton->priv->lock);
13862 value = g_value_get_int (&(skeleton->priv->properties[1]));
13863 g_mutex_unlock (&skeleton->priv->lock);
13864 return value;
13865}
13866
13867static void
13868control_skeleton_class_init (ControlSkeletonClass *klass)
13869{
13870 GObjectClass *gobject_class;
13871 GDBusInterfaceSkeletonClass *skeleton_class;
13872
13873 gobject_class = G_OBJECT_CLASS (klass);
13874 gobject_class->finalize = control_skeleton_finalize;
13875 gobject_class->get_property = control_skeleton_get_property;
13876 gobject_class->set_property = control_skeleton_set_property;
13877 gobject_class->notify = control_skeleton_notify;
13878
13879
13880 control_override_properties (gobject_class, 1);
13881
13882 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
13883 skeleton_class->get_info = control_skeleton_dbus_interface_get_info;
13884 skeleton_class->get_properties = control_skeleton_dbus_interface_get_properties;
13885 skeleton_class->flush = control_skeleton_dbus_interface_flush;
13886 skeleton_class->get_vtable = control_skeleton_dbus_interface_get_vtable;
13887
13888#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
13889 g_type_class_add_private (klass, sizeof (ControlSkeletonPrivate));
13890#endif
13891}
13892
13893static void
13894control_skeleton_iface_init (ControlIface *iface)
13895{
13896 iface->heartbeat = _control_on_signal_heartbeat;
13897 iface->goto_system_state = _control_on_signal_goto_system_state;
Norman Jamesa3e47c42015-10-18 14:43:10 -050013898 iface->started = _control_on_signal_started;
Norman James362a80f2015-09-14 14:04:39 -050013899 iface->get_poll_interval = control_skeleton_get_poll_interval;
13900 iface->get_heatbeat = control_skeleton_get_heatbeat;
13901}
13902
13903/**
13904 * control_skeleton_new:
13905 *
13906 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
13907 *
13908 * Returns: (transfer full) (type ControlSkeleton): The skeleton object.
13909 */
13910Control *
13911control_skeleton_new (void)
13912{
13913 return CONTROL (g_object_new (TYPE_CONTROL_SKELETON, NULL));
13914}
13915
13916/* ------------------------------------------------------------------------
13917 * Code for interface org.openbmc.control.Bmc
13918 * ------------------------------------------------------------------------
13919 */
13920
13921/**
13922 * SECTION:ControlBmc
13923 * @title: ControlBmc
13924 * @short_description: Generated C code for the org.openbmc.control.Bmc D-Bus interface
13925 *
13926 * 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.
13927 */
13928
13929/* ---- Introspection data for org.openbmc.control.Bmc ---- */
13930
13931static const _ExtendedGDBusMethodInfo _control_bmc_method_info_place_holder =
13932{
13933 {
13934 -1,
13935 (gchar *) "place_holder",
13936 NULL,
13937 NULL,
13938 NULL
13939 },
13940 "handle-place-holder",
13941 FALSE
13942};
13943
13944static const _ExtendedGDBusMethodInfo * const _control_bmc_method_info_pointers[] =
13945{
13946 &_control_bmc_method_info_place_holder,
13947 NULL
13948};
13949
13950static const _ExtendedGDBusInterfaceInfo _control_bmc_interface_info =
13951{
13952 {
13953 -1,
13954 (gchar *) "org.openbmc.control.Bmc",
13955 (GDBusMethodInfo **) &_control_bmc_method_info_pointers,
13956 NULL,
13957 NULL,
13958 NULL
13959 },
13960 "control-bmc",
13961};
13962
13963
13964/**
13965 * control_bmc_interface_info:
13966 *
13967 * 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.
13968 *
13969 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
13970 */
13971GDBusInterfaceInfo *
13972control_bmc_interface_info (void)
13973{
13974 return (GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct;
13975}
13976
13977/**
13978 * control_bmc_override_properties:
13979 * @klass: The class structure for a #GObject<!-- -->-derived class.
13980 * @property_id_begin: The property id to assign to the first overridden property.
13981 *
13982 * Overrides all #GObject properties in the #ControlBmc interface for a concrete class.
13983 * The properties are overridden in the order they are defined.
13984 *
13985 * Returns: The last property id.
13986 */
13987guint
13988control_bmc_override_properties (GObjectClass *klass, guint property_id_begin)
13989{
13990 return property_id_begin - 1;
13991}
13992
13993
13994
13995/**
13996 * ControlBmc:
13997 *
13998 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
13999 */
14000
14001/**
14002 * ControlBmcIface:
14003 * @parent_iface: The parent interface.
14004 * @handle_place_holder: Handler for the #ControlBmc::handle-place-holder signal.
14005 *
14006 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
14007 */
14008
14009typedef ControlBmcIface ControlBmcInterface;
14010G_DEFINE_INTERFACE (ControlBmc, control_bmc, G_TYPE_OBJECT);
14011
14012static void
14013control_bmc_default_init (ControlBmcIface *iface)
14014{
14015 /* GObject signals for incoming D-Bus method calls: */
14016 /**
14017 * ControlBmc::handle-place-holder:
14018 * @object: A #ControlBmc.
14019 * @invocation: A #GDBusMethodInvocation.
14020 *
14021 * 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.
14022 *
14023 * 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.
14024 *
14025 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14026 */
14027 g_signal_new ("handle-place-holder",
14028 G_TYPE_FROM_INTERFACE (iface),
14029 G_SIGNAL_RUN_LAST,
14030 G_STRUCT_OFFSET (ControlBmcIface, handle_place_holder),
14031 g_signal_accumulator_true_handled,
14032 NULL,
14033 g_cclosure_marshal_generic,
14034 G_TYPE_BOOLEAN,
14035 1,
14036 G_TYPE_DBUS_METHOD_INVOCATION);
14037
14038}
14039
14040/**
14041 * control_bmc_call_place_holder:
14042 * @proxy: A #ControlBmcProxy.
14043 * @cancellable: (allow-none): A #GCancellable or %NULL.
14044 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
14045 * @user_data: User data to pass to @callback.
14046 *
14047 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.place_holder">place_holder()</link> D-Bus method on @proxy.
14048 * 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.
14049 * You can then call control_bmc_call_place_holder_finish() to get the result of the operation.
14050 *
14051 * See control_bmc_call_place_holder_sync() for the synchronous, blocking version of this method.
14052 */
14053void
14054control_bmc_call_place_holder (
14055 ControlBmc *proxy,
14056 GCancellable *cancellable,
14057 GAsyncReadyCallback callback,
14058 gpointer user_data)
14059{
14060 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
14061 "place_holder",
14062 g_variant_new ("()"),
14063 G_DBUS_CALL_FLAGS_NONE,
14064 -1,
14065 cancellable,
14066 callback,
14067 user_data);
14068}
14069
14070/**
14071 * control_bmc_call_place_holder_finish:
14072 * @proxy: A #ControlBmcProxy.
14073 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_call_place_holder().
14074 * @error: Return location for error or %NULL.
14075 *
14076 * Finishes an operation started with control_bmc_call_place_holder().
14077 *
14078 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14079 */
14080gboolean
14081control_bmc_call_place_holder_finish (
14082 ControlBmc *proxy,
14083 GAsyncResult *res,
14084 GError **error)
14085{
14086 GVariant *_ret;
14087 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
14088 if (_ret == NULL)
14089 goto _out;
14090 g_variant_get (_ret,
14091 "()");
14092 g_variant_unref (_ret);
14093_out:
14094 return _ret != NULL;
14095}
14096
14097/**
14098 * control_bmc_call_place_holder_sync:
14099 * @proxy: A #ControlBmcProxy.
14100 * @cancellable: (allow-none): A #GCancellable or %NULL.
14101 * @error: Return location for error or %NULL.
14102 *
14103 * 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.
14104 *
14105 * See control_bmc_call_place_holder() for the asynchronous version of this method.
14106 *
14107 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14108 */
14109gboolean
14110control_bmc_call_place_holder_sync (
14111 ControlBmc *proxy,
14112 GCancellable *cancellable,
14113 GError **error)
14114{
14115 GVariant *_ret;
14116 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
14117 "place_holder",
14118 g_variant_new ("()"),
14119 G_DBUS_CALL_FLAGS_NONE,
14120 -1,
14121 cancellable,
14122 error);
14123 if (_ret == NULL)
14124 goto _out;
14125 g_variant_get (_ret,
14126 "()");
14127 g_variant_unref (_ret);
14128_out:
14129 return _ret != NULL;
14130}
14131
14132/**
14133 * control_bmc_complete_place_holder:
14134 * @object: A #ControlBmc.
14135 * @invocation: (transfer full): A #GDBusMethodInvocation.
14136 *
14137 * 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.
14138 *
14139 * This method will free @invocation, you cannot use it afterwards.
14140 */
14141void
14142control_bmc_complete_place_holder (
14143 ControlBmc *object,
14144 GDBusMethodInvocation *invocation)
14145{
14146 g_dbus_method_invocation_return_value (invocation,
14147 g_variant_new ("()"));
14148}
14149
14150/* ------------------------------------------------------------------------ */
14151
14152/**
14153 * ControlBmcProxy:
14154 *
14155 * The #ControlBmcProxy structure contains only private data and should only be accessed using the provided API.
14156 */
14157
14158/**
14159 * ControlBmcProxyClass:
14160 * @parent_class: The parent class.
14161 *
14162 * Class structure for #ControlBmcProxy.
14163 */
14164
14165struct _ControlBmcProxyPrivate
14166{
14167 GData *qdata;
14168};
14169
14170static void control_bmc_proxy_iface_init (ControlBmcIface *iface);
14171
14172#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14173G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY,
14174 G_ADD_PRIVATE (ControlBmcProxy)
14175 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init));
14176
14177#else
14178G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY,
14179 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init));
14180
14181#endif
14182static void
14183control_bmc_proxy_finalize (GObject *object)
14184{
14185 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (object);
14186 g_datalist_clear (&proxy->priv->qdata);
14187 G_OBJECT_CLASS (control_bmc_proxy_parent_class)->finalize (object);
14188}
14189
14190static void
14191control_bmc_proxy_get_property (GObject *object,
14192 guint prop_id,
14193 GValue *value,
14194 GParamSpec *pspec G_GNUC_UNUSED)
14195{
14196}
14197
14198static void
14199control_bmc_proxy_set_property (GObject *object,
14200 guint prop_id,
14201 const GValue *value,
14202 GParamSpec *pspec G_GNUC_UNUSED)
14203{
14204}
14205
14206static void
14207control_bmc_proxy_g_signal (GDBusProxy *proxy,
14208 const gchar *sender_name G_GNUC_UNUSED,
14209 const gchar *signal_name,
14210 GVariant *parameters)
14211{
14212 _ExtendedGDBusSignalInfo *info;
14213 GVariantIter iter;
14214 GVariant *child;
14215 GValue *paramv;
14216 guint num_params;
14217 guint n;
14218 guint signal_id;
14219 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, signal_name);
14220 if (info == NULL)
14221 return;
14222 num_params = g_variant_n_children (parameters);
14223 paramv = g_new0 (GValue, num_params + 1);
14224 g_value_init (&paramv[0], TYPE_CONTROL_BMC);
14225 g_value_set_object (&paramv[0], proxy);
14226 g_variant_iter_init (&iter, parameters);
14227 n = 1;
14228 while ((child = g_variant_iter_next_value (&iter)) != NULL)
14229 {
14230 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
14231 if (arg_info->use_gvariant)
14232 {
14233 g_value_init (&paramv[n], G_TYPE_VARIANT);
14234 g_value_set_variant (&paramv[n], child);
14235 n++;
14236 }
14237 else
14238 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
14239 g_variant_unref (child);
14240 }
14241 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC);
14242 g_signal_emitv (paramv, signal_id, 0, NULL);
14243 for (n = 0; n < num_params + 1; n++)
14244 g_value_unset (&paramv[n]);
14245 g_free (paramv);
14246}
14247
14248static void
14249control_bmc_proxy_g_properties_changed (GDBusProxy *_proxy,
14250 GVariant *changed_properties,
14251 const gchar *const *invalidated_properties)
14252{
14253 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (_proxy);
14254 guint n;
14255 const gchar *key;
14256 GVariantIter *iter;
14257 _ExtendedGDBusPropertyInfo *info;
14258 g_variant_get (changed_properties, "a{sv}", &iter);
14259 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
14260 {
14261 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, key);
14262 g_datalist_remove_data (&proxy->priv->qdata, key);
14263 if (info != NULL)
14264 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
14265 }
14266 g_variant_iter_free (iter);
14267 for (n = 0; invalidated_properties[n] != NULL; n++)
14268 {
14269 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, invalidated_properties[n]);
14270 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
14271 if (info != NULL)
14272 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
14273 }
14274}
14275
14276static void
14277control_bmc_proxy_init (ControlBmcProxy *proxy)
14278{
14279#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14280 proxy->priv = control_bmc_proxy_get_instance_private (proxy);
14281#else
14282 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_BMC_PROXY, ControlBmcProxyPrivate);
14283#endif
14284
14285 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_bmc_interface_info ());
14286}
14287
14288static void
14289control_bmc_proxy_class_init (ControlBmcProxyClass *klass)
14290{
14291 GObjectClass *gobject_class;
14292 GDBusProxyClass *proxy_class;
14293
14294 gobject_class = G_OBJECT_CLASS (klass);
14295 gobject_class->finalize = control_bmc_proxy_finalize;
14296 gobject_class->get_property = control_bmc_proxy_get_property;
14297 gobject_class->set_property = control_bmc_proxy_set_property;
14298
14299 proxy_class = G_DBUS_PROXY_CLASS (klass);
14300 proxy_class->g_signal = control_bmc_proxy_g_signal;
14301 proxy_class->g_properties_changed = control_bmc_proxy_g_properties_changed;
14302
14303#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
14304 g_type_class_add_private (klass, sizeof (ControlBmcProxyPrivate));
14305#endif
14306}
14307
14308static void
14309control_bmc_proxy_iface_init (ControlBmcIface *iface)
14310{
14311}
14312
14313/**
14314 * control_bmc_proxy_new:
14315 * @connection: A #GDBusConnection.
14316 * @flags: Flags from the #GDBusProxyFlags enumeration.
14317 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
14318 * @object_path: An object path.
14319 * @cancellable: (allow-none): A #GCancellable or %NULL.
14320 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
14321 * @user_data: User data to pass to @callback.
14322 *
14323 * 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.
14324 *
14325 * 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.
14326 * You can then call control_bmc_proxy_new_finish() to get the result of the operation.
14327 *
14328 * See control_bmc_proxy_new_sync() for the synchronous, blocking version of this constructor.
14329 */
14330void
14331control_bmc_proxy_new (
14332 GDBusConnection *connection,
14333 GDBusProxyFlags flags,
14334 const gchar *name,
14335 const gchar *object_path,
14336 GCancellable *cancellable,
14337 GAsyncReadyCallback callback,
14338 gpointer user_data)
14339{
14340 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);
14341}
14342
14343/**
14344 * control_bmc_proxy_new_finish:
14345 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new().
14346 * @error: Return location for error or %NULL
14347 *
14348 * Finishes an operation started with control_bmc_proxy_new().
14349 *
14350 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14351 */
14352ControlBmc *
14353control_bmc_proxy_new_finish (
14354 GAsyncResult *res,
14355 GError **error)
14356{
14357 GObject *ret;
14358 GObject *source_object;
14359 source_object = g_async_result_get_source_object (res);
14360 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
14361 g_object_unref (source_object);
14362 if (ret != NULL)
14363 return CONTROL_BMC (ret);
14364 else
14365 return NULL;
14366}
14367
14368/**
14369 * control_bmc_proxy_new_sync:
14370 * @connection: A #GDBusConnection.
14371 * @flags: Flags from the #GDBusProxyFlags enumeration.
14372 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
14373 * @object_path: An object path.
14374 * @cancellable: (allow-none): A #GCancellable or %NULL.
14375 * @error: Return location for error or %NULL
14376 *
14377 * 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.
14378 *
14379 * The calling thread is blocked until a reply is received.
14380 *
14381 * See control_bmc_proxy_new() for the asynchronous version of this constructor.
14382 *
14383 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14384 */
14385ControlBmc *
14386control_bmc_proxy_new_sync (
14387 GDBusConnection *connection,
14388 GDBusProxyFlags flags,
14389 const gchar *name,
14390 const gchar *object_path,
14391 GCancellable *cancellable,
14392 GError **error)
14393{
14394 GInitable *ret;
14395 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);
14396 if (ret != NULL)
14397 return CONTROL_BMC (ret);
14398 else
14399 return NULL;
14400}
14401
14402
14403/**
14404 * control_bmc_proxy_new_for_bus:
14405 * @bus_type: A #GBusType.
14406 * @flags: Flags from the #GDBusProxyFlags enumeration.
14407 * @name: A bus name (well-known or unique).
14408 * @object_path: An object path.
14409 * @cancellable: (allow-none): A #GCancellable or %NULL.
14410 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
14411 * @user_data: User data to pass to @callback.
14412 *
14413 * Like control_bmc_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
14414 *
14415 * 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.
14416 * You can then call control_bmc_proxy_new_for_bus_finish() to get the result of the operation.
14417 *
14418 * See control_bmc_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
14419 */
14420void
14421control_bmc_proxy_new_for_bus (
14422 GBusType bus_type,
14423 GDBusProxyFlags flags,
14424 const gchar *name,
14425 const gchar *object_path,
14426 GCancellable *cancellable,
14427 GAsyncReadyCallback callback,
14428 gpointer user_data)
14429{
14430 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);
14431}
14432
14433/**
14434 * control_bmc_proxy_new_for_bus_finish:
14435 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new_for_bus().
14436 * @error: Return location for error or %NULL
14437 *
14438 * Finishes an operation started with control_bmc_proxy_new_for_bus().
14439 *
14440 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14441 */
14442ControlBmc *
14443control_bmc_proxy_new_for_bus_finish (
14444 GAsyncResult *res,
14445 GError **error)
14446{
14447 GObject *ret;
14448 GObject *source_object;
14449 source_object = g_async_result_get_source_object (res);
14450 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
14451 g_object_unref (source_object);
14452 if (ret != NULL)
14453 return CONTROL_BMC (ret);
14454 else
14455 return NULL;
14456}
14457
14458/**
14459 * control_bmc_proxy_new_for_bus_sync:
14460 * @bus_type: A #GBusType.
14461 * @flags: Flags from the #GDBusProxyFlags enumeration.
14462 * @name: A bus name (well-known or unique).
14463 * @object_path: An object path.
14464 * @cancellable: (allow-none): A #GCancellable or %NULL.
14465 * @error: Return location for error or %NULL
14466 *
14467 * Like control_bmc_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
14468 *
14469 * The calling thread is blocked until a reply is received.
14470 *
14471 * See control_bmc_proxy_new_for_bus() for the asynchronous version of this constructor.
14472 *
14473 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14474 */
14475ControlBmc *
14476control_bmc_proxy_new_for_bus_sync (
14477 GBusType bus_type,
14478 GDBusProxyFlags flags,
14479 const gchar *name,
14480 const gchar *object_path,
14481 GCancellable *cancellable,
14482 GError **error)
14483{
14484 GInitable *ret;
14485 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);
14486 if (ret != NULL)
14487 return CONTROL_BMC (ret);
14488 else
14489 return NULL;
14490}
14491
14492
14493/* ------------------------------------------------------------------------ */
14494
14495/**
14496 * ControlBmcSkeleton:
14497 *
14498 * The #ControlBmcSkeleton structure contains only private data and should only be accessed using the provided API.
14499 */
14500
14501/**
14502 * ControlBmcSkeletonClass:
14503 * @parent_class: The parent class.
14504 *
14505 * Class structure for #ControlBmcSkeleton.
14506 */
14507
14508struct _ControlBmcSkeletonPrivate
14509{
14510 GValue *properties;
14511 GList *changed_properties;
14512 GSource *changed_properties_idle_source;
14513 GMainContext *context;
14514 GMutex lock;
14515};
14516
14517static void
14518_control_bmc_skeleton_handle_method_call (
14519 GDBusConnection *connection G_GNUC_UNUSED,
14520 const gchar *sender G_GNUC_UNUSED,
14521 const gchar *object_path G_GNUC_UNUSED,
14522 const gchar *interface_name,
14523 const gchar *method_name,
14524 GVariant *parameters,
14525 GDBusMethodInvocation *invocation,
14526 gpointer user_data)
14527{
14528 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
14529 _ExtendedGDBusMethodInfo *info;
14530 GVariantIter iter;
14531 GVariant *child;
14532 GValue *paramv;
14533 guint num_params;
14534 guint num_extra;
14535 guint n;
14536 guint signal_id;
14537 GValue return_value = G_VALUE_INIT;
14538 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
14539 g_assert (info != NULL);
14540 num_params = g_variant_n_children (parameters);
14541 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
14542 n = 0;
14543 g_value_init (&paramv[n], TYPE_CONTROL_BMC);
14544 g_value_set_object (&paramv[n++], skeleton);
14545 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
14546 g_value_set_object (&paramv[n++], invocation);
14547 if (info->pass_fdlist)
14548 {
14549#ifdef G_OS_UNIX
14550 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
14551 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
14552#else
14553 g_assert_not_reached ();
14554#endif
14555 }
14556 g_variant_iter_init (&iter, parameters);
14557 while ((child = g_variant_iter_next_value (&iter)) != NULL)
14558 {
14559 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
14560 if (arg_info->use_gvariant)
14561 {
14562 g_value_init (&paramv[n], G_TYPE_VARIANT);
14563 g_value_set_variant (&paramv[n], child);
14564 n++;
14565 }
14566 else
14567 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
14568 g_variant_unref (child);
14569 }
14570 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC);
14571 g_value_init (&return_value, G_TYPE_BOOLEAN);
14572 g_signal_emitv (paramv, signal_id, 0, &return_value);
14573 if (!g_value_get_boolean (&return_value))
14574 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);
14575 g_value_unset (&return_value);
14576 for (n = 0; n < num_params + num_extra; n++)
14577 g_value_unset (&paramv[n]);
14578 g_free (paramv);
14579}
14580
14581static GVariant *
14582_control_bmc_skeleton_handle_get_property (
14583 GDBusConnection *connection G_GNUC_UNUSED,
14584 const gchar *sender G_GNUC_UNUSED,
14585 const gchar *object_path G_GNUC_UNUSED,
14586 const gchar *interface_name G_GNUC_UNUSED,
14587 const gchar *property_name,
14588 GError **error,
14589 gpointer user_data)
14590{
14591 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
14592 GValue value = G_VALUE_INIT;
14593 GParamSpec *pspec;
14594 _ExtendedGDBusPropertyInfo *info;
14595 GVariant *ret;
14596 ret = NULL;
14597 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name);
14598 g_assert (info != NULL);
14599 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
14600 if (pspec == NULL)
14601 {
14602 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
14603 }
14604 else
14605 {
14606 g_value_init (&value, pspec->value_type);
14607 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
14608 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
14609 g_value_unset (&value);
14610 }
14611 return ret;
14612}
14613
14614static gboolean
14615_control_bmc_skeleton_handle_set_property (
14616 GDBusConnection *connection G_GNUC_UNUSED,
14617 const gchar *sender G_GNUC_UNUSED,
14618 const gchar *object_path G_GNUC_UNUSED,
14619 const gchar *interface_name G_GNUC_UNUSED,
14620 const gchar *property_name,
14621 GVariant *variant,
14622 GError **error,
14623 gpointer user_data)
14624{
14625 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
14626 GValue value = G_VALUE_INIT;
14627 GParamSpec *pspec;
14628 _ExtendedGDBusPropertyInfo *info;
14629 gboolean ret;
14630 ret = FALSE;
14631 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name);
14632 g_assert (info != NULL);
14633 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
14634 if (pspec == NULL)
14635 {
14636 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
14637 }
14638 else
14639 {
14640 if (info->use_gvariant)
14641 g_value_set_variant (&value, variant);
14642 else
14643 g_dbus_gvariant_to_gvalue (variant, &value);
14644 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
14645 g_value_unset (&value);
14646 ret = TRUE;
14647 }
14648 return ret;
14649}
14650
14651static const GDBusInterfaceVTable _control_bmc_skeleton_vtable =
14652{
14653 _control_bmc_skeleton_handle_method_call,
14654 _control_bmc_skeleton_handle_get_property,
14655 _control_bmc_skeleton_handle_set_property,
14656 {NULL}
14657};
14658
14659static GDBusInterfaceInfo *
14660control_bmc_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
14661{
14662 return control_bmc_interface_info ();
14663}
14664
14665static GDBusInterfaceVTable *
14666control_bmc_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
14667{
14668 return (GDBusInterfaceVTable *) &_control_bmc_skeleton_vtable;
14669}
14670
14671static GVariant *
14672control_bmc_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
14673{
14674 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (_skeleton);
14675
14676 GVariantBuilder builder;
14677 guint n;
14678 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
14679 if (_control_bmc_interface_info.parent_struct.properties == NULL)
14680 goto out;
14681 for (n = 0; _control_bmc_interface_info.parent_struct.properties[n] != NULL; n++)
14682 {
14683 GDBusPropertyInfo *info = _control_bmc_interface_info.parent_struct.properties[n];
14684 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
14685 {
14686 GVariant *value;
14687 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);
14688 if (value != NULL)
14689 {
14690 g_variant_take_ref (value);
14691 g_variant_builder_add (&builder, "{sv}", info->name, value);
14692 g_variant_unref (value);
14693 }
14694 }
14695 }
14696out:
14697 return g_variant_builder_end (&builder);
14698}
14699
14700static void
14701control_bmc_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
14702{
14703}
14704
14705static void control_bmc_skeleton_iface_init (ControlBmcIface *iface);
14706#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14707G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
14708 G_ADD_PRIVATE (ControlBmcSkeleton)
14709 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init));
14710
14711#else
14712G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
14713 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init));
14714
14715#endif
14716static void
14717control_bmc_skeleton_finalize (GObject *object)
14718{
14719 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (object);
14720 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
14721 if (skeleton->priv->changed_properties_idle_source != NULL)
14722 g_source_destroy (skeleton->priv->changed_properties_idle_source);
14723 g_main_context_unref (skeleton->priv->context);
14724 g_mutex_clear (&skeleton->priv->lock);
14725 G_OBJECT_CLASS (control_bmc_skeleton_parent_class)->finalize (object);
14726}
14727
14728static void
14729control_bmc_skeleton_init (ControlBmcSkeleton *skeleton)
14730{
14731#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14732 skeleton->priv = control_bmc_skeleton_get_instance_private (skeleton);
14733#else
14734 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_BMC_SKELETON, ControlBmcSkeletonPrivate);
14735#endif
14736
14737 g_mutex_init (&skeleton->priv->lock);
14738 skeleton->priv->context = g_main_context_ref_thread_default ();
14739}
14740
14741static void
14742control_bmc_skeleton_class_init (ControlBmcSkeletonClass *klass)
14743{
14744 GObjectClass *gobject_class;
14745 GDBusInterfaceSkeletonClass *skeleton_class;
14746
14747 gobject_class = G_OBJECT_CLASS (klass);
14748 gobject_class->finalize = control_bmc_skeleton_finalize;
14749
14750 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
14751 skeleton_class->get_info = control_bmc_skeleton_dbus_interface_get_info;
14752 skeleton_class->get_properties = control_bmc_skeleton_dbus_interface_get_properties;
14753 skeleton_class->flush = control_bmc_skeleton_dbus_interface_flush;
14754 skeleton_class->get_vtable = control_bmc_skeleton_dbus_interface_get_vtable;
14755
14756#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
14757 g_type_class_add_private (klass, sizeof (ControlBmcSkeletonPrivate));
14758#endif
14759}
14760
14761static void
14762control_bmc_skeleton_iface_init (ControlBmcIface *iface)
14763{
14764}
14765
14766/**
14767 * control_bmc_skeleton_new:
14768 *
14769 * 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>.
14770 *
14771 * Returns: (transfer full) (type ControlBmcSkeleton): The skeleton object.
14772 */
14773ControlBmc *
14774control_bmc_skeleton_new (void)
14775{
14776 return CONTROL_BMC (g_object_new (TYPE_CONTROL_BMC_SKELETON, NULL));
14777}
14778
14779/* ------------------------------------------------------------------------
14780 * Code for interface org.openbmc.control.Host
14781 * ------------------------------------------------------------------------
14782 */
14783
14784/**
14785 * SECTION:ControlHost
14786 * @title: ControlHost
14787 * @short_description: Generated C code for the org.openbmc.control.Host D-Bus interface
14788 *
14789 * 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.
14790 */
14791
14792/* ---- Introspection data for org.openbmc.control.Host ---- */
14793
14794static const _ExtendedGDBusMethodInfo _control_host_method_info_boot =
14795{
14796 {
14797 -1,
14798 (gchar *) "boot",
14799 NULL,
14800 NULL,
14801 NULL
14802 },
14803 "handle-boot",
14804 FALSE
14805};
14806
14807static const _ExtendedGDBusMethodInfo _control_host_method_info_shutdown =
14808{
14809 {
14810 -1,
14811 (gchar *) "shutdown",
14812 NULL,
14813 NULL,
14814 NULL
14815 },
14816 "handle-shutdown",
14817 FALSE
14818};
14819
14820static const _ExtendedGDBusMethodInfo _control_host_method_info_reboot =
14821{
14822 {
14823 -1,
14824 (gchar *) "reboot",
14825 NULL,
14826 NULL,
14827 NULL
14828 },
14829 "handle-reboot",
14830 FALSE
14831};
14832
14833static const _ExtendedGDBusMethodInfo * const _control_host_method_info_pointers[] =
14834{
14835 &_control_host_method_info_boot,
14836 &_control_host_method_info_shutdown,
14837 &_control_host_method_info_reboot,
14838 NULL
14839};
14840
14841static const _ExtendedGDBusSignalInfo _control_host_signal_info_booted =
14842{
14843 {
14844 -1,
14845 (gchar *) "Booted",
14846 NULL,
14847 NULL
14848 },
14849 "booted"
14850};
14851
14852static const _ExtendedGDBusSignalInfo * const _control_host_signal_info_pointers[] =
14853{
14854 &_control_host_signal_info_booted,
14855 NULL
14856};
14857
14858static const _ExtendedGDBusInterfaceInfo _control_host_interface_info =
14859{
14860 {
14861 -1,
14862 (gchar *) "org.openbmc.control.Host",
14863 (GDBusMethodInfo **) &_control_host_method_info_pointers,
14864 (GDBusSignalInfo **) &_control_host_signal_info_pointers,
14865 NULL,
14866 NULL
14867 },
14868 "control-host",
14869};
14870
14871
14872/**
14873 * control_host_interface_info:
14874 *
14875 * 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.
14876 *
14877 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
14878 */
14879GDBusInterfaceInfo *
14880control_host_interface_info (void)
14881{
14882 return (GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct;
14883}
14884
14885/**
14886 * control_host_override_properties:
14887 * @klass: The class structure for a #GObject<!-- -->-derived class.
14888 * @property_id_begin: The property id to assign to the first overridden property.
14889 *
14890 * Overrides all #GObject properties in the #ControlHost interface for a concrete class.
14891 * The properties are overridden in the order they are defined.
14892 *
14893 * Returns: The last property id.
14894 */
14895guint
14896control_host_override_properties (GObjectClass *klass, guint property_id_begin)
14897{
14898 return property_id_begin - 1;
14899}
14900
14901
14902
14903/**
14904 * ControlHost:
14905 *
14906 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
14907 */
14908
14909/**
14910 * ControlHostIface:
14911 * @parent_iface: The parent interface.
14912 * @handle_boot: Handler for the #ControlHost::handle-boot signal.
14913 * @handle_reboot: Handler for the #ControlHost::handle-reboot signal.
14914 * @handle_shutdown: Handler for the #ControlHost::handle-shutdown signal.
14915 * @booted: Handler for the #ControlHost::booted signal.
14916 *
14917 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
14918 */
14919
14920typedef ControlHostIface ControlHostInterface;
14921G_DEFINE_INTERFACE (ControlHost, control_host, G_TYPE_OBJECT);
14922
14923static void
14924control_host_default_init (ControlHostIface *iface)
14925{
14926 /* GObject signals for incoming D-Bus method calls: */
14927 /**
14928 * ControlHost::handle-boot:
14929 * @object: A #ControlHost.
14930 * @invocation: A #GDBusMethodInvocation.
14931 *
14932 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method.
14933 *
14934 * 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.
14935 *
14936 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14937 */
14938 g_signal_new ("handle-boot",
14939 G_TYPE_FROM_INTERFACE (iface),
14940 G_SIGNAL_RUN_LAST,
14941 G_STRUCT_OFFSET (ControlHostIface, handle_boot),
14942 g_signal_accumulator_true_handled,
14943 NULL,
14944 g_cclosure_marshal_generic,
14945 G_TYPE_BOOLEAN,
14946 1,
14947 G_TYPE_DBUS_METHOD_INVOCATION);
14948
14949 /**
14950 * ControlHost::handle-shutdown:
14951 * @object: A #ControlHost.
14952 * @invocation: A #GDBusMethodInvocation.
14953 *
14954 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method.
14955 *
14956 * 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.
14957 *
14958 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14959 */
14960 g_signal_new ("handle-shutdown",
14961 G_TYPE_FROM_INTERFACE (iface),
14962 G_SIGNAL_RUN_LAST,
14963 G_STRUCT_OFFSET (ControlHostIface, handle_shutdown),
14964 g_signal_accumulator_true_handled,
14965 NULL,
14966 g_cclosure_marshal_generic,
14967 G_TYPE_BOOLEAN,
14968 1,
14969 G_TYPE_DBUS_METHOD_INVOCATION);
14970
14971 /**
14972 * ControlHost::handle-reboot:
14973 * @object: A #ControlHost.
14974 * @invocation: A #GDBusMethodInvocation.
14975 *
14976 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method.
14977 *
14978 * 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.
14979 *
14980 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14981 */
14982 g_signal_new ("handle-reboot",
14983 G_TYPE_FROM_INTERFACE (iface),
14984 G_SIGNAL_RUN_LAST,
14985 G_STRUCT_OFFSET (ControlHostIface, handle_reboot),
14986 g_signal_accumulator_true_handled,
14987 NULL,
14988 g_cclosure_marshal_generic,
14989 G_TYPE_BOOLEAN,
14990 1,
14991 G_TYPE_DBUS_METHOD_INVOCATION);
14992
14993 /* GObject signals for received D-Bus signals: */
14994 /**
14995 * ControlHost::booted:
14996 * @object: A #ControlHost.
14997 *
14998 * 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.
14999 *
15000 * 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.
15001 */
15002 g_signal_new ("booted",
15003 G_TYPE_FROM_INTERFACE (iface),
15004 G_SIGNAL_RUN_LAST,
15005 G_STRUCT_OFFSET (ControlHostIface, booted),
15006 NULL,
15007 NULL,
15008 g_cclosure_marshal_generic,
15009 G_TYPE_NONE,
15010 0);
15011
15012}
15013
15014/**
15015 * control_host_emit_booted:
15016 * @object: A #ControlHost.
15017 *
15018 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Host.Booted">"Booted"</link> D-Bus signal.
15019 */
15020void
15021control_host_emit_booted (
15022 ControlHost *object)
15023{
15024 g_signal_emit_by_name (object, "booted");
15025}
15026
15027/**
15028 * control_host_call_boot:
15029 * @proxy: A #ControlHostProxy.
15030 * @cancellable: (allow-none): A #GCancellable or %NULL.
15031 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
15032 * @user_data: User data to pass to @callback.
15033 *
15034 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method on @proxy.
15035 * 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.
15036 * You can then call control_host_call_boot_finish() to get the result of the operation.
15037 *
15038 * See control_host_call_boot_sync() for the synchronous, blocking version of this method.
15039 */
15040void
15041control_host_call_boot (
15042 ControlHost *proxy,
15043 GCancellable *cancellable,
15044 GAsyncReadyCallback callback,
15045 gpointer user_data)
15046{
15047 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
15048 "boot",
15049 g_variant_new ("()"),
15050 G_DBUS_CALL_FLAGS_NONE,
15051 -1,
15052 cancellable,
15053 callback,
15054 user_data);
15055}
15056
15057/**
15058 * control_host_call_boot_finish:
15059 * @proxy: A #ControlHostProxy.
15060 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_boot().
15061 * @error: Return location for error or %NULL.
15062 *
15063 * Finishes an operation started with control_host_call_boot().
15064 *
15065 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15066 */
15067gboolean
15068control_host_call_boot_finish (
15069 ControlHost *proxy,
15070 GAsyncResult *res,
15071 GError **error)
15072{
15073 GVariant *_ret;
15074 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
15075 if (_ret == NULL)
15076 goto _out;
15077 g_variant_get (_ret,
15078 "()");
15079 g_variant_unref (_ret);
15080_out:
15081 return _ret != NULL;
15082}
15083
15084/**
15085 * control_host_call_boot_sync:
15086 * @proxy: A #ControlHostProxy.
15087 * @cancellable: (allow-none): A #GCancellable or %NULL.
15088 * @error: Return location for error or %NULL.
15089 *
15090 * 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.
15091 *
15092 * See control_host_call_boot() for the asynchronous version of this method.
15093 *
15094 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15095 */
15096gboolean
15097control_host_call_boot_sync (
15098 ControlHost *proxy,
15099 GCancellable *cancellable,
15100 GError **error)
15101{
15102 GVariant *_ret;
15103 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
15104 "boot",
15105 g_variant_new ("()"),
15106 G_DBUS_CALL_FLAGS_NONE,
15107 -1,
15108 cancellable,
15109 error);
15110 if (_ret == NULL)
15111 goto _out;
15112 g_variant_get (_ret,
15113 "()");
15114 g_variant_unref (_ret);
15115_out:
15116 return _ret != NULL;
15117}
15118
15119/**
15120 * control_host_call_shutdown:
15121 * @proxy: A #ControlHostProxy.
15122 * @cancellable: (allow-none): A #GCancellable or %NULL.
15123 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
15124 * @user_data: User data to pass to @callback.
15125 *
15126 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method on @proxy.
15127 * 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.
15128 * You can then call control_host_call_shutdown_finish() to get the result of the operation.
15129 *
15130 * See control_host_call_shutdown_sync() for the synchronous, blocking version of this method.
15131 */
15132void
15133control_host_call_shutdown (
15134 ControlHost *proxy,
15135 GCancellable *cancellable,
15136 GAsyncReadyCallback callback,
15137 gpointer user_data)
15138{
15139 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
15140 "shutdown",
15141 g_variant_new ("()"),
15142 G_DBUS_CALL_FLAGS_NONE,
15143 -1,
15144 cancellable,
15145 callback,
15146 user_data);
15147}
15148
15149/**
15150 * control_host_call_shutdown_finish:
15151 * @proxy: A #ControlHostProxy.
15152 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_shutdown().
15153 * @error: Return location for error or %NULL.
15154 *
15155 * Finishes an operation started with control_host_call_shutdown().
15156 *
15157 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15158 */
15159gboolean
15160control_host_call_shutdown_finish (
15161 ControlHost *proxy,
15162 GAsyncResult *res,
15163 GError **error)
15164{
15165 GVariant *_ret;
15166 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
15167 if (_ret == NULL)
15168 goto _out;
15169 g_variant_get (_ret,
15170 "()");
15171 g_variant_unref (_ret);
15172_out:
15173 return _ret != NULL;
15174}
15175
15176/**
15177 * control_host_call_shutdown_sync:
15178 * @proxy: A #ControlHostProxy.
15179 * @cancellable: (allow-none): A #GCancellable or %NULL.
15180 * @error: Return location for error or %NULL.
15181 *
15182 * 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.
15183 *
15184 * See control_host_call_shutdown() for the asynchronous version of this method.
15185 *
15186 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15187 */
15188gboolean
15189control_host_call_shutdown_sync (
15190 ControlHost *proxy,
15191 GCancellable *cancellable,
15192 GError **error)
15193{
15194 GVariant *_ret;
15195 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
15196 "shutdown",
15197 g_variant_new ("()"),
15198 G_DBUS_CALL_FLAGS_NONE,
15199 -1,
15200 cancellable,
15201 error);
15202 if (_ret == NULL)
15203 goto _out;
15204 g_variant_get (_ret,
15205 "()");
15206 g_variant_unref (_ret);
15207_out:
15208 return _ret != NULL;
15209}
15210
15211/**
15212 * control_host_call_reboot:
15213 * @proxy: A #ControlHostProxy.
15214 * @cancellable: (allow-none): A #GCancellable or %NULL.
15215 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
15216 * @user_data: User data to pass to @callback.
15217 *
15218 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method on @proxy.
15219 * 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.
15220 * You can then call control_host_call_reboot_finish() to get the result of the operation.
15221 *
15222 * See control_host_call_reboot_sync() for the synchronous, blocking version of this method.
15223 */
15224void
15225control_host_call_reboot (
15226 ControlHost *proxy,
15227 GCancellable *cancellable,
15228 GAsyncReadyCallback callback,
15229 gpointer user_data)
15230{
15231 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
15232 "reboot",
15233 g_variant_new ("()"),
15234 G_DBUS_CALL_FLAGS_NONE,
15235 -1,
15236 cancellable,
15237 callback,
15238 user_data);
15239}
15240
15241/**
15242 * control_host_call_reboot_finish:
15243 * @proxy: A #ControlHostProxy.
15244 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_reboot().
15245 * @error: Return location for error or %NULL.
15246 *
15247 * Finishes an operation started with control_host_call_reboot().
15248 *
15249 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15250 */
15251gboolean
15252control_host_call_reboot_finish (
15253 ControlHost *proxy,
15254 GAsyncResult *res,
15255 GError **error)
15256{
15257 GVariant *_ret;
15258 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
15259 if (_ret == NULL)
15260 goto _out;
15261 g_variant_get (_ret,
15262 "()");
15263 g_variant_unref (_ret);
15264_out:
15265 return _ret != NULL;
15266}
15267
15268/**
15269 * control_host_call_reboot_sync:
15270 * @proxy: A #ControlHostProxy.
15271 * @cancellable: (allow-none): A #GCancellable or %NULL.
15272 * @error: Return location for error or %NULL.
15273 *
15274 * 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.
15275 *
15276 * See control_host_call_reboot() for the asynchronous version of this method.
15277 *
15278 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15279 */
15280gboolean
15281control_host_call_reboot_sync (
15282 ControlHost *proxy,
15283 GCancellable *cancellable,
15284 GError **error)
15285{
15286 GVariant *_ret;
15287 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
15288 "reboot",
15289 g_variant_new ("()"),
15290 G_DBUS_CALL_FLAGS_NONE,
15291 -1,
15292 cancellable,
15293 error);
15294 if (_ret == NULL)
15295 goto _out;
15296 g_variant_get (_ret,
15297 "()");
15298 g_variant_unref (_ret);
15299_out:
15300 return _ret != NULL;
15301}
15302
15303/**
15304 * control_host_complete_boot:
15305 * @object: A #ControlHost.
15306 * @invocation: (transfer full): A #GDBusMethodInvocation.
15307 *
15308 * 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.
15309 *
15310 * This method will free @invocation, you cannot use it afterwards.
15311 */
15312void
15313control_host_complete_boot (
15314 ControlHost *object,
15315 GDBusMethodInvocation *invocation)
15316{
15317 g_dbus_method_invocation_return_value (invocation,
15318 g_variant_new ("()"));
15319}
15320
15321/**
15322 * control_host_complete_shutdown:
15323 * @object: A #ControlHost.
15324 * @invocation: (transfer full): A #GDBusMethodInvocation.
15325 *
15326 * 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.
15327 *
15328 * This method will free @invocation, you cannot use it afterwards.
15329 */
15330void
15331control_host_complete_shutdown (
15332 ControlHost *object,
15333 GDBusMethodInvocation *invocation)
15334{
15335 g_dbus_method_invocation_return_value (invocation,
15336 g_variant_new ("()"));
15337}
15338
15339/**
15340 * control_host_complete_reboot:
15341 * @object: A #ControlHost.
15342 * @invocation: (transfer full): A #GDBusMethodInvocation.
15343 *
15344 * 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.
15345 *
15346 * This method will free @invocation, you cannot use it afterwards.
15347 */
15348void
15349control_host_complete_reboot (
15350 ControlHost *object,
15351 GDBusMethodInvocation *invocation)
15352{
15353 g_dbus_method_invocation_return_value (invocation,
15354 g_variant_new ("()"));
15355}
15356
15357/* ------------------------------------------------------------------------ */
15358
15359/**
15360 * ControlHostProxy:
15361 *
15362 * The #ControlHostProxy structure contains only private data and should only be accessed using the provided API.
15363 */
15364
15365/**
15366 * ControlHostProxyClass:
15367 * @parent_class: The parent class.
15368 *
15369 * Class structure for #ControlHostProxy.
15370 */
15371
15372struct _ControlHostProxyPrivate
15373{
15374 GData *qdata;
15375};
15376
15377static void control_host_proxy_iface_init (ControlHostIface *iface);
15378
15379#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15380G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
15381 G_ADD_PRIVATE (ControlHostProxy)
15382 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
15383
15384#else
15385G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
15386 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
15387
15388#endif
15389static void
15390control_host_proxy_finalize (GObject *object)
15391{
15392 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object);
15393 g_datalist_clear (&proxy->priv->qdata);
15394 G_OBJECT_CLASS (control_host_proxy_parent_class)->finalize (object);
15395}
15396
15397static void
15398control_host_proxy_get_property (GObject *object,
15399 guint prop_id,
15400 GValue *value,
15401 GParamSpec *pspec G_GNUC_UNUSED)
15402{
15403}
15404
15405static void
15406control_host_proxy_set_property (GObject *object,
15407 guint prop_id,
15408 const GValue *value,
15409 GParamSpec *pspec G_GNUC_UNUSED)
15410{
15411}
15412
15413static void
15414control_host_proxy_g_signal (GDBusProxy *proxy,
15415 const gchar *sender_name G_GNUC_UNUSED,
15416 const gchar *signal_name,
15417 GVariant *parameters)
15418{
15419 _ExtendedGDBusSignalInfo *info;
15420 GVariantIter iter;
15421 GVariant *child;
15422 GValue *paramv;
15423 guint num_params;
15424 guint n;
15425 guint signal_id;
15426 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, signal_name);
15427 if (info == NULL)
15428 return;
15429 num_params = g_variant_n_children (parameters);
15430 paramv = g_new0 (GValue, num_params + 1);
15431 g_value_init (&paramv[0], TYPE_CONTROL_HOST);
15432 g_value_set_object (&paramv[0], proxy);
15433 g_variant_iter_init (&iter, parameters);
15434 n = 1;
15435 while ((child = g_variant_iter_next_value (&iter)) != NULL)
15436 {
15437 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
15438 if (arg_info->use_gvariant)
15439 {
15440 g_value_init (&paramv[n], G_TYPE_VARIANT);
15441 g_value_set_variant (&paramv[n], child);
15442 n++;
15443 }
15444 else
15445 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
15446 g_variant_unref (child);
15447 }
15448 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
15449 g_signal_emitv (paramv, signal_id, 0, NULL);
15450 for (n = 0; n < num_params + 1; n++)
15451 g_value_unset (&paramv[n]);
15452 g_free (paramv);
15453}
15454
15455static void
15456control_host_proxy_g_properties_changed (GDBusProxy *_proxy,
15457 GVariant *changed_properties,
15458 const gchar *const *invalidated_properties)
15459{
15460 ControlHostProxy *proxy = CONTROL_HOST_PROXY (_proxy);
15461 guint n;
15462 const gchar *key;
15463 GVariantIter *iter;
15464 _ExtendedGDBusPropertyInfo *info;
15465 g_variant_get (changed_properties, "a{sv}", &iter);
15466 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
15467 {
15468 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, key);
15469 g_datalist_remove_data (&proxy->priv->qdata, key);
15470 if (info != NULL)
15471 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
15472 }
15473 g_variant_iter_free (iter);
15474 for (n = 0; invalidated_properties[n] != NULL; n++)
15475 {
15476 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, invalidated_properties[n]);
15477 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
15478 if (info != NULL)
15479 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
15480 }
15481}
15482
15483static void
15484control_host_proxy_init (ControlHostProxy *proxy)
15485{
15486#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15487 proxy->priv = control_host_proxy_get_instance_private (proxy);
15488#else
15489 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_HOST_PROXY, ControlHostProxyPrivate);
15490#endif
15491
15492 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_host_interface_info ());
15493}
15494
15495static void
15496control_host_proxy_class_init (ControlHostProxyClass *klass)
15497{
15498 GObjectClass *gobject_class;
15499 GDBusProxyClass *proxy_class;
15500
15501 gobject_class = G_OBJECT_CLASS (klass);
15502 gobject_class->finalize = control_host_proxy_finalize;
15503 gobject_class->get_property = control_host_proxy_get_property;
15504 gobject_class->set_property = control_host_proxy_set_property;
15505
15506 proxy_class = G_DBUS_PROXY_CLASS (klass);
15507 proxy_class->g_signal = control_host_proxy_g_signal;
15508 proxy_class->g_properties_changed = control_host_proxy_g_properties_changed;
15509
15510#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
15511 g_type_class_add_private (klass, sizeof (ControlHostProxyPrivate));
15512#endif
15513}
15514
15515static void
15516control_host_proxy_iface_init (ControlHostIface *iface)
15517{
15518}
15519
15520/**
15521 * control_host_proxy_new:
15522 * @connection: A #GDBusConnection.
15523 * @flags: Flags from the #GDBusProxyFlags enumeration.
15524 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
15525 * @object_path: An object path.
15526 * @cancellable: (allow-none): A #GCancellable or %NULL.
15527 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
15528 * @user_data: User data to pass to @callback.
15529 *
15530 * 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.
15531 *
15532 * 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.
15533 * You can then call control_host_proxy_new_finish() to get the result of the operation.
15534 *
15535 * See control_host_proxy_new_sync() for the synchronous, blocking version of this constructor.
15536 */
15537void
15538control_host_proxy_new (
15539 GDBusConnection *connection,
15540 GDBusProxyFlags flags,
15541 const gchar *name,
15542 const gchar *object_path,
15543 GCancellable *cancellable,
15544 GAsyncReadyCallback callback,
15545 gpointer user_data)
15546{
15547 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);
15548}
15549
15550/**
15551 * control_host_proxy_new_finish:
15552 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new().
15553 * @error: Return location for error or %NULL
15554 *
15555 * Finishes an operation started with control_host_proxy_new().
15556 *
15557 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
15558 */
15559ControlHost *
15560control_host_proxy_new_finish (
15561 GAsyncResult *res,
15562 GError **error)
15563{
15564 GObject *ret;
15565 GObject *source_object;
15566 source_object = g_async_result_get_source_object (res);
15567 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
15568 g_object_unref (source_object);
15569 if (ret != NULL)
15570 return CONTROL_HOST (ret);
15571 else
15572 return NULL;
15573}
15574
15575/**
15576 * control_host_proxy_new_sync:
15577 * @connection: A #GDBusConnection.
15578 * @flags: Flags from the #GDBusProxyFlags enumeration.
15579 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
15580 * @object_path: An object path.
15581 * @cancellable: (allow-none): A #GCancellable or %NULL.
15582 * @error: Return location for error or %NULL
15583 *
15584 * 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.
15585 *
15586 * The calling thread is blocked until a reply is received.
15587 *
15588 * See control_host_proxy_new() for the asynchronous version of this constructor.
15589 *
15590 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
15591 */
15592ControlHost *
15593control_host_proxy_new_sync (
15594 GDBusConnection *connection,
15595 GDBusProxyFlags flags,
15596 const gchar *name,
15597 const gchar *object_path,
15598 GCancellable *cancellable,
15599 GError **error)
15600{
15601 GInitable *ret;
15602 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);
15603 if (ret != NULL)
15604 return CONTROL_HOST (ret);
15605 else
15606 return NULL;
15607}
15608
15609
15610/**
15611 * control_host_proxy_new_for_bus:
15612 * @bus_type: A #GBusType.
15613 * @flags: Flags from the #GDBusProxyFlags enumeration.
15614 * @name: A bus name (well-known or unique).
15615 * @object_path: An object path.
15616 * @cancellable: (allow-none): A #GCancellable or %NULL.
15617 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
15618 * @user_data: User data to pass to @callback.
15619 *
15620 * Like control_host_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
15621 *
15622 * 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.
15623 * You can then call control_host_proxy_new_for_bus_finish() to get the result of the operation.
15624 *
15625 * See control_host_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
15626 */
15627void
15628control_host_proxy_new_for_bus (
15629 GBusType bus_type,
15630 GDBusProxyFlags flags,
15631 const gchar *name,
15632 const gchar *object_path,
15633 GCancellable *cancellable,
15634 GAsyncReadyCallback callback,
15635 gpointer user_data)
15636{
15637 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);
15638}
15639
15640/**
15641 * control_host_proxy_new_for_bus_finish:
15642 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new_for_bus().
15643 * @error: Return location for error or %NULL
15644 *
15645 * Finishes an operation started with control_host_proxy_new_for_bus().
15646 *
15647 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
15648 */
15649ControlHost *
15650control_host_proxy_new_for_bus_finish (
15651 GAsyncResult *res,
15652 GError **error)
15653{
15654 GObject *ret;
15655 GObject *source_object;
15656 source_object = g_async_result_get_source_object (res);
15657 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
15658 g_object_unref (source_object);
15659 if (ret != NULL)
15660 return CONTROL_HOST (ret);
15661 else
15662 return NULL;
15663}
15664
15665/**
15666 * control_host_proxy_new_for_bus_sync:
15667 * @bus_type: A #GBusType.
15668 * @flags: Flags from the #GDBusProxyFlags enumeration.
15669 * @name: A bus name (well-known or unique).
15670 * @object_path: An object path.
15671 * @cancellable: (allow-none): A #GCancellable or %NULL.
15672 * @error: Return location for error or %NULL
15673 *
15674 * Like control_host_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
15675 *
15676 * The calling thread is blocked until a reply is received.
15677 *
15678 * See control_host_proxy_new_for_bus() for the asynchronous version of this constructor.
15679 *
15680 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
15681 */
15682ControlHost *
15683control_host_proxy_new_for_bus_sync (
15684 GBusType bus_type,
15685 GDBusProxyFlags flags,
15686 const gchar *name,
15687 const gchar *object_path,
15688 GCancellable *cancellable,
15689 GError **error)
15690{
15691 GInitable *ret;
15692 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);
15693 if (ret != NULL)
15694 return CONTROL_HOST (ret);
15695 else
15696 return NULL;
15697}
15698
15699
15700/* ------------------------------------------------------------------------ */
15701
15702/**
15703 * ControlHostSkeleton:
15704 *
15705 * The #ControlHostSkeleton structure contains only private data and should only be accessed using the provided API.
15706 */
15707
15708/**
15709 * ControlHostSkeletonClass:
15710 * @parent_class: The parent class.
15711 *
15712 * Class structure for #ControlHostSkeleton.
15713 */
15714
15715struct _ControlHostSkeletonPrivate
15716{
15717 GValue *properties;
15718 GList *changed_properties;
15719 GSource *changed_properties_idle_source;
15720 GMainContext *context;
15721 GMutex lock;
15722};
15723
15724static void
15725_control_host_skeleton_handle_method_call (
15726 GDBusConnection *connection G_GNUC_UNUSED,
15727 const gchar *sender G_GNUC_UNUSED,
15728 const gchar *object_path G_GNUC_UNUSED,
15729 const gchar *interface_name,
15730 const gchar *method_name,
15731 GVariant *parameters,
15732 GDBusMethodInvocation *invocation,
15733 gpointer user_data)
15734{
15735 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
15736 _ExtendedGDBusMethodInfo *info;
15737 GVariantIter iter;
15738 GVariant *child;
15739 GValue *paramv;
15740 guint num_params;
15741 guint num_extra;
15742 guint n;
15743 guint signal_id;
15744 GValue return_value = G_VALUE_INIT;
15745 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
15746 g_assert (info != NULL);
15747 num_params = g_variant_n_children (parameters);
15748 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
15749 n = 0;
15750 g_value_init (&paramv[n], TYPE_CONTROL_HOST);
15751 g_value_set_object (&paramv[n++], skeleton);
15752 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
15753 g_value_set_object (&paramv[n++], invocation);
15754 if (info->pass_fdlist)
15755 {
15756#ifdef G_OS_UNIX
15757 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
15758 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
15759#else
15760 g_assert_not_reached ();
15761#endif
15762 }
15763 g_variant_iter_init (&iter, parameters);
15764 while ((child = g_variant_iter_next_value (&iter)) != NULL)
15765 {
15766 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
15767 if (arg_info->use_gvariant)
15768 {
15769 g_value_init (&paramv[n], G_TYPE_VARIANT);
15770 g_value_set_variant (&paramv[n], child);
15771 n++;
15772 }
15773 else
15774 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
15775 g_variant_unref (child);
15776 }
15777 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
15778 g_value_init (&return_value, G_TYPE_BOOLEAN);
15779 g_signal_emitv (paramv, signal_id, 0, &return_value);
15780 if (!g_value_get_boolean (&return_value))
15781 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);
15782 g_value_unset (&return_value);
15783 for (n = 0; n < num_params + num_extra; n++)
15784 g_value_unset (&paramv[n]);
15785 g_free (paramv);
15786}
15787
15788static GVariant *
15789_control_host_skeleton_handle_get_property (
15790 GDBusConnection *connection G_GNUC_UNUSED,
15791 const gchar *sender G_GNUC_UNUSED,
15792 const gchar *object_path G_GNUC_UNUSED,
15793 const gchar *interface_name G_GNUC_UNUSED,
15794 const gchar *property_name,
15795 GError **error,
15796 gpointer user_data)
15797{
15798 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
15799 GValue value = G_VALUE_INIT;
15800 GParamSpec *pspec;
15801 _ExtendedGDBusPropertyInfo *info;
15802 GVariant *ret;
15803 ret = NULL;
15804 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
15805 g_assert (info != NULL);
15806 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
15807 if (pspec == NULL)
15808 {
15809 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
15810 }
15811 else
15812 {
15813 g_value_init (&value, pspec->value_type);
15814 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
15815 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
15816 g_value_unset (&value);
15817 }
15818 return ret;
15819}
15820
15821static gboolean
15822_control_host_skeleton_handle_set_property (
15823 GDBusConnection *connection G_GNUC_UNUSED,
15824 const gchar *sender G_GNUC_UNUSED,
15825 const gchar *object_path G_GNUC_UNUSED,
15826 const gchar *interface_name G_GNUC_UNUSED,
15827 const gchar *property_name,
15828 GVariant *variant,
15829 GError **error,
15830 gpointer user_data)
15831{
15832 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
15833 GValue value = G_VALUE_INIT;
15834 GParamSpec *pspec;
15835 _ExtendedGDBusPropertyInfo *info;
15836 gboolean ret;
15837 ret = FALSE;
15838 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
15839 g_assert (info != NULL);
15840 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
15841 if (pspec == NULL)
15842 {
15843 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
15844 }
15845 else
15846 {
15847 if (info->use_gvariant)
15848 g_value_set_variant (&value, variant);
15849 else
15850 g_dbus_gvariant_to_gvalue (variant, &value);
15851 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
15852 g_value_unset (&value);
15853 ret = TRUE;
15854 }
15855 return ret;
15856}
15857
15858static const GDBusInterfaceVTable _control_host_skeleton_vtable =
15859{
15860 _control_host_skeleton_handle_method_call,
15861 _control_host_skeleton_handle_get_property,
15862 _control_host_skeleton_handle_set_property,
15863 {NULL}
15864};
15865
15866static GDBusInterfaceInfo *
15867control_host_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
15868{
15869 return control_host_interface_info ();
15870}
15871
15872static GDBusInterfaceVTable *
15873control_host_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
15874{
15875 return (GDBusInterfaceVTable *) &_control_host_skeleton_vtable;
15876}
15877
15878static GVariant *
15879control_host_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
15880{
15881 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton);
15882
15883 GVariantBuilder builder;
15884 guint n;
15885 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
15886 if (_control_host_interface_info.parent_struct.properties == NULL)
15887 goto out;
15888 for (n = 0; _control_host_interface_info.parent_struct.properties[n] != NULL; n++)
15889 {
15890 GDBusPropertyInfo *info = _control_host_interface_info.parent_struct.properties[n];
15891 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
15892 {
15893 GVariant *value;
15894 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);
15895 if (value != NULL)
15896 {
15897 g_variant_take_ref (value);
15898 g_variant_builder_add (&builder, "{sv}", info->name, value);
15899 g_variant_unref (value);
15900 }
15901 }
15902 }
15903out:
15904 return g_variant_builder_end (&builder);
15905}
15906
15907static void
15908control_host_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
15909{
15910}
15911
15912static void
15913_control_host_on_signal_booted (
15914 ControlHost *object)
15915{
15916 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
15917
15918 GList *connections, *l;
15919 GVariant *signal_variant;
15920 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
15921
15922 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
15923 for (l = connections; l != NULL; l = l->next)
15924 {
15925 GDBusConnection *connection = l->data;
15926 g_dbus_connection_emit_signal (connection,
15927 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Host", "Booted",
15928 signal_variant, NULL);
15929 }
15930 g_variant_unref (signal_variant);
15931 g_list_free_full (connections, g_object_unref);
15932}
15933
15934static void control_host_skeleton_iface_init (ControlHostIface *iface);
15935#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15936G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
15937 G_ADD_PRIVATE (ControlHostSkeleton)
15938 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
15939
15940#else
15941G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
15942 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
15943
15944#endif
15945static void
15946control_host_skeleton_finalize (GObject *object)
15947{
15948 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
15949 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
15950 if (skeleton->priv->changed_properties_idle_source != NULL)
15951 g_source_destroy (skeleton->priv->changed_properties_idle_source);
15952 g_main_context_unref (skeleton->priv->context);
15953 g_mutex_clear (&skeleton->priv->lock);
15954 G_OBJECT_CLASS (control_host_skeleton_parent_class)->finalize (object);
15955}
15956
15957static void
15958control_host_skeleton_init (ControlHostSkeleton *skeleton)
15959{
15960#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15961 skeleton->priv = control_host_skeleton_get_instance_private (skeleton);
15962#else
15963 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_HOST_SKELETON, ControlHostSkeletonPrivate);
15964#endif
15965
15966 g_mutex_init (&skeleton->priv->lock);
15967 skeleton->priv->context = g_main_context_ref_thread_default ();
15968}
15969
15970static void
15971control_host_skeleton_class_init (ControlHostSkeletonClass *klass)
15972{
15973 GObjectClass *gobject_class;
15974 GDBusInterfaceSkeletonClass *skeleton_class;
15975
15976 gobject_class = G_OBJECT_CLASS (klass);
15977 gobject_class->finalize = control_host_skeleton_finalize;
15978
15979 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
15980 skeleton_class->get_info = control_host_skeleton_dbus_interface_get_info;
15981 skeleton_class->get_properties = control_host_skeleton_dbus_interface_get_properties;
15982 skeleton_class->flush = control_host_skeleton_dbus_interface_flush;
15983 skeleton_class->get_vtable = control_host_skeleton_dbus_interface_get_vtable;
15984
15985#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
15986 g_type_class_add_private (klass, sizeof (ControlHostSkeletonPrivate));
15987#endif
15988}
15989
15990static void
15991control_host_skeleton_iface_init (ControlHostIface *iface)
15992{
15993 iface->booted = _control_host_on_signal_booted;
15994}
15995
15996/**
15997 * control_host_skeleton_new:
15998 *
15999 * 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>.
16000 *
16001 * Returns: (transfer full) (type ControlHostSkeleton): The skeleton object.
16002 */
16003ControlHost *
16004control_host_skeleton_new (void)
16005{
16006 return CONTROL_HOST (g_object_new (TYPE_CONTROL_HOST_SKELETON, NULL));
16007}
16008
16009/* ------------------------------------------------------------------------
16010 * Code for interface org.openbmc.control.Power
16011 * ------------------------------------------------------------------------
16012 */
16013
16014/**
16015 * SECTION:ControlPower
16016 * @title: ControlPower
16017 * @short_description: Generated C code for the org.openbmc.control.Power D-Bus interface
16018 *
16019 * 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.
16020 */
16021
16022/* ---- Introspection data for org.openbmc.control.Power ---- */
16023
16024static const _ExtendedGDBusArgInfo _control_power_method_info_set_power_state_IN_ARG_state =
16025{
16026 {
16027 -1,
16028 (gchar *) "state",
16029 (gchar *) "i",
16030 NULL
16031 },
16032 FALSE
16033};
16034
16035static const _ExtendedGDBusArgInfo * const _control_power_method_info_set_power_state_IN_ARG_pointers[] =
16036{
16037 &_control_power_method_info_set_power_state_IN_ARG_state,
16038 NULL
16039};
16040
16041static const _ExtendedGDBusMethodInfo _control_power_method_info_set_power_state =
16042{
16043 {
16044 -1,
16045 (gchar *) "setPowerState",
16046 (GDBusArgInfo **) &_control_power_method_info_set_power_state_IN_ARG_pointers,
16047 NULL,
16048 NULL
16049 },
16050 "handle-set-power-state",
16051 FALSE
16052};
16053
16054static const _ExtendedGDBusArgInfo _control_power_method_info_get_power_state_OUT_ARG_state =
16055{
16056 {
16057 -1,
16058 (gchar *) "state",
16059 (gchar *) "i",
16060 NULL
16061 },
16062 FALSE
16063};
16064
16065static const _ExtendedGDBusArgInfo * const _control_power_method_info_get_power_state_OUT_ARG_pointers[] =
16066{
16067 &_control_power_method_info_get_power_state_OUT_ARG_state,
16068 NULL
16069};
16070
16071static const _ExtendedGDBusMethodInfo _control_power_method_info_get_power_state =
16072{
16073 {
16074 -1,
16075 (gchar *) "getPowerState",
16076 NULL,
16077 (GDBusArgInfo **) &_control_power_method_info_get_power_state_OUT_ARG_pointers,
16078 NULL
16079 },
16080 "handle-get-power-state",
16081 FALSE
16082};
16083
16084static const _ExtendedGDBusMethodInfo * const _control_power_method_info_pointers[] =
16085{
16086 &_control_power_method_info_set_power_state,
16087 &_control_power_method_info_get_power_state,
16088 NULL
16089};
16090
16091static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_good =
16092{
16093 {
16094 -1,
16095 (gchar *) "PowerGood",
16096 NULL,
16097 NULL
16098 },
16099 "power-good"
16100};
16101
16102static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_lost =
16103{
16104 {
16105 -1,
16106 (gchar *) "PowerLost",
16107 NULL,
16108 NULL
16109 },
16110 "power-lost"
16111};
16112
16113static const _ExtendedGDBusSignalInfo * const _control_power_signal_info_pointers[] =
16114{
16115 &_control_power_signal_info_power_good,
16116 &_control_power_signal_info_power_lost,
16117 NULL
16118};
16119
16120static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood =
16121{
16122 {
16123 -1,
16124 (gchar *) "pgood",
16125 (gchar *) "i",
16126 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
16127 NULL
16128 },
16129 "pgood",
16130 FALSE
16131};
16132
16133static const _ExtendedGDBusPropertyInfo _control_power_property_info_state =
16134{
16135 {
16136 -1,
16137 (gchar *) "state",
16138 (gchar *) "i",
16139 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
16140 NULL
16141 },
16142 "state",
16143 FALSE
16144};
16145
Norman James32e74e22015-09-15 21:28:06 -050016146static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood_timeout =
16147{
16148 {
16149 -1,
16150 (gchar *) "pgood_timeout",
16151 (gchar *) "i",
16152 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
16153 NULL
16154 },
16155 "pgood-timeout",
16156 FALSE
16157};
16158
Norman James362a80f2015-09-14 14:04:39 -050016159static const _ExtendedGDBusPropertyInfo * const _control_power_property_info_pointers[] =
16160{
16161 &_control_power_property_info_pgood,
16162 &_control_power_property_info_state,
Norman James32e74e22015-09-15 21:28:06 -050016163 &_control_power_property_info_pgood_timeout,
Norman James362a80f2015-09-14 14:04:39 -050016164 NULL
16165};
16166
16167static const _ExtendedGDBusInterfaceInfo _control_power_interface_info =
16168{
16169 {
16170 -1,
16171 (gchar *) "org.openbmc.control.Power",
16172 (GDBusMethodInfo **) &_control_power_method_info_pointers,
16173 (GDBusSignalInfo **) &_control_power_signal_info_pointers,
16174 (GDBusPropertyInfo **) &_control_power_property_info_pointers,
16175 NULL
16176 },
16177 "control-power",
16178};
16179
16180
16181/**
16182 * control_power_interface_info:
16183 *
16184 * 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.
16185 *
16186 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
16187 */
16188GDBusInterfaceInfo *
16189control_power_interface_info (void)
16190{
16191 return (GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct;
16192}
16193
16194/**
16195 * control_power_override_properties:
16196 * @klass: The class structure for a #GObject<!-- -->-derived class.
16197 * @property_id_begin: The property id to assign to the first overridden property.
16198 *
16199 * Overrides all #GObject properties in the #ControlPower interface for a concrete class.
16200 * The properties are overridden in the order they are defined.
16201 *
16202 * Returns: The last property id.
16203 */
16204guint
16205control_power_override_properties (GObjectClass *klass, guint property_id_begin)
16206{
16207 g_object_class_override_property (klass, property_id_begin++, "pgood");
16208 g_object_class_override_property (klass, property_id_begin++, "state");
Norman James32e74e22015-09-15 21:28:06 -050016209 g_object_class_override_property (klass, property_id_begin++, "pgood-timeout");
Norman James362a80f2015-09-14 14:04:39 -050016210 return property_id_begin - 1;
16211}
16212
16213
16214
16215/**
16216 * ControlPower:
16217 *
16218 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
16219 */
16220
16221/**
16222 * ControlPowerIface:
16223 * @parent_iface: The parent interface.
16224 * @handle_get_power_state: Handler for the #ControlPower::handle-get-power-state signal.
16225 * @handle_set_power_state: Handler for the #ControlPower::handle-set-power-state signal.
16226 * @get_pgood: Getter for the #ControlPower:pgood property.
Norman James32e74e22015-09-15 21:28:06 -050016227 * @get_pgood_timeout: Getter for the #ControlPower:pgood-timeout property.
Norman James362a80f2015-09-14 14:04:39 -050016228 * @get_state: Getter for the #ControlPower:state property.
16229 * @power_good: Handler for the #ControlPower::power-good signal.
16230 * @power_lost: Handler for the #ControlPower::power-lost signal.
16231 *
16232 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
16233 */
16234
16235typedef ControlPowerIface ControlPowerInterface;
16236G_DEFINE_INTERFACE (ControlPower, control_power, G_TYPE_OBJECT);
16237
16238static void
16239control_power_default_init (ControlPowerIface *iface)
16240{
16241 /* GObject signals for incoming D-Bus method calls: */
16242 /**
16243 * ControlPower::handle-set-power-state:
16244 * @object: A #ControlPower.
16245 * @invocation: A #GDBusMethodInvocation.
16246 * @arg_state: Argument passed by remote caller.
16247 *
16248 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method.
16249 *
16250 * 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.
16251 *
16252 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
16253 */
16254 g_signal_new ("handle-set-power-state",
16255 G_TYPE_FROM_INTERFACE (iface),
16256 G_SIGNAL_RUN_LAST,
16257 G_STRUCT_OFFSET (ControlPowerIface, handle_set_power_state),
16258 g_signal_accumulator_true_handled,
16259 NULL,
16260 g_cclosure_marshal_generic,
16261 G_TYPE_BOOLEAN,
16262 2,
16263 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
16264
16265 /**
16266 * ControlPower::handle-get-power-state:
16267 * @object: A #ControlPower.
16268 * @invocation: A #GDBusMethodInvocation.
16269 *
16270 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method.
16271 *
16272 * 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.
16273 *
16274 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
16275 */
16276 g_signal_new ("handle-get-power-state",
16277 G_TYPE_FROM_INTERFACE (iface),
16278 G_SIGNAL_RUN_LAST,
16279 G_STRUCT_OFFSET (ControlPowerIface, handle_get_power_state),
16280 g_signal_accumulator_true_handled,
16281 NULL,
16282 g_cclosure_marshal_generic,
16283 G_TYPE_BOOLEAN,
16284 1,
16285 G_TYPE_DBUS_METHOD_INVOCATION);
16286
16287 /* GObject signals for received D-Bus signals: */
16288 /**
16289 * ControlPower::power-good:
16290 * @object: A #ControlPower.
16291 *
16292 * 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.
16293 *
16294 * 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.
16295 */
16296 g_signal_new ("power-good",
16297 G_TYPE_FROM_INTERFACE (iface),
16298 G_SIGNAL_RUN_LAST,
16299 G_STRUCT_OFFSET (ControlPowerIface, power_good),
16300 NULL,
16301 NULL,
16302 g_cclosure_marshal_generic,
16303 G_TYPE_NONE,
16304 0);
16305
16306 /**
16307 * ControlPower::power-lost:
16308 * @object: A #ControlPower.
16309 *
16310 * 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.
16311 *
16312 * 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.
16313 */
16314 g_signal_new ("power-lost",
16315 G_TYPE_FROM_INTERFACE (iface),
16316 G_SIGNAL_RUN_LAST,
16317 G_STRUCT_OFFSET (ControlPowerIface, power_lost),
16318 NULL,
16319 NULL,
16320 g_cclosure_marshal_generic,
16321 G_TYPE_NONE,
16322 0);
16323
16324 /* GObject properties for D-Bus properties: */
16325 /**
16326 * ControlPower:pgood:
16327 *
16328 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link>.
16329 *
16330 * 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.
16331 */
16332 g_object_interface_install_property (iface,
16333 g_param_spec_int ("pgood", "pgood", "pgood", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
16334 /**
16335 * ControlPower:state:
16336 *
16337 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link>.
16338 *
16339 * 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.
16340 */
16341 g_object_interface_install_property (iface,
16342 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 -050016343 /**
16344 * ControlPower:pgood-timeout:
16345 *
16346 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link>.
16347 *
16348 * 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.
16349 */
16350 g_object_interface_install_property (iface,
16351 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 -050016352}
16353
16354/**
16355 * control_power_get_pgood: (skip)
16356 * @object: A #ControlPower.
16357 *
16358 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property.
16359 *
16360 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
16361 *
16362 * Returns: The property value.
16363 */
16364gint
16365control_power_get_pgood (ControlPower *object)
16366{
16367 return CONTROL_POWER_GET_IFACE (object)->get_pgood (object);
16368}
16369
16370/**
16371 * control_power_set_pgood: (skip)
16372 * @object: A #ControlPower.
16373 * @value: The value to set.
16374 *
16375 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property to @value.
16376 *
16377 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
16378 */
16379void
16380control_power_set_pgood (ControlPower *object, gint value)
16381{
16382 g_object_set (G_OBJECT (object), "pgood", value, NULL);
16383}
16384
16385/**
16386 * control_power_get_state: (skip)
16387 * @object: A #ControlPower.
16388 *
16389 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property.
16390 *
16391 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
16392 *
16393 * Returns: The property value.
16394 */
16395gint
16396control_power_get_state (ControlPower *object)
16397{
16398 return CONTROL_POWER_GET_IFACE (object)->get_state (object);
16399}
16400
16401/**
16402 * control_power_set_state: (skip)
16403 * @object: A #ControlPower.
16404 * @value: The value to set.
16405 *
16406 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property to @value.
16407 *
16408 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
16409 */
16410void
16411control_power_set_state (ControlPower *object, gint value)
16412{
16413 g_object_set (G_OBJECT (object), "state", value, NULL);
16414}
16415
16416/**
Norman James32e74e22015-09-15 21:28:06 -050016417 * control_power_get_pgood_timeout: (skip)
16418 * @object: A #ControlPower.
16419 *
16420 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property.
16421 *
16422 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
16423 *
16424 * Returns: The property value.
16425 */
16426gint
16427control_power_get_pgood_timeout (ControlPower *object)
16428{
16429 return CONTROL_POWER_GET_IFACE (object)->get_pgood_timeout (object);
16430}
16431
16432/**
16433 * control_power_set_pgood_timeout: (skip)
16434 * @object: A #ControlPower.
16435 * @value: The value to set.
16436 *
16437 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property to @value.
16438 *
16439 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
16440 */
16441void
16442control_power_set_pgood_timeout (ControlPower *object, gint value)
16443{
16444 g_object_set (G_OBJECT (object), "pgood-timeout", value, NULL);
16445}
16446
16447/**
Norman James362a80f2015-09-14 14:04:39 -050016448 * control_power_emit_power_good:
16449 * @object: A #ControlPower.
16450 *
16451 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerGood">"PowerGood"</link> D-Bus signal.
16452 */
16453void
16454control_power_emit_power_good (
16455 ControlPower *object)
16456{
16457 g_signal_emit_by_name (object, "power-good");
16458}
16459
16460/**
16461 * control_power_emit_power_lost:
16462 * @object: A #ControlPower.
16463 *
16464 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerLost">"PowerLost"</link> D-Bus signal.
16465 */
16466void
16467control_power_emit_power_lost (
16468 ControlPower *object)
16469{
16470 g_signal_emit_by_name (object, "power-lost");
16471}
16472
16473/**
16474 * control_power_call_set_power_state:
16475 * @proxy: A #ControlPowerProxy.
16476 * @arg_state: Argument to pass with the method invocation.
16477 * @cancellable: (allow-none): A #GCancellable or %NULL.
16478 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
16479 * @user_data: User data to pass to @callback.
16480 *
16481 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method on @proxy.
16482 * 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.
16483 * You can then call control_power_call_set_power_state_finish() to get the result of the operation.
16484 *
16485 * See control_power_call_set_power_state_sync() for the synchronous, blocking version of this method.
16486 */
16487void
16488control_power_call_set_power_state (
16489 ControlPower *proxy,
16490 gint arg_state,
16491 GCancellable *cancellable,
16492 GAsyncReadyCallback callback,
16493 gpointer user_data)
16494{
16495 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
16496 "setPowerState",
16497 g_variant_new ("(i)",
16498 arg_state),
16499 G_DBUS_CALL_FLAGS_NONE,
16500 -1,
16501 cancellable,
16502 callback,
16503 user_data);
16504}
16505
16506/**
16507 * control_power_call_set_power_state_finish:
16508 * @proxy: A #ControlPowerProxy.
16509 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_set_power_state().
16510 * @error: Return location for error or %NULL.
16511 *
16512 * Finishes an operation started with control_power_call_set_power_state().
16513 *
16514 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16515 */
16516gboolean
16517control_power_call_set_power_state_finish (
16518 ControlPower *proxy,
16519 GAsyncResult *res,
16520 GError **error)
16521{
16522 GVariant *_ret;
16523 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
16524 if (_ret == NULL)
16525 goto _out;
16526 g_variant_get (_ret,
16527 "()");
16528 g_variant_unref (_ret);
16529_out:
16530 return _ret != NULL;
16531}
16532
16533/**
16534 * control_power_call_set_power_state_sync:
16535 * @proxy: A #ControlPowerProxy.
16536 * @arg_state: Argument to pass with the method invocation.
16537 * @cancellable: (allow-none): A #GCancellable or %NULL.
16538 * @error: Return location for error or %NULL.
16539 *
16540 * 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.
16541 *
16542 * See control_power_call_set_power_state() for the asynchronous version of this method.
16543 *
16544 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16545 */
16546gboolean
16547control_power_call_set_power_state_sync (
16548 ControlPower *proxy,
16549 gint arg_state,
16550 GCancellable *cancellable,
16551 GError **error)
16552{
16553 GVariant *_ret;
16554 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
16555 "setPowerState",
16556 g_variant_new ("(i)",
16557 arg_state),
16558 G_DBUS_CALL_FLAGS_NONE,
16559 -1,
16560 cancellable,
16561 error);
16562 if (_ret == NULL)
16563 goto _out;
16564 g_variant_get (_ret,
16565 "()");
16566 g_variant_unref (_ret);
16567_out:
16568 return _ret != NULL;
16569}
16570
16571/**
16572 * control_power_call_get_power_state:
16573 * @proxy: A #ControlPowerProxy.
16574 * @cancellable: (allow-none): A #GCancellable or %NULL.
16575 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
16576 * @user_data: User data to pass to @callback.
16577 *
16578 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method on @proxy.
16579 * 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.
16580 * You can then call control_power_call_get_power_state_finish() to get the result of the operation.
16581 *
16582 * See control_power_call_get_power_state_sync() for the synchronous, blocking version of this method.
16583 */
16584void
16585control_power_call_get_power_state (
16586 ControlPower *proxy,
16587 GCancellable *cancellable,
16588 GAsyncReadyCallback callback,
16589 gpointer user_data)
16590{
16591 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
16592 "getPowerState",
16593 g_variant_new ("()"),
16594 G_DBUS_CALL_FLAGS_NONE,
16595 -1,
16596 cancellable,
16597 callback,
16598 user_data);
16599}
16600
16601/**
16602 * control_power_call_get_power_state_finish:
16603 * @proxy: A #ControlPowerProxy.
16604 * @out_state: (out): Return location for return parameter or %NULL to ignore.
16605 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_get_power_state().
16606 * @error: Return location for error or %NULL.
16607 *
16608 * Finishes an operation started with control_power_call_get_power_state().
16609 *
16610 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16611 */
16612gboolean
16613control_power_call_get_power_state_finish (
16614 ControlPower *proxy,
16615 gint *out_state,
16616 GAsyncResult *res,
16617 GError **error)
16618{
16619 GVariant *_ret;
16620 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
16621 if (_ret == NULL)
16622 goto _out;
16623 g_variant_get (_ret,
16624 "(i)",
16625 out_state);
16626 g_variant_unref (_ret);
16627_out:
16628 return _ret != NULL;
16629}
16630
16631/**
16632 * control_power_call_get_power_state_sync:
16633 * @proxy: A #ControlPowerProxy.
16634 * @out_state: (out): Return location for return parameter or %NULL to ignore.
16635 * @cancellable: (allow-none): A #GCancellable or %NULL.
16636 * @error: Return location for error or %NULL.
16637 *
16638 * 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.
16639 *
16640 * See control_power_call_get_power_state() for the asynchronous version of this method.
16641 *
16642 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16643 */
16644gboolean
16645control_power_call_get_power_state_sync (
16646 ControlPower *proxy,
16647 gint *out_state,
16648 GCancellable *cancellable,
16649 GError **error)
16650{
16651 GVariant *_ret;
16652 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
16653 "getPowerState",
16654 g_variant_new ("()"),
16655 G_DBUS_CALL_FLAGS_NONE,
16656 -1,
16657 cancellable,
16658 error);
16659 if (_ret == NULL)
16660 goto _out;
16661 g_variant_get (_ret,
16662 "(i)",
16663 out_state);
16664 g_variant_unref (_ret);
16665_out:
16666 return _ret != NULL;
16667}
16668
16669/**
16670 * control_power_complete_set_power_state:
16671 * @object: A #ControlPower.
16672 * @invocation: (transfer full): A #GDBusMethodInvocation.
16673 *
16674 * 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.
16675 *
16676 * This method will free @invocation, you cannot use it afterwards.
16677 */
16678void
16679control_power_complete_set_power_state (
16680 ControlPower *object,
16681 GDBusMethodInvocation *invocation)
16682{
16683 g_dbus_method_invocation_return_value (invocation,
16684 g_variant_new ("()"));
16685}
16686
16687/**
16688 * control_power_complete_get_power_state:
16689 * @object: A #ControlPower.
16690 * @invocation: (transfer full): A #GDBusMethodInvocation.
16691 * @state: Parameter to return.
16692 *
16693 * 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.
16694 *
16695 * This method will free @invocation, you cannot use it afterwards.
16696 */
16697void
16698control_power_complete_get_power_state (
16699 ControlPower *object,
16700 GDBusMethodInvocation *invocation,
16701 gint state)
16702{
16703 g_dbus_method_invocation_return_value (invocation,
16704 g_variant_new ("(i)",
16705 state));
16706}
16707
16708/* ------------------------------------------------------------------------ */
16709
16710/**
16711 * ControlPowerProxy:
16712 *
16713 * The #ControlPowerProxy structure contains only private data and should only be accessed using the provided API.
16714 */
16715
16716/**
16717 * ControlPowerProxyClass:
16718 * @parent_class: The parent class.
16719 *
16720 * Class structure for #ControlPowerProxy.
16721 */
16722
16723struct _ControlPowerProxyPrivate
16724{
16725 GData *qdata;
16726};
16727
16728static void control_power_proxy_iface_init (ControlPowerIface *iface);
16729
16730#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16731G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
16732 G_ADD_PRIVATE (ControlPowerProxy)
16733 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init));
16734
16735#else
16736G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
16737 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init));
16738
16739#endif
16740static void
16741control_power_proxy_finalize (GObject *object)
16742{
16743 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
16744 g_datalist_clear (&proxy->priv->qdata);
16745 G_OBJECT_CLASS (control_power_proxy_parent_class)->finalize (object);
16746}
16747
16748static void
16749control_power_proxy_get_property (GObject *object,
16750 guint prop_id,
16751 GValue *value,
16752 GParamSpec *pspec G_GNUC_UNUSED)
16753{
16754 const _ExtendedGDBusPropertyInfo *info;
16755 GVariant *variant;
Norman James32e74e22015-09-15 21:28:06 -050016756 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050016757 info = _control_power_property_info_pointers[prop_id - 1];
16758 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
16759 if (info->use_gvariant)
16760 {
16761 g_value_set_variant (value, variant);
16762 }
16763 else
16764 {
16765 if (variant != NULL)
16766 g_dbus_gvariant_to_gvalue (variant, value);
16767 }
16768 if (variant != NULL)
16769 g_variant_unref (variant);
16770}
16771
16772static void
16773control_power_proxy_set_property_cb (GDBusProxy *proxy,
16774 GAsyncResult *res,
16775 gpointer user_data)
16776{
16777 const _ExtendedGDBusPropertyInfo *info = user_data;
16778 GError *error;
16779 GVariant *_ret;
16780 error = NULL;
16781 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
16782 if (!_ret)
16783 {
16784 g_warning ("Error setting property '%s' on interface org.openbmc.control.Power: %s (%s, %d)",
16785 info->parent_struct.name,
16786 error->message, g_quark_to_string (error->domain), error->code);
16787 g_error_free (error);
16788 }
16789 else
16790 {
16791 g_variant_unref (_ret);
16792 }
16793}
16794
16795static void
16796control_power_proxy_set_property (GObject *object,
16797 guint prop_id,
16798 const GValue *value,
16799 GParamSpec *pspec G_GNUC_UNUSED)
16800{
16801 const _ExtendedGDBusPropertyInfo *info;
16802 GVariant *variant;
Norman James32e74e22015-09-15 21:28:06 -050016803 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050016804 info = _control_power_property_info_pointers[prop_id - 1];
16805 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
16806 g_dbus_proxy_call (G_DBUS_PROXY (object),
16807 "org.freedesktop.DBus.Properties.Set",
16808 g_variant_new ("(ssv)", "org.openbmc.control.Power", info->parent_struct.name, variant),
16809 G_DBUS_CALL_FLAGS_NONE,
16810 -1,
16811 NULL, (GAsyncReadyCallback) control_power_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
16812 g_variant_unref (variant);
16813}
16814
16815static void
16816control_power_proxy_g_signal (GDBusProxy *proxy,
16817 const gchar *sender_name G_GNUC_UNUSED,
16818 const gchar *signal_name,
16819 GVariant *parameters)
16820{
16821 _ExtendedGDBusSignalInfo *info;
16822 GVariantIter iter;
16823 GVariant *child;
16824 GValue *paramv;
16825 guint num_params;
16826 guint n;
16827 guint signal_id;
16828 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, signal_name);
16829 if (info == NULL)
16830 return;
16831 num_params = g_variant_n_children (parameters);
16832 paramv = g_new0 (GValue, num_params + 1);
16833 g_value_init (&paramv[0], TYPE_CONTROL_POWER);
16834 g_value_set_object (&paramv[0], proxy);
16835 g_variant_iter_init (&iter, parameters);
16836 n = 1;
16837 while ((child = g_variant_iter_next_value (&iter)) != NULL)
16838 {
16839 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
16840 if (arg_info->use_gvariant)
16841 {
16842 g_value_init (&paramv[n], G_TYPE_VARIANT);
16843 g_value_set_variant (&paramv[n], child);
16844 n++;
16845 }
16846 else
16847 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
16848 g_variant_unref (child);
16849 }
16850 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
16851 g_signal_emitv (paramv, signal_id, 0, NULL);
16852 for (n = 0; n < num_params + 1; n++)
16853 g_value_unset (&paramv[n]);
16854 g_free (paramv);
16855}
16856
16857static void
16858control_power_proxy_g_properties_changed (GDBusProxy *_proxy,
16859 GVariant *changed_properties,
16860 const gchar *const *invalidated_properties)
16861{
16862 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (_proxy);
16863 guint n;
16864 const gchar *key;
16865 GVariantIter *iter;
16866 _ExtendedGDBusPropertyInfo *info;
16867 g_variant_get (changed_properties, "a{sv}", &iter);
16868 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
16869 {
16870 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, key);
16871 g_datalist_remove_data (&proxy->priv->qdata, key);
16872 if (info != NULL)
16873 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
16874 }
16875 g_variant_iter_free (iter);
16876 for (n = 0; invalidated_properties[n] != NULL; n++)
16877 {
16878 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, invalidated_properties[n]);
16879 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
16880 if (info != NULL)
16881 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
16882 }
16883}
16884
16885static gint
16886control_power_proxy_get_pgood (ControlPower *object)
16887{
16888 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
16889 GVariant *variant;
16890 gint value = 0;
16891 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood");
16892 if (variant != NULL)
16893 {
16894 value = g_variant_get_int32 (variant);
16895 g_variant_unref (variant);
16896 }
16897 return value;
16898}
16899
16900static gint
16901control_power_proxy_get_state (ControlPower *object)
16902{
16903 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
16904 GVariant *variant;
16905 gint value = 0;
16906 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
16907 if (variant != NULL)
16908 {
16909 value = g_variant_get_int32 (variant);
16910 g_variant_unref (variant);
16911 }
16912 return value;
16913}
16914
Norman James32e74e22015-09-15 21:28:06 -050016915static gint
16916control_power_proxy_get_pgood_timeout (ControlPower *object)
16917{
16918 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
16919 GVariant *variant;
16920 gint value = 0;
16921 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood_timeout");
16922 if (variant != NULL)
16923 {
16924 value = g_variant_get_int32 (variant);
16925 g_variant_unref (variant);
16926 }
16927 return value;
16928}
16929
Norman James362a80f2015-09-14 14:04:39 -050016930static void
16931control_power_proxy_init (ControlPowerProxy *proxy)
16932{
16933#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16934 proxy->priv = control_power_proxy_get_instance_private (proxy);
16935#else
16936 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_POWER_PROXY, ControlPowerProxyPrivate);
16937#endif
16938
16939 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_power_interface_info ());
16940}
16941
16942static void
16943control_power_proxy_class_init (ControlPowerProxyClass *klass)
16944{
16945 GObjectClass *gobject_class;
16946 GDBusProxyClass *proxy_class;
16947
16948 gobject_class = G_OBJECT_CLASS (klass);
16949 gobject_class->finalize = control_power_proxy_finalize;
16950 gobject_class->get_property = control_power_proxy_get_property;
16951 gobject_class->set_property = control_power_proxy_set_property;
16952
16953 proxy_class = G_DBUS_PROXY_CLASS (klass);
16954 proxy_class->g_signal = control_power_proxy_g_signal;
16955 proxy_class->g_properties_changed = control_power_proxy_g_properties_changed;
16956
16957 control_power_override_properties (gobject_class, 1);
16958
16959#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
16960 g_type_class_add_private (klass, sizeof (ControlPowerProxyPrivate));
16961#endif
16962}
16963
16964static void
16965control_power_proxy_iface_init (ControlPowerIface *iface)
16966{
16967 iface->get_pgood = control_power_proxy_get_pgood;
16968 iface->get_state = control_power_proxy_get_state;
Norman James32e74e22015-09-15 21:28:06 -050016969 iface->get_pgood_timeout = control_power_proxy_get_pgood_timeout;
Norman James362a80f2015-09-14 14:04:39 -050016970}
16971
16972/**
16973 * control_power_proxy_new:
16974 * @connection: A #GDBusConnection.
16975 * @flags: Flags from the #GDBusProxyFlags enumeration.
16976 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
16977 * @object_path: An object path.
16978 * @cancellable: (allow-none): A #GCancellable or %NULL.
16979 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
16980 * @user_data: User data to pass to @callback.
16981 *
16982 * 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.
16983 *
16984 * 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.
16985 * You can then call control_power_proxy_new_finish() to get the result of the operation.
16986 *
16987 * See control_power_proxy_new_sync() for the synchronous, blocking version of this constructor.
16988 */
16989void
16990control_power_proxy_new (
16991 GDBusConnection *connection,
16992 GDBusProxyFlags flags,
16993 const gchar *name,
16994 const gchar *object_path,
16995 GCancellable *cancellable,
16996 GAsyncReadyCallback callback,
16997 gpointer user_data)
16998{
16999 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);
17000}
17001
17002/**
17003 * control_power_proxy_new_finish:
17004 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new().
17005 * @error: Return location for error or %NULL
17006 *
17007 * Finishes an operation started with control_power_proxy_new().
17008 *
17009 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
17010 */
17011ControlPower *
17012control_power_proxy_new_finish (
17013 GAsyncResult *res,
17014 GError **error)
17015{
17016 GObject *ret;
17017 GObject *source_object;
17018 source_object = g_async_result_get_source_object (res);
17019 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
17020 g_object_unref (source_object);
17021 if (ret != NULL)
17022 return CONTROL_POWER (ret);
17023 else
17024 return NULL;
17025}
17026
17027/**
17028 * control_power_proxy_new_sync:
17029 * @connection: A #GDBusConnection.
17030 * @flags: Flags from the #GDBusProxyFlags enumeration.
17031 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
17032 * @object_path: An object path.
17033 * @cancellable: (allow-none): A #GCancellable or %NULL.
17034 * @error: Return location for error or %NULL
17035 *
17036 * 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.
17037 *
17038 * The calling thread is blocked until a reply is received.
17039 *
17040 * See control_power_proxy_new() for the asynchronous version of this constructor.
17041 *
17042 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
17043 */
17044ControlPower *
17045control_power_proxy_new_sync (
17046 GDBusConnection *connection,
17047 GDBusProxyFlags flags,
17048 const gchar *name,
17049 const gchar *object_path,
17050 GCancellable *cancellable,
17051 GError **error)
17052{
17053 GInitable *ret;
17054 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);
17055 if (ret != NULL)
17056 return CONTROL_POWER (ret);
17057 else
17058 return NULL;
17059}
17060
17061
17062/**
17063 * control_power_proxy_new_for_bus:
17064 * @bus_type: A #GBusType.
17065 * @flags: Flags from the #GDBusProxyFlags enumeration.
17066 * @name: A bus name (well-known or unique).
17067 * @object_path: An object path.
17068 * @cancellable: (allow-none): A #GCancellable or %NULL.
17069 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
17070 * @user_data: User data to pass to @callback.
17071 *
17072 * Like control_power_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
17073 *
17074 * 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.
17075 * You can then call control_power_proxy_new_for_bus_finish() to get the result of the operation.
17076 *
17077 * See control_power_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
17078 */
17079void
17080control_power_proxy_new_for_bus (
17081 GBusType bus_type,
17082 GDBusProxyFlags flags,
17083 const gchar *name,
17084 const gchar *object_path,
17085 GCancellable *cancellable,
17086 GAsyncReadyCallback callback,
17087 gpointer user_data)
17088{
17089 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);
17090}
17091
17092/**
17093 * control_power_proxy_new_for_bus_finish:
17094 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new_for_bus().
17095 * @error: Return location for error or %NULL
17096 *
17097 * Finishes an operation started with control_power_proxy_new_for_bus().
17098 *
17099 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
17100 */
17101ControlPower *
17102control_power_proxy_new_for_bus_finish (
17103 GAsyncResult *res,
17104 GError **error)
17105{
17106 GObject *ret;
17107 GObject *source_object;
17108 source_object = g_async_result_get_source_object (res);
17109 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
17110 g_object_unref (source_object);
17111 if (ret != NULL)
17112 return CONTROL_POWER (ret);
17113 else
17114 return NULL;
17115}
17116
17117/**
17118 * control_power_proxy_new_for_bus_sync:
17119 * @bus_type: A #GBusType.
17120 * @flags: Flags from the #GDBusProxyFlags enumeration.
17121 * @name: A bus name (well-known or unique).
17122 * @object_path: An object path.
17123 * @cancellable: (allow-none): A #GCancellable or %NULL.
17124 * @error: Return location for error or %NULL
17125 *
17126 * Like control_power_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
17127 *
17128 * The calling thread is blocked until a reply is received.
17129 *
17130 * See control_power_proxy_new_for_bus() for the asynchronous version of this constructor.
17131 *
17132 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
17133 */
17134ControlPower *
17135control_power_proxy_new_for_bus_sync (
17136 GBusType bus_type,
17137 GDBusProxyFlags flags,
17138 const gchar *name,
17139 const gchar *object_path,
17140 GCancellable *cancellable,
17141 GError **error)
17142{
17143 GInitable *ret;
17144 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);
17145 if (ret != NULL)
17146 return CONTROL_POWER (ret);
17147 else
17148 return NULL;
17149}
17150
17151
17152/* ------------------------------------------------------------------------ */
17153
17154/**
17155 * ControlPowerSkeleton:
17156 *
17157 * The #ControlPowerSkeleton structure contains only private data and should only be accessed using the provided API.
17158 */
17159
17160/**
17161 * ControlPowerSkeletonClass:
17162 * @parent_class: The parent class.
17163 *
17164 * Class structure for #ControlPowerSkeleton.
17165 */
17166
17167struct _ControlPowerSkeletonPrivate
17168{
17169 GValue *properties;
17170 GList *changed_properties;
17171 GSource *changed_properties_idle_source;
17172 GMainContext *context;
17173 GMutex lock;
17174};
17175
17176static void
17177_control_power_skeleton_handle_method_call (
17178 GDBusConnection *connection G_GNUC_UNUSED,
17179 const gchar *sender G_GNUC_UNUSED,
17180 const gchar *object_path G_GNUC_UNUSED,
17181 const gchar *interface_name,
17182 const gchar *method_name,
17183 GVariant *parameters,
17184 GDBusMethodInvocation *invocation,
17185 gpointer user_data)
17186{
17187 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
17188 _ExtendedGDBusMethodInfo *info;
17189 GVariantIter iter;
17190 GVariant *child;
17191 GValue *paramv;
17192 guint num_params;
17193 guint num_extra;
17194 guint n;
17195 guint signal_id;
17196 GValue return_value = G_VALUE_INIT;
17197 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
17198 g_assert (info != NULL);
17199 num_params = g_variant_n_children (parameters);
17200 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
17201 n = 0;
17202 g_value_init (&paramv[n], TYPE_CONTROL_POWER);
17203 g_value_set_object (&paramv[n++], skeleton);
17204 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
17205 g_value_set_object (&paramv[n++], invocation);
17206 if (info->pass_fdlist)
17207 {
17208#ifdef G_OS_UNIX
17209 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
17210 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
17211#else
17212 g_assert_not_reached ();
17213#endif
17214 }
17215 g_variant_iter_init (&iter, parameters);
17216 while ((child = g_variant_iter_next_value (&iter)) != NULL)
17217 {
17218 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
17219 if (arg_info->use_gvariant)
17220 {
17221 g_value_init (&paramv[n], G_TYPE_VARIANT);
17222 g_value_set_variant (&paramv[n], child);
17223 n++;
17224 }
17225 else
17226 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
17227 g_variant_unref (child);
17228 }
17229 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
17230 g_value_init (&return_value, G_TYPE_BOOLEAN);
17231 g_signal_emitv (paramv, signal_id, 0, &return_value);
17232 if (!g_value_get_boolean (&return_value))
17233 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);
17234 g_value_unset (&return_value);
17235 for (n = 0; n < num_params + num_extra; n++)
17236 g_value_unset (&paramv[n]);
17237 g_free (paramv);
17238}
17239
17240static GVariant *
17241_control_power_skeleton_handle_get_property (
17242 GDBusConnection *connection G_GNUC_UNUSED,
17243 const gchar *sender G_GNUC_UNUSED,
17244 const gchar *object_path G_GNUC_UNUSED,
17245 const gchar *interface_name G_GNUC_UNUSED,
17246 const gchar *property_name,
17247 GError **error,
17248 gpointer user_data)
17249{
17250 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
17251 GValue value = G_VALUE_INIT;
17252 GParamSpec *pspec;
17253 _ExtendedGDBusPropertyInfo *info;
17254 GVariant *ret;
17255 ret = NULL;
17256 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
17257 g_assert (info != NULL);
17258 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
17259 if (pspec == NULL)
17260 {
17261 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
17262 }
17263 else
17264 {
17265 g_value_init (&value, pspec->value_type);
17266 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
17267 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
17268 g_value_unset (&value);
17269 }
17270 return ret;
17271}
17272
17273static gboolean
17274_control_power_skeleton_handle_set_property (
17275 GDBusConnection *connection G_GNUC_UNUSED,
17276 const gchar *sender G_GNUC_UNUSED,
17277 const gchar *object_path G_GNUC_UNUSED,
17278 const gchar *interface_name G_GNUC_UNUSED,
17279 const gchar *property_name,
17280 GVariant *variant,
17281 GError **error,
17282 gpointer user_data)
17283{
17284 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
17285 GValue value = G_VALUE_INIT;
17286 GParamSpec *pspec;
17287 _ExtendedGDBusPropertyInfo *info;
17288 gboolean ret;
17289 ret = FALSE;
17290 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
17291 g_assert (info != NULL);
17292 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
17293 if (pspec == NULL)
17294 {
17295 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
17296 }
17297 else
17298 {
17299 if (info->use_gvariant)
17300 g_value_set_variant (&value, variant);
17301 else
17302 g_dbus_gvariant_to_gvalue (variant, &value);
17303 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
17304 g_value_unset (&value);
17305 ret = TRUE;
17306 }
17307 return ret;
17308}
17309
17310static const GDBusInterfaceVTable _control_power_skeleton_vtable =
17311{
17312 _control_power_skeleton_handle_method_call,
17313 _control_power_skeleton_handle_get_property,
17314 _control_power_skeleton_handle_set_property,
17315 {NULL}
17316};
17317
17318static GDBusInterfaceInfo *
17319control_power_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
17320{
17321 return control_power_interface_info ();
17322}
17323
17324static GDBusInterfaceVTable *
17325control_power_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
17326{
17327 return (GDBusInterfaceVTable *) &_control_power_skeleton_vtable;
17328}
17329
17330static GVariant *
17331control_power_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
17332{
17333 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
17334
17335 GVariantBuilder builder;
17336 guint n;
17337 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
17338 if (_control_power_interface_info.parent_struct.properties == NULL)
17339 goto out;
17340 for (n = 0; _control_power_interface_info.parent_struct.properties[n] != NULL; n++)
17341 {
17342 GDBusPropertyInfo *info = _control_power_interface_info.parent_struct.properties[n];
17343 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
17344 {
17345 GVariant *value;
17346 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);
17347 if (value != NULL)
17348 {
17349 g_variant_take_ref (value);
17350 g_variant_builder_add (&builder, "{sv}", info->name, value);
17351 g_variant_unref (value);
17352 }
17353 }
17354 }
17355out:
17356 return g_variant_builder_end (&builder);
17357}
17358
17359static gboolean _control_power_emit_changed (gpointer user_data);
17360
17361static void
17362control_power_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
17363{
17364 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
17365 gboolean emit_changed = FALSE;
17366
17367 g_mutex_lock (&skeleton->priv->lock);
17368 if (skeleton->priv->changed_properties_idle_source != NULL)
17369 {
17370 g_source_destroy (skeleton->priv->changed_properties_idle_source);
17371 skeleton->priv->changed_properties_idle_source = NULL;
17372 emit_changed = TRUE;
17373 }
17374 g_mutex_unlock (&skeleton->priv->lock);
17375
17376 if (emit_changed)
17377 _control_power_emit_changed (skeleton);
17378}
17379
17380static void
17381_control_power_on_signal_power_good (
17382 ControlPower *object)
17383{
17384 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17385
17386 GList *connections, *l;
17387 GVariant *signal_variant;
17388 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
17389
17390 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
17391 for (l = connections; l != NULL; l = l->next)
17392 {
17393 GDBusConnection *connection = l->data;
17394 g_dbus_connection_emit_signal (connection,
17395 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerGood",
17396 signal_variant, NULL);
17397 }
17398 g_variant_unref (signal_variant);
17399 g_list_free_full (connections, g_object_unref);
17400}
17401
17402static void
17403_control_power_on_signal_power_lost (
17404 ControlPower *object)
17405{
17406 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17407
17408 GList *connections, *l;
17409 GVariant *signal_variant;
17410 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
17411
17412 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
17413 for (l = connections; l != NULL; l = l->next)
17414 {
17415 GDBusConnection *connection = l->data;
17416 g_dbus_connection_emit_signal (connection,
17417 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerLost",
17418 signal_variant, NULL);
17419 }
17420 g_variant_unref (signal_variant);
17421 g_list_free_full (connections, g_object_unref);
17422}
17423
17424static void control_power_skeleton_iface_init (ControlPowerIface *iface);
17425#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17426G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
17427 G_ADD_PRIVATE (ControlPowerSkeleton)
17428 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init));
17429
17430#else
17431G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
17432 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init));
17433
17434#endif
17435static void
17436control_power_skeleton_finalize (GObject *object)
17437{
17438 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17439 guint n;
Norman James32e74e22015-09-15 21:28:06 -050017440 for (n = 0; n < 3; n++)
Norman James362a80f2015-09-14 14:04:39 -050017441 g_value_unset (&skeleton->priv->properties[n]);
17442 g_free (skeleton->priv->properties);
17443 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
17444 if (skeleton->priv->changed_properties_idle_source != NULL)
17445 g_source_destroy (skeleton->priv->changed_properties_idle_source);
17446 g_main_context_unref (skeleton->priv->context);
17447 g_mutex_clear (&skeleton->priv->lock);
17448 G_OBJECT_CLASS (control_power_skeleton_parent_class)->finalize (object);
17449}
17450
17451static void
17452control_power_skeleton_get_property (GObject *object,
17453 guint prop_id,
17454 GValue *value,
17455 GParamSpec *pspec G_GNUC_UNUSED)
17456{
17457 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
Norman James32e74e22015-09-15 21:28:06 -050017458 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050017459 g_mutex_lock (&skeleton->priv->lock);
17460 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
17461 g_mutex_unlock (&skeleton->priv->lock);
17462}
17463
17464static gboolean
17465_control_power_emit_changed (gpointer user_data)
17466{
17467 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
17468 GList *l;
17469 GVariantBuilder builder;
17470 GVariantBuilder invalidated_builder;
17471 guint num_changes;
17472
17473 g_mutex_lock (&skeleton->priv->lock);
17474 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
17475 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
17476 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
17477 {
17478 ChangedProperty *cp = l->data;
17479 GVariant *variant;
17480 const GValue *cur_value;
17481
17482 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
17483 if (!_g_value_equal (cur_value, &cp->orig_value))
17484 {
17485 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
17486 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
17487 g_variant_unref (variant);
17488 num_changes++;
17489 }
17490 }
17491 if (num_changes > 0)
17492 {
17493 GList *connections, *ll;
17494 GVariant *signal_variant;
17495 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.control.Power",
17496 &builder, &invalidated_builder));
17497 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
17498 for (ll = connections; ll != NULL; ll = ll->next)
17499 {
17500 GDBusConnection *connection = ll->data;
17501
17502 g_dbus_connection_emit_signal (connection,
17503 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
17504 "org.freedesktop.DBus.Properties",
17505 "PropertiesChanged",
17506 signal_variant,
17507 NULL);
17508 }
17509 g_variant_unref (signal_variant);
17510 g_list_free_full (connections, g_object_unref);
17511 }
17512 else
17513 {
17514 g_variant_builder_clear (&builder);
17515 g_variant_builder_clear (&invalidated_builder);
17516 }
17517 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
17518 skeleton->priv->changed_properties = NULL;
17519 skeleton->priv->changed_properties_idle_source = NULL;
17520 g_mutex_unlock (&skeleton->priv->lock);
17521 return FALSE;
17522}
17523
17524static void
17525_control_power_schedule_emit_changed (ControlPowerSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
17526{
17527 ChangedProperty *cp;
17528 GList *l;
17529 cp = NULL;
17530 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
17531 {
17532 ChangedProperty *i_cp = l->data;
17533 if (i_cp->info == info)
17534 {
17535 cp = i_cp;
17536 break;
17537 }
17538 }
17539 if (cp == NULL)
17540 {
17541 cp = g_new0 (ChangedProperty, 1);
17542 cp->prop_id = prop_id;
17543 cp->info = info;
17544 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
17545 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
17546 g_value_copy (orig_value, &cp->orig_value);
17547 }
17548}
17549
17550static void
17551control_power_skeleton_notify (GObject *object,
17552 GParamSpec *pspec G_GNUC_UNUSED)
17553{
17554 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17555 g_mutex_lock (&skeleton->priv->lock);
17556 if (skeleton->priv->changed_properties != NULL &&
17557 skeleton->priv->changed_properties_idle_source == NULL)
17558 {
17559 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
17560 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
17561 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_power_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylak2cb27752015-10-19 16:23:14 -050017562 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _control_power_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -050017563 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
17564 g_source_unref (skeleton->priv->changed_properties_idle_source);
17565 }
17566 g_mutex_unlock (&skeleton->priv->lock);
17567}
17568
17569static void
17570control_power_skeleton_set_property (GObject *object,
17571 guint prop_id,
17572 const GValue *value,
17573 GParamSpec *pspec)
17574{
17575 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
Norman James32e74e22015-09-15 21:28:06 -050017576 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050017577 g_mutex_lock (&skeleton->priv->lock);
17578 g_object_freeze_notify (object);
17579 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
17580 {
17581 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
17582 _control_power_schedule_emit_changed (skeleton, _control_power_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
17583 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
17584 g_object_notify_by_pspec (object, pspec);
17585 }
17586 g_mutex_unlock (&skeleton->priv->lock);
17587 g_object_thaw_notify (object);
17588}
17589
17590static void
17591control_power_skeleton_init (ControlPowerSkeleton *skeleton)
17592{
17593#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17594 skeleton->priv = control_power_skeleton_get_instance_private (skeleton);
17595#else
17596 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_POWER_SKELETON, ControlPowerSkeletonPrivate);
17597#endif
17598
17599 g_mutex_init (&skeleton->priv->lock);
17600 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James32e74e22015-09-15 21:28:06 -050017601 skeleton->priv->properties = g_new0 (GValue, 3);
Norman James362a80f2015-09-14 14:04:39 -050017602 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
17603 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
Norman James32e74e22015-09-15 21:28:06 -050017604 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
Norman James362a80f2015-09-14 14:04:39 -050017605}
17606
17607static gint
17608control_power_skeleton_get_pgood (ControlPower *object)
17609{
17610 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17611 gint value;
17612 g_mutex_lock (&skeleton->priv->lock);
17613 value = g_value_get_int (&(skeleton->priv->properties[0]));
17614 g_mutex_unlock (&skeleton->priv->lock);
17615 return value;
17616}
17617
17618static gint
17619control_power_skeleton_get_state (ControlPower *object)
17620{
17621 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17622 gint value;
17623 g_mutex_lock (&skeleton->priv->lock);
17624 value = g_value_get_int (&(skeleton->priv->properties[1]));
17625 g_mutex_unlock (&skeleton->priv->lock);
17626 return value;
17627}
17628
Norman James32e74e22015-09-15 21:28:06 -050017629static gint
17630control_power_skeleton_get_pgood_timeout (ControlPower *object)
17631{
17632 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17633 gint value;
17634 g_mutex_lock (&skeleton->priv->lock);
17635 value = g_value_get_int (&(skeleton->priv->properties[2]));
17636 g_mutex_unlock (&skeleton->priv->lock);
17637 return value;
17638}
17639
Norman James362a80f2015-09-14 14:04:39 -050017640static void
17641control_power_skeleton_class_init (ControlPowerSkeletonClass *klass)
17642{
17643 GObjectClass *gobject_class;
17644 GDBusInterfaceSkeletonClass *skeleton_class;
17645
17646 gobject_class = G_OBJECT_CLASS (klass);
17647 gobject_class->finalize = control_power_skeleton_finalize;
17648 gobject_class->get_property = control_power_skeleton_get_property;
17649 gobject_class->set_property = control_power_skeleton_set_property;
17650 gobject_class->notify = control_power_skeleton_notify;
17651
17652
17653 control_power_override_properties (gobject_class, 1);
17654
17655 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
17656 skeleton_class->get_info = control_power_skeleton_dbus_interface_get_info;
17657 skeleton_class->get_properties = control_power_skeleton_dbus_interface_get_properties;
17658 skeleton_class->flush = control_power_skeleton_dbus_interface_flush;
17659 skeleton_class->get_vtable = control_power_skeleton_dbus_interface_get_vtable;
17660
17661#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
17662 g_type_class_add_private (klass, sizeof (ControlPowerSkeletonPrivate));
17663#endif
17664}
17665
17666static void
17667control_power_skeleton_iface_init (ControlPowerIface *iface)
17668{
17669 iface->power_good = _control_power_on_signal_power_good;
17670 iface->power_lost = _control_power_on_signal_power_lost;
17671 iface->get_pgood = control_power_skeleton_get_pgood;
17672 iface->get_state = control_power_skeleton_get_state;
Norman James32e74e22015-09-15 21:28:06 -050017673 iface->get_pgood_timeout = control_power_skeleton_get_pgood_timeout;
Norman James362a80f2015-09-14 14:04:39 -050017674}
17675
17676/**
17677 * control_power_skeleton_new:
17678 *
17679 * 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>.
17680 *
17681 * Returns: (transfer full) (type ControlPowerSkeleton): The skeleton object.
17682 */
17683ControlPower *
17684control_power_skeleton_new (void)
17685{
17686 return CONTROL_POWER (g_object_new (TYPE_CONTROL_POWER_SKELETON, NULL));
17687}
17688
17689/* ------------------------------------------------------------------------
17690 * Code for interface org.openbmc.Watchdog
17691 * ------------------------------------------------------------------------
17692 */
17693
17694/**
17695 * SECTION:Watchdog
17696 * @title: Watchdog
17697 * @short_description: Generated C code for the org.openbmc.Watchdog D-Bus interface
17698 *
17699 * 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.
17700 */
17701
17702/* ---- Introspection data for org.openbmc.Watchdog ---- */
17703
17704static const _ExtendedGDBusMethodInfo _watchdog_method_info_start =
17705{
17706 {
17707 -1,
17708 (gchar *) "start",
17709 NULL,
17710 NULL,
17711 NULL
17712 },
17713 "handle-start",
17714 FALSE
17715};
17716
17717static const _ExtendedGDBusMethodInfo _watchdog_method_info_poke =
17718{
17719 {
17720 -1,
17721 (gchar *) "poke",
17722 NULL,
17723 NULL,
17724 NULL
17725 },
17726 "handle-poke",
17727 FALSE
17728};
17729
17730static const _ExtendedGDBusMethodInfo _watchdog_method_info_stop =
17731{
17732 {
17733 -1,
17734 (gchar *) "stop",
17735 NULL,
17736 NULL,
17737 NULL
17738 },
17739 "handle-stop",
17740 FALSE
17741};
17742
Adriana Kobylak2cb27752015-10-19 16:23:14 -050017743static const _ExtendedGDBusArgInfo _watchdog_method_info_set_IN_ARG_interval =
17744{
17745 {
17746 -1,
17747 (gchar *) "interval",
17748 (gchar *) "i",
17749 NULL
17750 },
17751 FALSE
17752};
17753
17754static const _ExtendedGDBusArgInfo * const _watchdog_method_info_set_IN_ARG_pointers[] =
17755{
17756 &_watchdog_method_info_set_IN_ARG_interval,
17757 NULL
17758};
17759
17760static const _ExtendedGDBusMethodInfo _watchdog_method_info_set =
17761{
17762 {
17763 -1,
17764 (gchar *) "set",
17765 (GDBusArgInfo **) &_watchdog_method_info_set_IN_ARG_pointers,
17766 NULL,
17767 NULL
17768 },
17769 "handle-set",
17770 FALSE
17771};
17772
Norman James362a80f2015-09-14 14:04:39 -050017773static const _ExtendedGDBusMethodInfo * const _watchdog_method_info_pointers[] =
17774{
17775 &_watchdog_method_info_start,
17776 &_watchdog_method_info_poke,
17777 &_watchdog_method_info_stop,
Adriana Kobylak2cb27752015-10-19 16:23:14 -050017778 &_watchdog_method_info_set,
Norman James362a80f2015-09-14 14:04:39 -050017779 NULL
17780};
17781
17782static const _ExtendedGDBusSignalInfo _watchdog_signal_info_watchdog_error =
17783{
17784 {
17785 -1,
17786 (gchar *) "WatchdogError",
17787 NULL,
17788 NULL
17789 },
17790 "watchdog-error"
17791};
17792
17793static const _ExtendedGDBusSignalInfo * const _watchdog_signal_info_pointers[] =
17794{
17795 &_watchdog_signal_info_watchdog_error,
17796 NULL
17797};
17798
17799static const _ExtendedGDBusPropertyInfo _watchdog_property_info_watchdog =
17800{
17801 {
17802 -1,
17803 (gchar *) "watchdog",
17804 (gchar *) "i",
17805 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
17806 NULL
17807 },
17808 "watchdog",
17809 FALSE
17810};
17811
17812static const _ExtendedGDBusPropertyInfo _watchdog_property_info_poll_interval =
17813{
17814 {
17815 -1,
17816 (gchar *) "poll_interval",
17817 (gchar *) "i",
17818 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
17819 NULL
17820 },
17821 "poll-interval",
17822 FALSE
17823};
17824
17825static const _ExtendedGDBusPropertyInfo * const _watchdog_property_info_pointers[] =
17826{
17827 &_watchdog_property_info_watchdog,
17828 &_watchdog_property_info_poll_interval,
17829 NULL
17830};
17831
17832static const _ExtendedGDBusInterfaceInfo _watchdog_interface_info =
17833{
17834 {
17835 -1,
17836 (gchar *) "org.openbmc.Watchdog",
17837 (GDBusMethodInfo **) &_watchdog_method_info_pointers,
17838 (GDBusSignalInfo **) &_watchdog_signal_info_pointers,
17839 (GDBusPropertyInfo **) &_watchdog_property_info_pointers,
17840 NULL
17841 },
17842 "watchdog",
17843};
17844
17845
17846/**
17847 * watchdog_interface_info:
17848 *
17849 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> D-Bus interface.
17850 *
17851 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
17852 */
17853GDBusInterfaceInfo *
17854watchdog_interface_info (void)
17855{
17856 return (GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct;
17857}
17858
17859/**
17860 * watchdog_override_properties:
17861 * @klass: The class structure for a #GObject<!-- -->-derived class.
17862 * @property_id_begin: The property id to assign to the first overridden property.
17863 *
17864 * Overrides all #GObject properties in the #Watchdog interface for a concrete class.
17865 * The properties are overridden in the order they are defined.
17866 *
17867 * Returns: The last property id.
17868 */
17869guint
17870watchdog_override_properties (GObjectClass *klass, guint property_id_begin)
17871{
17872 g_object_class_override_property (klass, property_id_begin++, "watchdog");
17873 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
17874 return property_id_begin - 1;
17875}
17876
17877
17878
17879/**
17880 * Watchdog:
17881 *
17882 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
17883 */
17884
17885/**
17886 * WatchdogIface:
17887 * @parent_iface: The parent interface.
17888 * @handle_poke: Handler for the #Watchdog::handle-poke signal.
Adriana Kobylak2cb27752015-10-19 16:23:14 -050017889 * @handle_set: Handler for the #Watchdog::handle-set signal.
Norman James362a80f2015-09-14 14:04:39 -050017890 * @handle_start: Handler for the #Watchdog::handle-start signal.
17891 * @handle_stop: Handler for the #Watchdog::handle-stop signal.
17892 * @get_poll_interval: Getter for the #Watchdog:poll-interval property.
17893 * @get_watchdog: Getter for the #Watchdog:watchdog property.
17894 * @watchdog_error: Handler for the #Watchdog::watchdog-error signal.
17895 *
17896 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
17897 */
17898
17899typedef WatchdogIface WatchdogInterface;
17900G_DEFINE_INTERFACE (Watchdog, watchdog, G_TYPE_OBJECT);
17901
17902static void
17903watchdog_default_init (WatchdogIface *iface)
17904{
17905 /* GObject signals for incoming D-Bus method calls: */
17906 /**
17907 * Watchdog::handle-start:
17908 * @object: A #Watchdog.
17909 * @invocation: A #GDBusMethodInvocation.
17910 *
17911 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method.
17912 *
17913 * 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.
17914 *
17915 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
17916 */
17917 g_signal_new ("handle-start",
17918 G_TYPE_FROM_INTERFACE (iface),
17919 G_SIGNAL_RUN_LAST,
17920 G_STRUCT_OFFSET (WatchdogIface, handle_start),
17921 g_signal_accumulator_true_handled,
17922 NULL,
17923 g_cclosure_marshal_generic,
17924 G_TYPE_BOOLEAN,
17925 1,
17926 G_TYPE_DBUS_METHOD_INVOCATION);
17927
17928 /**
17929 * Watchdog::handle-poke:
17930 * @object: A #Watchdog.
17931 * @invocation: A #GDBusMethodInvocation.
17932 *
17933 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method.
17934 *
17935 * 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.
17936 *
17937 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
17938 */
17939 g_signal_new ("handle-poke",
17940 G_TYPE_FROM_INTERFACE (iface),
17941 G_SIGNAL_RUN_LAST,
17942 G_STRUCT_OFFSET (WatchdogIface, handle_poke),
17943 g_signal_accumulator_true_handled,
17944 NULL,
17945 g_cclosure_marshal_generic,
17946 G_TYPE_BOOLEAN,
17947 1,
17948 G_TYPE_DBUS_METHOD_INVOCATION);
17949
17950 /**
17951 * Watchdog::handle-stop:
17952 * @object: A #Watchdog.
17953 * @invocation: A #GDBusMethodInvocation.
17954 *
17955 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method.
17956 *
17957 * 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.
17958 *
17959 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
17960 */
17961 g_signal_new ("handle-stop",
17962 G_TYPE_FROM_INTERFACE (iface),
17963 G_SIGNAL_RUN_LAST,
17964 G_STRUCT_OFFSET (WatchdogIface, handle_stop),
17965 g_signal_accumulator_true_handled,
17966 NULL,
17967 g_cclosure_marshal_generic,
17968 G_TYPE_BOOLEAN,
17969 1,
17970 G_TYPE_DBUS_METHOD_INVOCATION);
17971
Adriana Kobylak2cb27752015-10-19 16:23:14 -050017972 /**
17973 * Watchdog::handle-set:
17974 * @object: A #Watchdog.
17975 * @invocation: A #GDBusMethodInvocation.
17976 * @arg_interval: Argument passed by remote caller.
17977 *
17978 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method.
17979 *
17980 * 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_set() 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.
17981 *
17982 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
17983 */
17984 g_signal_new ("handle-set",
17985 G_TYPE_FROM_INTERFACE (iface),
17986 G_SIGNAL_RUN_LAST,
17987 G_STRUCT_OFFSET (WatchdogIface, handle_set),
17988 g_signal_accumulator_true_handled,
17989 NULL,
17990 g_cclosure_marshal_generic,
17991 G_TYPE_BOOLEAN,
17992 2,
17993 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
17994
Norman James362a80f2015-09-14 14:04:39 -050017995 /* GObject signals for received D-Bus signals: */
17996 /**
17997 * Watchdog::watchdog-error:
17998 * @object: A #Watchdog.
17999 *
18000 * 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.
18001 *
18002 * 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.
18003 */
18004 g_signal_new ("watchdog-error",
18005 G_TYPE_FROM_INTERFACE (iface),
18006 G_SIGNAL_RUN_LAST,
18007 G_STRUCT_OFFSET (WatchdogIface, watchdog_error),
18008 NULL,
18009 NULL,
18010 g_cclosure_marshal_generic,
18011 G_TYPE_NONE,
18012 0);
18013
18014 /* GObject properties for D-Bus properties: */
18015 /**
18016 * Watchdog:watchdog:
18017 *
18018 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link>.
18019 *
18020 * 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.
18021 */
18022 g_object_interface_install_property (iface,
18023 g_param_spec_int ("watchdog", "watchdog", "watchdog", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
18024 /**
18025 * Watchdog:poll-interval:
18026 *
18027 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link>.
18028 *
18029 * 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.
18030 */
18031 g_object_interface_install_property (iface,
18032 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
18033}
18034
18035/**
18036 * watchdog_get_watchdog: (skip)
18037 * @object: A #Watchdog.
18038 *
18039 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property.
18040 *
18041 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
18042 *
18043 * Returns: The property value.
18044 */
18045gint
18046watchdog_get_watchdog (Watchdog *object)
18047{
18048 return WATCHDOG_GET_IFACE (object)->get_watchdog (object);
18049}
18050
18051/**
18052 * watchdog_set_watchdog: (skip)
18053 * @object: A #Watchdog.
18054 * @value: The value to set.
18055 *
18056 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property to @value.
18057 *
18058 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
18059 */
18060void
18061watchdog_set_watchdog (Watchdog *object, gint value)
18062{
18063 g_object_set (G_OBJECT (object), "watchdog", value, NULL);
18064}
18065
18066/**
18067 * watchdog_get_poll_interval: (skip)
18068 * @object: A #Watchdog.
18069 *
18070 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property.
18071 *
18072 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
18073 *
18074 * Returns: The property value.
18075 */
18076gint
18077watchdog_get_poll_interval (Watchdog *object)
18078{
18079 return WATCHDOG_GET_IFACE (object)->get_poll_interval (object);
18080}
18081
18082/**
18083 * watchdog_set_poll_interval: (skip)
18084 * @object: A #Watchdog.
18085 * @value: The value to set.
18086 *
18087 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property to @value.
18088 *
18089 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
18090 */
18091void
18092watchdog_set_poll_interval (Watchdog *object, gint value)
18093{
18094 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
18095}
18096
18097/**
18098 * watchdog_emit_watchdog_error:
18099 * @object: A #Watchdog.
18100 *
18101 * Emits the <link linkend="gdbus-signal-org-openbmc-Watchdog.WatchdogError">"WatchdogError"</link> D-Bus signal.
18102 */
18103void
18104watchdog_emit_watchdog_error (
18105 Watchdog *object)
18106{
18107 g_signal_emit_by_name (object, "watchdog-error");
18108}
18109
18110/**
18111 * watchdog_call_start:
18112 * @proxy: A #WatchdogProxy.
18113 * @cancellable: (allow-none): A #GCancellable or %NULL.
18114 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
18115 * @user_data: User data to pass to @callback.
18116 *
18117 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method on @proxy.
18118 * 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.
18119 * You can then call watchdog_call_start_finish() to get the result of the operation.
18120 *
18121 * See watchdog_call_start_sync() for the synchronous, blocking version of this method.
18122 */
18123void
18124watchdog_call_start (
18125 Watchdog *proxy,
18126 GCancellable *cancellable,
18127 GAsyncReadyCallback callback,
18128 gpointer user_data)
18129{
18130 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
18131 "start",
18132 g_variant_new ("()"),
18133 G_DBUS_CALL_FLAGS_NONE,
18134 -1,
18135 cancellable,
18136 callback,
18137 user_data);
18138}
18139
18140/**
18141 * watchdog_call_start_finish:
18142 * @proxy: A #WatchdogProxy.
18143 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_start().
18144 * @error: Return location for error or %NULL.
18145 *
18146 * Finishes an operation started with watchdog_call_start().
18147 *
18148 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18149 */
18150gboolean
18151watchdog_call_start_finish (
18152 Watchdog *proxy,
18153 GAsyncResult *res,
18154 GError **error)
18155{
18156 GVariant *_ret;
18157 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
18158 if (_ret == NULL)
18159 goto _out;
18160 g_variant_get (_ret,
18161 "()");
18162 g_variant_unref (_ret);
18163_out:
18164 return _ret != NULL;
18165}
18166
18167/**
18168 * watchdog_call_start_sync:
18169 * @proxy: A #WatchdogProxy.
18170 * @cancellable: (allow-none): A #GCancellable or %NULL.
18171 * @error: Return location for error or %NULL.
18172 *
18173 * 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.
18174 *
18175 * See watchdog_call_start() for the asynchronous version of this method.
18176 *
18177 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18178 */
18179gboolean
18180watchdog_call_start_sync (
18181 Watchdog *proxy,
18182 GCancellable *cancellable,
18183 GError **error)
18184{
18185 GVariant *_ret;
18186 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
18187 "start",
18188 g_variant_new ("()"),
18189 G_DBUS_CALL_FLAGS_NONE,
18190 -1,
18191 cancellable,
18192 error);
18193 if (_ret == NULL)
18194 goto _out;
18195 g_variant_get (_ret,
18196 "()");
18197 g_variant_unref (_ret);
18198_out:
18199 return _ret != NULL;
18200}
18201
18202/**
18203 * watchdog_call_poke:
18204 * @proxy: A #WatchdogProxy.
18205 * @cancellable: (allow-none): A #GCancellable or %NULL.
18206 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
18207 * @user_data: User data to pass to @callback.
18208 *
18209 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method on @proxy.
18210 * 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.
18211 * You can then call watchdog_call_poke_finish() to get the result of the operation.
18212 *
18213 * See watchdog_call_poke_sync() for the synchronous, blocking version of this method.
18214 */
18215void
18216watchdog_call_poke (
18217 Watchdog *proxy,
18218 GCancellable *cancellable,
18219 GAsyncReadyCallback callback,
18220 gpointer user_data)
18221{
18222 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
18223 "poke",
18224 g_variant_new ("()"),
18225 G_DBUS_CALL_FLAGS_NONE,
18226 -1,
18227 cancellable,
18228 callback,
18229 user_data);
18230}
18231
18232/**
18233 * watchdog_call_poke_finish:
18234 * @proxy: A #WatchdogProxy.
18235 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_poke().
18236 * @error: Return location for error or %NULL.
18237 *
18238 * Finishes an operation started with watchdog_call_poke().
18239 *
18240 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18241 */
18242gboolean
18243watchdog_call_poke_finish (
18244 Watchdog *proxy,
18245 GAsyncResult *res,
18246 GError **error)
18247{
18248 GVariant *_ret;
18249 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
18250 if (_ret == NULL)
18251 goto _out;
18252 g_variant_get (_ret,
18253 "()");
18254 g_variant_unref (_ret);
18255_out:
18256 return _ret != NULL;
18257}
18258
18259/**
18260 * watchdog_call_poke_sync:
18261 * @proxy: A #WatchdogProxy.
18262 * @cancellable: (allow-none): A #GCancellable or %NULL.
18263 * @error: Return location for error or %NULL.
18264 *
18265 * 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.
18266 *
18267 * See watchdog_call_poke() for the asynchronous version of this method.
18268 *
18269 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18270 */
18271gboolean
18272watchdog_call_poke_sync (
18273 Watchdog *proxy,
18274 GCancellable *cancellable,
18275 GError **error)
18276{
18277 GVariant *_ret;
18278 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
18279 "poke",
18280 g_variant_new ("()"),
18281 G_DBUS_CALL_FLAGS_NONE,
18282 -1,
18283 cancellable,
18284 error);
18285 if (_ret == NULL)
18286 goto _out;
18287 g_variant_get (_ret,
18288 "()");
18289 g_variant_unref (_ret);
18290_out:
18291 return _ret != NULL;
18292}
18293
18294/**
18295 * watchdog_call_stop:
18296 * @proxy: A #WatchdogProxy.
18297 * @cancellable: (allow-none): A #GCancellable or %NULL.
18298 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
18299 * @user_data: User data to pass to @callback.
18300 *
18301 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method on @proxy.
18302 * 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.
18303 * You can then call watchdog_call_stop_finish() to get the result of the operation.
18304 *
18305 * See watchdog_call_stop_sync() for the synchronous, blocking version of this method.
18306 */
18307void
18308watchdog_call_stop (
18309 Watchdog *proxy,
18310 GCancellable *cancellable,
18311 GAsyncReadyCallback callback,
18312 gpointer user_data)
18313{
18314 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
18315 "stop",
18316 g_variant_new ("()"),
18317 G_DBUS_CALL_FLAGS_NONE,
18318 -1,
18319 cancellable,
18320 callback,
18321 user_data);
18322}
18323
18324/**
18325 * watchdog_call_stop_finish:
18326 * @proxy: A #WatchdogProxy.
18327 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_stop().
18328 * @error: Return location for error or %NULL.
18329 *
18330 * Finishes an operation started with watchdog_call_stop().
18331 *
18332 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18333 */
18334gboolean
18335watchdog_call_stop_finish (
18336 Watchdog *proxy,
18337 GAsyncResult *res,
18338 GError **error)
18339{
18340 GVariant *_ret;
18341 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
18342 if (_ret == NULL)
18343 goto _out;
18344 g_variant_get (_ret,
18345 "()");
18346 g_variant_unref (_ret);
18347_out:
18348 return _ret != NULL;
18349}
18350
18351/**
18352 * watchdog_call_stop_sync:
18353 * @proxy: A #WatchdogProxy.
18354 * @cancellable: (allow-none): A #GCancellable or %NULL.
18355 * @error: Return location for error or %NULL.
18356 *
18357 * 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.
18358 *
18359 * See watchdog_call_stop() for the asynchronous version of this method.
18360 *
18361 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18362 */
18363gboolean
18364watchdog_call_stop_sync (
18365 Watchdog *proxy,
18366 GCancellable *cancellable,
18367 GError **error)
18368{
18369 GVariant *_ret;
18370 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
18371 "stop",
18372 g_variant_new ("()"),
18373 G_DBUS_CALL_FLAGS_NONE,
18374 -1,
18375 cancellable,
18376 error);
18377 if (_ret == NULL)
18378 goto _out;
18379 g_variant_get (_ret,
18380 "()");
18381 g_variant_unref (_ret);
18382_out:
18383 return _ret != NULL;
18384}
18385
18386/**
Adriana Kobylak2cb27752015-10-19 16:23:14 -050018387 * watchdog_call_set:
18388 * @proxy: A #WatchdogProxy.
18389 * @arg_interval: Argument to pass with the method invocation.
18390 * @cancellable: (allow-none): A #GCancellable or %NULL.
18391 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
18392 * @user_data: User data to pass to @callback.
18393 *
18394 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method on @proxy.
18395 * 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.
18396 * You can then call watchdog_call_set_finish() to get the result of the operation.
18397 *
18398 * See watchdog_call_set_sync() for the synchronous, blocking version of this method.
18399 */
18400void
18401watchdog_call_set (
18402 Watchdog *proxy,
18403 gint arg_interval,
18404 GCancellable *cancellable,
18405 GAsyncReadyCallback callback,
18406 gpointer user_data)
18407{
18408 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
18409 "set",
18410 g_variant_new ("(i)",
18411 arg_interval),
18412 G_DBUS_CALL_FLAGS_NONE,
18413 -1,
18414 cancellable,
18415 callback,
18416 user_data);
18417}
18418
18419/**
18420 * watchdog_call_set_finish:
18421 * @proxy: A #WatchdogProxy.
18422 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_set().
18423 * @error: Return location for error or %NULL.
18424 *
18425 * Finishes an operation started with watchdog_call_set().
18426 *
18427 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18428 */
18429gboolean
18430watchdog_call_set_finish (
18431 Watchdog *proxy,
18432 GAsyncResult *res,
18433 GError **error)
18434{
18435 GVariant *_ret;
18436 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
18437 if (_ret == NULL)
18438 goto _out;
18439 g_variant_get (_ret,
18440 "()");
18441 g_variant_unref (_ret);
18442_out:
18443 return _ret != NULL;
18444}
18445
18446/**
18447 * watchdog_call_set_sync:
18448 * @proxy: A #WatchdogProxy.
18449 * @arg_interval: Argument to pass with the method invocation.
18450 * @cancellable: (allow-none): A #GCancellable or %NULL.
18451 * @error: Return location for error or %NULL.
18452 *
18453 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
18454 *
18455 * See watchdog_call_set() for the asynchronous version of this method.
18456 *
18457 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18458 */
18459gboolean
18460watchdog_call_set_sync (
18461 Watchdog *proxy,
18462 gint arg_interval,
18463 GCancellable *cancellable,
18464 GError **error)
18465{
18466 GVariant *_ret;
18467 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
18468 "set",
18469 g_variant_new ("(i)",
18470 arg_interval),
18471 G_DBUS_CALL_FLAGS_NONE,
18472 -1,
18473 cancellable,
18474 error);
18475 if (_ret == NULL)
18476 goto _out;
18477 g_variant_get (_ret,
18478 "()");
18479 g_variant_unref (_ret);
18480_out:
18481 return _ret != NULL;
18482}
18483
18484/**
Norman James362a80f2015-09-14 14:04:39 -050018485 * watchdog_complete_start:
18486 * @object: A #Watchdog.
18487 * @invocation: (transfer full): A #GDBusMethodInvocation.
18488 *
18489 * 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.
18490 *
18491 * This method will free @invocation, you cannot use it afterwards.
18492 */
18493void
18494watchdog_complete_start (
18495 Watchdog *object,
18496 GDBusMethodInvocation *invocation)
18497{
18498 g_dbus_method_invocation_return_value (invocation,
18499 g_variant_new ("()"));
18500}
18501
18502/**
18503 * watchdog_complete_poke:
18504 * @object: A #Watchdog.
18505 * @invocation: (transfer full): A #GDBusMethodInvocation.
18506 *
18507 * 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.
18508 *
18509 * This method will free @invocation, you cannot use it afterwards.
18510 */
18511void
18512watchdog_complete_poke (
18513 Watchdog *object,
18514 GDBusMethodInvocation *invocation)
18515{
18516 g_dbus_method_invocation_return_value (invocation,
18517 g_variant_new ("()"));
18518}
18519
18520/**
18521 * watchdog_complete_stop:
18522 * @object: A #Watchdog.
18523 * @invocation: (transfer full): A #GDBusMethodInvocation.
18524 *
18525 * 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.
18526 *
18527 * This method will free @invocation, you cannot use it afterwards.
18528 */
18529void
18530watchdog_complete_stop (
18531 Watchdog *object,
18532 GDBusMethodInvocation *invocation)
18533{
18534 g_dbus_method_invocation_return_value (invocation,
18535 g_variant_new ("()"));
18536}
18537
Adriana Kobylak2cb27752015-10-19 16:23:14 -050018538/**
18539 * watchdog_complete_set:
18540 * @object: A #Watchdog.
18541 * @invocation: (transfer full): A #GDBusMethodInvocation.
18542 *
18543 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</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.
18544 *
18545 * This method will free @invocation, you cannot use it afterwards.
18546 */
18547void
18548watchdog_complete_set (
18549 Watchdog *object,
18550 GDBusMethodInvocation *invocation)
18551{
18552 g_dbus_method_invocation_return_value (invocation,
18553 g_variant_new ("()"));
18554}
18555
Norman James362a80f2015-09-14 14:04:39 -050018556/* ------------------------------------------------------------------------ */
18557
18558/**
18559 * WatchdogProxy:
18560 *
18561 * The #WatchdogProxy structure contains only private data and should only be accessed using the provided API.
18562 */
18563
18564/**
18565 * WatchdogProxyClass:
18566 * @parent_class: The parent class.
18567 *
18568 * Class structure for #WatchdogProxy.
18569 */
18570
18571struct _WatchdogProxyPrivate
18572{
18573 GData *qdata;
18574};
18575
18576static void watchdog_proxy_iface_init (WatchdogIface *iface);
18577
18578#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18579G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY,
18580 G_ADD_PRIVATE (WatchdogProxy)
18581 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init));
18582
18583#else
18584G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY,
18585 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init));
18586
18587#endif
18588static void
18589watchdog_proxy_finalize (GObject *object)
18590{
18591 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
18592 g_datalist_clear (&proxy->priv->qdata);
18593 G_OBJECT_CLASS (watchdog_proxy_parent_class)->finalize (object);
18594}
18595
18596static void
18597watchdog_proxy_get_property (GObject *object,
18598 guint prop_id,
18599 GValue *value,
18600 GParamSpec *pspec G_GNUC_UNUSED)
18601{
18602 const _ExtendedGDBusPropertyInfo *info;
18603 GVariant *variant;
18604 g_assert (prop_id != 0 && prop_id - 1 < 2);
18605 info = _watchdog_property_info_pointers[prop_id - 1];
18606 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
18607 if (info->use_gvariant)
18608 {
18609 g_value_set_variant (value, variant);
18610 }
18611 else
18612 {
18613 if (variant != NULL)
18614 g_dbus_gvariant_to_gvalue (variant, value);
18615 }
18616 if (variant != NULL)
18617 g_variant_unref (variant);
18618}
18619
18620static void
18621watchdog_proxy_set_property_cb (GDBusProxy *proxy,
18622 GAsyncResult *res,
18623 gpointer user_data)
18624{
18625 const _ExtendedGDBusPropertyInfo *info = user_data;
18626 GError *error;
18627 GVariant *_ret;
18628 error = NULL;
18629 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
18630 if (!_ret)
18631 {
18632 g_warning ("Error setting property '%s' on interface org.openbmc.Watchdog: %s (%s, %d)",
18633 info->parent_struct.name,
18634 error->message, g_quark_to_string (error->domain), error->code);
18635 g_error_free (error);
18636 }
18637 else
18638 {
18639 g_variant_unref (_ret);
18640 }
18641}
18642
18643static void
18644watchdog_proxy_set_property (GObject *object,
18645 guint prop_id,
18646 const GValue *value,
18647 GParamSpec *pspec G_GNUC_UNUSED)
18648{
18649 const _ExtendedGDBusPropertyInfo *info;
18650 GVariant *variant;
18651 g_assert (prop_id != 0 && prop_id - 1 < 2);
18652 info = _watchdog_property_info_pointers[prop_id - 1];
18653 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
18654 g_dbus_proxy_call (G_DBUS_PROXY (object),
18655 "org.freedesktop.DBus.Properties.Set",
18656 g_variant_new ("(ssv)", "org.openbmc.Watchdog", info->parent_struct.name, variant),
18657 G_DBUS_CALL_FLAGS_NONE,
18658 -1,
18659 NULL, (GAsyncReadyCallback) watchdog_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
18660 g_variant_unref (variant);
18661}
18662
18663static void
18664watchdog_proxy_g_signal (GDBusProxy *proxy,
18665 const gchar *sender_name G_GNUC_UNUSED,
18666 const gchar *signal_name,
18667 GVariant *parameters)
18668{
18669 _ExtendedGDBusSignalInfo *info;
18670 GVariantIter iter;
18671 GVariant *child;
18672 GValue *paramv;
18673 guint num_params;
18674 guint n;
18675 guint signal_id;
18676 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, signal_name);
18677 if (info == NULL)
18678 return;
18679 num_params = g_variant_n_children (parameters);
18680 paramv = g_new0 (GValue, num_params + 1);
18681 g_value_init (&paramv[0], TYPE_WATCHDOG);
18682 g_value_set_object (&paramv[0], proxy);
18683 g_variant_iter_init (&iter, parameters);
18684 n = 1;
18685 while ((child = g_variant_iter_next_value (&iter)) != NULL)
18686 {
18687 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
18688 if (arg_info->use_gvariant)
18689 {
18690 g_value_init (&paramv[n], G_TYPE_VARIANT);
18691 g_value_set_variant (&paramv[n], child);
18692 n++;
18693 }
18694 else
18695 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
18696 g_variant_unref (child);
18697 }
18698 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG);
18699 g_signal_emitv (paramv, signal_id, 0, NULL);
18700 for (n = 0; n < num_params + 1; n++)
18701 g_value_unset (&paramv[n]);
18702 g_free (paramv);
18703}
18704
18705static void
18706watchdog_proxy_g_properties_changed (GDBusProxy *_proxy,
18707 GVariant *changed_properties,
18708 const gchar *const *invalidated_properties)
18709{
18710 WatchdogProxy *proxy = WATCHDOG_PROXY (_proxy);
18711 guint n;
18712 const gchar *key;
18713 GVariantIter *iter;
18714 _ExtendedGDBusPropertyInfo *info;
18715 g_variant_get (changed_properties, "a{sv}", &iter);
18716 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
18717 {
18718 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, key);
18719 g_datalist_remove_data (&proxy->priv->qdata, key);
18720 if (info != NULL)
18721 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
18722 }
18723 g_variant_iter_free (iter);
18724 for (n = 0; invalidated_properties[n] != NULL; n++)
18725 {
18726 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, invalidated_properties[n]);
18727 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
18728 if (info != NULL)
18729 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
18730 }
18731}
18732
18733static gint
18734watchdog_proxy_get_watchdog (Watchdog *object)
18735{
18736 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
18737 GVariant *variant;
18738 gint value = 0;
18739 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "watchdog");
18740 if (variant != NULL)
18741 {
18742 value = g_variant_get_int32 (variant);
18743 g_variant_unref (variant);
18744 }
18745 return value;
18746}
18747
18748static gint
18749watchdog_proxy_get_poll_interval (Watchdog *object)
18750{
18751 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
18752 GVariant *variant;
18753 gint value = 0;
18754 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
18755 if (variant != NULL)
18756 {
18757 value = g_variant_get_int32 (variant);
18758 g_variant_unref (variant);
18759 }
18760 return value;
18761}
18762
18763static void
18764watchdog_proxy_init (WatchdogProxy *proxy)
18765{
18766#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18767 proxy->priv = watchdog_proxy_get_instance_private (proxy);
18768#else
18769 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_WATCHDOG_PROXY, WatchdogProxyPrivate);
18770#endif
18771
18772 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), watchdog_interface_info ());
18773}
18774
18775static void
18776watchdog_proxy_class_init (WatchdogProxyClass *klass)
18777{
18778 GObjectClass *gobject_class;
18779 GDBusProxyClass *proxy_class;
18780
18781 gobject_class = G_OBJECT_CLASS (klass);
18782 gobject_class->finalize = watchdog_proxy_finalize;
18783 gobject_class->get_property = watchdog_proxy_get_property;
18784 gobject_class->set_property = watchdog_proxy_set_property;
18785
18786 proxy_class = G_DBUS_PROXY_CLASS (klass);
18787 proxy_class->g_signal = watchdog_proxy_g_signal;
18788 proxy_class->g_properties_changed = watchdog_proxy_g_properties_changed;
18789
18790 watchdog_override_properties (gobject_class, 1);
18791
18792#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
18793 g_type_class_add_private (klass, sizeof (WatchdogProxyPrivate));
18794#endif
18795}
18796
18797static void
18798watchdog_proxy_iface_init (WatchdogIface *iface)
18799{
18800 iface->get_watchdog = watchdog_proxy_get_watchdog;
18801 iface->get_poll_interval = watchdog_proxy_get_poll_interval;
18802}
18803
18804/**
18805 * watchdog_proxy_new:
18806 * @connection: A #GDBusConnection.
18807 * @flags: Flags from the #GDBusProxyFlags enumeration.
18808 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
18809 * @object_path: An object path.
18810 * @cancellable: (allow-none): A #GCancellable or %NULL.
18811 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
18812 * @user_data: User data to pass to @callback.
18813 *
18814 * 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.
18815 *
18816 * 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.
18817 * You can then call watchdog_proxy_new_finish() to get the result of the operation.
18818 *
18819 * See watchdog_proxy_new_sync() for the synchronous, blocking version of this constructor.
18820 */
18821void
18822watchdog_proxy_new (
18823 GDBusConnection *connection,
18824 GDBusProxyFlags flags,
18825 const gchar *name,
18826 const gchar *object_path,
18827 GCancellable *cancellable,
18828 GAsyncReadyCallback callback,
18829 gpointer user_data)
18830{
18831 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);
18832}
18833
18834/**
18835 * watchdog_proxy_new_finish:
18836 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new().
18837 * @error: Return location for error or %NULL
18838 *
18839 * Finishes an operation started with watchdog_proxy_new().
18840 *
18841 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
18842 */
18843Watchdog *
18844watchdog_proxy_new_finish (
18845 GAsyncResult *res,
18846 GError **error)
18847{
18848 GObject *ret;
18849 GObject *source_object;
18850 source_object = g_async_result_get_source_object (res);
18851 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
18852 g_object_unref (source_object);
18853 if (ret != NULL)
18854 return WATCHDOG (ret);
18855 else
18856 return NULL;
18857}
18858
18859/**
18860 * watchdog_proxy_new_sync:
18861 * @connection: A #GDBusConnection.
18862 * @flags: Flags from the #GDBusProxyFlags enumeration.
18863 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
18864 * @object_path: An object path.
18865 * @cancellable: (allow-none): A #GCancellable or %NULL.
18866 * @error: Return location for error or %NULL
18867 *
18868 * 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.
18869 *
18870 * The calling thread is blocked until a reply is received.
18871 *
18872 * See watchdog_proxy_new() for the asynchronous version of this constructor.
18873 *
18874 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
18875 */
18876Watchdog *
18877watchdog_proxy_new_sync (
18878 GDBusConnection *connection,
18879 GDBusProxyFlags flags,
18880 const gchar *name,
18881 const gchar *object_path,
18882 GCancellable *cancellable,
18883 GError **error)
18884{
18885 GInitable *ret;
18886 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);
18887 if (ret != NULL)
18888 return WATCHDOG (ret);
18889 else
18890 return NULL;
18891}
18892
18893
18894/**
18895 * watchdog_proxy_new_for_bus:
18896 * @bus_type: A #GBusType.
18897 * @flags: Flags from the #GDBusProxyFlags enumeration.
18898 * @name: A bus name (well-known or unique).
18899 * @object_path: An object path.
18900 * @cancellable: (allow-none): A #GCancellable or %NULL.
18901 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
18902 * @user_data: User data to pass to @callback.
18903 *
18904 * Like watchdog_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
18905 *
18906 * 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.
18907 * You can then call watchdog_proxy_new_for_bus_finish() to get the result of the operation.
18908 *
18909 * See watchdog_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
18910 */
18911void
18912watchdog_proxy_new_for_bus (
18913 GBusType bus_type,
18914 GDBusProxyFlags flags,
18915 const gchar *name,
18916 const gchar *object_path,
18917 GCancellable *cancellable,
18918 GAsyncReadyCallback callback,
18919 gpointer user_data)
18920{
18921 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);
18922}
18923
18924/**
18925 * watchdog_proxy_new_for_bus_finish:
18926 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new_for_bus().
18927 * @error: Return location for error or %NULL
18928 *
18929 * Finishes an operation started with watchdog_proxy_new_for_bus().
18930 *
18931 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
18932 */
18933Watchdog *
18934watchdog_proxy_new_for_bus_finish (
18935 GAsyncResult *res,
18936 GError **error)
18937{
18938 GObject *ret;
18939 GObject *source_object;
18940 source_object = g_async_result_get_source_object (res);
18941 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
18942 g_object_unref (source_object);
18943 if (ret != NULL)
18944 return WATCHDOG (ret);
18945 else
18946 return NULL;
18947}
18948
18949/**
18950 * watchdog_proxy_new_for_bus_sync:
18951 * @bus_type: A #GBusType.
18952 * @flags: Flags from the #GDBusProxyFlags enumeration.
18953 * @name: A bus name (well-known or unique).
18954 * @object_path: An object path.
18955 * @cancellable: (allow-none): A #GCancellable or %NULL.
18956 * @error: Return location for error or %NULL
18957 *
18958 * Like watchdog_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
18959 *
18960 * The calling thread is blocked until a reply is received.
18961 *
18962 * See watchdog_proxy_new_for_bus() for the asynchronous version of this constructor.
18963 *
18964 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
18965 */
18966Watchdog *
18967watchdog_proxy_new_for_bus_sync (
18968 GBusType bus_type,
18969 GDBusProxyFlags flags,
18970 const gchar *name,
18971 const gchar *object_path,
18972 GCancellable *cancellable,
18973 GError **error)
18974{
18975 GInitable *ret;
18976 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);
18977 if (ret != NULL)
18978 return WATCHDOG (ret);
18979 else
18980 return NULL;
18981}
18982
18983
18984/* ------------------------------------------------------------------------ */
18985
18986/**
18987 * WatchdogSkeleton:
18988 *
18989 * The #WatchdogSkeleton structure contains only private data and should only be accessed using the provided API.
18990 */
18991
18992/**
18993 * WatchdogSkeletonClass:
18994 * @parent_class: The parent class.
18995 *
18996 * Class structure for #WatchdogSkeleton.
18997 */
18998
18999struct _WatchdogSkeletonPrivate
19000{
19001 GValue *properties;
19002 GList *changed_properties;
19003 GSource *changed_properties_idle_source;
19004 GMainContext *context;
19005 GMutex lock;
19006};
19007
19008static void
19009_watchdog_skeleton_handle_method_call (
19010 GDBusConnection *connection G_GNUC_UNUSED,
19011 const gchar *sender G_GNUC_UNUSED,
19012 const gchar *object_path G_GNUC_UNUSED,
19013 const gchar *interface_name,
19014 const gchar *method_name,
19015 GVariant *parameters,
19016 GDBusMethodInvocation *invocation,
19017 gpointer user_data)
19018{
19019 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
19020 _ExtendedGDBusMethodInfo *info;
19021 GVariantIter iter;
19022 GVariant *child;
19023 GValue *paramv;
19024 guint num_params;
19025 guint num_extra;
19026 guint n;
19027 guint signal_id;
19028 GValue return_value = G_VALUE_INIT;
19029 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
19030 g_assert (info != NULL);
19031 num_params = g_variant_n_children (parameters);
19032 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
19033 n = 0;
19034 g_value_init (&paramv[n], TYPE_WATCHDOG);
19035 g_value_set_object (&paramv[n++], skeleton);
19036 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
19037 g_value_set_object (&paramv[n++], invocation);
19038 if (info->pass_fdlist)
19039 {
19040#ifdef G_OS_UNIX
19041 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
19042 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
19043#else
19044 g_assert_not_reached ();
19045#endif
19046 }
19047 g_variant_iter_init (&iter, parameters);
19048 while ((child = g_variant_iter_next_value (&iter)) != NULL)
19049 {
19050 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
19051 if (arg_info->use_gvariant)
19052 {
19053 g_value_init (&paramv[n], G_TYPE_VARIANT);
19054 g_value_set_variant (&paramv[n], child);
19055 n++;
19056 }
19057 else
19058 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
19059 g_variant_unref (child);
19060 }
19061 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG);
19062 g_value_init (&return_value, G_TYPE_BOOLEAN);
19063 g_signal_emitv (paramv, signal_id, 0, &return_value);
19064 if (!g_value_get_boolean (&return_value))
19065 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);
19066 g_value_unset (&return_value);
19067 for (n = 0; n < num_params + num_extra; n++)
19068 g_value_unset (&paramv[n]);
19069 g_free (paramv);
19070}
19071
19072static GVariant *
19073_watchdog_skeleton_handle_get_property (
19074 GDBusConnection *connection G_GNUC_UNUSED,
19075 const gchar *sender G_GNUC_UNUSED,
19076 const gchar *object_path G_GNUC_UNUSED,
19077 const gchar *interface_name G_GNUC_UNUSED,
19078 const gchar *property_name,
19079 GError **error,
19080 gpointer user_data)
19081{
19082 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
19083 GValue value = G_VALUE_INIT;
19084 GParamSpec *pspec;
19085 _ExtendedGDBusPropertyInfo *info;
19086 GVariant *ret;
19087 ret = NULL;
19088 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name);
19089 g_assert (info != NULL);
19090 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
19091 if (pspec == NULL)
19092 {
19093 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
19094 }
19095 else
19096 {
19097 g_value_init (&value, pspec->value_type);
19098 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
19099 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
19100 g_value_unset (&value);
19101 }
19102 return ret;
19103}
19104
19105static gboolean
19106_watchdog_skeleton_handle_set_property (
19107 GDBusConnection *connection G_GNUC_UNUSED,
19108 const gchar *sender G_GNUC_UNUSED,
19109 const gchar *object_path G_GNUC_UNUSED,
19110 const gchar *interface_name G_GNUC_UNUSED,
19111 const gchar *property_name,
19112 GVariant *variant,
19113 GError **error,
19114 gpointer user_data)
19115{
19116 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
19117 GValue value = G_VALUE_INIT;
19118 GParamSpec *pspec;
19119 _ExtendedGDBusPropertyInfo *info;
19120 gboolean ret;
19121 ret = FALSE;
19122 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name);
19123 g_assert (info != NULL);
19124 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
19125 if (pspec == NULL)
19126 {
19127 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
19128 }
19129 else
19130 {
19131 if (info->use_gvariant)
19132 g_value_set_variant (&value, variant);
19133 else
19134 g_dbus_gvariant_to_gvalue (variant, &value);
19135 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
19136 g_value_unset (&value);
19137 ret = TRUE;
19138 }
19139 return ret;
19140}
19141
19142static const GDBusInterfaceVTable _watchdog_skeleton_vtable =
19143{
19144 _watchdog_skeleton_handle_method_call,
19145 _watchdog_skeleton_handle_get_property,
19146 _watchdog_skeleton_handle_set_property,
19147 {NULL}
19148};
19149
19150static GDBusInterfaceInfo *
19151watchdog_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
19152{
19153 return watchdog_interface_info ();
19154}
19155
19156static GDBusInterfaceVTable *
19157watchdog_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
19158{
19159 return (GDBusInterfaceVTable *) &_watchdog_skeleton_vtable;
19160}
19161
19162static GVariant *
19163watchdog_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
19164{
19165 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton);
19166
19167 GVariantBuilder builder;
19168 guint n;
19169 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
19170 if (_watchdog_interface_info.parent_struct.properties == NULL)
19171 goto out;
19172 for (n = 0; _watchdog_interface_info.parent_struct.properties[n] != NULL; n++)
19173 {
19174 GDBusPropertyInfo *info = _watchdog_interface_info.parent_struct.properties[n];
19175 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
19176 {
19177 GVariant *value;
19178 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);
19179 if (value != NULL)
19180 {
19181 g_variant_take_ref (value);
19182 g_variant_builder_add (&builder, "{sv}", info->name, value);
19183 g_variant_unref (value);
19184 }
19185 }
19186 }
19187out:
19188 return g_variant_builder_end (&builder);
19189}
19190
19191static gboolean _watchdog_emit_changed (gpointer user_data);
19192
19193static void
19194watchdog_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
19195{
19196 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton);
19197 gboolean emit_changed = FALSE;
19198
19199 g_mutex_lock (&skeleton->priv->lock);
19200 if (skeleton->priv->changed_properties_idle_source != NULL)
19201 {
19202 g_source_destroy (skeleton->priv->changed_properties_idle_source);
19203 skeleton->priv->changed_properties_idle_source = NULL;
19204 emit_changed = TRUE;
19205 }
19206 g_mutex_unlock (&skeleton->priv->lock);
19207
19208 if (emit_changed)
19209 _watchdog_emit_changed (skeleton);
19210}
19211
19212static void
19213_watchdog_on_signal_watchdog_error (
19214 Watchdog *object)
19215{
19216 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
19217
19218 GList *connections, *l;
19219 GVariant *signal_variant;
19220 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
19221
19222 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
19223 for (l = connections; l != NULL; l = l->next)
19224 {
19225 GDBusConnection *connection = l->data;
19226 g_dbus_connection_emit_signal (connection,
19227 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Watchdog", "WatchdogError",
19228 signal_variant, NULL);
19229 }
19230 g_variant_unref (signal_variant);
19231 g_list_free_full (connections, g_object_unref);
19232}
19233
19234static void watchdog_skeleton_iface_init (WatchdogIface *iface);
19235#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19236G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
19237 G_ADD_PRIVATE (WatchdogSkeleton)
19238 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init));
19239
19240#else
19241G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
19242 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init));
19243
19244#endif
19245static void
19246watchdog_skeleton_finalize (GObject *object)
19247{
19248 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
19249 guint n;
19250 for (n = 0; n < 2; n++)
19251 g_value_unset (&skeleton->priv->properties[n]);
19252 g_free (skeleton->priv->properties);
19253 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
19254 if (skeleton->priv->changed_properties_idle_source != NULL)
19255 g_source_destroy (skeleton->priv->changed_properties_idle_source);
19256 g_main_context_unref (skeleton->priv->context);
19257 g_mutex_clear (&skeleton->priv->lock);
19258 G_OBJECT_CLASS (watchdog_skeleton_parent_class)->finalize (object);
19259}
19260
19261static void
19262watchdog_skeleton_get_property (GObject *object,
19263 guint prop_id,
19264 GValue *value,
19265 GParamSpec *pspec G_GNUC_UNUSED)
19266{
19267 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
19268 g_assert (prop_id != 0 && prop_id - 1 < 2);
19269 g_mutex_lock (&skeleton->priv->lock);
19270 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
19271 g_mutex_unlock (&skeleton->priv->lock);
19272}
19273
19274static gboolean
19275_watchdog_emit_changed (gpointer user_data)
19276{
19277 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
19278 GList *l;
19279 GVariantBuilder builder;
19280 GVariantBuilder invalidated_builder;
19281 guint num_changes;
19282
19283 g_mutex_lock (&skeleton->priv->lock);
19284 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
19285 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
19286 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
19287 {
19288 ChangedProperty *cp = l->data;
19289 GVariant *variant;
19290 const GValue *cur_value;
19291
19292 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
19293 if (!_g_value_equal (cur_value, &cp->orig_value))
19294 {
19295 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
19296 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
19297 g_variant_unref (variant);
19298 num_changes++;
19299 }
19300 }
19301 if (num_changes > 0)
19302 {
19303 GList *connections, *ll;
19304 GVariant *signal_variant;
19305 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Watchdog",
19306 &builder, &invalidated_builder));
19307 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
19308 for (ll = connections; ll != NULL; ll = ll->next)
19309 {
19310 GDBusConnection *connection = ll->data;
19311
19312 g_dbus_connection_emit_signal (connection,
19313 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
19314 "org.freedesktop.DBus.Properties",
19315 "PropertiesChanged",
19316 signal_variant,
19317 NULL);
19318 }
19319 g_variant_unref (signal_variant);
19320 g_list_free_full (connections, g_object_unref);
19321 }
19322 else
19323 {
19324 g_variant_builder_clear (&builder);
19325 g_variant_builder_clear (&invalidated_builder);
19326 }
19327 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
19328 skeleton->priv->changed_properties = NULL;
19329 skeleton->priv->changed_properties_idle_source = NULL;
19330 g_mutex_unlock (&skeleton->priv->lock);
19331 return FALSE;
19332}
19333
19334static void
19335_watchdog_schedule_emit_changed (WatchdogSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
19336{
19337 ChangedProperty *cp;
19338 GList *l;
19339 cp = NULL;
19340 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
19341 {
19342 ChangedProperty *i_cp = l->data;
19343 if (i_cp->info == info)
19344 {
19345 cp = i_cp;
19346 break;
19347 }
19348 }
19349 if (cp == NULL)
19350 {
19351 cp = g_new0 (ChangedProperty, 1);
19352 cp->prop_id = prop_id;
19353 cp->info = info;
19354 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
19355 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
19356 g_value_copy (orig_value, &cp->orig_value);
19357 }
19358}
19359
19360static void
19361watchdog_skeleton_notify (GObject *object,
19362 GParamSpec *pspec G_GNUC_UNUSED)
19363{
19364 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
19365 g_mutex_lock (&skeleton->priv->lock);
19366 if (skeleton->priv->changed_properties != NULL &&
19367 skeleton->priv->changed_properties_idle_source == NULL)
19368 {
19369 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
19370 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
19371 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _watchdog_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylak2cb27752015-10-19 16:23:14 -050019372 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _watchdog_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -050019373 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
19374 g_source_unref (skeleton->priv->changed_properties_idle_source);
19375 }
19376 g_mutex_unlock (&skeleton->priv->lock);
19377}
19378
19379static void
19380watchdog_skeleton_set_property (GObject *object,
19381 guint prop_id,
19382 const GValue *value,
19383 GParamSpec *pspec)
19384{
19385 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
19386 g_assert (prop_id != 0 && prop_id - 1 < 2);
19387 g_mutex_lock (&skeleton->priv->lock);
19388 g_object_freeze_notify (object);
19389 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
19390 {
19391 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
19392 _watchdog_schedule_emit_changed (skeleton, _watchdog_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
19393 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
19394 g_object_notify_by_pspec (object, pspec);
19395 }
19396 g_mutex_unlock (&skeleton->priv->lock);
19397 g_object_thaw_notify (object);
19398}
19399
19400static void
19401watchdog_skeleton_init (WatchdogSkeleton *skeleton)
19402{
19403#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19404 skeleton->priv = watchdog_skeleton_get_instance_private (skeleton);
19405#else
19406 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_WATCHDOG_SKELETON, WatchdogSkeletonPrivate);
19407#endif
19408
19409 g_mutex_init (&skeleton->priv->lock);
19410 skeleton->priv->context = g_main_context_ref_thread_default ();
19411 skeleton->priv->properties = g_new0 (GValue, 2);
19412 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
19413 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
19414}
19415
19416static gint
19417watchdog_skeleton_get_watchdog (Watchdog *object)
19418{
19419 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
19420 gint value;
19421 g_mutex_lock (&skeleton->priv->lock);
19422 value = g_value_get_int (&(skeleton->priv->properties[0]));
19423 g_mutex_unlock (&skeleton->priv->lock);
19424 return value;
19425}
19426
19427static gint
19428watchdog_skeleton_get_poll_interval (Watchdog *object)
19429{
19430 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
19431 gint value;
19432 g_mutex_lock (&skeleton->priv->lock);
19433 value = g_value_get_int (&(skeleton->priv->properties[1]));
19434 g_mutex_unlock (&skeleton->priv->lock);
19435 return value;
19436}
19437
19438static void
19439watchdog_skeleton_class_init (WatchdogSkeletonClass *klass)
19440{
19441 GObjectClass *gobject_class;
19442 GDBusInterfaceSkeletonClass *skeleton_class;
19443
19444 gobject_class = G_OBJECT_CLASS (klass);
19445 gobject_class->finalize = watchdog_skeleton_finalize;
19446 gobject_class->get_property = watchdog_skeleton_get_property;
19447 gobject_class->set_property = watchdog_skeleton_set_property;
19448 gobject_class->notify = watchdog_skeleton_notify;
19449
19450
19451 watchdog_override_properties (gobject_class, 1);
19452
19453 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
19454 skeleton_class->get_info = watchdog_skeleton_dbus_interface_get_info;
19455 skeleton_class->get_properties = watchdog_skeleton_dbus_interface_get_properties;
19456 skeleton_class->flush = watchdog_skeleton_dbus_interface_flush;
19457 skeleton_class->get_vtable = watchdog_skeleton_dbus_interface_get_vtable;
19458
19459#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
19460 g_type_class_add_private (klass, sizeof (WatchdogSkeletonPrivate));
19461#endif
19462}
19463
19464static void
19465watchdog_skeleton_iface_init (WatchdogIface *iface)
19466{
19467 iface->watchdog_error = _watchdog_on_signal_watchdog_error;
19468 iface->get_watchdog = watchdog_skeleton_get_watchdog;
19469 iface->get_poll_interval = watchdog_skeleton_get_poll_interval;
19470}
19471
19472/**
19473 * watchdog_skeleton_new:
19474 *
19475 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
19476 *
19477 * Returns: (transfer full) (type WatchdogSkeleton): The skeleton object.
19478 */
19479Watchdog *
19480watchdog_skeleton_new (void)
19481{
19482 return WATCHDOG (g_object_new (TYPE_WATCHDOG_SKELETON, NULL));
19483}
19484
19485/* ------------------------------------------------------------------------
19486 * Code for interface org.openbmc.EventLog
19487 * ------------------------------------------------------------------------
19488 */
19489
19490/**
19491 * SECTION:EventLog
19492 * @title: EventLog
19493 * @short_description: Generated C code for the org.openbmc.EventLog D-Bus interface
19494 *
19495 * 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.
19496 */
19497
19498/* ---- Introspection data for org.openbmc.EventLog ---- */
19499
Norman James2d1ee892015-09-16 23:13:45 -050019500static const _ExtendedGDBusArgInfo _event_log_method_info_get_event_log_OUT_ARG_log =
19501{
19502 {
19503 -1,
19504 (gchar *) "log",
19505 (gchar *) "a(s)",
19506 NULL
19507 },
19508 FALSE
19509};
19510
19511static const _ExtendedGDBusArgInfo * const _event_log_method_info_get_event_log_OUT_ARG_pointers[] =
19512{
19513 &_event_log_method_info_get_event_log_OUT_ARG_log,
19514 NULL
19515};
19516
19517static const _ExtendedGDBusMethodInfo _event_log_method_info_get_event_log =
19518{
19519 {
19520 -1,
19521 (gchar *) "getEventLog",
19522 NULL,
19523 (GDBusArgInfo **) &_event_log_method_info_get_event_log_OUT_ARG_pointers,
19524 NULL
19525 },
19526 "handle-get-event-log",
19527 FALSE
19528};
19529
19530static const _ExtendedGDBusMethodInfo * const _event_log_method_info_pointers[] =
19531{
19532 &_event_log_method_info_get_event_log,
19533 NULL
19534};
19535
Norman James8abb50c2015-09-16 10:58:16 -050019536static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_priority =
Norman James362a80f2015-09-14 14:04:39 -050019537{
19538 {
19539 -1,
Norman James8abb50c2015-09-16 10:58:16 -050019540 (gchar *) "priority",
19541 (gchar *) "i",
Norman James362a80f2015-09-14 14:04:39 -050019542 NULL
19543 },
19544 FALSE
19545};
19546
Norman James362a80f2015-09-14 14:04:39 -050019547static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_message =
19548{
19549 {
19550 -1,
19551 (gchar *) "message",
Norman James32e74e22015-09-15 21:28:06 -050019552 (gchar *) "s",
Norman James362a80f2015-09-14 14:04:39 -050019553 NULL
19554 },
19555 FALSE
19556};
19557
Norman James88872672015-09-21 16:51:35 -050019558static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_rc =
19559{
19560 {
19561 -1,
19562 (gchar *) "rc",
19563 (gchar *) "i",
19564 NULL
19565 },
19566 FALSE
19567};
19568
Norman James362a80f2015-09-14 14:04:39 -050019569static const _ExtendedGDBusArgInfo * const _event_log_signal_info_event_log_ARG_pointers[] =
19570{
Norman James8abb50c2015-09-16 10:58:16 -050019571 &_event_log_signal_info_event_log_ARG_priority,
Norman James362a80f2015-09-14 14:04:39 -050019572 &_event_log_signal_info_event_log_ARG_message,
Norman James88872672015-09-21 16:51:35 -050019573 &_event_log_signal_info_event_log_ARG_rc,
Norman James362a80f2015-09-14 14:04:39 -050019574 NULL
19575};
19576
19577static const _ExtendedGDBusSignalInfo _event_log_signal_info_event_log =
19578{
19579 {
19580 -1,
19581 (gchar *) "EventLog",
19582 (GDBusArgInfo **) &_event_log_signal_info_event_log_ARG_pointers,
19583 NULL
19584 },
19585 "event-log"
19586};
19587
19588static const _ExtendedGDBusSignalInfo * const _event_log_signal_info_pointers[] =
19589{
19590 &_event_log_signal_info_event_log,
19591 NULL
19592};
19593
Norman James362a80f2015-09-14 14:04:39 -050019594static const _ExtendedGDBusInterfaceInfo _event_log_interface_info =
19595{
19596 {
19597 -1,
19598 (gchar *) "org.openbmc.EventLog",
Norman James2d1ee892015-09-16 23:13:45 -050019599 (GDBusMethodInfo **) &_event_log_method_info_pointers,
Norman James362a80f2015-09-14 14:04:39 -050019600 (GDBusSignalInfo **) &_event_log_signal_info_pointers,
Norman James32e74e22015-09-15 21:28:06 -050019601 NULL,
Norman James362a80f2015-09-14 14:04:39 -050019602 NULL
19603 },
19604 "event-log",
19605};
19606
19607
19608/**
19609 * event_log_interface_info:
19610 *
19611 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> D-Bus interface.
19612 *
19613 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
19614 */
19615GDBusInterfaceInfo *
19616event_log_interface_info (void)
19617{
19618 return (GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct;
19619}
19620
19621/**
19622 * event_log_override_properties:
19623 * @klass: The class structure for a #GObject<!-- -->-derived class.
19624 * @property_id_begin: The property id to assign to the first overridden property.
19625 *
19626 * Overrides all #GObject properties in the #EventLog interface for a concrete class.
19627 * The properties are overridden in the order they are defined.
19628 *
19629 * Returns: The last property id.
19630 */
19631guint
19632event_log_override_properties (GObjectClass *klass, guint property_id_begin)
19633{
Norman James362a80f2015-09-14 14:04:39 -050019634 return property_id_begin - 1;
19635}
19636
19637
19638
19639/**
19640 * EventLog:
19641 *
19642 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
19643 */
19644
19645/**
19646 * EventLogIface:
19647 * @parent_iface: The parent interface.
Norman James2d1ee892015-09-16 23:13:45 -050019648 * @handle_get_event_log: Handler for the #EventLog::handle-get-event-log signal.
Norman James362a80f2015-09-14 14:04:39 -050019649 * @event_log: Handler for the #EventLog::event-log signal.
19650 *
19651 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
19652 */
19653
19654typedef EventLogIface EventLogInterface;
19655G_DEFINE_INTERFACE (EventLog, event_log, G_TYPE_OBJECT);
19656
19657static void
19658event_log_default_init (EventLogIface *iface)
19659{
Norman James2d1ee892015-09-16 23:13:45 -050019660 /* GObject signals for incoming D-Bus method calls: */
19661 /**
19662 * EventLog::handle-get-event-log:
19663 * @object: A #EventLog.
19664 * @invocation: A #GDBusMethodInvocation.
19665 *
19666 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method.
19667 *
19668 * 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.
19669 *
19670 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
19671 */
19672 g_signal_new ("handle-get-event-log",
19673 G_TYPE_FROM_INTERFACE (iface),
19674 G_SIGNAL_RUN_LAST,
19675 G_STRUCT_OFFSET (EventLogIface, handle_get_event_log),
19676 g_signal_accumulator_true_handled,
19677 NULL,
19678 g_cclosure_marshal_generic,
19679 G_TYPE_BOOLEAN,
19680 1,
19681 G_TYPE_DBUS_METHOD_INVOCATION);
19682
Norman James362a80f2015-09-14 14:04:39 -050019683 /* GObject signals for received D-Bus signals: */
19684 /**
19685 * EventLog::event-log:
19686 * @object: A #EventLog.
Norman James8abb50c2015-09-16 10:58:16 -050019687 * @arg_priority: Argument.
Norman James362a80f2015-09-14 14:04:39 -050019688 * @arg_message: Argument.
Norman James88872672015-09-21 16:51:35 -050019689 * @arg_rc: Argument.
Norman James362a80f2015-09-14 14:04:39 -050019690 *
19691 * 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.
19692 *
19693 * 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.
19694 */
19695 g_signal_new ("event-log",
19696 G_TYPE_FROM_INTERFACE (iface),
19697 G_SIGNAL_RUN_LAST,
19698 G_STRUCT_OFFSET (EventLogIface, event_log),
19699 NULL,
19700 NULL,
19701 g_cclosure_marshal_generic,
19702 G_TYPE_NONE,
Norman James88872672015-09-21 16:51:35 -050019703 3, G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT);
Norman James362a80f2015-09-14 14:04:39 -050019704
Norman James362a80f2015-09-14 14:04:39 -050019705}
19706
19707/**
19708 * event_log_emit_event_log:
19709 * @object: A #EventLog.
Norman James8abb50c2015-09-16 10:58:16 -050019710 * @arg_priority: Argument to pass with the signal.
Norman James362a80f2015-09-14 14:04:39 -050019711 * @arg_message: Argument to pass with the signal.
Norman James88872672015-09-21 16:51:35 -050019712 * @arg_rc: Argument to pass with the signal.
Norman James362a80f2015-09-14 14:04:39 -050019713 *
19714 * Emits the <link linkend="gdbus-signal-org-openbmc-EventLog.EventLog">"EventLog"</link> D-Bus signal.
19715 */
19716void
19717event_log_emit_event_log (
19718 EventLog *object,
Norman James8abb50c2015-09-16 10:58:16 -050019719 gint arg_priority,
Norman James88872672015-09-21 16:51:35 -050019720 const gchar *arg_message,
19721 gint arg_rc)
Norman James362a80f2015-09-14 14:04:39 -050019722{
Norman James88872672015-09-21 16:51:35 -050019723 g_signal_emit_by_name (object, "event-log", arg_priority, arg_message, arg_rc);
Norman James362a80f2015-09-14 14:04:39 -050019724}
19725
Norman James2d1ee892015-09-16 23:13:45 -050019726/**
19727 * event_log_call_get_event_log:
19728 * @proxy: A #EventLogProxy.
19729 * @cancellable: (allow-none): A #GCancellable or %NULL.
19730 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19731 * @user_data: User data to pass to @callback.
19732 *
19733 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method on @proxy.
19734 * 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.
19735 * You can then call event_log_call_get_event_log_finish() to get the result of the operation.
19736 *
19737 * See event_log_call_get_event_log_sync() for the synchronous, blocking version of this method.
19738 */
19739void
19740event_log_call_get_event_log (
19741 EventLog *proxy,
19742 GCancellable *cancellable,
19743 GAsyncReadyCallback callback,
19744 gpointer user_data)
19745{
19746 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19747 "getEventLog",
19748 g_variant_new ("()"),
19749 G_DBUS_CALL_FLAGS_NONE,
19750 -1,
19751 cancellable,
19752 callback,
19753 user_data);
19754}
19755
19756/**
19757 * event_log_call_get_event_log_finish:
19758 * @proxy: A #EventLogProxy.
19759 * @out_log: (out): Return location for return parameter or %NULL to ignore.
19760 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_call_get_event_log().
19761 * @error: Return location for error or %NULL.
19762 *
19763 * Finishes an operation started with event_log_call_get_event_log().
19764 *
19765 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19766 */
19767gboolean
19768event_log_call_get_event_log_finish (
19769 EventLog *proxy,
19770 GVariant **out_log,
19771 GAsyncResult *res,
19772 GError **error)
19773{
19774 GVariant *_ret;
19775 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19776 if (_ret == NULL)
19777 goto _out;
19778 g_variant_get (_ret,
19779 "(@a(s))",
19780 out_log);
19781 g_variant_unref (_ret);
19782_out:
19783 return _ret != NULL;
19784}
19785
19786/**
19787 * event_log_call_get_event_log_sync:
19788 * @proxy: A #EventLogProxy.
19789 * @out_log: (out): Return location for return parameter or %NULL to ignore.
19790 * @cancellable: (allow-none): A #GCancellable or %NULL.
19791 * @error: Return location for error or %NULL.
19792 *
19793 * 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.
19794 *
19795 * See event_log_call_get_event_log() for the asynchronous version of this method.
19796 *
19797 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19798 */
19799gboolean
19800event_log_call_get_event_log_sync (
19801 EventLog *proxy,
19802 GVariant **out_log,
19803 GCancellable *cancellable,
19804 GError **error)
19805{
19806 GVariant *_ret;
19807 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19808 "getEventLog",
19809 g_variant_new ("()"),
19810 G_DBUS_CALL_FLAGS_NONE,
19811 -1,
19812 cancellable,
19813 error);
19814 if (_ret == NULL)
19815 goto _out;
19816 g_variant_get (_ret,
19817 "(@a(s))",
19818 out_log);
19819 g_variant_unref (_ret);
19820_out:
19821 return _ret != NULL;
19822}
19823
19824/**
19825 * event_log_complete_get_event_log:
19826 * @object: A #EventLog.
19827 * @invocation: (transfer full): A #GDBusMethodInvocation.
19828 * @log: Parameter to return.
19829 *
19830 * 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.
19831 *
19832 * This method will free @invocation, you cannot use it afterwards.
19833 */
19834void
19835event_log_complete_get_event_log (
19836 EventLog *object,
19837 GDBusMethodInvocation *invocation,
19838 GVariant *log)
19839{
19840 g_dbus_method_invocation_return_value (invocation,
19841 g_variant_new ("(@a(s))",
19842 log));
19843}
19844
Norman James362a80f2015-09-14 14:04:39 -050019845/* ------------------------------------------------------------------------ */
19846
19847/**
19848 * EventLogProxy:
19849 *
19850 * The #EventLogProxy structure contains only private data and should only be accessed using the provided API.
19851 */
19852
19853/**
19854 * EventLogProxyClass:
19855 * @parent_class: The parent class.
19856 *
19857 * Class structure for #EventLogProxy.
19858 */
19859
19860struct _EventLogProxyPrivate
19861{
19862 GData *qdata;
19863};
19864
19865static void event_log_proxy_iface_init (EventLogIface *iface);
19866
19867#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19868G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
19869 G_ADD_PRIVATE (EventLogProxy)
19870 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
19871
19872#else
19873G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
19874 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
19875
19876#endif
19877static void
19878event_log_proxy_finalize (GObject *object)
19879{
19880 EventLogProxy *proxy = EVENT_LOG_PROXY (object);
19881 g_datalist_clear (&proxy->priv->qdata);
19882 G_OBJECT_CLASS (event_log_proxy_parent_class)->finalize (object);
19883}
19884
19885static void
19886event_log_proxy_get_property (GObject *object,
19887 guint prop_id,
19888 GValue *value,
19889 GParamSpec *pspec G_GNUC_UNUSED)
19890{
Norman James362a80f2015-09-14 14:04:39 -050019891}
19892
19893static void
19894event_log_proxy_set_property (GObject *object,
19895 guint prop_id,
19896 const GValue *value,
19897 GParamSpec *pspec G_GNUC_UNUSED)
19898{
Norman James362a80f2015-09-14 14:04:39 -050019899}
19900
19901static void
19902event_log_proxy_g_signal (GDBusProxy *proxy,
19903 const gchar *sender_name G_GNUC_UNUSED,
19904 const gchar *signal_name,
19905 GVariant *parameters)
19906{
19907 _ExtendedGDBusSignalInfo *info;
19908 GVariantIter iter;
19909 GVariant *child;
19910 GValue *paramv;
19911 guint num_params;
19912 guint n;
19913 guint signal_id;
19914 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, signal_name);
19915 if (info == NULL)
19916 return;
19917 num_params = g_variant_n_children (parameters);
19918 paramv = g_new0 (GValue, num_params + 1);
19919 g_value_init (&paramv[0], TYPE_EVENT_LOG);
19920 g_value_set_object (&paramv[0], proxy);
19921 g_variant_iter_init (&iter, parameters);
19922 n = 1;
19923 while ((child = g_variant_iter_next_value (&iter)) != NULL)
19924 {
19925 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
19926 if (arg_info->use_gvariant)
19927 {
19928 g_value_init (&paramv[n], G_TYPE_VARIANT);
19929 g_value_set_variant (&paramv[n], child);
19930 n++;
19931 }
19932 else
19933 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
19934 g_variant_unref (child);
19935 }
19936 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
19937 g_signal_emitv (paramv, signal_id, 0, NULL);
19938 for (n = 0; n < num_params + 1; n++)
19939 g_value_unset (&paramv[n]);
19940 g_free (paramv);
19941}
19942
19943static void
19944event_log_proxy_g_properties_changed (GDBusProxy *_proxy,
19945 GVariant *changed_properties,
19946 const gchar *const *invalidated_properties)
19947{
19948 EventLogProxy *proxy = EVENT_LOG_PROXY (_proxy);
19949 guint n;
19950 const gchar *key;
19951 GVariantIter *iter;
19952 _ExtendedGDBusPropertyInfo *info;
19953 g_variant_get (changed_properties, "a{sv}", &iter);
19954 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
19955 {
19956 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, key);
19957 g_datalist_remove_data (&proxy->priv->qdata, key);
19958 if (info != NULL)
19959 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
19960 }
19961 g_variant_iter_free (iter);
19962 for (n = 0; invalidated_properties[n] != NULL; n++)
19963 {
19964 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, invalidated_properties[n]);
19965 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
19966 if (info != NULL)
19967 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
19968 }
19969}
19970
Norman James362a80f2015-09-14 14:04:39 -050019971static void
19972event_log_proxy_init (EventLogProxy *proxy)
19973{
19974#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19975 proxy->priv = event_log_proxy_get_instance_private (proxy);
19976#else
19977 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_EVENT_LOG_PROXY, EventLogProxyPrivate);
19978#endif
19979
19980 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), event_log_interface_info ());
19981}
19982
19983static void
19984event_log_proxy_class_init (EventLogProxyClass *klass)
19985{
19986 GObjectClass *gobject_class;
19987 GDBusProxyClass *proxy_class;
19988
19989 gobject_class = G_OBJECT_CLASS (klass);
19990 gobject_class->finalize = event_log_proxy_finalize;
19991 gobject_class->get_property = event_log_proxy_get_property;
19992 gobject_class->set_property = event_log_proxy_set_property;
19993
19994 proxy_class = G_DBUS_PROXY_CLASS (klass);
19995 proxy_class->g_signal = event_log_proxy_g_signal;
19996 proxy_class->g_properties_changed = event_log_proxy_g_properties_changed;
19997
Norman James362a80f2015-09-14 14:04:39 -050019998#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
19999 g_type_class_add_private (klass, sizeof (EventLogProxyPrivate));
20000#endif
20001}
20002
20003static void
20004event_log_proxy_iface_init (EventLogIface *iface)
20005{
Norman James362a80f2015-09-14 14:04:39 -050020006}
20007
20008/**
20009 * event_log_proxy_new:
20010 * @connection: A #GDBusConnection.
20011 * @flags: Flags from the #GDBusProxyFlags enumeration.
20012 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
20013 * @object_path: An object path.
20014 * @cancellable: (allow-none): A #GCancellable or %NULL.
20015 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
20016 * @user_data: User data to pass to @callback.
20017 *
20018 * 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.
20019 *
20020 * 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.
20021 * You can then call event_log_proxy_new_finish() to get the result of the operation.
20022 *
20023 * See event_log_proxy_new_sync() for the synchronous, blocking version of this constructor.
20024 */
20025void
20026event_log_proxy_new (
20027 GDBusConnection *connection,
20028 GDBusProxyFlags flags,
20029 const gchar *name,
20030 const gchar *object_path,
20031 GCancellable *cancellable,
20032 GAsyncReadyCallback callback,
20033 gpointer user_data)
20034{
20035 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);
20036}
20037
20038/**
20039 * event_log_proxy_new_finish:
20040 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new().
20041 * @error: Return location for error or %NULL
20042 *
20043 * Finishes an operation started with event_log_proxy_new().
20044 *
20045 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
20046 */
20047EventLog *
20048event_log_proxy_new_finish (
20049 GAsyncResult *res,
20050 GError **error)
20051{
20052 GObject *ret;
20053 GObject *source_object;
20054 source_object = g_async_result_get_source_object (res);
20055 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
20056 g_object_unref (source_object);
20057 if (ret != NULL)
20058 return EVENT_LOG (ret);
20059 else
20060 return NULL;
20061}
20062
20063/**
20064 * event_log_proxy_new_sync:
20065 * @connection: A #GDBusConnection.
20066 * @flags: Flags from the #GDBusProxyFlags enumeration.
20067 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
20068 * @object_path: An object path.
20069 * @cancellable: (allow-none): A #GCancellable or %NULL.
20070 * @error: Return location for error or %NULL
20071 *
20072 * 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.
20073 *
20074 * The calling thread is blocked until a reply is received.
20075 *
20076 * See event_log_proxy_new() for the asynchronous version of this constructor.
20077 *
20078 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
20079 */
20080EventLog *
20081event_log_proxy_new_sync (
20082 GDBusConnection *connection,
20083 GDBusProxyFlags flags,
20084 const gchar *name,
20085 const gchar *object_path,
20086 GCancellable *cancellable,
20087 GError **error)
20088{
20089 GInitable *ret;
20090 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);
20091 if (ret != NULL)
20092 return EVENT_LOG (ret);
20093 else
20094 return NULL;
20095}
20096
20097
20098/**
20099 * event_log_proxy_new_for_bus:
20100 * @bus_type: A #GBusType.
20101 * @flags: Flags from the #GDBusProxyFlags enumeration.
20102 * @name: A bus name (well-known or unique).
20103 * @object_path: An object path.
20104 * @cancellable: (allow-none): A #GCancellable or %NULL.
20105 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
20106 * @user_data: User data to pass to @callback.
20107 *
20108 * Like event_log_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
20109 *
20110 * 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.
20111 * You can then call event_log_proxy_new_for_bus_finish() to get the result of the operation.
20112 *
20113 * See event_log_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
20114 */
20115void
20116event_log_proxy_new_for_bus (
20117 GBusType bus_type,
20118 GDBusProxyFlags flags,
20119 const gchar *name,
20120 const gchar *object_path,
20121 GCancellable *cancellable,
20122 GAsyncReadyCallback callback,
20123 gpointer user_data)
20124{
20125 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);
20126}
20127
20128/**
20129 * event_log_proxy_new_for_bus_finish:
20130 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new_for_bus().
20131 * @error: Return location for error or %NULL
20132 *
20133 * Finishes an operation started with event_log_proxy_new_for_bus().
20134 *
20135 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
20136 */
20137EventLog *
20138event_log_proxy_new_for_bus_finish (
20139 GAsyncResult *res,
20140 GError **error)
20141{
20142 GObject *ret;
20143 GObject *source_object;
20144 source_object = g_async_result_get_source_object (res);
20145 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
20146 g_object_unref (source_object);
20147 if (ret != NULL)
20148 return EVENT_LOG (ret);
20149 else
20150 return NULL;
20151}
20152
20153/**
20154 * event_log_proxy_new_for_bus_sync:
20155 * @bus_type: A #GBusType.
20156 * @flags: Flags from the #GDBusProxyFlags enumeration.
20157 * @name: A bus name (well-known or unique).
20158 * @object_path: An object path.
20159 * @cancellable: (allow-none): A #GCancellable or %NULL.
20160 * @error: Return location for error or %NULL
20161 *
20162 * Like event_log_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
20163 *
20164 * The calling thread is blocked until a reply is received.
20165 *
20166 * See event_log_proxy_new_for_bus() for the asynchronous version of this constructor.
20167 *
20168 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
20169 */
20170EventLog *
20171event_log_proxy_new_for_bus_sync (
20172 GBusType bus_type,
20173 GDBusProxyFlags flags,
20174 const gchar *name,
20175 const gchar *object_path,
20176 GCancellable *cancellable,
20177 GError **error)
20178{
20179 GInitable *ret;
20180 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);
20181 if (ret != NULL)
20182 return EVENT_LOG (ret);
20183 else
20184 return NULL;
20185}
20186
20187
20188/* ------------------------------------------------------------------------ */
20189
20190/**
20191 * EventLogSkeleton:
20192 *
20193 * The #EventLogSkeleton structure contains only private data and should only be accessed using the provided API.
20194 */
20195
20196/**
20197 * EventLogSkeletonClass:
20198 * @parent_class: The parent class.
20199 *
20200 * Class structure for #EventLogSkeleton.
20201 */
20202
20203struct _EventLogSkeletonPrivate
20204{
20205 GValue *properties;
20206 GList *changed_properties;
20207 GSource *changed_properties_idle_source;
20208 GMainContext *context;
20209 GMutex lock;
20210};
20211
20212static void
20213_event_log_skeleton_handle_method_call (
20214 GDBusConnection *connection G_GNUC_UNUSED,
20215 const gchar *sender G_GNUC_UNUSED,
20216 const gchar *object_path G_GNUC_UNUSED,
20217 const gchar *interface_name,
20218 const gchar *method_name,
20219 GVariant *parameters,
20220 GDBusMethodInvocation *invocation,
20221 gpointer user_data)
20222{
20223 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
20224 _ExtendedGDBusMethodInfo *info;
20225 GVariantIter iter;
20226 GVariant *child;
20227 GValue *paramv;
20228 guint num_params;
20229 guint num_extra;
20230 guint n;
20231 guint signal_id;
20232 GValue return_value = G_VALUE_INIT;
20233 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
20234 g_assert (info != NULL);
20235 num_params = g_variant_n_children (parameters);
20236 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
20237 n = 0;
20238 g_value_init (&paramv[n], TYPE_EVENT_LOG);
20239 g_value_set_object (&paramv[n++], skeleton);
20240 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
20241 g_value_set_object (&paramv[n++], invocation);
20242 if (info->pass_fdlist)
20243 {
20244#ifdef G_OS_UNIX
20245 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
20246 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
20247#else
20248 g_assert_not_reached ();
20249#endif
20250 }
20251 g_variant_iter_init (&iter, parameters);
20252 while ((child = g_variant_iter_next_value (&iter)) != NULL)
20253 {
20254 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
20255 if (arg_info->use_gvariant)
20256 {
20257 g_value_init (&paramv[n], G_TYPE_VARIANT);
20258 g_value_set_variant (&paramv[n], child);
20259 n++;
20260 }
20261 else
20262 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
20263 g_variant_unref (child);
20264 }
20265 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
20266 g_value_init (&return_value, G_TYPE_BOOLEAN);
20267 g_signal_emitv (paramv, signal_id, 0, &return_value);
20268 if (!g_value_get_boolean (&return_value))
20269 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);
20270 g_value_unset (&return_value);
20271 for (n = 0; n < num_params + num_extra; n++)
20272 g_value_unset (&paramv[n]);
20273 g_free (paramv);
20274}
20275
20276static GVariant *
20277_event_log_skeleton_handle_get_property (
20278 GDBusConnection *connection G_GNUC_UNUSED,
20279 const gchar *sender G_GNUC_UNUSED,
20280 const gchar *object_path G_GNUC_UNUSED,
20281 const gchar *interface_name G_GNUC_UNUSED,
20282 const gchar *property_name,
20283 GError **error,
20284 gpointer user_data)
20285{
20286 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
20287 GValue value = G_VALUE_INIT;
20288 GParamSpec *pspec;
20289 _ExtendedGDBusPropertyInfo *info;
20290 GVariant *ret;
20291 ret = NULL;
20292 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
20293 g_assert (info != NULL);
20294 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
20295 if (pspec == NULL)
20296 {
20297 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
20298 }
20299 else
20300 {
20301 g_value_init (&value, pspec->value_type);
20302 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
20303 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
20304 g_value_unset (&value);
20305 }
20306 return ret;
20307}
20308
20309static gboolean
20310_event_log_skeleton_handle_set_property (
20311 GDBusConnection *connection G_GNUC_UNUSED,
20312 const gchar *sender G_GNUC_UNUSED,
20313 const gchar *object_path G_GNUC_UNUSED,
20314 const gchar *interface_name G_GNUC_UNUSED,
20315 const gchar *property_name,
20316 GVariant *variant,
20317 GError **error,
20318 gpointer user_data)
20319{
20320 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
20321 GValue value = G_VALUE_INIT;
20322 GParamSpec *pspec;
20323 _ExtendedGDBusPropertyInfo *info;
20324 gboolean ret;
20325 ret = FALSE;
20326 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
20327 g_assert (info != NULL);
20328 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
20329 if (pspec == NULL)
20330 {
20331 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
20332 }
20333 else
20334 {
20335 if (info->use_gvariant)
20336 g_value_set_variant (&value, variant);
20337 else
20338 g_dbus_gvariant_to_gvalue (variant, &value);
20339 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
20340 g_value_unset (&value);
20341 ret = TRUE;
20342 }
20343 return ret;
20344}
20345
20346static const GDBusInterfaceVTable _event_log_skeleton_vtable =
20347{
20348 _event_log_skeleton_handle_method_call,
20349 _event_log_skeleton_handle_get_property,
20350 _event_log_skeleton_handle_set_property,
20351 {NULL}
20352};
20353
20354static GDBusInterfaceInfo *
20355event_log_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
20356{
20357 return event_log_interface_info ();
20358}
20359
20360static GDBusInterfaceVTable *
20361event_log_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
20362{
20363 return (GDBusInterfaceVTable *) &_event_log_skeleton_vtable;
20364}
20365
20366static GVariant *
20367event_log_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
20368{
20369 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (_skeleton);
20370
20371 GVariantBuilder builder;
20372 guint n;
20373 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
20374 if (_event_log_interface_info.parent_struct.properties == NULL)
20375 goto out;
20376 for (n = 0; _event_log_interface_info.parent_struct.properties[n] != NULL; n++)
20377 {
20378 GDBusPropertyInfo *info = _event_log_interface_info.parent_struct.properties[n];
20379 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
20380 {
20381 GVariant *value;
20382 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);
20383 if (value != NULL)
20384 {
20385 g_variant_take_ref (value);
20386 g_variant_builder_add (&builder, "{sv}", info->name, value);
20387 g_variant_unref (value);
20388 }
20389 }
20390 }
20391out:
20392 return g_variant_builder_end (&builder);
20393}
20394
Norman James362a80f2015-09-14 14:04:39 -050020395static void
20396event_log_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
20397{
Norman James362a80f2015-09-14 14:04:39 -050020398}
20399
20400static void
20401_event_log_on_signal_event_log (
20402 EventLog *object,
Norman James8abb50c2015-09-16 10:58:16 -050020403 gint arg_priority,
Norman James88872672015-09-21 16:51:35 -050020404 const gchar *arg_message,
20405 gint arg_rc)
Norman James362a80f2015-09-14 14:04:39 -050020406{
20407 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
20408
20409 GList *connections, *l;
20410 GVariant *signal_variant;
20411 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
20412
Norman James88872672015-09-21 16:51:35 -050020413 signal_variant = g_variant_ref_sink (g_variant_new ("(isi)",
Norman James8abb50c2015-09-16 10:58:16 -050020414 arg_priority,
Norman James88872672015-09-21 16:51:35 -050020415 arg_message,
20416 arg_rc));
Norman James362a80f2015-09-14 14:04:39 -050020417 for (l = connections; l != NULL; l = l->next)
20418 {
20419 GDBusConnection *connection = l->data;
20420 g_dbus_connection_emit_signal (connection,
20421 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.EventLog", "EventLog",
20422 signal_variant, NULL);
20423 }
20424 g_variant_unref (signal_variant);
20425 g_list_free_full (connections, g_object_unref);
20426}
20427
20428static void event_log_skeleton_iface_init (EventLogIface *iface);
20429#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20430G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
20431 G_ADD_PRIVATE (EventLogSkeleton)
20432 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
20433
20434#else
20435G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
20436 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
20437
20438#endif
20439static void
20440event_log_skeleton_finalize (GObject *object)
20441{
20442 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
Norman James362a80f2015-09-14 14:04:39 -050020443 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
20444 if (skeleton->priv->changed_properties_idle_source != NULL)
20445 g_source_destroy (skeleton->priv->changed_properties_idle_source);
20446 g_main_context_unref (skeleton->priv->context);
20447 g_mutex_clear (&skeleton->priv->lock);
20448 G_OBJECT_CLASS (event_log_skeleton_parent_class)->finalize (object);
20449}
20450
20451static void
Norman James362a80f2015-09-14 14:04:39 -050020452event_log_skeleton_init (EventLogSkeleton *skeleton)
20453{
20454#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20455 skeleton->priv = event_log_skeleton_get_instance_private (skeleton);
20456#else
20457 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_EVENT_LOG_SKELETON, EventLogSkeletonPrivate);
20458#endif
20459
20460 g_mutex_init (&skeleton->priv->lock);
20461 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James362a80f2015-09-14 14:04:39 -050020462}
20463
20464static void
20465event_log_skeleton_class_init (EventLogSkeletonClass *klass)
20466{
20467 GObjectClass *gobject_class;
20468 GDBusInterfaceSkeletonClass *skeleton_class;
20469
20470 gobject_class = G_OBJECT_CLASS (klass);
20471 gobject_class->finalize = event_log_skeleton_finalize;
Norman James362a80f2015-09-14 14:04:39 -050020472
20473 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
20474 skeleton_class->get_info = event_log_skeleton_dbus_interface_get_info;
20475 skeleton_class->get_properties = event_log_skeleton_dbus_interface_get_properties;
20476 skeleton_class->flush = event_log_skeleton_dbus_interface_flush;
20477 skeleton_class->get_vtable = event_log_skeleton_dbus_interface_get_vtable;
20478
20479#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
20480 g_type_class_add_private (klass, sizeof (EventLogSkeletonPrivate));
20481#endif
20482}
20483
20484static void
20485event_log_skeleton_iface_init (EventLogIface *iface)
20486{
20487 iface->event_log = _event_log_on_signal_event_log;
Norman James362a80f2015-09-14 14:04:39 -050020488}
20489
20490/**
20491 * event_log_skeleton_new:
20492 *
20493 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
20494 *
20495 * Returns: (transfer full) (type EventLogSkeleton): The skeleton object.
20496 */
20497EventLog *
20498event_log_skeleton_new (void)
20499{
20500 return EVENT_LOG (g_object_new (TYPE_EVENT_LOG_SKELETON, NULL));
20501}
20502
20503/* ------------------------------------------------------------------------
20504 * Code for interface org.openbmc.Flash
20505 * ------------------------------------------------------------------------
20506 */
20507
20508/**
20509 * SECTION:Flash
20510 * @title: Flash
20511 * @short_description: Generated C code for the org.openbmc.Flash D-Bus interface
20512 *
20513 * 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.
20514 */
20515
20516/* ---- Introspection data for org.openbmc.Flash ---- */
20517
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020518static const _ExtendedGDBusArgInfo _flash_method_info_update_IN_ARG_filename =
Norman James362a80f2015-09-14 14:04:39 -050020519{
20520 {
20521 -1,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020522 (gchar *) "filename",
Norman James362a80f2015-09-14 14:04:39 -050020523 (gchar *) "s",
20524 NULL
20525 },
20526 FALSE
20527};
20528
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020529static const _ExtendedGDBusArgInfo * const _flash_method_info_update_IN_ARG_pointers[] =
Norman James362a80f2015-09-14 14:04:39 -050020530{
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020531 &_flash_method_info_update_IN_ARG_filename,
Norman James362a80f2015-09-14 14:04:39 -050020532 NULL
20533};
20534
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020535static const _ExtendedGDBusMethodInfo _flash_method_info_update =
Norman James362a80f2015-09-14 14:04:39 -050020536{
20537 {
20538 -1,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020539 (gchar *) "update",
20540 (GDBusArgInfo **) &_flash_method_info_update_IN_ARG_pointers,
Norman James362a80f2015-09-14 14:04:39 -050020541 NULL,
20542 NULL
20543 },
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020544 "handle-update",
Norman James362a80f2015-09-14 14:04:39 -050020545 FALSE
20546};
20547
Norman Jamesf066e872015-10-07 15:29:51 -050020548static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_url =
20549{
20550 {
20551 -1,
20552 (gchar *) "url",
20553 (gchar *) "s",
20554 NULL
20555 },
20556 FALSE
20557};
20558
20559static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_filename =
20560{
20561 {
20562 -1,
20563 (gchar *) "filename",
20564 (gchar *) "s",
20565 NULL
20566 },
20567 FALSE
20568};
20569
20570static const _ExtendedGDBusArgInfo * const _flash_method_info_update_via_tftp_IN_ARG_pointers[] =
20571{
20572 &_flash_method_info_update_via_tftp_IN_ARG_url,
20573 &_flash_method_info_update_via_tftp_IN_ARG_filename,
20574 NULL
20575};
20576
20577static const _ExtendedGDBusMethodInfo _flash_method_info_update_via_tftp =
20578{
20579 {
20580 -1,
20581 (gchar *) "updateViaTftp",
20582 (GDBusArgInfo **) &_flash_method_info_update_via_tftp_IN_ARG_pointers,
20583 NULL,
20584 NULL
20585 },
20586 "handle-update-via-tftp",
20587 FALSE
20588};
20589
Norman James362a80f2015-09-14 14:04:39 -050020590static const _ExtendedGDBusMethodInfo _flash_method_info_init =
20591{
20592 {
20593 -1,
20594 (gchar *) "init",
20595 NULL,
20596 NULL,
20597 NULL
20598 },
20599 "handle-init",
20600 FALSE
20601};
20602
20603static const _ExtendedGDBusMethodInfo * const _flash_method_info_pointers[] =
20604{
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020605 &_flash_method_info_update,
Norman Jamesf066e872015-10-07 15:29:51 -050020606 &_flash_method_info_update_via_tftp,
Norman James362a80f2015-09-14 14:04:39 -050020607 &_flash_method_info_init,
20608 NULL
20609};
20610
20611static const _ExtendedGDBusSignalInfo _flash_signal_info_updated =
20612{
20613 {
20614 -1,
20615 (gchar *) "Updated",
20616 NULL,
20617 NULL
20618 },
20619 "updated"
20620};
20621
Norman Jamesf066e872015-10-07 15:29:51 -050020622static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_url =
20623{
20624 {
20625 -1,
20626 (gchar *) "url",
20627 (gchar *) "s",
20628 NULL
20629 },
20630 FALSE
20631};
20632
20633static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_filename =
20634{
20635 {
20636 -1,
20637 (gchar *) "filename",
20638 (gchar *) "s",
20639 NULL
20640 },
20641 FALSE
20642};
20643
20644static const _ExtendedGDBusArgInfo * const _flash_signal_info_download_ARG_pointers[] =
20645{
20646 &_flash_signal_info_download_ARG_url,
20647 &_flash_signal_info_download_ARG_filename,
20648 NULL
20649};
20650
20651static const _ExtendedGDBusSignalInfo _flash_signal_info_download =
20652{
20653 {
20654 -1,
20655 (gchar *) "Download",
20656 (GDBusArgInfo **) &_flash_signal_info_download_ARG_pointers,
20657 NULL
20658 },
20659 "download"
20660};
20661
Norman James362a80f2015-09-14 14:04:39 -050020662static const _ExtendedGDBusSignalInfo * const _flash_signal_info_pointers[] =
20663{
20664 &_flash_signal_info_updated,
Norman Jamesf066e872015-10-07 15:29:51 -050020665 &_flash_signal_info_download,
Norman James362a80f2015-09-14 14:04:39 -050020666 NULL
20667};
20668
Norman James18998182015-10-11 21:54:53 -050020669static const _ExtendedGDBusPropertyInfo _flash_property_info_filename =
20670{
20671 {
20672 -1,
20673 (gchar *) "filename",
20674 (gchar *) "s",
20675 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
20676 NULL
20677 },
20678 "filename",
20679 FALSE
20680};
20681
20682static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_path =
20683{
20684 {
20685 -1,
20686 (gchar *) "flasher_path",
20687 (gchar *) "s",
20688 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
20689 NULL
20690 },
20691 "flasher-path",
20692 FALSE
20693};
20694
20695static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_name =
20696{
20697 {
20698 -1,
20699 (gchar *) "flasher_name",
20700 (gchar *) "s",
20701 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
20702 NULL
20703 },
20704 "flasher-name",
20705 FALSE
20706};
20707
20708static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_instance =
20709{
20710 {
20711 -1,
20712 (gchar *) "flasher_instance",
20713 (gchar *) "s",
20714 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
20715 NULL
20716 },
20717 "flasher-instance",
20718 FALSE
20719};
20720
20721static const _ExtendedGDBusPropertyInfo * const _flash_property_info_pointers[] =
20722{
20723 &_flash_property_info_filename,
20724 &_flash_property_info_flasher_path,
20725 &_flash_property_info_flasher_name,
20726 &_flash_property_info_flasher_instance,
20727 NULL
20728};
20729
Norman James362a80f2015-09-14 14:04:39 -050020730static const _ExtendedGDBusInterfaceInfo _flash_interface_info =
20731{
20732 {
20733 -1,
20734 (gchar *) "org.openbmc.Flash",
20735 (GDBusMethodInfo **) &_flash_method_info_pointers,
20736 (GDBusSignalInfo **) &_flash_signal_info_pointers,
Norman James18998182015-10-11 21:54:53 -050020737 (GDBusPropertyInfo **) &_flash_property_info_pointers,
Norman James362a80f2015-09-14 14:04:39 -050020738 NULL
20739 },
20740 "flash",
20741};
20742
20743
20744/**
20745 * flash_interface_info:
20746 *
20747 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> D-Bus interface.
20748 *
20749 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
20750 */
20751GDBusInterfaceInfo *
20752flash_interface_info (void)
20753{
20754 return (GDBusInterfaceInfo *) &_flash_interface_info.parent_struct;
20755}
20756
20757/**
20758 * flash_override_properties:
20759 * @klass: The class structure for a #GObject<!-- -->-derived class.
20760 * @property_id_begin: The property id to assign to the first overridden property.
20761 *
20762 * Overrides all #GObject properties in the #Flash interface for a concrete class.
20763 * The properties are overridden in the order they are defined.
20764 *
20765 * Returns: The last property id.
20766 */
20767guint
20768flash_override_properties (GObjectClass *klass, guint property_id_begin)
20769{
Norman James18998182015-10-11 21:54:53 -050020770 g_object_class_override_property (klass, property_id_begin++, "filename");
20771 g_object_class_override_property (klass, property_id_begin++, "flasher-path");
20772 g_object_class_override_property (klass, property_id_begin++, "flasher-name");
20773 g_object_class_override_property (klass, property_id_begin++, "flasher-instance");
Norman James362a80f2015-09-14 14:04:39 -050020774 return property_id_begin - 1;
20775}
20776
20777
20778
20779/**
20780 * Flash:
20781 *
20782 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
20783 */
20784
20785/**
20786 * FlashIface:
20787 * @parent_iface: The parent interface.
Norman James362a80f2015-09-14 14:04:39 -050020788 * @handle_init: Handler for the #Flash::handle-init signal.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020789 * @handle_update: Handler for the #Flash::handle-update signal.
Norman Jamesf066e872015-10-07 15:29:51 -050020790 * @handle_update_via_tftp: Handler for the #Flash::handle-update-via-tftp signal.
Norman James18998182015-10-11 21:54:53 -050020791 * @get_filename: Getter for the #Flash:filename property.
20792 * @get_flasher_instance: Getter for the #Flash:flasher-instance property.
20793 * @get_flasher_name: Getter for the #Flash:flasher-name property.
20794 * @get_flasher_path: Getter for the #Flash:flasher-path property.
Norman Jamesf066e872015-10-07 15:29:51 -050020795 * @download: Handler for the #Flash::download signal.
Norman James362a80f2015-09-14 14:04:39 -050020796 * @updated: Handler for the #Flash::updated signal.
20797 *
20798 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
20799 */
20800
20801typedef FlashIface FlashInterface;
20802G_DEFINE_INTERFACE (Flash, flash, G_TYPE_OBJECT);
20803
20804static void
20805flash_default_init (FlashIface *iface)
20806{
20807 /* GObject signals for incoming D-Bus method calls: */
20808 /**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020809 * Flash::handle-update:
Norman James362a80f2015-09-14 14:04:39 -050020810 * @object: A #Flash.
20811 * @invocation: A #GDBusMethodInvocation.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020812 * @arg_filename: Argument passed by remote caller.
Norman James362a80f2015-09-14 14:04:39 -050020813 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020814 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.update">update()</link> D-Bus method.
Norman James362a80f2015-09-14 14:04:39 -050020815 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020816 * 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() 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.
Norman James362a80f2015-09-14 14:04:39 -050020817 *
20818 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
20819 */
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020820 g_signal_new ("handle-update",
Norman James362a80f2015-09-14 14:04:39 -050020821 G_TYPE_FROM_INTERFACE (iface),
20822 G_SIGNAL_RUN_LAST,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020823 G_STRUCT_OFFSET (FlashIface, handle_update),
Norman James362a80f2015-09-14 14:04:39 -050020824 g_signal_accumulator_true_handled,
20825 NULL,
20826 g_cclosure_marshal_generic,
20827 G_TYPE_BOOLEAN,
20828 2,
20829 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
20830
20831 /**
Norman Jamesf066e872015-10-07 15:29:51 -050020832 * Flash::handle-update-via-tftp:
20833 * @object: A #Flash.
20834 * @invocation: A #GDBusMethodInvocation.
20835 * @arg_url: Argument passed by remote caller.
20836 * @arg_filename: Argument passed by remote caller.
20837 *
20838 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method.
20839 *
20840 * 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_tftp() 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.
20841 *
20842 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
20843 */
20844 g_signal_new ("handle-update-via-tftp",
20845 G_TYPE_FROM_INTERFACE (iface),
20846 G_SIGNAL_RUN_LAST,
20847 G_STRUCT_OFFSET (FlashIface, handle_update_via_tftp),
20848 g_signal_accumulator_true_handled,
20849 NULL,
20850 g_cclosure_marshal_generic,
20851 G_TYPE_BOOLEAN,
20852 3,
20853 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING);
20854
20855 /**
Norman James362a80f2015-09-14 14:04:39 -050020856 * Flash::handle-init:
20857 * @object: A #Flash.
20858 * @invocation: A #GDBusMethodInvocation.
20859 *
20860 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method.
20861 *
20862 * 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.
20863 *
20864 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
20865 */
20866 g_signal_new ("handle-init",
20867 G_TYPE_FROM_INTERFACE (iface),
20868 G_SIGNAL_RUN_LAST,
20869 G_STRUCT_OFFSET (FlashIface, handle_init),
20870 g_signal_accumulator_true_handled,
20871 NULL,
20872 g_cclosure_marshal_generic,
20873 G_TYPE_BOOLEAN,
20874 1,
20875 G_TYPE_DBUS_METHOD_INVOCATION);
20876
20877 /* GObject signals for received D-Bus signals: */
20878 /**
20879 * Flash::updated:
20880 * @object: A #Flash.
20881 *
20882 * 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.
20883 *
20884 * 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.
20885 */
20886 g_signal_new ("updated",
20887 G_TYPE_FROM_INTERFACE (iface),
20888 G_SIGNAL_RUN_LAST,
20889 G_STRUCT_OFFSET (FlashIface, updated),
20890 NULL,
20891 NULL,
20892 g_cclosure_marshal_generic,
20893 G_TYPE_NONE,
20894 0);
20895
Norman Jamesf066e872015-10-07 15:29:51 -050020896 /**
20897 * Flash::download:
20898 * @object: A #Flash.
20899 * @arg_url: Argument.
20900 * @arg_filename: Argument.
20901 *
20902 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Flash.Download">"Download"</link> is received.
20903 *
20904 * 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.
20905 */
20906 g_signal_new ("download",
20907 G_TYPE_FROM_INTERFACE (iface),
20908 G_SIGNAL_RUN_LAST,
20909 G_STRUCT_OFFSET (FlashIface, download),
20910 NULL,
20911 NULL,
20912 g_cclosure_marshal_generic,
20913 G_TYPE_NONE,
20914 2, G_TYPE_STRING, G_TYPE_STRING);
20915
Norman James18998182015-10-11 21:54:53 -050020916 /* GObject properties for D-Bus properties: */
20917 /**
20918 * Flash:filename:
20919 *
20920 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link>.
20921 *
20922 * 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.
20923 */
20924 g_object_interface_install_property (iface,
20925 g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
20926 /**
20927 * Flash:flasher-path:
20928 *
20929 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link>.
20930 *
20931 * 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.
20932 */
20933 g_object_interface_install_property (iface,
20934 g_param_spec_string ("flasher-path", "flasher_path", "flasher_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
20935 /**
20936 * Flash:flasher-name:
20937 *
20938 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link>.
20939 *
20940 * 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.
20941 */
20942 g_object_interface_install_property (iface,
20943 g_param_spec_string ("flasher-name", "flasher_name", "flasher_name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
20944 /**
20945 * Flash:flasher-instance:
20946 *
20947 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link>.
20948 *
20949 * 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.
20950 */
20951 g_object_interface_install_property (iface,
20952 g_param_spec_string ("flasher-instance", "flasher_instance", "flasher_instance", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
20953}
20954
20955/**
20956 * flash_get_filename: (skip)
20957 * @object: A #Flash.
20958 *
20959 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property.
20960 *
20961 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
20962 *
20963 * <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 flash_dup_filename() if on another thread.</warning>
20964 *
20965 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
20966 */
20967const gchar *
20968flash_get_filename (Flash *object)
20969{
20970 return FLASH_GET_IFACE (object)->get_filename (object);
20971}
20972
20973/**
20974 * flash_dup_filename: (skip)
20975 * @object: A #Flash.
20976 *
20977 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property.
20978 *
20979 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
20980 *
20981 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
20982 */
20983gchar *
20984flash_dup_filename (Flash *object)
20985{
20986 gchar *value;
20987 g_object_get (G_OBJECT (object), "filename", &value, NULL);
20988 return value;
20989}
20990
20991/**
20992 * flash_set_filename: (skip)
20993 * @object: A #Flash.
20994 * @value: The value to set.
20995 *
20996 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property to @value.
20997 *
20998 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
20999 */
21000void
21001flash_set_filename (Flash *object, const gchar *value)
21002{
21003 g_object_set (G_OBJECT (object), "filename", value, NULL);
21004}
21005
21006/**
21007 * flash_get_flasher_path: (skip)
21008 * @object: A #Flash.
21009 *
21010 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property.
21011 *
21012 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
21013 *
21014 * <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 flash_dup_flasher_path() if on another thread.</warning>
21015 *
21016 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
21017 */
21018const gchar *
21019flash_get_flasher_path (Flash *object)
21020{
21021 return FLASH_GET_IFACE (object)->get_flasher_path (object);
21022}
21023
21024/**
21025 * flash_dup_flasher_path: (skip)
21026 * @object: A #Flash.
21027 *
21028 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property.
21029 *
21030 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
21031 *
21032 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
21033 */
21034gchar *
21035flash_dup_flasher_path (Flash *object)
21036{
21037 gchar *value;
21038 g_object_get (G_OBJECT (object), "flasher-path", &value, NULL);
21039 return value;
21040}
21041
21042/**
21043 * flash_set_flasher_path: (skip)
21044 * @object: A #Flash.
21045 * @value: The value to set.
21046 *
21047 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property to @value.
21048 *
21049 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
21050 */
21051void
21052flash_set_flasher_path (Flash *object, const gchar *value)
21053{
21054 g_object_set (G_OBJECT (object), "flasher-path", value, NULL);
21055}
21056
21057/**
21058 * flash_get_flasher_name: (skip)
21059 * @object: A #Flash.
21060 *
21061 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property.
21062 *
21063 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
21064 *
21065 * <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 flash_dup_flasher_name() if on another thread.</warning>
21066 *
21067 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
21068 */
21069const gchar *
21070flash_get_flasher_name (Flash *object)
21071{
21072 return FLASH_GET_IFACE (object)->get_flasher_name (object);
21073}
21074
21075/**
21076 * flash_dup_flasher_name: (skip)
21077 * @object: A #Flash.
21078 *
21079 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property.
21080 *
21081 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
21082 *
21083 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
21084 */
21085gchar *
21086flash_dup_flasher_name (Flash *object)
21087{
21088 gchar *value;
21089 g_object_get (G_OBJECT (object), "flasher-name", &value, NULL);
21090 return value;
21091}
21092
21093/**
21094 * flash_set_flasher_name: (skip)
21095 * @object: A #Flash.
21096 * @value: The value to set.
21097 *
21098 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property to @value.
21099 *
21100 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
21101 */
21102void
21103flash_set_flasher_name (Flash *object, const gchar *value)
21104{
21105 g_object_set (G_OBJECT (object), "flasher-name", value, NULL);
21106}
21107
21108/**
21109 * flash_get_flasher_instance: (skip)
21110 * @object: A #Flash.
21111 *
21112 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property.
21113 *
21114 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
21115 *
21116 * <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 flash_dup_flasher_instance() if on another thread.</warning>
21117 *
21118 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
21119 */
21120const gchar *
21121flash_get_flasher_instance (Flash *object)
21122{
21123 return FLASH_GET_IFACE (object)->get_flasher_instance (object);
21124}
21125
21126/**
21127 * flash_dup_flasher_instance: (skip)
21128 * @object: A #Flash.
21129 *
21130 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property.
21131 *
21132 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
21133 *
21134 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
21135 */
21136gchar *
21137flash_dup_flasher_instance (Flash *object)
21138{
21139 gchar *value;
21140 g_object_get (G_OBJECT (object), "flasher-instance", &value, NULL);
21141 return value;
21142}
21143
21144/**
21145 * flash_set_flasher_instance: (skip)
21146 * @object: A #Flash.
21147 * @value: The value to set.
21148 *
21149 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property to @value.
21150 *
21151 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
21152 */
21153void
21154flash_set_flasher_instance (Flash *object, const gchar *value)
21155{
21156 g_object_set (G_OBJECT (object), "flasher-instance", value, NULL);
Norman James362a80f2015-09-14 14:04:39 -050021157}
21158
21159/**
21160 * flash_emit_updated:
21161 * @object: A #Flash.
21162 *
21163 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Updated">"Updated"</link> D-Bus signal.
21164 */
21165void
21166flash_emit_updated (
21167 Flash *object)
21168{
21169 g_signal_emit_by_name (object, "updated");
21170}
21171
21172/**
Norman Jamesf066e872015-10-07 15:29:51 -050021173 * flash_emit_download:
21174 * @object: A #Flash.
21175 * @arg_url: Argument to pass with the signal.
21176 * @arg_filename: Argument to pass with the signal.
21177 *
21178 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Download">"Download"</link> D-Bus signal.
21179 */
21180void
21181flash_emit_download (
21182 Flash *object,
21183 const gchar *arg_url,
21184 const gchar *arg_filename)
21185{
21186 g_signal_emit_by_name (object, "download", arg_url, arg_filename);
21187}
21188
21189/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021190 * flash_call_update:
Norman James362a80f2015-09-14 14:04:39 -050021191 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021192 * @arg_filename: Argument to pass with the method invocation.
Norman James362a80f2015-09-14 14:04:39 -050021193 * @cancellable: (allow-none): A #GCancellable or %NULL.
21194 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
21195 * @user_data: User data to pass to @callback.
21196 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021197 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.update">update()</link> D-Bus method on @proxy.
Norman James362a80f2015-09-14 14:04:39 -050021198 * 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.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021199 * You can then call flash_call_update_finish() to get the result of the operation.
Norman James362a80f2015-09-14 14:04:39 -050021200 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021201 * See flash_call_update_sync() for the synchronous, blocking version of this method.
Norman James362a80f2015-09-14 14:04:39 -050021202 */
21203void
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021204flash_call_update (
Norman James362a80f2015-09-14 14:04:39 -050021205 Flash *proxy,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021206 const gchar *arg_filename,
Norman James362a80f2015-09-14 14:04:39 -050021207 GCancellable *cancellable,
21208 GAsyncReadyCallback callback,
21209 gpointer user_data)
21210{
21211 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021212 "update",
Norman James362a80f2015-09-14 14:04:39 -050021213 g_variant_new ("(s)",
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021214 arg_filename),
Norman James362a80f2015-09-14 14:04:39 -050021215 G_DBUS_CALL_FLAGS_NONE,
21216 -1,
21217 cancellable,
21218 callback,
21219 user_data);
21220}
21221
21222/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021223 * flash_call_update_finish:
Norman James362a80f2015-09-14 14:04:39 -050021224 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021225 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update().
Norman James362a80f2015-09-14 14:04:39 -050021226 * @error: Return location for error or %NULL.
21227 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021228 * Finishes an operation started with flash_call_update().
Norman James362a80f2015-09-14 14:04:39 -050021229 *
21230 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
21231 */
21232gboolean
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021233flash_call_update_finish (
Norman James362a80f2015-09-14 14:04:39 -050021234 Flash *proxy,
21235 GAsyncResult *res,
21236 GError **error)
21237{
21238 GVariant *_ret;
21239 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
21240 if (_ret == NULL)
21241 goto _out;
21242 g_variant_get (_ret,
21243 "()");
21244 g_variant_unref (_ret);
21245_out:
21246 return _ret != NULL;
21247}
21248
21249/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021250 * flash_call_update_sync:
Norman James362a80f2015-09-14 14:04:39 -050021251 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021252 * @arg_filename: Argument to pass with the method invocation.
Norman James362a80f2015-09-14 14:04:39 -050021253 * @cancellable: (allow-none): A #GCancellable or %NULL.
21254 * @error: Return location for error or %NULL.
21255 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021256 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.update">update()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
Norman James362a80f2015-09-14 14:04:39 -050021257 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021258 * See flash_call_update() for the asynchronous version of this method.
Norman James362a80f2015-09-14 14:04:39 -050021259 *
21260 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
21261 */
21262gboolean
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021263flash_call_update_sync (
Norman James362a80f2015-09-14 14:04:39 -050021264 Flash *proxy,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021265 const gchar *arg_filename,
Norman James362a80f2015-09-14 14:04:39 -050021266 GCancellable *cancellable,
21267 GError **error)
21268{
21269 GVariant *_ret;
21270 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021271 "update",
Norman James362a80f2015-09-14 14:04:39 -050021272 g_variant_new ("(s)",
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021273 arg_filename),
Norman James362a80f2015-09-14 14:04:39 -050021274 G_DBUS_CALL_FLAGS_NONE,
21275 -1,
21276 cancellable,
21277 error);
21278 if (_ret == NULL)
21279 goto _out;
21280 g_variant_get (_ret,
21281 "()");
21282 g_variant_unref (_ret);
21283_out:
21284 return _ret != NULL;
21285}
21286
21287/**
Norman Jamesf066e872015-10-07 15:29:51 -050021288 * flash_call_update_via_tftp:
21289 * @proxy: A #FlashProxy.
21290 * @arg_url: Argument to pass with the method invocation.
21291 * @arg_filename: Argument to pass with the method invocation.
21292 * @cancellable: (allow-none): A #GCancellable or %NULL.
21293 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
21294 * @user_data: User data to pass to @callback.
21295 *
21296 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method on @proxy.
21297 * 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.
21298 * You can then call flash_call_update_via_tftp_finish() to get the result of the operation.
21299 *
21300 * See flash_call_update_via_tftp_sync() for the synchronous, blocking version of this method.
21301 */
21302void
21303flash_call_update_via_tftp (
21304 Flash *proxy,
21305 const gchar *arg_url,
21306 const gchar *arg_filename,
21307 GCancellable *cancellable,
21308 GAsyncReadyCallback callback,
21309 gpointer user_data)
21310{
21311 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
21312 "updateViaTftp",
21313 g_variant_new ("(ss)",
21314 arg_url,
21315 arg_filename),
21316 G_DBUS_CALL_FLAGS_NONE,
21317 -1,
21318 cancellable,
21319 callback,
21320 user_data);
21321}
21322
21323/**
21324 * flash_call_update_via_tftp_finish:
21325 * @proxy: A #FlashProxy.
21326 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update_via_tftp().
21327 * @error: Return location for error or %NULL.
21328 *
21329 * Finishes an operation started with flash_call_update_via_tftp().
21330 *
21331 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
21332 */
21333gboolean
21334flash_call_update_via_tftp_finish (
21335 Flash *proxy,
21336 GAsyncResult *res,
21337 GError **error)
21338{
21339 GVariant *_ret;
21340 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
21341 if (_ret == NULL)
21342 goto _out;
21343 g_variant_get (_ret,
21344 "()");
21345 g_variant_unref (_ret);
21346_out:
21347 return _ret != NULL;
21348}
21349
21350/**
21351 * flash_call_update_via_tftp_sync:
21352 * @proxy: A #FlashProxy.
21353 * @arg_url: Argument to pass with the method invocation.
21354 * @arg_filename: Argument to pass with the method invocation.
21355 * @cancellable: (allow-none): A #GCancellable or %NULL.
21356 * @error: Return location for error or %NULL.
21357 *
21358 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
21359 *
21360 * See flash_call_update_via_tftp() for the asynchronous version of this method.
21361 *
21362 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
21363 */
21364gboolean
21365flash_call_update_via_tftp_sync (
21366 Flash *proxy,
21367 const gchar *arg_url,
21368 const gchar *arg_filename,
21369 GCancellable *cancellable,
21370 GError **error)
21371{
21372 GVariant *_ret;
21373 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
21374 "updateViaTftp",
21375 g_variant_new ("(ss)",
21376 arg_url,
21377 arg_filename),
21378 G_DBUS_CALL_FLAGS_NONE,
21379 -1,
21380 cancellable,
21381 error);
21382 if (_ret == NULL)
21383 goto _out;
21384 g_variant_get (_ret,
21385 "()");
21386 g_variant_unref (_ret);
21387_out:
21388 return _ret != NULL;
21389}
21390
21391/**
Norman James362a80f2015-09-14 14:04:39 -050021392 * flash_call_init:
21393 * @proxy: A #FlashProxy.
21394 * @cancellable: (allow-none): A #GCancellable or %NULL.
21395 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
21396 * @user_data: User data to pass to @callback.
21397 *
21398 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method on @proxy.
21399 * 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.
21400 * You can then call flash_call_init_finish() to get the result of the operation.
21401 *
21402 * See flash_call_init_sync() for the synchronous, blocking version of this method.
21403 */
21404void
21405flash_call_init (
21406 Flash *proxy,
21407 GCancellable *cancellable,
21408 GAsyncReadyCallback callback,
21409 gpointer user_data)
21410{
21411 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
21412 "init",
21413 g_variant_new ("()"),
21414 G_DBUS_CALL_FLAGS_NONE,
21415 -1,
21416 cancellable,
21417 callback,
21418 user_data);
21419}
21420
21421/**
21422 * flash_call_init_finish:
21423 * @proxy: A #FlashProxy.
21424 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_init().
21425 * @error: Return location for error or %NULL.
21426 *
21427 * Finishes an operation started with flash_call_init().
21428 *
21429 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
21430 */
21431gboolean
21432flash_call_init_finish (
21433 Flash *proxy,
21434 GAsyncResult *res,
21435 GError **error)
21436{
21437 GVariant *_ret;
21438 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
21439 if (_ret == NULL)
21440 goto _out;
21441 g_variant_get (_ret,
21442 "()");
21443 g_variant_unref (_ret);
21444_out:
21445 return _ret != NULL;
21446}
21447
21448/**
21449 * flash_call_init_sync:
21450 * @proxy: A #FlashProxy.
21451 * @cancellable: (allow-none): A #GCancellable or %NULL.
21452 * @error: Return location for error or %NULL.
21453 *
21454 * 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.
21455 *
21456 * See flash_call_init() for the asynchronous version of this method.
21457 *
21458 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
21459 */
21460gboolean
21461flash_call_init_sync (
21462 Flash *proxy,
21463 GCancellable *cancellable,
21464 GError **error)
21465{
21466 GVariant *_ret;
21467 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
21468 "init",
21469 g_variant_new ("()"),
21470 G_DBUS_CALL_FLAGS_NONE,
21471 -1,
21472 cancellable,
21473 error);
21474 if (_ret == NULL)
21475 goto _out;
21476 g_variant_get (_ret,
21477 "()");
21478 g_variant_unref (_ret);
21479_out:
21480 return _ret != NULL;
21481}
21482
21483/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021484 * flash_complete_update:
Norman James362a80f2015-09-14 14:04:39 -050021485 * @object: A #Flash.
21486 * @invocation: (transfer full): A #GDBusMethodInvocation.
21487 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021488 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.update">update()</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.
Norman James362a80f2015-09-14 14:04:39 -050021489 *
21490 * This method will free @invocation, you cannot use it afterwards.
21491 */
21492void
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021493flash_complete_update (
Norman James362a80f2015-09-14 14:04:39 -050021494 Flash *object,
21495 GDBusMethodInvocation *invocation)
21496{
21497 g_dbus_method_invocation_return_value (invocation,
21498 g_variant_new ("()"));
21499}
21500
21501/**
Norman Jamesf066e872015-10-07 15:29:51 -050021502 * flash_complete_update_via_tftp:
21503 * @object: A #Flash.
21504 * @invocation: (transfer full): A #GDBusMethodInvocation.
21505 *
21506 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</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.
21507 *
21508 * This method will free @invocation, you cannot use it afterwards.
21509 */
21510void
21511flash_complete_update_via_tftp (
21512 Flash *object,
21513 GDBusMethodInvocation *invocation)
21514{
21515 g_dbus_method_invocation_return_value (invocation,
21516 g_variant_new ("()"));
21517}
21518
21519/**
Norman James362a80f2015-09-14 14:04:39 -050021520 * flash_complete_init:
21521 * @object: A #Flash.
21522 * @invocation: (transfer full): A #GDBusMethodInvocation.
21523 *
21524 * 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.
21525 *
21526 * This method will free @invocation, you cannot use it afterwards.
21527 */
21528void
21529flash_complete_init (
21530 Flash *object,
21531 GDBusMethodInvocation *invocation)
21532{
21533 g_dbus_method_invocation_return_value (invocation,
21534 g_variant_new ("()"));
21535}
21536
21537/* ------------------------------------------------------------------------ */
21538
21539/**
21540 * FlashProxy:
21541 *
21542 * The #FlashProxy structure contains only private data and should only be accessed using the provided API.
21543 */
21544
21545/**
21546 * FlashProxyClass:
21547 * @parent_class: The parent class.
21548 *
21549 * Class structure for #FlashProxy.
21550 */
21551
21552struct _FlashProxyPrivate
21553{
21554 GData *qdata;
21555};
21556
21557static void flash_proxy_iface_init (FlashIface *iface);
21558
21559#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21560G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
21561 G_ADD_PRIVATE (FlashProxy)
21562 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
21563
21564#else
21565G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
21566 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
21567
21568#endif
21569static void
21570flash_proxy_finalize (GObject *object)
21571{
21572 FlashProxy *proxy = FLASH_PROXY (object);
21573 g_datalist_clear (&proxy->priv->qdata);
21574 G_OBJECT_CLASS (flash_proxy_parent_class)->finalize (object);
21575}
21576
21577static void
21578flash_proxy_get_property (GObject *object,
21579 guint prop_id,
21580 GValue *value,
21581 GParamSpec *pspec G_GNUC_UNUSED)
21582{
Norman James18998182015-10-11 21:54:53 -050021583 const _ExtendedGDBusPropertyInfo *info;
21584 GVariant *variant;
21585 g_assert (prop_id != 0 && prop_id - 1 < 4);
21586 info = _flash_property_info_pointers[prop_id - 1];
21587 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
21588 if (info->use_gvariant)
21589 {
21590 g_value_set_variant (value, variant);
21591 }
21592 else
21593 {
21594 if (variant != NULL)
21595 g_dbus_gvariant_to_gvalue (variant, value);
21596 }
21597 if (variant != NULL)
21598 g_variant_unref (variant);
21599}
21600
21601static void
21602flash_proxy_set_property_cb (GDBusProxy *proxy,
21603 GAsyncResult *res,
21604 gpointer user_data)
21605{
21606 const _ExtendedGDBusPropertyInfo *info = user_data;
21607 GError *error;
21608 GVariant *_ret;
21609 error = NULL;
21610 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
21611 if (!_ret)
21612 {
21613 g_warning ("Error setting property '%s' on interface org.openbmc.Flash: %s (%s, %d)",
21614 info->parent_struct.name,
21615 error->message, g_quark_to_string (error->domain), error->code);
21616 g_error_free (error);
21617 }
21618 else
21619 {
21620 g_variant_unref (_ret);
21621 }
Norman James362a80f2015-09-14 14:04:39 -050021622}
21623
21624static void
21625flash_proxy_set_property (GObject *object,
21626 guint prop_id,
21627 const GValue *value,
21628 GParamSpec *pspec G_GNUC_UNUSED)
21629{
Norman James18998182015-10-11 21:54:53 -050021630 const _ExtendedGDBusPropertyInfo *info;
21631 GVariant *variant;
21632 g_assert (prop_id != 0 && prop_id - 1 < 4);
21633 info = _flash_property_info_pointers[prop_id - 1];
21634 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
21635 g_dbus_proxy_call (G_DBUS_PROXY (object),
21636 "org.freedesktop.DBus.Properties.Set",
21637 g_variant_new ("(ssv)", "org.openbmc.Flash", info->parent_struct.name, variant),
21638 G_DBUS_CALL_FLAGS_NONE,
21639 -1,
21640 NULL, (GAsyncReadyCallback) flash_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
21641 g_variant_unref (variant);
Norman James362a80f2015-09-14 14:04:39 -050021642}
21643
21644static void
21645flash_proxy_g_signal (GDBusProxy *proxy,
21646 const gchar *sender_name G_GNUC_UNUSED,
21647 const gchar *signal_name,
21648 GVariant *parameters)
21649{
21650 _ExtendedGDBusSignalInfo *info;
21651 GVariantIter iter;
21652 GVariant *child;
21653 GValue *paramv;
21654 guint num_params;
21655 guint n;
21656 guint signal_id;
21657 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, signal_name);
21658 if (info == NULL)
21659 return;
21660 num_params = g_variant_n_children (parameters);
21661 paramv = g_new0 (GValue, num_params + 1);
21662 g_value_init (&paramv[0], TYPE_FLASH);
21663 g_value_set_object (&paramv[0], proxy);
21664 g_variant_iter_init (&iter, parameters);
21665 n = 1;
21666 while ((child = g_variant_iter_next_value (&iter)) != NULL)
21667 {
21668 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
21669 if (arg_info->use_gvariant)
21670 {
21671 g_value_init (&paramv[n], G_TYPE_VARIANT);
21672 g_value_set_variant (&paramv[n], child);
21673 n++;
21674 }
21675 else
21676 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
21677 g_variant_unref (child);
21678 }
21679 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
21680 g_signal_emitv (paramv, signal_id, 0, NULL);
21681 for (n = 0; n < num_params + 1; n++)
21682 g_value_unset (&paramv[n]);
21683 g_free (paramv);
21684}
21685
21686static void
21687flash_proxy_g_properties_changed (GDBusProxy *_proxy,
21688 GVariant *changed_properties,
21689 const gchar *const *invalidated_properties)
21690{
21691 FlashProxy *proxy = FLASH_PROXY (_proxy);
21692 guint n;
21693 const gchar *key;
21694 GVariantIter *iter;
21695 _ExtendedGDBusPropertyInfo *info;
21696 g_variant_get (changed_properties, "a{sv}", &iter);
21697 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
21698 {
21699 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, key);
21700 g_datalist_remove_data (&proxy->priv->qdata, key);
21701 if (info != NULL)
21702 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
21703 }
21704 g_variant_iter_free (iter);
21705 for (n = 0; invalidated_properties[n] != NULL; n++)
21706 {
21707 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, invalidated_properties[n]);
21708 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
21709 if (info != NULL)
21710 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
21711 }
21712}
21713
Norman James18998182015-10-11 21:54:53 -050021714static const gchar *
21715flash_proxy_get_filename (Flash *object)
21716{
21717 FlashProxy *proxy = FLASH_PROXY (object);
21718 GVariant *variant;
21719 const gchar *value = NULL;
21720 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "filename");
21721 if (variant != NULL)
21722 {
21723 value = g_variant_get_string (variant, NULL);
21724 g_variant_unref (variant);
21725 }
21726 return value;
21727}
21728
21729static const gchar *
21730flash_proxy_get_flasher_path (Flash *object)
21731{
21732 FlashProxy *proxy = FLASH_PROXY (object);
21733 GVariant *variant;
21734 const gchar *value = NULL;
21735 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_path");
21736 if (variant != NULL)
21737 {
21738 value = g_variant_get_string (variant, NULL);
21739 g_variant_unref (variant);
21740 }
21741 return value;
21742}
21743
21744static const gchar *
21745flash_proxy_get_flasher_name (Flash *object)
21746{
21747 FlashProxy *proxy = FLASH_PROXY (object);
21748 GVariant *variant;
21749 const gchar *value = NULL;
21750 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_name");
21751 if (variant != NULL)
21752 {
21753 value = g_variant_get_string (variant, NULL);
21754 g_variant_unref (variant);
21755 }
21756 return value;
21757}
21758
21759static const gchar *
21760flash_proxy_get_flasher_instance (Flash *object)
21761{
21762 FlashProxy *proxy = FLASH_PROXY (object);
21763 GVariant *variant;
21764 const gchar *value = NULL;
21765 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_instance");
21766 if (variant != NULL)
21767 {
21768 value = g_variant_get_string (variant, NULL);
21769 g_variant_unref (variant);
21770 }
21771 return value;
21772}
21773
Norman James362a80f2015-09-14 14:04:39 -050021774static void
21775flash_proxy_init (FlashProxy *proxy)
21776{
21777#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21778 proxy->priv = flash_proxy_get_instance_private (proxy);
21779#else
21780 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_PROXY, FlashProxyPrivate);
21781#endif
21782
21783 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_interface_info ());
21784}
21785
21786static void
21787flash_proxy_class_init (FlashProxyClass *klass)
21788{
21789 GObjectClass *gobject_class;
21790 GDBusProxyClass *proxy_class;
21791
21792 gobject_class = G_OBJECT_CLASS (klass);
21793 gobject_class->finalize = flash_proxy_finalize;
21794 gobject_class->get_property = flash_proxy_get_property;
21795 gobject_class->set_property = flash_proxy_set_property;
21796
21797 proxy_class = G_DBUS_PROXY_CLASS (klass);
21798 proxy_class->g_signal = flash_proxy_g_signal;
21799 proxy_class->g_properties_changed = flash_proxy_g_properties_changed;
21800
Norman James18998182015-10-11 21:54:53 -050021801 flash_override_properties (gobject_class, 1);
21802
Norman James362a80f2015-09-14 14:04:39 -050021803#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
21804 g_type_class_add_private (klass, sizeof (FlashProxyPrivate));
21805#endif
21806}
21807
21808static void
21809flash_proxy_iface_init (FlashIface *iface)
21810{
Norman James18998182015-10-11 21:54:53 -050021811 iface->get_filename = flash_proxy_get_filename;
21812 iface->get_flasher_path = flash_proxy_get_flasher_path;
21813 iface->get_flasher_name = flash_proxy_get_flasher_name;
21814 iface->get_flasher_instance = flash_proxy_get_flasher_instance;
Norman James362a80f2015-09-14 14:04:39 -050021815}
21816
21817/**
21818 * flash_proxy_new:
21819 * @connection: A #GDBusConnection.
21820 * @flags: Flags from the #GDBusProxyFlags enumeration.
21821 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
21822 * @object_path: An object path.
21823 * @cancellable: (allow-none): A #GCancellable or %NULL.
21824 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
21825 * @user_data: User data to pass to @callback.
21826 *
21827 * 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.
21828 *
21829 * 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.
21830 * You can then call flash_proxy_new_finish() to get the result of the operation.
21831 *
21832 * See flash_proxy_new_sync() for the synchronous, blocking version of this constructor.
21833 */
21834void
21835flash_proxy_new (
21836 GDBusConnection *connection,
21837 GDBusProxyFlags flags,
21838 const gchar *name,
21839 const gchar *object_path,
21840 GCancellable *cancellable,
21841 GAsyncReadyCallback callback,
21842 gpointer user_data)
21843{
21844 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);
21845}
21846
21847/**
21848 * flash_proxy_new_finish:
21849 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new().
21850 * @error: Return location for error or %NULL
21851 *
21852 * Finishes an operation started with flash_proxy_new().
21853 *
21854 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
21855 */
21856Flash *
21857flash_proxy_new_finish (
21858 GAsyncResult *res,
21859 GError **error)
21860{
21861 GObject *ret;
21862 GObject *source_object;
21863 source_object = g_async_result_get_source_object (res);
21864 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
21865 g_object_unref (source_object);
21866 if (ret != NULL)
21867 return FLASH (ret);
21868 else
21869 return NULL;
21870}
21871
21872/**
21873 * flash_proxy_new_sync:
21874 * @connection: A #GDBusConnection.
21875 * @flags: Flags from the #GDBusProxyFlags enumeration.
21876 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
21877 * @object_path: An object path.
21878 * @cancellable: (allow-none): A #GCancellable or %NULL.
21879 * @error: Return location for error or %NULL
21880 *
21881 * 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.
21882 *
21883 * The calling thread is blocked until a reply is received.
21884 *
21885 * See flash_proxy_new() for the asynchronous version of this constructor.
21886 *
21887 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
21888 */
21889Flash *
21890flash_proxy_new_sync (
21891 GDBusConnection *connection,
21892 GDBusProxyFlags flags,
21893 const gchar *name,
21894 const gchar *object_path,
21895 GCancellable *cancellable,
21896 GError **error)
21897{
21898 GInitable *ret;
21899 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);
21900 if (ret != NULL)
21901 return FLASH (ret);
21902 else
21903 return NULL;
21904}
21905
21906
21907/**
21908 * flash_proxy_new_for_bus:
21909 * @bus_type: A #GBusType.
21910 * @flags: Flags from the #GDBusProxyFlags enumeration.
21911 * @name: A bus name (well-known or unique).
21912 * @object_path: An object path.
21913 * @cancellable: (allow-none): A #GCancellable or %NULL.
21914 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
21915 * @user_data: User data to pass to @callback.
21916 *
21917 * Like flash_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
21918 *
21919 * 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.
21920 * You can then call flash_proxy_new_for_bus_finish() to get the result of the operation.
21921 *
21922 * See flash_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
21923 */
21924void
21925flash_proxy_new_for_bus (
21926 GBusType bus_type,
21927 GDBusProxyFlags flags,
21928 const gchar *name,
21929 const gchar *object_path,
21930 GCancellable *cancellable,
21931 GAsyncReadyCallback callback,
21932 gpointer user_data)
21933{
21934 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);
21935}
21936
21937/**
21938 * flash_proxy_new_for_bus_finish:
21939 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new_for_bus().
21940 * @error: Return location for error or %NULL
21941 *
21942 * Finishes an operation started with flash_proxy_new_for_bus().
21943 *
21944 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
21945 */
21946Flash *
21947flash_proxy_new_for_bus_finish (
21948 GAsyncResult *res,
21949 GError **error)
21950{
21951 GObject *ret;
21952 GObject *source_object;
21953 source_object = g_async_result_get_source_object (res);
21954 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
21955 g_object_unref (source_object);
21956 if (ret != NULL)
21957 return FLASH (ret);
21958 else
21959 return NULL;
21960}
21961
21962/**
21963 * flash_proxy_new_for_bus_sync:
21964 * @bus_type: A #GBusType.
21965 * @flags: Flags from the #GDBusProxyFlags enumeration.
21966 * @name: A bus name (well-known or unique).
21967 * @object_path: An object path.
21968 * @cancellable: (allow-none): A #GCancellable or %NULL.
21969 * @error: Return location for error or %NULL
21970 *
21971 * Like flash_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
21972 *
21973 * The calling thread is blocked until a reply is received.
21974 *
21975 * See flash_proxy_new_for_bus() for the asynchronous version of this constructor.
21976 *
21977 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
21978 */
21979Flash *
21980flash_proxy_new_for_bus_sync (
21981 GBusType bus_type,
21982 GDBusProxyFlags flags,
21983 const gchar *name,
21984 const gchar *object_path,
21985 GCancellable *cancellable,
21986 GError **error)
21987{
21988 GInitable *ret;
21989 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);
21990 if (ret != NULL)
21991 return FLASH (ret);
21992 else
21993 return NULL;
21994}
21995
21996
21997/* ------------------------------------------------------------------------ */
21998
21999/**
22000 * FlashSkeleton:
22001 *
22002 * The #FlashSkeleton structure contains only private data and should only be accessed using the provided API.
22003 */
22004
22005/**
22006 * FlashSkeletonClass:
22007 * @parent_class: The parent class.
22008 *
22009 * Class structure for #FlashSkeleton.
22010 */
22011
22012struct _FlashSkeletonPrivate
22013{
22014 GValue *properties;
22015 GList *changed_properties;
22016 GSource *changed_properties_idle_source;
22017 GMainContext *context;
22018 GMutex lock;
22019};
22020
22021static void
22022_flash_skeleton_handle_method_call (
22023 GDBusConnection *connection G_GNUC_UNUSED,
22024 const gchar *sender G_GNUC_UNUSED,
22025 const gchar *object_path G_GNUC_UNUSED,
22026 const gchar *interface_name,
22027 const gchar *method_name,
22028 GVariant *parameters,
22029 GDBusMethodInvocation *invocation,
22030 gpointer user_data)
22031{
22032 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
22033 _ExtendedGDBusMethodInfo *info;
22034 GVariantIter iter;
22035 GVariant *child;
22036 GValue *paramv;
22037 guint num_params;
22038 guint num_extra;
22039 guint n;
22040 guint signal_id;
22041 GValue return_value = G_VALUE_INIT;
22042 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
22043 g_assert (info != NULL);
22044 num_params = g_variant_n_children (parameters);
22045 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
22046 n = 0;
22047 g_value_init (&paramv[n], TYPE_FLASH);
22048 g_value_set_object (&paramv[n++], skeleton);
22049 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
22050 g_value_set_object (&paramv[n++], invocation);
22051 if (info->pass_fdlist)
22052 {
22053#ifdef G_OS_UNIX
22054 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
22055 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
22056#else
22057 g_assert_not_reached ();
22058#endif
22059 }
22060 g_variant_iter_init (&iter, parameters);
22061 while ((child = g_variant_iter_next_value (&iter)) != NULL)
22062 {
22063 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
22064 if (arg_info->use_gvariant)
22065 {
22066 g_value_init (&paramv[n], G_TYPE_VARIANT);
22067 g_value_set_variant (&paramv[n], child);
22068 n++;
22069 }
22070 else
22071 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
22072 g_variant_unref (child);
22073 }
22074 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
22075 g_value_init (&return_value, G_TYPE_BOOLEAN);
22076 g_signal_emitv (paramv, signal_id, 0, &return_value);
22077 if (!g_value_get_boolean (&return_value))
22078 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);
22079 g_value_unset (&return_value);
22080 for (n = 0; n < num_params + num_extra; n++)
22081 g_value_unset (&paramv[n]);
22082 g_free (paramv);
22083}
22084
22085static GVariant *
22086_flash_skeleton_handle_get_property (
22087 GDBusConnection *connection G_GNUC_UNUSED,
22088 const gchar *sender G_GNUC_UNUSED,
22089 const gchar *object_path G_GNUC_UNUSED,
22090 const gchar *interface_name G_GNUC_UNUSED,
22091 const gchar *property_name,
22092 GError **error,
22093 gpointer user_data)
22094{
22095 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
22096 GValue value = G_VALUE_INIT;
22097 GParamSpec *pspec;
22098 _ExtendedGDBusPropertyInfo *info;
22099 GVariant *ret;
22100 ret = NULL;
22101 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
22102 g_assert (info != NULL);
22103 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
22104 if (pspec == NULL)
22105 {
22106 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
22107 }
22108 else
22109 {
22110 g_value_init (&value, pspec->value_type);
22111 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
22112 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
22113 g_value_unset (&value);
22114 }
22115 return ret;
22116}
22117
22118static gboolean
22119_flash_skeleton_handle_set_property (
22120 GDBusConnection *connection G_GNUC_UNUSED,
22121 const gchar *sender G_GNUC_UNUSED,
22122 const gchar *object_path G_GNUC_UNUSED,
22123 const gchar *interface_name G_GNUC_UNUSED,
22124 const gchar *property_name,
22125 GVariant *variant,
22126 GError **error,
22127 gpointer user_data)
22128{
22129 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
22130 GValue value = G_VALUE_INIT;
22131 GParamSpec *pspec;
22132 _ExtendedGDBusPropertyInfo *info;
22133 gboolean ret;
22134 ret = FALSE;
22135 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
22136 g_assert (info != NULL);
22137 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
22138 if (pspec == NULL)
22139 {
22140 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
22141 }
22142 else
22143 {
22144 if (info->use_gvariant)
22145 g_value_set_variant (&value, variant);
22146 else
22147 g_dbus_gvariant_to_gvalue (variant, &value);
22148 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
22149 g_value_unset (&value);
22150 ret = TRUE;
22151 }
22152 return ret;
22153}
22154
22155static const GDBusInterfaceVTable _flash_skeleton_vtable =
22156{
22157 _flash_skeleton_handle_method_call,
22158 _flash_skeleton_handle_get_property,
22159 _flash_skeleton_handle_set_property,
22160 {NULL}
22161};
22162
22163static GDBusInterfaceInfo *
22164flash_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
22165{
22166 return flash_interface_info ();
22167}
22168
22169static GDBusInterfaceVTable *
22170flash_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
22171{
22172 return (GDBusInterfaceVTable *) &_flash_skeleton_vtable;
22173}
22174
22175static GVariant *
22176flash_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
22177{
22178 FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton);
22179
22180 GVariantBuilder builder;
22181 guint n;
22182 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
22183 if (_flash_interface_info.parent_struct.properties == NULL)
22184 goto out;
22185 for (n = 0; _flash_interface_info.parent_struct.properties[n] != NULL; n++)
22186 {
22187 GDBusPropertyInfo *info = _flash_interface_info.parent_struct.properties[n];
22188 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
22189 {
22190 GVariant *value;
22191 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);
22192 if (value != NULL)
22193 {
22194 g_variant_take_ref (value);
22195 g_variant_builder_add (&builder, "{sv}", info->name, value);
22196 g_variant_unref (value);
22197 }
22198 }
22199 }
22200out:
22201 return g_variant_builder_end (&builder);
22202}
22203
Norman James18998182015-10-11 21:54:53 -050022204static gboolean _flash_emit_changed (gpointer user_data);
22205
Norman James362a80f2015-09-14 14:04:39 -050022206static void
22207flash_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
22208{
Norman James18998182015-10-11 21:54:53 -050022209 FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton);
22210 gboolean emit_changed = FALSE;
22211
22212 g_mutex_lock (&skeleton->priv->lock);
22213 if (skeleton->priv->changed_properties_idle_source != NULL)
22214 {
22215 g_source_destroy (skeleton->priv->changed_properties_idle_source);
22216 skeleton->priv->changed_properties_idle_source = NULL;
22217 emit_changed = TRUE;
22218 }
22219 g_mutex_unlock (&skeleton->priv->lock);
22220
22221 if (emit_changed)
22222 _flash_emit_changed (skeleton);
Norman James362a80f2015-09-14 14:04:39 -050022223}
22224
22225static void
22226_flash_on_signal_updated (
22227 Flash *object)
22228{
22229 FlashSkeleton *skeleton = FLASH_SKELETON (object);
22230
22231 GList *connections, *l;
22232 GVariant *signal_variant;
22233 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
22234
22235 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
22236 for (l = connections; l != NULL; l = l->next)
22237 {
22238 GDBusConnection *connection = l->data;
22239 g_dbus_connection_emit_signal (connection,
22240 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Updated",
22241 signal_variant, NULL);
22242 }
22243 g_variant_unref (signal_variant);
22244 g_list_free_full (connections, g_object_unref);
22245}
22246
Norman Jamesf066e872015-10-07 15:29:51 -050022247static void
22248_flash_on_signal_download (
22249 Flash *object,
22250 const gchar *arg_url,
22251 const gchar *arg_filename)
22252{
22253 FlashSkeleton *skeleton = FLASH_SKELETON (object);
22254
22255 GList *connections, *l;
22256 GVariant *signal_variant;
22257 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
22258
22259 signal_variant = g_variant_ref_sink (g_variant_new ("(ss)",
22260 arg_url,
22261 arg_filename));
22262 for (l = connections; l != NULL; l = l->next)
22263 {
22264 GDBusConnection *connection = l->data;
22265 g_dbus_connection_emit_signal (connection,
22266 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Download",
22267 signal_variant, NULL);
22268 }
22269 g_variant_unref (signal_variant);
22270 g_list_free_full (connections, g_object_unref);
22271}
22272
Norman James362a80f2015-09-14 14:04:39 -050022273static void flash_skeleton_iface_init (FlashIface *iface);
22274#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22275G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
22276 G_ADD_PRIVATE (FlashSkeleton)
22277 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
22278
22279#else
22280G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
22281 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
22282
22283#endif
22284static void
22285flash_skeleton_finalize (GObject *object)
22286{
22287 FlashSkeleton *skeleton = FLASH_SKELETON (object);
Norman James18998182015-10-11 21:54:53 -050022288 guint n;
22289 for (n = 0; n < 4; n++)
22290 g_value_unset (&skeleton->priv->properties[n]);
22291 g_free (skeleton->priv->properties);
Norman James362a80f2015-09-14 14:04:39 -050022292 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
22293 if (skeleton->priv->changed_properties_idle_source != NULL)
22294 g_source_destroy (skeleton->priv->changed_properties_idle_source);
22295 g_main_context_unref (skeleton->priv->context);
22296 g_mutex_clear (&skeleton->priv->lock);
22297 G_OBJECT_CLASS (flash_skeleton_parent_class)->finalize (object);
22298}
22299
22300static void
Norman James18998182015-10-11 21:54:53 -050022301flash_skeleton_get_property (GObject *object,
22302 guint prop_id,
22303 GValue *value,
22304 GParamSpec *pspec G_GNUC_UNUSED)
22305{
22306 FlashSkeleton *skeleton = FLASH_SKELETON (object);
22307 g_assert (prop_id != 0 && prop_id - 1 < 4);
22308 g_mutex_lock (&skeleton->priv->lock);
22309 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
22310 g_mutex_unlock (&skeleton->priv->lock);
22311}
22312
22313static gboolean
22314_flash_emit_changed (gpointer user_data)
22315{
22316 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
22317 GList *l;
22318 GVariantBuilder builder;
22319 GVariantBuilder invalidated_builder;
22320 guint num_changes;
22321
22322 g_mutex_lock (&skeleton->priv->lock);
22323 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
22324 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
22325 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
22326 {
22327 ChangedProperty *cp = l->data;
22328 GVariant *variant;
22329 const GValue *cur_value;
22330
22331 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
22332 if (!_g_value_equal (cur_value, &cp->orig_value))
22333 {
22334 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
22335 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
22336 g_variant_unref (variant);
22337 num_changes++;
22338 }
22339 }
22340 if (num_changes > 0)
22341 {
22342 GList *connections, *ll;
22343 GVariant *signal_variant;
22344 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Flash",
22345 &builder, &invalidated_builder));
22346 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
22347 for (ll = connections; ll != NULL; ll = ll->next)
22348 {
22349 GDBusConnection *connection = ll->data;
22350
22351 g_dbus_connection_emit_signal (connection,
22352 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
22353 "org.freedesktop.DBus.Properties",
22354 "PropertiesChanged",
22355 signal_variant,
22356 NULL);
22357 }
22358 g_variant_unref (signal_variant);
22359 g_list_free_full (connections, g_object_unref);
22360 }
22361 else
22362 {
22363 g_variant_builder_clear (&builder);
22364 g_variant_builder_clear (&invalidated_builder);
22365 }
22366 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
22367 skeleton->priv->changed_properties = NULL;
22368 skeleton->priv->changed_properties_idle_source = NULL;
22369 g_mutex_unlock (&skeleton->priv->lock);
22370 return FALSE;
22371}
22372
22373static void
22374_flash_schedule_emit_changed (FlashSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
22375{
22376 ChangedProperty *cp;
22377 GList *l;
22378 cp = NULL;
22379 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
22380 {
22381 ChangedProperty *i_cp = l->data;
22382 if (i_cp->info == info)
22383 {
22384 cp = i_cp;
22385 break;
22386 }
22387 }
22388 if (cp == NULL)
22389 {
22390 cp = g_new0 (ChangedProperty, 1);
22391 cp->prop_id = prop_id;
22392 cp->info = info;
22393 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
22394 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
22395 g_value_copy (orig_value, &cp->orig_value);
22396 }
22397}
22398
22399static void
22400flash_skeleton_notify (GObject *object,
22401 GParamSpec *pspec G_GNUC_UNUSED)
22402{
22403 FlashSkeleton *skeleton = FLASH_SKELETON (object);
22404 g_mutex_lock (&skeleton->priv->lock);
22405 if (skeleton->priv->changed_properties != NULL &&
22406 skeleton->priv->changed_properties_idle_source == NULL)
22407 {
22408 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
22409 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
22410 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _flash_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylak2cb27752015-10-19 16:23:14 -050022411 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _flash_emit_changed");
Norman James18998182015-10-11 21:54:53 -050022412 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
22413 g_source_unref (skeleton->priv->changed_properties_idle_source);
22414 }
22415 g_mutex_unlock (&skeleton->priv->lock);
22416}
22417
22418static void
22419flash_skeleton_set_property (GObject *object,
22420 guint prop_id,
22421 const GValue *value,
22422 GParamSpec *pspec)
22423{
22424 FlashSkeleton *skeleton = FLASH_SKELETON (object);
22425 g_assert (prop_id != 0 && prop_id - 1 < 4);
22426 g_mutex_lock (&skeleton->priv->lock);
22427 g_object_freeze_notify (object);
22428 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
22429 {
22430 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
22431 _flash_schedule_emit_changed (skeleton, _flash_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
22432 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
22433 g_object_notify_by_pspec (object, pspec);
22434 }
22435 g_mutex_unlock (&skeleton->priv->lock);
22436 g_object_thaw_notify (object);
22437}
22438
22439static void
Norman James362a80f2015-09-14 14:04:39 -050022440flash_skeleton_init (FlashSkeleton *skeleton)
22441{
22442#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22443 skeleton->priv = flash_skeleton_get_instance_private (skeleton);
22444#else
22445 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_SKELETON, FlashSkeletonPrivate);
22446#endif
22447
22448 g_mutex_init (&skeleton->priv->lock);
22449 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James18998182015-10-11 21:54:53 -050022450 skeleton->priv->properties = g_new0 (GValue, 4);
22451 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
22452 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
22453 g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING);
22454 g_value_init (&skeleton->priv->properties[3], G_TYPE_STRING);
22455}
22456
22457static const gchar *
22458flash_skeleton_get_filename (Flash *object)
22459{
22460 FlashSkeleton *skeleton = FLASH_SKELETON (object);
22461 const gchar *value;
22462 g_mutex_lock (&skeleton->priv->lock);
22463 value = g_value_get_string (&(skeleton->priv->properties[0]));
22464 g_mutex_unlock (&skeleton->priv->lock);
22465 return value;
22466}
22467
22468static const gchar *
22469flash_skeleton_get_flasher_path (Flash *object)
22470{
22471 FlashSkeleton *skeleton = FLASH_SKELETON (object);
22472 const gchar *value;
22473 g_mutex_lock (&skeleton->priv->lock);
22474 value = g_value_get_string (&(skeleton->priv->properties[1]));
22475 g_mutex_unlock (&skeleton->priv->lock);
22476 return value;
22477}
22478
22479static const gchar *
22480flash_skeleton_get_flasher_name (Flash *object)
22481{
22482 FlashSkeleton *skeleton = FLASH_SKELETON (object);
22483 const gchar *value;
22484 g_mutex_lock (&skeleton->priv->lock);
22485 value = g_value_get_string (&(skeleton->priv->properties[2]));
22486 g_mutex_unlock (&skeleton->priv->lock);
22487 return value;
22488}
22489
22490static const gchar *
22491flash_skeleton_get_flasher_instance (Flash *object)
22492{
22493 FlashSkeleton *skeleton = FLASH_SKELETON (object);
22494 const gchar *value;
22495 g_mutex_lock (&skeleton->priv->lock);
22496 value = g_value_get_string (&(skeleton->priv->properties[3]));
22497 g_mutex_unlock (&skeleton->priv->lock);
22498 return value;
Norman James362a80f2015-09-14 14:04:39 -050022499}
22500
22501static void
22502flash_skeleton_class_init (FlashSkeletonClass *klass)
22503{
22504 GObjectClass *gobject_class;
22505 GDBusInterfaceSkeletonClass *skeleton_class;
22506
22507 gobject_class = G_OBJECT_CLASS (klass);
22508 gobject_class->finalize = flash_skeleton_finalize;
Norman James18998182015-10-11 21:54:53 -050022509 gobject_class->get_property = flash_skeleton_get_property;
22510 gobject_class->set_property = flash_skeleton_set_property;
22511 gobject_class->notify = flash_skeleton_notify;
22512
22513
22514 flash_override_properties (gobject_class, 1);
Norman James362a80f2015-09-14 14:04:39 -050022515
22516 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
22517 skeleton_class->get_info = flash_skeleton_dbus_interface_get_info;
22518 skeleton_class->get_properties = flash_skeleton_dbus_interface_get_properties;
22519 skeleton_class->flush = flash_skeleton_dbus_interface_flush;
22520 skeleton_class->get_vtable = flash_skeleton_dbus_interface_get_vtable;
22521
22522#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
22523 g_type_class_add_private (klass, sizeof (FlashSkeletonPrivate));
22524#endif
22525}
22526
22527static void
22528flash_skeleton_iface_init (FlashIface *iface)
22529{
22530 iface->updated = _flash_on_signal_updated;
Norman Jamesf066e872015-10-07 15:29:51 -050022531 iface->download = _flash_on_signal_download;
Norman James18998182015-10-11 21:54:53 -050022532 iface->get_filename = flash_skeleton_get_filename;
22533 iface->get_flasher_path = flash_skeleton_get_flasher_path;
22534 iface->get_flasher_name = flash_skeleton_get_flasher_name;
22535 iface->get_flasher_instance = flash_skeleton_get_flasher_instance;
Norman James362a80f2015-09-14 14:04:39 -050022536}
22537
22538/**
22539 * flash_skeleton_new:
22540 *
22541 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
22542 *
22543 * Returns: (transfer full) (type FlashSkeleton): The skeleton object.
22544 */
22545Flash *
22546flash_skeleton_new (void)
22547{
22548 return FLASH (g_object_new (TYPE_FLASH_SKELETON, NULL));
22549}
22550
22551/* ------------------------------------------------------------------------
Norman James18998182015-10-11 21:54:53 -050022552 * Code for interface org.openbmc.FlashControl
22553 * ------------------------------------------------------------------------
22554 */
22555
22556/**
22557 * SECTION:FlashControl
22558 * @title: FlashControl
22559 * @short_description: Generated C code for the org.openbmc.FlashControl D-Bus interface
22560 *
22561 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> D-Bus interface in C.
22562 */
22563
22564/* ---- Introspection data for org.openbmc.FlashControl ---- */
22565
22566static const _ExtendedGDBusArgInfo _flash_control_method_info_flash_IN_ARG_type =
22567{
22568 {
22569 -1,
22570 (gchar *) "type",
22571 (gchar *) "s",
22572 NULL
22573 },
22574 FALSE
22575};
22576
22577static const _ExtendedGDBusArgInfo _flash_control_method_info_flash_IN_ARG_filename =
22578{
22579 {
22580 -1,
22581 (gchar *) "filename",
22582 (gchar *) "s",
22583 NULL
22584 },
22585 FALSE
22586};
22587
22588static const _ExtendedGDBusArgInfo * const _flash_control_method_info_flash_IN_ARG_pointers[] =
22589{
22590 &_flash_control_method_info_flash_IN_ARG_type,
22591 &_flash_control_method_info_flash_IN_ARG_filename,
22592 NULL
22593};
22594
22595static const _ExtendedGDBusMethodInfo _flash_control_method_info_flash =
22596{
22597 {
22598 -1,
22599 (gchar *) "flash",
22600 (GDBusArgInfo **) &_flash_control_method_info_flash_IN_ARG_pointers,
22601 NULL,
22602 NULL
22603 },
22604 "handle-flash",
22605 FALSE
22606};
22607
22608static const _ExtendedGDBusMethodInfo * const _flash_control_method_info_pointers[] =
22609{
22610 &_flash_control_method_info_flash,
22611 NULL
22612};
22613
22614static const _ExtendedGDBusArgInfo _flash_control_signal_info_done_ARG_filename =
22615{
22616 {
22617 -1,
22618 (gchar *) "filename",
22619 (gchar *) "s",
22620 NULL
22621 },
22622 FALSE
22623};
22624
22625static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_done_ARG_pointers[] =
22626{
22627 &_flash_control_signal_info_done_ARG_filename,
22628 NULL
22629};
22630
22631static const _ExtendedGDBusSignalInfo _flash_control_signal_info_done =
22632{
22633 {
22634 -1,
22635 (gchar *) "Done",
22636 (GDBusArgInfo **) &_flash_control_signal_info_done_ARG_pointers,
22637 NULL
22638 },
22639 "done"
22640};
22641
22642static const _ExtendedGDBusArgInfo _flash_control_signal_info_error_ARG_filename =
22643{
22644 {
22645 -1,
22646 (gchar *) "filename",
22647 (gchar *) "s",
22648 NULL
22649 },
22650 FALSE
22651};
22652
22653static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_error_ARG_pointers[] =
22654{
22655 &_flash_control_signal_info_error_ARG_filename,
22656 NULL
22657};
22658
22659static const _ExtendedGDBusSignalInfo _flash_control_signal_info_error =
22660{
22661 {
22662 -1,
22663 (gchar *) "Error",
22664 (GDBusArgInfo **) &_flash_control_signal_info_error_ARG_pointers,
22665 NULL
22666 },
22667 "error"
22668};
22669
22670static const _ExtendedGDBusArgInfo _flash_control_signal_info_progress_ARG_filename =
22671{
22672 {
22673 -1,
22674 (gchar *) "filename",
22675 (gchar *) "s",
22676 NULL
22677 },
22678 FALSE
22679};
22680
22681static const _ExtendedGDBusArgInfo _flash_control_signal_info_progress_ARG_progress =
22682{
22683 {
22684 -1,
22685 (gchar *) "progress",
22686 (gchar *) "y",
22687 NULL
22688 },
22689 FALSE
22690};
22691
22692static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_progress_ARG_pointers[] =
22693{
22694 &_flash_control_signal_info_progress_ARG_filename,
22695 &_flash_control_signal_info_progress_ARG_progress,
22696 NULL
22697};
22698
22699static const _ExtendedGDBusSignalInfo _flash_control_signal_info_progress =
22700{
22701 {
22702 -1,
22703 (gchar *) "Progress",
22704 (GDBusArgInfo **) &_flash_control_signal_info_progress_ARG_pointers,
22705 NULL
22706 },
22707 "progress"
22708};
22709
22710static const _ExtendedGDBusSignalInfo * const _flash_control_signal_info_pointers[] =
22711{
22712 &_flash_control_signal_info_done,
22713 &_flash_control_signal_info_error,
22714 &_flash_control_signal_info_progress,
22715 NULL
22716};
22717
22718static const _ExtendedGDBusPropertyInfo _flash_control_property_info_filename =
22719{
22720 {
22721 -1,
22722 (gchar *) "filename",
22723 (gchar *) "s",
22724 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
22725 NULL
22726 },
22727 "filename",
22728 FALSE
22729};
22730
22731static const _ExtendedGDBusPropertyInfo _flash_control_property_info_type_ =
22732{
22733 {
22734 -1,
22735 (gchar *) "type",
22736 (gchar *) "s",
22737 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
22738 NULL
22739 },
22740 "type",
22741 FALSE
22742};
22743
22744static const _ExtendedGDBusPropertyInfo * const _flash_control_property_info_pointers[] =
22745{
22746 &_flash_control_property_info_filename,
22747 &_flash_control_property_info_type_,
22748 NULL
22749};
22750
22751static const _ExtendedGDBusInterfaceInfo _flash_control_interface_info =
22752{
22753 {
22754 -1,
22755 (gchar *) "org.openbmc.FlashControl",
22756 (GDBusMethodInfo **) &_flash_control_method_info_pointers,
22757 (GDBusSignalInfo **) &_flash_control_signal_info_pointers,
22758 (GDBusPropertyInfo **) &_flash_control_property_info_pointers,
22759 NULL
22760 },
22761 "flash-control",
22762};
22763
22764
22765/**
22766 * flash_control_interface_info:
22767 *
22768 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> D-Bus interface.
22769 *
22770 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
22771 */
22772GDBusInterfaceInfo *
22773flash_control_interface_info (void)
22774{
22775 return (GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct;
22776}
22777
22778/**
22779 * flash_control_override_properties:
22780 * @klass: The class structure for a #GObject<!-- -->-derived class.
22781 * @property_id_begin: The property id to assign to the first overridden property.
22782 *
22783 * Overrides all #GObject properties in the #FlashControl interface for a concrete class.
22784 * The properties are overridden in the order they are defined.
22785 *
22786 * Returns: The last property id.
22787 */
22788guint
22789flash_control_override_properties (GObjectClass *klass, guint property_id_begin)
22790{
22791 g_object_class_override_property (klass, property_id_begin++, "filename");
22792 g_object_class_override_property (klass, property_id_begin++, "type");
22793 return property_id_begin - 1;
22794}
22795
22796
22797
22798/**
22799 * FlashControl:
22800 *
22801 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
22802 */
22803
22804/**
22805 * FlashControlIface:
22806 * @parent_iface: The parent interface.
22807 * @handle_flash: Handler for the #FlashControl::handle-flash signal.
22808 * @get_filename: Getter for the #FlashControl:filename property.
22809 * @get_type_: Getter for the #FlashControl:type property.
22810 * @done: Handler for the #FlashControl::done signal.
22811 * @error: Handler for the #FlashControl::error signal.
22812 * @progress: Handler for the #FlashControl::progress signal.
22813 *
22814 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
22815 */
22816
22817typedef FlashControlIface FlashControlInterface;
22818G_DEFINE_INTERFACE (FlashControl, flash_control, G_TYPE_OBJECT);
22819
22820static void
22821flash_control_default_init (FlashControlIface *iface)
22822{
22823 /* GObject signals for incoming D-Bus method calls: */
22824 /**
22825 * FlashControl::handle-flash:
22826 * @object: A #FlashControl.
22827 * @invocation: A #GDBusMethodInvocation.
22828 * @arg_type: Argument passed by remote caller.
22829 * @arg_filename: Argument passed by remote caller.
22830 *
22831 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method.
22832 *
22833 * 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_control_complete_flash() 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.
22834 *
22835 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
22836 */
22837 g_signal_new ("handle-flash",
22838 G_TYPE_FROM_INTERFACE (iface),
22839 G_SIGNAL_RUN_LAST,
22840 G_STRUCT_OFFSET (FlashControlIface, handle_flash),
22841 g_signal_accumulator_true_handled,
22842 NULL,
22843 g_cclosure_marshal_generic,
22844 G_TYPE_BOOLEAN,
22845 3,
22846 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING);
22847
22848 /* GObject signals for received D-Bus signals: */
22849 /**
22850 * FlashControl::done:
22851 * @object: A #FlashControl.
22852 * @arg_filename: Argument.
22853 *
22854 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-FlashControl.Done">"Done"</link> is received.
22855 *
22856 * 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.
22857 */
22858 g_signal_new ("done",
22859 G_TYPE_FROM_INTERFACE (iface),
22860 G_SIGNAL_RUN_LAST,
22861 G_STRUCT_OFFSET (FlashControlIface, done),
22862 NULL,
22863 NULL,
22864 g_cclosure_marshal_generic,
22865 G_TYPE_NONE,
22866 1, G_TYPE_STRING);
22867
22868 /**
22869 * FlashControl::error:
22870 * @object: A #FlashControl.
22871 * @arg_filename: Argument.
22872 *
22873 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-FlashControl.Error">"Error"</link> is received.
22874 *
22875 * 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.
22876 */
22877 g_signal_new ("error",
22878 G_TYPE_FROM_INTERFACE (iface),
22879 G_SIGNAL_RUN_LAST,
22880 G_STRUCT_OFFSET (FlashControlIface, error),
22881 NULL,
22882 NULL,
22883 g_cclosure_marshal_generic,
22884 G_TYPE_NONE,
22885 1, G_TYPE_STRING);
22886
22887 /**
22888 * FlashControl::progress:
22889 * @object: A #FlashControl.
22890 * @arg_filename: Argument.
22891 * @arg_progress: Argument.
22892 *
22893 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-FlashControl.Progress">"Progress"</link> is received.
22894 *
22895 * 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.
22896 */
22897 g_signal_new ("progress",
22898 G_TYPE_FROM_INTERFACE (iface),
22899 G_SIGNAL_RUN_LAST,
22900 G_STRUCT_OFFSET (FlashControlIface, progress),
22901 NULL,
22902 NULL,
22903 g_cclosure_marshal_generic,
22904 G_TYPE_NONE,
22905 2, G_TYPE_STRING, G_TYPE_UCHAR);
22906
22907 /* GObject properties for D-Bus properties: */
22908 /**
22909 * FlashControl:filename:
22910 *
22911 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link>.
22912 *
22913 * 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.
22914 */
22915 g_object_interface_install_property (iface,
22916 g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
22917 /**
22918 * FlashControl:type:
22919 *
22920 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link>.
22921 *
22922 * 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.
22923 */
22924 g_object_interface_install_property (iface,
22925 g_param_spec_string ("type", "type", "type", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
22926}
22927
22928/**
22929 * flash_control_get_filename: (skip)
22930 * @object: A #FlashControl.
22931 *
22932 * Gets the value of the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property.
22933 *
22934 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22935 *
22936 * <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 flash_control_dup_filename() if on another thread.</warning>
22937 *
22938 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
22939 */
22940const gchar *
22941flash_control_get_filename (FlashControl *object)
22942{
22943 return FLASH_CONTROL_GET_IFACE (object)->get_filename (object);
22944}
22945
22946/**
22947 * flash_control_dup_filename: (skip)
22948 * @object: A #FlashControl.
22949 *
22950 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property.
22951 *
22952 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22953 *
22954 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22955 */
22956gchar *
22957flash_control_dup_filename (FlashControl *object)
22958{
22959 gchar *value;
22960 g_object_get (G_OBJECT (object), "filename", &value, NULL);
22961 return value;
22962}
22963
22964/**
22965 * flash_control_set_filename: (skip)
22966 * @object: A #FlashControl.
22967 * @value: The value to set.
22968 *
22969 * Sets the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property to @value.
22970 *
22971 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22972 */
22973void
22974flash_control_set_filename (FlashControl *object, const gchar *value)
22975{
22976 g_object_set (G_OBJECT (object), "filename", value, NULL);
22977}
22978
22979/**
22980 * flash_control_get_type_: (skip)
22981 * @object: A #FlashControl.
22982 *
22983 * Gets the value of the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property.
22984 *
22985 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22986 *
22987 * <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 flash_control_dup_type_() if on another thread.</warning>
22988 *
22989 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
22990 */
22991const gchar *
22992flash_control_get_type_ (FlashControl *object)
22993{
22994 return FLASH_CONTROL_GET_IFACE (object)->get_type_ (object);
22995}
22996
22997/**
22998 * flash_control_dup_type_: (skip)
22999 * @object: A #FlashControl.
23000 *
23001 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property.
23002 *
23003 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
23004 *
23005 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
23006 */
23007gchar *
23008flash_control_dup_type_ (FlashControl *object)
23009{
23010 gchar *value;
23011 g_object_get (G_OBJECT (object), "type", &value, NULL);
23012 return value;
23013}
23014
23015/**
23016 * flash_control_set_type_: (skip)
23017 * @object: A #FlashControl.
23018 * @value: The value to set.
23019 *
23020 * Sets the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property to @value.
23021 *
23022 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
23023 */
23024void
23025flash_control_set_type_ (FlashControl *object, const gchar *value)
23026{
23027 g_object_set (G_OBJECT (object), "type", value, NULL);
23028}
23029
23030/**
23031 * flash_control_emit_done:
23032 * @object: A #FlashControl.
23033 * @arg_filename: Argument to pass with the signal.
23034 *
23035 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Done">"Done"</link> D-Bus signal.
23036 */
23037void
23038flash_control_emit_done (
23039 FlashControl *object,
23040 const gchar *arg_filename)
23041{
23042 g_signal_emit_by_name (object, "done", arg_filename);
23043}
23044
23045/**
23046 * flash_control_emit_error:
23047 * @object: A #FlashControl.
23048 * @arg_filename: Argument to pass with the signal.
23049 *
23050 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Error">"Error"</link> D-Bus signal.
23051 */
23052void
23053flash_control_emit_error (
23054 FlashControl *object,
23055 const gchar *arg_filename)
23056{
23057 g_signal_emit_by_name (object, "error", arg_filename);
23058}
23059
23060/**
23061 * flash_control_emit_progress:
23062 * @object: A #FlashControl.
23063 * @arg_filename: Argument to pass with the signal.
23064 * @arg_progress: Argument to pass with the signal.
23065 *
23066 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Progress">"Progress"</link> D-Bus signal.
23067 */
23068void
23069flash_control_emit_progress (
23070 FlashControl *object,
23071 const gchar *arg_filename,
23072 guchar arg_progress)
23073{
23074 g_signal_emit_by_name (object, "progress", arg_filename, arg_progress);
23075}
23076
23077/**
23078 * flash_control_call_flash:
23079 * @proxy: A #FlashControlProxy.
23080 * @arg_type: Argument to pass with the method invocation.
23081 * @arg_filename: Argument to pass with the method invocation.
23082 * @cancellable: (allow-none): A #GCancellable or %NULL.
23083 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
23084 * @user_data: User data to pass to @callback.
23085 *
23086 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method on @proxy.
23087 * 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.
23088 * You can then call flash_control_call_flash_finish() to get the result of the operation.
23089 *
23090 * See flash_control_call_flash_sync() for the synchronous, blocking version of this method.
23091 */
23092void
23093flash_control_call_flash (
23094 FlashControl *proxy,
23095 const gchar *arg_type,
23096 const gchar *arg_filename,
23097 GCancellable *cancellable,
23098 GAsyncReadyCallback callback,
23099 gpointer user_data)
23100{
23101 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
23102 "flash",
23103 g_variant_new ("(ss)",
23104 arg_type,
23105 arg_filename),
23106 G_DBUS_CALL_FLAGS_NONE,
23107 -1,
23108 cancellable,
23109 callback,
23110 user_data);
23111}
23112
23113/**
23114 * flash_control_call_flash_finish:
23115 * @proxy: A #FlashControlProxy.
23116 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_call_flash().
23117 * @error: Return location for error or %NULL.
23118 *
23119 * Finishes an operation started with flash_control_call_flash().
23120 *
23121 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23122 */
23123gboolean
23124flash_control_call_flash_finish (
23125 FlashControl *proxy,
23126 GAsyncResult *res,
23127 GError **error)
23128{
23129 GVariant *_ret;
23130 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
23131 if (_ret == NULL)
23132 goto _out;
23133 g_variant_get (_ret,
23134 "()");
23135 g_variant_unref (_ret);
23136_out:
23137 return _ret != NULL;
23138}
23139
23140/**
23141 * flash_control_call_flash_sync:
23142 * @proxy: A #FlashControlProxy.
23143 * @arg_type: Argument to pass with the method invocation.
23144 * @arg_filename: Argument to pass with the method invocation.
23145 * @cancellable: (allow-none): A #GCancellable or %NULL.
23146 * @error: Return location for error or %NULL.
23147 *
23148 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
23149 *
23150 * See flash_control_call_flash() for the asynchronous version of this method.
23151 *
23152 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23153 */
23154gboolean
23155flash_control_call_flash_sync (
23156 FlashControl *proxy,
23157 const gchar *arg_type,
23158 const gchar *arg_filename,
23159 GCancellable *cancellable,
23160 GError **error)
23161{
23162 GVariant *_ret;
23163 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
23164 "flash",
23165 g_variant_new ("(ss)",
23166 arg_type,
23167 arg_filename),
23168 G_DBUS_CALL_FLAGS_NONE,
23169 -1,
23170 cancellable,
23171 error);
23172 if (_ret == NULL)
23173 goto _out;
23174 g_variant_get (_ret,
23175 "()");
23176 g_variant_unref (_ret);
23177_out:
23178 return _ret != NULL;
23179}
23180
23181/**
23182 * flash_control_complete_flash:
23183 * @object: A #FlashControl.
23184 * @invocation: (transfer full): A #GDBusMethodInvocation.
23185 *
23186 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</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.
23187 *
23188 * This method will free @invocation, you cannot use it afterwards.
23189 */
23190void
23191flash_control_complete_flash (
23192 FlashControl *object,
23193 GDBusMethodInvocation *invocation)
23194{
23195 g_dbus_method_invocation_return_value (invocation,
23196 g_variant_new ("()"));
23197}
23198
23199/* ------------------------------------------------------------------------ */
23200
23201/**
23202 * FlashControlProxy:
23203 *
23204 * The #FlashControlProxy structure contains only private data and should only be accessed using the provided API.
23205 */
23206
23207/**
23208 * FlashControlProxyClass:
23209 * @parent_class: The parent class.
23210 *
23211 * Class structure for #FlashControlProxy.
23212 */
23213
23214struct _FlashControlProxyPrivate
23215{
23216 GData *qdata;
23217};
23218
23219static void flash_control_proxy_iface_init (FlashControlIface *iface);
23220
23221#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23222G_DEFINE_TYPE_WITH_CODE (FlashControlProxy, flash_control_proxy, G_TYPE_DBUS_PROXY,
23223 G_ADD_PRIVATE (FlashControlProxy)
23224 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_proxy_iface_init));
23225
23226#else
23227G_DEFINE_TYPE_WITH_CODE (FlashControlProxy, flash_control_proxy, G_TYPE_DBUS_PROXY,
23228 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_proxy_iface_init));
23229
23230#endif
23231static void
23232flash_control_proxy_finalize (GObject *object)
23233{
23234 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
23235 g_datalist_clear (&proxy->priv->qdata);
23236 G_OBJECT_CLASS (flash_control_proxy_parent_class)->finalize (object);
23237}
23238
23239static void
23240flash_control_proxy_get_property (GObject *object,
23241 guint prop_id,
23242 GValue *value,
23243 GParamSpec *pspec G_GNUC_UNUSED)
23244{
23245 const _ExtendedGDBusPropertyInfo *info;
23246 GVariant *variant;
23247 g_assert (prop_id != 0 && prop_id - 1 < 2);
23248 info = _flash_control_property_info_pointers[prop_id - 1];
23249 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
23250 if (info->use_gvariant)
23251 {
23252 g_value_set_variant (value, variant);
23253 }
23254 else
23255 {
23256 if (variant != NULL)
23257 g_dbus_gvariant_to_gvalue (variant, value);
23258 }
23259 if (variant != NULL)
23260 g_variant_unref (variant);
23261}
23262
23263static void
23264flash_control_proxy_set_property_cb (GDBusProxy *proxy,
23265 GAsyncResult *res,
23266 gpointer user_data)
23267{
23268 const _ExtendedGDBusPropertyInfo *info = user_data;
23269 GError *error;
23270 GVariant *_ret;
23271 error = NULL;
23272 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
23273 if (!_ret)
23274 {
23275 g_warning ("Error setting property '%s' on interface org.openbmc.FlashControl: %s (%s, %d)",
23276 info->parent_struct.name,
23277 error->message, g_quark_to_string (error->domain), error->code);
23278 g_error_free (error);
23279 }
23280 else
23281 {
23282 g_variant_unref (_ret);
23283 }
23284}
23285
23286static void
23287flash_control_proxy_set_property (GObject *object,
23288 guint prop_id,
23289 const GValue *value,
23290 GParamSpec *pspec G_GNUC_UNUSED)
23291{
23292 const _ExtendedGDBusPropertyInfo *info;
23293 GVariant *variant;
23294 g_assert (prop_id != 0 && prop_id - 1 < 2);
23295 info = _flash_control_property_info_pointers[prop_id - 1];
23296 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
23297 g_dbus_proxy_call (G_DBUS_PROXY (object),
23298 "org.freedesktop.DBus.Properties.Set",
23299 g_variant_new ("(ssv)", "org.openbmc.FlashControl", info->parent_struct.name, variant),
23300 G_DBUS_CALL_FLAGS_NONE,
23301 -1,
23302 NULL, (GAsyncReadyCallback) flash_control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
23303 g_variant_unref (variant);
23304}
23305
23306static void
23307flash_control_proxy_g_signal (GDBusProxy *proxy,
23308 const gchar *sender_name G_GNUC_UNUSED,
23309 const gchar *signal_name,
23310 GVariant *parameters)
23311{
23312 _ExtendedGDBusSignalInfo *info;
23313 GVariantIter iter;
23314 GVariant *child;
23315 GValue *paramv;
23316 guint num_params;
23317 guint n;
23318 guint signal_id;
23319 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, signal_name);
23320 if (info == NULL)
23321 return;
23322 num_params = g_variant_n_children (parameters);
23323 paramv = g_new0 (GValue, num_params + 1);
23324 g_value_init (&paramv[0], TYPE_FLASH_CONTROL);
23325 g_value_set_object (&paramv[0], proxy);
23326 g_variant_iter_init (&iter, parameters);
23327 n = 1;
23328 while ((child = g_variant_iter_next_value (&iter)) != NULL)
23329 {
23330 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
23331 if (arg_info->use_gvariant)
23332 {
23333 g_value_init (&paramv[n], G_TYPE_VARIANT);
23334 g_value_set_variant (&paramv[n], child);
23335 n++;
23336 }
23337 else
23338 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
23339 g_variant_unref (child);
23340 }
23341 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH_CONTROL);
23342 g_signal_emitv (paramv, signal_id, 0, NULL);
23343 for (n = 0; n < num_params + 1; n++)
23344 g_value_unset (&paramv[n]);
23345 g_free (paramv);
23346}
23347
23348static void
23349flash_control_proxy_g_properties_changed (GDBusProxy *_proxy,
23350 GVariant *changed_properties,
23351 const gchar *const *invalidated_properties)
23352{
23353 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (_proxy);
23354 guint n;
23355 const gchar *key;
23356 GVariantIter *iter;
23357 _ExtendedGDBusPropertyInfo *info;
23358 g_variant_get (changed_properties, "a{sv}", &iter);
23359 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
23360 {
23361 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, key);
23362 g_datalist_remove_data (&proxy->priv->qdata, key);
23363 if (info != NULL)
23364 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
23365 }
23366 g_variant_iter_free (iter);
23367 for (n = 0; invalidated_properties[n] != NULL; n++)
23368 {
23369 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, invalidated_properties[n]);
23370 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
23371 if (info != NULL)
23372 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
23373 }
23374}
23375
23376static const gchar *
23377flash_control_proxy_get_filename (FlashControl *object)
23378{
23379 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
23380 GVariant *variant;
23381 const gchar *value = NULL;
23382 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "filename");
23383 if (variant != NULL)
23384 {
23385 value = g_variant_get_string (variant, NULL);
23386 g_variant_unref (variant);
23387 }
23388 return value;
23389}
23390
23391static const gchar *
23392flash_control_proxy_get_type_ (FlashControl *object)
23393{
23394 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
23395 GVariant *variant;
23396 const gchar *value = NULL;
23397 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "type");
23398 if (variant != NULL)
23399 {
23400 value = g_variant_get_string (variant, NULL);
23401 g_variant_unref (variant);
23402 }
23403 return value;
23404}
23405
23406static void
23407flash_control_proxy_init (FlashControlProxy *proxy)
23408{
23409#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23410 proxy->priv = flash_control_proxy_get_instance_private (proxy);
23411#else
23412 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_CONTROL_PROXY, FlashControlProxyPrivate);
23413#endif
23414
23415 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_control_interface_info ());
23416}
23417
23418static void
23419flash_control_proxy_class_init (FlashControlProxyClass *klass)
23420{
23421 GObjectClass *gobject_class;
23422 GDBusProxyClass *proxy_class;
23423
23424 gobject_class = G_OBJECT_CLASS (klass);
23425 gobject_class->finalize = flash_control_proxy_finalize;
23426 gobject_class->get_property = flash_control_proxy_get_property;
23427 gobject_class->set_property = flash_control_proxy_set_property;
23428
23429 proxy_class = G_DBUS_PROXY_CLASS (klass);
23430 proxy_class->g_signal = flash_control_proxy_g_signal;
23431 proxy_class->g_properties_changed = flash_control_proxy_g_properties_changed;
23432
23433 flash_control_override_properties (gobject_class, 1);
23434
23435#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
23436 g_type_class_add_private (klass, sizeof (FlashControlProxyPrivate));
23437#endif
23438}
23439
23440static void
23441flash_control_proxy_iface_init (FlashControlIface *iface)
23442{
23443 iface->get_filename = flash_control_proxy_get_filename;
23444 iface->get_type_ = flash_control_proxy_get_type_;
23445}
23446
23447/**
23448 * flash_control_proxy_new:
23449 * @connection: A #GDBusConnection.
23450 * @flags: Flags from the #GDBusProxyFlags enumeration.
23451 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
23452 * @object_path: An object path.
23453 * @cancellable: (allow-none): A #GCancellable or %NULL.
23454 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
23455 * @user_data: User data to pass to @callback.
23456 *
23457 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>. See g_dbus_proxy_new() for more details.
23458 *
23459 * 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.
23460 * You can then call flash_control_proxy_new_finish() to get the result of the operation.
23461 *
23462 * See flash_control_proxy_new_sync() for the synchronous, blocking version of this constructor.
23463 */
23464void
23465flash_control_proxy_new (
23466 GDBusConnection *connection,
23467 GDBusProxyFlags flags,
23468 const gchar *name,
23469 const gchar *object_path,
23470 GCancellable *cancellable,
23471 GAsyncReadyCallback callback,
23472 gpointer user_data)
23473{
23474 g_async_initable_new_async (TYPE_FLASH_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.FlashControl", NULL);
23475}
23476
23477/**
23478 * flash_control_proxy_new_finish:
23479 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_proxy_new().
23480 * @error: Return location for error or %NULL
23481 *
23482 * Finishes an operation started with flash_control_proxy_new().
23483 *
23484 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
23485 */
23486FlashControl *
23487flash_control_proxy_new_finish (
23488 GAsyncResult *res,
23489 GError **error)
23490{
23491 GObject *ret;
23492 GObject *source_object;
23493 source_object = g_async_result_get_source_object (res);
23494 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
23495 g_object_unref (source_object);
23496 if (ret != NULL)
23497 return FLASH_CONTROL (ret);
23498 else
23499 return NULL;
23500}
23501
23502/**
23503 * flash_control_proxy_new_sync:
23504 * @connection: A #GDBusConnection.
23505 * @flags: Flags from the #GDBusProxyFlags enumeration.
23506 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
23507 * @object_path: An object path.
23508 * @cancellable: (allow-none): A #GCancellable or %NULL.
23509 * @error: Return location for error or %NULL
23510 *
23511 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>. See g_dbus_proxy_new_sync() for more details.
23512 *
23513 * The calling thread is blocked until a reply is received.
23514 *
23515 * See flash_control_proxy_new() for the asynchronous version of this constructor.
23516 *
23517 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
23518 */
23519FlashControl *
23520flash_control_proxy_new_sync (
23521 GDBusConnection *connection,
23522 GDBusProxyFlags flags,
23523 const gchar *name,
23524 const gchar *object_path,
23525 GCancellable *cancellable,
23526 GError **error)
23527{
23528 GInitable *ret;
23529 ret = g_initable_new (TYPE_FLASH_CONTROL_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.FlashControl", NULL);
23530 if (ret != NULL)
23531 return FLASH_CONTROL (ret);
23532 else
23533 return NULL;
23534}
23535
23536
23537/**
23538 * flash_control_proxy_new_for_bus:
23539 * @bus_type: A #GBusType.
23540 * @flags: Flags from the #GDBusProxyFlags enumeration.
23541 * @name: A bus name (well-known or unique).
23542 * @object_path: An object path.
23543 * @cancellable: (allow-none): A #GCancellable or %NULL.
23544 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
23545 * @user_data: User data to pass to @callback.
23546 *
23547 * Like flash_control_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
23548 *
23549 * 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.
23550 * You can then call flash_control_proxy_new_for_bus_finish() to get the result of the operation.
23551 *
23552 * See flash_control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
23553 */
23554void
23555flash_control_proxy_new_for_bus (
23556 GBusType bus_type,
23557 GDBusProxyFlags flags,
23558 const gchar *name,
23559 const gchar *object_path,
23560 GCancellable *cancellable,
23561 GAsyncReadyCallback callback,
23562 gpointer user_data)
23563{
23564 g_async_initable_new_async (TYPE_FLASH_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.FlashControl", NULL);
23565}
23566
23567/**
23568 * flash_control_proxy_new_for_bus_finish:
23569 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_proxy_new_for_bus().
23570 * @error: Return location for error or %NULL
23571 *
23572 * Finishes an operation started with flash_control_proxy_new_for_bus().
23573 *
23574 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
23575 */
23576FlashControl *
23577flash_control_proxy_new_for_bus_finish (
23578 GAsyncResult *res,
23579 GError **error)
23580{
23581 GObject *ret;
23582 GObject *source_object;
23583 source_object = g_async_result_get_source_object (res);
23584 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
23585 g_object_unref (source_object);
23586 if (ret != NULL)
23587 return FLASH_CONTROL (ret);
23588 else
23589 return NULL;
23590}
23591
23592/**
23593 * flash_control_proxy_new_for_bus_sync:
23594 * @bus_type: A #GBusType.
23595 * @flags: Flags from the #GDBusProxyFlags enumeration.
23596 * @name: A bus name (well-known or unique).
23597 * @object_path: An object path.
23598 * @cancellable: (allow-none): A #GCancellable or %NULL.
23599 * @error: Return location for error or %NULL
23600 *
23601 * Like flash_control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
23602 *
23603 * The calling thread is blocked until a reply is received.
23604 *
23605 * See flash_control_proxy_new_for_bus() for the asynchronous version of this constructor.
23606 *
23607 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
23608 */
23609FlashControl *
23610flash_control_proxy_new_for_bus_sync (
23611 GBusType bus_type,
23612 GDBusProxyFlags flags,
23613 const gchar *name,
23614 const gchar *object_path,
23615 GCancellable *cancellable,
23616 GError **error)
23617{
23618 GInitable *ret;
23619 ret = g_initable_new (TYPE_FLASH_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.FlashControl", NULL);
23620 if (ret != NULL)
23621 return FLASH_CONTROL (ret);
23622 else
23623 return NULL;
23624}
23625
23626
23627/* ------------------------------------------------------------------------ */
23628
23629/**
23630 * FlashControlSkeleton:
23631 *
23632 * The #FlashControlSkeleton structure contains only private data and should only be accessed using the provided API.
23633 */
23634
23635/**
23636 * FlashControlSkeletonClass:
23637 * @parent_class: The parent class.
23638 *
23639 * Class structure for #FlashControlSkeleton.
23640 */
23641
23642struct _FlashControlSkeletonPrivate
23643{
23644 GValue *properties;
23645 GList *changed_properties;
23646 GSource *changed_properties_idle_source;
23647 GMainContext *context;
23648 GMutex lock;
23649};
23650
23651static void
23652_flash_control_skeleton_handle_method_call (
23653 GDBusConnection *connection G_GNUC_UNUSED,
23654 const gchar *sender G_GNUC_UNUSED,
23655 const gchar *object_path G_GNUC_UNUSED,
23656 const gchar *interface_name,
23657 const gchar *method_name,
23658 GVariant *parameters,
23659 GDBusMethodInvocation *invocation,
23660 gpointer user_data)
23661{
23662 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
23663 _ExtendedGDBusMethodInfo *info;
23664 GVariantIter iter;
23665 GVariant *child;
23666 GValue *paramv;
23667 guint num_params;
23668 guint num_extra;
23669 guint n;
23670 guint signal_id;
23671 GValue return_value = G_VALUE_INIT;
23672 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
23673 g_assert (info != NULL);
23674 num_params = g_variant_n_children (parameters);
23675 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
23676 n = 0;
23677 g_value_init (&paramv[n], TYPE_FLASH_CONTROL);
23678 g_value_set_object (&paramv[n++], skeleton);
23679 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
23680 g_value_set_object (&paramv[n++], invocation);
23681 if (info->pass_fdlist)
23682 {
23683#ifdef G_OS_UNIX
23684 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
23685 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
23686#else
23687 g_assert_not_reached ();
23688#endif
23689 }
23690 g_variant_iter_init (&iter, parameters);
23691 while ((child = g_variant_iter_next_value (&iter)) != NULL)
23692 {
23693 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
23694 if (arg_info->use_gvariant)
23695 {
23696 g_value_init (&paramv[n], G_TYPE_VARIANT);
23697 g_value_set_variant (&paramv[n], child);
23698 n++;
23699 }
23700 else
23701 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
23702 g_variant_unref (child);
23703 }
23704 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH_CONTROL);
23705 g_value_init (&return_value, G_TYPE_BOOLEAN);
23706 g_signal_emitv (paramv, signal_id, 0, &return_value);
23707 if (!g_value_get_boolean (&return_value))
23708 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);
23709 g_value_unset (&return_value);
23710 for (n = 0; n < num_params + num_extra; n++)
23711 g_value_unset (&paramv[n]);
23712 g_free (paramv);
23713}
23714
23715static GVariant *
23716_flash_control_skeleton_handle_get_property (
23717 GDBusConnection *connection G_GNUC_UNUSED,
23718 const gchar *sender G_GNUC_UNUSED,
23719 const gchar *object_path G_GNUC_UNUSED,
23720 const gchar *interface_name G_GNUC_UNUSED,
23721 const gchar *property_name,
23722 GError **error,
23723 gpointer user_data)
23724{
23725 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
23726 GValue value = G_VALUE_INIT;
23727 GParamSpec *pspec;
23728 _ExtendedGDBusPropertyInfo *info;
23729 GVariant *ret;
23730 ret = NULL;
23731 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, property_name);
23732 g_assert (info != NULL);
23733 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
23734 if (pspec == NULL)
23735 {
23736 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
23737 }
23738 else
23739 {
23740 g_value_init (&value, pspec->value_type);
23741 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
23742 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
23743 g_value_unset (&value);
23744 }
23745 return ret;
23746}
23747
23748static gboolean
23749_flash_control_skeleton_handle_set_property (
23750 GDBusConnection *connection G_GNUC_UNUSED,
23751 const gchar *sender G_GNUC_UNUSED,
23752 const gchar *object_path G_GNUC_UNUSED,
23753 const gchar *interface_name G_GNUC_UNUSED,
23754 const gchar *property_name,
23755 GVariant *variant,
23756 GError **error,
23757 gpointer user_data)
23758{
23759 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
23760 GValue value = G_VALUE_INIT;
23761 GParamSpec *pspec;
23762 _ExtendedGDBusPropertyInfo *info;
23763 gboolean ret;
23764 ret = FALSE;
23765 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, property_name);
23766 g_assert (info != NULL);
23767 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
23768 if (pspec == NULL)
23769 {
23770 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
23771 }
23772 else
23773 {
23774 if (info->use_gvariant)
23775 g_value_set_variant (&value, variant);
23776 else
23777 g_dbus_gvariant_to_gvalue (variant, &value);
23778 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
23779 g_value_unset (&value);
23780 ret = TRUE;
23781 }
23782 return ret;
23783}
23784
23785static const GDBusInterfaceVTable _flash_control_skeleton_vtable =
23786{
23787 _flash_control_skeleton_handle_method_call,
23788 _flash_control_skeleton_handle_get_property,
23789 _flash_control_skeleton_handle_set_property,
23790 {NULL}
23791};
23792
23793static GDBusInterfaceInfo *
23794flash_control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
23795{
23796 return flash_control_interface_info ();
23797}
23798
23799static GDBusInterfaceVTable *
23800flash_control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
23801{
23802 return (GDBusInterfaceVTable *) &_flash_control_skeleton_vtable;
23803}
23804
23805static GVariant *
23806flash_control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
23807{
23808 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (_skeleton);
23809
23810 GVariantBuilder builder;
23811 guint n;
23812 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
23813 if (_flash_control_interface_info.parent_struct.properties == NULL)
23814 goto out;
23815 for (n = 0; _flash_control_interface_info.parent_struct.properties[n] != NULL; n++)
23816 {
23817 GDBusPropertyInfo *info = _flash_control_interface_info.parent_struct.properties[n];
23818 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
23819 {
23820 GVariant *value;
23821 value = _flash_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.FlashControl", info->name, NULL, skeleton);
23822 if (value != NULL)
23823 {
23824 g_variant_take_ref (value);
23825 g_variant_builder_add (&builder, "{sv}", info->name, value);
23826 g_variant_unref (value);
23827 }
23828 }
23829 }
23830out:
23831 return g_variant_builder_end (&builder);
23832}
23833
23834static gboolean _flash_control_emit_changed (gpointer user_data);
23835
23836static void
23837flash_control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
23838{
23839 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (_skeleton);
23840 gboolean emit_changed = FALSE;
23841
23842 g_mutex_lock (&skeleton->priv->lock);
23843 if (skeleton->priv->changed_properties_idle_source != NULL)
23844 {
23845 g_source_destroy (skeleton->priv->changed_properties_idle_source);
23846 skeleton->priv->changed_properties_idle_source = NULL;
23847 emit_changed = TRUE;
23848 }
23849 g_mutex_unlock (&skeleton->priv->lock);
23850
23851 if (emit_changed)
23852 _flash_control_emit_changed (skeleton);
23853}
23854
23855static void
23856_flash_control_on_signal_done (
23857 FlashControl *object,
23858 const gchar *arg_filename)
23859{
23860 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
23861
23862 GList *connections, *l;
23863 GVariant *signal_variant;
23864 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
23865
23866 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
23867 arg_filename));
23868 for (l = connections; l != NULL; l = l->next)
23869 {
23870 GDBusConnection *connection = l->data;
23871 g_dbus_connection_emit_signal (connection,
23872 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Done",
23873 signal_variant, NULL);
23874 }
23875 g_variant_unref (signal_variant);
23876 g_list_free_full (connections, g_object_unref);
23877}
23878
23879static void
23880_flash_control_on_signal_error (
23881 FlashControl *object,
23882 const gchar *arg_filename)
23883{
23884 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
23885
23886 GList *connections, *l;
23887 GVariant *signal_variant;
23888 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
23889
23890 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
23891 arg_filename));
23892 for (l = connections; l != NULL; l = l->next)
23893 {
23894 GDBusConnection *connection = l->data;
23895 g_dbus_connection_emit_signal (connection,
23896 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Error",
23897 signal_variant, NULL);
23898 }
23899 g_variant_unref (signal_variant);
23900 g_list_free_full (connections, g_object_unref);
23901}
23902
23903static void
23904_flash_control_on_signal_progress (
23905 FlashControl *object,
23906 const gchar *arg_filename,
23907 guchar arg_progress)
23908{
23909 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
23910
23911 GList *connections, *l;
23912 GVariant *signal_variant;
23913 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
23914
23915 signal_variant = g_variant_ref_sink (g_variant_new ("(sy)",
23916 arg_filename,
23917 arg_progress));
23918 for (l = connections; l != NULL; l = l->next)
23919 {
23920 GDBusConnection *connection = l->data;
23921 g_dbus_connection_emit_signal (connection,
23922 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Progress",
23923 signal_variant, NULL);
23924 }
23925 g_variant_unref (signal_variant);
23926 g_list_free_full (connections, g_object_unref);
23927}
23928
23929static void flash_control_skeleton_iface_init (FlashControlIface *iface);
23930#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23931G_DEFINE_TYPE_WITH_CODE (FlashControlSkeleton, flash_control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
23932 G_ADD_PRIVATE (FlashControlSkeleton)
23933 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_skeleton_iface_init));
23934
23935#else
23936G_DEFINE_TYPE_WITH_CODE (FlashControlSkeleton, flash_control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
23937 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_skeleton_iface_init));
23938
23939#endif
23940static void
23941flash_control_skeleton_finalize (GObject *object)
23942{
23943 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
23944 guint n;
23945 for (n = 0; n < 2; n++)
23946 g_value_unset (&skeleton->priv->properties[n]);
23947 g_free (skeleton->priv->properties);
23948 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
23949 if (skeleton->priv->changed_properties_idle_source != NULL)
23950 g_source_destroy (skeleton->priv->changed_properties_idle_source);
23951 g_main_context_unref (skeleton->priv->context);
23952 g_mutex_clear (&skeleton->priv->lock);
23953 G_OBJECT_CLASS (flash_control_skeleton_parent_class)->finalize (object);
23954}
23955
23956static void
23957flash_control_skeleton_get_property (GObject *object,
23958 guint prop_id,
23959 GValue *value,
23960 GParamSpec *pspec G_GNUC_UNUSED)
23961{
23962 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
23963 g_assert (prop_id != 0 && prop_id - 1 < 2);
23964 g_mutex_lock (&skeleton->priv->lock);
23965 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
23966 g_mutex_unlock (&skeleton->priv->lock);
23967}
23968
23969static gboolean
23970_flash_control_emit_changed (gpointer user_data)
23971{
23972 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
23973 GList *l;
23974 GVariantBuilder builder;
23975 GVariantBuilder invalidated_builder;
23976 guint num_changes;
23977
23978 g_mutex_lock (&skeleton->priv->lock);
23979 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
23980 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
23981 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
23982 {
23983 ChangedProperty *cp = l->data;
23984 GVariant *variant;
23985 const GValue *cur_value;
23986
23987 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
23988 if (!_g_value_equal (cur_value, &cp->orig_value))
23989 {
23990 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
23991 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
23992 g_variant_unref (variant);
23993 num_changes++;
23994 }
23995 }
23996 if (num_changes > 0)
23997 {
23998 GList *connections, *ll;
23999 GVariant *signal_variant;
24000 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.FlashControl",
24001 &builder, &invalidated_builder));
24002 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
24003 for (ll = connections; ll != NULL; ll = ll->next)
24004 {
24005 GDBusConnection *connection = ll->data;
24006
24007 g_dbus_connection_emit_signal (connection,
24008 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
24009 "org.freedesktop.DBus.Properties",
24010 "PropertiesChanged",
24011 signal_variant,
24012 NULL);
24013 }
24014 g_variant_unref (signal_variant);
24015 g_list_free_full (connections, g_object_unref);
24016 }
24017 else
24018 {
24019 g_variant_builder_clear (&builder);
24020 g_variant_builder_clear (&invalidated_builder);
24021 }
24022 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
24023 skeleton->priv->changed_properties = NULL;
24024 skeleton->priv->changed_properties_idle_source = NULL;
24025 g_mutex_unlock (&skeleton->priv->lock);
24026 return FALSE;
24027}
24028
24029static void
24030_flash_control_schedule_emit_changed (FlashControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
24031{
24032 ChangedProperty *cp;
24033 GList *l;
24034 cp = NULL;
24035 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
24036 {
24037 ChangedProperty *i_cp = l->data;
24038 if (i_cp->info == info)
24039 {
24040 cp = i_cp;
24041 break;
24042 }
24043 }
24044 if (cp == NULL)
24045 {
24046 cp = g_new0 (ChangedProperty, 1);
24047 cp->prop_id = prop_id;
24048 cp->info = info;
24049 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
24050 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
24051 g_value_copy (orig_value, &cp->orig_value);
24052 }
24053}
24054
24055static void
24056flash_control_skeleton_notify (GObject *object,
24057 GParamSpec *pspec G_GNUC_UNUSED)
24058{
24059 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
24060 g_mutex_lock (&skeleton->priv->lock);
24061 if (skeleton->priv->changed_properties != NULL &&
24062 skeleton->priv->changed_properties_idle_source == NULL)
24063 {
24064 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
24065 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
24066 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _flash_control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylak2cb27752015-10-19 16:23:14 -050024067 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _flash_control_emit_changed");
Norman James18998182015-10-11 21:54:53 -050024068 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
24069 g_source_unref (skeleton->priv->changed_properties_idle_source);
24070 }
24071 g_mutex_unlock (&skeleton->priv->lock);
24072}
24073
24074static void
24075flash_control_skeleton_set_property (GObject *object,
24076 guint prop_id,
24077 const GValue *value,
24078 GParamSpec *pspec)
24079{
24080 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
24081 g_assert (prop_id != 0 && prop_id - 1 < 2);
24082 g_mutex_lock (&skeleton->priv->lock);
24083 g_object_freeze_notify (object);
24084 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
24085 {
24086 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
24087 _flash_control_schedule_emit_changed (skeleton, _flash_control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
24088 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
24089 g_object_notify_by_pspec (object, pspec);
24090 }
24091 g_mutex_unlock (&skeleton->priv->lock);
24092 g_object_thaw_notify (object);
24093}
24094
24095static void
24096flash_control_skeleton_init (FlashControlSkeleton *skeleton)
24097{
24098#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
24099 skeleton->priv = flash_control_skeleton_get_instance_private (skeleton);
24100#else
24101 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_CONTROL_SKELETON, FlashControlSkeletonPrivate);
24102#endif
24103
24104 g_mutex_init (&skeleton->priv->lock);
24105 skeleton->priv->context = g_main_context_ref_thread_default ();
24106 skeleton->priv->properties = g_new0 (GValue, 2);
24107 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
24108 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
24109}
24110
24111static const gchar *
24112flash_control_skeleton_get_filename (FlashControl *object)
24113{
24114 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
24115 const gchar *value;
24116 g_mutex_lock (&skeleton->priv->lock);
24117 value = g_value_get_string (&(skeleton->priv->properties[0]));
24118 g_mutex_unlock (&skeleton->priv->lock);
24119 return value;
24120}
24121
24122static const gchar *
24123flash_control_skeleton_get_type_ (FlashControl *object)
24124{
24125 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
24126 const gchar *value;
24127 g_mutex_lock (&skeleton->priv->lock);
24128 value = g_value_get_string (&(skeleton->priv->properties[1]));
24129 g_mutex_unlock (&skeleton->priv->lock);
24130 return value;
24131}
24132
24133static void
24134flash_control_skeleton_class_init (FlashControlSkeletonClass *klass)
24135{
24136 GObjectClass *gobject_class;
24137 GDBusInterfaceSkeletonClass *skeleton_class;
24138
24139 gobject_class = G_OBJECT_CLASS (klass);
24140 gobject_class->finalize = flash_control_skeleton_finalize;
24141 gobject_class->get_property = flash_control_skeleton_get_property;
24142 gobject_class->set_property = flash_control_skeleton_set_property;
24143 gobject_class->notify = flash_control_skeleton_notify;
24144
24145
24146 flash_control_override_properties (gobject_class, 1);
24147
24148 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
24149 skeleton_class->get_info = flash_control_skeleton_dbus_interface_get_info;
24150 skeleton_class->get_properties = flash_control_skeleton_dbus_interface_get_properties;
24151 skeleton_class->flush = flash_control_skeleton_dbus_interface_flush;
24152 skeleton_class->get_vtable = flash_control_skeleton_dbus_interface_get_vtable;
24153
24154#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
24155 g_type_class_add_private (klass, sizeof (FlashControlSkeletonPrivate));
24156#endif
24157}
24158
24159static void
24160flash_control_skeleton_iface_init (FlashControlIface *iface)
24161{
24162 iface->done = _flash_control_on_signal_done;
24163 iface->error = _flash_control_on_signal_error;
24164 iface->progress = _flash_control_on_signal_progress;
24165 iface->get_filename = flash_control_skeleton_get_filename;
24166 iface->get_type_ = flash_control_skeleton_get_type_;
24167}
24168
24169/**
24170 * flash_control_skeleton_new:
24171 *
24172 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
24173 *
24174 * Returns: (transfer full) (type FlashControlSkeleton): The skeleton object.
24175 */
24176FlashControl *
24177flash_control_skeleton_new (void)
24178{
24179 return FLASH_CONTROL (g_object_new (TYPE_FLASH_CONTROL_SKELETON, NULL));
24180}
24181
24182/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050024183 * Code for interface org.openbmc.Button
24184 * ------------------------------------------------------------------------
24185 */
24186
24187/**
24188 * SECTION:Button
24189 * @title: Button
24190 * @short_description: Generated C code for the org.openbmc.Button D-Bus interface
24191 *
24192 * 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.
24193 */
24194
24195/* ---- Introspection data for org.openbmc.Button ---- */
24196
24197static const _ExtendedGDBusArgInfo _button_method_info_is_on_OUT_ARG_state =
24198{
24199 {
24200 -1,
24201 (gchar *) "state",
24202 (gchar *) "b",
24203 NULL
24204 },
24205 FALSE
24206};
24207
24208static const _ExtendedGDBusArgInfo * const _button_method_info_is_on_OUT_ARG_pointers[] =
24209{
24210 &_button_method_info_is_on_OUT_ARG_state,
24211 NULL
24212};
24213
24214static const _ExtendedGDBusMethodInfo _button_method_info_is_on =
24215{
24216 {
24217 -1,
24218 (gchar *) "isOn",
24219 NULL,
24220 (GDBusArgInfo **) &_button_method_info_is_on_OUT_ARG_pointers,
24221 NULL
24222 },
24223 "handle-is-on",
24224 FALSE
24225};
24226
24227static const _ExtendedGDBusMethodInfo _button_method_info_sim_button_press =
24228{
24229 {
24230 -1,
24231 (gchar *) "simButtonPress",
24232 NULL,
24233 NULL,
24234 NULL
24235 },
24236 "handle-sim-button-press",
24237 FALSE
24238};
24239
24240static const _ExtendedGDBusMethodInfo _button_method_info_sim_button_long_press =
24241{
24242 {
24243 -1,
24244 (gchar *) "simButtonLongPress",
24245 NULL,
24246 NULL,
24247 NULL
24248 },
24249 "handle-sim-button-long-press",
24250 FALSE
24251};
24252
24253static const _ExtendedGDBusMethodInfo * const _button_method_info_pointers[] =
24254{
24255 &_button_method_info_is_on,
24256 &_button_method_info_sim_button_press,
24257 &_button_method_info_sim_button_long_press,
24258 NULL
24259};
24260
24261static const _ExtendedGDBusSignalInfo _button_signal_info_button_release =
24262{
24263 {
24264 -1,
24265 (gchar *) "ButtonRelease",
24266 NULL,
24267 NULL
24268 },
24269 "button-release"
24270};
24271
24272static const _ExtendedGDBusSignalInfo _button_signal_info_button_pressed =
24273{
24274 {
24275 -1,
24276 (gchar *) "ButtonPressed",
24277 NULL,
24278 NULL
24279 },
24280 "button-pressed"
24281};
24282
24283static const _ExtendedGDBusSignalInfo _button_signal_info_button_pressed_long =
24284{
24285 {
24286 -1,
24287 (gchar *) "ButtonPressedLong",
24288 NULL,
24289 NULL
24290 },
24291 "button-pressed-long"
24292};
24293
24294static const _ExtendedGDBusSignalInfo * const _button_signal_info_pointers[] =
24295{
24296 &_button_signal_info_button_release,
24297 &_button_signal_info_button_pressed,
24298 &_button_signal_info_button_pressed_long,
24299 NULL
24300};
24301
24302static const _ExtendedGDBusPropertyInfo _button_property_info_state =
24303{
24304 {
24305 -1,
24306 (gchar *) "state",
24307 (gchar *) "b",
24308 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
24309 NULL
24310 },
24311 "state",
24312 FALSE
24313};
24314
24315static const _ExtendedGDBusPropertyInfo * const _button_property_info_pointers[] =
24316{
24317 &_button_property_info_state,
24318 NULL
24319};
24320
24321static const _ExtendedGDBusInterfaceInfo _button_interface_info =
24322{
24323 {
24324 -1,
24325 (gchar *) "org.openbmc.Button",
24326 (GDBusMethodInfo **) &_button_method_info_pointers,
24327 (GDBusSignalInfo **) &_button_signal_info_pointers,
24328 (GDBusPropertyInfo **) &_button_property_info_pointers,
24329 NULL
24330 },
24331 "button",
24332};
24333
24334
24335/**
24336 * button_interface_info:
24337 *
24338 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> D-Bus interface.
24339 *
24340 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
24341 */
24342GDBusInterfaceInfo *
24343button_interface_info (void)
24344{
24345 return (GDBusInterfaceInfo *) &_button_interface_info.parent_struct;
24346}
24347
24348/**
24349 * button_override_properties:
24350 * @klass: The class structure for a #GObject<!-- -->-derived class.
24351 * @property_id_begin: The property id to assign to the first overridden property.
24352 *
24353 * Overrides all #GObject properties in the #Button interface for a concrete class.
24354 * The properties are overridden in the order they are defined.
24355 *
24356 * Returns: The last property id.
24357 */
24358guint
24359button_override_properties (GObjectClass *klass, guint property_id_begin)
24360{
24361 g_object_class_override_property (klass, property_id_begin++, "state");
24362 return property_id_begin - 1;
24363}
24364
24365
24366
24367/**
24368 * Button:
24369 *
24370 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
24371 */
24372
24373/**
24374 * ButtonIface:
24375 * @parent_iface: The parent interface.
24376 * @handle_is_on: Handler for the #Button::handle-is-on signal.
24377 * @handle_sim_button_long_press: Handler for the #Button::handle-sim-button-long-press signal.
24378 * @handle_sim_button_press: Handler for the #Button::handle-sim-button-press signal.
24379 * @get_state: Getter for the #Button:state property.
24380 * @button_pressed: Handler for the #Button::button-pressed signal.
24381 * @button_pressed_long: Handler for the #Button::button-pressed-long signal.
24382 * @button_release: Handler for the #Button::button-release signal.
24383 *
24384 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
24385 */
24386
24387typedef ButtonIface ButtonInterface;
24388G_DEFINE_INTERFACE (Button, button, G_TYPE_OBJECT);
24389
24390static void
24391button_default_init (ButtonIface *iface)
24392{
24393 /* GObject signals for incoming D-Bus method calls: */
24394 /**
24395 * Button::handle-is-on:
24396 * @object: A #Button.
24397 * @invocation: A #GDBusMethodInvocation.
24398 *
24399 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method.
24400 *
24401 * 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.
24402 *
24403 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
24404 */
24405 g_signal_new ("handle-is-on",
24406 G_TYPE_FROM_INTERFACE (iface),
24407 G_SIGNAL_RUN_LAST,
24408 G_STRUCT_OFFSET (ButtonIface, handle_is_on),
24409 g_signal_accumulator_true_handled,
24410 NULL,
24411 g_cclosure_marshal_generic,
24412 G_TYPE_BOOLEAN,
24413 1,
24414 G_TYPE_DBUS_METHOD_INVOCATION);
24415
24416 /**
24417 * Button::handle-sim-button-press:
24418 * @object: A #Button.
24419 * @invocation: A #GDBusMethodInvocation.
24420 *
24421 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method.
24422 *
24423 * 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.
24424 *
24425 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
24426 */
24427 g_signal_new ("handle-sim-button-press",
24428 G_TYPE_FROM_INTERFACE (iface),
24429 G_SIGNAL_RUN_LAST,
24430 G_STRUCT_OFFSET (ButtonIface, handle_sim_button_press),
24431 g_signal_accumulator_true_handled,
24432 NULL,
24433 g_cclosure_marshal_generic,
24434 G_TYPE_BOOLEAN,
24435 1,
24436 G_TYPE_DBUS_METHOD_INVOCATION);
24437
24438 /**
24439 * Button::handle-sim-button-long-press:
24440 * @object: A #Button.
24441 * @invocation: A #GDBusMethodInvocation.
24442 *
24443 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method.
24444 *
24445 * 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.
24446 *
24447 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
24448 */
24449 g_signal_new ("handle-sim-button-long-press",
24450 G_TYPE_FROM_INTERFACE (iface),
24451 G_SIGNAL_RUN_LAST,
24452 G_STRUCT_OFFSET (ButtonIface, handle_sim_button_long_press),
24453 g_signal_accumulator_true_handled,
24454 NULL,
24455 g_cclosure_marshal_generic,
24456 G_TYPE_BOOLEAN,
24457 1,
24458 G_TYPE_DBUS_METHOD_INVOCATION);
24459
24460 /* GObject signals for received D-Bus signals: */
24461 /**
24462 * Button::button-release:
24463 * @object: A #Button.
24464 *
24465 * 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.
24466 *
24467 * 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.
24468 */
24469 g_signal_new ("button-release",
24470 G_TYPE_FROM_INTERFACE (iface),
24471 G_SIGNAL_RUN_LAST,
24472 G_STRUCT_OFFSET (ButtonIface, button_release),
24473 NULL,
24474 NULL,
24475 g_cclosure_marshal_generic,
24476 G_TYPE_NONE,
24477 0);
24478
24479 /**
24480 * Button::button-pressed:
24481 * @object: A #Button.
24482 *
24483 * 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.
24484 *
24485 * 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.
24486 */
24487 g_signal_new ("button-pressed",
24488 G_TYPE_FROM_INTERFACE (iface),
24489 G_SIGNAL_RUN_LAST,
24490 G_STRUCT_OFFSET (ButtonIface, button_pressed),
24491 NULL,
24492 NULL,
24493 g_cclosure_marshal_generic,
24494 G_TYPE_NONE,
24495 0);
24496
24497 /**
24498 * Button::button-pressed-long:
24499 * @object: A #Button.
24500 *
24501 * 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.
24502 *
24503 * 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.
24504 */
24505 g_signal_new ("button-pressed-long",
24506 G_TYPE_FROM_INTERFACE (iface),
24507 G_SIGNAL_RUN_LAST,
24508 G_STRUCT_OFFSET (ButtonIface, button_pressed_long),
24509 NULL,
24510 NULL,
24511 g_cclosure_marshal_generic,
24512 G_TYPE_NONE,
24513 0);
24514
24515 /* GObject properties for D-Bus properties: */
24516 /**
24517 * Button:state:
24518 *
24519 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link>.
24520 *
24521 * 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.
24522 */
24523 g_object_interface_install_property (iface,
24524 g_param_spec_boolean ("state", "state", "state", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
24525}
24526
24527/**
24528 * button_get_state: (skip)
24529 * @object: A #Button.
24530 *
24531 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property.
24532 *
24533 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
24534 *
24535 * Returns: The property value.
24536 */
24537gboolean
24538button_get_state (Button *object)
24539{
24540 return BUTTON_GET_IFACE (object)->get_state (object);
24541}
24542
24543/**
24544 * button_set_state: (skip)
24545 * @object: A #Button.
24546 * @value: The value to set.
24547 *
24548 * Sets the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property to @value.
24549 *
24550 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
24551 */
24552void
24553button_set_state (Button *object, gboolean value)
24554{
24555 g_object_set (G_OBJECT (object), "state", value, NULL);
24556}
24557
24558/**
24559 * button_emit_button_release:
24560 * @object: A #Button.
24561 *
24562 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonRelease">"ButtonRelease"</link> D-Bus signal.
24563 */
24564void
24565button_emit_button_release (
24566 Button *object)
24567{
24568 g_signal_emit_by_name (object, "button-release");
24569}
24570
24571/**
24572 * button_emit_button_pressed:
24573 * @object: A #Button.
24574 *
24575 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressed">"ButtonPressed"</link> D-Bus signal.
24576 */
24577void
24578button_emit_button_pressed (
24579 Button *object)
24580{
24581 g_signal_emit_by_name (object, "button-pressed");
24582}
24583
24584/**
24585 * button_emit_button_pressed_long:
24586 * @object: A #Button.
24587 *
24588 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressedLong">"ButtonPressedLong"</link> D-Bus signal.
24589 */
24590void
24591button_emit_button_pressed_long (
24592 Button *object)
24593{
24594 g_signal_emit_by_name (object, "button-pressed-long");
24595}
24596
24597/**
24598 * button_call_is_on:
24599 * @proxy: A #ButtonProxy.
24600 * @cancellable: (allow-none): A #GCancellable or %NULL.
24601 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
24602 * @user_data: User data to pass to @callback.
24603 *
24604 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method on @proxy.
24605 * 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.
24606 * You can then call button_call_is_on_finish() to get the result of the operation.
24607 *
24608 * See button_call_is_on_sync() for the synchronous, blocking version of this method.
24609 */
24610void
24611button_call_is_on (
24612 Button *proxy,
24613 GCancellable *cancellable,
24614 GAsyncReadyCallback callback,
24615 gpointer user_data)
24616{
24617 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
24618 "isOn",
24619 g_variant_new ("()"),
24620 G_DBUS_CALL_FLAGS_NONE,
24621 -1,
24622 cancellable,
24623 callback,
24624 user_data);
24625}
24626
24627/**
24628 * button_call_is_on_finish:
24629 * @proxy: A #ButtonProxy.
24630 * @out_state: (out): Return location for return parameter or %NULL to ignore.
24631 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_is_on().
24632 * @error: Return location for error or %NULL.
24633 *
24634 * Finishes an operation started with button_call_is_on().
24635 *
24636 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24637 */
24638gboolean
24639button_call_is_on_finish (
24640 Button *proxy,
24641 gboolean *out_state,
24642 GAsyncResult *res,
24643 GError **error)
24644{
24645 GVariant *_ret;
24646 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
24647 if (_ret == NULL)
24648 goto _out;
24649 g_variant_get (_ret,
24650 "(b)",
24651 out_state);
24652 g_variant_unref (_ret);
24653_out:
24654 return _ret != NULL;
24655}
24656
24657/**
24658 * button_call_is_on_sync:
24659 * @proxy: A #ButtonProxy.
24660 * @out_state: (out): Return location for return parameter or %NULL to ignore.
24661 * @cancellable: (allow-none): A #GCancellable or %NULL.
24662 * @error: Return location for error or %NULL.
24663 *
24664 * 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.
24665 *
24666 * See button_call_is_on() for the asynchronous version of this method.
24667 *
24668 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24669 */
24670gboolean
24671button_call_is_on_sync (
24672 Button *proxy,
24673 gboolean *out_state,
24674 GCancellable *cancellable,
24675 GError **error)
24676{
24677 GVariant *_ret;
24678 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
24679 "isOn",
24680 g_variant_new ("()"),
24681 G_DBUS_CALL_FLAGS_NONE,
24682 -1,
24683 cancellable,
24684 error);
24685 if (_ret == NULL)
24686 goto _out;
24687 g_variant_get (_ret,
24688 "(b)",
24689 out_state);
24690 g_variant_unref (_ret);
24691_out:
24692 return _ret != NULL;
24693}
24694
24695/**
24696 * button_call_sim_button_press:
24697 * @proxy: A #ButtonProxy.
24698 * @cancellable: (allow-none): A #GCancellable or %NULL.
24699 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
24700 * @user_data: User data to pass to @callback.
24701 *
24702 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method on @proxy.
24703 * 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.
24704 * You can then call button_call_sim_button_press_finish() to get the result of the operation.
24705 *
24706 * See button_call_sim_button_press_sync() for the synchronous, blocking version of this method.
24707 */
24708void
24709button_call_sim_button_press (
24710 Button *proxy,
24711 GCancellable *cancellable,
24712 GAsyncReadyCallback callback,
24713 gpointer user_data)
24714{
24715 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
24716 "simButtonPress",
24717 g_variant_new ("()"),
24718 G_DBUS_CALL_FLAGS_NONE,
24719 -1,
24720 cancellable,
24721 callback,
24722 user_data);
24723}
24724
24725/**
24726 * button_call_sim_button_press_finish:
24727 * @proxy: A #ButtonProxy.
24728 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_button_press().
24729 * @error: Return location for error or %NULL.
24730 *
24731 * Finishes an operation started with button_call_sim_button_press().
24732 *
24733 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24734 */
24735gboolean
24736button_call_sim_button_press_finish (
24737 Button *proxy,
24738 GAsyncResult *res,
24739 GError **error)
24740{
24741 GVariant *_ret;
24742 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
24743 if (_ret == NULL)
24744 goto _out;
24745 g_variant_get (_ret,
24746 "()");
24747 g_variant_unref (_ret);
24748_out:
24749 return _ret != NULL;
24750}
24751
24752/**
24753 * button_call_sim_button_press_sync:
24754 * @proxy: A #ButtonProxy.
24755 * @cancellable: (allow-none): A #GCancellable or %NULL.
24756 * @error: Return location for error or %NULL.
24757 *
24758 * 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.
24759 *
24760 * See button_call_sim_button_press() for the asynchronous version of this method.
24761 *
24762 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24763 */
24764gboolean
24765button_call_sim_button_press_sync (
24766 Button *proxy,
24767 GCancellable *cancellable,
24768 GError **error)
24769{
24770 GVariant *_ret;
24771 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
24772 "simButtonPress",
24773 g_variant_new ("()"),
24774 G_DBUS_CALL_FLAGS_NONE,
24775 -1,
24776 cancellable,
24777 error);
24778 if (_ret == NULL)
24779 goto _out;
24780 g_variant_get (_ret,
24781 "()");
24782 g_variant_unref (_ret);
24783_out:
24784 return _ret != NULL;
24785}
24786
24787/**
24788 * button_call_sim_button_long_press:
24789 * @proxy: A #ButtonProxy.
24790 * @cancellable: (allow-none): A #GCancellable or %NULL.
24791 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
24792 * @user_data: User data to pass to @callback.
24793 *
24794 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method on @proxy.
24795 * 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.
24796 * You can then call button_call_sim_button_long_press_finish() to get the result of the operation.
24797 *
24798 * See button_call_sim_button_long_press_sync() for the synchronous, blocking version of this method.
24799 */
24800void
24801button_call_sim_button_long_press (
24802 Button *proxy,
24803 GCancellable *cancellable,
24804 GAsyncReadyCallback callback,
24805 gpointer user_data)
24806{
24807 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
24808 "simButtonLongPress",
24809 g_variant_new ("()"),
24810 G_DBUS_CALL_FLAGS_NONE,
24811 -1,
24812 cancellable,
24813 callback,
24814 user_data);
24815}
24816
24817/**
24818 * button_call_sim_button_long_press_finish:
24819 * @proxy: A #ButtonProxy.
24820 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_button_long_press().
24821 * @error: Return location for error or %NULL.
24822 *
24823 * Finishes an operation started with button_call_sim_button_long_press().
24824 *
24825 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24826 */
24827gboolean
24828button_call_sim_button_long_press_finish (
24829 Button *proxy,
24830 GAsyncResult *res,
24831 GError **error)
24832{
24833 GVariant *_ret;
24834 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
24835 if (_ret == NULL)
24836 goto _out;
24837 g_variant_get (_ret,
24838 "()");
24839 g_variant_unref (_ret);
24840_out:
24841 return _ret != NULL;
24842}
24843
24844/**
24845 * button_call_sim_button_long_press_sync:
24846 * @proxy: A #ButtonProxy.
24847 * @cancellable: (allow-none): A #GCancellable or %NULL.
24848 * @error: Return location for error or %NULL.
24849 *
24850 * 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.
24851 *
24852 * See button_call_sim_button_long_press() for the asynchronous version of this method.
24853 *
24854 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24855 */
24856gboolean
24857button_call_sim_button_long_press_sync (
24858 Button *proxy,
24859 GCancellable *cancellable,
24860 GError **error)
24861{
24862 GVariant *_ret;
24863 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
24864 "simButtonLongPress",
24865 g_variant_new ("()"),
24866 G_DBUS_CALL_FLAGS_NONE,
24867 -1,
24868 cancellable,
24869 error);
24870 if (_ret == NULL)
24871 goto _out;
24872 g_variant_get (_ret,
24873 "()");
24874 g_variant_unref (_ret);
24875_out:
24876 return _ret != NULL;
24877}
24878
24879/**
24880 * button_complete_is_on:
24881 * @object: A #Button.
24882 * @invocation: (transfer full): A #GDBusMethodInvocation.
24883 * @state: Parameter to return.
24884 *
24885 * 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.
24886 *
24887 * This method will free @invocation, you cannot use it afterwards.
24888 */
24889void
24890button_complete_is_on (
24891 Button *object,
24892 GDBusMethodInvocation *invocation,
24893 gboolean state)
24894{
24895 g_dbus_method_invocation_return_value (invocation,
24896 g_variant_new ("(b)",
24897 state));
24898}
24899
24900/**
24901 * button_complete_sim_button_press:
24902 * @object: A #Button.
24903 * @invocation: (transfer full): A #GDBusMethodInvocation.
24904 *
24905 * 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.
24906 *
24907 * This method will free @invocation, you cannot use it afterwards.
24908 */
24909void
24910button_complete_sim_button_press (
24911 Button *object,
24912 GDBusMethodInvocation *invocation)
24913{
24914 g_dbus_method_invocation_return_value (invocation,
24915 g_variant_new ("()"));
24916}
24917
24918/**
24919 * button_complete_sim_button_long_press:
24920 * @object: A #Button.
24921 * @invocation: (transfer full): A #GDBusMethodInvocation.
24922 *
24923 * 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.
24924 *
24925 * This method will free @invocation, you cannot use it afterwards.
24926 */
24927void
24928button_complete_sim_button_long_press (
24929 Button *object,
24930 GDBusMethodInvocation *invocation)
24931{
24932 g_dbus_method_invocation_return_value (invocation,
24933 g_variant_new ("()"));
24934}
24935
24936/* ------------------------------------------------------------------------ */
24937
24938/**
24939 * ButtonProxy:
24940 *
24941 * The #ButtonProxy structure contains only private data and should only be accessed using the provided API.
24942 */
24943
24944/**
24945 * ButtonProxyClass:
24946 * @parent_class: The parent class.
24947 *
24948 * Class structure for #ButtonProxy.
24949 */
24950
24951struct _ButtonProxyPrivate
24952{
24953 GData *qdata;
24954};
24955
24956static void button_proxy_iface_init (ButtonIface *iface);
24957
24958#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
24959G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
24960 G_ADD_PRIVATE (ButtonProxy)
24961 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
24962
24963#else
24964G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
24965 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
24966
24967#endif
24968static void
24969button_proxy_finalize (GObject *object)
24970{
24971 ButtonProxy *proxy = BUTTON_PROXY (object);
24972 g_datalist_clear (&proxy->priv->qdata);
24973 G_OBJECT_CLASS (button_proxy_parent_class)->finalize (object);
24974}
24975
24976static void
24977button_proxy_get_property (GObject *object,
24978 guint prop_id,
24979 GValue *value,
24980 GParamSpec *pspec G_GNUC_UNUSED)
24981{
24982 const _ExtendedGDBusPropertyInfo *info;
24983 GVariant *variant;
24984 g_assert (prop_id != 0 && prop_id - 1 < 1);
24985 info = _button_property_info_pointers[prop_id - 1];
24986 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
24987 if (info->use_gvariant)
24988 {
24989 g_value_set_variant (value, variant);
24990 }
24991 else
24992 {
24993 if (variant != NULL)
24994 g_dbus_gvariant_to_gvalue (variant, value);
24995 }
24996 if (variant != NULL)
24997 g_variant_unref (variant);
24998}
24999
25000static void
25001button_proxy_set_property_cb (GDBusProxy *proxy,
25002 GAsyncResult *res,
25003 gpointer user_data)
25004{
25005 const _ExtendedGDBusPropertyInfo *info = user_data;
25006 GError *error;
25007 GVariant *_ret;
25008 error = NULL;
25009 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
25010 if (!_ret)
25011 {
25012 g_warning ("Error setting property '%s' on interface org.openbmc.Button: %s (%s, %d)",
25013 info->parent_struct.name,
25014 error->message, g_quark_to_string (error->domain), error->code);
25015 g_error_free (error);
25016 }
25017 else
25018 {
25019 g_variant_unref (_ret);
25020 }
25021}
25022
25023static void
25024button_proxy_set_property (GObject *object,
25025 guint prop_id,
25026 const GValue *value,
25027 GParamSpec *pspec G_GNUC_UNUSED)
25028{
25029 const _ExtendedGDBusPropertyInfo *info;
25030 GVariant *variant;
25031 g_assert (prop_id != 0 && prop_id - 1 < 1);
25032 info = _button_property_info_pointers[prop_id - 1];
25033 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
25034 g_dbus_proxy_call (G_DBUS_PROXY (object),
25035 "org.freedesktop.DBus.Properties.Set",
25036 g_variant_new ("(ssv)", "org.openbmc.Button", info->parent_struct.name, variant),
25037 G_DBUS_CALL_FLAGS_NONE,
25038 -1,
25039 NULL, (GAsyncReadyCallback) button_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
25040 g_variant_unref (variant);
25041}
25042
25043static void
25044button_proxy_g_signal (GDBusProxy *proxy,
25045 const gchar *sender_name G_GNUC_UNUSED,
25046 const gchar *signal_name,
25047 GVariant *parameters)
25048{
25049 _ExtendedGDBusSignalInfo *info;
25050 GVariantIter iter;
25051 GVariant *child;
25052 GValue *paramv;
25053 guint num_params;
25054 guint n;
25055 guint signal_id;
25056 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, signal_name);
25057 if (info == NULL)
25058 return;
25059 num_params = g_variant_n_children (parameters);
25060 paramv = g_new0 (GValue, num_params + 1);
25061 g_value_init (&paramv[0], TYPE_BUTTON);
25062 g_value_set_object (&paramv[0], proxy);
25063 g_variant_iter_init (&iter, parameters);
25064 n = 1;
25065 while ((child = g_variant_iter_next_value (&iter)) != NULL)
25066 {
25067 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
25068 if (arg_info->use_gvariant)
25069 {
25070 g_value_init (&paramv[n], G_TYPE_VARIANT);
25071 g_value_set_variant (&paramv[n], child);
25072 n++;
25073 }
25074 else
25075 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
25076 g_variant_unref (child);
25077 }
25078 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
25079 g_signal_emitv (paramv, signal_id, 0, NULL);
25080 for (n = 0; n < num_params + 1; n++)
25081 g_value_unset (&paramv[n]);
25082 g_free (paramv);
25083}
25084
25085static void
25086button_proxy_g_properties_changed (GDBusProxy *_proxy,
25087 GVariant *changed_properties,
25088 const gchar *const *invalidated_properties)
25089{
25090 ButtonProxy *proxy = BUTTON_PROXY (_proxy);
25091 guint n;
25092 const gchar *key;
25093 GVariantIter *iter;
25094 _ExtendedGDBusPropertyInfo *info;
25095 g_variant_get (changed_properties, "a{sv}", &iter);
25096 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
25097 {
25098 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, key);
25099 g_datalist_remove_data (&proxy->priv->qdata, key);
25100 if (info != NULL)
25101 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
25102 }
25103 g_variant_iter_free (iter);
25104 for (n = 0; invalidated_properties[n] != NULL; n++)
25105 {
25106 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, invalidated_properties[n]);
25107 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
25108 if (info != NULL)
25109 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
25110 }
25111}
25112
25113static gboolean
25114button_proxy_get_state (Button *object)
25115{
25116 ButtonProxy *proxy = BUTTON_PROXY (object);
25117 GVariant *variant;
25118 gboolean value = 0;
25119 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
25120 if (variant != NULL)
25121 {
25122 value = g_variant_get_boolean (variant);
25123 g_variant_unref (variant);
25124 }
25125 return value;
25126}
25127
25128static void
25129button_proxy_init (ButtonProxy *proxy)
25130{
25131#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
25132 proxy->priv = button_proxy_get_instance_private (proxy);
25133#else
25134 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_BUTTON_PROXY, ButtonProxyPrivate);
25135#endif
25136
25137 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), button_interface_info ());
25138}
25139
25140static void
25141button_proxy_class_init (ButtonProxyClass *klass)
25142{
25143 GObjectClass *gobject_class;
25144 GDBusProxyClass *proxy_class;
25145
25146 gobject_class = G_OBJECT_CLASS (klass);
25147 gobject_class->finalize = button_proxy_finalize;
25148 gobject_class->get_property = button_proxy_get_property;
25149 gobject_class->set_property = button_proxy_set_property;
25150
25151 proxy_class = G_DBUS_PROXY_CLASS (klass);
25152 proxy_class->g_signal = button_proxy_g_signal;
25153 proxy_class->g_properties_changed = button_proxy_g_properties_changed;
25154
25155 button_override_properties (gobject_class, 1);
25156
25157#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
25158 g_type_class_add_private (klass, sizeof (ButtonProxyPrivate));
25159#endif
25160}
25161
25162static void
25163button_proxy_iface_init (ButtonIface *iface)
25164{
25165 iface->get_state = button_proxy_get_state;
25166}
25167
25168/**
25169 * button_proxy_new:
25170 * @connection: A #GDBusConnection.
25171 * @flags: Flags from the #GDBusProxyFlags enumeration.
25172 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
25173 * @object_path: An object path.
25174 * @cancellable: (allow-none): A #GCancellable or %NULL.
25175 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
25176 * @user_data: User data to pass to @callback.
25177 *
25178 * 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.
25179 *
25180 * 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.
25181 * You can then call button_proxy_new_finish() to get the result of the operation.
25182 *
25183 * See button_proxy_new_sync() for the synchronous, blocking version of this constructor.
25184 */
25185void
25186button_proxy_new (
25187 GDBusConnection *connection,
25188 GDBusProxyFlags flags,
25189 const gchar *name,
25190 const gchar *object_path,
25191 GCancellable *cancellable,
25192 GAsyncReadyCallback callback,
25193 gpointer user_data)
25194{
25195 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);
25196}
25197
25198/**
25199 * button_proxy_new_finish:
25200 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new().
25201 * @error: Return location for error or %NULL
25202 *
25203 * Finishes an operation started with button_proxy_new().
25204 *
25205 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
25206 */
25207Button *
25208button_proxy_new_finish (
25209 GAsyncResult *res,
25210 GError **error)
25211{
25212 GObject *ret;
25213 GObject *source_object;
25214 source_object = g_async_result_get_source_object (res);
25215 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
25216 g_object_unref (source_object);
25217 if (ret != NULL)
25218 return BUTTON (ret);
25219 else
25220 return NULL;
25221}
25222
25223/**
25224 * button_proxy_new_sync:
25225 * @connection: A #GDBusConnection.
25226 * @flags: Flags from the #GDBusProxyFlags enumeration.
25227 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
25228 * @object_path: An object path.
25229 * @cancellable: (allow-none): A #GCancellable or %NULL.
25230 * @error: Return location for error or %NULL
25231 *
25232 * 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.
25233 *
25234 * The calling thread is blocked until a reply is received.
25235 *
25236 * See button_proxy_new() for the asynchronous version of this constructor.
25237 *
25238 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
25239 */
25240Button *
25241button_proxy_new_sync (
25242 GDBusConnection *connection,
25243 GDBusProxyFlags flags,
25244 const gchar *name,
25245 const gchar *object_path,
25246 GCancellable *cancellable,
25247 GError **error)
25248{
25249 GInitable *ret;
25250 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);
25251 if (ret != NULL)
25252 return BUTTON (ret);
25253 else
25254 return NULL;
25255}
25256
25257
25258/**
25259 * button_proxy_new_for_bus:
25260 * @bus_type: A #GBusType.
25261 * @flags: Flags from the #GDBusProxyFlags enumeration.
25262 * @name: A bus name (well-known or unique).
25263 * @object_path: An object path.
25264 * @cancellable: (allow-none): A #GCancellable or %NULL.
25265 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
25266 * @user_data: User data to pass to @callback.
25267 *
25268 * Like button_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
25269 *
25270 * 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.
25271 * You can then call button_proxy_new_for_bus_finish() to get the result of the operation.
25272 *
25273 * See button_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
25274 */
25275void
25276button_proxy_new_for_bus (
25277 GBusType bus_type,
25278 GDBusProxyFlags flags,
25279 const gchar *name,
25280 const gchar *object_path,
25281 GCancellable *cancellable,
25282 GAsyncReadyCallback callback,
25283 gpointer user_data)
25284{
25285 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);
25286}
25287
25288/**
25289 * button_proxy_new_for_bus_finish:
25290 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new_for_bus().
25291 * @error: Return location for error or %NULL
25292 *
25293 * Finishes an operation started with button_proxy_new_for_bus().
25294 *
25295 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
25296 */
25297Button *
25298button_proxy_new_for_bus_finish (
25299 GAsyncResult *res,
25300 GError **error)
25301{
25302 GObject *ret;
25303 GObject *source_object;
25304 source_object = g_async_result_get_source_object (res);
25305 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
25306 g_object_unref (source_object);
25307 if (ret != NULL)
25308 return BUTTON (ret);
25309 else
25310 return NULL;
25311}
25312
25313/**
25314 * button_proxy_new_for_bus_sync:
25315 * @bus_type: A #GBusType.
25316 * @flags: Flags from the #GDBusProxyFlags enumeration.
25317 * @name: A bus name (well-known or unique).
25318 * @object_path: An object path.
25319 * @cancellable: (allow-none): A #GCancellable or %NULL.
25320 * @error: Return location for error or %NULL
25321 *
25322 * Like button_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
25323 *
25324 * The calling thread is blocked until a reply is received.
25325 *
25326 * See button_proxy_new_for_bus() for the asynchronous version of this constructor.
25327 *
25328 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
25329 */
25330Button *
25331button_proxy_new_for_bus_sync (
25332 GBusType bus_type,
25333 GDBusProxyFlags flags,
25334 const gchar *name,
25335 const gchar *object_path,
25336 GCancellable *cancellable,
25337 GError **error)
25338{
25339 GInitable *ret;
25340 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);
25341 if (ret != NULL)
25342 return BUTTON (ret);
25343 else
25344 return NULL;
25345}
25346
25347
25348/* ------------------------------------------------------------------------ */
25349
25350/**
25351 * ButtonSkeleton:
25352 *
25353 * The #ButtonSkeleton structure contains only private data and should only be accessed using the provided API.
25354 */
25355
25356/**
25357 * ButtonSkeletonClass:
25358 * @parent_class: The parent class.
25359 *
25360 * Class structure for #ButtonSkeleton.
25361 */
25362
25363struct _ButtonSkeletonPrivate
25364{
25365 GValue *properties;
25366 GList *changed_properties;
25367 GSource *changed_properties_idle_source;
25368 GMainContext *context;
25369 GMutex lock;
25370};
25371
25372static void
25373_button_skeleton_handle_method_call (
25374 GDBusConnection *connection G_GNUC_UNUSED,
25375 const gchar *sender G_GNUC_UNUSED,
25376 const gchar *object_path G_GNUC_UNUSED,
25377 const gchar *interface_name,
25378 const gchar *method_name,
25379 GVariant *parameters,
25380 GDBusMethodInvocation *invocation,
25381 gpointer user_data)
25382{
25383 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
25384 _ExtendedGDBusMethodInfo *info;
25385 GVariantIter iter;
25386 GVariant *child;
25387 GValue *paramv;
25388 guint num_params;
25389 guint num_extra;
25390 guint n;
25391 guint signal_id;
25392 GValue return_value = G_VALUE_INIT;
25393 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
25394 g_assert (info != NULL);
25395 num_params = g_variant_n_children (parameters);
25396 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
25397 n = 0;
25398 g_value_init (&paramv[n], TYPE_BUTTON);
25399 g_value_set_object (&paramv[n++], skeleton);
25400 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
25401 g_value_set_object (&paramv[n++], invocation);
25402 if (info->pass_fdlist)
25403 {
25404#ifdef G_OS_UNIX
25405 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
25406 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
25407#else
25408 g_assert_not_reached ();
25409#endif
25410 }
25411 g_variant_iter_init (&iter, parameters);
25412 while ((child = g_variant_iter_next_value (&iter)) != NULL)
25413 {
25414 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
25415 if (arg_info->use_gvariant)
25416 {
25417 g_value_init (&paramv[n], G_TYPE_VARIANT);
25418 g_value_set_variant (&paramv[n], child);
25419 n++;
25420 }
25421 else
25422 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
25423 g_variant_unref (child);
25424 }
25425 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
25426 g_value_init (&return_value, G_TYPE_BOOLEAN);
25427 g_signal_emitv (paramv, signal_id, 0, &return_value);
25428 if (!g_value_get_boolean (&return_value))
25429 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);
25430 g_value_unset (&return_value);
25431 for (n = 0; n < num_params + num_extra; n++)
25432 g_value_unset (&paramv[n]);
25433 g_free (paramv);
25434}
25435
25436static GVariant *
25437_button_skeleton_handle_get_property (
25438 GDBusConnection *connection G_GNUC_UNUSED,
25439 const gchar *sender G_GNUC_UNUSED,
25440 const gchar *object_path G_GNUC_UNUSED,
25441 const gchar *interface_name G_GNUC_UNUSED,
25442 const gchar *property_name,
25443 GError **error,
25444 gpointer user_data)
25445{
25446 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
25447 GValue value = G_VALUE_INIT;
25448 GParamSpec *pspec;
25449 _ExtendedGDBusPropertyInfo *info;
25450 GVariant *ret;
25451 ret = NULL;
25452 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
25453 g_assert (info != NULL);
25454 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
25455 if (pspec == NULL)
25456 {
25457 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
25458 }
25459 else
25460 {
25461 g_value_init (&value, pspec->value_type);
25462 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
25463 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
25464 g_value_unset (&value);
25465 }
25466 return ret;
25467}
25468
25469static gboolean
25470_button_skeleton_handle_set_property (
25471 GDBusConnection *connection G_GNUC_UNUSED,
25472 const gchar *sender G_GNUC_UNUSED,
25473 const gchar *object_path G_GNUC_UNUSED,
25474 const gchar *interface_name G_GNUC_UNUSED,
25475 const gchar *property_name,
25476 GVariant *variant,
25477 GError **error,
25478 gpointer user_data)
25479{
25480 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
25481 GValue value = G_VALUE_INIT;
25482 GParamSpec *pspec;
25483 _ExtendedGDBusPropertyInfo *info;
25484 gboolean ret;
25485 ret = FALSE;
25486 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
25487 g_assert (info != NULL);
25488 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
25489 if (pspec == NULL)
25490 {
25491 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
25492 }
25493 else
25494 {
25495 if (info->use_gvariant)
25496 g_value_set_variant (&value, variant);
25497 else
25498 g_dbus_gvariant_to_gvalue (variant, &value);
25499 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
25500 g_value_unset (&value);
25501 ret = TRUE;
25502 }
25503 return ret;
25504}
25505
25506static const GDBusInterfaceVTable _button_skeleton_vtable =
25507{
25508 _button_skeleton_handle_method_call,
25509 _button_skeleton_handle_get_property,
25510 _button_skeleton_handle_set_property,
25511 {NULL}
25512};
25513
25514static GDBusInterfaceInfo *
25515button_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
25516{
25517 return button_interface_info ();
25518}
25519
25520static GDBusInterfaceVTable *
25521button_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
25522{
25523 return (GDBusInterfaceVTable *) &_button_skeleton_vtable;
25524}
25525
25526static GVariant *
25527button_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
25528{
25529 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
25530
25531 GVariantBuilder builder;
25532 guint n;
25533 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
25534 if (_button_interface_info.parent_struct.properties == NULL)
25535 goto out;
25536 for (n = 0; _button_interface_info.parent_struct.properties[n] != NULL; n++)
25537 {
25538 GDBusPropertyInfo *info = _button_interface_info.parent_struct.properties[n];
25539 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
25540 {
25541 GVariant *value;
25542 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);
25543 if (value != NULL)
25544 {
25545 g_variant_take_ref (value);
25546 g_variant_builder_add (&builder, "{sv}", info->name, value);
25547 g_variant_unref (value);
25548 }
25549 }
25550 }
25551out:
25552 return g_variant_builder_end (&builder);
25553}
25554
25555static gboolean _button_emit_changed (gpointer user_data);
25556
25557static void
25558button_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
25559{
25560 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
25561 gboolean emit_changed = FALSE;
25562
25563 g_mutex_lock (&skeleton->priv->lock);
25564 if (skeleton->priv->changed_properties_idle_source != NULL)
25565 {
25566 g_source_destroy (skeleton->priv->changed_properties_idle_source);
25567 skeleton->priv->changed_properties_idle_source = NULL;
25568 emit_changed = TRUE;
25569 }
25570 g_mutex_unlock (&skeleton->priv->lock);
25571
25572 if (emit_changed)
25573 _button_emit_changed (skeleton);
25574}
25575
25576static void
25577_button_on_signal_button_release (
25578 Button *object)
25579{
25580 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
25581
25582 GList *connections, *l;
25583 GVariant *signal_variant;
25584 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25585
25586 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
25587 for (l = connections; l != NULL; l = l->next)
25588 {
25589 GDBusConnection *connection = l->data;
25590 g_dbus_connection_emit_signal (connection,
25591 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonRelease",
25592 signal_variant, NULL);
25593 }
25594 g_variant_unref (signal_variant);
25595 g_list_free_full (connections, g_object_unref);
25596}
25597
25598static void
25599_button_on_signal_button_pressed (
25600 Button *object)
25601{
25602 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
25603
25604 GList *connections, *l;
25605 GVariant *signal_variant;
25606 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25607
25608 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
25609 for (l = connections; l != NULL; l = l->next)
25610 {
25611 GDBusConnection *connection = l->data;
25612 g_dbus_connection_emit_signal (connection,
25613 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonPressed",
25614 signal_variant, NULL);
25615 }
25616 g_variant_unref (signal_variant);
25617 g_list_free_full (connections, g_object_unref);
25618}
25619
25620static void
25621_button_on_signal_button_pressed_long (
25622 Button *object)
25623{
25624 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
25625
25626 GList *connections, *l;
25627 GVariant *signal_variant;
25628 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25629
25630 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
25631 for (l = connections; l != NULL; l = l->next)
25632 {
25633 GDBusConnection *connection = l->data;
25634 g_dbus_connection_emit_signal (connection,
25635 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonPressedLong",
25636 signal_variant, NULL);
25637 }
25638 g_variant_unref (signal_variant);
25639 g_list_free_full (connections, g_object_unref);
25640}
25641
25642static void button_skeleton_iface_init (ButtonIface *iface);
25643#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
25644G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
25645 G_ADD_PRIVATE (ButtonSkeleton)
25646 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
25647
25648#else
25649G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
25650 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
25651
25652#endif
25653static void
25654button_skeleton_finalize (GObject *object)
25655{
25656 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
25657 guint n;
25658 for (n = 0; n < 1; n++)
25659 g_value_unset (&skeleton->priv->properties[n]);
25660 g_free (skeleton->priv->properties);
25661 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
25662 if (skeleton->priv->changed_properties_idle_source != NULL)
25663 g_source_destroy (skeleton->priv->changed_properties_idle_source);
25664 g_main_context_unref (skeleton->priv->context);
25665 g_mutex_clear (&skeleton->priv->lock);
25666 G_OBJECT_CLASS (button_skeleton_parent_class)->finalize (object);
25667}
25668
25669static void
25670button_skeleton_get_property (GObject *object,
25671 guint prop_id,
25672 GValue *value,
25673 GParamSpec *pspec G_GNUC_UNUSED)
25674{
25675 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
25676 g_assert (prop_id != 0 && prop_id - 1 < 1);
25677 g_mutex_lock (&skeleton->priv->lock);
25678 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
25679 g_mutex_unlock (&skeleton->priv->lock);
25680}
25681
25682static gboolean
25683_button_emit_changed (gpointer user_data)
25684{
25685 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
25686 GList *l;
25687 GVariantBuilder builder;
25688 GVariantBuilder invalidated_builder;
25689 guint num_changes;
25690
25691 g_mutex_lock (&skeleton->priv->lock);
25692 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
25693 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
25694 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
25695 {
25696 ChangedProperty *cp = l->data;
25697 GVariant *variant;
25698 const GValue *cur_value;
25699
25700 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
25701 if (!_g_value_equal (cur_value, &cp->orig_value))
25702 {
25703 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
25704 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
25705 g_variant_unref (variant);
25706 num_changes++;
25707 }
25708 }
25709 if (num_changes > 0)
25710 {
25711 GList *connections, *ll;
25712 GVariant *signal_variant;
25713 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Button",
25714 &builder, &invalidated_builder));
25715 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25716 for (ll = connections; ll != NULL; ll = ll->next)
25717 {
25718 GDBusConnection *connection = ll->data;
25719
25720 g_dbus_connection_emit_signal (connection,
25721 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
25722 "org.freedesktop.DBus.Properties",
25723 "PropertiesChanged",
25724 signal_variant,
25725 NULL);
25726 }
25727 g_variant_unref (signal_variant);
25728 g_list_free_full (connections, g_object_unref);
25729 }
25730 else
25731 {
25732 g_variant_builder_clear (&builder);
25733 g_variant_builder_clear (&invalidated_builder);
25734 }
25735 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
25736 skeleton->priv->changed_properties = NULL;
25737 skeleton->priv->changed_properties_idle_source = NULL;
25738 g_mutex_unlock (&skeleton->priv->lock);
25739 return FALSE;
25740}
25741
25742static void
25743_button_schedule_emit_changed (ButtonSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
25744{
25745 ChangedProperty *cp;
25746 GList *l;
25747 cp = NULL;
25748 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
25749 {
25750 ChangedProperty *i_cp = l->data;
25751 if (i_cp->info == info)
25752 {
25753 cp = i_cp;
25754 break;
25755 }
25756 }
25757 if (cp == NULL)
25758 {
25759 cp = g_new0 (ChangedProperty, 1);
25760 cp->prop_id = prop_id;
25761 cp->info = info;
25762 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
25763 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
25764 g_value_copy (orig_value, &cp->orig_value);
25765 }
25766}
25767
25768static void
25769button_skeleton_notify (GObject *object,
25770 GParamSpec *pspec G_GNUC_UNUSED)
25771{
25772 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
25773 g_mutex_lock (&skeleton->priv->lock);
25774 if (skeleton->priv->changed_properties != NULL &&
25775 skeleton->priv->changed_properties_idle_source == NULL)
25776 {
25777 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
25778 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
25779 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _button_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylak2cb27752015-10-19 16:23:14 -050025780 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _button_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -050025781 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
25782 g_source_unref (skeleton->priv->changed_properties_idle_source);
25783 }
25784 g_mutex_unlock (&skeleton->priv->lock);
25785}
25786
25787static void
25788button_skeleton_set_property (GObject *object,
25789 guint prop_id,
25790 const GValue *value,
25791 GParamSpec *pspec)
25792{
25793 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
25794 g_assert (prop_id != 0 && prop_id - 1 < 1);
25795 g_mutex_lock (&skeleton->priv->lock);
25796 g_object_freeze_notify (object);
25797 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
25798 {
25799 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
25800 _button_schedule_emit_changed (skeleton, _button_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
25801 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
25802 g_object_notify_by_pspec (object, pspec);
25803 }
25804 g_mutex_unlock (&skeleton->priv->lock);
25805 g_object_thaw_notify (object);
25806}
25807
25808static void
25809button_skeleton_init (ButtonSkeleton *skeleton)
25810{
25811#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
25812 skeleton->priv = button_skeleton_get_instance_private (skeleton);
25813#else
25814 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_BUTTON_SKELETON, ButtonSkeletonPrivate);
25815#endif
25816
25817 g_mutex_init (&skeleton->priv->lock);
25818 skeleton->priv->context = g_main_context_ref_thread_default ();
25819 skeleton->priv->properties = g_new0 (GValue, 1);
25820 g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN);
25821}
25822
25823static gboolean
25824button_skeleton_get_state (Button *object)
25825{
25826 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
25827 gboolean value;
25828 g_mutex_lock (&skeleton->priv->lock);
25829 value = g_value_get_boolean (&(skeleton->priv->properties[0]));
25830 g_mutex_unlock (&skeleton->priv->lock);
25831 return value;
25832}
25833
25834static void
25835button_skeleton_class_init (ButtonSkeletonClass *klass)
25836{
25837 GObjectClass *gobject_class;
25838 GDBusInterfaceSkeletonClass *skeleton_class;
25839
25840 gobject_class = G_OBJECT_CLASS (klass);
25841 gobject_class->finalize = button_skeleton_finalize;
25842 gobject_class->get_property = button_skeleton_get_property;
25843 gobject_class->set_property = button_skeleton_set_property;
25844 gobject_class->notify = button_skeleton_notify;
25845
25846
25847 button_override_properties (gobject_class, 1);
25848
25849 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
25850 skeleton_class->get_info = button_skeleton_dbus_interface_get_info;
25851 skeleton_class->get_properties = button_skeleton_dbus_interface_get_properties;
25852 skeleton_class->flush = button_skeleton_dbus_interface_flush;
25853 skeleton_class->get_vtable = button_skeleton_dbus_interface_get_vtable;
25854
25855#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
25856 g_type_class_add_private (klass, sizeof (ButtonSkeletonPrivate));
25857#endif
25858}
25859
25860static void
25861button_skeleton_iface_init (ButtonIface *iface)
25862{
25863 iface->button_release = _button_on_signal_button_release;
25864 iface->button_pressed = _button_on_signal_button_pressed;
25865 iface->button_pressed_long = _button_on_signal_button_pressed_long;
25866 iface->get_state = button_skeleton_get_state;
25867}
25868
25869/**
25870 * button_skeleton_new:
25871 *
25872 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
25873 *
25874 * Returns: (transfer full) (type ButtonSkeleton): The skeleton object.
25875 */
25876Button *
25877button_skeleton_new (void)
25878{
25879 return BUTTON (g_object_new (TYPE_BUTTON_SKELETON, NULL));
25880}
25881
25882/* ------------------------------------------------------------------------
25883 * Code for interface org.openbmc.Led
25884 * ------------------------------------------------------------------------
25885 */
25886
25887/**
25888 * SECTION:Led
25889 * @title: Led
25890 * @short_description: Generated C code for the org.openbmc.Led D-Bus interface
25891 *
25892 * 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.
25893 */
25894
25895/* ---- Introspection data for org.openbmc.Led ---- */
25896
25897static const _ExtendedGDBusMethodInfo _led_method_info_set_on =
25898{
25899 {
25900 -1,
25901 (gchar *) "setOn",
25902 NULL,
25903 NULL,
25904 NULL
25905 },
25906 "handle-set-on",
25907 FALSE
25908};
25909
25910static const _ExtendedGDBusMethodInfo _led_method_info_set_off =
25911{
25912 {
25913 -1,
25914 (gchar *) "setOff",
25915 NULL,
25916 NULL,
25917 NULL
25918 },
25919 "handle-set-off",
25920 FALSE
25921};
25922
25923static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_slow =
25924{
25925 {
25926 -1,
25927 (gchar *) "setBlinkSlow",
25928 NULL,
25929 NULL,
25930 NULL
25931 },
25932 "handle-set-blink-slow",
25933 FALSE
25934};
25935
25936static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_fast =
25937{
25938 {
25939 -1,
25940 (gchar *) "setBlinkFast",
25941 NULL,
25942 NULL,
25943 NULL
25944 },
25945 "handle-set-blink-fast",
25946 FALSE
25947};
25948
25949static const _ExtendedGDBusMethodInfo * const _led_method_info_pointers[] =
25950{
25951 &_led_method_info_set_on,
25952 &_led_method_info_set_off,
25953 &_led_method_info_set_blink_slow,
25954 &_led_method_info_set_blink_fast,
25955 NULL
25956};
25957
25958static const _ExtendedGDBusPropertyInfo _led_property_info_color =
25959{
25960 {
25961 -1,
25962 (gchar *) "color",
25963 (gchar *) "i",
25964 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
25965 NULL
25966 },
25967 "color",
25968 FALSE
25969};
25970
25971static const _ExtendedGDBusPropertyInfo _led_property_info_function =
25972{
25973 {
25974 -1,
25975 (gchar *) "function",
25976 (gchar *) "s",
25977 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
25978 NULL
25979 },
25980 "function",
25981 FALSE
25982};
25983
25984static const _ExtendedGDBusPropertyInfo * const _led_property_info_pointers[] =
25985{
25986 &_led_property_info_color,
25987 &_led_property_info_function,
25988 NULL
25989};
25990
25991static const _ExtendedGDBusInterfaceInfo _led_interface_info =
25992{
25993 {
25994 -1,
25995 (gchar *) "org.openbmc.Led",
25996 (GDBusMethodInfo **) &_led_method_info_pointers,
25997 NULL,
25998 (GDBusPropertyInfo **) &_led_property_info_pointers,
25999 NULL
26000 },
26001 "led",
26002};
26003
26004
26005/**
26006 * led_interface_info:
26007 *
26008 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> D-Bus interface.
26009 *
26010 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
26011 */
26012GDBusInterfaceInfo *
26013led_interface_info (void)
26014{
26015 return (GDBusInterfaceInfo *) &_led_interface_info.parent_struct;
26016}
26017
26018/**
26019 * led_override_properties:
26020 * @klass: The class structure for a #GObject<!-- -->-derived class.
26021 * @property_id_begin: The property id to assign to the first overridden property.
26022 *
26023 * Overrides all #GObject properties in the #Led interface for a concrete class.
26024 * The properties are overridden in the order they are defined.
26025 *
26026 * Returns: The last property id.
26027 */
26028guint
26029led_override_properties (GObjectClass *klass, guint property_id_begin)
26030{
26031 g_object_class_override_property (klass, property_id_begin++, "color");
26032 g_object_class_override_property (klass, property_id_begin++, "function");
26033 return property_id_begin - 1;
26034}
26035
26036
26037
26038/**
26039 * Led:
26040 *
26041 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
26042 */
26043
26044/**
26045 * LedIface:
26046 * @parent_iface: The parent interface.
26047 * @handle_set_blink_fast: Handler for the #Led::handle-set-blink-fast signal.
26048 * @handle_set_blink_slow: Handler for the #Led::handle-set-blink-slow signal.
26049 * @handle_set_off: Handler for the #Led::handle-set-off signal.
26050 * @handle_set_on: Handler for the #Led::handle-set-on signal.
26051 * @get_color: Getter for the #Led:color property.
26052 * @get_function: Getter for the #Led:function property.
26053 *
26054 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
26055 */
26056
26057typedef LedIface LedInterface;
26058G_DEFINE_INTERFACE (Led, led, G_TYPE_OBJECT);
26059
26060static void
26061led_default_init (LedIface *iface)
26062{
26063 /* GObject signals for incoming D-Bus method calls: */
26064 /**
26065 * Led::handle-set-on:
26066 * @object: A #Led.
26067 * @invocation: A #GDBusMethodInvocation.
26068 *
26069 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method.
26070 *
26071 * 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.
26072 *
26073 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
26074 */
26075 g_signal_new ("handle-set-on",
26076 G_TYPE_FROM_INTERFACE (iface),
26077 G_SIGNAL_RUN_LAST,
26078 G_STRUCT_OFFSET (LedIface, handle_set_on),
26079 g_signal_accumulator_true_handled,
26080 NULL,
26081 g_cclosure_marshal_generic,
26082 G_TYPE_BOOLEAN,
26083 1,
26084 G_TYPE_DBUS_METHOD_INVOCATION);
26085
26086 /**
26087 * Led::handle-set-off:
26088 * @object: A #Led.
26089 * @invocation: A #GDBusMethodInvocation.
26090 *
26091 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method.
26092 *
26093 * 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.
26094 *
26095 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
26096 */
26097 g_signal_new ("handle-set-off",
26098 G_TYPE_FROM_INTERFACE (iface),
26099 G_SIGNAL_RUN_LAST,
26100 G_STRUCT_OFFSET (LedIface, handle_set_off),
26101 g_signal_accumulator_true_handled,
26102 NULL,
26103 g_cclosure_marshal_generic,
26104 G_TYPE_BOOLEAN,
26105 1,
26106 G_TYPE_DBUS_METHOD_INVOCATION);
26107
26108 /**
26109 * Led::handle-set-blink-slow:
26110 * @object: A #Led.
26111 * @invocation: A #GDBusMethodInvocation.
26112 *
26113 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method.
26114 *
26115 * 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.
26116 *
26117 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
26118 */
26119 g_signal_new ("handle-set-blink-slow",
26120 G_TYPE_FROM_INTERFACE (iface),
26121 G_SIGNAL_RUN_LAST,
26122 G_STRUCT_OFFSET (LedIface, handle_set_blink_slow),
26123 g_signal_accumulator_true_handled,
26124 NULL,
26125 g_cclosure_marshal_generic,
26126 G_TYPE_BOOLEAN,
26127 1,
26128 G_TYPE_DBUS_METHOD_INVOCATION);
26129
26130 /**
26131 * Led::handle-set-blink-fast:
26132 * @object: A #Led.
26133 * @invocation: A #GDBusMethodInvocation.
26134 *
26135 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method.
26136 *
26137 * 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.
26138 *
26139 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
26140 */
26141 g_signal_new ("handle-set-blink-fast",
26142 G_TYPE_FROM_INTERFACE (iface),
26143 G_SIGNAL_RUN_LAST,
26144 G_STRUCT_OFFSET (LedIface, handle_set_blink_fast),
26145 g_signal_accumulator_true_handled,
26146 NULL,
26147 g_cclosure_marshal_generic,
26148 G_TYPE_BOOLEAN,
26149 1,
26150 G_TYPE_DBUS_METHOD_INVOCATION);
26151
26152 /* GObject properties for D-Bus properties: */
26153 /**
26154 * Led:color:
26155 *
26156 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link>.
26157 *
26158 * 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.
26159 */
26160 g_object_interface_install_property (iface,
26161 g_param_spec_int ("color", "color", "color", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
26162 /**
26163 * Led:function:
26164 *
26165 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link>.
26166 *
26167 * 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.
26168 */
26169 g_object_interface_install_property (iface,
26170 g_param_spec_string ("function", "function", "function", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
26171}
26172
26173/**
26174 * led_get_color: (skip)
26175 * @object: A #Led.
26176 *
26177 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property.
26178 *
26179 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
26180 *
26181 * Returns: The property value.
26182 */
26183gint
26184led_get_color (Led *object)
26185{
26186 return LED_GET_IFACE (object)->get_color (object);
26187}
26188
26189/**
26190 * led_set_color: (skip)
26191 * @object: A #Led.
26192 * @value: The value to set.
26193 *
26194 * Sets the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property to @value.
26195 *
26196 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
26197 */
26198void
26199led_set_color (Led *object, gint value)
26200{
26201 g_object_set (G_OBJECT (object), "color", value, NULL);
26202}
26203
26204/**
26205 * led_get_function: (skip)
26206 * @object: A #Led.
26207 *
26208 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
26209 *
26210 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
26211 *
26212 * <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>
26213 *
26214 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
26215 */
26216const gchar *
26217led_get_function (Led *object)
26218{
26219 return LED_GET_IFACE (object)->get_function (object);
26220}
26221
26222/**
26223 * led_dup_function: (skip)
26224 * @object: A #Led.
26225 *
26226 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
26227 *
26228 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
26229 *
26230 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
26231 */
26232gchar *
26233led_dup_function (Led *object)
26234{
26235 gchar *value;
26236 g_object_get (G_OBJECT (object), "function", &value, NULL);
26237 return value;
26238}
26239
26240/**
26241 * led_set_function: (skip)
26242 * @object: A #Led.
26243 * @value: The value to set.
26244 *
26245 * Sets the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property to @value.
26246 *
26247 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
26248 */
26249void
26250led_set_function (Led *object, const gchar *value)
26251{
26252 g_object_set (G_OBJECT (object), "function", value, NULL);
26253}
26254
26255/**
26256 * led_call_set_on:
26257 * @proxy: A #LedProxy.
26258 * @cancellable: (allow-none): A #GCancellable or %NULL.
26259 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
26260 * @user_data: User data to pass to @callback.
26261 *
26262 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method on @proxy.
26263 * 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.
26264 * You can then call led_call_set_on_finish() to get the result of the operation.
26265 *
26266 * See led_call_set_on_sync() for the synchronous, blocking version of this method.
26267 */
26268void
26269led_call_set_on (
26270 Led *proxy,
26271 GCancellable *cancellable,
26272 GAsyncReadyCallback callback,
26273 gpointer user_data)
26274{
26275 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
26276 "setOn",
26277 g_variant_new ("()"),
26278 G_DBUS_CALL_FLAGS_NONE,
26279 -1,
26280 cancellable,
26281 callback,
26282 user_data);
26283}
26284
26285/**
26286 * led_call_set_on_finish:
26287 * @proxy: A #LedProxy.
26288 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_on().
26289 * @error: Return location for error or %NULL.
26290 *
26291 * Finishes an operation started with led_call_set_on().
26292 *
26293 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26294 */
26295gboolean
26296led_call_set_on_finish (
26297 Led *proxy,
26298 GAsyncResult *res,
26299 GError **error)
26300{
26301 GVariant *_ret;
26302 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
26303 if (_ret == NULL)
26304 goto _out;
26305 g_variant_get (_ret,
26306 "()");
26307 g_variant_unref (_ret);
26308_out:
26309 return _ret != NULL;
26310}
26311
26312/**
26313 * led_call_set_on_sync:
26314 * @proxy: A #LedProxy.
26315 * @cancellable: (allow-none): A #GCancellable or %NULL.
26316 * @error: Return location for error or %NULL.
26317 *
26318 * 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.
26319 *
26320 * See led_call_set_on() for the asynchronous version of this method.
26321 *
26322 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26323 */
26324gboolean
26325led_call_set_on_sync (
26326 Led *proxy,
26327 GCancellable *cancellable,
26328 GError **error)
26329{
26330 GVariant *_ret;
26331 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
26332 "setOn",
26333 g_variant_new ("()"),
26334 G_DBUS_CALL_FLAGS_NONE,
26335 -1,
26336 cancellable,
26337 error);
26338 if (_ret == NULL)
26339 goto _out;
26340 g_variant_get (_ret,
26341 "()");
26342 g_variant_unref (_ret);
26343_out:
26344 return _ret != NULL;
26345}
26346
26347/**
26348 * led_call_set_off:
26349 * @proxy: A #LedProxy.
26350 * @cancellable: (allow-none): A #GCancellable or %NULL.
26351 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
26352 * @user_data: User data to pass to @callback.
26353 *
26354 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method on @proxy.
26355 * 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.
26356 * You can then call led_call_set_off_finish() to get the result of the operation.
26357 *
26358 * See led_call_set_off_sync() for the synchronous, blocking version of this method.
26359 */
26360void
26361led_call_set_off (
26362 Led *proxy,
26363 GCancellable *cancellable,
26364 GAsyncReadyCallback callback,
26365 gpointer user_data)
26366{
26367 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
26368 "setOff",
26369 g_variant_new ("()"),
26370 G_DBUS_CALL_FLAGS_NONE,
26371 -1,
26372 cancellable,
26373 callback,
26374 user_data);
26375}
26376
26377/**
26378 * led_call_set_off_finish:
26379 * @proxy: A #LedProxy.
26380 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_off().
26381 * @error: Return location for error or %NULL.
26382 *
26383 * Finishes an operation started with led_call_set_off().
26384 *
26385 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26386 */
26387gboolean
26388led_call_set_off_finish (
26389 Led *proxy,
26390 GAsyncResult *res,
26391 GError **error)
26392{
26393 GVariant *_ret;
26394 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
26395 if (_ret == NULL)
26396 goto _out;
26397 g_variant_get (_ret,
26398 "()");
26399 g_variant_unref (_ret);
26400_out:
26401 return _ret != NULL;
26402}
26403
26404/**
26405 * led_call_set_off_sync:
26406 * @proxy: A #LedProxy.
26407 * @cancellable: (allow-none): A #GCancellable or %NULL.
26408 * @error: Return location for error or %NULL.
26409 *
26410 * 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.
26411 *
26412 * See led_call_set_off() for the asynchronous version of this method.
26413 *
26414 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26415 */
26416gboolean
26417led_call_set_off_sync (
26418 Led *proxy,
26419 GCancellable *cancellable,
26420 GError **error)
26421{
26422 GVariant *_ret;
26423 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
26424 "setOff",
26425 g_variant_new ("()"),
26426 G_DBUS_CALL_FLAGS_NONE,
26427 -1,
26428 cancellable,
26429 error);
26430 if (_ret == NULL)
26431 goto _out;
26432 g_variant_get (_ret,
26433 "()");
26434 g_variant_unref (_ret);
26435_out:
26436 return _ret != NULL;
26437}
26438
26439/**
26440 * led_call_set_blink_slow:
26441 * @proxy: A #LedProxy.
26442 * @cancellable: (allow-none): A #GCancellable or %NULL.
26443 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
26444 * @user_data: User data to pass to @callback.
26445 *
26446 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method on @proxy.
26447 * 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.
26448 * You can then call led_call_set_blink_slow_finish() to get the result of the operation.
26449 *
26450 * See led_call_set_blink_slow_sync() for the synchronous, blocking version of this method.
26451 */
26452void
26453led_call_set_blink_slow (
26454 Led *proxy,
26455 GCancellable *cancellable,
26456 GAsyncReadyCallback callback,
26457 gpointer user_data)
26458{
26459 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
26460 "setBlinkSlow",
26461 g_variant_new ("()"),
26462 G_DBUS_CALL_FLAGS_NONE,
26463 -1,
26464 cancellable,
26465 callback,
26466 user_data);
26467}
26468
26469/**
26470 * led_call_set_blink_slow_finish:
26471 * @proxy: A #LedProxy.
26472 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_slow().
26473 * @error: Return location for error or %NULL.
26474 *
26475 * Finishes an operation started with led_call_set_blink_slow().
26476 *
26477 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26478 */
26479gboolean
26480led_call_set_blink_slow_finish (
26481 Led *proxy,
26482 GAsyncResult *res,
26483 GError **error)
26484{
26485 GVariant *_ret;
26486 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
26487 if (_ret == NULL)
26488 goto _out;
26489 g_variant_get (_ret,
26490 "()");
26491 g_variant_unref (_ret);
26492_out:
26493 return _ret != NULL;
26494}
26495
26496/**
26497 * led_call_set_blink_slow_sync:
26498 * @proxy: A #LedProxy.
26499 * @cancellable: (allow-none): A #GCancellable or %NULL.
26500 * @error: Return location for error or %NULL.
26501 *
26502 * 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.
26503 *
26504 * See led_call_set_blink_slow() for the asynchronous version of this method.
26505 *
26506 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26507 */
26508gboolean
26509led_call_set_blink_slow_sync (
26510 Led *proxy,
26511 GCancellable *cancellable,
26512 GError **error)
26513{
26514 GVariant *_ret;
26515 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
26516 "setBlinkSlow",
26517 g_variant_new ("()"),
26518 G_DBUS_CALL_FLAGS_NONE,
26519 -1,
26520 cancellable,
26521 error);
26522 if (_ret == NULL)
26523 goto _out;
26524 g_variant_get (_ret,
26525 "()");
26526 g_variant_unref (_ret);
26527_out:
26528 return _ret != NULL;
26529}
26530
26531/**
26532 * led_call_set_blink_fast:
26533 * @proxy: A #LedProxy.
26534 * @cancellable: (allow-none): A #GCancellable or %NULL.
26535 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
26536 * @user_data: User data to pass to @callback.
26537 *
26538 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method on @proxy.
26539 * 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.
26540 * You can then call led_call_set_blink_fast_finish() to get the result of the operation.
26541 *
26542 * See led_call_set_blink_fast_sync() for the synchronous, blocking version of this method.
26543 */
26544void
26545led_call_set_blink_fast (
26546 Led *proxy,
26547 GCancellable *cancellable,
26548 GAsyncReadyCallback callback,
26549 gpointer user_data)
26550{
26551 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
26552 "setBlinkFast",
26553 g_variant_new ("()"),
26554 G_DBUS_CALL_FLAGS_NONE,
26555 -1,
26556 cancellable,
26557 callback,
26558 user_data);
26559}
26560
26561/**
26562 * led_call_set_blink_fast_finish:
26563 * @proxy: A #LedProxy.
26564 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_fast().
26565 * @error: Return location for error or %NULL.
26566 *
26567 * Finishes an operation started with led_call_set_blink_fast().
26568 *
26569 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26570 */
26571gboolean
26572led_call_set_blink_fast_finish (
26573 Led *proxy,
26574 GAsyncResult *res,
26575 GError **error)
26576{
26577 GVariant *_ret;
26578 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
26579 if (_ret == NULL)
26580 goto _out;
26581 g_variant_get (_ret,
26582 "()");
26583 g_variant_unref (_ret);
26584_out:
26585 return _ret != NULL;
26586}
26587
26588/**
26589 * led_call_set_blink_fast_sync:
26590 * @proxy: A #LedProxy.
26591 * @cancellable: (allow-none): A #GCancellable or %NULL.
26592 * @error: Return location for error or %NULL.
26593 *
26594 * 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.
26595 *
26596 * See led_call_set_blink_fast() for the asynchronous version of this method.
26597 *
26598 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26599 */
26600gboolean
26601led_call_set_blink_fast_sync (
26602 Led *proxy,
26603 GCancellable *cancellable,
26604 GError **error)
26605{
26606 GVariant *_ret;
26607 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
26608 "setBlinkFast",
26609 g_variant_new ("()"),
26610 G_DBUS_CALL_FLAGS_NONE,
26611 -1,
26612 cancellable,
26613 error);
26614 if (_ret == NULL)
26615 goto _out;
26616 g_variant_get (_ret,
26617 "()");
26618 g_variant_unref (_ret);
26619_out:
26620 return _ret != NULL;
26621}
26622
26623/**
26624 * led_complete_set_on:
26625 * @object: A #Led.
26626 * @invocation: (transfer full): A #GDBusMethodInvocation.
26627 *
26628 * 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.
26629 *
26630 * This method will free @invocation, you cannot use it afterwards.
26631 */
26632void
26633led_complete_set_on (
26634 Led *object,
26635 GDBusMethodInvocation *invocation)
26636{
26637 g_dbus_method_invocation_return_value (invocation,
26638 g_variant_new ("()"));
26639}
26640
26641/**
26642 * led_complete_set_off:
26643 * @object: A #Led.
26644 * @invocation: (transfer full): A #GDBusMethodInvocation.
26645 *
26646 * 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.
26647 *
26648 * This method will free @invocation, you cannot use it afterwards.
26649 */
26650void
26651led_complete_set_off (
26652 Led *object,
26653 GDBusMethodInvocation *invocation)
26654{
26655 g_dbus_method_invocation_return_value (invocation,
26656 g_variant_new ("()"));
26657}
26658
26659/**
26660 * led_complete_set_blink_slow:
26661 * @object: A #Led.
26662 * @invocation: (transfer full): A #GDBusMethodInvocation.
26663 *
26664 * 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.
26665 *
26666 * This method will free @invocation, you cannot use it afterwards.
26667 */
26668void
26669led_complete_set_blink_slow (
26670 Led *object,
26671 GDBusMethodInvocation *invocation)
26672{
26673 g_dbus_method_invocation_return_value (invocation,
26674 g_variant_new ("()"));
26675}
26676
26677/**
26678 * led_complete_set_blink_fast:
26679 * @object: A #Led.
26680 * @invocation: (transfer full): A #GDBusMethodInvocation.
26681 *
26682 * 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.
26683 *
26684 * This method will free @invocation, you cannot use it afterwards.
26685 */
26686void
26687led_complete_set_blink_fast (
26688 Led *object,
26689 GDBusMethodInvocation *invocation)
26690{
26691 g_dbus_method_invocation_return_value (invocation,
26692 g_variant_new ("()"));
26693}
26694
26695/* ------------------------------------------------------------------------ */
26696
26697/**
26698 * LedProxy:
26699 *
26700 * The #LedProxy structure contains only private data and should only be accessed using the provided API.
26701 */
26702
26703/**
26704 * LedProxyClass:
26705 * @parent_class: The parent class.
26706 *
26707 * Class structure for #LedProxy.
26708 */
26709
26710struct _LedProxyPrivate
26711{
26712 GData *qdata;
26713};
26714
26715static void led_proxy_iface_init (LedIface *iface);
26716
26717#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
26718G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
26719 G_ADD_PRIVATE (LedProxy)
26720 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
26721
26722#else
26723G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
26724 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
26725
26726#endif
26727static void
26728led_proxy_finalize (GObject *object)
26729{
26730 LedProxy *proxy = LED_PROXY (object);
26731 g_datalist_clear (&proxy->priv->qdata);
26732 G_OBJECT_CLASS (led_proxy_parent_class)->finalize (object);
26733}
26734
26735static void
26736led_proxy_get_property (GObject *object,
26737 guint prop_id,
26738 GValue *value,
26739 GParamSpec *pspec G_GNUC_UNUSED)
26740{
26741 const _ExtendedGDBusPropertyInfo *info;
26742 GVariant *variant;
26743 g_assert (prop_id != 0 && prop_id - 1 < 2);
26744 info = _led_property_info_pointers[prop_id - 1];
26745 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
26746 if (info->use_gvariant)
26747 {
26748 g_value_set_variant (value, variant);
26749 }
26750 else
26751 {
26752 if (variant != NULL)
26753 g_dbus_gvariant_to_gvalue (variant, value);
26754 }
26755 if (variant != NULL)
26756 g_variant_unref (variant);
26757}
26758
26759static void
26760led_proxy_set_property_cb (GDBusProxy *proxy,
26761 GAsyncResult *res,
26762 gpointer user_data)
26763{
26764 const _ExtendedGDBusPropertyInfo *info = user_data;
26765 GError *error;
26766 GVariant *_ret;
26767 error = NULL;
26768 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
26769 if (!_ret)
26770 {
26771 g_warning ("Error setting property '%s' on interface org.openbmc.Led: %s (%s, %d)",
26772 info->parent_struct.name,
26773 error->message, g_quark_to_string (error->domain), error->code);
26774 g_error_free (error);
26775 }
26776 else
26777 {
26778 g_variant_unref (_ret);
26779 }
26780}
26781
26782static void
26783led_proxy_set_property (GObject *object,
26784 guint prop_id,
26785 const GValue *value,
26786 GParamSpec *pspec G_GNUC_UNUSED)
26787{
26788 const _ExtendedGDBusPropertyInfo *info;
26789 GVariant *variant;
26790 g_assert (prop_id != 0 && prop_id - 1 < 2);
26791 info = _led_property_info_pointers[prop_id - 1];
26792 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
26793 g_dbus_proxy_call (G_DBUS_PROXY (object),
26794 "org.freedesktop.DBus.Properties.Set",
26795 g_variant_new ("(ssv)", "org.openbmc.Led", info->parent_struct.name, variant),
26796 G_DBUS_CALL_FLAGS_NONE,
26797 -1,
26798 NULL, (GAsyncReadyCallback) led_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
26799 g_variant_unref (variant);
26800}
26801
26802static void
26803led_proxy_g_signal (GDBusProxy *proxy,
26804 const gchar *sender_name G_GNUC_UNUSED,
26805 const gchar *signal_name,
26806 GVariant *parameters)
26807{
26808 _ExtendedGDBusSignalInfo *info;
26809 GVariantIter iter;
26810 GVariant *child;
26811 GValue *paramv;
26812 guint num_params;
26813 guint n;
26814 guint signal_id;
26815 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, signal_name);
26816 if (info == NULL)
26817 return;
26818 num_params = g_variant_n_children (parameters);
26819 paramv = g_new0 (GValue, num_params + 1);
26820 g_value_init (&paramv[0], TYPE_LED);
26821 g_value_set_object (&paramv[0], proxy);
26822 g_variant_iter_init (&iter, parameters);
26823 n = 1;
26824 while ((child = g_variant_iter_next_value (&iter)) != NULL)
26825 {
26826 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
26827 if (arg_info->use_gvariant)
26828 {
26829 g_value_init (&paramv[n], G_TYPE_VARIANT);
26830 g_value_set_variant (&paramv[n], child);
26831 n++;
26832 }
26833 else
26834 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
26835 g_variant_unref (child);
26836 }
26837 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
26838 g_signal_emitv (paramv, signal_id, 0, NULL);
26839 for (n = 0; n < num_params + 1; n++)
26840 g_value_unset (&paramv[n]);
26841 g_free (paramv);
26842}
26843
26844static void
26845led_proxy_g_properties_changed (GDBusProxy *_proxy,
26846 GVariant *changed_properties,
26847 const gchar *const *invalidated_properties)
26848{
26849 LedProxy *proxy = LED_PROXY (_proxy);
26850 guint n;
26851 const gchar *key;
26852 GVariantIter *iter;
26853 _ExtendedGDBusPropertyInfo *info;
26854 g_variant_get (changed_properties, "a{sv}", &iter);
26855 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
26856 {
26857 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, key);
26858 g_datalist_remove_data (&proxy->priv->qdata, key);
26859 if (info != NULL)
26860 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
26861 }
26862 g_variant_iter_free (iter);
26863 for (n = 0; invalidated_properties[n] != NULL; n++)
26864 {
26865 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, invalidated_properties[n]);
26866 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
26867 if (info != NULL)
26868 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
26869 }
26870}
26871
26872static gint
26873led_proxy_get_color (Led *object)
26874{
26875 LedProxy *proxy = LED_PROXY (object);
26876 GVariant *variant;
26877 gint value = 0;
26878 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "color");
26879 if (variant != NULL)
26880 {
26881 value = g_variant_get_int32 (variant);
26882 g_variant_unref (variant);
26883 }
26884 return value;
26885}
26886
26887static const gchar *
26888led_proxy_get_function (Led *object)
26889{
26890 LedProxy *proxy = LED_PROXY (object);
26891 GVariant *variant;
26892 const gchar *value = NULL;
26893 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "function");
26894 if (variant != NULL)
26895 {
26896 value = g_variant_get_string (variant, NULL);
26897 g_variant_unref (variant);
26898 }
26899 return value;
26900}
26901
26902static void
26903led_proxy_init (LedProxy *proxy)
26904{
26905#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
26906 proxy->priv = led_proxy_get_instance_private (proxy);
26907#else
26908 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_LED_PROXY, LedProxyPrivate);
26909#endif
26910
26911 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), led_interface_info ());
26912}
26913
26914static void
26915led_proxy_class_init (LedProxyClass *klass)
26916{
26917 GObjectClass *gobject_class;
26918 GDBusProxyClass *proxy_class;
26919
26920 gobject_class = G_OBJECT_CLASS (klass);
26921 gobject_class->finalize = led_proxy_finalize;
26922 gobject_class->get_property = led_proxy_get_property;
26923 gobject_class->set_property = led_proxy_set_property;
26924
26925 proxy_class = G_DBUS_PROXY_CLASS (klass);
26926 proxy_class->g_signal = led_proxy_g_signal;
26927 proxy_class->g_properties_changed = led_proxy_g_properties_changed;
26928
26929 led_override_properties (gobject_class, 1);
26930
26931#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
26932 g_type_class_add_private (klass, sizeof (LedProxyPrivate));
26933#endif
26934}
26935
26936static void
26937led_proxy_iface_init (LedIface *iface)
26938{
26939 iface->get_color = led_proxy_get_color;
26940 iface->get_function = led_proxy_get_function;
26941}
26942
26943/**
26944 * led_proxy_new:
26945 * @connection: A #GDBusConnection.
26946 * @flags: Flags from the #GDBusProxyFlags enumeration.
26947 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
26948 * @object_path: An object path.
26949 * @cancellable: (allow-none): A #GCancellable or %NULL.
26950 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
26951 * @user_data: User data to pass to @callback.
26952 *
26953 * 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.
26954 *
26955 * 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.
26956 * You can then call led_proxy_new_finish() to get the result of the operation.
26957 *
26958 * See led_proxy_new_sync() for the synchronous, blocking version of this constructor.
26959 */
26960void
26961led_proxy_new (
26962 GDBusConnection *connection,
26963 GDBusProxyFlags flags,
26964 const gchar *name,
26965 const gchar *object_path,
26966 GCancellable *cancellable,
26967 GAsyncReadyCallback callback,
26968 gpointer user_data)
26969{
26970 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);
26971}
26972
26973/**
26974 * led_proxy_new_finish:
26975 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new().
26976 * @error: Return location for error or %NULL
26977 *
26978 * Finishes an operation started with led_proxy_new().
26979 *
26980 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
26981 */
26982Led *
26983led_proxy_new_finish (
26984 GAsyncResult *res,
26985 GError **error)
26986{
26987 GObject *ret;
26988 GObject *source_object;
26989 source_object = g_async_result_get_source_object (res);
26990 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
26991 g_object_unref (source_object);
26992 if (ret != NULL)
26993 return LED (ret);
26994 else
26995 return NULL;
26996}
26997
26998/**
26999 * led_proxy_new_sync:
27000 * @connection: A #GDBusConnection.
27001 * @flags: Flags from the #GDBusProxyFlags enumeration.
27002 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
27003 * @object_path: An object path.
27004 * @cancellable: (allow-none): A #GCancellable or %NULL.
27005 * @error: Return location for error or %NULL
27006 *
27007 * 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.
27008 *
27009 * The calling thread is blocked until a reply is received.
27010 *
27011 * See led_proxy_new() for the asynchronous version of this constructor.
27012 *
27013 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
27014 */
27015Led *
27016led_proxy_new_sync (
27017 GDBusConnection *connection,
27018 GDBusProxyFlags flags,
27019 const gchar *name,
27020 const gchar *object_path,
27021 GCancellable *cancellable,
27022 GError **error)
27023{
27024 GInitable *ret;
27025 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);
27026 if (ret != NULL)
27027 return LED (ret);
27028 else
27029 return NULL;
27030}
27031
27032
27033/**
27034 * led_proxy_new_for_bus:
27035 * @bus_type: A #GBusType.
27036 * @flags: Flags from the #GDBusProxyFlags enumeration.
27037 * @name: A bus name (well-known or unique).
27038 * @object_path: An object path.
27039 * @cancellable: (allow-none): A #GCancellable or %NULL.
27040 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
27041 * @user_data: User data to pass to @callback.
27042 *
27043 * Like led_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
27044 *
27045 * 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.
27046 * You can then call led_proxy_new_for_bus_finish() to get the result of the operation.
27047 *
27048 * See led_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
27049 */
27050void
27051led_proxy_new_for_bus (
27052 GBusType bus_type,
27053 GDBusProxyFlags flags,
27054 const gchar *name,
27055 const gchar *object_path,
27056 GCancellable *cancellable,
27057 GAsyncReadyCallback callback,
27058 gpointer user_data)
27059{
27060 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);
27061}
27062
27063/**
27064 * led_proxy_new_for_bus_finish:
27065 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new_for_bus().
27066 * @error: Return location for error or %NULL
27067 *
27068 * Finishes an operation started with led_proxy_new_for_bus().
27069 *
27070 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
27071 */
27072Led *
27073led_proxy_new_for_bus_finish (
27074 GAsyncResult *res,
27075 GError **error)
27076{
27077 GObject *ret;
27078 GObject *source_object;
27079 source_object = g_async_result_get_source_object (res);
27080 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
27081 g_object_unref (source_object);
27082 if (ret != NULL)
27083 return LED (ret);
27084 else
27085 return NULL;
27086}
27087
27088/**
27089 * led_proxy_new_for_bus_sync:
27090 * @bus_type: A #GBusType.
27091 * @flags: Flags from the #GDBusProxyFlags enumeration.
27092 * @name: A bus name (well-known or unique).
27093 * @object_path: An object path.
27094 * @cancellable: (allow-none): A #GCancellable or %NULL.
27095 * @error: Return location for error or %NULL
27096 *
27097 * Like led_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
27098 *
27099 * The calling thread is blocked until a reply is received.
27100 *
27101 * See led_proxy_new_for_bus() for the asynchronous version of this constructor.
27102 *
27103 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
27104 */
27105Led *
27106led_proxy_new_for_bus_sync (
27107 GBusType bus_type,
27108 GDBusProxyFlags flags,
27109 const gchar *name,
27110 const gchar *object_path,
27111 GCancellable *cancellable,
27112 GError **error)
27113{
27114 GInitable *ret;
27115 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);
27116 if (ret != NULL)
27117 return LED (ret);
27118 else
27119 return NULL;
27120}
27121
27122
27123/* ------------------------------------------------------------------------ */
27124
27125/**
27126 * LedSkeleton:
27127 *
27128 * The #LedSkeleton structure contains only private data and should only be accessed using the provided API.
27129 */
27130
27131/**
27132 * LedSkeletonClass:
27133 * @parent_class: The parent class.
27134 *
27135 * Class structure for #LedSkeleton.
27136 */
27137
27138struct _LedSkeletonPrivate
27139{
27140 GValue *properties;
27141 GList *changed_properties;
27142 GSource *changed_properties_idle_source;
27143 GMainContext *context;
27144 GMutex lock;
27145};
27146
27147static void
27148_led_skeleton_handle_method_call (
27149 GDBusConnection *connection G_GNUC_UNUSED,
27150 const gchar *sender G_GNUC_UNUSED,
27151 const gchar *object_path G_GNUC_UNUSED,
27152 const gchar *interface_name,
27153 const gchar *method_name,
27154 GVariant *parameters,
27155 GDBusMethodInvocation *invocation,
27156 gpointer user_data)
27157{
27158 LedSkeleton *skeleton = LED_SKELETON (user_data);
27159 _ExtendedGDBusMethodInfo *info;
27160 GVariantIter iter;
27161 GVariant *child;
27162 GValue *paramv;
27163 guint num_params;
27164 guint num_extra;
27165 guint n;
27166 guint signal_id;
27167 GValue return_value = G_VALUE_INIT;
27168 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
27169 g_assert (info != NULL);
27170 num_params = g_variant_n_children (parameters);
27171 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
27172 n = 0;
27173 g_value_init (&paramv[n], TYPE_LED);
27174 g_value_set_object (&paramv[n++], skeleton);
27175 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
27176 g_value_set_object (&paramv[n++], invocation);
27177 if (info->pass_fdlist)
27178 {
27179#ifdef G_OS_UNIX
27180 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
27181 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
27182#else
27183 g_assert_not_reached ();
27184#endif
27185 }
27186 g_variant_iter_init (&iter, parameters);
27187 while ((child = g_variant_iter_next_value (&iter)) != NULL)
27188 {
27189 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
27190 if (arg_info->use_gvariant)
27191 {
27192 g_value_init (&paramv[n], G_TYPE_VARIANT);
27193 g_value_set_variant (&paramv[n], child);
27194 n++;
27195 }
27196 else
27197 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
27198 g_variant_unref (child);
27199 }
27200 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
27201 g_value_init (&return_value, G_TYPE_BOOLEAN);
27202 g_signal_emitv (paramv, signal_id, 0, &return_value);
27203 if (!g_value_get_boolean (&return_value))
27204 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);
27205 g_value_unset (&return_value);
27206 for (n = 0; n < num_params + num_extra; n++)
27207 g_value_unset (&paramv[n]);
27208 g_free (paramv);
27209}
27210
27211static GVariant *
27212_led_skeleton_handle_get_property (
27213 GDBusConnection *connection G_GNUC_UNUSED,
27214 const gchar *sender G_GNUC_UNUSED,
27215 const gchar *object_path G_GNUC_UNUSED,
27216 const gchar *interface_name G_GNUC_UNUSED,
27217 const gchar *property_name,
27218 GError **error,
27219 gpointer user_data)
27220{
27221 LedSkeleton *skeleton = LED_SKELETON (user_data);
27222 GValue value = G_VALUE_INIT;
27223 GParamSpec *pspec;
27224 _ExtendedGDBusPropertyInfo *info;
27225 GVariant *ret;
27226 ret = NULL;
27227 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
27228 g_assert (info != NULL);
27229 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
27230 if (pspec == NULL)
27231 {
27232 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
27233 }
27234 else
27235 {
27236 g_value_init (&value, pspec->value_type);
27237 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
27238 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
27239 g_value_unset (&value);
27240 }
27241 return ret;
27242}
27243
27244static gboolean
27245_led_skeleton_handle_set_property (
27246 GDBusConnection *connection G_GNUC_UNUSED,
27247 const gchar *sender G_GNUC_UNUSED,
27248 const gchar *object_path G_GNUC_UNUSED,
27249 const gchar *interface_name G_GNUC_UNUSED,
27250 const gchar *property_name,
27251 GVariant *variant,
27252 GError **error,
27253 gpointer user_data)
27254{
27255 LedSkeleton *skeleton = LED_SKELETON (user_data);
27256 GValue value = G_VALUE_INIT;
27257 GParamSpec *pspec;
27258 _ExtendedGDBusPropertyInfo *info;
27259 gboolean ret;
27260 ret = FALSE;
27261 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
27262 g_assert (info != NULL);
27263 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
27264 if (pspec == NULL)
27265 {
27266 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
27267 }
27268 else
27269 {
27270 if (info->use_gvariant)
27271 g_value_set_variant (&value, variant);
27272 else
27273 g_dbus_gvariant_to_gvalue (variant, &value);
27274 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
27275 g_value_unset (&value);
27276 ret = TRUE;
27277 }
27278 return ret;
27279}
27280
27281static const GDBusInterfaceVTable _led_skeleton_vtable =
27282{
27283 _led_skeleton_handle_method_call,
27284 _led_skeleton_handle_get_property,
27285 _led_skeleton_handle_set_property,
27286 {NULL}
27287};
27288
27289static GDBusInterfaceInfo *
27290led_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
27291{
27292 return led_interface_info ();
27293}
27294
27295static GDBusInterfaceVTable *
27296led_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
27297{
27298 return (GDBusInterfaceVTable *) &_led_skeleton_vtable;
27299}
27300
27301static GVariant *
27302led_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
27303{
27304 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
27305
27306 GVariantBuilder builder;
27307 guint n;
27308 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
27309 if (_led_interface_info.parent_struct.properties == NULL)
27310 goto out;
27311 for (n = 0; _led_interface_info.parent_struct.properties[n] != NULL; n++)
27312 {
27313 GDBusPropertyInfo *info = _led_interface_info.parent_struct.properties[n];
27314 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
27315 {
27316 GVariant *value;
27317 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);
27318 if (value != NULL)
27319 {
27320 g_variant_take_ref (value);
27321 g_variant_builder_add (&builder, "{sv}", info->name, value);
27322 g_variant_unref (value);
27323 }
27324 }
27325 }
27326out:
27327 return g_variant_builder_end (&builder);
27328}
27329
27330static gboolean _led_emit_changed (gpointer user_data);
27331
27332static void
27333led_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
27334{
27335 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
27336 gboolean emit_changed = FALSE;
27337
27338 g_mutex_lock (&skeleton->priv->lock);
27339 if (skeleton->priv->changed_properties_idle_source != NULL)
27340 {
27341 g_source_destroy (skeleton->priv->changed_properties_idle_source);
27342 skeleton->priv->changed_properties_idle_source = NULL;
27343 emit_changed = TRUE;
27344 }
27345 g_mutex_unlock (&skeleton->priv->lock);
27346
27347 if (emit_changed)
27348 _led_emit_changed (skeleton);
27349}
27350
27351static void led_skeleton_iface_init (LedIface *iface);
27352#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
27353G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
27354 G_ADD_PRIVATE (LedSkeleton)
27355 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
27356
27357#else
27358G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
27359 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
27360
27361#endif
27362static void
27363led_skeleton_finalize (GObject *object)
27364{
27365 LedSkeleton *skeleton = LED_SKELETON (object);
27366 guint n;
27367 for (n = 0; n < 2; n++)
27368 g_value_unset (&skeleton->priv->properties[n]);
27369 g_free (skeleton->priv->properties);
27370 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
27371 if (skeleton->priv->changed_properties_idle_source != NULL)
27372 g_source_destroy (skeleton->priv->changed_properties_idle_source);
27373 g_main_context_unref (skeleton->priv->context);
27374 g_mutex_clear (&skeleton->priv->lock);
27375 G_OBJECT_CLASS (led_skeleton_parent_class)->finalize (object);
27376}
27377
27378static void
27379led_skeleton_get_property (GObject *object,
27380 guint prop_id,
27381 GValue *value,
27382 GParamSpec *pspec G_GNUC_UNUSED)
27383{
27384 LedSkeleton *skeleton = LED_SKELETON (object);
27385 g_assert (prop_id != 0 && prop_id - 1 < 2);
27386 g_mutex_lock (&skeleton->priv->lock);
27387 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
27388 g_mutex_unlock (&skeleton->priv->lock);
27389}
27390
27391static gboolean
27392_led_emit_changed (gpointer user_data)
27393{
27394 LedSkeleton *skeleton = LED_SKELETON (user_data);
27395 GList *l;
27396 GVariantBuilder builder;
27397 GVariantBuilder invalidated_builder;
27398 guint num_changes;
27399
27400 g_mutex_lock (&skeleton->priv->lock);
27401 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
27402 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
27403 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
27404 {
27405 ChangedProperty *cp = l->data;
27406 GVariant *variant;
27407 const GValue *cur_value;
27408
27409 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
27410 if (!_g_value_equal (cur_value, &cp->orig_value))
27411 {
27412 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
27413 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
27414 g_variant_unref (variant);
27415 num_changes++;
27416 }
27417 }
27418 if (num_changes > 0)
27419 {
27420 GList *connections, *ll;
27421 GVariant *signal_variant;
27422 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Led",
27423 &builder, &invalidated_builder));
27424 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
27425 for (ll = connections; ll != NULL; ll = ll->next)
27426 {
27427 GDBusConnection *connection = ll->data;
27428
27429 g_dbus_connection_emit_signal (connection,
27430 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
27431 "org.freedesktop.DBus.Properties",
27432 "PropertiesChanged",
27433 signal_variant,
27434 NULL);
27435 }
27436 g_variant_unref (signal_variant);
27437 g_list_free_full (connections, g_object_unref);
27438 }
27439 else
27440 {
27441 g_variant_builder_clear (&builder);
27442 g_variant_builder_clear (&invalidated_builder);
27443 }
27444 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
27445 skeleton->priv->changed_properties = NULL;
27446 skeleton->priv->changed_properties_idle_source = NULL;
27447 g_mutex_unlock (&skeleton->priv->lock);
27448 return FALSE;
27449}
27450
27451static void
27452_led_schedule_emit_changed (LedSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
27453{
27454 ChangedProperty *cp;
27455 GList *l;
27456 cp = NULL;
27457 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
27458 {
27459 ChangedProperty *i_cp = l->data;
27460 if (i_cp->info == info)
27461 {
27462 cp = i_cp;
27463 break;
27464 }
27465 }
27466 if (cp == NULL)
27467 {
27468 cp = g_new0 (ChangedProperty, 1);
27469 cp->prop_id = prop_id;
27470 cp->info = info;
27471 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
27472 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
27473 g_value_copy (orig_value, &cp->orig_value);
27474 }
27475}
27476
27477static void
27478led_skeleton_notify (GObject *object,
27479 GParamSpec *pspec G_GNUC_UNUSED)
27480{
27481 LedSkeleton *skeleton = LED_SKELETON (object);
27482 g_mutex_lock (&skeleton->priv->lock);
27483 if (skeleton->priv->changed_properties != NULL &&
27484 skeleton->priv->changed_properties_idle_source == NULL)
27485 {
27486 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
27487 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
27488 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _led_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylak2cb27752015-10-19 16:23:14 -050027489 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _led_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -050027490 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
27491 g_source_unref (skeleton->priv->changed_properties_idle_source);
27492 }
27493 g_mutex_unlock (&skeleton->priv->lock);
27494}
27495
27496static void
27497led_skeleton_set_property (GObject *object,
27498 guint prop_id,
27499 const GValue *value,
27500 GParamSpec *pspec)
27501{
27502 LedSkeleton *skeleton = LED_SKELETON (object);
27503 g_assert (prop_id != 0 && prop_id - 1 < 2);
27504 g_mutex_lock (&skeleton->priv->lock);
27505 g_object_freeze_notify (object);
27506 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
27507 {
27508 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
27509 _led_schedule_emit_changed (skeleton, _led_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
27510 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
27511 g_object_notify_by_pspec (object, pspec);
27512 }
27513 g_mutex_unlock (&skeleton->priv->lock);
27514 g_object_thaw_notify (object);
27515}
27516
27517static void
27518led_skeleton_init (LedSkeleton *skeleton)
27519{
27520#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
27521 skeleton->priv = led_skeleton_get_instance_private (skeleton);
27522#else
27523 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_LED_SKELETON, LedSkeletonPrivate);
27524#endif
27525
27526 g_mutex_init (&skeleton->priv->lock);
27527 skeleton->priv->context = g_main_context_ref_thread_default ();
27528 skeleton->priv->properties = g_new0 (GValue, 2);
27529 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
27530 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
27531}
27532
27533static gint
27534led_skeleton_get_color (Led *object)
27535{
27536 LedSkeleton *skeleton = LED_SKELETON (object);
27537 gint value;
27538 g_mutex_lock (&skeleton->priv->lock);
27539 value = g_value_get_int (&(skeleton->priv->properties[0]));
27540 g_mutex_unlock (&skeleton->priv->lock);
27541 return value;
27542}
27543
27544static const gchar *
27545led_skeleton_get_function (Led *object)
27546{
27547 LedSkeleton *skeleton = LED_SKELETON (object);
27548 const gchar *value;
27549 g_mutex_lock (&skeleton->priv->lock);
27550 value = g_value_get_string (&(skeleton->priv->properties[1]));
27551 g_mutex_unlock (&skeleton->priv->lock);
27552 return value;
27553}
27554
27555static void
27556led_skeleton_class_init (LedSkeletonClass *klass)
27557{
27558 GObjectClass *gobject_class;
27559 GDBusInterfaceSkeletonClass *skeleton_class;
27560
27561 gobject_class = G_OBJECT_CLASS (klass);
27562 gobject_class->finalize = led_skeleton_finalize;
27563 gobject_class->get_property = led_skeleton_get_property;
27564 gobject_class->set_property = led_skeleton_set_property;
27565 gobject_class->notify = led_skeleton_notify;
27566
27567
27568 led_override_properties (gobject_class, 1);
27569
27570 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
27571 skeleton_class->get_info = led_skeleton_dbus_interface_get_info;
27572 skeleton_class->get_properties = led_skeleton_dbus_interface_get_properties;
27573 skeleton_class->flush = led_skeleton_dbus_interface_flush;
27574 skeleton_class->get_vtable = led_skeleton_dbus_interface_get_vtable;
27575
27576#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
27577 g_type_class_add_private (klass, sizeof (LedSkeletonPrivate));
27578#endif
27579}
27580
27581static void
27582led_skeleton_iface_init (LedIface *iface)
27583{
27584 iface->get_color = led_skeleton_get_color;
27585 iface->get_function = led_skeleton_get_function;
27586}
27587
27588/**
27589 * led_skeleton_new:
27590 *
27591 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
27592 *
27593 * Returns: (transfer full) (type LedSkeleton): The skeleton object.
27594 */
27595Led *
27596led_skeleton_new (void)
27597{
27598 return LED (g_object_new (TYPE_LED_SKELETON, NULL));
27599}
27600
27601/* ------------------------------------------------------------------------
Norman Jamesdbcffbd2015-10-06 16:53:06 -050027602 * Code for interface org.openbmc.HostIpmi
27603 * ------------------------------------------------------------------------
27604 */
27605
27606/**
27607 * SECTION:HostIpmi
27608 * @title: HostIpmi
27609 * @short_description: Generated C code for the org.openbmc.HostIpmi D-Bus interface
27610 *
27611 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> D-Bus interface in C.
27612 */
27613
27614/* ---- Introspection data for org.openbmc.HostIpmi ---- */
27615
27616static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_seq =
27617{
27618 {
27619 -1,
27620 (gchar *) "seq",
27621 (gchar *) "y",
27622 NULL
27623 },
27624 FALSE
27625};
27626
27627static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_netfn =
27628{
27629 {
27630 -1,
27631 (gchar *) "netfn",
27632 (gchar *) "y",
27633 NULL
27634 },
27635 FALSE
27636};
27637
27638static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_cmd =
27639{
27640 {
27641 -1,
27642 (gchar *) "cmd",
27643 (gchar *) "y",
27644 NULL
27645 },
27646 FALSE
27647};
27648
27649static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_data =
27650{
27651 {
27652 -1,
27653 (gchar *) "data",
27654 (gchar *) "ay",
27655 NULL
27656 },
27657 FALSE
27658};
27659
27660static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_IN_ARG_pointers[] =
27661{
27662 &_host_ipmi_method_info_send_message_IN_ARG_seq,
27663 &_host_ipmi_method_info_send_message_IN_ARG_netfn,
27664 &_host_ipmi_method_info_send_message_IN_ARG_cmd,
27665 &_host_ipmi_method_info_send_message_IN_ARG_data,
27666 NULL
27667};
27668
27669static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4 =
27670{
27671 {
27672 -1,
27673 (gchar *) "unnamed_arg4",
27674 (gchar *) "x",
27675 NULL
27676 },
27677 FALSE
27678};
27679
27680static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_OUT_ARG_pointers[] =
27681{
27682 &_host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4,
27683 NULL
27684};
27685
27686static const _ExtendedGDBusMethodInfo _host_ipmi_method_info_send_message =
27687{
27688 {
27689 -1,
27690 (gchar *) "sendMessage",
27691 (GDBusArgInfo **) &_host_ipmi_method_info_send_message_IN_ARG_pointers,
27692 (GDBusArgInfo **) &_host_ipmi_method_info_send_message_OUT_ARG_pointers,
27693 NULL
27694 },
27695 "handle-send-message",
27696 FALSE
27697};
27698
27699static const _ExtendedGDBusMethodInfo * const _host_ipmi_method_info_pointers[] =
27700{
27701 &_host_ipmi_method_info_send_message,
27702 NULL
27703};
27704
27705static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_seq =
27706{
27707 {
27708 -1,
27709 (gchar *) "seq",
27710 (gchar *) "y",
27711 NULL
27712 },
27713 FALSE
27714};
27715
27716static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_netfn =
27717{
27718 {
27719 -1,
27720 (gchar *) "netfn",
27721 (gchar *) "y",
27722 NULL
27723 },
27724 FALSE
27725};
27726
27727static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_cmd =
27728{
27729 {
27730 -1,
27731 (gchar *) "cmd",
27732 (gchar *) "y",
27733 NULL
27734 },
27735 FALSE
27736};
27737
27738static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_data =
27739{
27740 {
27741 -1,
27742 (gchar *) "data",
27743 (gchar *) "ay",
27744 NULL
27745 },
27746 FALSE
27747};
27748
27749static const _ExtendedGDBusArgInfo * const _host_ipmi_signal_info_received_message_ARG_pointers[] =
27750{
27751 &_host_ipmi_signal_info_received_message_ARG_seq,
27752 &_host_ipmi_signal_info_received_message_ARG_netfn,
27753 &_host_ipmi_signal_info_received_message_ARG_cmd,
27754 &_host_ipmi_signal_info_received_message_ARG_data,
27755 NULL
27756};
27757
27758static const _ExtendedGDBusSignalInfo _host_ipmi_signal_info_received_message =
27759{
27760 {
27761 -1,
27762 (gchar *) "ReceivedMessage",
27763 (GDBusArgInfo **) &_host_ipmi_signal_info_received_message_ARG_pointers,
27764 NULL
27765 },
27766 "received-message"
27767};
27768
27769static const _ExtendedGDBusSignalInfo * const _host_ipmi_signal_info_pointers[] =
27770{
27771 &_host_ipmi_signal_info_received_message,
27772 NULL
27773};
27774
27775static const _ExtendedGDBusInterfaceInfo _host_ipmi_interface_info =
27776{
27777 {
27778 -1,
27779 (gchar *) "org.openbmc.HostIpmi",
27780 (GDBusMethodInfo **) &_host_ipmi_method_info_pointers,
27781 (GDBusSignalInfo **) &_host_ipmi_signal_info_pointers,
27782 NULL,
27783 NULL
27784 },
27785 "host-ipmi",
27786};
27787
27788
27789/**
27790 * host_ipmi_interface_info:
27791 *
27792 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> D-Bus interface.
27793 *
27794 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
27795 */
27796GDBusInterfaceInfo *
27797host_ipmi_interface_info (void)
27798{
27799 return (GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct;
27800}
27801
27802/**
27803 * host_ipmi_override_properties:
27804 * @klass: The class structure for a #GObject<!-- -->-derived class.
27805 * @property_id_begin: The property id to assign to the first overridden property.
27806 *
27807 * Overrides all #GObject properties in the #HostIpmi interface for a concrete class.
27808 * The properties are overridden in the order they are defined.
27809 *
27810 * Returns: The last property id.
27811 */
27812guint
27813host_ipmi_override_properties (GObjectClass *klass, guint property_id_begin)
27814{
27815 return property_id_begin - 1;
27816}
27817
27818
27819
27820/**
27821 * HostIpmi:
27822 *
27823 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
27824 */
27825
27826/**
27827 * HostIpmiIface:
27828 * @parent_iface: The parent interface.
27829 * @handle_send_message: Handler for the #HostIpmi::handle-send-message signal.
27830 * @received_message: Handler for the #HostIpmi::received-message signal.
27831 *
27832 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
27833 */
27834
27835typedef HostIpmiIface HostIpmiInterface;
27836G_DEFINE_INTERFACE (HostIpmi, host_ipmi, G_TYPE_OBJECT);
27837
27838static void
27839host_ipmi_default_init (HostIpmiIface *iface)
27840{
27841 /* GObject signals for incoming D-Bus method calls: */
27842 /**
27843 * HostIpmi::handle-send-message:
27844 * @object: A #HostIpmi.
27845 * @invocation: A #GDBusMethodInvocation.
27846 * @arg_seq: Argument passed by remote caller.
27847 * @arg_netfn: Argument passed by remote caller.
27848 * @arg_cmd: Argument passed by remote caller.
27849 * @arg_data: Argument passed by remote caller.
27850 *
27851 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method.
27852 *
27853 * 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 host_ipmi_complete_send_message() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
27854 *
27855 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
27856 */
27857 g_signal_new ("handle-send-message",
27858 G_TYPE_FROM_INTERFACE (iface),
27859 G_SIGNAL_RUN_LAST,
27860 G_STRUCT_OFFSET (HostIpmiIface, handle_send_message),
27861 g_signal_accumulator_true_handled,
27862 NULL,
27863 g_cclosure_marshal_generic,
27864 G_TYPE_BOOLEAN,
27865 5,
27866 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING);
27867
27868 /* GObject signals for received D-Bus signals: */
27869 /**
27870 * HostIpmi::received-message:
27871 * @object: A #HostIpmi.
27872 * @arg_seq: Argument.
27873 * @arg_netfn: Argument.
27874 * @arg_cmd: Argument.
27875 * @arg_data: Argument.
27876 *
27877 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-HostIpmi.ReceivedMessage">"ReceivedMessage"</link> is received.
27878 *
27879 * 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.
27880 */
27881 g_signal_new ("received-message",
27882 G_TYPE_FROM_INTERFACE (iface),
27883 G_SIGNAL_RUN_LAST,
27884 G_STRUCT_OFFSET (HostIpmiIface, received_message),
27885 NULL,
27886 NULL,
27887 g_cclosure_marshal_generic,
27888 G_TYPE_NONE,
27889 4, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING);
27890
27891}
27892
27893/**
27894 * host_ipmi_emit_received_message:
27895 * @object: A #HostIpmi.
27896 * @arg_seq: Argument to pass with the signal.
27897 * @arg_netfn: Argument to pass with the signal.
27898 * @arg_cmd: Argument to pass with the signal.
27899 * @arg_data: Argument to pass with the signal.
27900 *
27901 * Emits the <link linkend="gdbus-signal-org-openbmc-HostIpmi.ReceivedMessage">"ReceivedMessage"</link> D-Bus signal.
27902 */
27903void
27904host_ipmi_emit_received_message (
27905 HostIpmi *object,
27906 guchar arg_seq,
27907 guchar arg_netfn,
27908 guchar arg_cmd,
27909 const gchar *arg_data)
27910{
27911 g_signal_emit_by_name (object, "received-message", arg_seq, arg_netfn, arg_cmd, arg_data);
27912}
27913
27914/**
27915 * host_ipmi_call_send_message:
27916 * @proxy: A #HostIpmiProxy.
27917 * @arg_seq: Argument to pass with the method invocation.
27918 * @arg_netfn: Argument to pass with the method invocation.
27919 * @arg_cmd: Argument to pass with the method invocation.
27920 * @arg_data: Argument to pass with the method invocation.
27921 * @cancellable: (allow-none): A #GCancellable or %NULL.
27922 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
27923 * @user_data: User data to pass to @callback.
27924 *
27925 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method on @proxy.
27926 * 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.
27927 * You can then call host_ipmi_call_send_message_finish() to get the result of the operation.
27928 *
27929 * See host_ipmi_call_send_message_sync() for the synchronous, blocking version of this method.
27930 */
27931void
27932host_ipmi_call_send_message (
27933 HostIpmi *proxy,
27934 guchar arg_seq,
27935 guchar arg_netfn,
27936 guchar arg_cmd,
27937 const gchar *arg_data,
27938 GCancellable *cancellable,
27939 GAsyncReadyCallback callback,
27940 gpointer user_data)
27941{
27942 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
27943 "sendMessage",
27944 g_variant_new ("(yyy^ay)",
27945 arg_seq,
27946 arg_netfn,
27947 arg_cmd,
27948 arg_data),
27949 G_DBUS_CALL_FLAGS_NONE,
27950 -1,
27951 cancellable,
27952 callback,
27953 user_data);
27954}
27955
27956/**
27957 * host_ipmi_call_send_message_finish:
27958 * @proxy: A #HostIpmiProxy.
27959 * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore.
27960 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_call_send_message().
27961 * @error: Return location for error or %NULL.
27962 *
27963 * Finishes an operation started with host_ipmi_call_send_message().
27964 *
27965 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
27966 */
27967gboolean
27968host_ipmi_call_send_message_finish (
27969 HostIpmi *proxy,
27970 gint64 *out_unnamed_arg4,
27971 GAsyncResult *res,
27972 GError **error)
27973{
27974 GVariant *_ret;
27975 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
27976 if (_ret == NULL)
27977 goto _out;
27978 g_variant_get (_ret,
27979 "(x)",
27980 out_unnamed_arg4);
27981 g_variant_unref (_ret);
27982_out:
27983 return _ret != NULL;
27984}
27985
27986/**
27987 * host_ipmi_call_send_message_sync:
27988 * @proxy: A #HostIpmiProxy.
27989 * @arg_seq: Argument to pass with the method invocation.
27990 * @arg_netfn: Argument to pass with the method invocation.
27991 * @arg_cmd: Argument to pass with the method invocation.
27992 * @arg_data: Argument to pass with the method invocation.
27993 * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore.
27994 * @cancellable: (allow-none): A #GCancellable or %NULL.
27995 * @error: Return location for error or %NULL.
27996 *
27997 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
27998 *
27999 * See host_ipmi_call_send_message() for the asynchronous version of this method.
28000 *
28001 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
28002 */
28003gboolean
28004host_ipmi_call_send_message_sync (
28005 HostIpmi *proxy,
28006 guchar arg_seq,
28007 guchar arg_netfn,
28008 guchar arg_cmd,
28009 const gchar *arg_data,
28010 gint64 *out_unnamed_arg4,
28011 GCancellable *cancellable,
28012 GError **error)
28013{
28014 GVariant *_ret;
28015 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
28016 "sendMessage",
28017 g_variant_new ("(yyy^ay)",
28018 arg_seq,
28019 arg_netfn,
28020 arg_cmd,
28021 arg_data),
28022 G_DBUS_CALL_FLAGS_NONE,
28023 -1,
28024 cancellable,
28025 error);
28026 if (_ret == NULL)
28027 goto _out;
28028 g_variant_get (_ret,
28029 "(x)",
28030 out_unnamed_arg4);
28031 g_variant_unref (_ret);
28032_out:
28033 return _ret != NULL;
28034}
28035
28036/**
28037 * host_ipmi_complete_send_message:
28038 * @object: A #HostIpmi.
28039 * @invocation: (transfer full): A #GDBusMethodInvocation.
28040 * @unnamed_arg4: Parameter to return.
28041 *
28042 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</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.
28043 *
28044 * This method will free @invocation, you cannot use it afterwards.
28045 */
28046void
28047host_ipmi_complete_send_message (
28048 HostIpmi *object,
28049 GDBusMethodInvocation *invocation,
28050 gint64 unnamed_arg4)
28051{
28052 g_dbus_method_invocation_return_value (invocation,
28053 g_variant_new ("(x)",
28054 unnamed_arg4));
28055}
28056
28057/* ------------------------------------------------------------------------ */
28058
28059/**
28060 * HostIpmiProxy:
28061 *
28062 * The #HostIpmiProxy structure contains only private data and should only be accessed using the provided API.
28063 */
28064
28065/**
28066 * HostIpmiProxyClass:
28067 * @parent_class: The parent class.
28068 *
28069 * Class structure for #HostIpmiProxy.
28070 */
28071
28072struct _HostIpmiProxyPrivate
28073{
28074 GData *qdata;
28075};
28076
28077static void host_ipmi_proxy_iface_init (HostIpmiIface *iface);
28078
28079#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
28080G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY,
28081 G_ADD_PRIVATE (HostIpmiProxy)
28082 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init));
28083
28084#else
28085G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY,
28086 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init));
28087
28088#endif
28089static void
28090host_ipmi_proxy_finalize (GObject *object)
28091{
28092 HostIpmiProxy *proxy = HOST_IPMI_PROXY (object);
28093 g_datalist_clear (&proxy->priv->qdata);
28094 G_OBJECT_CLASS (host_ipmi_proxy_parent_class)->finalize (object);
28095}
28096
28097static void
28098host_ipmi_proxy_get_property (GObject *object,
28099 guint prop_id,
28100 GValue *value,
28101 GParamSpec *pspec G_GNUC_UNUSED)
28102{
28103}
28104
28105static void
28106host_ipmi_proxy_set_property (GObject *object,
28107 guint prop_id,
28108 const GValue *value,
28109 GParamSpec *pspec G_GNUC_UNUSED)
28110{
28111}
28112
28113static void
28114host_ipmi_proxy_g_signal (GDBusProxy *proxy,
28115 const gchar *sender_name G_GNUC_UNUSED,
28116 const gchar *signal_name,
28117 GVariant *parameters)
28118{
28119 _ExtendedGDBusSignalInfo *info;
28120 GVariantIter iter;
28121 GVariant *child;
28122 GValue *paramv;
28123 guint num_params;
28124 guint n;
28125 guint signal_id;
28126 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, signal_name);
28127 if (info == NULL)
28128 return;
28129 num_params = g_variant_n_children (parameters);
28130 paramv = g_new0 (GValue, num_params + 1);
28131 g_value_init (&paramv[0], TYPE_HOST_IPMI);
28132 g_value_set_object (&paramv[0], proxy);
28133 g_variant_iter_init (&iter, parameters);
28134 n = 1;
28135 while ((child = g_variant_iter_next_value (&iter)) != NULL)
28136 {
28137 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
28138 if (arg_info->use_gvariant)
28139 {
28140 g_value_init (&paramv[n], G_TYPE_VARIANT);
28141 g_value_set_variant (&paramv[n], child);
28142 n++;
28143 }
28144 else
28145 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
28146 g_variant_unref (child);
28147 }
28148 signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI);
28149 g_signal_emitv (paramv, signal_id, 0, NULL);
28150 for (n = 0; n < num_params + 1; n++)
28151 g_value_unset (&paramv[n]);
28152 g_free (paramv);
28153}
28154
28155static void
28156host_ipmi_proxy_g_properties_changed (GDBusProxy *_proxy,
28157 GVariant *changed_properties,
28158 const gchar *const *invalidated_properties)
28159{
28160 HostIpmiProxy *proxy = HOST_IPMI_PROXY (_proxy);
28161 guint n;
28162 const gchar *key;
28163 GVariantIter *iter;
28164 _ExtendedGDBusPropertyInfo *info;
28165 g_variant_get (changed_properties, "a{sv}", &iter);
28166 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
28167 {
28168 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, key);
28169 g_datalist_remove_data (&proxy->priv->qdata, key);
28170 if (info != NULL)
28171 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
28172 }
28173 g_variant_iter_free (iter);
28174 for (n = 0; invalidated_properties[n] != NULL; n++)
28175 {
28176 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, invalidated_properties[n]);
28177 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
28178 if (info != NULL)
28179 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
28180 }
28181}
28182
28183static void
28184host_ipmi_proxy_init (HostIpmiProxy *proxy)
28185{
28186#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
28187 proxy->priv = host_ipmi_proxy_get_instance_private (proxy);
28188#else
28189 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_HOST_IPMI_PROXY, HostIpmiProxyPrivate);
28190#endif
28191
28192 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), host_ipmi_interface_info ());
28193}
28194
28195static void
28196host_ipmi_proxy_class_init (HostIpmiProxyClass *klass)
28197{
28198 GObjectClass *gobject_class;
28199 GDBusProxyClass *proxy_class;
28200
28201 gobject_class = G_OBJECT_CLASS (klass);
28202 gobject_class->finalize = host_ipmi_proxy_finalize;
28203 gobject_class->get_property = host_ipmi_proxy_get_property;
28204 gobject_class->set_property = host_ipmi_proxy_set_property;
28205
28206 proxy_class = G_DBUS_PROXY_CLASS (klass);
28207 proxy_class->g_signal = host_ipmi_proxy_g_signal;
28208 proxy_class->g_properties_changed = host_ipmi_proxy_g_properties_changed;
28209
28210#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
28211 g_type_class_add_private (klass, sizeof (HostIpmiProxyPrivate));
28212#endif
28213}
28214
28215static void
28216host_ipmi_proxy_iface_init (HostIpmiIface *iface)
28217{
28218}
28219
28220/**
28221 * host_ipmi_proxy_new:
28222 * @connection: A #GDBusConnection.
28223 * @flags: Flags from the #GDBusProxyFlags enumeration.
28224 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
28225 * @object_path: An object path.
28226 * @cancellable: (allow-none): A #GCancellable or %NULL.
28227 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
28228 * @user_data: User data to pass to @callback.
28229 *
28230 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>. See g_dbus_proxy_new() for more details.
28231 *
28232 * 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.
28233 * You can then call host_ipmi_proxy_new_finish() to get the result of the operation.
28234 *
28235 * See host_ipmi_proxy_new_sync() for the synchronous, blocking version of this constructor.
28236 */
28237void
28238host_ipmi_proxy_new (
28239 GDBusConnection *connection,
28240 GDBusProxyFlags flags,
28241 const gchar *name,
28242 const gchar *object_path,
28243 GCancellable *cancellable,
28244 GAsyncReadyCallback callback,
28245 gpointer user_data)
28246{
28247 g_async_initable_new_async (TYPE_HOST_IPMI_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.HostIpmi", NULL);
28248}
28249
28250/**
28251 * host_ipmi_proxy_new_finish:
28252 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new().
28253 * @error: Return location for error or %NULL
28254 *
28255 * Finishes an operation started with host_ipmi_proxy_new().
28256 *
28257 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
28258 */
28259HostIpmi *
28260host_ipmi_proxy_new_finish (
28261 GAsyncResult *res,
28262 GError **error)
28263{
28264 GObject *ret;
28265 GObject *source_object;
28266 source_object = g_async_result_get_source_object (res);
28267 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
28268 g_object_unref (source_object);
28269 if (ret != NULL)
28270 return HOST_IPMI (ret);
28271 else
28272 return NULL;
28273}
28274
28275/**
28276 * host_ipmi_proxy_new_sync:
28277 * @connection: A #GDBusConnection.
28278 * @flags: Flags from the #GDBusProxyFlags enumeration.
28279 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
28280 * @object_path: An object path.
28281 * @cancellable: (allow-none): A #GCancellable or %NULL.
28282 * @error: Return location for error or %NULL
28283 *
28284 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>. See g_dbus_proxy_new_sync() for more details.
28285 *
28286 * The calling thread is blocked until a reply is received.
28287 *
28288 * See host_ipmi_proxy_new() for the asynchronous version of this constructor.
28289 *
28290 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
28291 */
28292HostIpmi *
28293host_ipmi_proxy_new_sync (
28294 GDBusConnection *connection,
28295 GDBusProxyFlags flags,
28296 const gchar *name,
28297 const gchar *object_path,
28298 GCancellable *cancellable,
28299 GError **error)
28300{
28301 GInitable *ret;
28302 ret = g_initable_new (TYPE_HOST_IPMI_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.HostIpmi", NULL);
28303 if (ret != NULL)
28304 return HOST_IPMI (ret);
28305 else
28306 return NULL;
28307}
28308
28309
28310/**
28311 * host_ipmi_proxy_new_for_bus:
28312 * @bus_type: A #GBusType.
28313 * @flags: Flags from the #GDBusProxyFlags enumeration.
28314 * @name: A bus name (well-known or unique).
28315 * @object_path: An object path.
28316 * @cancellable: (allow-none): A #GCancellable or %NULL.
28317 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
28318 * @user_data: User data to pass to @callback.
28319 *
28320 * Like host_ipmi_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
28321 *
28322 * 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.
28323 * You can then call host_ipmi_proxy_new_for_bus_finish() to get the result of the operation.
28324 *
28325 * See host_ipmi_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
28326 */
28327void
28328host_ipmi_proxy_new_for_bus (
28329 GBusType bus_type,
28330 GDBusProxyFlags flags,
28331 const gchar *name,
28332 const gchar *object_path,
28333 GCancellable *cancellable,
28334 GAsyncReadyCallback callback,
28335 gpointer user_data)
28336{
28337 g_async_initable_new_async (TYPE_HOST_IPMI_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.HostIpmi", NULL);
28338}
28339
28340/**
28341 * host_ipmi_proxy_new_for_bus_finish:
28342 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new_for_bus().
28343 * @error: Return location for error or %NULL
28344 *
28345 * Finishes an operation started with host_ipmi_proxy_new_for_bus().
28346 *
28347 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
28348 */
28349HostIpmi *
28350host_ipmi_proxy_new_for_bus_finish (
28351 GAsyncResult *res,
28352 GError **error)
28353{
28354 GObject *ret;
28355 GObject *source_object;
28356 source_object = g_async_result_get_source_object (res);
28357 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
28358 g_object_unref (source_object);
28359 if (ret != NULL)
28360 return HOST_IPMI (ret);
28361 else
28362 return NULL;
28363}
28364
28365/**
28366 * host_ipmi_proxy_new_for_bus_sync:
28367 * @bus_type: A #GBusType.
28368 * @flags: Flags from the #GDBusProxyFlags enumeration.
28369 * @name: A bus name (well-known or unique).
28370 * @object_path: An object path.
28371 * @cancellable: (allow-none): A #GCancellable or %NULL.
28372 * @error: Return location for error or %NULL
28373 *
28374 * Like host_ipmi_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
28375 *
28376 * The calling thread is blocked until a reply is received.
28377 *
28378 * See host_ipmi_proxy_new_for_bus() for the asynchronous version of this constructor.
28379 *
28380 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
28381 */
28382HostIpmi *
28383host_ipmi_proxy_new_for_bus_sync (
28384 GBusType bus_type,
28385 GDBusProxyFlags flags,
28386 const gchar *name,
28387 const gchar *object_path,
28388 GCancellable *cancellable,
28389 GError **error)
28390{
28391 GInitable *ret;
28392 ret = g_initable_new (TYPE_HOST_IPMI_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.HostIpmi", NULL);
28393 if (ret != NULL)
28394 return HOST_IPMI (ret);
28395 else
28396 return NULL;
28397}
28398
28399
28400/* ------------------------------------------------------------------------ */
28401
28402/**
28403 * HostIpmiSkeleton:
28404 *
28405 * The #HostIpmiSkeleton structure contains only private data and should only be accessed using the provided API.
28406 */
28407
28408/**
28409 * HostIpmiSkeletonClass:
28410 * @parent_class: The parent class.
28411 *
28412 * Class structure for #HostIpmiSkeleton.
28413 */
28414
28415struct _HostIpmiSkeletonPrivate
28416{
28417 GValue *properties;
28418 GList *changed_properties;
28419 GSource *changed_properties_idle_source;
28420 GMainContext *context;
28421 GMutex lock;
28422};
28423
28424static void
28425_host_ipmi_skeleton_handle_method_call (
28426 GDBusConnection *connection G_GNUC_UNUSED,
28427 const gchar *sender G_GNUC_UNUSED,
28428 const gchar *object_path G_GNUC_UNUSED,
28429 const gchar *interface_name,
28430 const gchar *method_name,
28431 GVariant *parameters,
28432 GDBusMethodInvocation *invocation,
28433 gpointer user_data)
28434{
28435 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
28436 _ExtendedGDBusMethodInfo *info;
28437 GVariantIter iter;
28438 GVariant *child;
28439 GValue *paramv;
28440 guint num_params;
28441 guint num_extra;
28442 guint n;
28443 guint signal_id;
28444 GValue return_value = G_VALUE_INIT;
28445 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
28446 g_assert (info != NULL);
28447 num_params = g_variant_n_children (parameters);
28448 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
28449 n = 0;
28450 g_value_init (&paramv[n], TYPE_HOST_IPMI);
28451 g_value_set_object (&paramv[n++], skeleton);
28452 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
28453 g_value_set_object (&paramv[n++], invocation);
28454 if (info->pass_fdlist)
28455 {
28456#ifdef G_OS_UNIX
28457 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
28458 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
28459#else
28460 g_assert_not_reached ();
28461#endif
28462 }
28463 g_variant_iter_init (&iter, parameters);
28464 while ((child = g_variant_iter_next_value (&iter)) != NULL)
28465 {
28466 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
28467 if (arg_info->use_gvariant)
28468 {
28469 g_value_init (&paramv[n], G_TYPE_VARIANT);
28470 g_value_set_variant (&paramv[n], child);
28471 n++;
28472 }
28473 else
28474 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
28475 g_variant_unref (child);
28476 }
28477 signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI);
28478 g_value_init (&return_value, G_TYPE_BOOLEAN);
28479 g_signal_emitv (paramv, signal_id, 0, &return_value);
28480 if (!g_value_get_boolean (&return_value))
28481 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);
28482 g_value_unset (&return_value);
28483 for (n = 0; n < num_params + num_extra; n++)
28484 g_value_unset (&paramv[n]);
28485 g_free (paramv);
28486}
28487
28488static GVariant *
28489_host_ipmi_skeleton_handle_get_property (
28490 GDBusConnection *connection G_GNUC_UNUSED,
28491 const gchar *sender G_GNUC_UNUSED,
28492 const gchar *object_path G_GNUC_UNUSED,
28493 const gchar *interface_name G_GNUC_UNUSED,
28494 const gchar *property_name,
28495 GError **error,
28496 gpointer user_data)
28497{
28498 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
28499 GValue value = G_VALUE_INIT;
28500 GParamSpec *pspec;
28501 _ExtendedGDBusPropertyInfo *info;
28502 GVariant *ret;
28503 ret = NULL;
28504 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name);
28505 g_assert (info != NULL);
28506 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
28507 if (pspec == NULL)
28508 {
28509 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
28510 }
28511 else
28512 {
28513 g_value_init (&value, pspec->value_type);
28514 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
28515 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
28516 g_value_unset (&value);
28517 }
28518 return ret;
28519}
28520
28521static gboolean
28522_host_ipmi_skeleton_handle_set_property (
28523 GDBusConnection *connection G_GNUC_UNUSED,
28524 const gchar *sender G_GNUC_UNUSED,
28525 const gchar *object_path G_GNUC_UNUSED,
28526 const gchar *interface_name G_GNUC_UNUSED,
28527 const gchar *property_name,
28528 GVariant *variant,
28529 GError **error,
28530 gpointer user_data)
28531{
28532 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
28533 GValue value = G_VALUE_INIT;
28534 GParamSpec *pspec;
28535 _ExtendedGDBusPropertyInfo *info;
28536 gboolean ret;
28537 ret = FALSE;
28538 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name);
28539 g_assert (info != NULL);
28540 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
28541 if (pspec == NULL)
28542 {
28543 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
28544 }
28545 else
28546 {
28547 if (info->use_gvariant)
28548 g_value_set_variant (&value, variant);
28549 else
28550 g_dbus_gvariant_to_gvalue (variant, &value);
28551 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
28552 g_value_unset (&value);
28553 ret = TRUE;
28554 }
28555 return ret;
28556}
28557
28558static const GDBusInterfaceVTable _host_ipmi_skeleton_vtable =
28559{
28560 _host_ipmi_skeleton_handle_method_call,
28561 _host_ipmi_skeleton_handle_get_property,
28562 _host_ipmi_skeleton_handle_set_property,
28563 {NULL}
28564};
28565
28566static GDBusInterfaceInfo *
28567host_ipmi_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
28568{
28569 return host_ipmi_interface_info ();
28570}
28571
28572static GDBusInterfaceVTable *
28573host_ipmi_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
28574{
28575 return (GDBusInterfaceVTable *) &_host_ipmi_skeleton_vtable;
28576}
28577
28578static GVariant *
28579host_ipmi_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
28580{
28581 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (_skeleton);
28582
28583 GVariantBuilder builder;
28584 guint n;
28585 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
28586 if (_host_ipmi_interface_info.parent_struct.properties == NULL)
28587 goto out;
28588 for (n = 0; _host_ipmi_interface_info.parent_struct.properties[n] != NULL; n++)
28589 {
28590 GDBusPropertyInfo *info = _host_ipmi_interface_info.parent_struct.properties[n];
28591 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
28592 {
28593 GVariant *value;
28594 value = _host_ipmi_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.HostIpmi", info->name, NULL, skeleton);
28595 if (value != NULL)
28596 {
28597 g_variant_take_ref (value);
28598 g_variant_builder_add (&builder, "{sv}", info->name, value);
28599 g_variant_unref (value);
28600 }
28601 }
28602 }
28603out:
28604 return g_variant_builder_end (&builder);
28605}
28606
28607static void
28608host_ipmi_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
28609{
28610}
28611
28612static void
28613_host_ipmi_on_signal_received_message (
28614 HostIpmi *object,
28615 guchar arg_seq,
28616 guchar arg_netfn,
28617 guchar arg_cmd,
28618 const gchar *arg_data)
28619{
28620 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object);
28621
28622 GList *connections, *l;
28623 GVariant *signal_variant;
28624 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
28625
28626 signal_variant = g_variant_ref_sink (g_variant_new ("(yyy^ay)",
28627 arg_seq,
28628 arg_netfn,
28629 arg_cmd,
28630 arg_data));
28631 for (l = connections; l != NULL; l = l->next)
28632 {
28633 GDBusConnection *connection = l->data;
28634 g_dbus_connection_emit_signal (connection,
28635 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.HostIpmi", "ReceivedMessage",
28636 signal_variant, NULL);
28637 }
28638 g_variant_unref (signal_variant);
28639 g_list_free_full (connections, g_object_unref);
28640}
28641
28642static void host_ipmi_skeleton_iface_init (HostIpmiIface *iface);
28643#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
28644G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
28645 G_ADD_PRIVATE (HostIpmiSkeleton)
28646 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init));
28647
28648#else
28649G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
28650 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init));
28651
28652#endif
28653static void
28654host_ipmi_skeleton_finalize (GObject *object)
28655{
28656 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object);
28657 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
28658 if (skeleton->priv->changed_properties_idle_source != NULL)
28659 g_source_destroy (skeleton->priv->changed_properties_idle_source);
28660 g_main_context_unref (skeleton->priv->context);
28661 g_mutex_clear (&skeleton->priv->lock);
28662 G_OBJECT_CLASS (host_ipmi_skeleton_parent_class)->finalize (object);
28663}
28664
28665static void
28666host_ipmi_skeleton_init (HostIpmiSkeleton *skeleton)
28667{
28668#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
28669 skeleton->priv = host_ipmi_skeleton_get_instance_private (skeleton);
28670#else
28671 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_HOST_IPMI_SKELETON, HostIpmiSkeletonPrivate);
28672#endif
28673
28674 g_mutex_init (&skeleton->priv->lock);
28675 skeleton->priv->context = g_main_context_ref_thread_default ();
28676}
28677
28678static void
28679host_ipmi_skeleton_class_init (HostIpmiSkeletonClass *klass)
28680{
28681 GObjectClass *gobject_class;
28682 GDBusInterfaceSkeletonClass *skeleton_class;
28683
28684 gobject_class = G_OBJECT_CLASS (klass);
28685 gobject_class->finalize = host_ipmi_skeleton_finalize;
28686
28687 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
28688 skeleton_class->get_info = host_ipmi_skeleton_dbus_interface_get_info;
28689 skeleton_class->get_properties = host_ipmi_skeleton_dbus_interface_get_properties;
28690 skeleton_class->flush = host_ipmi_skeleton_dbus_interface_flush;
28691 skeleton_class->get_vtable = host_ipmi_skeleton_dbus_interface_get_vtable;
28692
28693#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
28694 g_type_class_add_private (klass, sizeof (HostIpmiSkeletonPrivate));
28695#endif
28696}
28697
28698static void
28699host_ipmi_skeleton_iface_init (HostIpmiIface *iface)
28700{
28701 iface->received_message = _host_ipmi_on_signal_received_message;
28702}
28703
28704/**
28705 * host_ipmi_skeleton_new:
28706 *
28707 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
28708 *
28709 * Returns: (transfer full) (type HostIpmiSkeleton): The skeleton object.
28710 */
28711HostIpmi *
28712host_ipmi_skeleton_new (void)
28713{
28714 return HOST_IPMI (g_object_new (TYPE_HOST_IPMI_SKELETON, NULL));
28715}
28716
28717/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050028718 * Code for Object, ObjectProxy and ObjectSkeleton
28719 * ------------------------------------------------------------------------
28720 */
28721
28722/**
28723 * SECTION:Object
28724 * @title: Object
28725 * @short_description: Specialized GDBusObject types
28726 *
28727 * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
28728 */
28729
28730/**
28731 * Object:
28732 *
28733 * The #Object type is a specialized container of interfaces.
28734 */
28735
28736/**
28737 * ObjectIface:
28738 * @parent_iface: The parent interface.
28739 *
28740 * Virtual table for the #Object interface.
28741 */
28742
28743typedef ObjectIface ObjectInterface;
28744G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));
28745
28746static void
28747object_default_init (ObjectIface *iface)
28748{
28749 /**
Norman James362a80f2015-09-14 14:04:39 -050028750 * Object:fan:
28751 *
28752 * 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.
28753 *
28754 * Connect to the #GObject::notify signal to get informed of property changes.
28755 */
28756 g_object_interface_install_property (iface, g_param_spec_object ("fan", "fan", "fan", TYPE_FAN, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
28757
28758 /**
28759 * Object:sensor-value:
28760 *
28761 * 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.
28762 *
28763 * Connect to the #GObject::notify signal to get informed of property changes.
28764 */
28765 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));
28766
28767 /**
28768 * Object:sensor-threshold:
28769 *
28770 * 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.
28771 *
28772 * Connect to the #GObject::notify signal to get informed of property changes.
28773 */
28774 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));
28775
28776 /**
28777 * Object:sensor-i2c:
28778 *
28779 * 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.
28780 *
28781 * Connect to the #GObject::notify signal to get informed of property changes.
28782 */
28783 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));
28784
28785 /**
28786 * Object:sensor-match:
28787 *
28788 * 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.
28789 *
28790 * Connect to the #GObject::notify signal to get informed of property changes.
28791 */
28792 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));
28793
28794 /**
28795 * Object:process:
28796 *
28797 * 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.
28798 *
28799 * Connect to the #GObject::notify signal to get informed of property changes.
28800 */
28801 g_object_interface_install_property (iface, g_param_spec_object ("process", "process", "process", TYPE_PROCESS, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
28802
28803 /**
Norman James18998182015-10-11 21:54:53 -050028804 * Object:shared-resource:
28805 *
28806 * The #SharedResource instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>, if any.
28807 *
28808 * Connect to the #GObject::notify signal to get informed of property changes.
28809 */
28810 g_object_interface_install_property (iface, g_param_spec_object ("shared-resource", "shared-resource", "shared-resource", TYPE_SHARED_RESOURCE, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
28811
28812 /**
Norman James362a80f2015-09-14 14:04:39 -050028813 * Object:control:
28814 *
28815 * 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.
28816 *
28817 * Connect to the #GObject::notify signal to get informed of property changes.
28818 */
28819 g_object_interface_install_property (iface, g_param_spec_object ("control", "control", "control", TYPE_CONTROL, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
28820
28821 /**
28822 * Object:control-bmc:
28823 *
28824 * 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.
28825 *
28826 * Connect to the #GObject::notify signal to get informed of property changes.
28827 */
28828 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));
28829
28830 /**
28831 * Object:control-host:
28832 *
28833 * 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.
28834 *
28835 * Connect to the #GObject::notify signal to get informed of property changes.
28836 */
28837 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));
28838
28839 /**
28840 * Object:control-power:
28841 *
28842 * 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.
28843 *
28844 * Connect to the #GObject::notify signal to get informed of property changes.
28845 */
28846 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));
28847
28848 /**
28849 * Object:watchdog:
28850 *
28851 * 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.
28852 *
28853 * Connect to the #GObject::notify signal to get informed of property changes.
28854 */
28855 g_object_interface_install_property (iface, g_param_spec_object ("watchdog", "watchdog", "watchdog", TYPE_WATCHDOG, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
28856
28857 /**
28858 * Object:event-log:
28859 *
28860 * 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.
28861 *
28862 * Connect to the #GObject::notify signal to get informed of property changes.
28863 */
28864 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));
28865
28866 /**
28867 * Object:flash:
28868 *
28869 * 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.
28870 *
28871 * Connect to the #GObject::notify signal to get informed of property changes.
28872 */
28873 g_object_interface_install_property (iface, g_param_spec_object ("flash", "flash", "flash", TYPE_FLASH, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
28874
28875 /**
Norman James18998182015-10-11 21:54:53 -050028876 * Object:flash-control:
28877 *
28878 * The #FlashControl instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>, if any.
28879 *
28880 * Connect to the #GObject::notify signal to get informed of property changes.
28881 */
28882 g_object_interface_install_property (iface, g_param_spec_object ("flash-control", "flash-control", "flash-control", TYPE_FLASH_CONTROL, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
28883
28884 /**
Norman James362a80f2015-09-14 14:04:39 -050028885 * Object:button:
28886 *
28887 * 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.
28888 *
28889 * Connect to the #GObject::notify signal to get informed of property changes.
28890 */
28891 g_object_interface_install_property (iface, g_param_spec_object ("button", "button", "button", TYPE_BUTTON, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
28892
28893 /**
28894 * Object:led:
28895 *
28896 * 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.
28897 *
28898 * Connect to the #GObject::notify signal to get informed of property changes.
28899 */
28900 g_object_interface_install_property (iface, g_param_spec_object ("led", "led", "led", TYPE_LED, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
28901
Norman Jamesdbcffbd2015-10-06 16:53:06 -050028902 /**
28903 * Object:host-ipmi:
28904 *
28905 * The #HostIpmi instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>, if any.
28906 *
28907 * Connect to the #GObject::notify signal to get informed of property changes.
28908 */
28909 g_object_interface_install_property (iface, g_param_spec_object ("host-ipmi", "host-ipmi", "host-ipmi", TYPE_HOST_IPMI, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
28910
Norman James362a80f2015-09-14 14:04:39 -050028911}
28912
28913/**
Norman James362a80f2015-09-14 14:04:39 -050028914 * object_get_fan:
28915 * @object: A #Object.
28916 *
28917 * 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.
28918 *
28919 * Returns: (transfer full): A #Fan that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28920 */
28921Fan *object_get_fan (Object *object)
28922{
28923 GDBusInterface *ret;
28924 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
28925 if (ret == NULL)
28926 return NULL;
28927 return FAN (ret);
28928}
28929
28930/**
28931 * object_get_sensor_value:
28932 * @object: A #Object.
28933 *
28934 * 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.
28935 *
28936 * Returns: (transfer full): A #SensorValue that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28937 */
28938SensorValue *object_get_sensor_value (Object *object)
28939{
28940 GDBusInterface *ret;
28941 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
28942 if (ret == NULL)
28943 return NULL;
28944 return SENSOR_VALUE (ret);
28945}
28946
28947/**
28948 * object_get_sensor_threshold:
28949 * @object: A #Object.
28950 *
28951 * 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.
28952 *
28953 * Returns: (transfer full): A #SensorThreshold that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28954 */
28955SensorThreshold *object_get_sensor_threshold (Object *object)
28956{
28957 GDBusInterface *ret;
28958 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
28959 if (ret == NULL)
28960 return NULL;
28961 return SENSOR_THRESHOLD (ret);
28962}
28963
28964/**
28965 * object_get_sensor_i2c:
28966 * @object: A #Object.
28967 *
28968 * 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.
28969 *
28970 * Returns: (transfer full): A #SensorI2c that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28971 */
28972SensorI2c *object_get_sensor_i2c (Object *object)
28973{
28974 GDBusInterface *ret;
28975 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
28976 if (ret == NULL)
28977 return NULL;
28978 return SENSOR_I2C (ret);
28979}
28980
28981/**
28982 * object_get_sensor_match:
28983 * @object: A #Object.
28984 *
28985 * 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.
28986 *
28987 * Returns: (transfer full): A #SensorMatch that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28988 */
28989SensorMatch *object_get_sensor_match (Object *object)
28990{
28991 GDBusInterface *ret;
28992 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
28993 if (ret == NULL)
28994 return NULL;
28995 return SENSOR_MATCH (ret);
28996}
28997
28998/**
28999 * object_get_process:
29000 * @object: A #Object.
29001 *
29002 * 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.
29003 *
29004 * Returns: (transfer full): A #Process that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
29005 */
29006Process *object_get_process (Object *object)
29007{
29008 GDBusInterface *ret;
29009 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
29010 if (ret == NULL)
29011 return NULL;
29012 return PROCESS (ret);
29013}
29014
29015/**
Norman James18998182015-10-11 21:54:53 -050029016 * object_get_shared_resource:
29017 * @object: A #Object.
29018 *
29019 * Gets the #SharedResource instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> on @object, if any.
29020 *
29021 * Returns: (transfer full): A #SharedResource that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
29022 */
29023SharedResource *object_get_shared_resource (Object *object)
29024{
29025 GDBusInterface *ret;
29026 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
29027 if (ret == NULL)
29028 return NULL;
29029 return SHARED_RESOURCE (ret);
29030}
29031
29032/**
Norman James362a80f2015-09-14 14:04:39 -050029033 * object_get_control:
29034 * @object: A #Object.
29035 *
29036 * 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.
29037 *
29038 * Returns: (transfer full): A #Control that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
29039 */
29040Control *object_get_control (Object *object)
29041{
29042 GDBusInterface *ret;
29043 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
29044 if (ret == NULL)
29045 return NULL;
29046 return CONTROL (ret);
29047}
29048
29049/**
29050 * object_get_control_bmc:
29051 * @object: A #Object.
29052 *
29053 * 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.
29054 *
29055 * Returns: (transfer full): A #ControlBmc that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
29056 */
29057ControlBmc *object_get_control_bmc (Object *object)
29058{
29059 GDBusInterface *ret;
29060 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
29061 if (ret == NULL)
29062 return NULL;
29063 return CONTROL_BMC (ret);
29064}
29065
29066/**
29067 * object_get_control_host:
29068 * @object: A #Object.
29069 *
29070 * 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.
29071 *
29072 * Returns: (transfer full): A #ControlHost that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
29073 */
29074ControlHost *object_get_control_host (Object *object)
29075{
29076 GDBusInterface *ret;
29077 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
29078 if (ret == NULL)
29079 return NULL;
29080 return CONTROL_HOST (ret);
29081}
29082
29083/**
29084 * object_get_control_power:
29085 * @object: A #Object.
29086 *
29087 * 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.
29088 *
29089 * Returns: (transfer full): A #ControlPower that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
29090 */
29091ControlPower *object_get_control_power (Object *object)
29092{
29093 GDBusInterface *ret;
29094 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
29095 if (ret == NULL)
29096 return NULL;
29097 return CONTROL_POWER (ret);
29098}
29099
29100/**
29101 * object_get_watchdog:
29102 * @object: A #Object.
29103 *
29104 * 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.
29105 *
29106 * Returns: (transfer full): A #Watchdog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
29107 */
29108Watchdog *object_get_watchdog (Object *object)
29109{
29110 GDBusInterface *ret;
29111 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
29112 if (ret == NULL)
29113 return NULL;
29114 return WATCHDOG (ret);
29115}
29116
29117/**
29118 * object_get_event_log:
29119 * @object: A #Object.
29120 *
29121 * 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.
29122 *
29123 * Returns: (transfer full): A #EventLog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
29124 */
29125EventLog *object_get_event_log (Object *object)
29126{
29127 GDBusInterface *ret;
29128 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
29129 if (ret == NULL)
29130 return NULL;
29131 return EVENT_LOG (ret);
29132}
29133
29134/**
29135 * object_get_flash:
29136 * @object: A #Object.
29137 *
29138 * 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.
29139 *
29140 * Returns: (transfer full): A #Flash that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
29141 */
29142Flash *object_get_flash (Object *object)
29143{
29144 GDBusInterface *ret;
29145 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
29146 if (ret == NULL)
29147 return NULL;
29148 return FLASH (ret);
29149}
29150
29151/**
Norman James18998182015-10-11 21:54:53 -050029152 * object_get_flash_control:
29153 * @object: A #Object.
29154 *
29155 * Gets the #FlashControl instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> on @object, if any.
29156 *
29157 * Returns: (transfer full): A #FlashControl that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
29158 */
29159FlashControl *object_get_flash_control (Object *object)
29160{
29161 GDBusInterface *ret;
29162 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
29163 if (ret == NULL)
29164 return NULL;
29165 return FLASH_CONTROL (ret);
29166}
29167
29168/**
Norman James362a80f2015-09-14 14:04:39 -050029169 * object_get_button:
29170 * @object: A #Object.
29171 *
29172 * 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.
29173 *
29174 * Returns: (transfer full): A #Button that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
29175 */
29176Button *object_get_button (Object *object)
29177{
29178 GDBusInterface *ret;
29179 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
29180 if (ret == NULL)
29181 return NULL;
29182 return BUTTON (ret);
29183}
29184
29185/**
29186 * object_get_led:
29187 * @object: A #Object.
29188 *
29189 * 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.
29190 *
29191 * Returns: (transfer full): A #Led that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
29192 */
29193Led *object_get_led (Object *object)
29194{
29195 GDBusInterface *ret;
29196 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
29197 if (ret == NULL)
29198 return NULL;
29199 return LED (ret);
29200}
29201
Norman Jamesdbcffbd2015-10-06 16:53:06 -050029202/**
29203 * object_get_host_ipmi:
29204 * @object: A #Object.
29205 *
29206 * Gets the #HostIpmi instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> on @object, if any.
29207 *
29208 * Returns: (transfer full): A #HostIpmi that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
29209 */
29210HostIpmi *object_get_host_ipmi (Object *object)
29211{
29212 GDBusInterface *ret;
29213 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
29214 if (ret == NULL)
29215 return NULL;
29216 return HOST_IPMI (ret);
29217}
29218
Norman James362a80f2015-09-14 14:04:39 -050029219
29220/**
Norman James362a80f2015-09-14 14:04:39 -050029221 * object_peek_fan: (skip)
29222 * @object: A #Object.
29223 *
29224 * Like object_get_fan() but doesn't increase the reference count on the returned object.
29225 *
29226 * <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>
29227 *
29228 * 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.
29229 */
29230Fan *object_peek_fan (Object *object)
29231{
29232 GDBusInterface *ret;
29233 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
29234 if (ret == NULL)
29235 return NULL;
29236 g_object_unref (ret);
29237 return FAN (ret);
29238}
29239
29240/**
29241 * object_peek_sensor_value: (skip)
29242 * @object: A #Object.
29243 *
29244 * Like object_get_sensor_value() but doesn't increase the reference count on the returned object.
29245 *
29246 * <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>
29247 *
29248 * 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.
29249 */
29250SensorValue *object_peek_sensor_value (Object *object)
29251{
29252 GDBusInterface *ret;
29253 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
29254 if (ret == NULL)
29255 return NULL;
29256 g_object_unref (ret);
29257 return SENSOR_VALUE (ret);
29258}
29259
29260/**
29261 * object_peek_sensor_threshold: (skip)
29262 * @object: A #Object.
29263 *
29264 * Like object_get_sensor_threshold() but doesn't increase the reference count on the returned object.
29265 *
29266 * <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>
29267 *
29268 * 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.
29269 */
29270SensorThreshold *object_peek_sensor_threshold (Object *object)
29271{
29272 GDBusInterface *ret;
29273 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
29274 if (ret == NULL)
29275 return NULL;
29276 g_object_unref (ret);
29277 return SENSOR_THRESHOLD (ret);
29278}
29279
29280/**
29281 * object_peek_sensor_i2c: (skip)
29282 * @object: A #Object.
29283 *
29284 * Like object_get_sensor_i2c() but doesn't increase the reference count on the returned object.
29285 *
29286 * <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>
29287 *
29288 * 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.
29289 */
29290SensorI2c *object_peek_sensor_i2c (Object *object)
29291{
29292 GDBusInterface *ret;
29293 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
29294 if (ret == NULL)
29295 return NULL;
29296 g_object_unref (ret);
29297 return SENSOR_I2C (ret);
29298}
29299
29300/**
29301 * object_peek_sensor_match: (skip)
29302 * @object: A #Object.
29303 *
29304 * Like object_get_sensor_match() but doesn't increase the reference count on the returned object.
29305 *
29306 * <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>
29307 *
29308 * 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.
29309 */
29310SensorMatch *object_peek_sensor_match (Object *object)
29311{
29312 GDBusInterface *ret;
29313 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
29314 if (ret == NULL)
29315 return NULL;
29316 g_object_unref (ret);
29317 return SENSOR_MATCH (ret);
29318}
29319
29320/**
29321 * object_peek_process: (skip)
29322 * @object: A #Object.
29323 *
29324 * Like object_get_process() but doesn't increase the reference count on the returned object.
29325 *
29326 * <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>
29327 *
29328 * 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.
29329 */
29330Process *object_peek_process (Object *object)
29331{
29332 GDBusInterface *ret;
29333 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
29334 if (ret == NULL)
29335 return NULL;
29336 g_object_unref (ret);
29337 return PROCESS (ret);
29338}
29339
29340/**
Norman James18998182015-10-11 21:54:53 -050029341 * object_peek_shared_resource: (skip)
29342 * @object: A #Object.
29343 *
29344 * Like object_get_shared_resource() but doesn't increase the reference count on the returned object.
29345 *
29346 * <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>
29347 *
29348 * Returns: (transfer none): A #SharedResource or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
29349 */
29350SharedResource *object_peek_shared_resource (Object *object)
29351{
29352 GDBusInterface *ret;
29353 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
29354 if (ret == NULL)
29355 return NULL;
29356 g_object_unref (ret);
29357 return SHARED_RESOURCE (ret);
29358}
29359
29360/**
Norman James362a80f2015-09-14 14:04:39 -050029361 * object_peek_control: (skip)
29362 * @object: A #Object.
29363 *
29364 * Like object_get_control() but doesn't increase the reference count on the returned object.
29365 *
29366 * <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>
29367 *
29368 * 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.
29369 */
29370Control *object_peek_control (Object *object)
29371{
29372 GDBusInterface *ret;
29373 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
29374 if (ret == NULL)
29375 return NULL;
29376 g_object_unref (ret);
29377 return CONTROL (ret);
29378}
29379
29380/**
29381 * object_peek_control_bmc: (skip)
29382 * @object: A #Object.
29383 *
29384 * Like object_get_control_bmc() but doesn't increase the reference count on the returned object.
29385 *
29386 * <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>
29387 *
29388 * 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.
29389 */
29390ControlBmc *object_peek_control_bmc (Object *object)
29391{
29392 GDBusInterface *ret;
29393 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
29394 if (ret == NULL)
29395 return NULL;
29396 g_object_unref (ret);
29397 return CONTROL_BMC (ret);
29398}
29399
29400/**
29401 * object_peek_control_host: (skip)
29402 * @object: A #Object.
29403 *
29404 * Like object_get_control_host() but doesn't increase the reference count on the returned object.
29405 *
29406 * <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>
29407 *
29408 * 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.
29409 */
29410ControlHost *object_peek_control_host (Object *object)
29411{
29412 GDBusInterface *ret;
29413 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
29414 if (ret == NULL)
29415 return NULL;
29416 g_object_unref (ret);
29417 return CONTROL_HOST (ret);
29418}
29419
29420/**
29421 * object_peek_control_power: (skip)
29422 * @object: A #Object.
29423 *
29424 * Like object_get_control_power() but doesn't increase the reference count on the returned object.
29425 *
29426 * <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>
29427 *
29428 * 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.
29429 */
29430ControlPower *object_peek_control_power (Object *object)
29431{
29432 GDBusInterface *ret;
29433 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
29434 if (ret == NULL)
29435 return NULL;
29436 g_object_unref (ret);
29437 return CONTROL_POWER (ret);
29438}
29439
29440/**
29441 * object_peek_watchdog: (skip)
29442 * @object: A #Object.
29443 *
29444 * Like object_get_watchdog() but doesn't increase the reference count on the returned object.
29445 *
29446 * <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>
29447 *
29448 * 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.
29449 */
29450Watchdog *object_peek_watchdog (Object *object)
29451{
29452 GDBusInterface *ret;
29453 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
29454 if (ret == NULL)
29455 return NULL;
29456 g_object_unref (ret);
29457 return WATCHDOG (ret);
29458}
29459
29460/**
29461 * object_peek_event_log: (skip)
29462 * @object: A #Object.
29463 *
29464 * Like object_get_event_log() but doesn't increase the reference count on the returned object.
29465 *
29466 * <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>
29467 *
29468 * 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.
29469 */
29470EventLog *object_peek_event_log (Object *object)
29471{
29472 GDBusInterface *ret;
29473 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
29474 if (ret == NULL)
29475 return NULL;
29476 g_object_unref (ret);
29477 return EVENT_LOG (ret);
29478}
29479
29480/**
29481 * object_peek_flash: (skip)
29482 * @object: A #Object.
29483 *
29484 * Like object_get_flash() but doesn't increase the reference count on the returned object.
29485 *
29486 * <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>
29487 *
29488 * 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.
29489 */
29490Flash *object_peek_flash (Object *object)
29491{
29492 GDBusInterface *ret;
29493 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
29494 if (ret == NULL)
29495 return NULL;
29496 g_object_unref (ret);
29497 return FLASH (ret);
29498}
29499
29500/**
Norman James18998182015-10-11 21:54:53 -050029501 * object_peek_flash_control: (skip)
29502 * @object: A #Object.
29503 *
29504 * Like object_get_flash_control() but doesn't increase the reference count on the returned object.
29505 *
29506 * <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>
29507 *
29508 * Returns: (transfer none): A #FlashControl or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
29509 */
29510FlashControl *object_peek_flash_control (Object *object)
29511{
29512 GDBusInterface *ret;
29513 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
29514 if (ret == NULL)
29515 return NULL;
29516 g_object_unref (ret);
29517 return FLASH_CONTROL (ret);
29518}
29519
29520/**
Norman James362a80f2015-09-14 14:04:39 -050029521 * object_peek_button: (skip)
29522 * @object: A #Object.
29523 *
29524 * Like object_get_button() but doesn't increase the reference count on the returned object.
29525 *
29526 * <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>
29527 *
29528 * 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.
29529 */
29530Button *object_peek_button (Object *object)
29531{
29532 GDBusInterface *ret;
29533 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
29534 if (ret == NULL)
29535 return NULL;
29536 g_object_unref (ret);
29537 return BUTTON (ret);
29538}
29539
29540/**
29541 * object_peek_led: (skip)
29542 * @object: A #Object.
29543 *
29544 * Like object_get_led() but doesn't increase the reference count on the returned object.
29545 *
29546 * <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>
29547 *
29548 * 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.
29549 */
29550Led *object_peek_led (Object *object)
29551{
29552 GDBusInterface *ret;
29553 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
29554 if (ret == NULL)
29555 return NULL;
29556 g_object_unref (ret);
29557 return LED (ret);
29558}
29559
Norman Jamesdbcffbd2015-10-06 16:53:06 -050029560/**
29561 * object_peek_host_ipmi: (skip)
29562 * @object: A #Object.
29563 *
29564 * Like object_get_host_ipmi() but doesn't increase the reference count on the returned object.
29565 *
29566 * <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>
29567 *
29568 * Returns: (transfer none): A #HostIpmi or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
29569 */
29570HostIpmi *object_peek_host_ipmi (Object *object)
29571{
29572 GDBusInterface *ret;
29573 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
29574 if (ret == NULL)
29575 return NULL;
29576 g_object_unref (ret);
29577 return HOST_IPMI (ret);
29578}
29579
Norman James362a80f2015-09-14 14:04:39 -050029580
29581static void
29582object_notify (GDBusObject *object, GDBusInterface *interface)
29583{
29584 _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
29585 /* info can be NULL if the other end is using a D-Bus interface we don't know
29586 * anything about, for example old generated code in this process talking to
29587 * newer generated code in the other process. */
29588 if (info != NULL)
29589 g_object_notify (G_OBJECT (object), info->hyphen_name);
29590}
29591
29592/**
29593 * ObjectProxy:
29594 *
29595 * The #ObjectProxy structure contains only private data and should only be accessed using the provided API.
29596 */
29597
29598/**
29599 * ObjectProxyClass:
29600 * @parent_class: The parent class.
29601 *
29602 * Class structure for #ObjectProxy.
29603 */
29604
29605static void
29606object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
29607{
29608}
29609
29610static void
29611object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
29612{
29613 iface->interface_added = object_notify;
29614 iface->interface_removed = object_notify;
29615}
29616
29617
29618G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
29619 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init)
29620 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init));
29621
29622static void
29623object_proxy_init (ObjectProxy *object G_GNUC_UNUSED)
29624{
29625}
29626
29627static void
29628object_proxy_set_property (GObject *gobject,
29629 guint prop_id,
29630 const GValue *value G_GNUC_UNUSED,
29631 GParamSpec *pspec)
29632{
29633 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
29634}
29635
29636static void
29637object_proxy_get_property (GObject *gobject,
29638 guint prop_id,
29639 GValue *value,
29640 GParamSpec *pspec)
29641{
29642 ObjectProxy *object = OBJECT_PROXY (gobject);
29643 GDBusInterface *interface;
29644
29645 switch (prop_id)
29646 {
29647 case 1:
Norman James362a80f2015-09-14 14:04:39 -050029648 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
29649 g_value_take_object (value, interface);
29650 break;
29651
Norman Jamesa3e47c42015-10-18 14:43:10 -050029652 case 2:
Norman James362a80f2015-09-14 14:04:39 -050029653 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
29654 g_value_take_object (value, interface);
29655 break;
29656
Norman Jamesa3e47c42015-10-18 14:43:10 -050029657 case 3:
Norman Jamesdfdaca92015-09-27 22:11:15 -050029658 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman James362a80f2015-09-14 14:04:39 -050029659 g_value_take_object (value, interface);
29660 break;
29661
Norman Jamesa3e47c42015-10-18 14:43:10 -050029662 case 4:
Norman Jamesdfdaca92015-09-27 22:11:15 -050029663 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman James362a80f2015-09-14 14:04:39 -050029664 g_value_take_object (value, interface);
29665 break;
29666
Norman Jamesa3e47c42015-10-18 14:43:10 -050029667 case 5:
Norman Jamesdfdaca92015-09-27 22:11:15 -050029668 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
Norman James362a80f2015-09-14 14:04:39 -050029669 g_value_take_object (value, interface);
29670 break;
29671
Norman Jamesa3e47c42015-10-18 14:43:10 -050029672 case 6:
Norman Jamesdfdaca92015-09-27 22:11:15 -050029673 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
Norman James362a80f2015-09-14 14:04:39 -050029674 g_value_take_object (value, interface);
29675 break;
29676
Norman Jamesa3e47c42015-10-18 14:43:10 -050029677 case 7:
Norman James18998182015-10-11 21:54:53 -050029678 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
Norman James362a80f2015-09-14 14:04:39 -050029679 g_value_take_object (value, interface);
29680 break;
29681
Norman Jamesa3e47c42015-10-18 14:43:10 -050029682 case 8:
Norman James18998182015-10-11 21:54:53 -050029683 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
Norman James362a80f2015-09-14 14:04:39 -050029684 g_value_take_object (value, interface);
29685 break;
29686
Norman Jamesa3e47c42015-10-18 14:43:10 -050029687 case 9:
Norman James18998182015-10-11 21:54:53 -050029688 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
Norman James362a80f2015-09-14 14:04:39 -050029689 g_value_take_object (value, interface);
29690 break;
29691
Norman Jamesa3e47c42015-10-18 14:43:10 -050029692 case 10:
Norman James18998182015-10-11 21:54:53 -050029693 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
Norman James362a80f2015-09-14 14:04:39 -050029694 g_value_take_object (value, interface);
29695 break;
29696
Norman Jamesa3e47c42015-10-18 14:43:10 -050029697 case 11:
Norman James18998182015-10-11 21:54:53 -050029698 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
Norman James362a80f2015-09-14 14:04:39 -050029699 g_value_take_object (value, interface);
29700 break;
29701
Norman Jamesa3e47c42015-10-18 14:43:10 -050029702 case 12:
Norman James18998182015-10-11 21:54:53 -050029703 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
Norman James362a80f2015-09-14 14:04:39 -050029704 g_value_take_object (value, interface);
29705 break;
29706
Norman Jamesa3e47c42015-10-18 14:43:10 -050029707 case 13:
Norman James18998182015-10-11 21:54:53 -050029708 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
Norman James362a80f2015-09-14 14:04:39 -050029709 g_value_take_object (value, interface);
29710 break;
29711
Norman Jamesa3e47c42015-10-18 14:43:10 -050029712 case 14:
Norman James18998182015-10-11 21:54:53 -050029713 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
Norman Jamesdfdaca92015-09-27 22:11:15 -050029714 g_value_take_object (value, interface);
29715 break;
29716
Norman Jamesa3e47c42015-10-18 14:43:10 -050029717 case 15:
Norman James18998182015-10-11 21:54:53 -050029718 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
Norman James362a80f2015-09-14 14:04:39 -050029719 g_value_take_object (value, interface);
29720 break;
29721
Norman Jamesa3e47c42015-10-18 14:43:10 -050029722 case 16:
Norman James18998182015-10-11 21:54:53 -050029723 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
29724 g_value_take_object (value, interface);
29725 break;
29726
Norman Jamesa3e47c42015-10-18 14:43:10 -050029727 case 17:
Norman James18998182015-10-11 21:54:53 -050029728 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
29729 g_value_take_object (value, interface);
29730 break;
29731
Norman Jamesa3e47c42015-10-18 14:43:10 -050029732 case 18:
Norman Jamesdbcffbd2015-10-06 16:53:06 -050029733 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
29734 g_value_take_object (value, interface);
29735 break;
29736
Norman James362a80f2015-09-14 14:04:39 -050029737 default:
29738 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
29739 break;
29740 }
29741}
29742
29743static void
29744object_proxy_class_init (ObjectProxyClass *klass)
29745{
29746 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
29747
29748 gobject_class->set_property = object_proxy_set_property;
29749 gobject_class->get_property = object_proxy_get_property;
29750
Norman Jamesa3e47c42015-10-18 14:43:10 -050029751 g_object_class_override_property (gobject_class, 1, "fan");
29752 g_object_class_override_property (gobject_class, 2, "sensor-value");
29753 g_object_class_override_property (gobject_class, 3, "sensor-threshold");
29754 g_object_class_override_property (gobject_class, 4, "sensor-i2c");
29755 g_object_class_override_property (gobject_class, 5, "sensor-match");
29756 g_object_class_override_property (gobject_class, 6, "process");
29757 g_object_class_override_property (gobject_class, 7, "shared-resource");
29758 g_object_class_override_property (gobject_class, 8, "control");
29759 g_object_class_override_property (gobject_class, 9, "control-bmc");
29760 g_object_class_override_property (gobject_class, 10, "control-host");
29761 g_object_class_override_property (gobject_class, 11, "control-power");
29762 g_object_class_override_property (gobject_class, 12, "watchdog");
29763 g_object_class_override_property (gobject_class, 13, "event-log");
29764 g_object_class_override_property (gobject_class, 14, "flash");
29765 g_object_class_override_property (gobject_class, 15, "flash-control");
29766 g_object_class_override_property (gobject_class, 16, "button");
29767 g_object_class_override_property (gobject_class, 17, "led");
29768 g_object_class_override_property (gobject_class, 18, "host-ipmi");
Norman James362a80f2015-09-14 14:04:39 -050029769}
29770
29771/**
29772 * object_proxy_new:
29773 * @connection: A #GDBusConnection.
29774 * @object_path: An object path.
29775 *
29776 * Creates a new proxy object.
29777 *
29778 * Returns: (transfer full): The proxy object.
29779 */
29780ObjectProxy *
29781object_proxy_new (GDBusConnection *connection,
29782 const gchar *object_path)
29783{
29784 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
29785 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
29786 return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
29787}
29788
29789/**
29790 * ObjectSkeleton:
29791 *
29792 * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API.
29793 */
29794
29795/**
29796 * ObjectSkeletonClass:
29797 * @parent_class: The parent class.
29798 *
29799 * Class structure for #ObjectSkeleton.
29800 */
29801
29802static void
29803object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
29804{
29805}
29806
29807
29808static void
29809object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
29810{
29811 iface->interface_added = object_notify;
29812 iface->interface_removed = object_notify;
29813}
29814
29815G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
29816 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init)
29817 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init));
29818
29819static void
29820object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED)
29821{
29822}
29823
29824static void
29825object_skeleton_set_property (GObject *gobject,
29826 guint prop_id,
29827 const GValue *value,
29828 GParamSpec *pspec)
29829{
29830 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
29831 GDBusInterfaceSkeleton *interface;
29832
29833 switch (prop_id)
29834 {
29835 case 1:
29836 interface = g_value_get_object (value);
29837 if (interface != NULL)
29838 {
Norman James362a80f2015-09-14 14:04:39 -050029839 g_warn_if_fail (IS_FAN (interface));
29840 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29841 }
29842 else
29843 {
29844 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Fan");
29845 }
29846 break;
29847
Norman Jamesa3e47c42015-10-18 14:43:10 -050029848 case 2:
Norman James362a80f2015-09-14 14:04:39 -050029849 interface = g_value_get_object (value);
29850 if (interface != NULL)
29851 {
29852 g_warn_if_fail (IS_SENSOR_VALUE (interface));
29853 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29854 }
29855 else
29856 {
29857 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorValue");
29858 }
29859 break;
29860
Norman Jamesa3e47c42015-10-18 14:43:10 -050029861 case 3:
Norman James362a80f2015-09-14 14:04:39 -050029862 interface = g_value_get_object (value);
29863 if (interface != NULL)
29864 {
29865 g_warn_if_fail (IS_SENSOR_THRESHOLD (interface));
29866 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29867 }
29868 else
29869 {
29870 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorThreshold");
29871 }
29872 break;
29873
Norman Jamesa3e47c42015-10-18 14:43:10 -050029874 case 4:
Norman James362a80f2015-09-14 14:04:39 -050029875 interface = g_value_get_object (value);
29876 if (interface != NULL)
29877 {
29878 g_warn_if_fail (IS_SENSOR_I2C (interface));
29879 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29880 }
29881 else
29882 {
29883 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorI2c");
29884 }
29885 break;
29886
Norman Jamesa3e47c42015-10-18 14:43:10 -050029887 case 5:
Norman James362a80f2015-09-14 14:04:39 -050029888 interface = g_value_get_object (value);
29889 if (interface != NULL)
29890 {
29891 g_warn_if_fail (IS_SENSOR_MATCH (interface));
29892 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29893 }
29894 else
29895 {
29896 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorMatch");
29897 }
29898 break;
29899
Norman Jamesa3e47c42015-10-18 14:43:10 -050029900 case 6:
Norman James362a80f2015-09-14 14:04:39 -050029901 interface = g_value_get_object (value);
29902 if (interface != NULL)
29903 {
29904 g_warn_if_fail (IS_PROCESS (interface));
29905 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29906 }
29907 else
29908 {
29909 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Process");
29910 }
29911 break;
29912
Norman Jamesa3e47c42015-10-18 14:43:10 -050029913 case 7:
Norman James362a80f2015-09-14 14:04:39 -050029914 interface = g_value_get_object (value);
29915 if (interface != NULL)
29916 {
Norman James18998182015-10-11 21:54:53 -050029917 g_warn_if_fail (IS_SHARED_RESOURCE (interface));
29918 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29919 }
29920 else
29921 {
29922 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SharedResource");
29923 }
29924 break;
29925
Norman Jamesa3e47c42015-10-18 14:43:10 -050029926 case 8:
Norman James18998182015-10-11 21:54:53 -050029927 interface = g_value_get_object (value);
29928 if (interface != NULL)
29929 {
Norman James362a80f2015-09-14 14:04:39 -050029930 g_warn_if_fail (IS_CONTROL (interface));
29931 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29932 }
29933 else
29934 {
29935 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Control");
29936 }
29937 break;
29938
Norman Jamesa3e47c42015-10-18 14:43:10 -050029939 case 9:
Norman James362a80f2015-09-14 14:04:39 -050029940 interface = g_value_get_object (value);
29941 if (interface != NULL)
29942 {
29943 g_warn_if_fail (IS_CONTROL_BMC (interface));
29944 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29945 }
29946 else
29947 {
29948 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Bmc");
29949 }
29950 break;
29951
Norman Jamesa3e47c42015-10-18 14:43:10 -050029952 case 10:
Norman James362a80f2015-09-14 14:04:39 -050029953 interface = g_value_get_object (value);
29954 if (interface != NULL)
29955 {
29956 g_warn_if_fail (IS_CONTROL_HOST (interface));
29957 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29958 }
29959 else
29960 {
29961 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Host");
29962 }
29963 break;
29964
Norman Jamesa3e47c42015-10-18 14:43:10 -050029965 case 11:
Norman James362a80f2015-09-14 14:04:39 -050029966 interface = g_value_get_object (value);
29967 if (interface != NULL)
29968 {
29969 g_warn_if_fail (IS_CONTROL_POWER (interface));
29970 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29971 }
29972 else
29973 {
29974 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Power");
29975 }
29976 break;
29977
Norman Jamesa3e47c42015-10-18 14:43:10 -050029978 case 12:
Norman James362a80f2015-09-14 14:04:39 -050029979 interface = g_value_get_object (value);
29980 if (interface != NULL)
29981 {
29982 g_warn_if_fail (IS_WATCHDOG (interface));
29983 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29984 }
29985 else
29986 {
29987 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Watchdog");
29988 }
29989 break;
29990
Norman Jamesa3e47c42015-10-18 14:43:10 -050029991 case 13:
Norman James362a80f2015-09-14 14:04:39 -050029992 interface = g_value_get_object (value);
29993 if (interface != NULL)
29994 {
29995 g_warn_if_fail (IS_EVENT_LOG (interface));
29996 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29997 }
29998 else
29999 {
30000 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.EventLog");
30001 }
30002 break;
30003
Norman Jamesa3e47c42015-10-18 14:43:10 -050030004 case 14:
Norman James362a80f2015-09-14 14:04:39 -050030005 interface = g_value_get_object (value);
30006 if (interface != NULL)
30007 {
30008 g_warn_if_fail (IS_FLASH (interface));
30009 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
30010 }
30011 else
30012 {
30013 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Flash");
30014 }
30015 break;
30016
Norman Jamesa3e47c42015-10-18 14:43:10 -050030017 case 15:
Norman James18998182015-10-11 21:54:53 -050030018 interface = g_value_get_object (value);
30019 if (interface != NULL)
30020 {
30021 g_warn_if_fail (IS_FLASH_CONTROL (interface));
30022 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
30023 }
30024 else
30025 {
30026 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.FlashControl");
30027 }
30028 break;
30029
Norman Jamesa3e47c42015-10-18 14:43:10 -050030030 case 16:
Norman James362a80f2015-09-14 14:04:39 -050030031 interface = g_value_get_object (value);
30032 if (interface != NULL)
30033 {
30034 g_warn_if_fail (IS_BUTTON (interface));
30035 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
30036 }
30037 else
30038 {
30039 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Button");
30040 }
30041 break;
30042
Norman Jamesa3e47c42015-10-18 14:43:10 -050030043 case 17:
Norman James362a80f2015-09-14 14:04:39 -050030044 interface = g_value_get_object (value);
30045 if (interface != NULL)
30046 {
30047 g_warn_if_fail (IS_LED (interface));
30048 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
30049 }
30050 else
30051 {
30052 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Led");
30053 }
30054 break;
30055
Norman Jamesa3e47c42015-10-18 14:43:10 -050030056 case 18:
Norman Jamesdbcffbd2015-10-06 16:53:06 -050030057 interface = g_value_get_object (value);
30058 if (interface != NULL)
30059 {
30060 g_warn_if_fail (IS_HOST_IPMI (interface));
30061 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
30062 }
30063 else
30064 {
30065 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.HostIpmi");
30066 }
30067 break;
30068
Norman James362a80f2015-09-14 14:04:39 -050030069 default:
30070 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
30071 break;
30072 }
30073}
30074
30075static void
30076object_skeleton_get_property (GObject *gobject,
30077 guint prop_id,
30078 GValue *value,
30079 GParamSpec *pspec)
30080{
30081 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
30082 GDBusInterface *interface;
30083
30084 switch (prop_id)
30085 {
30086 case 1:
Norman James362a80f2015-09-14 14:04:39 -050030087 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
30088 g_value_take_object (value, interface);
30089 break;
30090
Norman Jamesa3e47c42015-10-18 14:43:10 -050030091 case 2:
Norman James362a80f2015-09-14 14:04:39 -050030092 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
30093 g_value_take_object (value, interface);
30094 break;
30095
Norman Jamesa3e47c42015-10-18 14:43:10 -050030096 case 3:
Norman Jamesdfdaca92015-09-27 22:11:15 -050030097 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman James362a80f2015-09-14 14:04:39 -050030098 g_value_take_object (value, interface);
30099 break;
30100
Norman Jamesa3e47c42015-10-18 14:43:10 -050030101 case 4:
Norman Jamesdfdaca92015-09-27 22:11:15 -050030102 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman James362a80f2015-09-14 14:04:39 -050030103 g_value_take_object (value, interface);
30104 break;
30105
Norman Jamesa3e47c42015-10-18 14:43:10 -050030106 case 5:
Norman Jamesdfdaca92015-09-27 22:11:15 -050030107 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
Norman James362a80f2015-09-14 14:04:39 -050030108 g_value_take_object (value, interface);
30109 break;
30110
Norman Jamesa3e47c42015-10-18 14:43:10 -050030111 case 6:
Norman Jamesdfdaca92015-09-27 22:11:15 -050030112 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
Norman James362a80f2015-09-14 14:04:39 -050030113 g_value_take_object (value, interface);
30114 break;
30115
Norman Jamesa3e47c42015-10-18 14:43:10 -050030116 case 7:
Norman James18998182015-10-11 21:54:53 -050030117 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
Norman James362a80f2015-09-14 14:04:39 -050030118 g_value_take_object (value, interface);
30119 break;
30120
Norman Jamesa3e47c42015-10-18 14:43:10 -050030121 case 8:
Norman James18998182015-10-11 21:54:53 -050030122 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
Norman James362a80f2015-09-14 14:04:39 -050030123 g_value_take_object (value, interface);
30124 break;
30125
Norman Jamesa3e47c42015-10-18 14:43:10 -050030126 case 9:
Norman James18998182015-10-11 21:54:53 -050030127 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
Norman James362a80f2015-09-14 14:04:39 -050030128 g_value_take_object (value, interface);
30129 break;
30130
Norman Jamesa3e47c42015-10-18 14:43:10 -050030131 case 10:
Norman James18998182015-10-11 21:54:53 -050030132 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
Norman James362a80f2015-09-14 14:04:39 -050030133 g_value_take_object (value, interface);
30134 break;
30135
Norman Jamesa3e47c42015-10-18 14:43:10 -050030136 case 11:
Norman James18998182015-10-11 21:54:53 -050030137 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
Norman James362a80f2015-09-14 14:04:39 -050030138 g_value_take_object (value, interface);
30139 break;
30140
Norman Jamesa3e47c42015-10-18 14:43:10 -050030141 case 12:
Norman James18998182015-10-11 21:54:53 -050030142 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
Norman James362a80f2015-09-14 14:04:39 -050030143 g_value_take_object (value, interface);
30144 break;
30145
Norman Jamesa3e47c42015-10-18 14:43:10 -050030146 case 13:
Norman James18998182015-10-11 21:54:53 -050030147 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
Norman James362a80f2015-09-14 14:04:39 -050030148 g_value_take_object (value, interface);
30149 break;
30150
Norman Jamesa3e47c42015-10-18 14:43:10 -050030151 case 14:
Norman James18998182015-10-11 21:54:53 -050030152 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
Norman Jamesdfdaca92015-09-27 22:11:15 -050030153 g_value_take_object (value, interface);
30154 break;
30155
Norman Jamesa3e47c42015-10-18 14:43:10 -050030156 case 15:
Norman James18998182015-10-11 21:54:53 -050030157 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
Norman James362a80f2015-09-14 14:04:39 -050030158 g_value_take_object (value, interface);
30159 break;
30160
Norman Jamesa3e47c42015-10-18 14:43:10 -050030161 case 16:
Norman James18998182015-10-11 21:54:53 -050030162 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
30163 g_value_take_object (value, interface);
30164 break;
30165
Norman Jamesa3e47c42015-10-18 14:43:10 -050030166 case 17:
Norman James18998182015-10-11 21:54:53 -050030167 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
30168 g_value_take_object (value, interface);
30169 break;
30170
Norman Jamesa3e47c42015-10-18 14:43:10 -050030171 case 18:
Norman Jamesdbcffbd2015-10-06 16:53:06 -050030172 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
30173 g_value_take_object (value, interface);
30174 break;
30175
Norman James362a80f2015-09-14 14:04:39 -050030176 default:
30177 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
30178 break;
30179 }
30180}
30181
30182static void
30183object_skeleton_class_init (ObjectSkeletonClass *klass)
30184{
30185 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
30186
30187 gobject_class->set_property = object_skeleton_set_property;
30188 gobject_class->get_property = object_skeleton_get_property;
30189
Norman Jamesa3e47c42015-10-18 14:43:10 -050030190 g_object_class_override_property (gobject_class, 1, "fan");
30191 g_object_class_override_property (gobject_class, 2, "sensor-value");
30192 g_object_class_override_property (gobject_class, 3, "sensor-threshold");
30193 g_object_class_override_property (gobject_class, 4, "sensor-i2c");
30194 g_object_class_override_property (gobject_class, 5, "sensor-match");
30195 g_object_class_override_property (gobject_class, 6, "process");
30196 g_object_class_override_property (gobject_class, 7, "shared-resource");
30197 g_object_class_override_property (gobject_class, 8, "control");
30198 g_object_class_override_property (gobject_class, 9, "control-bmc");
30199 g_object_class_override_property (gobject_class, 10, "control-host");
30200 g_object_class_override_property (gobject_class, 11, "control-power");
30201 g_object_class_override_property (gobject_class, 12, "watchdog");
30202 g_object_class_override_property (gobject_class, 13, "event-log");
30203 g_object_class_override_property (gobject_class, 14, "flash");
30204 g_object_class_override_property (gobject_class, 15, "flash-control");
30205 g_object_class_override_property (gobject_class, 16, "button");
30206 g_object_class_override_property (gobject_class, 17, "led");
30207 g_object_class_override_property (gobject_class, 18, "host-ipmi");
Norman James362a80f2015-09-14 14:04:39 -050030208}
30209
30210/**
30211 * object_skeleton_new:
30212 * @object_path: An object path.
30213 *
30214 * Creates a new skeleton object.
30215 *
30216 * Returns: (transfer full): The skeleton object.
30217 */
30218ObjectSkeleton *
30219object_skeleton_new (const gchar *object_path)
30220{
30221 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
30222 return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
30223}
30224
30225/**
Norman James362a80f2015-09-14 14:04:39 -050030226 * object_skeleton_set_fan:
30227 * @object: A #ObjectSkeleton.
30228 * @interface_: (allow-none): A #Fan or %NULL to clear the interface.
30229 *
30230 * 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.
30231 */
30232void object_skeleton_set_fan (ObjectSkeleton *object, Fan *interface_)
30233{
30234 g_object_set (G_OBJECT (object), "fan", interface_, NULL);
30235}
30236
30237/**
30238 * object_skeleton_set_sensor_value:
30239 * @object: A #ObjectSkeleton.
30240 * @interface_: (allow-none): A #SensorValue or %NULL to clear the interface.
30241 *
30242 * 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.
30243 */
30244void object_skeleton_set_sensor_value (ObjectSkeleton *object, SensorValue *interface_)
30245{
30246 g_object_set (G_OBJECT (object), "sensor-value", interface_, NULL);
30247}
30248
30249/**
30250 * object_skeleton_set_sensor_threshold:
30251 * @object: A #ObjectSkeleton.
30252 * @interface_: (allow-none): A #SensorThreshold or %NULL to clear the interface.
30253 *
30254 * 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.
30255 */
30256void object_skeleton_set_sensor_threshold (ObjectSkeleton *object, SensorThreshold *interface_)
30257{
30258 g_object_set (G_OBJECT (object), "sensor-threshold", interface_, NULL);
30259}
30260
30261/**
30262 * object_skeleton_set_sensor_i2c:
30263 * @object: A #ObjectSkeleton.
30264 * @interface_: (allow-none): A #SensorI2c or %NULL to clear the interface.
30265 *
30266 * 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.
30267 */
30268void object_skeleton_set_sensor_i2c (ObjectSkeleton *object, SensorI2c *interface_)
30269{
30270 g_object_set (G_OBJECT (object), "sensor-i2c", interface_, NULL);
30271}
30272
30273/**
30274 * object_skeleton_set_sensor_match:
30275 * @object: A #ObjectSkeleton.
30276 * @interface_: (allow-none): A #SensorMatch or %NULL to clear the interface.
30277 *
30278 * 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.
30279 */
30280void object_skeleton_set_sensor_match (ObjectSkeleton *object, SensorMatch *interface_)
30281{
30282 g_object_set (G_OBJECT (object), "sensor-match", interface_, NULL);
30283}
30284
30285/**
30286 * object_skeleton_set_process:
30287 * @object: A #ObjectSkeleton.
30288 * @interface_: (allow-none): A #Process or %NULL to clear the interface.
30289 *
30290 * 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.
30291 */
30292void object_skeleton_set_process (ObjectSkeleton *object, Process *interface_)
30293{
30294 g_object_set (G_OBJECT (object), "process", interface_, NULL);
30295}
30296
30297/**
Norman James18998182015-10-11 21:54:53 -050030298 * object_skeleton_set_shared_resource:
30299 * @object: A #ObjectSkeleton.
30300 * @interface_: (allow-none): A #SharedResource or %NULL to clear the interface.
30301 *
30302 * Sets the #SharedResource instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> on @object.
30303 */
30304void object_skeleton_set_shared_resource (ObjectSkeleton *object, SharedResource *interface_)
30305{
30306 g_object_set (G_OBJECT (object), "shared-resource", interface_, NULL);
30307}
30308
30309/**
Norman James362a80f2015-09-14 14:04:39 -050030310 * object_skeleton_set_control:
30311 * @object: A #ObjectSkeleton.
30312 * @interface_: (allow-none): A #Control or %NULL to clear the interface.
30313 *
30314 * 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.
30315 */
30316void object_skeleton_set_control (ObjectSkeleton *object, Control *interface_)
30317{
30318 g_object_set (G_OBJECT (object), "control", interface_, NULL);
30319}
30320
30321/**
30322 * object_skeleton_set_control_bmc:
30323 * @object: A #ObjectSkeleton.
30324 * @interface_: (allow-none): A #ControlBmc or %NULL to clear the interface.
30325 *
30326 * 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.
30327 */
30328void object_skeleton_set_control_bmc (ObjectSkeleton *object, ControlBmc *interface_)
30329{
30330 g_object_set (G_OBJECT (object), "control-bmc", interface_, NULL);
30331}
30332
30333/**
30334 * object_skeleton_set_control_host:
30335 * @object: A #ObjectSkeleton.
30336 * @interface_: (allow-none): A #ControlHost or %NULL to clear the interface.
30337 *
30338 * 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.
30339 */
30340void object_skeleton_set_control_host (ObjectSkeleton *object, ControlHost *interface_)
30341{
30342 g_object_set (G_OBJECT (object), "control-host", interface_, NULL);
30343}
30344
30345/**
30346 * object_skeleton_set_control_power:
30347 * @object: A #ObjectSkeleton.
30348 * @interface_: (allow-none): A #ControlPower or %NULL to clear the interface.
30349 *
30350 * 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.
30351 */
30352void object_skeleton_set_control_power (ObjectSkeleton *object, ControlPower *interface_)
30353{
30354 g_object_set (G_OBJECT (object), "control-power", interface_, NULL);
30355}
30356
30357/**
30358 * object_skeleton_set_watchdog:
30359 * @object: A #ObjectSkeleton.
30360 * @interface_: (allow-none): A #Watchdog or %NULL to clear the interface.
30361 *
30362 * 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.
30363 */
30364void object_skeleton_set_watchdog (ObjectSkeleton *object, Watchdog *interface_)
30365{
30366 g_object_set (G_OBJECT (object), "watchdog", interface_, NULL);
30367}
30368
30369/**
30370 * object_skeleton_set_event_log:
30371 * @object: A #ObjectSkeleton.
30372 * @interface_: (allow-none): A #EventLog or %NULL to clear the interface.
30373 *
30374 * 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.
30375 */
30376void object_skeleton_set_event_log (ObjectSkeleton *object, EventLog *interface_)
30377{
30378 g_object_set (G_OBJECT (object), "event-log", interface_, NULL);
30379}
30380
30381/**
30382 * object_skeleton_set_flash:
30383 * @object: A #ObjectSkeleton.
30384 * @interface_: (allow-none): A #Flash or %NULL to clear the interface.
30385 *
30386 * 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.
30387 */
30388void object_skeleton_set_flash (ObjectSkeleton *object, Flash *interface_)
30389{
30390 g_object_set (G_OBJECT (object), "flash", interface_, NULL);
30391}
30392
30393/**
Norman James18998182015-10-11 21:54:53 -050030394 * object_skeleton_set_flash_control:
30395 * @object: A #ObjectSkeleton.
30396 * @interface_: (allow-none): A #FlashControl or %NULL to clear the interface.
30397 *
30398 * Sets the #FlashControl instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> on @object.
30399 */
30400void object_skeleton_set_flash_control (ObjectSkeleton *object, FlashControl *interface_)
30401{
30402 g_object_set (G_OBJECT (object), "flash-control", interface_, NULL);
30403}
30404
30405/**
Norman James362a80f2015-09-14 14:04:39 -050030406 * object_skeleton_set_button:
30407 * @object: A #ObjectSkeleton.
30408 * @interface_: (allow-none): A #Button or %NULL to clear the interface.
30409 *
30410 * 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.
30411 */
30412void object_skeleton_set_button (ObjectSkeleton *object, Button *interface_)
30413{
30414 g_object_set (G_OBJECT (object), "button", interface_, NULL);
30415}
30416
30417/**
30418 * object_skeleton_set_led:
30419 * @object: A #ObjectSkeleton.
30420 * @interface_: (allow-none): A #Led or %NULL to clear the interface.
30421 *
30422 * 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.
30423 */
30424void object_skeleton_set_led (ObjectSkeleton *object, Led *interface_)
30425{
30426 g_object_set (G_OBJECT (object), "led", interface_, NULL);
30427}
30428
Norman Jamesdbcffbd2015-10-06 16:53:06 -050030429/**
30430 * object_skeleton_set_host_ipmi:
30431 * @object: A #ObjectSkeleton.
30432 * @interface_: (allow-none): A #HostIpmi or %NULL to clear the interface.
30433 *
30434 * Sets the #HostIpmi instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> on @object.
30435 */
30436void object_skeleton_set_host_ipmi (ObjectSkeleton *object, HostIpmi *interface_)
30437{
30438 g_object_set (G_OBJECT (object), "host-ipmi", interface_, NULL);
30439}
30440
Norman James362a80f2015-09-14 14:04:39 -050030441
30442/* ------------------------------------------------------------------------
30443 * Code for ObjectManager client
30444 * ------------------------------------------------------------------------
30445 */
30446
30447/**
30448 * SECTION:ObjectManagerClient
30449 * @title: ObjectManagerClient
30450 * @short_description: Generated GDBusObjectManagerClient type
30451 *
30452 * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
30453 */
30454
30455/**
30456 * ObjectManagerClient:
30457 *
30458 * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API.
30459 */
30460
30461/**
30462 * ObjectManagerClientClass:
30463 * @parent_class: The parent class.
30464 *
30465 * Class structure for #ObjectManagerClient.
30466 */
30467
30468G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT);
30469
30470static void
30471object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED)
30472{
30473}
30474
30475static void
30476object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED)
30477{
30478}
30479
30480/**
30481 * object_manager_client_get_proxy_type:
30482 * @manager: A #GDBusObjectManagerClient.
30483 * @object_path: The object path of the remote object (unused).
30484 * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType.
30485 * @user_data: User data (unused).
30486 *
30487 * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types.
30488 *
30489 * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy.
30490 */
30491GType
30492object_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)
30493{
30494 static gsize once_init_value = 0;
30495 static GHashTable *lookup_hash;
30496 GType ret;
30497
30498 if (interface_name == NULL)
30499 return TYPE_OBJECT_PROXY;
30500 if (g_once_init_enter (&once_init_value))
30501 {
30502 lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
Norman James362a80f2015-09-14 14:04:39 -050030503 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Fan", GSIZE_TO_POINTER (TYPE_FAN_PROXY));
30504 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorValue", GSIZE_TO_POINTER (TYPE_SENSOR_VALUE_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050030505 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_THRESHOLD_PROXY));
30506 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorI2c", GSIZE_TO_POINTER (TYPE_SENSOR_I2C_PROXY));
30507 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorMatch", GSIZE_TO_POINTER (TYPE_SENSOR_MATCH_PROXY));
30508 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Process", GSIZE_TO_POINTER (TYPE_PROCESS_PROXY));
Norman James18998182015-10-11 21:54:53 -050030509 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SharedResource", GSIZE_TO_POINTER (TYPE_SHARED_RESOURCE_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050030510 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Control", GSIZE_TO_POINTER (TYPE_CONTROL_PROXY));
30511 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Bmc", GSIZE_TO_POINTER (TYPE_CONTROL_BMC_PROXY));
30512 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Host", GSIZE_TO_POINTER (TYPE_CONTROL_HOST_PROXY));
30513 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Power", GSIZE_TO_POINTER (TYPE_CONTROL_POWER_PROXY));
30514 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Watchdog", GSIZE_TO_POINTER (TYPE_WATCHDOG_PROXY));
30515 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.EventLog", GSIZE_TO_POINTER (TYPE_EVENT_LOG_PROXY));
30516 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Flash", GSIZE_TO_POINTER (TYPE_FLASH_PROXY));
Norman James18998182015-10-11 21:54:53 -050030517 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.FlashControl", GSIZE_TO_POINTER (TYPE_FLASH_CONTROL_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050030518 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Button", GSIZE_TO_POINTER (TYPE_BUTTON_PROXY));
30519 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Led", GSIZE_TO_POINTER (TYPE_LED_PROXY));
Norman Jamesdbcffbd2015-10-06 16:53:06 -050030520 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.HostIpmi", GSIZE_TO_POINTER (TYPE_HOST_IPMI_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050030521 g_once_init_leave (&once_init_value, 1);
30522 }
30523 ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
30524 if (ret == (GType) 0)
30525 ret = G_TYPE_DBUS_PROXY;
30526 return ret;
30527}
30528
30529/**
30530 * object_manager_client_new:
30531 * @connection: A #GDBusConnection.
30532 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
30533 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
30534 * @object_path: An object path.
30535 * @cancellable: (allow-none): A #GCancellable or %NULL.
30536 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
30537 * @user_data: User data to pass to @callback.
30538 *
30539 * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
30540 *
30541 * 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.
30542 * You can then call object_manager_client_new_finish() to get the result of the operation.
30543 *
30544 * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
30545 */
30546void
30547object_manager_client_new (
30548 GDBusConnection *connection,
30549 GDBusObjectManagerClientFlags flags,
30550 const gchar *name,
30551 const gchar *object_path,
30552 GCancellable *cancellable,
30553 GAsyncReadyCallback callback,
30554 gpointer user_data)
30555{
30556 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);
30557}
30558
30559/**
30560 * object_manager_client_new_finish:
30561 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new().
30562 * @error: Return location for error or %NULL
30563 *
30564 * Finishes an operation started with object_manager_client_new().
30565 *
30566 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
30567 */
30568GDBusObjectManager *
30569object_manager_client_new_finish (
30570 GAsyncResult *res,
30571 GError **error)
30572{
30573 GObject *ret;
30574 GObject *source_object;
30575 source_object = g_async_result_get_source_object (res);
30576 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
30577 g_object_unref (source_object);
30578 if (ret != NULL)
30579 return G_DBUS_OBJECT_MANAGER (ret);
30580 else
30581 return NULL;
30582}
30583
30584/**
30585 * object_manager_client_new_sync:
30586 * @connection: A #GDBusConnection.
30587 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
30588 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
30589 * @object_path: An object path.
30590 * @cancellable: (allow-none): A #GCancellable or %NULL.
30591 * @error: Return location for error or %NULL
30592 *
30593 * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
30594 *
30595 * The calling thread is blocked until a reply is received.
30596 *
30597 * See object_manager_client_new() for the asynchronous version of this constructor.
30598 *
30599 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
30600 */
30601GDBusObjectManager *
30602object_manager_client_new_sync (
30603 GDBusConnection *connection,
30604 GDBusObjectManagerClientFlags flags,
30605 const gchar *name,
30606 const gchar *object_path,
30607 GCancellable *cancellable,
30608 GError **error)
30609{
30610 GInitable *ret;
30611 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);
30612 if (ret != NULL)
30613 return G_DBUS_OBJECT_MANAGER (ret);
30614 else
30615 return NULL;
30616}
30617
30618
30619/**
30620 * object_manager_client_new_for_bus:
30621 * @bus_type: A #GBusType.
30622 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
30623 * @name: A bus name (well-known or unique).
30624 * @object_path: An object path.
30625 * @cancellable: (allow-none): A #GCancellable or %NULL.
30626 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
30627 * @user_data: User data to pass to @callback.
30628 *
30629 * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
30630 *
30631 * 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.
30632 * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation.
30633 *
30634 * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
30635 */
30636void
30637object_manager_client_new_for_bus (
30638 GBusType bus_type,
30639 GDBusObjectManagerClientFlags flags,
30640 const gchar *name,
30641 const gchar *object_path,
30642 GCancellable *cancellable,
30643 GAsyncReadyCallback callback,
30644 gpointer user_data)
30645{
30646 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);
30647}
30648
30649/**
30650 * object_manager_client_new_for_bus_finish:
30651 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus().
30652 * @error: Return location for error or %NULL
30653 *
30654 * Finishes an operation started with object_manager_client_new_for_bus().
30655 *
30656 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
30657 */
30658GDBusObjectManager *
30659object_manager_client_new_for_bus_finish (
30660 GAsyncResult *res,
30661 GError **error)
30662{
30663 GObject *ret;
30664 GObject *source_object;
30665 source_object = g_async_result_get_source_object (res);
30666 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
30667 g_object_unref (source_object);
30668 if (ret != NULL)
30669 return G_DBUS_OBJECT_MANAGER (ret);
30670 else
30671 return NULL;
30672}
30673
30674/**
30675 * object_manager_client_new_for_bus_sync:
30676 * @bus_type: A #GBusType.
30677 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
30678 * @name: A bus name (well-known or unique).
30679 * @object_path: An object path.
30680 * @cancellable: (allow-none): A #GCancellable or %NULL.
30681 * @error: Return location for error or %NULL
30682 *
30683 * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
30684 *
30685 * The calling thread is blocked until a reply is received.
30686 *
30687 * See object_manager_client_new_for_bus() for the asynchronous version of this constructor.
30688 *
30689 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
30690 */
30691GDBusObjectManager *
30692object_manager_client_new_for_bus_sync (
30693 GBusType bus_type,
30694 GDBusObjectManagerClientFlags flags,
30695 const gchar *name,
30696 const gchar *object_path,
30697 GCancellable *cancellable,
30698 GError **error)
30699{
30700 GInitable *ret;
30701 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);
30702 if (ret != NULL)
30703 return G_DBUS_OBJECT_MANAGER (ret);
30704 else
30705 return NULL;
30706}
30707
30708