blob: b7d9501abe88827380cee3acc5d652348cb1f153 [file] [log] [blame]
Norman James362a80f2015-09-14 14:04:39 -05001/*
Norman James47750bc2015-10-20 09:46:10 -05002 * Generated by gdbus-codegen 2.40.2. 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/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -0500152 * Code for interface org.openbmc.Fan
153 * ------------------------------------------------------------------------
154 */
155
156/**
157 * SECTION:Fan
158 * @title: Fan
159 * @short_description: Generated C code for the org.openbmc.Fan D-Bus interface
160 *
161 * 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.
162 */
163
164/* ---- Introspection data for org.openbmc.Fan ---- */
165
166static const _ExtendedGDBusArgInfo _fan_method_info_set_cooling_zone_IN_ARG_cooling_zone =
167{
168 {
169 -1,
170 (gchar *) "cooling_zone",
171 (gchar *) "i",
172 NULL
173 },
174 FALSE
175};
176
177static const _ExtendedGDBusArgInfo * const _fan_method_info_set_cooling_zone_IN_ARG_pointers[] =
178{
179 &_fan_method_info_set_cooling_zone_IN_ARG_cooling_zone,
180 NULL
181};
182
183static const _ExtendedGDBusMethodInfo _fan_method_info_set_cooling_zone =
184{
185 {
186 -1,
187 (gchar *) "setCoolingZone",
188 (GDBusArgInfo **) &_fan_method_info_set_cooling_zone_IN_ARG_pointers,
189 NULL,
190 NULL
191 },
192 "handle-set-cooling-zone",
193 FALSE
194};
195
196static const _ExtendedGDBusArgInfo _fan_method_info_get_speed_OUT_ARG_speed =
197{
198 {
199 -1,
200 (gchar *) "speed",
201 (gchar *) "i",
202 NULL
203 },
204 FALSE
205};
206
207static const _ExtendedGDBusArgInfo * const _fan_method_info_get_speed_OUT_ARG_pointers[] =
208{
209 &_fan_method_info_get_speed_OUT_ARG_speed,
210 NULL
211};
212
213static const _ExtendedGDBusMethodInfo _fan_method_info_get_speed =
214{
215 {
216 -1,
217 (gchar *) "getSpeed",
218 NULL,
219 (GDBusArgInfo **) &_fan_method_info_get_speed_OUT_ARG_pointers,
220 NULL
221 },
222 "handle-get-speed",
223 FALSE
224};
225
226static const _ExtendedGDBusArgInfo _fan_method_info_set_speed_IN_ARG_speed =
227{
228 {
229 -1,
230 (gchar *) "speed",
231 (gchar *) "i",
232 NULL
233 },
234 FALSE
235};
236
237static const _ExtendedGDBusArgInfo * const _fan_method_info_set_speed_IN_ARG_pointers[] =
238{
239 &_fan_method_info_set_speed_IN_ARG_speed,
240 NULL
241};
242
243static const _ExtendedGDBusMethodInfo _fan_method_info_set_speed =
244{
245 {
246 -1,
247 (gchar *) "setSpeed",
248 (GDBusArgInfo **) &_fan_method_info_set_speed_IN_ARG_pointers,
249 NULL,
250 NULL
251 },
252 "handle-set-speed",
253 FALSE
254};
255
256static const _ExtendedGDBusMethodInfo * const _fan_method_info_pointers[] =
257{
258 &_fan_method_info_set_cooling_zone,
259 &_fan_method_info_get_speed,
260 &_fan_method_info_set_speed,
261 NULL
262};
263
264static const _ExtendedGDBusArgInfo _fan_signal_info_speed_changed_ARG_speed =
265{
266 {
267 -1,
268 (gchar *) "speed",
269 (gchar *) "i",
270 NULL
271 },
272 FALSE
273};
274
275static const _ExtendedGDBusArgInfo * const _fan_signal_info_speed_changed_ARG_pointers[] =
276{
277 &_fan_signal_info_speed_changed_ARG_speed,
278 NULL
279};
280
281static const _ExtendedGDBusSignalInfo _fan_signal_info_speed_changed =
282{
283 {
284 -1,
285 (gchar *) "SpeedChanged",
286 (GDBusArgInfo **) &_fan_signal_info_speed_changed_ARG_pointers,
287 NULL
288 },
289 "speed-changed"
290};
291
292static const _ExtendedGDBusSignalInfo _fan_signal_info_tach_error =
293{
294 {
295 -1,
296 (gchar *) "TachError",
297 NULL,
298 NULL
299 },
300 "tach-error"
301};
302
303static const _ExtendedGDBusSignalInfo * const _fan_signal_info_pointers[] =
304{
305 &_fan_signal_info_speed_changed,
306 &_fan_signal_info_tach_error,
307 NULL
308};
309
310static const _ExtendedGDBusPropertyInfo _fan_property_info_speed =
311{
312 {
313 -1,
314 (gchar *) "speed",
315 (gchar *) "i",
316 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
317 NULL
318 },
319 "speed",
320 FALSE
321};
322
323static const _ExtendedGDBusPropertyInfo _fan_property_info_cooling_zone =
324{
325 {
326 -1,
327 (gchar *) "cooling_zone",
328 (gchar *) "i",
329 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
330 NULL
331 },
332 "cooling-zone",
333 FALSE
334};
335
336static const _ExtendedGDBusPropertyInfo _fan_property_info_pwm_num =
337{
338 {
339 -1,
340 (gchar *) "pwm_num",
341 (gchar *) "i",
342 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
343 NULL
344 },
345 "pwm-num",
346 FALSE
347};
348
349static const _ExtendedGDBusPropertyInfo * const _fan_property_info_pointers[] =
350{
351 &_fan_property_info_speed,
352 &_fan_property_info_cooling_zone,
353 &_fan_property_info_pwm_num,
354 NULL
355};
356
357static const _ExtendedGDBusInterfaceInfo _fan_interface_info =
358{
359 {
360 -1,
361 (gchar *) "org.openbmc.Fan",
362 (GDBusMethodInfo **) &_fan_method_info_pointers,
363 (GDBusSignalInfo **) &_fan_signal_info_pointers,
364 (GDBusPropertyInfo **) &_fan_property_info_pointers,
365 NULL
366 },
367 "fan",
368};
369
370
371/**
372 * fan_interface_info:
373 *
374 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> D-Bus interface.
375 *
376 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
377 */
378GDBusInterfaceInfo *
379fan_interface_info (void)
380{
381 return (GDBusInterfaceInfo *) &_fan_interface_info.parent_struct;
382}
383
384/**
385 * fan_override_properties:
386 * @klass: The class structure for a #GObject<!-- -->-derived class.
387 * @property_id_begin: The property id to assign to the first overridden property.
388 *
389 * Overrides all #GObject properties in the #Fan interface for a concrete class.
390 * The properties are overridden in the order they are defined.
391 *
392 * Returns: The last property id.
393 */
394guint
395fan_override_properties (GObjectClass *klass, guint property_id_begin)
396{
397 g_object_class_override_property (klass, property_id_begin++, "speed");
398 g_object_class_override_property (klass, property_id_begin++, "cooling-zone");
399 g_object_class_override_property (klass, property_id_begin++, "pwm-num");
400 return property_id_begin - 1;
401}
402
403
404
405/**
406 * Fan:
407 *
408 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
409 */
410
411/**
412 * FanIface:
413 * @parent_iface: The parent interface.
414 * @handle_get_speed: Handler for the #Fan::handle-get-speed signal.
415 * @handle_set_cooling_zone: Handler for the #Fan::handle-set-cooling-zone signal.
416 * @handle_set_speed: Handler for the #Fan::handle-set-speed signal.
417 * @get_cooling_zone: Getter for the #Fan:cooling-zone property.
418 * @get_pwm_num: Getter for the #Fan:pwm-num property.
419 * @get_speed: Getter for the #Fan:speed property.
420 * @speed_changed: Handler for the #Fan::speed-changed signal.
421 * @tach_error: Handler for the #Fan::tach-error signal.
422 *
423 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
424 */
425
426typedef FanIface FanInterface;
427G_DEFINE_INTERFACE (Fan, fan, G_TYPE_OBJECT);
428
429static void
430fan_default_init (FanIface *iface)
431{
432 /* GObject signals for incoming D-Bus method calls: */
433 /**
434 * Fan::handle-set-cooling-zone:
435 * @object: A #Fan.
436 * @invocation: A #GDBusMethodInvocation.
437 * @arg_cooling_zone: Argument passed by remote caller.
438 *
439 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method.
440 *
441 * 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.
442 *
443 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
444 */
445 g_signal_new ("handle-set-cooling-zone",
446 G_TYPE_FROM_INTERFACE (iface),
447 G_SIGNAL_RUN_LAST,
448 G_STRUCT_OFFSET (FanIface, handle_set_cooling_zone),
449 g_signal_accumulator_true_handled,
450 NULL,
451 g_cclosure_marshal_generic,
452 G_TYPE_BOOLEAN,
453 2,
454 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
455
456 /**
457 * Fan::handle-get-speed:
458 * @object: A #Fan.
459 * @invocation: A #GDBusMethodInvocation.
460 *
461 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method.
462 *
463 * 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.
464 *
465 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
466 */
467 g_signal_new ("handle-get-speed",
468 G_TYPE_FROM_INTERFACE (iface),
469 G_SIGNAL_RUN_LAST,
470 G_STRUCT_OFFSET (FanIface, handle_get_speed),
471 g_signal_accumulator_true_handled,
472 NULL,
473 g_cclosure_marshal_generic,
474 G_TYPE_BOOLEAN,
475 1,
476 G_TYPE_DBUS_METHOD_INVOCATION);
477
478 /**
479 * Fan::handle-set-speed:
480 * @object: A #Fan.
481 * @invocation: A #GDBusMethodInvocation.
482 * @arg_speed: Argument passed by remote caller.
483 *
484 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method.
485 *
486 * 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.
487 *
488 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
489 */
490 g_signal_new ("handle-set-speed",
491 G_TYPE_FROM_INTERFACE (iface),
492 G_SIGNAL_RUN_LAST,
493 G_STRUCT_OFFSET (FanIface, handle_set_speed),
494 g_signal_accumulator_true_handled,
495 NULL,
496 g_cclosure_marshal_generic,
497 G_TYPE_BOOLEAN,
498 2,
499 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
500
501 /* GObject signals for received D-Bus signals: */
502 /**
503 * Fan::speed-changed:
504 * @object: A #Fan.
505 * @arg_speed: Argument.
506 *
507 * 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.
508 *
509 * 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.
510 */
511 g_signal_new ("speed-changed",
512 G_TYPE_FROM_INTERFACE (iface),
513 G_SIGNAL_RUN_LAST,
514 G_STRUCT_OFFSET (FanIface, speed_changed),
515 NULL,
516 NULL,
517 g_cclosure_marshal_generic,
518 G_TYPE_NONE,
519 1, G_TYPE_INT);
520
521 /**
522 * Fan::tach-error:
523 * @object: A #Fan.
524 *
525 * 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.
526 *
527 * 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.
528 */
529 g_signal_new ("tach-error",
530 G_TYPE_FROM_INTERFACE (iface),
531 G_SIGNAL_RUN_LAST,
532 G_STRUCT_OFFSET (FanIface, tach_error),
533 NULL,
534 NULL,
535 g_cclosure_marshal_generic,
536 G_TYPE_NONE,
537 0);
538
539 /* GObject properties for D-Bus properties: */
540 /**
541 * Fan:speed:
542 *
543 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link>.
544 *
545 * 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.
546 */
547 g_object_interface_install_property (iface,
548 g_param_spec_int ("speed", "speed", "speed", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
549 /**
550 * Fan:cooling-zone:
551 *
552 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link>.
553 *
554 * 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.
555 */
556 g_object_interface_install_property (iface,
557 g_param_spec_int ("cooling-zone", "cooling_zone", "cooling_zone", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
558 /**
559 * Fan:pwm-num:
560 *
561 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link>.
562 *
563 * 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.
564 */
565 g_object_interface_install_property (iface,
566 g_param_spec_int ("pwm-num", "pwm_num", "pwm_num", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
567}
568
569/**
570 * fan_get_speed: (skip)
571 * @object: A #Fan.
572 *
573 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property.
574 *
575 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
576 *
577 * Returns: The property value.
578 */
579gint
580fan_get_speed (Fan *object)
581{
582 return FAN_GET_IFACE (object)->get_speed (object);
583}
584
585/**
586 * fan_set_speed: (skip)
587 * @object: A #Fan.
588 * @value: The value to set.
589 *
590 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property to @value.
591 *
592 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
593 */
594void
595fan_set_speed (Fan *object, gint value)
596{
597 g_object_set (G_OBJECT (object), "speed", value, NULL);
598}
599
600/**
601 * fan_get_cooling_zone: (skip)
602 * @object: A #Fan.
603 *
604 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property.
605 *
606 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
607 *
608 * Returns: The property value.
609 */
610gint
611fan_get_cooling_zone (Fan *object)
612{
613 return FAN_GET_IFACE (object)->get_cooling_zone (object);
614}
615
616/**
617 * fan_set_cooling_zone: (skip)
618 * @object: A #Fan.
619 * @value: The value to set.
620 *
621 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property to @value.
622 *
623 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
624 */
625void
626fan_set_cooling_zone (Fan *object, gint value)
627{
628 g_object_set (G_OBJECT (object), "cooling-zone", value, NULL);
629}
630
631/**
632 * fan_get_pwm_num: (skip)
633 * @object: A #Fan.
634 *
635 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property.
636 *
637 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
638 *
639 * Returns: The property value.
640 */
641gint
642fan_get_pwm_num (Fan *object)
643{
644 return FAN_GET_IFACE (object)->get_pwm_num (object);
645}
646
647/**
648 * fan_set_pwm_num: (skip)
649 * @object: A #Fan.
650 * @value: The value to set.
651 *
652 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property to @value.
653 *
654 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
655 */
656void
657fan_set_pwm_num (Fan *object, gint value)
658{
659 g_object_set (G_OBJECT (object), "pwm-num", value, NULL);
660}
661
662/**
663 * fan_emit_speed_changed:
664 * @object: A #Fan.
665 * @arg_speed: Argument to pass with the signal.
666 *
667 * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.SpeedChanged">"SpeedChanged"</link> D-Bus signal.
668 */
669void
670fan_emit_speed_changed (
671 Fan *object,
672 gint arg_speed)
673{
674 g_signal_emit_by_name (object, "speed-changed", arg_speed);
675}
676
677/**
678 * fan_emit_tach_error:
679 * @object: A #Fan.
680 *
681 * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.TachError">"TachError"</link> D-Bus signal.
682 */
683void
684fan_emit_tach_error (
685 Fan *object)
686{
687 g_signal_emit_by_name (object, "tach-error");
688}
689
690/**
691 * fan_call_set_cooling_zone:
692 * @proxy: A #FanProxy.
693 * @arg_cooling_zone: Argument to pass with the method invocation.
694 * @cancellable: (allow-none): A #GCancellable or %NULL.
695 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
696 * @user_data: User data to pass to @callback.
697 *
698 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method on @proxy.
699 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
700 * You can then call fan_call_set_cooling_zone_finish() to get the result of the operation.
701 *
702 * See fan_call_set_cooling_zone_sync() for the synchronous, blocking version of this method.
703 */
704void
705fan_call_set_cooling_zone (
706 Fan *proxy,
707 gint arg_cooling_zone,
708 GCancellable *cancellable,
709 GAsyncReadyCallback callback,
710 gpointer user_data)
711{
712 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
713 "setCoolingZone",
714 g_variant_new ("(i)",
715 arg_cooling_zone),
716 G_DBUS_CALL_FLAGS_NONE,
717 -1,
718 cancellable,
719 callback,
720 user_data);
721}
722
723/**
724 * fan_call_set_cooling_zone_finish:
725 * @proxy: A #FanProxy.
726 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_cooling_zone().
727 * @error: Return location for error or %NULL.
728 *
729 * Finishes an operation started with fan_call_set_cooling_zone().
730 *
731 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
732 */
733gboolean
734fan_call_set_cooling_zone_finish (
735 Fan *proxy,
736 GAsyncResult *res,
737 GError **error)
738{
739 GVariant *_ret;
740 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
741 if (_ret == NULL)
742 goto _out;
743 g_variant_get (_ret,
744 "()");
745 g_variant_unref (_ret);
746_out:
747 return _ret != NULL;
748}
749
750/**
751 * fan_call_set_cooling_zone_sync:
752 * @proxy: A #FanProxy.
753 * @arg_cooling_zone: Argument to pass with the method invocation.
754 * @cancellable: (allow-none): A #GCancellable or %NULL.
755 * @error: Return location for error or %NULL.
756 *
757 * 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.
758 *
759 * See fan_call_set_cooling_zone() for the asynchronous version of this method.
760 *
761 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
762 */
763gboolean
764fan_call_set_cooling_zone_sync (
765 Fan *proxy,
766 gint arg_cooling_zone,
767 GCancellable *cancellable,
768 GError **error)
769{
770 GVariant *_ret;
771 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
772 "setCoolingZone",
773 g_variant_new ("(i)",
774 arg_cooling_zone),
775 G_DBUS_CALL_FLAGS_NONE,
776 -1,
777 cancellable,
778 error);
779 if (_ret == NULL)
780 goto _out;
781 g_variant_get (_ret,
782 "()");
783 g_variant_unref (_ret);
784_out:
785 return _ret != NULL;
786}
787
788/**
789 * fan_call_get_speed:
790 * @proxy: A #FanProxy.
791 * @cancellable: (allow-none): A #GCancellable or %NULL.
792 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
793 * @user_data: User data to pass to @callback.
794 *
795 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method on @proxy.
796 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
797 * You can then call fan_call_get_speed_finish() to get the result of the operation.
798 *
799 * See fan_call_get_speed_sync() for the synchronous, blocking version of this method.
800 */
801void
802fan_call_get_speed (
803 Fan *proxy,
804 GCancellable *cancellable,
805 GAsyncReadyCallback callback,
806 gpointer user_data)
807{
808 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
809 "getSpeed",
810 g_variant_new ("()"),
811 G_DBUS_CALL_FLAGS_NONE,
812 -1,
813 cancellable,
814 callback,
815 user_data);
816}
817
818/**
819 * fan_call_get_speed_finish:
820 * @proxy: A #FanProxy.
821 * @out_speed: (out): Return location for return parameter or %NULL to ignore.
822 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_get_speed().
823 * @error: Return location for error or %NULL.
824 *
825 * Finishes an operation started with fan_call_get_speed().
826 *
827 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
828 */
829gboolean
830fan_call_get_speed_finish (
831 Fan *proxy,
832 gint *out_speed,
833 GAsyncResult *res,
834 GError **error)
835{
836 GVariant *_ret;
837 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
838 if (_ret == NULL)
839 goto _out;
840 g_variant_get (_ret,
841 "(i)",
842 out_speed);
843 g_variant_unref (_ret);
844_out:
845 return _ret != NULL;
846}
847
848/**
849 * fan_call_get_speed_sync:
850 * @proxy: A #FanProxy.
851 * @out_speed: (out): Return location for return parameter or %NULL to ignore.
852 * @cancellable: (allow-none): A #GCancellable or %NULL.
853 * @error: Return location for error or %NULL.
854 *
855 * 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.
856 *
857 * See fan_call_get_speed() for the asynchronous version of this method.
858 *
859 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
860 */
861gboolean
862fan_call_get_speed_sync (
863 Fan *proxy,
864 gint *out_speed,
865 GCancellable *cancellable,
866 GError **error)
867{
868 GVariant *_ret;
869 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
870 "getSpeed",
871 g_variant_new ("()"),
872 G_DBUS_CALL_FLAGS_NONE,
873 -1,
874 cancellable,
875 error);
876 if (_ret == NULL)
877 goto _out;
878 g_variant_get (_ret,
879 "(i)",
880 out_speed);
881 g_variant_unref (_ret);
882_out:
883 return _ret != NULL;
884}
885
886/**
887 * fan_call_set_speed:
888 * @proxy: A #FanProxy.
889 * @arg_speed: Argument to pass with the method invocation.
890 * @cancellable: (allow-none): A #GCancellable or %NULL.
891 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
892 * @user_data: User data to pass to @callback.
893 *
894 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method on @proxy.
895 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
896 * You can then call fan_call_set_speed_finish() to get the result of the operation.
897 *
898 * See fan_call_set_speed_sync() for the synchronous, blocking version of this method.
899 */
900void
901fan_call_set_speed (
902 Fan *proxy,
903 gint arg_speed,
904 GCancellable *cancellable,
905 GAsyncReadyCallback callback,
906 gpointer user_data)
907{
908 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
909 "setSpeed",
910 g_variant_new ("(i)",
911 arg_speed),
912 G_DBUS_CALL_FLAGS_NONE,
913 -1,
914 cancellable,
915 callback,
916 user_data);
917}
918
919/**
920 * fan_call_set_speed_finish:
921 * @proxy: A #FanProxy.
922 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_speed().
923 * @error: Return location for error or %NULL.
924 *
925 * Finishes an operation started with fan_call_set_speed().
926 *
927 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
928 */
929gboolean
930fan_call_set_speed_finish (
931 Fan *proxy,
932 GAsyncResult *res,
933 GError **error)
934{
935 GVariant *_ret;
936 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
937 if (_ret == NULL)
938 goto _out;
939 g_variant_get (_ret,
940 "()");
941 g_variant_unref (_ret);
942_out:
943 return _ret != NULL;
944}
945
946/**
947 * fan_call_set_speed_sync:
948 * @proxy: A #FanProxy.
949 * @arg_speed: Argument to pass with the method invocation.
950 * @cancellable: (allow-none): A #GCancellable or %NULL.
951 * @error: Return location for error or %NULL.
952 *
953 * 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.
954 *
955 * See fan_call_set_speed() for the asynchronous version of this method.
956 *
957 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
958 */
959gboolean
960fan_call_set_speed_sync (
961 Fan *proxy,
962 gint arg_speed,
963 GCancellable *cancellable,
964 GError **error)
965{
966 GVariant *_ret;
967 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
968 "setSpeed",
969 g_variant_new ("(i)",
970 arg_speed),
971 G_DBUS_CALL_FLAGS_NONE,
972 -1,
973 cancellable,
974 error);
975 if (_ret == NULL)
976 goto _out;
977 g_variant_get (_ret,
978 "()");
979 g_variant_unref (_ret);
980_out:
981 return _ret != NULL;
982}
983
984/**
985 * fan_complete_set_cooling_zone:
986 * @object: A #Fan.
987 * @invocation: (transfer full): A #GDBusMethodInvocation.
988 *
989 * 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.
990 *
991 * This method will free @invocation, you cannot use it afterwards.
992 */
993void
994fan_complete_set_cooling_zone (
995 Fan *object,
996 GDBusMethodInvocation *invocation)
997{
998 g_dbus_method_invocation_return_value (invocation,
999 g_variant_new ("()"));
1000}
1001
1002/**
1003 * fan_complete_get_speed:
1004 * @object: A #Fan.
1005 * @invocation: (transfer full): A #GDBusMethodInvocation.
1006 * @speed: Parameter to return.
1007 *
1008 * 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.
1009 *
1010 * This method will free @invocation, you cannot use it afterwards.
1011 */
1012void
1013fan_complete_get_speed (
1014 Fan *object,
1015 GDBusMethodInvocation *invocation,
1016 gint speed)
1017{
1018 g_dbus_method_invocation_return_value (invocation,
1019 g_variant_new ("(i)",
1020 speed));
1021}
1022
1023/**
1024 * fan_complete_set_speed:
1025 * @object: A #Fan.
1026 * @invocation: (transfer full): A #GDBusMethodInvocation.
1027 *
1028 * 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.
1029 *
1030 * This method will free @invocation, you cannot use it afterwards.
1031 */
1032void
1033fan_complete_set_speed (
1034 Fan *object,
1035 GDBusMethodInvocation *invocation)
1036{
1037 g_dbus_method_invocation_return_value (invocation,
1038 g_variant_new ("()"));
1039}
1040
1041/* ------------------------------------------------------------------------ */
1042
1043/**
1044 * FanProxy:
1045 *
1046 * The #FanProxy structure contains only private data and should only be accessed using the provided API.
1047 */
1048
1049/**
1050 * FanProxyClass:
1051 * @parent_class: The parent class.
1052 *
1053 * Class structure for #FanProxy.
1054 */
1055
1056struct _FanProxyPrivate
1057{
1058 GData *qdata;
1059};
1060
1061static void fan_proxy_iface_init (FanIface *iface);
1062
1063#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1064G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY,
1065 G_ADD_PRIVATE (FanProxy)
1066 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init));
1067
1068#else
1069G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY,
1070 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init));
1071
1072#endif
1073static void
1074fan_proxy_finalize (GObject *object)
1075{
1076 FanProxy *proxy = FAN_PROXY (object);
1077 g_datalist_clear (&proxy->priv->qdata);
1078 G_OBJECT_CLASS (fan_proxy_parent_class)->finalize (object);
1079}
1080
1081static void
1082fan_proxy_get_property (GObject *object,
1083 guint prop_id,
1084 GValue *value,
1085 GParamSpec *pspec G_GNUC_UNUSED)
1086{
1087 const _ExtendedGDBusPropertyInfo *info;
1088 GVariant *variant;
1089 g_assert (prop_id != 0 && prop_id - 1 < 3);
1090 info = _fan_property_info_pointers[prop_id - 1];
1091 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
1092 if (info->use_gvariant)
1093 {
1094 g_value_set_variant (value, variant);
1095 }
1096 else
1097 {
1098 if (variant != NULL)
1099 g_dbus_gvariant_to_gvalue (variant, value);
1100 }
1101 if (variant != NULL)
1102 g_variant_unref (variant);
1103}
1104
1105static void
1106fan_proxy_set_property_cb (GDBusProxy *proxy,
1107 GAsyncResult *res,
1108 gpointer user_data)
1109{
1110 const _ExtendedGDBusPropertyInfo *info = user_data;
1111 GError *error;
1112 GVariant *_ret;
1113 error = NULL;
1114 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
1115 if (!_ret)
1116 {
1117 g_warning ("Error setting property '%s' on interface org.openbmc.Fan: %s (%s, %d)",
1118 info->parent_struct.name,
1119 error->message, g_quark_to_string (error->domain), error->code);
1120 g_error_free (error);
1121 }
1122 else
1123 {
1124 g_variant_unref (_ret);
1125 }
1126}
1127
1128static void
1129fan_proxy_set_property (GObject *object,
1130 guint prop_id,
1131 const GValue *value,
1132 GParamSpec *pspec G_GNUC_UNUSED)
1133{
1134 const _ExtendedGDBusPropertyInfo *info;
1135 GVariant *variant;
1136 g_assert (prop_id != 0 && prop_id - 1 < 3);
1137 info = _fan_property_info_pointers[prop_id - 1];
1138 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
1139 g_dbus_proxy_call (G_DBUS_PROXY (object),
1140 "org.freedesktop.DBus.Properties.Set",
1141 g_variant_new ("(ssv)", "org.openbmc.Fan", info->parent_struct.name, variant),
1142 G_DBUS_CALL_FLAGS_NONE,
1143 -1,
1144 NULL, (GAsyncReadyCallback) fan_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
1145 g_variant_unref (variant);
1146}
1147
1148static void
1149fan_proxy_g_signal (GDBusProxy *proxy,
1150 const gchar *sender_name G_GNUC_UNUSED,
1151 const gchar *signal_name,
1152 GVariant *parameters)
1153{
1154 _ExtendedGDBusSignalInfo *info;
1155 GVariantIter iter;
1156 GVariant *child;
1157 GValue *paramv;
1158 guint num_params;
1159 guint n;
1160 guint signal_id;
1161 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, signal_name);
1162 if (info == NULL)
1163 return;
1164 num_params = g_variant_n_children (parameters);
1165 paramv = g_new0 (GValue, num_params + 1);
1166 g_value_init (&paramv[0], TYPE_FAN);
1167 g_value_set_object (&paramv[0], proxy);
1168 g_variant_iter_init (&iter, parameters);
1169 n = 1;
1170 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1171 {
1172 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
1173 if (arg_info->use_gvariant)
1174 {
1175 g_value_init (&paramv[n], G_TYPE_VARIANT);
1176 g_value_set_variant (&paramv[n], child);
1177 n++;
1178 }
1179 else
1180 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
1181 g_variant_unref (child);
1182 }
1183 signal_id = g_signal_lookup (info->signal_name, TYPE_FAN);
1184 g_signal_emitv (paramv, signal_id, 0, NULL);
1185 for (n = 0; n < num_params + 1; n++)
1186 g_value_unset (&paramv[n]);
1187 g_free (paramv);
1188}
1189
1190static void
1191fan_proxy_g_properties_changed (GDBusProxy *_proxy,
1192 GVariant *changed_properties,
1193 const gchar *const *invalidated_properties)
1194{
1195 FanProxy *proxy = FAN_PROXY (_proxy);
1196 guint n;
1197 const gchar *key;
1198 GVariantIter *iter;
1199 _ExtendedGDBusPropertyInfo *info;
1200 g_variant_get (changed_properties, "a{sv}", &iter);
1201 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
1202 {
1203 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, key);
1204 g_datalist_remove_data (&proxy->priv->qdata, key);
1205 if (info != NULL)
1206 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
1207 }
1208 g_variant_iter_free (iter);
1209 for (n = 0; invalidated_properties[n] != NULL; n++)
1210 {
1211 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, invalidated_properties[n]);
1212 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
1213 if (info != NULL)
1214 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
1215 }
1216}
1217
1218static gint
1219fan_proxy_get_speed (Fan *object)
1220{
1221 FanProxy *proxy = FAN_PROXY (object);
1222 GVariant *variant;
1223 gint value = 0;
1224 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "speed");
1225 if (variant != NULL)
1226 {
1227 value = g_variant_get_int32 (variant);
1228 g_variant_unref (variant);
1229 }
1230 return value;
1231}
1232
1233static gint
1234fan_proxy_get_cooling_zone (Fan *object)
1235{
1236 FanProxy *proxy = FAN_PROXY (object);
1237 GVariant *variant;
1238 gint value = 0;
1239 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "cooling_zone");
1240 if (variant != NULL)
1241 {
1242 value = g_variant_get_int32 (variant);
1243 g_variant_unref (variant);
1244 }
1245 return value;
1246}
1247
1248static gint
1249fan_proxy_get_pwm_num (Fan *object)
1250{
1251 FanProxy *proxy = FAN_PROXY (object);
1252 GVariant *variant;
1253 gint value = 0;
1254 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pwm_num");
1255 if (variant != NULL)
1256 {
1257 value = g_variant_get_int32 (variant);
1258 g_variant_unref (variant);
1259 }
1260 return value;
1261}
1262
1263static void
1264fan_proxy_init (FanProxy *proxy)
1265{
1266#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1267 proxy->priv = fan_proxy_get_instance_private (proxy);
1268#else
1269 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FAN_PROXY, FanProxyPrivate);
1270#endif
1271
1272 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), fan_interface_info ());
1273}
1274
1275static void
1276fan_proxy_class_init (FanProxyClass *klass)
1277{
1278 GObjectClass *gobject_class;
1279 GDBusProxyClass *proxy_class;
1280
1281 gobject_class = G_OBJECT_CLASS (klass);
1282 gobject_class->finalize = fan_proxy_finalize;
1283 gobject_class->get_property = fan_proxy_get_property;
1284 gobject_class->set_property = fan_proxy_set_property;
1285
1286 proxy_class = G_DBUS_PROXY_CLASS (klass);
1287 proxy_class->g_signal = fan_proxy_g_signal;
1288 proxy_class->g_properties_changed = fan_proxy_g_properties_changed;
1289
1290 fan_override_properties (gobject_class, 1);
1291
1292#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1293 g_type_class_add_private (klass, sizeof (FanProxyPrivate));
1294#endif
1295}
1296
1297static void
1298fan_proxy_iface_init (FanIface *iface)
1299{
1300 iface->get_speed = fan_proxy_get_speed;
1301 iface->get_cooling_zone = fan_proxy_get_cooling_zone;
1302 iface->get_pwm_num = fan_proxy_get_pwm_num;
1303}
1304
1305/**
1306 * fan_proxy_new:
1307 * @connection: A #GDBusConnection.
1308 * @flags: Flags from the #GDBusProxyFlags enumeration.
1309 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1310 * @object_path: An object path.
1311 * @cancellable: (allow-none): A #GCancellable or %NULL.
1312 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1313 * @user_data: User data to pass to @callback.
1314 *
1315 * 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.
1316 *
1317 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
1318 * You can then call fan_proxy_new_finish() to get the result of the operation.
1319 *
1320 * See fan_proxy_new_sync() for the synchronous, blocking version of this constructor.
1321 */
1322void
1323fan_proxy_new (
1324 GDBusConnection *connection,
1325 GDBusProxyFlags flags,
1326 const gchar *name,
1327 const gchar *object_path,
1328 GCancellable *cancellable,
1329 GAsyncReadyCallback callback,
1330 gpointer user_data)
1331{
1332 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);
1333}
1334
1335/**
1336 * fan_proxy_new_finish:
1337 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new().
1338 * @error: Return location for error or %NULL
1339 *
1340 * Finishes an operation started with fan_proxy_new().
1341 *
1342 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
1343 */
1344Fan *
1345fan_proxy_new_finish (
1346 GAsyncResult *res,
1347 GError **error)
1348{
1349 GObject *ret;
1350 GObject *source_object;
1351 source_object = g_async_result_get_source_object (res);
1352 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1353 g_object_unref (source_object);
1354 if (ret != NULL)
1355 return FAN (ret);
1356 else
1357 return NULL;
1358}
1359
1360/**
1361 * fan_proxy_new_sync:
1362 * @connection: A #GDBusConnection.
1363 * @flags: Flags from the #GDBusProxyFlags enumeration.
1364 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1365 * @object_path: An object path.
1366 * @cancellable: (allow-none): A #GCancellable or %NULL.
1367 * @error: Return location for error or %NULL
1368 *
1369 * 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.
1370 *
1371 * The calling thread is blocked until a reply is received.
1372 *
1373 * See fan_proxy_new() for the asynchronous version of this constructor.
1374 *
1375 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
1376 */
1377Fan *
1378fan_proxy_new_sync (
1379 GDBusConnection *connection,
1380 GDBusProxyFlags flags,
1381 const gchar *name,
1382 const gchar *object_path,
1383 GCancellable *cancellable,
1384 GError **error)
1385{
1386 GInitable *ret;
1387 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);
1388 if (ret != NULL)
1389 return FAN (ret);
1390 else
1391 return NULL;
1392}
1393
1394
1395/**
1396 * fan_proxy_new_for_bus:
1397 * @bus_type: A #GBusType.
1398 * @flags: Flags from the #GDBusProxyFlags enumeration.
1399 * @name: A bus name (well-known or unique).
1400 * @object_path: An object path.
1401 * @cancellable: (allow-none): A #GCancellable or %NULL.
1402 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1403 * @user_data: User data to pass to @callback.
1404 *
1405 * Like fan_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
1406 *
1407 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
1408 * You can then call fan_proxy_new_for_bus_finish() to get the result of the operation.
1409 *
1410 * See fan_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
1411 */
1412void
1413fan_proxy_new_for_bus (
1414 GBusType bus_type,
1415 GDBusProxyFlags flags,
1416 const gchar *name,
1417 const gchar *object_path,
1418 GCancellable *cancellable,
1419 GAsyncReadyCallback callback,
1420 gpointer user_data)
1421{
1422 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);
1423}
1424
1425/**
1426 * fan_proxy_new_for_bus_finish:
1427 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new_for_bus().
1428 * @error: Return location for error or %NULL
1429 *
1430 * Finishes an operation started with fan_proxy_new_for_bus().
1431 *
1432 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
1433 */
1434Fan *
1435fan_proxy_new_for_bus_finish (
1436 GAsyncResult *res,
1437 GError **error)
1438{
1439 GObject *ret;
1440 GObject *source_object;
1441 source_object = g_async_result_get_source_object (res);
1442 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1443 g_object_unref (source_object);
1444 if (ret != NULL)
1445 return FAN (ret);
1446 else
1447 return NULL;
1448}
1449
1450/**
1451 * fan_proxy_new_for_bus_sync:
1452 * @bus_type: A #GBusType.
1453 * @flags: Flags from the #GDBusProxyFlags enumeration.
1454 * @name: A bus name (well-known or unique).
1455 * @object_path: An object path.
1456 * @cancellable: (allow-none): A #GCancellable or %NULL.
1457 * @error: Return location for error or %NULL
1458 *
1459 * Like fan_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
1460 *
1461 * The calling thread is blocked until a reply is received.
1462 *
1463 * See fan_proxy_new_for_bus() for the asynchronous version of this constructor.
1464 *
1465 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
1466 */
1467Fan *
1468fan_proxy_new_for_bus_sync (
1469 GBusType bus_type,
1470 GDBusProxyFlags flags,
1471 const gchar *name,
1472 const gchar *object_path,
1473 GCancellable *cancellable,
1474 GError **error)
1475{
1476 GInitable *ret;
1477 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);
1478 if (ret != NULL)
1479 return FAN (ret);
1480 else
1481 return NULL;
1482}
1483
1484
1485/* ------------------------------------------------------------------------ */
1486
1487/**
1488 * FanSkeleton:
1489 *
1490 * The #FanSkeleton structure contains only private data and should only be accessed using the provided API.
1491 */
1492
1493/**
1494 * FanSkeletonClass:
1495 * @parent_class: The parent class.
1496 *
1497 * Class structure for #FanSkeleton.
1498 */
1499
1500struct _FanSkeletonPrivate
1501{
1502 GValue *properties;
1503 GList *changed_properties;
1504 GSource *changed_properties_idle_source;
1505 GMainContext *context;
1506 GMutex lock;
1507};
1508
1509static void
1510_fan_skeleton_handle_method_call (
1511 GDBusConnection *connection G_GNUC_UNUSED,
1512 const gchar *sender G_GNUC_UNUSED,
1513 const gchar *object_path G_GNUC_UNUSED,
1514 const gchar *interface_name,
1515 const gchar *method_name,
1516 GVariant *parameters,
1517 GDBusMethodInvocation *invocation,
1518 gpointer user_data)
1519{
1520 FanSkeleton *skeleton = FAN_SKELETON (user_data);
1521 _ExtendedGDBusMethodInfo *info;
1522 GVariantIter iter;
1523 GVariant *child;
1524 GValue *paramv;
1525 guint num_params;
1526 guint num_extra;
1527 guint n;
1528 guint signal_id;
1529 GValue return_value = G_VALUE_INIT;
1530 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
1531 g_assert (info != NULL);
1532 num_params = g_variant_n_children (parameters);
1533 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
1534 n = 0;
1535 g_value_init (&paramv[n], TYPE_FAN);
1536 g_value_set_object (&paramv[n++], skeleton);
1537 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
1538 g_value_set_object (&paramv[n++], invocation);
1539 if (info->pass_fdlist)
1540 {
1541#ifdef G_OS_UNIX
1542 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
1543 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
1544#else
1545 g_assert_not_reached ();
1546#endif
1547 }
1548 g_variant_iter_init (&iter, parameters);
1549 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1550 {
1551 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
1552 if (arg_info->use_gvariant)
1553 {
1554 g_value_init (&paramv[n], G_TYPE_VARIANT);
1555 g_value_set_variant (&paramv[n], child);
1556 n++;
1557 }
1558 else
1559 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
1560 g_variant_unref (child);
1561 }
1562 signal_id = g_signal_lookup (info->signal_name, TYPE_FAN);
1563 g_value_init (&return_value, G_TYPE_BOOLEAN);
1564 g_signal_emitv (paramv, signal_id, 0, &return_value);
1565 if (!g_value_get_boolean (&return_value))
1566 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);
1567 g_value_unset (&return_value);
1568 for (n = 0; n < num_params + num_extra; n++)
1569 g_value_unset (&paramv[n]);
1570 g_free (paramv);
1571}
1572
1573static GVariant *
1574_fan_skeleton_handle_get_property (
1575 GDBusConnection *connection G_GNUC_UNUSED,
1576 const gchar *sender G_GNUC_UNUSED,
1577 const gchar *object_path G_GNUC_UNUSED,
1578 const gchar *interface_name G_GNUC_UNUSED,
1579 const gchar *property_name,
1580 GError **error,
1581 gpointer user_data)
1582{
1583 FanSkeleton *skeleton = FAN_SKELETON (user_data);
1584 GValue value = G_VALUE_INIT;
1585 GParamSpec *pspec;
1586 _ExtendedGDBusPropertyInfo *info;
1587 GVariant *ret;
1588 ret = NULL;
1589 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name);
1590 g_assert (info != NULL);
1591 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1592 if (pspec == NULL)
1593 {
1594 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1595 }
1596 else
1597 {
1598 g_value_init (&value, pspec->value_type);
1599 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1600 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
1601 g_value_unset (&value);
1602 }
1603 return ret;
1604}
1605
1606static gboolean
1607_fan_skeleton_handle_set_property (
1608 GDBusConnection *connection G_GNUC_UNUSED,
1609 const gchar *sender G_GNUC_UNUSED,
1610 const gchar *object_path G_GNUC_UNUSED,
1611 const gchar *interface_name G_GNUC_UNUSED,
1612 const gchar *property_name,
1613 GVariant *variant,
1614 GError **error,
1615 gpointer user_data)
1616{
1617 FanSkeleton *skeleton = FAN_SKELETON (user_data);
1618 GValue value = G_VALUE_INIT;
1619 GParamSpec *pspec;
1620 _ExtendedGDBusPropertyInfo *info;
1621 gboolean ret;
1622 ret = FALSE;
1623 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name);
1624 g_assert (info != NULL);
1625 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1626 if (pspec == NULL)
1627 {
1628 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1629 }
1630 else
1631 {
1632 if (info->use_gvariant)
1633 g_value_set_variant (&value, variant);
1634 else
1635 g_dbus_gvariant_to_gvalue (variant, &value);
1636 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1637 g_value_unset (&value);
1638 ret = TRUE;
1639 }
1640 return ret;
1641}
1642
1643static const GDBusInterfaceVTable _fan_skeleton_vtable =
1644{
1645 _fan_skeleton_handle_method_call,
1646 _fan_skeleton_handle_get_property,
1647 _fan_skeleton_handle_set_property,
1648 {NULL}
1649};
1650
1651static GDBusInterfaceInfo *
1652fan_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1653{
1654 return fan_interface_info ();
1655}
1656
1657static GDBusInterfaceVTable *
1658fan_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1659{
1660 return (GDBusInterfaceVTable *) &_fan_skeleton_vtable;
1661}
1662
1663static GVariant *
1664fan_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
1665{
1666 FanSkeleton *skeleton = FAN_SKELETON (_skeleton);
1667
1668 GVariantBuilder builder;
1669 guint n;
1670 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1671 if (_fan_interface_info.parent_struct.properties == NULL)
1672 goto out;
1673 for (n = 0; _fan_interface_info.parent_struct.properties[n] != NULL; n++)
1674 {
1675 GDBusPropertyInfo *info = _fan_interface_info.parent_struct.properties[n];
1676 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
1677 {
1678 GVariant *value;
1679 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);
1680 if (value != NULL)
1681 {
1682 g_variant_take_ref (value);
1683 g_variant_builder_add (&builder, "{sv}", info->name, value);
1684 g_variant_unref (value);
1685 }
1686 }
1687 }
1688out:
1689 return g_variant_builder_end (&builder);
1690}
1691
1692static gboolean _fan_emit_changed (gpointer user_data);
1693
1694static void
1695fan_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
1696{
1697 FanSkeleton *skeleton = FAN_SKELETON (_skeleton);
1698 gboolean emit_changed = FALSE;
1699
1700 g_mutex_lock (&skeleton->priv->lock);
1701 if (skeleton->priv->changed_properties_idle_source != NULL)
1702 {
1703 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1704 skeleton->priv->changed_properties_idle_source = NULL;
1705 emit_changed = TRUE;
1706 }
1707 g_mutex_unlock (&skeleton->priv->lock);
1708
1709 if (emit_changed)
1710 _fan_emit_changed (skeleton);
1711}
1712
1713static void
1714_fan_on_signal_speed_changed (
1715 Fan *object,
1716 gint arg_speed)
1717{
1718 FanSkeleton *skeleton = FAN_SKELETON (object);
1719
1720 GList *connections, *l;
1721 GVariant *signal_variant;
1722 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
1723
1724 signal_variant = g_variant_ref_sink (g_variant_new ("(i)",
1725 arg_speed));
1726 for (l = connections; l != NULL; l = l->next)
1727 {
1728 GDBusConnection *connection = l->data;
1729 g_dbus_connection_emit_signal (connection,
1730 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "SpeedChanged",
1731 signal_variant, NULL);
1732 }
1733 g_variant_unref (signal_variant);
1734 g_list_free_full (connections, g_object_unref);
1735}
1736
1737static void
1738_fan_on_signal_tach_error (
1739 Fan *object)
1740{
1741 FanSkeleton *skeleton = FAN_SKELETON (object);
1742
1743 GList *connections, *l;
1744 GVariant *signal_variant;
1745 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
1746
1747 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
1748 for (l = connections; l != NULL; l = l->next)
1749 {
1750 GDBusConnection *connection = l->data;
1751 g_dbus_connection_emit_signal (connection,
1752 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "TachError",
1753 signal_variant, NULL);
1754 }
1755 g_variant_unref (signal_variant);
1756 g_list_free_full (connections, g_object_unref);
1757}
1758
1759static void fan_skeleton_iface_init (FanIface *iface);
1760#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1761G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1762 G_ADD_PRIVATE (FanSkeleton)
1763 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init));
1764
1765#else
1766G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1767 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init));
1768
1769#endif
1770static void
1771fan_skeleton_finalize (GObject *object)
1772{
1773 FanSkeleton *skeleton = FAN_SKELETON (object);
1774 guint n;
1775 for (n = 0; n < 3; n++)
1776 g_value_unset (&skeleton->priv->properties[n]);
1777 g_free (skeleton->priv->properties);
1778 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1779 if (skeleton->priv->changed_properties_idle_source != NULL)
1780 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1781 g_main_context_unref (skeleton->priv->context);
1782 g_mutex_clear (&skeleton->priv->lock);
1783 G_OBJECT_CLASS (fan_skeleton_parent_class)->finalize (object);
1784}
1785
1786static void
1787fan_skeleton_get_property (GObject *object,
1788 guint prop_id,
1789 GValue *value,
1790 GParamSpec *pspec G_GNUC_UNUSED)
1791{
1792 FanSkeleton *skeleton = FAN_SKELETON (object);
1793 g_assert (prop_id != 0 && prop_id - 1 < 3);
1794 g_mutex_lock (&skeleton->priv->lock);
1795 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
1796 g_mutex_unlock (&skeleton->priv->lock);
1797}
1798
1799static gboolean
1800_fan_emit_changed (gpointer user_data)
1801{
1802 FanSkeleton *skeleton = FAN_SKELETON (user_data);
1803 GList *l;
1804 GVariantBuilder builder;
1805 GVariantBuilder invalidated_builder;
1806 guint num_changes;
1807
1808 g_mutex_lock (&skeleton->priv->lock);
1809 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1810 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
1811 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
1812 {
1813 ChangedProperty *cp = l->data;
1814 GVariant *variant;
1815 const GValue *cur_value;
1816
1817 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
1818 if (!_g_value_equal (cur_value, &cp->orig_value))
1819 {
1820 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
1821 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
1822 g_variant_unref (variant);
1823 num_changes++;
1824 }
1825 }
1826 if (num_changes > 0)
1827 {
1828 GList *connections, *ll;
1829 GVariant *signal_variant;
1830 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Fan",
1831 &builder, &invalidated_builder));
1832 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
1833 for (ll = connections; ll != NULL; ll = ll->next)
1834 {
1835 GDBusConnection *connection = ll->data;
1836
1837 g_dbus_connection_emit_signal (connection,
1838 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
1839 "org.freedesktop.DBus.Properties",
1840 "PropertiesChanged",
1841 signal_variant,
1842 NULL);
1843 }
1844 g_variant_unref (signal_variant);
1845 g_list_free_full (connections, g_object_unref);
1846 }
1847 else
1848 {
1849 g_variant_builder_clear (&builder);
1850 g_variant_builder_clear (&invalidated_builder);
1851 }
1852 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1853 skeleton->priv->changed_properties = NULL;
1854 skeleton->priv->changed_properties_idle_source = NULL;
1855 g_mutex_unlock (&skeleton->priv->lock);
1856 return FALSE;
1857}
1858
1859static void
1860_fan_schedule_emit_changed (FanSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
1861{
1862 ChangedProperty *cp;
1863 GList *l;
1864 cp = NULL;
1865 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
1866 {
1867 ChangedProperty *i_cp = l->data;
1868 if (i_cp->info == info)
1869 {
1870 cp = i_cp;
1871 break;
1872 }
1873 }
1874 if (cp == NULL)
1875 {
1876 cp = g_new0 (ChangedProperty, 1);
1877 cp->prop_id = prop_id;
1878 cp->info = info;
1879 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
1880 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
1881 g_value_copy (orig_value, &cp->orig_value);
1882 }
1883}
1884
1885static void
1886fan_skeleton_notify (GObject *object,
1887 GParamSpec *pspec G_GNUC_UNUSED)
1888{
1889 FanSkeleton *skeleton = FAN_SKELETON (object);
1890 g_mutex_lock (&skeleton->priv->lock);
1891 if (skeleton->priv->changed_properties != NULL &&
1892 skeleton->priv->changed_properties_idle_source == NULL)
1893 {
1894 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
1895 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
1896 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _fan_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
1897 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
1898 g_source_unref (skeleton->priv->changed_properties_idle_source);
1899 }
1900 g_mutex_unlock (&skeleton->priv->lock);
1901}
1902
1903static void
1904fan_skeleton_set_property (GObject *object,
1905 guint prop_id,
1906 const GValue *value,
1907 GParamSpec *pspec)
1908{
1909 FanSkeleton *skeleton = FAN_SKELETON (object);
1910 g_assert (prop_id != 0 && prop_id - 1 < 3);
1911 g_mutex_lock (&skeleton->priv->lock);
1912 g_object_freeze_notify (object);
1913 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
1914 {
1915 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
1916 _fan_schedule_emit_changed (skeleton, _fan_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
1917 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
1918 g_object_notify_by_pspec (object, pspec);
1919 }
1920 g_mutex_unlock (&skeleton->priv->lock);
1921 g_object_thaw_notify (object);
1922}
1923
1924static void
1925fan_skeleton_init (FanSkeleton *skeleton)
1926{
1927#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1928 skeleton->priv = fan_skeleton_get_instance_private (skeleton);
1929#else
1930 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FAN_SKELETON, FanSkeletonPrivate);
1931#endif
1932
1933 g_mutex_init (&skeleton->priv->lock);
1934 skeleton->priv->context = g_main_context_ref_thread_default ();
1935 skeleton->priv->properties = g_new0 (GValue, 3);
1936 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
1937 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
1938 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
1939}
1940
1941static gint
1942fan_skeleton_get_speed (Fan *object)
1943{
1944 FanSkeleton *skeleton = FAN_SKELETON (object);
1945 gint value;
1946 g_mutex_lock (&skeleton->priv->lock);
1947 value = g_value_get_int (&(skeleton->priv->properties[0]));
1948 g_mutex_unlock (&skeleton->priv->lock);
1949 return value;
1950}
1951
1952static gint
1953fan_skeleton_get_cooling_zone (Fan *object)
1954{
1955 FanSkeleton *skeleton = FAN_SKELETON (object);
1956 gint value;
1957 g_mutex_lock (&skeleton->priv->lock);
1958 value = g_value_get_int (&(skeleton->priv->properties[1]));
1959 g_mutex_unlock (&skeleton->priv->lock);
1960 return value;
1961}
1962
1963static gint
1964fan_skeleton_get_pwm_num (Fan *object)
1965{
1966 FanSkeleton *skeleton = FAN_SKELETON (object);
1967 gint value;
1968 g_mutex_lock (&skeleton->priv->lock);
1969 value = g_value_get_int (&(skeleton->priv->properties[2]));
1970 g_mutex_unlock (&skeleton->priv->lock);
1971 return value;
1972}
1973
1974static void
1975fan_skeleton_class_init (FanSkeletonClass *klass)
1976{
1977 GObjectClass *gobject_class;
1978 GDBusInterfaceSkeletonClass *skeleton_class;
1979
1980 gobject_class = G_OBJECT_CLASS (klass);
1981 gobject_class->finalize = fan_skeleton_finalize;
1982 gobject_class->get_property = fan_skeleton_get_property;
1983 gobject_class->set_property = fan_skeleton_set_property;
1984 gobject_class->notify = fan_skeleton_notify;
1985
1986
1987 fan_override_properties (gobject_class, 1);
1988
1989 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
1990 skeleton_class->get_info = fan_skeleton_dbus_interface_get_info;
1991 skeleton_class->get_properties = fan_skeleton_dbus_interface_get_properties;
1992 skeleton_class->flush = fan_skeleton_dbus_interface_flush;
1993 skeleton_class->get_vtable = fan_skeleton_dbus_interface_get_vtable;
1994
1995#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1996 g_type_class_add_private (klass, sizeof (FanSkeletonPrivate));
1997#endif
1998}
1999
2000static void
2001fan_skeleton_iface_init (FanIface *iface)
2002{
2003 iface->speed_changed = _fan_on_signal_speed_changed;
2004 iface->tach_error = _fan_on_signal_tach_error;
2005 iface->get_speed = fan_skeleton_get_speed;
2006 iface->get_cooling_zone = fan_skeleton_get_cooling_zone;
2007 iface->get_pwm_num = fan_skeleton_get_pwm_num;
2008}
2009
2010/**
2011 * fan_skeleton_new:
2012 *
2013 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
2014 *
2015 * Returns: (transfer full) (type FanSkeleton): The skeleton object.
2016 */
2017Fan *
2018fan_skeleton_new (void)
2019{
2020 return FAN (g_object_new (TYPE_FAN_SKELETON, NULL));
2021}
2022
2023/* ------------------------------------------------------------------------
2024 * Code for interface org.openbmc.SensorValue
2025 * ------------------------------------------------------------------------
2026 */
2027
2028/**
2029 * SECTION:SensorValue
2030 * @title: SensorValue
2031 * @short_description: Generated C code for the org.openbmc.SensorValue D-Bus interface
2032 *
2033 * 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.
2034 */
2035
2036/* ---- Introspection data for org.openbmc.SensorValue ---- */
2037
2038static const _ExtendedGDBusMethodInfo _sensor_value_method_info_init =
2039{
2040 {
2041 -1,
2042 (gchar *) "init",
2043 NULL,
2044 NULL,
2045 NULL
2046 },
2047 "handle-init",
2048 FALSE
2049};
2050
2051static const _ExtendedGDBusArgInfo _sensor_value_method_info_get_value_OUT_ARG_value =
2052{
2053 {
2054 -1,
2055 (gchar *) "value",
2056 (gchar *) "v",
2057 NULL
2058 },
2059 FALSE
2060};
2061
2062static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_get_value_OUT_ARG_pointers[] =
2063{
2064 &_sensor_value_method_info_get_value_OUT_ARG_value,
2065 NULL
2066};
2067
2068static const _ExtendedGDBusMethodInfo _sensor_value_method_info_get_value =
2069{
2070 {
2071 -1,
2072 (gchar *) "getValue",
2073 NULL,
2074 (GDBusArgInfo **) &_sensor_value_method_info_get_value_OUT_ARG_pointers,
2075 NULL
2076 },
2077 "handle-get-value",
2078 FALSE
2079};
2080
Norman James19e45912015-10-04 20:19:41 -05002081static const _ExtendedGDBusArgInfo _sensor_value_method_info_set_value_IN_ARG_value =
2082{
2083 {
2084 -1,
2085 (gchar *) "value",
2086 (gchar *) "v",
2087 NULL
2088 },
2089 FALSE
2090};
2091
2092static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_set_value_IN_ARG_pointers[] =
2093{
2094 &_sensor_value_method_info_set_value_IN_ARG_value,
2095 NULL
2096};
2097
2098static const _ExtendedGDBusMethodInfo _sensor_value_method_info_set_value =
2099{
2100 {
2101 -1,
2102 (gchar *) "setValue",
2103 (GDBusArgInfo **) &_sensor_value_method_info_set_value_IN_ARG_pointers,
2104 NULL,
2105 NULL
2106 },
2107 "handle-set-value",
2108 FALSE
2109};
2110
Norman James362a80f2015-09-14 14:04:39 -05002111static const _ExtendedGDBusMethodInfo * const _sensor_value_method_info_pointers[] =
2112{
2113 &_sensor_value_method_info_init,
2114 &_sensor_value_method_info_get_value,
Norman James19e45912015-10-04 20:19:41 -05002115 &_sensor_value_method_info_set_value,
Norman James362a80f2015-09-14 14:04:39 -05002116 NULL
2117};
2118
2119static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_value =
2120{
2121 {
2122 -1,
2123 (gchar *) "value",
2124 (gchar *) "v",
2125 NULL
2126 },
2127 FALSE
2128};
2129
2130static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_units =
2131{
2132 {
2133 -1,
2134 (gchar *) "units",
2135 (gchar *) "s",
2136 NULL
2137 },
2138 FALSE
2139};
2140
2141static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_changed_ARG_pointers[] =
2142{
2143 &_sensor_value_signal_info_changed_ARG_value,
2144 &_sensor_value_signal_info_changed_ARG_units,
2145 NULL
2146};
2147
2148static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_changed =
2149{
2150 {
2151 -1,
2152 (gchar *) "Changed",
2153 (GDBusArgInfo **) &_sensor_value_signal_info_changed_ARG_pointers,
2154 NULL
2155 },
2156 "changed"
2157};
2158
Norman James32e74e22015-09-15 21:28:06 -05002159static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_error =
2160{
2161 {
2162 -1,
2163 (gchar *) "Error",
2164 NULL,
2165 NULL
2166 },
2167 "error"
2168};
2169
Norman James362a80f2015-09-14 14:04:39 -05002170static const _ExtendedGDBusArgInfo _sensor_value_signal_info_heartbeat_ARG_bus_name =
2171{
2172 {
2173 -1,
2174 (gchar *) "bus_name",
2175 (gchar *) "s",
2176 NULL
2177 },
2178 FALSE
2179};
2180
2181static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_heartbeat_ARG_pointers[] =
2182{
2183 &_sensor_value_signal_info_heartbeat_ARG_bus_name,
2184 NULL
2185};
2186
2187static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_heartbeat =
2188{
2189 {
2190 -1,
2191 (gchar *) "Heartbeat",
2192 (GDBusArgInfo **) &_sensor_value_signal_info_heartbeat_ARG_pointers,
2193 NULL
2194 },
2195 "heartbeat"
2196};
2197
2198static const _ExtendedGDBusSignalInfo * const _sensor_value_signal_info_pointers[] =
2199{
2200 &_sensor_value_signal_info_changed,
Norman James32e74e22015-09-15 21:28:06 -05002201 &_sensor_value_signal_info_error,
Norman James362a80f2015-09-14 14:04:39 -05002202 &_sensor_value_signal_info_heartbeat,
2203 NULL
2204};
2205
2206static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_value =
2207{
2208 {
2209 -1,
2210 (gchar *) "value",
2211 (gchar *) "v",
2212 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
2213 NULL
2214 },
2215 "value",
2216 FALSE
2217};
2218
2219static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_units =
2220{
2221 {
2222 -1,
2223 (gchar *) "units",
2224 (gchar *) "s",
2225 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
2226 NULL
2227 },
2228 "units",
2229 FALSE
2230};
2231
2232static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_poll_interval =
2233{
2234 {
2235 -1,
2236 (gchar *) "poll_interval",
2237 (gchar *) "i",
2238 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
2239 NULL
2240 },
2241 "poll-interval",
2242 FALSE
2243};
2244
2245static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_heatbeat =
2246{
2247 {
2248 -1,
2249 (gchar *) "heatbeat",
2250 (gchar *) "i",
2251 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
2252 NULL
2253 },
2254 "heatbeat",
2255 FALSE
2256};
2257
2258static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_settable =
2259{
2260 {
2261 -1,
2262 (gchar *) "settable",
2263 (gchar *) "b",
2264 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
2265 NULL
2266 },
2267 "settable",
2268 FALSE
2269};
2270
Norman James362a80f2015-09-14 14:04:39 -05002271static const _ExtendedGDBusPropertyInfo * const _sensor_value_property_info_pointers[] =
2272{
2273 &_sensor_value_property_info_value,
2274 &_sensor_value_property_info_units,
2275 &_sensor_value_property_info_poll_interval,
2276 &_sensor_value_property_info_heatbeat,
2277 &_sensor_value_property_info_settable,
Norman James362a80f2015-09-14 14:04:39 -05002278 NULL
2279};
2280
2281static const _ExtendedGDBusInterfaceInfo _sensor_value_interface_info =
2282{
2283 {
2284 -1,
2285 (gchar *) "org.openbmc.SensorValue",
2286 (GDBusMethodInfo **) &_sensor_value_method_info_pointers,
2287 (GDBusSignalInfo **) &_sensor_value_signal_info_pointers,
2288 (GDBusPropertyInfo **) &_sensor_value_property_info_pointers,
2289 NULL
2290 },
2291 "sensor-value",
2292};
2293
2294
2295/**
2296 * sensor_value_interface_info:
2297 *
2298 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> D-Bus interface.
2299 *
2300 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
2301 */
2302GDBusInterfaceInfo *
2303sensor_value_interface_info (void)
2304{
2305 return (GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct;
2306}
2307
2308/**
2309 * sensor_value_override_properties:
2310 * @klass: The class structure for a #GObject<!-- -->-derived class.
2311 * @property_id_begin: The property id to assign to the first overridden property.
2312 *
2313 * Overrides all #GObject properties in the #SensorValue interface for a concrete class.
2314 * The properties are overridden in the order they are defined.
2315 *
2316 * Returns: The last property id.
2317 */
2318guint
2319sensor_value_override_properties (GObjectClass *klass, guint property_id_begin)
2320{
2321 g_object_class_override_property (klass, property_id_begin++, "value");
2322 g_object_class_override_property (klass, property_id_begin++, "units");
2323 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
2324 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
2325 g_object_class_override_property (klass, property_id_begin++, "settable");
Norman James362a80f2015-09-14 14:04:39 -05002326 return property_id_begin - 1;
2327}
2328
2329
2330
2331/**
2332 * SensorValue:
2333 *
2334 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
2335 */
2336
2337/**
2338 * SensorValueIface:
2339 * @parent_iface: The parent interface.
2340 * @handle_get_value: Handler for the #SensorValue::handle-get-value signal.
2341 * @handle_init: Handler for the #SensorValue::handle-init signal.
Norman James19e45912015-10-04 20:19:41 -05002342 * @handle_set_value: Handler for the #SensorValue::handle-set-value signal.
Norman James362a80f2015-09-14 14:04:39 -05002343 * @get_heatbeat: Getter for the #SensorValue:heatbeat property.
Norman James362a80f2015-09-14 14:04:39 -05002344 * @get_poll_interval: Getter for the #SensorValue:poll-interval property.
2345 * @get_settable: Getter for the #SensorValue:settable property.
2346 * @get_units: Getter for the #SensorValue:units property.
2347 * @get_value: Getter for the #SensorValue:value property.
2348 * @changed: Handler for the #SensorValue::changed signal.
Norman James32e74e22015-09-15 21:28:06 -05002349 * @error: Handler for the #SensorValue::error signal.
Norman James362a80f2015-09-14 14:04:39 -05002350 * @heartbeat: Handler for the #SensorValue::heartbeat signal.
2351 *
2352 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
2353 */
2354
2355typedef SensorValueIface SensorValueInterface;
2356G_DEFINE_INTERFACE (SensorValue, sensor_value, G_TYPE_OBJECT);
2357
2358static void
2359sensor_value_default_init (SensorValueIface *iface)
2360{
2361 /* GObject signals for incoming D-Bus method calls: */
2362 /**
2363 * SensorValue::handle-init:
2364 * @object: A #SensorValue.
2365 * @invocation: A #GDBusMethodInvocation.
2366 *
2367 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method.
2368 *
2369 * 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.
2370 *
2371 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
2372 */
2373 g_signal_new ("handle-init",
2374 G_TYPE_FROM_INTERFACE (iface),
2375 G_SIGNAL_RUN_LAST,
2376 G_STRUCT_OFFSET (SensorValueIface, handle_init),
2377 g_signal_accumulator_true_handled,
2378 NULL,
2379 g_cclosure_marshal_generic,
2380 G_TYPE_BOOLEAN,
2381 1,
2382 G_TYPE_DBUS_METHOD_INVOCATION);
2383
2384 /**
2385 * SensorValue::handle-get-value:
2386 * @object: A #SensorValue.
2387 * @invocation: A #GDBusMethodInvocation.
2388 *
2389 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method.
2390 *
2391 * 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.
2392 *
2393 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
2394 */
2395 g_signal_new ("handle-get-value",
2396 G_TYPE_FROM_INTERFACE (iface),
2397 G_SIGNAL_RUN_LAST,
2398 G_STRUCT_OFFSET (SensorValueIface, handle_get_value),
2399 g_signal_accumulator_true_handled,
2400 NULL,
2401 g_cclosure_marshal_generic,
2402 G_TYPE_BOOLEAN,
2403 1,
2404 G_TYPE_DBUS_METHOD_INVOCATION);
2405
Norman James19e45912015-10-04 20:19:41 -05002406 /**
2407 * SensorValue::handle-set-value:
2408 * @object: A #SensorValue.
2409 * @invocation: A #GDBusMethodInvocation.
2410 * @arg_value: Argument passed by remote caller.
2411 *
2412 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method.
2413 *
2414 * 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.
2415 *
2416 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
2417 */
2418 g_signal_new ("handle-set-value",
2419 G_TYPE_FROM_INTERFACE (iface),
2420 G_SIGNAL_RUN_LAST,
2421 G_STRUCT_OFFSET (SensorValueIface, handle_set_value),
2422 g_signal_accumulator_true_handled,
2423 NULL,
2424 g_cclosure_marshal_generic,
2425 G_TYPE_BOOLEAN,
2426 2,
2427 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT);
2428
Norman James362a80f2015-09-14 14:04:39 -05002429 /* GObject signals for received D-Bus signals: */
2430 /**
2431 * SensorValue::changed:
2432 * @object: A #SensorValue.
2433 * @arg_value: Argument.
2434 * @arg_units: Argument.
2435 *
2436 * 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.
2437 *
2438 * 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.
2439 */
2440 g_signal_new ("changed",
2441 G_TYPE_FROM_INTERFACE (iface),
2442 G_SIGNAL_RUN_LAST,
2443 G_STRUCT_OFFSET (SensorValueIface, changed),
2444 NULL,
2445 NULL,
2446 g_cclosure_marshal_generic,
2447 G_TYPE_NONE,
2448 2, G_TYPE_VARIANT, G_TYPE_STRING);
2449
2450 /**
Norman James32e74e22015-09-15 21:28:06 -05002451 * SensorValue::error:
2452 * @object: A #SensorValue.
2453 *
2454 * 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.
2455 *
2456 * 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.
2457 */
2458 g_signal_new ("error",
2459 G_TYPE_FROM_INTERFACE (iface),
2460 G_SIGNAL_RUN_LAST,
2461 G_STRUCT_OFFSET (SensorValueIface, error),
2462 NULL,
2463 NULL,
2464 g_cclosure_marshal_generic,
2465 G_TYPE_NONE,
2466 0);
2467
2468 /**
Norman James362a80f2015-09-14 14:04:39 -05002469 * SensorValue::heartbeat:
2470 * @object: A #SensorValue.
2471 * @arg_bus_name: Argument.
2472 *
2473 * 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.
2474 *
2475 * 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.
2476 */
2477 g_signal_new ("heartbeat",
2478 G_TYPE_FROM_INTERFACE (iface),
2479 G_SIGNAL_RUN_LAST,
2480 G_STRUCT_OFFSET (SensorValueIface, heartbeat),
2481 NULL,
2482 NULL,
2483 g_cclosure_marshal_generic,
2484 G_TYPE_NONE,
2485 1, G_TYPE_STRING);
2486
2487 /* GObject properties for D-Bus properties: */
2488 /**
2489 * SensorValue:value:
2490 *
2491 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link>.
2492 *
2493 * 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.
2494 */
2495 g_object_interface_install_property (iface,
2496 g_param_spec_variant ("value", "value", "value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2497 /**
2498 * SensorValue:units:
2499 *
2500 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link>.
2501 *
2502 * 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.
2503 */
2504 g_object_interface_install_property (iface,
2505 g_param_spec_string ("units", "units", "units", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2506 /**
2507 * SensorValue:poll-interval:
2508 *
2509 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link>.
2510 *
2511 * 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.
2512 */
2513 g_object_interface_install_property (iface,
2514 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2515 /**
2516 * SensorValue:heatbeat:
2517 *
2518 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link>.
2519 *
2520 * 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.
2521 */
2522 g_object_interface_install_property (iface,
2523 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2524 /**
2525 * SensorValue:settable:
2526 *
2527 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link>.
2528 *
2529 * 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.
2530 */
2531 g_object_interface_install_property (iface,
2532 g_param_spec_boolean ("settable", "settable", "settable", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James362a80f2015-09-14 14:04:39 -05002533}
2534
2535/**
2536 * sensor_value_get_value: (skip)
2537 * @object: A #SensorValue.
2538 *
2539 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property.
2540 *
2541 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
2542 *
2543 * <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>
2544 *
2545 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
2546 */
2547GVariant *
2548sensor_value_get_value (SensorValue *object)
2549{
2550 return SENSOR_VALUE_GET_IFACE (object)->get_value (object);
2551}
2552
2553/**
2554 * sensor_value_dup_value: (skip)
2555 * @object: A #SensorValue.
2556 *
2557 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property.
2558 *
2559 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
2560 *
2561 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
2562 */
2563GVariant *
2564sensor_value_dup_value (SensorValue *object)
2565{
2566 GVariant *value;
2567 g_object_get (G_OBJECT (object), "value", &value, NULL);
2568 return value;
2569}
2570
2571/**
2572 * sensor_value_set_value: (skip)
2573 * @object: A #SensorValue.
2574 * @value: The value to set.
2575 *
2576 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property to @value.
2577 *
2578 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
2579 */
2580void
2581sensor_value_set_value (SensorValue *object, GVariant *value)
2582{
2583 g_object_set (G_OBJECT (object), "value", value, NULL);
2584}
2585
2586/**
2587 * sensor_value_get_units: (skip)
2588 * @object: A #SensorValue.
2589 *
2590 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property.
2591 *
2592 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
2593 *
2594 * <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>
2595 *
2596 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
2597 */
2598const gchar *
2599sensor_value_get_units (SensorValue *object)
2600{
2601 return SENSOR_VALUE_GET_IFACE (object)->get_units (object);
2602}
2603
2604/**
2605 * sensor_value_dup_units: (skip)
2606 * @object: A #SensorValue.
2607 *
2608 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property.
2609 *
2610 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
2611 *
2612 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
2613 */
2614gchar *
2615sensor_value_dup_units (SensorValue *object)
2616{
2617 gchar *value;
2618 g_object_get (G_OBJECT (object), "units", &value, NULL);
2619 return value;
2620}
2621
2622/**
2623 * sensor_value_set_units: (skip)
2624 * @object: A #SensorValue.
2625 * @value: The value to set.
2626 *
2627 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property to @value.
2628 *
2629 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
2630 */
2631void
2632sensor_value_set_units (SensorValue *object, const gchar *value)
2633{
2634 g_object_set (G_OBJECT (object), "units", value, NULL);
2635}
2636
2637/**
2638 * sensor_value_get_poll_interval: (skip)
2639 * @object: A #SensorValue.
2640 *
2641 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property.
2642 *
2643 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2644 *
2645 * Returns: The property value.
2646 */
2647gint
2648sensor_value_get_poll_interval (SensorValue *object)
2649{
2650 return SENSOR_VALUE_GET_IFACE (object)->get_poll_interval (object);
2651}
2652
2653/**
2654 * sensor_value_set_poll_interval: (skip)
2655 * @object: A #SensorValue.
2656 * @value: The value to set.
2657 *
2658 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property to @value.
2659 *
2660 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2661 */
2662void
2663sensor_value_set_poll_interval (SensorValue *object, gint value)
2664{
2665 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
2666}
2667
2668/**
2669 * sensor_value_get_heatbeat: (skip)
2670 * @object: A #SensorValue.
2671 *
2672 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property.
2673 *
2674 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
2675 *
2676 * Returns: The property value.
2677 */
2678gint
2679sensor_value_get_heatbeat (SensorValue *object)
2680{
2681 return SENSOR_VALUE_GET_IFACE (object)->get_heatbeat (object);
2682}
2683
2684/**
2685 * sensor_value_set_heatbeat: (skip)
2686 * @object: A #SensorValue.
2687 * @value: The value to set.
2688 *
2689 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property to @value.
2690 *
2691 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
2692 */
2693void
2694sensor_value_set_heatbeat (SensorValue *object, gint value)
2695{
2696 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
2697}
2698
2699/**
2700 * sensor_value_get_settable: (skip)
2701 * @object: A #SensorValue.
2702 *
2703 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property.
2704 *
2705 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
2706 *
2707 * Returns: The property value.
2708 */
2709gboolean
2710sensor_value_get_settable (SensorValue *object)
2711{
2712 return SENSOR_VALUE_GET_IFACE (object)->get_settable (object);
2713}
2714
2715/**
2716 * sensor_value_set_settable: (skip)
2717 * @object: A #SensorValue.
2718 * @value: The value to set.
2719 *
2720 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property to @value.
2721 *
2722 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
2723 */
2724void
2725sensor_value_set_settable (SensorValue *object, gboolean value)
2726{
2727 g_object_set (G_OBJECT (object), "settable", value, NULL);
2728}
2729
2730/**
Norman James362a80f2015-09-14 14:04:39 -05002731 * sensor_value_emit_changed:
2732 * @object: A #SensorValue.
2733 * @arg_value: Argument to pass with the signal.
2734 * @arg_units: Argument to pass with the signal.
2735 *
2736 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Changed">"Changed"</link> D-Bus signal.
2737 */
2738void
2739sensor_value_emit_changed (
2740 SensorValue *object,
2741 GVariant *arg_value,
2742 const gchar *arg_units)
2743{
2744 g_signal_emit_by_name (object, "changed", arg_value, arg_units);
2745}
2746
2747/**
Norman James32e74e22015-09-15 21:28:06 -05002748 * sensor_value_emit_error:
2749 * @object: A #SensorValue.
2750 *
2751 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Error">"Error"</link> D-Bus signal.
2752 */
2753void
2754sensor_value_emit_error (
2755 SensorValue *object)
2756{
2757 g_signal_emit_by_name (object, "error");
2758}
2759
2760/**
Norman James362a80f2015-09-14 14:04:39 -05002761 * sensor_value_emit_heartbeat:
2762 * @object: A #SensorValue.
2763 * @arg_bus_name: Argument to pass with the signal.
2764 *
2765 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Heartbeat">"Heartbeat"</link> D-Bus signal.
2766 */
2767void
2768sensor_value_emit_heartbeat (
2769 SensorValue *object,
2770 const gchar *arg_bus_name)
2771{
2772 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
2773}
2774
2775/**
2776 * sensor_value_call_init:
2777 * @proxy: A #SensorValueProxy.
2778 * @cancellable: (allow-none): A #GCancellable or %NULL.
2779 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2780 * @user_data: User data to pass to @callback.
2781 *
2782 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method on @proxy.
2783 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
2784 * You can then call sensor_value_call_init_finish() to get the result of the operation.
2785 *
2786 * See sensor_value_call_init_sync() for the synchronous, blocking version of this method.
2787 */
2788void
2789sensor_value_call_init (
2790 SensorValue *proxy,
2791 GCancellable *cancellable,
2792 GAsyncReadyCallback callback,
2793 gpointer user_data)
2794{
2795 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2796 "init",
2797 g_variant_new ("()"),
2798 G_DBUS_CALL_FLAGS_NONE,
2799 -1,
2800 cancellable,
2801 callback,
2802 user_data);
2803}
2804
2805/**
2806 * sensor_value_call_init_finish:
2807 * @proxy: A #SensorValueProxy.
2808 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_init().
2809 * @error: Return location for error or %NULL.
2810 *
2811 * Finishes an operation started with sensor_value_call_init().
2812 *
2813 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2814 */
2815gboolean
2816sensor_value_call_init_finish (
2817 SensorValue *proxy,
2818 GAsyncResult *res,
2819 GError **error)
2820{
2821 GVariant *_ret;
2822 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2823 if (_ret == NULL)
2824 goto _out;
2825 g_variant_get (_ret,
2826 "()");
2827 g_variant_unref (_ret);
2828_out:
2829 return _ret != NULL;
2830}
2831
2832/**
2833 * sensor_value_call_init_sync:
2834 * @proxy: A #SensorValueProxy.
2835 * @cancellable: (allow-none): A #GCancellable or %NULL.
2836 * @error: Return location for error or %NULL.
2837 *
2838 * 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.
2839 *
2840 * See sensor_value_call_init() for the asynchronous version of this method.
2841 *
2842 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2843 */
2844gboolean
2845sensor_value_call_init_sync (
2846 SensorValue *proxy,
2847 GCancellable *cancellable,
2848 GError **error)
2849{
2850 GVariant *_ret;
2851 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2852 "init",
2853 g_variant_new ("()"),
2854 G_DBUS_CALL_FLAGS_NONE,
2855 -1,
2856 cancellable,
2857 error);
2858 if (_ret == NULL)
2859 goto _out;
2860 g_variant_get (_ret,
2861 "()");
2862 g_variant_unref (_ret);
2863_out:
2864 return _ret != NULL;
2865}
2866
2867/**
2868 * sensor_value_call_get_value:
2869 * @proxy: A #SensorValueProxy.
2870 * @cancellable: (allow-none): A #GCancellable or %NULL.
2871 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2872 * @user_data: User data to pass to @callback.
2873 *
2874 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method on @proxy.
2875 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
2876 * You can then call sensor_value_call_get_value_finish() to get the result of the operation.
2877 *
2878 * See sensor_value_call_get_value_sync() for the synchronous, blocking version of this method.
2879 */
2880void
2881sensor_value_call_get_value (
2882 SensorValue *proxy,
2883 GCancellable *cancellable,
2884 GAsyncReadyCallback callback,
2885 gpointer user_data)
2886{
2887 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2888 "getValue",
2889 g_variant_new ("()"),
2890 G_DBUS_CALL_FLAGS_NONE,
2891 -1,
2892 cancellable,
2893 callback,
2894 user_data);
2895}
2896
2897/**
2898 * sensor_value_call_get_value_finish:
2899 * @proxy: A #SensorValueProxy.
2900 * @out_value: (out): Return location for return parameter or %NULL to ignore.
2901 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_get_value().
2902 * @error: Return location for error or %NULL.
2903 *
2904 * Finishes an operation started with sensor_value_call_get_value().
2905 *
2906 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2907 */
2908gboolean
2909sensor_value_call_get_value_finish (
2910 SensorValue *proxy,
2911 GVariant **out_value,
2912 GAsyncResult *res,
2913 GError **error)
2914{
2915 GVariant *_ret;
2916 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2917 if (_ret == NULL)
2918 goto _out;
2919 g_variant_get (_ret,
2920 "(@v)",
2921 out_value);
2922 g_variant_unref (_ret);
2923_out:
2924 return _ret != NULL;
2925}
2926
2927/**
2928 * sensor_value_call_get_value_sync:
2929 * @proxy: A #SensorValueProxy.
2930 * @out_value: (out): Return location for return parameter or %NULL to ignore.
2931 * @cancellable: (allow-none): A #GCancellable or %NULL.
2932 * @error: Return location for error or %NULL.
2933 *
2934 * 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.
2935 *
2936 * See sensor_value_call_get_value() for the asynchronous version of this method.
2937 *
2938 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2939 */
2940gboolean
2941sensor_value_call_get_value_sync (
2942 SensorValue *proxy,
2943 GVariant **out_value,
2944 GCancellable *cancellable,
2945 GError **error)
2946{
2947 GVariant *_ret;
2948 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2949 "getValue",
2950 g_variant_new ("()"),
2951 G_DBUS_CALL_FLAGS_NONE,
2952 -1,
2953 cancellable,
2954 error);
2955 if (_ret == NULL)
2956 goto _out;
2957 g_variant_get (_ret,
2958 "(@v)",
2959 out_value);
2960 g_variant_unref (_ret);
2961_out:
2962 return _ret != NULL;
2963}
2964
2965/**
Norman James19e45912015-10-04 20:19:41 -05002966 * sensor_value_call_set_value:
2967 * @proxy: A #SensorValueProxy.
2968 * @arg_value: Argument to pass with the method invocation.
2969 * @cancellable: (allow-none): A #GCancellable or %NULL.
2970 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2971 * @user_data: User data to pass to @callback.
2972 *
2973 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method on @proxy.
2974 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
2975 * You can then call sensor_value_call_set_value_finish() to get the result of the operation.
2976 *
2977 * See sensor_value_call_set_value_sync() for the synchronous, blocking version of this method.
2978 */
2979void
2980sensor_value_call_set_value (
2981 SensorValue *proxy,
2982 GVariant *arg_value,
2983 GCancellable *cancellable,
2984 GAsyncReadyCallback callback,
2985 gpointer user_data)
2986{
2987 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2988 "setValue",
2989 g_variant_new ("(@v)",
2990 arg_value),
2991 G_DBUS_CALL_FLAGS_NONE,
2992 -1,
2993 cancellable,
2994 callback,
2995 user_data);
2996}
2997
2998/**
2999 * sensor_value_call_set_value_finish:
3000 * @proxy: A #SensorValueProxy.
3001 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_set_value().
3002 * @error: Return location for error or %NULL.
3003 *
3004 * Finishes an operation started with sensor_value_call_set_value().
3005 *
3006 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
3007 */
3008gboolean
3009sensor_value_call_set_value_finish (
3010 SensorValue *proxy,
3011 GAsyncResult *res,
3012 GError **error)
3013{
3014 GVariant *_ret;
3015 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
3016 if (_ret == NULL)
3017 goto _out;
3018 g_variant_get (_ret,
3019 "()");
3020 g_variant_unref (_ret);
3021_out:
3022 return _ret != NULL;
3023}
3024
3025/**
3026 * sensor_value_call_set_value_sync:
3027 * @proxy: A #SensorValueProxy.
3028 * @arg_value: Argument to pass with the method invocation.
3029 * @cancellable: (allow-none): A #GCancellable or %NULL.
3030 * @error: Return location for error or %NULL.
3031 *
3032 * 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.
3033 *
3034 * See sensor_value_call_set_value() for the asynchronous version of this method.
3035 *
3036 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
3037 */
3038gboolean
3039sensor_value_call_set_value_sync (
3040 SensorValue *proxy,
3041 GVariant *arg_value,
3042 GCancellable *cancellable,
3043 GError **error)
3044{
3045 GVariant *_ret;
3046 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
3047 "setValue",
3048 g_variant_new ("(@v)",
3049 arg_value),
3050 G_DBUS_CALL_FLAGS_NONE,
3051 -1,
3052 cancellable,
3053 error);
3054 if (_ret == NULL)
3055 goto _out;
3056 g_variant_get (_ret,
3057 "()");
3058 g_variant_unref (_ret);
3059_out:
3060 return _ret != NULL;
3061}
3062
3063/**
Norman James362a80f2015-09-14 14:04:39 -05003064 * sensor_value_complete_init:
3065 * @object: A #SensorValue.
3066 * @invocation: (transfer full): A #GDBusMethodInvocation.
3067 *
3068 * 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.
3069 *
3070 * This method will free @invocation, you cannot use it afterwards.
3071 */
3072void
3073sensor_value_complete_init (
3074 SensorValue *object,
3075 GDBusMethodInvocation *invocation)
3076{
3077 g_dbus_method_invocation_return_value (invocation,
3078 g_variant_new ("()"));
3079}
3080
3081/**
3082 * sensor_value_complete_get_value:
3083 * @object: A #SensorValue.
3084 * @invocation: (transfer full): A #GDBusMethodInvocation.
3085 * @value: Parameter to return.
3086 *
3087 * 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.
3088 *
3089 * This method will free @invocation, you cannot use it afterwards.
3090 */
3091void
3092sensor_value_complete_get_value (
3093 SensorValue *object,
3094 GDBusMethodInvocation *invocation,
3095 GVariant *value)
3096{
3097 g_dbus_method_invocation_return_value (invocation,
3098 g_variant_new ("(@v)",
3099 value));
3100}
3101
Norman James19e45912015-10-04 20:19:41 -05003102/**
3103 * sensor_value_complete_set_value:
3104 * @object: A #SensorValue.
3105 * @invocation: (transfer full): A #GDBusMethodInvocation.
3106 *
3107 * 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.
3108 *
3109 * This method will free @invocation, you cannot use it afterwards.
3110 */
3111void
3112sensor_value_complete_set_value (
3113 SensorValue *object,
3114 GDBusMethodInvocation *invocation)
3115{
3116 g_dbus_method_invocation_return_value (invocation,
3117 g_variant_new ("()"));
3118}
3119
Norman James362a80f2015-09-14 14:04:39 -05003120/* ------------------------------------------------------------------------ */
3121
3122/**
3123 * SensorValueProxy:
3124 *
3125 * The #SensorValueProxy structure contains only private data and should only be accessed using the provided API.
3126 */
3127
3128/**
3129 * SensorValueProxyClass:
3130 * @parent_class: The parent class.
3131 *
3132 * Class structure for #SensorValueProxy.
3133 */
3134
3135struct _SensorValueProxyPrivate
3136{
3137 GData *qdata;
3138};
3139
3140static void sensor_value_proxy_iface_init (SensorValueIface *iface);
3141
3142#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3143G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
3144 G_ADD_PRIVATE (SensorValueProxy)
3145 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init));
3146
3147#else
3148G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
3149 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init));
3150
3151#endif
3152static void
3153sensor_value_proxy_finalize (GObject *object)
3154{
3155 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
3156 g_datalist_clear (&proxy->priv->qdata);
3157 G_OBJECT_CLASS (sensor_value_proxy_parent_class)->finalize (object);
3158}
3159
3160static void
3161sensor_value_proxy_get_property (GObject *object,
3162 guint prop_id,
3163 GValue *value,
3164 GParamSpec *pspec G_GNUC_UNUSED)
3165{
3166 const _ExtendedGDBusPropertyInfo *info;
3167 GVariant *variant;
Norman Jamesdfdaca92015-09-27 22:11:15 -05003168 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05003169 info = _sensor_value_property_info_pointers[prop_id - 1];
3170 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
3171 if (info->use_gvariant)
3172 {
3173 g_value_set_variant (value, variant);
3174 }
3175 else
3176 {
3177 if (variant != NULL)
3178 g_dbus_gvariant_to_gvalue (variant, value);
3179 }
3180 if (variant != NULL)
3181 g_variant_unref (variant);
3182}
3183
3184static void
3185sensor_value_proxy_set_property_cb (GDBusProxy *proxy,
3186 GAsyncResult *res,
3187 gpointer user_data)
3188{
3189 const _ExtendedGDBusPropertyInfo *info = user_data;
3190 GError *error;
3191 GVariant *_ret;
3192 error = NULL;
3193 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
3194 if (!_ret)
3195 {
3196 g_warning ("Error setting property '%s' on interface org.openbmc.SensorValue: %s (%s, %d)",
3197 info->parent_struct.name,
3198 error->message, g_quark_to_string (error->domain), error->code);
3199 g_error_free (error);
3200 }
3201 else
3202 {
3203 g_variant_unref (_ret);
3204 }
3205}
3206
3207static void
3208sensor_value_proxy_set_property (GObject *object,
3209 guint prop_id,
3210 const GValue *value,
3211 GParamSpec *pspec G_GNUC_UNUSED)
3212{
3213 const _ExtendedGDBusPropertyInfo *info;
3214 GVariant *variant;
Norman Jamesdfdaca92015-09-27 22:11:15 -05003215 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05003216 info = _sensor_value_property_info_pointers[prop_id - 1];
3217 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
3218 g_dbus_proxy_call (G_DBUS_PROXY (object),
3219 "org.freedesktop.DBus.Properties.Set",
3220 g_variant_new ("(ssv)", "org.openbmc.SensorValue", info->parent_struct.name, variant),
3221 G_DBUS_CALL_FLAGS_NONE,
3222 -1,
3223 NULL, (GAsyncReadyCallback) sensor_value_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
3224 g_variant_unref (variant);
3225}
3226
3227static void
3228sensor_value_proxy_g_signal (GDBusProxy *proxy,
3229 const gchar *sender_name G_GNUC_UNUSED,
3230 const gchar *signal_name,
3231 GVariant *parameters)
3232{
3233 _ExtendedGDBusSignalInfo *info;
3234 GVariantIter iter;
3235 GVariant *child;
3236 GValue *paramv;
3237 guint num_params;
3238 guint n;
3239 guint signal_id;
3240 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, signal_name);
3241 if (info == NULL)
3242 return;
3243 num_params = g_variant_n_children (parameters);
3244 paramv = g_new0 (GValue, num_params + 1);
3245 g_value_init (&paramv[0], TYPE_SENSOR_VALUE);
3246 g_value_set_object (&paramv[0], proxy);
3247 g_variant_iter_init (&iter, parameters);
3248 n = 1;
3249 while ((child = g_variant_iter_next_value (&iter)) != NULL)
3250 {
3251 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
3252 if (arg_info->use_gvariant)
3253 {
3254 g_value_init (&paramv[n], G_TYPE_VARIANT);
3255 g_value_set_variant (&paramv[n], child);
3256 n++;
3257 }
3258 else
3259 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
3260 g_variant_unref (child);
3261 }
3262 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
3263 g_signal_emitv (paramv, signal_id, 0, NULL);
3264 for (n = 0; n < num_params + 1; n++)
3265 g_value_unset (&paramv[n]);
3266 g_free (paramv);
3267}
3268
3269static void
3270sensor_value_proxy_g_properties_changed (GDBusProxy *_proxy,
3271 GVariant *changed_properties,
3272 const gchar *const *invalidated_properties)
3273{
3274 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (_proxy);
3275 guint n;
3276 const gchar *key;
3277 GVariantIter *iter;
3278 _ExtendedGDBusPropertyInfo *info;
3279 g_variant_get (changed_properties, "a{sv}", &iter);
3280 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
3281 {
3282 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, key);
3283 g_datalist_remove_data (&proxy->priv->qdata, key);
3284 if (info != NULL)
3285 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
3286 }
3287 g_variant_iter_free (iter);
3288 for (n = 0; invalidated_properties[n] != NULL; n++)
3289 {
3290 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, invalidated_properties[n]);
3291 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
3292 if (info != NULL)
3293 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
3294 }
3295}
3296
3297static GVariant *
3298sensor_value_proxy_get_value (SensorValue *object)
3299{
3300 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
3301 GVariant *variant;
3302 GVariant *value = NULL;
3303 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value");
3304 value = variant;
3305 if (variant != NULL)
3306 g_variant_unref (variant);
3307 return value;
3308}
3309
3310static const gchar *
3311sensor_value_proxy_get_units (SensorValue *object)
3312{
3313 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
3314 GVariant *variant;
3315 const gchar *value = NULL;
3316 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units");
3317 if (variant != NULL)
3318 {
3319 value = g_variant_get_string (variant, NULL);
3320 g_variant_unref (variant);
3321 }
3322 return value;
3323}
3324
3325static gint
3326sensor_value_proxy_get_poll_interval (SensorValue *object)
3327{
3328 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
3329 GVariant *variant;
3330 gint value = 0;
3331 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
3332 if (variant != NULL)
3333 {
3334 value = g_variant_get_int32 (variant);
3335 g_variant_unref (variant);
3336 }
3337 return value;
3338}
3339
3340static gint
3341sensor_value_proxy_get_heatbeat (SensorValue *object)
3342{
3343 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
3344 GVariant *variant;
3345 gint value = 0;
3346 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
3347 if (variant != NULL)
3348 {
3349 value = g_variant_get_int32 (variant);
3350 g_variant_unref (variant);
3351 }
3352 return value;
3353}
3354
3355static gboolean
3356sensor_value_proxy_get_settable (SensorValue *object)
3357{
3358 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
3359 GVariant *variant;
3360 gboolean value = 0;
3361 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "settable");
3362 if (variant != NULL)
3363 {
3364 value = g_variant_get_boolean (variant);
3365 g_variant_unref (variant);
3366 }
3367 return value;
3368}
3369
Norman James362a80f2015-09-14 14:04:39 -05003370static void
3371sensor_value_proxy_init (SensorValueProxy *proxy)
3372{
3373#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3374 proxy->priv = sensor_value_proxy_get_instance_private (proxy);
3375#else
3376 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_VALUE_PROXY, SensorValueProxyPrivate);
3377#endif
3378
3379 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_value_interface_info ());
3380}
3381
3382static void
3383sensor_value_proxy_class_init (SensorValueProxyClass *klass)
3384{
3385 GObjectClass *gobject_class;
3386 GDBusProxyClass *proxy_class;
3387
3388 gobject_class = G_OBJECT_CLASS (klass);
3389 gobject_class->finalize = sensor_value_proxy_finalize;
3390 gobject_class->get_property = sensor_value_proxy_get_property;
3391 gobject_class->set_property = sensor_value_proxy_set_property;
3392
3393 proxy_class = G_DBUS_PROXY_CLASS (klass);
3394 proxy_class->g_signal = sensor_value_proxy_g_signal;
3395 proxy_class->g_properties_changed = sensor_value_proxy_g_properties_changed;
3396
3397 sensor_value_override_properties (gobject_class, 1);
3398
3399#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
3400 g_type_class_add_private (klass, sizeof (SensorValueProxyPrivate));
3401#endif
3402}
3403
3404static void
3405sensor_value_proxy_iface_init (SensorValueIface *iface)
3406{
3407 iface->get_value = sensor_value_proxy_get_value;
3408 iface->get_units = sensor_value_proxy_get_units;
3409 iface->get_poll_interval = sensor_value_proxy_get_poll_interval;
3410 iface->get_heatbeat = sensor_value_proxy_get_heatbeat;
3411 iface->get_settable = sensor_value_proxy_get_settable;
Norman James362a80f2015-09-14 14:04:39 -05003412}
3413
3414/**
3415 * sensor_value_proxy_new:
3416 * @connection: A #GDBusConnection.
3417 * @flags: Flags from the #GDBusProxyFlags enumeration.
3418 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
3419 * @object_path: An object path.
3420 * @cancellable: (allow-none): A #GCancellable or %NULL.
3421 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
3422 * @user_data: User data to pass to @callback.
3423 *
3424 * 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.
3425 *
3426 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
3427 * You can then call sensor_value_proxy_new_finish() to get the result of the operation.
3428 *
3429 * See sensor_value_proxy_new_sync() for the synchronous, blocking version of this constructor.
3430 */
3431void
3432sensor_value_proxy_new (
3433 GDBusConnection *connection,
3434 GDBusProxyFlags flags,
3435 const gchar *name,
3436 const gchar *object_path,
3437 GCancellable *cancellable,
3438 GAsyncReadyCallback callback,
3439 gpointer user_data)
3440{
3441 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);
3442}
3443
3444/**
3445 * sensor_value_proxy_new_finish:
3446 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new().
3447 * @error: Return location for error or %NULL
3448 *
3449 * Finishes an operation started with sensor_value_proxy_new().
3450 *
3451 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
3452 */
3453SensorValue *
3454sensor_value_proxy_new_finish (
3455 GAsyncResult *res,
3456 GError **error)
3457{
3458 GObject *ret;
3459 GObject *source_object;
3460 source_object = g_async_result_get_source_object (res);
3461 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
3462 g_object_unref (source_object);
3463 if (ret != NULL)
3464 return SENSOR_VALUE (ret);
3465 else
3466 return NULL;
3467}
3468
3469/**
3470 * sensor_value_proxy_new_sync:
3471 * @connection: A #GDBusConnection.
3472 * @flags: Flags from the #GDBusProxyFlags enumeration.
3473 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
3474 * @object_path: An object path.
3475 * @cancellable: (allow-none): A #GCancellable or %NULL.
3476 * @error: Return location for error or %NULL
3477 *
3478 * 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.
3479 *
3480 * The calling thread is blocked until a reply is received.
3481 *
3482 * See sensor_value_proxy_new() for the asynchronous version of this constructor.
3483 *
3484 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
3485 */
3486SensorValue *
3487sensor_value_proxy_new_sync (
3488 GDBusConnection *connection,
3489 GDBusProxyFlags flags,
3490 const gchar *name,
3491 const gchar *object_path,
3492 GCancellable *cancellable,
3493 GError **error)
3494{
3495 GInitable *ret;
3496 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);
3497 if (ret != NULL)
3498 return SENSOR_VALUE (ret);
3499 else
3500 return NULL;
3501}
3502
3503
3504/**
3505 * sensor_value_proxy_new_for_bus:
3506 * @bus_type: A #GBusType.
3507 * @flags: Flags from the #GDBusProxyFlags enumeration.
3508 * @name: A bus name (well-known or unique).
3509 * @object_path: An object path.
3510 * @cancellable: (allow-none): A #GCancellable or %NULL.
3511 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
3512 * @user_data: User data to pass to @callback.
3513 *
3514 * Like sensor_value_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
3515 *
3516 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
3517 * You can then call sensor_value_proxy_new_for_bus_finish() to get the result of the operation.
3518 *
3519 * See sensor_value_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
3520 */
3521void
3522sensor_value_proxy_new_for_bus (
3523 GBusType bus_type,
3524 GDBusProxyFlags flags,
3525 const gchar *name,
3526 const gchar *object_path,
3527 GCancellable *cancellable,
3528 GAsyncReadyCallback callback,
3529 gpointer user_data)
3530{
3531 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);
3532}
3533
3534/**
3535 * sensor_value_proxy_new_for_bus_finish:
3536 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new_for_bus().
3537 * @error: Return location for error or %NULL
3538 *
3539 * Finishes an operation started with sensor_value_proxy_new_for_bus().
3540 *
3541 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
3542 */
3543SensorValue *
3544sensor_value_proxy_new_for_bus_finish (
3545 GAsyncResult *res,
3546 GError **error)
3547{
3548 GObject *ret;
3549 GObject *source_object;
3550 source_object = g_async_result_get_source_object (res);
3551 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
3552 g_object_unref (source_object);
3553 if (ret != NULL)
3554 return SENSOR_VALUE (ret);
3555 else
3556 return NULL;
3557}
3558
3559/**
3560 * sensor_value_proxy_new_for_bus_sync:
3561 * @bus_type: A #GBusType.
3562 * @flags: Flags from the #GDBusProxyFlags enumeration.
3563 * @name: A bus name (well-known or unique).
3564 * @object_path: An object path.
3565 * @cancellable: (allow-none): A #GCancellable or %NULL.
3566 * @error: Return location for error or %NULL
3567 *
3568 * Like sensor_value_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
3569 *
3570 * The calling thread is blocked until a reply is received.
3571 *
3572 * See sensor_value_proxy_new_for_bus() for the asynchronous version of this constructor.
3573 *
3574 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
3575 */
3576SensorValue *
3577sensor_value_proxy_new_for_bus_sync (
3578 GBusType bus_type,
3579 GDBusProxyFlags flags,
3580 const gchar *name,
3581 const gchar *object_path,
3582 GCancellable *cancellable,
3583 GError **error)
3584{
3585 GInitable *ret;
3586 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);
3587 if (ret != NULL)
3588 return SENSOR_VALUE (ret);
3589 else
3590 return NULL;
3591}
3592
3593
3594/* ------------------------------------------------------------------------ */
3595
3596/**
3597 * SensorValueSkeleton:
3598 *
3599 * The #SensorValueSkeleton structure contains only private data and should only be accessed using the provided API.
3600 */
3601
3602/**
3603 * SensorValueSkeletonClass:
3604 * @parent_class: The parent class.
3605 *
3606 * Class structure for #SensorValueSkeleton.
3607 */
3608
3609struct _SensorValueSkeletonPrivate
3610{
3611 GValue *properties;
3612 GList *changed_properties;
3613 GSource *changed_properties_idle_source;
3614 GMainContext *context;
3615 GMutex lock;
3616};
3617
3618static void
3619_sensor_value_skeleton_handle_method_call (
3620 GDBusConnection *connection G_GNUC_UNUSED,
3621 const gchar *sender G_GNUC_UNUSED,
3622 const gchar *object_path G_GNUC_UNUSED,
3623 const gchar *interface_name,
3624 const gchar *method_name,
3625 GVariant *parameters,
3626 GDBusMethodInvocation *invocation,
3627 gpointer user_data)
3628{
3629 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
3630 _ExtendedGDBusMethodInfo *info;
3631 GVariantIter iter;
3632 GVariant *child;
3633 GValue *paramv;
3634 guint num_params;
3635 guint num_extra;
3636 guint n;
3637 guint signal_id;
3638 GValue return_value = G_VALUE_INIT;
3639 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
3640 g_assert (info != NULL);
3641 num_params = g_variant_n_children (parameters);
3642 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
3643 n = 0;
3644 g_value_init (&paramv[n], TYPE_SENSOR_VALUE);
3645 g_value_set_object (&paramv[n++], skeleton);
3646 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
3647 g_value_set_object (&paramv[n++], invocation);
3648 if (info->pass_fdlist)
3649 {
3650#ifdef G_OS_UNIX
3651 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
3652 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
3653#else
3654 g_assert_not_reached ();
3655#endif
3656 }
3657 g_variant_iter_init (&iter, parameters);
3658 while ((child = g_variant_iter_next_value (&iter)) != NULL)
3659 {
3660 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
3661 if (arg_info->use_gvariant)
3662 {
3663 g_value_init (&paramv[n], G_TYPE_VARIANT);
3664 g_value_set_variant (&paramv[n], child);
3665 n++;
3666 }
3667 else
3668 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
3669 g_variant_unref (child);
3670 }
3671 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
3672 g_value_init (&return_value, G_TYPE_BOOLEAN);
3673 g_signal_emitv (paramv, signal_id, 0, &return_value);
3674 if (!g_value_get_boolean (&return_value))
3675 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);
3676 g_value_unset (&return_value);
3677 for (n = 0; n < num_params + num_extra; n++)
3678 g_value_unset (&paramv[n]);
3679 g_free (paramv);
3680}
3681
3682static GVariant *
3683_sensor_value_skeleton_handle_get_property (
3684 GDBusConnection *connection G_GNUC_UNUSED,
3685 const gchar *sender G_GNUC_UNUSED,
3686 const gchar *object_path G_GNUC_UNUSED,
3687 const gchar *interface_name G_GNUC_UNUSED,
3688 const gchar *property_name,
3689 GError **error,
3690 gpointer user_data)
3691{
3692 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
3693 GValue value = G_VALUE_INIT;
3694 GParamSpec *pspec;
3695 _ExtendedGDBusPropertyInfo *info;
3696 GVariant *ret;
3697 ret = NULL;
3698 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
3699 g_assert (info != NULL);
3700 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3701 if (pspec == NULL)
3702 {
3703 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3704 }
3705 else
3706 {
3707 g_value_init (&value, pspec->value_type);
3708 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3709 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
3710 g_value_unset (&value);
3711 }
3712 return ret;
3713}
3714
3715static gboolean
3716_sensor_value_skeleton_handle_set_property (
3717 GDBusConnection *connection G_GNUC_UNUSED,
3718 const gchar *sender G_GNUC_UNUSED,
3719 const gchar *object_path G_GNUC_UNUSED,
3720 const gchar *interface_name G_GNUC_UNUSED,
3721 const gchar *property_name,
3722 GVariant *variant,
3723 GError **error,
3724 gpointer user_data)
3725{
3726 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
3727 GValue value = G_VALUE_INIT;
3728 GParamSpec *pspec;
3729 _ExtendedGDBusPropertyInfo *info;
3730 gboolean ret;
3731 ret = FALSE;
3732 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
3733 g_assert (info != NULL);
3734 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3735 if (pspec == NULL)
3736 {
3737 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3738 }
3739 else
3740 {
3741 if (info->use_gvariant)
3742 g_value_set_variant (&value, variant);
3743 else
3744 g_dbus_gvariant_to_gvalue (variant, &value);
3745 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3746 g_value_unset (&value);
3747 ret = TRUE;
3748 }
3749 return ret;
3750}
3751
3752static const GDBusInterfaceVTable _sensor_value_skeleton_vtable =
3753{
3754 _sensor_value_skeleton_handle_method_call,
3755 _sensor_value_skeleton_handle_get_property,
3756 _sensor_value_skeleton_handle_set_property,
3757 {NULL}
3758};
3759
3760static GDBusInterfaceInfo *
3761sensor_value_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3762{
3763 return sensor_value_interface_info ();
3764}
3765
3766static GDBusInterfaceVTable *
3767sensor_value_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3768{
3769 return (GDBusInterfaceVTable *) &_sensor_value_skeleton_vtable;
3770}
3771
3772static GVariant *
3773sensor_value_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
3774{
3775 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
3776
3777 GVariantBuilder builder;
3778 guint n;
3779 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3780 if (_sensor_value_interface_info.parent_struct.properties == NULL)
3781 goto out;
3782 for (n = 0; _sensor_value_interface_info.parent_struct.properties[n] != NULL; n++)
3783 {
3784 GDBusPropertyInfo *info = _sensor_value_interface_info.parent_struct.properties[n];
3785 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
3786 {
3787 GVariant *value;
3788 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);
3789 if (value != NULL)
3790 {
3791 g_variant_take_ref (value);
3792 g_variant_builder_add (&builder, "{sv}", info->name, value);
3793 g_variant_unref (value);
3794 }
3795 }
3796 }
3797out:
3798 return g_variant_builder_end (&builder);
3799}
3800
3801static gboolean _sensor_value_emit_changed (gpointer user_data);
3802
3803static void
3804sensor_value_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
3805{
3806 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
3807 gboolean emit_changed = FALSE;
3808
3809 g_mutex_lock (&skeleton->priv->lock);
3810 if (skeleton->priv->changed_properties_idle_source != NULL)
3811 {
3812 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3813 skeleton->priv->changed_properties_idle_source = NULL;
3814 emit_changed = TRUE;
3815 }
3816 g_mutex_unlock (&skeleton->priv->lock);
3817
3818 if (emit_changed)
3819 _sensor_value_emit_changed (skeleton);
3820}
3821
3822static void
3823_sensor_value_on_signal_changed (
3824 SensorValue *object,
3825 GVariant *arg_value,
3826 const gchar *arg_units)
3827{
3828 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
3829
3830 GList *connections, *l;
3831 GVariant *signal_variant;
3832 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3833
3834 signal_variant = g_variant_ref_sink (g_variant_new ("(@vs)",
3835 arg_value,
3836 arg_units));
3837 for (l = connections; l != NULL; l = l->next)
3838 {
3839 GDBusConnection *connection = l->data;
3840 g_dbus_connection_emit_signal (connection,
3841 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Changed",
3842 signal_variant, NULL);
3843 }
3844 g_variant_unref (signal_variant);
3845 g_list_free_full (connections, g_object_unref);
3846}
3847
3848static void
Norman James32e74e22015-09-15 21:28:06 -05003849_sensor_value_on_signal_error (
3850 SensorValue *object)
3851{
3852 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
3853
3854 GList *connections, *l;
3855 GVariant *signal_variant;
3856 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3857
3858 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
3859 for (l = connections; l != NULL; l = l->next)
3860 {
3861 GDBusConnection *connection = l->data;
3862 g_dbus_connection_emit_signal (connection,
3863 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Error",
3864 signal_variant, NULL);
3865 }
3866 g_variant_unref (signal_variant);
3867 g_list_free_full (connections, g_object_unref);
3868}
3869
3870static void
Norman James362a80f2015-09-14 14:04:39 -05003871_sensor_value_on_signal_heartbeat (
3872 SensorValue *object,
3873 const gchar *arg_bus_name)
3874{
3875 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
3876
3877 GList *connections, *l;
3878 GVariant *signal_variant;
3879 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3880
3881 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
3882 arg_bus_name));
3883 for (l = connections; l != NULL; l = l->next)
3884 {
3885 GDBusConnection *connection = l->data;
3886 g_dbus_connection_emit_signal (connection,
3887 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Heartbeat",
3888 signal_variant, NULL);
3889 }
3890 g_variant_unref (signal_variant);
3891 g_list_free_full (connections, g_object_unref);
3892}
3893
3894static void sensor_value_skeleton_iface_init (SensorValueIface *iface);
3895#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3896G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3897 G_ADD_PRIVATE (SensorValueSkeleton)
3898 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init));
3899
3900#else
3901G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3902 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init));
3903
3904#endif
3905static void
3906sensor_value_skeleton_finalize (GObject *object)
3907{
3908 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
3909 guint n;
Norman Jamesdfdaca92015-09-27 22:11:15 -05003910 for (n = 0; n < 5; n++)
Norman James362a80f2015-09-14 14:04:39 -05003911 g_value_unset (&skeleton->priv->properties[n]);
3912 g_free (skeleton->priv->properties);
3913 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3914 if (skeleton->priv->changed_properties_idle_source != NULL)
3915 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3916 g_main_context_unref (skeleton->priv->context);
3917 g_mutex_clear (&skeleton->priv->lock);
3918 G_OBJECT_CLASS (sensor_value_skeleton_parent_class)->finalize (object);
3919}
3920
3921static void
3922sensor_value_skeleton_get_property (GObject *object,
3923 guint prop_id,
3924 GValue *value,
3925 GParamSpec *pspec G_GNUC_UNUSED)
3926{
3927 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman Jamesdfdaca92015-09-27 22:11:15 -05003928 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05003929 g_mutex_lock (&skeleton->priv->lock);
3930 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
3931 g_mutex_unlock (&skeleton->priv->lock);
3932}
3933
3934static gboolean
3935_sensor_value_emit_changed (gpointer user_data)
3936{
3937 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
3938 GList *l;
3939 GVariantBuilder builder;
3940 GVariantBuilder invalidated_builder;
3941 guint num_changes;
3942
3943 g_mutex_lock (&skeleton->priv->lock);
3944 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3945 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
3946 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
3947 {
3948 ChangedProperty *cp = l->data;
3949 GVariant *variant;
3950 const GValue *cur_value;
3951
3952 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
3953 if (!_g_value_equal (cur_value, &cp->orig_value))
3954 {
3955 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
3956 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
3957 g_variant_unref (variant);
3958 num_changes++;
3959 }
3960 }
3961 if (num_changes > 0)
3962 {
3963 GList *connections, *ll;
3964 GVariant *signal_variant;
3965 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorValue",
3966 &builder, &invalidated_builder));
3967 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3968 for (ll = connections; ll != NULL; ll = ll->next)
3969 {
3970 GDBusConnection *connection = ll->data;
3971
3972 g_dbus_connection_emit_signal (connection,
3973 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
3974 "org.freedesktop.DBus.Properties",
3975 "PropertiesChanged",
3976 signal_variant,
3977 NULL);
3978 }
3979 g_variant_unref (signal_variant);
3980 g_list_free_full (connections, g_object_unref);
3981 }
3982 else
3983 {
3984 g_variant_builder_clear (&builder);
3985 g_variant_builder_clear (&invalidated_builder);
3986 }
3987 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3988 skeleton->priv->changed_properties = NULL;
3989 skeleton->priv->changed_properties_idle_source = NULL;
3990 g_mutex_unlock (&skeleton->priv->lock);
3991 return FALSE;
3992}
3993
3994static void
3995_sensor_value_schedule_emit_changed (SensorValueSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
3996{
3997 ChangedProperty *cp;
3998 GList *l;
3999 cp = NULL;
4000 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
4001 {
4002 ChangedProperty *i_cp = l->data;
4003 if (i_cp->info == info)
4004 {
4005 cp = i_cp;
4006 break;
4007 }
4008 }
4009 if (cp == NULL)
4010 {
4011 cp = g_new0 (ChangedProperty, 1);
4012 cp->prop_id = prop_id;
4013 cp->info = info;
4014 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
4015 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
4016 g_value_copy (orig_value, &cp->orig_value);
4017 }
4018}
4019
4020static void
4021sensor_value_skeleton_notify (GObject *object,
4022 GParamSpec *pspec G_GNUC_UNUSED)
4023{
4024 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
4025 g_mutex_lock (&skeleton->priv->lock);
4026 if (skeleton->priv->changed_properties != NULL &&
4027 skeleton->priv->changed_properties_idle_source == NULL)
4028 {
4029 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
4030 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
4031 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_value_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
4032 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
4033 g_source_unref (skeleton->priv->changed_properties_idle_source);
4034 }
4035 g_mutex_unlock (&skeleton->priv->lock);
4036}
4037
4038static void
4039sensor_value_skeleton_set_property (GObject *object,
4040 guint prop_id,
4041 const GValue *value,
4042 GParamSpec *pspec)
4043{
4044 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman Jamesdfdaca92015-09-27 22:11:15 -05004045 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05004046 g_mutex_lock (&skeleton->priv->lock);
4047 g_object_freeze_notify (object);
4048 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
4049 {
4050 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
4051 _sensor_value_schedule_emit_changed (skeleton, _sensor_value_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
4052 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
4053 g_object_notify_by_pspec (object, pspec);
4054 }
4055 g_mutex_unlock (&skeleton->priv->lock);
4056 g_object_thaw_notify (object);
4057}
4058
4059static void
4060sensor_value_skeleton_init (SensorValueSkeleton *skeleton)
4061{
4062#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4063 skeleton->priv = sensor_value_skeleton_get_instance_private (skeleton);
4064#else
4065 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_VALUE_SKELETON, SensorValueSkeletonPrivate);
4066#endif
4067
4068 g_mutex_init (&skeleton->priv->lock);
4069 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman Jamesdfdaca92015-09-27 22:11:15 -05004070 skeleton->priv->properties = g_new0 (GValue, 5);
Norman James362a80f2015-09-14 14:04:39 -05004071 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
4072 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
4073 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
4074 g_value_init (&skeleton->priv->properties[3], G_TYPE_INT);
4075 g_value_init (&skeleton->priv->properties[4], G_TYPE_BOOLEAN);
Norman James362a80f2015-09-14 14:04:39 -05004076}
4077
4078static GVariant *
4079sensor_value_skeleton_get_value (SensorValue *object)
4080{
4081 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
4082 GVariant *value;
4083 g_mutex_lock (&skeleton->priv->lock);
4084 value = g_value_get_variant (&(skeleton->priv->properties[0]));
4085 g_mutex_unlock (&skeleton->priv->lock);
4086 return value;
4087}
4088
4089static const gchar *
4090sensor_value_skeleton_get_units (SensorValue *object)
4091{
4092 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
4093 const gchar *value;
4094 g_mutex_lock (&skeleton->priv->lock);
4095 value = g_value_get_string (&(skeleton->priv->properties[1]));
4096 g_mutex_unlock (&skeleton->priv->lock);
4097 return value;
4098}
4099
4100static gint
4101sensor_value_skeleton_get_poll_interval (SensorValue *object)
4102{
4103 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
4104 gint value;
4105 g_mutex_lock (&skeleton->priv->lock);
4106 value = g_value_get_int (&(skeleton->priv->properties[2]));
4107 g_mutex_unlock (&skeleton->priv->lock);
4108 return value;
4109}
4110
4111static gint
4112sensor_value_skeleton_get_heatbeat (SensorValue *object)
4113{
4114 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
4115 gint value;
4116 g_mutex_lock (&skeleton->priv->lock);
4117 value = g_value_get_int (&(skeleton->priv->properties[3]));
4118 g_mutex_unlock (&skeleton->priv->lock);
4119 return value;
4120}
4121
4122static gboolean
4123sensor_value_skeleton_get_settable (SensorValue *object)
4124{
4125 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
4126 gboolean value;
4127 g_mutex_lock (&skeleton->priv->lock);
4128 value = g_value_get_boolean (&(skeleton->priv->properties[4]));
4129 g_mutex_unlock (&skeleton->priv->lock);
4130 return value;
4131}
4132
Norman James362a80f2015-09-14 14:04:39 -05004133static void
4134sensor_value_skeleton_class_init (SensorValueSkeletonClass *klass)
4135{
4136 GObjectClass *gobject_class;
4137 GDBusInterfaceSkeletonClass *skeleton_class;
4138
4139 gobject_class = G_OBJECT_CLASS (klass);
4140 gobject_class->finalize = sensor_value_skeleton_finalize;
4141 gobject_class->get_property = sensor_value_skeleton_get_property;
4142 gobject_class->set_property = sensor_value_skeleton_set_property;
4143 gobject_class->notify = sensor_value_skeleton_notify;
4144
4145
4146 sensor_value_override_properties (gobject_class, 1);
4147
4148 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
4149 skeleton_class->get_info = sensor_value_skeleton_dbus_interface_get_info;
4150 skeleton_class->get_properties = sensor_value_skeleton_dbus_interface_get_properties;
4151 skeleton_class->flush = sensor_value_skeleton_dbus_interface_flush;
4152 skeleton_class->get_vtable = sensor_value_skeleton_dbus_interface_get_vtable;
4153
4154#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
4155 g_type_class_add_private (klass, sizeof (SensorValueSkeletonPrivate));
4156#endif
4157}
4158
4159static void
4160sensor_value_skeleton_iface_init (SensorValueIface *iface)
4161{
4162 iface->changed = _sensor_value_on_signal_changed;
Norman James32e74e22015-09-15 21:28:06 -05004163 iface->error = _sensor_value_on_signal_error;
Norman James362a80f2015-09-14 14:04:39 -05004164 iface->heartbeat = _sensor_value_on_signal_heartbeat;
4165 iface->get_value = sensor_value_skeleton_get_value;
4166 iface->get_units = sensor_value_skeleton_get_units;
4167 iface->get_poll_interval = sensor_value_skeleton_get_poll_interval;
4168 iface->get_heatbeat = sensor_value_skeleton_get_heatbeat;
4169 iface->get_settable = sensor_value_skeleton_get_settable;
Norman James362a80f2015-09-14 14:04:39 -05004170}
4171
4172/**
4173 * sensor_value_skeleton_new:
4174 *
4175 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
4176 *
4177 * Returns: (transfer full) (type SensorValueSkeleton): The skeleton object.
4178 */
4179SensorValue *
4180sensor_value_skeleton_new (void)
4181{
4182 return SENSOR_VALUE (g_object_new (TYPE_SENSOR_VALUE_SKELETON, NULL));
4183}
4184
4185/* ------------------------------------------------------------------------
4186 * Code for interface org.openbmc.SensorThreshold
4187 * ------------------------------------------------------------------------
4188 */
4189
4190/**
4191 * SECTION:SensorThreshold
4192 * @title: SensorThreshold
4193 * @short_description: Generated C code for the org.openbmc.SensorThreshold D-Bus interface
4194 *
4195 * 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.
4196 */
4197
4198/* ---- Introspection data for org.openbmc.SensorThreshold ---- */
4199
4200static const _ExtendedGDBusArgInfo _sensor_threshold_method_info_get_state_OUT_ARG_state =
4201{
4202 {
4203 -1,
4204 (gchar *) "state",
4205 (gchar *) "y",
4206 NULL
4207 },
4208 FALSE
4209};
4210
4211static const _ExtendedGDBusArgInfo * const _sensor_threshold_method_info_get_state_OUT_ARG_pointers[] =
4212{
4213 &_sensor_threshold_method_info_get_state_OUT_ARG_state,
4214 NULL
4215};
4216
4217static const _ExtendedGDBusMethodInfo _sensor_threshold_method_info_get_state =
4218{
4219 {
4220 -1,
4221 (gchar *) "getState",
4222 NULL,
4223 (GDBusArgInfo **) &_sensor_threshold_method_info_get_state_OUT_ARG_pointers,
4224 NULL
4225 },
4226 "handle-get-state",
4227 FALSE
4228};
4229
4230static const _ExtendedGDBusMethodInfo * const _sensor_threshold_method_info_pointers[] =
4231{
4232 &_sensor_threshold_method_info_get_state,
4233 NULL
4234};
4235
4236static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_warning =
4237{
4238 {
4239 -1,
4240 (gchar *) "Warning",
4241 NULL,
4242 NULL
4243 },
4244 "warning"
4245};
4246
4247static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_critical =
4248{
4249 {
4250 -1,
4251 (gchar *) "Critical",
4252 NULL,
4253 NULL
4254 },
4255 "critical"
4256};
4257
4258static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_normal =
4259{
4260 {
4261 -1,
4262 (gchar *) "Normal",
4263 NULL,
4264 NULL
4265 },
4266 "normal"
4267};
4268
4269static const _ExtendedGDBusSignalInfo * const _sensor_threshold_signal_info_pointers[] =
4270{
4271 &_sensor_threshold_signal_info_warning,
4272 &_sensor_threshold_signal_info_critical,
4273 &_sensor_threshold_signal_info_normal,
4274 NULL
4275};
4276
4277static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_critical =
4278{
4279 {
4280 -1,
4281 (gchar *) "lower_critical",
4282 (gchar *) "v",
4283 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
4284 NULL
4285 },
4286 "lower-critical",
4287 FALSE
4288};
4289
4290static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_warning =
4291{
4292 {
4293 -1,
4294 (gchar *) "lower_warning",
4295 (gchar *) "v",
4296 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
4297 NULL
4298 },
4299 "lower-warning",
4300 FALSE
4301};
4302
4303static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_warning =
4304{
4305 {
4306 -1,
4307 (gchar *) "upper_warning",
4308 (gchar *) "v",
4309 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
4310 NULL
4311 },
4312 "upper-warning",
4313 FALSE
4314};
4315
4316static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_critical =
4317{
4318 {
4319 -1,
4320 (gchar *) "upper_critical",
4321 (gchar *) "v",
4322 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
4323 NULL
4324 },
4325 "upper-critical",
4326 FALSE
4327};
4328
4329static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_state =
4330{
4331 {
4332 -1,
4333 (gchar *) "state",
4334 (gchar *) "y",
4335 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
4336 NULL
4337 },
4338 "state",
4339 FALSE
4340};
4341
4342static const _ExtendedGDBusPropertyInfo * const _sensor_threshold_property_info_pointers[] =
4343{
4344 &_sensor_threshold_property_info_lower_critical,
4345 &_sensor_threshold_property_info_lower_warning,
4346 &_sensor_threshold_property_info_upper_warning,
4347 &_sensor_threshold_property_info_upper_critical,
4348 &_sensor_threshold_property_info_state,
4349 NULL
4350};
4351
4352static const _ExtendedGDBusInterfaceInfo _sensor_threshold_interface_info =
4353{
4354 {
4355 -1,
4356 (gchar *) "org.openbmc.SensorThreshold",
4357 (GDBusMethodInfo **) &_sensor_threshold_method_info_pointers,
4358 (GDBusSignalInfo **) &_sensor_threshold_signal_info_pointers,
4359 (GDBusPropertyInfo **) &_sensor_threshold_property_info_pointers,
4360 NULL
4361 },
4362 "sensor-threshold",
4363};
4364
4365
4366/**
4367 * sensor_threshold_interface_info:
4368 *
4369 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> D-Bus interface.
4370 *
4371 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
4372 */
4373GDBusInterfaceInfo *
4374sensor_threshold_interface_info (void)
4375{
4376 return (GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct;
4377}
4378
4379/**
4380 * sensor_threshold_override_properties:
4381 * @klass: The class structure for a #GObject<!-- -->-derived class.
4382 * @property_id_begin: The property id to assign to the first overridden property.
4383 *
4384 * Overrides all #GObject properties in the #SensorThreshold interface for a concrete class.
4385 * The properties are overridden in the order they are defined.
4386 *
4387 * Returns: The last property id.
4388 */
4389guint
4390sensor_threshold_override_properties (GObjectClass *klass, guint property_id_begin)
4391{
4392 g_object_class_override_property (klass, property_id_begin++, "lower-critical");
4393 g_object_class_override_property (klass, property_id_begin++, "lower-warning");
4394 g_object_class_override_property (klass, property_id_begin++, "upper-warning");
4395 g_object_class_override_property (klass, property_id_begin++, "upper-critical");
4396 g_object_class_override_property (klass, property_id_begin++, "state");
4397 return property_id_begin - 1;
4398}
4399
4400
4401
4402/**
4403 * SensorThreshold:
4404 *
4405 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
4406 */
4407
4408/**
4409 * SensorThresholdIface:
4410 * @parent_iface: The parent interface.
4411 * @handle_get_state: Handler for the #SensorThreshold::handle-get-state signal.
4412 * @get_lower_critical: Getter for the #SensorThreshold:lower-critical property.
4413 * @get_lower_warning: Getter for the #SensorThreshold:lower-warning property.
4414 * @get_state: Getter for the #SensorThreshold:state property.
4415 * @get_upper_critical: Getter for the #SensorThreshold:upper-critical property.
4416 * @get_upper_warning: Getter for the #SensorThreshold:upper-warning property.
4417 * @critical: Handler for the #SensorThreshold::critical signal.
4418 * @normal: Handler for the #SensorThreshold::normal signal.
4419 * @warning: Handler for the #SensorThreshold::warning signal.
4420 *
4421 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
4422 */
4423
4424typedef SensorThresholdIface SensorThresholdInterface;
4425G_DEFINE_INTERFACE (SensorThreshold, sensor_threshold, G_TYPE_OBJECT);
4426
4427static void
4428sensor_threshold_default_init (SensorThresholdIface *iface)
4429{
4430 /* GObject signals for incoming D-Bus method calls: */
4431 /**
4432 * SensorThreshold::handle-get-state:
4433 * @object: A #SensorThreshold.
4434 * @invocation: A #GDBusMethodInvocation.
4435 *
4436 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method.
4437 *
4438 * 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.
4439 *
4440 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
4441 */
4442 g_signal_new ("handle-get-state",
4443 G_TYPE_FROM_INTERFACE (iface),
4444 G_SIGNAL_RUN_LAST,
4445 G_STRUCT_OFFSET (SensorThresholdIface, handle_get_state),
4446 g_signal_accumulator_true_handled,
4447 NULL,
4448 g_cclosure_marshal_generic,
4449 G_TYPE_BOOLEAN,
4450 1,
4451 G_TYPE_DBUS_METHOD_INVOCATION);
4452
4453 /* GObject signals for received D-Bus signals: */
4454 /**
4455 * SensorThreshold::warning:
4456 * @object: A #SensorThreshold.
4457 *
4458 * 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.
4459 *
4460 * 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.
4461 */
4462 g_signal_new ("warning",
4463 G_TYPE_FROM_INTERFACE (iface),
4464 G_SIGNAL_RUN_LAST,
4465 G_STRUCT_OFFSET (SensorThresholdIface, warning),
4466 NULL,
4467 NULL,
4468 g_cclosure_marshal_generic,
4469 G_TYPE_NONE,
4470 0);
4471
4472 /**
4473 * SensorThreshold::critical:
4474 * @object: A #SensorThreshold.
4475 *
4476 * 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.
4477 *
4478 * 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.
4479 */
4480 g_signal_new ("critical",
4481 G_TYPE_FROM_INTERFACE (iface),
4482 G_SIGNAL_RUN_LAST,
4483 G_STRUCT_OFFSET (SensorThresholdIface, critical),
4484 NULL,
4485 NULL,
4486 g_cclosure_marshal_generic,
4487 G_TYPE_NONE,
4488 0);
4489
4490 /**
4491 * SensorThreshold::normal:
4492 * @object: A #SensorThreshold.
4493 *
4494 * 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.
4495 *
4496 * 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.
4497 */
4498 g_signal_new ("normal",
4499 G_TYPE_FROM_INTERFACE (iface),
4500 G_SIGNAL_RUN_LAST,
4501 G_STRUCT_OFFSET (SensorThresholdIface, normal),
4502 NULL,
4503 NULL,
4504 g_cclosure_marshal_generic,
4505 G_TYPE_NONE,
4506 0);
4507
4508 /* GObject properties for D-Bus properties: */
4509 /**
4510 * SensorThreshold:lower-critical:
4511 *
4512 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link>.
4513 *
4514 * 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.
4515 */
4516 g_object_interface_install_property (iface,
4517 g_param_spec_variant ("lower-critical", "lower_critical", "lower_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4518 /**
4519 * SensorThreshold:lower-warning:
4520 *
4521 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link>.
4522 *
4523 * 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.
4524 */
4525 g_object_interface_install_property (iface,
4526 g_param_spec_variant ("lower-warning", "lower_warning", "lower_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4527 /**
4528 * SensorThreshold:upper-warning:
4529 *
4530 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link>.
4531 *
4532 * 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.
4533 */
4534 g_object_interface_install_property (iface,
4535 g_param_spec_variant ("upper-warning", "upper_warning", "upper_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4536 /**
4537 * SensorThreshold:upper-critical:
4538 *
4539 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link>.
4540 *
4541 * 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.
4542 */
4543 g_object_interface_install_property (iface,
4544 g_param_spec_variant ("upper-critical", "upper_critical", "upper_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4545 /**
4546 * SensorThreshold:state:
4547 *
4548 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link>.
4549 *
4550 * 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.
4551 */
4552 g_object_interface_install_property (iface,
4553 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4554}
4555
4556/**
4557 * sensor_threshold_get_lower_critical: (skip)
4558 * @object: A #SensorThreshold.
4559 *
4560 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property.
4561 *
4562 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4563 *
4564 * <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>
4565 *
4566 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
4567 */
4568GVariant *
4569sensor_threshold_get_lower_critical (SensorThreshold *object)
4570{
4571 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_critical (object);
4572}
4573
4574/**
4575 * sensor_threshold_dup_lower_critical: (skip)
4576 * @object: A #SensorThreshold.
4577 *
4578 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property.
4579 *
4580 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4581 *
4582 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
4583 */
4584GVariant *
4585sensor_threshold_dup_lower_critical (SensorThreshold *object)
4586{
4587 GVariant *value;
4588 g_object_get (G_OBJECT (object), "lower-critical", &value, NULL);
4589 return value;
4590}
4591
4592/**
4593 * sensor_threshold_set_lower_critical: (skip)
4594 * @object: A #SensorThreshold.
4595 * @value: The value to set.
4596 *
4597 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property to @value.
4598 *
4599 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4600 */
4601void
4602sensor_threshold_set_lower_critical (SensorThreshold *object, GVariant *value)
4603{
4604 g_object_set (G_OBJECT (object), "lower-critical", value, NULL);
4605}
4606
4607/**
4608 * sensor_threshold_get_lower_warning: (skip)
4609 * @object: A #SensorThreshold.
4610 *
4611 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property.
4612 *
4613 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4614 *
4615 * <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>
4616 *
4617 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
4618 */
4619GVariant *
4620sensor_threshold_get_lower_warning (SensorThreshold *object)
4621{
4622 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_warning (object);
4623}
4624
4625/**
4626 * sensor_threshold_dup_lower_warning: (skip)
4627 * @object: A #SensorThreshold.
4628 *
4629 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property.
4630 *
4631 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4632 *
4633 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
4634 */
4635GVariant *
4636sensor_threshold_dup_lower_warning (SensorThreshold *object)
4637{
4638 GVariant *value;
4639 g_object_get (G_OBJECT (object), "lower-warning", &value, NULL);
4640 return value;
4641}
4642
4643/**
4644 * sensor_threshold_set_lower_warning: (skip)
4645 * @object: A #SensorThreshold.
4646 * @value: The value to set.
4647 *
4648 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property to @value.
4649 *
4650 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4651 */
4652void
4653sensor_threshold_set_lower_warning (SensorThreshold *object, GVariant *value)
4654{
4655 g_object_set (G_OBJECT (object), "lower-warning", value, NULL);
4656}
4657
4658/**
4659 * sensor_threshold_get_upper_warning: (skip)
4660 * @object: A #SensorThreshold.
4661 *
4662 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property.
4663 *
4664 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4665 *
4666 * <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>
4667 *
4668 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
4669 */
4670GVariant *
4671sensor_threshold_get_upper_warning (SensorThreshold *object)
4672{
4673 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_warning (object);
4674}
4675
4676/**
4677 * sensor_threshold_dup_upper_warning: (skip)
4678 * @object: A #SensorThreshold.
4679 *
4680 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property.
4681 *
4682 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4683 *
4684 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
4685 */
4686GVariant *
4687sensor_threshold_dup_upper_warning (SensorThreshold *object)
4688{
4689 GVariant *value;
4690 g_object_get (G_OBJECT (object), "upper-warning", &value, NULL);
4691 return value;
4692}
4693
4694/**
4695 * sensor_threshold_set_upper_warning: (skip)
4696 * @object: A #SensorThreshold.
4697 * @value: The value to set.
4698 *
4699 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property to @value.
4700 *
4701 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4702 */
4703void
4704sensor_threshold_set_upper_warning (SensorThreshold *object, GVariant *value)
4705{
4706 g_object_set (G_OBJECT (object), "upper-warning", value, NULL);
4707}
4708
4709/**
4710 * sensor_threshold_get_upper_critical: (skip)
4711 * @object: A #SensorThreshold.
4712 *
4713 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property.
4714 *
4715 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4716 *
4717 * <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>
4718 *
4719 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
4720 */
4721GVariant *
4722sensor_threshold_get_upper_critical (SensorThreshold *object)
4723{
4724 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_critical (object);
4725}
4726
4727/**
4728 * sensor_threshold_dup_upper_critical: (skip)
4729 * @object: A #SensorThreshold.
4730 *
4731 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property.
4732 *
4733 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4734 *
4735 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
4736 */
4737GVariant *
4738sensor_threshold_dup_upper_critical (SensorThreshold *object)
4739{
4740 GVariant *value;
4741 g_object_get (G_OBJECT (object), "upper-critical", &value, NULL);
4742 return value;
4743}
4744
4745/**
4746 * sensor_threshold_set_upper_critical: (skip)
4747 * @object: A #SensorThreshold.
4748 * @value: The value to set.
4749 *
4750 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property to @value.
4751 *
4752 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4753 */
4754void
4755sensor_threshold_set_upper_critical (SensorThreshold *object, GVariant *value)
4756{
4757 g_object_set (G_OBJECT (object), "upper-critical", value, NULL);
4758}
4759
4760/**
4761 * sensor_threshold_get_state: (skip)
4762 * @object: A #SensorThreshold.
4763 *
4764 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property.
4765 *
4766 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4767 *
4768 * Returns: The property value.
4769 */
4770guchar
4771sensor_threshold_get_state (SensorThreshold *object)
4772{
4773 return SENSOR_THRESHOLD_GET_IFACE (object)->get_state (object);
4774}
4775
4776/**
4777 * sensor_threshold_set_state: (skip)
4778 * @object: A #SensorThreshold.
4779 * @value: The value to set.
4780 *
4781 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property to @value.
4782 *
4783 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4784 */
4785void
4786sensor_threshold_set_state (SensorThreshold *object, guchar value)
4787{
4788 g_object_set (G_OBJECT (object), "state", value, NULL);
4789}
4790
4791/**
4792 * sensor_threshold_emit_warning:
4793 * @object: A #SensorThreshold.
4794 *
4795 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Warning">"Warning"</link> D-Bus signal.
4796 */
4797void
4798sensor_threshold_emit_warning (
4799 SensorThreshold *object)
4800{
4801 g_signal_emit_by_name (object, "warning");
4802}
4803
4804/**
4805 * sensor_threshold_emit_critical:
4806 * @object: A #SensorThreshold.
4807 *
4808 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Critical">"Critical"</link> D-Bus signal.
4809 */
4810void
4811sensor_threshold_emit_critical (
4812 SensorThreshold *object)
4813{
4814 g_signal_emit_by_name (object, "critical");
4815}
4816
4817/**
4818 * sensor_threshold_emit_normal:
4819 * @object: A #SensorThreshold.
4820 *
4821 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Normal">"Normal"</link> D-Bus signal.
4822 */
4823void
4824sensor_threshold_emit_normal (
4825 SensorThreshold *object)
4826{
4827 g_signal_emit_by_name (object, "normal");
4828}
4829
4830/**
4831 * sensor_threshold_call_get_state:
4832 * @proxy: A #SensorThresholdProxy.
4833 * @cancellable: (allow-none): A #GCancellable or %NULL.
4834 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4835 * @user_data: User data to pass to @callback.
4836 *
4837 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method on @proxy.
4838 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
4839 * You can then call sensor_threshold_call_get_state_finish() to get the result of the operation.
4840 *
4841 * See sensor_threshold_call_get_state_sync() for the synchronous, blocking version of this method.
4842 */
4843void
4844sensor_threshold_call_get_state (
4845 SensorThreshold *proxy,
4846 GCancellable *cancellable,
4847 GAsyncReadyCallback callback,
4848 gpointer user_data)
4849{
4850 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4851 "getState",
4852 g_variant_new ("()"),
4853 G_DBUS_CALL_FLAGS_NONE,
4854 -1,
4855 cancellable,
4856 callback,
4857 user_data);
4858}
4859
4860/**
4861 * sensor_threshold_call_get_state_finish:
4862 * @proxy: A #SensorThresholdProxy.
4863 * @out_state: (out): Return location for return parameter or %NULL to ignore.
4864 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_call_get_state().
4865 * @error: Return location for error or %NULL.
4866 *
4867 * Finishes an operation started with sensor_threshold_call_get_state().
4868 *
4869 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4870 */
4871gboolean
4872sensor_threshold_call_get_state_finish (
4873 SensorThreshold *proxy,
4874 guchar *out_state,
4875 GAsyncResult *res,
4876 GError **error)
4877{
4878 GVariant *_ret;
4879 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4880 if (_ret == NULL)
4881 goto _out;
4882 g_variant_get (_ret,
4883 "(y)",
4884 out_state);
4885 g_variant_unref (_ret);
4886_out:
4887 return _ret != NULL;
4888}
4889
4890/**
4891 * sensor_threshold_call_get_state_sync:
4892 * @proxy: A #SensorThresholdProxy.
4893 * @out_state: (out): Return location for return parameter or %NULL to ignore.
4894 * @cancellable: (allow-none): A #GCancellable or %NULL.
4895 * @error: Return location for error or %NULL.
4896 *
4897 * 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.
4898 *
4899 * See sensor_threshold_call_get_state() for the asynchronous version of this method.
4900 *
4901 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4902 */
4903gboolean
4904sensor_threshold_call_get_state_sync (
4905 SensorThreshold *proxy,
4906 guchar *out_state,
4907 GCancellable *cancellable,
4908 GError **error)
4909{
4910 GVariant *_ret;
4911 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4912 "getState",
4913 g_variant_new ("()"),
4914 G_DBUS_CALL_FLAGS_NONE,
4915 -1,
4916 cancellable,
4917 error);
4918 if (_ret == NULL)
4919 goto _out;
4920 g_variant_get (_ret,
4921 "(y)",
4922 out_state);
4923 g_variant_unref (_ret);
4924_out:
4925 return _ret != NULL;
4926}
4927
4928/**
4929 * sensor_threshold_complete_get_state:
4930 * @object: A #SensorThreshold.
4931 * @invocation: (transfer full): A #GDBusMethodInvocation.
4932 * @state: Parameter to return.
4933 *
4934 * 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.
4935 *
4936 * This method will free @invocation, you cannot use it afterwards.
4937 */
4938void
4939sensor_threshold_complete_get_state (
4940 SensorThreshold *object,
4941 GDBusMethodInvocation *invocation,
4942 guchar state)
4943{
4944 g_dbus_method_invocation_return_value (invocation,
4945 g_variant_new ("(y)",
4946 state));
4947}
4948
4949/* ------------------------------------------------------------------------ */
4950
4951/**
4952 * SensorThresholdProxy:
4953 *
4954 * The #SensorThresholdProxy structure contains only private data and should only be accessed using the provided API.
4955 */
4956
4957/**
4958 * SensorThresholdProxyClass:
4959 * @parent_class: The parent class.
4960 *
4961 * Class structure for #SensorThresholdProxy.
4962 */
4963
4964struct _SensorThresholdProxyPrivate
4965{
4966 GData *qdata;
4967};
4968
4969static void sensor_threshold_proxy_iface_init (SensorThresholdIface *iface);
4970
4971#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4972G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
4973 G_ADD_PRIVATE (SensorThresholdProxy)
4974 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init));
4975
4976#else
4977G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
4978 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init));
4979
4980#endif
4981static void
4982sensor_threshold_proxy_finalize (GObject *object)
4983{
4984 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
4985 g_datalist_clear (&proxy->priv->qdata);
4986 G_OBJECT_CLASS (sensor_threshold_proxy_parent_class)->finalize (object);
4987}
4988
4989static void
4990sensor_threshold_proxy_get_property (GObject *object,
4991 guint prop_id,
4992 GValue *value,
4993 GParamSpec *pspec G_GNUC_UNUSED)
4994{
4995 const _ExtendedGDBusPropertyInfo *info;
4996 GVariant *variant;
4997 g_assert (prop_id != 0 && prop_id - 1 < 5);
4998 info = _sensor_threshold_property_info_pointers[prop_id - 1];
4999 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
5000 if (info->use_gvariant)
5001 {
5002 g_value_set_variant (value, variant);
5003 }
5004 else
5005 {
5006 if (variant != NULL)
5007 g_dbus_gvariant_to_gvalue (variant, value);
5008 }
5009 if (variant != NULL)
5010 g_variant_unref (variant);
5011}
5012
5013static void
5014sensor_threshold_proxy_set_property_cb (GDBusProxy *proxy,
5015 GAsyncResult *res,
5016 gpointer user_data)
5017{
5018 const _ExtendedGDBusPropertyInfo *info = user_data;
5019 GError *error;
5020 GVariant *_ret;
5021 error = NULL;
5022 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
5023 if (!_ret)
5024 {
5025 g_warning ("Error setting property '%s' on interface org.openbmc.SensorThreshold: %s (%s, %d)",
5026 info->parent_struct.name,
5027 error->message, g_quark_to_string (error->domain), error->code);
5028 g_error_free (error);
5029 }
5030 else
5031 {
5032 g_variant_unref (_ret);
5033 }
5034}
5035
5036static void
5037sensor_threshold_proxy_set_property (GObject *object,
5038 guint prop_id,
5039 const GValue *value,
5040 GParamSpec *pspec G_GNUC_UNUSED)
5041{
5042 const _ExtendedGDBusPropertyInfo *info;
5043 GVariant *variant;
5044 g_assert (prop_id != 0 && prop_id - 1 < 5);
5045 info = _sensor_threshold_property_info_pointers[prop_id - 1];
5046 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
5047 g_dbus_proxy_call (G_DBUS_PROXY (object),
5048 "org.freedesktop.DBus.Properties.Set",
5049 g_variant_new ("(ssv)", "org.openbmc.SensorThreshold", info->parent_struct.name, variant),
5050 G_DBUS_CALL_FLAGS_NONE,
5051 -1,
5052 NULL, (GAsyncReadyCallback) sensor_threshold_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
5053 g_variant_unref (variant);
5054}
5055
5056static void
5057sensor_threshold_proxy_g_signal (GDBusProxy *proxy,
5058 const gchar *sender_name G_GNUC_UNUSED,
5059 const gchar *signal_name,
5060 GVariant *parameters)
5061{
5062 _ExtendedGDBusSignalInfo *info;
5063 GVariantIter iter;
5064 GVariant *child;
5065 GValue *paramv;
5066 guint num_params;
5067 guint n;
5068 guint signal_id;
5069 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, signal_name);
5070 if (info == NULL)
5071 return;
5072 num_params = g_variant_n_children (parameters);
5073 paramv = g_new0 (GValue, num_params + 1);
5074 g_value_init (&paramv[0], TYPE_SENSOR_THRESHOLD);
5075 g_value_set_object (&paramv[0], proxy);
5076 g_variant_iter_init (&iter, parameters);
5077 n = 1;
5078 while ((child = g_variant_iter_next_value (&iter)) != NULL)
5079 {
5080 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
5081 if (arg_info->use_gvariant)
5082 {
5083 g_value_init (&paramv[n], G_TYPE_VARIANT);
5084 g_value_set_variant (&paramv[n], child);
5085 n++;
5086 }
5087 else
5088 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
5089 g_variant_unref (child);
5090 }
5091 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
5092 g_signal_emitv (paramv, signal_id, 0, NULL);
5093 for (n = 0; n < num_params + 1; n++)
5094 g_value_unset (&paramv[n]);
5095 g_free (paramv);
5096}
5097
5098static void
5099sensor_threshold_proxy_g_properties_changed (GDBusProxy *_proxy,
5100 GVariant *changed_properties,
5101 const gchar *const *invalidated_properties)
5102{
5103 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (_proxy);
5104 guint n;
5105 const gchar *key;
5106 GVariantIter *iter;
5107 _ExtendedGDBusPropertyInfo *info;
5108 g_variant_get (changed_properties, "a{sv}", &iter);
5109 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
5110 {
5111 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, key);
5112 g_datalist_remove_data (&proxy->priv->qdata, key);
5113 if (info != NULL)
5114 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
5115 }
5116 g_variant_iter_free (iter);
5117 for (n = 0; invalidated_properties[n] != NULL; n++)
5118 {
5119 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, invalidated_properties[n]);
5120 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
5121 if (info != NULL)
5122 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
5123 }
5124}
5125
5126static GVariant *
5127sensor_threshold_proxy_get_lower_critical (SensorThreshold *object)
5128{
5129 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
5130 GVariant *variant;
5131 GVariant *value = NULL;
5132 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_critical");
5133 value = variant;
5134 if (variant != NULL)
5135 g_variant_unref (variant);
5136 return value;
5137}
5138
5139static GVariant *
5140sensor_threshold_proxy_get_lower_warning (SensorThreshold *object)
5141{
5142 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
5143 GVariant *variant;
5144 GVariant *value = NULL;
5145 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_warning");
5146 value = variant;
5147 if (variant != NULL)
5148 g_variant_unref (variant);
5149 return value;
5150}
5151
5152static GVariant *
5153sensor_threshold_proxy_get_upper_warning (SensorThreshold *object)
5154{
5155 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
5156 GVariant *variant;
5157 GVariant *value = NULL;
5158 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_warning");
5159 value = variant;
5160 if (variant != NULL)
5161 g_variant_unref (variant);
5162 return value;
5163}
5164
5165static GVariant *
5166sensor_threshold_proxy_get_upper_critical (SensorThreshold *object)
5167{
5168 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
5169 GVariant *variant;
5170 GVariant *value = NULL;
5171 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_critical");
5172 value = variant;
5173 if (variant != NULL)
5174 g_variant_unref (variant);
5175 return value;
5176}
5177
5178static guchar
5179sensor_threshold_proxy_get_state (SensorThreshold *object)
5180{
5181 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
5182 GVariant *variant;
5183 guchar value = 0;
5184 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
5185 if (variant != NULL)
5186 {
5187 value = g_variant_get_byte (variant);
5188 g_variant_unref (variant);
5189 }
5190 return value;
5191}
5192
5193static void
5194sensor_threshold_proxy_init (SensorThresholdProxy *proxy)
5195{
5196#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5197 proxy->priv = sensor_threshold_proxy_get_instance_private (proxy);
5198#else
5199 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_THRESHOLD_PROXY, SensorThresholdProxyPrivate);
5200#endif
5201
5202 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_threshold_interface_info ());
5203}
5204
5205static void
5206sensor_threshold_proxy_class_init (SensorThresholdProxyClass *klass)
5207{
5208 GObjectClass *gobject_class;
5209 GDBusProxyClass *proxy_class;
5210
5211 gobject_class = G_OBJECT_CLASS (klass);
5212 gobject_class->finalize = sensor_threshold_proxy_finalize;
5213 gobject_class->get_property = sensor_threshold_proxy_get_property;
5214 gobject_class->set_property = sensor_threshold_proxy_set_property;
5215
5216 proxy_class = G_DBUS_PROXY_CLASS (klass);
5217 proxy_class->g_signal = sensor_threshold_proxy_g_signal;
5218 proxy_class->g_properties_changed = sensor_threshold_proxy_g_properties_changed;
5219
5220 sensor_threshold_override_properties (gobject_class, 1);
5221
5222#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
5223 g_type_class_add_private (klass, sizeof (SensorThresholdProxyPrivate));
5224#endif
5225}
5226
5227static void
5228sensor_threshold_proxy_iface_init (SensorThresholdIface *iface)
5229{
5230 iface->get_lower_critical = sensor_threshold_proxy_get_lower_critical;
5231 iface->get_lower_warning = sensor_threshold_proxy_get_lower_warning;
5232 iface->get_upper_warning = sensor_threshold_proxy_get_upper_warning;
5233 iface->get_upper_critical = sensor_threshold_proxy_get_upper_critical;
5234 iface->get_state = sensor_threshold_proxy_get_state;
5235}
5236
5237/**
5238 * sensor_threshold_proxy_new:
5239 * @connection: A #GDBusConnection.
5240 * @flags: Flags from the #GDBusProxyFlags enumeration.
5241 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
5242 * @object_path: An object path.
5243 * @cancellable: (allow-none): A #GCancellable or %NULL.
5244 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
5245 * @user_data: User data to pass to @callback.
5246 *
5247 * 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.
5248 *
5249 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
5250 * You can then call sensor_threshold_proxy_new_finish() to get the result of the operation.
5251 *
5252 * See sensor_threshold_proxy_new_sync() for the synchronous, blocking version of this constructor.
5253 */
5254void
5255sensor_threshold_proxy_new (
5256 GDBusConnection *connection,
5257 GDBusProxyFlags flags,
5258 const gchar *name,
5259 const gchar *object_path,
5260 GCancellable *cancellable,
5261 GAsyncReadyCallback callback,
5262 gpointer user_data)
5263{
5264 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);
5265}
5266
5267/**
5268 * sensor_threshold_proxy_new_finish:
5269 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new().
5270 * @error: Return location for error or %NULL
5271 *
5272 * Finishes an operation started with sensor_threshold_proxy_new().
5273 *
5274 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
5275 */
5276SensorThreshold *
5277sensor_threshold_proxy_new_finish (
5278 GAsyncResult *res,
5279 GError **error)
5280{
5281 GObject *ret;
5282 GObject *source_object;
5283 source_object = g_async_result_get_source_object (res);
5284 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
5285 g_object_unref (source_object);
5286 if (ret != NULL)
5287 return SENSOR_THRESHOLD (ret);
5288 else
5289 return NULL;
5290}
5291
5292/**
5293 * sensor_threshold_proxy_new_sync:
5294 * @connection: A #GDBusConnection.
5295 * @flags: Flags from the #GDBusProxyFlags enumeration.
5296 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
5297 * @object_path: An object path.
5298 * @cancellable: (allow-none): A #GCancellable or %NULL.
5299 * @error: Return location for error or %NULL
5300 *
5301 * 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.
5302 *
5303 * The calling thread is blocked until a reply is received.
5304 *
5305 * See sensor_threshold_proxy_new() for the asynchronous version of this constructor.
5306 *
5307 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
5308 */
5309SensorThreshold *
5310sensor_threshold_proxy_new_sync (
5311 GDBusConnection *connection,
5312 GDBusProxyFlags flags,
5313 const gchar *name,
5314 const gchar *object_path,
5315 GCancellable *cancellable,
5316 GError **error)
5317{
5318 GInitable *ret;
5319 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);
5320 if (ret != NULL)
5321 return SENSOR_THRESHOLD (ret);
5322 else
5323 return NULL;
5324}
5325
5326
5327/**
5328 * sensor_threshold_proxy_new_for_bus:
5329 * @bus_type: A #GBusType.
5330 * @flags: Flags from the #GDBusProxyFlags enumeration.
5331 * @name: A bus name (well-known or unique).
5332 * @object_path: An object path.
5333 * @cancellable: (allow-none): A #GCancellable or %NULL.
5334 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
5335 * @user_data: User data to pass to @callback.
5336 *
5337 * Like sensor_threshold_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
5338 *
5339 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
5340 * You can then call sensor_threshold_proxy_new_for_bus_finish() to get the result of the operation.
5341 *
5342 * See sensor_threshold_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
5343 */
5344void
5345sensor_threshold_proxy_new_for_bus (
5346 GBusType bus_type,
5347 GDBusProxyFlags flags,
5348 const gchar *name,
5349 const gchar *object_path,
5350 GCancellable *cancellable,
5351 GAsyncReadyCallback callback,
5352 gpointer user_data)
5353{
5354 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);
5355}
5356
5357/**
5358 * sensor_threshold_proxy_new_for_bus_finish:
5359 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new_for_bus().
5360 * @error: Return location for error or %NULL
5361 *
5362 * Finishes an operation started with sensor_threshold_proxy_new_for_bus().
5363 *
5364 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
5365 */
5366SensorThreshold *
5367sensor_threshold_proxy_new_for_bus_finish (
5368 GAsyncResult *res,
5369 GError **error)
5370{
5371 GObject *ret;
5372 GObject *source_object;
5373 source_object = g_async_result_get_source_object (res);
5374 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
5375 g_object_unref (source_object);
5376 if (ret != NULL)
5377 return SENSOR_THRESHOLD (ret);
5378 else
5379 return NULL;
5380}
5381
5382/**
5383 * sensor_threshold_proxy_new_for_bus_sync:
5384 * @bus_type: A #GBusType.
5385 * @flags: Flags from the #GDBusProxyFlags enumeration.
5386 * @name: A bus name (well-known or unique).
5387 * @object_path: An object path.
5388 * @cancellable: (allow-none): A #GCancellable or %NULL.
5389 * @error: Return location for error or %NULL
5390 *
5391 * Like sensor_threshold_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
5392 *
5393 * The calling thread is blocked until a reply is received.
5394 *
5395 * See sensor_threshold_proxy_new_for_bus() for the asynchronous version of this constructor.
5396 *
5397 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
5398 */
5399SensorThreshold *
5400sensor_threshold_proxy_new_for_bus_sync (
5401 GBusType bus_type,
5402 GDBusProxyFlags flags,
5403 const gchar *name,
5404 const gchar *object_path,
5405 GCancellable *cancellable,
5406 GError **error)
5407{
5408 GInitable *ret;
5409 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);
5410 if (ret != NULL)
5411 return SENSOR_THRESHOLD (ret);
5412 else
5413 return NULL;
5414}
5415
5416
5417/* ------------------------------------------------------------------------ */
5418
5419/**
5420 * SensorThresholdSkeleton:
5421 *
5422 * The #SensorThresholdSkeleton structure contains only private data and should only be accessed using the provided API.
5423 */
5424
5425/**
5426 * SensorThresholdSkeletonClass:
5427 * @parent_class: The parent class.
5428 *
5429 * Class structure for #SensorThresholdSkeleton.
5430 */
5431
5432struct _SensorThresholdSkeletonPrivate
5433{
5434 GValue *properties;
5435 GList *changed_properties;
5436 GSource *changed_properties_idle_source;
5437 GMainContext *context;
5438 GMutex lock;
5439};
5440
5441static void
5442_sensor_threshold_skeleton_handle_method_call (
5443 GDBusConnection *connection G_GNUC_UNUSED,
5444 const gchar *sender G_GNUC_UNUSED,
5445 const gchar *object_path G_GNUC_UNUSED,
5446 const gchar *interface_name,
5447 const gchar *method_name,
5448 GVariant *parameters,
5449 GDBusMethodInvocation *invocation,
5450 gpointer user_data)
5451{
5452 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
5453 _ExtendedGDBusMethodInfo *info;
5454 GVariantIter iter;
5455 GVariant *child;
5456 GValue *paramv;
5457 guint num_params;
5458 guint num_extra;
5459 guint n;
5460 guint signal_id;
5461 GValue return_value = G_VALUE_INIT;
5462 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
5463 g_assert (info != NULL);
5464 num_params = g_variant_n_children (parameters);
5465 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
5466 n = 0;
5467 g_value_init (&paramv[n], TYPE_SENSOR_THRESHOLD);
5468 g_value_set_object (&paramv[n++], skeleton);
5469 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
5470 g_value_set_object (&paramv[n++], invocation);
5471 if (info->pass_fdlist)
5472 {
5473#ifdef G_OS_UNIX
5474 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
5475 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
5476#else
5477 g_assert_not_reached ();
5478#endif
5479 }
5480 g_variant_iter_init (&iter, parameters);
5481 while ((child = g_variant_iter_next_value (&iter)) != NULL)
5482 {
5483 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
5484 if (arg_info->use_gvariant)
5485 {
5486 g_value_init (&paramv[n], G_TYPE_VARIANT);
5487 g_value_set_variant (&paramv[n], child);
5488 n++;
5489 }
5490 else
5491 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
5492 g_variant_unref (child);
5493 }
5494 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
5495 g_value_init (&return_value, G_TYPE_BOOLEAN);
5496 g_signal_emitv (paramv, signal_id, 0, &return_value);
5497 if (!g_value_get_boolean (&return_value))
5498 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);
5499 g_value_unset (&return_value);
5500 for (n = 0; n < num_params + num_extra; n++)
5501 g_value_unset (&paramv[n]);
5502 g_free (paramv);
5503}
5504
5505static GVariant *
5506_sensor_threshold_skeleton_handle_get_property (
5507 GDBusConnection *connection G_GNUC_UNUSED,
5508 const gchar *sender G_GNUC_UNUSED,
5509 const gchar *object_path G_GNUC_UNUSED,
5510 const gchar *interface_name G_GNUC_UNUSED,
5511 const gchar *property_name,
5512 GError **error,
5513 gpointer user_data)
5514{
5515 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
5516 GValue value = G_VALUE_INIT;
5517 GParamSpec *pspec;
5518 _ExtendedGDBusPropertyInfo *info;
5519 GVariant *ret;
5520 ret = NULL;
5521 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
5522 g_assert (info != NULL);
5523 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5524 if (pspec == NULL)
5525 {
5526 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5527 }
5528 else
5529 {
5530 g_value_init (&value, pspec->value_type);
5531 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5532 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
5533 g_value_unset (&value);
5534 }
5535 return ret;
5536}
5537
5538static gboolean
5539_sensor_threshold_skeleton_handle_set_property (
5540 GDBusConnection *connection G_GNUC_UNUSED,
5541 const gchar *sender G_GNUC_UNUSED,
5542 const gchar *object_path G_GNUC_UNUSED,
5543 const gchar *interface_name G_GNUC_UNUSED,
5544 const gchar *property_name,
5545 GVariant *variant,
5546 GError **error,
5547 gpointer user_data)
5548{
5549 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
5550 GValue value = G_VALUE_INIT;
5551 GParamSpec *pspec;
5552 _ExtendedGDBusPropertyInfo *info;
5553 gboolean ret;
5554 ret = FALSE;
5555 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
5556 g_assert (info != NULL);
5557 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5558 if (pspec == NULL)
5559 {
5560 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5561 }
5562 else
5563 {
5564 if (info->use_gvariant)
5565 g_value_set_variant (&value, variant);
5566 else
5567 g_dbus_gvariant_to_gvalue (variant, &value);
5568 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5569 g_value_unset (&value);
5570 ret = TRUE;
5571 }
5572 return ret;
5573}
5574
5575static const GDBusInterfaceVTable _sensor_threshold_skeleton_vtable =
5576{
5577 _sensor_threshold_skeleton_handle_method_call,
5578 _sensor_threshold_skeleton_handle_get_property,
5579 _sensor_threshold_skeleton_handle_set_property,
5580 {NULL}
5581};
5582
5583static GDBusInterfaceInfo *
5584sensor_threshold_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5585{
5586 return sensor_threshold_interface_info ();
5587}
5588
5589static GDBusInterfaceVTable *
5590sensor_threshold_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5591{
5592 return (GDBusInterfaceVTable *) &_sensor_threshold_skeleton_vtable;
5593}
5594
5595static GVariant *
5596sensor_threshold_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
5597{
5598 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
5599
5600 GVariantBuilder builder;
5601 guint n;
5602 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5603 if (_sensor_threshold_interface_info.parent_struct.properties == NULL)
5604 goto out;
5605 for (n = 0; _sensor_threshold_interface_info.parent_struct.properties[n] != NULL; n++)
5606 {
5607 GDBusPropertyInfo *info = _sensor_threshold_interface_info.parent_struct.properties[n];
5608 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
5609 {
5610 GVariant *value;
5611 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);
5612 if (value != NULL)
5613 {
5614 g_variant_take_ref (value);
5615 g_variant_builder_add (&builder, "{sv}", info->name, value);
5616 g_variant_unref (value);
5617 }
5618 }
5619 }
5620out:
5621 return g_variant_builder_end (&builder);
5622}
5623
5624static gboolean _sensor_threshold_emit_changed (gpointer user_data);
5625
5626static void
5627sensor_threshold_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
5628{
5629 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
5630 gboolean emit_changed = FALSE;
5631
5632 g_mutex_lock (&skeleton->priv->lock);
5633 if (skeleton->priv->changed_properties_idle_source != NULL)
5634 {
5635 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5636 skeleton->priv->changed_properties_idle_source = NULL;
5637 emit_changed = TRUE;
5638 }
5639 g_mutex_unlock (&skeleton->priv->lock);
5640
5641 if (emit_changed)
5642 _sensor_threshold_emit_changed (skeleton);
5643}
5644
5645static void
5646_sensor_threshold_on_signal_warning (
5647 SensorThreshold *object)
5648{
5649 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
5650
5651 GList *connections, *l;
5652 GVariant *signal_variant;
5653 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5654
5655 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
5656 for (l = connections; l != NULL; l = l->next)
5657 {
5658 GDBusConnection *connection = l->data;
5659 g_dbus_connection_emit_signal (connection,
5660 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Warning",
5661 signal_variant, NULL);
5662 }
5663 g_variant_unref (signal_variant);
5664 g_list_free_full (connections, g_object_unref);
5665}
5666
5667static void
5668_sensor_threshold_on_signal_critical (
5669 SensorThreshold *object)
5670{
5671 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
5672
5673 GList *connections, *l;
5674 GVariant *signal_variant;
5675 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5676
5677 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
5678 for (l = connections; l != NULL; l = l->next)
5679 {
5680 GDBusConnection *connection = l->data;
5681 g_dbus_connection_emit_signal (connection,
5682 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Critical",
5683 signal_variant, NULL);
5684 }
5685 g_variant_unref (signal_variant);
5686 g_list_free_full (connections, g_object_unref);
5687}
5688
5689static void
5690_sensor_threshold_on_signal_normal (
5691 SensorThreshold *object)
5692{
5693 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
5694
5695 GList *connections, *l;
5696 GVariant *signal_variant;
5697 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5698
5699 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
5700 for (l = connections; l != NULL; l = l->next)
5701 {
5702 GDBusConnection *connection = l->data;
5703 g_dbus_connection_emit_signal (connection,
5704 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Normal",
5705 signal_variant, NULL);
5706 }
5707 g_variant_unref (signal_variant);
5708 g_list_free_full (connections, g_object_unref);
5709}
5710
5711static void sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface);
5712#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5713G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5714 G_ADD_PRIVATE (SensorThresholdSkeleton)
5715 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init));
5716
5717#else
5718G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5719 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init));
5720
5721#endif
5722static void
5723sensor_threshold_skeleton_finalize (GObject *object)
5724{
5725 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
5726 guint n;
5727 for (n = 0; n < 5; n++)
5728 g_value_unset (&skeleton->priv->properties[n]);
5729 g_free (skeleton->priv->properties);
5730 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5731 if (skeleton->priv->changed_properties_idle_source != NULL)
5732 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5733 g_main_context_unref (skeleton->priv->context);
5734 g_mutex_clear (&skeleton->priv->lock);
5735 G_OBJECT_CLASS (sensor_threshold_skeleton_parent_class)->finalize (object);
5736}
5737
5738static void
5739sensor_threshold_skeleton_get_property (GObject *object,
5740 guint prop_id,
5741 GValue *value,
5742 GParamSpec *pspec G_GNUC_UNUSED)
5743{
5744 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
5745 g_assert (prop_id != 0 && prop_id - 1 < 5);
5746 g_mutex_lock (&skeleton->priv->lock);
5747 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
5748 g_mutex_unlock (&skeleton->priv->lock);
5749}
5750
5751static gboolean
5752_sensor_threshold_emit_changed (gpointer user_data)
5753{
5754 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
5755 GList *l;
5756 GVariantBuilder builder;
5757 GVariantBuilder invalidated_builder;
5758 guint num_changes;
5759
5760 g_mutex_lock (&skeleton->priv->lock);
5761 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5762 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
5763 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
5764 {
5765 ChangedProperty *cp = l->data;
5766 GVariant *variant;
5767 const GValue *cur_value;
5768
5769 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
5770 if (!_g_value_equal (cur_value, &cp->orig_value))
5771 {
5772 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
5773 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
5774 g_variant_unref (variant);
5775 num_changes++;
5776 }
5777 }
5778 if (num_changes > 0)
5779 {
5780 GList *connections, *ll;
5781 GVariant *signal_variant;
5782 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorThreshold",
5783 &builder, &invalidated_builder));
5784 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5785 for (ll = connections; ll != NULL; ll = ll->next)
5786 {
5787 GDBusConnection *connection = ll->data;
5788
5789 g_dbus_connection_emit_signal (connection,
5790 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
5791 "org.freedesktop.DBus.Properties",
5792 "PropertiesChanged",
5793 signal_variant,
5794 NULL);
5795 }
5796 g_variant_unref (signal_variant);
5797 g_list_free_full (connections, g_object_unref);
5798 }
5799 else
5800 {
5801 g_variant_builder_clear (&builder);
5802 g_variant_builder_clear (&invalidated_builder);
5803 }
5804 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5805 skeleton->priv->changed_properties = NULL;
5806 skeleton->priv->changed_properties_idle_source = NULL;
5807 g_mutex_unlock (&skeleton->priv->lock);
5808 return FALSE;
5809}
5810
5811static void
5812_sensor_threshold_schedule_emit_changed (SensorThresholdSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
5813{
5814 ChangedProperty *cp;
5815 GList *l;
5816 cp = NULL;
5817 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
5818 {
5819 ChangedProperty *i_cp = l->data;
5820 if (i_cp->info == info)
5821 {
5822 cp = i_cp;
5823 break;
5824 }
5825 }
5826 if (cp == NULL)
5827 {
5828 cp = g_new0 (ChangedProperty, 1);
5829 cp->prop_id = prop_id;
5830 cp->info = info;
5831 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
5832 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
5833 g_value_copy (orig_value, &cp->orig_value);
5834 }
5835}
5836
5837static void
5838sensor_threshold_skeleton_notify (GObject *object,
5839 GParamSpec *pspec G_GNUC_UNUSED)
5840{
5841 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
5842 g_mutex_lock (&skeleton->priv->lock);
5843 if (skeleton->priv->changed_properties != NULL &&
5844 skeleton->priv->changed_properties_idle_source == NULL)
5845 {
5846 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
5847 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
5848 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_threshold_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
5849 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
5850 g_source_unref (skeleton->priv->changed_properties_idle_source);
5851 }
5852 g_mutex_unlock (&skeleton->priv->lock);
5853}
5854
5855static void
5856sensor_threshold_skeleton_set_property (GObject *object,
5857 guint prop_id,
5858 const GValue *value,
5859 GParamSpec *pspec)
5860{
5861 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
5862 g_assert (prop_id != 0 && prop_id - 1 < 5);
5863 g_mutex_lock (&skeleton->priv->lock);
5864 g_object_freeze_notify (object);
5865 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
5866 {
5867 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
5868 _sensor_threshold_schedule_emit_changed (skeleton, _sensor_threshold_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
5869 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
5870 g_object_notify_by_pspec (object, pspec);
5871 }
5872 g_mutex_unlock (&skeleton->priv->lock);
5873 g_object_thaw_notify (object);
5874}
5875
5876static void
5877sensor_threshold_skeleton_init (SensorThresholdSkeleton *skeleton)
5878{
5879#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5880 skeleton->priv = sensor_threshold_skeleton_get_instance_private (skeleton);
5881#else
5882 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_THRESHOLD_SKELETON, SensorThresholdSkeletonPrivate);
5883#endif
5884
5885 g_mutex_init (&skeleton->priv->lock);
5886 skeleton->priv->context = g_main_context_ref_thread_default ();
5887 skeleton->priv->properties = g_new0 (GValue, 5);
5888 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
5889 g_value_init (&skeleton->priv->properties[1], G_TYPE_VARIANT);
5890 g_value_init (&skeleton->priv->properties[2], G_TYPE_VARIANT);
5891 g_value_init (&skeleton->priv->properties[3], G_TYPE_VARIANT);
5892 g_value_init (&skeleton->priv->properties[4], G_TYPE_UCHAR);
5893}
5894
5895static GVariant *
5896sensor_threshold_skeleton_get_lower_critical (SensorThreshold *object)
5897{
5898 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
5899 GVariant *value;
5900 g_mutex_lock (&skeleton->priv->lock);
5901 value = g_value_get_variant (&(skeleton->priv->properties[0]));
5902 g_mutex_unlock (&skeleton->priv->lock);
5903 return value;
5904}
5905
5906static GVariant *
5907sensor_threshold_skeleton_get_lower_warning (SensorThreshold *object)
5908{
5909 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
5910 GVariant *value;
5911 g_mutex_lock (&skeleton->priv->lock);
5912 value = g_value_get_variant (&(skeleton->priv->properties[1]));
5913 g_mutex_unlock (&skeleton->priv->lock);
5914 return value;
5915}
5916
5917static GVariant *
5918sensor_threshold_skeleton_get_upper_warning (SensorThreshold *object)
5919{
5920 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
5921 GVariant *value;
5922 g_mutex_lock (&skeleton->priv->lock);
5923 value = g_value_get_variant (&(skeleton->priv->properties[2]));
5924 g_mutex_unlock (&skeleton->priv->lock);
5925 return value;
5926}
5927
5928static GVariant *
5929sensor_threshold_skeleton_get_upper_critical (SensorThreshold *object)
5930{
5931 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
5932 GVariant *value;
5933 g_mutex_lock (&skeleton->priv->lock);
5934 value = g_value_get_variant (&(skeleton->priv->properties[3]));
5935 g_mutex_unlock (&skeleton->priv->lock);
5936 return value;
5937}
5938
5939static guchar
5940sensor_threshold_skeleton_get_state (SensorThreshold *object)
5941{
5942 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
5943 guchar value;
5944 g_mutex_lock (&skeleton->priv->lock);
5945 value = g_value_get_uchar (&(skeleton->priv->properties[4]));
5946 g_mutex_unlock (&skeleton->priv->lock);
5947 return value;
5948}
5949
5950static void
5951sensor_threshold_skeleton_class_init (SensorThresholdSkeletonClass *klass)
5952{
5953 GObjectClass *gobject_class;
5954 GDBusInterfaceSkeletonClass *skeleton_class;
5955
5956 gobject_class = G_OBJECT_CLASS (klass);
5957 gobject_class->finalize = sensor_threshold_skeleton_finalize;
5958 gobject_class->get_property = sensor_threshold_skeleton_get_property;
5959 gobject_class->set_property = sensor_threshold_skeleton_set_property;
5960 gobject_class->notify = sensor_threshold_skeleton_notify;
5961
5962
5963 sensor_threshold_override_properties (gobject_class, 1);
5964
5965 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
5966 skeleton_class->get_info = sensor_threshold_skeleton_dbus_interface_get_info;
5967 skeleton_class->get_properties = sensor_threshold_skeleton_dbus_interface_get_properties;
5968 skeleton_class->flush = sensor_threshold_skeleton_dbus_interface_flush;
5969 skeleton_class->get_vtable = sensor_threshold_skeleton_dbus_interface_get_vtable;
5970
5971#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
5972 g_type_class_add_private (klass, sizeof (SensorThresholdSkeletonPrivate));
5973#endif
5974}
5975
5976static void
5977sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface)
5978{
5979 iface->warning = _sensor_threshold_on_signal_warning;
5980 iface->critical = _sensor_threshold_on_signal_critical;
5981 iface->normal = _sensor_threshold_on_signal_normal;
5982 iface->get_lower_critical = sensor_threshold_skeleton_get_lower_critical;
5983 iface->get_lower_warning = sensor_threshold_skeleton_get_lower_warning;
5984 iface->get_upper_warning = sensor_threshold_skeleton_get_upper_warning;
5985 iface->get_upper_critical = sensor_threshold_skeleton_get_upper_critical;
5986 iface->get_state = sensor_threshold_skeleton_get_state;
5987}
5988
5989/**
5990 * sensor_threshold_skeleton_new:
5991 *
5992 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
5993 *
5994 * Returns: (transfer full) (type SensorThresholdSkeleton): The skeleton object.
5995 */
5996SensorThreshold *
5997sensor_threshold_skeleton_new (void)
5998{
5999 return SENSOR_THRESHOLD (g_object_new (TYPE_SENSOR_THRESHOLD_SKELETON, NULL));
6000}
6001
6002/* ------------------------------------------------------------------------
6003 * Code for interface org.openbmc.SensorI2c
6004 * ------------------------------------------------------------------------
6005 */
6006
6007/**
6008 * SECTION:SensorI2c
6009 * @title: SensorI2c
6010 * @short_description: Generated C code for the org.openbmc.SensorI2c D-Bus interface
6011 *
6012 * 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.
6013 */
6014
6015/* ---- Introspection data for org.openbmc.SensorI2c ---- */
6016
6017static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_dev_path =
6018{
6019 {
6020 -1,
6021 (gchar *) "dev_path",
6022 (gchar *) "s",
6023 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
6024 NULL
6025 },
6026 "dev-path",
6027 FALSE
6028};
6029
6030static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_address =
6031{
6032 {
6033 -1,
6034 (gchar *) "address",
6035 (gchar *) "s",
6036 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
6037 NULL
6038 },
6039 "address",
6040 FALSE
6041};
6042
6043static const _ExtendedGDBusPropertyInfo * const _sensor_i2c_property_info_pointers[] =
6044{
6045 &_sensor_i2c_property_info_dev_path,
6046 &_sensor_i2c_property_info_address,
6047 NULL
6048};
6049
6050static const _ExtendedGDBusInterfaceInfo _sensor_i2c_interface_info =
6051{
6052 {
6053 -1,
6054 (gchar *) "org.openbmc.SensorI2c",
6055 NULL,
6056 NULL,
6057 (GDBusPropertyInfo **) &_sensor_i2c_property_info_pointers,
6058 NULL
6059 },
6060 "sensor-i2c",
6061};
6062
6063
6064/**
6065 * sensor_i2c_interface_info:
6066 *
6067 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> D-Bus interface.
6068 *
6069 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
6070 */
6071GDBusInterfaceInfo *
6072sensor_i2c_interface_info (void)
6073{
6074 return (GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct;
6075}
6076
6077/**
6078 * sensor_i2c_override_properties:
6079 * @klass: The class structure for a #GObject<!-- -->-derived class.
6080 * @property_id_begin: The property id to assign to the first overridden property.
6081 *
6082 * Overrides all #GObject properties in the #SensorI2c interface for a concrete class.
6083 * The properties are overridden in the order they are defined.
6084 *
6085 * Returns: The last property id.
6086 */
6087guint
6088sensor_i2c_override_properties (GObjectClass *klass, guint property_id_begin)
6089{
6090 g_object_class_override_property (klass, property_id_begin++, "dev-path");
6091 g_object_class_override_property (klass, property_id_begin++, "address");
6092 return property_id_begin - 1;
6093}
6094
6095
6096
6097/**
6098 * SensorI2c:
6099 *
6100 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
6101 */
6102
6103/**
6104 * SensorI2cIface:
6105 * @parent_iface: The parent interface.
6106 * @get_address: Getter for the #SensorI2c:address property.
6107 * @get_dev_path: Getter for the #SensorI2c:dev-path property.
6108 *
6109 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
6110 */
6111
6112typedef SensorI2cIface SensorI2cInterface;
6113G_DEFINE_INTERFACE (SensorI2c, sensor_i2c, G_TYPE_OBJECT);
6114
6115static void
6116sensor_i2c_default_init (SensorI2cIface *iface)
6117{
6118 /* GObject properties for D-Bus properties: */
6119 /**
6120 * SensorI2c:dev-path:
6121 *
6122 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link>.
6123 *
6124 * 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.
6125 */
6126 g_object_interface_install_property (iface,
6127 g_param_spec_string ("dev-path", "dev_path", "dev_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6128 /**
6129 * SensorI2c:address:
6130 *
6131 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link>.
6132 *
6133 * 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.
6134 */
6135 g_object_interface_install_property (iface,
6136 g_param_spec_string ("address", "address", "address", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6137}
6138
6139/**
6140 * sensor_i2c_get_dev_path: (skip)
6141 * @object: A #SensorI2c.
6142 *
6143 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
6144 *
6145 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6146 *
6147 * <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>
6148 *
6149 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6150 */
6151const gchar *
6152sensor_i2c_get_dev_path (SensorI2c *object)
6153{
6154 return SENSOR_I2C_GET_IFACE (object)->get_dev_path (object);
6155}
6156
6157/**
6158 * sensor_i2c_dup_dev_path: (skip)
6159 * @object: A #SensorI2c.
6160 *
6161 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
6162 *
6163 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6164 *
6165 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
6166 */
6167gchar *
6168sensor_i2c_dup_dev_path (SensorI2c *object)
6169{
6170 gchar *value;
6171 g_object_get (G_OBJECT (object), "dev-path", &value, NULL);
6172 return value;
6173}
6174
6175/**
6176 * sensor_i2c_set_dev_path: (skip)
6177 * @object: A #SensorI2c.
6178 * @value: The value to set.
6179 *
6180 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property to @value.
6181 *
6182 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6183 */
6184void
6185sensor_i2c_set_dev_path (SensorI2c *object, const gchar *value)
6186{
6187 g_object_set (G_OBJECT (object), "dev-path", value, NULL);
6188}
6189
6190/**
6191 * sensor_i2c_get_address: (skip)
6192 * @object: A #SensorI2c.
6193 *
6194 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
6195 *
6196 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6197 *
6198 * <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>
6199 *
6200 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6201 */
6202const gchar *
6203sensor_i2c_get_address (SensorI2c *object)
6204{
6205 return SENSOR_I2C_GET_IFACE (object)->get_address (object);
6206}
6207
6208/**
6209 * sensor_i2c_dup_address: (skip)
6210 * @object: A #SensorI2c.
6211 *
6212 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
6213 *
6214 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6215 *
6216 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
6217 */
6218gchar *
6219sensor_i2c_dup_address (SensorI2c *object)
6220{
6221 gchar *value;
6222 g_object_get (G_OBJECT (object), "address", &value, NULL);
6223 return value;
6224}
6225
6226/**
6227 * sensor_i2c_set_address: (skip)
6228 * @object: A #SensorI2c.
6229 * @value: The value to set.
6230 *
6231 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property to @value.
6232 *
6233 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6234 */
6235void
6236sensor_i2c_set_address (SensorI2c *object, const gchar *value)
6237{
6238 g_object_set (G_OBJECT (object), "address", value, NULL);
6239}
6240
6241/* ------------------------------------------------------------------------ */
6242
6243/**
6244 * SensorI2cProxy:
6245 *
6246 * The #SensorI2cProxy structure contains only private data and should only be accessed using the provided API.
6247 */
6248
6249/**
6250 * SensorI2cProxyClass:
6251 * @parent_class: The parent class.
6252 *
6253 * Class structure for #SensorI2cProxy.
6254 */
6255
6256struct _SensorI2cProxyPrivate
6257{
6258 GData *qdata;
6259};
6260
6261static void sensor_i2c_proxy_iface_init (SensorI2cIface *iface);
6262
6263#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6264G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
6265 G_ADD_PRIVATE (SensorI2cProxy)
6266 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
6267
6268#else
6269G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
6270 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
6271
6272#endif
6273static void
6274sensor_i2c_proxy_finalize (GObject *object)
6275{
6276 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
6277 g_datalist_clear (&proxy->priv->qdata);
6278 G_OBJECT_CLASS (sensor_i2c_proxy_parent_class)->finalize (object);
6279}
6280
6281static void
6282sensor_i2c_proxy_get_property (GObject *object,
6283 guint prop_id,
6284 GValue *value,
6285 GParamSpec *pspec G_GNUC_UNUSED)
6286{
6287 const _ExtendedGDBusPropertyInfo *info;
6288 GVariant *variant;
6289 g_assert (prop_id != 0 && prop_id - 1 < 2);
6290 info = _sensor_i2c_property_info_pointers[prop_id - 1];
6291 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
6292 if (info->use_gvariant)
6293 {
6294 g_value_set_variant (value, variant);
6295 }
6296 else
6297 {
6298 if (variant != NULL)
6299 g_dbus_gvariant_to_gvalue (variant, value);
6300 }
6301 if (variant != NULL)
6302 g_variant_unref (variant);
6303}
6304
6305static void
6306sensor_i2c_proxy_set_property_cb (GDBusProxy *proxy,
6307 GAsyncResult *res,
6308 gpointer user_data)
6309{
6310 const _ExtendedGDBusPropertyInfo *info = user_data;
6311 GError *error;
6312 GVariant *_ret;
6313 error = NULL;
6314 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
6315 if (!_ret)
6316 {
6317 g_warning ("Error setting property '%s' on interface org.openbmc.SensorI2c: %s (%s, %d)",
6318 info->parent_struct.name,
6319 error->message, g_quark_to_string (error->domain), error->code);
6320 g_error_free (error);
6321 }
6322 else
6323 {
6324 g_variant_unref (_ret);
6325 }
6326}
6327
6328static void
6329sensor_i2c_proxy_set_property (GObject *object,
6330 guint prop_id,
6331 const GValue *value,
6332 GParamSpec *pspec G_GNUC_UNUSED)
6333{
6334 const _ExtendedGDBusPropertyInfo *info;
6335 GVariant *variant;
6336 g_assert (prop_id != 0 && prop_id - 1 < 2);
6337 info = _sensor_i2c_property_info_pointers[prop_id - 1];
6338 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
6339 g_dbus_proxy_call (G_DBUS_PROXY (object),
6340 "org.freedesktop.DBus.Properties.Set",
6341 g_variant_new ("(ssv)", "org.openbmc.SensorI2c", info->parent_struct.name, variant),
6342 G_DBUS_CALL_FLAGS_NONE,
6343 -1,
6344 NULL, (GAsyncReadyCallback) sensor_i2c_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
6345 g_variant_unref (variant);
6346}
6347
6348static void
6349sensor_i2c_proxy_g_signal (GDBusProxy *proxy,
6350 const gchar *sender_name G_GNUC_UNUSED,
6351 const gchar *signal_name,
6352 GVariant *parameters)
6353{
6354 _ExtendedGDBusSignalInfo *info;
6355 GVariantIter iter;
6356 GVariant *child;
6357 GValue *paramv;
6358 guint num_params;
6359 guint n;
6360 guint signal_id;
6361 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, signal_name);
6362 if (info == NULL)
6363 return;
6364 num_params = g_variant_n_children (parameters);
6365 paramv = g_new0 (GValue, num_params + 1);
6366 g_value_init (&paramv[0], TYPE_SENSOR_I2C);
6367 g_value_set_object (&paramv[0], proxy);
6368 g_variant_iter_init (&iter, parameters);
6369 n = 1;
6370 while ((child = g_variant_iter_next_value (&iter)) != NULL)
6371 {
6372 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
6373 if (arg_info->use_gvariant)
6374 {
6375 g_value_init (&paramv[n], G_TYPE_VARIANT);
6376 g_value_set_variant (&paramv[n], child);
6377 n++;
6378 }
6379 else
6380 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
6381 g_variant_unref (child);
6382 }
6383 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
6384 g_signal_emitv (paramv, signal_id, 0, NULL);
6385 for (n = 0; n < num_params + 1; n++)
6386 g_value_unset (&paramv[n]);
6387 g_free (paramv);
6388}
6389
6390static void
6391sensor_i2c_proxy_g_properties_changed (GDBusProxy *_proxy,
6392 GVariant *changed_properties,
6393 const gchar *const *invalidated_properties)
6394{
6395 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (_proxy);
6396 guint n;
6397 const gchar *key;
6398 GVariantIter *iter;
6399 _ExtendedGDBusPropertyInfo *info;
6400 g_variant_get (changed_properties, "a{sv}", &iter);
6401 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
6402 {
6403 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, key);
6404 g_datalist_remove_data (&proxy->priv->qdata, key);
6405 if (info != NULL)
6406 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
6407 }
6408 g_variant_iter_free (iter);
6409 for (n = 0; invalidated_properties[n] != NULL; n++)
6410 {
6411 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, invalidated_properties[n]);
6412 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
6413 if (info != NULL)
6414 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
6415 }
6416}
6417
6418static const gchar *
6419sensor_i2c_proxy_get_dev_path (SensorI2c *object)
6420{
6421 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
6422 GVariant *variant;
6423 const gchar *value = NULL;
6424 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "dev_path");
6425 if (variant != NULL)
6426 {
6427 value = g_variant_get_string (variant, NULL);
6428 g_variant_unref (variant);
6429 }
6430 return value;
6431}
6432
6433static const gchar *
6434sensor_i2c_proxy_get_address (SensorI2c *object)
6435{
6436 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
6437 GVariant *variant;
6438 const gchar *value = NULL;
6439 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "address");
6440 if (variant != NULL)
6441 {
6442 value = g_variant_get_string (variant, NULL);
6443 g_variant_unref (variant);
6444 }
6445 return value;
6446}
6447
6448static void
6449sensor_i2c_proxy_init (SensorI2cProxy *proxy)
6450{
6451#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6452 proxy->priv = sensor_i2c_proxy_get_instance_private (proxy);
6453#else
6454 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_I2C_PROXY, SensorI2cProxyPrivate);
6455#endif
6456
6457 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_i2c_interface_info ());
6458}
6459
6460static void
6461sensor_i2c_proxy_class_init (SensorI2cProxyClass *klass)
6462{
6463 GObjectClass *gobject_class;
6464 GDBusProxyClass *proxy_class;
6465
6466 gobject_class = G_OBJECT_CLASS (klass);
6467 gobject_class->finalize = sensor_i2c_proxy_finalize;
6468 gobject_class->get_property = sensor_i2c_proxy_get_property;
6469 gobject_class->set_property = sensor_i2c_proxy_set_property;
6470
6471 proxy_class = G_DBUS_PROXY_CLASS (klass);
6472 proxy_class->g_signal = sensor_i2c_proxy_g_signal;
6473 proxy_class->g_properties_changed = sensor_i2c_proxy_g_properties_changed;
6474
6475 sensor_i2c_override_properties (gobject_class, 1);
6476
6477#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
6478 g_type_class_add_private (klass, sizeof (SensorI2cProxyPrivate));
6479#endif
6480}
6481
6482static void
6483sensor_i2c_proxy_iface_init (SensorI2cIface *iface)
6484{
6485 iface->get_dev_path = sensor_i2c_proxy_get_dev_path;
6486 iface->get_address = sensor_i2c_proxy_get_address;
6487}
6488
6489/**
6490 * sensor_i2c_proxy_new:
6491 * @connection: A #GDBusConnection.
6492 * @flags: Flags from the #GDBusProxyFlags enumeration.
6493 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6494 * @object_path: An object path.
6495 * @cancellable: (allow-none): A #GCancellable or %NULL.
6496 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6497 * @user_data: User data to pass to @callback.
6498 *
6499 * 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.
6500 *
6501 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
6502 * You can then call sensor_i2c_proxy_new_finish() to get the result of the operation.
6503 *
6504 * See sensor_i2c_proxy_new_sync() for the synchronous, blocking version of this constructor.
6505 */
6506void
6507sensor_i2c_proxy_new (
6508 GDBusConnection *connection,
6509 GDBusProxyFlags flags,
6510 const gchar *name,
6511 const gchar *object_path,
6512 GCancellable *cancellable,
6513 GAsyncReadyCallback callback,
6514 gpointer user_data)
6515{
6516 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);
6517}
6518
6519/**
6520 * sensor_i2c_proxy_new_finish:
6521 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new().
6522 * @error: Return location for error or %NULL
6523 *
6524 * Finishes an operation started with sensor_i2c_proxy_new().
6525 *
6526 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
6527 */
6528SensorI2c *
6529sensor_i2c_proxy_new_finish (
6530 GAsyncResult *res,
6531 GError **error)
6532{
6533 GObject *ret;
6534 GObject *source_object;
6535 source_object = g_async_result_get_source_object (res);
6536 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6537 g_object_unref (source_object);
6538 if (ret != NULL)
6539 return SENSOR_I2C (ret);
6540 else
6541 return NULL;
6542}
6543
6544/**
6545 * sensor_i2c_proxy_new_sync:
6546 * @connection: A #GDBusConnection.
6547 * @flags: Flags from the #GDBusProxyFlags enumeration.
6548 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6549 * @object_path: An object path.
6550 * @cancellable: (allow-none): A #GCancellable or %NULL.
6551 * @error: Return location for error or %NULL
6552 *
6553 * 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.
6554 *
6555 * The calling thread is blocked until a reply is received.
6556 *
6557 * See sensor_i2c_proxy_new() for the asynchronous version of this constructor.
6558 *
6559 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
6560 */
6561SensorI2c *
6562sensor_i2c_proxy_new_sync (
6563 GDBusConnection *connection,
6564 GDBusProxyFlags flags,
6565 const gchar *name,
6566 const gchar *object_path,
6567 GCancellable *cancellable,
6568 GError **error)
6569{
6570 GInitable *ret;
6571 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);
6572 if (ret != NULL)
6573 return SENSOR_I2C (ret);
6574 else
6575 return NULL;
6576}
6577
6578
6579/**
6580 * sensor_i2c_proxy_new_for_bus:
6581 * @bus_type: A #GBusType.
6582 * @flags: Flags from the #GDBusProxyFlags enumeration.
6583 * @name: A bus name (well-known or unique).
6584 * @object_path: An object path.
6585 * @cancellable: (allow-none): A #GCancellable or %NULL.
6586 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6587 * @user_data: User data to pass to @callback.
6588 *
6589 * Like sensor_i2c_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
6590 *
6591 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
6592 * You can then call sensor_i2c_proxy_new_for_bus_finish() to get the result of the operation.
6593 *
6594 * See sensor_i2c_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
6595 */
6596void
6597sensor_i2c_proxy_new_for_bus (
6598 GBusType bus_type,
6599 GDBusProxyFlags flags,
6600 const gchar *name,
6601 const gchar *object_path,
6602 GCancellable *cancellable,
6603 GAsyncReadyCallback callback,
6604 gpointer user_data)
6605{
6606 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);
6607}
6608
6609/**
6610 * sensor_i2c_proxy_new_for_bus_finish:
6611 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new_for_bus().
6612 * @error: Return location for error or %NULL
6613 *
6614 * Finishes an operation started with sensor_i2c_proxy_new_for_bus().
6615 *
6616 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
6617 */
6618SensorI2c *
6619sensor_i2c_proxy_new_for_bus_finish (
6620 GAsyncResult *res,
6621 GError **error)
6622{
6623 GObject *ret;
6624 GObject *source_object;
6625 source_object = g_async_result_get_source_object (res);
6626 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6627 g_object_unref (source_object);
6628 if (ret != NULL)
6629 return SENSOR_I2C (ret);
6630 else
6631 return NULL;
6632}
6633
6634/**
6635 * sensor_i2c_proxy_new_for_bus_sync:
6636 * @bus_type: A #GBusType.
6637 * @flags: Flags from the #GDBusProxyFlags enumeration.
6638 * @name: A bus name (well-known or unique).
6639 * @object_path: An object path.
6640 * @cancellable: (allow-none): A #GCancellable or %NULL.
6641 * @error: Return location for error or %NULL
6642 *
6643 * Like sensor_i2c_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
6644 *
6645 * The calling thread is blocked until a reply is received.
6646 *
6647 * See sensor_i2c_proxy_new_for_bus() for the asynchronous version of this constructor.
6648 *
6649 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
6650 */
6651SensorI2c *
6652sensor_i2c_proxy_new_for_bus_sync (
6653 GBusType bus_type,
6654 GDBusProxyFlags flags,
6655 const gchar *name,
6656 const gchar *object_path,
6657 GCancellable *cancellable,
6658 GError **error)
6659{
6660 GInitable *ret;
6661 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);
6662 if (ret != NULL)
6663 return SENSOR_I2C (ret);
6664 else
6665 return NULL;
6666}
6667
6668
6669/* ------------------------------------------------------------------------ */
6670
6671/**
6672 * SensorI2cSkeleton:
6673 *
6674 * The #SensorI2cSkeleton structure contains only private data and should only be accessed using the provided API.
6675 */
6676
6677/**
6678 * SensorI2cSkeletonClass:
6679 * @parent_class: The parent class.
6680 *
6681 * Class structure for #SensorI2cSkeleton.
6682 */
6683
6684struct _SensorI2cSkeletonPrivate
6685{
6686 GValue *properties;
6687 GList *changed_properties;
6688 GSource *changed_properties_idle_source;
6689 GMainContext *context;
6690 GMutex lock;
6691};
6692
6693static void
6694_sensor_i2c_skeleton_handle_method_call (
6695 GDBusConnection *connection G_GNUC_UNUSED,
6696 const gchar *sender G_GNUC_UNUSED,
6697 const gchar *object_path G_GNUC_UNUSED,
6698 const gchar *interface_name,
6699 const gchar *method_name,
6700 GVariant *parameters,
6701 GDBusMethodInvocation *invocation,
6702 gpointer user_data)
6703{
6704 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
6705 _ExtendedGDBusMethodInfo *info;
6706 GVariantIter iter;
6707 GVariant *child;
6708 GValue *paramv;
6709 guint num_params;
6710 guint num_extra;
6711 guint n;
6712 guint signal_id;
6713 GValue return_value = G_VALUE_INIT;
6714 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
6715 g_assert (info != NULL);
6716 num_params = g_variant_n_children (parameters);
6717 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
6718 n = 0;
6719 g_value_init (&paramv[n], TYPE_SENSOR_I2C);
6720 g_value_set_object (&paramv[n++], skeleton);
6721 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
6722 g_value_set_object (&paramv[n++], invocation);
6723 if (info->pass_fdlist)
6724 {
6725#ifdef G_OS_UNIX
6726 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
6727 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
6728#else
6729 g_assert_not_reached ();
6730#endif
6731 }
6732 g_variant_iter_init (&iter, parameters);
6733 while ((child = g_variant_iter_next_value (&iter)) != NULL)
6734 {
6735 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
6736 if (arg_info->use_gvariant)
6737 {
6738 g_value_init (&paramv[n], G_TYPE_VARIANT);
6739 g_value_set_variant (&paramv[n], child);
6740 n++;
6741 }
6742 else
6743 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
6744 g_variant_unref (child);
6745 }
6746 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
6747 g_value_init (&return_value, G_TYPE_BOOLEAN);
6748 g_signal_emitv (paramv, signal_id, 0, &return_value);
6749 if (!g_value_get_boolean (&return_value))
6750 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);
6751 g_value_unset (&return_value);
6752 for (n = 0; n < num_params + num_extra; n++)
6753 g_value_unset (&paramv[n]);
6754 g_free (paramv);
6755}
6756
6757static GVariant *
6758_sensor_i2c_skeleton_handle_get_property (
6759 GDBusConnection *connection G_GNUC_UNUSED,
6760 const gchar *sender G_GNUC_UNUSED,
6761 const gchar *object_path G_GNUC_UNUSED,
6762 const gchar *interface_name G_GNUC_UNUSED,
6763 const gchar *property_name,
6764 GError **error,
6765 gpointer user_data)
6766{
6767 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
6768 GValue value = G_VALUE_INIT;
6769 GParamSpec *pspec;
6770 _ExtendedGDBusPropertyInfo *info;
6771 GVariant *ret;
6772 ret = NULL;
6773 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
6774 g_assert (info != NULL);
6775 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
6776 if (pspec == NULL)
6777 {
6778 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
6779 }
6780 else
6781 {
6782 g_value_init (&value, pspec->value_type);
6783 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
6784 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
6785 g_value_unset (&value);
6786 }
6787 return ret;
6788}
6789
6790static gboolean
6791_sensor_i2c_skeleton_handle_set_property (
6792 GDBusConnection *connection G_GNUC_UNUSED,
6793 const gchar *sender G_GNUC_UNUSED,
6794 const gchar *object_path G_GNUC_UNUSED,
6795 const gchar *interface_name G_GNUC_UNUSED,
6796 const gchar *property_name,
6797 GVariant *variant,
6798 GError **error,
6799 gpointer user_data)
6800{
6801 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
6802 GValue value = G_VALUE_INIT;
6803 GParamSpec *pspec;
6804 _ExtendedGDBusPropertyInfo *info;
6805 gboolean ret;
6806 ret = FALSE;
6807 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
6808 g_assert (info != NULL);
6809 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
6810 if (pspec == NULL)
6811 {
6812 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
6813 }
6814 else
6815 {
6816 if (info->use_gvariant)
6817 g_value_set_variant (&value, variant);
6818 else
6819 g_dbus_gvariant_to_gvalue (variant, &value);
6820 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
6821 g_value_unset (&value);
6822 ret = TRUE;
6823 }
6824 return ret;
6825}
6826
6827static const GDBusInterfaceVTable _sensor_i2c_skeleton_vtable =
6828{
6829 _sensor_i2c_skeleton_handle_method_call,
6830 _sensor_i2c_skeleton_handle_get_property,
6831 _sensor_i2c_skeleton_handle_set_property,
6832 {NULL}
6833};
6834
6835static GDBusInterfaceInfo *
6836sensor_i2c_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
6837{
6838 return sensor_i2c_interface_info ();
6839}
6840
6841static GDBusInterfaceVTable *
6842sensor_i2c_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
6843{
6844 return (GDBusInterfaceVTable *) &_sensor_i2c_skeleton_vtable;
6845}
6846
6847static GVariant *
6848sensor_i2c_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
6849{
6850 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
6851
6852 GVariantBuilder builder;
6853 guint n;
6854 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
6855 if (_sensor_i2c_interface_info.parent_struct.properties == NULL)
6856 goto out;
6857 for (n = 0; _sensor_i2c_interface_info.parent_struct.properties[n] != NULL; n++)
6858 {
6859 GDBusPropertyInfo *info = _sensor_i2c_interface_info.parent_struct.properties[n];
6860 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
6861 {
6862 GVariant *value;
6863 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);
6864 if (value != NULL)
6865 {
6866 g_variant_take_ref (value);
6867 g_variant_builder_add (&builder, "{sv}", info->name, value);
6868 g_variant_unref (value);
6869 }
6870 }
6871 }
6872out:
6873 return g_variant_builder_end (&builder);
6874}
6875
6876static gboolean _sensor_i2c_emit_changed (gpointer user_data);
6877
6878static void
6879sensor_i2c_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
6880{
6881 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
6882 gboolean emit_changed = FALSE;
6883
6884 g_mutex_lock (&skeleton->priv->lock);
6885 if (skeleton->priv->changed_properties_idle_source != NULL)
6886 {
6887 g_source_destroy (skeleton->priv->changed_properties_idle_source);
6888 skeleton->priv->changed_properties_idle_source = NULL;
6889 emit_changed = TRUE;
6890 }
6891 g_mutex_unlock (&skeleton->priv->lock);
6892
6893 if (emit_changed)
6894 _sensor_i2c_emit_changed (skeleton);
6895}
6896
6897static void sensor_i2c_skeleton_iface_init (SensorI2cIface *iface);
6898#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6899G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
6900 G_ADD_PRIVATE (SensorI2cSkeleton)
6901 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
6902
6903#else
6904G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
6905 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
6906
6907#endif
6908static void
6909sensor_i2c_skeleton_finalize (GObject *object)
6910{
6911 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
6912 guint n;
6913 for (n = 0; n < 2; n++)
6914 g_value_unset (&skeleton->priv->properties[n]);
6915 g_free (skeleton->priv->properties);
6916 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
6917 if (skeleton->priv->changed_properties_idle_source != NULL)
6918 g_source_destroy (skeleton->priv->changed_properties_idle_source);
6919 g_main_context_unref (skeleton->priv->context);
6920 g_mutex_clear (&skeleton->priv->lock);
6921 G_OBJECT_CLASS (sensor_i2c_skeleton_parent_class)->finalize (object);
6922}
6923
6924static void
6925sensor_i2c_skeleton_get_property (GObject *object,
6926 guint prop_id,
6927 GValue *value,
6928 GParamSpec *pspec G_GNUC_UNUSED)
6929{
6930 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
6931 g_assert (prop_id != 0 && prop_id - 1 < 2);
6932 g_mutex_lock (&skeleton->priv->lock);
6933 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
6934 g_mutex_unlock (&skeleton->priv->lock);
6935}
6936
6937static gboolean
6938_sensor_i2c_emit_changed (gpointer user_data)
6939{
6940 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
6941 GList *l;
6942 GVariantBuilder builder;
6943 GVariantBuilder invalidated_builder;
6944 guint num_changes;
6945
6946 g_mutex_lock (&skeleton->priv->lock);
6947 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
6948 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
6949 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
6950 {
6951 ChangedProperty *cp = l->data;
6952 GVariant *variant;
6953 const GValue *cur_value;
6954
6955 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
6956 if (!_g_value_equal (cur_value, &cp->orig_value))
6957 {
6958 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
6959 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
6960 g_variant_unref (variant);
6961 num_changes++;
6962 }
6963 }
6964 if (num_changes > 0)
6965 {
6966 GList *connections, *ll;
6967 GVariant *signal_variant;
6968 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorI2c",
6969 &builder, &invalidated_builder));
6970 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
6971 for (ll = connections; ll != NULL; ll = ll->next)
6972 {
6973 GDBusConnection *connection = ll->data;
6974
6975 g_dbus_connection_emit_signal (connection,
6976 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
6977 "org.freedesktop.DBus.Properties",
6978 "PropertiesChanged",
6979 signal_variant,
6980 NULL);
6981 }
6982 g_variant_unref (signal_variant);
6983 g_list_free_full (connections, g_object_unref);
6984 }
6985 else
6986 {
6987 g_variant_builder_clear (&builder);
6988 g_variant_builder_clear (&invalidated_builder);
6989 }
6990 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
6991 skeleton->priv->changed_properties = NULL;
6992 skeleton->priv->changed_properties_idle_source = NULL;
6993 g_mutex_unlock (&skeleton->priv->lock);
6994 return FALSE;
6995}
6996
6997static void
6998_sensor_i2c_schedule_emit_changed (SensorI2cSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
6999{
7000 ChangedProperty *cp;
7001 GList *l;
7002 cp = NULL;
7003 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
7004 {
7005 ChangedProperty *i_cp = l->data;
7006 if (i_cp->info == info)
7007 {
7008 cp = i_cp;
7009 break;
7010 }
7011 }
7012 if (cp == NULL)
7013 {
7014 cp = g_new0 (ChangedProperty, 1);
7015 cp->prop_id = prop_id;
7016 cp->info = info;
7017 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
7018 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
7019 g_value_copy (orig_value, &cp->orig_value);
7020 }
7021}
7022
7023static void
7024sensor_i2c_skeleton_notify (GObject *object,
7025 GParamSpec *pspec G_GNUC_UNUSED)
7026{
7027 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
7028 g_mutex_lock (&skeleton->priv->lock);
7029 if (skeleton->priv->changed_properties != NULL &&
7030 skeleton->priv->changed_properties_idle_source == NULL)
7031 {
7032 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
7033 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
7034 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_i2c_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
7035 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
7036 g_source_unref (skeleton->priv->changed_properties_idle_source);
7037 }
7038 g_mutex_unlock (&skeleton->priv->lock);
7039}
7040
7041static void
7042sensor_i2c_skeleton_set_property (GObject *object,
7043 guint prop_id,
7044 const GValue *value,
7045 GParamSpec *pspec)
7046{
7047 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
7048 g_assert (prop_id != 0 && prop_id - 1 < 2);
7049 g_mutex_lock (&skeleton->priv->lock);
7050 g_object_freeze_notify (object);
7051 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
7052 {
7053 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
7054 _sensor_i2c_schedule_emit_changed (skeleton, _sensor_i2c_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
7055 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
7056 g_object_notify_by_pspec (object, pspec);
7057 }
7058 g_mutex_unlock (&skeleton->priv->lock);
7059 g_object_thaw_notify (object);
7060}
7061
7062static void
7063sensor_i2c_skeleton_init (SensorI2cSkeleton *skeleton)
7064{
7065#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7066 skeleton->priv = sensor_i2c_skeleton_get_instance_private (skeleton);
7067#else
7068 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_I2C_SKELETON, SensorI2cSkeletonPrivate);
7069#endif
7070
7071 g_mutex_init (&skeleton->priv->lock);
7072 skeleton->priv->context = g_main_context_ref_thread_default ();
7073 skeleton->priv->properties = g_new0 (GValue, 2);
7074 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
7075 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
7076}
7077
7078static const gchar *
7079sensor_i2c_skeleton_get_dev_path (SensorI2c *object)
7080{
7081 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
7082 const gchar *value;
7083 g_mutex_lock (&skeleton->priv->lock);
7084 value = g_value_get_string (&(skeleton->priv->properties[0]));
7085 g_mutex_unlock (&skeleton->priv->lock);
7086 return value;
7087}
7088
7089static const gchar *
7090sensor_i2c_skeleton_get_address (SensorI2c *object)
7091{
7092 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
7093 const gchar *value;
7094 g_mutex_lock (&skeleton->priv->lock);
7095 value = g_value_get_string (&(skeleton->priv->properties[1]));
7096 g_mutex_unlock (&skeleton->priv->lock);
7097 return value;
7098}
7099
7100static void
7101sensor_i2c_skeleton_class_init (SensorI2cSkeletonClass *klass)
7102{
7103 GObjectClass *gobject_class;
7104 GDBusInterfaceSkeletonClass *skeleton_class;
7105
7106 gobject_class = G_OBJECT_CLASS (klass);
7107 gobject_class->finalize = sensor_i2c_skeleton_finalize;
7108 gobject_class->get_property = sensor_i2c_skeleton_get_property;
7109 gobject_class->set_property = sensor_i2c_skeleton_set_property;
7110 gobject_class->notify = sensor_i2c_skeleton_notify;
7111
7112
7113 sensor_i2c_override_properties (gobject_class, 1);
7114
7115 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
7116 skeleton_class->get_info = sensor_i2c_skeleton_dbus_interface_get_info;
7117 skeleton_class->get_properties = sensor_i2c_skeleton_dbus_interface_get_properties;
7118 skeleton_class->flush = sensor_i2c_skeleton_dbus_interface_flush;
7119 skeleton_class->get_vtable = sensor_i2c_skeleton_dbus_interface_get_vtable;
7120
7121#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
7122 g_type_class_add_private (klass, sizeof (SensorI2cSkeletonPrivate));
7123#endif
7124}
7125
7126static void
7127sensor_i2c_skeleton_iface_init (SensorI2cIface *iface)
7128{
7129 iface->get_dev_path = sensor_i2c_skeleton_get_dev_path;
7130 iface->get_address = sensor_i2c_skeleton_get_address;
7131}
7132
7133/**
7134 * sensor_i2c_skeleton_new:
7135 *
7136 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
7137 *
7138 * Returns: (transfer full) (type SensorI2cSkeleton): The skeleton object.
7139 */
7140SensorI2c *
7141sensor_i2c_skeleton_new (void)
7142{
7143 return SENSOR_I2C (g_object_new (TYPE_SENSOR_I2C_SKELETON, NULL));
7144}
7145
7146/* ------------------------------------------------------------------------
7147 * Code for interface org.openbmc.SensorMatch
7148 * ------------------------------------------------------------------------
7149 */
7150
7151/**
7152 * SECTION:SensorMatch
7153 * @title: SensorMatch
7154 * @short_description: Generated C code for the org.openbmc.SensorMatch D-Bus interface
7155 *
7156 * 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.
7157 */
7158
7159/* ---- Introspection data for org.openbmc.SensorMatch ---- */
7160
7161static const _ExtendedGDBusArgInfo _sensor_match_signal_info_sensor_match_ARG_state =
7162{
7163 {
7164 -1,
7165 (gchar *) "state",
7166 (gchar *) "y",
7167 NULL
7168 },
7169 FALSE
7170};
7171
7172static const _ExtendedGDBusArgInfo * const _sensor_match_signal_info_sensor_match_ARG_pointers[] =
7173{
7174 &_sensor_match_signal_info_sensor_match_ARG_state,
7175 NULL
7176};
7177
7178static const _ExtendedGDBusSignalInfo _sensor_match_signal_info_sensor_match =
7179{
7180 {
7181 -1,
7182 (gchar *) "SensorMatch",
7183 (GDBusArgInfo **) &_sensor_match_signal_info_sensor_match_ARG_pointers,
7184 NULL
7185 },
7186 "sensor-match"
7187};
7188
7189static const _ExtendedGDBusSignalInfo * const _sensor_match_signal_info_pointers[] =
7190{
7191 &_sensor_match_signal_info_sensor_match,
7192 NULL
7193};
7194
7195static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_match_value =
7196{
7197 {
7198 -1,
7199 (gchar *) "match_value",
7200 (gchar *) "v",
7201 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
7202 NULL
7203 },
7204 "match-value",
7205 FALSE
7206};
7207
7208static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_state =
7209{
7210 {
7211 -1,
7212 (gchar *) "state",
7213 (gchar *) "y",
7214 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
7215 NULL
7216 },
7217 "state",
7218 FALSE
7219};
7220
7221static const _ExtendedGDBusPropertyInfo * const _sensor_match_property_info_pointers[] =
7222{
7223 &_sensor_match_property_info_match_value,
7224 &_sensor_match_property_info_state,
7225 NULL
7226};
7227
7228static const _ExtendedGDBusInterfaceInfo _sensor_match_interface_info =
7229{
7230 {
7231 -1,
7232 (gchar *) "org.openbmc.SensorMatch",
7233 NULL,
7234 (GDBusSignalInfo **) &_sensor_match_signal_info_pointers,
7235 (GDBusPropertyInfo **) &_sensor_match_property_info_pointers,
7236 NULL
7237 },
7238 "sensor-match",
7239};
7240
7241
7242/**
7243 * sensor_match_interface_info:
7244 *
7245 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> D-Bus interface.
7246 *
7247 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
7248 */
7249GDBusInterfaceInfo *
7250sensor_match_interface_info (void)
7251{
7252 return (GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct;
7253}
7254
7255/**
7256 * sensor_match_override_properties:
7257 * @klass: The class structure for a #GObject<!-- -->-derived class.
7258 * @property_id_begin: The property id to assign to the first overridden property.
7259 *
7260 * Overrides all #GObject properties in the #SensorMatch interface for a concrete class.
7261 * The properties are overridden in the order they are defined.
7262 *
7263 * Returns: The last property id.
7264 */
7265guint
7266sensor_match_override_properties (GObjectClass *klass, guint property_id_begin)
7267{
7268 g_object_class_override_property (klass, property_id_begin++, "match-value");
7269 g_object_class_override_property (klass, property_id_begin++, "state");
7270 return property_id_begin - 1;
7271}
7272
7273
7274
7275/**
7276 * SensorMatch:
7277 *
7278 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
7279 */
7280
7281/**
7282 * SensorMatchIface:
7283 * @parent_iface: The parent interface.
7284 * @get_match_value: Getter for the #SensorMatch:match-value property.
7285 * @get_state: Getter for the #SensorMatch:state property.
7286 * @sensor_match: Handler for the #SensorMatch::sensor-match signal.
7287 *
7288 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
7289 */
7290
7291typedef SensorMatchIface SensorMatchInterface;
7292G_DEFINE_INTERFACE (SensorMatch, sensor_match, G_TYPE_OBJECT);
7293
7294static void
7295sensor_match_default_init (SensorMatchIface *iface)
7296{
7297 /* GObject signals for received D-Bus signals: */
7298 /**
7299 * SensorMatch::sensor-match:
7300 * @object: A #SensorMatch.
7301 * @arg_state: Argument.
7302 *
7303 * 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.
7304 *
7305 * 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.
7306 */
7307 g_signal_new ("sensor-match",
7308 G_TYPE_FROM_INTERFACE (iface),
7309 G_SIGNAL_RUN_LAST,
7310 G_STRUCT_OFFSET (SensorMatchIface, sensor_match),
7311 NULL,
7312 NULL,
7313 g_cclosure_marshal_generic,
7314 G_TYPE_NONE,
7315 1, G_TYPE_UCHAR);
7316
7317 /* GObject properties for D-Bus properties: */
7318 /**
7319 * SensorMatch:match-value:
7320 *
7321 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link>.
7322 *
7323 * 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.
7324 */
7325 g_object_interface_install_property (iface,
7326 g_param_spec_variant ("match-value", "match_value", "match_value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
7327 /**
7328 * SensorMatch:state:
7329 *
7330 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link>.
7331 *
7332 * 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.
7333 */
7334 g_object_interface_install_property (iface,
7335 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
7336}
7337
7338/**
7339 * sensor_match_get_match_value: (skip)
7340 * @object: A #SensorMatch.
7341 *
7342 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property.
7343 *
7344 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
7345 *
7346 * <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>
7347 *
7348 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
7349 */
7350GVariant *
7351sensor_match_get_match_value (SensorMatch *object)
7352{
7353 return SENSOR_MATCH_GET_IFACE (object)->get_match_value (object);
7354}
7355
7356/**
7357 * sensor_match_dup_match_value: (skip)
7358 * @object: A #SensorMatch.
7359 *
7360 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property.
7361 *
7362 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
7363 *
7364 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
7365 */
7366GVariant *
7367sensor_match_dup_match_value (SensorMatch *object)
7368{
7369 GVariant *value;
7370 g_object_get (G_OBJECT (object), "match-value", &value, NULL);
7371 return value;
7372}
7373
7374/**
7375 * sensor_match_set_match_value: (skip)
7376 * @object: A #SensorMatch.
7377 * @value: The value to set.
7378 *
7379 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property to @value.
7380 *
7381 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
7382 */
7383void
7384sensor_match_set_match_value (SensorMatch *object, GVariant *value)
7385{
7386 g_object_set (G_OBJECT (object), "match-value", value, NULL);
7387}
7388
7389/**
7390 * sensor_match_get_state: (skip)
7391 * @object: A #SensorMatch.
7392 *
7393 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property.
7394 *
7395 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
7396 *
7397 * Returns: The property value.
7398 */
7399guchar
7400sensor_match_get_state (SensorMatch *object)
7401{
7402 return SENSOR_MATCH_GET_IFACE (object)->get_state (object);
7403}
7404
7405/**
7406 * sensor_match_set_state: (skip)
7407 * @object: A #SensorMatch.
7408 * @value: The value to set.
7409 *
7410 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property to @value.
7411 *
7412 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
7413 */
7414void
7415sensor_match_set_state (SensorMatch *object, guchar value)
7416{
7417 g_object_set (G_OBJECT (object), "state", value, NULL);
7418}
7419
7420/**
7421 * sensor_match_emit_sensor_match:
7422 * @object: A #SensorMatch.
7423 * @arg_state: Argument to pass with the signal.
7424 *
7425 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorMatch.SensorMatch">"SensorMatch"</link> D-Bus signal.
7426 */
7427void
7428sensor_match_emit_sensor_match (
7429 SensorMatch *object,
7430 guchar arg_state)
7431{
7432 g_signal_emit_by_name (object, "sensor-match", arg_state);
7433}
7434
7435/* ------------------------------------------------------------------------ */
7436
7437/**
7438 * SensorMatchProxy:
7439 *
7440 * The #SensorMatchProxy structure contains only private data and should only be accessed using the provided API.
7441 */
7442
7443/**
7444 * SensorMatchProxyClass:
7445 * @parent_class: The parent class.
7446 *
7447 * Class structure for #SensorMatchProxy.
7448 */
7449
7450struct _SensorMatchProxyPrivate
7451{
7452 GData *qdata;
7453};
7454
7455static void sensor_match_proxy_iface_init (SensorMatchIface *iface);
7456
7457#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7458G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY,
7459 G_ADD_PRIVATE (SensorMatchProxy)
7460 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init));
7461
7462#else
7463G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY,
7464 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init));
7465
7466#endif
7467static void
7468sensor_match_proxy_finalize (GObject *object)
7469{
7470 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
7471 g_datalist_clear (&proxy->priv->qdata);
7472 G_OBJECT_CLASS (sensor_match_proxy_parent_class)->finalize (object);
7473}
7474
7475static void
7476sensor_match_proxy_get_property (GObject *object,
7477 guint prop_id,
7478 GValue *value,
7479 GParamSpec *pspec G_GNUC_UNUSED)
7480{
7481 const _ExtendedGDBusPropertyInfo *info;
7482 GVariant *variant;
7483 g_assert (prop_id != 0 && prop_id - 1 < 2);
7484 info = _sensor_match_property_info_pointers[prop_id - 1];
7485 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
7486 if (info->use_gvariant)
7487 {
7488 g_value_set_variant (value, variant);
7489 }
7490 else
7491 {
7492 if (variant != NULL)
7493 g_dbus_gvariant_to_gvalue (variant, value);
7494 }
7495 if (variant != NULL)
7496 g_variant_unref (variant);
7497}
7498
7499static void
7500sensor_match_proxy_set_property_cb (GDBusProxy *proxy,
7501 GAsyncResult *res,
7502 gpointer user_data)
7503{
7504 const _ExtendedGDBusPropertyInfo *info = user_data;
7505 GError *error;
7506 GVariant *_ret;
7507 error = NULL;
7508 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
7509 if (!_ret)
7510 {
7511 g_warning ("Error setting property '%s' on interface org.openbmc.SensorMatch: %s (%s, %d)",
7512 info->parent_struct.name,
7513 error->message, g_quark_to_string (error->domain), error->code);
7514 g_error_free (error);
7515 }
7516 else
7517 {
7518 g_variant_unref (_ret);
7519 }
7520}
7521
7522static void
7523sensor_match_proxy_set_property (GObject *object,
7524 guint prop_id,
7525 const GValue *value,
7526 GParamSpec *pspec G_GNUC_UNUSED)
7527{
7528 const _ExtendedGDBusPropertyInfo *info;
7529 GVariant *variant;
7530 g_assert (prop_id != 0 && prop_id - 1 < 2);
7531 info = _sensor_match_property_info_pointers[prop_id - 1];
7532 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
7533 g_dbus_proxy_call (G_DBUS_PROXY (object),
7534 "org.freedesktop.DBus.Properties.Set",
7535 g_variant_new ("(ssv)", "org.openbmc.SensorMatch", info->parent_struct.name, variant),
7536 G_DBUS_CALL_FLAGS_NONE,
7537 -1,
7538 NULL, (GAsyncReadyCallback) sensor_match_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
7539 g_variant_unref (variant);
7540}
7541
7542static void
7543sensor_match_proxy_g_signal (GDBusProxy *proxy,
7544 const gchar *sender_name G_GNUC_UNUSED,
7545 const gchar *signal_name,
7546 GVariant *parameters)
7547{
7548 _ExtendedGDBusSignalInfo *info;
7549 GVariantIter iter;
7550 GVariant *child;
7551 GValue *paramv;
7552 guint num_params;
7553 guint n;
7554 guint signal_id;
7555 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, signal_name);
7556 if (info == NULL)
7557 return;
7558 num_params = g_variant_n_children (parameters);
7559 paramv = g_new0 (GValue, num_params + 1);
7560 g_value_init (&paramv[0], TYPE_SENSOR_MATCH);
7561 g_value_set_object (&paramv[0], proxy);
7562 g_variant_iter_init (&iter, parameters);
7563 n = 1;
7564 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7565 {
7566 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
7567 if (arg_info->use_gvariant)
7568 {
7569 g_value_init (&paramv[n], G_TYPE_VARIANT);
7570 g_value_set_variant (&paramv[n], child);
7571 n++;
7572 }
7573 else
7574 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
7575 g_variant_unref (child);
7576 }
7577 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH);
7578 g_signal_emitv (paramv, signal_id, 0, NULL);
7579 for (n = 0; n < num_params + 1; n++)
7580 g_value_unset (&paramv[n]);
7581 g_free (paramv);
7582}
7583
7584static void
7585sensor_match_proxy_g_properties_changed (GDBusProxy *_proxy,
7586 GVariant *changed_properties,
7587 const gchar *const *invalidated_properties)
7588{
7589 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (_proxy);
7590 guint n;
7591 const gchar *key;
7592 GVariantIter *iter;
7593 _ExtendedGDBusPropertyInfo *info;
7594 g_variant_get (changed_properties, "a{sv}", &iter);
7595 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
7596 {
7597 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, key);
7598 g_datalist_remove_data (&proxy->priv->qdata, key);
7599 if (info != NULL)
7600 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7601 }
7602 g_variant_iter_free (iter);
7603 for (n = 0; invalidated_properties[n] != NULL; n++)
7604 {
7605 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, invalidated_properties[n]);
7606 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
7607 if (info != NULL)
7608 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7609 }
7610}
7611
7612static GVariant *
7613sensor_match_proxy_get_match_value (SensorMatch *object)
7614{
7615 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
7616 GVariant *variant;
7617 GVariant *value = NULL;
7618 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "match_value");
7619 value = variant;
7620 if (variant != NULL)
7621 g_variant_unref (variant);
7622 return value;
7623}
7624
7625static guchar
7626sensor_match_proxy_get_state (SensorMatch *object)
7627{
7628 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
7629 GVariant *variant;
7630 guchar value = 0;
7631 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
7632 if (variant != NULL)
7633 {
7634 value = g_variant_get_byte (variant);
7635 g_variant_unref (variant);
7636 }
7637 return value;
7638}
7639
7640static void
7641sensor_match_proxy_init (SensorMatchProxy *proxy)
7642{
7643#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7644 proxy->priv = sensor_match_proxy_get_instance_private (proxy);
7645#else
7646 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_MATCH_PROXY, SensorMatchProxyPrivate);
7647#endif
7648
7649 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_match_interface_info ());
7650}
7651
7652static void
7653sensor_match_proxy_class_init (SensorMatchProxyClass *klass)
7654{
7655 GObjectClass *gobject_class;
7656 GDBusProxyClass *proxy_class;
7657
7658 gobject_class = G_OBJECT_CLASS (klass);
7659 gobject_class->finalize = sensor_match_proxy_finalize;
7660 gobject_class->get_property = sensor_match_proxy_get_property;
7661 gobject_class->set_property = sensor_match_proxy_set_property;
7662
7663 proxy_class = G_DBUS_PROXY_CLASS (klass);
7664 proxy_class->g_signal = sensor_match_proxy_g_signal;
7665 proxy_class->g_properties_changed = sensor_match_proxy_g_properties_changed;
7666
7667 sensor_match_override_properties (gobject_class, 1);
7668
7669#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
7670 g_type_class_add_private (klass, sizeof (SensorMatchProxyPrivate));
7671#endif
7672}
7673
7674static void
7675sensor_match_proxy_iface_init (SensorMatchIface *iface)
7676{
7677 iface->get_match_value = sensor_match_proxy_get_match_value;
7678 iface->get_state = sensor_match_proxy_get_state;
7679}
7680
7681/**
7682 * sensor_match_proxy_new:
7683 * @connection: A #GDBusConnection.
7684 * @flags: Flags from the #GDBusProxyFlags enumeration.
7685 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
7686 * @object_path: An object path.
7687 * @cancellable: (allow-none): A #GCancellable or %NULL.
7688 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
7689 * @user_data: User data to pass to @callback.
7690 *
7691 * 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.
7692 *
7693 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
7694 * You can then call sensor_match_proxy_new_finish() to get the result of the operation.
7695 *
7696 * See sensor_match_proxy_new_sync() for the synchronous, blocking version of this constructor.
7697 */
7698void
7699sensor_match_proxy_new (
7700 GDBusConnection *connection,
7701 GDBusProxyFlags flags,
7702 const gchar *name,
7703 const gchar *object_path,
7704 GCancellable *cancellable,
7705 GAsyncReadyCallback callback,
7706 gpointer user_data)
7707{
7708 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);
7709}
7710
7711/**
7712 * sensor_match_proxy_new_finish:
7713 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new().
7714 * @error: Return location for error or %NULL
7715 *
7716 * Finishes an operation started with sensor_match_proxy_new().
7717 *
7718 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
7719 */
7720SensorMatch *
7721sensor_match_proxy_new_finish (
7722 GAsyncResult *res,
7723 GError **error)
7724{
7725 GObject *ret;
7726 GObject *source_object;
7727 source_object = g_async_result_get_source_object (res);
7728 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
7729 g_object_unref (source_object);
7730 if (ret != NULL)
7731 return SENSOR_MATCH (ret);
7732 else
7733 return NULL;
7734}
7735
7736/**
7737 * sensor_match_proxy_new_sync:
7738 * @connection: A #GDBusConnection.
7739 * @flags: Flags from the #GDBusProxyFlags enumeration.
7740 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
7741 * @object_path: An object path.
7742 * @cancellable: (allow-none): A #GCancellable or %NULL.
7743 * @error: Return location for error or %NULL
7744 *
7745 * 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.
7746 *
7747 * The calling thread is blocked until a reply is received.
7748 *
7749 * See sensor_match_proxy_new() for the asynchronous version of this constructor.
7750 *
7751 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
7752 */
7753SensorMatch *
7754sensor_match_proxy_new_sync (
7755 GDBusConnection *connection,
7756 GDBusProxyFlags flags,
7757 const gchar *name,
7758 const gchar *object_path,
7759 GCancellable *cancellable,
7760 GError **error)
7761{
7762 GInitable *ret;
7763 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);
7764 if (ret != NULL)
7765 return SENSOR_MATCH (ret);
7766 else
7767 return NULL;
7768}
7769
7770
7771/**
7772 * sensor_match_proxy_new_for_bus:
7773 * @bus_type: A #GBusType.
7774 * @flags: Flags from the #GDBusProxyFlags enumeration.
7775 * @name: A bus name (well-known or unique).
7776 * @object_path: An object path.
7777 * @cancellable: (allow-none): A #GCancellable or %NULL.
7778 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
7779 * @user_data: User data to pass to @callback.
7780 *
7781 * Like sensor_match_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
7782 *
7783 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
7784 * You can then call sensor_match_proxy_new_for_bus_finish() to get the result of the operation.
7785 *
7786 * See sensor_match_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
7787 */
7788void
7789sensor_match_proxy_new_for_bus (
7790 GBusType bus_type,
7791 GDBusProxyFlags flags,
7792 const gchar *name,
7793 const gchar *object_path,
7794 GCancellable *cancellable,
7795 GAsyncReadyCallback callback,
7796 gpointer user_data)
7797{
7798 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);
7799}
7800
7801/**
7802 * sensor_match_proxy_new_for_bus_finish:
7803 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new_for_bus().
7804 * @error: Return location for error or %NULL
7805 *
7806 * Finishes an operation started with sensor_match_proxy_new_for_bus().
7807 *
7808 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
7809 */
7810SensorMatch *
7811sensor_match_proxy_new_for_bus_finish (
7812 GAsyncResult *res,
7813 GError **error)
7814{
7815 GObject *ret;
7816 GObject *source_object;
7817 source_object = g_async_result_get_source_object (res);
7818 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
7819 g_object_unref (source_object);
7820 if (ret != NULL)
7821 return SENSOR_MATCH (ret);
7822 else
7823 return NULL;
7824}
7825
7826/**
7827 * sensor_match_proxy_new_for_bus_sync:
7828 * @bus_type: A #GBusType.
7829 * @flags: Flags from the #GDBusProxyFlags enumeration.
7830 * @name: A bus name (well-known or unique).
7831 * @object_path: An object path.
7832 * @cancellable: (allow-none): A #GCancellable or %NULL.
7833 * @error: Return location for error or %NULL
7834 *
7835 * Like sensor_match_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
7836 *
7837 * The calling thread is blocked until a reply is received.
7838 *
7839 * See sensor_match_proxy_new_for_bus() for the asynchronous version of this constructor.
7840 *
7841 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
7842 */
7843SensorMatch *
7844sensor_match_proxy_new_for_bus_sync (
7845 GBusType bus_type,
7846 GDBusProxyFlags flags,
7847 const gchar *name,
7848 const gchar *object_path,
7849 GCancellable *cancellable,
7850 GError **error)
7851{
7852 GInitable *ret;
7853 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);
7854 if (ret != NULL)
7855 return SENSOR_MATCH (ret);
7856 else
7857 return NULL;
7858}
7859
7860
7861/* ------------------------------------------------------------------------ */
7862
7863/**
7864 * SensorMatchSkeleton:
7865 *
7866 * The #SensorMatchSkeleton structure contains only private data and should only be accessed using the provided API.
7867 */
7868
7869/**
7870 * SensorMatchSkeletonClass:
7871 * @parent_class: The parent class.
7872 *
7873 * Class structure for #SensorMatchSkeleton.
7874 */
7875
7876struct _SensorMatchSkeletonPrivate
7877{
7878 GValue *properties;
7879 GList *changed_properties;
7880 GSource *changed_properties_idle_source;
7881 GMainContext *context;
7882 GMutex lock;
7883};
7884
7885static void
7886_sensor_match_skeleton_handle_method_call (
7887 GDBusConnection *connection G_GNUC_UNUSED,
7888 const gchar *sender G_GNUC_UNUSED,
7889 const gchar *object_path G_GNUC_UNUSED,
7890 const gchar *interface_name,
7891 const gchar *method_name,
7892 GVariant *parameters,
7893 GDBusMethodInvocation *invocation,
7894 gpointer user_data)
7895{
7896 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
7897 _ExtendedGDBusMethodInfo *info;
7898 GVariantIter iter;
7899 GVariant *child;
7900 GValue *paramv;
7901 guint num_params;
7902 guint num_extra;
7903 guint n;
7904 guint signal_id;
7905 GValue return_value = G_VALUE_INIT;
7906 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
7907 g_assert (info != NULL);
7908 num_params = g_variant_n_children (parameters);
7909 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
7910 n = 0;
7911 g_value_init (&paramv[n], TYPE_SENSOR_MATCH);
7912 g_value_set_object (&paramv[n++], skeleton);
7913 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
7914 g_value_set_object (&paramv[n++], invocation);
7915 if (info->pass_fdlist)
7916 {
7917#ifdef G_OS_UNIX
7918 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
7919 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
7920#else
7921 g_assert_not_reached ();
7922#endif
7923 }
7924 g_variant_iter_init (&iter, parameters);
7925 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7926 {
7927 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
7928 if (arg_info->use_gvariant)
7929 {
7930 g_value_init (&paramv[n], G_TYPE_VARIANT);
7931 g_value_set_variant (&paramv[n], child);
7932 n++;
7933 }
7934 else
7935 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
7936 g_variant_unref (child);
7937 }
7938 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH);
7939 g_value_init (&return_value, G_TYPE_BOOLEAN);
7940 g_signal_emitv (paramv, signal_id, 0, &return_value);
7941 if (!g_value_get_boolean (&return_value))
7942 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);
7943 g_value_unset (&return_value);
7944 for (n = 0; n < num_params + num_extra; n++)
7945 g_value_unset (&paramv[n]);
7946 g_free (paramv);
7947}
7948
7949static GVariant *
7950_sensor_match_skeleton_handle_get_property (
7951 GDBusConnection *connection G_GNUC_UNUSED,
7952 const gchar *sender G_GNUC_UNUSED,
7953 const gchar *object_path G_GNUC_UNUSED,
7954 const gchar *interface_name G_GNUC_UNUSED,
7955 const gchar *property_name,
7956 GError **error,
7957 gpointer user_data)
7958{
7959 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
7960 GValue value = G_VALUE_INIT;
7961 GParamSpec *pspec;
7962 _ExtendedGDBusPropertyInfo *info;
7963 GVariant *ret;
7964 ret = NULL;
7965 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name);
7966 g_assert (info != NULL);
7967 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
7968 if (pspec == NULL)
7969 {
7970 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
7971 }
7972 else
7973 {
7974 g_value_init (&value, pspec->value_type);
7975 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
7976 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
7977 g_value_unset (&value);
7978 }
7979 return ret;
7980}
7981
7982static gboolean
7983_sensor_match_skeleton_handle_set_property (
7984 GDBusConnection *connection G_GNUC_UNUSED,
7985 const gchar *sender G_GNUC_UNUSED,
7986 const gchar *object_path G_GNUC_UNUSED,
7987 const gchar *interface_name G_GNUC_UNUSED,
7988 const gchar *property_name,
7989 GVariant *variant,
7990 GError **error,
7991 gpointer user_data)
7992{
7993 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
7994 GValue value = G_VALUE_INIT;
7995 GParamSpec *pspec;
7996 _ExtendedGDBusPropertyInfo *info;
7997 gboolean ret;
7998 ret = FALSE;
7999 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name);
8000 g_assert (info != NULL);
8001 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
8002 if (pspec == NULL)
8003 {
8004 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
8005 }
8006 else
8007 {
8008 if (info->use_gvariant)
8009 g_value_set_variant (&value, variant);
8010 else
8011 g_dbus_gvariant_to_gvalue (variant, &value);
8012 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
8013 g_value_unset (&value);
8014 ret = TRUE;
8015 }
8016 return ret;
8017}
8018
8019static const GDBusInterfaceVTable _sensor_match_skeleton_vtable =
8020{
8021 _sensor_match_skeleton_handle_method_call,
8022 _sensor_match_skeleton_handle_get_property,
8023 _sensor_match_skeleton_handle_set_property,
8024 {NULL}
8025};
8026
8027static GDBusInterfaceInfo *
8028sensor_match_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8029{
8030 return sensor_match_interface_info ();
8031}
8032
8033static GDBusInterfaceVTable *
8034sensor_match_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8035{
8036 return (GDBusInterfaceVTable *) &_sensor_match_skeleton_vtable;
8037}
8038
8039static GVariant *
8040sensor_match_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
8041{
8042 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton);
8043
8044 GVariantBuilder builder;
8045 guint n;
8046 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8047 if (_sensor_match_interface_info.parent_struct.properties == NULL)
8048 goto out;
8049 for (n = 0; _sensor_match_interface_info.parent_struct.properties[n] != NULL; n++)
8050 {
8051 GDBusPropertyInfo *info = _sensor_match_interface_info.parent_struct.properties[n];
8052 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
8053 {
8054 GVariant *value;
8055 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);
8056 if (value != NULL)
8057 {
8058 g_variant_take_ref (value);
8059 g_variant_builder_add (&builder, "{sv}", info->name, value);
8060 g_variant_unref (value);
8061 }
8062 }
8063 }
8064out:
8065 return g_variant_builder_end (&builder);
8066}
8067
8068static gboolean _sensor_match_emit_changed (gpointer user_data);
8069
8070static void
8071sensor_match_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
8072{
8073 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton);
8074 gboolean emit_changed = FALSE;
8075
8076 g_mutex_lock (&skeleton->priv->lock);
8077 if (skeleton->priv->changed_properties_idle_source != NULL)
8078 {
8079 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8080 skeleton->priv->changed_properties_idle_source = NULL;
8081 emit_changed = TRUE;
8082 }
8083 g_mutex_unlock (&skeleton->priv->lock);
8084
8085 if (emit_changed)
8086 _sensor_match_emit_changed (skeleton);
8087}
8088
8089static void
8090_sensor_match_on_signal_sensor_match (
8091 SensorMatch *object,
8092 guchar arg_state)
8093{
8094 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
8095
8096 GList *connections, *l;
8097 GVariant *signal_variant;
8098 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
8099
8100 signal_variant = g_variant_ref_sink (g_variant_new ("(y)",
8101 arg_state));
8102 for (l = connections; l != NULL; l = l->next)
8103 {
8104 GDBusConnection *connection = l->data;
8105 g_dbus_connection_emit_signal (connection,
8106 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorMatch", "SensorMatch",
8107 signal_variant, NULL);
8108 }
8109 g_variant_unref (signal_variant);
8110 g_list_free_full (connections, g_object_unref);
8111}
8112
8113static void sensor_match_skeleton_iface_init (SensorMatchIface *iface);
8114#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8115G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8116 G_ADD_PRIVATE (SensorMatchSkeleton)
8117 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init));
8118
8119#else
8120G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8121 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init));
8122
8123#endif
8124static void
8125sensor_match_skeleton_finalize (GObject *object)
8126{
8127 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
8128 guint n;
8129 for (n = 0; n < 2; n++)
8130 g_value_unset (&skeleton->priv->properties[n]);
8131 g_free (skeleton->priv->properties);
8132 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
8133 if (skeleton->priv->changed_properties_idle_source != NULL)
8134 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8135 g_main_context_unref (skeleton->priv->context);
8136 g_mutex_clear (&skeleton->priv->lock);
8137 G_OBJECT_CLASS (sensor_match_skeleton_parent_class)->finalize (object);
8138}
8139
8140static void
8141sensor_match_skeleton_get_property (GObject *object,
8142 guint prop_id,
8143 GValue *value,
8144 GParamSpec *pspec G_GNUC_UNUSED)
8145{
8146 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
8147 g_assert (prop_id != 0 && prop_id - 1 < 2);
8148 g_mutex_lock (&skeleton->priv->lock);
8149 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
8150 g_mutex_unlock (&skeleton->priv->lock);
8151}
8152
8153static gboolean
8154_sensor_match_emit_changed (gpointer user_data)
8155{
8156 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
8157 GList *l;
8158 GVariantBuilder builder;
8159 GVariantBuilder invalidated_builder;
8160 guint num_changes;
8161
8162 g_mutex_lock (&skeleton->priv->lock);
8163 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8164 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
8165 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
8166 {
8167 ChangedProperty *cp = l->data;
8168 GVariant *variant;
8169 const GValue *cur_value;
8170
8171 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
8172 if (!_g_value_equal (cur_value, &cp->orig_value))
8173 {
8174 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
8175 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
8176 g_variant_unref (variant);
8177 num_changes++;
8178 }
8179 }
8180 if (num_changes > 0)
8181 {
8182 GList *connections, *ll;
8183 GVariant *signal_variant;
8184 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorMatch",
8185 &builder, &invalidated_builder));
8186 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
8187 for (ll = connections; ll != NULL; ll = ll->next)
8188 {
8189 GDBusConnection *connection = ll->data;
8190
8191 g_dbus_connection_emit_signal (connection,
8192 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
8193 "org.freedesktop.DBus.Properties",
8194 "PropertiesChanged",
8195 signal_variant,
8196 NULL);
8197 }
8198 g_variant_unref (signal_variant);
8199 g_list_free_full (connections, g_object_unref);
8200 }
8201 else
8202 {
8203 g_variant_builder_clear (&builder);
8204 g_variant_builder_clear (&invalidated_builder);
8205 }
8206 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
8207 skeleton->priv->changed_properties = NULL;
8208 skeleton->priv->changed_properties_idle_source = NULL;
8209 g_mutex_unlock (&skeleton->priv->lock);
8210 return FALSE;
8211}
8212
8213static void
8214_sensor_match_schedule_emit_changed (SensorMatchSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
8215{
8216 ChangedProperty *cp;
8217 GList *l;
8218 cp = NULL;
8219 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
8220 {
8221 ChangedProperty *i_cp = l->data;
8222 if (i_cp->info == info)
8223 {
8224 cp = i_cp;
8225 break;
8226 }
8227 }
8228 if (cp == NULL)
8229 {
8230 cp = g_new0 (ChangedProperty, 1);
8231 cp->prop_id = prop_id;
8232 cp->info = info;
8233 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
8234 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
8235 g_value_copy (orig_value, &cp->orig_value);
8236 }
8237}
8238
8239static void
8240sensor_match_skeleton_notify (GObject *object,
8241 GParamSpec *pspec G_GNUC_UNUSED)
8242{
8243 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
8244 g_mutex_lock (&skeleton->priv->lock);
8245 if (skeleton->priv->changed_properties != NULL &&
8246 skeleton->priv->changed_properties_idle_source == NULL)
8247 {
8248 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
8249 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
8250 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_match_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
8251 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
8252 g_source_unref (skeleton->priv->changed_properties_idle_source);
8253 }
8254 g_mutex_unlock (&skeleton->priv->lock);
8255}
8256
8257static void
8258sensor_match_skeleton_set_property (GObject *object,
8259 guint prop_id,
8260 const GValue *value,
8261 GParamSpec *pspec)
8262{
8263 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
8264 g_assert (prop_id != 0 && prop_id - 1 < 2);
8265 g_mutex_lock (&skeleton->priv->lock);
8266 g_object_freeze_notify (object);
8267 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
8268 {
8269 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
8270 _sensor_match_schedule_emit_changed (skeleton, _sensor_match_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
8271 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
8272 g_object_notify_by_pspec (object, pspec);
8273 }
8274 g_mutex_unlock (&skeleton->priv->lock);
8275 g_object_thaw_notify (object);
8276}
8277
8278static void
8279sensor_match_skeleton_init (SensorMatchSkeleton *skeleton)
8280{
8281#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8282 skeleton->priv = sensor_match_skeleton_get_instance_private (skeleton);
8283#else
8284 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_MATCH_SKELETON, SensorMatchSkeletonPrivate);
8285#endif
8286
8287 g_mutex_init (&skeleton->priv->lock);
8288 skeleton->priv->context = g_main_context_ref_thread_default ();
8289 skeleton->priv->properties = g_new0 (GValue, 2);
8290 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
8291 g_value_init (&skeleton->priv->properties[1], G_TYPE_UCHAR);
8292}
8293
8294static GVariant *
8295sensor_match_skeleton_get_match_value (SensorMatch *object)
8296{
8297 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
8298 GVariant *value;
8299 g_mutex_lock (&skeleton->priv->lock);
8300 value = g_value_get_variant (&(skeleton->priv->properties[0]));
8301 g_mutex_unlock (&skeleton->priv->lock);
8302 return value;
8303}
8304
8305static guchar
8306sensor_match_skeleton_get_state (SensorMatch *object)
8307{
8308 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
8309 guchar value;
8310 g_mutex_lock (&skeleton->priv->lock);
8311 value = g_value_get_uchar (&(skeleton->priv->properties[1]));
8312 g_mutex_unlock (&skeleton->priv->lock);
8313 return value;
8314}
8315
8316static void
8317sensor_match_skeleton_class_init (SensorMatchSkeletonClass *klass)
8318{
8319 GObjectClass *gobject_class;
8320 GDBusInterfaceSkeletonClass *skeleton_class;
8321
8322 gobject_class = G_OBJECT_CLASS (klass);
8323 gobject_class->finalize = sensor_match_skeleton_finalize;
8324 gobject_class->get_property = sensor_match_skeleton_get_property;
8325 gobject_class->set_property = sensor_match_skeleton_set_property;
8326 gobject_class->notify = sensor_match_skeleton_notify;
8327
8328
8329 sensor_match_override_properties (gobject_class, 1);
8330
8331 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
8332 skeleton_class->get_info = sensor_match_skeleton_dbus_interface_get_info;
8333 skeleton_class->get_properties = sensor_match_skeleton_dbus_interface_get_properties;
8334 skeleton_class->flush = sensor_match_skeleton_dbus_interface_flush;
8335 skeleton_class->get_vtable = sensor_match_skeleton_dbus_interface_get_vtable;
8336
8337#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8338 g_type_class_add_private (klass, sizeof (SensorMatchSkeletonPrivate));
8339#endif
8340}
8341
8342static void
8343sensor_match_skeleton_iface_init (SensorMatchIface *iface)
8344{
8345 iface->sensor_match = _sensor_match_on_signal_sensor_match;
8346 iface->get_match_value = sensor_match_skeleton_get_match_value;
8347 iface->get_state = sensor_match_skeleton_get_state;
8348}
8349
8350/**
8351 * sensor_match_skeleton_new:
8352 *
8353 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
8354 *
8355 * Returns: (transfer full) (type SensorMatchSkeleton): The skeleton object.
8356 */
8357SensorMatch *
8358sensor_match_skeleton_new (void)
8359{
8360 return SENSOR_MATCH (g_object_new (TYPE_SENSOR_MATCH_SKELETON, NULL));
8361}
8362
8363/* ------------------------------------------------------------------------
8364 * Code for interface org.openbmc.Process
8365 * ------------------------------------------------------------------------
8366 */
8367
8368/**
8369 * SECTION:Process
8370 * @title: Process
8371 * @short_description: Generated C code for the org.openbmc.Process D-Bus interface
8372 *
8373 * 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.
8374 */
8375
8376/* ---- Introspection data for org.openbmc.Process ---- */
8377
8378static const _ExtendedGDBusMethodInfo _process_method_info_stop =
8379{
8380 {
8381 -1,
8382 (gchar *) "stop",
8383 NULL,
8384 NULL,
8385 NULL
8386 },
8387 "handle-stop",
8388 FALSE
8389};
8390
8391static const _ExtendedGDBusMethodInfo * const _process_method_info_pointers[] =
8392{
8393 &_process_method_info_stop,
8394 NULL
8395};
8396
8397static const _ExtendedGDBusInterfaceInfo _process_interface_info =
8398{
8399 {
8400 -1,
8401 (gchar *) "org.openbmc.Process",
8402 (GDBusMethodInfo **) &_process_method_info_pointers,
8403 NULL,
8404 NULL,
8405 NULL
8406 },
8407 "process",
8408};
8409
8410
8411/**
8412 * process_interface_info:
8413 *
8414 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> D-Bus interface.
8415 *
8416 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
8417 */
8418GDBusInterfaceInfo *
8419process_interface_info (void)
8420{
8421 return (GDBusInterfaceInfo *) &_process_interface_info.parent_struct;
8422}
8423
8424/**
8425 * process_override_properties:
8426 * @klass: The class structure for a #GObject<!-- -->-derived class.
8427 * @property_id_begin: The property id to assign to the first overridden property.
8428 *
8429 * Overrides all #GObject properties in the #Process interface for a concrete class.
8430 * The properties are overridden in the order they are defined.
8431 *
8432 * Returns: The last property id.
8433 */
8434guint
8435process_override_properties (GObjectClass *klass, guint property_id_begin)
8436{
8437 return property_id_begin - 1;
8438}
8439
8440
8441
8442/**
8443 * Process:
8444 *
8445 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
8446 */
8447
8448/**
8449 * ProcessIface:
8450 * @parent_iface: The parent interface.
8451 * @handle_stop: Handler for the #Process::handle-stop signal.
8452 *
8453 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
8454 */
8455
8456typedef ProcessIface ProcessInterface;
8457G_DEFINE_INTERFACE (Process, process, G_TYPE_OBJECT);
8458
8459static void
8460process_default_init (ProcessIface *iface)
8461{
8462 /* GObject signals for incoming D-Bus method calls: */
8463 /**
8464 * Process::handle-stop:
8465 * @object: A #Process.
8466 * @invocation: A #GDBusMethodInvocation.
8467 *
8468 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method.
8469 *
8470 * 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.
8471 *
8472 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
8473 */
8474 g_signal_new ("handle-stop",
8475 G_TYPE_FROM_INTERFACE (iface),
8476 G_SIGNAL_RUN_LAST,
8477 G_STRUCT_OFFSET (ProcessIface, handle_stop),
8478 g_signal_accumulator_true_handled,
8479 NULL,
8480 g_cclosure_marshal_generic,
8481 G_TYPE_BOOLEAN,
8482 1,
8483 G_TYPE_DBUS_METHOD_INVOCATION);
8484
8485}
8486
8487/**
8488 * process_call_stop:
8489 * @proxy: A #ProcessProxy.
8490 * @cancellable: (allow-none): A #GCancellable or %NULL.
8491 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
8492 * @user_data: User data to pass to @callback.
8493 *
8494 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method on @proxy.
8495 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
8496 * You can then call process_call_stop_finish() to get the result of the operation.
8497 *
8498 * See process_call_stop_sync() for the synchronous, blocking version of this method.
8499 */
8500void
8501process_call_stop (
8502 Process *proxy,
8503 GCancellable *cancellable,
8504 GAsyncReadyCallback callback,
8505 gpointer user_data)
8506{
8507 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
8508 "stop",
8509 g_variant_new ("()"),
8510 G_DBUS_CALL_FLAGS_NONE,
8511 -1,
8512 cancellable,
8513 callback,
8514 user_data);
8515}
8516
8517/**
8518 * process_call_stop_finish:
8519 * @proxy: A #ProcessProxy.
8520 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_call_stop().
8521 * @error: Return location for error or %NULL.
8522 *
8523 * Finishes an operation started with process_call_stop().
8524 *
8525 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
8526 */
8527gboolean
8528process_call_stop_finish (
8529 Process *proxy,
8530 GAsyncResult *res,
8531 GError **error)
8532{
8533 GVariant *_ret;
8534 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
8535 if (_ret == NULL)
8536 goto _out;
8537 g_variant_get (_ret,
8538 "()");
8539 g_variant_unref (_ret);
8540_out:
8541 return _ret != NULL;
8542}
8543
8544/**
8545 * process_call_stop_sync:
8546 * @proxy: A #ProcessProxy.
8547 * @cancellable: (allow-none): A #GCancellable or %NULL.
8548 * @error: Return location for error or %NULL.
8549 *
8550 * 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.
8551 *
8552 * See process_call_stop() for the asynchronous version of this method.
8553 *
8554 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
8555 */
8556gboolean
8557process_call_stop_sync (
8558 Process *proxy,
8559 GCancellable *cancellable,
8560 GError **error)
8561{
8562 GVariant *_ret;
8563 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
8564 "stop",
8565 g_variant_new ("()"),
8566 G_DBUS_CALL_FLAGS_NONE,
8567 -1,
8568 cancellable,
8569 error);
8570 if (_ret == NULL)
8571 goto _out;
8572 g_variant_get (_ret,
8573 "()");
8574 g_variant_unref (_ret);
8575_out:
8576 return _ret != NULL;
8577}
8578
8579/**
8580 * process_complete_stop:
8581 * @object: A #Process.
8582 * @invocation: (transfer full): A #GDBusMethodInvocation.
8583 *
8584 * 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.
8585 *
8586 * This method will free @invocation, you cannot use it afterwards.
8587 */
8588void
8589process_complete_stop (
8590 Process *object,
8591 GDBusMethodInvocation *invocation)
8592{
8593 g_dbus_method_invocation_return_value (invocation,
8594 g_variant_new ("()"));
8595}
8596
8597/* ------------------------------------------------------------------------ */
8598
8599/**
8600 * ProcessProxy:
8601 *
8602 * The #ProcessProxy structure contains only private data and should only be accessed using the provided API.
8603 */
8604
8605/**
8606 * ProcessProxyClass:
8607 * @parent_class: The parent class.
8608 *
8609 * Class structure for #ProcessProxy.
8610 */
8611
8612struct _ProcessProxyPrivate
8613{
8614 GData *qdata;
8615};
8616
8617static void process_proxy_iface_init (ProcessIface *iface);
8618
8619#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8620G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY,
8621 G_ADD_PRIVATE (ProcessProxy)
8622 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init));
8623
8624#else
8625G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY,
8626 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init));
8627
8628#endif
8629static void
8630process_proxy_finalize (GObject *object)
8631{
8632 ProcessProxy *proxy = PROCESS_PROXY (object);
8633 g_datalist_clear (&proxy->priv->qdata);
8634 G_OBJECT_CLASS (process_proxy_parent_class)->finalize (object);
8635}
8636
8637static void
8638process_proxy_get_property (GObject *object,
8639 guint prop_id,
8640 GValue *value,
8641 GParamSpec *pspec G_GNUC_UNUSED)
8642{
8643}
8644
8645static void
8646process_proxy_set_property (GObject *object,
8647 guint prop_id,
8648 const GValue *value,
8649 GParamSpec *pspec G_GNUC_UNUSED)
8650{
8651}
8652
8653static void
8654process_proxy_g_signal (GDBusProxy *proxy,
8655 const gchar *sender_name G_GNUC_UNUSED,
8656 const gchar *signal_name,
8657 GVariant *parameters)
8658{
8659 _ExtendedGDBusSignalInfo *info;
8660 GVariantIter iter;
8661 GVariant *child;
8662 GValue *paramv;
8663 guint num_params;
8664 guint n;
8665 guint signal_id;
8666 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, signal_name);
8667 if (info == NULL)
8668 return;
8669 num_params = g_variant_n_children (parameters);
8670 paramv = g_new0 (GValue, num_params + 1);
8671 g_value_init (&paramv[0], TYPE_PROCESS);
8672 g_value_set_object (&paramv[0], proxy);
8673 g_variant_iter_init (&iter, parameters);
8674 n = 1;
8675 while ((child = g_variant_iter_next_value (&iter)) != NULL)
8676 {
8677 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
8678 if (arg_info->use_gvariant)
8679 {
8680 g_value_init (&paramv[n], G_TYPE_VARIANT);
8681 g_value_set_variant (&paramv[n], child);
8682 n++;
8683 }
8684 else
8685 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
8686 g_variant_unref (child);
8687 }
8688 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS);
8689 g_signal_emitv (paramv, signal_id, 0, NULL);
8690 for (n = 0; n < num_params + 1; n++)
8691 g_value_unset (&paramv[n]);
8692 g_free (paramv);
8693}
8694
8695static void
8696process_proxy_g_properties_changed (GDBusProxy *_proxy,
8697 GVariant *changed_properties,
8698 const gchar *const *invalidated_properties)
8699{
8700 ProcessProxy *proxy = PROCESS_PROXY (_proxy);
8701 guint n;
8702 const gchar *key;
8703 GVariantIter *iter;
8704 _ExtendedGDBusPropertyInfo *info;
8705 g_variant_get (changed_properties, "a{sv}", &iter);
8706 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
8707 {
8708 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, key);
8709 g_datalist_remove_data (&proxy->priv->qdata, key);
8710 if (info != NULL)
8711 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
8712 }
8713 g_variant_iter_free (iter);
8714 for (n = 0; invalidated_properties[n] != NULL; n++)
8715 {
8716 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, invalidated_properties[n]);
8717 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
8718 if (info != NULL)
8719 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
8720 }
8721}
8722
8723static void
8724process_proxy_init (ProcessProxy *proxy)
8725{
8726#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8727 proxy->priv = process_proxy_get_instance_private (proxy);
8728#else
8729 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_PROCESS_PROXY, ProcessProxyPrivate);
8730#endif
8731
8732 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), process_interface_info ());
8733}
8734
8735static void
8736process_proxy_class_init (ProcessProxyClass *klass)
8737{
8738 GObjectClass *gobject_class;
8739 GDBusProxyClass *proxy_class;
8740
8741 gobject_class = G_OBJECT_CLASS (klass);
8742 gobject_class->finalize = process_proxy_finalize;
8743 gobject_class->get_property = process_proxy_get_property;
8744 gobject_class->set_property = process_proxy_set_property;
8745
8746 proxy_class = G_DBUS_PROXY_CLASS (klass);
8747 proxy_class->g_signal = process_proxy_g_signal;
8748 proxy_class->g_properties_changed = process_proxy_g_properties_changed;
8749
8750#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8751 g_type_class_add_private (klass, sizeof (ProcessProxyPrivate));
8752#endif
8753}
8754
8755static void
8756process_proxy_iface_init (ProcessIface *iface)
8757{
8758}
8759
8760/**
8761 * process_proxy_new:
8762 * @connection: A #GDBusConnection.
8763 * @flags: Flags from the #GDBusProxyFlags enumeration.
8764 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
8765 * @object_path: An object path.
8766 * @cancellable: (allow-none): A #GCancellable or %NULL.
8767 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
8768 * @user_data: User data to pass to @callback.
8769 *
8770 * 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.
8771 *
8772 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
8773 * You can then call process_proxy_new_finish() to get the result of the operation.
8774 *
8775 * See process_proxy_new_sync() for the synchronous, blocking version of this constructor.
8776 */
8777void
8778process_proxy_new (
8779 GDBusConnection *connection,
8780 GDBusProxyFlags flags,
8781 const gchar *name,
8782 const gchar *object_path,
8783 GCancellable *cancellable,
8784 GAsyncReadyCallback callback,
8785 gpointer user_data)
8786{
8787 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);
8788}
8789
8790/**
8791 * process_proxy_new_finish:
8792 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new().
8793 * @error: Return location for error or %NULL
8794 *
8795 * Finishes an operation started with process_proxy_new().
8796 *
8797 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
8798 */
8799Process *
8800process_proxy_new_finish (
8801 GAsyncResult *res,
8802 GError **error)
8803{
8804 GObject *ret;
8805 GObject *source_object;
8806 source_object = g_async_result_get_source_object (res);
8807 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
8808 g_object_unref (source_object);
8809 if (ret != NULL)
8810 return PROCESS (ret);
8811 else
8812 return NULL;
8813}
8814
8815/**
8816 * process_proxy_new_sync:
8817 * @connection: A #GDBusConnection.
8818 * @flags: Flags from the #GDBusProxyFlags enumeration.
8819 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
8820 * @object_path: An object path.
8821 * @cancellable: (allow-none): A #GCancellable or %NULL.
8822 * @error: Return location for error or %NULL
8823 *
8824 * 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.
8825 *
8826 * The calling thread is blocked until a reply is received.
8827 *
8828 * See process_proxy_new() for the asynchronous version of this constructor.
8829 *
8830 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
8831 */
8832Process *
8833process_proxy_new_sync (
8834 GDBusConnection *connection,
8835 GDBusProxyFlags flags,
8836 const gchar *name,
8837 const gchar *object_path,
8838 GCancellable *cancellable,
8839 GError **error)
8840{
8841 GInitable *ret;
8842 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);
8843 if (ret != NULL)
8844 return PROCESS (ret);
8845 else
8846 return NULL;
8847}
8848
8849
8850/**
8851 * process_proxy_new_for_bus:
8852 * @bus_type: A #GBusType.
8853 * @flags: Flags from the #GDBusProxyFlags enumeration.
8854 * @name: A bus name (well-known or unique).
8855 * @object_path: An object path.
8856 * @cancellable: (allow-none): A #GCancellable or %NULL.
8857 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
8858 * @user_data: User data to pass to @callback.
8859 *
8860 * Like process_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
8861 *
8862 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
8863 * You can then call process_proxy_new_for_bus_finish() to get the result of the operation.
8864 *
8865 * See process_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
8866 */
8867void
8868process_proxy_new_for_bus (
8869 GBusType bus_type,
8870 GDBusProxyFlags flags,
8871 const gchar *name,
8872 const gchar *object_path,
8873 GCancellable *cancellable,
8874 GAsyncReadyCallback callback,
8875 gpointer user_data)
8876{
8877 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);
8878}
8879
8880/**
8881 * process_proxy_new_for_bus_finish:
8882 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new_for_bus().
8883 * @error: Return location for error or %NULL
8884 *
8885 * Finishes an operation started with process_proxy_new_for_bus().
8886 *
8887 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
8888 */
8889Process *
8890process_proxy_new_for_bus_finish (
8891 GAsyncResult *res,
8892 GError **error)
8893{
8894 GObject *ret;
8895 GObject *source_object;
8896 source_object = g_async_result_get_source_object (res);
8897 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
8898 g_object_unref (source_object);
8899 if (ret != NULL)
8900 return PROCESS (ret);
8901 else
8902 return NULL;
8903}
8904
8905/**
8906 * process_proxy_new_for_bus_sync:
8907 * @bus_type: A #GBusType.
8908 * @flags: Flags from the #GDBusProxyFlags enumeration.
8909 * @name: A bus name (well-known or unique).
8910 * @object_path: An object path.
8911 * @cancellable: (allow-none): A #GCancellable or %NULL.
8912 * @error: Return location for error or %NULL
8913 *
8914 * Like process_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
8915 *
8916 * The calling thread is blocked until a reply is received.
8917 *
8918 * See process_proxy_new_for_bus() for the asynchronous version of this constructor.
8919 *
8920 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
8921 */
8922Process *
8923process_proxy_new_for_bus_sync (
8924 GBusType bus_type,
8925 GDBusProxyFlags flags,
8926 const gchar *name,
8927 const gchar *object_path,
8928 GCancellable *cancellable,
8929 GError **error)
8930{
8931 GInitable *ret;
8932 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);
8933 if (ret != NULL)
8934 return PROCESS (ret);
8935 else
8936 return NULL;
8937}
8938
8939
8940/* ------------------------------------------------------------------------ */
8941
8942/**
8943 * ProcessSkeleton:
8944 *
8945 * The #ProcessSkeleton structure contains only private data and should only be accessed using the provided API.
8946 */
8947
8948/**
8949 * ProcessSkeletonClass:
8950 * @parent_class: The parent class.
8951 *
8952 * Class structure for #ProcessSkeleton.
8953 */
8954
8955struct _ProcessSkeletonPrivate
8956{
8957 GValue *properties;
8958 GList *changed_properties;
8959 GSource *changed_properties_idle_source;
8960 GMainContext *context;
8961 GMutex lock;
8962};
8963
8964static void
8965_process_skeleton_handle_method_call (
8966 GDBusConnection *connection G_GNUC_UNUSED,
8967 const gchar *sender G_GNUC_UNUSED,
8968 const gchar *object_path G_GNUC_UNUSED,
8969 const gchar *interface_name,
8970 const gchar *method_name,
8971 GVariant *parameters,
8972 GDBusMethodInvocation *invocation,
8973 gpointer user_data)
8974{
8975 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
8976 _ExtendedGDBusMethodInfo *info;
8977 GVariantIter iter;
8978 GVariant *child;
8979 GValue *paramv;
8980 guint num_params;
8981 guint num_extra;
8982 guint n;
8983 guint signal_id;
8984 GValue return_value = G_VALUE_INIT;
8985 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
8986 g_assert (info != NULL);
8987 num_params = g_variant_n_children (parameters);
8988 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
8989 n = 0;
8990 g_value_init (&paramv[n], TYPE_PROCESS);
8991 g_value_set_object (&paramv[n++], skeleton);
8992 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
8993 g_value_set_object (&paramv[n++], invocation);
8994 if (info->pass_fdlist)
8995 {
8996#ifdef G_OS_UNIX
8997 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
8998 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
8999#else
9000 g_assert_not_reached ();
9001#endif
9002 }
9003 g_variant_iter_init (&iter, parameters);
9004 while ((child = g_variant_iter_next_value (&iter)) != NULL)
9005 {
9006 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
9007 if (arg_info->use_gvariant)
9008 {
9009 g_value_init (&paramv[n], G_TYPE_VARIANT);
9010 g_value_set_variant (&paramv[n], child);
9011 n++;
9012 }
9013 else
9014 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
9015 g_variant_unref (child);
9016 }
9017 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS);
9018 g_value_init (&return_value, G_TYPE_BOOLEAN);
9019 g_signal_emitv (paramv, signal_id, 0, &return_value);
9020 if (!g_value_get_boolean (&return_value))
9021 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);
9022 g_value_unset (&return_value);
9023 for (n = 0; n < num_params + num_extra; n++)
9024 g_value_unset (&paramv[n]);
9025 g_free (paramv);
9026}
9027
9028static GVariant *
9029_process_skeleton_handle_get_property (
9030 GDBusConnection *connection G_GNUC_UNUSED,
9031 const gchar *sender G_GNUC_UNUSED,
9032 const gchar *object_path G_GNUC_UNUSED,
9033 const gchar *interface_name G_GNUC_UNUSED,
9034 const gchar *property_name,
9035 GError **error,
9036 gpointer user_data)
9037{
9038 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
9039 GValue value = G_VALUE_INIT;
9040 GParamSpec *pspec;
9041 _ExtendedGDBusPropertyInfo *info;
9042 GVariant *ret;
9043 ret = NULL;
9044 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name);
9045 g_assert (info != NULL);
9046 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
9047 if (pspec == NULL)
9048 {
9049 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
9050 }
9051 else
9052 {
9053 g_value_init (&value, pspec->value_type);
9054 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
9055 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
9056 g_value_unset (&value);
9057 }
9058 return ret;
9059}
9060
9061static gboolean
9062_process_skeleton_handle_set_property (
9063 GDBusConnection *connection G_GNUC_UNUSED,
9064 const gchar *sender G_GNUC_UNUSED,
9065 const gchar *object_path G_GNUC_UNUSED,
9066 const gchar *interface_name G_GNUC_UNUSED,
9067 const gchar *property_name,
9068 GVariant *variant,
9069 GError **error,
9070 gpointer user_data)
9071{
9072 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
9073 GValue value = G_VALUE_INIT;
9074 GParamSpec *pspec;
9075 _ExtendedGDBusPropertyInfo *info;
9076 gboolean ret;
9077 ret = FALSE;
9078 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name);
9079 g_assert (info != NULL);
9080 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
9081 if (pspec == NULL)
9082 {
9083 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
9084 }
9085 else
9086 {
9087 if (info->use_gvariant)
9088 g_value_set_variant (&value, variant);
9089 else
9090 g_dbus_gvariant_to_gvalue (variant, &value);
9091 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
9092 g_value_unset (&value);
9093 ret = TRUE;
9094 }
9095 return ret;
9096}
9097
9098static const GDBusInterfaceVTable _process_skeleton_vtable =
9099{
9100 _process_skeleton_handle_method_call,
9101 _process_skeleton_handle_get_property,
9102 _process_skeleton_handle_set_property,
9103 {NULL}
9104};
9105
9106static GDBusInterfaceInfo *
9107process_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
9108{
9109 return process_interface_info ();
9110}
9111
9112static GDBusInterfaceVTable *
9113process_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
9114{
9115 return (GDBusInterfaceVTable *) &_process_skeleton_vtable;
9116}
9117
9118static GVariant *
9119process_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
9120{
9121 ProcessSkeleton *skeleton = PROCESS_SKELETON (_skeleton);
9122
9123 GVariantBuilder builder;
9124 guint n;
9125 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
9126 if (_process_interface_info.parent_struct.properties == NULL)
9127 goto out;
9128 for (n = 0; _process_interface_info.parent_struct.properties[n] != NULL; n++)
9129 {
9130 GDBusPropertyInfo *info = _process_interface_info.parent_struct.properties[n];
9131 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
9132 {
9133 GVariant *value;
9134 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);
9135 if (value != NULL)
9136 {
9137 g_variant_take_ref (value);
9138 g_variant_builder_add (&builder, "{sv}", info->name, value);
9139 g_variant_unref (value);
9140 }
9141 }
9142 }
9143out:
9144 return g_variant_builder_end (&builder);
9145}
9146
9147static void
9148process_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
9149{
9150}
9151
9152static void process_skeleton_iface_init (ProcessIface *iface);
9153#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9154G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
9155 G_ADD_PRIVATE (ProcessSkeleton)
9156 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init));
9157
9158#else
9159G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
9160 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init));
9161
9162#endif
9163static void
9164process_skeleton_finalize (GObject *object)
9165{
9166 ProcessSkeleton *skeleton = PROCESS_SKELETON (object);
9167 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
9168 if (skeleton->priv->changed_properties_idle_source != NULL)
9169 g_source_destroy (skeleton->priv->changed_properties_idle_source);
9170 g_main_context_unref (skeleton->priv->context);
9171 g_mutex_clear (&skeleton->priv->lock);
9172 G_OBJECT_CLASS (process_skeleton_parent_class)->finalize (object);
9173}
9174
9175static void
9176process_skeleton_init (ProcessSkeleton *skeleton)
9177{
9178#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9179 skeleton->priv = process_skeleton_get_instance_private (skeleton);
9180#else
9181 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_PROCESS_SKELETON, ProcessSkeletonPrivate);
9182#endif
9183
9184 g_mutex_init (&skeleton->priv->lock);
9185 skeleton->priv->context = g_main_context_ref_thread_default ();
9186}
9187
9188static void
9189process_skeleton_class_init (ProcessSkeletonClass *klass)
9190{
9191 GObjectClass *gobject_class;
9192 GDBusInterfaceSkeletonClass *skeleton_class;
9193
9194 gobject_class = G_OBJECT_CLASS (klass);
9195 gobject_class->finalize = process_skeleton_finalize;
9196
9197 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
9198 skeleton_class->get_info = process_skeleton_dbus_interface_get_info;
9199 skeleton_class->get_properties = process_skeleton_dbus_interface_get_properties;
9200 skeleton_class->flush = process_skeleton_dbus_interface_flush;
9201 skeleton_class->get_vtable = process_skeleton_dbus_interface_get_vtable;
9202
9203#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
9204 g_type_class_add_private (klass, sizeof (ProcessSkeletonPrivate));
9205#endif
9206}
9207
9208static void
9209process_skeleton_iface_init (ProcessIface *iface)
9210{
9211}
9212
9213/**
9214 * process_skeleton_new:
9215 *
9216 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
9217 *
9218 * Returns: (transfer full) (type ProcessSkeleton): The skeleton object.
9219 */
9220Process *
9221process_skeleton_new (void)
9222{
9223 return PROCESS (g_object_new (TYPE_PROCESS_SKELETON, NULL));
9224}
9225
9226/* ------------------------------------------------------------------------
Norman James18998182015-10-11 21:54:53 -05009227 * Code for interface org.openbmc.SharedResource
9228 * ------------------------------------------------------------------------
9229 */
9230
9231/**
9232 * SECTION:SharedResource
9233 * @title: SharedResource
9234 * @short_description: Generated C code for the org.openbmc.SharedResource D-Bus interface
9235 *
9236 * 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.
9237 */
9238
9239/* ---- Introspection data for org.openbmc.SharedResource ---- */
9240
9241static const _ExtendedGDBusArgInfo _shared_resource_method_info_lock_IN_ARG_name =
9242{
9243 {
9244 -1,
9245 (gchar *) "name",
9246 (gchar *) "s",
9247 NULL
9248 },
9249 FALSE
9250};
9251
9252static const _ExtendedGDBusArgInfo * const _shared_resource_method_info_lock_IN_ARG_pointers[] =
9253{
9254 &_shared_resource_method_info_lock_IN_ARG_name,
9255 NULL
9256};
9257
9258static const _ExtendedGDBusMethodInfo _shared_resource_method_info_lock =
9259{
9260 {
9261 -1,
9262 (gchar *) "lock",
9263 (GDBusArgInfo **) &_shared_resource_method_info_lock_IN_ARG_pointers,
9264 NULL,
9265 NULL
9266 },
9267 "handle-lock",
9268 FALSE
9269};
9270
9271static const _ExtendedGDBusMethodInfo _shared_resource_method_info_unlock =
9272{
9273 {
9274 -1,
9275 (gchar *) "unlock",
9276 NULL,
9277 NULL,
9278 NULL
9279 },
9280 "handle-unlock",
9281 FALSE
9282};
9283
9284static const _ExtendedGDBusArgInfo _shared_resource_method_info_is_locked_OUT_ARG_lock =
9285{
9286 {
9287 -1,
9288 (gchar *) "lock",
9289 (gchar *) "b",
9290 NULL
9291 },
9292 FALSE
9293};
9294
9295static const _ExtendedGDBusArgInfo _shared_resource_method_info_is_locked_OUT_ARG_name =
9296{
9297 {
9298 -1,
9299 (gchar *) "name",
9300 (gchar *) "s",
9301 NULL
9302 },
9303 FALSE
9304};
9305
9306static const _ExtendedGDBusArgInfo * const _shared_resource_method_info_is_locked_OUT_ARG_pointers[] =
9307{
9308 &_shared_resource_method_info_is_locked_OUT_ARG_lock,
9309 &_shared_resource_method_info_is_locked_OUT_ARG_name,
9310 NULL
9311};
9312
9313static const _ExtendedGDBusMethodInfo _shared_resource_method_info_is_locked =
9314{
9315 {
9316 -1,
9317 (gchar *) "isLocked",
9318 NULL,
9319 (GDBusArgInfo **) &_shared_resource_method_info_is_locked_OUT_ARG_pointers,
9320 NULL
9321 },
9322 "handle-is-locked",
9323 FALSE
9324};
9325
9326static const _ExtendedGDBusMethodInfo * const _shared_resource_method_info_pointers[] =
9327{
9328 &_shared_resource_method_info_lock,
9329 &_shared_resource_method_info_unlock,
9330 &_shared_resource_method_info_is_locked,
9331 NULL
9332};
9333
9334static const _ExtendedGDBusPropertyInfo _shared_resource_property_info_lock =
9335{
9336 {
9337 -1,
9338 (gchar *) "lock",
9339 (gchar *) "b",
9340 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
9341 NULL
9342 },
9343 "lock",
9344 FALSE
9345};
9346
9347static const _ExtendedGDBusPropertyInfo _shared_resource_property_info_name =
9348{
9349 {
9350 -1,
9351 (gchar *) "name",
9352 (gchar *) "s",
9353 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
9354 NULL
9355 },
9356 "name",
9357 FALSE
9358};
9359
9360static const _ExtendedGDBusPropertyInfo * const _shared_resource_property_info_pointers[] =
9361{
9362 &_shared_resource_property_info_lock,
9363 &_shared_resource_property_info_name,
9364 NULL
9365};
9366
9367static const _ExtendedGDBusInterfaceInfo _shared_resource_interface_info =
9368{
9369 {
9370 -1,
9371 (gchar *) "org.openbmc.SharedResource",
9372 (GDBusMethodInfo **) &_shared_resource_method_info_pointers,
9373 NULL,
9374 (GDBusPropertyInfo **) &_shared_resource_property_info_pointers,
9375 NULL
9376 },
9377 "shared-resource",
9378};
9379
9380
9381/**
9382 * shared_resource_interface_info:
9383 *
9384 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> D-Bus interface.
9385 *
9386 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
9387 */
9388GDBusInterfaceInfo *
9389shared_resource_interface_info (void)
9390{
9391 return (GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct;
9392}
9393
9394/**
9395 * shared_resource_override_properties:
9396 * @klass: The class structure for a #GObject<!-- -->-derived class.
9397 * @property_id_begin: The property id to assign to the first overridden property.
9398 *
9399 * Overrides all #GObject properties in the #SharedResource interface for a concrete class.
9400 * The properties are overridden in the order they are defined.
9401 *
9402 * Returns: The last property id.
9403 */
9404guint
9405shared_resource_override_properties (GObjectClass *klass, guint property_id_begin)
9406{
9407 g_object_class_override_property (klass, property_id_begin++, "lock");
9408 g_object_class_override_property (klass, property_id_begin++, "name");
9409 return property_id_begin - 1;
9410}
9411
9412
9413
9414/**
9415 * SharedResource:
9416 *
9417 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>.
9418 */
9419
9420/**
9421 * SharedResourceIface:
9422 * @parent_iface: The parent interface.
9423 * @handle_is_locked: Handler for the #SharedResource::handle-is-locked signal.
9424 * @handle_lock: Handler for the #SharedResource::handle-lock signal.
9425 * @handle_unlock: Handler for the #SharedResource::handle-unlock signal.
9426 * @get_lock: Getter for the #SharedResource:lock property.
9427 * @get_name: Getter for the #SharedResource:name property.
9428 *
9429 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>.
9430 */
9431
9432typedef SharedResourceIface SharedResourceInterface;
9433G_DEFINE_INTERFACE (SharedResource, shared_resource, G_TYPE_OBJECT);
9434
9435static void
9436shared_resource_default_init (SharedResourceIface *iface)
9437{
9438 /* GObject signals for incoming D-Bus method calls: */
9439 /**
9440 * SharedResource::handle-lock:
9441 * @object: A #SharedResource.
9442 * @invocation: A #GDBusMethodInvocation.
9443 * @arg_name: Argument passed by remote caller.
9444 *
9445 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method.
9446 *
9447 * 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.
9448 *
9449 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
9450 */
9451 g_signal_new ("handle-lock",
9452 G_TYPE_FROM_INTERFACE (iface),
9453 G_SIGNAL_RUN_LAST,
9454 G_STRUCT_OFFSET (SharedResourceIface, handle_lock),
9455 g_signal_accumulator_true_handled,
9456 NULL,
9457 g_cclosure_marshal_generic,
9458 G_TYPE_BOOLEAN,
9459 2,
9460 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
9461
9462 /**
9463 * SharedResource::handle-unlock:
9464 * @object: A #SharedResource.
9465 * @invocation: A #GDBusMethodInvocation.
9466 *
9467 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method.
9468 *
9469 * 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.
9470 *
9471 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
9472 */
9473 g_signal_new ("handle-unlock",
9474 G_TYPE_FROM_INTERFACE (iface),
9475 G_SIGNAL_RUN_LAST,
9476 G_STRUCT_OFFSET (SharedResourceIface, handle_unlock),
9477 g_signal_accumulator_true_handled,
9478 NULL,
9479 g_cclosure_marshal_generic,
9480 G_TYPE_BOOLEAN,
9481 1,
9482 G_TYPE_DBUS_METHOD_INVOCATION);
9483
9484 /**
9485 * SharedResource::handle-is-locked:
9486 * @object: A #SharedResource.
9487 * @invocation: A #GDBusMethodInvocation.
9488 *
9489 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method.
9490 *
9491 * 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.
9492 *
9493 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
9494 */
9495 g_signal_new ("handle-is-locked",
9496 G_TYPE_FROM_INTERFACE (iface),
9497 G_SIGNAL_RUN_LAST,
9498 G_STRUCT_OFFSET (SharedResourceIface, handle_is_locked),
9499 g_signal_accumulator_true_handled,
9500 NULL,
9501 g_cclosure_marshal_generic,
9502 G_TYPE_BOOLEAN,
9503 1,
9504 G_TYPE_DBUS_METHOD_INVOCATION);
9505
9506 /* GObject properties for D-Bus properties: */
9507 /**
9508 * SharedResource:lock:
9509 *
9510 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link>.
9511 *
9512 * 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.
9513 */
9514 g_object_interface_install_property (iface,
9515 g_param_spec_boolean ("lock", "lock", "lock", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
9516 /**
9517 * SharedResource:name:
9518 *
9519 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link>.
9520 *
9521 * 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.
9522 */
9523 g_object_interface_install_property (iface,
9524 g_param_spec_string ("name", "name", "name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
9525}
9526
9527/**
9528 * shared_resource_get_lock: (skip)
9529 * @object: A #SharedResource.
9530 *
9531 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link> D-Bus property.
9532 *
9533 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
9534 *
9535 * Returns: The property value.
9536 */
9537gboolean
9538shared_resource_get_lock (SharedResource *object)
9539{
9540 return SHARED_RESOURCE_GET_IFACE (object)->get_lock (object);
9541}
9542
9543/**
9544 * shared_resource_set_lock: (skip)
9545 * @object: A #SharedResource.
9546 * @value: The value to set.
9547 *
9548 * Sets the <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link> D-Bus property to @value.
9549 *
9550 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
9551 */
9552void
9553shared_resource_set_lock (SharedResource *object, gboolean value)
9554{
9555 g_object_set (G_OBJECT (object), "lock", value, NULL);
9556}
9557
9558/**
9559 * shared_resource_get_name: (skip)
9560 * @object: A #SharedResource.
9561 *
9562 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property.
9563 *
9564 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
9565 *
9566 * <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>
9567 *
9568 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
9569 */
9570const gchar *
9571shared_resource_get_name (SharedResource *object)
9572{
9573 return SHARED_RESOURCE_GET_IFACE (object)->get_name (object);
9574}
9575
9576/**
9577 * shared_resource_dup_name: (skip)
9578 * @object: A #SharedResource.
9579 *
9580 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property.
9581 *
9582 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
9583 *
9584 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
9585 */
9586gchar *
9587shared_resource_dup_name (SharedResource *object)
9588{
9589 gchar *value;
9590 g_object_get (G_OBJECT (object), "name", &value, NULL);
9591 return value;
9592}
9593
9594/**
9595 * shared_resource_set_name: (skip)
9596 * @object: A #SharedResource.
9597 * @value: The value to set.
9598 *
9599 * Sets the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property to @value.
9600 *
9601 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
9602 */
9603void
9604shared_resource_set_name (SharedResource *object, const gchar *value)
9605{
9606 g_object_set (G_OBJECT (object), "name", value, NULL);
9607}
9608
9609/**
9610 * shared_resource_call_lock:
9611 * @proxy: A #SharedResourceProxy.
9612 * @arg_name: Argument to pass with the method invocation.
9613 * @cancellable: (allow-none): A #GCancellable or %NULL.
9614 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
9615 * @user_data: User data to pass to @callback.
9616 *
9617 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method on @proxy.
9618 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
9619 * You can then call shared_resource_call_lock_finish() to get the result of the operation.
9620 *
9621 * See shared_resource_call_lock_sync() for the synchronous, blocking version of this method.
9622 */
9623void
9624shared_resource_call_lock (
9625 SharedResource *proxy,
9626 const gchar *arg_name,
9627 GCancellable *cancellable,
9628 GAsyncReadyCallback callback,
9629 gpointer user_data)
9630{
9631 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
9632 "lock",
9633 g_variant_new ("(s)",
9634 arg_name),
9635 G_DBUS_CALL_FLAGS_NONE,
9636 -1,
9637 cancellable,
9638 callback,
9639 user_data);
9640}
9641
9642/**
9643 * shared_resource_call_lock_finish:
9644 * @proxy: A #SharedResourceProxy.
9645 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_lock().
9646 * @error: Return location for error or %NULL.
9647 *
9648 * Finishes an operation started with shared_resource_call_lock().
9649 *
9650 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
9651 */
9652gboolean
9653shared_resource_call_lock_finish (
9654 SharedResource *proxy,
9655 GAsyncResult *res,
9656 GError **error)
9657{
9658 GVariant *_ret;
9659 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
9660 if (_ret == NULL)
9661 goto _out;
9662 g_variant_get (_ret,
9663 "()");
9664 g_variant_unref (_ret);
9665_out:
9666 return _ret != NULL;
9667}
9668
9669/**
9670 * shared_resource_call_lock_sync:
9671 * @proxy: A #SharedResourceProxy.
9672 * @arg_name: Argument to pass with the method invocation.
9673 * @cancellable: (allow-none): A #GCancellable or %NULL.
9674 * @error: Return location for error or %NULL.
9675 *
9676 * 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.
9677 *
9678 * See shared_resource_call_lock() for the asynchronous version of this method.
9679 *
9680 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
9681 */
9682gboolean
9683shared_resource_call_lock_sync (
9684 SharedResource *proxy,
9685 const gchar *arg_name,
9686 GCancellable *cancellable,
9687 GError **error)
9688{
9689 GVariant *_ret;
9690 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
9691 "lock",
9692 g_variant_new ("(s)",
9693 arg_name),
9694 G_DBUS_CALL_FLAGS_NONE,
9695 -1,
9696 cancellable,
9697 error);
9698 if (_ret == NULL)
9699 goto _out;
9700 g_variant_get (_ret,
9701 "()");
9702 g_variant_unref (_ret);
9703_out:
9704 return _ret != NULL;
9705}
9706
9707/**
9708 * shared_resource_call_unlock:
9709 * @proxy: A #SharedResourceProxy.
9710 * @cancellable: (allow-none): A #GCancellable or %NULL.
9711 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
9712 * @user_data: User data to pass to @callback.
9713 *
9714 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method on @proxy.
9715 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
9716 * You can then call shared_resource_call_unlock_finish() to get the result of the operation.
9717 *
9718 * See shared_resource_call_unlock_sync() for the synchronous, blocking version of this method.
9719 */
9720void
9721shared_resource_call_unlock (
9722 SharedResource *proxy,
9723 GCancellable *cancellable,
9724 GAsyncReadyCallback callback,
9725 gpointer user_data)
9726{
9727 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
9728 "unlock",
9729 g_variant_new ("()"),
9730 G_DBUS_CALL_FLAGS_NONE,
9731 -1,
9732 cancellable,
9733 callback,
9734 user_data);
9735}
9736
9737/**
9738 * shared_resource_call_unlock_finish:
9739 * @proxy: A #SharedResourceProxy.
9740 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_unlock().
9741 * @error: Return location for error or %NULL.
9742 *
9743 * Finishes an operation started with shared_resource_call_unlock().
9744 *
9745 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
9746 */
9747gboolean
9748shared_resource_call_unlock_finish (
9749 SharedResource *proxy,
9750 GAsyncResult *res,
9751 GError **error)
9752{
9753 GVariant *_ret;
9754 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
9755 if (_ret == NULL)
9756 goto _out;
9757 g_variant_get (_ret,
9758 "()");
9759 g_variant_unref (_ret);
9760_out:
9761 return _ret != NULL;
9762}
9763
9764/**
9765 * shared_resource_call_unlock_sync:
9766 * @proxy: A #SharedResourceProxy.
9767 * @cancellable: (allow-none): A #GCancellable or %NULL.
9768 * @error: Return location for error or %NULL.
9769 *
9770 * 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.
9771 *
9772 * See shared_resource_call_unlock() for the asynchronous version of this method.
9773 *
9774 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
9775 */
9776gboolean
9777shared_resource_call_unlock_sync (
9778 SharedResource *proxy,
9779 GCancellable *cancellable,
9780 GError **error)
9781{
9782 GVariant *_ret;
9783 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
9784 "unlock",
9785 g_variant_new ("()"),
9786 G_DBUS_CALL_FLAGS_NONE,
9787 -1,
9788 cancellable,
9789 error);
9790 if (_ret == NULL)
9791 goto _out;
9792 g_variant_get (_ret,
9793 "()");
9794 g_variant_unref (_ret);
9795_out:
9796 return _ret != NULL;
9797}
9798
9799/**
9800 * shared_resource_call_is_locked:
9801 * @proxy: A #SharedResourceProxy.
9802 * @cancellable: (allow-none): A #GCancellable or %NULL.
9803 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
9804 * @user_data: User data to pass to @callback.
9805 *
9806 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method on @proxy.
9807 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
9808 * You can then call shared_resource_call_is_locked_finish() to get the result of the operation.
9809 *
9810 * See shared_resource_call_is_locked_sync() for the synchronous, blocking version of this method.
9811 */
9812void
9813shared_resource_call_is_locked (
9814 SharedResource *proxy,
9815 GCancellable *cancellable,
9816 GAsyncReadyCallback callback,
9817 gpointer user_data)
9818{
9819 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
9820 "isLocked",
9821 g_variant_new ("()"),
9822 G_DBUS_CALL_FLAGS_NONE,
9823 -1,
9824 cancellable,
9825 callback,
9826 user_data);
9827}
9828
9829/**
9830 * shared_resource_call_is_locked_finish:
9831 * @proxy: A #SharedResourceProxy.
9832 * @out_lock: (out): Return location for return parameter or %NULL to ignore.
9833 * @out_name: (out): Return location for return parameter or %NULL to ignore.
9834 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_is_locked().
9835 * @error: Return location for error or %NULL.
9836 *
9837 * Finishes an operation started with shared_resource_call_is_locked().
9838 *
9839 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
9840 */
9841gboolean
9842shared_resource_call_is_locked_finish (
9843 SharedResource *proxy,
9844 gboolean *out_lock,
9845 gchar **out_name,
9846 GAsyncResult *res,
9847 GError **error)
9848{
9849 GVariant *_ret;
9850 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
9851 if (_ret == NULL)
9852 goto _out;
9853 g_variant_get (_ret,
9854 "(bs)",
9855 out_lock,
9856 out_name);
9857 g_variant_unref (_ret);
9858_out:
9859 return _ret != NULL;
9860}
9861
9862/**
9863 * shared_resource_call_is_locked_sync:
9864 * @proxy: A #SharedResourceProxy.
9865 * @out_lock: (out): Return location for return parameter or %NULL to ignore.
9866 * @out_name: (out): Return location for return parameter or %NULL to ignore.
9867 * @cancellable: (allow-none): A #GCancellable or %NULL.
9868 * @error: Return location for error or %NULL.
9869 *
9870 * 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.
9871 *
9872 * See shared_resource_call_is_locked() for the asynchronous version of this method.
9873 *
9874 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
9875 */
9876gboolean
9877shared_resource_call_is_locked_sync (
9878 SharedResource *proxy,
9879 gboolean *out_lock,
9880 gchar **out_name,
9881 GCancellable *cancellable,
9882 GError **error)
9883{
9884 GVariant *_ret;
9885 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
9886 "isLocked",
9887 g_variant_new ("()"),
9888 G_DBUS_CALL_FLAGS_NONE,
9889 -1,
9890 cancellable,
9891 error);
9892 if (_ret == NULL)
9893 goto _out;
9894 g_variant_get (_ret,
9895 "(bs)",
9896 out_lock,
9897 out_name);
9898 g_variant_unref (_ret);
9899_out:
9900 return _ret != NULL;
9901}
9902
9903/**
9904 * shared_resource_complete_lock:
9905 * @object: A #SharedResource.
9906 * @invocation: (transfer full): A #GDBusMethodInvocation.
9907 *
9908 * 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.
9909 *
9910 * This method will free @invocation, you cannot use it afterwards.
9911 */
9912void
9913shared_resource_complete_lock (
9914 SharedResource *object,
9915 GDBusMethodInvocation *invocation)
9916{
9917 g_dbus_method_invocation_return_value (invocation,
9918 g_variant_new ("()"));
9919}
9920
9921/**
9922 * shared_resource_complete_unlock:
9923 * @object: A #SharedResource.
9924 * @invocation: (transfer full): A #GDBusMethodInvocation.
9925 *
9926 * 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.
9927 *
9928 * This method will free @invocation, you cannot use it afterwards.
9929 */
9930void
9931shared_resource_complete_unlock (
9932 SharedResource *object,
9933 GDBusMethodInvocation *invocation)
9934{
9935 g_dbus_method_invocation_return_value (invocation,
9936 g_variant_new ("()"));
9937}
9938
9939/**
9940 * shared_resource_complete_is_locked:
9941 * @object: A #SharedResource.
9942 * @invocation: (transfer full): A #GDBusMethodInvocation.
9943 * @lock: Parameter to return.
9944 * @name: Parameter to return.
9945 *
9946 * 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.
9947 *
9948 * This method will free @invocation, you cannot use it afterwards.
9949 */
9950void
9951shared_resource_complete_is_locked (
9952 SharedResource *object,
9953 GDBusMethodInvocation *invocation,
9954 gboolean lock,
9955 const gchar *name)
9956{
9957 g_dbus_method_invocation_return_value (invocation,
9958 g_variant_new ("(bs)",
9959 lock,
9960 name));
9961}
9962
9963/* ------------------------------------------------------------------------ */
9964
9965/**
9966 * SharedResourceProxy:
9967 *
9968 * The #SharedResourceProxy structure contains only private data and should only be accessed using the provided API.
9969 */
9970
9971/**
9972 * SharedResourceProxyClass:
9973 * @parent_class: The parent class.
9974 *
9975 * Class structure for #SharedResourceProxy.
9976 */
9977
9978struct _SharedResourceProxyPrivate
9979{
9980 GData *qdata;
9981};
9982
9983static void shared_resource_proxy_iface_init (SharedResourceIface *iface);
9984
9985#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9986G_DEFINE_TYPE_WITH_CODE (SharedResourceProxy, shared_resource_proxy, G_TYPE_DBUS_PROXY,
9987 G_ADD_PRIVATE (SharedResourceProxy)
9988 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_proxy_iface_init));
9989
9990#else
9991G_DEFINE_TYPE_WITH_CODE (SharedResourceProxy, shared_resource_proxy, G_TYPE_DBUS_PROXY,
9992 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_proxy_iface_init));
9993
9994#endif
9995static void
9996shared_resource_proxy_finalize (GObject *object)
9997{
9998 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object);
9999 g_datalist_clear (&proxy->priv->qdata);
10000 G_OBJECT_CLASS (shared_resource_proxy_parent_class)->finalize (object);
10001}
10002
10003static void
10004shared_resource_proxy_get_property (GObject *object,
10005 guint prop_id,
10006 GValue *value,
10007 GParamSpec *pspec G_GNUC_UNUSED)
10008{
10009 const _ExtendedGDBusPropertyInfo *info;
10010 GVariant *variant;
10011 g_assert (prop_id != 0 && prop_id - 1 < 2);
10012 info = _shared_resource_property_info_pointers[prop_id - 1];
10013 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
10014 if (info->use_gvariant)
10015 {
10016 g_value_set_variant (value, variant);
10017 }
10018 else
10019 {
10020 if (variant != NULL)
10021 g_dbus_gvariant_to_gvalue (variant, value);
10022 }
10023 if (variant != NULL)
10024 g_variant_unref (variant);
10025}
10026
10027static void
10028shared_resource_proxy_set_property_cb (GDBusProxy *proxy,
10029 GAsyncResult *res,
10030 gpointer user_data)
10031{
10032 const _ExtendedGDBusPropertyInfo *info = user_data;
10033 GError *error;
10034 GVariant *_ret;
10035 error = NULL;
10036 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
10037 if (!_ret)
10038 {
10039 g_warning ("Error setting property '%s' on interface org.openbmc.SharedResource: %s (%s, %d)",
10040 info->parent_struct.name,
10041 error->message, g_quark_to_string (error->domain), error->code);
10042 g_error_free (error);
10043 }
10044 else
10045 {
10046 g_variant_unref (_ret);
10047 }
10048}
10049
10050static void
10051shared_resource_proxy_set_property (GObject *object,
10052 guint prop_id,
10053 const GValue *value,
10054 GParamSpec *pspec G_GNUC_UNUSED)
10055{
10056 const _ExtendedGDBusPropertyInfo *info;
10057 GVariant *variant;
10058 g_assert (prop_id != 0 && prop_id - 1 < 2);
10059 info = _shared_resource_property_info_pointers[prop_id - 1];
10060 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
10061 g_dbus_proxy_call (G_DBUS_PROXY (object),
10062 "org.freedesktop.DBus.Properties.Set",
10063 g_variant_new ("(ssv)", "org.openbmc.SharedResource", info->parent_struct.name, variant),
10064 G_DBUS_CALL_FLAGS_NONE,
10065 -1,
10066 NULL, (GAsyncReadyCallback) shared_resource_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
10067 g_variant_unref (variant);
10068}
10069
10070static void
10071shared_resource_proxy_g_signal (GDBusProxy *proxy,
10072 const gchar *sender_name G_GNUC_UNUSED,
10073 const gchar *signal_name,
10074 GVariant *parameters)
10075{
10076 _ExtendedGDBusSignalInfo *info;
10077 GVariantIter iter;
10078 GVariant *child;
10079 GValue *paramv;
10080 guint num_params;
10081 guint n;
10082 guint signal_id;
10083 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, signal_name);
10084 if (info == NULL)
10085 return;
10086 num_params = g_variant_n_children (parameters);
10087 paramv = g_new0 (GValue, num_params + 1);
10088 g_value_init (&paramv[0], TYPE_SHARED_RESOURCE);
10089 g_value_set_object (&paramv[0], proxy);
10090 g_variant_iter_init (&iter, parameters);
10091 n = 1;
10092 while ((child = g_variant_iter_next_value (&iter)) != NULL)
10093 {
10094 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
10095 if (arg_info->use_gvariant)
10096 {
10097 g_value_init (&paramv[n], G_TYPE_VARIANT);
10098 g_value_set_variant (&paramv[n], child);
10099 n++;
10100 }
10101 else
10102 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
10103 g_variant_unref (child);
10104 }
10105 signal_id = g_signal_lookup (info->signal_name, TYPE_SHARED_RESOURCE);
10106 g_signal_emitv (paramv, signal_id, 0, NULL);
10107 for (n = 0; n < num_params + 1; n++)
10108 g_value_unset (&paramv[n]);
10109 g_free (paramv);
10110}
10111
10112static void
10113shared_resource_proxy_g_properties_changed (GDBusProxy *_proxy,
10114 GVariant *changed_properties,
10115 const gchar *const *invalidated_properties)
10116{
10117 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (_proxy);
10118 guint n;
10119 const gchar *key;
10120 GVariantIter *iter;
10121 _ExtendedGDBusPropertyInfo *info;
10122 g_variant_get (changed_properties, "a{sv}", &iter);
10123 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
10124 {
10125 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, key);
10126 g_datalist_remove_data (&proxy->priv->qdata, key);
10127 if (info != NULL)
10128 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
10129 }
10130 g_variant_iter_free (iter);
10131 for (n = 0; invalidated_properties[n] != NULL; n++)
10132 {
10133 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, invalidated_properties[n]);
10134 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
10135 if (info != NULL)
10136 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
10137 }
10138}
10139
10140static gboolean
10141shared_resource_proxy_get_lock (SharedResource *object)
10142{
10143 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object);
10144 GVariant *variant;
10145 gboolean value = 0;
10146 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lock");
10147 if (variant != NULL)
10148 {
10149 value = g_variant_get_boolean (variant);
10150 g_variant_unref (variant);
10151 }
10152 return value;
10153}
10154
10155static const gchar *
10156shared_resource_proxy_get_name (SharedResource *object)
10157{
10158 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object);
10159 GVariant *variant;
10160 const gchar *value = NULL;
10161 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "name");
10162 if (variant != NULL)
10163 {
10164 value = g_variant_get_string (variant, NULL);
10165 g_variant_unref (variant);
10166 }
10167 return value;
10168}
10169
10170static void
10171shared_resource_proxy_init (SharedResourceProxy *proxy)
10172{
10173#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10174 proxy->priv = shared_resource_proxy_get_instance_private (proxy);
10175#else
10176 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SHARED_RESOURCE_PROXY, SharedResourceProxyPrivate);
10177#endif
10178
10179 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), shared_resource_interface_info ());
10180}
10181
10182static void
10183shared_resource_proxy_class_init (SharedResourceProxyClass *klass)
10184{
10185 GObjectClass *gobject_class;
10186 GDBusProxyClass *proxy_class;
10187
10188 gobject_class = G_OBJECT_CLASS (klass);
10189 gobject_class->finalize = shared_resource_proxy_finalize;
10190 gobject_class->get_property = shared_resource_proxy_get_property;
10191 gobject_class->set_property = shared_resource_proxy_set_property;
10192
10193 proxy_class = G_DBUS_PROXY_CLASS (klass);
10194 proxy_class->g_signal = shared_resource_proxy_g_signal;
10195 proxy_class->g_properties_changed = shared_resource_proxy_g_properties_changed;
10196
10197 shared_resource_override_properties (gobject_class, 1);
10198
10199#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
10200 g_type_class_add_private (klass, sizeof (SharedResourceProxyPrivate));
10201#endif
10202}
10203
10204static void
10205shared_resource_proxy_iface_init (SharedResourceIface *iface)
10206{
10207 iface->get_lock = shared_resource_proxy_get_lock;
10208 iface->get_name = shared_resource_proxy_get_name;
10209}
10210
10211/**
10212 * shared_resource_proxy_new:
10213 * @connection: A #GDBusConnection.
10214 * @flags: Flags from the #GDBusProxyFlags enumeration.
10215 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
10216 * @object_path: An object path.
10217 * @cancellable: (allow-none): A #GCancellable or %NULL.
10218 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
10219 * @user_data: User data to pass to @callback.
10220 *
10221 * 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.
10222 *
10223 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
10224 * You can then call shared_resource_proxy_new_finish() to get the result of the operation.
10225 *
10226 * See shared_resource_proxy_new_sync() for the synchronous, blocking version of this constructor.
10227 */
10228void
10229shared_resource_proxy_new (
10230 GDBusConnection *connection,
10231 GDBusProxyFlags flags,
10232 const gchar *name,
10233 const gchar *object_path,
10234 GCancellable *cancellable,
10235 GAsyncReadyCallback callback,
10236 gpointer user_data)
10237{
10238 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);
10239}
10240
10241/**
10242 * shared_resource_proxy_new_finish:
10243 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_proxy_new().
10244 * @error: Return location for error or %NULL
10245 *
10246 * Finishes an operation started with shared_resource_proxy_new().
10247 *
10248 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
10249 */
10250SharedResource *
10251shared_resource_proxy_new_finish (
10252 GAsyncResult *res,
10253 GError **error)
10254{
10255 GObject *ret;
10256 GObject *source_object;
10257 source_object = g_async_result_get_source_object (res);
10258 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
10259 g_object_unref (source_object);
10260 if (ret != NULL)
10261 return SHARED_RESOURCE (ret);
10262 else
10263 return NULL;
10264}
10265
10266/**
10267 * shared_resource_proxy_new_sync:
10268 * @connection: A #GDBusConnection.
10269 * @flags: Flags from the #GDBusProxyFlags enumeration.
10270 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
10271 * @object_path: An object path.
10272 * @cancellable: (allow-none): A #GCancellable or %NULL.
10273 * @error: Return location for error or %NULL
10274 *
10275 * 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.
10276 *
10277 * The calling thread is blocked until a reply is received.
10278 *
10279 * See shared_resource_proxy_new() for the asynchronous version of this constructor.
10280 *
10281 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
10282 */
10283SharedResource *
10284shared_resource_proxy_new_sync (
10285 GDBusConnection *connection,
10286 GDBusProxyFlags flags,
10287 const gchar *name,
10288 const gchar *object_path,
10289 GCancellable *cancellable,
10290 GError **error)
10291{
10292 GInitable *ret;
10293 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);
10294 if (ret != NULL)
10295 return SHARED_RESOURCE (ret);
10296 else
10297 return NULL;
10298}
10299
10300
10301/**
10302 * shared_resource_proxy_new_for_bus:
10303 * @bus_type: A #GBusType.
10304 * @flags: Flags from the #GDBusProxyFlags enumeration.
10305 * @name: A bus name (well-known or unique).
10306 * @object_path: An object path.
10307 * @cancellable: (allow-none): A #GCancellable or %NULL.
10308 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
10309 * @user_data: User data to pass to @callback.
10310 *
10311 * Like shared_resource_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
10312 *
10313 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
10314 * You can then call shared_resource_proxy_new_for_bus_finish() to get the result of the operation.
10315 *
10316 * See shared_resource_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
10317 */
10318void
10319shared_resource_proxy_new_for_bus (
10320 GBusType bus_type,
10321 GDBusProxyFlags flags,
10322 const gchar *name,
10323 const gchar *object_path,
10324 GCancellable *cancellable,
10325 GAsyncReadyCallback callback,
10326 gpointer user_data)
10327{
10328 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);
10329}
10330
10331/**
10332 * shared_resource_proxy_new_for_bus_finish:
10333 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_proxy_new_for_bus().
10334 * @error: Return location for error or %NULL
10335 *
10336 * Finishes an operation started with shared_resource_proxy_new_for_bus().
10337 *
10338 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
10339 */
10340SharedResource *
10341shared_resource_proxy_new_for_bus_finish (
10342 GAsyncResult *res,
10343 GError **error)
10344{
10345 GObject *ret;
10346 GObject *source_object;
10347 source_object = g_async_result_get_source_object (res);
10348 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
10349 g_object_unref (source_object);
10350 if (ret != NULL)
10351 return SHARED_RESOURCE (ret);
10352 else
10353 return NULL;
10354}
10355
10356/**
10357 * shared_resource_proxy_new_for_bus_sync:
10358 * @bus_type: A #GBusType.
10359 * @flags: Flags from the #GDBusProxyFlags enumeration.
10360 * @name: A bus name (well-known or unique).
10361 * @object_path: An object path.
10362 * @cancellable: (allow-none): A #GCancellable or %NULL.
10363 * @error: Return location for error or %NULL
10364 *
10365 * Like shared_resource_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
10366 *
10367 * The calling thread is blocked until a reply is received.
10368 *
10369 * See shared_resource_proxy_new_for_bus() for the asynchronous version of this constructor.
10370 *
10371 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
10372 */
10373SharedResource *
10374shared_resource_proxy_new_for_bus_sync (
10375 GBusType bus_type,
10376 GDBusProxyFlags flags,
10377 const gchar *name,
10378 const gchar *object_path,
10379 GCancellable *cancellable,
10380 GError **error)
10381{
10382 GInitable *ret;
10383 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);
10384 if (ret != NULL)
10385 return SHARED_RESOURCE (ret);
10386 else
10387 return NULL;
10388}
10389
10390
10391/* ------------------------------------------------------------------------ */
10392
10393/**
10394 * SharedResourceSkeleton:
10395 *
10396 * The #SharedResourceSkeleton structure contains only private data and should only be accessed using the provided API.
10397 */
10398
10399/**
10400 * SharedResourceSkeletonClass:
10401 * @parent_class: The parent class.
10402 *
10403 * Class structure for #SharedResourceSkeleton.
10404 */
10405
10406struct _SharedResourceSkeletonPrivate
10407{
10408 GValue *properties;
10409 GList *changed_properties;
10410 GSource *changed_properties_idle_source;
10411 GMainContext *context;
10412 GMutex lock;
10413};
10414
10415static void
10416_shared_resource_skeleton_handle_method_call (
10417 GDBusConnection *connection G_GNUC_UNUSED,
10418 const gchar *sender G_GNUC_UNUSED,
10419 const gchar *object_path G_GNUC_UNUSED,
10420 const gchar *interface_name,
10421 const gchar *method_name,
10422 GVariant *parameters,
10423 GDBusMethodInvocation *invocation,
10424 gpointer user_data)
10425{
10426 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
10427 _ExtendedGDBusMethodInfo *info;
10428 GVariantIter iter;
10429 GVariant *child;
10430 GValue *paramv;
10431 guint num_params;
10432 guint num_extra;
10433 guint n;
10434 guint signal_id;
10435 GValue return_value = G_VALUE_INIT;
10436 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
10437 g_assert (info != NULL);
10438 num_params = g_variant_n_children (parameters);
10439 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
10440 n = 0;
10441 g_value_init (&paramv[n], TYPE_SHARED_RESOURCE);
10442 g_value_set_object (&paramv[n++], skeleton);
10443 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
10444 g_value_set_object (&paramv[n++], invocation);
10445 if (info->pass_fdlist)
10446 {
10447#ifdef G_OS_UNIX
10448 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
10449 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
10450#else
10451 g_assert_not_reached ();
10452#endif
10453 }
10454 g_variant_iter_init (&iter, parameters);
10455 while ((child = g_variant_iter_next_value (&iter)) != NULL)
10456 {
10457 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
10458 if (arg_info->use_gvariant)
10459 {
10460 g_value_init (&paramv[n], G_TYPE_VARIANT);
10461 g_value_set_variant (&paramv[n], child);
10462 n++;
10463 }
10464 else
10465 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
10466 g_variant_unref (child);
10467 }
10468 signal_id = g_signal_lookup (info->signal_name, TYPE_SHARED_RESOURCE);
10469 g_value_init (&return_value, G_TYPE_BOOLEAN);
10470 g_signal_emitv (paramv, signal_id, 0, &return_value);
10471 if (!g_value_get_boolean (&return_value))
10472 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);
10473 g_value_unset (&return_value);
10474 for (n = 0; n < num_params + num_extra; n++)
10475 g_value_unset (&paramv[n]);
10476 g_free (paramv);
10477}
10478
10479static GVariant *
10480_shared_resource_skeleton_handle_get_property (
10481 GDBusConnection *connection G_GNUC_UNUSED,
10482 const gchar *sender G_GNUC_UNUSED,
10483 const gchar *object_path G_GNUC_UNUSED,
10484 const gchar *interface_name G_GNUC_UNUSED,
10485 const gchar *property_name,
10486 GError **error,
10487 gpointer user_data)
10488{
10489 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
10490 GValue value = G_VALUE_INIT;
10491 GParamSpec *pspec;
10492 _ExtendedGDBusPropertyInfo *info;
10493 GVariant *ret;
10494 ret = NULL;
10495 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, property_name);
10496 g_assert (info != NULL);
10497 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
10498 if (pspec == NULL)
10499 {
10500 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
10501 }
10502 else
10503 {
10504 g_value_init (&value, pspec->value_type);
10505 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
10506 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
10507 g_value_unset (&value);
10508 }
10509 return ret;
10510}
10511
10512static gboolean
10513_shared_resource_skeleton_handle_set_property (
10514 GDBusConnection *connection G_GNUC_UNUSED,
10515 const gchar *sender G_GNUC_UNUSED,
10516 const gchar *object_path G_GNUC_UNUSED,
10517 const gchar *interface_name G_GNUC_UNUSED,
10518 const gchar *property_name,
10519 GVariant *variant,
10520 GError **error,
10521 gpointer user_data)
10522{
10523 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
10524 GValue value = G_VALUE_INIT;
10525 GParamSpec *pspec;
10526 _ExtendedGDBusPropertyInfo *info;
10527 gboolean ret;
10528 ret = FALSE;
10529 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, property_name);
10530 g_assert (info != NULL);
10531 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
10532 if (pspec == NULL)
10533 {
10534 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
10535 }
10536 else
10537 {
10538 if (info->use_gvariant)
10539 g_value_set_variant (&value, variant);
10540 else
10541 g_dbus_gvariant_to_gvalue (variant, &value);
10542 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
10543 g_value_unset (&value);
10544 ret = TRUE;
10545 }
10546 return ret;
10547}
10548
10549static const GDBusInterfaceVTable _shared_resource_skeleton_vtable =
10550{
10551 _shared_resource_skeleton_handle_method_call,
10552 _shared_resource_skeleton_handle_get_property,
10553 _shared_resource_skeleton_handle_set_property,
10554 {NULL}
10555};
10556
10557static GDBusInterfaceInfo *
10558shared_resource_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
10559{
10560 return shared_resource_interface_info ();
10561}
10562
10563static GDBusInterfaceVTable *
10564shared_resource_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
10565{
10566 return (GDBusInterfaceVTable *) &_shared_resource_skeleton_vtable;
10567}
10568
10569static GVariant *
10570shared_resource_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
10571{
10572 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (_skeleton);
10573
10574 GVariantBuilder builder;
10575 guint n;
10576 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
10577 if (_shared_resource_interface_info.parent_struct.properties == NULL)
10578 goto out;
10579 for (n = 0; _shared_resource_interface_info.parent_struct.properties[n] != NULL; n++)
10580 {
10581 GDBusPropertyInfo *info = _shared_resource_interface_info.parent_struct.properties[n];
10582 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
10583 {
10584 GVariant *value;
10585 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);
10586 if (value != NULL)
10587 {
10588 g_variant_take_ref (value);
10589 g_variant_builder_add (&builder, "{sv}", info->name, value);
10590 g_variant_unref (value);
10591 }
10592 }
10593 }
10594out:
10595 return g_variant_builder_end (&builder);
10596}
10597
10598static gboolean _shared_resource_emit_changed (gpointer user_data);
10599
10600static void
10601shared_resource_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
10602{
10603 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (_skeleton);
10604 gboolean emit_changed = FALSE;
10605
10606 g_mutex_lock (&skeleton->priv->lock);
10607 if (skeleton->priv->changed_properties_idle_source != NULL)
10608 {
10609 g_source_destroy (skeleton->priv->changed_properties_idle_source);
10610 skeleton->priv->changed_properties_idle_source = NULL;
10611 emit_changed = TRUE;
10612 }
10613 g_mutex_unlock (&skeleton->priv->lock);
10614
10615 if (emit_changed)
10616 _shared_resource_emit_changed (skeleton);
10617}
10618
10619static void shared_resource_skeleton_iface_init (SharedResourceIface *iface);
10620#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10621G_DEFINE_TYPE_WITH_CODE (SharedResourceSkeleton, shared_resource_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
10622 G_ADD_PRIVATE (SharedResourceSkeleton)
10623 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_skeleton_iface_init));
10624
10625#else
10626G_DEFINE_TYPE_WITH_CODE (SharedResourceSkeleton, shared_resource_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
10627 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_skeleton_iface_init));
10628
10629#endif
10630static void
10631shared_resource_skeleton_finalize (GObject *object)
10632{
10633 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
10634 guint n;
10635 for (n = 0; n < 2; n++)
10636 g_value_unset (&skeleton->priv->properties[n]);
10637 g_free (skeleton->priv->properties);
10638 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
10639 if (skeleton->priv->changed_properties_idle_source != NULL)
10640 g_source_destroy (skeleton->priv->changed_properties_idle_source);
10641 g_main_context_unref (skeleton->priv->context);
10642 g_mutex_clear (&skeleton->priv->lock);
10643 G_OBJECT_CLASS (shared_resource_skeleton_parent_class)->finalize (object);
10644}
10645
10646static void
10647shared_resource_skeleton_get_property (GObject *object,
10648 guint prop_id,
10649 GValue *value,
10650 GParamSpec *pspec G_GNUC_UNUSED)
10651{
10652 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
10653 g_assert (prop_id != 0 && prop_id - 1 < 2);
10654 g_mutex_lock (&skeleton->priv->lock);
10655 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
10656 g_mutex_unlock (&skeleton->priv->lock);
10657}
10658
10659static gboolean
10660_shared_resource_emit_changed (gpointer user_data)
10661{
10662 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
10663 GList *l;
10664 GVariantBuilder builder;
10665 GVariantBuilder invalidated_builder;
10666 guint num_changes;
10667
10668 g_mutex_lock (&skeleton->priv->lock);
10669 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
10670 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
10671 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
10672 {
10673 ChangedProperty *cp = l->data;
10674 GVariant *variant;
10675 const GValue *cur_value;
10676
10677 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
10678 if (!_g_value_equal (cur_value, &cp->orig_value))
10679 {
10680 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
10681 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
10682 g_variant_unref (variant);
10683 num_changes++;
10684 }
10685 }
10686 if (num_changes > 0)
10687 {
10688 GList *connections, *ll;
10689 GVariant *signal_variant;
10690 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SharedResource",
10691 &builder, &invalidated_builder));
10692 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
10693 for (ll = connections; ll != NULL; ll = ll->next)
10694 {
10695 GDBusConnection *connection = ll->data;
10696
10697 g_dbus_connection_emit_signal (connection,
10698 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
10699 "org.freedesktop.DBus.Properties",
10700 "PropertiesChanged",
10701 signal_variant,
10702 NULL);
10703 }
10704 g_variant_unref (signal_variant);
10705 g_list_free_full (connections, g_object_unref);
10706 }
10707 else
10708 {
10709 g_variant_builder_clear (&builder);
10710 g_variant_builder_clear (&invalidated_builder);
10711 }
10712 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
10713 skeleton->priv->changed_properties = NULL;
10714 skeleton->priv->changed_properties_idle_source = NULL;
10715 g_mutex_unlock (&skeleton->priv->lock);
10716 return FALSE;
10717}
10718
10719static void
10720_shared_resource_schedule_emit_changed (SharedResourceSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
10721{
10722 ChangedProperty *cp;
10723 GList *l;
10724 cp = NULL;
10725 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
10726 {
10727 ChangedProperty *i_cp = l->data;
10728 if (i_cp->info == info)
10729 {
10730 cp = i_cp;
10731 break;
10732 }
10733 }
10734 if (cp == NULL)
10735 {
10736 cp = g_new0 (ChangedProperty, 1);
10737 cp->prop_id = prop_id;
10738 cp->info = info;
10739 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
10740 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
10741 g_value_copy (orig_value, &cp->orig_value);
10742 }
10743}
10744
10745static void
10746shared_resource_skeleton_notify (GObject *object,
10747 GParamSpec *pspec G_GNUC_UNUSED)
10748{
10749 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
10750 g_mutex_lock (&skeleton->priv->lock);
10751 if (skeleton->priv->changed_properties != NULL &&
10752 skeleton->priv->changed_properties_idle_source == NULL)
10753 {
10754 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
10755 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
10756 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _shared_resource_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
10757 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
10758 g_source_unref (skeleton->priv->changed_properties_idle_source);
10759 }
10760 g_mutex_unlock (&skeleton->priv->lock);
10761}
10762
10763static void
10764shared_resource_skeleton_set_property (GObject *object,
10765 guint prop_id,
10766 const GValue *value,
10767 GParamSpec *pspec)
10768{
10769 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
10770 g_assert (prop_id != 0 && prop_id - 1 < 2);
10771 g_mutex_lock (&skeleton->priv->lock);
10772 g_object_freeze_notify (object);
10773 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
10774 {
10775 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
10776 _shared_resource_schedule_emit_changed (skeleton, _shared_resource_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
10777 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
10778 g_object_notify_by_pspec (object, pspec);
10779 }
10780 g_mutex_unlock (&skeleton->priv->lock);
10781 g_object_thaw_notify (object);
10782}
10783
10784static void
10785shared_resource_skeleton_init (SharedResourceSkeleton *skeleton)
10786{
10787#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10788 skeleton->priv = shared_resource_skeleton_get_instance_private (skeleton);
10789#else
10790 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SHARED_RESOURCE_SKELETON, SharedResourceSkeletonPrivate);
10791#endif
10792
10793 g_mutex_init (&skeleton->priv->lock);
10794 skeleton->priv->context = g_main_context_ref_thread_default ();
10795 skeleton->priv->properties = g_new0 (GValue, 2);
10796 g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN);
10797 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
10798}
10799
10800static gboolean
10801shared_resource_skeleton_get_lock (SharedResource *object)
10802{
10803 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
10804 gboolean value;
10805 g_mutex_lock (&skeleton->priv->lock);
10806 value = g_value_get_boolean (&(skeleton->priv->properties[0]));
10807 g_mutex_unlock (&skeleton->priv->lock);
10808 return value;
10809}
10810
10811static const gchar *
10812shared_resource_skeleton_get_name (SharedResource *object)
10813{
10814 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
10815 const gchar *value;
10816 g_mutex_lock (&skeleton->priv->lock);
10817 value = g_value_get_string (&(skeleton->priv->properties[1]));
10818 g_mutex_unlock (&skeleton->priv->lock);
10819 return value;
10820}
10821
10822static void
10823shared_resource_skeleton_class_init (SharedResourceSkeletonClass *klass)
10824{
10825 GObjectClass *gobject_class;
10826 GDBusInterfaceSkeletonClass *skeleton_class;
10827
10828 gobject_class = G_OBJECT_CLASS (klass);
10829 gobject_class->finalize = shared_resource_skeleton_finalize;
10830 gobject_class->get_property = shared_resource_skeleton_get_property;
10831 gobject_class->set_property = shared_resource_skeleton_set_property;
10832 gobject_class->notify = shared_resource_skeleton_notify;
10833
10834
10835 shared_resource_override_properties (gobject_class, 1);
10836
10837 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
10838 skeleton_class->get_info = shared_resource_skeleton_dbus_interface_get_info;
10839 skeleton_class->get_properties = shared_resource_skeleton_dbus_interface_get_properties;
10840 skeleton_class->flush = shared_resource_skeleton_dbus_interface_flush;
10841 skeleton_class->get_vtable = shared_resource_skeleton_dbus_interface_get_vtable;
10842
10843#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
10844 g_type_class_add_private (klass, sizeof (SharedResourceSkeletonPrivate));
10845#endif
10846}
10847
10848static void
10849shared_resource_skeleton_iface_init (SharedResourceIface *iface)
10850{
10851 iface->get_lock = shared_resource_skeleton_get_lock;
10852 iface->get_name = shared_resource_skeleton_get_name;
10853}
10854
10855/**
10856 * shared_resource_skeleton_new:
10857 *
10858 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>.
10859 *
10860 * Returns: (transfer full) (type SharedResourceSkeleton): The skeleton object.
10861 */
10862SharedResource *
10863shared_resource_skeleton_new (void)
10864{
10865 return SHARED_RESOURCE (g_object_new (TYPE_SHARED_RESOURCE_SKELETON, NULL));
10866}
10867
10868/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050010869 * Code for interface org.openbmc.Control
10870 * ------------------------------------------------------------------------
10871 */
10872
10873/**
10874 * SECTION:Control
10875 * @title: Control
10876 * @short_description: Generated C code for the org.openbmc.Control D-Bus interface
10877 *
10878 * 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.
10879 */
10880
10881/* ---- Introspection data for org.openbmc.Control ---- */
10882
10883static const _ExtendedGDBusMethodInfo _control_method_info_init =
10884{
10885 {
10886 -1,
10887 (gchar *) "init",
10888 NULL,
10889 NULL,
10890 NULL
10891 },
10892 "handle-init",
10893 FALSE
10894};
10895
10896static const _ExtendedGDBusMethodInfo * const _control_method_info_pointers[] =
10897{
10898 &_control_method_info_init,
10899 NULL
10900};
10901
10902static const _ExtendedGDBusArgInfo _control_signal_info_heartbeat_ARG_bus_name =
10903{
10904 {
10905 -1,
10906 (gchar *) "bus_name",
10907 (gchar *) "s",
10908 NULL
10909 },
10910 FALSE
10911};
10912
10913static const _ExtendedGDBusArgInfo * const _control_signal_info_heartbeat_ARG_pointers[] =
10914{
10915 &_control_signal_info_heartbeat_ARG_bus_name,
10916 NULL
10917};
10918
10919static const _ExtendedGDBusSignalInfo _control_signal_info_heartbeat =
10920{
10921 {
10922 -1,
10923 (gchar *) "Heartbeat",
10924 (GDBusArgInfo **) &_control_signal_info_heartbeat_ARG_pointers,
10925 NULL
10926 },
10927 "heartbeat"
10928};
10929
10930static const _ExtendedGDBusArgInfo _control_signal_info_goto_system_state_ARG_state_name =
10931{
10932 {
10933 -1,
10934 (gchar *) "state_name",
10935 (gchar *) "s",
10936 NULL
10937 },
10938 FALSE
10939};
10940
10941static const _ExtendedGDBusArgInfo * const _control_signal_info_goto_system_state_ARG_pointers[] =
10942{
10943 &_control_signal_info_goto_system_state_ARG_state_name,
10944 NULL
10945};
10946
10947static const _ExtendedGDBusSignalInfo _control_signal_info_goto_system_state =
10948{
10949 {
10950 -1,
10951 (gchar *) "GotoSystemState",
10952 (GDBusArgInfo **) &_control_signal_info_goto_system_state_ARG_pointers,
10953 NULL
10954 },
10955 "goto-system-state"
10956};
10957
Norman Jamesa3e47c42015-10-18 14:43:10 -050010958static const _ExtendedGDBusSignalInfo _control_signal_info_started =
10959{
10960 {
10961 -1,
10962 (gchar *) "Started",
10963 NULL,
10964 NULL
10965 },
10966 "started"
10967};
10968
Norman James362a80f2015-09-14 14:04:39 -050010969static const _ExtendedGDBusSignalInfo * const _control_signal_info_pointers[] =
10970{
10971 &_control_signal_info_heartbeat,
10972 &_control_signal_info_goto_system_state,
Norman Jamesa3e47c42015-10-18 14:43:10 -050010973 &_control_signal_info_started,
Norman James362a80f2015-09-14 14:04:39 -050010974 NULL
10975};
10976
10977static const _ExtendedGDBusPropertyInfo _control_property_info_poll_interval =
10978{
10979 {
10980 -1,
10981 (gchar *) "poll_interval",
10982 (gchar *) "i",
10983 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
10984 NULL
10985 },
10986 "poll-interval",
10987 FALSE
10988};
10989
10990static const _ExtendedGDBusPropertyInfo _control_property_info_heatbeat =
10991{
10992 {
10993 -1,
10994 (gchar *) "heatbeat",
10995 (gchar *) "i",
10996 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
10997 NULL
10998 },
10999 "heatbeat",
11000 FALSE
11001};
11002
11003static const _ExtendedGDBusPropertyInfo * const _control_property_info_pointers[] =
11004{
11005 &_control_property_info_poll_interval,
11006 &_control_property_info_heatbeat,
11007 NULL
11008};
11009
11010static const _ExtendedGDBusInterfaceInfo _control_interface_info =
11011{
11012 {
11013 -1,
11014 (gchar *) "org.openbmc.Control",
11015 (GDBusMethodInfo **) &_control_method_info_pointers,
11016 (GDBusSignalInfo **) &_control_signal_info_pointers,
11017 (GDBusPropertyInfo **) &_control_property_info_pointers,
11018 NULL
11019 },
11020 "control",
11021};
11022
11023
11024/**
11025 * control_interface_info:
11026 *
11027 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> D-Bus interface.
11028 *
11029 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
11030 */
11031GDBusInterfaceInfo *
11032control_interface_info (void)
11033{
11034 return (GDBusInterfaceInfo *) &_control_interface_info.parent_struct;
11035}
11036
11037/**
11038 * control_override_properties:
11039 * @klass: The class structure for a #GObject<!-- -->-derived class.
11040 * @property_id_begin: The property id to assign to the first overridden property.
11041 *
11042 * Overrides all #GObject properties in the #Control interface for a concrete class.
11043 * The properties are overridden in the order they are defined.
11044 *
11045 * Returns: The last property id.
11046 */
11047guint
11048control_override_properties (GObjectClass *klass, guint property_id_begin)
11049{
11050 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
11051 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
11052 return property_id_begin - 1;
11053}
11054
11055
11056
11057/**
11058 * Control:
11059 *
11060 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
11061 */
11062
11063/**
11064 * ControlIface:
11065 * @parent_iface: The parent interface.
11066 * @handle_init: Handler for the #Control::handle-init signal.
11067 * @get_heatbeat: Getter for the #Control:heatbeat property.
11068 * @get_poll_interval: Getter for the #Control:poll-interval property.
11069 * @goto_system_state: Handler for the #Control::goto-system-state signal.
11070 * @heartbeat: Handler for the #Control::heartbeat signal.
Norman Jamesa3e47c42015-10-18 14:43:10 -050011071 * @started: Handler for the #Control::started signal.
Norman James362a80f2015-09-14 14:04:39 -050011072 *
11073 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
11074 */
11075
11076typedef ControlIface ControlInterface;
11077G_DEFINE_INTERFACE (Control, control, G_TYPE_OBJECT);
11078
11079static void
11080control_default_init (ControlIface *iface)
11081{
11082 /* GObject signals for incoming D-Bus method calls: */
11083 /**
11084 * Control::handle-init:
11085 * @object: A #Control.
11086 * @invocation: A #GDBusMethodInvocation.
11087 *
11088 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method.
11089 *
11090 * 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.
11091 *
11092 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
11093 */
11094 g_signal_new ("handle-init",
11095 G_TYPE_FROM_INTERFACE (iface),
11096 G_SIGNAL_RUN_LAST,
11097 G_STRUCT_OFFSET (ControlIface, handle_init),
11098 g_signal_accumulator_true_handled,
11099 NULL,
11100 g_cclosure_marshal_generic,
11101 G_TYPE_BOOLEAN,
11102 1,
11103 G_TYPE_DBUS_METHOD_INVOCATION);
11104
11105 /* GObject signals for received D-Bus signals: */
11106 /**
11107 * Control::heartbeat:
11108 * @object: A #Control.
11109 * @arg_bus_name: Argument.
11110 *
11111 * 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.
11112 *
11113 * 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.
11114 */
11115 g_signal_new ("heartbeat",
11116 G_TYPE_FROM_INTERFACE (iface),
11117 G_SIGNAL_RUN_LAST,
11118 G_STRUCT_OFFSET (ControlIface, heartbeat),
11119 NULL,
11120 NULL,
11121 g_cclosure_marshal_generic,
11122 G_TYPE_NONE,
11123 1, G_TYPE_STRING);
11124
11125 /**
11126 * Control::goto-system-state:
11127 * @object: A #Control.
11128 * @arg_state_name: Argument.
11129 *
11130 * 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.
11131 *
11132 * 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.
11133 */
11134 g_signal_new ("goto-system-state",
11135 G_TYPE_FROM_INTERFACE (iface),
11136 G_SIGNAL_RUN_LAST,
11137 G_STRUCT_OFFSET (ControlIface, goto_system_state),
11138 NULL,
11139 NULL,
11140 g_cclosure_marshal_generic,
11141 G_TYPE_NONE,
11142 1, G_TYPE_STRING);
11143
Norman Jamesa3e47c42015-10-18 14:43:10 -050011144 /**
11145 * Control::started:
11146 * @object: A #Control.
11147 *
11148 * 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.
11149 *
11150 * 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.
11151 */
11152 g_signal_new ("started",
11153 G_TYPE_FROM_INTERFACE (iface),
11154 G_SIGNAL_RUN_LAST,
11155 G_STRUCT_OFFSET (ControlIface, started),
11156 NULL,
11157 NULL,
11158 g_cclosure_marshal_generic,
11159 G_TYPE_NONE,
11160 0);
11161
Norman James362a80f2015-09-14 14:04:39 -050011162 /* GObject properties for D-Bus properties: */
11163 /**
11164 * Control:poll-interval:
11165 *
11166 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link>.
11167 *
11168 * 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.
11169 */
11170 g_object_interface_install_property (iface,
11171 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
11172 /**
11173 * Control:heatbeat:
11174 *
11175 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link>.
11176 *
11177 * 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.
11178 */
11179 g_object_interface_install_property (iface,
11180 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
11181}
11182
11183/**
11184 * control_get_poll_interval: (skip)
11185 * @object: A #Control.
11186 *
11187 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property.
11188 *
11189 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
11190 *
11191 * Returns: The property value.
11192 */
11193gint
11194control_get_poll_interval (Control *object)
11195{
11196 return CONTROL_GET_IFACE (object)->get_poll_interval (object);
11197}
11198
11199/**
11200 * control_set_poll_interval: (skip)
11201 * @object: A #Control.
11202 * @value: The value to set.
11203 *
11204 * Sets the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property to @value.
11205 *
11206 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
11207 */
11208void
11209control_set_poll_interval (Control *object, gint value)
11210{
11211 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
11212}
11213
11214/**
11215 * control_get_heatbeat: (skip)
11216 * @object: A #Control.
11217 *
11218 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property.
11219 *
11220 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
11221 *
11222 * Returns: The property value.
11223 */
11224gint
11225control_get_heatbeat (Control *object)
11226{
11227 return CONTROL_GET_IFACE (object)->get_heatbeat (object);
11228}
11229
11230/**
11231 * control_set_heatbeat: (skip)
11232 * @object: A #Control.
11233 * @value: The value to set.
11234 *
11235 * Sets the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property to @value.
11236 *
11237 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
11238 */
11239void
11240control_set_heatbeat (Control *object, gint value)
11241{
11242 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
11243}
11244
11245/**
11246 * control_emit_heartbeat:
11247 * @object: A #Control.
11248 * @arg_bus_name: Argument to pass with the signal.
11249 *
11250 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Heartbeat">"Heartbeat"</link> D-Bus signal.
11251 */
11252void
11253control_emit_heartbeat (
11254 Control *object,
11255 const gchar *arg_bus_name)
11256{
11257 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
11258}
11259
11260/**
11261 * control_emit_goto_system_state:
11262 * @object: A #Control.
11263 * @arg_state_name: Argument to pass with the signal.
11264 *
11265 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.GotoSystemState">"GotoSystemState"</link> D-Bus signal.
11266 */
11267void
11268control_emit_goto_system_state (
11269 Control *object,
11270 const gchar *arg_state_name)
11271{
11272 g_signal_emit_by_name (object, "goto-system-state", arg_state_name);
11273}
11274
11275/**
Norman Jamesa3e47c42015-10-18 14:43:10 -050011276 * control_emit_started:
11277 * @object: A #Control.
11278 *
11279 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Started">"Started"</link> D-Bus signal.
11280 */
11281void
11282control_emit_started (
11283 Control *object)
11284{
11285 g_signal_emit_by_name (object, "started");
11286}
11287
11288/**
Norman James362a80f2015-09-14 14:04:39 -050011289 * control_call_init:
11290 * @proxy: A #ControlProxy.
11291 * @cancellable: (allow-none): A #GCancellable or %NULL.
11292 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
11293 * @user_data: User data to pass to @callback.
11294 *
11295 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method on @proxy.
11296 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
11297 * You can then call control_call_init_finish() to get the result of the operation.
11298 *
11299 * See control_call_init_sync() for the synchronous, blocking version of this method.
11300 */
11301void
11302control_call_init (
11303 Control *proxy,
11304 GCancellable *cancellable,
11305 GAsyncReadyCallback callback,
11306 gpointer user_data)
11307{
11308 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
11309 "init",
11310 g_variant_new ("()"),
11311 G_DBUS_CALL_FLAGS_NONE,
11312 -1,
11313 cancellable,
11314 callback,
11315 user_data);
11316}
11317
11318/**
11319 * control_call_init_finish:
11320 * @proxy: A #ControlProxy.
11321 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_call_init().
11322 * @error: Return location for error or %NULL.
11323 *
11324 * Finishes an operation started with control_call_init().
11325 *
11326 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11327 */
11328gboolean
11329control_call_init_finish (
11330 Control *proxy,
11331 GAsyncResult *res,
11332 GError **error)
11333{
11334 GVariant *_ret;
11335 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
11336 if (_ret == NULL)
11337 goto _out;
11338 g_variant_get (_ret,
11339 "()");
11340 g_variant_unref (_ret);
11341_out:
11342 return _ret != NULL;
11343}
11344
11345/**
11346 * control_call_init_sync:
11347 * @proxy: A #ControlProxy.
11348 * @cancellable: (allow-none): A #GCancellable or %NULL.
11349 * @error: Return location for error or %NULL.
11350 *
11351 * 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.
11352 *
11353 * See control_call_init() for the asynchronous version of this method.
11354 *
11355 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11356 */
11357gboolean
11358control_call_init_sync (
11359 Control *proxy,
11360 GCancellable *cancellable,
11361 GError **error)
11362{
11363 GVariant *_ret;
11364 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
11365 "init",
11366 g_variant_new ("()"),
11367 G_DBUS_CALL_FLAGS_NONE,
11368 -1,
11369 cancellable,
11370 error);
11371 if (_ret == NULL)
11372 goto _out;
11373 g_variant_get (_ret,
11374 "()");
11375 g_variant_unref (_ret);
11376_out:
11377 return _ret != NULL;
11378}
11379
11380/**
11381 * control_complete_init:
11382 * @object: A #Control.
11383 * @invocation: (transfer full): A #GDBusMethodInvocation.
11384 *
11385 * 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.
11386 *
11387 * This method will free @invocation, you cannot use it afterwards.
11388 */
11389void
11390control_complete_init (
11391 Control *object,
11392 GDBusMethodInvocation *invocation)
11393{
11394 g_dbus_method_invocation_return_value (invocation,
11395 g_variant_new ("()"));
11396}
11397
11398/* ------------------------------------------------------------------------ */
11399
11400/**
11401 * ControlProxy:
11402 *
11403 * The #ControlProxy structure contains only private data and should only be accessed using the provided API.
11404 */
11405
11406/**
11407 * ControlProxyClass:
11408 * @parent_class: The parent class.
11409 *
11410 * Class structure for #ControlProxy.
11411 */
11412
11413struct _ControlProxyPrivate
11414{
11415 GData *qdata;
11416};
11417
11418static void control_proxy_iface_init (ControlIface *iface);
11419
11420#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11421G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
11422 G_ADD_PRIVATE (ControlProxy)
11423 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init));
11424
11425#else
11426G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
11427 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init));
11428
11429#endif
11430static void
11431control_proxy_finalize (GObject *object)
11432{
11433 ControlProxy *proxy = CONTROL_PROXY (object);
11434 g_datalist_clear (&proxy->priv->qdata);
11435 G_OBJECT_CLASS (control_proxy_parent_class)->finalize (object);
11436}
11437
11438static void
11439control_proxy_get_property (GObject *object,
11440 guint prop_id,
11441 GValue *value,
11442 GParamSpec *pspec G_GNUC_UNUSED)
11443{
11444 const _ExtendedGDBusPropertyInfo *info;
11445 GVariant *variant;
11446 g_assert (prop_id != 0 && prop_id - 1 < 2);
11447 info = _control_property_info_pointers[prop_id - 1];
11448 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
11449 if (info->use_gvariant)
11450 {
11451 g_value_set_variant (value, variant);
11452 }
11453 else
11454 {
11455 if (variant != NULL)
11456 g_dbus_gvariant_to_gvalue (variant, value);
11457 }
11458 if (variant != NULL)
11459 g_variant_unref (variant);
11460}
11461
11462static void
11463control_proxy_set_property_cb (GDBusProxy *proxy,
11464 GAsyncResult *res,
11465 gpointer user_data)
11466{
11467 const _ExtendedGDBusPropertyInfo *info = user_data;
11468 GError *error;
11469 GVariant *_ret;
11470 error = NULL;
11471 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
11472 if (!_ret)
11473 {
11474 g_warning ("Error setting property '%s' on interface org.openbmc.Control: %s (%s, %d)",
11475 info->parent_struct.name,
11476 error->message, g_quark_to_string (error->domain), error->code);
11477 g_error_free (error);
11478 }
11479 else
11480 {
11481 g_variant_unref (_ret);
11482 }
11483}
11484
11485static void
11486control_proxy_set_property (GObject *object,
11487 guint prop_id,
11488 const GValue *value,
11489 GParamSpec *pspec G_GNUC_UNUSED)
11490{
11491 const _ExtendedGDBusPropertyInfo *info;
11492 GVariant *variant;
11493 g_assert (prop_id != 0 && prop_id - 1 < 2);
11494 info = _control_property_info_pointers[prop_id - 1];
11495 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
11496 g_dbus_proxy_call (G_DBUS_PROXY (object),
11497 "org.freedesktop.DBus.Properties.Set",
11498 g_variant_new ("(ssv)", "org.openbmc.Control", info->parent_struct.name, variant),
11499 G_DBUS_CALL_FLAGS_NONE,
11500 -1,
11501 NULL, (GAsyncReadyCallback) control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
11502 g_variant_unref (variant);
11503}
11504
11505static void
11506control_proxy_g_signal (GDBusProxy *proxy,
11507 const gchar *sender_name G_GNUC_UNUSED,
11508 const gchar *signal_name,
11509 GVariant *parameters)
11510{
11511 _ExtendedGDBusSignalInfo *info;
11512 GVariantIter iter;
11513 GVariant *child;
11514 GValue *paramv;
11515 guint num_params;
11516 guint n;
11517 guint signal_id;
11518 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, signal_name);
11519 if (info == NULL)
11520 return;
11521 num_params = g_variant_n_children (parameters);
11522 paramv = g_new0 (GValue, num_params + 1);
11523 g_value_init (&paramv[0], TYPE_CONTROL);
11524 g_value_set_object (&paramv[0], proxy);
11525 g_variant_iter_init (&iter, parameters);
11526 n = 1;
11527 while ((child = g_variant_iter_next_value (&iter)) != NULL)
11528 {
11529 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
11530 if (arg_info->use_gvariant)
11531 {
11532 g_value_init (&paramv[n], G_TYPE_VARIANT);
11533 g_value_set_variant (&paramv[n], child);
11534 n++;
11535 }
11536 else
11537 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
11538 g_variant_unref (child);
11539 }
11540 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
11541 g_signal_emitv (paramv, signal_id, 0, NULL);
11542 for (n = 0; n < num_params + 1; n++)
11543 g_value_unset (&paramv[n]);
11544 g_free (paramv);
11545}
11546
11547static void
11548control_proxy_g_properties_changed (GDBusProxy *_proxy,
11549 GVariant *changed_properties,
11550 const gchar *const *invalidated_properties)
11551{
11552 ControlProxy *proxy = CONTROL_PROXY (_proxy);
11553 guint n;
11554 const gchar *key;
11555 GVariantIter *iter;
11556 _ExtendedGDBusPropertyInfo *info;
11557 g_variant_get (changed_properties, "a{sv}", &iter);
11558 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
11559 {
11560 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, key);
11561 g_datalist_remove_data (&proxy->priv->qdata, key);
11562 if (info != NULL)
11563 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
11564 }
11565 g_variant_iter_free (iter);
11566 for (n = 0; invalidated_properties[n] != NULL; n++)
11567 {
11568 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, invalidated_properties[n]);
11569 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
11570 if (info != NULL)
11571 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
11572 }
11573}
11574
11575static gint
11576control_proxy_get_poll_interval (Control *object)
11577{
11578 ControlProxy *proxy = CONTROL_PROXY (object);
11579 GVariant *variant;
11580 gint value = 0;
11581 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
11582 if (variant != NULL)
11583 {
11584 value = g_variant_get_int32 (variant);
11585 g_variant_unref (variant);
11586 }
11587 return value;
11588}
11589
11590static gint
11591control_proxy_get_heatbeat (Control *object)
11592{
11593 ControlProxy *proxy = CONTROL_PROXY (object);
11594 GVariant *variant;
11595 gint value = 0;
11596 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
11597 if (variant != NULL)
11598 {
11599 value = g_variant_get_int32 (variant);
11600 g_variant_unref (variant);
11601 }
11602 return value;
11603}
11604
11605static void
11606control_proxy_init (ControlProxy *proxy)
11607{
11608#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11609 proxy->priv = control_proxy_get_instance_private (proxy);
11610#else
11611 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_PROXY, ControlProxyPrivate);
11612#endif
11613
11614 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_interface_info ());
11615}
11616
11617static void
11618control_proxy_class_init (ControlProxyClass *klass)
11619{
11620 GObjectClass *gobject_class;
11621 GDBusProxyClass *proxy_class;
11622
11623 gobject_class = G_OBJECT_CLASS (klass);
11624 gobject_class->finalize = control_proxy_finalize;
11625 gobject_class->get_property = control_proxy_get_property;
11626 gobject_class->set_property = control_proxy_set_property;
11627
11628 proxy_class = G_DBUS_PROXY_CLASS (klass);
11629 proxy_class->g_signal = control_proxy_g_signal;
11630 proxy_class->g_properties_changed = control_proxy_g_properties_changed;
11631
11632 control_override_properties (gobject_class, 1);
11633
11634#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
11635 g_type_class_add_private (klass, sizeof (ControlProxyPrivate));
11636#endif
11637}
11638
11639static void
11640control_proxy_iface_init (ControlIface *iface)
11641{
11642 iface->get_poll_interval = control_proxy_get_poll_interval;
11643 iface->get_heatbeat = control_proxy_get_heatbeat;
11644}
11645
11646/**
11647 * control_proxy_new:
11648 * @connection: A #GDBusConnection.
11649 * @flags: Flags from the #GDBusProxyFlags enumeration.
11650 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
11651 * @object_path: An object path.
11652 * @cancellable: (allow-none): A #GCancellable or %NULL.
11653 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
11654 * @user_data: User data to pass to @callback.
11655 *
11656 * 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.
11657 *
11658 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
11659 * You can then call control_proxy_new_finish() to get the result of the operation.
11660 *
11661 * See control_proxy_new_sync() for the synchronous, blocking version of this constructor.
11662 */
11663void
11664control_proxy_new (
11665 GDBusConnection *connection,
11666 GDBusProxyFlags flags,
11667 const gchar *name,
11668 const gchar *object_path,
11669 GCancellable *cancellable,
11670 GAsyncReadyCallback callback,
11671 gpointer user_data)
11672{
11673 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);
11674}
11675
11676/**
11677 * control_proxy_new_finish:
11678 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new().
11679 * @error: Return location for error or %NULL
11680 *
11681 * Finishes an operation started with control_proxy_new().
11682 *
11683 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
11684 */
11685Control *
11686control_proxy_new_finish (
11687 GAsyncResult *res,
11688 GError **error)
11689{
11690 GObject *ret;
11691 GObject *source_object;
11692 source_object = g_async_result_get_source_object (res);
11693 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
11694 g_object_unref (source_object);
11695 if (ret != NULL)
11696 return CONTROL (ret);
11697 else
11698 return NULL;
11699}
11700
11701/**
11702 * control_proxy_new_sync:
11703 * @connection: A #GDBusConnection.
11704 * @flags: Flags from the #GDBusProxyFlags enumeration.
11705 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
11706 * @object_path: An object path.
11707 * @cancellable: (allow-none): A #GCancellable or %NULL.
11708 * @error: Return location for error or %NULL
11709 *
11710 * 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.
11711 *
11712 * The calling thread is blocked until a reply is received.
11713 *
11714 * See control_proxy_new() for the asynchronous version of this constructor.
11715 *
11716 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
11717 */
11718Control *
11719control_proxy_new_sync (
11720 GDBusConnection *connection,
11721 GDBusProxyFlags flags,
11722 const gchar *name,
11723 const gchar *object_path,
11724 GCancellable *cancellable,
11725 GError **error)
11726{
11727 GInitable *ret;
11728 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);
11729 if (ret != NULL)
11730 return CONTROL (ret);
11731 else
11732 return NULL;
11733}
11734
11735
11736/**
11737 * control_proxy_new_for_bus:
11738 * @bus_type: A #GBusType.
11739 * @flags: Flags from the #GDBusProxyFlags enumeration.
11740 * @name: A bus name (well-known or unique).
11741 * @object_path: An object path.
11742 * @cancellable: (allow-none): A #GCancellable or %NULL.
11743 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
11744 * @user_data: User data to pass to @callback.
11745 *
11746 * Like control_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
11747 *
11748 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
11749 * You can then call control_proxy_new_for_bus_finish() to get the result of the operation.
11750 *
11751 * See control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
11752 */
11753void
11754control_proxy_new_for_bus (
11755 GBusType bus_type,
11756 GDBusProxyFlags flags,
11757 const gchar *name,
11758 const gchar *object_path,
11759 GCancellable *cancellable,
11760 GAsyncReadyCallback callback,
11761 gpointer user_data)
11762{
11763 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);
11764}
11765
11766/**
11767 * control_proxy_new_for_bus_finish:
11768 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new_for_bus().
11769 * @error: Return location for error or %NULL
11770 *
11771 * Finishes an operation started with control_proxy_new_for_bus().
11772 *
11773 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
11774 */
11775Control *
11776control_proxy_new_for_bus_finish (
11777 GAsyncResult *res,
11778 GError **error)
11779{
11780 GObject *ret;
11781 GObject *source_object;
11782 source_object = g_async_result_get_source_object (res);
11783 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
11784 g_object_unref (source_object);
11785 if (ret != NULL)
11786 return CONTROL (ret);
11787 else
11788 return NULL;
11789}
11790
11791/**
11792 * control_proxy_new_for_bus_sync:
11793 * @bus_type: A #GBusType.
11794 * @flags: Flags from the #GDBusProxyFlags enumeration.
11795 * @name: A bus name (well-known or unique).
11796 * @object_path: An object path.
11797 * @cancellable: (allow-none): A #GCancellable or %NULL.
11798 * @error: Return location for error or %NULL
11799 *
11800 * Like control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
11801 *
11802 * The calling thread is blocked until a reply is received.
11803 *
11804 * See control_proxy_new_for_bus() for the asynchronous version of this constructor.
11805 *
11806 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
11807 */
11808Control *
11809control_proxy_new_for_bus_sync (
11810 GBusType bus_type,
11811 GDBusProxyFlags flags,
11812 const gchar *name,
11813 const gchar *object_path,
11814 GCancellable *cancellable,
11815 GError **error)
11816{
11817 GInitable *ret;
11818 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);
11819 if (ret != NULL)
11820 return CONTROL (ret);
11821 else
11822 return NULL;
11823}
11824
11825
11826/* ------------------------------------------------------------------------ */
11827
11828/**
11829 * ControlSkeleton:
11830 *
11831 * The #ControlSkeleton structure contains only private data and should only be accessed using the provided API.
11832 */
11833
11834/**
11835 * ControlSkeletonClass:
11836 * @parent_class: The parent class.
11837 *
11838 * Class structure for #ControlSkeleton.
11839 */
11840
11841struct _ControlSkeletonPrivate
11842{
11843 GValue *properties;
11844 GList *changed_properties;
11845 GSource *changed_properties_idle_source;
11846 GMainContext *context;
11847 GMutex lock;
11848};
11849
11850static void
11851_control_skeleton_handle_method_call (
11852 GDBusConnection *connection G_GNUC_UNUSED,
11853 const gchar *sender G_GNUC_UNUSED,
11854 const gchar *object_path G_GNUC_UNUSED,
11855 const gchar *interface_name,
11856 const gchar *method_name,
11857 GVariant *parameters,
11858 GDBusMethodInvocation *invocation,
11859 gpointer user_data)
11860{
11861 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
11862 _ExtendedGDBusMethodInfo *info;
11863 GVariantIter iter;
11864 GVariant *child;
11865 GValue *paramv;
11866 guint num_params;
11867 guint num_extra;
11868 guint n;
11869 guint signal_id;
11870 GValue return_value = G_VALUE_INIT;
11871 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
11872 g_assert (info != NULL);
11873 num_params = g_variant_n_children (parameters);
11874 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
11875 n = 0;
11876 g_value_init (&paramv[n], TYPE_CONTROL);
11877 g_value_set_object (&paramv[n++], skeleton);
11878 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
11879 g_value_set_object (&paramv[n++], invocation);
11880 if (info->pass_fdlist)
11881 {
11882#ifdef G_OS_UNIX
11883 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
11884 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
11885#else
11886 g_assert_not_reached ();
11887#endif
11888 }
11889 g_variant_iter_init (&iter, parameters);
11890 while ((child = g_variant_iter_next_value (&iter)) != NULL)
11891 {
11892 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
11893 if (arg_info->use_gvariant)
11894 {
11895 g_value_init (&paramv[n], G_TYPE_VARIANT);
11896 g_value_set_variant (&paramv[n], child);
11897 n++;
11898 }
11899 else
11900 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
11901 g_variant_unref (child);
11902 }
11903 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
11904 g_value_init (&return_value, G_TYPE_BOOLEAN);
11905 g_signal_emitv (paramv, signal_id, 0, &return_value);
11906 if (!g_value_get_boolean (&return_value))
11907 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);
11908 g_value_unset (&return_value);
11909 for (n = 0; n < num_params + num_extra; n++)
11910 g_value_unset (&paramv[n]);
11911 g_free (paramv);
11912}
11913
11914static GVariant *
11915_control_skeleton_handle_get_property (
11916 GDBusConnection *connection G_GNUC_UNUSED,
11917 const gchar *sender G_GNUC_UNUSED,
11918 const gchar *object_path G_GNUC_UNUSED,
11919 const gchar *interface_name G_GNUC_UNUSED,
11920 const gchar *property_name,
11921 GError **error,
11922 gpointer user_data)
11923{
11924 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
11925 GValue value = G_VALUE_INIT;
11926 GParamSpec *pspec;
11927 _ExtendedGDBusPropertyInfo *info;
11928 GVariant *ret;
11929 ret = NULL;
11930 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
11931 g_assert (info != NULL);
11932 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
11933 if (pspec == NULL)
11934 {
11935 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
11936 }
11937 else
11938 {
11939 g_value_init (&value, pspec->value_type);
11940 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
11941 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
11942 g_value_unset (&value);
11943 }
11944 return ret;
11945}
11946
11947static gboolean
11948_control_skeleton_handle_set_property (
11949 GDBusConnection *connection G_GNUC_UNUSED,
11950 const gchar *sender G_GNUC_UNUSED,
11951 const gchar *object_path G_GNUC_UNUSED,
11952 const gchar *interface_name G_GNUC_UNUSED,
11953 const gchar *property_name,
11954 GVariant *variant,
11955 GError **error,
11956 gpointer user_data)
11957{
11958 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
11959 GValue value = G_VALUE_INIT;
11960 GParamSpec *pspec;
11961 _ExtendedGDBusPropertyInfo *info;
11962 gboolean ret;
11963 ret = FALSE;
11964 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
11965 g_assert (info != NULL);
11966 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
11967 if (pspec == NULL)
11968 {
11969 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
11970 }
11971 else
11972 {
11973 if (info->use_gvariant)
11974 g_value_set_variant (&value, variant);
11975 else
11976 g_dbus_gvariant_to_gvalue (variant, &value);
11977 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
11978 g_value_unset (&value);
11979 ret = TRUE;
11980 }
11981 return ret;
11982}
11983
11984static const GDBusInterfaceVTable _control_skeleton_vtable =
11985{
11986 _control_skeleton_handle_method_call,
11987 _control_skeleton_handle_get_property,
11988 _control_skeleton_handle_set_property,
11989 {NULL}
11990};
11991
11992static GDBusInterfaceInfo *
11993control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
11994{
11995 return control_interface_info ();
11996}
11997
11998static GDBusInterfaceVTable *
11999control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
12000{
12001 return (GDBusInterfaceVTable *) &_control_skeleton_vtable;
12002}
12003
12004static GVariant *
12005control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
12006{
12007 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
12008
12009 GVariantBuilder builder;
12010 guint n;
12011 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
12012 if (_control_interface_info.parent_struct.properties == NULL)
12013 goto out;
12014 for (n = 0; _control_interface_info.parent_struct.properties[n] != NULL; n++)
12015 {
12016 GDBusPropertyInfo *info = _control_interface_info.parent_struct.properties[n];
12017 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
12018 {
12019 GVariant *value;
12020 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);
12021 if (value != NULL)
12022 {
12023 g_variant_take_ref (value);
12024 g_variant_builder_add (&builder, "{sv}", info->name, value);
12025 g_variant_unref (value);
12026 }
12027 }
12028 }
12029out:
12030 return g_variant_builder_end (&builder);
12031}
12032
12033static gboolean _control_emit_changed (gpointer user_data);
12034
12035static void
12036control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
12037{
12038 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
12039 gboolean emit_changed = FALSE;
12040
12041 g_mutex_lock (&skeleton->priv->lock);
12042 if (skeleton->priv->changed_properties_idle_source != NULL)
12043 {
12044 g_source_destroy (skeleton->priv->changed_properties_idle_source);
12045 skeleton->priv->changed_properties_idle_source = NULL;
12046 emit_changed = TRUE;
12047 }
12048 g_mutex_unlock (&skeleton->priv->lock);
12049
12050 if (emit_changed)
12051 _control_emit_changed (skeleton);
12052}
12053
12054static void
12055_control_on_signal_heartbeat (
12056 Control *object,
12057 const gchar *arg_bus_name)
12058{
12059 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12060
12061 GList *connections, *l;
12062 GVariant *signal_variant;
12063 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
12064
12065 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
12066 arg_bus_name));
12067 for (l = connections; l != NULL; l = l->next)
12068 {
12069 GDBusConnection *connection = l->data;
12070 g_dbus_connection_emit_signal (connection,
12071 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Heartbeat",
12072 signal_variant, NULL);
12073 }
12074 g_variant_unref (signal_variant);
12075 g_list_free_full (connections, g_object_unref);
12076}
12077
12078static void
12079_control_on_signal_goto_system_state (
12080 Control *object,
12081 const gchar *arg_state_name)
12082{
12083 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12084
12085 GList *connections, *l;
12086 GVariant *signal_variant;
12087 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
12088
12089 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
12090 arg_state_name));
12091 for (l = connections; l != NULL; l = l->next)
12092 {
12093 GDBusConnection *connection = l->data;
12094 g_dbus_connection_emit_signal (connection,
12095 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "GotoSystemState",
12096 signal_variant, NULL);
12097 }
12098 g_variant_unref (signal_variant);
12099 g_list_free_full (connections, g_object_unref);
12100}
12101
Norman Jamesa3e47c42015-10-18 14:43:10 -050012102static void
12103_control_on_signal_started (
12104 Control *object)
12105{
12106 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12107
12108 GList *connections, *l;
12109 GVariant *signal_variant;
12110 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
12111
12112 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
12113 for (l = connections; l != NULL; l = l->next)
12114 {
12115 GDBusConnection *connection = l->data;
12116 g_dbus_connection_emit_signal (connection,
12117 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Started",
12118 signal_variant, NULL);
12119 }
12120 g_variant_unref (signal_variant);
12121 g_list_free_full (connections, g_object_unref);
12122}
12123
Norman James362a80f2015-09-14 14:04:39 -050012124static void control_skeleton_iface_init (ControlIface *iface);
12125#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12126G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
12127 G_ADD_PRIVATE (ControlSkeleton)
12128 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init));
12129
12130#else
12131G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
12132 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init));
12133
12134#endif
12135static void
12136control_skeleton_finalize (GObject *object)
12137{
12138 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12139 guint n;
12140 for (n = 0; n < 2; n++)
12141 g_value_unset (&skeleton->priv->properties[n]);
12142 g_free (skeleton->priv->properties);
12143 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
12144 if (skeleton->priv->changed_properties_idle_source != NULL)
12145 g_source_destroy (skeleton->priv->changed_properties_idle_source);
12146 g_main_context_unref (skeleton->priv->context);
12147 g_mutex_clear (&skeleton->priv->lock);
12148 G_OBJECT_CLASS (control_skeleton_parent_class)->finalize (object);
12149}
12150
12151static void
12152control_skeleton_get_property (GObject *object,
12153 guint prop_id,
12154 GValue *value,
12155 GParamSpec *pspec G_GNUC_UNUSED)
12156{
12157 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12158 g_assert (prop_id != 0 && prop_id - 1 < 2);
12159 g_mutex_lock (&skeleton->priv->lock);
12160 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
12161 g_mutex_unlock (&skeleton->priv->lock);
12162}
12163
12164static gboolean
12165_control_emit_changed (gpointer user_data)
12166{
12167 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
12168 GList *l;
12169 GVariantBuilder builder;
12170 GVariantBuilder invalidated_builder;
12171 guint num_changes;
12172
12173 g_mutex_lock (&skeleton->priv->lock);
12174 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
12175 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
12176 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
12177 {
12178 ChangedProperty *cp = l->data;
12179 GVariant *variant;
12180 const GValue *cur_value;
12181
12182 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
12183 if (!_g_value_equal (cur_value, &cp->orig_value))
12184 {
12185 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
12186 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
12187 g_variant_unref (variant);
12188 num_changes++;
12189 }
12190 }
12191 if (num_changes > 0)
12192 {
12193 GList *connections, *ll;
12194 GVariant *signal_variant;
12195 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Control",
12196 &builder, &invalidated_builder));
12197 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
12198 for (ll = connections; ll != NULL; ll = ll->next)
12199 {
12200 GDBusConnection *connection = ll->data;
12201
12202 g_dbus_connection_emit_signal (connection,
12203 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
12204 "org.freedesktop.DBus.Properties",
12205 "PropertiesChanged",
12206 signal_variant,
12207 NULL);
12208 }
12209 g_variant_unref (signal_variant);
12210 g_list_free_full (connections, g_object_unref);
12211 }
12212 else
12213 {
12214 g_variant_builder_clear (&builder);
12215 g_variant_builder_clear (&invalidated_builder);
12216 }
12217 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
12218 skeleton->priv->changed_properties = NULL;
12219 skeleton->priv->changed_properties_idle_source = NULL;
12220 g_mutex_unlock (&skeleton->priv->lock);
12221 return FALSE;
12222}
12223
12224static void
12225_control_schedule_emit_changed (ControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
12226{
12227 ChangedProperty *cp;
12228 GList *l;
12229 cp = NULL;
12230 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
12231 {
12232 ChangedProperty *i_cp = l->data;
12233 if (i_cp->info == info)
12234 {
12235 cp = i_cp;
12236 break;
12237 }
12238 }
12239 if (cp == NULL)
12240 {
12241 cp = g_new0 (ChangedProperty, 1);
12242 cp->prop_id = prop_id;
12243 cp->info = info;
12244 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
12245 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
12246 g_value_copy (orig_value, &cp->orig_value);
12247 }
12248}
12249
12250static void
12251control_skeleton_notify (GObject *object,
12252 GParamSpec *pspec G_GNUC_UNUSED)
12253{
12254 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12255 g_mutex_lock (&skeleton->priv->lock);
12256 if (skeleton->priv->changed_properties != NULL &&
12257 skeleton->priv->changed_properties_idle_source == NULL)
12258 {
12259 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
12260 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
12261 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
12262 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
12263 g_source_unref (skeleton->priv->changed_properties_idle_source);
12264 }
12265 g_mutex_unlock (&skeleton->priv->lock);
12266}
12267
12268static void
12269control_skeleton_set_property (GObject *object,
12270 guint prop_id,
12271 const GValue *value,
12272 GParamSpec *pspec)
12273{
12274 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12275 g_assert (prop_id != 0 && prop_id - 1 < 2);
12276 g_mutex_lock (&skeleton->priv->lock);
12277 g_object_freeze_notify (object);
12278 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
12279 {
12280 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
12281 _control_schedule_emit_changed (skeleton, _control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
12282 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
12283 g_object_notify_by_pspec (object, pspec);
12284 }
12285 g_mutex_unlock (&skeleton->priv->lock);
12286 g_object_thaw_notify (object);
12287}
12288
12289static void
12290control_skeleton_init (ControlSkeleton *skeleton)
12291{
12292#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12293 skeleton->priv = control_skeleton_get_instance_private (skeleton);
12294#else
12295 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_SKELETON, ControlSkeletonPrivate);
12296#endif
12297
12298 g_mutex_init (&skeleton->priv->lock);
12299 skeleton->priv->context = g_main_context_ref_thread_default ();
12300 skeleton->priv->properties = g_new0 (GValue, 2);
12301 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
12302 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
12303}
12304
12305static gint
12306control_skeleton_get_poll_interval (Control *object)
12307{
12308 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12309 gint value;
12310 g_mutex_lock (&skeleton->priv->lock);
12311 value = g_value_get_int (&(skeleton->priv->properties[0]));
12312 g_mutex_unlock (&skeleton->priv->lock);
12313 return value;
12314}
12315
12316static gint
12317control_skeleton_get_heatbeat (Control *object)
12318{
12319 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12320 gint value;
12321 g_mutex_lock (&skeleton->priv->lock);
12322 value = g_value_get_int (&(skeleton->priv->properties[1]));
12323 g_mutex_unlock (&skeleton->priv->lock);
12324 return value;
12325}
12326
12327static void
12328control_skeleton_class_init (ControlSkeletonClass *klass)
12329{
12330 GObjectClass *gobject_class;
12331 GDBusInterfaceSkeletonClass *skeleton_class;
12332
12333 gobject_class = G_OBJECT_CLASS (klass);
12334 gobject_class->finalize = control_skeleton_finalize;
12335 gobject_class->get_property = control_skeleton_get_property;
12336 gobject_class->set_property = control_skeleton_set_property;
12337 gobject_class->notify = control_skeleton_notify;
12338
12339
12340 control_override_properties (gobject_class, 1);
12341
12342 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
12343 skeleton_class->get_info = control_skeleton_dbus_interface_get_info;
12344 skeleton_class->get_properties = control_skeleton_dbus_interface_get_properties;
12345 skeleton_class->flush = control_skeleton_dbus_interface_flush;
12346 skeleton_class->get_vtable = control_skeleton_dbus_interface_get_vtable;
12347
12348#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
12349 g_type_class_add_private (klass, sizeof (ControlSkeletonPrivate));
12350#endif
12351}
12352
12353static void
12354control_skeleton_iface_init (ControlIface *iface)
12355{
12356 iface->heartbeat = _control_on_signal_heartbeat;
12357 iface->goto_system_state = _control_on_signal_goto_system_state;
Norman Jamesa3e47c42015-10-18 14:43:10 -050012358 iface->started = _control_on_signal_started;
Norman James362a80f2015-09-14 14:04:39 -050012359 iface->get_poll_interval = control_skeleton_get_poll_interval;
12360 iface->get_heatbeat = control_skeleton_get_heatbeat;
12361}
12362
12363/**
12364 * control_skeleton_new:
12365 *
12366 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
12367 *
12368 * Returns: (transfer full) (type ControlSkeleton): The skeleton object.
12369 */
12370Control *
12371control_skeleton_new (void)
12372{
12373 return CONTROL (g_object_new (TYPE_CONTROL_SKELETON, NULL));
12374}
12375
12376/* ------------------------------------------------------------------------
12377 * Code for interface org.openbmc.control.Bmc
12378 * ------------------------------------------------------------------------
12379 */
12380
12381/**
12382 * SECTION:ControlBmc
12383 * @title: ControlBmc
12384 * @short_description: Generated C code for the org.openbmc.control.Bmc D-Bus interface
12385 *
12386 * 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.
12387 */
12388
12389/* ---- Introspection data for org.openbmc.control.Bmc ---- */
12390
12391static const _ExtendedGDBusMethodInfo _control_bmc_method_info_place_holder =
12392{
12393 {
12394 -1,
12395 (gchar *) "place_holder",
12396 NULL,
12397 NULL,
12398 NULL
12399 },
12400 "handle-place-holder",
12401 FALSE
12402};
12403
12404static const _ExtendedGDBusMethodInfo * const _control_bmc_method_info_pointers[] =
12405{
12406 &_control_bmc_method_info_place_holder,
12407 NULL
12408};
12409
12410static const _ExtendedGDBusInterfaceInfo _control_bmc_interface_info =
12411{
12412 {
12413 -1,
12414 (gchar *) "org.openbmc.control.Bmc",
12415 (GDBusMethodInfo **) &_control_bmc_method_info_pointers,
12416 NULL,
12417 NULL,
12418 NULL
12419 },
12420 "control-bmc",
12421};
12422
12423
12424/**
12425 * control_bmc_interface_info:
12426 *
12427 * 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.
12428 *
12429 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
12430 */
12431GDBusInterfaceInfo *
12432control_bmc_interface_info (void)
12433{
12434 return (GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct;
12435}
12436
12437/**
12438 * control_bmc_override_properties:
12439 * @klass: The class structure for a #GObject<!-- -->-derived class.
12440 * @property_id_begin: The property id to assign to the first overridden property.
12441 *
12442 * Overrides all #GObject properties in the #ControlBmc interface for a concrete class.
12443 * The properties are overridden in the order they are defined.
12444 *
12445 * Returns: The last property id.
12446 */
12447guint
12448control_bmc_override_properties (GObjectClass *klass, guint property_id_begin)
12449{
12450 return property_id_begin - 1;
12451}
12452
12453
12454
12455/**
12456 * ControlBmc:
12457 *
12458 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
12459 */
12460
12461/**
12462 * ControlBmcIface:
12463 * @parent_iface: The parent interface.
12464 * @handle_place_holder: Handler for the #ControlBmc::handle-place-holder signal.
12465 *
12466 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
12467 */
12468
12469typedef ControlBmcIface ControlBmcInterface;
12470G_DEFINE_INTERFACE (ControlBmc, control_bmc, G_TYPE_OBJECT);
12471
12472static void
12473control_bmc_default_init (ControlBmcIface *iface)
12474{
12475 /* GObject signals for incoming D-Bus method calls: */
12476 /**
12477 * ControlBmc::handle-place-holder:
12478 * @object: A #ControlBmc.
12479 * @invocation: A #GDBusMethodInvocation.
12480 *
12481 * 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.
12482 *
12483 * 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.
12484 *
12485 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
12486 */
12487 g_signal_new ("handle-place-holder",
12488 G_TYPE_FROM_INTERFACE (iface),
12489 G_SIGNAL_RUN_LAST,
12490 G_STRUCT_OFFSET (ControlBmcIface, handle_place_holder),
12491 g_signal_accumulator_true_handled,
12492 NULL,
12493 g_cclosure_marshal_generic,
12494 G_TYPE_BOOLEAN,
12495 1,
12496 G_TYPE_DBUS_METHOD_INVOCATION);
12497
12498}
12499
12500/**
12501 * control_bmc_call_place_holder:
12502 * @proxy: A #ControlBmcProxy.
12503 * @cancellable: (allow-none): A #GCancellable or %NULL.
12504 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
12505 * @user_data: User data to pass to @callback.
12506 *
12507 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.place_holder">place_holder()</link> D-Bus method on @proxy.
12508 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
12509 * You can then call control_bmc_call_place_holder_finish() to get the result of the operation.
12510 *
12511 * See control_bmc_call_place_holder_sync() for the synchronous, blocking version of this method.
12512 */
12513void
12514control_bmc_call_place_holder (
12515 ControlBmc *proxy,
12516 GCancellable *cancellable,
12517 GAsyncReadyCallback callback,
12518 gpointer user_data)
12519{
12520 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
12521 "place_holder",
12522 g_variant_new ("()"),
12523 G_DBUS_CALL_FLAGS_NONE,
12524 -1,
12525 cancellable,
12526 callback,
12527 user_data);
12528}
12529
12530/**
12531 * control_bmc_call_place_holder_finish:
12532 * @proxy: A #ControlBmcProxy.
12533 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_call_place_holder().
12534 * @error: Return location for error or %NULL.
12535 *
12536 * Finishes an operation started with control_bmc_call_place_holder().
12537 *
12538 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
12539 */
12540gboolean
12541control_bmc_call_place_holder_finish (
12542 ControlBmc *proxy,
12543 GAsyncResult *res,
12544 GError **error)
12545{
12546 GVariant *_ret;
12547 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
12548 if (_ret == NULL)
12549 goto _out;
12550 g_variant_get (_ret,
12551 "()");
12552 g_variant_unref (_ret);
12553_out:
12554 return _ret != NULL;
12555}
12556
12557/**
12558 * control_bmc_call_place_holder_sync:
12559 * @proxy: A #ControlBmcProxy.
12560 * @cancellable: (allow-none): A #GCancellable or %NULL.
12561 * @error: Return location for error or %NULL.
12562 *
12563 * 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.
12564 *
12565 * See control_bmc_call_place_holder() for the asynchronous version of this method.
12566 *
12567 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
12568 */
12569gboolean
12570control_bmc_call_place_holder_sync (
12571 ControlBmc *proxy,
12572 GCancellable *cancellable,
12573 GError **error)
12574{
12575 GVariant *_ret;
12576 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
12577 "place_holder",
12578 g_variant_new ("()"),
12579 G_DBUS_CALL_FLAGS_NONE,
12580 -1,
12581 cancellable,
12582 error);
12583 if (_ret == NULL)
12584 goto _out;
12585 g_variant_get (_ret,
12586 "()");
12587 g_variant_unref (_ret);
12588_out:
12589 return _ret != NULL;
12590}
12591
12592/**
12593 * control_bmc_complete_place_holder:
12594 * @object: A #ControlBmc.
12595 * @invocation: (transfer full): A #GDBusMethodInvocation.
12596 *
12597 * 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.
12598 *
12599 * This method will free @invocation, you cannot use it afterwards.
12600 */
12601void
12602control_bmc_complete_place_holder (
12603 ControlBmc *object,
12604 GDBusMethodInvocation *invocation)
12605{
12606 g_dbus_method_invocation_return_value (invocation,
12607 g_variant_new ("()"));
12608}
12609
12610/* ------------------------------------------------------------------------ */
12611
12612/**
12613 * ControlBmcProxy:
12614 *
12615 * The #ControlBmcProxy structure contains only private data and should only be accessed using the provided API.
12616 */
12617
12618/**
12619 * ControlBmcProxyClass:
12620 * @parent_class: The parent class.
12621 *
12622 * Class structure for #ControlBmcProxy.
12623 */
12624
12625struct _ControlBmcProxyPrivate
12626{
12627 GData *qdata;
12628};
12629
12630static void control_bmc_proxy_iface_init (ControlBmcIface *iface);
12631
12632#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12633G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY,
12634 G_ADD_PRIVATE (ControlBmcProxy)
12635 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init));
12636
12637#else
12638G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY,
12639 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init));
12640
12641#endif
12642static void
12643control_bmc_proxy_finalize (GObject *object)
12644{
12645 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (object);
12646 g_datalist_clear (&proxy->priv->qdata);
12647 G_OBJECT_CLASS (control_bmc_proxy_parent_class)->finalize (object);
12648}
12649
12650static void
12651control_bmc_proxy_get_property (GObject *object,
12652 guint prop_id,
12653 GValue *value,
12654 GParamSpec *pspec G_GNUC_UNUSED)
12655{
12656}
12657
12658static void
12659control_bmc_proxy_set_property (GObject *object,
12660 guint prop_id,
12661 const GValue *value,
12662 GParamSpec *pspec G_GNUC_UNUSED)
12663{
12664}
12665
12666static void
12667control_bmc_proxy_g_signal (GDBusProxy *proxy,
12668 const gchar *sender_name G_GNUC_UNUSED,
12669 const gchar *signal_name,
12670 GVariant *parameters)
12671{
12672 _ExtendedGDBusSignalInfo *info;
12673 GVariantIter iter;
12674 GVariant *child;
12675 GValue *paramv;
12676 guint num_params;
12677 guint n;
12678 guint signal_id;
12679 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, signal_name);
12680 if (info == NULL)
12681 return;
12682 num_params = g_variant_n_children (parameters);
12683 paramv = g_new0 (GValue, num_params + 1);
12684 g_value_init (&paramv[0], TYPE_CONTROL_BMC);
12685 g_value_set_object (&paramv[0], proxy);
12686 g_variant_iter_init (&iter, parameters);
12687 n = 1;
12688 while ((child = g_variant_iter_next_value (&iter)) != NULL)
12689 {
12690 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
12691 if (arg_info->use_gvariant)
12692 {
12693 g_value_init (&paramv[n], G_TYPE_VARIANT);
12694 g_value_set_variant (&paramv[n], child);
12695 n++;
12696 }
12697 else
12698 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
12699 g_variant_unref (child);
12700 }
12701 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC);
12702 g_signal_emitv (paramv, signal_id, 0, NULL);
12703 for (n = 0; n < num_params + 1; n++)
12704 g_value_unset (&paramv[n]);
12705 g_free (paramv);
12706}
12707
12708static void
12709control_bmc_proxy_g_properties_changed (GDBusProxy *_proxy,
12710 GVariant *changed_properties,
12711 const gchar *const *invalidated_properties)
12712{
12713 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (_proxy);
12714 guint n;
12715 const gchar *key;
12716 GVariantIter *iter;
12717 _ExtendedGDBusPropertyInfo *info;
12718 g_variant_get (changed_properties, "a{sv}", &iter);
12719 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
12720 {
12721 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, key);
12722 g_datalist_remove_data (&proxy->priv->qdata, key);
12723 if (info != NULL)
12724 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
12725 }
12726 g_variant_iter_free (iter);
12727 for (n = 0; invalidated_properties[n] != NULL; n++)
12728 {
12729 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, invalidated_properties[n]);
12730 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
12731 if (info != NULL)
12732 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
12733 }
12734}
12735
12736static void
12737control_bmc_proxy_init (ControlBmcProxy *proxy)
12738{
12739#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12740 proxy->priv = control_bmc_proxy_get_instance_private (proxy);
12741#else
12742 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_BMC_PROXY, ControlBmcProxyPrivate);
12743#endif
12744
12745 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_bmc_interface_info ());
12746}
12747
12748static void
12749control_bmc_proxy_class_init (ControlBmcProxyClass *klass)
12750{
12751 GObjectClass *gobject_class;
12752 GDBusProxyClass *proxy_class;
12753
12754 gobject_class = G_OBJECT_CLASS (klass);
12755 gobject_class->finalize = control_bmc_proxy_finalize;
12756 gobject_class->get_property = control_bmc_proxy_get_property;
12757 gobject_class->set_property = control_bmc_proxy_set_property;
12758
12759 proxy_class = G_DBUS_PROXY_CLASS (klass);
12760 proxy_class->g_signal = control_bmc_proxy_g_signal;
12761 proxy_class->g_properties_changed = control_bmc_proxy_g_properties_changed;
12762
12763#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
12764 g_type_class_add_private (klass, sizeof (ControlBmcProxyPrivate));
12765#endif
12766}
12767
12768static void
12769control_bmc_proxy_iface_init (ControlBmcIface *iface)
12770{
12771}
12772
12773/**
12774 * control_bmc_proxy_new:
12775 * @connection: A #GDBusConnection.
12776 * @flags: Flags from the #GDBusProxyFlags enumeration.
12777 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
12778 * @object_path: An object path.
12779 * @cancellable: (allow-none): A #GCancellable or %NULL.
12780 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
12781 * @user_data: User data to pass to @callback.
12782 *
12783 * 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.
12784 *
12785 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
12786 * You can then call control_bmc_proxy_new_finish() to get the result of the operation.
12787 *
12788 * See control_bmc_proxy_new_sync() for the synchronous, blocking version of this constructor.
12789 */
12790void
12791control_bmc_proxy_new (
12792 GDBusConnection *connection,
12793 GDBusProxyFlags flags,
12794 const gchar *name,
12795 const gchar *object_path,
12796 GCancellable *cancellable,
12797 GAsyncReadyCallback callback,
12798 gpointer user_data)
12799{
12800 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);
12801}
12802
12803/**
12804 * control_bmc_proxy_new_finish:
12805 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new().
12806 * @error: Return location for error or %NULL
12807 *
12808 * Finishes an operation started with control_bmc_proxy_new().
12809 *
12810 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
12811 */
12812ControlBmc *
12813control_bmc_proxy_new_finish (
12814 GAsyncResult *res,
12815 GError **error)
12816{
12817 GObject *ret;
12818 GObject *source_object;
12819 source_object = g_async_result_get_source_object (res);
12820 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
12821 g_object_unref (source_object);
12822 if (ret != NULL)
12823 return CONTROL_BMC (ret);
12824 else
12825 return NULL;
12826}
12827
12828/**
12829 * control_bmc_proxy_new_sync:
12830 * @connection: A #GDBusConnection.
12831 * @flags: Flags from the #GDBusProxyFlags enumeration.
12832 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
12833 * @object_path: An object path.
12834 * @cancellable: (allow-none): A #GCancellable or %NULL.
12835 * @error: Return location for error or %NULL
12836 *
12837 * 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.
12838 *
12839 * The calling thread is blocked until a reply is received.
12840 *
12841 * See control_bmc_proxy_new() for the asynchronous version of this constructor.
12842 *
12843 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
12844 */
12845ControlBmc *
12846control_bmc_proxy_new_sync (
12847 GDBusConnection *connection,
12848 GDBusProxyFlags flags,
12849 const gchar *name,
12850 const gchar *object_path,
12851 GCancellable *cancellable,
12852 GError **error)
12853{
12854 GInitable *ret;
12855 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);
12856 if (ret != NULL)
12857 return CONTROL_BMC (ret);
12858 else
12859 return NULL;
12860}
12861
12862
12863/**
12864 * control_bmc_proxy_new_for_bus:
12865 * @bus_type: A #GBusType.
12866 * @flags: Flags from the #GDBusProxyFlags enumeration.
12867 * @name: A bus name (well-known or unique).
12868 * @object_path: An object path.
12869 * @cancellable: (allow-none): A #GCancellable or %NULL.
12870 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
12871 * @user_data: User data to pass to @callback.
12872 *
12873 * Like control_bmc_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
12874 *
12875 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
12876 * You can then call control_bmc_proxy_new_for_bus_finish() to get the result of the operation.
12877 *
12878 * See control_bmc_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
12879 */
12880void
12881control_bmc_proxy_new_for_bus (
12882 GBusType bus_type,
12883 GDBusProxyFlags flags,
12884 const gchar *name,
12885 const gchar *object_path,
12886 GCancellable *cancellable,
12887 GAsyncReadyCallback callback,
12888 gpointer user_data)
12889{
12890 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);
12891}
12892
12893/**
12894 * control_bmc_proxy_new_for_bus_finish:
12895 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new_for_bus().
12896 * @error: Return location for error or %NULL
12897 *
12898 * Finishes an operation started with control_bmc_proxy_new_for_bus().
12899 *
12900 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
12901 */
12902ControlBmc *
12903control_bmc_proxy_new_for_bus_finish (
12904 GAsyncResult *res,
12905 GError **error)
12906{
12907 GObject *ret;
12908 GObject *source_object;
12909 source_object = g_async_result_get_source_object (res);
12910 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
12911 g_object_unref (source_object);
12912 if (ret != NULL)
12913 return CONTROL_BMC (ret);
12914 else
12915 return NULL;
12916}
12917
12918/**
12919 * control_bmc_proxy_new_for_bus_sync:
12920 * @bus_type: A #GBusType.
12921 * @flags: Flags from the #GDBusProxyFlags enumeration.
12922 * @name: A bus name (well-known or unique).
12923 * @object_path: An object path.
12924 * @cancellable: (allow-none): A #GCancellable or %NULL.
12925 * @error: Return location for error or %NULL
12926 *
12927 * Like control_bmc_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
12928 *
12929 * The calling thread is blocked until a reply is received.
12930 *
12931 * See control_bmc_proxy_new_for_bus() for the asynchronous version of this constructor.
12932 *
12933 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
12934 */
12935ControlBmc *
12936control_bmc_proxy_new_for_bus_sync (
12937 GBusType bus_type,
12938 GDBusProxyFlags flags,
12939 const gchar *name,
12940 const gchar *object_path,
12941 GCancellable *cancellable,
12942 GError **error)
12943{
12944 GInitable *ret;
12945 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);
12946 if (ret != NULL)
12947 return CONTROL_BMC (ret);
12948 else
12949 return NULL;
12950}
12951
12952
12953/* ------------------------------------------------------------------------ */
12954
12955/**
12956 * ControlBmcSkeleton:
12957 *
12958 * The #ControlBmcSkeleton structure contains only private data and should only be accessed using the provided API.
12959 */
12960
12961/**
12962 * ControlBmcSkeletonClass:
12963 * @parent_class: The parent class.
12964 *
12965 * Class structure for #ControlBmcSkeleton.
12966 */
12967
12968struct _ControlBmcSkeletonPrivate
12969{
12970 GValue *properties;
12971 GList *changed_properties;
12972 GSource *changed_properties_idle_source;
12973 GMainContext *context;
12974 GMutex lock;
12975};
12976
12977static void
12978_control_bmc_skeleton_handle_method_call (
12979 GDBusConnection *connection G_GNUC_UNUSED,
12980 const gchar *sender G_GNUC_UNUSED,
12981 const gchar *object_path G_GNUC_UNUSED,
12982 const gchar *interface_name,
12983 const gchar *method_name,
12984 GVariant *parameters,
12985 GDBusMethodInvocation *invocation,
12986 gpointer user_data)
12987{
12988 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
12989 _ExtendedGDBusMethodInfo *info;
12990 GVariantIter iter;
12991 GVariant *child;
12992 GValue *paramv;
12993 guint num_params;
12994 guint num_extra;
12995 guint n;
12996 guint signal_id;
12997 GValue return_value = G_VALUE_INIT;
12998 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
12999 g_assert (info != NULL);
13000 num_params = g_variant_n_children (parameters);
13001 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
13002 n = 0;
13003 g_value_init (&paramv[n], TYPE_CONTROL_BMC);
13004 g_value_set_object (&paramv[n++], skeleton);
13005 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
13006 g_value_set_object (&paramv[n++], invocation);
13007 if (info->pass_fdlist)
13008 {
13009#ifdef G_OS_UNIX
13010 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
13011 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
13012#else
13013 g_assert_not_reached ();
13014#endif
13015 }
13016 g_variant_iter_init (&iter, parameters);
13017 while ((child = g_variant_iter_next_value (&iter)) != NULL)
13018 {
13019 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
13020 if (arg_info->use_gvariant)
13021 {
13022 g_value_init (&paramv[n], G_TYPE_VARIANT);
13023 g_value_set_variant (&paramv[n], child);
13024 n++;
13025 }
13026 else
13027 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
13028 g_variant_unref (child);
13029 }
13030 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC);
13031 g_value_init (&return_value, G_TYPE_BOOLEAN);
13032 g_signal_emitv (paramv, signal_id, 0, &return_value);
13033 if (!g_value_get_boolean (&return_value))
13034 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);
13035 g_value_unset (&return_value);
13036 for (n = 0; n < num_params + num_extra; n++)
13037 g_value_unset (&paramv[n]);
13038 g_free (paramv);
13039}
13040
13041static GVariant *
13042_control_bmc_skeleton_handle_get_property (
13043 GDBusConnection *connection G_GNUC_UNUSED,
13044 const gchar *sender G_GNUC_UNUSED,
13045 const gchar *object_path G_GNUC_UNUSED,
13046 const gchar *interface_name G_GNUC_UNUSED,
13047 const gchar *property_name,
13048 GError **error,
13049 gpointer user_data)
13050{
13051 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
13052 GValue value = G_VALUE_INIT;
13053 GParamSpec *pspec;
13054 _ExtendedGDBusPropertyInfo *info;
13055 GVariant *ret;
13056 ret = NULL;
13057 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name);
13058 g_assert (info != NULL);
13059 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
13060 if (pspec == NULL)
13061 {
13062 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
13063 }
13064 else
13065 {
13066 g_value_init (&value, pspec->value_type);
13067 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
13068 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
13069 g_value_unset (&value);
13070 }
13071 return ret;
13072}
13073
13074static gboolean
13075_control_bmc_skeleton_handle_set_property (
13076 GDBusConnection *connection G_GNUC_UNUSED,
13077 const gchar *sender G_GNUC_UNUSED,
13078 const gchar *object_path G_GNUC_UNUSED,
13079 const gchar *interface_name G_GNUC_UNUSED,
13080 const gchar *property_name,
13081 GVariant *variant,
13082 GError **error,
13083 gpointer user_data)
13084{
13085 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
13086 GValue value = G_VALUE_INIT;
13087 GParamSpec *pspec;
13088 _ExtendedGDBusPropertyInfo *info;
13089 gboolean ret;
13090 ret = FALSE;
13091 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name);
13092 g_assert (info != NULL);
13093 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
13094 if (pspec == NULL)
13095 {
13096 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
13097 }
13098 else
13099 {
13100 if (info->use_gvariant)
13101 g_value_set_variant (&value, variant);
13102 else
13103 g_dbus_gvariant_to_gvalue (variant, &value);
13104 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
13105 g_value_unset (&value);
13106 ret = TRUE;
13107 }
13108 return ret;
13109}
13110
13111static const GDBusInterfaceVTable _control_bmc_skeleton_vtable =
13112{
13113 _control_bmc_skeleton_handle_method_call,
13114 _control_bmc_skeleton_handle_get_property,
13115 _control_bmc_skeleton_handle_set_property,
13116 {NULL}
13117};
13118
13119static GDBusInterfaceInfo *
13120control_bmc_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
13121{
13122 return control_bmc_interface_info ();
13123}
13124
13125static GDBusInterfaceVTable *
13126control_bmc_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
13127{
13128 return (GDBusInterfaceVTable *) &_control_bmc_skeleton_vtable;
13129}
13130
13131static GVariant *
13132control_bmc_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
13133{
13134 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (_skeleton);
13135
13136 GVariantBuilder builder;
13137 guint n;
13138 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
13139 if (_control_bmc_interface_info.parent_struct.properties == NULL)
13140 goto out;
13141 for (n = 0; _control_bmc_interface_info.parent_struct.properties[n] != NULL; n++)
13142 {
13143 GDBusPropertyInfo *info = _control_bmc_interface_info.parent_struct.properties[n];
13144 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
13145 {
13146 GVariant *value;
13147 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);
13148 if (value != NULL)
13149 {
13150 g_variant_take_ref (value);
13151 g_variant_builder_add (&builder, "{sv}", info->name, value);
13152 g_variant_unref (value);
13153 }
13154 }
13155 }
13156out:
13157 return g_variant_builder_end (&builder);
13158}
13159
13160static void
13161control_bmc_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
13162{
13163}
13164
13165static void control_bmc_skeleton_iface_init (ControlBmcIface *iface);
13166#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13167G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
13168 G_ADD_PRIVATE (ControlBmcSkeleton)
13169 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init));
13170
13171#else
13172G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
13173 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init));
13174
13175#endif
13176static void
13177control_bmc_skeleton_finalize (GObject *object)
13178{
13179 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (object);
13180 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
13181 if (skeleton->priv->changed_properties_idle_source != NULL)
13182 g_source_destroy (skeleton->priv->changed_properties_idle_source);
13183 g_main_context_unref (skeleton->priv->context);
13184 g_mutex_clear (&skeleton->priv->lock);
13185 G_OBJECT_CLASS (control_bmc_skeleton_parent_class)->finalize (object);
13186}
13187
13188static void
13189control_bmc_skeleton_init (ControlBmcSkeleton *skeleton)
13190{
13191#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13192 skeleton->priv = control_bmc_skeleton_get_instance_private (skeleton);
13193#else
13194 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_BMC_SKELETON, ControlBmcSkeletonPrivate);
13195#endif
13196
13197 g_mutex_init (&skeleton->priv->lock);
13198 skeleton->priv->context = g_main_context_ref_thread_default ();
13199}
13200
13201static void
13202control_bmc_skeleton_class_init (ControlBmcSkeletonClass *klass)
13203{
13204 GObjectClass *gobject_class;
13205 GDBusInterfaceSkeletonClass *skeleton_class;
13206
13207 gobject_class = G_OBJECT_CLASS (klass);
13208 gobject_class->finalize = control_bmc_skeleton_finalize;
13209
13210 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
13211 skeleton_class->get_info = control_bmc_skeleton_dbus_interface_get_info;
13212 skeleton_class->get_properties = control_bmc_skeleton_dbus_interface_get_properties;
13213 skeleton_class->flush = control_bmc_skeleton_dbus_interface_flush;
13214 skeleton_class->get_vtable = control_bmc_skeleton_dbus_interface_get_vtable;
13215
13216#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
13217 g_type_class_add_private (klass, sizeof (ControlBmcSkeletonPrivate));
13218#endif
13219}
13220
13221static void
13222control_bmc_skeleton_iface_init (ControlBmcIface *iface)
13223{
13224}
13225
13226/**
13227 * control_bmc_skeleton_new:
13228 *
13229 * 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>.
13230 *
13231 * Returns: (transfer full) (type ControlBmcSkeleton): The skeleton object.
13232 */
13233ControlBmc *
13234control_bmc_skeleton_new (void)
13235{
13236 return CONTROL_BMC (g_object_new (TYPE_CONTROL_BMC_SKELETON, NULL));
13237}
13238
13239/* ------------------------------------------------------------------------
13240 * Code for interface org.openbmc.control.Host
13241 * ------------------------------------------------------------------------
13242 */
13243
13244/**
13245 * SECTION:ControlHost
13246 * @title: ControlHost
13247 * @short_description: Generated C code for the org.openbmc.control.Host D-Bus interface
13248 *
13249 * 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.
13250 */
13251
13252/* ---- Introspection data for org.openbmc.control.Host ---- */
13253
13254static const _ExtendedGDBusMethodInfo _control_host_method_info_boot =
13255{
13256 {
13257 -1,
13258 (gchar *) "boot",
13259 NULL,
13260 NULL,
13261 NULL
13262 },
13263 "handle-boot",
13264 FALSE
13265};
13266
13267static const _ExtendedGDBusMethodInfo _control_host_method_info_shutdown =
13268{
13269 {
13270 -1,
13271 (gchar *) "shutdown",
13272 NULL,
13273 NULL,
13274 NULL
13275 },
13276 "handle-shutdown",
13277 FALSE
13278};
13279
13280static const _ExtendedGDBusMethodInfo _control_host_method_info_reboot =
13281{
13282 {
13283 -1,
13284 (gchar *) "reboot",
13285 NULL,
13286 NULL,
13287 NULL
13288 },
13289 "handle-reboot",
13290 FALSE
13291};
13292
13293static const _ExtendedGDBusMethodInfo * const _control_host_method_info_pointers[] =
13294{
13295 &_control_host_method_info_boot,
13296 &_control_host_method_info_shutdown,
13297 &_control_host_method_info_reboot,
13298 NULL
13299};
13300
13301static const _ExtendedGDBusSignalInfo _control_host_signal_info_booted =
13302{
13303 {
13304 -1,
13305 (gchar *) "Booted",
13306 NULL,
13307 NULL
13308 },
13309 "booted"
13310};
13311
13312static const _ExtendedGDBusSignalInfo * const _control_host_signal_info_pointers[] =
13313{
13314 &_control_host_signal_info_booted,
13315 NULL
13316};
13317
13318static const _ExtendedGDBusInterfaceInfo _control_host_interface_info =
13319{
13320 {
13321 -1,
13322 (gchar *) "org.openbmc.control.Host",
13323 (GDBusMethodInfo **) &_control_host_method_info_pointers,
13324 (GDBusSignalInfo **) &_control_host_signal_info_pointers,
13325 NULL,
13326 NULL
13327 },
13328 "control-host",
13329};
13330
13331
13332/**
13333 * control_host_interface_info:
13334 *
13335 * 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.
13336 *
13337 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
13338 */
13339GDBusInterfaceInfo *
13340control_host_interface_info (void)
13341{
13342 return (GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct;
13343}
13344
13345/**
13346 * control_host_override_properties:
13347 * @klass: The class structure for a #GObject<!-- -->-derived class.
13348 * @property_id_begin: The property id to assign to the first overridden property.
13349 *
13350 * Overrides all #GObject properties in the #ControlHost interface for a concrete class.
13351 * The properties are overridden in the order they are defined.
13352 *
13353 * Returns: The last property id.
13354 */
13355guint
13356control_host_override_properties (GObjectClass *klass, guint property_id_begin)
13357{
13358 return property_id_begin - 1;
13359}
13360
13361
13362
13363/**
13364 * ControlHost:
13365 *
13366 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
13367 */
13368
13369/**
13370 * ControlHostIface:
13371 * @parent_iface: The parent interface.
13372 * @handle_boot: Handler for the #ControlHost::handle-boot signal.
13373 * @handle_reboot: Handler for the #ControlHost::handle-reboot signal.
13374 * @handle_shutdown: Handler for the #ControlHost::handle-shutdown signal.
13375 * @booted: Handler for the #ControlHost::booted signal.
13376 *
13377 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
13378 */
13379
13380typedef ControlHostIface ControlHostInterface;
13381G_DEFINE_INTERFACE (ControlHost, control_host, G_TYPE_OBJECT);
13382
13383static void
13384control_host_default_init (ControlHostIface *iface)
13385{
13386 /* GObject signals for incoming D-Bus method calls: */
13387 /**
13388 * ControlHost::handle-boot:
13389 * @object: A #ControlHost.
13390 * @invocation: A #GDBusMethodInvocation.
13391 *
13392 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method.
13393 *
13394 * 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.
13395 *
13396 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
13397 */
13398 g_signal_new ("handle-boot",
13399 G_TYPE_FROM_INTERFACE (iface),
13400 G_SIGNAL_RUN_LAST,
13401 G_STRUCT_OFFSET (ControlHostIface, handle_boot),
13402 g_signal_accumulator_true_handled,
13403 NULL,
13404 g_cclosure_marshal_generic,
13405 G_TYPE_BOOLEAN,
13406 1,
13407 G_TYPE_DBUS_METHOD_INVOCATION);
13408
13409 /**
13410 * ControlHost::handle-shutdown:
13411 * @object: A #ControlHost.
13412 * @invocation: A #GDBusMethodInvocation.
13413 *
13414 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method.
13415 *
13416 * 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.
13417 *
13418 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
13419 */
13420 g_signal_new ("handle-shutdown",
13421 G_TYPE_FROM_INTERFACE (iface),
13422 G_SIGNAL_RUN_LAST,
13423 G_STRUCT_OFFSET (ControlHostIface, handle_shutdown),
13424 g_signal_accumulator_true_handled,
13425 NULL,
13426 g_cclosure_marshal_generic,
13427 G_TYPE_BOOLEAN,
13428 1,
13429 G_TYPE_DBUS_METHOD_INVOCATION);
13430
13431 /**
13432 * ControlHost::handle-reboot:
13433 * @object: A #ControlHost.
13434 * @invocation: A #GDBusMethodInvocation.
13435 *
13436 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method.
13437 *
13438 * 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.
13439 *
13440 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
13441 */
13442 g_signal_new ("handle-reboot",
13443 G_TYPE_FROM_INTERFACE (iface),
13444 G_SIGNAL_RUN_LAST,
13445 G_STRUCT_OFFSET (ControlHostIface, handle_reboot),
13446 g_signal_accumulator_true_handled,
13447 NULL,
13448 g_cclosure_marshal_generic,
13449 G_TYPE_BOOLEAN,
13450 1,
13451 G_TYPE_DBUS_METHOD_INVOCATION);
13452
13453 /* GObject signals for received D-Bus signals: */
13454 /**
13455 * ControlHost::booted:
13456 * @object: A #ControlHost.
13457 *
13458 * 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.
13459 *
13460 * 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.
13461 */
13462 g_signal_new ("booted",
13463 G_TYPE_FROM_INTERFACE (iface),
13464 G_SIGNAL_RUN_LAST,
13465 G_STRUCT_OFFSET (ControlHostIface, booted),
13466 NULL,
13467 NULL,
13468 g_cclosure_marshal_generic,
13469 G_TYPE_NONE,
13470 0);
13471
13472}
13473
13474/**
13475 * control_host_emit_booted:
13476 * @object: A #ControlHost.
13477 *
13478 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Host.Booted">"Booted"</link> D-Bus signal.
13479 */
13480void
13481control_host_emit_booted (
13482 ControlHost *object)
13483{
13484 g_signal_emit_by_name (object, "booted");
13485}
13486
13487/**
13488 * control_host_call_boot:
13489 * @proxy: A #ControlHostProxy.
13490 * @cancellable: (allow-none): A #GCancellable or %NULL.
13491 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
13492 * @user_data: User data to pass to @callback.
13493 *
13494 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method on @proxy.
13495 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
13496 * You can then call control_host_call_boot_finish() to get the result of the operation.
13497 *
13498 * See control_host_call_boot_sync() for the synchronous, blocking version of this method.
13499 */
13500void
13501control_host_call_boot (
13502 ControlHost *proxy,
13503 GCancellable *cancellable,
13504 GAsyncReadyCallback callback,
13505 gpointer user_data)
13506{
13507 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
13508 "boot",
13509 g_variant_new ("()"),
13510 G_DBUS_CALL_FLAGS_NONE,
13511 -1,
13512 cancellable,
13513 callback,
13514 user_data);
13515}
13516
13517/**
13518 * control_host_call_boot_finish:
13519 * @proxy: A #ControlHostProxy.
13520 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_boot().
13521 * @error: Return location for error or %NULL.
13522 *
13523 * Finishes an operation started with control_host_call_boot().
13524 *
13525 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13526 */
13527gboolean
13528control_host_call_boot_finish (
13529 ControlHost *proxy,
13530 GAsyncResult *res,
13531 GError **error)
13532{
13533 GVariant *_ret;
13534 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
13535 if (_ret == NULL)
13536 goto _out;
13537 g_variant_get (_ret,
13538 "()");
13539 g_variant_unref (_ret);
13540_out:
13541 return _ret != NULL;
13542}
13543
13544/**
13545 * control_host_call_boot_sync:
13546 * @proxy: A #ControlHostProxy.
13547 * @cancellable: (allow-none): A #GCancellable or %NULL.
13548 * @error: Return location for error or %NULL.
13549 *
13550 * 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.
13551 *
13552 * See control_host_call_boot() for the asynchronous version of this method.
13553 *
13554 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13555 */
13556gboolean
13557control_host_call_boot_sync (
13558 ControlHost *proxy,
13559 GCancellable *cancellable,
13560 GError **error)
13561{
13562 GVariant *_ret;
13563 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
13564 "boot",
13565 g_variant_new ("()"),
13566 G_DBUS_CALL_FLAGS_NONE,
13567 -1,
13568 cancellable,
13569 error);
13570 if (_ret == NULL)
13571 goto _out;
13572 g_variant_get (_ret,
13573 "()");
13574 g_variant_unref (_ret);
13575_out:
13576 return _ret != NULL;
13577}
13578
13579/**
13580 * control_host_call_shutdown:
13581 * @proxy: A #ControlHostProxy.
13582 * @cancellable: (allow-none): A #GCancellable or %NULL.
13583 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
13584 * @user_data: User data to pass to @callback.
13585 *
13586 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method on @proxy.
13587 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
13588 * You can then call control_host_call_shutdown_finish() to get the result of the operation.
13589 *
13590 * See control_host_call_shutdown_sync() for the synchronous, blocking version of this method.
13591 */
13592void
13593control_host_call_shutdown (
13594 ControlHost *proxy,
13595 GCancellable *cancellable,
13596 GAsyncReadyCallback callback,
13597 gpointer user_data)
13598{
13599 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
13600 "shutdown",
13601 g_variant_new ("()"),
13602 G_DBUS_CALL_FLAGS_NONE,
13603 -1,
13604 cancellable,
13605 callback,
13606 user_data);
13607}
13608
13609/**
13610 * control_host_call_shutdown_finish:
13611 * @proxy: A #ControlHostProxy.
13612 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_shutdown().
13613 * @error: Return location for error or %NULL.
13614 *
13615 * Finishes an operation started with control_host_call_shutdown().
13616 *
13617 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13618 */
13619gboolean
13620control_host_call_shutdown_finish (
13621 ControlHost *proxy,
13622 GAsyncResult *res,
13623 GError **error)
13624{
13625 GVariant *_ret;
13626 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
13627 if (_ret == NULL)
13628 goto _out;
13629 g_variant_get (_ret,
13630 "()");
13631 g_variant_unref (_ret);
13632_out:
13633 return _ret != NULL;
13634}
13635
13636/**
13637 * control_host_call_shutdown_sync:
13638 * @proxy: A #ControlHostProxy.
13639 * @cancellable: (allow-none): A #GCancellable or %NULL.
13640 * @error: Return location for error or %NULL.
13641 *
13642 * 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.
13643 *
13644 * See control_host_call_shutdown() for the asynchronous version of this method.
13645 *
13646 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13647 */
13648gboolean
13649control_host_call_shutdown_sync (
13650 ControlHost *proxy,
13651 GCancellable *cancellable,
13652 GError **error)
13653{
13654 GVariant *_ret;
13655 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
13656 "shutdown",
13657 g_variant_new ("()"),
13658 G_DBUS_CALL_FLAGS_NONE,
13659 -1,
13660 cancellable,
13661 error);
13662 if (_ret == NULL)
13663 goto _out;
13664 g_variant_get (_ret,
13665 "()");
13666 g_variant_unref (_ret);
13667_out:
13668 return _ret != NULL;
13669}
13670
13671/**
13672 * control_host_call_reboot:
13673 * @proxy: A #ControlHostProxy.
13674 * @cancellable: (allow-none): A #GCancellable or %NULL.
13675 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
13676 * @user_data: User data to pass to @callback.
13677 *
13678 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method on @proxy.
13679 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
13680 * You can then call control_host_call_reboot_finish() to get the result of the operation.
13681 *
13682 * See control_host_call_reboot_sync() for the synchronous, blocking version of this method.
13683 */
13684void
13685control_host_call_reboot (
13686 ControlHost *proxy,
13687 GCancellable *cancellable,
13688 GAsyncReadyCallback callback,
13689 gpointer user_data)
13690{
13691 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
13692 "reboot",
13693 g_variant_new ("()"),
13694 G_DBUS_CALL_FLAGS_NONE,
13695 -1,
13696 cancellable,
13697 callback,
13698 user_data);
13699}
13700
13701/**
13702 * control_host_call_reboot_finish:
13703 * @proxy: A #ControlHostProxy.
13704 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_reboot().
13705 * @error: Return location for error or %NULL.
13706 *
13707 * Finishes an operation started with control_host_call_reboot().
13708 *
13709 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13710 */
13711gboolean
13712control_host_call_reboot_finish (
13713 ControlHost *proxy,
13714 GAsyncResult *res,
13715 GError **error)
13716{
13717 GVariant *_ret;
13718 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
13719 if (_ret == NULL)
13720 goto _out;
13721 g_variant_get (_ret,
13722 "()");
13723 g_variant_unref (_ret);
13724_out:
13725 return _ret != NULL;
13726}
13727
13728/**
13729 * control_host_call_reboot_sync:
13730 * @proxy: A #ControlHostProxy.
13731 * @cancellable: (allow-none): A #GCancellable or %NULL.
13732 * @error: Return location for error or %NULL.
13733 *
13734 * 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.
13735 *
13736 * See control_host_call_reboot() for the asynchronous version of this method.
13737 *
13738 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13739 */
13740gboolean
13741control_host_call_reboot_sync (
13742 ControlHost *proxy,
13743 GCancellable *cancellable,
13744 GError **error)
13745{
13746 GVariant *_ret;
13747 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
13748 "reboot",
13749 g_variant_new ("()"),
13750 G_DBUS_CALL_FLAGS_NONE,
13751 -1,
13752 cancellable,
13753 error);
13754 if (_ret == NULL)
13755 goto _out;
13756 g_variant_get (_ret,
13757 "()");
13758 g_variant_unref (_ret);
13759_out:
13760 return _ret != NULL;
13761}
13762
13763/**
13764 * control_host_complete_boot:
13765 * @object: A #ControlHost.
13766 * @invocation: (transfer full): A #GDBusMethodInvocation.
13767 *
13768 * 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.
13769 *
13770 * This method will free @invocation, you cannot use it afterwards.
13771 */
13772void
13773control_host_complete_boot (
13774 ControlHost *object,
13775 GDBusMethodInvocation *invocation)
13776{
13777 g_dbus_method_invocation_return_value (invocation,
13778 g_variant_new ("()"));
13779}
13780
13781/**
13782 * control_host_complete_shutdown:
13783 * @object: A #ControlHost.
13784 * @invocation: (transfer full): A #GDBusMethodInvocation.
13785 *
13786 * 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.
13787 *
13788 * This method will free @invocation, you cannot use it afterwards.
13789 */
13790void
13791control_host_complete_shutdown (
13792 ControlHost *object,
13793 GDBusMethodInvocation *invocation)
13794{
13795 g_dbus_method_invocation_return_value (invocation,
13796 g_variant_new ("()"));
13797}
13798
13799/**
13800 * control_host_complete_reboot:
13801 * @object: A #ControlHost.
13802 * @invocation: (transfer full): A #GDBusMethodInvocation.
13803 *
13804 * 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.
13805 *
13806 * This method will free @invocation, you cannot use it afterwards.
13807 */
13808void
13809control_host_complete_reboot (
13810 ControlHost *object,
13811 GDBusMethodInvocation *invocation)
13812{
13813 g_dbus_method_invocation_return_value (invocation,
13814 g_variant_new ("()"));
13815}
13816
13817/* ------------------------------------------------------------------------ */
13818
13819/**
13820 * ControlHostProxy:
13821 *
13822 * The #ControlHostProxy structure contains only private data and should only be accessed using the provided API.
13823 */
13824
13825/**
13826 * ControlHostProxyClass:
13827 * @parent_class: The parent class.
13828 *
13829 * Class structure for #ControlHostProxy.
13830 */
13831
13832struct _ControlHostProxyPrivate
13833{
13834 GData *qdata;
13835};
13836
13837static void control_host_proxy_iface_init (ControlHostIface *iface);
13838
13839#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13840G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
13841 G_ADD_PRIVATE (ControlHostProxy)
13842 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
13843
13844#else
13845G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
13846 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
13847
13848#endif
13849static void
13850control_host_proxy_finalize (GObject *object)
13851{
13852 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object);
13853 g_datalist_clear (&proxy->priv->qdata);
13854 G_OBJECT_CLASS (control_host_proxy_parent_class)->finalize (object);
13855}
13856
13857static void
13858control_host_proxy_get_property (GObject *object,
13859 guint prop_id,
13860 GValue *value,
13861 GParamSpec *pspec G_GNUC_UNUSED)
13862{
13863}
13864
13865static void
13866control_host_proxy_set_property (GObject *object,
13867 guint prop_id,
13868 const GValue *value,
13869 GParamSpec *pspec G_GNUC_UNUSED)
13870{
13871}
13872
13873static void
13874control_host_proxy_g_signal (GDBusProxy *proxy,
13875 const gchar *sender_name G_GNUC_UNUSED,
13876 const gchar *signal_name,
13877 GVariant *parameters)
13878{
13879 _ExtendedGDBusSignalInfo *info;
13880 GVariantIter iter;
13881 GVariant *child;
13882 GValue *paramv;
13883 guint num_params;
13884 guint n;
13885 guint signal_id;
13886 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, signal_name);
13887 if (info == NULL)
13888 return;
13889 num_params = g_variant_n_children (parameters);
13890 paramv = g_new0 (GValue, num_params + 1);
13891 g_value_init (&paramv[0], TYPE_CONTROL_HOST);
13892 g_value_set_object (&paramv[0], proxy);
13893 g_variant_iter_init (&iter, parameters);
13894 n = 1;
13895 while ((child = g_variant_iter_next_value (&iter)) != NULL)
13896 {
13897 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
13898 if (arg_info->use_gvariant)
13899 {
13900 g_value_init (&paramv[n], G_TYPE_VARIANT);
13901 g_value_set_variant (&paramv[n], child);
13902 n++;
13903 }
13904 else
13905 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
13906 g_variant_unref (child);
13907 }
13908 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
13909 g_signal_emitv (paramv, signal_id, 0, NULL);
13910 for (n = 0; n < num_params + 1; n++)
13911 g_value_unset (&paramv[n]);
13912 g_free (paramv);
13913}
13914
13915static void
13916control_host_proxy_g_properties_changed (GDBusProxy *_proxy,
13917 GVariant *changed_properties,
13918 const gchar *const *invalidated_properties)
13919{
13920 ControlHostProxy *proxy = CONTROL_HOST_PROXY (_proxy);
13921 guint n;
13922 const gchar *key;
13923 GVariantIter *iter;
13924 _ExtendedGDBusPropertyInfo *info;
13925 g_variant_get (changed_properties, "a{sv}", &iter);
13926 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
13927 {
13928 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, key);
13929 g_datalist_remove_data (&proxy->priv->qdata, key);
13930 if (info != NULL)
13931 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
13932 }
13933 g_variant_iter_free (iter);
13934 for (n = 0; invalidated_properties[n] != NULL; n++)
13935 {
13936 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, invalidated_properties[n]);
13937 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
13938 if (info != NULL)
13939 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
13940 }
13941}
13942
13943static void
13944control_host_proxy_init (ControlHostProxy *proxy)
13945{
13946#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13947 proxy->priv = control_host_proxy_get_instance_private (proxy);
13948#else
13949 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_HOST_PROXY, ControlHostProxyPrivate);
13950#endif
13951
13952 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_host_interface_info ());
13953}
13954
13955static void
13956control_host_proxy_class_init (ControlHostProxyClass *klass)
13957{
13958 GObjectClass *gobject_class;
13959 GDBusProxyClass *proxy_class;
13960
13961 gobject_class = G_OBJECT_CLASS (klass);
13962 gobject_class->finalize = control_host_proxy_finalize;
13963 gobject_class->get_property = control_host_proxy_get_property;
13964 gobject_class->set_property = control_host_proxy_set_property;
13965
13966 proxy_class = G_DBUS_PROXY_CLASS (klass);
13967 proxy_class->g_signal = control_host_proxy_g_signal;
13968 proxy_class->g_properties_changed = control_host_proxy_g_properties_changed;
13969
13970#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
13971 g_type_class_add_private (klass, sizeof (ControlHostProxyPrivate));
13972#endif
13973}
13974
13975static void
13976control_host_proxy_iface_init (ControlHostIface *iface)
13977{
13978}
13979
13980/**
13981 * control_host_proxy_new:
13982 * @connection: A #GDBusConnection.
13983 * @flags: Flags from the #GDBusProxyFlags enumeration.
13984 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
13985 * @object_path: An object path.
13986 * @cancellable: (allow-none): A #GCancellable or %NULL.
13987 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
13988 * @user_data: User data to pass to @callback.
13989 *
13990 * 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.
13991 *
13992 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
13993 * You can then call control_host_proxy_new_finish() to get the result of the operation.
13994 *
13995 * See control_host_proxy_new_sync() for the synchronous, blocking version of this constructor.
13996 */
13997void
13998control_host_proxy_new (
13999 GDBusConnection *connection,
14000 GDBusProxyFlags flags,
14001 const gchar *name,
14002 const gchar *object_path,
14003 GCancellable *cancellable,
14004 GAsyncReadyCallback callback,
14005 gpointer user_data)
14006{
14007 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);
14008}
14009
14010/**
14011 * control_host_proxy_new_finish:
14012 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new().
14013 * @error: Return location for error or %NULL
14014 *
14015 * Finishes an operation started with control_host_proxy_new().
14016 *
14017 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
14018 */
14019ControlHost *
14020control_host_proxy_new_finish (
14021 GAsyncResult *res,
14022 GError **error)
14023{
14024 GObject *ret;
14025 GObject *source_object;
14026 source_object = g_async_result_get_source_object (res);
14027 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
14028 g_object_unref (source_object);
14029 if (ret != NULL)
14030 return CONTROL_HOST (ret);
14031 else
14032 return NULL;
14033}
14034
14035/**
14036 * control_host_proxy_new_sync:
14037 * @connection: A #GDBusConnection.
14038 * @flags: Flags from the #GDBusProxyFlags enumeration.
14039 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
14040 * @object_path: An object path.
14041 * @cancellable: (allow-none): A #GCancellable or %NULL.
14042 * @error: Return location for error or %NULL
14043 *
14044 * 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.
14045 *
14046 * The calling thread is blocked until a reply is received.
14047 *
14048 * See control_host_proxy_new() for the asynchronous version of this constructor.
14049 *
14050 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
14051 */
14052ControlHost *
14053control_host_proxy_new_sync (
14054 GDBusConnection *connection,
14055 GDBusProxyFlags flags,
14056 const gchar *name,
14057 const gchar *object_path,
14058 GCancellable *cancellable,
14059 GError **error)
14060{
14061 GInitable *ret;
14062 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);
14063 if (ret != NULL)
14064 return CONTROL_HOST (ret);
14065 else
14066 return NULL;
14067}
14068
14069
14070/**
14071 * control_host_proxy_new_for_bus:
14072 * @bus_type: A #GBusType.
14073 * @flags: Flags from the #GDBusProxyFlags enumeration.
14074 * @name: A bus name (well-known or unique).
14075 * @object_path: An object path.
14076 * @cancellable: (allow-none): A #GCancellable or %NULL.
14077 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
14078 * @user_data: User data to pass to @callback.
14079 *
14080 * Like control_host_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
14081 *
14082 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
14083 * You can then call control_host_proxy_new_for_bus_finish() to get the result of the operation.
14084 *
14085 * See control_host_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
14086 */
14087void
14088control_host_proxy_new_for_bus (
14089 GBusType bus_type,
14090 GDBusProxyFlags flags,
14091 const gchar *name,
14092 const gchar *object_path,
14093 GCancellable *cancellable,
14094 GAsyncReadyCallback callback,
14095 gpointer user_data)
14096{
14097 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);
14098}
14099
14100/**
14101 * control_host_proxy_new_for_bus_finish:
14102 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new_for_bus().
14103 * @error: Return location for error or %NULL
14104 *
14105 * Finishes an operation started with control_host_proxy_new_for_bus().
14106 *
14107 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
14108 */
14109ControlHost *
14110control_host_proxy_new_for_bus_finish (
14111 GAsyncResult *res,
14112 GError **error)
14113{
14114 GObject *ret;
14115 GObject *source_object;
14116 source_object = g_async_result_get_source_object (res);
14117 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
14118 g_object_unref (source_object);
14119 if (ret != NULL)
14120 return CONTROL_HOST (ret);
14121 else
14122 return NULL;
14123}
14124
14125/**
14126 * control_host_proxy_new_for_bus_sync:
14127 * @bus_type: A #GBusType.
14128 * @flags: Flags from the #GDBusProxyFlags enumeration.
14129 * @name: A bus name (well-known or unique).
14130 * @object_path: An object path.
14131 * @cancellable: (allow-none): A #GCancellable or %NULL.
14132 * @error: Return location for error or %NULL
14133 *
14134 * Like control_host_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
14135 *
14136 * The calling thread is blocked until a reply is received.
14137 *
14138 * See control_host_proxy_new_for_bus() for the asynchronous version of this constructor.
14139 *
14140 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
14141 */
14142ControlHost *
14143control_host_proxy_new_for_bus_sync (
14144 GBusType bus_type,
14145 GDBusProxyFlags flags,
14146 const gchar *name,
14147 const gchar *object_path,
14148 GCancellable *cancellable,
14149 GError **error)
14150{
14151 GInitable *ret;
14152 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);
14153 if (ret != NULL)
14154 return CONTROL_HOST (ret);
14155 else
14156 return NULL;
14157}
14158
14159
14160/* ------------------------------------------------------------------------ */
14161
14162/**
14163 * ControlHostSkeleton:
14164 *
14165 * The #ControlHostSkeleton structure contains only private data and should only be accessed using the provided API.
14166 */
14167
14168/**
14169 * ControlHostSkeletonClass:
14170 * @parent_class: The parent class.
14171 *
14172 * Class structure for #ControlHostSkeleton.
14173 */
14174
14175struct _ControlHostSkeletonPrivate
14176{
14177 GValue *properties;
14178 GList *changed_properties;
14179 GSource *changed_properties_idle_source;
14180 GMainContext *context;
14181 GMutex lock;
14182};
14183
14184static void
14185_control_host_skeleton_handle_method_call (
14186 GDBusConnection *connection G_GNUC_UNUSED,
14187 const gchar *sender G_GNUC_UNUSED,
14188 const gchar *object_path G_GNUC_UNUSED,
14189 const gchar *interface_name,
14190 const gchar *method_name,
14191 GVariant *parameters,
14192 GDBusMethodInvocation *invocation,
14193 gpointer user_data)
14194{
14195 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
14196 _ExtendedGDBusMethodInfo *info;
14197 GVariantIter iter;
14198 GVariant *child;
14199 GValue *paramv;
14200 guint num_params;
14201 guint num_extra;
14202 guint n;
14203 guint signal_id;
14204 GValue return_value = G_VALUE_INIT;
14205 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
14206 g_assert (info != NULL);
14207 num_params = g_variant_n_children (parameters);
14208 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
14209 n = 0;
14210 g_value_init (&paramv[n], TYPE_CONTROL_HOST);
14211 g_value_set_object (&paramv[n++], skeleton);
14212 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
14213 g_value_set_object (&paramv[n++], invocation);
14214 if (info->pass_fdlist)
14215 {
14216#ifdef G_OS_UNIX
14217 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
14218 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
14219#else
14220 g_assert_not_reached ();
14221#endif
14222 }
14223 g_variant_iter_init (&iter, parameters);
14224 while ((child = g_variant_iter_next_value (&iter)) != NULL)
14225 {
14226 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
14227 if (arg_info->use_gvariant)
14228 {
14229 g_value_init (&paramv[n], G_TYPE_VARIANT);
14230 g_value_set_variant (&paramv[n], child);
14231 n++;
14232 }
14233 else
14234 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
14235 g_variant_unref (child);
14236 }
14237 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
14238 g_value_init (&return_value, G_TYPE_BOOLEAN);
14239 g_signal_emitv (paramv, signal_id, 0, &return_value);
14240 if (!g_value_get_boolean (&return_value))
14241 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);
14242 g_value_unset (&return_value);
14243 for (n = 0; n < num_params + num_extra; n++)
14244 g_value_unset (&paramv[n]);
14245 g_free (paramv);
14246}
14247
14248static GVariant *
14249_control_host_skeleton_handle_get_property (
14250 GDBusConnection *connection G_GNUC_UNUSED,
14251 const gchar *sender G_GNUC_UNUSED,
14252 const gchar *object_path G_GNUC_UNUSED,
14253 const gchar *interface_name G_GNUC_UNUSED,
14254 const gchar *property_name,
14255 GError **error,
14256 gpointer user_data)
14257{
14258 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
14259 GValue value = G_VALUE_INIT;
14260 GParamSpec *pspec;
14261 _ExtendedGDBusPropertyInfo *info;
14262 GVariant *ret;
14263 ret = NULL;
14264 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
14265 g_assert (info != NULL);
14266 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
14267 if (pspec == NULL)
14268 {
14269 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
14270 }
14271 else
14272 {
14273 g_value_init (&value, pspec->value_type);
14274 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
14275 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
14276 g_value_unset (&value);
14277 }
14278 return ret;
14279}
14280
14281static gboolean
14282_control_host_skeleton_handle_set_property (
14283 GDBusConnection *connection G_GNUC_UNUSED,
14284 const gchar *sender G_GNUC_UNUSED,
14285 const gchar *object_path G_GNUC_UNUSED,
14286 const gchar *interface_name G_GNUC_UNUSED,
14287 const gchar *property_name,
14288 GVariant *variant,
14289 GError **error,
14290 gpointer user_data)
14291{
14292 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
14293 GValue value = G_VALUE_INIT;
14294 GParamSpec *pspec;
14295 _ExtendedGDBusPropertyInfo *info;
14296 gboolean ret;
14297 ret = FALSE;
14298 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
14299 g_assert (info != NULL);
14300 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
14301 if (pspec == NULL)
14302 {
14303 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
14304 }
14305 else
14306 {
14307 if (info->use_gvariant)
14308 g_value_set_variant (&value, variant);
14309 else
14310 g_dbus_gvariant_to_gvalue (variant, &value);
14311 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
14312 g_value_unset (&value);
14313 ret = TRUE;
14314 }
14315 return ret;
14316}
14317
14318static const GDBusInterfaceVTable _control_host_skeleton_vtable =
14319{
14320 _control_host_skeleton_handle_method_call,
14321 _control_host_skeleton_handle_get_property,
14322 _control_host_skeleton_handle_set_property,
14323 {NULL}
14324};
14325
14326static GDBusInterfaceInfo *
14327control_host_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
14328{
14329 return control_host_interface_info ();
14330}
14331
14332static GDBusInterfaceVTable *
14333control_host_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
14334{
14335 return (GDBusInterfaceVTable *) &_control_host_skeleton_vtable;
14336}
14337
14338static GVariant *
14339control_host_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
14340{
14341 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton);
14342
14343 GVariantBuilder builder;
14344 guint n;
14345 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
14346 if (_control_host_interface_info.parent_struct.properties == NULL)
14347 goto out;
14348 for (n = 0; _control_host_interface_info.parent_struct.properties[n] != NULL; n++)
14349 {
14350 GDBusPropertyInfo *info = _control_host_interface_info.parent_struct.properties[n];
14351 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
14352 {
14353 GVariant *value;
14354 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);
14355 if (value != NULL)
14356 {
14357 g_variant_take_ref (value);
14358 g_variant_builder_add (&builder, "{sv}", info->name, value);
14359 g_variant_unref (value);
14360 }
14361 }
14362 }
14363out:
14364 return g_variant_builder_end (&builder);
14365}
14366
14367static void
14368control_host_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
14369{
14370}
14371
14372static void
14373_control_host_on_signal_booted (
14374 ControlHost *object)
14375{
14376 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
14377
14378 GList *connections, *l;
14379 GVariant *signal_variant;
14380 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
14381
14382 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
14383 for (l = connections; l != NULL; l = l->next)
14384 {
14385 GDBusConnection *connection = l->data;
14386 g_dbus_connection_emit_signal (connection,
14387 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Host", "Booted",
14388 signal_variant, NULL);
14389 }
14390 g_variant_unref (signal_variant);
14391 g_list_free_full (connections, g_object_unref);
14392}
14393
14394static void control_host_skeleton_iface_init (ControlHostIface *iface);
14395#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14396G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
14397 G_ADD_PRIVATE (ControlHostSkeleton)
14398 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
14399
14400#else
14401G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
14402 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
14403
14404#endif
14405static void
14406control_host_skeleton_finalize (GObject *object)
14407{
14408 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
14409 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
14410 if (skeleton->priv->changed_properties_idle_source != NULL)
14411 g_source_destroy (skeleton->priv->changed_properties_idle_source);
14412 g_main_context_unref (skeleton->priv->context);
14413 g_mutex_clear (&skeleton->priv->lock);
14414 G_OBJECT_CLASS (control_host_skeleton_parent_class)->finalize (object);
14415}
14416
14417static void
14418control_host_skeleton_init (ControlHostSkeleton *skeleton)
14419{
14420#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14421 skeleton->priv = control_host_skeleton_get_instance_private (skeleton);
14422#else
14423 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_HOST_SKELETON, ControlHostSkeletonPrivate);
14424#endif
14425
14426 g_mutex_init (&skeleton->priv->lock);
14427 skeleton->priv->context = g_main_context_ref_thread_default ();
14428}
14429
14430static void
14431control_host_skeleton_class_init (ControlHostSkeletonClass *klass)
14432{
14433 GObjectClass *gobject_class;
14434 GDBusInterfaceSkeletonClass *skeleton_class;
14435
14436 gobject_class = G_OBJECT_CLASS (klass);
14437 gobject_class->finalize = control_host_skeleton_finalize;
14438
14439 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
14440 skeleton_class->get_info = control_host_skeleton_dbus_interface_get_info;
14441 skeleton_class->get_properties = control_host_skeleton_dbus_interface_get_properties;
14442 skeleton_class->flush = control_host_skeleton_dbus_interface_flush;
14443 skeleton_class->get_vtable = control_host_skeleton_dbus_interface_get_vtable;
14444
14445#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
14446 g_type_class_add_private (klass, sizeof (ControlHostSkeletonPrivate));
14447#endif
14448}
14449
14450static void
14451control_host_skeleton_iface_init (ControlHostIface *iface)
14452{
14453 iface->booted = _control_host_on_signal_booted;
14454}
14455
14456/**
14457 * control_host_skeleton_new:
14458 *
14459 * 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>.
14460 *
14461 * Returns: (transfer full) (type ControlHostSkeleton): The skeleton object.
14462 */
14463ControlHost *
14464control_host_skeleton_new (void)
14465{
14466 return CONTROL_HOST (g_object_new (TYPE_CONTROL_HOST_SKELETON, NULL));
14467}
14468
14469/* ------------------------------------------------------------------------
14470 * Code for interface org.openbmc.control.Power
14471 * ------------------------------------------------------------------------
14472 */
14473
14474/**
14475 * SECTION:ControlPower
14476 * @title: ControlPower
14477 * @short_description: Generated C code for the org.openbmc.control.Power D-Bus interface
14478 *
14479 * 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.
14480 */
14481
14482/* ---- Introspection data for org.openbmc.control.Power ---- */
14483
14484static const _ExtendedGDBusArgInfo _control_power_method_info_set_power_state_IN_ARG_state =
14485{
14486 {
14487 -1,
14488 (gchar *) "state",
14489 (gchar *) "i",
14490 NULL
14491 },
14492 FALSE
14493};
14494
14495static const _ExtendedGDBusArgInfo * const _control_power_method_info_set_power_state_IN_ARG_pointers[] =
14496{
14497 &_control_power_method_info_set_power_state_IN_ARG_state,
14498 NULL
14499};
14500
14501static const _ExtendedGDBusMethodInfo _control_power_method_info_set_power_state =
14502{
14503 {
14504 -1,
14505 (gchar *) "setPowerState",
14506 (GDBusArgInfo **) &_control_power_method_info_set_power_state_IN_ARG_pointers,
14507 NULL,
14508 NULL
14509 },
14510 "handle-set-power-state",
14511 FALSE
14512};
14513
14514static const _ExtendedGDBusArgInfo _control_power_method_info_get_power_state_OUT_ARG_state =
14515{
14516 {
14517 -1,
14518 (gchar *) "state",
14519 (gchar *) "i",
14520 NULL
14521 },
14522 FALSE
14523};
14524
14525static const _ExtendedGDBusArgInfo * const _control_power_method_info_get_power_state_OUT_ARG_pointers[] =
14526{
14527 &_control_power_method_info_get_power_state_OUT_ARG_state,
14528 NULL
14529};
14530
14531static const _ExtendedGDBusMethodInfo _control_power_method_info_get_power_state =
14532{
14533 {
14534 -1,
14535 (gchar *) "getPowerState",
14536 NULL,
14537 (GDBusArgInfo **) &_control_power_method_info_get_power_state_OUT_ARG_pointers,
14538 NULL
14539 },
14540 "handle-get-power-state",
14541 FALSE
14542};
14543
14544static const _ExtendedGDBusMethodInfo * const _control_power_method_info_pointers[] =
14545{
14546 &_control_power_method_info_set_power_state,
14547 &_control_power_method_info_get_power_state,
14548 NULL
14549};
14550
14551static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_good =
14552{
14553 {
14554 -1,
14555 (gchar *) "PowerGood",
14556 NULL,
14557 NULL
14558 },
14559 "power-good"
14560};
14561
14562static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_lost =
14563{
14564 {
14565 -1,
14566 (gchar *) "PowerLost",
14567 NULL,
14568 NULL
14569 },
14570 "power-lost"
14571};
14572
14573static const _ExtendedGDBusSignalInfo * const _control_power_signal_info_pointers[] =
14574{
14575 &_control_power_signal_info_power_good,
14576 &_control_power_signal_info_power_lost,
14577 NULL
14578};
14579
14580static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood =
14581{
14582 {
14583 -1,
14584 (gchar *) "pgood",
14585 (gchar *) "i",
14586 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
14587 NULL
14588 },
14589 "pgood",
14590 FALSE
14591};
14592
14593static const _ExtendedGDBusPropertyInfo _control_power_property_info_state =
14594{
14595 {
14596 -1,
14597 (gchar *) "state",
14598 (gchar *) "i",
14599 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
14600 NULL
14601 },
14602 "state",
14603 FALSE
14604};
14605
Norman James32e74e22015-09-15 21:28:06 -050014606static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood_timeout =
14607{
14608 {
14609 -1,
14610 (gchar *) "pgood_timeout",
14611 (gchar *) "i",
14612 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
14613 NULL
14614 },
14615 "pgood-timeout",
14616 FALSE
14617};
14618
Norman James362a80f2015-09-14 14:04:39 -050014619static const _ExtendedGDBusPropertyInfo * const _control_power_property_info_pointers[] =
14620{
14621 &_control_power_property_info_pgood,
14622 &_control_power_property_info_state,
Norman James32e74e22015-09-15 21:28:06 -050014623 &_control_power_property_info_pgood_timeout,
Norman James362a80f2015-09-14 14:04:39 -050014624 NULL
14625};
14626
14627static const _ExtendedGDBusInterfaceInfo _control_power_interface_info =
14628{
14629 {
14630 -1,
14631 (gchar *) "org.openbmc.control.Power",
14632 (GDBusMethodInfo **) &_control_power_method_info_pointers,
14633 (GDBusSignalInfo **) &_control_power_signal_info_pointers,
14634 (GDBusPropertyInfo **) &_control_power_property_info_pointers,
14635 NULL
14636 },
14637 "control-power",
14638};
14639
14640
14641/**
14642 * control_power_interface_info:
14643 *
14644 * 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.
14645 *
14646 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
14647 */
14648GDBusInterfaceInfo *
14649control_power_interface_info (void)
14650{
14651 return (GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct;
14652}
14653
14654/**
14655 * control_power_override_properties:
14656 * @klass: The class structure for a #GObject<!-- -->-derived class.
14657 * @property_id_begin: The property id to assign to the first overridden property.
14658 *
14659 * Overrides all #GObject properties in the #ControlPower interface for a concrete class.
14660 * The properties are overridden in the order they are defined.
14661 *
14662 * Returns: The last property id.
14663 */
14664guint
14665control_power_override_properties (GObjectClass *klass, guint property_id_begin)
14666{
14667 g_object_class_override_property (klass, property_id_begin++, "pgood");
14668 g_object_class_override_property (klass, property_id_begin++, "state");
Norman James32e74e22015-09-15 21:28:06 -050014669 g_object_class_override_property (klass, property_id_begin++, "pgood-timeout");
Norman James362a80f2015-09-14 14:04:39 -050014670 return property_id_begin - 1;
14671}
14672
14673
14674
14675/**
14676 * ControlPower:
14677 *
14678 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
14679 */
14680
14681/**
14682 * ControlPowerIface:
14683 * @parent_iface: The parent interface.
14684 * @handle_get_power_state: Handler for the #ControlPower::handle-get-power-state signal.
14685 * @handle_set_power_state: Handler for the #ControlPower::handle-set-power-state signal.
14686 * @get_pgood: Getter for the #ControlPower:pgood property.
Norman James32e74e22015-09-15 21:28:06 -050014687 * @get_pgood_timeout: Getter for the #ControlPower:pgood-timeout property.
Norman James362a80f2015-09-14 14:04:39 -050014688 * @get_state: Getter for the #ControlPower:state property.
14689 * @power_good: Handler for the #ControlPower::power-good signal.
14690 * @power_lost: Handler for the #ControlPower::power-lost signal.
14691 *
14692 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
14693 */
14694
14695typedef ControlPowerIface ControlPowerInterface;
14696G_DEFINE_INTERFACE (ControlPower, control_power, G_TYPE_OBJECT);
14697
14698static void
14699control_power_default_init (ControlPowerIface *iface)
14700{
14701 /* GObject signals for incoming D-Bus method calls: */
14702 /**
14703 * ControlPower::handle-set-power-state:
14704 * @object: A #ControlPower.
14705 * @invocation: A #GDBusMethodInvocation.
14706 * @arg_state: Argument passed by remote caller.
14707 *
14708 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method.
14709 *
14710 * 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.
14711 *
14712 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14713 */
14714 g_signal_new ("handle-set-power-state",
14715 G_TYPE_FROM_INTERFACE (iface),
14716 G_SIGNAL_RUN_LAST,
14717 G_STRUCT_OFFSET (ControlPowerIface, handle_set_power_state),
14718 g_signal_accumulator_true_handled,
14719 NULL,
14720 g_cclosure_marshal_generic,
14721 G_TYPE_BOOLEAN,
14722 2,
14723 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
14724
14725 /**
14726 * ControlPower::handle-get-power-state:
14727 * @object: A #ControlPower.
14728 * @invocation: A #GDBusMethodInvocation.
14729 *
14730 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method.
14731 *
14732 * 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.
14733 *
14734 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14735 */
14736 g_signal_new ("handle-get-power-state",
14737 G_TYPE_FROM_INTERFACE (iface),
14738 G_SIGNAL_RUN_LAST,
14739 G_STRUCT_OFFSET (ControlPowerIface, handle_get_power_state),
14740 g_signal_accumulator_true_handled,
14741 NULL,
14742 g_cclosure_marshal_generic,
14743 G_TYPE_BOOLEAN,
14744 1,
14745 G_TYPE_DBUS_METHOD_INVOCATION);
14746
14747 /* GObject signals for received D-Bus signals: */
14748 /**
14749 * ControlPower::power-good:
14750 * @object: A #ControlPower.
14751 *
14752 * 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.
14753 *
14754 * 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.
14755 */
14756 g_signal_new ("power-good",
14757 G_TYPE_FROM_INTERFACE (iface),
14758 G_SIGNAL_RUN_LAST,
14759 G_STRUCT_OFFSET (ControlPowerIface, power_good),
14760 NULL,
14761 NULL,
14762 g_cclosure_marshal_generic,
14763 G_TYPE_NONE,
14764 0);
14765
14766 /**
14767 * ControlPower::power-lost:
14768 * @object: A #ControlPower.
14769 *
14770 * 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.
14771 *
14772 * 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.
14773 */
14774 g_signal_new ("power-lost",
14775 G_TYPE_FROM_INTERFACE (iface),
14776 G_SIGNAL_RUN_LAST,
14777 G_STRUCT_OFFSET (ControlPowerIface, power_lost),
14778 NULL,
14779 NULL,
14780 g_cclosure_marshal_generic,
14781 G_TYPE_NONE,
14782 0);
14783
14784 /* GObject properties for D-Bus properties: */
14785 /**
14786 * ControlPower:pgood:
14787 *
14788 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link>.
14789 *
14790 * 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.
14791 */
14792 g_object_interface_install_property (iface,
14793 g_param_spec_int ("pgood", "pgood", "pgood", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
14794 /**
14795 * ControlPower:state:
14796 *
14797 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link>.
14798 *
14799 * 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.
14800 */
14801 g_object_interface_install_property (iface,
14802 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 -050014803 /**
14804 * ControlPower:pgood-timeout:
14805 *
14806 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link>.
14807 *
14808 * 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.
14809 */
14810 g_object_interface_install_property (iface,
14811 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 -050014812}
14813
14814/**
14815 * control_power_get_pgood: (skip)
14816 * @object: A #ControlPower.
14817 *
14818 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property.
14819 *
14820 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
14821 *
14822 * Returns: The property value.
14823 */
14824gint
14825control_power_get_pgood (ControlPower *object)
14826{
14827 return CONTROL_POWER_GET_IFACE (object)->get_pgood (object);
14828}
14829
14830/**
14831 * control_power_set_pgood: (skip)
14832 * @object: A #ControlPower.
14833 * @value: The value to set.
14834 *
14835 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property to @value.
14836 *
14837 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
14838 */
14839void
14840control_power_set_pgood (ControlPower *object, gint value)
14841{
14842 g_object_set (G_OBJECT (object), "pgood", value, NULL);
14843}
14844
14845/**
14846 * control_power_get_state: (skip)
14847 * @object: A #ControlPower.
14848 *
14849 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property.
14850 *
14851 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
14852 *
14853 * Returns: The property value.
14854 */
14855gint
14856control_power_get_state (ControlPower *object)
14857{
14858 return CONTROL_POWER_GET_IFACE (object)->get_state (object);
14859}
14860
14861/**
14862 * control_power_set_state: (skip)
14863 * @object: A #ControlPower.
14864 * @value: The value to set.
14865 *
14866 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property to @value.
14867 *
14868 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
14869 */
14870void
14871control_power_set_state (ControlPower *object, gint value)
14872{
14873 g_object_set (G_OBJECT (object), "state", value, NULL);
14874}
14875
14876/**
Norman James32e74e22015-09-15 21:28:06 -050014877 * control_power_get_pgood_timeout: (skip)
14878 * @object: A #ControlPower.
14879 *
14880 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property.
14881 *
14882 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
14883 *
14884 * Returns: The property value.
14885 */
14886gint
14887control_power_get_pgood_timeout (ControlPower *object)
14888{
14889 return CONTROL_POWER_GET_IFACE (object)->get_pgood_timeout (object);
14890}
14891
14892/**
14893 * control_power_set_pgood_timeout: (skip)
14894 * @object: A #ControlPower.
14895 * @value: The value to set.
14896 *
14897 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property to @value.
14898 *
14899 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
14900 */
14901void
14902control_power_set_pgood_timeout (ControlPower *object, gint value)
14903{
14904 g_object_set (G_OBJECT (object), "pgood-timeout", value, NULL);
14905}
14906
14907/**
Norman James362a80f2015-09-14 14:04:39 -050014908 * control_power_emit_power_good:
14909 * @object: A #ControlPower.
14910 *
14911 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerGood">"PowerGood"</link> D-Bus signal.
14912 */
14913void
14914control_power_emit_power_good (
14915 ControlPower *object)
14916{
14917 g_signal_emit_by_name (object, "power-good");
14918}
14919
14920/**
14921 * control_power_emit_power_lost:
14922 * @object: A #ControlPower.
14923 *
14924 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerLost">"PowerLost"</link> D-Bus signal.
14925 */
14926void
14927control_power_emit_power_lost (
14928 ControlPower *object)
14929{
14930 g_signal_emit_by_name (object, "power-lost");
14931}
14932
14933/**
14934 * control_power_call_set_power_state:
14935 * @proxy: A #ControlPowerProxy.
14936 * @arg_state: Argument to pass with the method invocation.
14937 * @cancellable: (allow-none): A #GCancellable or %NULL.
14938 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
14939 * @user_data: User data to pass to @callback.
14940 *
14941 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method on @proxy.
14942 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
14943 * You can then call control_power_call_set_power_state_finish() to get the result of the operation.
14944 *
14945 * See control_power_call_set_power_state_sync() for the synchronous, blocking version of this method.
14946 */
14947void
14948control_power_call_set_power_state (
14949 ControlPower *proxy,
14950 gint arg_state,
14951 GCancellable *cancellable,
14952 GAsyncReadyCallback callback,
14953 gpointer user_data)
14954{
14955 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
14956 "setPowerState",
14957 g_variant_new ("(i)",
14958 arg_state),
14959 G_DBUS_CALL_FLAGS_NONE,
14960 -1,
14961 cancellable,
14962 callback,
14963 user_data);
14964}
14965
14966/**
14967 * control_power_call_set_power_state_finish:
14968 * @proxy: A #ControlPowerProxy.
14969 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_set_power_state().
14970 * @error: Return location for error or %NULL.
14971 *
14972 * Finishes an operation started with control_power_call_set_power_state().
14973 *
14974 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14975 */
14976gboolean
14977control_power_call_set_power_state_finish (
14978 ControlPower *proxy,
14979 GAsyncResult *res,
14980 GError **error)
14981{
14982 GVariant *_ret;
14983 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
14984 if (_ret == NULL)
14985 goto _out;
14986 g_variant_get (_ret,
14987 "()");
14988 g_variant_unref (_ret);
14989_out:
14990 return _ret != NULL;
14991}
14992
14993/**
14994 * control_power_call_set_power_state_sync:
14995 * @proxy: A #ControlPowerProxy.
14996 * @arg_state: Argument to pass with the method invocation.
14997 * @cancellable: (allow-none): A #GCancellable or %NULL.
14998 * @error: Return location for error or %NULL.
14999 *
15000 * 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.
15001 *
15002 * See control_power_call_set_power_state() for the asynchronous version of this method.
15003 *
15004 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15005 */
15006gboolean
15007control_power_call_set_power_state_sync (
15008 ControlPower *proxy,
15009 gint arg_state,
15010 GCancellable *cancellable,
15011 GError **error)
15012{
15013 GVariant *_ret;
15014 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
15015 "setPowerState",
15016 g_variant_new ("(i)",
15017 arg_state),
15018 G_DBUS_CALL_FLAGS_NONE,
15019 -1,
15020 cancellable,
15021 error);
15022 if (_ret == NULL)
15023 goto _out;
15024 g_variant_get (_ret,
15025 "()");
15026 g_variant_unref (_ret);
15027_out:
15028 return _ret != NULL;
15029}
15030
15031/**
15032 * control_power_call_get_power_state:
15033 * @proxy: A #ControlPowerProxy.
15034 * @cancellable: (allow-none): A #GCancellable or %NULL.
15035 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
15036 * @user_data: User data to pass to @callback.
15037 *
15038 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method on @proxy.
15039 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
15040 * You can then call control_power_call_get_power_state_finish() to get the result of the operation.
15041 *
15042 * See control_power_call_get_power_state_sync() for the synchronous, blocking version of this method.
15043 */
15044void
15045control_power_call_get_power_state (
15046 ControlPower *proxy,
15047 GCancellable *cancellable,
15048 GAsyncReadyCallback callback,
15049 gpointer user_data)
15050{
15051 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
15052 "getPowerState",
15053 g_variant_new ("()"),
15054 G_DBUS_CALL_FLAGS_NONE,
15055 -1,
15056 cancellable,
15057 callback,
15058 user_data);
15059}
15060
15061/**
15062 * control_power_call_get_power_state_finish:
15063 * @proxy: A #ControlPowerProxy.
15064 * @out_state: (out): Return location for return parameter or %NULL to ignore.
15065 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_get_power_state().
15066 * @error: Return location for error or %NULL.
15067 *
15068 * Finishes an operation started with control_power_call_get_power_state().
15069 *
15070 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15071 */
15072gboolean
15073control_power_call_get_power_state_finish (
15074 ControlPower *proxy,
15075 gint *out_state,
15076 GAsyncResult *res,
15077 GError **error)
15078{
15079 GVariant *_ret;
15080 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
15081 if (_ret == NULL)
15082 goto _out;
15083 g_variant_get (_ret,
15084 "(i)",
15085 out_state);
15086 g_variant_unref (_ret);
15087_out:
15088 return _ret != NULL;
15089}
15090
15091/**
15092 * control_power_call_get_power_state_sync:
15093 * @proxy: A #ControlPowerProxy.
15094 * @out_state: (out): Return location for return parameter or %NULL to ignore.
15095 * @cancellable: (allow-none): A #GCancellable or %NULL.
15096 * @error: Return location for error or %NULL.
15097 *
15098 * 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.
15099 *
15100 * See control_power_call_get_power_state() for the asynchronous version of this method.
15101 *
15102 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15103 */
15104gboolean
15105control_power_call_get_power_state_sync (
15106 ControlPower *proxy,
15107 gint *out_state,
15108 GCancellable *cancellable,
15109 GError **error)
15110{
15111 GVariant *_ret;
15112 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
15113 "getPowerState",
15114 g_variant_new ("()"),
15115 G_DBUS_CALL_FLAGS_NONE,
15116 -1,
15117 cancellable,
15118 error);
15119 if (_ret == NULL)
15120 goto _out;
15121 g_variant_get (_ret,
15122 "(i)",
15123 out_state);
15124 g_variant_unref (_ret);
15125_out:
15126 return _ret != NULL;
15127}
15128
15129/**
15130 * control_power_complete_set_power_state:
15131 * @object: A #ControlPower.
15132 * @invocation: (transfer full): A #GDBusMethodInvocation.
15133 *
15134 * 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.
15135 *
15136 * This method will free @invocation, you cannot use it afterwards.
15137 */
15138void
15139control_power_complete_set_power_state (
15140 ControlPower *object,
15141 GDBusMethodInvocation *invocation)
15142{
15143 g_dbus_method_invocation_return_value (invocation,
15144 g_variant_new ("()"));
15145}
15146
15147/**
15148 * control_power_complete_get_power_state:
15149 * @object: A #ControlPower.
15150 * @invocation: (transfer full): A #GDBusMethodInvocation.
15151 * @state: Parameter to return.
15152 *
15153 * 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.
15154 *
15155 * This method will free @invocation, you cannot use it afterwards.
15156 */
15157void
15158control_power_complete_get_power_state (
15159 ControlPower *object,
15160 GDBusMethodInvocation *invocation,
15161 gint state)
15162{
15163 g_dbus_method_invocation_return_value (invocation,
15164 g_variant_new ("(i)",
15165 state));
15166}
15167
15168/* ------------------------------------------------------------------------ */
15169
15170/**
15171 * ControlPowerProxy:
15172 *
15173 * The #ControlPowerProxy structure contains only private data and should only be accessed using the provided API.
15174 */
15175
15176/**
15177 * ControlPowerProxyClass:
15178 * @parent_class: The parent class.
15179 *
15180 * Class structure for #ControlPowerProxy.
15181 */
15182
15183struct _ControlPowerProxyPrivate
15184{
15185 GData *qdata;
15186};
15187
15188static void control_power_proxy_iface_init (ControlPowerIface *iface);
15189
15190#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15191G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
15192 G_ADD_PRIVATE (ControlPowerProxy)
15193 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init));
15194
15195#else
15196G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
15197 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init));
15198
15199#endif
15200static void
15201control_power_proxy_finalize (GObject *object)
15202{
15203 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
15204 g_datalist_clear (&proxy->priv->qdata);
15205 G_OBJECT_CLASS (control_power_proxy_parent_class)->finalize (object);
15206}
15207
15208static void
15209control_power_proxy_get_property (GObject *object,
15210 guint prop_id,
15211 GValue *value,
15212 GParamSpec *pspec G_GNUC_UNUSED)
15213{
15214 const _ExtendedGDBusPropertyInfo *info;
15215 GVariant *variant;
Norman James32e74e22015-09-15 21:28:06 -050015216 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050015217 info = _control_power_property_info_pointers[prop_id - 1];
15218 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
15219 if (info->use_gvariant)
15220 {
15221 g_value_set_variant (value, variant);
15222 }
15223 else
15224 {
15225 if (variant != NULL)
15226 g_dbus_gvariant_to_gvalue (variant, value);
15227 }
15228 if (variant != NULL)
15229 g_variant_unref (variant);
15230}
15231
15232static void
15233control_power_proxy_set_property_cb (GDBusProxy *proxy,
15234 GAsyncResult *res,
15235 gpointer user_data)
15236{
15237 const _ExtendedGDBusPropertyInfo *info = user_data;
15238 GError *error;
15239 GVariant *_ret;
15240 error = NULL;
15241 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
15242 if (!_ret)
15243 {
15244 g_warning ("Error setting property '%s' on interface org.openbmc.control.Power: %s (%s, %d)",
15245 info->parent_struct.name,
15246 error->message, g_quark_to_string (error->domain), error->code);
15247 g_error_free (error);
15248 }
15249 else
15250 {
15251 g_variant_unref (_ret);
15252 }
15253}
15254
15255static void
15256control_power_proxy_set_property (GObject *object,
15257 guint prop_id,
15258 const GValue *value,
15259 GParamSpec *pspec G_GNUC_UNUSED)
15260{
15261 const _ExtendedGDBusPropertyInfo *info;
15262 GVariant *variant;
Norman James32e74e22015-09-15 21:28:06 -050015263 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050015264 info = _control_power_property_info_pointers[prop_id - 1];
15265 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
15266 g_dbus_proxy_call (G_DBUS_PROXY (object),
15267 "org.freedesktop.DBus.Properties.Set",
15268 g_variant_new ("(ssv)", "org.openbmc.control.Power", info->parent_struct.name, variant),
15269 G_DBUS_CALL_FLAGS_NONE,
15270 -1,
15271 NULL, (GAsyncReadyCallback) control_power_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
15272 g_variant_unref (variant);
15273}
15274
15275static void
15276control_power_proxy_g_signal (GDBusProxy *proxy,
15277 const gchar *sender_name G_GNUC_UNUSED,
15278 const gchar *signal_name,
15279 GVariant *parameters)
15280{
15281 _ExtendedGDBusSignalInfo *info;
15282 GVariantIter iter;
15283 GVariant *child;
15284 GValue *paramv;
15285 guint num_params;
15286 guint n;
15287 guint signal_id;
15288 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, signal_name);
15289 if (info == NULL)
15290 return;
15291 num_params = g_variant_n_children (parameters);
15292 paramv = g_new0 (GValue, num_params + 1);
15293 g_value_init (&paramv[0], TYPE_CONTROL_POWER);
15294 g_value_set_object (&paramv[0], proxy);
15295 g_variant_iter_init (&iter, parameters);
15296 n = 1;
15297 while ((child = g_variant_iter_next_value (&iter)) != NULL)
15298 {
15299 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
15300 if (arg_info->use_gvariant)
15301 {
15302 g_value_init (&paramv[n], G_TYPE_VARIANT);
15303 g_value_set_variant (&paramv[n], child);
15304 n++;
15305 }
15306 else
15307 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
15308 g_variant_unref (child);
15309 }
15310 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
15311 g_signal_emitv (paramv, signal_id, 0, NULL);
15312 for (n = 0; n < num_params + 1; n++)
15313 g_value_unset (&paramv[n]);
15314 g_free (paramv);
15315}
15316
15317static void
15318control_power_proxy_g_properties_changed (GDBusProxy *_proxy,
15319 GVariant *changed_properties,
15320 const gchar *const *invalidated_properties)
15321{
15322 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (_proxy);
15323 guint n;
15324 const gchar *key;
15325 GVariantIter *iter;
15326 _ExtendedGDBusPropertyInfo *info;
15327 g_variant_get (changed_properties, "a{sv}", &iter);
15328 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
15329 {
15330 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, key);
15331 g_datalist_remove_data (&proxy->priv->qdata, key);
15332 if (info != NULL)
15333 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
15334 }
15335 g_variant_iter_free (iter);
15336 for (n = 0; invalidated_properties[n] != NULL; n++)
15337 {
15338 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, invalidated_properties[n]);
15339 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
15340 if (info != NULL)
15341 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
15342 }
15343}
15344
15345static gint
15346control_power_proxy_get_pgood (ControlPower *object)
15347{
15348 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
15349 GVariant *variant;
15350 gint value = 0;
15351 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood");
15352 if (variant != NULL)
15353 {
15354 value = g_variant_get_int32 (variant);
15355 g_variant_unref (variant);
15356 }
15357 return value;
15358}
15359
15360static gint
15361control_power_proxy_get_state (ControlPower *object)
15362{
15363 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
15364 GVariant *variant;
15365 gint value = 0;
15366 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
15367 if (variant != NULL)
15368 {
15369 value = g_variant_get_int32 (variant);
15370 g_variant_unref (variant);
15371 }
15372 return value;
15373}
15374
Norman James32e74e22015-09-15 21:28:06 -050015375static gint
15376control_power_proxy_get_pgood_timeout (ControlPower *object)
15377{
15378 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
15379 GVariant *variant;
15380 gint value = 0;
15381 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood_timeout");
15382 if (variant != NULL)
15383 {
15384 value = g_variant_get_int32 (variant);
15385 g_variant_unref (variant);
15386 }
15387 return value;
15388}
15389
Norman James362a80f2015-09-14 14:04:39 -050015390static void
15391control_power_proxy_init (ControlPowerProxy *proxy)
15392{
15393#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15394 proxy->priv = control_power_proxy_get_instance_private (proxy);
15395#else
15396 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_POWER_PROXY, ControlPowerProxyPrivate);
15397#endif
15398
15399 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_power_interface_info ());
15400}
15401
15402static void
15403control_power_proxy_class_init (ControlPowerProxyClass *klass)
15404{
15405 GObjectClass *gobject_class;
15406 GDBusProxyClass *proxy_class;
15407
15408 gobject_class = G_OBJECT_CLASS (klass);
15409 gobject_class->finalize = control_power_proxy_finalize;
15410 gobject_class->get_property = control_power_proxy_get_property;
15411 gobject_class->set_property = control_power_proxy_set_property;
15412
15413 proxy_class = G_DBUS_PROXY_CLASS (klass);
15414 proxy_class->g_signal = control_power_proxy_g_signal;
15415 proxy_class->g_properties_changed = control_power_proxy_g_properties_changed;
15416
15417 control_power_override_properties (gobject_class, 1);
15418
15419#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
15420 g_type_class_add_private (klass, sizeof (ControlPowerProxyPrivate));
15421#endif
15422}
15423
15424static void
15425control_power_proxy_iface_init (ControlPowerIface *iface)
15426{
15427 iface->get_pgood = control_power_proxy_get_pgood;
15428 iface->get_state = control_power_proxy_get_state;
Norman James32e74e22015-09-15 21:28:06 -050015429 iface->get_pgood_timeout = control_power_proxy_get_pgood_timeout;
Norman James362a80f2015-09-14 14:04:39 -050015430}
15431
15432/**
15433 * control_power_proxy_new:
15434 * @connection: A #GDBusConnection.
15435 * @flags: Flags from the #GDBusProxyFlags enumeration.
15436 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
15437 * @object_path: An object path.
15438 * @cancellable: (allow-none): A #GCancellable or %NULL.
15439 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
15440 * @user_data: User data to pass to @callback.
15441 *
15442 * 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.
15443 *
15444 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
15445 * You can then call control_power_proxy_new_finish() to get the result of the operation.
15446 *
15447 * See control_power_proxy_new_sync() for the synchronous, blocking version of this constructor.
15448 */
15449void
15450control_power_proxy_new (
15451 GDBusConnection *connection,
15452 GDBusProxyFlags flags,
15453 const gchar *name,
15454 const gchar *object_path,
15455 GCancellable *cancellable,
15456 GAsyncReadyCallback callback,
15457 gpointer user_data)
15458{
15459 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);
15460}
15461
15462/**
15463 * control_power_proxy_new_finish:
15464 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new().
15465 * @error: Return location for error or %NULL
15466 *
15467 * Finishes an operation started with control_power_proxy_new().
15468 *
15469 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
15470 */
15471ControlPower *
15472control_power_proxy_new_finish (
15473 GAsyncResult *res,
15474 GError **error)
15475{
15476 GObject *ret;
15477 GObject *source_object;
15478 source_object = g_async_result_get_source_object (res);
15479 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
15480 g_object_unref (source_object);
15481 if (ret != NULL)
15482 return CONTROL_POWER (ret);
15483 else
15484 return NULL;
15485}
15486
15487/**
15488 * control_power_proxy_new_sync:
15489 * @connection: A #GDBusConnection.
15490 * @flags: Flags from the #GDBusProxyFlags enumeration.
15491 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
15492 * @object_path: An object path.
15493 * @cancellable: (allow-none): A #GCancellable or %NULL.
15494 * @error: Return location for error or %NULL
15495 *
15496 * 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.
15497 *
15498 * The calling thread is blocked until a reply is received.
15499 *
15500 * See control_power_proxy_new() for the asynchronous version of this constructor.
15501 *
15502 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
15503 */
15504ControlPower *
15505control_power_proxy_new_sync (
15506 GDBusConnection *connection,
15507 GDBusProxyFlags flags,
15508 const gchar *name,
15509 const gchar *object_path,
15510 GCancellable *cancellable,
15511 GError **error)
15512{
15513 GInitable *ret;
15514 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);
15515 if (ret != NULL)
15516 return CONTROL_POWER (ret);
15517 else
15518 return NULL;
15519}
15520
15521
15522/**
15523 * control_power_proxy_new_for_bus:
15524 * @bus_type: A #GBusType.
15525 * @flags: Flags from the #GDBusProxyFlags enumeration.
15526 * @name: A bus name (well-known or unique).
15527 * @object_path: An object path.
15528 * @cancellable: (allow-none): A #GCancellable or %NULL.
15529 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
15530 * @user_data: User data to pass to @callback.
15531 *
15532 * Like control_power_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
15533 *
15534 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
15535 * You can then call control_power_proxy_new_for_bus_finish() to get the result of the operation.
15536 *
15537 * See control_power_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
15538 */
15539void
15540control_power_proxy_new_for_bus (
15541 GBusType bus_type,
15542 GDBusProxyFlags flags,
15543 const gchar *name,
15544 const gchar *object_path,
15545 GCancellable *cancellable,
15546 GAsyncReadyCallback callback,
15547 gpointer user_data)
15548{
15549 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);
15550}
15551
15552/**
15553 * control_power_proxy_new_for_bus_finish:
15554 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new_for_bus().
15555 * @error: Return location for error or %NULL
15556 *
15557 * Finishes an operation started with control_power_proxy_new_for_bus().
15558 *
15559 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
15560 */
15561ControlPower *
15562control_power_proxy_new_for_bus_finish (
15563 GAsyncResult *res,
15564 GError **error)
15565{
15566 GObject *ret;
15567 GObject *source_object;
15568 source_object = g_async_result_get_source_object (res);
15569 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
15570 g_object_unref (source_object);
15571 if (ret != NULL)
15572 return CONTROL_POWER (ret);
15573 else
15574 return NULL;
15575}
15576
15577/**
15578 * control_power_proxy_new_for_bus_sync:
15579 * @bus_type: A #GBusType.
15580 * @flags: Flags from the #GDBusProxyFlags enumeration.
15581 * @name: A bus name (well-known or unique).
15582 * @object_path: An object path.
15583 * @cancellable: (allow-none): A #GCancellable or %NULL.
15584 * @error: Return location for error or %NULL
15585 *
15586 * Like control_power_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
15587 *
15588 * The calling thread is blocked until a reply is received.
15589 *
15590 * See control_power_proxy_new_for_bus() for the asynchronous version of this constructor.
15591 *
15592 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
15593 */
15594ControlPower *
15595control_power_proxy_new_for_bus_sync (
15596 GBusType bus_type,
15597 GDBusProxyFlags flags,
15598 const gchar *name,
15599 const gchar *object_path,
15600 GCancellable *cancellable,
15601 GError **error)
15602{
15603 GInitable *ret;
15604 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);
15605 if (ret != NULL)
15606 return CONTROL_POWER (ret);
15607 else
15608 return NULL;
15609}
15610
15611
15612/* ------------------------------------------------------------------------ */
15613
15614/**
15615 * ControlPowerSkeleton:
15616 *
15617 * The #ControlPowerSkeleton structure contains only private data and should only be accessed using the provided API.
15618 */
15619
15620/**
15621 * ControlPowerSkeletonClass:
15622 * @parent_class: The parent class.
15623 *
15624 * Class structure for #ControlPowerSkeleton.
15625 */
15626
15627struct _ControlPowerSkeletonPrivate
15628{
15629 GValue *properties;
15630 GList *changed_properties;
15631 GSource *changed_properties_idle_source;
15632 GMainContext *context;
15633 GMutex lock;
15634};
15635
15636static void
15637_control_power_skeleton_handle_method_call (
15638 GDBusConnection *connection G_GNUC_UNUSED,
15639 const gchar *sender G_GNUC_UNUSED,
15640 const gchar *object_path G_GNUC_UNUSED,
15641 const gchar *interface_name,
15642 const gchar *method_name,
15643 GVariant *parameters,
15644 GDBusMethodInvocation *invocation,
15645 gpointer user_data)
15646{
15647 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
15648 _ExtendedGDBusMethodInfo *info;
15649 GVariantIter iter;
15650 GVariant *child;
15651 GValue *paramv;
15652 guint num_params;
15653 guint num_extra;
15654 guint n;
15655 guint signal_id;
15656 GValue return_value = G_VALUE_INIT;
15657 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
15658 g_assert (info != NULL);
15659 num_params = g_variant_n_children (parameters);
15660 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
15661 n = 0;
15662 g_value_init (&paramv[n], TYPE_CONTROL_POWER);
15663 g_value_set_object (&paramv[n++], skeleton);
15664 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
15665 g_value_set_object (&paramv[n++], invocation);
15666 if (info->pass_fdlist)
15667 {
15668#ifdef G_OS_UNIX
15669 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
15670 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
15671#else
15672 g_assert_not_reached ();
15673#endif
15674 }
15675 g_variant_iter_init (&iter, parameters);
15676 while ((child = g_variant_iter_next_value (&iter)) != NULL)
15677 {
15678 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
15679 if (arg_info->use_gvariant)
15680 {
15681 g_value_init (&paramv[n], G_TYPE_VARIANT);
15682 g_value_set_variant (&paramv[n], child);
15683 n++;
15684 }
15685 else
15686 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
15687 g_variant_unref (child);
15688 }
15689 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
15690 g_value_init (&return_value, G_TYPE_BOOLEAN);
15691 g_signal_emitv (paramv, signal_id, 0, &return_value);
15692 if (!g_value_get_boolean (&return_value))
15693 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);
15694 g_value_unset (&return_value);
15695 for (n = 0; n < num_params + num_extra; n++)
15696 g_value_unset (&paramv[n]);
15697 g_free (paramv);
15698}
15699
15700static GVariant *
15701_control_power_skeleton_handle_get_property (
15702 GDBusConnection *connection G_GNUC_UNUSED,
15703 const gchar *sender G_GNUC_UNUSED,
15704 const gchar *object_path G_GNUC_UNUSED,
15705 const gchar *interface_name G_GNUC_UNUSED,
15706 const gchar *property_name,
15707 GError **error,
15708 gpointer user_data)
15709{
15710 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
15711 GValue value = G_VALUE_INIT;
15712 GParamSpec *pspec;
15713 _ExtendedGDBusPropertyInfo *info;
15714 GVariant *ret;
15715 ret = NULL;
15716 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
15717 g_assert (info != NULL);
15718 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
15719 if (pspec == NULL)
15720 {
15721 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
15722 }
15723 else
15724 {
15725 g_value_init (&value, pspec->value_type);
15726 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
15727 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
15728 g_value_unset (&value);
15729 }
15730 return ret;
15731}
15732
15733static gboolean
15734_control_power_skeleton_handle_set_property (
15735 GDBusConnection *connection G_GNUC_UNUSED,
15736 const gchar *sender G_GNUC_UNUSED,
15737 const gchar *object_path G_GNUC_UNUSED,
15738 const gchar *interface_name G_GNUC_UNUSED,
15739 const gchar *property_name,
15740 GVariant *variant,
15741 GError **error,
15742 gpointer user_data)
15743{
15744 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
15745 GValue value = G_VALUE_INIT;
15746 GParamSpec *pspec;
15747 _ExtendedGDBusPropertyInfo *info;
15748 gboolean ret;
15749 ret = FALSE;
15750 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
15751 g_assert (info != NULL);
15752 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
15753 if (pspec == NULL)
15754 {
15755 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
15756 }
15757 else
15758 {
15759 if (info->use_gvariant)
15760 g_value_set_variant (&value, variant);
15761 else
15762 g_dbus_gvariant_to_gvalue (variant, &value);
15763 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
15764 g_value_unset (&value);
15765 ret = TRUE;
15766 }
15767 return ret;
15768}
15769
15770static const GDBusInterfaceVTable _control_power_skeleton_vtable =
15771{
15772 _control_power_skeleton_handle_method_call,
15773 _control_power_skeleton_handle_get_property,
15774 _control_power_skeleton_handle_set_property,
15775 {NULL}
15776};
15777
15778static GDBusInterfaceInfo *
15779control_power_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
15780{
15781 return control_power_interface_info ();
15782}
15783
15784static GDBusInterfaceVTable *
15785control_power_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
15786{
15787 return (GDBusInterfaceVTable *) &_control_power_skeleton_vtable;
15788}
15789
15790static GVariant *
15791control_power_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
15792{
15793 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
15794
15795 GVariantBuilder builder;
15796 guint n;
15797 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
15798 if (_control_power_interface_info.parent_struct.properties == NULL)
15799 goto out;
15800 for (n = 0; _control_power_interface_info.parent_struct.properties[n] != NULL; n++)
15801 {
15802 GDBusPropertyInfo *info = _control_power_interface_info.parent_struct.properties[n];
15803 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
15804 {
15805 GVariant *value;
15806 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);
15807 if (value != NULL)
15808 {
15809 g_variant_take_ref (value);
15810 g_variant_builder_add (&builder, "{sv}", info->name, value);
15811 g_variant_unref (value);
15812 }
15813 }
15814 }
15815out:
15816 return g_variant_builder_end (&builder);
15817}
15818
15819static gboolean _control_power_emit_changed (gpointer user_data);
15820
15821static void
15822control_power_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
15823{
15824 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
15825 gboolean emit_changed = FALSE;
15826
15827 g_mutex_lock (&skeleton->priv->lock);
15828 if (skeleton->priv->changed_properties_idle_source != NULL)
15829 {
15830 g_source_destroy (skeleton->priv->changed_properties_idle_source);
15831 skeleton->priv->changed_properties_idle_source = NULL;
15832 emit_changed = TRUE;
15833 }
15834 g_mutex_unlock (&skeleton->priv->lock);
15835
15836 if (emit_changed)
15837 _control_power_emit_changed (skeleton);
15838}
15839
15840static void
15841_control_power_on_signal_power_good (
15842 ControlPower *object)
15843{
15844 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
15845
15846 GList *connections, *l;
15847 GVariant *signal_variant;
15848 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
15849
15850 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
15851 for (l = connections; l != NULL; l = l->next)
15852 {
15853 GDBusConnection *connection = l->data;
15854 g_dbus_connection_emit_signal (connection,
15855 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerGood",
15856 signal_variant, NULL);
15857 }
15858 g_variant_unref (signal_variant);
15859 g_list_free_full (connections, g_object_unref);
15860}
15861
15862static void
15863_control_power_on_signal_power_lost (
15864 ControlPower *object)
15865{
15866 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
15867
15868 GList *connections, *l;
15869 GVariant *signal_variant;
15870 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
15871
15872 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
15873 for (l = connections; l != NULL; l = l->next)
15874 {
15875 GDBusConnection *connection = l->data;
15876 g_dbus_connection_emit_signal (connection,
15877 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerLost",
15878 signal_variant, NULL);
15879 }
15880 g_variant_unref (signal_variant);
15881 g_list_free_full (connections, g_object_unref);
15882}
15883
15884static void control_power_skeleton_iface_init (ControlPowerIface *iface);
15885#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15886G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
15887 G_ADD_PRIVATE (ControlPowerSkeleton)
15888 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init));
15889
15890#else
15891G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
15892 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init));
15893
15894#endif
15895static void
15896control_power_skeleton_finalize (GObject *object)
15897{
15898 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
15899 guint n;
Norman James32e74e22015-09-15 21:28:06 -050015900 for (n = 0; n < 3; n++)
Norman James362a80f2015-09-14 14:04:39 -050015901 g_value_unset (&skeleton->priv->properties[n]);
15902 g_free (skeleton->priv->properties);
15903 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
15904 if (skeleton->priv->changed_properties_idle_source != NULL)
15905 g_source_destroy (skeleton->priv->changed_properties_idle_source);
15906 g_main_context_unref (skeleton->priv->context);
15907 g_mutex_clear (&skeleton->priv->lock);
15908 G_OBJECT_CLASS (control_power_skeleton_parent_class)->finalize (object);
15909}
15910
15911static void
15912control_power_skeleton_get_property (GObject *object,
15913 guint prop_id,
15914 GValue *value,
15915 GParamSpec *pspec G_GNUC_UNUSED)
15916{
15917 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
Norman James32e74e22015-09-15 21:28:06 -050015918 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050015919 g_mutex_lock (&skeleton->priv->lock);
15920 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
15921 g_mutex_unlock (&skeleton->priv->lock);
15922}
15923
15924static gboolean
15925_control_power_emit_changed (gpointer user_data)
15926{
15927 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
15928 GList *l;
15929 GVariantBuilder builder;
15930 GVariantBuilder invalidated_builder;
15931 guint num_changes;
15932
15933 g_mutex_lock (&skeleton->priv->lock);
15934 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
15935 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
15936 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
15937 {
15938 ChangedProperty *cp = l->data;
15939 GVariant *variant;
15940 const GValue *cur_value;
15941
15942 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
15943 if (!_g_value_equal (cur_value, &cp->orig_value))
15944 {
15945 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
15946 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
15947 g_variant_unref (variant);
15948 num_changes++;
15949 }
15950 }
15951 if (num_changes > 0)
15952 {
15953 GList *connections, *ll;
15954 GVariant *signal_variant;
15955 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.control.Power",
15956 &builder, &invalidated_builder));
15957 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
15958 for (ll = connections; ll != NULL; ll = ll->next)
15959 {
15960 GDBusConnection *connection = ll->data;
15961
15962 g_dbus_connection_emit_signal (connection,
15963 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
15964 "org.freedesktop.DBus.Properties",
15965 "PropertiesChanged",
15966 signal_variant,
15967 NULL);
15968 }
15969 g_variant_unref (signal_variant);
15970 g_list_free_full (connections, g_object_unref);
15971 }
15972 else
15973 {
15974 g_variant_builder_clear (&builder);
15975 g_variant_builder_clear (&invalidated_builder);
15976 }
15977 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
15978 skeleton->priv->changed_properties = NULL;
15979 skeleton->priv->changed_properties_idle_source = NULL;
15980 g_mutex_unlock (&skeleton->priv->lock);
15981 return FALSE;
15982}
15983
15984static void
15985_control_power_schedule_emit_changed (ControlPowerSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
15986{
15987 ChangedProperty *cp;
15988 GList *l;
15989 cp = NULL;
15990 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
15991 {
15992 ChangedProperty *i_cp = l->data;
15993 if (i_cp->info == info)
15994 {
15995 cp = i_cp;
15996 break;
15997 }
15998 }
15999 if (cp == NULL)
16000 {
16001 cp = g_new0 (ChangedProperty, 1);
16002 cp->prop_id = prop_id;
16003 cp->info = info;
16004 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
16005 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
16006 g_value_copy (orig_value, &cp->orig_value);
16007 }
16008}
16009
16010static void
16011control_power_skeleton_notify (GObject *object,
16012 GParamSpec *pspec G_GNUC_UNUSED)
16013{
16014 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
16015 g_mutex_lock (&skeleton->priv->lock);
16016 if (skeleton->priv->changed_properties != NULL &&
16017 skeleton->priv->changed_properties_idle_source == NULL)
16018 {
16019 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
16020 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
16021 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_power_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
16022 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
16023 g_source_unref (skeleton->priv->changed_properties_idle_source);
16024 }
16025 g_mutex_unlock (&skeleton->priv->lock);
16026}
16027
16028static void
16029control_power_skeleton_set_property (GObject *object,
16030 guint prop_id,
16031 const GValue *value,
16032 GParamSpec *pspec)
16033{
16034 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
Norman James32e74e22015-09-15 21:28:06 -050016035 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050016036 g_mutex_lock (&skeleton->priv->lock);
16037 g_object_freeze_notify (object);
16038 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
16039 {
16040 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
16041 _control_power_schedule_emit_changed (skeleton, _control_power_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
16042 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
16043 g_object_notify_by_pspec (object, pspec);
16044 }
16045 g_mutex_unlock (&skeleton->priv->lock);
16046 g_object_thaw_notify (object);
16047}
16048
16049static void
16050control_power_skeleton_init (ControlPowerSkeleton *skeleton)
16051{
16052#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16053 skeleton->priv = control_power_skeleton_get_instance_private (skeleton);
16054#else
16055 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_POWER_SKELETON, ControlPowerSkeletonPrivate);
16056#endif
16057
16058 g_mutex_init (&skeleton->priv->lock);
16059 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James32e74e22015-09-15 21:28:06 -050016060 skeleton->priv->properties = g_new0 (GValue, 3);
Norman James362a80f2015-09-14 14:04:39 -050016061 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
16062 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
Norman James32e74e22015-09-15 21:28:06 -050016063 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
Norman James362a80f2015-09-14 14:04:39 -050016064}
16065
16066static gint
16067control_power_skeleton_get_pgood (ControlPower *object)
16068{
16069 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
16070 gint value;
16071 g_mutex_lock (&skeleton->priv->lock);
16072 value = g_value_get_int (&(skeleton->priv->properties[0]));
16073 g_mutex_unlock (&skeleton->priv->lock);
16074 return value;
16075}
16076
16077static gint
16078control_power_skeleton_get_state (ControlPower *object)
16079{
16080 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
16081 gint value;
16082 g_mutex_lock (&skeleton->priv->lock);
16083 value = g_value_get_int (&(skeleton->priv->properties[1]));
16084 g_mutex_unlock (&skeleton->priv->lock);
16085 return value;
16086}
16087
Norman James32e74e22015-09-15 21:28:06 -050016088static gint
16089control_power_skeleton_get_pgood_timeout (ControlPower *object)
16090{
16091 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
16092 gint value;
16093 g_mutex_lock (&skeleton->priv->lock);
16094 value = g_value_get_int (&(skeleton->priv->properties[2]));
16095 g_mutex_unlock (&skeleton->priv->lock);
16096 return value;
16097}
16098
Norman James362a80f2015-09-14 14:04:39 -050016099static void
16100control_power_skeleton_class_init (ControlPowerSkeletonClass *klass)
16101{
16102 GObjectClass *gobject_class;
16103 GDBusInterfaceSkeletonClass *skeleton_class;
16104
16105 gobject_class = G_OBJECT_CLASS (klass);
16106 gobject_class->finalize = control_power_skeleton_finalize;
16107 gobject_class->get_property = control_power_skeleton_get_property;
16108 gobject_class->set_property = control_power_skeleton_set_property;
16109 gobject_class->notify = control_power_skeleton_notify;
16110
16111
16112 control_power_override_properties (gobject_class, 1);
16113
16114 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
16115 skeleton_class->get_info = control_power_skeleton_dbus_interface_get_info;
16116 skeleton_class->get_properties = control_power_skeleton_dbus_interface_get_properties;
16117 skeleton_class->flush = control_power_skeleton_dbus_interface_flush;
16118 skeleton_class->get_vtable = control_power_skeleton_dbus_interface_get_vtable;
16119
16120#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
16121 g_type_class_add_private (klass, sizeof (ControlPowerSkeletonPrivate));
16122#endif
16123}
16124
16125static void
16126control_power_skeleton_iface_init (ControlPowerIface *iface)
16127{
16128 iface->power_good = _control_power_on_signal_power_good;
16129 iface->power_lost = _control_power_on_signal_power_lost;
16130 iface->get_pgood = control_power_skeleton_get_pgood;
16131 iface->get_state = control_power_skeleton_get_state;
Norman James32e74e22015-09-15 21:28:06 -050016132 iface->get_pgood_timeout = control_power_skeleton_get_pgood_timeout;
Norman James362a80f2015-09-14 14:04:39 -050016133}
16134
16135/**
16136 * control_power_skeleton_new:
16137 *
16138 * 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>.
16139 *
16140 * Returns: (transfer full) (type ControlPowerSkeleton): The skeleton object.
16141 */
16142ControlPower *
16143control_power_skeleton_new (void)
16144{
16145 return CONTROL_POWER (g_object_new (TYPE_CONTROL_POWER_SKELETON, NULL));
16146}
16147
16148/* ------------------------------------------------------------------------
16149 * Code for interface org.openbmc.Watchdog
16150 * ------------------------------------------------------------------------
16151 */
16152
16153/**
16154 * SECTION:Watchdog
16155 * @title: Watchdog
16156 * @short_description: Generated C code for the org.openbmc.Watchdog D-Bus interface
16157 *
16158 * 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.
16159 */
16160
16161/* ---- Introspection data for org.openbmc.Watchdog ---- */
16162
16163static const _ExtendedGDBusMethodInfo _watchdog_method_info_start =
16164{
16165 {
16166 -1,
16167 (gchar *) "start",
16168 NULL,
16169 NULL,
16170 NULL
16171 },
16172 "handle-start",
16173 FALSE
16174};
16175
16176static const _ExtendedGDBusMethodInfo _watchdog_method_info_poke =
16177{
16178 {
16179 -1,
16180 (gchar *) "poke",
16181 NULL,
16182 NULL,
16183 NULL
16184 },
16185 "handle-poke",
16186 FALSE
16187};
16188
16189static const _ExtendedGDBusMethodInfo _watchdog_method_info_stop =
16190{
16191 {
16192 -1,
16193 (gchar *) "stop",
16194 NULL,
16195 NULL,
16196 NULL
16197 },
16198 "handle-stop",
16199 FALSE
16200};
16201
Adriana Kobylak2cb27752015-10-19 16:23:14 -050016202static const _ExtendedGDBusArgInfo _watchdog_method_info_set_IN_ARG_interval =
16203{
16204 {
16205 -1,
16206 (gchar *) "interval",
16207 (gchar *) "i",
16208 NULL
16209 },
16210 FALSE
16211};
16212
16213static const _ExtendedGDBusArgInfo * const _watchdog_method_info_set_IN_ARG_pointers[] =
16214{
16215 &_watchdog_method_info_set_IN_ARG_interval,
16216 NULL
16217};
16218
16219static const _ExtendedGDBusMethodInfo _watchdog_method_info_set =
16220{
16221 {
16222 -1,
16223 (gchar *) "set",
16224 (GDBusArgInfo **) &_watchdog_method_info_set_IN_ARG_pointers,
16225 NULL,
16226 NULL
16227 },
16228 "handle-set",
16229 FALSE
16230};
16231
Norman James362a80f2015-09-14 14:04:39 -050016232static const _ExtendedGDBusMethodInfo * const _watchdog_method_info_pointers[] =
16233{
16234 &_watchdog_method_info_start,
16235 &_watchdog_method_info_poke,
16236 &_watchdog_method_info_stop,
Adriana Kobylak2cb27752015-10-19 16:23:14 -050016237 &_watchdog_method_info_set,
Norman James362a80f2015-09-14 14:04:39 -050016238 NULL
16239};
16240
16241static const _ExtendedGDBusSignalInfo _watchdog_signal_info_watchdog_error =
16242{
16243 {
16244 -1,
16245 (gchar *) "WatchdogError",
16246 NULL,
16247 NULL
16248 },
16249 "watchdog-error"
16250};
16251
16252static const _ExtendedGDBusSignalInfo * const _watchdog_signal_info_pointers[] =
16253{
16254 &_watchdog_signal_info_watchdog_error,
16255 NULL
16256};
16257
16258static const _ExtendedGDBusPropertyInfo _watchdog_property_info_watchdog =
16259{
16260 {
16261 -1,
16262 (gchar *) "watchdog",
16263 (gchar *) "i",
16264 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
16265 NULL
16266 },
16267 "watchdog",
16268 FALSE
16269};
16270
16271static const _ExtendedGDBusPropertyInfo _watchdog_property_info_poll_interval =
16272{
16273 {
16274 -1,
16275 (gchar *) "poll_interval",
16276 (gchar *) "i",
16277 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
16278 NULL
16279 },
16280 "poll-interval",
16281 FALSE
16282};
16283
16284static const _ExtendedGDBusPropertyInfo * const _watchdog_property_info_pointers[] =
16285{
16286 &_watchdog_property_info_watchdog,
16287 &_watchdog_property_info_poll_interval,
16288 NULL
16289};
16290
16291static const _ExtendedGDBusInterfaceInfo _watchdog_interface_info =
16292{
16293 {
16294 -1,
16295 (gchar *) "org.openbmc.Watchdog",
16296 (GDBusMethodInfo **) &_watchdog_method_info_pointers,
16297 (GDBusSignalInfo **) &_watchdog_signal_info_pointers,
16298 (GDBusPropertyInfo **) &_watchdog_property_info_pointers,
16299 NULL
16300 },
16301 "watchdog",
16302};
16303
16304
16305/**
16306 * watchdog_interface_info:
16307 *
16308 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> D-Bus interface.
16309 *
16310 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
16311 */
16312GDBusInterfaceInfo *
16313watchdog_interface_info (void)
16314{
16315 return (GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct;
16316}
16317
16318/**
16319 * watchdog_override_properties:
16320 * @klass: The class structure for a #GObject<!-- -->-derived class.
16321 * @property_id_begin: The property id to assign to the first overridden property.
16322 *
16323 * Overrides all #GObject properties in the #Watchdog interface for a concrete class.
16324 * The properties are overridden in the order they are defined.
16325 *
16326 * Returns: The last property id.
16327 */
16328guint
16329watchdog_override_properties (GObjectClass *klass, guint property_id_begin)
16330{
16331 g_object_class_override_property (klass, property_id_begin++, "watchdog");
16332 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
16333 return property_id_begin - 1;
16334}
16335
16336
16337
16338/**
16339 * Watchdog:
16340 *
16341 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
16342 */
16343
16344/**
16345 * WatchdogIface:
16346 * @parent_iface: The parent interface.
16347 * @handle_poke: Handler for the #Watchdog::handle-poke signal.
Adriana Kobylak2cb27752015-10-19 16:23:14 -050016348 * @handle_set: Handler for the #Watchdog::handle-set signal.
Norman James362a80f2015-09-14 14:04:39 -050016349 * @handle_start: Handler for the #Watchdog::handle-start signal.
16350 * @handle_stop: Handler for the #Watchdog::handle-stop signal.
16351 * @get_poll_interval: Getter for the #Watchdog:poll-interval property.
16352 * @get_watchdog: Getter for the #Watchdog:watchdog property.
16353 * @watchdog_error: Handler for the #Watchdog::watchdog-error signal.
16354 *
16355 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
16356 */
16357
16358typedef WatchdogIface WatchdogInterface;
16359G_DEFINE_INTERFACE (Watchdog, watchdog, G_TYPE_OBJECT);
16360
16361static void
16362watchdog_default_init (WatchdogIface *iface)
16363{
16364 /* GObject signals for incoming D-Bus method calls: */
16365 /**
16366 * Watchdog::handle-start:
16367 * @object: A #Watchdog.
16368 * @invocation: A #GDBusMethodInvocation.
16369 *
16370 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method.
16371 *
16372 * 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.
16373 *
16374 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
16375 */
16376 g_signal_new ("handle-start",
16377 G_TYPE_FROM_INTERFACE (iface),
16378 G_SIGNAL_RUN_LAST,
16379 G_STRUCT_OFFSET (WatchdogIface, handle_start),
16380 g_signal_accumulator_true_handled,
16381 NULL,
16382 g_cclosure_marshal_generic,
16383 G_TYPE_BOOLEAN,
16384 1,
16385 G_TYPE_DBUS_METHOD_INVOCATION);
16386
16387 /**
16388 * Watchdog::handle-poke:
16389 * @object: A #Watchdog.
16390 * @invocation: A #GDBusMethodInvocation.
16391 *
16392 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method.
16393 *
16394 * 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.
16395 *
16396 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
16397 */
16398 g_signal_new ("handle-poke",
16399 G_TYPE_FROM_INTERFACE (iface),
16400 G_SIGNAL_RUN_LAST,
16401 G_STRUCT_OFFSET (WatchdogIface, handle_poke),
16402 g_signal_accumulator_true_handled,
16403 NULL,
16404 g_cclosure_marshal_generic,
16405 G_TYPE_BOOLEAN,
16406 1,
16407 G_TYPE_DBUS_METHOD_INVOCATION);
16408
16409 /**
16410 * Watchdog::handle-stop:
16411 * @object: A #Watchdog.
16412 * @invocation: A #GDBusMethodInvocation.
16413 *
16414 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method.
16415 *
16416 * 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.
16417 *
16418 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
16419 */
16420 g_signal_new ("handle-stop",
16421 G_TYPE_FROM_INTERFACE (iface),
16422 G_SIGNAL_RUN_LAST,
16423 G_STRUCT_OFFSET (WatchdogIface, handle_stop),
16424 g_signal_accumulator_true_handled,
16425 NULL,
16426 g_cclosure_marshal_generic,
16427 G_TYPE_BOOLEAN,
16428 1,
16429 G_TYPE_DBUS_METHOD_INVOCATION);
16430
Adriana Kobylak2cb27752015-10-19 16:23:14 -050016431 /**
16432 * Watchdog::handle-set:
16433 * @object: A #Watchdog.
16434 * @invocation: A #GDBusMethodInvocation.
16435 * @arg_interval: Argument passed by remote caller.
16436 *
16437 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method.
16438 *
16439 * 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.
16440 *
16441 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
16442 */
16443 g_signal_new ("handle-set",
16444 G_TYPE_FROM_INTERFACE (iface),
16445 G_SIGNAL_RUN_LAST,
16446 G_STRUCT_OFFSET (WatchdogIface, handle_set),
16447 g_signal_accumulator_true_handled,
16448 NULL,
16449 g_cclosure_marshal_generic,
16450 G_TYPE_BOOLEAN,
16451 2,
16452 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
16453
Norman James362a80f2015-09-14 14:04:39 -050016454 /* GObject signals for received D-Bus signals: */
16455 /**
16456 * Watchdog::watchdog-error:
16457 * @object: A #Watchdog.
16458 *
16459 * 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.
16460 *
16461 * 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.
16462 */
16463 g_signal_new ("watchdog-error",
16464 G_TYPE_FROM_INTERFACE (iface),
16465 G_SIGNAL_RUN_LAST,
16466 G_STRUCT_OFFSET (WatchdogIface, watchdog_error),
16467 NULL,
16468 NULL,
16469 g_cclosure_marshal_generic,
16470 G_TYPE_NONE,
16471 0);
16472
16473 /* GObject properties for D-Bus properties: */
16474 /**
16475 * Watchdog:watchdog:
16476 *
16477 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link>.
16478 *
16479 * 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.
16480 */
16481 g_object_interface_install_property (iface,
16482 g_param_spec_int ("watchdog", "watchdog", "watchdog", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
16483 /**
16484 * Watchdog:poll-interval:
16485 *
16486 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link>.
16487 *
16488 * 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.
16489 */
16490 g_object_interface_install_property (iface,
16491 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
16492}
16493
16494/**
16495 * watchdog_get_watchdog: (skip)
16496 * @object: A #Watchdog.
16497 *
16498 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property.
16499 *
16500 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
16501 *
16502 * Returns: The property value.
16503 */
16504gint
16505watchdog_get_watchdog (Watchdog *object)
16506{
16507 return WATCHDOG_GET_IFACE (object)->get_watchdog (object);
16508}
16509
16510/**
16511 * watchdog_set_watchdog: (skip)
16512 * @object: A #Watchdog.
16513 * @value: The value to set.
16514 *
16515 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property to @value.
16516 *
16517 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
16518 */
16519void
16520watchdog_set_watchdog (Watchdog *object, gint value)
16521{
16522 g_object_set (G_OBJECT (object), "watchdog", value, NULL);
16523}
16524
16525/**
16526 * watchdog_get_poll_interval: (skip)
16527 * @object: A #Watchdog.
16528 *
16529 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property.
16530 *
16531 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
16532 *
16533 * Returns: The property value.
16534 */
16535gint
16536watchdog_get_poll_interval (Watchdog *object)
16537{
16538 return WATCHDOG_GET_IFACE (object)->get_poll_interval (object);
16539}
16540
16541/**
16542 * watchdog_set_poll_interval: (skip)
16543 * @object: A #Watchdog.
16544 * @value: The value to set.
16545 *
16546 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property to @value.
16547 *
16548 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
16549 */
16550void
16551watchdog_set_poll_interval (Watchdog *object, gint value)
16552{
16553 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
16554}
16555
16556/**
16557 * watchdog_emit_watchdog_error:
16558 * @object: A #Watchdog.
16559 *
16560 * Emits the <link linkend="gdbus-signal-org-openbmc-Watchdog.WatchdogError">"WatchdogError"</link> D-Bus signal.
16561 */
16562void
16563watchdog_emit_watchdog_error (
16564 Watchdog *object)
16565{
16566 g_signal_emit_by_name (object, "watchdog-error");
16567}
16568
16569/**
16570 * watchdog_call_start:
16571 * @proxy: A #WatchdogProxy.
16572 * @cancellable: (allow-none): A #GCancellable or %NULL.
16573 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
16574 * @user_data: User data to pass to @callback.
16575 *
16576 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method on @proxy.
16577 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
16578 * You can then call watchdog_call_start_finish() to get the result of the operation.
16579 *
16580 * See watchdog_call_start_sync() for the synchronous, blocking version of this method.
16581 */
16582void
16583watchdog_call_start (
16584 Watchdog *proxy,
16585 GCancellable *cancellable,
16586 GAsyncReadyCallback callback,
16587 gpointer user_data)
16588{
16589 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
16590 "start",
16591 g_variant_new ("()"),
16592 G_DBUS_CALL_FLAGS_NONE,
16593 -1,
16594 cancellable,
16595 callback,
16596 user_data);
16597}
16598
16599/**
16600 * watchdog_call_start_finish:
16601 * @proxy: A #WatchdogProxy.
16602 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_start().
16603 * @error: Return location for error or %NULL.
16604 *
16605 * Finishes an operation started with watchdog_call_start().
16606 *
16607 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16608 */
16609gboolean
16610watchdog_call_start_finish (
16611 Watchdog *proxy,
16612 GAsyncResult *res,
16613 GError **error)
16614{
16615 GVariant *_ret;
16616 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
16617 if (_ret == NULL)
16618 goto _out;
16619 g_variant_get (_ret,
16620 "()");
16621 g_variant_unref (_ret);
16622_out:
16623 return _ret != NULL;
16624}
16625
16626/**
16627 * watchdog_call_start_sync:
16628 * @proxy: A #WatchdogProxy.
16629 * @cancellable: (allow-none): A #GCancellable or %NULL.
16630 * @error: Return location for error or %NULL.
16631 *
16632 * 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.
16633 *
16634 * See watchdog_call_start() for the asynchronous version of this method.
16635 *
16636 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16637 */
16638gboolean
16639watchdog_call_start_sync (
16640 Watchdog *proxy,
16641 GCancellable *cancellable,
16642 GError **error)
16643{
16644 GVariant *_ret;
16645 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
16646 "start",
16647 g_variant_new ("()"),
16648 G_DBUS_CALL_FLAGS_NONE,
16649 -1,
16650 cancellable,
16651 error);
16652 if (_ret == NULL)
16653 goto _out;
16654 g_variant_get (_ret,
16655 "()");
16656 g_variant_unref (_ret);
16657_out:
16658 return _ret != NULL;
16659}
16660
16661/**
16662 * watchdog_call_poke:
16663 * @proxy: A #WatchdogProxy.
16664 * @cancellable: (allow-none): A #GCancellable or %NULL.
16665 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
16666 * @user_data: User data to pass to @callback.
16667 *
16668 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method on @proxy.
16669 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
16670 * You can then call watchdog_call_poke_finish() to get the result of the operation.
16671 *
16672 * See watchdog_call_poke_sync() for the synchronous, blocking version of this method.
16673 */
16674void
16675watchdog_call_poke (
16676 Watchdog *proxy,
16677 GCancellable *cancellable,
16678 GAsyncReadyCallback callback,
16679 gpointer user_data)
16680{
16681 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
16682 "poke",
16683 g_variant_new ("()"),
16684 G_DBUS_CALL_FLAGS_NONE,
16685 -1,
16686 cancellable,
16687 callback,
16688 user_data);
16689}
16690
16691/**
16692 * watchdog_call_poke_finish:
16693 * @proxy: A #WatchdogProxy.
16694 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_poke().
16695 * @error: Return location for error or %NULL.
16696 *
16697 * Finishes an operation started with watchdog_call_poke().
16698 *
16699 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16700 */
16701gboolean
16702watchdog_call_poke_finish (
16703 Watchdog *proxy,
16704 GAsyncResult *res,
16705 GError **error)
16706{
16707 GVariant *_ret;
16708 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
16709 if (_ret == NULL)
16710 goto _out;
16711 g_variant_get (_ret,
16712 "()");
16713 g_variant_unref (_ret);
16714_out:
16715 return _ret != NULL;
16716}
16717
16718/**
16719 * watchdog_call_poke_sync:
16720 * @proxy: A #WatchdogProxy.
16721 * @cancellable: (allow-none): A #GCancellable or %NULL.
16722 * @error: Return location for error or %NULL.
16723 *
16724 * 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.
16725 *
16726 * See watchdog_call_poke() for the asynchronous version of this method.
16727 *
16728 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16729 */
16730gboolean
16731watchdog_call_poke_sync (
16732 Watchdog *proxy,
16733 GCancellable *cancellable,
16734 GError **error)
16735{
16736 GVariant *_ret;
16737 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
16738 "poke",
16739 g_variant_new ("()"),
16740 G_DBUS_CALL_FLAGS_NONE,
16741 -1,
16742 cancellable,
16743 error);
16744 if (_ret == NULL)
16745 goto _out;
16746 g_variant_get (_ret,
16747 "()");
16748 g_variant_unref (_ret);
16749_out:
16750 return _ret != NULL;
16751}
16752
16753/**
16754 * watchdog_call_stop:
16755 * @proxy: A #WatchdogProxy.
16756 * @cancellable: (allow-none): A #GCancellable or %NULL.
16757 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
16758 * @user_data: User data to pass to @callback.
16759 *
16760 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method on @proxy.
16761 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
16762 * You can then call watchdog_call_stop_finish() to get the result of the operation.
16763 *
16764 * See watchdog_call_stop_sync() for the synchronous, blocking version of this method.
16765 */
16766void
16767watchdog_call_stop (
16768 Watchdog *proxy,
16769 GCancellable *cancellable,
16770 GAsyncReadyCallback callback,
16771 gpointer user_data)
16772{
16773 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
16774 "stop",
16775 g_variant_new ("()"),
16776 G_DBUS_CALL_FLAGS_NONE,
16777 -1,
16778 cancellable,
16779 callback,
16780 user_data);
16781}
16782
16783/**
16784 * watchdog_call_stop_finish:
16785 * @proxy: A #WatchdogProxy.
16786 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_stop().
16787 * @error: Return location for error or %NULL.
16788 *
16789 * Finishes an operation started with watchdog_call_stop().
16790 *
16791 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16792 */
16793gboolean
16794watchdog_call_stop_finish (
16795 Watchdog *proxy,
16796 GAsyncResult *res,
16797 GError **error)
16798{
16799 GVariant *_ret;
16800 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
16801 if (_ret == NULL)
16802 goto _out;
16803 g_variant_get (_ret,
16804 "()");
16805 g_variant_unref (_ret);
16806_out:
16807 return _ret != NULL;
16808}
16809
16810/**
16811 * watchdog_call_stop_sync:
16812 * @proxy: A #WatchdogProxy.
16813 * @cancellable: (allow-none): A #GCancellable or %NULL.
16814 * @error: Return location for error or %NULL.
16815 *
16816 * 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.
16817 *
16818 * See watchdog_call_stop() for the asynchronous version of this method.
16819 *
16820 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16821 */
16822gboolean
16823watchdog_call_stop_sync (
16824 Watchdog *proxy,
16825 GCancellable *cancellable,
16826 GError **error)
16827{
16828 GVariant *_ret;
16829 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
16830 "stop",
16831 g_variant_new ("()"),
16832 G_DBUS_CALL_FLAGS_NONE,
16833 -1,
16834 cancellable,
16835 error);
16836 if (_ret == NULL)
16837 goto _out;
16838 g_variant_get (_ret,
16839 "()");
16840 g_variant_unref (_ret);
16841_out:
16842 return _ret != NULL;
16843}
16844
16845/**
Adriana Kobylak2cb27752015-10-19 16:23:14 -050016846 * watchdog_call_set:
16847 * @proxy: A #WatchdogProxy.
16848 * @arg_interval: Argument to pass with the method invocation.
16849 * @cancellable: (allow-none): A #GCancellable or %NULL.
16850 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
16851 * @user_data: User data to pass to @callback.
16852 *
16853 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method on @proxy.
16854 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
16855 * You can then call watchdog_call_set_finish() to get the result of the operation.
16856 *
16857 * See watchdog_call_set_sync() for the synchronous, blocking version of this method.
16858 */
16859void
16860watchdog_call_set (
16861 Watchdog *proxy,
16862 gint arg_interval,
16863 GCancellable *cancellable,
16864 GAsyncReadyCallback callback,
16865 gpointer user_data)
16866{
16867 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
16868 "set",
16869 g_variant_new ("(i)",
16870 arg_interval),
16871 G_DBUS_CALL_FLAGS_NONE,
16872 -1,
16873 cancellable,
16874 callback,
16875 user_data);
16876}
16877
16878/**
16879 * watchdog_call_set_finish:
16880 * @proxy: A #WatchdogProxy.
16881 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_set().
16882 * @error: Return location for error or %NULL.
16883 *
16884 * Finishes an operation started with watchdog_call_set().
16885 *
16886 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16887 */
16888gboolean
16889watchdog_call_set_finish (
16890 Watchdog *proxy,
16891 GAsyncResult *res,
16892 GError **error)
16893{
16894 GVariant *_ret;
16895 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
16896 if (_ret == NULL)
16897 goto _out;
16898 g_variant_get (_ret,
16899 "()");
16900 g_variant_unref (_ret);
16901_out:
16902 return _ret != NULL;
16903}
16904
16905/**
16906 * watchdog_call_set_sync:
16907 * @proxy: A #WatchdogProxy.
16908 * @arg_interval: Argument to pass with the method invocation.
16909 * @cancellable: (allow-none): A #GCancellable or %NULL.
16910 * @error: Return location for error or %NULL.
16911 *
16912 * 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.
16913 *
16914 * See watchdog_call_set() for the asynchronous version of this method.
16915 *
16916 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16917 */
16918gboolean
16919watchdog_call_set_sync (
16920 Watchdog *proxy,
16921 gint arg_interval,
16922 GCancellable *cancellable,
16923 GError **error)
16924{
16925 GVariant *_ret;
16926 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
16927 "set",
16928 g_variant_new ("(i)",
16929 arg_interval),
16930 G_DBUS_CALL_FLAGS_NONE,
16931 -1,
16932 cancellable,
16933 error);
16934 if (_ret == NULL)
16935 goto _out;
16936 g_variant_get (_ret,
16937 "()");
16938 g_variant_unref (_ret);
16939_out:
16940 return _ret != NULL;
16941}
16942
16943/**
Norman James362a80f2015-09-14 14:04:39 -050016944 * watchdog_complete_start:
16945 * @object: A #Watchdog.
16946 * @invocation: (transfer full): A #GDBusMethodInvocation.
16947 *
16948 * 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.
16949 *
16950 * This method will free @invocation, you cannot use it afterwards.
16951 */
16952void
16953watchdog_complete_start (
16954 Watchdog *object,
16955 GDBusMethodInvocation *invocation)
16956{
16957 g_dbus_method_invocation_return_value (invocation,
16958 g_variant_new ("()"));
16959}
16960
16961/**
16962 * watchdog_complete_poke:
16963 * @object: A #Watchdog.
16964 * @invocation: (transfer full): A #GDBusMethodInvocation.
16965 *
16966 * 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.
16967 *
16968 * This method will free @invocation, you cannot use it afterwards.
16969 */
16970void
16971watchdog_complete_poke (
16972 Watchdog *object,
16973 GDBusMethodInvocation *invocation)
16974{
16975 g_dbus_method_invocation_return_value (invocation,
16976 g_variant_new ("()"));
16977}
16978
16979/**
16980 * watchdog_complete_stop:
16981 * @object: A #Watchdog.
16982 * @invocation: (transfer full): A #GDBusMethodInvocation.
16983 *
16984 * 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.
16985 *
16986 * This method will free @invocation, you cannot use it afterwards.
16987 */
16988void
16989watchdog_complete_stop (
16990 Watchdog *object,
16991 GDBusMethodInvocation *invocation)
16992{
16993 g_dbus_method_invocation_return_value (invocation,
16994 g_variant_new ("()"));
16995}
16996
Adriana Kobylak2cb27752015-10-19 16:23:14 -050016997/**
16998 * watchdog_complete_set:
16999 * @object: A #Watchdog.
17000 * @invocation: (transfer full): A #GDBusMethodInvocation.
17001 *
17002 * 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.
17003 *
17004 * This method will free @invocation, you cannot use it afterwards.
17005 */
17006void
17007watchdog_complete_set (
17008 Watchdog *object,
17009 GDBusMethodInvocation *invocation)
17010{
17011 g_dbus_method_invocation_return_value (invocation,
17012 g_variant_new ("()"));
17013}
17014
Norman James362a80f2015-09-14 14:04:39 -050017015/* ------------------------------------------------------------------------ */
17016
17017/**
17018 * WatchdogProxy:
17019 *
17020 * The #WatchdogProxy structure contains only private data and should only be accessed using the provided API.
17021 */
17022
17023/**
17024 * WatchdogProxyClass:
17025 * @parent_class: The parent class.
17026 *
17027 * Class structure for #WatchdogProxy.
17028 */
17029
17030struct _WatchdogProxyPrivate
17031{
17032 GData *qdata;
17033};
17034
17035static void watchdog_proxy_iface_init (WatchdogIface *iface);
17036
17037#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17038G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY,
17039 G_ADD_PRIVATE (WatchdogProxy)
17040 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init));
17041
17042#else
17043G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY,
17044 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init));
17045
17046#endif
17047static void
17048watchdog_proxy_finalize (GObject *object)
17049{
17050 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
17051 g_datalist_clear (&proxy->priv->qdata);
17052 G_OBJECT_CLASS (watchdog_proxy_parent_class)->finalize (object);
17053}
17054
17055static void
17056watchdog_proxy_get_property (GObject *object,
17057 guint prop_id,
17058 GValue *value,
17059 GParamSpec *pspec G_GNUC_UNUSED)
17060{
17061 const _ExtendedGDBusPropertyInfo *info;
17062 GVariant *variant;
17063 g_assert (prop_id != 0 && prop_id - 1 < 2);
17064 info = _watchdog_property_info_pointers[prop_id - 1];
17065 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
17066 if (info->use_gvariant)
17067 {
17068 g_value_set_variant (value, variant);
17069 }
17070 else
17071 {
17072 if (variant != NULL)
17073 g_dbus_gvariant_to_gvalue (variant, value);
17074 }
17075 if (variant != NULL)
17076 g_variant_unref (variant);
17077}
17078
17079static void
17080watchdog_proxy_set_property_cb (GDBusProxy *proxy,
17081 GAsyncResult *res,
17082 gpointer user_data)
17083{
17084 const _ExtendedGDBusPropertyInfo *info = user_data;
17085 GError *error;
17086 GVariant *_ret;
17087 error = NULL;
17088 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
17089 if (!_ret)
17090 {
17091 g_warning ("Error setting property '%s' on interface org.openbmc.Watchdog: %s (%s, %d)",
17092 info->parent_struct.name,
17093 error->message, g_quark_to_string (error->domain), error->code);
17094 g_error_free (error);
17095 }
17096 else
17097 {
17098 g_variant_unref (_ret);
17099 }
17100}
17101
17102static void
17103watchdog_proxy_set_property (GObject *object,
17104 guint prop_id,
17105 const GValue *value,
17106 GParamSpec *pspec G_GNUC_UNUSED)
17107{
17108 const _ExtendedGDBusPropertyInfo *info;
17109 GVariant *variant;
17110 g_assert (prop_id != 0 && prop_id - 1 < 2);
17111 info = _watchdog_property_info_pointers[prop_id - 1];
17112 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
17113 g_dbus_proxy_call (G_DBUS_PROXY (object),
17114 "org.freedesktop.DBus.Properties.Set",
17115 g_variant_new ("(ssv)", "org.openbmc.Watchdog", info->parent_struct.name, variant),
17116 G_DBUS_CALL_FLAGS_NONE,
17117 -1,
17118 NULL, (GAsyncReadyCallback) watchdog_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
17119 g_variant_unref (variant);
17120}
17121
17122static void
17123watchdog_proxy_g_signal (GDBusProxy *proxy,
17124 const gchar *sender_name G_GNUC_UNUSED,
17125 const gchar *signal_name,
17126 GVariant *parameters)
17127{
17128 _ExtendedGDBusSignalInfo *info;
17129 GVariantIter iter;
17130 GVariant *child;
17131 GValue *paramv;
17132 guint num_params;
17133 guint n;
17134 guint signal_id;
17135 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, signal_name);
17136 if (info == NULL)
17137 return;
17138 num_params = g_variant_n_children (parameters);
17139 paramv = g_new0 (GValue, num_params + 1);
17140 g_value_init (&paramv[0], TYPE_WATCHDOG);
17141 g_value_set_object (&paramv[0], proxy);
17142 g_variant_iter_init (&iter, parameters);
17143 n = 1;
17144 while ((child = g_variant_iter_next_value (&iter)) != NULL)
17145 {
17146 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
17147 if (arg_info->use_gvariant)
17148 {
17149 g_value_init (&paramv[n], G_TYPE_VARIANT);
17150 g_value_set_variant (&paramv[n], child);
17151 n++;
17152 }
17153 else
17154 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
17155 g_variant_unref (child);
17156 }
17157 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG);
17158 g_signal_emitv (paramv, signal_id, 0, NULL);
17159 for (n = 0; n < num_params + 1; n++)
17160 g_value_unset (&paramv[n]);
17161 g_free (paramv);
17162}
17163
17164static void
17165watchdog_proxy_g_properties_changed (GDBusProxy *_proxy,
17166 GVariant *changed_properties,
17167 const gchar *const *invalidated_properties)
17168{
17169 WatchdogProxy *proxy = WATCHDOG_PROXY (_proxy);
17170 guint n;
17171 const gchar *key;
17172 GVariantIter *iter;
17173 _ExtendedGDBusPropertyInfo *info;
17174 g_variant_get (changed_properties, "a{sv}", &iter);
17175 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
17176 {
17177 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, key);
17178 g_datalist_remove_data (&proxy->priv->qdata, key);
17179 if (info != NULL)
17180 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
17181 }
17182 g_variant_iter_free (iter);
17183 for (n = 0; invalidated_properties[n] != NULL; n++)
17184 {
17185 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, invalidated_properties[n]);
17186 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
17187 if (info != NULL)
17188 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
17189 }
17190}
17191
17192static gint
17193watchdog_proxy_get_watchdog (Watchdog *object)
17194{
17195 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
17196 GVariant *variant;
17197 gint value = 0;
17198 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "watchdog");
17199 if (variant != NULL)
17200 {
17201 value = g_variant_get_int32 (variant);
17202 g_variant_unref (variant);
17203 }
17204 return value;
17205}
17206
17207static gint
17208watchdog_proxy_get_poll_interval (Watchdog *object)
17209{
17210 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
17211 GVariant *variant;
17212 gint value = 0;
17213 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
17214 if (variant != NULL)
17215 {
17216 value = g_variant_get_int32 (variant);
17217 g_variant_unref (variant);
17218 }
17219 return value;
17220}
17221
17222static void
17223watchdog_proxy_init (WatchdogProxy *proxy)
17224{
17225#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17226 proxy->priv = watchdog_proxy_get_instance_private (proxy);
17227#else
17228 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_WATCHDOG_PROXY, WatchdogProxyPrivate);
17229#endif
17230
17231 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), watchdog_interface_info ());
17232}
17233
17234static void
17235watchdog_proxy_class_init (WatchdogProxyClass *klass)
17236{
17237 GObjectClass *gobject_class;
17238 GDBusProxyClass *proxy_class;
17239
17240 gobject_class = G_OBJECT_CLASS (klass);
17241 gobject_class->finalize = watchdog_proxy_finalize;
17242 gobject_class->get_property = watchdog_proxy_get_property;
17243 gobject_class->set_property = watchdog_proxy_set_property;
17244
17245 proxy_class = G_DBUS_PROXY_CLASS (klass);
17246 proxy_class->g_signal = watchdog_proxy_g_signal;
17247 proxy_class->g_properties_changed = watchdog_proxy_g_properties_changed;
17248
17249 watchdog_override_properties (gobject_class, 1);
17250
17251#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
17252 g_type_class_add_private (klass, sizeof (WatchdogProxyPrivate));
17253#endif
17254}
17255
17256static void
17257watchdog_proxy_iface_init (WatchdogIface *iface)
17258{
17259 iface->get_watchdog = watchdog_proxy_get_watchdog;
17260 iface->get_poll_interval = watchdog_proxy_get_poll_interval;
17261}
17262
17263/**
17264 * watchdog_proxy_new:
17265 * @connection: A #GDBusConnection.
17266 * @flags: Flags from the #GDBusProxyFlags enumeration.
17267 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
17268 * @object_path: An object path.
17269 * @cancellable: (allow-none): A #GCancellable or %NULL.
17270 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
17271 * @user_data: User data to pass to @callback.
17272 *
17273 * 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.
17274 *
17275 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
17276 * You can then call watchdog_proxy_new_finish() to get the result of the operation.
17277 *
17278 * See watchdog_proxy_new_sync() for the synchronous, blocking version of this constructor.
17279 */
17280void
17281watchdog_proxy_new (
17282 GDBusConnection *connection,
17283 GDBusProxyFlags flags,
17284 const gchar *name,
17285 const gchar *object_path,
17286 GCancellable *cancellable,
17287 GAsyncReadyCallback callback,
17288 gpointer user_data)
17289{
17290 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);
17291}
17292
17293/**
17294 * watchdog_proxy_new_finish:
17295 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new().
17296 * @error: Return location for error or %NULL
17297 *
17298 * Finishes an operation started with watchdog_proxy_new().
17299 *
17300 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
17301 */
17302Watchdog *
17303watchdog_proxy_new_finish (
17304 GAsyncResult *res,
17305 GError **error)
17306{
17307 GObject *ret;
17308 GObject *source_object;
17309 source_object = g_async_result_get_source_object (res);
17310 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
17311 g_object_unref (source_object);
17312 if (ret != NULL)
17313 return WATCHDOG (ret);
17314 else
17315 return NULL;
17316}
17317
17318/**
17319 * watchdog_proxy_new_sync:
17320 * @connection: A #GDBusConnection.
17321 * @flags: Flags from the #GDBusProxyFlags enumeration.
17322 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
17323 * @object_path: An object path.
17324 * @cancellable: (allow-none): A #GCancellable or %NULL.
17325 * @error: Return location for error or %NULL
17326 *
17327 * 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.
17328 *
17329 * The calling thread is blocked until a reply is received.
17330 *
17331 * See watchdog_proxy_new() for the asynchronous version of this constructor.
17332 *
17333 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
17334 */
17335Watchdog *
17336watchdog_proxy_new_sync (
17337 GDBusConnection *connection,
17338 GDBusProxyFlags flags,
17339 const gchar *name,
17340 const gchar *object_path,
17341 GCancellable *cancellable,
17342 GError **error)
17343{
17344 GInitable *ret;
17345 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);
17346 if (ret != NULL)
17347 return WATCHDOG (ret);
17348 else
17349 return NULL;
17350}
17351
17352
17353/**
17354 * watchdog_proxy_new_for_bus:
17355 * @bus_type: A #GBusType.
17356 * @flags: Flags from the #GDBusProxyFlags enumeration.
17357 * @name: A bus name (well-known or unique).
17358 * @object_path: An object path.
17359 * @cancellable: (allow-none): A #GCancellable or %NULL.
17360 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
17361 * @user_data: User data to pass to @callback.
17362 *
17363 * Like watchdog_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
17364 *
17365 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
17366 * You can then call watchdog_proxy_new_for_bus_finish() to get the result of the operation.
17367 *
17368 * See watchdog_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
17369 */
17370void
17371watchdog_proxy_new_for_bus (
17372 GBusType bus_type,
17373 GDBusProxyFlags flags,
17374 const gchar *name,
17375 const gchar *object_path,
17376 GCancellable *cancellable,
17377 GAsyncReadyCallback callback,
17378 gpointer user_data)
17379{
17380 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);
17381}
17382
17383/**
17384 * watchdog_proxy_new_for_bus_finish:
17385 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new_for_bus().
17386 * @error: Return location for error or %NULL
17387 *
17388 * Finishes an operation started with watchdog_proxy_new_for_bus().
17389 *
17390 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
17391 */
17392Watchdog *
17393watchdog_proxy_new_for_bus_finish (
17394 GAsyncResult *res,
17395 GError **error)
17396{
17397 GObject *ret;
17398 GObject *source_object;
17399 source_object = g_async_result_get_source_object (res);
17400 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
17401 g_object_unref (source_object);
17402 if (ret != NULL)
17403 return WATCHDOG (ret);
17404 else
17405 return NULL;
17406}
17407
17408/**
17409 * watchdog_proxy_new_for_bus_sync:
17410 * @bus_type: A #GBusType.
17411 * @flags: Flags from the #GDBusProxyFlags enumeration.
17412 * @name: A bus name (well-known or unique).
17413 * @object_path: An object path.
17414 * @cancellable: (allow-none): A #GCancellable or %NULL.
17415 * @error: Return location for error or %NULL
17416 *
17417 * Like watchdog_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
17418 *
17419 * The calling thread is blocked until a reply is received.
17420 *
17421 * See watchdog_proxy_new_for_bus() for the asynchronous version of this constructor.
17422 *
17423 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
17424 */
17425Watchdog *
17426watchdog_proxy_new_for_bus_sync (
17427 GBusType bus_type,
17428 GDBusProxyFlags flags,
17429 const gchar *name,
17430 const gchar *object_path,
17431 GCancellable *cancellable,
17432 GError **error)
17433{
17434 GInitable *ret;
17435 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);
17436 if (ret != NULL)
17437 return WATCHDOG (ret);
17438 else
17439 return NULL;
17440}
17441
17442
17443/* ------------------------------------------------------------------------ */
17444
17445/**
17446 * WatchdogSkeleton:
17447 *
17448 * The #WatchdogSkeleton structure contains only private data and should only be accessed using the provided API.
17449 */
17450
17451/**
17452 * WatchdogSkeletonClass:
17453 * @parent_class: The parent class.
17454 *
17455 * Class structure for #WatchdogSkeleton.
17456 */
17457
17458struct _WatchdogSkeletonPrivate
17459{
17460 GValue *properties;
17461 GList *changed_properties;
17462 GSource *changed_properties_idle_source;
17463 GMainContext *context;
17464 GMutex lock;
17465};
17466
17467static void
17468_watchdog_skeleton_handle_method_call (
17469 GDBusConnection *connection G_GNUC_UNUSED,
17470 const gchar *sender G_GNUC_UNUSED,
17471 const gchar *object_path G_GNUC_UNUSED,
17472 const gchar *interface_name,
17473 const gchar *method_name,
17474 GVariant *parameters,
17475 GDBusMethodInvocation *invocation,
17476 gpointer user_data)
17477{
17478 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
17479 _ExtendedGDBusMethodInfo *info;
17480 GVariantIter iter;
17481 GVariant *child;
17482 GValue *paramv;
17483 guint num_params;
17484 guint num_extra;
17485 guint n;
17486 guint signal_id;
17487 GValue return_value = G_VALUE_INIT;
17488 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
17489 g_assert (info != NULL);
17490 num_params = g_variant_n_children (parameters);
17491 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
17492 n = 0;
17493 g_value_init (&paramv[n], TYPE_WATCHDOG);
17494 g_value_set_object (&paramv[n++], skeleton);
17495 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
17496 g_value_set_object (&paramv[n++], invocation);
17497 if (info->pass_fdlist)
17498 {
17499#ifdef G_OS_UNIX
17500 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
17501 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
17502#else
17503 g_assert_not_reached ();
17504#endif
17505 }
17506 g_variant_iter_init (&iter, parameters);
17507 while ((child = g_variant_iter_next_value (&iter)) != NULL)
17508 {
17509 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
17510 if (arg_info->use_gvariant)
17511 {
17512 g_value_init (&paramv[n], G_TYPE_VARIANT);
17513 g_value_set_variant (&paramv[n], child);
17514 n++;
17515 }
17516 else
17517 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
17518 g_variant_unref (child);
17519 }
17520 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG);
17521 g_value_init (&return_value, G_TYPE_BOOLEAN);
17522 g_signal_emitv (paramv, signal_id, 0, &return_value);
17523 if (!g_value_get_boolean (&return_value))
17524 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);
17525 g_value_unset (&return_value);
17526 for (n = 0; n < num_params + num_extra; n++)
17527 g_value_unset (&paramv[n]);
17528 g_free (paramv);
17529}
17530
17531static GVariant *
17532_watchdog_skeleton_handle_get_property (
17533 GDBusConnection *connection G_GNUC_UNUSED,
17534 const gchar *sender G_GNUC_UNUSED,
17535 const gchar *object_path G_GNUC_UNUSED,
17536 const gchar *interface_name G_GNUC_UNUSED,
17537 const gchar *property_name,
17538 GError **error,
17539 gpointer user_data)
17540{
17541 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
17542 GValue value = G_VALUE_INIT;
17543 GParamSpec *pspec;
17544 _ExtendedGDBusPropertyInfo *info;
17545 GVariant *ret;
17546 ret = NULL;
17547 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name);
17548 g_assert (info != NULL);
17549 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
17550 if (pspec == NULL)
17551 {
17552 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
17553 }
17554 else
17555 {
17556 g_value_init (&value, pspec->value_type);
17557 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
17558 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
17559 g_value_unset (&value);
17560 }
17561 return ret;
17562}
17563
17564static gboolean
17565_watchdog_skeleton_handle_set_property (
17566 GDBusConnection *connection G_GNUC_UNUSED,
17567 const gchar *sender G_GNUC_UNUSED,
17568 const gchar *object_path G_GNUC_UNUSED,
17569 const gchar *interface_name G_GNUC_UNUSED,
17570 const gchar *property_name,
17571 GVariant *variant,
17572 GError **error,
17573 gpointer user_data)
17574{
17575 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
17576 GValue value = G_VALUE_INIT;
17577 GParamSpec *pspec;
17578 _ExtendedGDBusPropertyInfo *info;
17579 gboolean ret;
17580 ret = FALSE;
17581 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name);
17582 g_assert (info != NULL);
17583 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
17584 if (pspec == NULL)
17585 {
17586 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
17587 }
17588 else
17589 {
17590 if (info->use_gvariant)
17591 g_value_set_variant (&value, variant);
17592 else
17593 g_dbus_gvariant_to_gvalue (variant, &value);
17594 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
17595 g_value_unset (&value);
17596 ret = TRUE;
17597 }
17598 return ret;
17599}
17600
17601static const GDBusInterfaceVTable _watchdog_skeleton_vtable =
17602{
17603 _watchdog_skeleton_handle_method_call,
17604 _watchdog_skeleton_handle_get_property,
17605 _watchdog_skeleton_handle_set_property,
17606 {NULL}
17607};
17608
17609static GDBusInterfaceInfo *
17610watchdog_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
17611{
17612 return watchdog_interface_info ();
17613}
17614
17615static GDBusInterfaceVTable *
17616watchdog_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
17617{
17618 return (GDBusInterfaceVTable *) &_watchdog_skeleton_vtable;
17619}
17620
17621static GVariant *
17622watchdog_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
17623{
17624 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton);
17625
17626 GVariantBuilder builder;
17627 guint n;
17628 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
17629 if (_watchdog_interface_info.parent_struct.properties == NULL)
17630 goto out;
17631 for (n = 0; _watchdog_interface_info.parent_struct.properties[n] != NULL; n++)
17632 {
17633 GDBusPropertyInfo *info = _watchdog_interface_info.parent_struct.properties[n];
17634 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
17635 {
17636 GVariant *value;
17637 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);
17638 if (value != NULL)
17639 {
17640 g_variant_take_ref (value);
17641 g_variant_builder_add (&builder, "{sv}", info->name, value);
17642 g_variant_unref (value);
17643 }
17644 }
17645 }
17646out:
17647 return g_variant_builder_end (&builder);
17648}
17649
17650static gboolean _watchdog_emit_changed (gpointer user_data);
17651
17652static void
17653watchdog_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
17654{
17655 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton);
17656 gboolean emit_changed = FALSE;
17657
17658 g_mutex_lock (&skeleton->priv->lock);
17659 if (skeleton->priv->changed_properties_idle_source != NULL)
17660 {
17661 g_source_destroy (skeleton->priv->changed_properties_idle_source);
17662 skeleton->priv->changed_properties_idle_source = NULL;
17663 emit_changed = TRUE;
17664 }
17665 g_mutex_unlock (&skeleton->priv->lock);
17666
17667 if (emit_changed)
17668 _watchdog_emit_changed (skeleton);
17669}
17670
17671static void
17672_watchdog_on_signal_watchdog_error (
17673 Watchdog *object)
17674{
17675 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17676
17677 GList *connections, *l;
17678 GVariant *signal_variant;
17679 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
17680
17681 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
17682 for (l = connections; l != NULL; l = l->next)
17683 {
17684 GDBusConnection *connection = l->data;
17685 g_dbus_connection_emit_signal (connection,
17686 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Watchdog", "WatchdogError",
17687 signal_variant, NULL);
17688 }
17689 g_variant_unref (signal_variant);
17690 g_list_free_full (connections, g_object_unref);
17691}
17692
17693static void watchdog_skeleton_iface_init (WatchdogIface *iface);
17694#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17695G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
17696 G_ADD_PRIVATE (WatchdogSkeleton)
17697 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init));
17698
17699#else
17700G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
17701 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init));
17702
17703#endif
17704static void
17705watchdog_skeleton_finalize (GObject *object)
17706{
17707 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17708 guint n;
17709 for (n = 0; n < 2; n++)
17710 g_value_unset (&skeleton->priv->properties[n]);
17711 g_free (skeleton->priv->properties);
17712 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
17713 if (skeleton->priv->changed_properties_idle_source != NULL)
17714 g_source_destroy (skeleton->priv->changed_properties_idle_source);
17715 g_main_context_unref (skeleton->priv->context);
17716 g_mutex_clear (&skeleton->priv->lock);
17717 G_OBJECT_CLASS (watchdog_skeleton_parent_class)->finalize (object);
17718}
17719
17720static void
17721watchdog_skeleton_get_property (GObject *object,
17722 guint prop_id,
17723 GValue *value,
17724 GParamSpec *pspec G_GNUC_UNUSED)
17725{
17726 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17727 g_assert (prop_id != 0 && prop_id - 1 < 2);
17728 g_mutex_lock (&skeleton->priv->lock);
17729 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
17730 g_mutex_unlock (&skeleton->priv->lock);
17731}
17732
17733static gboolean
17734_watchdog_emit_changed (gpointer user_data)
17735{
17736 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
17737 GList *l;
17738 GVariantBuilder builder;
17739 GVariantBuilder invalidated_builder;
17740 guint num_changes;
17741
17742 g_mutex_lock (&skeleton->priv->lock);
17743 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
17744 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
17745 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
17746 {
17747 ChangedProperty *cp = l->data;
17748 GVariant *variant;
17749 const GValue *cur_value;
17750
17751 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
17752 if (!_g_value_equal (cur_value, &cp->orig_value))
17753 {
17754 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
17755 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
17756 g_variant_unref (variant);
17757 num_changes++;
17758 }
17759 }
17760 if (num_changes > 0)
17761 {
17762 GList *connections, *ll;
17763 GVariant *signal_variant;
17764 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Watchdog",
17765 &builder, &invalidated_builder));
17766 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
17767 for (ll = connections; ll != NULL; ll = ll->next)
17768 {
17769 GDBusConnection *connection = ll->data;
17770
17771 g_dbus_connection_emit_signal (connection,
17772 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
17773 "org.freedesktop.DBus.Properties",
17774 "PropertiesChanged",
17775 signal_variant,
17776 NULL);
17777 }
17778 g_variant_unref (signal_variant);
17779 g_list_free_full (connections, g_object_unref);
17780 }
17781 else
17782 {
17783 g_variant_builder_clear (&builder);
17784 g_variant_builder_clear (&invalidated_builder);
17785 }
17786 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
17787 skeleton->priv->changed_properties = NULL;
17788 skeleton->priv->changed_properties_idle_source = NULL;
17789 g_mutex_unlock (&skeleton->priv->lock);
17790 return FALSE;
17791}
17792
17793static void
17794_watchdog_schedule_emit_changed (WatchdogSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
17795{
17796 ChangedProperty *cp;
17797 GList *l;
17798 cp = NULL;
17799 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
17800 {
17801 ChangedProperty *i_cp = l->data;
17802 if (i_cp->info == info)
17803 {
17804 cp = i_cp;
17805 break;
17806 }
17807 }
17808 if (cp == NULL)
17809 {
17810 cp = g_new0 (ChangedProperty, 1);
17811 cp->prop_id = prop_id;
17812 cp->info = info;
17813 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
17814 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
17815 g_value_copy (orig_value, &cp->orig_value);
17816 }
17817}
17818
17819static void
17820watchdog_skeleton_notify (GObject *object,
17821 GParamSpec *pspec G_GNUC_UNUSED)
17822{
17823 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17824 g_mutex_lock (&skeleton->priv->lock);
17825 if (skeleton->priv->changed_properties != NULL &&
17826 skeleton->priv->changed_properties_idle_source == NULL)
17827 {
17828 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
17829 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
17830 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _watchdog_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
17831 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
17832 g_source_unref (skeleton->priv->changed_properties_idle_source);
17833 }
17834 g_mutex_unlock (&skeleton->priv->lock);
17835}
17836
17837static void
17838watchdog_skeleton_set_property (GObject *object,
17839 guint prop_id,
17840 const GValue *value,
17841 GParamSpec *pspec)
17842{
17843 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17844 g_assert (prop_id != 0 && prop_id - 1 < 2);
17845 g_mutex_lock (&skeleton->priv->lock);
17846 g_object_freeze_notify (object);
17847 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
17848 {
17849 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
17850 _watchdog_schedule_emit_changed (skeleton, _watchdog_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
17851 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
17852 g_object_notify_by_pspec (object, pspec);
17853 }
17854 g_mutex_unlock (&skeleton->priv->lock);
17855 g_object_thaw_notify (object);
17856}
17857
17858static void
17859watchdog_skeleton_init (WatchdogSkeleton *skeleton)
17860{
17861#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17862 skeleton->priv = watchdog_skeleton_get_instance_private (skeleton);
17863#else
17864 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_WATCHDOG_SKELETON, WatchdogSkeletonPrivate);
17865#endif
17866
17867 g_mutex_init (&skeleton->priv->lock);
17868 skeleton->priv->context = g_main_context_ref_thread_default ();
17869 skeleton->priv->properties = g_new0 (GValue, 2);
17870 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
17871 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
17872}
17873
17874static gint
17875watchdog_skeleton_get_watchdog (Watchdog *object)
17876{
17877 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17878 gint value;
17879 g_mutex_lock (&skeleton->priv->lock);
17880 value = g_value_get_int (&(skeleton->priv->properties[0]));
17881 g_mutex_unlock (&skeleton->priv->lock);
17882 return value;
17883}
17884
17885static gint
17886watchdog_skeleton_get_poll_interval (Watchdog *object)
17887{
17888 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
17889 gint value;
17890 g_mutex_lock (&skeleton->priv->lock);
17891 value = g_value_get_int (&(skeleton->priv->properties[1]));
17892 g_mutex_unlock (&skeleton->priv->lock);
17893 return value;
17894}
17895
17896static void
17897watchdog_skeleton_class_init (WatchdogSkeletonClass *klass)
17898{
17899 GObjectClass *gobject_class;
17900 GDBusInterfaceSkeletonClass *skeleton_class;
17901
17902 gobject_class = G_OBJECT_CLASS (klass);
17903 gobject_class->finalize = watchdog_skeleton_finalize;
17904 gobject_class->get_property = watchdog_skeleton_get_property;
17905 gobject_class->set_property = watchdog_skeleton_set_property;
17906 gobject_class->notify = watchdog_skeleton_notify;
17907
17908
17909 watchdog_override_properties (gobject_class, 1);
17910
17911 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
17912 skeleton_class->get_info = watchdog_skeleton_dbus_interface_get_info;
17913 skeleton_class->get_properties = watchdog_skeleton_dbus_interface_get_properties;
17914 skeleton_class->flush = watchdog_skeleton_dbus_interface_flush;
17915 skeleton_class->get_vtable = watchdog_skeleton_dbus_interface_get_vtable;
17916
17917#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
17918 g_type_class_add_private (klass, sizeof (WatchdogSkeletonPrivate));
17919#endif
17920}
17921
17922static void
17923watchdog_skeleton_iface_init (WatchdogIface *iface)
17924{
17925 iface->watchdog_error = _watchdog_on_signal_watchdog_error;
17926 iface->get_watchdog = watchdog_skeleton_get_watchdog;
17927 iface->get_poll_interval = watchdog_skeleton_get_poll_interval;
17928}
17929
17930/**
17931 * watchdog_skeleton_new:
17932 *
17933 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
17934 *
17935 * Returns: (transfer full) (type WatchdogSkeleton): The skeleton object.
17936 */
17937Watchdog *
17938watchdog_skeleton_new (void)
17939{
17940 return WATCHDOG (g_object_new (TYPE_WATCHDOG_SKELETON, NULL));
17941}
17942
17943/* ------------------------------------------------------------------------
17944 * Code for interface org.openbmc.EventLog
17945 * ------------------------------------------------------------------------
17946 */
17947
17948/**
17949 * SECTION:EventLog
17950 * @title: EventLog
17951 * @short_description: Generated C code for the org.openbmc.EventLog D-Bus interface
17952 *
17953 * 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.
17954 */
17955
17956/* ---- Introspection data for org.openbmc.EventLog ---- */
17957
Norman James2d1ee892015-09-16 23:13:45 -050017958static const _ExtendedGDBusArgInfo _event_log_method_info_get_event_log_OUT_ARG_log =
17959{
17960 {
17961 -1,
17962 (gchar *) "log",
17963 (gchar *) "a(s)",
17964 NULL
17965 },
17966 FALSE
17967};
17968
17969static const _ExtendedGDBusArgInfo * const _event_log_method_info_get_event_log_OUT_ARG_pointers[] =
17970{
17971 &_event_log_method_info_get_event_log_OUT_ARG_log,
17972 NULL
17973};
17974
17975static const _ExtendedGDBusMethodInfo _event_log_method_info_get_event_log =
17976{
17977 {
17978 -1,
17979 (gchar *) "getEventLog",
17980 NULL,
17981 (GDBusArgInfo **) &_event_log_method_info_get_event_log_OUT_ARG_pointers,
17982 NULL
17983 },
17984 "handle-get-event-log",
17985 FALSE
17986};
17987
17988static const _ExtendedGDBusMethodInfo * const _event_log_method_info_pointers[] =
17989{
17990 &_event_log_method_info_get_event_log,
17991 NULL
17992};
17993
Norman James8abb50c2015-09-16 10:58:16 -050017994static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_priority =
Norman James362a80f2015-09-14 14:04:39 -050017995{
17996 {
17997 -1,
Norman James8abb50c2015-09-16 10:58:16 -050017998 (gchar *) "priority",
17999 (gchar *) "i",
Norman James362a80f2015-09-14 14:04:39 -050018000 NULL
18001 },
18002 FALSE
18003};
18004
Norman James362a80f2015-09-14 14:04:39 -050018005static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_message =
18006{
18007 {
18008 -1,
18009 (gchar *) "message",
Norman James32e74e22015-09-15 21:28:06 -050018010 (gchar *) "s",
Norman James362a80f2015-09-14 14:04:39 -050018011 NULL
18012 },
18013 FALSE
18014};
18015
Norman James88872672015-09-21 16:51:35 -050018016static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_rc =
18017{
18018 {
18019 -1,
18020 (gchar *) "rc",
18021 (gchar *) "i",
18022 NULL
18023 },
18024 FALSE
18025};
18026
Norman James362a80f2015-09-14 14:04:39 -050018027static const _ExtendedGDBusArgInfo * const _event_log_signal_info_event_log_ARG_pointers[] =
18028{
Norman James8abb50c2015-09-16 10:58:16 -050018029 &_event_log_signal_info_event_log_ARG_priority,
Norman James362a80f2015-09-14 14:04:39 -050018030 &_event_log_signal_info_event_log_ARG_message,
Norman James88872672015-09-21 16:51:35 -050018031 &_event_log_signal_info_event_log_ARG_rc,
Norman James362a80f2015-09-14 14:04:39 -050018032 NULL
18033};
18034
18035static const _ExtendedGDBusSignalInfo _event_log_signal_info_event_log =
18036{
18037 {
18038 -1,
18039 (gchar *) "EventLog",
18040 (GDBusArgInfo **) &_event_log_signal_info_event_log_ARG_pointers,
18041 NULL
18042 },
18043 "event-log"
18044};
18045
18046static const _ExtendedGDBusSignalInfo * const _event_log_signal_info_pointers[] =
18047{
18048 &_event_log_signal_info_event_log,
18049 NULL
18050};
18051
Norman James362a80f2015-09-14 14:04:39 -050018052static const _ExtendedGDBusInterfaceInfo _event_log_interface_info =
18053{
18054 {
18055 -1,
18056 (gchar *) "org.openbmc.EventLog",
Norman James2d1ee892015-09-16 23:13:45 -050018057 (GDBusMethodInfo **) &_event_log_method_info_pointers,
Norman James362a80f2015-09-14 14:04:39 -050018058 (GDBusSignalInfo **) &_event_log_signal_info_pointers,
Norman James32e74e22015-09-15 21:28:06 -050018059 NULL,
Norman James362a80f2015-09-14 14:04:39 -050018060 NULL
18061 },
18062 "event-log",
18063};
18064
18065
18066/**
18067 * event_log_interface_info:
18068 *
18069 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> D-Bus interface.
18070 *
18071 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
18072 */
18073GDBusInterfaceInfo *
18074event_log_interface_info (void)
18075{
18076 return (GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct;
18077}
18078
18079/**
18080 * event_log_override_properties:
18081 * @klass: The class structure for a #GObject<!-- -->-derived class.
18082 * @property_id_begin: The property id to assign to the first overridden property.
18083 *
18084 * Overrides all #GObject properties in the #EventLog interface for a concrete class.
18085 * The properties are overridden in the order they are defined.
18086 *
18087 * Returns: The last property id.
18088 */
18089guint
18090event_log_override_properties (GObjectClass *klass, guint property_id_begin)
18091{
Norman James362a80f2015-09-14 14:04:39 -050018092 return property_id_begin - 1;
18093}
18094
18095
18096
18097/**
18098 * EventLog:
18099 *
18100 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
18101 */
18102
18103/**
18104 * EventLogIface:
18105 * @parent_iface: The parent interface.
Norman James2d1ee892015-09-16 23:13:45 -050018106 * @handle_get_event_log: Handler for the #EventLog::handle-get-event-log signal.
Norman James362a80f2015-09-14 14:04:39 -050018107 * @event_log: Handler for the #EventLog::event-log signal.
18108 *
18109 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
18110 */
18111
18112typedef EventLogIface EventLogInterface;
18113G_DEFINE_INTERFACE (EventLog, event_log, G_TYPE_OBJECT);
18114
18115static void
18116event_log_default_init (EventLogIface *iface)
18117{
Norman James2d1ee892015-09-16 23:13:45 -050018118 /* GObject signals for incoming D-Bus method calls: */
18119 /**
18120 * EventLog::handle-get-event-log:
18121 * @object: A #EventLog.
18122 * @invocation: A #GDBusMethodInvocation.
18123 *
18124 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method.
18125 *
18126 * 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.
18127 *
18128 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
18129 */
18130 g_signal_new ("handle-get-event-log",
18131 G_TYPE_FROM_INTERFACE (iface),
18132 G_SIGNAL_RUN_LAST,
18133 G_STRUCT_OFFSET (EventLogIface, handle_get_event_log),
18134 g_signal_accumulator_true_handled,
18135 NULL,
18136 g_cclosure_marshal_generic,
18137 G_TYPE_BOOLEAN,
18138 1,
18139 G_TYPE_DBUS_METHOD_INVOCATION);
18140
Norman James362a80f2015-09-14 14:04:39 -050018141 /* GObject signals for received D-Bus signals: */
18142 /**
18143 * EventLog::event-log:
18144 * @object: A #EventLog.
Norman James8abb50c2015-09-16 10:58:16 -050018145 * @arg_priority: Argument.
Norman James362a80f2015-09-14 14:04:39 -050018146 * @arg_message: Argument.
Norman James88872672015-09-21 16:51:35 -050018147 * @arg_rc: Argument.
Norman James362a80f2015-09-14 14:04:39 -050018148 *
18149 * 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.
18150 *
18151 * 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.
18152 */
18153 g_signal_new ("event-log",
18154 G_TYPE_FROM_INTERFACE (iface),
18155 G_SIGNAL_RUN_LAST,
18156 G_STRUCT_OFFSET (EventLogIface, event_log),
18157 NULL,
18158 NULL,
18159 g_cclosure_marshal_generic,
18160 G_TYPE_NONE,
Norman James88872672015-09-21 16:51:35 -050018161 3, G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT);
Norman James362a80f2015-09-14 14:04:39 -050018162
Norman James362a80f2015-09-14 14:04:39 -050018163}
18164
18165/**
18166 * event_log_emit_event_log:
18167 * @object: A #EventLog.
Norman James8abb50c2015-09-16 10:58:16 -050018168 * @arg_priority: Argument to pass with the signal.
Norman James362a80f2015-09-14 14:04:39 -050018169 * @arg_message: Argument to pass with the signal.
Norman James88872672015-09-21 16:51:35 -050018170 * @arg_rc: Argument to pass with the signal.
Norman James362a80f2015-09-14 14:04:39 -050018171 *
18172 * Emits the <link linkend="gdbus-signal-org-openbmc-EventLog.EventLog">"EventLog"</link> D-Bus signal.
18173 */
18174void
18175event_log_emit_event_log (
18176 EventLog *object,
Norman James8abb50c2015-09-16 10:58:16 -050018177 gint arg_priority,
Norman James88872672015-09-21 16:51:35 -050018178 const gchar *arg_message,
18179 gint arg_rc)
Norman James362a80f2015-09-14 14:04:39 -050018180{
Norman James88872672015-09-21 16:51:35 -050018181 g_signal_emit_by_name (object, "event-log", arg_priority, arg_message, arg_rc);
Norman James362a80f2015-09-14 14:04:39 -050018182}
18183
Norman James2d1ee892015-09-16 23:13:45 -050018184/**
18185 * event_log_call_get_event_log:
18186 * @proxy: A #EventLogProxy.
18187 * @cancellable: (allow-none): A #GCancellable or %NULL.
18188 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
18189 * @user_data: User data to pass to @callback.
18190 *
18191 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method on @proxy.
18192 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
18193 * You can then call event_log_call_get_event_log_finish() to get the result of the operation.
18194 *
18195 * See event_log_call_get_event_log_sync() for the synchronous, blocking version of this method.
18196 */
18197void
18198event_log_call_get_event_log (
18199 EventLog *proxy,
18200 GCancellable *cancellable,
18201 GAsyncReadyCallback callback,
18202 gpointer user_data)
18203{
18204 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
18205 "getEventLog",
18206 g_variant_new ("()"),
18207 G_DBUS_CALL_FLAGS_NONE,
18208 -1,
18209 cancellable,
18210 callback,
18211 user_data);
18212}
18213
18214/**
18215 * event_log_call_get_event_log_finish:
18216 * @proxy: A #EventLogProxy.
18217 * @out_log: (out): Return location for return parameter or %NULL to ignore.
18218 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_call_get_event_log().
18219 * @error: Return location for error or %NULL.
18220 *
18221 * Finishes an operation started with event_log_call_get_event_log().
18222 *
18223 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18224 */
18225gboolean
18226event_log_call_get_event_log_finish (
18227 EventLog *proxy,
18228 GVariant **out_log,
18229 GAsyncResult *res,
18230 GError **error)
18231{
18232 GVariant *_ret;
18233 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
18234 if (_ret == NULL)
18235 goto _out;
18236 g_variant_get (_ret,
18237 "(@a(s))",
18238 out_log);
18239 g_variant_unref (_ret);
18240_out:
18241 return _ret != NULL;
18242}
18243
18244/**
18245 * event_log_call_get_event_log_sync:
18246 * @proxy: A #EventLogProxy.
18247 * @out_log: (out): Return location for return parameter or %NULL to ignore.
18248 * @cancellable: (allow-none): A #GCancellable or %NULL.
18249 * @error: Return location for error or %NULL.
18250 *
18251 * 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.
18252 *
18253 * See event_log_call_get_event_log() for the asynchronous version of this method.
18254 *
18255 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18256 */
18257gboolean
18258event_log_call_get_event_log_sync (
18259 EventLog *proxy,
18260 GVariant **out_log,
18261 GCancellable *cancellable,
18262 GError **error)
18263{
18264 GVariant *_ret;
18265 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
18266 "getEventLog",
18267 g_variant_new ("()"),
18268 G_DBUS_CALL_FLAGS_NONE,
18269 -1,
18270 cancellable,
18271 error);
18272 if (_ret == NULL)
18273 goto _out;
18274 g_variant_get (_ret,
18275 "(@a(s))",
18276 out_log);
18277 g_variant_unref (_ret);
18278_out:
18279 return _ret != NULL;
18280}
18281
18282/**
18283 * event_log_complete_get_event_log:
18284 * @object: A #EventLog.
18285 * @invocation: (transfer full): A #GDBusMethodInvocation.
18286 * @log: Parameter to return.
18287 *
18288 * 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.
18289 *
18290 * This method will free @invocation, you cannot use it afterwards.
18291 */
18292void
18293event_log_complete_get_event_log (
18294 EventLog *object,
18295 GDBusMethodInvocation *invocation,
18296 GVariant *log)
18297{
18298 g_dbus_method_invocation_return_value (invocation,
18299 g_variant_new ("(@a(s))",
18300 log));
18301}
18302
Norman James362a80f2015-09-14 14:04:39 -050018303/* ------------------------------------------------------------------------ */
18304
18305/**
18306 * EventLogProxy:
18307 *
18308 * The #EventLogProxy structure contains only private data and should only be accessed using the provided API.
18309 */
18310
18311/**
18312 * EventLogProxyClass:
18313 * @parent_class: The parent class.
18314 *
18315 * Class structure for #EventLogProxy.
18316 */
18317
18318struct _EventLogProxyPrivate
18319{
18320 GData *qdata;
18321};
18322
18323static void event_log_proxy_iface_init (EventLogIface *iface);
18324
18325#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18326G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
18327 G_ADD_PRIVATE (EventLogProxy)
18328 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
18329
18330#else
18331G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
18332 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
18333
18334#endif
18335static void
18336event_log_proxy_finalize (GObject *object)
18337{
18338 EventLogProxy *proxy = EVENT_LOG_PROXY (object);
18339 g_datalist_clear (&proxy->priv->qdata);
18340 G_OBJECT_CLASS (event_log_proxy_parent_class)->finalize (object);
18341}
18342
18343static void
18344event_log_proxy_get_property (GObject *object,
18345 guint prop_id,
18346 GValue *value,
18347 GParamSpec *pspec G_GNUC_UNUSED)
18348{
Norman James362a80f2015-09-14 14:04:39 -050018349}
18350
18351static void
18352event_log_proxy_set_property (GObject *object,
18353 guint prop_id,
18354 const GValue *value,
18355 GParamSpec *pspec G_GNUC_UNUSED)
18356{
Norman James362a80f2015-09-14 14:04:39 -050018357}
18358
18359static void
18360event_log_proxy_g_signal (GDBusProxy *proxy,
18361 const gchar *sender_name G_GNUC_UNUSED,
18362 const gchar *signal_name,
18363 GVariant *parameters)
18364{
18365 _ExtendedGDBusSignalInfo *info;
18366 GVariantIter iter;
18367 GVariant *child;
18368 GValue *paramv;
18369 guint num_params;
18370 guint n;
18371 guint signal_id;
18372 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, signal_name);
18373 if (info == NULL)
18374 return;
18375 num_params = g_variant_n_children (parameters);
18376 paramv = g_new0 (GValue, num_params + 1);
18377 g_value_init (&paramv[0], TYPE_EVENT_LOG);
18378 g_value_set_object (&paramv[0], proxy);
18379 g_variant_iter_init (&iter, parameters);
18380 n = 1;
18381 while ((child = g_variant_iter_next_value (&iter)) != NULL)
18382 {
18383 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
18384 if (arg_info->use_gvariant)
18385 {
18386 g_value_init (&paramv[n], G_TYPE_VARIANT);
18387 g_value_set_variant (&paramv[n], child);
18388 n++;
18389 }
18390 else
18391 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
18392 g_variant_unref (child);
18393 }
18394 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
18395 g_signal_emitv (paramv, signal_id, 0, NULL);
18396 for (n = 0; n < num_params + 1; n++)
18397 g_value_unset (&paramv[n]);
18398 g_free (paramv);
18399}
18400
18401static void
18402event_log_proxy_g_properties_changed (GDBusProxy *_proxy,
18403 GVariant *changed_properties,
18404 const gchar *const *invalidated_properties)
18405{
18406 EventLogProxy *proxy = EVENT_LOG_PROXY (_proxy);
18407 guint n;
18408 const gchar *key;
18409 GVariantIter *iter;
18410 _ExtendedGDBusPropertyInfo *info;
18411 g_variant_get (changed_properties, "a{sv}", &iter);
18412 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
18413 {
18414 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, key);
18415 g_datalist_remove_data (&proxy->priv->qdata, key);
18416 if (info != NULL)
18417 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
18418 }
18419 g_variant_iter_free (iter);
18420 for (n = 0; invalidated_properties[n] != NULL; n++)
18421 {
18422 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, invalidated_properties[n]);
18423 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
18424 if (info != NULL)
18425 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
18426 }
18427}
18428
Norman James362a80f2015-09-14 14:04:39 -050018429static void
18430event_log_proxy_init (EventLogProxy *proxy)
18431{
18432#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18433 proxy->priv = event_log_proxy_get_instance_private (proxy);
18434#else
18435 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_EVENT_LOG_PROXY, EventLogProxyPrivate);
18436#endif
18437
18438 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), event_log_interface_info ());
18439}
18440
18441static void
18442event_log_proxy_class_init (EventLogProxyClass *klass)
18443{
18444 GObjectClass *gobject_class;
18445 GDBusProxyClass *proxy_class;
18446
18447 gobject_class = G_OBJECT_CLASS (klass);
18448 gobject_class->finalize = event_log_proxy_finalize;
18449 gobject_class->get_property = event_log_proxy_get_property;
18450 gobject_class->set_property = event_log_proxy_set_property;
18451
18452 proxy_class = G_DBUS_PROXY_CLASS (klass);
18453 proxy_class->g_signal = event_log_proxy_g_signal;
18454 proxy_class->g_properties_changed = event_log_proxy_g_properties_changed;
18455
Norman James362a80f2015-09-14 14:04:39 -050018456#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
18457 g_type_class_add_private (klass, sizeof (EventLogProxyPrivate));
18458#endif
18459}
18460
18461static void
18462event_log_proxy_iface_init (EventLogIface *iface)
18463{
Norman James362a80f2015-09-14 14:04:39 -050018464}
18465
18466/**
18467 * event_log_proxy_new:
18468 * @connection: A #GDBusConnection.
18469 * @flags: Flags from the #GDBusProxyFlags enumeration.
18470 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
18471 * @object_path: An object path.
18472 * @cancellable: (allow-none): A #GCancellable or %NULL.
18473 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
18474 * @user_data: User data to pass to @callback.
18475 *
18476 * 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.
18477 *
18478 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
18479 * You can then call event_log_proxy_new_finish() to get the result of the operation.
18480 *
18481 * See event_log_proxy_new_sync() for the synchronous, blocking version of this constructor.
18482 */
18483void
18484event_log_proxy_new (
18485 GDBusConnection *connection,
18486 GDBusProxyFlags flags,
18487 const gchar *name,
18488 const gchar *object_path,
18489 GCancellable *cancellable,
18490 GAsyncReadyCallback callback,
18491 gpointer user_data)
18492{
18493 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);
18494}
18495
18496/**
18497 * event_log_proxy_new_finish:
18498 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new().
18499 * @error: Return location for error or %NULL
18500 *
18501 * Finishes an operation started with event_log_proxy_new().
18502 *
18503 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
18504 */
18505EventLog *
18506event_log_proxy_new_finish (
18507 GAsyncResult *res,
18508 GError **error)
18509{
18510 GObject *ret;
18511 GObject *source_object;
18512 source_object = g_async_result_get_source_object (res);
18513 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
18514 g_object_unref (source_object);
18515 if (ret != NULL)
18516 return EVENT_LOG (ret);
18517 else
18518 return NULL;
18519}
18520
18521/**
18522 * event_log_proxy_new_sync:
18523 * @connection: A #GDBusConnection.
18524 * @flags: Flags from the #GDBusProxyFlags enumeration.
18525 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
18526 * @object_path: An object path.
18527 * @cancellable: (allow-none): A #GCancellable or %NULL.
18528 * @error: Return location for error or %NULL
18529 *
18530 * 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.
18531 *
18532 * The calling thread is blocked until a reply is received.
18533 *
18534 * See event_log_proxy_new() for the asynchronous version of this constructor.
18535 *
18536 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
18537 */
18538EventLog *
18539event_log_proxy_new_sync (
18540 GDBusConnection *connection,
18541 GDBusProxyFlags flags,
18542 const gchar *name,
18543 const gchar *object_path,
18544 GCancellable *cancellable,
18545 GError **error)
18546{
18547 GInitable *ret;
18548 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);
18549 if (ret != NULL)
18550 return EVENT_LOG (ret);
18551 else
18552 return NULL;
18553}
18554
18555
18556/**
18557 * event_log_proxy_new_for_bus:
18558 * @bus_type: A #GBusType.
18559 * @flags: Flags from the #GDBusProxyFlags enumeration.
18560 * @name: A bus name (well-known or unique).
18561 * @object_path: An object path.
18562 * @cancellable: (allow-none): A #GCancellable or %NULL.
18563 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
18564 * @user_data: User data to pass to @callback.
18565 *
18566 * Like event_log_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
18567 *
18568 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
18569 * You can then call event_log_proxy_new_for_bus_finish() to get the result of the operation.
18570 *
18571 * See event_log_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
18572 */
18573void
18574event_log_proxy_new_for_bus (
18575 GBusType bus_type,
18576 GDBusProxyFlags flags,
18577 const gchar *name,
18578 const gchar *object_path,
18579 GCancellable *cancellable,
18580 GAsyncReadyCallback callback,
18581 gpointer user_data)
18582{
18583 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);
18584}
18585
18586/**
18587 * event_log_proxy_new_for_bus_finish:
18588 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new_for_bus().
18589 * @error: Return location for error or %NULL
18590 *
18591 * Finishes an operation started with event_log_proxy_new_for_bus().
18592 *
18593 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
18594 */
18595EventLog *
18596event_log_proxy_new_for_bus_finish (
18597 GAsyncResult *res,
18598 GError **error)
18599{
18600 GObject *ret;
18601 GObject *source_object;
18602 source_object = g_async_result_get_source_object (res);
18603 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
18604 g_object_unref (source_object);
18605 if (ret != NULL)
18606 return EVENT_LOG (ret);
18607 else
18608 return NULL;
18609}
18610
18611/**
18612 * event_log_proxy_new_for_bus_sync:
18613 * @bus_type: A #GBusType.
18614 * @flags: Flags from the #GDBusProxyFlags enumeration.
18615 * @name: A bus name (well-known or unique).
18616 * @object_path: An object path.
18617 * @cancellable: (allow-none): A #GCancellable or %NULL.
18618 * @error: Return location for error or %NULL
18619 *
18620 * Like event_log_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
18621 *
18622 * The calling thread is blocked until a reply is received.
18623 *
18624 * See event_log_proxy_new_for_bus() for the asynchronous version of this constructor.
18625 *
18626 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
18627 */
18628EventLog *
18629event_log_proxy_new_for_bus_sync (
18630 GBusType bus_type,
18631 GDBusProxyFlags flags,
18632 const gchar *name,
18633 const gchar *object_path,
18634 GCancellable *cancellable,
18635 GError **error)
18636{
18637 GInitable *ret;
18638 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);
18639 if (ret != NULL)
18640 return EVENT_LOG (ret);
18641 else
18642 return NULL;
18643}
18644
18645
18646/* ------------------------------------------------------------------------ */
18647
18648/**
18649 * EventLogSkeleton:
18650 *
18651 * The #EventLogSkeleton structure contains only private data and should only be accessed using the provided API.
18652 */
18653
18654/**
18655 * EventLogSkeletonClass:
18656 * @parent_class: The parent class.
18657 *
18658 * Class structure for #EventLogSkeleton.
18659 */
18660
18661struct _EventLogSkeletonPrivate
18662{
18663 GValue *properties;
18664 GList *changed_properties;
18665 GSource *changed_properties_idle_source;
18666 GMainContext *context;
18667 GMutex lock;
18668};
18669
18670static void
18671_event_log_skeleton_handle_method_call (
18672 GDBusConnection *connection G_GNUC_UNUSED,
18673 const gchar *sender G_GNUC_UNUSED,
18674 const gchar *object_path G_GNUC_UNUSED,
18675 const gchar *interface_name,
18676 const gchar *method_name,
18677 GVariant *parameters,
18678 GDBusMethodInvocation *invocation,
18679 gpointer user_data)
18680{
18681 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
18682 _ExtendedGDBusMethodInfo *info;
18683 GVariantIter iter;
18684 GVariant *child;
18685 GValue *paramv;
18686 guint num_params;
18687 guint num_extra;
18688 guint n;
18689 guint signal_id;
18690 GValue return_value = G_VALUE_INIT;
18691 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
18692 g_assert (info != NULL);
18693 num_params = g_variant_n_children (parameters);
18694 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
18695 n = 0;
18696 g_value_init (&paramv[n], TYPE_EVENT_LOG);
18697 g_value_set_object (&paramv[n++], skeleton);
18698 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
18699 g_value_set_object (&paramv[n++], invocation);
18700 if (info->pass_fdlist)
18701 {
18702#ifdef G_OS_UNIX
18703 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
18704 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
18705#else
18706 g_assert_not_reached ();
18707#endif
18708 }
18709 g_variant_iter_init (&iter, parameters);
18710 while ((child = g_variant_iter_next_value (&iter)) != NULL)
18711 {
18712 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
18713 if (arg_info->use_gvariant)
18714 {
18715 g_value_init (&paramv[n], G_TYPE_VARIANT);
18716 g_value_set_variant (&paramv[n], child);
18717 n++;
18718 }
18719 else
18720 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
18721 g_variant_unref (child);
18722 }
18723 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
18724 g_value_init (&return_value, G_TYPE_BOOLEAN);
18725 g_signal_emitv (paramv, signal_id, 0, &return_value);
18726 if (!g_value_get_boolean (&return_value))
18727 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);
18728 g_value_unset (&return_value);
18729 for (n = 0; n < num_params + num_extra; n++)
18730 g_value_unset (&paramv[n]);
18731 g_free (paramv);
18732}
18733
18734static GVariant *
18735_event_log_skeleton_handle_get_property (
18736 GDBusConnection *connection G_GNUC_UNUSED,
18737 const gchar *sender G_GNUC_UNUSED,
18738 const gchar *object_path G_GNUC_UNUSED,
18739 const gchar *interface_name G_GNUC_UNUSED,
18740 const gchar *property_name,
18741 GError **error,
18742 gpointer user_data)
18743{
18744 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
18745 GValue value = G_VALUE_INIT;
18746 GParamSpec *pspec;
18747 _ExtendedGDBusPropertyInfo *info;
18748 GVariant *ret;
18749 ret = NULL;
18750 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
18751 g_assert (info != NULL);
18752 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
18753 if (pspec == NULL)
18754 {
18755 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
18756 }
18757 else
18758 {
18759 g_value_init (&value, pspec->value_type);
18760 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
18761 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
18762 g_value_unset (&value);
18763 }
18764 return ret;
18765}
18766
18767static gboolean
18768_event_log_skeleton_handle_set_property (
18769 GDBusConnection *connection G_GNUC_UNUSED,
18770 const gchar *sender G_GNUC_UNUSED,
18771 const gchar *object_path G_GNUC_UNUSED,
18772 const gchar *interface_name G_GNUC_UNUSED,
18773 const gchar *property_name,
18774 GVariant *variant,
18775 GError **error,
18776 gpointer user_data)
18777{
18778 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
18779 GValue value = G_VALUE_INIT;
18780 GParamSpec *pspec;
18781 _ExtendedGDBusPropertyInfo *info;
18782 gboolean ret;
18783 ret = FALSE;
18784 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
18785 g_assert (info != NULL);
18786 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
18787 if (pspec == NULL)
18788 {
18789 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
18790 }
18791 else
18792 {
18793 if (info->use_gvariant)
18794 g_value_set_variant (&value, variant);
18795 else
18796 g_dbus_gvariant_to_gvalue (variant, &value);
18797 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
18798 g_value_unset (&value);
18799 ret = TRUE;
18800 }
18801 return ret;
18802}
18803
18804static const GDBusInterfaceVTable _event_log_skeleton_vtable =
18805{
18806 _event_log_skeleton_handle_method_call,
18807 _event_log_skeleton_handle_get_property,
18808 _event_log_skeleton_handle_set_property,
18809 {NULL}
18810};
18811
18812static GDBusInterfaceInfo *
18813event_log_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
18814{
18815 return event_log_interface_info ();
18816}
18817
18818static GDBusInterfaceVTable *
18819event_log_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
18820{
18821 return (GDBusInterfaceVTable *) &_event_log_skeleton_vtable;
18822}
18823
18824static GVariant *
18825event_log_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
18826{
18827 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (_skeleton);
18828
18829 GVariantBuilder builder;
18830 guint n;
18831 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
18832 if (_event_log_interface_info.parent_struct.properties == NULL)
18833 goto out;
18834 for (n = 0; _event_log_interface_info.parent_struct.properties[n] != NULL; n++)
18835 {
18836 GDBusPropertyInfo *info = _event_log_interface_info.parent_struct.properties[n];
18837 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
18838 {
18839 GVariant *value;
18840 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);
18841 if (value != NULL)
18842 {
18843 g_variant_take_ref (value);
18844 g_variant_builder_add (&builder, "{sv}", info->name, value);
18845 g_variant_unref (value);
18846 }
18847 }
18848 }
18849out:
18850 return g_variant_builder_end (&builder);
18851}
18852
Norman James362a80f2015-09-14 14:04:39 -050018853static void
18854event_log_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
18855{
Norman James362a80f2015-09-14 14:04:39 -050018856}
18857
18858static void
18859_event_log_on_signal_event_log (
18860 EventLog *object,
Norman James8abb50c2015-09-16 10:58:16 -050018861 gint arg_priority,
Norman James88872672015-09-21 16:51:35 -050018862 const gchar *arg_message,
18863 gint arg_rc)
Norman James362a80f2015-09-14 14:04:39 -050018864{
18865 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
18866
18867 GList *connections, *l;
18868 GVariant *signal_variant;
18869 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
18870
Norman James88872672015-09-21 16:51:35 -050018871 signal_variant = g_variant_ref_sink (g_variant_new ("(isi)",
Norman James8abb50c2015-09-16 10:58:16 -050018872 arg_priority,
Norman James88872672015-09-21 16:51:35 -050018873 arg_message,
18874 arg_rc));
Norman James362a80f2015-09-14 14:04:39 -050018875 for (l = connections; l != NULL; l = l->next)
18876 {
18877 GDBusConnection *connection = l->data;
18878 g_dbus_connection_emit_signal (connection,
18879 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.EventLog", "EventLog",
18880 signal_variant, NULL);
18881 }
18882 g_variant_unref (signal_variant);
18883 g_list_free_full (connections, g_object_unref);
18884}
18885
18886static void event_log_skeleton_iface_init (EventLogIface *iface);
18887#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18888G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
18889 G_ADD_PRIVATE (EventLogSkeleton)
18890 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
18891
18892#else
18893G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
18894 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
18895
18896#endif
18897static void
18898event_log_skeleton_finalize (GObject *object)
18899{
18900 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
Norman James362a80f2015-09-14 14:04:39 -050018901 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
18902 if (skeleton->priv->changed_properties_idle_source != NULL)
18903 g_source_destroy (skeleton->priv->changed_properties_idle_source);
18904 g_main_context_unref (skeleton->priv->context);
18905 g_mutex_clear (&skeleton->priv->lock);
18906 G_OBJECT_CLASS (event_log_skeleton_parent_class)->finalize (object);
18907}
18908
18909static void
Norman James362a80f2015-09-14 14:04:39 -050018910event_log_skeleton_init (EventLogSkeleton *skeleton)
18911{
18912#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18913 skeleton->priv = event_log_skeleton_get_instance_private (skeleton);
18914#else
18915 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_EVENT_LOG_SKELETON, EventLogSkeletonPrivate);
18916#endif
18917
18918 g_mutex_init (&skeleton->priv->lock);
18919 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James362a80f2015-09-14 14:04:39 -050018920}
18921
18922static void
18923event_log_skeleton_class_init (EventLogSkeletonClass *klass)
18924{
18925 GObjectClass *gobject_class;
18926 GDBusInterfaceSkeletonClass *skeleton_class;
18927
18928 gobject_class = G_OBJECT_CLASS (klass);
18929 gobject_class->finalize = event_log_skeleton_finalize;
Norman James362a80f2015-09-14 14:04:39 -050018930
18931 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
18932 skeleton_class->get_info = event_log_skeleton_dbus_interface_get_info;
18933 skeleton_class->get_properties = event_log_skeleton_dbus_interface_get_properties;
18934 skeleton_class->flush = event_log_skeleton_dbus_interface_flush;
18935 skeleton_class->get_vtable = event_log_skeleton_dbus_interface_get_vtable;
18936
18937#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
18938 g_type_class_add_private (klass, sizeof (EventLogSkeletonPrivate));
18939#endif
18940}
18941
18942static void
18943event_log_skeleton_iface_init (EventLogIface *iface)
18944{
18945 iface->event_log = _event_log_on_signal_event_log;
Norman James362a80f2015-09-14 14:04:39 -050018946}
18947
18948/**
18949 * event_log_skeleton_new:
18950 *
18951 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
18952 *
18953 * Returns: (transfer full) (type EventLogSkeleton): The skeleton object.
18954 */
18955EventLog *
18956event_log_skeleton_new (void)
18957{
18958 return EVENT_LOG (g_object_new (TYPE_EVENT_LOG_SKELETON, NULL));
18959}
18960
18961/* ------------------------------------------------------------------------
18962 * Code for interface org.openbmc.Flash
18963 * ------------------------------------------------------------------------
18964 */
18965
18966/**
18967 * SECTION:Flash
18968 * @title: Flash
18969 * @short_description: Generated C code for the org.openbmc.Flash D-Bus interface
18970 *
18971 * 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.
18972 */
18973
18974/* ---- Introspection data for org.openbmc.Flash ---- */
18975
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018976static const _ExtendedGDBusArgInfo _flash_method_info_update_IN_ARG_filename =
Norman James362a80f2015-09-14 14:04:39 -050018977{
18978 {
18979 -1,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018980 (gchar *) "filename",
Norman James362a80f2015-09-14 14:04:39 -050018981 (gchar *) "s",
18982 NULL
18983 },
18984 FALSE
18985};
18986
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018987static const _ExtendedGDBusArgInfo * const _flash_method_info_update_IN_ARG_pointers[] =
Norman James362a80f2015-09-14 14:04:39 -050018988{
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018989 &_flash_method_info_update_IN_ARG_filename,
Norman James362a80f2015-09-14 14:04:39 -050018990 NULL
18991};
18992
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018993static const _ExtendedGDBusMethodInfo _flash_method_info_update =
Norman James362a80f2015-09-14 14:04:39 -050018994{
18995 {
18996 -1,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050018997 (gchar *) "update",
18998 (GDBusArgInfo **) &_flash_method_info_update_IN_ARG_pointers,
Norman James362a80f2015-09-14 14:04:39 -050018999 NULL,
19000 NULL
19001 },
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019002 "handle-update",
Norman James362a80f2015-09-14 14:04:39 -050019003 FALSE
19004};
19005
Norman James166acf42015-10-22 07:11:51 -050019006static const _ExtendedGDBusArgInfo _flash_method_info_error_IN_ARG_message =
19007{
19008 {
19009 -1,
19010 (gchar *) "message",
19011 (gchar *) "s",
19012 NULL
19013 },
19014 FALSE
19015};
19016
19017static const _ExtendedGDBusArgInfo * const _flash_method_info_error_IN_ARG_pointers[] =
19018{
19019 &_flash_method_info_error_IN_ARG_message,
19020 NULL
19021};
19022
19023static const _ExtendedGDBusMethodInfo _flash_method_info_error =
19024{
19025 {
19026 -1,
19027 (gchar *) "error",
19028 (GDBusArgInfo **) &_flash_method_info_error_IN_ARG_pointers,
19029 NULL,
19030 NULL
19031 },
19032 "handle-error",
19033 FALSE
19034};
19035
19036static const _ExtendedGDBusMethodInfo _flash_method_info_done =
19037{
19038 {
19039 -1,
19040 (gchar *) "done",
19041 NULL,
19042 NULL,
19043 NULL
19044 },
19045 "handle-done",
19046 FALSE
19047};
19048
Norman Jamesf066e872015-10-07 15:29:51 -050019049static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_url =
19050{
19051 {
19052 -1,
19053 (gchar *) "url",
19054 (gchar *) "s",
19055 NULL
19056 },
19057 FALSE
19058};
19059
19060static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_filename =
19061{
19062 {
19063 -1,
19064 (gchar *) "filename",
19065 (gchar *) "s",
19066 NULL
19067 },
19068 FALSE
19069};
19070
19071static const _ExtendedGDBusArgInfo * const _flash_method_info_update_via_tftp_IN_ARG_pointers[] =
19072{
19073 &_flash_method_info_update_via_tftp_IN_ARG_url,
19074 &_flash_method_info_update_via_tftp_IN_ARG_filename,
19075 NULL
19076};
19077
19078static const _ExtendedGDBusMethodInfo _flash_method_info_update_via_tftp =
19079{
19080 {
19081 -1,
19082 (gchar *) "updateViaTftp",
19083 (GDBusArgInfo **) &_flash_method_info_update_via_tftp_IN_ARG_pointers,
19084 NULL,
19085 NULL
19086 },
19087 "handle-update-via-tftp",
19088 FALSE
19089};
19090
Norman James362a80f2015-09-14 14:04:39 -050019091static const _ExtendedGDBusMethodInfo _flash_method_info_init =
19092{
19093 {
19094 -1,
19095 (gchar *) "init",
19096 NULL,
19097 NULL,
19098 NULL
19099 },
19100 "handle-init",
19101 FALSE
19102};
19103
19104static const _ExtendedGDBusMethodInfo * const _flash_method_info_pointers[] =
19105{
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019106 &_flash_method_info_update,
Norman James166acf42015-10-22 07:11:51 -050019107 &_flash_method_info_error,
19108 &_flash_method_info_done,
Norman Jamesf066e872015-10-07 15:29:51 -050019109 &_flash_method_info_update_via_tftp,
Norman James362a80f2015-09-14 14:04:39 -050019110 &_flash_method_info_init,
19111 NULL
19112};
19113
19114static const _ExtendedGDBusSignalInfo _flash_signal_info_updated =
19115{
19116 {
19117 -1,
19118 (gchar *) "Updated",
19119 NULL,
19120 NULL
19121 },
19122 "updated"
19123};
19124
Norman Jamesf066e872015-10-07 15:29:51 -050019125static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_url =
19126{
19127 {
19128 -1,
19129 (gchar *) "url",
19130 (gchar *) "s",
19131 NULL
19132 },
19133 FALSE
19134};
19135
19136static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_filename =
19137{
19138 {
19139 -1,
19140 (gchar *) "filename",
19141 (gchar *) "s",
19142 NULL
19143 },
19144 FALSE
19145};
19146
19147static const _ExtendedGDBusArgInfo * const _flash_signal_info_download_ARG_pointers[] =
19148{
19149 &_flash_signal_info_download_ARG_url,
19150 &_flash_signal_info_download_ARG_filename,
19151 NULL
19152};
19153
19154static const _ExtendedGDBusSignalInfo _flash_signal_info_download =
19155{
19156 {
19157 -1,
19158 (gchar *) "Download",
19159 (GDBusArgInfo **) &_flash_signal_info_download_ARG_pointers,
19160 NULL
19161 },
19162 "download"
19163};
19164
Norman James362a80f2015-09-14 14:04:39 -050019165static const _ExtendedGDBusSignalInfo * const _flash_signal_info_pointers[] =
19166{
19167 &_flash_signal_info_updated,
Norman Jamesf066e872015-10-07 15:29:51 -050019168 &_flash_signal_info_download,
Norman James362a80f2015-09-14 14:04:39 -050019169 NULL
19170};
19171
Norman James18998182015-10-11 21:54:53 -050019172static const _ExtendedGDBusPropertyInfo _flash_property_info_filename =
19173{
19174 {
19175 -1,
19176 (gchar *) "filename",
19177 (gchar *) "s",
19178 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
19179 NULL
19180 },
19181 "filename",
19182 FALSE
19183};
19184
19185static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_path =
19186{
19187 {
19188 -1,
19189 (gchar *) "flasher_path",
19190 (gchar *) "s",
19191 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
19192 NULL
19193 },
19194 "flasher-path",
19195 FALSE
19196};
19197
19198static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_name =
19199{
19200 {
19201 -1,
19202 (gchar *) "flasher_name",
19203 (gchar *) "s",
19204 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
19205 NULL
19206 },
19207 "flasher-name",
19208 FALSE
19209};
19210
19211static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_instance =
19212{
19213 {
19214 -1,
19215 (gchar *) "flasher_instance",
19216 (gchar *) "s",
19217 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
19218 NULL
19219 },
19220 "flasher-instance",
19221 FALSE
19222};
19223
Norman James166acf42015-10-22 07:11:51 -050019224static const _ExtendedGDBusPropertyInfo _flash_property_info_status =
19225{
19226 {
19227 -1,
19228 (gchar *) "status",
19229 (gchar *) "s",
19230 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
19231 NULL
19232 },
19233 "status",
19234 FALSE
19235};
19236
Norman James18998182015-10-11 21:54:53 -050019237static const _ExtendedGDBusPropertyInfo * const _flash_property_info_pointers[] =
19238{
19239 &_flash_property_info_filename,
19240 &_flash_property_info_flasher_path,
19241 &_flash_property_info_flasher_name,
19242 &_flash_property_info_flasher_instance,
Norman James166acf42015-10-22 07:11:51 -050019243 &_flash_property_info_status,
Norman James18998182015-10-11 21:54:53 -050019244 NULL
19245};
19246
Norman James362a80f2015-09-14 14:04:39 -050019247static const _ExtendedGDBusInterfaceInfo _flash_interface_info =
19248{
19249 {
19250 -1,
19251 (gchar *) "org.openbmc.Flash",
19252 (GDBusMethodInfo **) &_flash_method_info_pointers,
19253 (GDBusSignalInfo **) &_flash_signal_info_pointers,
Norman James18998182015-10-11 21:54:53 -050019254 (GDBusPropertyInfo **) &_flash_property_info_pointers,
Norman James362a80f2015-09-14 14:04:39 -050019255 NULL
19256 },
19257 "flash",
19258};
19259
19260
19261/**
19262 * flash_interface_info:
19263 *
19264 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> D-Bus interface.
19265 *
19266 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
19267 */
19268GDBusInterfaceInfo *
19269flash_interface_info (void)
19270{
19271 return (GDBusInterfaceInfo *) &_flash_interface_info.parent_struct;
19272}
19273
19274/**
19275 * flash_override_properties:
19276 * @klass: The class structure for a #GObject<!-- -->-derived class.
19277 * @property_id_begin: The property id to assign to the first overridden property.
19278 *
19279 * Overrides all #GObject properties in the #Flash interface for a concrete class.
19280 * The properties are overridden in the order they are defined.
19281 *
19282 * Returns: The last property id.
19283 */
19284guint
19285flash_override_properties (GObjectClass *klass, guint property_id_begin)
19286{
Norman James18998182015-10-11 21:54:53 -050019287 g_object_class_override_property (klass, property_id_begin++, "filename");
19288 g_object_class_override_property (klass, property_id_begin++, "flasher-path");
19289 g_object_class_override_property (klass, property_id_begin++, "flasher-name");
19290 g_object_class_override_property (klass, property_id_begin++, "flasher-instance");
Norman James166acf42015-10-22 07:11:51 -050019291 g_object_class_override_property (klass, property_id_begin++, "status");
Norman James362a80f2015-09-14 14:04:39 -050019292 return property_id_begin - 1;
19293}
19294
19295
19296
19297/**
19298 * Flash:
19299 *
19300 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
19301 */
19302
19303/**
19304 * FlashIface:
19305 * @parent_iface: The parent interface.
Norman James166acf42015-10-22 07:11:51 -050019306 * @handle_done: Handler for the #Flash::handle-done signal.
19307 * @handle_error: Handler for the #Flash::handle-error signal.
Norman James362a80f2015-09-14 14:04:39 -050019308 * @handle_init: Handler for the #Flash::handle-init signal.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019309 * @handle_update: Handler for the #Flash::handle-update signal.
Norman Jamesf066e872015-10-07 15:29:51 -050019310 * @handle_update_via_tftp: Handler for the #Flash::handle-update-via-tftp signal.
Norman James18998182015-10-11 21:54:53 -050019311 * @get_filename: Getter for the #Flash:filename property.
19312 * @get_flasher_instance: Getter for the #Flash:flasher-instance property.
19313 * @get_flasher_name: Getter for the #Flash:flasher-name property.
19314 * @get_flasher_path: Getter for the #Flash:flasher-path property.
Norman James166acf42015-10-22 07:11:51 -050019315 * @get_status: Getter for the #Flash:status property.
Norman Jamesf066e872015-10-07 15:29:51 -050019316 * @download: Handler for the #Flash::download signal.
Norman James362a80f2015-09-14 14:04:39 -050019317 * @updated: Handler for the #Flash::updated signal.
19318 *
19319 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
19320 */
19321
19322typedef FlashIface FlashInterface;
19323G_DEFINE_INTERFACE (Flash, flash, G_TYPE_OBJECT);
19324
19325static void
19326flash_default_init (FlashIface *iface)
19327{
19328 /* GObject signals for incoming D-Bus method calls: */
19329 /**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019330 * Flash::handle-update:
Norman James362a80f2015-09-14 14:04:39 -050019331 * @object: A #Flash.
19332 * @invocation: A #GDBusMethodInvocation.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019333 * @arg_filename: Argument passed by remote caller.
Norman James362a80f2015-09-14 14:04:39 -050019334 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019335 * 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 -050019336 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019337 * 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 -050019338 *
19339 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
19340 */
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019341 g_signal_new ("handle-update",
Norman James362a80f2015-09-14 14:04:39 -050019342 G_TYPE_FROM_INTERFACE (iface),
19343 G_SIGNAL_RUN_LAST,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019344 G_STRUCT_OFFSET (FlashIface, handle_update),
Norman James362a80f2015-09-14 14:04:39 -050019345 g_signal_accumulator_true_handled,
19346 NULL,
19347 g_cclosure_marshal_generic,
19348 G_TYPE_BOOLEAN,
19349 2,
19350 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
19351
19352 /**
Norman James166acf42015-10-22 07:11:51 -050019353 * Flash::handle-error:
19354 * @object: A #Flash.
19355 * @invocation: A #GDBusMethodInvocation.
19356 * @arg_message: Argument passed by remote caller.
19357 *
19358 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.error">error()</link> D-Bus method.
19359 *
19360 * 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_error() 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.
19361 *
19362 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
19363 */
19364 g_signal_new ("handle-error",
19365 G_TYPE_FROM_INTERFACE (iface),
19366 G_SIGNAL_RUN_LAST,
19367 G_STRUCT_OFFSET (FlashIface, handle_error),
19368 g_signal_accumulator_true_handled,
19369 NULL,
19370 g_cclosure_marshal_generic,
19371 G_TYPE_BOOLEAN,
19372 2,
19373 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
19374
19375 /**
19376 * Flash::handle-done:
19377 * @object: A #Flash.
19378 * @invocation: A #GDBusMethodInvocation.
19379 *
19380 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.done">done()</link> D-Bus method.
19381 *
19382 * 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_done() 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.
19383 *
19384 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
19385 */
19386 g_signal_new ("handle-done",
19387 G_TYPE_FROM_INTERFACE (iface),
19388 G_SIGNAL_RUN_LAST,
19389 G_STRUCT_OFFSET (FlashIface, handle_done),
19390 g_signal_accumulator_true_handled,
19391 NULL,
19392 g_cclosure_marshal_generic,
19393 G_TYPE_BOOLEAN,
19394 1,
19395 G_TYPE_DBUS_METHOD_INVOCATION);
19396
19397 /**
Norman Jamesf066e872015-10-07 15:29:51 -050019398 * Flash::handle-update-via-tftp:
19399 * @object: A #Flash.
19400 * @invocation: A #GDBusMethodInvocation.
19401 * @arg_url: Argument passed by remote caller.
19402 * @arg_filename: Argument passed by remote caller.
19403 *
19404 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method.
19405 *
19406 * 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.
19407 *
19408 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
19409 */
19410 g_signal_new ("handle-update-via-tftp",
19411 G_TYPE_FROM_INTERFACE (iface),
19412 G_SIGNAL_RUN_LAST,
19413 G_STRUCT_OFFSET (FlashIface, handle_update_via_tftp),
19414 g_signal_accumulator_true_handled,
19415 NULL,
19416 g_cclosure_marshal_generic,
19417 G_TYPE_BOOLEAN,
19418 3,
19419 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING);
19420
19421 /**
Norman James362a80f2015-09-14 14:04:39 -050019422 * Flash::handle-init:
19423 * @object: A #Flash.
19424 * @invocation: A #GDBusMethodInvocation.
19425 *
19426 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method.
19427 *
19428 * 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.
19429 *
19430 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
19431 */
19432 g_signal_new ("handle-init",
19433 G_TYPE_FROM_INTERFACE (iface),
19434 G_SIGNAL_RUN_LAST,
19435 G_STRUCT_OFFSET (FlashIface, handle_init),
19436 g_signal_accumulator_true_handled,
19437 NULL,
19438 g_cclosure_marshal_generic,
19439 G_TYPE_BOOLEAN,
19440 1,
19441 G_TYPE_DBUS_METHOD_INVOCATION);
19442
19443 /* GObject signals for received D-Bus signals: */
19444 /**
19445 * Flash::updated:
19446 * @object: A #Flash.
19447 *
19448 * 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.
19449 *
19450 * 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.
19451 */
19452 g_signal_new ("updated",
19453 G_TYPE_FROM_INTERFACE (iface),
19454 G_SIGNAL_RUN_LAST,
19455 G_STRUCT_OFFSET (FlashIface, updated),
19456 NULL,
19457 NULL,
19458 g_cclosure_marshal_generic,
19459 G_TYPE_NONE,
19460 0);
19461
Norman Jamesf066e872015-10-07 15:29:51 -050019462 /**
19463 * Flash::download:
19464 * @object: A #Flash.
19465 * @arg_url: Argument.
19466 * @arg_filename: Argument.
19467 *
19468 * 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.
19469 *
19470 * 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.
19471 */
19472 g_signal_new ("download",
19473 G_TYPE_FROM_INTERFACE (iface),
19474 G_SIGNAL_RUN_LAST,
19475 G_STRUCT_OFFSET (FlashIface, download),
19476 NULL,
19477 NULL,
19478 g_cclosure_marshal_generic,
19479 G_TYPE_NONE,
19480 2, G_TYPE_STRING, G_TYPE_STRING);
19481
Norman James18998182015-10-11 21:54:53 -050019482 /* GObject properties for D-Bus properties: */
19483 /**
19484 * Flash:filename:
19485 *
19486 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link>.
19487 *
19488 * 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.
19489 */
19490 g_object_interface_install_property (iface,
19491 g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
19492 /**
19493 * Flash:flasher-path:
19494 *
19495 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link>.
19496 *
19497 * 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.
19498 */
19499 g_object_interface_install_property (iface,
19500 g_param_spec_string ("flasher-path", "flasher_path", "flasher_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
19501 /**
19502 * Flash:flasher-name:
19503 *
19504 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link>.
19505 *
19506 * 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.
19507 */
19508 g_object_interface_install_property (iface,
19509 g_param_spec_string ("flasher-name", "flasher_name", "flasher_name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
19510 /**
19511 * Flash:flasher-instance:
19512 *
19513 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link>.
19514 *
19515 * 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.
19516 */
19517 g_object_interface_install_property (iface,
19518 g_param_spec_string ("flasher-instance", "flasher_instance", "flasher_instance", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James166acf42015-10-22 07:11:51 -050019519 /**
19520 * Flash:status:
19521 *
19522 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link>.
19523 *
19524 * 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.
19525 */
19526 g_object_interface_install_property (iface,
19527 g_param_spec_string ("status", "status", "status", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James18998182015-10-11 21:54:53 -050019528}
19529
19530/**
19531 * flash_get_filename: (skip)
19532 * @object: A #Flash.
19533 *
19534 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property.
19535 *
19536 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
19537 *
19538 * <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>
19539 *
19540 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
19541 */
19542const gchar *
19543flash_get_filename (Flash *object)
19544{
19545 return FLASH_GET_IFACE (object)->get_filename (object);
19546}
19547
19548/**
19549 * flash_dup_filename: (skip)
19550 * @object: A #Flash.
19551 *
19552 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property.
19553 *
19554 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
19555 *
19556 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
19557 */
19558gchar *
19559flash_dup_filename (Flash *object)
19560{
19561 gchar *value;
19562 g_object_get (G_OBJECT (object), "filename", &value, NULL);
19563 return value;
19564}
19565
19566/**
19567 * flash_set_filename: (skip)
19568 * @object: A #Flash.
19569 * @value: The value to set.
19570 *
19571 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property to @value.
19572 *
19573 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
19574 */
19575void
19576flash_set_filename (Flash *object, const gchar *value)
19577{
19578 g_object_set (G_OBJECT (object), "filename", value, NULL);
19579}
19580
19581/**
19582 * flash_get_flasher_path: (skip)
19583 * @object: A #Flash.
19584 *
19585 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property.
19586 *
19587 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
19588 *
19589 * <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>
19590 *
19591 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
19592 */
19593const gchar *
19594flash_get_flasher_path (Flash *object)
19595{
19596 return FLASH_GET_IFACE (object)->get_flasher_path (object);
19597}
19598
19599/**
19600 * flash_dup_flasher_path: (skip)
19601 * @object: A #Flash.
19602 *
19603 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property.
19604 *
19605 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
19606 *
19607 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
19608 */
19609gchar *
19610flash_dup_flasher_path (Flash *object)
19611{
19612 gchar *value;
19613 g_object_get (G_OBJECT (object), "flasher-path", &value, NULL);
19614 return value;
19615}
19616
19617/**
19618 * flash_set_flasher_path: (skip)
19619 * @object: A #Flash.
19620 * @value: The value to set.
19621 *
19622 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property to @value.
19623 *
19624 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
19625 */
19626void
19627flash_set_flasher_path (Flash *object, const gchar *value)
19628{
19629 g_object_set (G_OBJECT (object), "flasher-path", value, NULL);
19630}
19631
19632/**
19633 * flash_get_flasher_name: (skip)
19634 * @object: A #Flash.
19635 *
19636 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property.
19637 *
19638 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
19639 *
19640 * <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>
19641 *
19642 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
19643 */
19644const gchar *
19645flash_get_flasher_name (Flash *object)
19646{
19647 return FLASH_GET_IFACE (object)->get_flasher_name (object);
19648}
19649
19650/**
19651 * flash_dup_flasher_name: (skip)
19652 * @object: A #Flash.
19653 *
19654 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property.
19655 *
19656 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
19657 *
19658 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
19659 */
19660gchar *
19661flash_dup_flasher_name (Flash *object)
19662{
19663 gchar *value;
19664 g_object_get (G_OBJECT (object), "flasher-name", &value, NULL);
19665 return value;
19666}
19667
19668/**
19669 * flash_set_flasher_name: (skip)
19670 * @object: A #Flash.
19671 * @value: The value to set.
19672 *
19673 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property to @value.
19674 *
19675 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
19676 */
19677void
19678flash_set_flasher_name (Flash *object, const gchar *value)
19679{
19680 g_object_set (G_OBJECT (object), "flasher-name", value, NULL);
19681}
19682
19683/**
19684 * flash_get_flasher_instance: (skip)
19685 * @object: A #Flash.
19686 *
19687 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property.
19688 *
19689 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
19690 *
19691 * <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>
19692 *
19693 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
19694 */
19695const gchar *
19696flash_get_flasher_instance (Flash *object)
19697{
19698 return FLASH_GET_IFACE (object)->get_flasher_instance (object);
19699}
19700
19701/**
19702 * flash_dup_flasher_instance: (skip)
19703 * @object: A #Flash.
19704 *
19705 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property.
19706 *
19707 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
19708 *
19709 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
19710 */
19711gchar *
19712flash_dup_flasher_instance (Flash *object)
19713{
19714 gchar *value;
19715 g_object_get (G_OBJECT (object), "flasher-instance", &value, NULL);
19716 return value;
19717}
19718
19719/**
19720 * flash_set_flasher_instance: (skip)
19721 * @object: A #Flash.
19722 * @value: The value to set.
19723 *
19724 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property to @value.
19725 *
19726 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
19727 */
19728void
19729flash_set_flasher_instance (Flash *object, const gchar *value)
19730{
19731 g_object_set (G_OBJECT (object), "flasher-instance", value, NULL);
Norman James362a80f2015-09-14 14:04:39 -050019732}
19733
19734/**
Norman James166acf42015-10-22 07:11:51 -050019735 * flash_get_status: (skip)
19736 * @object: A #Flash.
19737 *
19738 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link> D-Bus property.
19739 *
19740 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
19741 *
19742 * <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_status() if on another thread.</warning>
19743 *
19744 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
19745 */
19746const gchar *
19747flash_get_status (Flash *object)
19748{
19749 return FLASH_GET_IFACE (object)->get_status (object);
19750}
19751
19752/**
19753 * flash_dup_status: (skip)
19754 * @object: A #Flash.
19755 *
19756 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link> D-Bus property.
19757 *
19758 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
19759 *
19760 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
19761 */
19762gchar *
19763flash_dup_status (Flash *object)
19764{
19765 gchar *value;
19766 g_object_get (G_OBJECT (object), "status", &value, NULL);
19767 return value;
19768}
19769
19770/**
19771 * flash_set_status: (skip)
19772 * @object: A #Flash.
19773 * @value: The value to set.
19774 *
19775 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link> D-Bus property to @value.
19776 *
19777 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
19778 */
19779void
19780flash_set_status (Flash *object, const gchar *value)
19781{
19782 g_object_set (G_OBJECT (object), "status", value, NULL);
19783}
19784
19785/**
Norman James362a80f2015-09-14 14:04:39 -050019786 * flash_emit_updated:
19787 * @object: A #Flash.
19788 *
19789 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Updated">"Updated"</link> D-Bus signal.
19790 */
19791void
19792flash_emit_updated (
19793 Flash *object)
19794{
19795 g_signal_emit_by_name (object, "updated");
19796}
19797
19798/**
Norman Jamesf066e872015-10-07 15:29:51 -050019799 * flash_emit_download:
19800 * @object: A #Flash.
19801 * @arg_url: Argument to pass with the signal.
19802 * @arg_filename: Argument to pass with the signal.
19803 *
19804 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Download">"Download"</link> D-Bus signal.
19805 */
19806void
19807flash_emit_download (
19808 Flash *object,
19809 const gchar *arg_url,
19810 const gchar *arg_filename)
19811{
19812 g_signal_emit_by_name (object, "download", arg_url, arg_filename);
19813}
19814
19815/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019816 * flash_call_update:
Norman James362a80f2015-09-14 14:04:39 -050019817 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019818 * @arg_filename: Argument to pass with the method invocation.
Norman James362a80f2015-09-14 14:04:39 -050019819 * @cancellable: (allow-none): A #GCancellable or %NULL.
19820 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19821 * @user_data: User data to pass to @callback.
19822 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019823 * 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 -050019824 * When the operation is finished, @callback will be invoked 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 -050019825 * You can then call flash_call_update_finish() to get the result of the operation.
Norman James362a80f2015-09-14 14:04:39 -050019826 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019827 * See flash_call_update_sync() for the synchronous, blocking version of this method.
Norman James362a80f2015-09-14 14:04:39 -050019828 */
19829void
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019830flash_call_update (
Norman James362a80f2015-09-14 14:04:39 -050019831 Flash *proxy,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019832 const gchar *arg_filename,
Norman James362a80f2015-09-14 14:04:39 -050019833 GCancellable *cancellable,
19834 GAsyncReadyCallback callback,
19835 gpointer user_data)
19836{
19837 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019838 "update",
Norman James362a80f2015-09-14 14:04:39 -050019839 g_variant_new ("(s)",
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019840 arg_filename),
Norman James362a80f2015-09-14 14:04:39 -050019841 G_DBUS_CALL_FLAGS_NONE,
19842 -1,
19843 cancellable,
19844 callback,
19845 user_data);
19846}
19847
19848/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019849 * flash_call_update_finish:
Norman James362a80f2015-09-14 14:04:39 -050019850 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019851 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update().
Norman James362a80f2015-09-14 14:04:39 -050019852 * @error: Return location for error or %NULL.
19853 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019854 * Finishes an operation started with flash_call_update().
Norman James362a80f2015-09-14 14:04:39 -050019855 *
19856 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19857 */
19858gboolean
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019859flash_call_update_finish (
Norman James362a80f2015-09-14 14:04:39 -050019860 Flash *proxy,
19861 GAsyncResult *res,
19862 GError **error)
19863{
19864 GVariant *_ret;
19865 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19866 if (_ret == NULL)
19867 goto _out;
19868 g_variant_get (_ret,
19869 "()");
19870 g_variant_unref (_ret);
19871_out:
19872 return _ret != NULL;
19873}
19874
19875/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019876 * flash_call_update_sync:
Norman James362a80f2015-09-14 14:04:39 -050019877 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019878 * @arg_filename: Argument to pass with the method invocation.
Norman James362a80f2015-09-14 14:04:39 -050019879 * @cancellable: (allow-none): A #GCancellable or %NULL.
19880 * @error: Return location for error or %NULL.
19881 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019882 * 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 -050019883 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019884 * See flash_call_update() for the asynchronous version of this method.
Norman James362a80f2015-09-14 14:04:39 -050019885 *
19886 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19887 */
19888gboolean
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019889flash_call_update_sync (
Norman James362a80f2015-09-14 14:04:39 -050019890 Flash *proxy,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019891 const gchar *arg_filename,
Norman James362a80f2015-09-14 14:04:39 -050019892 GCancellable *cancellable,
19893 GError **error)
19894{
19895 GVariant *_ret;
19896 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019897 "update",
Norman James362a80f2015-09-14 14:04:39 -050019898 g_variant_new ("(s)",
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019899 arg_filename),
Norman James362a80f2015-09-14 14:04:39 -050019900 G_DBUS_CALL_FLAGS_NONE,
19901 -1,
19902 cancellable,
19903 error);
19904 if (_ret == NULL)
19905 goto _out;
19906 g_variant_get (_ret,
19907 "()");
19908 g_variant_unref (_ret);
19909_out:
19910 return _ret != NULL;
19911}
19912
19913/**
Norman James166acf42015-10-22 07:11:51 -050019914 * flash_call_error:
19915 * @proxy: A #FlashProxy.
19916 * @arg_message: Argument to pass with the method invocation.
19917 * @cancellable: (allow-none): A #GCancellable or %NULL.
19918 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19919 * @user_data: User data to pass to @callback.
19920 *
19921 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.error">error()</link> D-Bus method on @proxy.
19922 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
19923 * You can then call flash_call_error_finish() to get the result of the operation.
19924 *
19925 * See flash_call_error_sync() for the synchronous, blocking version of this method.
19926 */
19927void
19928flash_call_error (
19929 Flash *proxy,
19930 const gchar *arg_message,
19931 GCancellable *cancellable,
19932 GAsyncReadyCallback callback,
19933 gpointer user_data)
19934{
19935 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19936 "error",
19937 g_variant_new ("(s)",
19938 arg_message),
19939 G_DBUS_CALL_FLAGS_NONE,
19940 -1,
19941 cancellable,
19942 callback,
19943 user_data);
19944}
19945
19946/**
19947 * flash_call_error_finish:
19948 * @proxy: A #FlashProxy.
19949 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_error().
19950 * @error: Return location for error or %NULL.
19951 *
19952 * Finishes an operation started with flash_call_error().
19953 *
19954 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19955 */
19956gboolean
19957flash_call_error_finish (
19958 Flash *proxy,
19959 GAsyncResult *res,
19960 GError **error)
19961{
19962 GVariant *_ret;
19963 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19964 if (_ret == NULL)
19965 goto _out;
19966 g_variant_get (_ret,
19967 "()");
19968 g_variant_unref (_ret);
19969_out:
19970 return _ret != NULL;
19971}
19972
19973/**
19974 * flash_call_error_sync:
19975 * @proxy: A #FlashProxy.
19976 * @arg_message: Argument to pass with the method invocation.
19977 * @cancellable: (allow-none): A #GCancellable or %NULL.
19978 * @error: Return location for error or %NULL.
19979 *
19980 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.error">error()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
19981 *
19982 * See flash_call_error() for the asynchronous version of this method.
19983 *
19984 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19985 */
19986gboolean
19987flash_call_error_sync (
19988 Flash *proxy,
19989 const gchar *arg_message,
19990 GCancellable *cancellable,
19991 GError **error)
19992{
19993 GVariant *_ret;
19994 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19995 "error",
19996 g_variant_new ("(s)",
19997 arg_message),
19998 G_DBUS_CALL_FLAGS_NONE,
19999 -1,
20000 cancellable,
20001 error);
20002 if (_ret == NULL)
20003 goto _out;
20004 g_variant_get (_ret,
20005 "()");
20006 g_variant_unref (_ret);
20007_out:
20008 return _ret != NULL;
20009}
20010
20011/**
20012 * flash_call_done:
20013 * @proxy: A #FlashProxy.
20014 * @cancellable: (allow-none): A #GCancellable or %NULL.
20015 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
20016 * @user_data: User data to pass to @callback.
20017 *
20018 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.done">done()</link> D-Bus method on @proxy.
20019 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
20020 * You can then call flash_call_done_finish() to get the result of the operation.
20021 *
20022 * See flash_call_done_sync() for the synchronous, blocking version of this method.
20023 */
20024void
20025flash_call_done (
20026 Flash *proxy,
20027 GCancellable *cancellable,
20028 GAsyncReadyCallback callback,
20029 gpointer user_data)
20030{
20031 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
20032 "done",
20033 g_variant_new ("()"),
20034 G_DBUS_CALL_FLAGS_NONE,
20035 -1,
20036 cancellable,
20037 callback,
20038 user_data);
20039}
20040
20041/**
20042 * flash_call_done_finish:
20043 * @proxy: A #FlashProxy.
20044 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_done().
20045 * @error: Return location for error or %NULL.
20046 *
20047 * Finishes an operation started with flash_call_done().
20048 *
20049 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20050 */
20051gboolean
20052flash_call_done_finish (
20053 Flash *proxy,
20054 GAsyncResult *res,
20055 GError **error)
20056{
20057 GVariant *_ret;
20058 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
20059 if (_ret == NULL)
20060 goto _out;
20061 g_variant_get (_ret,
20062 "()");
20063 g_variant_unref (_ret);
20064_out:
20065 return _ret != NULL;
20066}
20067
20068/**
20069 * flash_call_done_sync:
20070 * @proxy: A #FlashProxy.
20071 * @cancellable: (allow-none): A #GCancellable or %NULL.
20072 * @error: Return location for error or %NULL.
20073 *
20074 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.done">done()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
20075 *
20076 * See flash_call_done() for the asynchronous version of this method.
20077 *
20078 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20079 */
20080gboolean
20081flash_call_done_sync (
20082 Flash *proxy,
20083 GCancellable *cancellable,
20084 GError **error)
20085{
20086 GVariant *_ret;
20087 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
20088 "done",
20089 g_variant_new ("()"),
20090 G_DBUS_CALL_FLAGS_NONE,
20091 -1,
20092 cancellable,
20093 error);
20094 if (_ret == NULL)
20095 goto _out;
20096 g_variant_get (_ret,
20097 "()");
20098 g_variant_unref (_ret);
20099_out:
20100 return _ret != NULL;
20101}
20102
20103/**
Norman Jamesf066e872015-10-07 15:29:51 -050020104 * flash_call_update_via_tftp:
20105 * @proxy: A #FlashProxy.
20106 * @arg_url: Argument to pass with the method invocation.
20107 * @arg_filename: Argument to pass with the method invocation.
20108 * @cancellable: (allow-none): A #GCancellable or %NULL.
20109 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
20110 * @user_data: User data to pass to @callback.
20111 *
20112 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method on @proxy.
20113 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
20114 * You can then call flash_call_update_via_tftp_finish() to get the result of the operation.
20115 *
20116 * See flash_call_update_via_tftp_sync() for the synchronous, blocking version of this method.
20117 */
20118void
20119flash_call_update_via_tftp (
20120 Flash *proxy,
20121 const gchar *arg_url,
20122 const gchar *arg_filename,
20123 GCancellable *cancellable,
20124 GAsyncReadyCallback callback,
20125 gpointer user_data)
20126{
20127 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
20128 "updateViaTftp",
20129 g_variant_new ("(ss)",
20130 arg_url,
20131 arg_filename),
20132 G_DBUS_CALL_FLAGS_NONE,
20133 -1,
20134 cancellable,
20135 callback,
20136 user_data);
20137}
20138
20139/**
20140 * flash_call_update_via_tftp_finish:
20141 * @proxy: A #FlashProxy.
20142 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update_via_tftp().
20143 * @error: Return location for error or %NULL.
20144 *
20145 * Finishes an operation started with flash_call_update_via_tftp().
20146 *
20147 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20148 */
20149gboolean
20150flash_call_update_via_tftp_finish (
20151 Flash *proxy,
20152 GAsyncResult *res,
20153 GError **error)
20154{
20155 GVariant *_ret;
20156 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
20157 if (_ret == NULL)
20158 goto _out;
20159 g_variant_get (_ret,
20160 "()");
20161 g_variant_unref (_ret);
20162_out:
20163 return _ret != NULL;
20164}
20165
20166/**
20167 * flash_call_update_via_tftp_sync:
20168 * @proxy: A #FlashProxy.
20169 * @arg_url: Argument to pass with the method invocation.
20170 * @arg_filename: Argument to pass with the method invocation.
20171 * @cancellable: (allow-none): A #GCancellable or %NULL.
20172 * @error: Return location for error or %NULL.
20173 *
20174 * 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.
20175 *
20176 * See flash_call_update_via_tftp() for the asynchronous version of this method.
20177 *
20178 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20179 */
20180gboolean
20181flash_call_update_via_tftp_sync (
20182 Flash *proxy,
20183 const gchar *arg_url,
20184 const gchar *arg_filename,
20185 GCancellable *cancellable,
20186 GError **error)
20187{
20188 GVariant *_ret;
20189 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
20190 "updateViaTftp",
20191 g_variant_new ("(ss)",
20192 arg_url,
20193 arg_filename),
20194 G_DBUS_CALL_FLAGS_NONE,
20195 -1,
20196 cancellable,
20197 error);
20198 if (_ret == NULL)
20199 goto _out;
20200 g_variant_get (_ret,
20201 "()");
20202 g_variant_unref (_ret);
20203_out:
20204 return _ret != NULL;
20205}
20206
20207/**
Norman James362a80f2015-09-14 14:04:39 -050020208 * flash_call_init:
20209 * @proxy: A #FlashProxy.
20210 * @cancellable: (allow-none): A #GCancellable or %NULL.
20211 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
20212 * @user_data: User data to pass to @callback.
20213 *
20214 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method on @proxy.
20215 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
20216 * You can then call flash_call_init_finish() to get the result of the operation.
20217 *
20218 * See flash_call_init_sync() for the synchronous, blocking version of this method.
20219 */
20220void
20221flash_call_init (
20222 Flash *proxy,
20223 GCancellable *cancellable,
20224 GAsyncReadyCallback callback,
20225 gpointer user_data)
20226{
20227 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
20228 "init",
20229 g_variant_new ("()"),
20230 G_DBUS_CALL_FLAGS_NONE,
20231 -1,
20232 cancellable,
20233 callback,
20234 user_data);
20235}
20236
20237/**
20238 * flash_call_init_finish:
20239 * @proxy: A #FlashProxy.
20240 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_init().
20241 * @error: Return location for error or %NULL.
20242 *
20243 * Finishes an operation started with flash_call_init().
20244 *
20245 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20246 */
20247gboolean
20248flash_call_init_finish (
20249 Flash *proxy,
20250 GAsyncResult *res,
20251 GError **error)
20252{
20253 GVariant *_ret;
20254 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
20255 if (_ret == NULL)
20256 goto _out;
20257 g_variant_get (_ret,
20258 "()");
20259 g_variant_unref (_ret);
20260_out:
20261 return _ret != NULL;
20262}
20263
20264/**
20265 * flash_call_init_sync:
20266 * @proxy: A #FlashProxy.
20267 * @cancellable: (allow-none): A #GCancellable or %NULL.
20268 * @error: Return location for error or %NULL.
20269 *
20270 * 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.
20271 *
20272 * See flash_call_init() for the asynchronous version of this method.
20273 *
20274 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20275 */
20276gboolean
20277flash_call_init_sync (
20278 Flash *proxy,
20279 GCancellable *cancellable,
20280 GError **error)
20281{
20282 GVariant *_ret;
20283 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
20284 "init",
20285 g_variant_new ("()"),
20286 G_DBUS_CALL_FLAGS_NONE,
20287 -1,
20288 cancellable,
20289 error);
20290 if (_ret == NULL)
20291 goto _out;
20292 g_variant_get (_ret,
20293 "()");
20294 g_variant_unref (_ret);
20295_out:
20296 return _ret != NULL;
20297}
20298
20299/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020300 * flash_complete_update:
Norman James362a80f2015-09-14 14:04:39 -050020301 * @object: A #Flash.
20302 * @invocation: (transfer full): A #GDBusMethodInvocation.
20303 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020304 * 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 -050020305 *
20306 * This method will free @invocation, you cannot use it afterwards.
20307 */
20308void
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020309flash_complete_update (
Norman James362a80f2015-09-14 14:04:39 -050020310 Flash *object,
20311 GDBusMethodInvocation *invocation)
20312{
20313 g_dbus_method_invocation_return_value (invocation,
20314 g_variant_new ("()"));
20315}
20316
20317/**
Norman James166acf42015-10-22 07:11:51 -050020318 * flash_complete_error:
20319 * @object: A #Flash.
20320 * @invocation: (transfer full): A #GDBusMethodInvocation.
20321 *
20322 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.error">error()</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.
20323 *
20324 * This method will free @invocation, you cannot use it afterwards.
20325 */
20326void
20327flash_complete_error (
20328 Flash *object,
20329 GDBusMethodInvocation *invocation)
20330{
20331 g_dbus_method_invocation_return_value (invocation,
20332 g_variant_new ("()"));
20333}
20334
20335/**
20336 * flash_complete_done:
20337 * @object: A #Flash.
20338 * @invocation: (transfer full): A #GDBusMethodInvocation.
20339 *
20340 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.done">done()</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.
20341 *
20342 * This method will free @invocation, you cannot use it afterwards.
20343 */
20344void
20345flash_complete_done (
20346 Flash *object,
20347 GDBusMethodInvocation *invocation)
20348{
20349 g_dbus_method_invocation_return_value (invocation,
20350 g_variant_new ("()"));
20351}
20352
20353/**
Norman Jamesf066e872015-10-07 15:29:51 -050020354 * flash_complete_update_via_tftp:
20355 * @object: A #Flash.
20356 * @invocation: (transfer full): A #GDBusMethodInvocation.
20357 *
20358 * 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.
20359 *
20360 * This method will free @invocation, you cannot use it afterwards.
20361 */
20362void
20363flash_complete_update_via_tftp (
20364 Flash *object,
20365 GDBusMethodInvocation *invocation)
20366{
20367 g_dbus_method_invocation_return_value (invocation,
20368 g_variant_new ("()"));
20369}
20370
20371/**
Norman James362a80f2015-09-14 14:04:39 -050020372 * flash_complete_init:
20373 * @object: A #Flash.
20374 * @invocation: (transfer full): A #GDBusMethodInvocation.
20375 *
20376 * 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.
20377 *
20378 * This method will free @invocation, you cannot use it afterwards.
20379 */
20380void
20381flash_complete_init (
20382 Flash *object,
20383 GDBusMethodInvocation *invocation)
20384{
20385 g_dbus_method_invocation_return_value (invocation,
20386 g_variant_new ("()"));
20387}
20388
20389/* ------------------------------------------------------------------------ */
20390
20391/**
20392 * FlashProxy:
20393 *
20394 * The #FlashProxy structure contains only private data and should only be accessed using the provided API.
20395 */
20396
20397/**
20398 * FlashProxyClass:
20399 * @parent_class: The parent class.
20400 *
20401 * Class structure for #FlashProxy.
20402 */
20403
20404struct _FlashProxyPrivate
20405{
20406 GData *qdata;
20407};
20408
20409static void flash_proxy_iface_init (FlashIface *iface);
20410
20411#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20412G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
20413 G_ADD_PRIVATE (FlashProxy)
20414 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
20415
20416#else
20417G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
20418 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
20419
20420#endif
20421static void
20422flash_proxy_finalize (GObject *object)
20423{
20424 FlashProxy *proxy = FLASH_PROXY (object);
20425 g_datalist_clear (&proxy->priv->qdata);
20426 G_OBJECT_CLASS (flash_proxy_parent_class)->finalize (object);
20427}
20428
20429static void
20430flash_proxy_get_property (GObject *object,
20431 guint prop_id,
20432 GValue *value,
20433 GParamSpec *pspec G_GNUC_UNUSED)
20434{
Norman James18998182015-10-11 21:54:53 -050020435 const _ExtendedGDBusPropertyInfo *info;
20436 GVariant *variant;
Norman James166acf42015-10-22 07:11:51 -050020437 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James18998182015-10-11 21:54:53 -050020438 info = _flash_property_info_pointers[prop_id - 1];
20439 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
20440 if (info->use_gvariant)
20441 {
20442 g_value_set_variant (value, variant);
20443 }
20444 else
20445 {
20446 if (variant != NULL)
20447 g_dbus_gvariant_to_gvalue (variant, value);
20448 }
20449 if (variant != NULL)
20450 g_variant_unref (variant);
20451}
20452
20453static void
20454flash_proxy_set_property_cb (GDBusProxy *proxy,
20455 GAsyncResult *res,
20456 gpointer user_data)
20457{
20458 const _ExtendedGDBusPropertyInfo *info = user_data;
20459 GError *error;
20460 GVariant *_ret;
20461 error = NULL;
20462 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
20463 if (!_ret)
20464 {
20465 g_warning ("Error setting property '%s' on interface org.openbmc.Flash: %s (%s, %d)",
20466 info->parent_struct.name,
20467 error->message, g_quark_to_string (error->domain), error->code);
20468 g_error_free (error);
20469 }
20470 else
20471 {
20472 g_variant_unref (_ret);
20473 }
Norman James362a80f2015-09-14 14:04:39 -050020474}
20475
20476static void
20477flash_proxy_set_property (GObject *object,
20478 guint prop_id,
20479 const GValue *value,
20480 GParamSpec *pspec G_GNUC_UNUSED)
20481{
Norman James18998182015-10-11 21:54:53 -050020482 const _ExtendedGDBusPropertyInfo *info;
20483 GVariant *variant;
Norman James166acf42015-10-22 07:11:51 -050020484 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James18998182015-10-11 21:54:53 -050020485 info = _flash_property_info_pointers[prop_id - 1];
20486 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
20487 g_dbus_proxy_call (G_DBUS_PROXY (object),
20488 "org.freedesktop.DBus.Properties.Set",
20489 g_variant_new ("(ssv)", "org.openbmc.Flash", info->parent_struct.name, variant),
20490 G_DBUS_CALL_FLAGS_NONE,
20491 -1,
20492 NULL, (GAsyncReadyCallback) flash_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
20493 g_variant_unref (variant);
Norman James362a80f2015-09-14 14:04:39 -050020494}
20495
20496static void
20497flash_proxy_g_signal (GDBusProxy *proxy,
20498 const gchar *sender_name G_GNUC_UNUSED,
20499 const gchar *signal_name,
20500 GVariant *parameters)
20501{
20502 _ExtendedGDBusSignalInfo *info;
20503 GVariantIter iter;
20504 GVariant *child;
20505 GValue *paramv;
20506 guint num_params;
20507 guint n;
20508 guint signal_id;
20509 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, signal_name);
20510 if (info == NULL)
20511 return;
20512 num_params = g_variant_n_children (parameters);
20513 paramv = g_new0 (GValue, num_params + 1);
20514 g_value_init (&paramv[0], TYPE_FLASH);
20515 g_value_set_object (&paramv[0], proxy);
20516 g_variant_iter_init (&iter, parameters);
20517 n = 1;
20518 while ((child = g_variant_iter_next_value (&iter)) != NULL)
20519 {
20520 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
20521 if (arg_info->use_gvariant)
20522 {
20523 g_value_init (&paramv[n], G_TYPE_VARIANT);
20524 g_value_set_variant (&paramv[n], child);
20525 n++;
20526 }
20527 else
20528 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
20529 g_variant_unref (child);
20530 }
20531 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
20532 g_signal_emitv (paramv, signal_id, 0, NULL);
20533 for (n = 0; n < num_params + 1; n++)
20534 g_value_unset (&paramv[n]);
20535 g_free (paramv);
20536}
20537
20538static void
20539flash_proxy_g_properties_changed (GDBusProxy *_proxy,
20540 GVariant *changed_properties,
20541 const gchar *const *invalidated_properties)
20542{
20543 FlashProxy *proxy = FLASH_PROXY (_proxy);
20544 guint n;
20545 const gchar *key;
20546 GVariantIter *iter;
20547 _ExtendedGDBusPropertyInfo *info;
20548 g_variant_get (changed_properties, "a{sv}", &iter);
20549 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
20550 {
20551 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, key);
20552 g_datalist_remove_data (&proxy->priv->qdata, key);
20553 if (info != NULL)
20554 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
20555 }
20556 g_variant_iter_free (iter);
20557 for (n = 0; invalidated_properties[n] != NULL; n++)
20558 {
20559 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, invalidated_properties[n]);
20560 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
20561 if (info != NULL)
20562 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
20563 }
20564}
20565
Norman James18998182015-10-11 21:54:53 -050020566static const gchar *
20567flash_proxy_get_filename (Flash *object)
20568{
20569 FlashProxy *proxy = FLASH_PROXY (object);
20570 GVariant *variant;
20571 const gchar *value = NULL;
20572 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "filename");
20573 if (variant != NULL)
20574 {
20575 value = g_variant_get_string (variant, NULL);
20576 g_variant_unref (variant);
20577 }
20578 return value;
20579}
20580
20581static const gchar *
20582flash_proxy_get_flasher_path (Flash *object)
20583{
20584 FlashProxy *proxy = FLASH_PROXY (object);
20585 GVariant *variant;
20586 const gchar *value = NULL;
20587 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_path");
20588 if (variant != NULL)
20589 {
20590 value = g_variant_get_string (variant, NULL);
20591 g_variant_unref (variant);
20592 }
20593 return value;
20594}
20595
20596static const gchar *
20597flash_proxy_get_flasher_name (Flash *object)
20598{
20599 FlashProxy *proxy = FLASH_PROXY (object);
20600 GVariant *variant;
20601 const gchar *value = NULL;
20602 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_name");
20603 if (variant != NULL)
20604 {
20605 value = g_variant_get_string (variant, NULL);
20606 g_variant_unref (variant);
20607 }
20608 return value;
20609}
20610
20611static const gchar *
20612flash_proxy_get_flasher_instance (Flash *object)
20613{
20614 FlashProxy *proxy = FLASH_PROXY (object);
20615 GVariant *variant;
20616 const gchar *value = NULL;
20617 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_instance");
20618 if (variant != NULL)
20619 {
20620 value = g_variant_get_string (variant, NULL);
20621 g_variant_unref (variant);
20622 }
20623 return value;
20624}
20625
Norman James166acf42015-10-22 07:11:51 -050020626static const gchar *
20627flash_proxy_get_status (Flash *object)
20628{
20629 FlashProxy *proxy = FLASH_PROXY (object);
20630 GVariant *variant;
20631 const gchar *value = NULL;
20632 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "status");
20633 if (variant != NULL)
20634 {
20635 value = g_variant_get_string (variant, NULL);
20636 g_variant_unref (variant);
20637 }
20638 return value;
20639}
20640
Norman James362a80f2015-09-14 14:04:39 -050020641static void
20642flash_proxy_init (FlashProxy *proxy)
20643{
20644#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20645 proxy->priv = flash_proxy_get_instance_private (proxy);
20646#else
20647 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_PROXY, FlashProxyPrivate);
20648#endif
20649
20650 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_interface_info ());
20651}
20652
20653static void
20654flash_proxy_class_init (FlashProxyClass *klass)
20655{
20656 GObjectClass *gobject_class;
20657 GDBusProxyClass *proxy_class;
20658
20659 gobject_class = G_OBJECT_CLASS (klass);
20660 gobject_class->finalize = flash_proxy_finalize;
20661 gobject_class->get_property = flash_proxy_get_property;
20662 gobject_class->set_property = flash_proxy_set_property;
20663
20664 proxy_class = G_DBUS_PROXY_CLASS (klass);
20665 proxy_class->g_signal = flash_proxy_g_signal;
20666 proxy_class->g_properties_changed = flash_proxy_g_properties_changed;
20667
Norman James18998182015-10-11 21:54:53 -050020668 flash_override_properties (gobject_class, 1);
20669
Norman James362a80f2015-09-14 14:04:39 -050020670#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
20671 g_type_class_add_private (klass, sizeof (FlashProxyPrivate));
20672#endif
20673}
20674
20675static void
20676flash_proxy_iface_init (FlashIface *iface)
20677{
Norman James18998182015-10-11 21:54:53 -050020678 iface->get_filename = flash_proxy_get_filename;
20679 iface->get_flasher_path = flash_proxy_get_flasher_path;
20680 iface->get_flasher_name = flash_proxy_get_flasher_name;
20681 iface->get_flasher_instance = flash_proxy_get_flasher_instance;
Norman James166acf42015-10-22 07:11:51 -050020682 iface->get_status = flash_proxy_get_status;
Norman James362a80f2015-09-14 14:04:39 -050020683}
20684
20685/**
20686 * flash_proxy_new:
20687 * @connection: A #GDBusConnection.
20688 * @flags: Flags from the #GDBusProxyFlags enumeration.
20689 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
20690 * @object_path: An object path.
20691 * @cancellable: (allow-none): A #GCancellable or %NULL.
20692 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
20693 * @user_data: User data to pass to @callback.
20694 *
20695 * 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.
20696 *
20697 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
20698 * You can then call flash_proxy_new_finish() to get the result of the operation.
20699 *
20700 * See flash_proxy_new_sync() for the synchronous, blocking version of this constructor.
20701 */
20702void
20703flash_proxy_new (
20704 GDBusConnection *connection,
20705 GDBusProxyFlags flags,
20706 const gchar *name,
20707 const gchar *object_path,
20708 GCancellable *cancellable,
20709 GAsyncReadyCallback callback,
20710 gpointer user_data)
20711{
20712 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);
20713}
20714
20715/**
20716 * flash_proxy_new_finish:
20717 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new().
20718 * @error: Return location for error or %NULL
20719 *
20720 * Finishes an operation started with flash_proxy_new().
20721 *
20722 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
20723 */
20724Flash *
20725flash_proxy_new_finish (
20726 GAsyncResult *res,
20727 GError **error)
20728{
20729 GObject *ret;
20730 GObject *source_object;
20731 source_object = g_async_result_get_source_object (res);
20732 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
20733 g_object_unref (source_object);
20734 if (ret != NULL)
20735 return FLASH (ret);
20736 else
20737 return NULL;
20738}
20739
20740/**
20741 * flash_proxy_new_sync:
20742 * @connection: A #GDBusConnection.
20743 * @flags: Flags from the #GDBusProxyFlags enumeration.
20744 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
20745 * @object_path: An object path.
20746 * @cancellable: (allow-none): A #GCancellable or %NULL.
20747 * @error: Return location for error or %NULL
20748 *
20749 * 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.
20750 *
20751 * The calling thread is blocked until a reply is received.
20752 *
20753 * See flash_proxy_new() for the asynchronous version of this constructor.
20754 *
20755 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
20756 */
20757Flash *
20758flash_proxy_new_sync (
20759 GDBusConnection *connection,
20760 GDBusProxyFlags flags,
20761 const gchar *name,
20762 const gchar *object_path,
20763 GCancellable *cancellable,
20764 GError **error)
20765{
20766 GInitable *ret;
20767 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);
20768 if (ret != NULL)
20769 return FLASH (ret);
20770 else
20771 return NULL;
20772}
20773
20774
20775/**
20776 * flash_proxy_new_for_bus:
20777 * @bus_type: A #GBusType.
20778 * @flags: Flags from the #GDBusProxyFlags enumeration.
20779 * @name: A bus name (well-known or unique).
20780 * @object_path: An object path.
20781 * @cancellable: (allow-none): A #GCancellable or %NULL.
20782 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
20783 * @user_data: User data to pass to @callback.
20784 *
20785 * Like flash_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
20786 *
20787 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
20788 * You can then call flash_proxy_new_for_bus_finish() to get the result of the operation.
20789 *
20790 * See flash_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
20791 */
20792void
20793flash_proxy_new_for_bus (
20794 GBusType bus_type,
20795 GDBusProxyFlags flags,
20796 const gchar *name,
20797 const gchar *object_path,
20798 GCancellable *cancellable,
20799 GAsyncReadyCallback callback,
20800 gpointer user_data)
20801{
20802 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);
20803}
20804
20805/**
20806 * flash_proxy_new_for_bus_finish:
20807 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new_for_bus().
20808 * @error: Return location for error or %NULL
20809 *
20810 * Finishes an operation started with flash_proxy_new_for_bus().
20811 *
20812 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
20813 */
20814Flash *
20815flash_proxy_new_for_bus_finish (
20816 GAsyncResult *res,
20817 GError **error)
20818{
20819 GObject *ret;
20820 GObject *source_object;
20821 source_object = g_async_result_get_source_object (res);
20822 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
20823 g_object_unref (source_object);
20824 if (ret != NULL)
20825 return FLASH (ret);
20826 else
20827 return NULL;
20828}
20829
20830/**
20831 * flash_proxy_new_for_bus_sync:
20832 * @bus_type: A #GBusType.
20833 * @flags: Flags from the #GDBusProxyFlags enumeration.
20834 * @name: A bus name (well-known or unique).
20835 * @object_path: An object path.
20836 * @cancellable: (allow-none): A #GCancellable or %NULL.
20837 * @error: Return location for error or %NULL
20838 *
20839 * Like flash_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
20840 *
20841 * The calling thread is blocked until a reply is received.
20842 *
20843 * See flash_proxy_new_for_bus() for the asynchronous version of this constructor.
20844 *
20845 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
20846 */
20847Flash *
20848flash_proxy_new_for_bus_sync (
20849 GBusType bus_type,
20850 GDBusProxyFlags flags,
20851 const gchar *name,
20852 const gchar *object_path,
20853 GCancellable *cancellable,
20854 GError **error)
20855{
20856 GInitable *ret;
20857 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);
20858 if (ret != NULL)
20859 return FLASH (ret);
20860 else
20861 return NULL;
20862}
20863
20864
20865/* ------------------------------------------------------------------------ */
20866
20867/**
20868 * FlashSkeleton:
20869 *
20870 * The #FlashSkeleton structure contains only private data and should only be accessed using the provided API.
20871 */
20872
20873/**
20874 * FlashSkeletonClass:
20875 * @parent_class: The parent class.
20876 *
20877 * Class structure for #FlashSkeleton.
20878 */
20879
20880struct _FlashSkeletonPrivate
20881{
20882 GValue *properties;
20883 GList *changed_properties;
20884 GSource *changed_properties_idle_source;
20885 GMainContext *context;
20886 GMutex lock;
20887};
20888
20889static void
20890_flash_skeleton_handle_method_call (
20891 GDBusConnection *connection G_GNUC_UNUSED,
20892 const gchar *sender G_GNUC_UNUSED,
20893 const gchar *object_path G_GNUC_UNUSED,
20894 const gchar *interface_name,
20895 const gchar *method_name,
20896 GVariant *parameters,
20897 GDBusMethodInvocation *invocation,
20898 gpointer user_data)
20899{
20900 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
20901 _ExtendedGDBusMethodInfo *info;
20902 GVariantIter iter;
20903 GVariant *child;
20904 GValue *paramv;
20905 guint num_params;
20906 guint num_extra;
20907 guint n;
20908 guint signal_id;
20909 GValue return_value = G_VALUE_INIT;
20910 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
20911 g_assert (info != NULL);
20912 num_params = g_variant_n_children (parameters);
20913 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
20914 n = 0;
20915 g_value_init (&paramv[n], TYPE_FLASH);
20916 g_value_set_object (&paramv[n++], skeleton);
20917 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
20918 g_value_set_object (&paramv[n++], invocation);
20919 if (info->pass_fdlist)
20920 {
20921#ifdef G_OS_UNIX
20922 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
20923 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
20924#else
20925 g_assert_not_reached ();
20926#endif
20927 }
20928 g_variant_iter_init (&iter, parameters);
20929 while ((child = g_variant_iter_next_value (&iter)) != NULL)
20930 {
20931 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
20932 if (arg_info->use_gvariant)
20933 {
20934 g_value_init (&paramv[n], G_TYPE_VARIANT);
20935 g_value_set_variant (&paramv[n], child);
20936 n++;
20937 }
20938 else
20939 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
20940 g_variant_unref (child);
20941 }
20942 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
20943 g_value_init (&return_value, G_TYPE_BOOLEAN);
20944 g_signal_emitv (paramv, signal_id, 0, &return_value);
20945 if (!g_value_get_boolean (&return_value))
20946 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);
20947 g_value_unset (&return_value);
20948 for (n = 0; n < num_params + num_extra; n++)
20949 g_value_unset (&paramv[n]);
20950 g_free (paramv);
20951}
20952
20953static GVariant *
20954_flash_skeleton_handle_get_property (
20955 GDBusConnection *connection G_GNUC_UNUSED,
20956 const gchar *sender G_GNUC_UNUSED,
20957 const gchar *object_path G_GNUC_UNUSED,
20958 const gchar *interface_name G_GNUC_UNUSED,
20959 const gchar *property_name,
20960 GError **error,
20961 gpointer user_data)
20962{
20963 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
20964 GValue value = G_VALUE_INIT;
20965 GParamSpec *pspec;
20966 _ExtendedGDBusPropertyInfo *info;
20967 GVariant *ret;
20968 ret = NULL;
20969 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
20970 g_assert (info != NULL);
20971 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
20972 if (pspec == NULL)
20973 {
20974 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
20975 }
20976 else
20977 {
20978 g_value_init (&value, pspec->value_type);
20979 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
20980 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
20981 g_value_unset (&value);
20982 }
20983 return ret;
20984}
20985
20986static gboolean
20987_flash_skeleton_handle_set_property (
20988 GDBusConnection *connection G_GNUC_UNUSED,
20989 const gchar *sender G_GNUC_UNUSED,
20990 const gchar *object_path G_GNUC_UNUSED,
20991 const gchar *interface_name G_GNUC_UNUSED,
20992 const gchar *property_name,
20993 GVariant *variant,
20994 GError **error,
20995 gpointer user_data)
20996{
20997 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
20998 GValue value = G_VALUE_INIT;
20999 GParamSpec *pspec;
21000 _ExtendedGDBusPropertyInfo *info;
21001 gboolean ret;
21002 ret = FALSE;
21003 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
21004 g_assert (info != NULL);
21005 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
21006 if (pspec == NULL)
21007 {
21008 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
21009 }
21010 else
21011 {
21012 if (info->use_gvariant)
21013 g_value_set_variant (&value, variant);
21014 else
21015 g_dbus_gvariant_to_gvalue (variant, &value);
21016 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
21017 g_value_unset (&value);
21018 ret = TRUE;
21019 }
21020 return ret;
21021}
21022
21023static const GDBusInterfaceVTable _flash_skeleton_vtable =
21024{
21025 _flash_skeleton_handle_method_call,
21026 _flash_skeleton_handle_get_property,
21027 _flash_skeleton_handle_set_property,
21028 {NULL}
21029};
21030
21031static GDBusInterfaceInfo *
21032flash_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
21033{
21034 return flash_interface_info ();
21035}
21036
21037static GDBusInterfaceVTable *
21038flash_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
21039{
21040 return (GDBusInterfaceVTable *) &_flash_skeleton_vtable;
21041}
21042
21043static GVariant *
21044flash_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
21045{
21046 FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton);
21047
21048 GVariantBuilder builder;
21049 guint n;
21050 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
21051 if (_flash_interface_info.parent_struct.properties == NULL)
21052 goto out;
21053 for (n = 0; _flash_interface_info.parent_struct.properties[n] != NULL; n++)
21054 {
21055 GDBusPropertyInfo *info = _flash_interface_info.parent_struct.properties[n];
21056 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
21057 {
21058 GVariant *value;
21059 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);
21060 if (value != NULL)
21061 {
21062 g_variant_take_ref (value);
21063 g_variant_builder_add (&builder, "{sv}", info->name, value);
21064 g_variant_unref (value);
21065 }
21066 }
21067 }
21068out:
21069 return g_variant_builder_end (&builder);
21070}
21071
Norman James18998182015-10-11 21:54:53 -050021072static gboolean _flash_emit_changed (gpointer user_data);
21073
Norman James362a80f2015-09-14 14:04:39 -050021074static void
21075flash_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
21076{
Norman James18998182015-10-11 21:54:53 -050021077 FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton);
21078 gboolean emit_changed = FALSE;
21079
21080 g_mutex_lock (&skeleton->priv->lock);
21081 if (skeleton->priv->changed_properties_idle_source != NULL)
21082 {
21083 g_source_destroy (skeleton->priv->changed_properties_idle_source);
21084 skeleton->priv->changed_properties_idle_source = NULL;
21085 emit_changed = TRUE;
21086 }
21087 g_mutex_unlock (&skeleton->priv->lock);
21088
21089 if (emit_changed)
21090 _flash_emit_changed (skeleton);
Norman James362a80f2015-09-14 14:04:39 -050021091}
21092
21093static void
21094_flash_on_signal_updated (
21095 Flash *object)
21096{
21097 FlashSkeleton *skeleton = FLASH_SKELETON (object);
21098
21099 GList *connections, *l;
21100 GVariant *signal_variant;
21101 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
21102
21103 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
21104 for (l = connections; l != NULL; l = l->next)
21105 {
21106 GDBusConnection *connection = l->data;
21107 g_dbus_connection_emit_signal (connection,
21108 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Updated",
21109 signal_variant, NULL);
21110 }
21111 g_variant_unref (signal_variant);
21112 g_list_free_full (connections, g_object_unref);
21113}
21114
Norman Jamesf066e872015-10-07 15:29:51 -050021115static void
21116_flash_on_signal_download (
21117 Flash *object,
21118 const gchar *arg_url,
21119 const gchar *arg_filename)
21120{
21121 FlashSkeleton *skeleton = FLASH_SKELETON (object);
21122
21123 GList *connections, *l;
21124 GVariant *signal_variant;
21125 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
21126
21127 signal_variant = g_variant_ref_sink (g_variant_new ("(ss)",
21128 arg_url,
21129 arg_filename));
21130 for (l = connections; l != NULL; l = l->next)
21131 {
21132 GDBusConnection *connection = l->data;
21133 g_dbus_connection_emit_signal (connection,
21134 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Download",
21135 signal_variant, NULL);
21136 }
21137 g_variant_unref (signal_variant);
21138 g_list_free_full (connections, g_object_unref);
21139}
21140
Norman James362a80f2015-09-14 14:04:39 -050021141static void flash_skeleton_iface_init (FlashIface *iface);
21142#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21143G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
21144 G_ADD_PRIVATE (FlashSkeleton)
21145 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
21146
21147#else
21148G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
21149 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
21150
21151#endif
21152static void
21153flash_skeleton_finalize (GObject *object)
21154{
21155 FlashSkeleton *skeleton = FLASH_SKELETON (object);
Norman James18998182015-10-11 21:54:53 -050021156 guint n;
Norman James166acf42015-10-22 07:11:51 -050021157 for (n = 0; n < 5; n++)
Norman James18998182015-10-11 21:54:53 -050021158 g_value_unset (&skeleton->priv->properties[n]);
21159 g_free (skeleton->priv->properties);
Norman James362a80f2015-09-14 14:04:39 -050021160 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
21161 if (skeleton->priv->changed_properties_idle_source != NULL)
21162 g_source_destroy (skeleton->priv->changed_properties_idle_source);
21163 g_main_context_unref (skeleton->priv->context);
21164 g_mutex_clear (&skeleton->priv->lock);
21165 G_OBJECT_CLASS (flash_skeleton_parent_class)->finalize (object);
21166}
21167
21168static void
Norman James18998182015-10-11 21:54:53 -050021169flash_skeleton_get_property (GObject *object,
21170 guint prop_id,
21171 GValue *value,
21172 GParamSpec *pspec G_GNUC_UNUSED)
21173{
21174 FlashSkeleton *skeleton = FLASH_SKELETON (object);
Norman James166acf42015-10-22 07:11:51 -050021175 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James18998182015-10-11 21:54:53 -050021176 g_mutex_lock (&skeleton->priv->lock);
21177 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
21178 g_mutex_unlock (&skeleton->priv->lock);
21179}
21180
21181static gboolean
21182_flash_emit_changed (gpointer user_data)
21183{
21184 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
21185 GList *l;
21186 GVariantBuilder builder;
21187 GVariantBuilder invalidated_builder;
21188 guint num_changes;
21189
21190 g_mutex_lock (&skeleton->priv->lock);
21191 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
21192 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
21193 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
21194 {
21195 ChangedProperty *cp = l->data;
21196 GVariant *variant;
21197 const GValue *cur_value;
21198
21199 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
21200 if (!_g_value_equal (cur_value, &cp->orig_value))
21201 {
21202 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
21203 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
21204 g_variant_unref (variant);
21205 num_changes++;
21206 }
21207 }
21208 if (num_changes > 0)
21209 {
21210 GList *connections, *ll;
21211 GVariant *signal_variant;
21212 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Flash",
21213 &builder, &invalidated_builder));
21214 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
21215 for (ll = connections; ll != NULL; ll = ll->next)
21216 {
21217 GDBusConnection *connection = ll->data;
21218
21219 g_dbus_connection_emit_signal (connection,
21220 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
21221 "org.freedesktop.DBus.Properties",
21222 "PropertiesChanged",
21223 signal_variant,
21224 NULL);
21225 }
21226 g_variant_unref (signal_variant);
21227 g_list_free_full (connections, g_object_unref);
21228 }
21229 else
21230 {
21231 g_variant_builder_clear (&builder);
21232 g_variant_builder_clear (&invalidated_builder);
21233 }
21234 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
21235 skeleton->priv->changed_properties = NULL;
21236 skeleton->priv->changed_properties_idle_source = NULL;
21237 g_mutex_unlock (&skeleton->priv->lock);
21238 return FALSE;
21239}
21240
21241static void
21242_flash_schedule_emit_changed (FlashSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
21243{
21244 ChangedProperty *cp;
21245 GList *l;
21246 cp = NULL;
21247 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
21248 {
21249 ChangedProperty *i_cp = l->data;
21250 if (i_cp->info == info)
21251 {
21252 cp = i_cp;
21253 break;
21254 }
21255 }
21256 if (cp == NULL)
21257 {
21258 cp = g_new0 (ChangedProperty, 1);
21259 cp->prop_id = prop_id;
21260 cp->info = info;
21261 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
21262 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
21263 g_value_copy (orig_value, &cp->orig_value);
21264 }
21265}
21266
21267static void
21268flash_skeleton_notify (GObject *object,
21269 GParamSpec *pspec G_GNUC_UNUSED)
21270{
21271 FlashSkeleton *skeleton = FLASH_SKELETON (object);
21272 g_mutex_lock (&skeleton->priv->lock);
21273 if (skeleton->priv->changed_properties != NULL &&
21274 skeleton->priv->changed_properties_idle_source == NULL)
21275 {
21276 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
21277 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
21278 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _flash_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
21279 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
21280 g_source_unref (skeleton->priv->changed_properties_idle_source);
21281 }
21282 g_mutex_unlock (&skeleton->priv->lock);
21283}
21284
21285static void
21286flash_skeleton_set_property (GObject *object,
21287 guint prop_id,
21288 const GValue *value,
21289 GParamSpec *pspec)
21290{
21291 FlashSkeleton *skeleton = FLASH_SKELETON (object);
Norman James166acf42015-10-22 07:11:51 -050021292 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James18998182015-10-11 21:54:53 -050021293 g_mutex_lock (&skeleton->priv->lock);
21294 g_object_freeze_notify (object);
21295 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
21296 {
21297 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
21298 _flash_schedule_emit_changed (skeleton, _flash_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
21299 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
21300 g_object_notify_by_pspec (object, pspec);
21301 }
21302 g_mutex_unlock (&skeleton->priv->lock);
21303 g_object_thaw_notify (object);
21304}
21305
21306static void
Norman James362a80f2015-09-14 14:04:39 -050021307flash_skeleton_init (FlashSkeleton *skeleton)
21308{
21309#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21310 skeleton->priv = flash_skeleton_get_instance_private (skeleton);
21311#else
21312 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_SKELETON, FlashSkeletonPrivate);
21313#endif
21314
21315 g_mutex_init (&skeleton->priv->lock);
21316 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James166acf42015-10-22 07:11:51 -050021317 skeleton->priv->properties = g_new0 (GValue, 5);
Norman James18998182015-10-11 21:54:53 -050021318 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
21319 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
21320 g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING);
21321 g_value_init (&skeleton->priv->properties[3], G_TYPE_STRING);
Norman James166acf42015-10-22 07:11:51 -050021322 g_value_init (&skeleton->priv->properties[4], G_TYPE_STRING);
Norman James18998182015-10-11 21:54:53 -050021323}
21324
21325static const gchar *
21326flash_skeleton_get_filename (Flash *object)
21327{
21328 FlashSkeleton *skeleton = FLASH_SKELETON (object);
21329 const gchar *value;
21330 g_mutex_lock (&skeleton->priv->lock);
21331 value = g_value_get_string (&(skeleton->priv->properties[0]));
21332 g_mutex_unlock (&skeleton->priv->lock);
21333 return value;
21334}
21335
21336static const gchar *
21337flash_skeleton_get_flasher_path (Flash *object)
21338{
21339 FlashSkeleton *skeleton = FLASH_SKELETON (object);
21340 const gchar *value;
21341 g_mutex_lock (&skeleton->priv->lock);
21342 value = g_value_get_string (&(skeleton->priv->properties[1]));
21343 g_mutex_unlock (&skeleton->priv->lock);
21344 return value;
21345}
21346
21347static const gchar *
21348flash_skeleton_get_flasher_name (Flash *object)
21349{
21350 FlashSkeleton *skeleton = FLASH_SKELETON (object);
21351 const gchar *value;
21352 g_mutex_lock (&skeleton->priv->lock);
21353 value = g_value_get_string (&(skeleton->priv->properties[2]));
21354 g_mutex_unlock (&skeleton->priv->lock);
21355 return value;
21356}
21357
21358static const gchar *
21359flash_skeleton_get_flasher_instance (Flash *object)
21360{
21361 FlashSkeleton *skeleton = FLASH_SKELETON (object);
21362 const gchar *value;
21363 g_mutex_lock (&skeleton->priv->lock);
21364 value = g_value_get_string (&(skeleton->priv->properties[3]));
21365 g_mutex_unlock (&skeleton->priv->lock);
21366 return value;
Norman James362a80f2015-09-14 14:04:39 -050021367}
21368
Norman James166acf42015-10-22 07:11:51 -050021369static const gchar *
21370flash_skeleton_get_status (Flash *object)
21371{
21372 FlashSkeleton *skeleton = FLASH_SKELETON (object);
21373 const gchar *value;
21374 g_mutex_lock (&skeleton->priv->lock);
21375 value = g_value_get_string (&(skeleton->priv->properties[4]));
21376 g_mutex_unlock (&skeleton->priv->lock);
21377 return value;
21378}
21379
Norman James362a80f2015-09-14 14:04:39 -050021380static void
21381flash_skeleton_class_init (FlashSkeletonClass *klass)
21382{
21383 GObjectClass *gobject_class;
21384 GDBusInterfaceSkeletonClass *skeleton_class;
21385
21386 gobject_class = G_OBJECT_CLASS (klass);
21387 gobject_class->finalize = flash_skeleton_finalize;
Norman James18998182015-10-11 21:54:53 -050021388 gobject_class->get_property = flash_skeleton_get_property;
21389 gobject_class->set_property = flash_skeleton_set_property;
21390 gobject_class->notify = flash_skeleton_notify;
21391
21392
21393 flash_override_properties (gobject_class, 1);
Norman James362a80f2015-09-14 14:04:39 -050021394
21395 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
21396 skeleton_class->get_info = flash_skeleton_dbus_interface_get_info;
21397 skeleton_class->get_properties = flash_skeleton_dbus_interface_get_properties;
21398 skeleton_class->flush = flash_skeleton_dbus_interface_flush;
21399 skeleton_class->get_vtable = flash_skeleton_dbus_interface_get_vtable;
21400
21401#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
21402 g_type_class_add_private (klass, sizeof (FlashSkeletonPrivate));
21403#endif
21404}
21405
21406static void
21407flash_skeleton_iface_init (FlashIface *iface)
21408{
21409 iface->updated = _flash_on_signal_updated;
Norman Jamesf066e872015-10-07 15:29:51 -050021410 iface->download = _flash_on_signal_download;
Norman James18998182015-10-11 21:54:53 -050021411 iface->get_filename = flash_skeleton_get_filename;
21412 iface->get_flasher_path = flash_skeleton_get_flasher_path;
21413 iface->get_flasher_name = flash_skeleton_get_flasher_name;
21414 iface->get_flasher_instance = flash_skeleton_get_flasher_instance;
Norman James166acf42015-10-22 07:11:51 -050021415 iface->get_status = flash_skeleton_get_status;
Norman James362a80f2015-09-14 14:04:39 -050021416}
21417
21418/**
21419 * flash_skeleton_new:
21420 *
21421 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
21422 *
21423 * Returns: (transfer full) (type FlashSkeleton): The skeleton object.
21424 */
21425Flash *
21426flash_skeleton_new (void)
21427{
21428 return FLASH (g_object_new (TYPE_FLASH_SKELETON, NULL));
21429}
21430
21431/* ------------------------------------------------------------------------
Norman James18998182015-10-11 21:54:53 -050021432 * Code for interface org.openbmc.FlashControl
21433 * ------------------------------------------------------------------------
21434 */
21435
21436/**
21437 * SECTION:FlashControl
21438 * @title: FlashControl
21439 * @short_description: Generated C code for the org.openbmc.FlashControl D-Bus interface
21440 *
21441 * 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.
21442 */
21443
21444/* ---- Introspection data for org.openbmc.FlashControl ---- */
21445
21446static const _ExtendedGDBusArgInfo _flash_control_method_info_flash_IN_ARG_type =
21447{
21448 {
21449 -1,
21450 (gchar *) "type",
21451 (gchar *) "s",
21452 NULL
21453 },
21454 FALSE
21455};
21456
21457static const _ExtendedGDBusArgInfo _flash_control_method_info_flash_IN_ARG_filename =
21458{
21459 {
21460 -1,
21461 (gchar *) "filename",
21462 (gchar *) "s",
21463 NULL
21464 },
21465 FALSE
21466};
21467
21468static const _ExtendedGDBusArgInfo * const _flash_control_method_info_flash_IN_ARG_pointers[] =
21469{
21470 &_flash_control_method_info_flash_IN_ARG_type,
21471 &_flash_control_method_info_flash_IN_ARG_filename,
21472 NULL
21473};
21474
21475static const _ExtendedGDBusMethodInfo _flash_control_method_info_flash =
21476{
21477 {
21478 -1,
21479 (gchar *) "flash",
21480 (GDBusArgInfo **) &_flash_control_method_info_flash_IN_ARG_pointers,
21481 NULL,
21482 NULL
21483 },
21484 "handle-flash",
21485 FALSE
21486};
21487
21488static const _ExtendedGDBusMethodInfo * const _flash_control_method_info_pointers[] =
21489{
21490 &_flash_control_method_info_flash,
21491 NULL
21492};
21493
21494static const _ExtendedGDBusArgInfo _flash_control_signal_info_done_ARG_filename =
21495{
21496 {
21497 -1,
21498 (gchar *) "filename",
21499 (gchar *) "s",
21500 NULL
21501 },
21502 FALSE
21503};
21504
21505static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_done_ARG_pointers[] =
21506{
21507 &_flash_control_signal_info_done_ARG_filename,
21508 NULL
21509};
21510
21511static const _ExtendedGDBusSignalInfo _flash_control_signal_info_done =
21512{
21513 {
21514 -1,
21515 (gchar *) "Done",
21516 (GDBusArgInfo **) &_flash_control_signal_info_done_ARG_pointers,
21517 NULL
21518 },
21519 "done"
21520};
21521
21522static const _ExtendedGDBusArgInfo _flash_control_signal_info_error_ARG_filename =
21523{
21524 {
21525 -1,
21526 (gchar *) "filename",
21527 (gchar *) "s",
21528 NULL
21529 },
21530 FALSE
21531};
21532
21533static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_error_ARG_pointers[] =
21534{
21535 &_flash_control_signal_info_error_ARG_filename,
21536 NULL
21537};
21538
21539static const _ExtendedGDBusSignalInfo _flash_control_signal_info_error =
21540{
21541 {
21542 -1,
21543 (gchar *) "Error",
21544 (GDBusArgInfo **) &_flash_control_signal_info_error_ARG_pointers,
21545 NULL
21546 },
21547 "error"
21548};
21549
21550static const _ExtendedGDBusArgInfo _flash_control_signal_info_progress_ARG_filename =
21551{
21552 {
21553 -1,
21554 (gchar *) "filename",
21555 (gchar *) "s",
21556 NULL
21557 },
21558 FALSE
21559};
21560
21561static const _ExtendedGDBusArgInfo _flash_control_signal_info_progress_ARG_progress =
21562{
21563 {
21564 -1,
21565 (gchar *) "progress",
21566 (gchar *) "y",
21567 NULL
21568 },
21569 FALSE
21570};
21571
21572static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_progress_ARG_pointers[] =
21573{
21574 &_flash_control_signal_info_progress_ARG_filename,
21575 &_flash_control_signal_info_progress_ARG_progress,
21576 NULL
21577};
21578
21579static const _ExtendedGDBusSignalInfo _flash_control_signal_info_progress =
21580{
21581 {
21582 -1,
21583 (gchar *) "Progress",
21584 (GDBusArgInfo **) &_flash_control_signal_info_progress_ARG_pointers,
21585 NULL
21586 },
21587 "progress"
21588};
21589
21590static const _ExtendedGDBusSignalInfo * const _flash_control_signal_info_pointers[] =
21591{
21592 &_flash_control_signal_info_done,
21593 &_flash_control_signal_info_error,
21594 &_flash_control_signal_info_progress,
21595 NULL
21596};
21597
21598static const _ExtendedGDBusPropertyInfo _flash_control_property_info_filename =
21599{
21600 {
21601 -1,
21602 (gchar *) "filename",
21603 (gchar *) "s",
21604 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21605 NULL
21606 },
21607 "filename",
21608 FALSE
21609};
21610
21611static const _ExtendedGDBusPropertyInfo _flash_control_property_info_type_ =
21612{
21613 {
21614 -1,
21615 (gchar *) "type",
21616 (gchar *) "s",
21617 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21618 NULL
21619 },
21620 "type",
21621 FALSE
21622};
21623
21624static const _ExtendedGDBusPropertyInfo * const _flash_control_property_info_pointers[] =
21625{
21626 &_flash_control_property_info_filename,
21627 &_flash_control_property_info_type_,
21628 NULL
21629};
21630
21631static const _ExtendedGDBusInterfaceInfo _flash_control_interface_info =
21632{
21633 {
21634 -1,
21635 (gchar *) "org.openbmc.FlashControl",
21636 (GDBusMethodInfo **) &_flash_control_method_info_pointers,
21637 (GDBusSignalInfo **) &_flash_control_signal_info_pointers,
21638 (GDBusPropertyInfo **) &_flash_control_property_info_pointers,
21639 NULL
21640 },
21641 "flash-control",
21642};
21643
21644
21645/**
21646 * flash_control_interface_info:
21647 *
21648 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> D-Bus interface.
21649 *
21650 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
21651 */
21652GDBusInterfaceInfo *
21653flash_control_interface_info (void)
21654{
21655 return (GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct;
21656}
21657
21658/**
21659 * flash_control_override_properties:
21660 * @klass: The class structure for a #GObject<!-- -->-derived class.
21661 * @property_id_begin: The property id to assign to the first overridden property.
21662 *
21663 * Overrides all #GObject properties in the #FlashControl interface for a concrete class.
21664 * The properties are overridden in the order they are defined.
21665 *
21666 * Returns: The last property id.
21667 */
21668guint
21669flash_control_override_properties (GObjectClass *klass, guint property_id_begin)
21670{
21671 g_object_class_override_property (klass, property_id_begin++, "filename");
21672 g_object_class_override_property (klass, property_id_begin++, "type");
21673 return property_id_begin - 1;
21674}
21675
21676
21677
21678/**
21679 * FlashControl:
21680 *
21681 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
21682 */
21683
21684/**
21685 * FlashControlIface:
21686 * @parent_iface: The parent interface.
21687 * @handle_flash: Handler for the #FlashControl::handle-flash signal.
21688 * @get_filename: Getter for the #FlashControl:filename property.
21689 * @get_type_: Getter for the #FlashControl:type property.
21690 * @done: Handler for the #FlashControl::done signal.
21691 * @error: Handler for the #FlashControl::error signal.
21692 * @progress: Handler for the #FlashControl::progress signal.
21693 *
21694 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
21695 */
21696
21697typedef FlashControlIface FlashControlInterface;
21698G_DEFINE_INTERFACE (FlashControl, flash_control, G_TYPE_OBJECT);
21699
21700static void
21701flash_control_default_init (FlashControlIface *iface)
21702{
21703 /* GObject signals for incoming D-Bus method calls: */
21704 /**
21705 * FlashControl::handle-flash:
21706 * @object: A #FlashControl.
21707 * @invocation: A #GDBusMethodInvocation.
21708 * @arg_type: Argument passed by remote caller.
21709 * @arg_filename: Argument passed by remote caller.
21710 *
21711 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method.
21712 *
21713 * 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.
21714 *
21715 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21716 */
21717 g_signal_new ("handle-flash",
21718 G_TYPE_FROM_INTERFACE (iface),
21719 G_SIGNAL_RUN_LAST,
21720 G_STRUCT_OFFSET (FlashControlIface, handle_flash),
21721 g_signal_accumulator_true_handled,
21722 NULL,
21723 g_cclosure_marshal_generic,
21724 G_TYPE_BOOLEAN,
21725 3,
21726 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING);
21727
21728 /* GObject signals for received D-Bus signals: */
21729 /**
21730 * FlashControl::done:
21731 * @object: A #FlashControl.
21732 * @arg_filename: Argument.
21733 *
21734 * 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.
21735 *
21736 * 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.
21737 */
21738 g_signal_new ("done",
21739 G_TYPE_FROM_INTERFACE (iface),
21740 G_SIGNAL_RUN_LAST,
21741 G_STRUCT_OFFSET (FlashControlIface, done),
21742 NULL,
21743 NULL,
21744 g_cclosure_marshal_generic,
21745 G_TYPE_NONE,
21746 1, G_TYPE_STRING);
21747
21748 /**
21749 * FlashControl::error:
21750 * @object: A #FlashControl.
21751 * @arg_filename: Argument.
21752 *
21753 * 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.
21754 *
21755 * 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.
21756 */
21757 g_signal_new ("error",
21758 G_TYPE_FROM_INTERFACE (iface),
21759 G_SIGNAL_RUN_LAST,
21760 G_STRUCT_OFFSET (FlashControlIface, error),
21761 NULL,
21762 NULL,
21763 g_cclosure_marshal_generic,
21764 G_TYPE_NONE,
21765 1, G_TYPE_STRING);
21766
21767 /**
21768 * FlashControl::progress:
21769 * @object: A #FlashControl.
21770 * @arg_filename: Argument.
21771 * @arg_progress: Argument.
21772 *
21773 * 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.
21774 *
21775 * 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.
21776 */
21777 g_signal_new ("progress",
21778 G_TYPE_FROM_INTERFACE (iface),
21779 G_SIGNAL_RUN_LAST,
21780 G_STRUCT_OFFSET (FlashControlIface, progress),
21781 NULL,
21782 NULL,
21783 g_cclosure_marshal_generic,
21784 G_TYPE_NONE,
21785 2, G_TYPE_STRING, G_TYPE_UCHAR);
21786
21787 /* GObject properties for D-Bus properties: */
21788 /**
21789 * FlashControl:filename:
21790 *
21791 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link>.
21792 *
21793 * 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.
21794 */
21795 g_object_interface_install_property (iface,
21796 g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
21797 /**
21798 * FlashControl:type:
21799 *
21800 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link>.
21801 *
21802 * 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.
21803 */
21804 g_object_interface_install_property (iface,
21805 g_param_spec_string ("type", "type", "type", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
21806}
21807
21808/**
21809 * flash_control_get_filename: (skip)
21810 * @object: A #FlashControl.
21811 *
21812 * Gets the value of the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property.
21813 *
21814 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
21815 *
21816 * <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>
21817 *
21818 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
21819 */
21820const gchar *
21821flash_control_get_filename (FlashControl *object)
21822{
21823 return FLASH_CONTROL_GET_IFACE (object)->get_filename (object);
21824}
21825
21826/**
21827 * flash_control_dup_filename: (skip)
21828 * @object: A #FlashControl.
21829 *
21830 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property.
21831 *
21832 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
21833 *
21834 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
21835 */
21836gchar *
21837flash_control_dup_filename (FlashControl *object)
21838{
21839 gchar *value;
21840 g_object_get (G_OBJECT (object), "filename", &value, NULL);
21841 return value;
21842}
21843
21844/**
21845 * flash_control_set_filename: (skip)
21846 * @object: A #FlashControl.
21847 * @value: The value to set.
21848 *
21849 * Sets the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property to @value.
21850 *
21851 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
21852 */
21853void
21854flash_control_set_filename (FlashControl *object, const gchar *value)
21855{
21856 g_object_set (G_OBJECT (object), "filename", value, NULL);
21857}
21858
21859/**
21860 * flash_control_get_type_: (skip)
21861 * @object: A #FlashControl.
21862 *
21863 * Gets the value of the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property.
21864 *
21865 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
21866 *
21867 * <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>
21868 *
21869 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
21870 */
21871const gchar *
21872flash_control_get_type_ (FlashControl *object)
21873{
21874 return FLASH_CONTROL_GET_IFACE (object)->get_type_ (object);
21875}
21876
21877/**
21878 * flash_control_dup_type_: (skip)
21879 * @object: A #FlashControl.
21880 *
21881 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property.
21882 *
21883 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
21884 *
21885 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
21886 */
21887gchar *
21888flash_control_dup_type_ (FlashControl *object)
21889{
21890 gchar *value;
21891 g_object_get (G_OBJECT (object), "type", &value, NULL);
21892 return value;
21893}
21894
21895/**
21896 * flash_control_set_type_: (skip)
21897 * @object: A #FlashControl.
21898 * @value: The value to set.
21899 *
21900 * Sets the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property to @value.
21901 *
21902 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
21903 */
21904void
21905flash_control_set_type_ (FlashControl *object, const gchar *value)
21906{
21907 g_object_set (G_OBJECT (object), "type", value, NULL);
21908}
21909
21910/**
21911 * flash_control_emit_done:
21912 * @object: A #FlashControl.
21913 * @arg_filename: Argument to pass with the signal.
21914 *
21915 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Done">"Done"</link> D-Bus signal.
21916 */
21917void
21918flash_control_emit_done (
21919 FlashControl *object,
21920 const gchar *arg_filename)
21921{
21922 g_signal_emit_by_name (object, "done", arg_filename);
21923}
21924
21925/**
21926 * flash_control_emit_error:
21927 * @object: A #FlashControl.
21928 * @arg_filename: Argument to pass with the signal.
21929 *
21930 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Error">"Error"</link> D-Bus signal.
21931 */
21932void
21933flash_control_emit_error (
21934 FlashControl *object,
21935 const gchar *arg_filename)
21936{
21937 g_signal_emit_by_name (object, "error", arg_filename);
21938}
21939
21940/**
21941 * flash_control_emit_progress:
21942 * @object: A #FlashControl.
21943 * @arg_filename: Argument to pass with the signal.
21944 * @arg_progress: Argument to pass with the signal.
21945 *
21946 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Progress">"Progress"</link> D-Bus signal.
21947 */
21948void
21949flash_control_emit_progress (
21950 FlashControl *object,
21951 const gchar *arg_filename,
21952 guchar arg_progress)
21953{
21954 g_signal_emit_by_name (object, "progress", arg_filename, arg_progress);
21955}
21956
21957/**
21958 * flash_control_call_flash:
21959 * @proxy: A #FlashControlProxy.
21960 * @arg_type: Argument to pass with the method invocation.
21961 * @arg_filename: Argument to pass with the method invocation.
21962 * @cancellable: (allow-none): A #GCancellable or %NULL.
21963 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
21964 * @user_data: User data to pass to @callback.
21965 *
21966 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method on @proxy.
21967 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
21968 * You can then call flash_control_call_flash_finish() to get the result of the operation.
21969 *
21970 * See flash_control_call_flash_sync() for the synchronous, blocking version of this method.
21971 */
21972void
21973flash_control_call_flash (
21974 FlashControl *proxy,
21975 const gchar *arg_type,
21976 const gchar *arg_filename,
21977 GCancellable *cancellable,
21978 GAsyncReadyCallback callback,
21979 gpointer user_data)
21980{
21981 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
21982 "flash",
21983 g_variant_new ("(ss)",
21984 arg_type,
21985 arg_filename),
21986 G_DBUS_CALL_FLAGS_NONE,
21987 -1,
21988 cancellable,
21989 callback,
21990 user_data);
21991}
21992
21993/**
21994 * flash_control_call_flash_finish:
21995 * @proxy: A #FlashControlProxy.
21996 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_call_flash().
21997 * @error: Return location for error or %NULL.
21998 *
21999 * Finishes an operation started with flash_control_call_flash().
22000 *
22001 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22002 */
22003gboolean
22004flash_control_call_flash_finish (
22005 FlashControl *proxy,
22006 GAsyncResult *res,
22007 GError **error)
22008{
22009 GVariant *_ret;
22010 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22011 if (_ret == NULL)
22012 goto _out;
22013 g_variant_get (_ret,
22014 "()");
22015 g_variant_unref (_ret);
22016_out:
22017 return _ret != NULL;
22018}
22019
22020/**
22021 * flash_control_call_flash_sync:
22022 * @proxy: A #FlashControlProxy.
22023 * @arg_type: Argument to pass with the method invocation.
22024 * @arg_filename: Argument to pass with the method invocation.
22025 * @cancellable: (allow-none): A #GCancellable or %NULL.
22026 * @error: Return location for error or %NULL.
22027 *
22028 * 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.
22029 *
22030 * See flash_control_call_flash() for the asynchronous version of this method.
22031 *
22032 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22033 */
22034gboolean
22035flash_control_call_flash_sync (
22036 FlashControl *proxy,
22037 const gchar *arg_type,
22038 const gchar *arg_filename,
22039 GCancellable *cancellable,
22040 GError **error)
22041{
22042 GVariant *_ret;
22043 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22044 "flash",
22045 g_variant_new ("(ss)",
22046 arg_type,
22047 arg_filename),
22048 G_DBUS_CALL_FLAGS_NONE,
22049 -1,
22050 cancellable,
22051 error);
22052 if (_ret == NULL)
22053 goto _out;
22054 g_variant_get (_ret,
22055 "()");
22056 g_variant_unref (_ret);
22057_out:
22058 return _ret != NULL;
22059}
22060
22061/**
22062 * flash_control_complete_flash:
22063 * @object: A #FlashControl.
22064 * @invocation: (transfer full): A #GDBusMethodInvocation.
22065 *
22066 * 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.
22067 *
22068 * This method will free @invocation, you cannot use it afterwards.
22069 */
22070void
22071flash_control_complete_flash (
22072 FlashControl *object,
22073 GDBusMethodInvocation *invocation)
22074{
22075 g_dbus_method_invocation_return_value (invocation,
22076 g_variant_new ("()"));
22077}
22078
22079/* ------------------------------------------------------------------------ */
22080
22081/**
22082 * FlashControlProxy:
22083 *
22084 * The #FlashControlProxy structure contains only private data and should only be accessed using the provided API.
22085 */
22086
22087/**
22088 * FlashControlProxyClass:
22089 * @parent_class: The parent class.
22090 *
22091 * Class structure for #FlashControlProxy.
22092 */
22093
22094struct _FlashControlProxyPrivate
22095{
22096 GData *qdata;
22097};
22098
22099static void flash_control_proxy_iface_init (FlashControlIface *iface);
22100
22101#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22102G_DEFINE_TYPE_WITH_CODE (FlashControlProxy, flash_control_proxy, G_TYPE_DBUS_PROXY,
22103 G_ADD_PRIVATE (FlashControlProxy)
22104 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_proxy_iface_init));
22105
22106#else
22107G_DEFINE_TYPE_WITH_CODE (FlashControlProxy, flash_control_proxy, G_TYPE_DBUS_PROXY,
22108 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_proxy_iface_init));
22109
22110#endif
22111static void
22112flash_control_proxy_finalize (GObject *object)
22113{
22114 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
22115 g_datalist_clear (&proxy->priv->qdata);
22116 G_OBJECT_CLASS (flash_control_proxy_parent_class)->finalize (object);
22117}
22118
22119static void
22120flash_control_proxy_get_property (GObject *object,
22121 guint prop_id,
22122 GValue *value,
22123 GParamSpec *pspec G_GNUC_UNUSED)
22124{
22125 const _ExtendedGDBusPropertyInfo *info;
22126 GVariant *variant;
22127 g_assert (prop_id != 0 && prop_id - 1 < 2);
22128 info = _flash_control_property_info_pointers[prop_id - 1];
22129 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
22130 if (info->use_gvariant)
22131 {
22132 g_value_set_variant (value, variant);
22133 }
22134 else
22135 {
22136 if (variant != NULL)
22137 g_dbus_gvariant_to_gvalue (variant, value);
22138 }
22139 if (variant != NULL)
22140 g_variant_unref (variant);
22141}
22142
22143static void
22144flash_control_proxy_set_property_cb (GDBusProxy *proxy,
22145 GAsyncResult *res,
22146 gpointer user_data)
22147{
22148 const _ExtendedGDBusPropertyInfo *info = user_data;
22149 GError *error;
22150 GVariant *_ret;
22151 error = NULL;
22152 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
22153 if (!_ret)
22154 {
22155 g_warning ("Error setting property '%s' on interface org.openbmc.FlashControl: %s (%s, %d)",
22156 info->parent_struct.name,
22157 error->message, g_quark_to_string (error->domain), error->code);
22158 g_error_free (error);
22159 }
22160 else
22161 {
22162 g_variant_unref (_ret);
22163 }
22164}
22165
22166static void
22167flash_control_proxy_set_property (GObject *object,
22168 guint prop_id,
22169 const GValue *value,
22170 GParamSpec *pspec G_GNUC_UNUSED)
22171{
22172 const _ExtendedGDBusPropertyInfo *info;
22173 GVariant *variant;
22174 g_assert (prop_id != 0 && prop_id - 1 < 2);
22175 info = _flash_control_property_info_pointers[prop_id - 1];
22176 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
22177 g_dbus_proxy_call (G_DBUS_PROXY (object),
22178 "org.freedesktop.DBus.Properties.Set",
22179 g_variant_new ("(ssv)", "org.openbmc.FlashControl", info->parent_struct.name, variant),
22180 G_DBUS_CALL_FLAGS_NONE,
22181 -1,
22182 NULL, (GAsyncReadyCallback) flash_control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
22183 g_variant_unref (variant);
22184}
22185
22186static void
22187flash_control_proxy_g_signal (GDBusProxy *proxy,
22188 const gchar *sender_name G_GNUC_UNUSED,
22189 const gchar *signal_name,
22190 GVariant *parameters)
22191{
22192 _ExtendedGDBusSignalInfo *info;
22193 GVariantIter iter;
22194 GVariant *child;
22195 GValue *paramv;
22196 guint num_params;
22197 guint n;
22198 guint signal_id;
22199 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, signal_name);
22200 if (info == NULL)
22201 return;
22202 num_params = g_variant_n_children (parameters);
22203 paramv = g_new0 (GValue, num_params + 1);
22204 g_value_init (&paramv[0], TYPE_FLASH_CONTROL);
22205 g_value_set_object (&paramv[0], proxy);
22206 g_variant_iter_init (&iter, parameters);
22207 n = 1;
22208 while ((child = g_variant_iter_next_value (&iter)) != NULL)
22209 {
22210 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
22211 if (arg_info->use_gvariant)
22212 {
22213 g_value_init (&paramv[n], G_TYPE_VARIANT);
22214 g_value_set_variant (&paramv[n], child);
22215 n++;
22216 }
22217 else
22218 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
22219 g_variant_unref (child);
22220 }
22221 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH_CONTROL);
22222 g_signal_emitv (paramv, signal_id, 0, NULL);
22223 for (n = 0; n < num_params + 1; n++)
22224 g_value_unset (&paramv[n]);
22225 g_free (paramv);
22226}
22227
22228static void
22229flash_control_proxy_g_properties_changed (GDBusProxy *_proxy,
22230 GVariant *changed_properties,
22231 const gchar *const *invalidated_properties)
22232{
22233 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (_proxy);
22234 guint n;
22235 const gchar *key;
22236 GVariantIter *iter;
22237 _ExtendedGDBusPropertyInfo *info;
22238 g_variant_get (changed_properties, "a{sv}", &iter);
22239 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
22240 {
22241 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, key);
22242 g_datalist_remove_data (&proxy->priv->qdata, key);
22243 if (info != NULL)
22244 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
22245 }
22246 g_variant_iter_free (iter);
22247 for (n = 0; invalidated_properties[n] != NULL; n++)
22248 {
22249 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, invalidated_properties[n]);
22250 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
22251 if (info != NULL)
22252 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
22253 }
22254}
22255
22256static const gchar *
22257flash_control_proxy_get_filename (FlashControl *object)
22258{
22259 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
22260 GVariant *variant;
22261 const gchar *value = NULL;
22262 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "filename");
22263 if (variant != NULL)
22264 {
22265 value = g_variant_get_string (variant, NULL);
22266 g_variant_unref (variant);
22267 }
22268 return value;
22269}
22270
22271static const gchar *
22272flash_control_proxy_get_type_ (FlashControl *object)
22273{
22274 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
22275 GVariant *variant;
22276 const gchar *value = NULL;
22277 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "type");
22278 if (variant != NULL)
22279 {
22280 value = g_variant_get_string (variant, NULL);
22281 g_variant_unref (variant);
22282 }
22283 return value;
22284}
22285
22286static void
22287flash_control_proxy_init (FlashControlProxy *proxy)
22288{
22289#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22290 proxy->priv = flash_control_proxy_get_instance_private (proxy);
22291#else
22292 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_CONTROL_PROXY, FlashControlProxyPrivate);
22293#endif
22294
22295 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_control_interface_info ());
22296}
22297
22298static void
22299flash_control_proxy_class_init (FlashControlProxyClass *klass)
22300{
22301 GObjectClass *gobject_class;
22302 GDBusProxyClass *proxy_class;
22303
22304 gobject_class = G_OBJECT_CLASS (klass);
22305 gobject_class->finalize = flash_control_proxy_finalize;
22306 gobject_class->get_property = flash_control_proxy_get_property;
22307 gobject_class->set_property = flash_control_proxy_set_property;
22308
22309 proxy_class = G_DBUS_PROXY_CLASS (klass);
22310 proxy_class->g_signal = flash_control_proxy_g_signal;
22311 proxy_class->g_properties_changed = flash_control_proxy_g_properties_changed;
22312
22313 flash_control_override_properties (gobject_class, 1);
22314
22315#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
22316 g_type_class_add_private (klass, sizeof (FlashControlProxyPrivate));
22317#endif
22318}
22319
22320static void
22321flash_control_proxy_iface_init (FlashControlIface *iface)
22322{
22323 iface->get_filename = flash_control_proxy_get_filename;
22324 iface->get_type_ = flash_control_proxy_get_type_;
22325}
22326
22327/**
22328 * flash_control_proxy_new:
22329 * @connection: A #GDBusConnection.
22330 * @flags: Flags from the #GDBusProxyFlags enumeration.
22331 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
22332 * @object_path: An object path.
22333 * @cancellable: (allow-none): A #GCancellable or %NULL.
22334 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
22335 * @user_data: User data to pass to @callback.
22336 *
22337 * 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.
22338 *
22339 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
22340 * You can then call flash_control_proxy_new_finish() to get the result of the operation.
22341 *
22342 * See flash_control_proxy_new_sync() for the synchronous, blocking version of this constructor.
22343 */
22344void
22345flash_control_proxy_new (
22346 GDBusConnection *connection,
22347 GDBusProxyFlags flags,
22348 const gchar *name,
22349 const gchar *object_path,
22350 GCancellable *cancellable,
22351 GAsyncReadyCallback callback,
22352 gpointer user_data)
22353{
22354 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);
22355}
22356
22357/**
22358 * flash_control_proxy_new_finish:
22359 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_proxy_new().
22360 * @error: Return location for error or %NULL
22361 *
22362 * Finishes an operation started with flash_control_proxy_new().
22363 *
22364 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
22365 */
22366FlashControl *
22367flash_control_proxy_new_finish (
22368 GAsyncResult *res,
22369 GError **error)
22370{
22371 GObject *ret;
22372 GObject *source_object;
22373 source_object = g_async_result_get_source_object (res);
22374 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
22375 g_object_unref (source_object);
22376 if (ret != NULL)
22377 return FLASH_CONTROL (ret);
22378 else
22379 return NULL;
22380}
22381
22382/**
22383 * flash_control_proxy_new_sync:
22384 * @connection: A #GDBusConnection.
22385 * @flags: Flags from the #GDBusProxyFlags enumeration.
22386 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
22387 * @object_path: An object path.
22388 * @cancellable: (allow-none): A #GCancellable or %NULL.
22389 * @error: Return location for error or %NULL
22390 *
22391 * 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.
22392 *
22393 * The calling thread is blocked until a reply is received.
22394 *
22395 * See flash_control_proxy_new() for the asynchronous version of this constructor.
22396 *
22397 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
22398 */
22399FlashControl *
22400flash_control_proxy_new_sync (
22401 GDBusConnection *connection,
22402 GDBusProxyFlags flags,
22403 const gchar *name,
22404 const gchar *object_path,
22405 GCancellable *cancellable,
22406 GError **error)
22407{
22408 GInitable *ret;
22409 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);
22410 if (ret != NULL)
22411 return FLASH_CONTROL (ret);
22412 else
22413 return NULL;
22414}
22415
22416
22417/**
22418 * flash_control_proxy_new_for_bus:
22419 * @bus_type: A #GBusType.
22420 * @flags: Flags from the #GDBusProxyFlags enumeration.
22421 * @name: A bus name (well-known or unique).
22422 * @object_path: An object path.
22423 * @cancellable: (allow-none): A #GCancellable or %NULL.
22424 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
22425 * @user_data: User data to pass to @callback.
22426 *
22427 * Like flash_control_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
22428 *
22429 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
22430 * You can then call flash_control_proxy_new_for_bus_finish() to get the result of the operation.
22431 *
22432 * See flash_control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
22433 */
22434void
22435flash_control_proxy_new_for_bus (
22436 GBusType bus_type,
22437 GDBusProxyFlags flags,
22438 const gchar *name,
22439 const gchar *object_path,
22440 GCancellable *cancellable,
22441 GAsyncReadyCallback callback,
22442 gpointer user_data)
22443{
22444 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);
22445}
22446
22447/**
22448 * flash_control_proxy_new_for_bus_finish:
22449 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_proxy_new_for_bus().
22450 * @error: Return location for error or %NULL
22451 *
22452 * Finishes an operation started with flash_control_proxy_new_for_bus().
22453 *
22454 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
22455 */
22456FlashControl *
22457flash_control_proxy_new_for_bus_finish (
22458 GAsyncResult *res,
22459 GError **error)
22460{
22461 GObject *ret;
22462 GObject *source_object;
22463 source_object = g_async_result_get_source_object (res);
22464 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
22465 g_object_unref (source_object);
22466 if (ret != NULL)
22467 return FLASH_CONTROL (ret);
22468 else
22469 return NULL;
22470}
22471
22472/**
22473 * flash_control_proxy_new_for_bus_sync:
22474 * @bus_type: A #GBusType.
22475 * @flags: Flags from the #GDBusProxyFlags enumeration.
22476 * @name: A bus name (well-known or unique).
22477 * @object_path: An object path.
22478 * @cancellable: (allow-none): A #GCancellable or %NULL.
22479 * @error: Return location for error or %NULL
22480 *
22481 * Like flash_control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
22482 *
22483 * The calling thread is blocked until a reply is received.
22484 *
22485 * See flash_control_proxy_new_for_bus() for the asynchronous version of this constructor.
22486 *
22487 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
22488 */
22489FlashControl *
22490flash_control_proxy_new_for_bus_sync (
22491 GBusType bus_type,
22492 GDBusProxyFlags flags,
22493 const gchar *name,
22494 const gchar *object_path,
22495 GCancellable *cancellable,
22496 GError **error)
22497{
22498 GInitable *ret;
22499 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);
22500 if (ret != NULL)
22501 return FLASH_CONTROL (ret);
22502 else
22503 return NULL;
22504}
22505
22506
22507/* ------------------------------------------------------------------------ */
22508
22509/**
22510 * FlashControlSkeleton:
22511 *
22512 * The #FlashControlSkeleton structure contains only private data and should only be accessed using the provided API.
22513 */
22514
22515/**
22516 * FlashControlSkeletonClass:
22517 * @parent_class: The parent class.
22518 *
22519 * Class structure for #FlashControlSkeleton.
22520 */
22521
22522struct _FlashControlSkeletonPrivate
22523{
22524 GValue *properties;
22525 GList *changed_properties;
22526 GSource *changed_properties_idle_source;
22527 GMainContext *context;
22528 GMutex lock;
22529};
22530
22531static void
22532_flash_control_skeleton_handle_method_call (
22533 GDBusConnection *connection G_GNUC_UNUSED,
22534 const gchar *sender G_GNUC_UNUSED,
22535 const gchar *object_path G_GNUC_UNUSED,
22536 const gchar *interface_name,
22537 const gchar *method_name,
22538 GVariant *parameters,
22539 GDBusMethodInvocation *invocation,
22540 gpointer user_data)
22541{
22542 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
22543 _ExtendedGDBusMethodInfo *info;
22544 GVariantIter iter;
22545 GVariant *child;
22546 GValue *paramv;
22547 guint num_params;
22548 guint num_extra;
22549 guint n;
22550 guint signal_id;
22551 GValue return_value = G_VALUE_INIT;
22552 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
22553 g_assert (info != NULL);
22554 num_params = g_variant_n_children (parameters);
22555 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
22556 n = 0;
22557 g_value_init (&paramv[n], TYPE_FLASH_CONTROL);
22558 g_value_set_object (&paramv[n++], skeleton);
22559 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
22560 g_value_set_object (&paramv[n++], invocation);
22561 if (info->pass_fdlist)
22562 {
22563#ifdef G_OS_UNIX
22564 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
22565 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
22566#else
22567 g_assert_not_reached ();
22568#endif
22569 }
22570 g_variant_iter_init (&iter, parameters);
22571 while ((child = g_variant_iter_next_value (&iter)) != NULL)
22572 {
22573 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
22574 if (arg_info->use_gvariant)
22575 {
22576 g_value_init (&paramv[n], G_TYPE_VARIANT);
22577 g_value_set_variant (&paramv[n], child);
22578 n++;
22579 }
22580 else
22581 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
22582 g_variant_unref (child);
22583 }
22584 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH_CONTROL);
22585 g_value_init (&return_value, G_TYPE_BOOLEAN);
22586 g_signal_emitv (paramv, signal_id, 0, &return_value);
22587 if (!g_value_get_boolean (&return_value))
22588 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);
22589 g_value_unset (&return_value);
22590 for (n = 0; n < num_params + num_extra; n++)
22591 g_value_unset (&paramv[n]);
22592 g_free (paramv);
22593}
22594
22595static GVariant *
22596_flash_control_skeleton_handle_get_property (
22597 GDBusConnection *connection G_GNUC_UNUSED,
22598 const gchar *sender G_GNUC_UNUSED,
22599 const gchar *object_path G_GNUC_UNUSED,
22600 const gchar *interface_name G_GNUC_UNUSED,
22601 const gchar *property_name,
22602 GError **error,
22603 gpointer user_data)
22604{
22605 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
22606 GValue value = G_VALUE_INIT;
22607 GParamSpec *pspec;
22608 _ExtendedGDBusPropertyInfo *info;
22609 GVariant *ret;
22610 ret = NULL;
22611 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, property_name);
22612 g_assert (info != NULL);
22613 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
22614 if (pspec == NULL)
22615 {
22616 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
22617 }
22618 else
22619 {
22620 g_value_init (&value, pspec->value_type);
22621 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
22622 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
22623 g_value_unset (&value);
22624 }
22625 return ret;
22626}
22627
22628static gboolean
22629_flash_control_skeleton_handle_set_property (
22630 GDBusConnection *connection G_GNUC_UNUSED,
22631 const gchar *sender G_GNUC_UNUSED,
22632 const gchar *object_path G_GNUC_UNUSED,
22633 const gchar *interface_name G_GNUC_UNUSED,
22634 const gchar *property_name,
22635 GVariant *variant,
22636 GError **error,
22637 gpointer user_data)
22638{
22639 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
22640 GValue value = G_VALUE_INIT;
22641 GParamSpec *pspec;
22642 _ExtendedGDBusPropertyInfo *info;
22643 gboolean ret;
22644 ret = FALSE;
22645 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, property_name);
22646 g_assert (info != NULL);
22647 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
22648 if (pspec == NULL)
22649 {
22650 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
22651 }
22652 else
22653 {
22654 if (info->use_gvariant)
22655 g_value_set_variant (&value, variant);
22656 else
22657 g_dbus_gvariant_to_gvalue (variant, &value);
22658 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
22659 g_value_unset (&value);
22660 ret = TRUE;
22661 }
22662 return ret;
22663}
22664
22665static const GDBusInterfaceVTable _flash_control_skeleton_vtable =
22666{
22667 _flash_control_skeleton_handle_method_call,
22668 _flash_control_skeleton_handle_get_property,
22669 _flash_control_skeleton_handle_set_property,
22670 {NULL}
22671};
22672
22673static GDBusInterfaceInfo *
22674flash_control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
22675{
22676 return flash_control_interface_info ();
22677}
22678
22679static GDBusInterfaceVTable *
22680flash_control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
22681{
22682 return (GDBusInterfaceVTable *) &_flash_control_skeleton_vtable;
22683}
22684
22685static GVariant *
22686flash_control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
22687{
22688 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (_skeleton);
22689
22690 GVariantBuilder builder;
22691 guint n;
22692 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
22693 if (_flash_control_interface_info.parent_struct.properties == NULL)
22694 goto out;
22695 for (n = 0; _flash_control_interface_info.parent_struct.properties[n] != NULL; n++)
22696 {
22697 GDBusPropertyInfo *info = _flash_control_interface_info.parent_struct.properties[n];
22698 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
22699 {
22700 GVariant *value;
22701 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);
22702 if (value != NULL)
22703 {
22704 g_variant_take_ref (value);
22705 g_variant_builder_add (&builder, "{sv}", info->name, value);
22706 g_variant_unref (value);
22707 }
22708 }
22709 }
22710out:
22711 return g_variant_builder_end (&builder);
22712}
22713
22714static gboolean _flash_control_emit_changed (gpointer user_data);
22715
22716static void
22717flash_control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
22718{
22719 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (_skeleton);
22720 gboolean emit_changed = FALSE;
22721
22722 g_mutex_lock (&skeleton->priv->lock);
22723 if (skeleton->priv->changed_properties_idle_source != NULL)
22724 {
22725 g_source_destroy (skeleton->priv->changed_properties_idle_source);
22726 skeleton->priv->changed_properties_idle_source = NULL;
22727 emit_changed = TRUE;
22728 }
22729 g_mutex_unlock (&skeleton->priv->lock);
22730
22731 if (emit_changed)
22732 _flash_control_emit_changed (skeleton);
22733}
22734
22735static void
22736_flash_control_on_signal_done (
22737 FlashControl *object,
22738 const gchar *arg_filename)
22739{
22740 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
22741
22742 GList *connections, *l;
22743 GVariant *signal_variant;
22744 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
22745
22746 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
22747 arg_filename));
22748 for (l = connections; l != NULL; l = l->next)
22749 {
22750 GDBusConnection *connection = l->data;
22751 g_dbus_connection_emit_signal (connection,
22752 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Done",
22753 signal_variant, NULL);
22754 }
22755 g_variant_unref (signal_variant);
22756 g_list_free_full (connections, g_object_unref);
22757}
22758
22759static void
22760_flash_control_on_signal_error (
22761 FlashControl *object,
22762 const gchar *arg_filename)
22763{
22764 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
22765
22766 GList *connections, *l;
22767 GVariant *signal_variant;
22768 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
22769
22770 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
22771 arg_filename));
22772 for (l = connections; l != NULL; l = l->next)
22773 {
22774 GDBusConnection *connection = l->data;
22775 g_dbus_connection_emit_signal (connection,
22776 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Error",
22777 signal_variant, NULL);
22778 }
22779 g_variant_unref (signal_variant);
22780 g_list_free_full (connections, g_object_unref);
22781}
22782
22783static void
22784_flash_control_on_signal_progress (
22785 FlashControl *object,
22786 const gchar *arg_filename,
22787 guchar arg_progress)
22788{
22789 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
22790
22791 GList *connections, *l;
22792 GVariant *signal_variant;
22793 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
22794
22795 signal_variant = g_variant_ref_sink (g_variant_new ("(sy)",
22796 arg_filename,
22797 arg_progress));
22798 for (l = connections; l != NULL; l = l->next)
22799 {
22800 GDBusConnection *connection = l->data;
22801 g_dbus_connection_emit_signal (connection,
22802 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Progress",
22803 signal_variant, NULL);
22804 }
22805 g_variant_unref (signal_variant);
22806 g_list_free_full (connections, g_object_unref);
22807}
22808
22809static void flash_control_skeleton_iface_init (FlashControlIface *iface);
22810#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22811G_DEFINE_TYPE_WITH_CODE (FlashControlSkeleton, flash_control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
22812 G_ADD_PRIVATE (FlashControlSkeleton)
22813 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_skeleton_iface_init));
22814
22815#else
22816G_DEFINE_TYPE_WITH_CODE (FlashControlSkeleton, flash_control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
22817 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_skeleton_iface_init));
22818
22819#endif
22820static void
22821flash_control_skeleton_finalize (GObject *object)
22822{
22823 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
22824 guint n;
22825 for (n = 0; n < 2; n++)
22826 g_value_unset (&skeleton->priv->properties[n]);
22827 g_free (skeleton->priv->properties);
22828 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
22829 if (skeleton->priv->changed_properties_idle_source != NULL)
22830 g_source_destroy (skeleton->priv->changed_properties_idle_source);
22831 g_main_context_unref (skeleton->priv->context);
22832 g_mutex_clear (&skeleton->priv->lock);
22833 G_OBJECT_CLASS (flash_control_skeleton_parent_class)->finalize (object);
22834}
22835
22836static void
22837flash_control_skeleton_get_property (GObject *object,
22838 guint prop_id,
22839 GValue *value,
22840 GParamSpec *pspec G_GNUC_UNUSED)
22841{
22842 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
22843 g_assert (prop_id != 0 && prop_id - 1 < 2);
22844 g_mutex_lock (&skeleton->priv->lock);
22845 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
22846 g_mutex_unlock (&skeleton->priv->lock);
22847}
22848
22849static gboolean
22850_flash_control_emit_changed (gpointer user_data)
22851{
22852 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
22853 GList *l;
22854 GVariantBuilder builder;
22855 GVariantBuilder invalidated_builder;
22856 guint num_changes;
22857
22858 g_mutex_lock (&skeleton->priv->lock);
22859 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
22860 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
22861 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
22862 {
22863 ChangedProperty *cp = l->data;
22864 GVariant *variant;
22865 const GValue *cur_value;
22866
22867 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
22868 if (!_g_value_equal (cur_value, &cp->orig_value))
22869 {
22870 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
22871 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
22872 g_variant_unref (variant);
22873 num_changes++;
22874 }
22875 }
22876 if (num_changes > 0)
22877 {
22878 GList *connections, *ll;
22879 GVariant *signal_variant;
22880 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.FlashControl",
22881 &builder, &invalidated_builder));
22882 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
22883 for (ll = connections; ll != NULL; ll = ll->next)
22884 {
22885 GDBusConnection *connection = ll->data;
22886
22887 g_dbus_connection_emit_signal (connection,
22888 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
22889 "org.freedesktop.DBus.Properties",
22890 "PropertiesChanged",
22891 signal_variant,
22892 NULL);
22893 }
22894 g_variant_unref (signal_variant);
22895 g_list_free_full (connections, g_object_unref);
22896 }
22897 else
22898 {
22899 g_variant_builder_clear (&builder);
22900 g_variant_builder_clear (&invalidated_builder);
22901 }
22902 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
22903 skeleton->priv->changed_properties = NULL;
22904 skeleton->priv->changed_properties_idle_source = NULL;
22905 g_mutex_unlock (&skeleton->priv->lock);
22906 return FALSE;
22907}
22908
22909static void
22910_flash_control_schedule_emit_changed (FlashControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
22911{
22912 ChangedProperty *cp;
22913 GList *l;
22914 cp = NULL;
22915 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
22916 {
22917 ChangedProperty *i_cp = l->data;
22918 if (i_cp->info == info)
22919 {
22920 cp = i_cp;
22921 break;
22922 }
22923 }
22924 if (cp == NULL)
22925 {
22926 cp = g_new0 (ChangedProperty, 1);
22927 cp->prop_id = prop_id;
22928 cp->info = info;
22929 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
22930 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
22931 g_value_copy (orig_value, &cp->orig_value);
22932 }
22933}
22934
22935static void
22936flash_control_skeleton_notify (GObject *object,
22937 GParamSpec *pspec G_GNUC_UNUSED)
22938{
22939 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
22940 g_mutex_lock (&skeleton->priv->lock);
22941 if (skeleton->priv->changed_properties != NULL &&
22942 skeleton->priv->changed_properties_idle_source == NULL)
22943 {
22944 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
22945 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
22946 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _flash_control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
22947 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
22948 g_source_unref (skeleton->priv->changed_properties_idle_source);
22949 }
22950 g_mutex_unlock (&skeleton->priv->lock);
22951}
22952
22953static void
22954flash_control_skeleton_set_property (GObject *object,
22955 guint prop_id,
22956 const GValue *value,
22957 GParamSpec *pspec)
22958{
22959 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
22960 g_assert (prop_id != 0 && prop_id - 1 < 2);
22961 g_mutex_lock (&skeleton->priv->lock);
22962 g_object_freeze_notify (object);
22963 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
22964 {
22965 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
22966 _flash_control_schedule_emit_changed (skeleton, _flash_control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
22967 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
22968 g_object_notify_by_pspec (object, pspec);
22969 }
22970 g_mutex_unlock (&skeleton->priv->lock);
22971 g_object_thaw_notify (object);
22972}
22973
22974static void
22975flash_control_skeleton_init (FlashControlSkeleton *skeleton)
22976{
22977#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22978 skeleton->priv = flash_control_skeleton_get_instance_private (skeleton);
22979#else
22980 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_CONTROL_SKELETON, FlashControlSkeletonPrivate);
22981#endif
22982
22983 g_mutex_init (&skeleton->priv->lock);
22984 skeleton->priv->context = g_main_context_ref_thread_default ();
22985 skeleton->priv->properties = g_new0 (GValue, 2);
22986 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
22987 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
22988}
22989
22990static const gchar *
22991flash_control_skeleton_get_filename (FlashControl *object)
22992{
22993 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
22994 const gchar *value;
22995 g_mutex_lock (&skeleton->priv->lock);
22996 value = g_value_get_string (&(skeleton->priv->properties[0]));
22997 g_mutex_unlock (&skeleton->priv->lock);
22998 return value;
22999}
23000
23001static const gchar *
23002flash_control_skeleton_get_type_ (FlashControl *object)
23003{
23004 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
23005 const gchar *value;
23006 g_mutex_lock (&skeleton->priv->lock);
23007 value = g_value_get_string (&(skeleton->priv->properties[1]));
23008 g_mutex_unlock (&skeleton->priv->lock);
23009 return value;
23010}
23011
23012static void
23013flash_control_skeleton_class_init (FlashControlSkeletonClass *klass)
23014{
23015 GObjectClass *gobject_class;
23016 GDBusInterfaceSkeletonClass *skeleton_class;
23017
23018 gobject_class = G_OBJECT_CLASS (klass);
23019 gobject_class->finalize = flash_control_skeleton_finalize;
23020 gobject_class->get_property = flash_control_skeleton_get_property;
23021 gobject_class->set_property = flash_control_skeleton_set_property;
23022 gobject_class->notify = flash_control_skeleton_notify;
23023
23024
23025 flash_control_override_properties (gobject_class, 1);
23026
23027 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
23028 skeleton_class->get_info = flash_control_skeleton_dbus_interface_get_info;
23029 skeleton_class->get_properties = flash_control_skeleton_dbus_interface_get_properties;
23030 skeleton_class->flush = flash_control_skeleton_dbus_interface_flush;
23031 skeleton_class->get_vtable = flash_control_skeleton_dbus_interface_get_vtable;
23032
23033#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
23034 g_type_class_add_private (klass, sizeof (FlashControlSkeletonPrivate));
23035#endif
23036}
23037
23038static void
23039flash_control_skeleton_iface_init (FlashControlIface *iface)
23040{
23041 iface->done = _flash_control_on_signal_done;
23042 iface->error = _flash_control_on_signal_error;
23043 iface->progress = _flash_control_on_signal_progress;
23044 iface->get_filename = flash_control_skeleton_get_filename;
23045 iface->get_type_ = flash_control_skeleton_get_type_;
23046}
23047
23048/**
23049 * flash_control_skeleton_new:
23050 *
23051 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
23052 *
23053 * Returns: (transfer full) (type FlashControlSkeleton): The skeleton object.
23054 */
23055FlashControl *
23056flash_control_skeleton_new (void)
23057{
23058 return FLASH_CONTROL (g_object_new (TYPE_FLASH_CONTROL_SKELETON, NULL));
23059}
23060
23061/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050023062 * Code for interface org.openbmc.Button
23063 * ------------------------------------------------------------------------
23064 */
23065
23066/**
23067 * SECTION:Button
23068 * @title: Button
23069 * @short_description: Generated C code for the org.openbmc.Button D-Bus interface
23070 *
23071 * 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.
23072 */
23073
23074/* ---- Introspection data for org.openbmc.Button ---- */
23075
23076static const _ExtendedGDBusArgInfo _button_method_info_is_on_OUT_ARG_state =
23077{
23078 {
23079 -1,
23080 (gchar *) "state",
23081 (gchar *) "b",
23082 NULL
23083 },
23084 FALSE
23085};
23086
23087static const _ExtendedGDBusArgInfo * const _button_method_info_is_on_OUT_ARG_pointers[] =
23088{
23089 &_button_method_info_is_on_OUT_ARG_state,
23090 NULL
23091};
23092
23093static const _ExtendedGDBusMethodInfo _button_method_info_is_on =
23094{
23095 {
23096 -1,
23097 (gchar *) "isOn",
23098 NULL,
23099 (GDBusArgInfo **) &_button_method_info_is_on_OUT_ARG_pointers,
23100 NULL
23101 },
23102 "handle-is-on",
23103 FALSE
23104};
23105
23106static const _ExtendedGDBusMethodInfo _button_method_info_sim_button_press =
23107{
23108 {
23109 -1,
23110 (gchar *) "simButtonPress",
23111 NULL,
23112 NULL,
23113 NULL
23114 },
23115 "handle-sim-button-press",
23116 FALSE
23117};
23118
23119static const _ExtendedGDBusMethodInfo _button_method_info_sim_button_long_press =
23120{
23121 {
23122 -1,
23123 (gchar *) "simButtonLongPress",
23124 NULL,
23125 NULL,
23126 NULL
23127 },
23128 "handle-sim-button-long-press",
23129 FALSE
23130};
23131
23132static const _ExtendedGDBusMethodInfo * const _button_method_info_pointers[] =
23133{
23134 &_button_method_info_is_on,
23135 &_button_method_info_sim_button_press,
23136 &_button_method_info_sim_button_long_press,
23137 NULL
23138};
23139
23140static const _ExtendedGDBusSignalInfo _button_signal_info_button_release =
23141{
23142 {
23143 -1,
23144 (gchar *) "ButtonRelease",
23145 NULL,
23146 NULL
23147 },
23148 "button-release"
23149};
23150
23151static const _ExtendedGDBusSignalInfo _button_signal_info_button_pressed =
23152{
23153 {
23154 -1,
23155 (gchar *) "ButtonPressed",
23156 NULL,
23157 NULL
23158 },
23159 "button-pressed"
23160};
23161
23162static const _ExtendedGDBusSignalInfo _button_signal_info_button_pressed_long =
23163{
23164 {
23165 -1,
23166 (gchar *) "ButtonPressedLong",
23167 NULL,
23168 NULL
23169 },
23170 "button-pressed-long"
23171};
23172
23173static const _ExtendedGDBusSignalInfo * const _button_signal_info_pointers[] =
23174{
23175 &_button_signal_info_button_release,
23176 &_button_signal_info_button_pressed,
23177 &_button_signal_info_button_pressed_long,
23178 NULL
23179};
23180
23181static const _ExtendedGDBusPropertyInfo _button_property_info_state =
23182{
23183 {
23184 -1,
23185 (gchar *) "state",
23186 (gchar *) "b",
23187 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
23188 NULL
23189 },
23190 "state",
23191 FALSE
23192};
23193
23194static const _ExtendedGDBusPropertyInfo * const _button_property_info_pointers[] =
23195{
23196 &_button_property_info_state,
23197 NULL
23198};
23199
23200static const _ExtendedGDBusInterfaceInfo _button_interface_info =
23201{
23202 {
23203 -1,
23204 (gchar *) "org.openbmc.Button",
23205 (GDBusMethodInfo **) &_button_method_info_pointers,
23206 (GDBusSignalInfo **) &_button_signal_info_pointers,
23207 (GDBusPropertyInfo **) &_button_property_info_pointers,
23208 NULL
23209 },
23210 "button",
23211};
23212
23213
23214/**
23215 * button_interface_info:
23216 *
23217 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> D-Bus interface.
23218 *
23219 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
23220 */
23221GDBusInterfaceInfo *
23222button_interface_info (void)
23223{
23224 return (GDBusInterfaceInfo *) &_button_interface_info.parent_struct;
23225}
23226
23227/**
23228 * button_override_properties:
23229 * @klass: The class structure for a #GObject<!-- -->-derived class.
23230 * @property_id_begin: The property id to assign to the first overridden property.
23231 *
23232 * Overrides all #GObject properties in the #Button interface for a concrete class.
23233 * The properties are overridden in the order they are defined.
23234 *
23235 * Returns: The last property id.
23236 */
23237guint
23238button_override_properties (GObjectClass *klass, guint property_id_begin)
23239{
23240 g_object_class_override_property (klass, property_id_begin++, "state");
23241 return property_id_begin - 1;
23242}
23243
23244
23245
23246/**
23247 * Button:
23248 *
23249 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
23250 */
23251
23252/**
23253 * ButtonIface:
23254 * @parent_iface: The parent interface.
23255 * @handle_is_on: Handler for the #Button::handle-is-on signal.
23256 * @handle_sim_button_long_press: Handler for the #Button::handle-sim-button-long-press signal.
23257 * @handle_sim_button_press: Handler for the #Button::handle-sim-button-press signal.
23258 * @get_state: Getter for the #Button:state property.
23259 * @button_pressed: Handler for the #Button::button-pressed signal.
23260 * @button_pressed_long: Handler for the #Button::button-pressed-long signal.
23261 * @button_release: Handler for the #Button::button-release signal.
23262 *
23263 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
23264 */
23265
23266typedef ButtonIface ButtonInterface;
23267G_DEFINE_INTERFACE (Button, button, G_TYPE_OBJECT);
23268
23269static void
23270button_default_init (ButtonIface *iface)
23271{
23272 /* GObject signals for incoming D-Bus method calls: */
23273 /**
23274 * Button::handle-is-on:
23275 * @object: A #Button.
23276 * @invocation: A #GDBusMethodInvocation.
23277 *
23278 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method.
23279 *
23280 * 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.
23281 *
23282 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
23283 */
23284 g_signal_new ("handle-is-on",
23285 G_TYPE_FROM_INTERFACE (iface),
23286 G_SIGNAL_RUN_LAST,
23287 G_STRUCT_OFFSET (ButtonIface, handle_is_on),
23288 g_signal_accumulator_true_handled,
23289 NULL,
23290 g_cclosure_marshal_generic,
23291 G_TYPE_BOOLEAN,
23292 1,
23293 G_TYPE_DBUS_METHOD_INVOCATION);
23294
23295 /**
23296 * Button::handle-sim-button-press:
23297 * @object: A #Button.
23298 * @invocation: A #GDBusMethodInvocation.
23299 *
23300 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method.
23301 *
23302 * 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.
23303 *
23304 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
23305 */
23306 g_signal_new ("handle-sim-button-press",
23307 G_TYPE_FROM_INTERFACE (iface),
23308 G_SIGNAL_RUN_LAST,
23309 G_STRUCT_OFFSET (ButtonIface, handle_sim_button_press),
23310 g_signal_accumulator_true_handled,
23311 NULL,
23312 g_cclosure_marshal_generic,
23313 G_TYPE_BOOLEAN,
23314 1,
23315 G_TYPE_DBUS_METHOD_INVOCATION);
23316
23317 /**
23318 * Button::handle-sim-button-long-press:
23319 * @object: A #Button.
23320 * @invocation: A #GDBusMethodInvocation.
23321 *
23322 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method.
23323 *
23324 * 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.
23325 *
23326 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
23327 */
23328 g_signal_new ("handle-sim-button-long-press",
23329 G_TYPE_FROM_INTERFACE (iface),
23330 G_SIGNAL_RUN_LAST,
23331 G_STRUCT_OFFSET (ButtonIface, handle_sim_button_long_press),
23332 g_signal_accumulator_true_handled,
23333 NULL,
23334 g_cclosure_marshal_generic,
23335 G_TYPE_BOOLEAN,
23336 1,
23337 G_TYPE_DBUS_METHOD_INVOCATION);
23338
23339 /* GObject signals for received D-Bus signals: */
23340 /**
23341 * Button::button-release:
23342 * @object: A #Button.
23343 *
23344 * 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.
23345 *
23346 * 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.
23347 */
23348 g_signal_new ("button-release",
23349 G_TYPE_FROM_INTERFACE (iface),
23350 G_SIGNAL_RUN_LAST,
23351 G_STRUCT_OFFSET (ButtonIface, button_release),
23352 NULL,
23353 NULL,
23354 g_cclosure_marshal_generic,
23355 G_TYPE_NONE,
23356 0);
23357
23358 /**
23359 * Button::button-pressed:
23360 * @object: A #Button.
23361 *
23362 * 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.
23363 *
23364 * 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.
23365 */
23366 g_signal_new ("button-pressed",
23367 G_TYPE_FROM_INTERFACE (iface),
23368 G_SIGNAL_RUN_LAST,
23369 G_STRUCT_OFFSET (ButtonIface, button_pressed),
23370 NULL,
23371 NULL,
23372 g_cclosure_marshal_generic,
23373 G_TYPE_NONE,
23374 0);
23375
23376 /**
23377 * Button::button-pressed-long:
23378 * @object: A #Button.
23379 *
23380 * 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.
23381 *
23382 * 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.
23383 */
23384 g_signal_new ("button-pressed-long",
23385 G_TYPE_FROM_INTERFACE (iface),
23386 G_SIGNAL_RUN_LAST,
23387 G_STRUCT_OFFSET (ButtonIface, button_pressed_long),
23388 NULL,
23389 NULL,
23390 g_cclosure_marshal_generic,
23391 G_TYPE_NONE,
23392 0);
23393
23394 /* GObject properties for D-Bus properties: */
23395 /**
23396 * Button:state:
23397 *
23398 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link>.
23399 *
23400 * 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.
23401 */
23402 g_object_interface_install_property (iface,
23403 g_param_spec_boolean ("state", "state", "state", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
23404}
23405
23406/**
23407 * button_get_state: (skip)
23408 * @object: A #Button.
23409 *
23410 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property.
23411 *
23412 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
23413 *
23414 * Returns: The property value.
23415 */
23416gboolean
23417button_get_state (Button *object)
23418{
23419 return BUTTON_GET_IFACE (object)->get_state (object);
23420}
23421
23422/**
23423 * button_set_state: (skip)
23424 * @object: A #Button.
23425 * @value: The value to set.
23426 *
23427 * Sets the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property to @value.
23428 *
23429 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
23430 */
23431void
23432button_set_state (Button *object, gboolean value)
23433{
23434 g_object_set (G_OBJECT (object), "state", value, NULL);
23435}
23436
23437/**
23438 * button_emit_button_release:
23439 * @object: A #Button.
23440 *
23441 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonRelease">"ButtonRelease"</link> D-Bus signal.
23442 */
23443void
23444button_emit_button_release (
23445 Button *object)
23446{
23447 g_signal_emit_by_name (object, "button-release");
23448}
23449
23450/**
23451 * button_emit_button_pressed:
23452 * @object: A #Button.
23453 *
23454 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressed">"ButtonPressed"</link> D-Bus signal.
23455 */
23456void
23457button_emit_button_pressed (
23458 Button *object)
23459{
23460 g_signal_emit_by_name (object, "button-pressed");
23461}
23462
23463/**
23464 * button_emit_button_pressed_long:
23465 * @object: A #Button.
23466 *
23467 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressedLong">"ButtonPressedLong"</link> D-Bus signal.
23468 */
23469void
23470button_emit_button_pressed_long (
23471 Button *object)
23472{
23473 g_signal_emit_by_name (object, "button-pressed-long");
23474}
23475
23476/**
23477 * button_call_is_on:
23478 * @proxy: A #ButtonProxy.
23479 * @cancellable: (allow-none): A #GCancellable or %NULL.
23480 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
23481 * @user_data: User data to pass to @callback.
23482 *
23483 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method on @proxy.
23484 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
23485 * You can then call button_call_is_on_finish() to get the result of the operation.
23486 *
23487 * See button_call_is_on_sync() for the synchronous, blocking version of this method.
23488 */
23489void
23490button_call_is_on (
23491 Button *proxy,
23492 GCancellable *cancellable,
23493 GAsyncReadyCallback callback,
23494 gpointer user_data)
23495{
23496 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
23497 "isOn",
23498 g_variant_new ("()"),
23499 G_DBUS_CALL_FLAGS_NONE,
23500 -1,
23501 cancellable,
23502 callback,
23503 user_data);
23504}
23505
23506/**
23507 * button_call_is_on_finish:
23508 * @proxy: A #ButtonProxy.
23509 * @out_state: (out): Return location for return parameter or %NULL to ignore.
23510 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_is_on().
23511 * @error: Return location for error or %NULL.
23512 *
23513 * Finishes an operation started with button_call_is_on().
23514 *
23515 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23516 */
23517gboolean
23518button_call_is_on_finish (
23519 Button *proxy,
23520 gboolean *out_state,
23521 GAsyncResult *res,
23522 GError **error)
23523{
23524 GVariant *_ret;
23525 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
23526 if (_ret == NULL)
23527 goto _out;
23528 g_variant_get (_ret,
23529 "(b)",
23530 out_state);
23531 g_variant_unref (_ret);
23532_out:
23533 return _ret != NULL;
23534}
23535
23536/**
23537 * button_call_is_on_sync:
23538 * @proxy: A #ButtonProxy.
23539 * @out_state: (out): Return location for return parameter or %NULL to ignore.
23540 * @cancellable: (allow-none): A #GCancellable or %NULL.
23541 * @error: Return location for error or %NULL.
23542 *
23543 * 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.
23544 *
23545 * See button_call_is_on() for the asynchronous version of this method.
23546 *
23547 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23548 */
23549gboolean
23550button_call_is_on_sync (
23551 Button *proxy,
23552 gboolean *out_state,
23553 GCancellable *cancellable,
23554 GError **error)
23555{
23556 GVariant *_ret;
23557 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
23558 "isOn",
23559 g_variant_new ("()"),
23560 G_DBUS_CALL_FLAGS_NONE,
23561 -1,
23562 cancellable,
23563 error);
23564 if (_ret == NULL)
23565 goto _out;
23566 g_variant_get (_ret,
23567 "(b)",
23568 out_state);
23569 g_variant_unref (_ret);
23570_out:
23571 return _ret != NULL;
23572}
23573
23574/**
23575 * button_call_sim_button_press:
23576 * @proxy: A #ButtonProxy.
23577 * @cancellable: (allow-none): A #GCancellable or %NULL.
23578 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
23579 * @user_data: User data to pass to @callback.
23580 *
23581 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method on @proxy.
23582 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
23583 * You can then call button_call_sim_button_press_finish() to get the result of the operation.
23584 *
23585 * See button_call_sim_button_press_sync() for the synchronous, blocking version of this method.
23586 */
23587void
23588button_call_sim_button_press (
23589 Button *proxy,
23590 GCancellable *cancellable,
23591 GAsyncReadyCallback callback,
23592 gpointer user_data)
23593{
23594 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
23595 "simButtonPress",
23596 g_variant_new ("()"),
23597 G_DBUS_CALL_FLAGS_NONE,
23598 -1,
23599 cancellable,
23600 callback,
23601 user_data);
23602}
23603
23604/**
23605 * button_call_sim_button_press_finish:
23606 * @proxy: A #ButtonProxy.
23607 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_button_press().
23608 * @error: Return location for error or %NULL.
23609 *
23610 * Finishes an operation started with button_call_sim_button_press().
23611 *
23612 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23613 */
23614gboolean
23615button_call_sim_button_press_finish (
23616 Button *proxy,
23617 GAsyncResult *res,
23618 GError **error)
23619{
23620 GVariant *_ret;
23621 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
23622 if (_ret == NULL)
23623 goto _out;
23624 g_variant_get (_ret,
23625 "()");
23626 g_variant_unref (_ret);
23627_out:
23628 return _ret != NULL;
23629}
23630
23631/**
23632 * button_call_sim_button_press_sync:
23633 * @proxy: A #ButtonProxy.
23634 * @cancellable: (allow-none): A #GCancellable or %NULL.
23635 * @error: Return location for error or %NULL.
23636 *
23637 * 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.
23638 *
23639 * See button_call_sim_button_press() for the asynchronous version of this method.
23640 *
23641 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23642 */
23643gboolean
23644button_call_sim_button_press_sync (
23645 Button *proxy,
23646 GCancellable *cancellable,
23647 GError **error)
23648{
23649 GVariant *_ret;
23650 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
23651 "simButtonPress",
23652 g_variant_new ("()"),
23653 G_DBUS_CALL_FLAGS_NONE,
23654 -1,
23655 cancellable,
23656 error);
23657 if (_ret == NULL)
23658 goto _out;
23659 g_variant_get (_ret,
23660 "()");
23661 g_variant_unref (_ret);
23662_out:
23663 return _ret != NULL;
23664}
23665
23666/**
23667 * button_call_sim_button_long_press:
23668 * @proxy: A #ButtonProxy.
23669 * @cancellable: (allow-none): A #GCancellable or %NULL.
23670 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
23671 * @user_data: User data to pass to @callback.
23672 *
23673 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method on @proxy.
23674 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
23675 * You can then call button_call_sim_button_long_press_finish() to get the result of the operation.
23676 *
23677 * See button_call_sim_button_long_press_sync() for the synchronous, blocking version of this method.
23678 */
23679void
23680button_call_sim_button_long_press (
23681 Button *proxy,
23682 GCancellable *cancellable,
23683 GAsyncReadyCallback callback,
23684 gpointer user_data)
23685{
23686 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
23687 "simButtonLongPress",
23688 g_variant_new ("()"),
23689 G_DBUS_CALL_FLAGS_NONE,
23690 -1,
23691 cancellable,
23692 callback,
23693 user_data);
23694}
23695
23696/**
23697 * button_call_sim_button_long_press_finish:
23698 * @proxy: A #ButtonProxy.
23699 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_button_long_press().
23700 * @error: Return location for error or %NULL.
23701 *
23702 * Finishes an operation started with button_call_sim_button_long_press().
23703 *
23704 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23705 */
23706gboolean
23707button_call_sim_button_long_press_finish (
23708 Button *proxy,
23709 GAsyncResult *res,
23710 GError **error)
23711{
23712 GVariant *_ret;
23713 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
23714 if (_ret == NULL)
23715 goto _out;
23716 g_variant_get (_ret,
23717 "()");
23718 g_variant_unref (_ret);
23719_out:
23720 return _ret != NULL;
23721}
23722
23723/**
23724 * button_call_sim_button_long_press_sync:
23725 * @proxy: A #ButtonProxy.
23726 * @cancellable: (allow-none): A #GCancellable or %NULL.
23727 * @error: Return location for error or %NULL.
23728 *
23729 * 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.
23730 *
23731 * See button_call_sim_button_long_press() for the asynchronous version of this method.
23732 *
23733 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23734 */
23735gboolean
23736button_call_sim_button_long_press_sync (
23737 Button *proxy,
23738 GCancellable *cancellable,
23739 GError **error)
23740{
23741 GVariant *_ret;
23742 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
23743 "simButtonLongPress",
23744 g_variant_new ("()"),
23745 G_DBUS_CALL_FLAGS_NONE,
23746 -1,
23747 cancellable,
23748 error);
23749 if (_ret == NULL)
23750 goto _out;
23751 g_variant_get (_ret,
23752 "()");
23753 g_variant_unref (_ret);
23754_out:
23755 return _ret != NULL;
23756}
23757
23758/**
23759 * button_complete_is_on:
23760 * @object: A #Button.
23761 * @invocation: (transfer full): A #GDBusMethodInvocation.
23762 * @state: Parameter to return.
23763 *
23764 * 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.
23765 *
23766 * This method will free @invocation, you cannot use it afterwards.
23767 */
23768void
23769button_complete_is_on (
23770 Button *object,
23771 GDBusMethodInvocation *invocation,
23772 gboolean state)
23773{
23774 g_dbus_method_invocation_return_value (invocation,
23775 g_variant_new ("(b)",
23776 state));
23777}
23778
23779/**
23780 * button_complete_sim_button_press:
23781 * @object: A #Button.
23782 * @invocation: (transfer full): A #GDBusMethodInvocation.
23783 *
23784 * 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.
23785 *
23786 * This method will free @invocation, you cannot use it afterwards.
23787 */
23788void
23789button_complete_sim_button_press (
23790 Button *object,
23791 GDBusMethodInvocation *invocation)
23792{
23793 g_dbus_method_invocation_return_value (invocation,
23794 g_variant_new ("()"));
23795}
23796
23797/**
23798 * button_complete_sim_button_long_press:
23799 * @object: A #Button.
23800 * @invocation: (transfer full): A #GDBusMethodInvocation.
23801 *
23802 * 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.
23803 *
23804 * This method will free @invocation, you cannot use it afterwards.
23805 */
23806void
23807button_complete_sim_button_long_press (
23808 Button *object,
23809 GDBusMethodInvocation *invocation)
23810{
23811 g_dbus_method_invocation_return_value (invocation,
23812 g_variant_new ("()"));
23813}
23814
23815/* ------------------------------------------------------------------------ */
23816
23817/**
23818 * ButtonProxy:
23819 *
23820 * The #ButtonProxy structure contains only private data and should only be accessed using the provided API.
23821 */
23822
23823/**
23824 * ButtonProxyClass:
23825 * @parent_class: The parent class.
23826 *
23827 * Class structure for #ButtonProxy.
23828 */
23829
23830struct _ButtonProxyPrivate
23831{
23832 GData *qdata;
23833};
23834
23835static void button_proxy_iface_init (ButtonIface *iface);
23836
23837#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23838G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
23839 G_ADD_PRIVATE (ButtonProxy)
23840 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
23841
23842#else
23843G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
23844 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
23845
23846#endif
23847static void
23848button_proxy_finalize (GObject *object)
23849{
23850 ButtonProxy *proxy = BUTTON_PROXY (object);
23851 g_datalist_clear (&proxy->priv->qdata);
23852 G_OBJECT_CLASS (button_proxy_parent_class)->finalize (object);
23853}
23854
23855static void
23856button_proxy_get_property (GObject *object,
23857 guint prop_id,
23858 GValue *value,
23859 GParamSpec *pspec G_GNUC_UNUSED)
23860{
23861 const _ExtendedGDBusPropertyInfo *info;
23862 GVariant *variant;
23863 g_assert (prop_id != 0 && prop_id - 1 < 1);
23864 info = _button_property_info_pointers[prop_id - 1];
23865 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
23866 if (info->use_gvariant)
23867 {
23868 g_value_set_variant (value, variant);
23869 }
23870 else
23871 {
23872 if (variant != NULL)
23873 g_dbus_gvariant_to_gvalue (variant, value);
23874 }
23875 if (variant != NULL)
23876 g_variant_unref (variant);
23877}
23878
23879static void
23880button_proxy_set_property_cb (GDBusProxy *proxy,
23881 GAsyncResult *res,
23882 gpointer user_data)
23883{
23884 const _ExtendedGDBusPropertyInfo *info = user_data;
23885 GError *error;
23886 GVariant *_ret;
23887 error = NULL;
23888 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
23889 if (!_ret)
23890 {
23891 g_warning ("Error setting property '%s' on interface org.openbmc.Button: %s (%s, %d)",
23892 info->parent_struct.name,
23893 error->message, g_quark_to_string (error->domain), error->code);
23894 g_error_free (error);
23895 }
23896 else
23897 {
23898 g_variant_unref (_ret);
23899 }
23900}
23901
23902static void
23903button_proxy_set_property (GObject *object,
23904 guint prop_id,
23905 const GValue *value,
23906 GParamSpec *pspec G_GNUC_UNUSED)
23907{
23908 const _ExtendedGDBusPropertyInfo *info;
23909 GVariant *variant;
23910 g_assert (prop_id != 0 && prop_id - 1 < 1);
23911 info = _button_property_info_pointers[prop_id - 1];
23912 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
23913 g_dbus_proxy_call (G_DBUS_PROXY (object),
23914 "org.freedesktop.DBus.Properties.Set",
23915 g_variant_new ("(ssv)", "org.openbmc.Button", info->parent_struct.name, variant),
23916 G_DBUS_CALL_FLAGS_NONE,
23917 -1,
23918 NULL, (GAsyncReadyCallback) button_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
23919 g_variant_unref (variant);
23920}
23921
23922static void
23923button_proxy_g_signal (GDBusProxy *proxy,
23924 const gchar *sender_name G_GNUC_UNUSED,
23925 const gchar *signal_name,
23926 GVariant *parameters)
23927{
23928 _ExtendedGDBusSignalInfo *info;
23929 GVariantIter iter;
23930 GVariant *child;
23931 GValue *paramv;
23932 guint num_params;
23933 guint n;
23934 guint signal_id;
23935 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, signal_name);
23936 if (info == NULL)
23937 return;
23938 num_params = g_variant_n_children (parameters);
23939 paramv = g_new0 (GValue, num_params + 1);
23940 g_value_init (&paramv[0], TYPE_BUTTON);
23941 g_value_set_object (&paramv[0], proxy);
23942 g_variant_iter_init (&iter, parameters);
23943 n = 1;
23944 while ((child = g_variant_iter_next_value (&iter)) != NULL)
23945 {
23946 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
23947 if (arg_info->use_gvariant)
23948 {
23949 g_value_init (&paramv[n], G_TYPE_VARIANT);
23950 g_value_set_variant (&paramv[n], child);
23951 n++;
23952 }
23953 else
23954 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
23955 g_variant_unref (child);
23956 }
23957 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
23958 g_signal_emitv (paramv, signal_id, 0, NULL);
23959 for (n = 0; n < num_params + 1; n++)
23960 g_value_unset (&paramv[n]);
23961 g_free (paramv);
23962}
23963
23964static void
23965button_proxy_g_properties_changed (GDBusProxy *_proxy,
23966 GVariant *changed_properties,
23967 const gchar *const *invalidated_properties)
23968{
23969 ButtonProxy *proxy = BUTTON_PROXY (_proxy);
23970 guint n;
23971 const gchar *key;
23972 GVariantIter *iter;
23973 _ExtendedGDBusPropertyInfo *info;
23974 g_variant_get (changed_properties, "a{sv}", &iter);
23975 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
23976 {
23977 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, key);
23978 g_datalist_remove_data (&proxy->priv->qdata, key);
23979 if (info != NULL)
23980 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
23981 }
23982 g_variant_iter_free (iter);
23983 for (n = 0; invalidated_properties[n] != NULL; n++)
23984 {
23985 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, invalidated_properties[n]);
23986 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
23987 if (info != NULL)
23988 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
23989 }
23990}
23991
23992static gboolean
23993button_proxy_get_state (Button *object)
23994{
23995 ButtonProxy *proxy = BUTTON_PROXY (object);
23996 GVariant *variant;
23997 gboolean value = 0;
23998 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
23999 if (variant != NULL)
24000 {
24001 value = g_variant_get_boolean (variant);
24002 g_variant_unref (variant);
24003 }
24004 return value;
24005}
24006
24007static void
24008button_proxy_init (ButtonProxy *proxy)
24009{
24010#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
24011 proxy->priv = button_proxy_get_instance_private (proxy);
24012#else
24013 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_BUTTON_PROXY, ButtonProxyPrivate);
24014#endif
24015
24016 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), button_interface_info ());
24017}
24018
24019static void
24020button_proxy_class_init (ButtonProxyClass *klass)
24021{
24022 GObjectClass *gobject_class;
24023 GDBusProxyClass *proxy_class;
24024
24025 gobject_class = G_OBJECT_CLASS (klass);
24026 gobject_class->finalize = button_proxy_finalize;
24027 gobject_class->get_property = button_proxy_get_property;
24028 gobject_class->set_property = button_proxy_set_property;
24029
24030 proxy_class = G_DBUS_PROXY_CLASS (klass);
24031 proxy_class->g_signal = button_proxy_g_signal;
24032 proxy_class->g_properties_changed = button_proxy_g_properties_changed;
24033
24034 button_override_properties (gobject_class, 1);
24035
24036#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
24037 g_type_class_add_private (klass, sizeof (ButtonProxyPrivate));
24038#endif
24039}
24040
24041static void
24042button_proxy_iface_init (ButtonIface *iface)
24043{
24044 iface->get_state = button_proxy_get_state;
24045}
24046
24047/**
24048 * button_proxy_new:
24049 * @connection: A #GDBusConnection.
24050 * @flags: Flags from the #GDBusProxyFlags enumeration.
24051 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
24052 * @object_path: An object path.
24053 * @cancellable: (allow-none): A #GCancellable or %NULL.
24054 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
24055 * @user_data: User data to pass to @callback.
24056 *
24057 * 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.
24058 *
24059 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
24060 * You can then call button_proxy_new_finish() to get the result of the operation.
24061 *
24062 * See button_proxy_new_sync() for the synchronous, blocking version of this constructor.
24063 */
24064void
24065button_proxy_new (
24066 GDBusConnection *connection,
24067 GDBusProxyFlags flags,
24068 const gchar *name,
24069 const gchar *object_path,
24070 GCancellable *cancellable,
24071 GAsyncReadyCallback callback,
24072 gpointer user_data)
24073{
24074 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);
24075}
24076
24077/**
24078 * button_proxy_new_finish:
24079 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new().
24080 * @error: Return location for error or %NULL
24081 *
24082 * Finishes an operation started with button_proxy_new().
24083 *
24084 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
24085 */
24086Button *
24087button_proxy_new_finish (
24088 GAsyncResult *res,
24089 GError **error)
24090{
24091 GObject *ret;
24092 GObject *source_object;
24093 source_object = g_async_result_get_source_object (res);
24094 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
24095 g_object_unref (source_object);
24096 if (ret != NULL)
24097 return BUTTON (ret);
24098 else
24099 return NULL;
24100}
24101
24102/**
24103 * button_proxy_new_sync:
24104 * @connection: A #GDBusConnection.
24105 * @flags: Flags from the #GDBusProxyFlags enumeration.
24106 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
24107 * @object_path: An object path.
24108 * @cancellable: (allow-none): A #GCancellable or %NULL.
24109 * @error: Return location for error or %NULL
24110 *
24111 * 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.
24112 *
24113 * The calling thread is blocked until a reply is received.
24114 *
24115 * See button_proxy_new() for the asynchronous version of this constructor.
24116 *
24117 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
24118 */
24119Button *
24120button_proxy_new_sync (
24121 GDBusConnection *connection,
24122 GDBusProxyFlags flags,
24123 const gchar *name,
24124 const gchar *object_path,
24125 GCancellable *cancellable,
24126 GError **error)
24127{
24128 GInitable *ret;
24129 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);
24130 if (ret != NULL)
24131 return BUTTON (ret);
24132 else
24133 return NULL;
24134}
24135
24136
24137/**
24138 * button_proxy_new_for_bus:
24139 * @bus_type: A #GBusType.
24140 * @flags: Flags from the #GDBusProxyFlags enumeration.
24141 * @name: A bus name (well-known or unique).
24142 * @object_path: An object path.
24143 * @cancellable: (allow-none): A #GCancellable or %NULL.
24144 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
24145 * @user_data: User data to pass to @callback.
24146 *
24147 * Like button_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
24148 *
24149 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
24150 * You can then call button_proxy_new_for_bus_finish() to get the result of the operation.
24151 *
24152 * See button_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
24153 */
24154void
24155button_proxy_new_for_bus (
24156 GBusType bus_type,
24157 GDBusProxyFlags flags,
24158 const gchar *name,
24159 const gchar *object_path,
24160 GCancellable *cancellable,
24161 GAsyncReadyCallback callback,
24162 gpointer user_data)
24163{
24164 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);
24165}
24166
24167/**
24168 * button_proxy_new_for_bus_finish:
24169 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new_for_bus().
24170 * @error: Return location for error or %NULL
24171 *
24172 * Finishes an operation started with button_proxy_new_for_bus().
24173 *
24174 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
24175 */
24176Button *
24177button_proxy_new_for_bus_finish (
24178 GAsyncResult *res,
24179 GError **error)
24180{
24181 GObject *ret;
24182 GObject *source_object;
24183 source_object = g_async_result_get_source_object (res);
24184 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
24185 g_object_unref (source_object);
24186 if (ret != NULL)
24187 return BUTTON (ret);
24188 else
24189 return NULL;
24190}
24191
24192/**
24193 * button_proxy_new_for_bus_sync:
24194 * @bus_type: A #GBusType.
24195 * @flags: Flags from the #GDBusProxyFlags enumeration.
24196 * @name: A bus name (well-known or unique).
24197 * @object_path: An object path.
24198 * @cancellable: (allow-none): A #GCancellable or %NULL.
24199 * @error: Return location for error or %NULL
24200 *
24201 * Like button_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
24202 *
24203 * The calling thread is blocked until a reply is received.
24204 *
24205 * See button_proxy_new_for_bus() for the asynchronous version of this constructor.
24206 *
24207 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
24208 */
24209Button *
24210button_proxy_new_for_bus_sync (
24211 GBusType bus_type,
24212 GDBusProxyFlags flags,
24213 const gchar *name,
24214 const gchar *object_path,
24215 GCancellable *cancellable,
24216 GError **error)
24217{
24218 GInitable *ret;
24219 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);
24220 if (ret != NULL)
24221 return BUTTON (ret);
24222 else
24223 return NULL;
24224}
24225
24226
24227/* ------------------------------------------------------------------------ */
24228
24229/**
24230 * ButtonSkeleton:
24231 *
24232 * The #ButtonSkeleton structure contains only private data and should only be accessed using the provided API.
24233 */
24234
24235/**
24236 * ButtonSkeletonClass:
24237 * @parent_class: The parent class.
24238 *
24239 * Class structure for #ButtonSkeleton.
24240 */
24241
24242struct _ButtonSkeletonPrivate
24243{
24244 GValue *properties;
24245 GList *changed_properties;
24246 GSource *changed_properties_idle_source;
24247 GMainContext *context;
24248 GMutex lock;
24249};
24250
24251static void
24252_button_skeleton_handle_method_call (
24253 GDBusConnection *connection G_GNUC_UNUSED,
24254 const gchar *sender G_GNUC_UNUSED,
24255 const gchar *object_path G_GNUC_UNUSED,
24256 const gchar *interface_name,
24257 const gchar *method_name,
24258 GVariant *parameters,
24259 GDBusMethodInvocation *invocation,
24260 gpointer user_data)
24261{
24262 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
24263 _ExtendedGDBusMethodInfo *info;
24264 GVariantIter iter;
24265 GVariant *child;
24266 GValue *paramv;
24267 guint num_params;
24268 guint num_extra;
24269 guint n;
24270 guint signal_id;
24271 GValue return_value = G_VALUE_INIT;
24272 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
24273 g_assert (info != NULL);
24274 num_params = g_variant_n_children (parameters);
24275 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
24276 n = 0;
24277 g_value_init (&paramv[n], TYPE_BUTTON);
24278 g_value_set_object (&paramv[n++], skeleton);
24279 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
24280 g_value_set_object (&paramv[n++], invocation);
24281 if (info->pass_fdlist)
24282 {
24283#ifdef G_OS_UNIX
24284 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
24285 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
24286#else
24287 g_assert_not_reached ();
24288#endif
24289 }
24290 g_variant_iter_init (&iter, parameters);
24291 while ((child = g_variant_iter_next_value (&iter)) != NULL)
24292 {
24293 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
24294 if (arg_info->use_gvariant)
24295 {
24296 g_value_init (&paramv[n], G_TYPE_VARIANT);
24297 g_value_set_variant (&paramv[n], child);
24298 n++;
24299 }
24300 else
24301 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
24302 g_variant_unref (child);
24303 }
24304 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
24305 g_value_init (&return_value, G_TYPE_BOOLEAN);
24306 g_signal_emitv (paramv, signal_id, 0, &return_value);
24307 if (!g_value_get_boolean (&return_value))
24308 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);
24309 g_value_unset (&return_value);
24310 for (n = 0; n < num_params + num_extra; n++)
24311 g_value_unset (&paramv[n]);
24312 g_free (paramv);
24313}
24314
24315static GVariant *
24316_button_skeleton_handle_get_property (
24317 GDBusConnection *connection G_GNUC_UNUSED,
24318 const gchar *sender G_GNUC_UNUSED,
24319 const gchar *object_path G_GNUC_UNUSED,
24320 const gchar *interface_name G_GNUC_UNUSED,
24321 const gchar *property_name,
24322 GError **error,
24323 gpointer user_data)
24324{
24325 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
24326 GValue value = G_VALUE_INIT;
24327 GParamSpec *pspec;
24328 _ExtendedGDBusPropertyInfo *info;
24329 GVariant *ret;
24330 ret = NULL;
24331 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
24332 g_assert (info != NULL);
24333 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
24334 if (pspec == NULL)
24335 {
24336 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
24337 }
24338 else
24339 {
24340 g_value_init (&value, pspec->value_type);
24341 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
24342 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
24343 g_value_unset (&value);
24344 }
24345 return ret;
24346}
24347
24348static gboolean
24349_button_skeleton_handle_set_property (
24350 GDBusConnection *connection G_GNUC_UNUSED,
24351 const gchar *sender G_GNUC_UNUSED,
24352 const gchar *object_path G_GNUC_UNUSED,
24353 const gchar *interface_name G_GNUC_UNUSED,
24354 const gchar *property_name,
24355 GVariant *variant,
24356 GError **error,
24357 gpointer user_data)
24358{
24359 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
24360 GValue value = G_VALUE_INIT;
24361 GParamSpec *pspec;
24362 _ExtendedGDBusPropertyInfo *info;
24363 gboolean ret;
24364 ret = FALSE;
24365 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
24366 g_assert (info != NULL);
24367 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
24368 if (pspec == NULL)
24369 {
24370 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
24371 }
24372 else
24373 {
24374 if (info->use_gvariant)
24375 g_value_set_variant (&value, variant);
24376 else
24377 g_dbus_gvariant_to_gvalue (variant, &value);
24378 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
24379 g_value_unset (&value);
24380 ret = TRUE;
24381 }
24382 return ret;
24383}
24384
24385static const GDBusInterfaceVTable _button_skeleton_vtable =
24386{
24387 _button_skeleton_handle_method_call,
24388 _button_skeleton_handle_get_property,
24389 _button_skeleton_handle_set_property,
24390 {NULL}
24391};
24392
24393static GDBusInterfaceInfo *
24394button_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
24395{
24396 return button_interface_info ();
24397}
24398
24399static GDBusInterfaceVTable *
24400button_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
24401{
24402 return (GDBusInterfaceVTable *) &_button_skeleton_vtable;
24403}
24404
24405static GVariant *
24406button_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
24407{
24408 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
24409
24410 GVariantBuilder builder;
24411 guint n;
24412 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
24413 if (_button_interface_info.parent_struct.properties == NULL)
24414 goto out;
24415 for (n = 0; _button_interface_info.parent_struct.properties[n] != NULL; n++)
24416 {
24417 GDBusPropertyInfo *info = _button_interface_info.parent_struct.properties[n];
24418 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
24419 {
24420 GVariant *value;
24421 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);
24422 if (value != NULL)
24423 {
24424 g_variant_take_ref (value);
24425 g_variant_builder_add (&builder, "{sv}", info->name, value);
24426 g_variant_unref (value);
24427 }
24428 }
24429 }
24430out:
24431 return g_variant_builder_end (&builder);
24432}
24433
24434static gboolean _button_emit_changed (gpointer user_data);
24435
24436static void
24437button_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
24438{
24439 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
24440 gboolean emit_changed = FALSE;
24441
24442 g_mutex_lock (&skeleton->priv->lock);
24443 if (skeleton->priv->changed_properties_idle_source != NULL)
24444 {
24445 g_source_destroy (skeleton->priv->changed_properties_idle_source);
24446 skeleton->priv->changed_properties_idle_source = NULL;
24447 emit_changed = TRUE;
24448 }
24449 g_mutex_unlock (&skeleton->priv->lock);
24450
24451 if (emit_changed)
24452 _button_emit_changed (skeleton);
24453}
24454
24455static void
24456_button_on_signal_button_release (
24457 Button *object)
24458{
24459 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
24460
24461 GList *connections, *l;
24462 GVariant *signal_variant;
24463 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
24464
24465 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
24466 for (l = connections; l != NULL; l = l->next)
24467 {
24468 GDBusConnection *connection = l->data;
24469 g_dbus_connection_emit_signal (connection,
24470 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonRelease",
24471 signal_variant, NULL);
24472 }
24473 g_variant_unref (signal_variant);
24474 g_list_free_full (connections, g_object_unref);
24475}
24476
24477static void
24478_button_on_signal_button_pressed (
24479 Button *object)
24480{
24481 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
24482
24483 GList *connections, *l;
24484 GVariant *signal_variant;
24485 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
24486
24487 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
24488 for (l = connections; l != NULL; l = l->next)
24489 {
24490 GDBusConnection *connection = l->data;
24491 g_dbus_connection_emit_signal (connection,
24492 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonPressed",
24493 signal_variant, NULL);
24494 }
24495 g_variant_unref (signal_variant);
24496 g_list_free_full (connections, g_object_unref);
24497}
24498
24499static void
24500_button_on_signal_button_pressed_long (
24501 Button *object)
24502{
24503 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
24504
24505 GList *connections, *l;
24506 GVariant *signal_variant;
24507 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
24508
24509 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
24510 for (l = connections; l != NULL; l = l->next)
24511 {
24512 GDBusConnection *connection = l->data;
24513 g_dbus_connection_emit_signal (connection,
24514 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonPressedLong",
24515 signal_variant, NULL);
24516 }
24517 g_variant_unref (signal_variant);
24518 g_list_free_full (connections, g_object_unref);
24519}
24520
24521static void button_skeleton_iface_init (ButtonIface *iface);
24522#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
24523G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
24524 G_ADD_PRIVATE (ButtonSkeleton)
24525 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
24526
24527#else
24528G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
24529 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
24530
24531#endif
24532static void
24533button_skeleton_finalize (GObject *object)
24534{
24535 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
24536 guint n;
24537 for (n = 0; n < 1; n++)
24538 g_value_unset (&skeleton->priv->properties[n]);
24539 g_free (skeleton->priv->properties);
24540 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
24541 if (skeleton->priv->changed_properties_idle_source != NULL)
24542 g_source_destroy (skeleton->priv->changed_properties_idle_source);
24543 g_main_context_unref (skeleton->priv->context);
24544 g_mutex_clear (&skeleton->priv->lock);
24545 G_OBJECT_CLASS (button_skeleton_parent_class)->finalize (object);
24546}
24547
24548static void
24549button_skeleton_get_property (GObject *object,
24550 guint prop_id,
24551 GValue *value,
24552 GParamSpec *pspec G_GNUC_UNUSED)
24553{
24554 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
24555 g_assert (prop_id != 0 && prop_id - 1 < 1);
24556 g_mutex_lock (&skeleton->priv->lock);
24557 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
24558 g_mutex_unlock (&skeleton->priv->lock);
24559}
24560
24561static gboolean
24562_button_emit_changed (gpointer user_data)
24563{
24564 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
24565 GList *l;
24566 GVariantBuilder builder;
24567 GVariantBuilder invalidated_builder;
24568 guint num_changes;
24569
24570 g_mutex_lock (&skeleton->priv->lock);
24571 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
24572 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
24573 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
24574 {
24575 ChangedProperty *cp = l->data;
24576 GVariant *variant;
24577 const GValue *cur_value;
24578
24579 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
24580 if (!_g_value_equal (cur_value, &cp->orig_value))
24581 {
24582 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
24583 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
24584 g_variant_unref (variant);
24585 num_changes++;
24586 }
24587 }
24588 if (num_changes > 0)
24589 {
24590 GList *connections, *ll;
24591 GVariant *signal_variant;
24592 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Button",
24593 &builder, &invalidated_builder));
24594 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
24595 for (ll = connections; ll != NULL; ll = ll->next)
24596 {
24597 GDBusConnection *connection = ll->data;
24598
24599 g_dbus_connection_emit_signal (connection,
24600 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
24601 "org.freedesktop.DBus.Properties",
24602 "PropertiesChanged",
24603 signal_variant,
24604 NULL);
24605 }
24606 g_variant_unref (signal_variant);
24607 g_list_free_full (connections, g_object_unref);
24608 }
24609 else
24610 {
24611 g_variant_builder_clear (&builder);
24612 g_variant_builder_clear (&invalidated_builder);
24613 }
24614 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
24615 skeleton->priv->changed_properties = NULL;
24616 skeleton->priv->changed_properties_idle_source = NULL;
24617 g_mutex_unlock (&skeleton->priv->lock);
24618 return FALSE;
24619}
24620
24621static void
24622_button_schedule_emit_changed (ButtonSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
24623{
24624 ChangedProperty *cp;
24625 GList *l;
24626 cp = NULL;
24627 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
24628 {
24629 ChangedProperty *i_cp = l->data;
24630 if (i_cp->info == info)
24631 {
24632 cp = i_cp;
24633 break;
24634 }
24635 }
24636 if (cp == NULL)
24637 {
24638 cp = g_new0 (ChangedProperty, 1);
24639 cp->prop_id = prop_id;
24640 cp->info = info;
24641 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
24642 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
24643 g_value_copy (orig_value, &cp->orig_value);
24644 }
24645}
24646
24647static void
24648button_skeleton_notify (GObject *object,
24649 GParamSpec *pspec G_GNUC_UNUSED)
24650{
24651 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
24652 g_mutex_lock (&skeleton->priv->lock);
24653 if (skeleton->priv->changed_properties != NULL &&
24654 skeleton->priv->changed_properties_idle_source == NULL)
24655 {
24656 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
24657 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
24658 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _button_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
24659 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
24660 g_source_unref (skeleton->priv->changed_properties_idle_source);
24661 }
24662 g_mutex_unlock (&skeleton->priv->lock);
24663}
24664
24665static void
24666button_skeleton_set_property (GObject *object,
24667 guint prop_id,
24668 const GValue *value,
24669 GParamSpec *pspec)
24670{
24671 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
24672 g_assert (prop_id != 0 && prop_id - 1 < 1);
24673 g_mutex_lock (&skeleton->priv->lock);
24674 g_object_freeze_notify (object);
24675 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
24676 {
24677 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
24678 _button_schedule_emit_changed (skeleton, _button_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
24679 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
24680 g_object_notify_by_pspec (object, pspec);
24681 }
24682 g_mutex_unlock (&skeleton->priv->lock);
24683 g_object_thaw_notify (object);
24684}
24685
24686static void
24687button_skeleton_init (ButtonSkeleton *skeleton)
24688{
24689#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
24690 skeleton->priv = button_skeleton_get_instance_private (skeleton);
24691#else
24692 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_BUTTON_SKELETON, ButtonSkeletonPrivate);
24693#endif
24694
24695 g_mutex_init (&skeleton->priv->lock);
24696 skeleton->priv->context = g_main_context_ref_thread_default ();
24697 skeleton->priv->properties = g_new0 (GValue, 1);
24698 g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN);
24699}
24700
24701static gboolean
24702button_skeleton_get_state (Button *object)
24703{
24704 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
24705 gboolean value;
24706 g_mutex_lock (&skeleton->priv->lock);
24707 value = g_value_get_boolean (&(skeleton->priv->properties[0]));
24708 g_mutex_unlock (&skeleton->priv->lock);
24709 return value;
24710}
24711
24712static void
24713button_skeleton_class_init (ButtonSkeletonClass *klass)
24714{
24715 GObjectClass *gobject_class;
24716 GDBusInterfaceSkeletonClass *skeleton_class;
24717
24718 gobject_class = G_OBJECT_CLASS (klass);
24719 gobject_class->finalize = button_skeleton_finalize;
24720 gobject_class->get_property = button_skeleton_get_property;
24721 gobject_class->set_property = button_skeleton_set_property;
24722 gobject_class->notify = button_skeleton_notify;
24723
24724
24725 button_override_properties (gobject_class, 1);
24726
24727 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
24728 skeleton_class->get_info = button_skeleton_dbus_interface_get_info;
24729 skeleton_class->get_properties = button_skeleton_dbus_interface_get_properties;
24730 skeleton_class->flush = button_skeleton_dbus_interface_flush;
24731 skeleton_class->get_vtable = button_skeleton_dbus_interface_get_vtable;
24732
24733#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
24734 g_type_class_add_private (klass, sizeof (ButtonSkeletonPrivate));
24735#endif
24736}
24737
24738static void
24739button_skeleton_iface_init (ButtonIface *iface)
24740{
24741 iface->button_release = _button_on_signal_button_release;
24742 iface->button_pressed = _button_on_signal_button_pressed;
24743 iface->button_pressed_long = _button_on_signal_button_pressed_long;
24744 iface->get_state = button_skeleton_get_state;
24745}
24746
24747/**
24748 * button_skeleton_new:
24749 *
24750 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
24751 *
24752 * Returns: (transfer full) (type ButtonSkeleton): The skeleton object.
24753 */
24754Button *
24755button_skeleton_new (void)
24756{
24757 return BUTTON (g_object_new (TYPE_BUTTON_SKELETON, NULL));
24758}
24759
24760/* ------------------------------------------------------------------------
24761 * Code for interface org.openbmc.Led
24762 * ------------------------------------------------------------------------
24763 */
24764
24765/**
24766 * SECTION:Led
24767 * @title: Led
24768 * @short_description: Generated C code for the org.openbmc.Led D-Bus interface
24769 *
24770 * 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.
24771 */
24772
24773/* ---- Introspection data for org.openbmc.Led ---- */
24774
24775static const _ExtendedGDBusMethodInfo _led_method_info_set_on =
24776{
24777 {
24778 -1,
24779 (gchar *) "setOn",
24780 NULL,
24781 NULL,
24782 NULL
24783 },
24784 "handle-set-on",
24785 FALSE
24786};
24787
24788static const _ExtendedGDBusMethodInfo _led_method_info_set_off =
24789{
24790 {
24791 -1,
24792 (gchar *) "setOff",
24793 NULL,
24794 NULL,
24795 NULL
24796 },
24797 "handle-set-off",
24798 FALSE
24799};
24800
24801static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_slow =
24802{
24803 {
24804 -1,
24805 (gchar *) "setBlinkSlow",
24806 NULL,
24807 NULL,
24808 NULL
24809 },
24810 "handle-set-blink-slow",
24811 FALSE
24812};
24813
24814static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_fast =
24815{
24816 {
24817 -1,
24818 (gchar *) "setBlinkFast",
24819 NULL,
24820 NULL,
24821 NULL
24822 },
24823 "handle-set-blink-fast",
24824 FALSE
24825};
24826
24827static const _ExtendedGDBusMethodInfo * const _led_method_info_pointers[] =
24828{
24829 &_led_method_info_set_on,
24830 &_led_method_info_set_off,
24831 &_led_method_info_set_blink_slow,
24832 &_led_method_info_set_blink_fast,
24833 NULL
24834};
24835
24836static const _ExtendedGDBusPropertyInfo _led_property_info_color =
24837{
24838 {
24839 -1,
24840 (gchar *) "color",
24841 (gchar *) "i",
24842 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
24843 NULL
24844 },
24845 "color",
24846 FALSE
24847};
24848
24849static const _ExtendedGDBusPropertyInfo _led_property_info_function =
24850{
24851 {
24852 -1,
24853 (gchar *) "function",
24854 (gchar *) "s",
24855 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
24856 NULL
24857 },
24858 "function",
24859 FALSE
24860};
24861
24862static const _ExtendedGDBusPropertyInfo * const _led_property_info_pointers[] =
24863{
24864 &_led_property_info_color,
24865 &_led_property_info_function,
24866 NULL
24867};
24868
24869static const _ExtendedGDBusInterfaceInfo _led_interface_info =
24870{
24871 {
24872 -1,
24873 (gchar *) "org.openbmc.Led",
24874 (GDBusMethodInfo **) &_led_method_info_pointers,
24875 NULL,
24876 (GDBusPropertyInfo **) &_led_property_info_pointers,
24877 NULL
24878 },
24879 "led",
24880};
24881
24882
24883/**
24884 * led_interface_info:
24885 *
24886 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> D-Bus interface.
24887 *
24888 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
24889 */
24890GDBusInterfaceInfo *
24891led_interface_info (void)
24892{
24893 return (GDBusInterfaceInfo *) &_led_interface_info.parent_struct;
24894}
24895
24896/**
24897 * led_override_properties:
24898 * @klass: The class structure for a #GObject<!-- -->-derived class.
24899 * @property_id_begin: The property id to assign to the first overridden property.
24900 *
24901 * Overrides all #GObject properties in the #Led interface for a concrete class.
24902 * The properties are overridden in the order they are defined.
24903 *
24904 * Returns: The last property id.
24905 */
24906guint
24907led_override_properties (GObjectClass *klass, guint property_id_begin)
24908{
24909 g_object_class_override_property (klass, property_id_begin++, "color");
24910 g_object_class_override_property (klass, property_id_begin++, "function");
24911 return property_id_begin - 1;
24912}
24913
24914
24915
24916/**
24917 * Led:
24918 *
24919 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
24920 */
24921
24922/**
24923 * LedIface:
24924 * @parent_iface: The parent interface.
24925 * @handle_set_blink_fast: Handler for the #Led::handle-set-blink-fast signal.
24926 * @handle_set_blink_slow: Handler for the #Led::handle-set-blink-slow signal.
24927 * @handle_set_off: Handler for the #Led::handle-set-off signal.
24928 * @handle_set_on: Handler for the #Led::handle-set-on signal.
24929 * @get_color: Getter for the #Led:color property.
24930 * @get_function: Getter for the #Led:function property.
24931 *
24932 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
24933 */
24934
24935typedef LedIface LedInterface;
24936G_DEFINE_INTERFACE (Led, led, G_TYPE_OBJECT);
24937
24938static void
24939led_default_init (LedIface *iface)
24940{
24941 /* GObject signals for incoming D-Bus method calls: */
24942 /**
24943 * Led::handle-set-on:
24944 * @object: A #Led.
24945 * @invocation: A #GDBusMethodInvocation.
24946 *
24947 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method.
24948 *
24949 * 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.
24950 *
24951 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
24952 */
24953 g_signal_new ("handle-set-on",
24954 G_TYPE_FROM_INTERFACE (iface),
24955 G_SIGNAL_RUN_LAST,
24956 G_STRUCT_OFFSET (LedIface, handle_set_on),
24957 g_signal_accumulator_true_handled,
24958 NULL,
24959 g_cclosure_marshal_generic,
24960 G_TYPE_BOOLEAN,
24961 1,
24962 G_TYPE_DBUS_METHOD_INVOCATION);
24963
24964 /**
24965 * Led::handle-set-off:
24966 * @object: A #Led.
24967 * @invocation: A #GDBusMethodInvocation.
24968 *
24969 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method.
24970 *
24971 * 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.
24972 *
24973 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
24974 */
24975 g_signal_new ("handle-set-off",
24976 G_TYPE_FROM_INTERFACE (iface),
24977 G_SIGNAL_RUN_LAST,
24978 G_STRUCT_OFFSET (LedIface, handle_set_off),
24979 g_signal_accumulator_true_handled,
24980 NULL,
24981 g_cclosure_marshal_generic,
24982 G_TYPE_BOOLEAN,
24983 1,
24984 G_TYPE_DBUS_METHOD_INVOCATION);
24985
24986 /**
24987 * Led::handle-set-blink-slow:
24988 * @object: A #Led.
24989 * @invocation: A #GDBusMethodInvocation.
24990 *
24991 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method.
24992 *
24993 * 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.
24994 *
24995 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
24996 */
24997 g_signal_new ("handle-set-blink-slow",
24998 G_TYPE_FROM_INTERFACE (iface),
24999 G_SIGNAL_RUN_LAST,
25000 G_STRUCT_OFFSET (LedIface, handle_set_blink_slow),
25001 g_signal_accumulator_true_handled,
25002 NULL,
25003 g_cclosure_marshal_generic,
25004 G_TYPE_BOOLEAN,
25005 1,
25006 G_TYPE_DBUS_METHOD_INVOCATION);
25007
25008 /**
25009 * Led::handle-set-blink-fast:
25010 * @object: A #Led.
25011 * @invocation: A #GDBusMethodInvocation.
25012 *
25013 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method.
25014 *
25015 * 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.
25016 *
25017 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
25018 */
25019 g_signal_new ("handle-set-blink-fast",
25020 G_TYPE_FROM_INTERFACE (iface),
25021 G_SIGNAL_RUN_LAST,
25022 G_STRUCT_OFFSET (LedIface, handle_set_blink_fast),
25023 g_signal_accumulator_true_handled,
25024 NULL,
25025 g_cclosure_marshal_generic,
25026 G_TYPE_BOOLEAN,
25027 1,
25028 G_TYPE_DBUS_METHOD_INVOCATION);
25029
25030 /* GObject properties for D-Bus properties: */
25031 /**
25032 * Led:color:
25033 *
25034 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link>.
25035 *
25036 * 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.
25037 */
25038 g_object_interface_install_property (iface,
25039 g_param_spec_int ("color", "color", "color", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
25040 /**
25041 * Led:function:
25042 *
25043 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link>.
25044 *
25045 * 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.
25046 */
25047 g_object_interface_install_property (iface,
25048 g_param_spec_string ("function", "function", "function", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
25049}
25050
25051/**
25052 * led_get_color: (skip)
25053 * @object: A #Led.
25054 *
25055 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property.
25056 *
25057 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
25058 *
25059 * Returns: The property value.
25060 */
25061gint
25062led_get_color (Led *object)
25063{
25064 return LED_GET_IFACE (object)->get_color (object);
25065}
25066
25067/**
25068 * led_set_color: (skip)
25069 * @object: A #Led.
25070 * @value: The value to set.
25071 *
25072 * Sets the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property to @value.
25073 *
25074 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
25075 */
25076void
25077led_set_color (Led *object, gint value)
25078{
25079 g_object_set (G_OBJECT (object), "color", value, NULL);
25080}
25081
25082/**
25083 * led_get_function: (skip)
25084 * @object: A #Led.
25085 *
25086 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
25087 *
25088 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
25089 *
25090 * <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>
25091 *
25092 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
25093 */
25094const gchar *
25095led_get_function (Led *object)
25096{
25097 return LED_GET_IFACE (object)->get_function (object);
25098}
25099
25100/**
25101 * led_dup_function: (skip)
25102 * @object: A #Led.
25103 *
25104 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
25105 *
25106 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
25107 *
25108 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
25109 */
25110gchar *
25111led_dup_function (Led *object)
25112{
25113 gchar *value;
25114 g_object_get (G_OBJECT (object), "function", &value, NULL);
25115 return value;
25116}
25117
25118/**
25119 * led_set_function: (skip)
25120 * @object: A #Led.
25121 * @value: The value to set.
25122 *
25123 * Sets the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property to @value.
25124 *
25125 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
25126 */
25127void
25128led_set_function (Led *object, const gchar *value)
25129{
25130 g_object_set (G_OBJECT (object), "function", value, NULL);
25131}
25132
25133/**
25134 * led_call_set_on:
25135 * @proxy: A #LedProxy.
25136 * @cancellable: (allow-none): A #GCancellable or %NULL.
25137 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
25138 * @user_data: User data to pass to @callback.
25139 *
25140 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method on @proxy.
25141 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
25142 * You can then call led_call_set_on_finish() to get the result of the operation.
25143 *
25144 * See led_call_set_on_sync() for the synchronous, blocking version of this method.
25145 */
25146void
25147led_call_set_on (
25148 Led *proxy,
25149 GCancellable *cancellable,
25150 GAsyncReadyCallback callback,
25151 gpointer user_data)
25152{
25153 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
25154 "setOn",
25155 g_variant_new ("()"),
25156 G_DBUS_CALL_FLAGS_NONE,
25157 -1,
25158 cancellable,
25159 callback,
25160 user_data);
25161}
25162
25163/**
25164 * led_call_set_on_finish:
25165 * @proxy: A #LedProxy.
25166 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_on().
25167 * @error: Return location for error or %NULL.
25168 *
25169 * Finishes an operation started with led_call_set_on().
25170 *
25171 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
25172 */
25173gboolean
25174led_call_set_on_finish (
25175 Led *proxy,
25176 GAsyncResult *res,
25177 GError **error)
25178{
25179 GVariant *_ret;
25180 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
25181 if (_ret == NULL)
25182 goto _out;
25183 g_variant_get (_ret,
25184 "()");
25185 g_variant_unref (_ret);
25186_out:
25187 return _ret != NULL;
25188}
25189
25190/**
25191 * led_call_set_on_sync:
25192 * @proxy: A #LedProxy.
25193 * @cancellable: (allow-none): A #GCancellable or %NULL.
25194 * @error: Return location for error or %NULL.
25195 *
25196 * 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.
25197 *
25198 * See led_call_set_on() for the asynchronous version of this method.
25199 *
25200 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
25201 */
25202gboolean
25203led_call_set_on_sync (
25204 Led *proxy,
25205 GCancellable *cancellable,
25206 GError **error)
25207{
25208 GVariant *_ret;
25209 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
25210 "setOn",
25211 g_variant_new ("()"),
25212 G_DBUS_CALL_FLAGS_NONE,
25213 -1,
25214 cancellable,
25215 error);
25216 if (_ret == NULL)
25217 goto _out;
25218 g_variant_get (_ret,
25219 "()");
25220 g_variant_unref (_ret);
25221_out:
25222 return _ret != NULL;
25223}
25224
25225/**
25226 * led_call_set_off:
25227 * @proxy: A #LedProxy.
25228 * @cancellable: (allow-none): A #GCancellable or %NULL.
25229 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
25230 * @user_data: User data to pass to @callback.
25231 *
25232 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method on @proxy.
25233 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
25234 * You can then call led_call_set_off_finish() to get the result of the operation.
25235 *
25236 * See led_call_set_off_sync() for the synchronous, blocking version of this method.
25237 */
25238void
25239led_call_set_off (
25240 Led *proxy,
25241 GCancellable *cancellable,
25242 GAsyncReadyCallback callback,
25243 gpointer user_data)
25244{
25245 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
25246 "setOff",
25247 g_variant_new ("()"),
25248 G_DBUS_CALL_FLAGS_NONE,
25249 -1,
25250 cancellable,
25251 callback,
25252 user_data);
25253}
25254
25255/**
25256 * led_call_set_off_finish:
25257 * @proxy: A #LedProxy.
25258 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_off().
25259 * @error: Return location for error or %NULL.
25260 *
25261 * Finishes an operation started with led_call_set_off().
25262 *
25263 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
25264 */
25265gboolean
25266led_call_set_off_finish (
25267 Led *proxy,
25268 GAsyncResult *res,
25269 GError **error)
25270{
25271 GVariant *_ret;
25272 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
25273 if (_ret == NULL)
25274 goto _out;
25275 g_variant_get (_ret,
25276 "()");
25277 g_variant_unref (_ret);
25278_out:
25279 return _ret != NULL;
25280}
25281
25282/**
25283 * led_call_set_off_sync:
25284 * @proxy: A #LedProxy.
25285 * @cancellable: (allow-none): A #GCancellable or %NULL.
25286 * @error: Return location for error or %NULL.
25287 *
25288 * 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.
25289 *
25290 * See led_call_set_off() for the asynchronous version of this method.
25291 *
25292 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
25293 */
25294gboolean
25295led_call_set_off_sync (
25296 Led *proxy,
25297 GCancellable *cancellable,
25298 GError **error)
25299{
25300 GVariant *_ret;
25301 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
25302 "setOff",
25303 g_variant_new ("()"),
25304 G_DBUS_CALL_FLAGS_NONE,
25305 -1,
25306 cancellable,
25307 error);
25308 if (_ret == NULL)
25309 goto _out;
25310 g_variant_get (_ret,
25311 "()");
25312 g_variant_unref (_ret);
25313_out:
25314 return _ret != NULL;
25315}
25316
25317/**
25318 * led_call_set_blink_slow:
25319 * @proxy: A #LedProxy.
25320 * @cancellable: (allow-none): A #GCancellable or %NULL.
25321 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
25322 * @user_data: User data to pass to @callback.
25323 *
25324 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method on @proxy.
25325 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
25326 * You can then call led_call_set_blink_slow_finish() to get the result of the operation.
25327 *
25328 * See led_call_set_blink_slow_sync() for the synchronous, blocking version of this method.
25329 */
25330void
25331led_call_set_blink_slow (
25332 Led *proxy,
25333 GCancellable *cancellable,
25334 GAsyncReadyCallback callback,
25335 gpointer user_data)
25336{
25337 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
25338 "setBlinkSlow",
25339 g_variant_new ("()"),
25340 G_DBUS_CALL_FLAGS_NONE,
25341 -1,
25342 cancellable,
25343 callback,
25344 user_data);
25345}
25346
25347/**
25348 * led_call_set_blink_slow_finish:
25349 * @proxy: A #LedProxy.
25350 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_slow().
25351 * @error: Return location for error or %NULL.
25352 *
25353 * Finishes an operation started with led_call_set_blink_slow().
25354 *
25355 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
25356 */
25357gboolean
25358led_call_set_blink_slow_finish (
25359 Led *proxy,
25360 GAsyncResult *res,
25361 GError **error)
25362{
25363 GVariant *_ret;
25364 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
25365 if (_ret == NULL)
25366 goto _out;
25367 g_variant_get (_ret,
25368 "()");
25369 g_variant_unref (_ret);
25370_out:
25371 return _ret != NULL;
25372}
25373
25374/**
25375 * led_call_set_blink_slow_sync:
25376 * @proxy: A #LedProxy.
25377 * @cancellable: (allow-none): A #GCancellable or %NULL.
25378 * @error: Return location for error or %NULL.
25379 *
25380 * 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.
25381 *
25382 * See led_call_set_blink_slow() for the asynchronous version of this method.
25383 *
25384 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
25385 */
25386gboolean
25387led_call_set_blink_slow_sync (
25388 Led *proxy,
25389 GCancellable *cancellable,
25390 GError **error)
25391{
25392 GVariant *_ret;
25393 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
25394 "setBlinkSlow",
25395 g_variant_new ("()"),
25396 G_DBUS_CALL_FLAGS_NONE,
25397 -1,
25398 cancellable,
25399 error);
25400 if (_ret == NULL)
25401 goto _out;
25402 g_variant_get (_ret,
25403 "()");
25404 g_variant_unref (_ret);
25405_out:
25406 return _ret != NULL;
25407}
25408
25409/**
25410 * led_call_set_blink_fast:
25411 * @proxy: A #LedProxy.
25412 * @cancellable: (allow-none): A #GCancellable or %NULL.
25413 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
25414 * @user_data: User data to pass to @callback.
25415 *
25416 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method on @proxy.
25417 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
25418 * You can then call led_call_set_blink_fast_finish() to get the result of the operation.
25419 *
25420 * See led_call_set_blink_fast_sync() for the synchronous, blocking version of this method.
25421 */
25422void
25423led_call_set_blink_fast (
25424 Led *proxy,
25425 GCancellable *cancellable,
25426 GAsyncReadyCallback callback,
25427 gpointer user_data)
25428{
25429 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
25430 "setBlinkFast",
25431 g_variant_new ("()"),
25432 G_DBUS_CALL_FLAGS_NONE,
25433 -1,
25434 cancellable,
25435 callback,
25436 user_data);
25437}
25438
25439/**
25440 * led_call_set_blink_fast_finish:
25441 * @proxy: A #LedProxy.
25442 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_fast().
25443 * @error: Return location for error or %NULL.
25444 *
25445 * Finishes an operation started with led_call_set_blink_fast().
25446 *
25447 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
25448 */
25449gboolean
25450led_call_set_blink_fast_finish (
25451 Led *proxy,
25452 GAsyncResult *res,
25453 GError **error)
25454{
25455 GVariant *_ret;
25456 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
25457 if (_ret == NULL)
25458 goto _out;
25459 g_variant_get (_ret,
25460 "()");
25461 g_variant_unref (_ret);
25462_out:
25463 return _ret != NULL;
25464}
25465
25466/**
25467 * led_call_set_blink_fast_sync:
25468 * @proxy: A #LedProxy.
25469 * @cancellable: (allow-none): A #GCancellable or %NULL.
25470 * @error: Return location for error or %NULL.
25471 *
25472 * 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.
25473 *
25474 * See led_call_set_blink_fast() for the asynchronous version of this method.
25475 *
25476 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
25477 */
25478gboolean
25479led_call_set_blink_fast_sync (
25480 Led *proxy,
25481 GCancellable *cancellable,
25482 GError **error)
25483{
25484 GVariant *_ret;
25485 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
25486 "setBlinkFast",
25487 g_variant_new ("()"),
25488 G_DBUS_CALL_FLAGS_NONE,
25489 -1,
25490 cancellable,
25491 error);
25492 if (_ret == NULL)
25493 goto _out;
25494 g_variant_get (_ret,
25495 "()");
25496 g_variant_unref (_ret);
25497_out:
25498 return _ret != NULL;
25499}
25500
25501/**
25502 * led_complete_set_on:
25503 * @object: A #Led.
25504 * @invocation: (transfer full): A #GDBusMethodInvocation.
25505 *
25506 * 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.
25507 *
25508 * This method will free @invocation, you cannot use it afterwards.
25509 */
25510void
25511led_complete_set_on (
25512 Led *object,
25513 GDBusMethodInvocation *invocation)
25514{
25515 g_dbus_method_invocation_return_value (invocation,
25516 g_variant_new ("()"));
25517}
25518
25519/**
25520 * led_complete_set_off:
25521 * @object: A #Led.
25522 * @invocation: (transfer full): A #GDBusMethodInvocation.
25523 *
25524 * 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.
25525 *
25526 * This method will free @invocation, you cannot use it afterwards.
25527 */
25528void
25529led_complete_set_off (
25530 Led *object,
25531 GDBusMethodInvocation *invocation)
25532{
25533 g_dbus_method_invocation_return_value (invocation,
25534 g_variant_new ("()"));
25535}
25536
25537/**
25538 * led_complete_set_blink_slow:
25539 * @object: A #Led.
25540 * @invocation: (transfer full): A #GDBusMethodInvocation.
25541 *
25542 * 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.
25543 *
25544 * This method will free @invocation, you cannot use it afterwards.
25545 */
25546void
25547led_complete_set_blink_slow (
25548 Led *object,
25549 GDBusMethodInvocation *invocation)
25550{
25551 g_dbus_method_invocation_return_value (invocation,
25552 g_variant_new ("()"));
25553}
25554
25555/**
25556 * led_complete_set_blink_fast:
25557 * @object: A #Led.
25558 * @invocation: (transfer full): A #GDBusMethodInvocation.
25559 *
25560 * 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.
25561 *
25562 * This method will free @invocation, you cannot use it afterwards.
25563 */
25564void
25565led_complete_set_blink_fast (
25566 Led *object,
25567 GDBusMethodInvocation *invocation)
25568{
25569 g_dbus_method_invocation_return_value (invocation,
25570 g_variant_new ("()"));
25571}
25572
25573/* ------------------------------------------------------------------------ */
25574
25575/**
25576 * LedProxy:
25577 *
25578 * The #LedProxy structure contains only private data and should only be accessed using the provided API.
25579 */
25580
25581/**
25582 * LedProxyClass:
25583 * @parent_class: The parent class.
25584 *
25585 * Class structure for #LedProxy.
25586 */
25587
25588struct _LedProxyPrivate
25589{
25590 GData *qdata;
25591};
25592
25593static void led_proxy_iface_init (LedIface *iface);
25594
25595#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
25596G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
25597 G_ADD_PRIVATE (LedProxy)
25598 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
25599
25600#else
25601G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
25602 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
25603
25604#endif
25605static void
25606led_proxy_finalize (GObject *object)
25607{
25608 LedProxy *proxy = LED_PROXY (object);
25609 g_datalist_clear (&proxy->priv->qdata);
25610 G_OBJECT_CLASS (led_proxy_parent_class)->finalize (object);
25611}
25612
25613static void
25614led_proxy_get_property (GObject *object,
25615 guint prop_id,
25616 GValue *value,
25617 GParamSpec *pspec G_GNUC_UNUSED)
25618{
25619 const _ExtendedGDBusPropertyInfo *info;
25620 GVariant *variant;
25621 g_assert (prop_id != 0 && prop_id - 1 < 2);
25622 info = _led_property_info_pointers[prop_id - 1];
25623 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
25624 if (info->use_gvariant)
25625 {
25626 g_value_set_variant (value, variant);
25627 }
25628 else
25629 {
25630 if (variant != NULL)
25631 g_dbus_gvariant_to_gvalue (variant, value);
25632 }
25633 if (variant != NULL)
25634 g_variant_unref (variant);
25635}
25636
25637static void
25638led_proxy_set_property_cb (GDBusProxy *proxy,
25639 GAsyncResult *res,
25640 gpointer user_data)
25641{
25642 const _ExtendedGDBusPropertyInfo *info = user_data;
25643 GError *error;
25644 GVariant *_ret;
25645 error = NULL;
25646 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
25647 if (!_ret)
25648 {
25649 g_warning ("Error setting property '%s' on interface org.openbmc.Led: %s (%s, %d)",
25650 info->parent_struct.name,
25651 error->message, g_quark_to_string (error->domain), error->code);
25652 g_error_free (error);
25653 }
25654 else
25655 {
25656 g_variant_unref (_ret);
25657 }
25658}
25659
25660static void
25661led_proxy_set_property (GObject *object,
25662 guint prop_id,
25663 const GValue *value,
25664 GParamSpec *pspec G_GNUC_UNUSED)
25665{
25666 const _ExtendedGDBusPropertyInfo *info;
25667 GVariant *variant;
25668 g_assert (prop_id != 0 && prop_id - 1 < 2);
25669 info = _led_property_info_pointers[prop_id - 1];
25670 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
25671 g_dbus_proxy_call (G_DBUS_PROXY (object),
25672 "org.freedesktop.DBus.Properties.Set",
25673 g_variant_new ("(ssv)", "org.openbmc.Led", info->parent_struct.name, variant),
25674 G_DBUS_CALL_FLAGS_NONE,
25675 -1,
25676 NULL, (GAsyncReadyCallback) led_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
25677 g_variant_unref (variant);
25678}
25679
25680static void
25681led_proxy_g_signal (GDBusProxy *proxy,
25682 const gchar *sender_name G_GNUC_UNUSED,
25683 const gchar *signal_name,
25684 GVariant *parameters)
25685{
25686 _ExtendedGDBusSignalInfo *info;
25687 GVariantIter iter;
25688 GVariant *child;
25689 GValue *paramv;
25690 guint num_params;
25691 guint n;
25692 guint signal_id;
25693 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, signal_name);
25694 if (info == NULL)
25695 return;
25696 num_params = g_variant_n_children (parameters);
25697 paramv = g_new0 (GValue, num_params + 1);
25698 g_value_init (&paramv[0], TYPE_LED);
25699 g_value_set_object (&paramv[0], proxy);
25700 g_variant_iter_init (&iter, parameters);
25701 n = 1;
25702 while ((child = g_variant_iter_next_value (&iter)) != NULL)
25703 {
25704 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
25705 if (arg_info->use_gvariant)
25706 {
25707 g_value_init (&paramv[n], G_TYPE_VARIANT);
25708 g_value_set_variant (&paramv[n], child);
25709 n++;
25710 }
25711 else
25712 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
25713 g_variant_unref (child);
25714 }
25715 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
25716 g_signal_emitv (paramv, signal_id, 0, NULL);
25717 for (n = 0; n < num_params + 1; n++)
25718 g_value_unset (&paramv[n]);
25719 g_free (paramv);
25720}
25721
25722static void
25723led_proxy_g_properties_changed (GDBusProxy *_proxy,
25724 GVariant *changed_properties,
25725 const gchar *const *invalidated_properties)
25726{
25727 LedProxy *proxy = LED_PROXY (_proxy);
25728 guint n;
25729 const gchar *key;
25730 GVariantIter *iter;
25731 _ExtendedGDBusPropertyInfo *info;
25732 g_variant_get (changed_properties, "a{sv}", &iter);
25733 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
25734 {
25735 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, key);
25736 g_datalist_remove_data (&proxy->priv->qdata, key);
25737 if (info != NULL)
25738 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
25739 }
25740 g_variant_iter_free (iter);
25741 for (n = 0; invalidated_properties[n] != NULL; n++)
25742 {
25743 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, invalidated_properties[n]);
25744 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
25745 if (info != NULL)
25746 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
25747 }
25748}
25749
25750static gint
25751led_proxy_get_color (Led *object)
25752{
25753 LedProxy *proxy = LED_PROXY (object);
25754 GVariant *variant;
25755 gint value = 0;
25756 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "color");
25757 if (variant != NULL)
25758 {
25759 value = g_variant_get_int32 (variant);
25760 g_variant_unref (variant);
25761 }
25762 return value;
25763}
25764
25765static const gchar *
25766led_proxy_get_function (Led *object)
25767{
25768 LedProxy *proxy = LED_PROXY (object);
25769 GVariant *variant;
25770 const gchar *value = NULL;
25771 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "function");
25772 if (variant != NULL)
25773 {
25774 value = g_variant_get_string (variant, NULL);
25775 g_variant_unref (variant);
25776 }
25777 return value;
25778}
25779
25780static void
25781led_proxy_init (LedProxy *proxy)
25782{
25783#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
25784 proxy->priv = led_proxy_get_instance_private (proxy);
25785#else
25786 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_LED_PROXY, LedProxyPrivate);
25787#endif
25788
25789 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), led_interface_info ());
25790}
25791
25792static void
25793led_proxy_class_init (LedProxyClass *klass)
25794{
25795 GObjectClass *gobject_class;
25796 GDBusProxyClass *proxy_class;
25797
25798 gobject_class = G_OBJECT_CLASS (klass);
25799 gobject_class->finalize = led_proxy_finalize;
25800 gobject_class->get_property = led_proxy_get_property;
25801 gobject_class->set_property = led_proxy_set_property;
25802
25803 proxy_class = G_DBUS_PROXY_CLASS (klass);
25804 proxy_class->g_signal = led_proxy_g_signal;
25805 proxy_class->g_properties_changed = led_proxy_g_properties_changed;
25806
25807 led_override_properties (gobject_class, 1);
25808
25809#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
25810 g_type_class_add_private (klass, sizeof (LedProxyPrivate));
25811#endif
25812}
25813
25814static void
25815led_proxy_iface_init (LedIface *iface)
25816{
25817 iface->get_color = led_proxy_get_color;
25818 iface->get_function = led_proxy_get_function;
25819}
25820
25821/**
25822 * led_proxy_new:
25823 * @connection: A #GDBusConnection.
25824 * @flags: Flags from the #GDBusProxyFlags enumeration.
25825 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
25826 * @object_path: An object path.
25827 * @cancellable: (allow-none): A #GCancellable or %NULL.
25828 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
25829 * @user_data: User data to pass to @callback.
25830 *
25831 * 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.
25832 *
25833 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
25834 * You can then call led_proxy_new_finish() to get the result of the operation.
25835 *
25836 * See led_proxy_new_sync() for the synchronous, blocking version of this constructor.
25837 */
25838void
25839led_proxy_new (
25840 GDBusConnection *connection,
25841 GDBusProxyFlags flags,
25842 const gchar *name,
25843 const gchar *object_path,
25844 GCancellable *cancellable,
25845 GAsyncReadyCallback callback,
25846 gpointer user_data)
25847{
25848 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);
25849}
25850
25851/**
25852 * led_proxy_new_finish:
25853 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new().
25854 * @error: Return location for error or %NULL
25855 *
25856 * Finishes an operation started with led_proxy_new().
25857 *
25858 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
25859 */
25860Led *
25861led_proxy_new_finish (
25862 GAsyncResult *res,
25863 GError **error)
25864{
25865 GObject *ret;
25866 GObject *source_object;
25867 source_object = g_async_result_get_source_object (res);
25868 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
25869 g_object_unref (source_object);
25870 if (ret != NULL)
25871 return LED (ret);
25872 else
25873 return NULL;
25874}
25875
25876/**
25877 * led_proxy_new_sync:
25878 * @connection: A #GDBusConnection.
25879 * @flags: Flags from the #GDBusProxyFlags enumeration.
25880 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
25881 * @object_path: An object path.
25882 * @cancellable: (allow-none): A #GCancellable or %NULL.
25883 * @error: Return location for error or %NULL
25884 *
25885 * 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.
25886 *
25887 * The calling thread is blocked until a reply is received.
25888 *
25889 * See led_proxy_new() for the asynchronous version of this constructor.
25890 *
25891 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
25892 */
25893Led *
25894led_proxy_new_sync (
25895 GDBusConnection *connection,
25896 GDBusProxyFlags flags,
25897 const gchar *name,
25898 const gchar *object_path,
25899 GCancellable *cancellable,
25900 GError **error)
25901{
25902 GInitable *ret;
25903 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);
25904 if (ret != NULL)
25905 return LED (ret);
25906 else
25907 return NULL;
25908}
25909
25910
25911/**
25912 * led_proxy_new_for_bus:
25913 * @bus_type: A #GBusType.
25914 * @flags: Flags from the #GDBusProxyFlags enumeration.
25915 * @name: A bus name (well-known or unique).
25916 * @object_path: An object path.
25917 * @cancellable: (allow-none): A #GCancellable or %NULL.
25918 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
25919 * @user_data: User data to pass to @callback.
25920 *
25921 * Like led_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
25922 *
25923 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
25924 * You can then call led_proxy_new_for_bus_finish() to get the result of the operation.
25925 *
25926 * See led_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
25927 */
25928void
25929led_proxy_new_for_bus (
25930 GBusType bus_type,
25931 GDBusProxyFlags flags,
25932 const gchar *name,
25933 const gchar *object_path,
25934 GCancellable *cancellable,
25935 GAsyncReadyCallback callback,
25936 gpointer user_data)
25937{
25938 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);
25939}
25940
25941/**
25942 * led_proxy_new_for_bus_finish:
25943 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new_for_bus().
25944 * @error: Return location for error or %NULL
25945 *
25946 * Finishes an operation started with led_proxy_new_for_bus().
25947 *
25948 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
25949 */
25950Led *
25951led_proxy_new_for_bus_finish (
25952 GAsyncResult *res,
25953 GError **error)
25954{
25955 GObject *ret;
25956 GObject *source_object;
25957 source_object = g_async_result_get_source_object (res);
25958 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
25959 g_object_unref (source_object);
25960 if (ret != NULL)
25961 return LED (ret);
25962 else
25963 return NULL;
25964}
25965
25966/**
25967 * led_proxy_new_for_bus_sync:
25968 * @bus_type: A #GBusType.
25969 * @flags: Flags from the #GDBusProxyFlags enumeration.
25970 * @name: A bus name (well-known or unique).
25971 * @object_path: An object path.
25972 * @cancellable: (allow-none): A #GCancellable or %NULL.
25973 * @error: Return location for error or %NULL
25974 *
25975 * Like led_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
25976 *
25977 * The calling thread is blocked until a reply is received.
25978 *
25979 * See led_proxy_new_for_bus() for the asynchronous version of this constructor.
25980 *
25981 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
25982 */
25983Led *
25984led_proxy_new_for_bus_sync (
25985 GBusType bus_type,
25986 GDBusProxyFlags flags,
25987 const gchar *name,
25988 const gchar *object_path,
25989 GCancellable *cancellable,
25990 GError **error)
25991{
25992 GInitable *ret;
25993 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);
25994 if (ret != NULL)
25995 return LED (ret);
25996 else
25997 return NULL;
25998}
25999
26000
26001/* ------------------------------------------------------------------------ */
26002
26003/**
26004 * LedSkeleton:
26005 *
26006 * The #LedSkeleton structure contains only private data and should only be accessed using the provided API.
26007 */
26008
26009/**
26010 * LedSkeletonClass:
26011 * @parent_class: The parent class.
26012 *
26013 * Class structure for #LedSkeleton.
26014 */
26015
26016struct _LedSkeletonPrivate
26017{
26018 GValue *properties;
26019 GList *changed_properties;
26020 GSource *changed_properties_idle_source;
26021 GMainContext *context;
26022 GMutex lock;
26023};
26024
26025static void
26026_led_skeleton_handle_method_call (
26027 GDBusConnection *connection G_GNUC_UNUSED,
26028 const gchar *sender G_GNUC_UNUSED,
26029 const gchar *object_path G_GNUC_UNUSED,
26030 const gchar *interface_name,
26031 const gchar *method_name,
26032 GVariant *parameters,
26033 GDBusMethodInvocation *invocation,
26034 gpointer user_data)
26035{
26036 LedSkeleton *skeleton = LED_SKELETON (user_data);
26037 _ExtendedGDBusMethodInfo *info;
26038 GVariantIter iter;
26039 GVariant *child;
26040 GValue *paramv;
26041 guint num_params;
26042 guint num_extra;
26043 guint n;
26044 guint signal_id;
26045 GValue return_value = G_VALUE_INIT;
26046 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
26047 g_assert (info != NULL);
26048 num_params = g_variant_n_children (parameters);
26049 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
26050 n = 0;
26051 g_value_init (&paramv[n], TYPE_LED);
26052 g_value_set_object (&paramv[n++], skeleton);
26053 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
26054 g_value_set_object (&paramv[n++], invocation);
26055 if (info->pass_fdlist)
26056 {
26057#ifdef G_OS_UNIX
26058 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
26059 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
26060#else
26061 g_assert_not_reached ();
26062#endif
26063 }
26064 g_variant_iter_init (&iter, parameters);
26065 while ((child = g_variant_iter_next_value (&iter)) != NULL)
26066 {
26067 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
26068 if (arg_info->use_gvariant)
26069 {
26070 g_value_init (&paramv[n], G_TYPE_VARIANT);
26071 g_value_set_variant (&paramv[n], child);
26072 n++;
26073 }
26074 else
26075 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
26076 g_variant_unref (child);
26077 }
26078 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
26079 g_value_init (&return_value, G_TYPE_BOOLEAN);
26080 g_signal_emitv (paramv, signal_id, 0, &return_value);
26081 if (!g_value_get_boolean (&return_value))
26082 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);
26083 g_value_unset (&return_value);
26084 for (n = 0; n < num_params + num_extra; n++)
26085 g_value_unset (&paramv[n]);
26086 g_free (paramv);
26087}
26088
26089static GVariant *
26090_led_skeleton_handle_get_property (
26091 GDBusConnection *connection G_GNUC_UNUSED,
26092 const gchar *sender G_GNUC_UNUSED,
26093 const gchar *object_path G_GNUC_UNUSED,
26094 const gchar *interface_name G_GNUC_UNUSED,
26095 const gchar *property_name,
26096 GError **error,
26097 gpointer user_data)
26098{
26099 LedSkeleton *skeleton = LED_SKELETON (user_data);
26100 GValue value = G_VALUE_INIT;
26101 GParamSpec *pspec;
26102 _ExtendedGDBusPropertyInfo *info;
26103 GVariant *ret;
26104 ret = NULL;
26105 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
26106 g_assert (info != NULL);
26107 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
26108 if (pspec == NULL)
26109 {
26110 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
26111 }
26112 else
26113 {
26114 g_value_init (&value, pspec->value_type);
26115 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
26116 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
26117 g_value_unset (&value);
26118 }
26119 return ret;
26120}
26121
26122static gboolean
26123_led_skeleton_handle_set_property (
26124 GDBusConnection *connection G_GNUC_UNUSED,
26125 const gchar *sender G_GNUC_UNUSED,
26126 const gchar *object_path G_GNUC_UNUSED,
26127 const gchar *interface_name G_GNUC_UNUSED,
26128 const gchar *property_name,
26129 GVariant *variant,
26130 GError **error,
26131 gpointer user_data)
26132{
26133 LedSkeleton *skeleton = LED_SKELETON (user_data);
26134 GValue value = G_VALUE_INIT;
26135 GParamSpec *pspec;
26136 _ExtendedGDBusPropertyInfo *info;
26137 gboolean ret;
26138 ret = FALSE;
26139 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
26140 g_assert (info != NULL);
26141 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
26142 if (pspec == NULL)
26143 {
26144 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
26145 }
26146 else
26147 {
26148 if (info->use_gvariant)
26149 g_value_set_variant (&value, variant);
26150 else
26151 g_dbus_gvariant_to_gvalue (variant, &value);
26152 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
26153 g_value_unset (&value);
26154 ret = TRUE;
26155 }
26156 return ret;
26157}
26158
26159static const GDBusInterfaceVTable _led_skeleton_vtable =
26160{
26161 _led_skeleton_handle_method_call,
26162 _led_skeleton_handle_get_property,
26163 _led_skeleton_handle_set_property,
26164 {NULL}
26165};
26166
26167static GDBusInterfaceInfo *
26168led_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
26169{
26170 return led_interface_info ();
26171}
26172
26173static GDBusInterfaceVTable *
26174led_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
26175{
26176 return (GDBusInterfaceVTable *) &_led_skeleton_vtable;
26177}
26178
26179static GVariant *
26180led_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
26181{
26182 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
26183
26184 GVariantBuilder builder;
26185 guint n;
26186 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
26187 if (_led_interface_info.parent_struct.properties == NULL)
26188 goto out;
26189 for (n = 0; _led_interface_info.parent_struct.properties[n] != NULL; n++)
26190 {
26191 GDBusPropertyInfo *info = _led_interface_info.parent_struct.properties[n];
26192 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
26193 {
26194 GVariant *value;
26195 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);
26196 if (value != NULL)
26197 {
26198 g_variant_take_ref (value);
26199 g_variant_builder_add (&builder, "{sv}", info->name, value);
26200 g_variant_unref (value);
26201 }
26202 }
26203 }
26204out:
26205 return g_variant_builder_end (&builder);
26206}
26207
26208static gboolean _led_emit_changed (gpointer user_data);
26209
26210static void
26211led_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
26212{
26213 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
26214 gboolean emit_changed = FALSE;
26215
26216 g_mutex_lock (&skeleton->priv->lock);
26217 if (skeleton->priv->changed_properties_idle_source != NULL)
26218 {
26219 g_source_destroy (skeleton->priv->changed_properties_idle_source);
26220 skeleton->priv->changed_properties_idle_source = NULL;
26221 emit_changed = TRUE;
26222 }
26223 g_mutex_unlock (&skeleton->priv->lock);
26224
26225 if (emit_changed)
26226 _led_emit_changed (skeleton);
26227}
26228
26229static void led_skeleton_iface_init (LedIface *iface);
26230#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
26231G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
26232 G_ADD_PRIVATE (LedSkeleton)
26233 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
26234
26235#else
26236G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
26237 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
26238
26239#endif
26240static void
26241led_skeleton_finalize (GObject *object)
26242{
26243 LedSkeleton *skeleton = LED_SKELETON (object);
26244 guint n;
26245 for (n = 0; n < 2; n++)
26246 g_value_unset (&skeleton->priv->properties[n]);
26247 g_free (skeleton->priv->properties);
26248 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
26249 if (skeleton->priv->changed_properties_idle_source != NULL)
26250 g_source_destroy (skeleton->priv->changed_properties_idle_source);
26251 g_main_context_unref (skeleton->priv->context);
26252 g_mutex_clear (&skeleton->priv->lock);
26253 G_OBJECT_CLASS (led_skeleton_parent_class)->finalize (object);
26254}
26255
26256static void
26257led_skeleton_get_property (GObject *object,
26258 guint prop_id,
26259 GValue *value,
26260 GParamSpec *pspec G_GNUC_UNUSED)
26261{
26262 LedSkeleton *skeleton = LED_SKELETON (object);
26263 g_assert (prop_id != 0 && prop_id - 1 < 2);
26264 g_mutex_lock (&skeleton->priv->lock);
26265 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
26266 g_mutex_unlock (&skeleton->priv->lock);
26267}
26268
26269static gboolean
26270_led_emit_changed (gpointer user_data)
26271{
26272 LedSkeleton *skeleton = LED_SKELETON (user_data);
26273 GList *l;
26274 GVariantBuilder builder;
26275 GVariantBuilder invalidated_builder;
26276 guint num_changes;
26277
26278 g_mutex_lock (&skeleton->priv->lock);
26279 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
26280 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
26281 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
26282 {
26283 ChangedProperty *cp = l->data;
26284 GVariant *variant;
26285 const GValue *cur_value;
26286
26287 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
26288 if (!_g_value_equal (cur_value, &cp->orig_value))
26289 {
26290 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
26291 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
26292 g_variant_unref (variant);
26293 num_changes++;
26294 }
26295 }
26296 if (num_changes > 0)
26297 {
26298 GList *connections, *ll;
26299 GVariant *signal_variant;
26300 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Led",
26301 &builder, &invalidated_builder));
26302 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
26303 for (ll = connections; ll != NULL; ll = ll->next)
26304 {
26305 GDBusConnection *connection = ll->data;
26306
26307 g_dbus_connection_emit_signal (connection,
26308 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
26309 "org.freedesktop.DBus.Properties",
26310 "PropertiesChanged",
26311 signal_variant,
26312 NULL);
26313 }
26314 g_variant_unref (signal_variant);
26315 g_list_free_full (connections, g_object_unref);
26316 }
26317 else
26318 {
26319 g_variant_builder_clear (&builder);
26320 g_variant_builder_clear (&invalidated_builder);
26321 }
26322 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
26323 skeleton->priv->changed_properties = NULL;
26324 skeleton->priv->changed_properties_idle_source = NULL;
26325 g_mutex_unlock (&skeleton->priv->lock);
26326 return FALSE;
26327}
26328
26329static void
26330_led_schedule_emit_changed (LedSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
26331{
26332 ChangedProperty *cp;
26333 GList *l;
26334 cp = NULL;
26335 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
26336 {
26337 ChangedProperty *i_cp = l->data;
26338 if (i_cp->info == info)
26339 {
26340 cp = i_cp;
26341 break;
26342 }
26343 }
26344 if (cp == NULL)
26345 {
26346 cp = g_new0 (ChangedProperty, 1);
26347 cp->prop_id = prop_id;
26348 cp->info = info;
26349 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
26350 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
26351 g_value_copy (orig_value, &cp->orig_value);
26352 }
26353}
26354
26355static void
26356led_skeleton_notify (GObject *object,
26357 GParamSpec *pspec G_GNUC_UNUSED)
26358{
26359 LedSkeleton *skeleton = LED_SKELETON (object);
26360 g_mutex_lock (&skeleton->priv->lock);
26361 if (skeleton->priv->changed_properties != NULL &&
26362 skeleton->priv->changed_properties_idle_source == NULL)
26363 {
26364 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
26365 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
26366 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _led_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
26367 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
26368 g_source_unref (skeleton->priv->changed_properties_idle_source);
26369 }
26370 g_mutex_unlock (&skeleton->priv->lock);
26371}
26372
26373static void
26374led_skeleton_set_property (GObject *object,
26375 guint prop_id,
26376 const GValue *value,
26377 GParamSpec *pspec)
26378{
26379 LedSkeleton *skeleton = LED_SKELETON (object);
26380 g_assert (prop_id != 0 && prop_id - 1 < 2);
26381 g_mutex_lock (&skeleton->priv->lock);
26382 g_object_freeze_notify (object);
26383 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
26384 {
26385 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
26386 _led_schedule_emit_changed (skeleton, _led_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
26387 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
26388 g_object_notify_by_pspec (object, pspec);
26389 }
26390 g_mutex_unlock (&skeleton->priv->lock);
26391 g_object_thaw_notify (object);
26392}
26393
26394static void
26395led_skeleton_init (LedSkeleton *skeleton)
26396{
26397#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
26398 skeleton->priv = led_skeleton_get_instance_private (skeleton);
26399#else
26400 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_LED_SKELETON, LedSkeletonPrivate);
26401#endif
26402
26403 g_mutex_init (&skeleton->priv->lock);
26404 skeleton->priv->context = g_main_context_ref_thread_default ();
26405 skeleton->priv->properties = g_new0 (GValue, 2);
26406 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
26407 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
26408}
26409
26410static gint
26411led_skeleton_get_color (Led *object)
26412{
26413 LedSkeleton *skeleton = LED_SKELETON (object);
26414 gint value;
26415 g_mutex_lock (&skeleton->priv->lock);
26416 value = g_value_get_int (&(skeleton->priv->properties[0]));
26417 g_mutex_unlock (&skeleton->priv->lock);
26418 return value;
26419}
26420
26421static const gchar *
26422led_skeleton_get_function (Led *object)
26423{
26424 LedSkeleton *skeleton = LED_SKELETON (object);
26425 const gchar *value;
26426 g_mutex_lock (&skeleton->priv->lock);
26427 value = g_value_get_string (&(skeleton->priv->properties[1]));
26428 g_mutex_unlock (&skeleton->priv->lock);
26429 return value;
26430}
26431
26432static void
26433led_skeleton_class_init (LedSkeletonClass *klass)
26434{
26435 GObjectClass *gobject_class;
26436 GDBusInterfaceSkeletonClass *skeleton_class;
26437
26438 gobject_class = G_OBJECT_CLASS (klass);
26439 gobject_class->finalize = led_skeleton_finalize;
26440 gobject_class->get_property = led_skeleton_get_property;
26441 gobject_class->set_property = led_skeleton_set_property;
26442 gobject_class->notify = led_skeleton_notify;
26443
26444
26445 led_override_properties (gobject_class, 1);
26446
26447 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
26448 skeleton_class->get_info = led_skeleton_dbus_interface_get_info;
26449 skeleton_class->get_properties = led_skeleton_dbus_interface_get_properties;
26450 skeleton_class->flush = led_skeleton_dbus_interface_flush;
26451 skeleton_class->get_vtable = led_skeleton_dbus_interface_get_vtable;
26452
26453#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
26454 g_type_class_add_private (klass, sizeof (LedSkeletonPrivate));
26455#endif
26456}
26457
26458static void
26459led_skeleton_iface_init (LedIface *iface)
26460{
26461 iface->get_color = led_skeleton_get_color;
26462 iface->get_function = led_skeleton_get_function;
26463}
26464
26465/**
26466 * led_skeleton_new:
26467 *
26468 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
26469 *
26470 * Returns: (transfer full) (type LedSkeleton): The skeleton object.
26471 */
26472Led *
26473led_skeleton_new (void)
26474{
26475 return LED (g_object_new (TYPE_LED_SKELETON, NULL));
26476}
26477
26478/* ------------------------------------------------------------------------
Norman Jamesdbcffbd2015-10-06 16:53:06 -050026479 * Code for interface org.openbmc.HostIpmi
26480 * ------------------------------------------------------------------------
26481 */
26482
26483/**
26484 * SECTION:HostIpmi
26485 * @title: HostIpmi
26486 * @short_description: Generated C code for the org.openbmc.HostIpmi D-Bus interface
26487 *
26488 * 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.
26489 */
26490
26491/* ---- Introspection data for org.openbmc.HostIpmi ---- */
26492
26493static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_seq =
26494{
26495 {
26496 -1,
26497 (gchar *) "seq",
26498 (gchar *) "y",
26499 NULL
26500 },
26501 FALSE
26502};
26503
26504static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_netfn =
26505{
26506 {
26507 -1,
26508 (gchar *) "netfn",
26509 (gchar *) "y",
26510 NULL
26511 },
26512 FALSE
26513};
26514
26515static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_cmd =
26516{
26517 {
26518 -1,
26519 (gchar *) "cmd",
26520 (gchar *) "y",
26521 NULL
26522 },
26523 FALSE
26524};
26525
26526static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_data =
26527{
26528 {
26529 -1,
26530 (gchar *) "data",
26531 (gchar *) "ay",
26532 NULL
26533 },
26534 FALSE
26535};
26536
26537static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_IN_ARG_pointers[] =
26538{
26539 &_host_ipmi_method_info_send_message_IN_ARG_seq,
26540 &_host_ipmi_method_info_send_message_IN_ARG_netfn,
26541 &_host_ipmi_method_info_send_message_IN_ARG_cmd,
26542 &_host_ipmi_method_info_send_message_IN_ARG_data,
26543 NULL
26544};
26545
26546static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4 =
26547{
26548 {
26549 -1,
26550 (gchar *) "unnamed_arg4",
26551 (gchar *) "x",
26552 NULL
26553 },
26554 FALSE
26555};
26556
26557static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_OUT_ARG_pointers[] =
26558{
26559 &_host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4,
26560 NULL
26561};
26562
26563static const _ExtendedGDBusMethodInfo _host_ipmi_method_info_send_message =
26564{
26565 {
26566 -1,
26567 (gchar *) "sendMessage",
26568 (GDBusArgInfo **) &_host_ipmi_method_info_send_message_IN_ARG_pointers,
26569 (GDBusArgInfo **) &_host_ipmi_method_info_send_message_OUT_ARG_pointers,
26570 NULL
26571 },
26572 "handle-send-message",
26573 FALSE
26574};
26575
26576static const _ExtendedGDBusMethodInfo * const _host_ipmi_method_info_pointers[] =
26577{
26578 &_host_ipmi_method_info_send_message,
26579 NULL
26580};
26581
26582static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_seq =
26583{
26584 {
26585 -1,
26586 (gchar *) "seq",
26587 (gchar *) "y",
26588 NULL
26589 },
26590 FALSE
26591};
26592
26593static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_netfn =
26594{
26595 {
26596 -1,
26597 (gchar *) "netfn",
26598 (gchar *) "y",
26599 NULL
26600 },
26601 FALSE
26602};
26603
26604static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_cmd =
26605{
26606 {
26607 -1,
26608 (gchar *) "cmd",
26609 (gchar *) "y",
26610 NULL
26611 },
26612 FALSE
26613};
26614
26615static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_data =
26616{
26617 {
26618 -1,
26619 (gchar *) "data",
26620 (gchar *) "ay",
26621 NULL
26622 },
26623 FALSE
26624};
26625
26626static const _ExtendedGDBusArgInfo * const _host_ipmi_signal_info_received_message_ARG_pointers[] =
26627{
26628 &_host_ipmi_signal_info_received_message_ARG_seq,
26629 &_host_ipmi_signal_info_received_message_ARG_netfn,
26630 &_host_ipmi_signal_info_received_message_ARG_cmd,
26631 &_host_ipmi_signal_info_received_message_ARG_data,
26632 NULL
26633};
26634
26635static const _ExtendedGDBusSignalInfo _host_ipmi_signal_info_received_message =
26636{
26637 {
26638 -1,
26639 (gchar *) "ReceivedMessage",
26640 (GDBusArgInfo **) &_host_ipmi_signal_info_received_message_ARG_pointers,
26641 NULL
26642 },
26643 "received-message"
26644};
26645
26646static const _ExtendedGDBusSignalInfo * const _host_ipmi_signal_info_pointers[] =
26647{
26648 &_host_ipmi_signal_info_received_message,
26649 NULL
26650};
26651
26652static const _ExtendedGDBusInterfaceInfo _host_ipmi_interface_info =
26653{
26654 {
26655 -1,
26656 (gchar *) "org.openbmc.HostIpmi",
26657 (GDBusMethodInfo **) &_host_ipmi_method_info_pointers,
26658 (GDBusSignalInfo **) &_host_ipmi_signal_info_pointers,
26659 NULL,
26660 NULL
26661 },
26662 "host-ipmi",
26663};
26664
26665
26666/**
26667 * host_ipmi_interface_info:
26668 *
26669 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> D-Bus interface.
26670 *
26671 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
26672 */
26673GDBusInterfaceInfo *
26674host_ipmi_interface_info (void)
26675{
26676 return (GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct;
26677}
26678
26679/**
26680 * host_ipmi_override_properties:
26681 * @klass: The class structure for a #GObject<!-- -->-derived class.
26682 * @property_id_begin: The property id to assign to the first overridden property.
26683 *
26684 * Overrides all #GObject properties in the #HostIpmi interface for a concrete class.
26685 * The properties are overridden in the order they are defined.
26686 *
26687 * Returns: The last property id.
26688 */
26689guint
26690host_ipmi_override_properties (GObjectClass *klass, guint property_id_begin)
26691{
26692 return property_id_begin - 1;
26693}
26694
26695
26696
26697/**
26698 * HostIpmi:
26699 *
26700 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
26701 */
26702
26703/**
26704 * HostIpmiIface:
26705 * @parent_iface: The parent interface.
26706 * @handle_send_message: Handler for the #HostIpmi::handle-send-message signal.
26707 * @received_message: Handler for the #HostIpmi::received-message signal.
26708 *
26709 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
26710 */
26711
26712typedef HostIpmiIface HostIpmiInterface;
26713G_DEFINE_INTERFACE (HostIpmi, host_ipmi, G_TYPE_OBJECT);
26714
26715static void
26716host_ipmi_default_init (HostIpmiIface *iface)
26717{
26718 /* GObject signals for incoming D-Bus method calls: */
26719 /**
26720 * HostIpmi::handle-send-message:
26721 * @object: A #HostIpmi.
26722 * @invocation: A #GDBusMethodInvocation.
26723 * @arg_seq: Argument passed by remote caller.
26724 * @arg_netfn: Argument passed by remote caller.
26725 * @arg_cmd: Argument passed by remote caller.
26726 * @arg_data: Argument passed by remote caller.
26727 *
26728 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method.
26729 *
26730 * 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.
26731 *
26732 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
26733 */
26734 g_signal_new ("handle-send-message",
26735 G_TYPE_FROM_INTERFACE (iface),
26736 G_SIGNAL_RUN_LAST,
26737 G_STRUCT_OFFSET (HostIpmiIface, handle_send_message),
26738 g_signal_accumulator_true_handled,
26739 NULL,
26740 g_cclosure_marshal_generic,
26741 G_TYPE_BOOLEAN,
26742 5,
26743 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING);
26744
26745 /* GObject signals for received D-Bus signals: */
26746 /**
26747 * HostIpmi::received-message:
26748 * @object: A #HostIpmi.
26749 * @arg_seq: Argument.
26750 * @arg_netfn: Argument.
26751 * @arg_cmd: Argument.
26752 * @arg_data: Argument.
26753 *
26754 * 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.
26755 *
26756 * 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.
26757 */
26758 g_signal_new ("received-message",
26759 G_TYPE_FROM_INTERFACE (iface),
26760 G_SIGNAL_RUN_LAST,
26761 G_STRUCT_OFFSET (HostIpmiIface, received_message),
26762 NULL,
26763 NULL,
26764 g_cclosure_marshal_generic,
26765 G_TYPE_NONE,
26766 4, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING);
26767
26768}
26769
26770/**
26771 * host_ipmi_emit_received_message:
26772 * @object: A #HostIpmi.
26773 * @arg_seq: Argument to pass with the signal.
26774 * @arg_netfn: Argument to pass with the signal.
26775 * @arg_cmd: Argument to pass with the signal.
26776 * @arg_data: Argument to pass with the signal.
26777 *
26778 * Emits the <link linkend="gdbus-signal-org-openbmc-HostIpmi.ReceivedMessage">"ReceivedMessage"</link> D-Bus signal.
26779 */
26780void
26781host_ipmi_emit_received_message (
26782 HostIpmi *object,
26783 guchar arg_seq,
26784 guchar arg_netfn,
26785 guchar arg_cmd,
26786 const gchar *arg_data)
26787{
26788 g_signal_emit_by_name (object, "received-message", arg_seq, arg_netfn, arg_cmd, arg_data);
26789}
26790
26791/**
26792 * host_ipmi_call_send_message:
26793 * @proxy: A #HostIpmiProxy.
26794 * @arg_seq: Argument to pass with the method invocation.
26795 * @arg_netfn: Argument to pass with the method invocation.
26796 * @arg_cmd: Argument to pass with the method invocation.
26797 * @arg_data: Argument to pass with the method invocation.
26798 * @cancellable: (allow-none): A #GCancellable or %NULL.
26799 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
26800 * @user_data: User data to pass to @callback.
26801 *
26802 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method on @proxy.
26803 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
26804 * You can then call host_ipmi_call_send_message_finish() to get the result of the operation.
26805 *
26806 * See host_ipmi_call_send_message_sync() for the synchronous, blocking version of this method.
26807 */
26808void
26809host_ipmi_call_send_message (
26810 HostIpmi *proxy,
26811 guchar arg_seq,
26812 guchar arg_netfn,
26813 guchar arg_cmd,
26814 const gchar *arg_data,
26815 GCancellable *cancellable,
26816 GAsyncReadyCallback callback,
26817 gpointer user_data)
26818{
26819 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
26820 "sendMessage",
26821 g_variant_new ("(yyy^ay)",
26822 arg_seq,
26823 arg_netfn,
26824 arg_cmd,
26825 arg_data),
26826 G_DBUS_CALL_FLAGS_NONE,
26827 -1,
26828 cancellable,
26829 callback,
26830 user_data);
26831}
26832
26833/**
26834 * host_ipmi_call_send_message_finish:
26835 * @proxy: A #HostIpmiProxy.
26836 * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore.
26837 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_call_send_message().
26838 * @error: Return location for error or %NULL.
26839 *
26840 * Finishes an operation started with host_ipmi_call_send_message().
26841 *
26842 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26843 */
26844gboolean
26845host_ipmi_call_send_message_finish (
26846 HostIpmi *proxy,
26847 gint64 *out_unnamed_arg4,
26848 GAsyncResult *res,
26849 GError **error)
26850{
26851 GVariant *_ret;
26852 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
26853 if (_ret == NULL)
26854 goto _out;
26855 g_variant_get (_ret,
26856 "(x)",
26857 out_unnamed_arg4);
26858 g_variant_unref (_ret);
26859_out:
26860 return _ret != NULL;
26861}
26862
26863/**
26864 * host_ipmi_call_send_message_sync:
26865 * @proxy: A #HostIpmiProxy.
26866 * @arg_seq: Argument to pass with the method invocation.
26867 * @arg_netfn: Argument to pass with the method invocation.
26868 * @arg_cmd: Argument to pass with the method invocation.
26869 * @arg_data: Argument to pass with the method invocation.
26870 * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore.
26871 * @cancellable: (allow-none): A #GCancellable or %NULL.
26872 * @error: Return location for error or %NULL.
26873 *
26874 * 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.
26875 *
26876 * See host_ipmi_call_send_message() for the asynchronous version of this method.
26877 *
26878 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26879 */
26880gboolean
26881host_ipmi_call_send_message_sync (
26882 HostIpmi *proxy,
26883 guchar arg_seq,
26884 guchar arg_netfn,
26885 guchar arg_cmd,
26886 const gchar *arg_data,
26887 gint64 *out_unnamed_arg4,
26888 GCancellable *cancellable,
26889 GError **error)
26890{
26891 GVariant *_ret;
26892 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
26893 "sendMessage",
26894 g_variant_new ("(yyy^ay)",
26895 arg_seq,
26896 arg_netfn,
26897 arg_cmd,
26898 arg_data),
26899 G_DBUS_CALL_FLAGS_NONE,
26900 -1,
26901 cancellable,
26902 error);
26903 if (_ret == NULL)
26904 goto _out;
26905 g_variant_get (_ret,
26906 "(x)",
26907 out_unnamed_arg4);
26908 g_variant_unref (_ret);
26909_out:
26910 return _ret != NULL;
26911}
26912
26913/**
26914 * host_ipmi_complete_send_message:
26915 * @object: A #HostIpmi.
26916 * @invocation: (transfer full): A #GDBusMethodInvocation.
26917 * @unnamed_arg4: Parameter to return.
26918 *
26919 * 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.
26920 *
26921 * This method will free @invocation, you cannot use it afterwards.
26922 */
26923void
26924host_ipmi_complete_send_message (
26925 HostIpmi *object,
26926 GDBusMethodInvocation *invocation,
26927 gint64 unnamed_arg4)
26928{
26929 g_dbus_method_invocation_return_value (invocation,
26930 g_variant_new ("(x)",
26931 unnamed_arg4));
26932}
26933
26934/* ------------------------------------------------------------------------ */
26935
26936/**
26937 * HostIpmiProxy:
26938 *
26939 * The #HostIpmiProxy structure contains only private data and should only be accessed using the provided API.
26940 */
26941
26942/**
26943 * HostIpmiProxyClass:
26944 * @parent_class: The parent class.
26945 *
26946 * Class structure for #HostIpmiProxy.
26947 */
26948
26949struct _HostIpmiProxyPrivate
26950{
26951 GData *qdata;
26952};
26953
26954static void host_ipmi_proxy_iface_init (HostIpmiIface *iface);
26955
26956#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
26957G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY,
26958 G_ADD_PRIVATE (HostIpmiProxy)
26959 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init));
26960
26961#else
26962G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY,
26963 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init));
26964
26965#endif
26966static void
26967host_ipmi_proxy_finalize (GObject *object)
26968{
26969 HostIpmiProxy *proxy = HOST_IPMI_PROXY (object);
26970 g_datalist_clear (&proxy->priv->qdata);
26971 G_OBJECT_CLASS (host_ipmi_proxy_parent_class)->finalize (object);
26972}
26973
26974static void
26975host_ipmi_proxy_get_property (GObject *object,
26976 guint prop_id,
26977 GValue *value,
26978 GParamSpec *pspec G_GNUC_UNUSED)
26979{
26980}
26981
26982static void
26983host_ipmi_proxy_set_property (GObject *object,
26984 guint prop_id,
26985 const GValue *value,
26986 GParamSpec *pspec G_GNUC_UNUSED)
26987{
26988}
26989
26990static void
26991host_ipmi_proxy_g_signal (GDBusProxy *proxy,
26992 const gchar *sender_name G_GNUC_UNUSED,
26993 const gchar *signal_name,
26994 GVariant *parameters)
26995{
26996 _ExtendedGDBusSignalInfo *info;
26997 GVariantIter iter;
26998 GVariant *child;
26999 GValue *paramv;
27000 guint num_params;
27001 guint n;
27002 guint signal_id;
27003 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, signal_name);
27004 if (info == NULL)
27005 return;
27006 num_params = g_variant_n_children (parameters);
27007 paramv = g_new0 (GValue, num_params + 1);
27008 g_value_init (&paramv[0], TYPE_HOST_IPMI);
27009 g_value_set_object (&paramv[0], proxy);
27010 g_variant_iter_init (&iter, parameters);
27011 n = 1;
27012 while ((child = g_variant_iter_next_value (&iter)) != NULL)
27013 {
27014 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
27015 if (arg_info->use_gvariant)
27016 {
27017 g_value_init (&paramv[n], G_TYPE_VARIANT);
27018 g_value_set_variant (&paramv[n], child);
27019 n++;
27020 }
27021 else
27022 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
27023 g_variant_unref (child);
27024 }
27025 signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI);
27026 g_signal_emitv (paramv, signal_id, 0, NULL);
27027 for (n = 0; n < num_params + 1; n++)
27028 g_value_unset (&paramv[n]);
27029 g_free (paramv);
27030}
27031
27032static void
27033host_ipmi_proxy_g_properties_changed (GDBusProxy *_proxy,
27034 GVariant *changed_properties,
27035 const gchar *const *invalidated_properties)
27036{
27037 HostIpmiProxy *proxy = HOST_IPMI_PROXY (_proxy);
27038 guint n;
27039 const gchar *key;
27040 GVariantIter *iter;
27041 _ExtendedGDBusPropertyInfo *info;
27042 g_variant_get (changed_properties, "a{sv}", &iter);
27043 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
27044 {
27045 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, key);
27046 g_datalist_remove_data (&proxy->priv->qdata, key);
27047 if (info != NULL)
27048 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
27049 }
27050 g_variant_iter_free (iter);
27051 for (n = 0; invalidated_properties[n] != NULL; n++)
27052 {
27053 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, invalidated_properties[n]);
27054 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
27055 if (info != NULL)
27056 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
27057 }
27058}
27059
27060static void
27061host_ipmi_proxy_init (HostIpmiProxy *proxy)
27062{
27063#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
27064 proxy->priv = host_ipmi_proxy_get_instance_private (proxy);
27065#else
27066 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_HOST_IPMI_PROXY, HostIpmiProxyPrivate);
27067#endif
27068
27069 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), host_ipmi_interface_info ());
27070}
27071
27072static void
27073host_ipmi_proxy_class_init (HostIpmiProxyClass *klass)
27074{
27075 GObjectClass *gobject_class;
27076 GDBusProxyClass *proxy_class;
27077
27078 gobject_class = G_OBJECT_CLASS (klass);
27079 gobject_class->finalize = host_ipmi_proxy_finalize;
27080 gobject_class->get_property = host_ipmi_proxy_get_property;
27081 gobject_class->set_property = host_ipmi_proxy_set_property;
27082
27083 proxy_class = G_DBUS_PROXY_CLASS (klass);
27084 proxy_class->g_signal = host_ipmi_proxy_g_signal;
27085 proxy_class->g_properties_changed = host_ipmi_proxy_g_properties_changed;
27086
27087#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
27088 g_type_class_add_private (klass, sizeof (HostIpmiProxyPrivate));
27089#endif
27090}
27091
27092static void
27093host_ipmi_proxy_iface_init (HostIpmiIface *iface)
27094{
27095}
27096
27097/**
27098 * host_ipmi_proxy_new:
27099 * @connection: A #GDBusConnection.
27100 * @flags: Flags from the #GDBusProxyFlags enumeration.
27101 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
27102 * @object_path: An object path.
27103 * @cancellable: (allow-none): A #GCancellable or %NULL.
27104 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
27105 * @user_data: User data to pass to @callback.
27106 *
27107 * 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.
27108 *
27109 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
27110 * You can then call host_ipmi_proxy_new_finish() to get the result of the operation.
27111 *
27112 * See host_ipmi_proxy_new_sync() for the synchronous, blocking version of this constructor.
27113 */
27114void
27115host_ipmi_proxy_new (
27116 GDBusConnection *connection,
27117 GDBusProxyFlags flags,
27118 const gchar *name,
27119 const gchar *object_path,
27120 GCancellable *cancellable,
27121 GAsyncReadyCallback callback,
27122 gpointer user_data)
27123{
27124 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);
27125}
27126
27127/**
27128 * host_ipmi_proxy_new_finish:
27129 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new().
27130 * @error: Return location for error or %NULL
27131 *
27132 * Finishes an operation started with host_ipmi_proxy_new().
27133 *
27134 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
27135 */
27136HostIpmi *
27137host_ipmi_proxy_new_finish (
27138 GAsyncResult *res,
27139 GError **error)
27140{
27141 GObject *ret;
27142 GObject *source_object;
27143 source_object = g_async_result_get_source_object (res);
27144 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
27145 g_object_unref (source_object);
27146 if (ret != NULL)
27147 return HOST_IPMI (ret);
27148 else
27149 return NULL;
27150}
27151
27152/**
27153 * host_ipmi_proxy_new_sync:
27154 * @connection: A #GDBusConnection.
27155 * @flags: Flags from the #GDBusProxyFlags enumeration.
27156 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
27157 * @object_path: An object path.
27158 * @cancellable: (allow-none): A #GCancellable or %NULL.
27159 * @error: Return location for error or %NULL
27160 *
27161 * 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.
27162 *
27163 * The calling thread is blocked until a reply is received.
27164 *
27165 * See host_ipmi_proxy_new() for the asynchronous version of this constructor.
27166 *
27167 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
27168 */
27169HostIpmi *
27170host_ipmi_proxy_new_sync (
27171 GDBusConnection *connection,
27172 GDBusProxyFlags flags,
27173 const gchar *name,
27174 const gchar *object_path,
27175 GCancellable *cancellable,
27176 GError **error)
27177{
27178 GInitable *ret;
27179 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);
27180 if (ret != NULL)
27181 return HOST_IPMI (ret);
27182 else
27183 return NULL;
27184}
27185
27186
27187/**
27188 * host_ipmi_proxy_new_for_bus:
27189 * @bus_type: A #GBusType.
27190 * @flags: Flags from the #GDBusProxyFlags enumeration.
27191 * @name: A bus name (well-known or unique).
27192 * @object_path: An object path.
27193 * @cancellable: (allow-none): A #GCancellable or %NULL.
27194 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
27195 * @user_data: User data to pass to @callback.
27196 *
27197 * Like host_ipmi_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
27198 *
27199 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
27200 * You can then call host_ipmi_proxy_new_for_bus_finish() to get the result of the operation.
27201 *
27202 * See host_ipmi_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
27203 */
27204void
27205host_ipmi_proxy_new_for_bus (
27206 GBusType bus_type,
27207 GDBusProxyFlags flags,
27208 const gchar *name,
27209 const gchar *object_path,
27210 GCancellable *cancellable,
27211 GAsyncReadyCallback callback,
27212 gpointer user_data)
27213{
27214 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);
27215}
27216
27217/**
27218 * host_ipmi_proxy_new_for_bus_finish:
27219 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new_for_bus().
27220 * @error: Return location for error or %NULL
27221 *
27222 * Finishes an operation started with host_ipmi_proxy_new_for_bus().
27223 *
27224 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
27225 */
27226HostIpmi *
27227host_ipmi_proxy_new_for_bus_finish (
27228 GAsyncResult *res,
27229 GError **error)
27230{
27231 GObject *ret;
27232 GObject *source_object;
27233 source_object = g_async_result_get_source_object (res);
27234 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
27235 g_object_unref (source_object);
27236 if (ret != NULL)
27237 return HOST_IPMI (ret);
27238 else
27239 return NULL;
27240}
27241
27242/**
27243 * host_ipmi_proxy_new_for_bus_sync:
27244 * @bus_type: A #GBusType.
27245 * @flags: Flags from the #GDBusProxyFlags enumeration.
27246 * @name: A bus name (well-known or unique).
27247 * @object_path: An object path.
27248 * @cancellable: (allow-none): A #GCancellable or %NULL.
27249 * @error: Return location for error or %NULL
27250 *
27251 * Like host_ipmi_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
27252 *
27253 * The calling thread is blocked until a reply is received.
27254 *
27255 * See host_ipmi_proxy_new_for_bus() for the asynchronous version of this constructor.
27256 *
27257 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
27258 */
27259HostIpmi *
27260host_ipmi_proxy_new_for_bus_sync (
27261 GBusType bus_type,
27262 GDBusProxyFlags flags,
27263 const gchar *name,
27264 const gchar *object_path,
27265 GCancellable *cancellable,
27266 GError **error)
27267{
27268 GInitable *ret;
27269 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);
27270 if (ret != NULL)
27271 return HOST_IPMI (ret);
27272 else
27273 return NULL;
27274}
27275
27276
27277/* ------------------------------------------------------------------------ */
27278
27279/**
27280 * HostIpmiSkeleton:
27281 *
27282 * The #HostIpmiSkeleton structure contains only private data and should only be accessed using the provided API.
27283 */
27284
27285/**
27286 * HostIpmiSkeletonClass:
27287 * @parent_class: The parent class.
27288 *
27289 * Class structure for #HostIpmiSkeleton.
27290 */
27291
27292struct _HostIpmiSkeletonPrivate
27293{
27294 GValue *properties;
27295 GList *changed_properties;
27296 GSource *changed_properties_idle_source;
27297 GMainContext *context;
27298 GMutex lock;
27299};
27300
27301static void
27302_host_ipmi_skeleton_handle_method_call (
27303 GDBusConnection *connection G_GNUC_UNUSED,
27304 const gchar *sender G_GNUC_UNUSED,
27305 const gchar *object_path G_GNUC_UNUSED,
27306 const gchar *interface_name,
27307 const gchar *method_name,
27308 GVariant *parameters,
27309 GDBusMethodInvocation *invocation,
27310 gpointer user_data)
27311{
27312 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
27313 _ExtendedGDBusMethodInfo *info;
27314 GVariantIter iter;
27315 GVariant *child;
27316 GValue *paramv;
27317 guint num_params;
27318 guint num_extra;
27319 guint n;
27320 guint signal_id;
27321 GValue return_value = G_VALUE_INIT;
27322 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
27323 g_assert (info != NULL);
27324 num_params = g_variant_n_children (parameters);
27325 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
27326 n = 0;
27327 g_value_init (&paramv[n], TYPE_HOST_IPMI);
27328 g_value_set_object (&paramv[n++], skeleton);
27329 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
27330 g_value_set_object (&paramv[n++], invocation);
27331 if (info->pass_fdlist)
27332 {
27333#ifdef G_OS_UNIX
27334 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
27335 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
27336#else
27337 g_assert_not_reached ();
27338#endif
27339 }
27340 g_variant_iter_init (&iter, parameters);
27341 while ((child = g_variant_iter_next_value (&iter)) != NULL)
27342 {
27343 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
27344 if (arg_info->use_gvariant)
27345 {
27346 g_value_init (&paramv[n], G_TYPE_VARIANT);
27347 g_value_set_variant (&paramv[n], child);
27348 n++;
27349 }
27350 else
27351 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
27352 g_variant_unref (child);
27353 }
27354 signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI);
27355 g_value_init (&return_value, G_TYPE_BOOLEAN);
27356 g_signal_emitv (paramv, signal_id, 0, &return_value);
27357 if (!g_value_get_boolean (&return_value))
27358 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);
27359 g_value_unset (&return_value);
27360 for (n = 0; n < num_params + num_extra; n++)
27361 g_value_unset (&paramv[n]);
27362 g_free (paramv);
27363}
27364
27365static GVariant *
27366_host_ipmi_skeleton_handle_get_property (
27367 GDBusConnection *connection G_GNUC_UNUSED,
27368 const gchar *sender G_GNUC_UNUSED,
27369 const gchar *object_path G_GNUC_UNUSED,
27370 const gchar *interface_name G_GNUC_UNUSED,
27371 const gchar *property_name,
27372 GError **error,
27373 gpointer user_data)
27374{
27375 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
27376 GValue value = G_VALUE_INIT;
27377 GParamSpec *pspec;
27378 _ExtendedGDBusPropertyInfo *info;
27379 GVariant *ret;
27380 ret = NULL;
27381 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name);
27382 g_assert (info != NULL);
27383 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
27384 if (pspec == NULL)
27385 {
27386 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
27387 }
27388 else
27389 {
27390 g_value_init (&value, pspec->value_type);
27391 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
27392 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
27393 g_value_unset (&value);
27394 }
27395 return ret;
27396}
27397
27398static gboolean
27399_host_ipmi_skeleton_handle_set_property (
27400 GDBusConnection *connection G_GNUC_UNUSED,
27401 const gchar *sender G_GNUC_UNUSED,
27402 const gchar *object_path G_GNUC_UNUSED,
27403 const gchar *interface_name G_GNUC_UNUSED,
27404 const gchar *property_name,
27405 GVariant *variant,
27406 GError **error,
27407 gpointer user_data)
27408{
27409 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
27410 GValue value = G_VALUE_INIT;
27411 GParamSpec *pspec;
27412 _ExtendedGDBusPropertyInfo *info;
27413 gboolean ret;
27414 ret = FALSE;
27415 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name);
27416 g_assert (info != NULL);
27417 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
27418 if (pspec == NULL)
27419 {
27420 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
27421 }
27422 else
27423 {
27424 if (info->use_gvariant)
27425 g_value_set_variant (&value, variant);
27426 else
27427 g_dbus_gvariant_to_gvalue (variant, &value);
27428 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
27429 g_value_unset (&value);
27430 ret = TRUE;
27431 }
27432 return ret;
27433}
27434
27435static const GDBusInterfaceVTable _host_ipmi_skeleton_vtable =
27436{
27437 _host_ipmi_skeleton_handle_method_call,
27438 _host_ipmi_skeleton_handle_get_property,
27439 _host_ipmi_skeleton_handle_set_property,
27440 {NULL}
27441};
27442
27443static GDBusInterfaceInfo *
27444host_ipmi_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
27445{
27446 return host_ipmi_interface_info ();
27447}
27448
27449static GDBusInterfaceVTable *
27450host_ipmi_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
27451{
27452 return (GDBusInterfaceVTable *) &_host_ipmi_skeleton_vtable;
27453}
27454
27455static GVariant *
27456host_ipmi_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
27457{
27458 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (_skeleton);
27459
27460 GVariantBuilder builder;
27461 guint n;
27462 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
27463 if (_host_ipmi_interface_info.parent_struct.properties == NULL)
27464 goto out;
27465 for (n = 0; _host_ipmi_interface_info.parent_struct.properties[n] != NULL; n++)
27466 {
27467 GDBusPropertyInfo *info = _host_ipmi_interface_info.parent_struct.properties[n];
27468 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
27469 {
27470 GVariant *value;
27471 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);
27472 if (value != NULL)
27473 {
27474 g_variant_take_ref (value);
27475 g_variant_builder_add (&builder, "{sv}", info->name, value);
27476 g_variant_unref (value);
27477 }
27478 }
27479 }
27480out:
27481 return g_variant_builder_end (&builder);
27482}
27483
27484static void
27485host_ipmi_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
27486{
27487}
27488
27489static void
27490_host_ipmi_on_signal_received_message (
27491 HostIpmi *object,
27492 guchar arg_seq,
27493 guchar arg_netfn,
27494 guchar arg_cmd,
27495 const gchar *arg_data)
27496{
27497 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object);
27498
27499 GList *connections, *l;
27500 GVariant *signal_variant;
27501 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
27502
27503 signal_variant = g_variant_ref_sink (g_variant_new ("(yyy^ay)",
27504 arg_seq,
27505 arg_netfn,
27506 arg_cmd,
27507 arg_data));
27508 for (l = connections; l != NULL; l = l->next)
27509 {
27510 GDBusConnection *connection = l->data;
27511 g_dbus_connection_emit_signal (connection,
27512 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.HostIpmi", "ReceivedMessage",
27513 signal_variant, NULL);
27514 }
27515 g_variant_unref (signal_variant);
27516 g_list_free_full (connections, g_object_unref);
27517}
27518
27519static void host_ipmi_skeleton_iface_init (HostIpmiIface *iface);
27520#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
27521G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
27522 G_ADD_PRIVATE (HostIpmiSkeleton)
27523 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init));
27524
27525#else
27526G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
27527 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init));
27528
27529#endif
27530static void
27531host_ipmi_skeleton_finalize (GObject *object)
27532{
27533 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object);
27534 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
27535 if (skeleton->priv->changed_properties_idle_source != NULL)
27536 g_source_destroy (skeleton->priv->changed_properties_idle_source);
27537 g_main_context_unref (skeleton->priv->context);
27538 g_mutex_clear (&skeleton->priv->lock);
27539 G_OBJECT_CLASS (host_ipmi_skeleton_parent_class)->finalize (object);
27540}
27541
27542static void
27543host_ipmi_skeleton_init (HostIpmiSkeleton *skeleton)
27544{
27545#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
27546 skeleton->priv = host_ipmi_skeleton_get_instance_private (skeleton);
27547#else
27548 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_HOST_IPMI_SKELETON, HostIpmiSkeletonPrivate);
27549#endif
27550
27551 g_mutex_init (&skeleton->priv->lock);
27552 skeleton->priv->context = g_main_context_ref_thread_default ();
27553}
27554
27555static void
27556host_ipmi_skeleton_class_init (HostIpmiSkeletonClass *klass)
27557{
27558 GObjectClass *gobject_class;
27559 GDBusInterfaceSkeletonClass *skeleton_class;
27560
27561 gobject_class = G_OBJECT_CLASS (klass);
27562 gobject_class->finalize = host_ipmi_skeleton_finalize;
27563
27564 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
27565 skeleton_class->get_info = host_ipmi_skeleton_dbus_interface_get_info;
27566 skeleton_class->get_properties = host_ipmi_skeleton_dbus_interface_get_properties;
27567 skeleton_class->flush = host_ipmi_skeleton_dbus_interface_flush;
27568 skeleton_class->get_vtable = host_ipmi_skeleton_dbus_interface_get_vtable;
27569
27570#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
27571 g_type_class_add_private (klass, sizeof (HostIpmiSkeletonPrivate));
27572#endif
27573}
27574
27575static void
27576host_ipmi_skeleton_iface_init (HostIpmiIface *iface)
27577{
27578 iface->received_message = _host_ipmi_on_signal_received_message;
27579}
27580
27581/**
27582 * host_ipmi_skeleton_new:
27583 *
27584 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
27585 *
27586 * Returns: (transfer full) (type HostIpmiSkeleton): The skeleton object.
27587 */
27588HostIpmi *
27589host_ipmi_skeleton_new (void)
27590{
27591 return HOST_IPMI (g_object_new (TYPE_HOST_IPMI_SKELETON, NULL));
27592}
27593
27594/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050027595 * Code for Object, ObjectProxy and ObjectSkeleton
27596 * ------------------------------------------------------------------------
27597 */
27598
27599/**
27600 * SECTION:Object
27601 * @title: Object
27602 * @short_description: Specialized GDBusObject types
27603 *
27604 * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
27605 */
27606
27607/**
27608 * Object:
27609 *
27610 * The #Object type is a specialized container of interfaces.
27611 */
27612
27613/**
27614 * ObjectIface:
27615 * @parent_iface: The parent interface.
27616 *
27617 * Virtual table for the #Object interface.
27618 */
27619
27620typedef ObjectIface ObjectInterface;
27621G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));
27622
27623static void
27624object_default_init (ObjectIface *iface)
27625{
27626 /**
Norman James362a80f2015-09-14 14:04:39 -050027627 * Object:fan:
27628 *
27629 * 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.
27630 *
27631 * Connect to the #GObject::notify signal to get informed of property changes.
27632 */
27633 g_object_interface_install_property (iface, g_param_spec_object ("fan", "fan", "fan", TYPE_FAN, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
27634
27635 /**
27636 * Object:sensor-value:
27637 *
27638 * 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.
27639 *
27640 * Connect to the #GObject::notify signal to get informed of property changes.
27641 */
27642 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));
27643
27644 /**
27645 * Object:sensor-threshold:
27646 *
27647 * 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.
27648 *
27649 * Connect to the #GObject::notify signal to get informed of property changes.
27650 */
27651 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));
27652
27653 /**
27654 * Object:sensor-i2c:
27655 *
27656 * 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.
27657 *
27658 * Connect to the #GObject::notify signal to get informed of property changes.
27659 */
27660 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));
27661
27662 /**
27663 * Object:sensor-match:
27664 *
27665 * 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.
27666 *
27667 * Connect to the #GObject::notify signal to get informed of property changes.
27668 */
27669 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));
27670
27671 /**
27672 * Object:process:
27673 *
27674 * 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.
27675 *
27676 * Connect to the #GObject::notify signal to get informed of property changes.
27677 */
27678 g_object_interface_install_property (iface, g_param_spec_object ("process", "process", "process", TYPE_PROCESS, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
27679
27680 /**
Norman James18998182015-10-11 21:54:53 -050027681 * Object:shared-resource:
27682 *
27683 * 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.
27684 *
27685 * Connect to the #GObject::notify signal to get informed of property changes.
27686 */
27687 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));
27688
27689 /**
Norman James362a80f2015-09-14 14:04:39 -050027690 * Object:control:
27691 *
27692 * 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.
27693 *
27694 * Connect to the #GObject::notify signal to get informed of property changes.
27695 */
27696 g_object_interface_install_property (iface, g_param_spec_object ("control", "control", "control", TYPE_CONTROL, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
27697
27698 /**
27699 * Object:control-bmc:
27700 *
27701 * 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.
27702 *
27703 * Connect to the #GObject::notify signal to get informed of property changes.
27704 */
27705 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));
27706
27707 /**
27708 * Object:control-host:
27709 *
27710 * 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.
27711 *
27712 * Connect to the #GObject::notify signal to get informed of property changes.
27713 */
27714 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));
27715
27716 /**
27717 * Object:control-power:
27718 *
27719 * 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.
27720 *
27721 * Connect to the #GObject::notify signal to get informed of property changes.
27722 */
27723 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));
27724
27725 /**
27726 * Object:watchdog:
27727 *
27728 * 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.
27729 *
27730 * Connect to the #GObject::notify signal to get informed of property changes.
27731 */
27732 g_object_interface_install_property (iface, g_param_spec_object ("watchdog", "watchdog", "watchdog", TYPE_WATCHDOG, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
27733
27734 /**
27735 * Object:event-log:
27736 *
27737 * 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.
27738 *
27739 * Connect to the #GObject::notify signal to get informed of property changes.
27740 */
27741 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));
27742
27743 /**
27744 * Object:flash:
27745 *
27746 * 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.
27747 *
27748 * Connect to the #GObject::notify signal to get informed of property changes.
27749 */
27750 g_object_interface_install_property (iface, g_param_spec_object ("flash", "flash", "flash", TYPE_FLASH, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
27751
27752 /**
Norman James18998182015-10-11 21:54:53 -050027753 * Object:flash-control:
27754 *
27755 * 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.
27756 *
27757 * Connect to the #GObject::notify signal to get informed of property changes.
27758 */
27759 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));
27760
27761 /**
Norman James362a80f2015-09-14 14:04:39 -050027762 * Object:button:
27763 *
27764 * 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.
27765 *
27766 * Connect to the #GObject::notify signal to get informed of property changes.
27767 */
27768 g_object_interface_install_property (iface, g_param_spec_object ("button", "button", "button", TYPE_BUTTON, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
27769
27770 /**
27771 * Object:led:
27772 *
27773 * 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.
27774 *
27775 * Connect to the #GObject::notify signal to get informed of property changes.
27776 */
27777 g_object_interface_install_property (iface, g_param_spec_object ("led", "led", "led", TYPE_LED, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
27778
Norman Jamesdbcffbd2015-10-06 16:53:06 -050027779 /**
27780 * Object:host-ipmi:
27781 *
27782 * 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.
27783 *
27784 * Connect to the #GObject::notify signal to get informed of property changes.
27785 */
27786 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));
27787
Norman James362a80f2015-09-14 14:04:39 -050027788}
27789
27790/**
Norman James362a80f2015-09-14 14:04:39 -050027791 * object_get_fan:
27792 * @object: A #Object.
27793 *
27794 * 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.
27795 *
27796 * Returns: (transfer full): A #Fan that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
27797 */
27798Fan *object_get_fan (Object *object)
27799{
27800 GDBusInterface *ret;
27801 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
27802 if (ret == NULL)
27803 return NULL;
27804 return FAN (ret);
27805}
27806
27807/**
27808 * object_get_sensor_value:
27809 * @object: A #Object.
27810 *
27811 * 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.
27812 *
27813 * Returns: (transfer full): A #SensorValue that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
27814 */
27815SensorValue *object_get_sensor_value (Object *object)
27816{
27817 GDBusInterface *ret;
27818 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
27819 if (ret == NULL)
27820 return NULL;
27821 return SENSOR_VALUE (ret);
27822}
27823
27824/**
27825 * object_get_sensor_threshold:
27826 * @object: A #Object.
27827 *
27828 * 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.
27829 *
27830 * Returns: (transfer full): A #SensorThreshold that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
27831 */
27832SensorThreshold *object_get_sensor_threshold (Object *object)
27833{
27834 GDBusInterface *ret;
27835 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
27836 if (ret == NULL)
27837 return NULL;
27838 return SENSOR_THRESHOLD (ret);
27839}
27840
27841/**
27842 * object_get_sensor_i2c:
27843 * @object: A #Object.
27844 *
27845 * 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.
27846 *
27847 * Returns: (transfer full): A #SensorI2c that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
27848 */
27849SensorI2c *object_get_sensor_i2c (Object *object)
27850{
27851 GDBusInterface *ret;
27852 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
27853 if (ret == NULL)
27854 return NULL;
27855 return SENSOR_I2C (ret);
27856}
27857
27858/**
27859 * object_get_sensor_match:
27860 * @object: A #Object.
27861 *
27862 * 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.
27863 *
27864 * Returns: (transfer full): A #SensorMatch that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
27865 */
27866SensorMatch *object_get_sensor_match (Object *object)
27867{
27868 GDBusInterface *ret;
27869 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
27870 if (ret == NULL)
27871 return NULL;
27872 return SENSOR_MATCH (ret);
27873}
27874
27875/**
27876 * object_get_process:
27877 * @object: A #Object.
27878 *
27879 * 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.
27880 *
27881 * Returns: (transfer full): A #Process that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
27882 */
27883Process *object_get_process (Object *object)
27884{
27885 GDBusInterface *ret;
27886 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
27887 if (ret == NULL)
27888 return NULL;
27889 return PROCESS (ret);
27890}
27891
27892/**
Norman James18998182015-10-11 21:54:53 -050027893 * object_get_shared_resource:
27894 * @object: A #Object.
27895 *
27896 * 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.
27897 *
27898 * Returns: (transfer full): A #SharedResource that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
27899 */
27900SharedResource *object_get_shared_resource (Object *object)
27901{
27902 GDBusInterface *ret;
27903 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
27904 if (ret == NULL)
27905 return NULL;
27906 return SHARED_RESOURCE (ret);
27907}
27908
27909/**
Norman James362a80f2015-09-14 14:04:39 -050027910 * object_get_control:
27911 * @object: A #Object.
27912 *
27913 * 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.
27914 *
27915 * Returns: (transfer full): A #Control that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
27916 */
27917Control *object_get_control (Object *object)
27918{
27919 GDBusInterface *ret;
27920 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
27921 if (ret == NULL)
27922 return NULL;
27923 return CONTROL (ret);
27924}
27925
27926/**
27927 * object_get_control_bmc:
27928 * @object: A #Object.
27929 *
27930 * 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.
27931 *
27932 * Returns: (transfer full): A #ControlBmc that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
27933 */
27934ControlBmc *object_get_control_bmc (Object *object)
27935{
27936 GDBusInterface *ret;
27937 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
27938 if (ret == NULL)
27939 return NULL;
27940 return CONTROL_BMC (ret);
27941}
27942
27943/**
27944 * object_get_control_host:
27945 * @object: A #Object.
27946 *
27947 * 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.
27948 *
27949 * Returns: (transfer full): A #ControlHost that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
27950 */
27951ControlHost *object_get_control_host (Object *object)
27952{
27953 GDBusInterface *ret;
27954 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
27955 if (ret == NULL)
27956 return NULL;
27957 return CONTROL_HOST (ret);
27958}
27959
27960/**
27961 * object_get_control_power:
27962 * @object: A #Object.
27963 *
27964 * 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.
27965 *
27966 * Returns: (transfer full): A #ControlPower that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
27967 */
27968ControlPower *object_get_control_power (Object *object)
27969{
27970 GDBusInterface *ret;
27971 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
27972 if (ret == NULL)
27973 return NULL;
27974 return CONTROL_POWER (ret);
27975}
27976
27977/**
27978 * object_get_watchdog:
27979 * @object: A #Object.
27980 *
27981 * 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.
27982 *
27983 * Returns: (transfer full): A #Watchdog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
27984 */
27985Watchdog *object_get_watchdog (Object *object)
27986{
27987 GDBusInterface *ret;
27988 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
27989 if (ret == NULL)
27990 return NULL;
27991 return WATCHDOG (ret);
27992}
27993
27994/**
27995 * object_get_event_log:
27996 * @object: A #Object.
27997 *
27998 * 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.
27999 *
28000 * Returns: (transfer full): A #EventLog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28001 */
28002EventLog *object_get_event_log (Object *object)
28003{
28004 GDBusInterface *ret;
28005 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
28006 if (ret == NULL)
28007 return NULL;
28008 return EVENT_LOG (ret);
28009}
28010
28011/**
28012 * object_get_flash:
28013 * @object: A #Object.
28014 *
28015 * 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.
28016 *
28017 * Returns: (transfer full): A #Flash that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28018 */
28019Flash *object_get_flash (Object *object)
28020{
28021 GDBusInterface *ret;
28022 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
28023 if (ret == NULL)
28024 return NULL;
28025 return FLASH (ret);
28026}
28027
28028/**
Norman James18998182015-10-11 21:54:53 -050028029 * object_get_flash_control:
28030 * @object: A #Object.
28031 *
28032 * 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.
28033 *
28034 * Returns: (transfer full): A #FlashControl that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28035 */
28036FlashControl *object_get_flash_control (Object *object)
28037{
28038 GDBusInterface *ret;
28039 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
28040 if (ret == NULL)
28041 return NULL;
28042 return FLASH_CONTROL (ret);
28043}
28044
28045/**
Norman James362a80f2015-09-14 14:04:39 -050028046 * object_get_button:
28047 * @object: A #Object.
28048 *
28049 * 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.
28050 *
28051 * Returns: (transfer full): A #Button that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28052 */
28053Button *object_get_button (Object *object)
28054{
28055 GDBusInterface *ret;
28056 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
28057 if (ret == NULL)
28058 return NULL;
28059 return BUTTON (ret);
28060}
28061
28062/**
28063 * object_get_led:
28064 * @object: A #Object.
28065 *
28066 * 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.
28067 *
28068 * Returns: (transfer full): A #Led that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28069 */
28070Led *object_get_led (Object *object)
28071{
28072 GDBusInterface *ret;
28073 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
28074 if (ret == NULL)
28075 return NULL;
28076 return LED (ret);
28077}
28078
Norman Jamesdbcffbd2015-10-06 16:53:06 -050028079/**
28080 * object_get_host_ipmi:
28081 * @object: A #Object.
28082 *
28083 * 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.
28084 *
28085 * Returns: (transfer full): A #HostIpmi that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28086 */
28087HostIpmi *object_get_host_ipmi (Object *object)
28088{
28089 GDBusInterface *ret;
28090 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
28091 if (ret == NULL)
28092 return NULL;
28093 return HOST_IPMI (ret);
28094}
28095
Norman James362a80f2015-09-14 14:04:39 -050028096
28097/**
Norman James362a80f2015-09-14 14:04:39 -050028098 * object_peek_fan: (skip)
28099 * @object: A #Object.
28100 *
28101 * Like object_get_fan() but doesn't increase the reference count on the returned object.
28102 *
28103 * <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>
28104 *
28105 * 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.
28106 */
28107Fan *object_peek_fan (Object *object)
28108{
28109 GDBusInterface *ret;
28110 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
28111 if (ret == NULL)
28112 return NULL;
28113 g_object_unref (ret);
28114 return FAN (ret);
28115}
28116
28117/**
28118 * object_peek_sensor_value: (skip)
28119 * @object: A #Object.
28120 *
28121 * Like object_get_sensor_value() but doesn't increase the reference count on the returned object.
28122 *
28123 * <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>
28124 *
28125 * 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.
28126 */
28127SensorValue *object_peek_sensor_value (Object *object)
28128{
28129 GDBusInterface *ret;
28130 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
28131 if (ret == NULL)
28132 return NULL;
28133 g_object_unref (ret);
28134 return SENSOR_VALUE (ret);
28135}
28136
28137/**
28138 * object_peek_sensor_threshold: (skip)
28139 * @object: A #Object.
28140 *
28141 * Like object_get_sensor_threshold() but doesn't increase the reference count on the returned object.
28142 *
28143 * <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>
28144 *
28145 * 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.
28146 */
28147SensorThreshold *object_peek_sensor_threshold (Object *object)
28148{
28149 GDBusInterface *ret;
28150 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
28151 if (ret == NULL)
28152 return NULL;
28153 g_object_unref (ret);
28154 return SENSOR_THRESHOLD (ret);
28155}
28156
28157/**
28158 * object_peek_sensor_i2c: (skip)
28159 * @object: A #Object.
28160 *
28161 * Like object_get_sensor_i2c() but doesn't increase the reference count on the returned object.
28162 *
28163 * <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>
28164 *
28165 * 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.
28166 */
28167SensorI2c *object_peek_sensor_i2c (Object *object)
28168{
28169 GDBusInterface *ret;
28170 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
28171 if (ret == NULL)
28172 return NULL;
28173 g_object_unref (ret);
28174 return SENSOR_I2C (ret);
28175}
28176
28177/**
28178 * object_peek_sensor_match: (skip)
28179 * @object: A #Object.
28180 *
28181 * Like object_get_sensor_match() but doesn't increase the reference count on the returned object.
28182 *
28183 * <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>
28184 *
28185 * 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.
28186 */
28187SensorMatch *object_peek_sensor_match (Object *object)
28188{
28189 GDBusInterface *ret;
28190 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
28191 if (ret == NULL)
28192 return NULL;
28193 g_object_unref (ret);
28194 return SENSOR_MATCH (ret);
28195}
28196
28197/**
28198 * object_peek_process: (skip)
28199 * @object: A #Object.
28200 *
28201 * Like object_get_process() but doesn't increase the reference count on the returned object.
28202 *
28203 * <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>
28204 *
28205 * 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.
28206 */
28207Process *object_peek_process (Object *object)
28208{
28209 GDBusInterface *ret;
28210 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
28211 if (ret == NULL)
28212 return NULL;
28213 g_object_unref (ret);
28214 return PROCESS (ret);
28215}
28216
28217/**
Norman James18998182015-10-11 21:54:53 -050028218 * object_peek_shared_resource: (skip)
28219 * @object: A #Object.
28220 *
28221 * Like object_get_shared_resource() but doesn't increase the reference count on the returned object.
28222 *
28223 * <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>
28224 *
28225 * 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.
28226 */
28227SharedResource *object_peek_shared_resource (Object *object)
28228{
28229 GDBusInterface *ret;
28230 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
28231 if (ret == NULL)
28232 return NULL;
28233 g_object_unref (ret);
28234 return SHARED_RESOURCE (ret);
28235}
28236
28237/**
Norman James362a80f2015-09-14 14:04:39 -050028238 * object_peek_control: (skip)
28239 * @object: A #Object.
28240 *
28241 * Like object_get_control() but doesn't increase the reference count on the returned object.
28242 *
28243 * <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>
28244 *
28245 * 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.
28246 */
28247Control *object_peek_control (Object *object)
28248{
28249 GDBusInterface *ret;
28250 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
28251 if (ret == NULL)
28252 return NULL;
28253 g_object_unref (ret);
28254 return CONTROL (ret);
28255}
28256
28257/**
28258 * object_peek_control_bmc: (skip)
28259 * @object: A #Object.
28260 *
28261 * Like object_get_control_bmc() but doesn't increase the reference count on the returned object.
28262 *
28263 * <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>
28264 *
28265 * 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.
28266 */
28267ControlBmc *object_peek_control_bmc (Object *object)
28268{
28269 GDBusInterface *ret;
28270 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
28271 if (ret == NULL)
28272 return NULL;
28273 g_object_unref (ret);
28274 return CONTROL_BMC (ret);
28275}
28276
28277/**
28278 * object_peek_control_host: (skip)
28279 * @object: A #Object.
28280 *
28281 * Like object_get_control_host() but doesn't increase the reference count on the returned object.
28282 *
28283 * <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>
28284 *
28285 * 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.
28286 */
28287ControlHost *object_peek_control_host (Object *object)
28288{
28289 GDBusInterface *ret;
28290 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
28291 if (ret == NULL)
28292 return NULL;
28293 g_object_unref (ret);
28294 return CONTROL_HOST (ret);
28295}
28296
28297/**
28298 * object_peek_control_power: (skip)
28299 * @object: A #Object.
28300 *
28301 * Like object_get_control_power() but doesn't increase the reference count on the returned object.
28302 *
28303 * <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>
28304 *
28305 * 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.
28306 */
28307ControlPower *object_peek_control_power (Object *object)
28308{
28309 GDBusInterface *ret;
28310 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
28311 if (ret == NULL)
28312 return NULL;
28313 g_object_unref (ret);
28314 return CONTROL_POWER (ret);
28315}
28316
28317/**
28318 * object_peek_watchdog: (skip)
28319 * @object: A #Object.
28320 *
28321 * Like object_get_watchdog() but doesn't increase the reference count on the returned object.
28322 *
28323 * <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>
28324 *
28325 * 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.
28326 */
28327Watchdog *object_peek_watchdog (Object *object)
28328{
28329 GDBusInterface *ret;
28330 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
28331 if (ret == NULL)
28332 return NULL;
28333 g_object_unref (ret);
28334 return WATCHDOG (ret);
28335}
28336
28337/**
28338 * object_peek_event_log: (skip)
28339 * @object: A #Object.
28340 *
28341 * Like object_get_event_log() but doesn't increase the reference count on the returned object.
28342 *
28343 * <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>
28344 *
28345 * 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.
28346 */
28347EventLog *object_peek_event_log (Object *object)
28348{
28349 GDBusInterface *ret;
28350 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
28351 if (ret == NULL)
28352 return NULL;
28353 g_object_unref (ret);
28354 return EVENT_LOG (ret);
28355}
28356
28357/**
28358 * object_peek_flash: (skip)
28359 * @object: A #Object.
28360 *
28361 * Like object_get_flash() but doesn't increase the reference count on the returned object.
28362 *
28363 * <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>
28364 *
28365 * 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.
28366 */
28367Flash *object_peek_flash (Object *object)
28368{
28369 GDBusInterface *ret;
28370 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
28371 if (ret == NULL)
28372 return NULL;
28373 g_object_unref (ret);
28374 return FLASH (ret);
28375}
28376
28377/**
Norman James18998182015-10-11 21:54:53 -050028378 * object_peek_flash_control: (skip)
28379 * @object: A #Object.
28380 *
28381 * Like object_get_flash_control() but doesn't increase the reference count on the returned object.
28382 *
28383 * <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>
28384 *
28385 * 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.
28386 */
28387FlashControl *object_peek_flash_control (Object *object)
28388{
28389 GDBusInterface *ret;
28390 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
28391 if (ret == NULL)
28392 return NULL;
28393 g_object_unref (ret);
28394 return FLASH_CONTROL (ret);
28395}
28396
28397/**
Norman James362a80f2015-09-14 14:04:39 -050028398 * object_peek_button: (skip)
28399 * @object: A #Object.
28400 *
28401 * Like object_get_button() but doesn't increase the reference count on the returned object.
28402 *
28403 * <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>
28404 *
28405 * 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.
28406 */
28407Button *object_peek_button (Object *object)
28408{
28409 GDBusInterface *ret;
28410 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
28411 if (ret == NULL)
28412 return NULL;
28413 g_object_unref (ret);
28414 return BUTTON (ret);
28415}
28416
28417/**
28418 * object_peek_led: (skip)
28419 * @object: A #Object.
28420 *
28421 * Like object_get_led() but doesn't increase the reference count on the returned object.
28422 *
28423 * <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>
28424 *
28425 * 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.
28426 */
28427Led *object_peek_led (Object *object)
28428{
28429 GDBusInterface *ret;
28430 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
28431 if (ret == NULL)
28432 return NULL;
28433 g_object_unref (ret);
28434 return LED (ret);
28435}
28436
Norman Jamesdbcffbd2015-10-06 16:53:06 -050028437/**
28438 * object_peek_host_ipmi: (skip)
28439 * @object: A #Object.
28440 *
28441 * Like object_get_host_ipmi() but doesn't increase the reference count on the returned object.
28442 *
28443 * <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>
28444 *
28445 * 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.
28446 */
28447HostIpmi *object_peek_host_ipmi (Object *object)
28448{
28449 GDBusInterface *ret;
28450 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
28451 if (ret == NULL)
28452 return NULL;
28453 g_object_unref (ret);
28454 return HOST_IPMI (ret);
28455}
28456
Norman James362a80f2015-09-14 14:04:39 -050028457
28458static void
28459object_notify (GDBusObject *object, GDBusInterface *interface)
28460{
28461 _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
28462 /* info can be NULL if the other end is using a D-Bus interface we don't know
28463 * anything about, for example old generated code in this process talking to
28464 * newer generated code in the other process. */
28465 if (info != NULL)
28466 g_object_notify (G_OBJECT (object), info->hyphen_name);
28467}
28468
28469/**
28470 * ObjectProxy:
28471 *
28472 * The #ObjectProxy structure contains only private data and should only be accessed using the provided API.
28473 */
28474
28475/**
28476 * ObjectProxyClass:
28477 * @parent_class: The parent class.
28478 *
28479 * Class structure for #ObjectProxy.
28480 */
28481
28482static void
28483object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
28484{
28485}
28486
28487static void
28488object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
28489{
28490 iface->interface_added = object_notify;
28491 iface->interface_removed = object_notify;
28492}
28493
28494
28495G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
28496 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init)
28497 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init));
28498
28499static void
28500object_proxy_init (ObjectProxy *object G_GNUC_UNUSED)
28501{
28502}
28503
28504static void
28505object_proxy_set_property (GObject *gobject,
28506 guint prop_id,
28507 const GValue *value G_GNUC_UNUSED,
28508 GParamSpec *pspec)
28509{
28510 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
28511}
28512
28513static void
28514object_proxy_get_property (GObject *gobject,
28515 guint prop_id,
28516 GValue *value,
28517 GParamSpec *pspec)
28518{
28519 ObjectProxy *object = OBJECT_PROXY (gobject);
28520 GDBusInterface *interface;
28521
28522 switch (prop_id)
28523 {
28524 case 1:
Norman James362a80f2015-09-14 14:04:39 -050028525 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
28526 g_value_take_object (value, interface);
28527 break;
28528
Norman Jamesa3e47c42015-10-18 14:43:10 -050028529 case 2:
Norman James362a80f2015-09-14 14:04:39 -050028530 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
28531 g_value_take_object (value, interface);
28532 break;
28533
Norman Jamesa3e47c42015-10-18 14:43:10 -050028534 case 3:
Norman Jamesdfdaca92015-09-27 22:11:15 -050028535 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman James362a80f2015-09-14 14:04:39 -050028536 g_value_take_object (value, interface);
28537 break;
28538
Norman Jamesa3e47c42015-10-18 14:43:10 -050028539 case 4:
Norman Jamesdfdaca92015-09-27 22:11:15 -050028540 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman James362a80f2015-09-14 14:04:39 -050028541 g_value_take_object (value, interface);
28542 break;
28543
Norman Jamesa3e47c42015-10-18 14:43:10 -050028544 case 5:
Norman Jamesdfdaca92015-09-27 22:11:15 -050028545 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
Norman James362a80f2015-09-14 14:04:39 -050028546 g_value_take_object (value, interface);
28547 break;
28548
Norman Jamesa3e47c42015-10-18 14:43:10 -050028549 case 6:
Norman Jamesdfdaca92015-09-27 22:11:15 -050028550 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
Norman James362a80f2015-09-14 14:04:39 -050028551 g_value_take_object (value, interface);
28552 break;
28553
Norman Jamesa3e47c42015-10-18 14:43:10 -050028554 case 7:
Norman James18998182015-10-11 21:54:53 -050028555 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
Norman James362a80f2015-09-14 14:04:39 -050028556 g_value_take_object (value, interface);
28557 break;
28558
Norman Jamesa3e47c42015-10-18 14:43:10 -050028559 case 8:
Norman James18998182015-10-11 21:54:53 -050028560 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
Norman James362a80f2015-09-14 14:04:39 -050028561 g_value_take_object (value, interface);
28562 break;
28563
Norman Jamesa3e47c42015-10-18 14:43:10 -050028564 case 9:
Norman James18998182015-10-11 21:54:53 -050028565 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
Norman James362a80f2015-09-14 14:04:39 -050028566 g_value_take_object (value, interface);
28567 break;
28568
Norman Jamesa3e47c42015-10-18 14:43:10 -050028569 case 10:
Norman James18998182015-10-11 21:54:53 -050028570 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
Norman James362a80f2015-09-14 14:04:39 -050028571 g_value_take_object (value, interface);
28572 break;
28573
Norman Jamesa3e47c42015-10-18 14:43:10 -050028574 case 11:
Norman James18998182015-10-11 21:54:53 -050028575 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
Norman James362a80f2015-09-14 14:04:39 -050028576 g_value_take_object (value, interface);
28577 break;
28578
Norman Jamesa3e47c42015-10-18 14:43:10 -050028579 case 12:
Norman James18998182015-10-11 21:54:53 -050028580 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
Norman James362a80f2015-09-14 14:04:39 -050028581 g_value_take_object (value, interface);
28582 break;
28583
Norman Jamesa3e47c42015-10-18 14:43:10 -050028584 case 13:
Norman James18998182015-10-11 21:54:53 -050028585 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
Norman James362a80f2015-09-14 14:04:39 -050028586 g_value_take_object (value, interface);
28587 break;
28588
Norman Jamesa3e47c42015-10-18 14:43:10 -050028589 case 14:
Norman James18998182015-10-11 21:54:53 -050028590 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
Norman Jamesdfdaca92015-09-27 22:11:15 -050028591 g_value_take_object (value, interface);
28592 break;
28593
Norman Jamesa3e47c42015-10-18 14:43:10 -050028594 case 15:
Norman James18998182015-10-11 21:54:53 -050028595 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
Norman James362a80f2015-09-14 14:04:39 -050028596 g_value_take_object (value, interface);
28597 break;
28598
Norman Jamesa3e47c42015-10-18 14:43:10 -050028599 case 16:
Norman James18998182015-10-11 21:54:53 -050028600 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
28601 g_value_take_object (value, interface);
28602 break;
28603
Norman Jamesa3e47c42015-10-18 14:43:10 -050028604 case 17:
Norman James18998182015-10-11 21:54:53 -050028605 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
28606 g_value_take_object (value, interface);
28607 break;
28608
Norman Jamesa3e47c42015-10-18 14:43:10 -050028609 case 18:
Norman Jamesdbcffbd2015-10-06 16:53:06 -050028610 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
28611 g_value_take_object (value, interface);
28612 break;
28613
Norman James362a80f2015-09-14 14:04:39 -050028614 default:
28615 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
28616 break;
28617 }
28618}
28619
28620static void
28621object_proxy_class_init (ObjectProxyClass *klass)
28622{
28623 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
28624
28625 gobject_class->set_property = object_proxy_set_property;
28626 gobject_class->get_property = object_proxy_get_property;
28627
Norman Jamesa3e47c42015-10-18 14:43:10 -050028628 g_object_class_override_property (gobject_class, 1, "fan");
28629 g_object_class_override_property (gobject_class, 2, "sensor-value");
28630 g_object_class_override_property (gobject_class, 3, "sensor-threshold");
28631 g_object_class_override_property (gobject_class, 4, "sensor-i2c");
28632 g_object_class_override_property (gobject_class, 5, "sensor-match");
28633 g_object_class_override_property (gobject_class, 6, "process");
28634 g_object_class_override_property (gobject_class, 7, "shared-resource");
28635 g_object_class_override_property (gobject_class, 8, "control");
28636 g_object_class_override_property (gobject_class, 9, "control-bmc");
28637 g_object_class_override_property (gobject_class, 10, "control-host");
28638 g_object_class_override_property (gobject_class, 11, "control-power");
28639 g_object_class_override_property (gobject_class, 12, "watchdog");
28640 g_object_class_override_property (gobject_class, 13, "event-log");
28641 g_object_class_override_property (gobject_class, 14, "flash");
28642 g_object_class_override_property (gobject_class, 15, "flash-control");
28643 g_object_class_override_property (gobject_class, 16, "button");
28644 g_object_class_override_property (gobject_class, 17, "led");
28645 g_object_class_override_property (gobject_class, 18, "host-ipmi");
Norman James362a80f2015-09-14 14:04:39 -050028646}
28647
28648/**
28649 * object_proxy_new:
28650 * @connection: A #GDBusConnection.
28651 * @object_path: An object path.
28652 *
28653 * Creates a new proxy object.
28654 *
28655 * Returns: (transfer full): The proxy object.
28656 */
28657ObjectProxy *
28658object_proxy_new (GDBusConnection *connection,
28659 const gchar *object_path)
28660{
28661 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
28662 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
28663 return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
28664}
28665
28666/**
28667 * ObjectSkeleton:
28668 *
28669 * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API.
28670 */
28671
28672/**
28673 * ObjectSkeletonClass:
28674 * @parent_class: The parent class.
28675 *
28676 * Class structure for #ObjectSkeleton.
28677 */
28678
28679static void
28680object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
28681{
28682}
28683
28684
28685static void
28686object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
28687{
28688 iface->interface_added = object_notify;
28689 iface->interface_removed = object_notify;
28690}
28691
28692G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
28693 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init)
28694 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init));
28695
28696static void
28697object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED)
28698{
28699}
28700
28701static void
28702object_skeleton_set_property (GObject *gobject,
28703 guint prop_id,
28704 const GValue *value,
28705 GParamSpec *pspec)
28706{
28707 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
28708 GDBusInterfaceSkeleton *interface;
28709
28710 switch (prop_id)
28711 {
28712 case 1:
28713 interface = g_value_get_object (value);
28714 if (interface != NULL)
28715 {
Norman James362a80f2015-09-14 14:04:39 -050028716 g_warn_if_fail (IS_FAN (interface));
28717 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28718 }
28719 else
28720 {
28721 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Fan");
28722 }
28723 break;
28724
Norman Jamesa3e47c42015-10-18 14:43:10 -050028725 case 2:
Norman James362a80f2015-09-14 14:04:39 -050028726 interface = g_value_get_object (value);
28727 if (interface != NULL)
28728 {
28729 g_warn_if_fail (IS_SENSOR_VALUE (interface));
28730 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28731 }
28732 else
28733 {
28734 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorValue");
28735 }
28736 break;
28737
Norman Jamesa3e47c42015-10-18 14:43:10 -050028738 case 3:
Norman James362a80f2015-09-14 14:04:39 -050028739 interface = g_value_get_object (value);
28740 if (interface != NULL)
28741 {
28742 g_warn_if_fail (IS_SENSOR_THRESHOLD (interface));
28743 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28744 }
28745 else
28746 {
28747 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorThreshold");
28748 }
28749 break;
28750
Norman Jamesa3e47c42015-10-18 14:43:10 -050028751 case 4:
Norman James362a80f2015-09-14 14:04:39 -050028752 interface = g_value_get_object (value);
28753 if (interface != NULL)
28754 {
28755 g_warn_if_fail (IS_SENSOR_I2C (interface));
28756 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28757 }
28758 else
28759 {
28760 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorI2c");
28761 }
28762 break;
28763
Norman Jamesa3e47c42015-10-18 14:43:10 -050028764 case 5:
Norman James362a80f2015-09-14 14:04:39 -050028765 interface = g_value_get_object (value);
28766 if (interface != NULL)
28767 {
28768 g_warn_if_fail (IS_SENSOR_MATCH (interface));
28769 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28770 }
28771 else
28772 {
28773 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorMatch");
28774 }
28775 break;
28776
Norman Jamesa3e47c42015-10-18 14:43:10 -050028777 case 6:
Norman James362a80f2015-09-14 14:04:39 -050028778 interface = g_value_get_object (value);
28779 if (interface != NULL)
28780 {
28781 g_warn_if_fail (IS_PROCESS (interface));
28782 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28783 }
28784 else
28785 {
28786 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Process");
28787 }
28788 break;
28789
Norman Jamesa3e47c42015-10-18 14:43:10 -050028790 case 7:
Norman James362a80f2015-09-14 14:04:39 -050028791 interface = g_value_get_object (value);
28792 if (interface != NULL)
28793 {
Norman James18998182015-10-11 21:54:53 -050028794 g_warn_if_fail (IS_SHARED_RESOURCE (interface));
28795 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28796 }
28797 else
28798 {
28799 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SharedResource");
28800 }
28801 break;
28802
Norman Jamesa3e47c42015-10-18 14:43:10 -050028803 case 8:
Norman James18998182015-10-11 21:54:53 -050028804 interface = g_value_get_object (value);
28805 if (interface != NULL)
28806 {
Norman James362a80f2015-09-14 14:04:39 -050028807 g_warn_if_fail (IS_CONTROL (interface));
28808 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28809 }
28810 else
28811 {
28812 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Control");
28813 }
28814 break;
28815
Norman Jamesa3e47c42015-10-18 14:43:10 -050028816 case 9:
Norman James362a80f2015-09-14 14:04:39 -050028817 interface = g_value_get_object (value);
28818 if (interface != NULL)
28819 {
28820 g_warn_if_fail (IS_CONTROL_BMC (interface));
28821 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28822 }
28823 else
28824 {
28825 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Bmc");
28826 }
28827 break;
28828
Norman Jamesa3e47c42015-10-18 14:43:10 -050028829 case 10:
Norman James362a80f2015-09-14 14:04:39 -050028830 interface = g_value_get_object (value);
28831 if (interface != NULL)
28832 {
28833 g_warn_if_fail (IS_CONTROL_HOST (interface));
28834 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28835 }
28836 else
28837 {
28838 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Host");
28839 }
28840 break;
28841
Norman Jamesa3e47c42015-10-18 14:43:10 -050028842 case 11:
Norman James362a80f2015-09-14 14:04:39 -050028843 interface = g_value_get_object (value);
28844 if (interface != NULL)
28845 {
28846 g_warn_if_fail (IS_CONTROL_POWER (interface));
28847 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28848 }
28849 else
28850 {
28851 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Power");
28852 }
28853 break;
28854
Norman Jamesa3e47c42015-10-18 14:43:10 -050028855 case 12:
Norman James362a80f2015-09-14 14:04:39 -050028856 interface = g_value_get_object (value);
28857 if (interface != NULL)
28858 {
28859 g_warn_if_fail (IS_WATCHDOG (interface));
28860 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28861 }
28862 else
28863 {
28864 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Watchdog");
28865 }
28866 break;
28867
Norman Jamesa3e47c42015-10-18 14:43:10 -050028868 case 13:
Norman James362a80f2015-09-14 14:04:39 -050028869 interface = g_value_get_object (value);
28870 if (interface != NULL)
28871 {
28872 g_warn_if_fail (IS_EVENT_LOG (interface));
28873 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28874 }
28875 else
28876 {
28877 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.EventLog");
28878 }
28879 break;
28880
Norman Jamesa3e47c42015-10-18 14:43:10 -050028881 case 14:
Norman James362a80f2015-09-14 14:04:39 -050028882 interface = g_value_get_object (value);
28883 if (interface != NULL)
28884 {
28885 g_warn_if_fail (IS_FLASH (interface));
28886 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28887 }
28888 else
28889 {
28890 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Flash");
28891 }
28892 break;
28893
Norman Jamesa3e47c42015-10-18 14:43:10 -050028894 case 15:
Norman James18998182015-10-11 21:54:53 -050028895 interface = g_value_get_object (value);
28896 if (interface != NULL)
28897 {
28898 g_warn_if_fail (IS_FLASH_CONTROL (interface));
28899 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28900 }
28901 else
28902 {
28903 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.FlashControl");
28904 }
28905 break;
28906
Norman Jamesa3e47c42015-10-18 14:43:10 -050028907 case 16:
Norman James362a80f2015-09-14 14:04:39 -050028908 interface = g_value_get_object (value);
28909 if (interface != NULL)
28910 {
28911 g_warn_if_fail (IS_BUTTON (interface));
28912 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28913 }
28914 else
28915 {
28916 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Button");
28917 }
28918 break;
28919
Norman Jamesa3e47c42015-10-18 14:43:10 -050028920 case 17:
Norman James362a80f2015-09-14 14:04:39 -050028921 interface = g_value_get_object (value);
28922 if (interface != NULL)
28923 {
28924 g_warn_if_fail (IS_LED (interface));
28925 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28926 }
28927 else
28928 {
28929 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Led");
28930 }
28931 break;
28932
Norman Jamesa3e47c42015-10-18 14:43:10 -050028933 case 18:
Norman Jamesdbcffbd2015-10-06 16:53:06 -050028934 interface = g_value_get_object (value);
28935 if (interface != NULL)
28936 {
28937 g_warn_if_fail (IS_HOST_IPMI (interface));
28938 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28939 }
28940 else
28941 {
28942 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.HostIpmi");
28943 }
28944 break;
28945
Norman James362a80f2015-09-14 14:04:39 -050028946 default:
28947 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
28948 break;
28949 }
28950}
28951
28952static void
28953object_skeleton_get_property (GObject *gobject,
28954 guint prop_id,
28955 GValue *value,
28956 GParamSpec *pspec)
28957{
28958 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
28959 GDBusInterface *interface;
28960
28961 switch (prop_id)
28962 {
28963 case 1:
Norman James362a80f2015-09-14 14:04:39 -050028964 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
28965 g_value_take_object (value, interface);
28966 break;
28967
Norman Jamesa3e47c42015-10-18 14:43:10 -050028968 case 2:
Norman James362a80f2015-09-14 14:04:39 -050028969 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
28970 g_value_take_object (value, interface);
28971 break;
28972
Norman Jamesa3e47c42015-10-18 14:43:10 -050028973 case 3:
Norman Jamesdfdaca92015-09-27 22:11:15 -050028974 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman James362a80f2015-09-14 14:04:39 -050028975 g_value_take_object (value, interface);
28976 break;
28977
Norman Jamesa3e47c42015-10-18 14:43:10 -050028978 case 4:
Norman Jamesdfdaca92015-09-27 22:11:15 -050028979 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman James362a80f2015-09-14 14:04:39 -050028980 g_value_take_object (value, interface);
28981 break;
28982
Norman Jamesa3e47c42015-10-18 14:43:10 -050028983 case 5:
Norman Jamesdfdaca92015-09-27 22:11:15 -050028984 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
Norman James362a80f2015-09-14 14:04:39 -050028985 g_value_take_object (value, interface);
28986 break;
28987
Norman Jamesa3e47c42015-10-18 14:43:10 -050028988 case 6:
Norman Jamesdfdaca92015-09-27 22:11:15 -050028989 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
Norman James362a80f2015-09-14 14:04:39 -050028990 g_value_take_object (value, interface);
28991 break;
28992
Norman Jamesa3e47c42015-10-18 14:43:10 -050028993 case 7:
Norman James18998182015-10-11 21:54:53 -050028994 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
Norman James362a80f2015-09-14 14:04:39 -050028995 g_value_take_object (value, interface);
28996 break;
28997
Norman Jamesa3e47c42015-10-18 14:43:10 -050028998 case 8:
Norman James18998182015-10-11 21:54:53 -050028999 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
Norman James362a80f2015-09-14 14:04:39 -050029000 g_value_take_object (value, interface);
29001 break;
29002
Norman Jamesa3e47c42015-10-18 14:43:10 -050029003 case 9:
Norman James18998182015-10-11 21:54:53 -050029004 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
Norman James362a80f2015-09-14 14:04:39 -050029005 g_value_take_object (value, interface);
29006 break;
29007
Norman Jamesa3e47c42015-10-18 14:43:10 -050029008 case 10:
Norman James18998182015-10-11 21:54:53 -050029009 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
Norman James362a80f2015-09-14 14:04:39 -050029010 g_value_take_object (value, interface);
29011 break;
29012
Norman Jamesa3e47c42015-10-18 14:43:10 -050029013 case 11:
Norman James18998182015-10-11 21:54:53 -050029014 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
Norman James362a80f2015-09-14 14:04:39 -050029015 g_value_take_object (value, interface);
29016 break;
29017
Norman Jamesa3e47c42015-10-18 14:43:10 -050029018 case 12:
Norman James18998182015-10-11 21:54:53 -050029019 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
Norman James362a80f2015-09-14 14:04:39 -050029020 g_value_take_object (value, interface);
29021 break;
29022
Norman Jamesa3e47c42015-10-18 14:43:10 -050029023 case 13:
Norman James18998182015-10-11 21:54:53 -050029024 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
Norman James362a80f2015-09-14 14:04:39 -050029025 g_value_take_object (value, interface);
29026 break;
29027
Norman Jamesa3e47c42015-10-18 14:43:10 -050029028 case 14:
Norman James18998182015-10-11 21:54:53 -050029029 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
Norman Jamesdfdaca92015-09-27 22:11:15 -050029030 g_value_take_object (value, interface);
29031 break;
29032
Norman Jamesa3e47c42015-10-18 14:43:10 -050029033 case 15:
Norman James18998182015-10-11 21:54:53 -050029034 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
Norman James362a80f2015-09-14 14:04:39 -050029035 g_value_take_object (value, interface);
29036 break;
29037
Norman Jamesa3e47c42015-10-18 14:43:10 -050029038 case 16:
Norman James18998182015-10-11 21:54:53 -050029039 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
29040 g_value_take_object (value, interface);
29041 break;
29042
Norman Jamesa3e47c42015-10-18 14:43:10 -050029043 case 17:
Norman James18998182015-10-11 21:54:53 -050029044 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
29045 g_value_take_object (value, interface);
29046 break;
29047
Norman Jamesa3e47c42015-10-18 14:43:10 -050029048 case 18:
Norman Jamesdbcffbd2015-10-06 16:53:06 -050029049 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
29050 g_value_take_object (value, interface);
29051 break;
29052
Norman James362a80f2015-09-14 14:04:39 -050029053 default:
29054 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
29055 break;
29056 }
29057}
29058
29059static void
29060object_skeleton_class_init (ObjectSkeletonClass *klass)
29061{
29062 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
29063
29064 gobject_class->set_property = object_skeleton_set_property;
29065 gobject_class->get_property = object_skeleton_get_property;
29066
Norman Jamesa3e47c42015-10-18 14:43:10 -050029067 g_object_class_override_property (gobject_class, 1, "fan");
29068 g_object_class_override_property (gobject_class, 2, "sensor-value");
29069 g_object_class_override_property (gobject_class, 3, "sensor-threshold");
29070 g_object_class_override_property (gobject_class, 4, "sensor-i2c");
29071 g_object_class_override_property (gobject_class, 5, "sensor-match");
29072 g_object_class_override_property (gobject_class, 6, "process");
29073 g_object_class_override_property (gobject_class, 7, "shared-resource");
29074 g_object_class_override_property (gobject_class, 8, "control");
29075 g_object_class_override_property (gobject_class, 9, "control-bmc");
29076 g_object_class_override_property (gobject_class, 10, "control-host");
29077 g_object_class_override_property (gobject_class, 11, "control-power");
29078 g_object_class_override_property (gobject_class, 12, "watchdog");
29079 g_object_class_override_property (gobject_class, 13, "event-log");
29080 g_object_class_override_property (gobject_class, 14, "flash");
29081 g_object_class_override_property (gobject_class, 15, "flash-control");
29082 g_object_class_override_property (gobject_class, 16, "button");
29083 g_object_class_override_property (gobject_class, 17, "led");
29084 g_object_class_override_property (gobject_class, 18, "host-ipmi");
Norman James362a80f2015-09-14 14:04:39 -050029085}
29086
29087/**
29088 * object_skeleton_new:
29089 * @object_path: An object path.
29090 *
29091 * Creates a new skeleton object.
29092 *
29093 * Returns: (transfer full): The skeleton object.
29094 */
29095ObjectSkeleton *
29096object_skeleton_new (const gchar *object_path)
29097{
29098 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
29099 return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
29100}
29101
29102/**
Norman James362a80f2015-09-14 14:04:39 -050029103 * object_skeleton_set_fan:
29104 * @object: A #ObjectSkeleton.
29105 * @interface_: (allow-none): A #Fan or %NULL to clear the interface.
29106 *
29107 * 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.
29108 */
29109void object_skeleton_set_fan (ObjectSkeleton *object, Fan *interface_)
29110{
29111 g_object_set (G_OBJECT (object), "fan", interface_, NULL);
29112}
29113
29114/**
29115 * object_skeleton_set_sensor_value:
29116 * @object: A #ObjectSkeleton.
29117 * @interface_: (allow-none): A #SensorValue or %NULL to clear the interface.
29118 *
29119 * 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.
29120 */
29121void object_skeleton_set_sensor_value (ObjectSkeleton *object, SensorValue *interface_)
29122{
29123 g_object_set (G_OBJECT (object), "sensor-value", interface_, NULL);
29124}
29125
29126/**
29127 * object_skeleton_set_sensor_threshold:
29128 * @object: A #ObjectSkeleton.
29129 * @interface_: (allow-none): A #SensorThreshold or %NULL to clear the interface.
29130 *
29131 * 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.
29132 */
29133void object_skeleton_set_sensor_threshold (ObjectSkeleton *object, SensorThreshold *interface_)
29134{
29135 g_object_set (G_OBJECT (object), "sensor-threshold", interface_, NULL);
29136}
29137
29138/**
29139 * object_skeleton_set_sensor_i2c:
29140 * @object: A #ObjectSkeleton.
29141 * @interface_: (allow-none): A #SensorI2c or %NULL to clear the interface.
29142 *
29143 * 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.
29144 */
29145void object_skeleton_set_sensor_i2c (ObjectSkeleton *object, SensorI2c *interface_)
29146{
29147 g_object_set (G_OBJECT (object), "sensor-i2c", interface_, NULL);
29148}
29149
29150/**
29151 * object_skeleton_set_sensor_match:
29152 * @object: A #ObjectSkeleton.
29153 * @interface_: (allow-none): A #SensorMatch or %NULL to clear the interface.
29154 *
29155 * 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.
29156 */
29157void object_skeleton_set_sensor_match (ObjectSkeleton *object, SensorMatch *interface_)
29158{
29159 g_object_set (G_OBJECT (object), "sensor-match", interface_, NULL);
29160}
29161
29162/**
29163 * object_skeleton_set_process:
29164 * @object: A #ObjectSkeleton.
29165 * @interface_: (allow-none): A #Process or %NULL to clear the interface.
29166 *
29167 * 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.
29168 */
29169void object_skeleton_set_process (ObjectSkeleton *object, Process *interface_)
29170{
29171 g_object_set (G_OBJECT (object), "process", interface_, NULL);
29172}
29173
29174/**
Norman James18998182015-10-11 21:54:53 -050029175 * object_skeleton_set_shared_resource:
29176 * @object: A #ObjectSkeleton.
29177 * @interface_: (allow-none): A #SharedResource or %NULL to clear the interface.
29178 *
29179 * 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.
29180 */
29181void object_skeleton_set_shared_resource (ObjectSkeleton *object, SharedResource *interface_)
29182{
29183 g_object_set (G_OBJECT (object), "shared-resource", interface_, NULL);
29184}
29185
29186/**
Norman James362a80f2015-09-14 14:04:39 -050029187 * object_skeleton_set_control:
29188 * @object: A #ObjectSkeleton.
29189 * @interface_: (allow-none): A #Control or %NULL to clear the interface.
29190 *
29191 * 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.
29192 */
29193void object_skeleton_set_control (ObjectSkeleton *object, Control *interface_)
29194{
29195 g_object_set (G_OBJECT (object), "control", interface_, NULL);
29196}
29197
29198/**
29199 * object_skeleton_set_control_bmc:
29200 * @object: A #ObjectSkeleton.
29201 * @interface_: (allow-none): A #ControlBmc or %NULL to clear the interface.
29202 *
29203 * 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.
29204 */
29205void object_skeleton_set_control_bmc (ObjectSkeleton *object, ControlBmc *interface_)
29206{
29207 g_object_set (G_OBJECT (object), "control-bmc", interface_, NULL);
29208}
29209
29210/**
29211 * object_skeleton_set_control_host:
29212 * @object: A #ObjectSkeleton.
29213 * @interface_: (allow-none): A #ControlHost or %NULL to clear the interface.
29214 *
29215 * 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.
29216 */
29217void object_skeleton_set_control_host (ObjectSkeleton *object, ControlHost *interface_)
29218{
29219 g_object_set (G_OBJECT (object), "control-host", interface_, NULL);
29220}
29221
29222/**
29223 * object_skeleton_set_control_power:
29224 * @object: A #ObjectSkeleton.
29225 * @interface_: (allow-none): A #ControlPower or %NULL to clear the interface.
29226 *
29227 * 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.
29228 */
29229void object_skeleton_set_control_power (ObjectSkeleton *object, ControlPower *interface_)
29230{
29231 g_object_set (G_OBJECT (object), "control-power", interface_, NULL);
29232}
29233
29234/**
29235 * object_skeleton_set_watchdog:
29236 * @object: A #ObjectSkeleton.
29237 * @interface_: (allow-none): A #Watchdog or %NULL to clear the interface.
29238 *
29239 * 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.
29240 */
29241void object_skeleton_set_watchdog (ObjectSkeleton *object, Watchdog *interface_)
29242{
29243 g_object_set (G_OBJECT (object), "watchdog", interface_, NULL);
29244}
29245
29246/**
29247 * object_skeleton_set_event_log:
29248 * @object: A #ObjectSkeleton.
29249 * @interface_: (allow-none): A #EventLog or %NULL to clear the interface.
29250 *
29251 * 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.
29252 */
29253void object_skeleton_set_event_log (ObjectSkeleton *object, EventLog *interface_)
29254{
29255 g_object_set (G_OBJECT (object), "event-log", interface_, NULL);
29256}
29257
29258/**
29259 * object_skeleton_set_flash:
29260 * @object: A #ObjectSkeleton.
29261 * @interface_: (allow-none): A #Flash or %NULL to clear the interface.
29262 *
29263 * 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.
29264 */
29265void object_skeleton_set_flash (ObjectSkeleton *object, Flash *interface_)
29266{
29267 g_object_set (G_OBJECT (object), "flash", interface_, NULL);
29268}
29269
29270/**
Norman James18998182015-10-11 21:54:53 -050029271 * object_skeleton_set_flash_control:
29272 * @object: A #ObjectSkeleton.
29273 * @interface_: (allow-none): A #FlashControl or %NULL to clear the interface.
29274 *
29275 * 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.
29276 */
29277void object_skeleton_set_flash_control (ObjectSkeleton *object, FlashControl *interface_)
29278{
29279 g_object_set (G_OBJECT (object), "flash-control", interface_, NULL);
29280}
29281
29282/**
Norman James362a80f2015-09-14 14:04:39 -050029283 * object_skeleton_set_button:
29284 * @object: A #ObjectSkeleton.
29285 * @interface_: (allow-none): A #Button or %NULL to clear the interface.
29286 *
29287 * 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.
29288 */
29289void object_skeleton_set_button (ObjectSkeleton *object, Button *interface_)
29290{
29291 g_object_set (G_OBJECT (object), "button", interface_, NULL);
29292}
29293
29294/**
29295 * object_skeleton_set_led:
29296 * @object: A #ObjectSkeleton.
29297 * @interface_: (allow-none): A #Led or %NULL to clear the interface.
29298 *
29299 * 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.
29300 */
29301void object_skeleton_set_led (ObjectSkeleton *object, Led *interface_)
29302{
29303 g_object_set (G_OBJECT (object), "led", interface_, NULL);
29304}
29305
Norman Jamesdbcffbd2015-10-06 16:53:06 -050029306/**
29307 * object_skeleton_set_host_ipmi:
29308 * @object: A #ObjectSkeleton.
29309 * @interface_: (allow-none): A #HostIpmi or %NULL to clear the interface.
29310 *
29311 * 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.
29312 */
29313void object_skeleton_set_host_ipmi (ObjectSkeleton *object, HostIpmi *interface_)
29314{
29315 g_object_set (G_OBJECT (object), "host-ipmi", interface_, NULL);
29316}
29317
Norman James362a80f2015-09-14 14:04:39 -050029318
29319/* ------------------------------------------------------------------------
29320 * Code for ObjectManager client
29321 * ------------------------------------------------------------------------
29322 */
29323
29324/**
29325 * SECTION:ObjectManagerClient
29326 * @title: ObjectManagerClient
29327 * @short_description: Generated GDBusObjectManagerClient type
29328 *
29329 * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
29330 */
29331
29332/**
29333 * ObjectManagerClient:
29334 *
29335 * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API.
29336 */
29337
29338/**
29339 * ObjectManagerClientClass:
29340 * @parent_class: The parent class.
29341 *
29342 * Class structure for #ObjectManagerClient.
29343 */
29344
29345G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT);
29346
29347static void
29348object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED)
29349{
29350}
29351
29352static void
29353object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED)
29354{
29355}
29356
29357/**
29358 * object_manager_client_get_proxy_type:
29359 * @manager: A #GDBusObjectManagerClient.
29360 * @object_path: The object path of the remote object (unused).
29361 * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType.
29362 * @user_data: User data (unused).
29363 *
29364 * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types.
29365 *
29366 * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy.
29367 */
29368GType
29369object_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)
29370{
29371 static gsize once_init_value = 0;
29372 static GHashTable *lookup_hash;
29373 GType ret;
29374
29375 if (interface_name == NULL)
29376 return TYPE_OBJECT_PROXY;
29377 if (g_once_init_enter (&once_init_value))
29378 {
29379 lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
Norman James362a80f2015-09-14 14:04:39 -050029380 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Fan", GSIZE_TO_POINTER (TYPE_FAN_PROXY));
29381 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorValue", GSIZE_TO_POINTER (TYPE_SENSOR_VALUE_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050029382 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_THRESHOLD_PROXY));
29383 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorI2c", GSIZE_TO_POINTER (TYPE_SENSOR_I2C_PROXY));
29384 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorMatch", GSIZE_TO_POINTER (TYPE_SENSOR_MATCH_PROXY));
29385 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Process", GSIZE_TO_POINTER (TYPE_PROCESS_PROXY));
Norman James18998182015-10-11 21:54:53 -050029386 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SharedResource", GSIZE_TO_POINTER (TYPE_SHARED_RESOURCE_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050029387 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Control", GSIZE_TO_POINTER (TYPE_CONTROL_PROXY));
29388 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Bmc", GSIZE_TO_POINTER (TYPE_CONTROL_BMC_PROXY));
29389 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Host", GSIZE_TO_POINTER (TYPE_CONTROL_HOST_PROXY));
29390 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Power", GSIZE_TO_POINTER (TYPE_CONTROL_POWER_PROXY));
29391 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Watchdog", GSIZE_TO_POINTER (TYPE_WATCHDOG_PROXY));
29392 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.EventLog", GSIZE_TO_POINTER (TYPE_EVENT_LOG_PROXY));
29393 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Flash", GSIZE_TO_POINTER (TYPE_FLASH_PROXY));
Norman James18998182015-10-11 21:54:53 -050029394 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.FlashControl", GSIZE_TO_POINTER (TYPE_FLASH_CONTROL_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050029395 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Button", GSIZE_TO_POINTER (TYPE_BUTTON_PROXY));
29396 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Led", GSIZE_TO_POINTER (TYPE_LED_PROXY));
Norman Jamesdbcffbd2015-10-06 16:53:06 -050029397 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.HostIpmi", GSIZE_TO_POINTER (TYPE_HOST_IPMI_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050029398 g_once_init_leave (&once_init_value, 1);
29399 }
29400 ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
29401 if (ret == (GType) 0)
29402 ret = G_TYPE_DBUS_PROXY;
29403 return ret;
29404}
29405
29406/**
29407 * object_manager_client_new:
29408 * @connection: A #GDBusConnection.
29409 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
29410 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
29411 * @object_path: An object path.
29412 * @cancellable: (allow-none): A #GCancellable or %NULL.
29413 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
29414 * @user_data: User data to pass to @callback.
29415 *
29416 * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
29417 *
29418 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
29419 * You can then call object_manager_client_new_finish() to get the result of the operation.
29420 *
29421 * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
29422 */
29423void
29424object_manager_client_new (
29425 GDBusConnection *connection,
29426 GDBusObjectManagerClientFlags flags,
29427 const gchar *name,
29428 const gchar *object_path,
29429 GCancellable *cancellable,
29430 GAsyncReadyCallback callback,
29431 gpointer user_data)
29432{
29433 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);
29434}
29435
29436/**
29437 * object_manager_client_new_finish:
29438 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new().
29439 * @error: Return location for error or %NULL
29440 *
29441 * Finishes an operation started with object_manager_client_new().
29442 *
29443 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
29444 */
29445GDBusObjectManager *
29446object_manager_client_new_finish (
29447 GAsyncResult *res,
29448 GError **error)
29449{
29450 GObject *ret;
29451 GObject *source_object;
29452 source_object = g_async_result_get_source_object (res);
29453 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
29454 g_object_unref (source_object);
29455 if (ret != NULL)
29456 return G_DBUS_OBJECT_MANAGER (ret);
29457 else
29458 return NULL;
29459}
29460
29461/**
29462 * object_manager_client_new_sync:
29463 * @connection: A #GDBusConnection.
29464 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
29465 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
29466 * @object_path: An object path.
29467 * @cancellable: (allow-none): A #GCancellable or %NULL.
29468 * @error: Return location for error or %NULL
29469 *
29470 * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
29471 *
29472 * The calling thread is blocked until a reply is received.
29473 *
29474 * See object_manager_client_new() for the asynchronous version of this constructor.
29475 *
29476 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
29477 */
29478GDBusObjectManager *
29479object_manager_client_new_sync (
29480 GDBusConnection *connection,
29481 GDBusObjectManagerClientFlags flags,
29482 const gchar *name,
29483 const gchar *object_path,
29484 GCancellable *cancellable,
29485 GError **error)
29486{
29487 GInitable *ret;
29488 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);
29489 if (ret != NULL)
29490 return G_DBUS_OBJECT_MANAGER (ret);
29491 else
29492 return NULL;
29493}
29494
29495
29496/**
29497 * object_manager_client_new_for_bus:
29498 * @bus_type: A #GBusType.
29499 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
29500 * @name: A bus name (well-known or unique).
29501 * @object_path: An object path.
29502 * @cancellable: (allow-none): A #GCancellable or %NULL.
29503 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
29504 * @user_data: User data to pass to @callback.
29505 *
29506 * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
29507 *
29508 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
29509 * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation.
29510 *
29511 * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
29512 */
29513void
29514object_manager_client_new_for_bus (
29515 GBusType bus_type,
29516 GDBusObjectManagerClientFlags flags,
29517 const gchar *name,
29518 const gchar *object_path,
29519 GCancellable *cancellable,
29520 GAsyncReadyCallback callback,
29521 gpointer user_data)
29522{
29523 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);
29524}
29525
29526/**
29527 * object_manager_client_new_for_bus_finish:
29528 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus().
29529 * @error: Return location for error or %NULL
29530 *
29531 * Finishes an operation started with object_manager_client_new_for_bus().
29532 *
29533 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
29534 */
29535GDBusObjectManager *
29536object_manager_client_new_for_bus_finish (
29537 GAsyncResult *res,
29538 GError **error)
29539{
29540 GObject *ret;
29541 GObject *source_object;
29542 source_object = g_async_result_get_source_object (res);
29543 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
29544 g_object_unref (source_object);
29545 if (ret != NULL)
29546 return G_DBUS_OBJECT_MANAGER (ret);
29547 else
29548 return NULL;
29549}
29550
29551/**
29552 * object_manager_client_new_for_bus_sync:
29553 * @bus_type: A #GBusType.
29554 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
29555 * @name: A bus name (well-known or unique).
29556 * @object_path: An object path.
29557 * @cancellable: (allow-none): A #GCancellable or %NULL.
29558 * @error: Return location for error or %NULL
29559 *
29560 * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
29561 *
29562 * The calling thread is blocked until a reply is received.
29563 *
29564 * See object_manager_client_new_for_bus() for the asynchronous version of this constructor.
29565 *
29566 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
29567 */
29568GDBusObjectManager *
29569object_manager_client_new_for_bus_sync (
29570 GBusType bus_type,
29571 GDBusObjectManagerClientFlags flags,
29572 const gchar *name,
29573 const gchar *object_path,
29574 GCancellable *cancellable,
29575 GError **error)
29576{
29577 GInitable *ret;
29578 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);
29579 if (ret != NULL)
29580 return G_DBUS_OBJECT_MANAGER (ret);
29581 else
29582 return NULL;
29583}
29584
29585