blob: f1e0c950a866c769ceb62978cceecd37342ce085 [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 Jamesf066e872015-10-07 15:29:51 -050019006static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_url =
19007{
19008 {
19009 -1,
19010 (gchar *) "url",
19011 (gchar *) "s",
19012 NULL
19013 },
19014 FALSE
19015};
19016
19017static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_filename =
19018{
19019 {
19020 -1,
19021 (gchar *) "filename",
19022 (gchar *) "s",
19023 NULL
19024 },
19025 FALSE
19026};
19027
19028static const _ExtendedGDBusArgInfo * const _flash_method_info_update_via_tftp_IN_ARG_pointers[] =
19029{
19030 &_flash_method_info_update_via_tftp_IN_ARG_url,
19031 &_flash_method_info_update_via_tftp_IN_ARG_filename,
19032 NULL
19033};
19034
19035static const _ExtendedGDBusMethodInfo _flash_method_info_update_via_tftp =
19036{
19037 {
19038 -1,
19039 (gchar *) "updateViaTftp",
19040 (GDBusArgInfo **) &_flash_method_info_update_via_tftp_IN_ARG_pointers,
19041 NULL,
19042 NULL
19043 },
19044 "handle-update-via-tftp",
19045 FALSE
19046};
19047
Norman James362a80f2015-09-14 14:04:39 -050019048static const _ExtendedGDBusMethodInfo _flash_method_info_init =
19049{
19050 {
19051 -1,
19052 (gchar *) "init",
19053 NULL,
19054 NULL,
19055 NULL
19056 },
19057 "handle-init",
19058 FALSE
19059};
19060
19061static const _ExtendedGDBusMethodInfo * const _flash_method_info_pointers[] =
19062{
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019063 &_flash_method_info_update,
Norman Jamesf066e872015-10-07 15:29:51 -050019064 &_flash_method_info_update_via_tftp,
Norman James362a80f2015-09-14 14:04:39 -050019065 &_flash_method_info_init,
19066 NULL
19067};
19068
19069static const _ExtendedGDBusSignalInfo _flash_signal_info_updated =
19070{
19071 {
19072 -1,
19073 (gchar *) "Updated",
19074 NULL,
19075 NULL
19076 },
19077 "updated"
19078};
19079
Norman Jamesf066e872015-10-07 15:29:51 -050019080static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_url =
19081{
19082 {
19083 -1,
19084 (gchar *) "url",
19085 (gchar *) "s",
19086 NULL
19087 },
19088 FALSE
19089};
19090
19091static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_filename =
19092{
19093 {
19094 -1,
19095 (gchar *) "filename",
19096 (gchar *) "s",
19097 NULL
19098 },
19099 FALSE
19100};
19101
19102static const _ExtendedGDBusArgInfo * const _flash_signal_info_download_ARG_pointers[] =
19103{
19104 &_flash_signal_info_download_ARG_url,
19105 &_flash_signal_info_download_ARG_filename,
19106 NULL
19107};
19108
19109static const _ExtendedGDBusSignalInfo _flash_signal_info_download =
19110{
19111 {
19112 -1,
19113 (gchar *) "Download",
19114 (GDBusArgInfo **) &_flash_signal_info_download_ARG_pointers,
19115 NULL
19116 },
19117 "download"
19118};
19119
Norman James362a80f2015-09-14 14:04:39 -050019120static const _ExtendedGDBusSignalInfo * const _flash_signal_info_pointers[] =
19121{
19122 &_flash_signal_info_updated,
Norman Jamesf066e872015-10-07 15:29:51 -050019123 &_flash_signal_info_download,
Norman James362a80f2015-09-14 14:04:39 -050019124 NULL
19125};
19126
Norman James18998182015-10-11 21:54:53 -050019127static const _ExtendedGDBusPropertyInfo _flash_property_info_filename =
19128{
19129 {
19130 -1,
19131 (gchar *) "filename",
19132 (gchar *) "s",
19133 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
19134 NULL
19135 },
19136 "filename",
19137 FALSE
19138};
19139
19140static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_path =
19141{
19142 {
19143 -1,
19144 (gchar *) "flasher_path",
19145 (gchar *) "s",
19146 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
19147 NULL
19148 },
19149 "flasher-path",
19150 FALSE
19151};
19152
19153static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_name =
19154{
19155 {
19156 -1,
19157 (gchar *) "flasher_name",
19158 (gchar *) "s",
19159 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
19160 NULL
19161 },
19162 "flasher-name",
19163 FALSE
19164};
19165
19166static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_instance =
19167{
19168 {
19169 -1,
19170 (gchar *) "flasher_instance",
19171 (gchar *) "s",
19172 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
19173 NULL
19174 },
19175 "flasher-instance",
19176 FALSE
19177};
19178
19179static const _ExtendedGDBusPropertyInfo * const _flash_property_info_pointers[] =
19180{
19181 &_flash_property_info_filename,
19182 &_flash_property_info_flasher_path,
19183 &_flash_property_info_flasher_name,
19184 &_flash_property_info_flasher_instance,
19185 NULL
19186};
19187
Norman James362a80f2015-09-14 14:04:39 -050019188static const _ExtendedGDBusInterfaceInfo _flash_interface_info =
19189{
19190 {
19191 -1,
19192 (gchar *) "org.openbmc.Flash",
19193 (GDBusMethodInfo **) &_flash_method_info_pointers,
19194 (GDBusSignalInfo **) &_flash_signal_info_pointers,
Norman James18998182015-10-11 21:54:53 -050019195 (GDBusPropertyInfo **) &_flash_property_info_pointers,
Norman James362a80f2015-09-14 14:04:39 -050019196 NULL
19197 },
19198 "flash",
19199};
19200
19201
19202/**
19203 * flash_interface_info:
19204 *
19205 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> D-Bus interface.
19206 *
19207 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
19208 */
19209GDBusInterfaceInfo *
19210flash_interface_info (void)
19211{
19212 return (GDBusInterfaceInfo *) &_flash_interface_info.parent_struct;
19213}
19214
19215/**
19216 * flash_override_properties:
19217 * @klass: The class structure for a #GObject<!-- -->-derived class.
19218 * @property_id_begin: The property id to assign to the first overridden property.
19219 *
19220 * Overrides all #GObject properties in the #Flash interface for a concrete class.
19221 * The properties are overridden in the order they are defined.
19222 *
19223 * Returns: The last property id.
19224 */
19225guint
19226flash_override_properties (GObjectClass *klass, guint property_id_begin)
19227{
Norman James18998182015-10-11 21:54:53 -050019228 g_object_class_override_property (klass, property_id_begin++, "filename");
19229 g_object_class_override_property (klass, property_id_begin++, "flasher-path");
19230 g_object_class_override_property (klass, property_id_begin++, "flasher-name");
19231 g_object_class_override_property (klass, property_id_begin++, "flasher-instance");
Norman James362a80f2015-09-14 14:04:39 -050019232 return property_id_begin - 1;
19233}
19234
19235
19236
19237/**
19238 * Flash:
19239 *
19240 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
19241 */
19242
19243/**
19244 * FlashIface:
19245 * @parent_iface: The parent interface.
Norman James362a80f2015-09-14 14:04:39 -050019246 * @handle_init: Handler for the #Flash::handle-init signal.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019247 * @handle_update: Handler for the #Flash::handle-update signal.
Norman Jamesf066e872015-10-07 15:29:51 -050019248 * @handle_update_via_tftp: Handler for the #Flash::handle-update-via-tftp signal.
Norman James18998182015-10-11 21:54:53 -050019249 * @get_filename: Getter for the #Flash:filename property.
19250 * @get_flasher_instance: Getter for the #Flash:flasher-instance property.
19251 * @get_flasher_name: Getter for the #Flash:flasher-name property.
19252 * @get_flasher_path: Getter for the #Flash:flasher-path property.
Norman Jamesf066e872015-10-07 15:29:51 -050019253 * @download: Handler for the #Flash::download signal.
Norman James362a80f2015-09-14 14:04:39 -050019254 * @updated: Handler for the #Flash::updated signal.
19255 *
19256 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
19257 */
19258
19259typedef FlashIface FlashInterface;
19260G_DEFINE_INTERFACE (Flash, flash, G_TYPE_OBJECT);
19261
19262static void
19263flash_default_init (FlashIface *iface)
19264{
19265 /* GObject signals for incoming D-Bus method calls: */
19266 /**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019267 * Flash::handle-update:
Norman James362a80f2015-09-14 14:04:39 -050019268 * @object: A #Flash.
19269 * @invocation: A #GDBusMethodInvocation.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019270 * @arg_filename: Argument passed by remote caller.
Norman James362a80f2015-09-14 14:04:39 -050019271 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019272 * 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 -050019273 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019274 * 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 -050019275 *
19276 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
19277 */
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019278 g_signal_new ("handle-update",
Norman James362a80f2015-09-14 14:04:39 -050019279 G_TYPE_FROM_INTERFACE (iface),
19280 G_SIGNAL_RUN_LAST,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019281 G_STRUCT_OFFSET (FlashIface, handle_update),
Norman James362a80f2015-09-14 14:04:39 -050019282 g_signal_accumulator_true_handled,
19283 NULL,
19284 g_cclosure_marshal_generic,
19285 G_TYPE_BOOLEAN,
19286 2,
19287 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
19288
19289 /**
Norman Jamesf066e872015-10-07 15:29:51 -050019290 * Flash::handle-update-via-tftp:
19291 * @object: A #Flash.
19292 * @invocation: A #GDBusMethodInvocation.
19293 * @arg_url: Argument passed by remote caller.
19294 * @arg_filename: Argument passed by remote caller.
19295 *
19296 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method.
19297 *
19298 * 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.
19299 *
19300 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
19301 */
19302 g_signal_new ("handle-update-via-tftp",
19303 G_TYPE_FROM_INTERFACE (iface),
19304 G_SIGNAL_RUN_LAST,
19305 G_STRUCT_OFFSET (FlashIface, handle_update_via_tftp),
19306 g_signal_accumulator_true_handled,
19307 NULL,
19308 g_cclosure_marshal_generic,
19309 G_TYPE_BOOLEAN,
19310 3,
19311 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING);
19312
19313 /**
Norman James362a80f2015-09-14 14:04:39 -050019314 * Flash::handle-init:
19315 * @object: A #Flash.
19316 * @invocation: A #GDBusMethodInvocation.
19317 *
19318 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method.
19319 *
19320 * 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.
19321 *
19322 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
19323 */
19324 g_signal_new ("handle-init",
19325 G_TYPE_FROM_INTERFACE (iface),
19326 G_SIGNAL_RUN_LAST,
19327 G_STRUCT_OFFSET (FlashIface, handle_init),
19328 g_signal_accumulator_true_handled,
19329 NULL,
19330 g_cclosure_marshal_generic,
19331 G_TYPE_BOOLEAN,
19332 1,
19333 G_TYPE_DBUS_METHOD_INVOCATION);
19334
19335 /* GObject signals for received D-Bus signals: */
19336 /**
19337 * Flash::updated:
19338 * @object: A #Flash.
19339 *
19340 * 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.
19341 *
19342 * 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.
19343 */
19344 g_signal_new ("updated",
19345 G_TYPE_FROM_INTERFACE (iface),
19346 G_SIGNAL_RUN_LAST,
19347 G_STRUCT_OFFSET (FlashIface, updated),
19348 NULL,
19349 NULL,
19350 g_cclosure_marshal_generic,
19351 G_TYPE_NONE,
19352 0);
19353
Norman Jamesf066e872015-10-07 15:29:51 -050019354 /**
19355 * Flash::download:
19356 * @object: A #Flash.
19357 * @arg_url: Argument.
19358 * @arg_filename: Argument.
19359 *
19360 * 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.
19361 *
19362 * 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.
19363 */
19364 g_signal_new ("download",
19365 G_TYPE_FROM_INTERFACE (iface),
19366 G_SIGNAL_RUN_LAST,
19367 G_STRUCT_OFFSET (FlashIface, download),
19368 NULL,
19369 NULL,
19370 g_cclosure_marshal_generic,
19371 G_TYPE_NONE,
19372 2, G_TYPE_STRING, G_TYPE_STRING);
19373
Norman James18998182015-10-11 21:54:53 -050019374 /* GObject properties for D-Bus properties: */
19375 /**
19376 * Flash:filename:
19377 *
19378 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link>.
19379 *
19380 * 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.
19381 */
19382 g_object_interface_install_property (iface,
19383 g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
19384 /**
19385 * Flash:flasher-path:
19386 *
19387 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link>.
19388 *
19389 * 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.
19390 */
19391 g_object_interface_install_property (iface,
19392 g_param_spec_string ("flasher-path", "flasher_path", "flasher_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
19393 /**
19394 * Flash:flasher-name:
19395 *
19396 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link>.
19397 *
19398 * 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.
19399 */
19400 g_object_interface_install_property (iface,
19401 g_param_spec_string ("flasher-name", "flasher_name", "flasher_name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
19402 /**
19403 * Flash:flasher-instance:
19404 *
19405 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link>.
19406 *
19407 * 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.
19408 */
19409 g_object_interface_install_property (iface,
19410 g_param_spec_string ("flasher-instance", "flasher_instance", "flasher_instance", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
19411}
19412
19413/**
19414 * flash_get_filename: (skip)
19415 * @object: A #Flash.
19416 *
19417 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property.
19418 *
19419 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
19420 *
19421 * <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>
19422 *
19423 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
19424 */
19425const gchar *
19426flash_get_filename (Flash *object)
19427{
19428 return FLASH_GET_IFACE (object)->get_filename (object);
19429}
19430
19431/**
19432 * flash_dup_filename: (skip)
19433 * @object: A #Flash.
19434 *
19435 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property.
19436 *
19437 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
19438 *
19439 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
19440 */
19441gchar *
19442flash_dup_filename (Flash *object)
19443{
19444 gchar *value;
19445 g_object_get (G_OBJECT (object), "filename", &value, NULL);
19446 return value;
19447}
19448
19449/**
19450 * flash_set_filename: (skip)
19451 * @object: A #Flash.
19452 * @value: The value to set.
19453 *
19454 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property to @value.
19455 *
19456 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
19457 */
19458void
19459flash_set_filename (Flash *object, const gchar *value)
19460{
19461 g_object_set (G_OBJECT (object), "filename", value, NULL);
19462}
19463
19464/**
19465 * flash_get_flasher_path: (skip)
19466 * @object: A #Flash.
19467 *
19468 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property.
19469 *
19470 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
19471 *
19472 * <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>
19473 *
19474 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
19475 */
19476const gchar *
19477flash_get_flasher_path (Flash *object)
19478{
19479 return FLASH_GET_IFACE (object)->get_flasher_path (object);
19480}
19481
19482/**
19483 * flash_dup_flasher_path: (skip)
19484 * @object: A #Flash.
19485 *
19486 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property.
19487 *
19488 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
19489 *
19490 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
19491 */
19492gchar *
19493flash_dup_flasher_path (Flash *object)
19494{
19495 gchar *value;
19496 g_object_get (G_OBJECT (object), "flasher-path", &value, NULL);
19497 return value;
19498}
19499
19500/**
19501 * flash_set_flasher_path: (skip)
19502 * @object: A #Flash.
19503 * @value: The value to set.
19504 *
19505 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property to @value.
19506 *
19507 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
19508 */
19509void
19510flash_set_flasher_path (Flash *object, const gchar *value)
19511{
19512 g_object_set (G_OBJECT (object), "flasher-path", value, NULL);
19513}
19514
19515/**
19516 * flash_get_flasher_name: (skip)
19517 * @object: A #Flash.
19518 *
19519 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property.
19520 *
19521 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
19522 *
19523 * <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>
19524 *
19525 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
19526 */
19527const gchar *
19528flash_get_flasher_name (Flash *object)
19529{
19530 return FLASH_GET_IFACE (object)->get_flasher_name (object);
19531}
19532
19533/**
19534 * flash_dup_flasher_name: (skip)
19535 * @object: A #Flash.
19536 *
19537 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property.
19538 *
19539 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
19540 *
19541 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
19542 */
19543gchar *
19544flash_dup_flasher_name (Flash *object)
19545{
19546 gchar *value;
19547 g_object_get (G_OBJECT (object), "flasher-name", &value, NULL);
19548 return value;
19549}
19550
19551/**
19552 * flash_set_flasher_name: (skip)
19553 * @object: A #Flash.
19554 * @value: The value to set.
19555 *
19556 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property to @value.
19557 *
19558 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
19559 */
19560void
19561flash_set_flasher_name (Flash *object, const gchar *value)
19562{
19563 g_object_set (G_OBJECT (object), "flasher-name", value, NULL);
19564}
19565
19566/**
19567 * flash_get_flasher_instance: (skip)
19568 * @object: A #Flash.
19569 *
19570 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property.
19571 *
19572 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
19573 *
19574 * <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>
19575 *
19576 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
19577 */
19578const gchar *
19579flash_get_flasher_instance (Flash *object)
19580{
19581 return FLASH_GET_IFACE (object)->get_flasher_instance (object);
19582}
19583
19584/**
19585 * flash_dup_flasher_instance: (skip)
19586 * @object: A #Flash.
19587 *
19588 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property.
19589 *
19590 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
19591 *
19592 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
19593 */
19594gchar *
19595flash_dup_flasher_instance (Flash *object)
19596{
19597 gchar *value;
19598 g_object_get (G_OBJECT (object), "flasher-instance", &value, NULL);
19599 return value;
19600}
19601
19602/**
19603 * flash_set_flasher_instance: (skip)
19604 * @object: A #Flash.
19605 * @value: The value to set.
19606 *
19607 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property to @value.
19608 *
19609 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
19610 */
19611void
19612flash_set_flasher_instance (Flash *object, const gchar *value)
19613{
19614 g_object_set (G_OBJECT (object), "flasher-instance", value, NULL);
Norman James362a80f2015-09-14 14:04:39 -050019615}
19616
19617/**
19618 * flash_emit_updated:
19619 * @object: A #Flash.
19620 *
19621 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Updated">"Updated"</link> D-Bus signal.
19622 */
19623void
19624flash_emit_updated (
19625 Flash *object)
19626{
19627 g_signal_emit_by_name (object, "updated");
19628}
19629
19630/**
Norman Jamesf066e872015-10-07 15:29:51 -050019631 * flash_emit_download:
19632 * @object: A #Flash.
19633 * @arg_url: Argument to pass with the signal.
19634 * @arg_filename: Argument to pass with the signal.
19635 *
19636 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Download">"Download"</link> D-Bus signal.
19637 */
19638void
19639flash_emit_download (
19640 Flash *object,
19641 const gchar *arg_url,
19642 const gchar *arg_filename)
19643{
19644 g_signal_emit_by_name (object, "download", arg_url, arg_filename);
19645}
19646
19647/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019648 * flash_call_update:
Norman James362a80f2015-09-14 14:04:39 -050019649 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019650 * @arg_filename: Argument to pass with the method invocation.
Norman James362a80f2015-09-14 14:04:39 -050019651 * @cancellable: (allow-none): A #GCancellable or %NULL.
19652 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19653 * @user_data: User data to pass to @callback.
19654 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019655 * 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 -050019656 * When the operation is finished, @callback will be invoked 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 -050019657 * You can then call flash_call_update_finish() to get the result of the operation.
Norman James362a80f2015-09-14 14:04:39 -050019658 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019659 * See flash_call_update_sync() for the synchronous, blocking version of this method.
Norman James362a80f2015-09-14 14:04:39 -050019660 */
19661void
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019662flash_call_update (
Norman James362a80f2015-09-14 14:04:39 -050019663 Flash *proxy,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019664 const gchar *arg_filename,
Norman James362a80f2015-09-14 14:04:39 -050019665 GCancellable *cancellable,
19666 GAsyncReadyCallback callback,
19667 gpointer user_data)
19668{
19669 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019670 "update",
Norman James362a80f2015-09-14 14:04:39 -050019671 g_variant_new ("(s)",
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019672 arg_filename),
Norman James362a80f2015-09-14 14:04:39 -050019673 G_DBUS_CALL_FLAGS_NONE,
19674 -1,
19675 cancellable,
19676 callback,
19677 user_data);
19678}
19679
19680/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019681 * flash_call_update_finish:
Norman James362a80f2015-09-14 14:04:39 -050019682 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019683 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update().
Norman James362a80f2015-09-14 14:04:39 -050019684 * @error: Return location for error or %NULL.
19685 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019686 * Finishes an operation started with flash_call_update().
Norman James362a80f2015-09-14 14:04:39 -050019687 *
19688 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19689 */
19690gboolean
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019691flash_call_update_finish (
Norman James362a80f2015-09-14 14:04:39 -050019692 Flash *proxy,
19693 GAsyncResult *res,
19694 GError **error)
19695{
19696 GVariant *_ret;
19697 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19698 if (_ret == NULL)
19699 goto _out;
19700 g_variant_get (_ret,
19701 "()");
19702 g_variant_unref (_ret);
19703_out:
19704 return _ret != NULL;
19705}
19706
19707/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019708 * flash_call_update_sync:
Norman James362a80f2015-09-14 14:04:39 -050019709 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019710 * @arg_filename: Argument to pass with the method invocation.
Norman James362a80f2015-09-14 14:04:39 -050019711 * @cancellable: (allow-none): A #GCancellable or %NULL.
19712 * @error: Return location for error or %NULL.
19713 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019714 * 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 -050019715 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019716 * See flash_call_update() for the asynchronous version of this method.
Norman James362a80f2015-09-14 14:04:39 -050019717 *
19718 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19719 */
19720gboolean
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019721flash_call_update_sync (
Norman James362a80f2015-09-14 14:04:39 -050019722 Flash *proxy,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019723 const gchar *arg_filename,
Norman James362a80f2015-09-14 14:04:39 -050019724 GCancellable *cancellable,
19725 GError **error)
19726{
19727 GVariant *_ret;
19728 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019729 "update",
Norman James362a80f2015-09-14 14:04:39 -050019730 g_variant_new ("(s)",
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019731 arg_filename),
Norman James362a80f2015-09-14 14:04:39 -050019732 G_DBUS_CALL_FLAGS_NONE,
19733 -1,
19734 cancellable,
19735 error);
19736 if (_ret == NULL)
19737 goto _out;
19738 g_variant_get (_ret,
19739 "()");
19740 g_variant_unref (_ret);
19741_out:
19742 return _ret != NULL;
19743}
19744
19745/**
Norman Jamesf066e872015-10-07 15:29:51 -050019746 * flash_call_update_via_tftp:
19747 * @proxy: A #FlashProxy.
19748 * @arg_url: Argument to pass with the method invocation.
19749 * @arg_filename: Argument to pass with the method invocation.
19750 * @cancellable: (allow-none): A #GCancellable or %NULL.
19751 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19752 * @user_data: User data to pass to @callback.
19753 *
19754 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method on @proxy.
19755 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
19756 * You can then call flash_call_update_via_tftp_finish() to get the result of the operation.
19757 *
19758 * See flash_call_update_via_tftp_sync() for the synchronous, blocking version of this method.
19759 */
19760void
19761flash_call_update_via_tftp (
19762 Flash *proxy,
19763 const gchar *arg_url,
19764 const gchar *arg_filename,
19765 GCancellable *cancellable,
19766 GAsyncReadyCallback callback,
19767 gpointer user_data)
19768{
19769 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19770 "updateViaTftp",
19771 g_variant_new ("(ss)",
19772 arg_url,
19773 arg_filename),
19774 G_DBUS_CALL_FLAGS_NONE,
19775 -1,
19776 cancellable,
19777 callback,
19778 user_data);
19779}
19780
19781/**
19782 * flash_call_update_via_tftp_finish:
19783 * @proxy: A #FlashProxy.
19784 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update_via_tftp().
19785 * @error: Return location for error or %NULL.
19786 *
19787 * Finishes an operation started with flash_call_update_via_tftp().
19788 *
19789 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19790 */
19791gboolean
19792flash_call_update_via_tftp_finish (
19793 Flash *proxy,
19794 GAsyncResult *res,
19795 GError **error)
19796{
19797 GVariant *_ret;
19798 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19799 if (_ret == NULL)
19800 goto _out;
19801 g_variant_get (_ret,
19802 "()");
19803 g_variant_unref (_ret);
19804_out:
19805 return _ret != NULL;
19806}
19807
19808/**
19809 * flash_call_update_via_tftp_sync:
19810 * @proxy: A #FlashProxy.
19811 * @arg_url: Argument to pass with the method invocation.
19812 * @arg_filename: Argument to pass with the method invocation.
19813 * @cancellable: (allow-none): A #GCancellable or %NULL.
19814 * @error: Return location for error or %NULL.
19815 *
19816 * 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.
19817 *
19818 * See flash_call_update_via_tftp() for the asynchronous version of this method.
19819 *
19820 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19821 */
19822gboolean
19823flash_call_update_via_tftp_sync (
19824 Flash *proxy,
19825 const gchar *arg_url,
19826 const gchar *arg_filename,
19827 GCancellable *cancellable,
19828 GError **error)
19829{
19830 GVariant *_ret;
19831 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19832 "updateViaTftp",
19833 g_variant_new ("(ss)",
19834 arg_url,
19835 arg_filename),
19836 G_DBUS_CALL_FLAGS_NONE,
19837 -1,
19838 cancellable,
19839 error);
19840 if (_ret == NULL)
19841 goto _out;
19842 g_variant_get (_ret,
19843 "()");
19844 g_variant_unref (_ret);
19845_out:
19846 return _ret != NULL;
19847}
19848
19849/**
Norman James362a80f2015-09-14 14:04:39 -050019850 * flash_call_init:
19851 * @proxy: A #FlashProxy.
19852 * @cancellable: (allow-none): A #GCancellable or %NULL.
19853 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19854 * @user_data: User data to pass to @callback.
19855 *
19856 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method on @proxy.
19857 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
19858 * You can then call flash_call_init_finish() to get the result of the operation.
19859 *
19860 * See flash_call_init_sync() for the synchronous, blocking version of this method.
19861 */
19862void
19863flash_call_init (
19864 Flash *proxy,
19865 GCancellable *cancellable,
19866 GAsyncReadyCallback callback,
19867 gpointer user_data)
19868{
19869 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19870 "init",
19871 g_variant_new ("()"),
19872 G_DBUS_CALL_FLAGS_NONE,
19873 -1,
19874 cancellable,
19875 callback,
19876 user_data);
19877}
19878
19879/**
19880 * flash_call_init_finish:
19881 * @proxy: A #FlashProxy.
19882 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_init().
19883 * @error: Return location for error or %NULL.
19884 *
19885 * Finishes an operation started with flash_call_init().
19886 *
19887 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19888 */
19889gboolean
19890flash_call_init_finish (
19891 Flash *proxy,
19892 GAsyncResult *res,
19893 GError **error)
19894{
19895 GVariant *_ret;
19896 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19897 if (_ret == NULL)
19898 goto _out;
19899 g_variant_get (_ret,
19900 "()");
19901 g_variant_unref (_ret);
19902_out:
19903 return _ret != NULL;
19904}
19905
19906/**
19907 * flash_call_init_sync:
19908 * @proxy: A #FlashProxy.
19909 * @cancellable: (allow-none): A #GCancellable or %NULL.
19910 * @error: Return location for error or %NULL.
19911 *
19912 * 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.
19913 *
19914 * See flash_call_init() for the asynchronous version of this method.
19915 *
19916 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19917 */
19918gboolean
19919flash_call_init_sync (
19920 Flash *proxy,
19921 GCancellable *cancellable,
19922 GError **error)
19923{
19924 GVariant *_ret;
19925 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19926 "init",
19927 g_variant_new ("()"),
19928 G_DBUS_CALL_FLAGS_NONE,
19929 -1,
19930 cancellable,
19931 error);
19932 if (_ret == NULL)
19933 goto _out;
19934 g_variant_get (_ret,
19935 "()");
19936 g_variant_unref (_ret);
19937_out:
19938 return _ret != NULL;
19939}
19940
19941/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019942 * flash_complete_update:
Norman James362a80f2015-09-14 14:04:39 -050019943 * @object: A #Flash.
19944 * @invocation: (transfer full): A #GDBusMethodInvocation.
19945 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019946 * 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 -050019947 *
19948 * This method will free @invocation, you cannot use it afterwards.
19949 */
19950void
Norman Jamesdbcffbd2015-10-06 16:53:06 -050019951flash_complete_update (
Norman James362a80f2015-09-14 14:04:39 -050019952 Flash *object,
19953 GDBusMethodInvocation *invocation)
19954{
19955 g_dbus_method_invocation_return_value (invocation,
19956 g_variant_new ("()"));
19957}
19958
19959/**
Norman Jamesf066e872015-10-07 15:29:51 -050019960 * flash_complete_update_via_tftp:
19961 * @object: A #Flash.
19962 * @invocation: (transfer full): A #GDBusMethodInvocation.
19963 *
19964 * 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.
19965 *
19966 * This method will free @invocation, you cannot use it afterwards.
19967 */
19968void
19969flash_complete_update_via_tftp (
19970 Flash *object,
19971 GDBusMethodInvocation *invocation)
19972{
19973 g_dbus_method_invocation_return_value (invocation,
19974 g_variant_new ("()"));
19975}
19976
19977/**
Norman James362a80f2015-09-14 14:04:39 -050019978 * flash_complete_init:
19979 * @object: A #Flash.
19980 * @invocation: (transfer full): A #GDBusMethodInvocation.
19981 *
19982 * 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.
19983 *
19984 * This method will free @invocation, you cannot use it afterwards.
19985 */
19986void
19987flash_complete_init (
19988 Flash *object,
19989 GDBusMethodInvocation *invocation)
19990{
19991 g_dbus_method_invocation_return_value (invocation,
19992 g_variant_new ("()"));
19993}
19994
19995/* ------------------------------------------------------------------------ */
19996
19997/**
19998 * FlashProxy:
19999 *
20000 * The #FlashProxy structure contains only private data and should only be accessed using the provided API.
20001 */
20002
20003/**
20004 * FlashProxyClass:
20005 * @parent_class: The parent class.
20006 *
20007 * Class structure for #FlashProxy.
20008 */
20009
20010struct _FlashProxyPrivate
20011{
20012 GData *qdata;
20013};
20014
20015static void flash_proxy_iface_init (FlashIface *iface);
20016
20017#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20018G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
20019 G_ADD_PRIVATE (FlashProxy)
20020 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
20021
20022#else
20023G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
20024 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
20025
20026#endif
20027static void
20028flash_proxy_finalize (GObject *object)
20029{
20030 FlashProxy *proxy = FLASH_PROXY (object);
20031 g_datalist_clear (&proxy->priv->qdata);
20032 G_OBJECT_CLASS (flash_proxy_parent_class)->finalize (object);
20033}
20034
20035static void
20036flash_proxy_get_property (GObject *object,
20037 guint prop_id,
20038 GValue *value,
20039 GParamSpec *pspec G_GNUC_UNUSED)
20040{
Norman James18998182015-10-11 21:54:53 -050020041 const _ExtendedGDBusPropertyInfo *info;
20042 GVariant *variant;
20043 g_assert (prop_id != 0 && prop_id - 1 < 4);
20044 info = _flash_property_info_pointers[prop_id - 1];
20045 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
20046 if (info->use_gvariant)
20047 {
20048 g_value_set_variant (value, variant);
20049 }
20050 else
20051 {
20052 if (variant != NULL)
20053 g_dbus_gvariant_to_gvalue (variant, value);
20054 }
20055 if (variant != NULL)
20056 g_variant_unref (variant);
20057}
20058
20059static void
20060flash_proxy_set_property_cb (GDBusProxy *proxy,
20061 GAsyncResult *res,
20062 gpointer user_data)
20063{
20064 const _ExtendedGDBusPropertyInfo *info = user_data;
20065 GError *error;
20066 GVariant *_ret;
20067 error = NULL;
20068 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
20069 if (!_ret)
20070 {
20071 g_warning ("Error setting property '%s' on interface org.openbmc.Flash: %s (%s, %d)",
20072 info->parent_struct.name,
20073 error->message, g_quark_to_string (error->domain), error->code);
20074 g_error_free (error);
20075 }
20076 else
20077 {
20078 g_variant_unref (_ret);
20079 }
Norman James362a80f2015-09-14 14:04:39 -050020080}
20081
20082static void
20083flash_proxy_set_property (GObject *object,
20084 guint prop_id,
20085 const GValue *value,
20086 GParamSpec *pspec G_GNUC_UNUSED)
20087{
Norman James18998182015-10-11 21:54:53 -050020088 const _ExtendedGDBusPropertyInfo *info;
20089 GVariant *variant;
20090 g_assert (prop_id != 0 && prop_id - 1 < 4);
20091 info = _flash_property_info_pointers[prop_id - 1];
20092 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
20093 g_dbus_proxy_call (G_DBUS_PROXY (object),
20094 "org.freedesktop.DBus.Properties.Set",
20095 g_variant_new ("(ssv)", "org.openbmc.Flash", info->parent_struct.name, variant),
20096 G_DBUS_CALL_FLAGS_NONE,
20097 -1,
20098 NULL, (GAsyncReadyCallback) flash_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
20099 g_variant_unref (variant);
Norman James362a80f2015-09-14 14:04:39 -050020100}
20101
20102static void
20103flash_proxy_g_signal (GDBusProxy *proxy,
20104 const gchar *sender_name G_GNUC_UNUSED,
20105 const gchar *signal_name,
20106 GVariant *parameters)
20107{
20108 _ExtendedGDBusSignalInfo *info;
20109 GVariantIter iter;
20110 GVariant *child;
20111 GValue *paramv;
20112 guint num_params;
20113 guint n;
20114 guint signal_id;
20115 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, signal_name);
20116 if (info == NULL)
20117 return;
20118 num_params = g_variant_n_children (parameters);
20119 paramv = g_new0 (GValue, num_params + 1);
20120 g_value_init (&paramv[0], TYPE_FLASH);
20121 g_value_set_object (&paramv[0], proxy);
20122 g_variant_iter_init (&iter, parameters);
20123 n = 1;
20124 while ((child = g_variant_iter_next_value (&iter)) != NULL)
20125 {
20126 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
20127 if (arg_info->use_gvariant)
20128 {
20129 g_value_init (&paramv[n], G_TYPE_VARIANT);
20130 g_value_set_variant (&paramv[n], child);
20131 n++;
20132 }
20133 else
20134 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
20135 g_variant_unref (child);
20136 }
20137 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
20138 g_signal_emitv (paramv, signal_id, 0, NULL);
20139 for (n = 0; n < num_params + 1; n++)
20140 g_value_unset (&paramv[n]);
20141 g_free (paramv);
20142}
20143
20144static void
20145flash_proxy_g_properties_changed (GDBusProxy *_proxy,
20146 GVariant *changed_properties,
20147 const gchar *const *invalidated_properties)
20148{
20149 FlashProxy *proxy = FLASH_PROXY (_proxy);
20150 guint n;
20151 const gchar *key;
20152 GVariantIter *iter;
20153 _ExtendedGDBusPropertyInfo *info;
20154 g_variant_get (changed_properties, "a{sv}", &iter);
20155 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
20156 {
20157 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, key);
20158 g_datalist_remove_data (&proxy->priv->qdata, key);
20159 if (info != NULL)
20160 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
20161 }
20162 g_variant_iter_free (iter);
20163 for (n = 0; invalidated_properties[n] != NULL; n++)
20164 {
20165 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, invalidated_properties[n]);
20166 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
20167 if (info != NULL)
20168 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
20169 }
20170}
20171
Norman James18998182015-10-11 21:54:53 -050020172static const gchar *
20173flash_proxy_get_filename (Flash *object)
20174{
20175 FlashProxy *proxy = FLASH_PROXY (object);
20176 GVariant *variant;
20177 const gchar *value = NULL;
20178 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "filename");
20179 if (variant != NULL)
20180 {
20181 value = g_variant_get_string (variant, NULL);
20182 g_variant_unref (variant);
20183 }
20184 return value;
20185}
20186
20187static const gchar *
20188flash_proxy_get_flasher_path (Flash *object)
20189{
20190 FlashProxy *proxy = FLASH_PROXY (object);
20191 GVariant *variant;
20192 const gchar *value = NULL;
20193 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_path");
20194 if (variant != NULL)
20195 {
20196 value = g_variant_get_string (variant, NULL);
20197 g_variant_unref (variant);
20198 }
20199 return value;
20200}
20201
20202static const gchar *
20203flash_proxy_get_flasher_name (Flash *object)
20204{
20205 FlashProxy *proxy = FLASH_PROXY (object);
20206 GVariant *variant;
20207 const gchar *value = NULL;
20208 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_name");
20209 if (variant != NULL)
20210 {
20211 value = g_variant_get_string (variant, NULL);
20212 g_variant_unref (variant);
20213 }
20214 return value;
20215}
20216
20217static const gchar *
20218flash_proxy_get_flasher_instance (Flash *object)
20219{
20220 FlashProxy *proxy = FLASH_PROXY (object);
20221 GVariant *variant;
20222 const gchar *value = NULL;
20223 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_instance");
20224 if (variant != NULL)
20225 {
20226 value = g_variant_get_string (variant, NULL);
20227 g_variant_unref (variant);
20228 }
20229 return value;
20230}
20231
Norman James362a80f2015-09-14 14:04:39 -050020232static void
20233flash_proxy_init (FlashProxy *proxy)
20234{
20235#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20236 proxy->priv = flash_proxy_get_instance_private (proxy);
20237#else
20238 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_PROXY, FlashProxyPrivate);
20239#endif
20240
20241 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_interface_info ());
20242}
20243
20244static void
20245flash_proxy_class_init (FlashProxyClass *klass)
20246{
20247 GObjectClass *gobject_class;
20248 GDBusProxyClass *proxy_class;
20249
20250 gobject_class = G_OBJECT_CLASS (klass);
20251 gobject_class->finalize = flash_proxy_finalize;
20252 gobject_class->get_property = flash_proxy_get_property;
20253 gobject_class->set_property = flash_proxy_set_property;
20254
20255 proxy_class = G_DBUS_PROXY_CLASS (klass);
20256 proxy_class->g_signal = flash_proxy_g_signal;
20257 proxy_class->g_properties_changed = flash_proxy_g_properties_changed;
20258
Norman James18998182015-10-11 21:54:53 -050020259 flash_override_properties (gobject_class, 1);
20260
Norman James362a80f2015-09-14 14:04:39 -050020261#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
20262 g_type_class_add_private (klass, sizeof (FlashProxyPrivate));
20263#endif
20264}
20265
20266static void
20267flash_proxy_iface_init (FlashIface *iface)
20268{
Norman James18998182015-10-11 21:54:53 -050020269 iface->get_filename = flash_proxy_get_filename;
20270 iface->get_flasher_path = flash_proxy_get_flasher_path;
20271 iface->get_flasher_name = flash_proxy_get_flasher_name;
20272 iface->get_flasher_instance = flash_proxy_get_flasher_instance;
Norman James362a80f2015-09-14 14:04:39 -050020273}
20274
20275/**
20276 * flash_proxy_new:
20277 * @connection: A #GDBusConnection.
20278 * @flags: Flags from the #GDBusProxyFlags enumeration.
20279 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
20280 * @object_path: An object path.
20281 * @cancellable: (allow-none): A #GCancellable or %NULL.
20282 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
20283 * @user_data: User data to pass to @callback.
20284 *
20285 * 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.
20286 *
20287 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
20288 * You can then call flash_proxy_new_finish() to get the result of the operation.
20289 *
20290 * See flash_proxy_new_sync() for the synchronous, blocking version of this constructor.
20291 */
20292void
20293flash_proxy_new (
20294 GDBusConnection *connection,
20295 GDBusProxyFlags flags,
20296 const gchar *name,
20297 const gchar *object_path,
20298 GCancellable *cancellable,
20299 GAsyncReadyCallback callback,
20300 gpointer user_data)
20301{
20302 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);
20303}
20304
20305/**
20306 * flash_proxy_new_finish:
20307 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new().
20308 * @error: Return location for error or %NULL
20309 *
20310 * Finishes an operation started with flash_proxy_new().
20311 *
20312 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
20313 */
20314Flash *
20315flash_proxy_new_finish (
20316 GAsyncResult *res,
20317 GError **error)
20318{
20319 GObject *ret;
20320 GObject *source_object;
20321 source_object = g_async_result_get_source_object (res);
20322 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
20323 g_object_unref (source_object);
20324 if (ret != NULL)
20325 return FLASH (ret);
20326 else
20327 return NULL;
20328}
20329
20330/**
20331 * flash_proxy_new_sync:
20332 * @connection: A #GDBusConnection.
20333 * @flags: Flags from the #GDBusProxyFlags enumeration.
20334 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
20335 * @object_path: An object path.
20336 * @cancellable: (allow-none): A #GCancellable or %NULL.
20337 * @error: Return location for error or %NULL
20338 *
20339 * 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.
20340 *
20341 * The calling thread is blocked until a reply is received.
20342 *
20343 * See flash_proxy_new() for the asynchronous version of this constructor.
20344 *
20345 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
20346 */
20347Flash *
20348flash_proxy_new_sync (
20349 GDBusConnection *connection,
20350 GDBusProxyFlags flags,
20351 const gchar *name,
20352 const gchar *object_path,
20353 GCancellable *cancellable,
20354 GError **error)
20355{
20356 GInitable *ret;
20357 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);
20358 if (ret != NULL)
20359 return FLASH (ret);
20360 else
20361 return NULL;
20362}
20363
20364
20365/**
20366 * flash_proxy_new_for_bus:
20367 * @bus_type: A #GBusType.
20368 * @flags: Flags from the #GDBusProxyFlags enumeration.
20369 * @name: A bus name (well-known or unique).
20370 * @object_path: An object path.
20371 * @cancellable: (allow-none): A #GCancellable or %NULL.
20372 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
20373 * @user_data: User data to pass to @callback.
20374 *
20375 * Like flash_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
20376 *
20377 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
20378 * You can then call flash_proxy_new_for_bus_finish() to get the result of the operation.
20379 *
20380 * See flash_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
20381 */
20382void
20383flash_proxy_new_for_bus (
20384 GBusType bus_type,
20385 GDBusProxyFlags flags,
20386 const gchar *name,
20387 const gchar *object_path,
20388 GCancellable *cancellable,
20389 GAsyncReadyCallback callback,
20390 gpointer user_data)
20391{
20392 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);
20393}
20394
20395/**
20396 * flash_proxy_new_for_bus_finish:
20397 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new_for_bus().
20398 * @error: Return location for error or %NULL
20399 *
20400 * Finishes an operation started with flash_proxy_new_for_bus().
20401 *
20402 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
20403 */
20404Flash *
20405flash_proxy_new_for_bus_finish (
20406 GAsyncResult *res,
20407 GError **error)
20408{
20409 GObject *ret;
20410 GObject *source_object;
20411 source_object = g_async_result_get_source_object (res);
20412 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
20413 g_object_unref (source_object);
20414 if (ret != NULL)
20415 return FLASH (ret);
20416 else
20417 return NULL;
20418}
20419
20420/**
20421 * flash_proxy_new_for_bus_sync:
20422 * @bus_type: A #GBusType.
20423 * @flags: Flags from the #GDBusProxyFlags enumeration.
20424 * @name: A bus name (well-known or unique).
20425 * @object_path: An object path.
20426 * @cancellable: (allow-none): A #GCancellable or %NULL.
20427 * @error: Return location for error or %NULL
20428 *
20429 * Like flash_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
20430 *
20431 * The calling thread is blocked until a reply is received.
20432 *
20433 * See flash_proxy_new_for_bus() for the asynchronous version of this constructor.
20434 *
20435 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
20436 */
20437Flash *
20438flash_proxy_new_for_bus_sync (
20439 GBusType bus_type,
20440 GDBusProxyFlags flags,
20441 const gchar *name,
20442 const gchar *object_path,
20443 GCancellable *cancellable,
20444 GError **error)
20445{
20446 GInitable *ret;
20447 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);
20448 if (ret != NULL)
20449 return FLASH (ret);
20450 else
20451 return NULL;
20452}
20453
20454
20455/* ------------------------------------------------------------------------ */
20456
20457/**
20458 * FlashSkeleton:
20459 *
20460 * The #FlashSkeleton structure contains only private data and should only be accessed using the provided API.
20461 */
20462
20463/**
20464 * FlashSkeletonClass:
20465 * @parent_class: The parent class.
20466 *
20467 * Class structure for #FlashSkeleton.
20468 */
20469
20470struct _FlashSkeletonPrivate
20471{
20472 GValue *properties;
20473 GList *changed_properties;
20474 GSource *changed_properties_idle_source;
20475 GMainContext *context;
20476 GMutex lock;
20477};
20478
20479static void
20480_flash_skeleton_handle_method_call (
20481 GDBusConnection *connection G_GNUC_UNUSED,
20482 const gchar *sender G_GNUC_UNUSED,
20483 const gchar *object_path G_GNUC_UNUSED,
20484 const gchar *interface_name,
20485 const gchar *method_name,
20486 GVariant *parameters,
20487 GDBusMethodInvocation *invocation,
20488 gpointer user_data)
20489{
20490 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
20491 _ExtendedGDBusMethodInfo *info;
20492 GVariantIter iter;
20493 GVariant *child;
20494 GValue *paramv;
20495 guint num_params;
20496 guint num_extra;
20497 guint n;
20498 guint signal_id;
20499 GValue return_value = G_VALUE_INIT;
20500 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
20501 g_assert (info != NULL);
20502 num_params = g_variant_n_children (parameters);
20503 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
20504 n = 0;
20505 g_value_init (&paramv[n], TYPE_FLASH);
20506 g_value_set_object (&paramv[n++], skeleton);
20507 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
20508 g_value_set_object (&paramv[n++], invocation);
20509 if (info->pass_fdlist)
20510 {
20511#ifdef G_OS_UNIX
20512 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
20513 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
20514#else
20515 g_assert_not_reached ();
20516#endif
20517 }
20518 g_variant_iter_init (&iter, parameters);
20519 while ((child = g_variant_iter_next_value (&iter)) != NULL)
20520 {
20521 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
20522 if (arg_info->use_gvariant)
20523 {
20524 g_value_init (&paramv[n], G_TYPE_VARIANT);
20525 g_value_set_variant (&paramv[n], child);
20526 n++;
20527 }
20528 else
20529 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
20530 g_variant_unref (child);
20531 }
20532 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
20533 g_value_init (&return_value, G_TYPE_BOOLEAN);
20534 g_signal_emitv (paramv, signal_id, 0, &return_value);
20535 if (!g_value_get_boolean (&return_value))
20536 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);
20537 g_value_unset (&return_value);
20538 for (n = 0; n < num_params + num_extra; n++)
20539 g_value_unset (&paramv[n]);
20540 g_free (paramv);
20541}
20542
20543static GVariant *
20544_flash_skeleton_handle_get_property (
20545 GDBusConnection *connection G_GNUC_UNUSED,
20546 const gchar *sender G_GNUC_UNUSED,
20547 const gchar *object_path G_GNUC_UNUSED,
20548 const gchar *interface_name G_GNUC_UNUSED,
20549 const gchar *property_name,
20550 GError **error,
20551 gpointer user_data)
20552{
20553 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
20554 GValue value = G_VALUE_INIT;
20555 GParamSpec *pspec;
20556 _ExtendedGDBusPropertyInfo *info;
20557 GVariant *ret;
20558 ret = NULL;
20559 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
20560 g_assert (info != NULL);
20561 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
20562 if (pspec == NULL)
20563 {
20564 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
20565 }
20566 else
20567 {
20568 g_value_init (&value, pspec->value_type);
20569 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
20570 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
20571 g_value_unset (&value);
20572 }
20573 return ret;
20574}
20575
20576static gboolean
20577_flash_skeleton_handle_set_property (
20578 GDBusConnection *connection G_GNUC_UNUSED,
20579 const gchar *sender G_GNUC_UNUSED,
20580 const gchar *object_path G_GNUC_UNUSED,
20581 const gchar *interface_name G_GNUC_UNUSED,
20582 const gchar *property_name,
20583 GVariant *variant,
20584 GError **error,
20585 gpointer user_data)
20586{
20587 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
20588 GValue value = G_VALUE_INIT;
20589 GParamSpec *pspec;
20590 _ExtendedGDBusPropertyInfo *info;
20591 gboolean ret;
20592 ret = FALSE;
20593 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
20594 g_assert (info != NULL);
20595 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
20596 if (pspec == NULL)
20597 {
20598 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
20599 }
20600 else
20601 {
20602 if (info->use_gvariant)
20603 g_value_set_variant (&value, variant);
20604 else
20605 g_dbus_gvariant_to_gvalue (variant, &value);
20606 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
20607 g_value_unset (&value);
20608 ret = TRUE;
20609 }
20610 return ret;
20611}
20612
20613static const GDBusInterfaceVTable _flash_skeleton_vtable =
20614{
20615 _flash_skeleton_handle_method_call,
20616 _flash_skeleton_handle_get_property,
20617 _flash_skeleton_handle_set_property,
20618 {NULL}
20619};
20620
20621static GDBusInterfaceInfo *
20622flash_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
20623{
20624 return flash_interface_info ();
20625}
20626
20627static GDBusInterfaceVTable *
20628flash_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
20629{
20630 return (GDBusInterfaceVTable *) &_flash_skeleton_vtable;
20631}
20632
20633static GVariant *
20634flash_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
20635{
20636 FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton);
20637
20638 GVariantBuilder builder;
20639 guint n;
20640 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
20641 if (_flash_interface_info.parent_struct.properties == NULL)
20642 goto out;
20643 for (n = 0; _flash_interface_info.parent_struct.properties[n] != NULL; n++)
20644 {
20645 GDBusPropertyInfo *info = _flash_interface_info.parent_struct.properties[n];
20646 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
20647 {
20648 GVariant *value;
20649 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);
20650 if (value != NULL)
20651 {
20652 g_variant_take_ref (value);
20653 g_variant_builder_add (&builder, "{sv}", info->name, value);
20654 g_variant_unref (value);
20655 }
20656 }
20657 }
20658out:
20659 return g_variant_builder_end (&builder);
20660}
20661
Norman James18998182015-10-11 21:54:53 -050020662static gboolean _flash_emit_changed (gpointer user_data);
20663
Norman James362a80f2015-09-14 14:04:39 -050020664static void
20665flash_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
20666{
Norman James18998182015-10-11 21:54:53 -050020667 FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton);
20668 gboolean emit_changed = FALSE;
20669
20670 g_mutex_lock (&skeleton->priv->lock);
20671 if (skeleton->priv->changed_properties_idle_source != NULL)
20672 {
20673 g_source_destroy (skeleton->priv->changed_properties_idle_source);
20674 skeleton->priv->changed_properties_idle_source = NULL;
20675 emit_changed = TRUE;
20676 }
20677 g_mutex_unlock (&skeleton->priv->lock);
20678
20679 if (emit_changed)
20680 _flash_emit_changed (skeleton);
Norman James362a80f2015-09-14 14:04:39 -050020681}
20682
20683static void
20684_flash_on_signal_updated (
20685 Flash *object)
20686{
20687 FlashSkeleton *skeleton = FLASH_SKELETON (object);
20688
20689 GList *connections, *l;
20690 GVariant *signal_variant;
20691 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
20692
20693 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
20694 for (l = connections; l != NULL; l = l->next)
20695 {
20696 GDBusConnection *connection = l->data;
20697 g_dbus_connection_emit_signal (connection,
20698 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Updated",
20699 signal_variant, NULL);
20700 }
20701 g_variant_unref (signal_variant);
20702 g_list_free_full (connections, g_object_unref);
20703}
20704
Norman Jamesf066e872015-10-07 15:29:51 -050020705static void
20706_flash_on_signal_download (
20707 Flash *object,
20708 const gchar *arg_url,
20709 const gchar *arg_filename)
20710{
20711 FlashSkeleton *skeleton = FLASH_SKELETON (object);
20712
20713 GList *connections, *l;
20714 GVariant *signal_variant;
20715 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
20716
20717 signal_variant = g_variant_ref_sink (g_variant_new ("(ss)",
20718 arg_url,
20719 arg_filename));
20720 for (l = connections; l != NULL; l = l->next)
20721 {
20722 GDBusConnection *connection = l->data;
20723 g_dbus_connection_emit_signal (connection,
20724 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Download",
20725 signal_variant, NULL);
20726 }
20727 g_variant_unref (signal_variant);
20728 g_list_free_full (connections, g_object_unref);
20729}
20730
Norman James362a80f2015-09-14 14:04:39 -050020731static void flash_skeleton_iface_init (FlashIface *iface);
20732#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20733G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
20734 G_ADD_PRIVATE (FlashSkeleton)
20735 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
20736
20737#else
20738G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
20739 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
20740
20741#endif
20742static void
20743flash_skeleton_finalize (GObject *object)
20744{
20745 FlashSkeleton *skeleton = FLASH_SKELETON (object);
Norman James18998182015-10-11 21:54:53 -050020746 guint n;
20747 for (n = 0; n < 4; n++)
20748 g_value_unset (&skeleton->priv->properties[n]);
20749 g_free (skeleton->priv->properties);
Norman James362a80f2015-09-14 14:04:39 -050020750 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
20751 if (skeleton->priv->changed_properties_idle_source != NULL)
20752 g_source_destroy (skeleton->priv->changed_properties_idle_source);
20753 g_main_context_unref (skeleton->priv->context);
20754 g_mutex_clear (&skeleton->priv->lock);
20755 G_OBJECT_CLASS (flash_skeleton_parent_class)->finalize (object);
20756}
20757
20758static void
Norman James18998182015-10-11 21:54:53 -050020759flash_skeleton_get_property (GObject *object,
20760 guint prop_id,
20761 GValue *value,
20762 GParamSpec *pspec G_GNUC_UNUSED)
20763{
20764 FlashSkeleton *skeleton = FLASH_SKELETON (object);
20765 g_assert (prop_id != 0 && prop_id - 1 < 4);
20766 g_mutex_lock (&skeleton->priv->lock);
20767 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
20768 g_mutex_unlock (&skeleton->priv->lock);
20769}
20770
20771static gboolean
20772_flash_emit_changed (gpointer user_data)
20773{
20774 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
20775 GList *l;
20776 GVariantBuilder builder;
20777 GVariantBuilder invalidated_builder;
20778 guint num_changes;
20779
20780 g_mutex_lock (&skeleton->priv->lock);
20781 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
20782 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
20783 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
20784 {
20785 ChangedProperty *cp = l->data;
20786 GVariant *variant;
20787 const GValue *cur_value;
20788
20789 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
20790 if (!_g_value_equal (cur_value, &cp->orig_value))
20791 {
20792 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
20793 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
20794 g_variant_unref (variant);
20795 num_changes++;
20796 }
20797 }
20798 if (num_changes > 0)
20799 {
20800 GList *connections, *ll;
20801 GVariant *signal_variant;
20802 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Flash",
20803 &builder, &invalidated_builder));
20804 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
20805 for (ll = connections; ll != NULL; ll = ll->next)
20806 {
20807 GDBusConnection *connection = ll->data;
20808
20809 g_dbus_connection_emit_signal (connection,
20810 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
20811 "org.freedesktop.DBus.Properties",
20812 "PropertiesChanged",
20813 signal_variant,
20814 NULL);
20815 }
20816 g_variant_unref (signal_variant);
20817 g_list_free_full (connections, g_object_unref);
20818 }
20819 else
20820 {
20821 g_variant_builder_clear (&builder);
20822 g_variant_builder_clear (&invalidated_builder);
20823 }
20824 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
20825 skeleton->priv->changed_properties = NULL;
20826 skeleton->priv->changed_properties_idle_source = NULL;
20827 g_mutex_unlock (&skeleton->priv->lock);
20828 return FALSE;
20829}
20830
20831static void
20832_flash_schedule_emit_changed (FlashSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
20833{
20834 ChangedProperty *cp;
20835 GList *l;
20836 cp = NULL;
20837 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
20838 {
20839 ChangedProperty *i_cp = l->data;
20840 if (i_cp->info == info)
20841 {
20842 cp = i_cp;
20843 break;
20844 }
20845 }
20846 if (cp == NULL)
20847 {
20848 cp = g_new0 (ChangedProperty, 1);
20849 cp->prop_id = prop_id;
20850 cp->info = info;
20851 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
20852 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
20853 g_value_copy (orig_value, &cp->orig_value);
20854 }
20855}
20856
20857static void
20858flash_skeleton_notify (GObject *object,
20859 GParamSpec *pspec G_GNUC_UNUSED)
20860{
20861 FlashSkeleton *skeleton = FLASH_SKELETON (object);
20862 g_mutex_lock (&skeleton->priv->lock);
20863 if (skeleton->priv->changed_properties != NULL &&
20864 skeleton->priv->changed_properties_idle_source == NULL)
20865 {
20866 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
20867 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
20868 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _flash_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
20869 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
20870 g_source_unref (skeleton->priv->changed_properties_idle_source);
20871 }
20872 g_mutex_unlock (&skeleton->priv->lock);
20873}
20874
20875static void
20876flash_skeleton_set_property (GObject *object,
20877 guint prop_id,
20878 const GValue *value,
20879 GParamSpec *pspec)
20880{
20881 FlashSkeleton *skeleton = FLASH_SKELETON (object);
20882 g_assert (prop_id != 0 && prop_id - 1 < 4);
20883 g_mutex_lock (&skeleton->priv->lock);
20884 g_object_freeze_notify (object);
20885 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
20886 {
20887 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
20888 _flash_schedule_emit_changed (skeleton, _flash_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
20889 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
20890 g_object_notify_by_pspec (object, pspec);
20891 }
20892 g_mutex_unlock (&skeleton->priv->lock);
20893 g_object_thaw_notify (object);
20894}
20895
20896static void
Norman James362a80f2015-09-14 14:04:39 -050020897flash_skeleton_init (FlashSkeleton *skeleton)
20898{
20899#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20900 skeleton->priv = flash_skeleton_get_instance_private (skeleton);
20901#else
20902 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_SKELETON, FlashSkeletonPrivate);
20903#endif
20904
20905 g_mutex_init (&skeleton->priv->lock);
20906 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James18998182015-10-11 21:54:53 -050020907 skeleton->priv->properties = g_new0 (GValue, 4);
20908 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
20909 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
20910 g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING);
20911 g_value_init (&skeleton->priv->properties[3], G_TYPE_STRING);
20912}
20913
20914static const gchar *
20915flash_skeleton_get_filename (Flash *object)
20916{
20917 FlashSkeleton *skeleton = FLASH_SKELETON (object);
20918 const gchar *value;
20919 g_mutex_lock (&skeleton->priv->lock);
20920 value = g_value_get_string (&(skeleton->priv->properties[0]));
20921 g_mutex_unlock (&skeleton->priv->lock);
20922 return value;
20923}
20924
20925static const gchar *
20926flash_skeleton_get_flasher_path (Flash *object)
20927{
20928 FlashSkeleton *skeleton = FLASH_SKELETON (object);
20929 const gchar *value;
20930 g_mutex_lock (&skeleton->priv->lock);
20931 value = g_value_get_string (&(skeleton->priv->properties[1]));
20932 g_mutex_unlock (&skeleton->priv->lock);
20933 return value;
20934}
20935
20936static const gchar *
20937flash_skeleton_get_flasher_name (Flash *object)
20938{
20939 FlashSkeleton *skeleton = FLASH_SKELETON (object);
20940 const gchar *value;
20941 g_mutex_lock (&skeleton->priv->lock);
20942 value = g_value_get_string (&(skeleton->priv->properties[2]));
20943 g_mutex_unlock (&skeleton->priv->lock);
20944 return value;
20945}
20946
20947static const gchar *
20948flash_skeleton_get_flasher_instance (Flash *object)
20949{
20950 FlashSkeleton *skeleton = FLASH_SKELETON (object);
20951 const gchar *value;
20952 g_mutex_lock (&skeleton->priv->lock);
20953 value = g_value_get_string (&(skeleton->priv->properties[3]));
20954 g_mutex_unlock (&skeleton->priv->lock);
20955 return value;
Norman James362a80f2015-09-14 14:04:39 -050020956}
20957
20958static void
20959flash_skeleton_class_init (FlashSkeletonClass *klass)
20960{
20961 GObjectClass *gobject_class;
20962 GDBusInterfaceSkeletonClass *skeleton_class;
20963
20964 gobject_class = G_OBJECT_CLASS (klass);
20965 gobject_class->finalize = flash_skeleton_finalize;
Norman James18998182015-10-11 21:54:53 -050020966 gobject_class->get_property = flash_skeleton_get_property;
20967 gobject_class->set_property = flash_skeleton_set_property;
20968 gobject_class->notify = flash_skeleton_notify;
20969
20970
20971 flash_override_properties (gobject_class, 1);
Norman James362a80f2015-09-14 14:04:39 -050020972
20973 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
20974 skeleton_class->get_info = flash_skeleton_dbus_interface_get_info;
20975 skeleton_class->get_properties = flash_skeleton_dbus_interface_get_properties;
20976 skeleton_class->flush = flash_skeleton_dbus_interface_flush;
20977 skeleton_class->get_vtable = flash_skeleton_dbus_interface_get_vtable;
20978
20979#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
20980 g_type_class_add_private (klass, sizeof (FlashSkeletonPrivate));
20981#endif
20982}
20983
20984static void
20985flash_skeleton_iface_init (FlashIface *iface)
20986{
20987 iface->updated = _flash_on_signal_updated;
Norman Jamesf066e872015-10-07 15:29:51 -050020988 iface->download = _flash_on_signal_download;
Norman James18998182015-10-11 21:54:53 -050020989 iface->get_filename = flash_skeleton_get_filename;
20990 iface->get_flasher_path = flash_skeleton_get_flasher_path;
20991 iface->get_flasher_name = flash_skeleton_get_flasher_name;
20992 iface->get_flasher_instance = flash_skeleton_get_flasher_instance;
Norman James362a80f2015-09-14 14:04:39 -050020993}
20994
20995/**
20996 * flash_skeleton_new:
20997 *
20998 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
20999 *
21000 * Returns: (transfer full) (type FlashSkeleton): The skeleton object.
21001 */
21002Flash *
21003flash_skeleton_new (void)
21004{
21005 return FLASH (g_object_new (TYPE_FLASH_SKELETON, NULL));
21006}
21007
21008/* ------------------------------------------------------------------------
Norman James18998182015-10-11 21:54:53 -050021009 * Code for interface org.openbmc.FlashControl
21010 * ------------------------------------------------------------------------
21011 */
21012
21013/**
21014 * SECTION:FlashControl
21015 * @title: FlashControl
21016 * @short_description: Generated C code for the org.openbmc.FlashControl D-Bus interface
21017 *
21018 * 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.
21019 */
21020
21021/* ---- Introspection data for org.openbmc.FlashControl ---- */
21022
21023static const _ExtendedGDBusArgInfo _flash_control_method_info_flash_IN_ARG_type =
21024{
21025 {
21026 -1,
21027 (gchar *) "type",
21028 (gchar *) "s",
21029 NULL
21030 },
21031 FALSE
21032};
21033
21034static const _ExtendedGDBusArgInfo _flash_control_method_info_flash_IN_ARG_filename =
21035{
21036 {
21037 -1,
21038 (gchar *) "filename",
21039 (gchar *) "s",
21040 NULL
21041 },
21042 FALSE
21043};
21044
21045static const _ExtendedGDBusArgInfo * const _flash_control_method_info_flash_IN_ARG_pointers[] =
21046{
21047 &_flash_control_method_info_flash_IN_ARG_type,
21048 &_flash_control_method_info_flash_IN_ARG_filename,
21049 NULL
21050};
21051
21052static const _ExtendedGDBusMethodInfo _flash_control_method_info_flash =
21053{
21054 {
21055 -1,
21056 (gchar *) "flash",
21057 (GDBusArgInfo **) &_flash_control_method_info_flash_IN_ARG_pointers,
21058 NULL,
21059 NULL
21060 },
21061 "handle-flash",
21062 FALSE
21063};
21064
21065static const _ExtendedGDBusMethodInfo * const _flash_control_method_info_pointers[] =
21066{
21067 &_flash_control_method_info_flash,
21068 NULL
21069};
21070
21071static const _ExtendedGDBusArgInfo _flash_control_signal_info_done_ARG_filename =
21072{
21073 {
21074 -1,
21075 (gchar *) "filename",
21076 (gchar *) "s",
21077 NULL
21078 },
21079 FALSE
21080};
21081
21082static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_done_ARG_pointers[] =
21083{
21084 &_flash_control_signal_info_done_ARG_filename,
21085 NULL
21086};
21087
21088static const _ExtendedGDBusSignalInfo _flash_control_signal_info_done =
21089{
21090 {
21091 -1,
21092 (gchar *) "Done",
21093 (GDBusArgInfo **) &_flash_control_signal_info_done_ARG_pointers,
21094 NULL
21095 },
21096 "done"
21097};
21098
21099static const _ExtendedGDBusArgInfo _flash_control_signal_info_error_ARG_filename =
21100{
21101 {
21102 -1,
21103 (gchar *) "filename",
21104 (gchar *) "s",
21105 NULL
21106 },
21107 FALSE
21108};
21109
21110static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_error_ARG_pointers[] =
21111{
21112 &_flash_control_signal_info_error_ARG_filename,
21113 NULL
21114};
21115
21116static const _ExtendedGDBusSignalInfo _flash_control_signal_info_error =
21117{
21118 {
21119 -1,
21120 (gchar *) "Error",
21121 (GDBusArgInfo **) &_flash_control_signal_info_error_ARG_pointers,
21122 NULL
21123 },
21124 "error"
21125};
21126
21127static const _ExtendedGDBusArgInfo _flash_control_signal_info_progress_ARG_filename =
21128{
21129 {
21130 -1,
21131 (gchar *) "filename",
21132 (gchar *) "s",
21133 NULL
21134 },
21135 FALSE
21136};
21137
21138static const _ExtendedGDBusArgInfo _flash_control_signal_info_progress_ARG_progress =
21139{
21140 {
21141 -1,
21142 (gchar *) "progress",
21143 (gchar *) "y",
21144 NULL
21145 },
21146 FALSE
21147};
21148
21149static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_progress_ARG_pointers[] =
21150{
21151 &_flash_control_signal_info_progress_ARG_filename,
21152 &_flash_control_signal_info_progress_ARG_progress,
21153 NULL
21154};
21155
21156static const _ExtendedGDBusSignalInfo _flash_control_signal_info_progress =
21157{
21158 {
21159 -1,
21160 (gchar *) "Progress",
21161 (GDBusArgInfo **) &_flash_control_signal_info_progress_ARG_pointers,
21162 NULL
21163 },
21164 "progress"
21165};
21166
21167static const _ExtendedGDBusSignalInfo * const _flash_control_signal_info_pointers[] =
21168{
21169 &_flash_control_signal_info_done,
21170 &_flash_control_signal_info_error,
21171 &_flash_control_signal_info_progress,
21172 NULL
21173};
21174
21175static const _ExtendedGDBusPropertyInfo _flash_control_property_info_filename =
21176{
21177 {
21178 -1,
21179 (gchar *) "filename",
21180 (gchar *) "s",
21181 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21182 NULL
21183 },
21184 "filename",
21185 FALSE
21186};
21187
21188static const _ExtendedGDBusPropertyInfo _flash_control_property_info_type_ =
21189{
21190 {
21191 -1,
21192 (gchar *) "type",
21193 (gchar *) "s",
21194 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21195 NULL
21196 },
21197 "type",
21198 FALSE
21199};
21200
21201static const _ExtendedGDBusPropertyInfo * const _flash_control_property_info_pointers[] =
21202{
21203 &_flash_control_property_info_filename,
21204 &_flash_control_property_info_type_,
21205 NULL
21206};
21207
21208static const _ExtendedGDBusInterfaceInfo _flash_control_interface_info =
21209{
21210 {
21211 -1,
21212 (gchar *) "org.openbmc.FlashControl",
21213 (GDBusMethodInfo **) &_flash_control_method_info_pointers,
21214 (GDBusSignalInfo **) &_flash_control_signal_info_pointers,
21215 (GDBusPropertyInfo **) &_flash_control_property_info_pointers,
21216 NULL
21217 },
21218 "flash-control",
21219};
21220
21221
21222/**
21223 * flash_control_interface_info:
21224 *
21225 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> D-Bus interface.
21226 *
21227 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
21228 */
21229GDBusInterfaceInfo *
21230flash_control_interface_info (void)
21231{
21232 return (GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct;
21233}
21234
21235/**
21236 * flash_control_override_properties:
21237 * @klass: The class structure for a #GObject<!-- -->-derived class.
21238 * @property_id_begin: The property id to assign to the first overridden property.
21239 *
21240 * Overrides all #GObject properties in the #FlashControl interface for a concrete class.
21241 * The properties are overridden in the order they are defined.
21242 *
21243 * Returns: The last property id.
21244 */
21245guint
21246flash_control_override_properties (GObjectClass *klass, guint property_id_begin)
21247{
21248 g_object_class_override_property (klass, property_id_begin++, "filename");
21249 g_object_class_override_property (klass, property_id_begin++, "type");
21250 return property_id_begin - 1;
21251}
21252
21253
21254
21255/**
21256 * FlashControl:
21257 *
21258 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
21259 */
21260
21261/**
21262 * FlashControlIface:
21263 * @parent_iface: The parent interface.
21264 * @handle_flash: Handler for the #FlashControl::handle-flash signal.
21265 * @get_filename: Getter for the #FlashControl:filename property.
21266 * @get_type_: Getter for the #FlashControl:type property.
21267 * @done: Handler for the #FlashControl::done signal.
21268 * @error: Handler for the #FlashControl::error signal.
21269 * @progress: Handler for the #FlashControl::progress signal.
21270 *
21271 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
21272 */
21273
21274typedef FlashControlIface FlashControlInterface;
21275G_DEFINE_INTERFACE (FlashControl, flash_control, G_TYPE_OBJECT);
21276
21277static void
21278flash_control_default_init (FlashControlIface *iface)
21279{
21280 /* GObject signals for incoming D-Bus method calls: */
21281 /**
21282 * FlashControl::handle-flash:
21283 * @object: A #FlashControl.
21284 * @invocation: A #GDBusMethodInvocation.
21285 * @arg_type: Argument passed by remote caller.
21286 * @arg_filename: Argument passed by remote caller.
21287 *
21288 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method.
21289 *
21290 * 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.
21291 *
21292 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21293 */
21294 g_signal_new ("handle-flash",
21295 G_TYPE_FROM_INTERFACE (iface),
21296 G_SIGNAL_RUN_LAST,
21297 G_STRUCT_OFFSET (FlashControlIface, handle_flash),
21298 g_signal_accumulator_true_handled,
21299 NULL,
21300 g_cclosure_marshal_generic,
21301 G_TYPE_BOOLEAN,
21302 3,
21303 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING);
21304
21305 /* GObject signals for received D-Bus signals: */
21306 /**
21307 * FlashControl::done:
21308 * @object: A #FlashControl.
21309 * @arg_filename: Argument.
21310 *
21311 * 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.
21312 *
21313 * 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.
21314 */
21315 g_signal_new ("done",
21316 G_TYPE_FROM_INTERFACE (iface),
21317 G_SIGNAL_RUN_LAST,
21318 G_STRUCT_OFFSET (FlashControlIface, done),
21319 NULL,
21320 NULL,
21321 g_cclosure_marshal_generic,
21322 G_TYPE_NONE,
21323 1, G_TYPE_STRING);
21324
21325 /**
21326 * FlashControl::error:
21327 * @object: A #FlashControl.
21328 * @arg_filename: Argument.
21329 *
21330 * 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.
21331 *
21332 * 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.
21333 */
21334 g_signal_new ("error",
21335 G_TYPE_FROM_INTERFACE (iface),
21336 G_SIGNAL_RUN_LAST,
21337 G_STRUCT_OFFSET (FlashControlIface, error),
21338 NULL,
21339 NULL,
21340 g_cclosure_marshal_generic,
21341 G_TYPE_NONE,
21342 1, G_TYPE_STRING);
21343
21344 /**
21345 * FlashControl::progress:
21346 * @object: A #FlashControl.
21347 * @arg_filename: Argument.
21348 * @arg_progress: Argument.
21349 *
21350 * 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.
21351 *
21352 * 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.
21353 */
21354 g_signal_new ("progress",
21355 G_TYPE_FROM_INTERFACE (iface),
21356 G_SIGNAL_RUN_LAST,
21357 G_STRUCT_OFFSET (FlashControlIface, progress),
21358 NULL,
21359 NULL,
21360 g_cclosure_marshal_generic,
21361 G_TYPE_NONE,
21362 2, G_TYPE_STRING, G_TYPE_UCHAR);
21363
21364 /* GObject properties for D-Bus properties: */
21365 /**
21366 * FlashControl:filename:
21367 *
21368 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link>.
21369 *
21370 * 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.
21371 */
21372 g_object_interface_install_property (iface,
21373 g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
21374 /**
21375 * FlashControl:type:
21376 *
21377 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link>.
21378 *
21379 * 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.
21380 */
21381 g_object_interface_install_property (iface,
21382 g_param_spec_string ("type", "type", "type", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
21383}
21384
21385/**
21386 * flash_control_get_filename: (skip)
21387 * @object: A #FlashControl.
21388 *
21389 * Gets the value of the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property.
21390 *
21391 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
21392 *
21393 * <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>
21394 *
21395 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
21396 */
21397const gchar *
21398flash_control_get_filename (FlashControl *object)
21399{
21400 return FLASH_CONTROL_GET_IFACE (object)->get_filename (object);
21401}
21402
21403/**
21404 * flash_control_dup_filename: (skip)
21405 * @object: A #FlashControl.
21406 *
21407 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property.
21408 *
21409 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
21410 *
21411 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
21412 */
21413gchar *
21414flash_control_dup_filename (FlashControl *object)
21415{
21416 gchar *value;
21417 g_object_get (G_OBJECT (object), "filename", &value, NULL);
21418 return value;
21419}
21420
21421/**
21422 * flash_control_set_filename: (skip)
21423 * @object: A #FlashControl.
21424 * @value: The value to set.
21425 *
21426 * Sets the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property to @value.
21427 *
21428 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
21429 */
21430void
21431flash_control_set_filename (FlashControl *object, const gchar *value)
21432{
21433 g_object_set (G_OBJECT (object), "filename", value, NULL);
21434}
21435
21436/**
21437 * flash_control_get_type_: (skip)
21438 * @object: A #FlashControl.
21439 *
21440 * Gets the value of the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property.
21441 *
21442 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
21443 *
21444 * <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>
21445 *
21446 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
21447 */
21448const gchar *
21449flash_control_get_type_ (FlashControl *object)
21450{
21451 return FLASH_CONTROL_GET_IFACE (object)->get_type_ (object);
21452}
21453
21454/**
21455 * flash_control_dup_type_: (skip)
21456 * @object: A #FlashControl.
21457 *
21458 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property.
21459 *
21460 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
21461 *
21462 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
21463 */
21464gchar *
21465flash_control_dup_type_ (FlashControl *object)
21466{
21467 gchar *value;
21468 g_object_get (G_OBJECT (object), "type", &value, NULL);
21469 return value;
21470}
21471
21472/**
21473 * flash_control_set_type_: (skip)
21474 * @object: A #FlashControl.
21475 * @value: The value to set.
21476 *
21477 * Sets the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property to @value.
21478 *
21479 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
21480 */
21481void
21482flash_control_set_type_ (FlashControl *object, const gchar *value)
21483{
21484 g_object_set (G_OBJECT (object), "type", value, NULL);
21485}
21486
21487/**
21488 * flash_control_emit_done:
21489 * @object: A #FlashControl.
21490 * @arg_filename: Argument to pass with the signal.
21491 *
21492 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Done">"Done"</link> D-Bus signal.
21493 */
21494void
21495flash_control_emit_done (
21496 FlashControl *object,
21497 const gchar *arg_filename)
21498{
21499 g_signal_emit_by_name (object, "done", arg_filename);
21500}
21501
21502/**
21503 * flash_control_emit_error:
21504 * @object: A #FlashControl.
21505 * @arg_filename: Argument to pass with the signal.
21506 *
21507 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Error">"Error"</link> D-Bus signal.
21508 */
21509void
21510flash_control_emit_error (
21511 FlashControl *object,
21512 const gchar *arg_filename)
21513{
21514 g_signal_emit_by_name (object, "error", arg_filename);
21515}
21516
21517/**
21518 * flash_control_emit_progress:
21519 * @object: A #FlashControl.
21520 * @arg_filename: Argument to pass with the signal.
21521 * @arg_progress: Argument to pass with the signal.
21522 *
21523 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Progress">"Progress"</link> D-Bus signal.
21524 */
21525void
21526flash_control_emit_progress (
21527 FlashControl *object,
21528 const gchar *arg_filename,
21529 guchar arg_progress)
21530{
21531 g_signal_emit_by_name (object, "progress", arg_filename, arg_progress);
21532}
21533
21534/**
21535 * flash_control_call_flash:
21536 * @proxy: A #FlashControlProxy.
21537 * @arg_type: Argument to pass with the method invocation.
21538 * @arg_filename: Argument to pass with the method invocation.
21539 * @cancellable: (allow-none): A #GCancellable or %NULL.
21540 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
21541 * @user_data: User data to pass to @callback.
21542 *
21543 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method on @proxy.
21544 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
21545 * You can then call flash_control_call_flash_finish() to get the result of the operation.
21546 *
21547 * See flash_control_call_flash_sync() for the synchronous, blocking version of this method.
21548 */
21549void
21550flash_control_call_flash (
21551 FlashControl *proxy,
21552 const gchar *arg_type,
21553 const gchar *arg_filename,
21554 GCancellable *cancellable,
21555 GAsyncReadyCallback callback,
21556 gpointer user_data)
21557{
21558 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
21559 "flash",
21560 g_variant_new ("(ss)",
21561 arg_type,
21562 arg_filename),
21563 G_DBUS_CALL_FLAGS_NONE,
21564 -1,
21565 cancellable,
21566 callback,
21567 user_data);
21568}
21569
21570/**
21571 * flash_control_call_flash_finish:
21572 * @proxy: A #FlashControlProxy.
21573 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_call_flash().
21574 * @error: Return location for error or %NULL.
21575 *
21576 * Finishes an operation started with flash_control_call_flash().
21577 *
21578 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
21579 */
21580gboolean
21581flash_control_call_flash_finish (
21582 FlashControl *proxy,
21583 GAsyncResult *res,
21584 GError **error)
21585{
21586 GVariant *_ret;
21587 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
21588 if (_ret == NULL)
21589 goto _out;
21590 g_variant_get (_ret,
21591 "()");
21592 g_variant_unref (_ret);
21593_out:
21594 return _ret != NULL;
21595}
21596
21597/**
21598 * flash_control_call_flash_sync:
21599 * @proxy: A #FlashControlProxy.
21600 * @arg_type: Argument to pass with the method invocation.
21601 * @arg_filename: Argument to pass with the method invocation.
21602 * @cancellable: (allow-none): A #GCancellable or %NULL.
21603 * @error: Return location for error or %NULL.
21604 *
21605 * 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.
21606 *
21607 * See flash_control_call_flash() for the asynchronous version of this method.
21608 *
21609 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
21610 */
21611gboolean
21612flash_control_call_flash_sync (
21613 FlashControl *proxy,
21614 const gchar *arg_type,
21615 const gchar *arg_filename,
21616 GCancellable *cancellable,
21617 GError **error)
21618{
21619 GVariant *_ret;
21620 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
21621 "flash",
21622 g_variant_new ("(ss)",
21623 arg_type,
21624 arg_filename),
21625 G_DBUS_CALL_FLAGS_NONE,
21626 -1,
21627 cancellable,
21628 error);
21629 if (_ret == NULL)
21630 goto _out;
21631 g_variant_get (_ret,
21632 "()");
21633 g_variant_unref (_ret);
21634_out:
21635 return _ret != NULL;
21636}
21637
21638/**
21639 * flash_control_complete_flash:
21640 * @object: A #FlashControl.
21641 * @invocation: (transfer full): A #GDBusMethodInvocation.
21642 *
21643 * 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.
21644 *
21645 * This method will free @invocation, you cannot use it afterwards.
21646 */
21647void
21648flash_control_complete_flash (
21649 FlashControl *object,
21650 GDBusMethodInvocation *invocation)
21651{
21652 g_dbus_method_invocation_return_value (invocation,
21653 g_variant_new ("()"));
21654}
21655
21656/* ------------------------------------------------------------------------ */
21657
21658/**
21659 * FlashControlProxy:
21660 *
21661 * The #FlashControlProxy structure contains only private data and should only be accessed using the provided API.
21662 */
21663
21664/**
21665 * FlashControlProxyClass:
21666 * @parent_class: The parent class.
21667 *
21668 * Class structure for #FlashControlProxy.
21669 */
21670
21671struct _FlashControlProxyPrivate
21672{
21673 GData *qdata;
21674};
21675
21676static void flash_control_proxy_iface_init (FlashControlIface *iface);
21677
21678#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21679G_DEFINE_TYPE_WITH_CODE (FlashControlProxy, flash_control_proxy, G_TYPE_DBUS_PROXY,
21680 G_ADD_PRIVATE (FlashControlProxy)
21681 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_proxy_iface_init));
21682
21683#else
21684G_DEFINE_TYPE_WITH_CODE (FlashControlProxy, flash_control_proxy, G_TYPE_DBUS_PROXY,
21685 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_proxy_iface_init));
21686
21687#endif
21688static void
21689flash_control_proxy_finalize (GObject *object)
21690{
21691 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
21692 g_datalist_clear (&proxy->priv->qdata);
21693 G_OBJECT_CLASS (flash_control_proxy_parent_class)->finalize (object);
21694}
21695
21696static void
21697flash_control_proxy_get_property (GObject *object,
21698 guint prop_id,
21699 GValue *value,
21700 GParamSpec *pspec G_GNUC_UNUSED)
21701{
21702 const _ExtendedGDBusPropertyInfo *info;
21703 GVariant *variant;
21704 g_assert (prop_id != 0 && prop_id - 1 < 2);
21705 info = _flash_control_property_info_pointers[prop_id - 1];
21706 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
21707 if (info->use_gvariant)
21708 {
21709 g_value_set_variant (value, variant);
21710 }
21711 else
21712 {
21713 if (variant != NULL)
21714 g_dbus_gvariant_to_gvalue (variant, value);
21715 }
21716 if (variant != NULL)
21717 g_variant_unref (variant);
21718}
21719
21720static void
21721flash_control_proxy_set_property_cb (GDBusProxy *proxy,
21722 GAsyncResult *res,
21723 gpointer user_data)
21724{
21725 const _ExtendedGDBusPropertyInfo *info = user_data;
21726 GError *error;
21727 GVariant *_ret;
21728 error = NULL;
21729 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
21730 if (!_ret)
21731 {
21732 g_warning ("Error setting property '%s' on interface org.openbmc.FlashControl: %s (%s, %d)",
21733 info->parent_struct.name,
21734 error->message, g_quark_to_string (error->domain), error->code);
21735 g_error_free (error);
21736 }
21737 else
21738 {
21739 g_variant_unref (_ret);
21740 }
21741}
21742
21743static void
21744flash_control_proxy_set_property (GObject *object,
21745 guint prop_id,
21746 const GValue *value,
21747 GParamSpec *pspec G_GNUC_UNUSED)
21748{
21749 const _ExtendedGDBusPropertyInfo *info;
21750 GVariant *variant;
21751 g_assert (prop_id != 0 && prop_id - 1 < 2);
21752 info = _flash_control_property_info_pointers[prop_id - 1];
21753 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
21754 g_dbus_proxy_call (G_DBUS_PROXY (object),
21755 "org.freedesktop.DBus.Properties.Set",
21756 g_variant_new ("(ssv)", "org.openbmc.FlashControl", info->parent_struct.name, variant),
21757 G_DBUS_CALL_FLAGS_NONE,
21758 -1,
21759 NULL, (GAsyncReadyCallback) flash_control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
21760 g_variant_unref (variant);
21761}
21762
21763static void
21764flash_control_proxy_g_signal (GDBusProxy *proxy,
21765 const gchar *sender_name G_GNUC_UNUSED,
21766 const gchar *signal_name,
21767 GVariant *parameters)
21768{
21769 _ExtendedGDBusSignalInfo *info;
21770 GVariantIter iter;
21771 GVariant *child;
21772 GValue *paramv;
21773 guint num_params;
21774 guint n;
21775 guint signal_id;
21776 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, signal_name);
21777 if (info == NULL)
21778 return;
21779 num_params = g_variant_n_children (parameters);
21780 paramv = g_new0 (GValue, num_params + 1);
21781 g_value_init (&paramv[0], TYPE_FLASH_CONTROL);
21782 g_value_set_object (&paramv[0], proxy);
21783 g_variant_iter_init (&iter, parameters);
21784 n = 1;
21785 while ((child = g_variant_iter_next_value (&iter)) != NULL)
21786 {
21787 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
21788 if (arg_info->use_gvariant)
21789 {
21790 g_value_init (&paramv[n], G_TYPE_VARIANT);
21791 g_value_set_variant (&paramv[n], child);
21792 n++;
21793 }
21794 else
21795 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
21796 g_variant_unref (child);
21797 }
21798 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH_CONTROL);
21799 g_signal_emitv (paramv, signal_id, 0, NULL);
21800 for (n = 0; n < num_params + 1; n++)
21801 g_value_unset (&paramv[n]);
21802 g_free (paramv);
21803}
21804
21805static void
21806flash_control_proxy_g_properties_changed (GDBusProxy *_proxy,
21807 GVariant *changed_properties,
21808 const gchar *const *invalidated_properties)
21809{
21810 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (_proxy);
21811 guint n;
21812 const gchar *key;
21813 GVariantIter *iter;
21814 _ExtendedGDBusPropertyInfo *info;
21815 g_variant_get (changed_properties, "a{sv}", &iter);
21816 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
21817 {
21818 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, key);
21819 g_datalist_remove_data (&proxy->priv->qdata, key);
21820 if (info != NULL)
21821 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
21822 }
21823 g_variant_iter_free (iter);
21824 for (n = 0; invalidated_properties[n] != NULL; n++)
21825 {
21826 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, invalidated_properties[n]);
21827 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
21828 if (info != NULL)
21829 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
21830 }
21831}
21832
21833static const gchar *
21834flash_control_proxy_get_filename (FlashControl *object)
21835{
21836 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
21837 GVariant *variant;
21838 const gchar *value = NULL;
21839 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "filename");
21840 if (variant != NULL)
21841 {
21842 value = g_variant_get_string (variant, NULL);
21843 g_variant_unref (variant);
21844 }
21845 return value;
21846}
21847
21848static const gchar *
21849flash_control_proxy_get_type_ (FlashControl *object)
21850{
21851 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
21852 GVariant *variant;
21853 const gchar *value = NULL;
21854 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "type");
21855 if (variant != NULL)
21856 {
21857 value = g_variant_get_string (variant, NULL);
21858 g_variant_unref (variant);
21859 }
21860 return value;
21861}
21862
21863static void
21864flash_control_proxy_init (FlashControlProxy *proxy)
21865{
21866#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21867 proxy->priv = flash_control_proxy_get_instance_private (proxy);
21868#else
21869 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_CONTROL_PROXY, FlashControlProxyPrivate);
21870#endif
21871
21872 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_control_interface_info ());
21873}
21874
21875static void
21876flash_control_proxy_class_init (FlashControlProxyClass *klass)
21877{
21878 GObjectClass *gobject_class;
21879 GDBusProxyClass *proxy_class;
21880
21881 gobject_class = G_OBJECT_CLASS (klass);
21882 gobject_class->finalize = flash_control_proxy_finalize;
21883 gobject_class->get_property = flash_control_proxy_get_property;
21884 gobject_class->set_property = flash_control_proxy_set_property;
21885
21886 proxy_class = G_DBUS_PROXY_CLASS (klass);
21887 proxy_class->g_signal = flash_control_proxy_g_signal;
21888 proxy_class->g_properties_changed = flash_control_proxy_g_properties_changed;
21889
21890 flash_control_override_properties (gobject_class, 1);
21891
21892#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
21893 g_type_class_add_private (klass, sizeof (FlashControlProxyPrivate));
21894#endif
21895}
21896
21897static void
21898flash_control_proxy_iface_init (FlashControlIface *iface)
21899{
21900 iface->get_filename = flash_control_proxy_get_filename;
21901 iface->get_type_ = flash_control_proxy_get_type_;
21902}
21903
21904/**
21905 * flash_control_proxy_new:
21906 * @connection: A #GDBusConnection.
21907 * @flags: Flags from the #GDBusProxyFlags enumeration.
21908 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
21909 * @object_path: An object path.
21910 * @cancellable: (allow-none): A #GCancellable or %NULL.
21911 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
21912 * @user_data: User data to pass to @callback.
21913 *
21914 * 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.
21915 *
21916 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
21917 * You can then call flash_control_proxy_new_finish() to get the result of the operation.
21918 *
21919 * See flash_control_proxy_new_sync() for the synchronous, blocking version of this constructor.
21920 */
21921void
21922flash_control_proxy_new (
21923 GDBusConnection *connection,
21924 GDBusProxyFlags flags,
21925 const gchar *name,
21926 const gchar *object_path,
21927 GCancellable *cancellable,
21928 GAsyncReadyCallback callback,
21929 gpointer user_data)
21930{
21931 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);
21932}
21933
21934/**
21935 * flash_control_proxy_new_finish:
21936 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_proxy_new().
21937 * @error: Return location for error or %NULL
21938 *
21939 * Finishes an operation started with flash_control_proxy_new().
21940 *
21941 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
21942 */
21943FlashControl *
21944flash_control_proxy_new_finish (
21945 GAsyncResult *res,
21946 GError **error)
21947{
21948 GObject *ret;
21949 GObject *source_object;
21950 source_object = g_async_result_get_source_object (res);
21951 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
21952 g_object_unref (source_object);
21953 if (ret != NULL)
21954 return FLASH_CONTROL (ret);
21955 else
21956 return NULL;
21957}
21958
21959/**
21960 * flash_control_proxy_new_sync:
21961 * @connection: A #GDBusConnection.
21962 * @flags: Flags from the #GDBusProxyFlags enumeration.
21963 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
21964 * @object_path: An object path.
21965 * @cancellable: (allow-none): A #GCancellable or %NULL.
21966 * @error: Return location for error or %NULL
21967 *
21968 * 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.
21969 *
21970 * The calling thread is blocked until a reply is received.
21971 *
21972 * See flash_control_proxy_new() for the asynchronous version of this constructor.
21973 *
21974 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
21975 */
21976FlashControl *
21977flash_control_proxy_new_sync (
21978 GDBusConnection *connection,
21979 GDBusProxyFlags flags,
21980 const gchar *name,
21981 const gchar *object_path,
21982 GCancellable *cancellable,
21983 GError **error)
21984{
21985 GInitable *ret;
21986 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);
21987 if (ret != NULL)
21988 return FLASH_CONTROL (ret);
21989 else
21990 return NULL;
21991}
21992
21993
21994/**
21995 * flash_control_proxy_new_for_bus:
21996 * @bus_type: A #GBusType.
21997 * @flags: Flags from the #GDBusProxyFlags enumeration.
21998 * @name: A bus name (well-known or unique).
21999 * @object_path: An object path.
22000 * @cancellable: (allow-none): A #GCancellable or %NULL.
22001 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
22002 * @user_data: User data to pass to @callback.
22003 *
22004 * Like flash_control_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
22005 *
22006 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
22007 * You can then call flash_control_proxy_new_for_bus_finish() to get the result of the operation.
22008 *
22009 * See flash_control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
22010 */
22011void
22012flash_control_proxy_new_for_bus (
22013 GBusType bus_type,
22014 GDBusProxyFlags flags,
22015 const gchar *name,
22016 const gchar *object_path,
22017 GCancellable *cancellable,
22018 GAsyncReadyCallback callback,
22019 gpointer user_data)
22020{
22021 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);
22022}
22023
22024/**
22025 * flash_control_proxy_new_for_bus_finish:
22026 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_proxy_new_for_bus().
22027 * @error: Return location for error or %NULL
22028 *
22029 * Finishes an operation started with flash_control_proxy_new_for_bus().
22030 *
22031 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
22032 */
22033FlashControl *
22034flash_control_proxy_new_for_bus_finish (
22035 GAsyncResult *res,
22036 GError **error)
22037{
22038 GObject *ret;
22039 GObject *source_object;
22040 source_object = g_async_result_get_source_object (res);
22041 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
22042 g_object_unref (source_object);
22043 if (ret != NULL)
22044 return FLASH_CONTROL (ret);
22045 else
22046 return NULL;
22047}
22048
22049/**
22050 * flash_control_proxy_new_for_bus_sync:
22051 * @bus_type: A #GBusType.
22052 * @flags: Flags from the #GDBusProxyFlags enumeration.
22053 * @name: A bus name (well-known or unique).
22054 * @object_path: An object path.
22055 * @cancellable: (allow-none): A #GCancellable or %NULL.
22056 * @error: Return location for error or %NULL
22057 *
22058 * Like flash_control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
22059 *
22060 * The calling thread is blocked until a reply is received.
22061 *
22062 * See flash_control_proxy_new_for_bus() for the asynchronous version of this constructor.
22063 *
22064 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
22065 */
22066FlashControl *
22067flash_control_proxy_new_for_bus_sync (
22068 GBusType bus_type,
22069 GDBusProxyFlags flags,
22070 const gchar *name,
22071 const gchar *object_path,
22072 GCancellable *cancellable,
22073 GError **error)
22074{
22075 GInitable *ret;
22076 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);
22077 if (ret != NULL)
22078 return FLASH_CONTROL (ret);
22079 else
22080 return NULL;
22081}
22082
22083
22084/* ------------------------------------------------------------------------ */
22085
22086/**
22087 * FlashControlSkeleton:
22088 *
22089 * The #FlashControlSkeleton structure contains only private data and should only be accessed using the provided API.
22090 */
22091
22092/**
22093 * FlashControlSkeletonClass:
22094 * @parent_class: The parent class.
22095 *
22096 * Class structure for #FlashControlSkeleton.
22097 */
22098
22099struct _FlashControlSkeletonPrivate
22100{
22101 GValue *properties;
22102 GList *changed_properties;
22103 GSource *changed_properties_idle_source;
22104 GMainContext *context;
22105 GMutex lock;
22106};
22107
22108static void
22109_flash_control_skeleton_handle_method_call (
22110 GDBusConnection *connection G_GNUC_UNUSED,
22111 const gchar *sender G_GNUC_UNUSED,
22112 const gchar *object_path G_GNUC_UNUSED,
22113 const gchar *interface_name,
22114 const gchar *method_name,
22115 GVariant *parameters,
22116 GDBusMethodInvocation *invocation,
22117 gpointer user_data)
22118{
22119 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
22120 _ExtendedGDBusMethodInfo *info;
22121 GVariantIter iter;
22122 GVariant *child;
22123 GValue *paramv;
22124 guint num_params;
22125 guint num_extra;
22126 guint n;
22127 guint signal_id;
22128 GValue return_value = G_VALUE_INIT;
22129 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
22130 g_assert (info != NULL);
22131 num_params = g_variant_n_children (parameters);
22132 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
22133 n = 0;
22134 g_value_init (&paramv[n], TYPE_FLASH_CONTROL);
22135 g_value_set_object (&paramv[n++], skeleton);
22136 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
22137 g_value_set_object (&paramv[n++], invocation);
22138 if (info->pass_fdlist)
22139 {
22140#ifdef G_OS_UNIX
22141 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
22142 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
22143#else
22144 g_assert_not_reached ();
22145#endif
22146 }
22147 g_variant_iter_init (&iter, parameters);
22148 while ((child = g_variant_iter_next_value (&iter)) != NULL)
22149 {
22150 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
22151 if (arg_info->use_gvariant)
22152 {
22153 g_value_init (&paramv[n], G_TYPE_VARIANT);
22154 g_value_set_variant (&paramv[n], child);
22155 n++;
22156 }
22157 else
22158 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
22159 g_variant_unref (child);
22160 }
22161 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH_CONTROL);
22162 g_value_init (&return_value, G_TYPE_BOOLEAN);
22163 g_signal_emitv (paramv, signal_id, 0, &return_value);
22164 if (!g_value_get_boolean (&return_value))
22165 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);
22166 g_value_unset (&return_value);
22167 for (n = 0; n < num_params + num_extra; n++)
22168 g_value_unset (&paramv[n]);
22169 g_free (paramv);
22170}
22171
22172static GVariant *
22173_flash_control_skeleton_handle_get_property (
22174 GDBusConnection *connection G_GNUC_UNUSED,
22175 const gchar *sender G_GNUC_UNUSED,
22176 const gchar *object_path G_GNUC_UNUSED,
22177 const gchar *interface_name G_GNUC_UNUSED,
22178 const gchar *property_name,
22179 GError **error,
22180 gpointer user_data)
22181{
22182 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
22183 GValue value = G_VALUE_INIT;
22184 GParamSpec *pspec;
22185 _ExtendedGDBusPropertyInfo *info;
22186 GVariant *ret;
22187 ret = NULL;
22188 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, property_name);
22189 g_assert (info != NULL);
22190 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
22191 if (pspec == NULL)
22192 {
22193 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
22194 }
22195 else
22196 {
22197 g_value_init (&value, pspec->value_type);
22198 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
22199 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
22200 g_value_unset (&value);
22201 }
22202 return ret;
22203}
22204
22205static gboolean
22206_flash_control_skeleton_handle_set_property (
22207 GDBusConnection *connection G_GNUC_UNUSED,
22208 const gchar *sender G_GNUC_UNUSED,
22209 const gchar *object_path G_GNUC_UNUSED,
22210 const gchar *interface_name G_GNUC_UNUSED,
22211 const gchar *property_name,
22212 GVariant *variant,
22213 GError **error,
22214 gpointer user_data)
22215{
22216 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
22217 GValue value = G_VALUE_INIT;
22218 GParamSpec *pspec;
22219 _ExtendedGDBusPropertyInfo *info;
22220 gboolean ret;
22221 ret = FALSE;
22222 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, property_name);
22223 g_assert (info != NULL);
22224 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
22225 if (pspec == NULL)
22226 {
22227 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
22228 }
22229 else
22230 {
22231 if (info->use_gvariant)
22232 g_value_set_variant (&value, variant);
22233 else
22234 g_dbus_gvariant_to_gvalue (variant, &value);
22235 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
22236 g_value_unset (&value);
22237 ret = TRUE;
22238 }
22239 return ret;
22240}
22241
22242static const GDBusInterfaceVTable _flash_control_skeleton_vtable =
22243{
22244 _flash_control_skeleton_handle_method_call,
22245 _flash_control_skeleton_handle_get_property,
22246 _flash_control_skeleton_handle_set_property,
22247 {NULL}
22248};
22249
22250static GDBusInterfaceInfo *
22251flash_control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
22252{
22253 return flash_control_interface_info ();
22254}
22255
22256static GDBusInterfaceVTable *
22257flash_control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
22258{
22259 return (GDBusInterfaceVTable *) &_flash_control_skeleton_vtable;
22260}
22261
22262static GVariant *
22263flash_control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
22264{
22265 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (_skeleton);
22266
22267 GVariantBuilder builder;
22268 guint n;
22269 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
22270 if (_flash_control_interface_info.parent_struct.properties == NULL)
22271 goto out;
22272 for (n = 0; _flash_control_interface_info.parent_struct.properties[n] != NULL; n++)
22273 {
22274 GDBusPropertyInfo *info = _flash_control_interface_info.parent_struct.properties[n];
22275 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
22276 {
22277 GVariant *value;
22278 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);
22279 if (value != NULL)
22280 {
22281 g_variant_take_ref (value);
22282 g_variant_builder_add (&builder, "{sv}", info->name, value);
22283 g_variant_unref (value);
22284 }
22285 }
22286 }
22287out:
22288 return g_variant_builder_end (&builder);
22289}
22290
22291static gboolean _flash_control_emit_changed (gpointer user_data);
22292
22293static void
22294flash_control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
22295{
22296 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (_skeleton);
22297 gboolean emit_changed = FALSE;
22298
22299 g_mutex_lock (&skeleton->priv->lock);
22300 if (skeleton->priv->changed_properties_idle_source != NULL)
22301 {
22302 g_source_destroy (skeleton->priv->changed_properties_idle_source);
22303 skeleton->priv->changed_properties_idle_source = NULL;
22304 emit_changed = TRUE;
22305 }
22306 g_mutex_unlock (&skeleton->priv->lock);
22307
22308 if (emit_changed)
22309 _flash_control_emit_changed (skeleton);
22310}
22311
22312static void
22313_flash_control_on_signal_done (
22314 FlashControl *object,
22315 const gchar *arg_filename)
22316{
22317 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
22318
22319 GList *connections, *l;
22320 GVariant *signal_variant;
22321 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
22322
22323 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
22324 arg_filename));
22325 for (l = connections; l != NULL; l = l->next)
22326 {
22327 GDBusConnection *connection = l->data;
22328 g_dbus_connection_emit_signal (connection,
22329 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Done",
22330 signal_variant, NULL);
22331 }
22332 g_variant_unref (signal_variant);
22333 g_list_free_full (connections, g_object_unref);
22334}
22335
22336static void
22337_flash_control_on_signal_error (
22338 FlashControl *object,
22339 const gchar *arg_filename)
22340{
22341 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
22342
22343 GList *connections, *l;
22344 GVariant *signal_variant;
22345 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
22346
22347 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
22348 arg_filename));
22349 for (l = connections; l != NULL; l = l->next)
22350 {
22351 GDBusConnection *connection = l->data;
22352 g_dbus_connection_emit_signal (connection,
22353 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Error",
22354 signal_variant, NULL);
22355 }
22356 g_variant_unref (signal_variant);
22357 g_list_free_full (connections, g_object_unref);
22358}
22359
22360static void
22361_flash_control_on_signal_progress (
22362 FlashControl *object,
22363 const gchar *arg_filename,
22364 guchar arg_progress)
22365{
22366 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
22367
22368 GList *connections, *l;
22369 GVariant *signal_variant;
22370 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
22371
22372 signal_variant = g_variant_ref_sink (g_variant_new ("(sy)",
22373 arg_filename,
22374 arg_progress));
22375 for (l = connections; l != NULL; l = l->next)
22376 {
22377 GDBusConnection *connection = l->data;
22378 g_dbus_connection_emit_signal (connection,
22379 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Progress",
22380 signal_variant, NULL);
22381 }
22382 g_variant_unref (signal_variant);
22383 g_list_free_full (connections, g_object_unref);
22384}
22385
22386static void flash_control_skeleton_iface_init (FlashControlIface *iface);
22387#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22388G_DEFINE_TYPE_WITH_CODE (FlashControlSkeleton, flash_control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
22389 G_ADD_PRIVATE (FlashControlSkeleton)
22390 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_skeleton_iface_init));
22391
22392#else
22393G_DEFINE_TYPE_WITH_CODE (FlashControlSkeleton, flash_control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
22394 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_skeleton_iface_init));
22395
22396#endif
22397static void
22398flash_control_skeleton_finalize (GObject *object)
22399{
22400 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
22401 guint n;
22402 for (n = 0; n < 2; n++)
22403 g_value_unset (&skeleton->priv->properties[n]);
22404 g_free (skeleton->priv->properties);
22405 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
22406 if (skeleton->priv->changed_properties_idle_source != NULL)
22407 g_source_destroy (skeleton->priv->changed_properties_idle_source);
22408 g_main_context_unref (skeleton->priv->context);
22409 g_mutex_clear (&skeleton->priv->lock);
22410 G_OBJECT_CLASS (flash_control_skeleton_parent_class)->finalize (object);
22411}
22412
22413static void
22414flash_control_skeleton_get_property (GObject *object,
22415 guint prop_id,
22416 GValue *value,
22417 GParamSpec *pspec G_GNUC_UNUSED)
22418{
22419 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
22420 g_assert (prop_id != 0 && prop_id - 1 < 2);
22421 g_mutex_lock (&skeleton->priv->lock);
22422 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
22423 g_mutex_unlock (&skeleton->priv->lock);
22424}
22425
22426static gboolean
22427_flash_control_emit_changed (gpointer user_data)
22428{
22429 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
22430 GList *l;
22431 GVariantBuilder builder;
22432 GVariantBuilder invalidated_builder;
22433 guint num_changes;
22434
22435 g_mutex_lock (&skeleton->priv->lock);
22436 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
22437 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
22438 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
22439 {
22440 ChangedProperty *cp = l->data;
22441 GVariant *variant;
22442 const GValue *cur_value;
22443
22444 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
22445 if (!_g_value_equal (cur_value, &cp->orig_value))
22446 {
22447 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
22448 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
22449 g_variant_unref (variant);
22450 num_changes++;
22451 }
22452 }
22453 if (num_changes > 0)
22454 {
22455 GList *connections, *ll;
22456 GVariant *signal_variant;
22457 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.FlashControl",
22458 &builder, &invalidated_builder));
22459 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
22460 for (ll = connections; ll != NULL; ll = ll->next)
22461 {
22462 GDBusConnection *connection = ll->data;
22463
22464 g_dbus_connection_emit_signal (connection,
22465 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
22466 "org.freedesktop.DBus.Properties",
22467 "PropertiesChanged",
22468 signal_variant,
22469 NULL);
22470 }
22471 g_variant_unref (signal_variant);
22472 g_list_free_full (connections, g_object_unref);
22473 }
22474 else
22475 {
22476 g_variant_builder_clear (&builder);
22477 g_variant_builder_clear (&invalidated_builder);
22478 }
22479 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
22480 skeleton->priv->changed_properties = NULL;
22481 skeleton->priv->changed_properties_idle_source = NULL;
22482 g_mutex_unlock (&skeleton->priv->lock);
22483 return FALSE;
22484}
22485
22486static void
22487_flash_control_schedule_emit_changed (FlashControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
22488{
22489 ChangedProperty *cp;
22490 GList *l;
22491 cp = NULL;
22492 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
22493 {
22494 ChangedProperty *i_cp = l->data;
22495 if (i_cp->info == info)
22496 {
22497 cp = i_cp;
22498 break;
22499 }
22500 }
22501 if (cp == NULL)
22502 {
22503 cp = g_new0 (ChangedProperty, 1);
22504 cp->prop_id = prop_id;
22505 cp->info = info;
22506 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
22507 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
22508 g_value_copy (orig_value, &cp->orig_value);
22509 }
22510}
22511
22512static void
22513flash_control_skeleton_notify (GObject *object,
22514 GParamSpec *pspec G_GNUC_UNUSED)
22515{
22516 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
22517 g_mutex_lock (&skeleton->priv->lock);
22518 if (skeleton->priv->changed_properties != NULL &&
22519 skeleton->priv->changed_properties_idle_source == NULL)
22520 {
22521 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
22522 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
22523 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _flash_control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
22524 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
22525 g_source_unref (skeleton->priv->changed_properties_idle_source);
22526 }
22527 g_mutex_unlock (&skeleton->priv->lock);
22528}
22529
22530static void
22531flash_control_skeleton_set_property (GObject *object,
22532 guint prop_id,
22533 const GValue *value,
22534 GParamSpec *pspec)
22535{
22536 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
22537 g_assert (prop_id != 0 && prop_id - 1 < 2);
22538 g_mutex_lock (&skeleton->priv->lock);
22539 g_object_freeze_notify (object);
22540 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
22541 {
22542 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
22543 _flash_control_schedule_emit_changed (skeleton, _flash_control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
22544 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
22545 g_object_notify_by_pspec (object, pspec);
22546 }
22547 g_mutex_unlock (&skeleton->priv->lock);
22548 g_object_thaw_notify (object);
22549}
22550
22551static void
22552flash_control_skeleton_init (FlashControlSkeleton *skeleton)
22553{
22554#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22555 skeleton->priv = flash_control_skeleton_get_instance_private (skeleton);
22556#else
22557 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_CONTROL_SKELETON, FlashControlSkeletonPrivate);
22558#endif
22559
22560 g_mutex_init (&skeleton->priv->lock);
22561 skeleton->priv->context = g_main_context_ref_thread_default ();
22562 skeleton->priv->properties = g_new0 (GValue, 2);
22563 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
22564 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
22565}
22566
22567static const gchar *
22568flash_control_skeleton_get_filename (FlashControl *object)
22569{
22570 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
22571 const gchar *value;
22572 g_mutex_lock (&skeleton->priv->lock);
22573 value = g_value_get_string (&(skeleton->priv->properties[0]));
22574 g_mutex_unlock (&skeleton->priv->lock);
22575 return value;
22576}
22577
22578static const gchar *
22579flash_control_skeleton_get_type_ (FlashControl *object)
22580{
22581 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
22582 const gchar *value;
22583 g_mutex_lock (&skeleton->priv->lock);
22584 value = g_value_get_string (&(skeleton->priv->properties[1]));
22585 g_mutex_unlock (&skeleton->priv->lock);
22586 return value;
22587}
22588
22589static void
22590flash_control_skeleton_class_init (FlashControlSkeletonClass *klass)
22591{
22592 GObjectClass *gobject_class;
22593 GDBusInterfaceSkeletonClass *skeleton_class;
22594
22595 gobject_class = G_OBJECT_CLASS (klass);
22596 gobject_class->finalize = flash_control_skeleton_finalize;
22597 gobject_class->get_property = flash_control_skeleton_get_property;
22598 gobject_class->set_property = flash_control_skeleton_set_property;
22599 gobject_class->notify = flash_control_skeleton_notify;
22600
22601
22602 flash_control_override_properties (gobject_class, 1);
22603
22604 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
22605 skeleton_class->get_info = flash_control_skeleton_dbus_interface_get_info;
22606 skeleton_class->get_properties = flash_control_skeleton_dbus_interface_get_properties;
22607 skeleton_class->flush = flash_control_skeleton_dbus_interface_flush;
22608 skeleton_class->get_vtable = flash_control_skeleton_dbus_interface_get_vtable;
22609
22610#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
22611 g_type_class_add_private (klass, sizeof (FlashControlSkeletonPrivate));
22612#endif
22613}
22614
22615static void
22616flash_control_skeleton_iface_init (FlashControlIface *iface)
22617{
22618 iface->done = _flash_control_on_signal_done;
22619 iface->error = _flash_control_on_signal_error;
22620 iface->progress = _flash_control_on_signal_progress;
22621 iface->get_filename = flash_control_skeleton_get_filename;
22622 iface->get_type_ = flash_control_skeleton_get_type_;
22623}
22624
22625/**
22626 * flash_control_skeleton_new:
22627 *
22628 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
22629 *
22630 * Returns: (transfer full) (type FlashControlSkeleton): The skeleton object.
22631 */
22632FlashControl *
22633flash_control_skeleton_new (void)
22634{
22635 return FLASH_CONTROL (g_object_new (TYPE_FLASH_CONTROL_SKELETON, NULL));
22636}
22637
22638/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050022639 * Code for interface org.openbmc.Button
22640 * ------------------------------------------------------------------------
22641 */
22642
22643/**
22644 * SECTION:Button
22645 * @title: Button
22646 * @short_description: Generated C code for the org.openbmc.Button D-Bus interface
22647 *
22648 * 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.
22649 */
22650
22651/* ---- Introspection data for org.openbmc.Button ---- */
22652
22653static const _ExtendedGDBusArgInfo _button_method_info_is_on_OUT_ARG_state =
22654{
22655 {
22656 -1,
22657 (gchar *) "state",
22658 (gchar *) "b",
22659 NULL
22660 },
22661 FALSE
22662};
22663
22664static const _ExtendedGDBusArgInfo * const _button_method_info_is_on_OUT_ARG_pointers[] =
22665{
22666 &_button_method_info_is_on_OUT_ARG_state,
22667 NULL
22668};
22669
22670static const _ExtendedGDBusMethodInfo _button_method_info_is_on =
22671{
22672 {
22673 -1,
22674 (gchar *) "isOn",
22675 NULL,
22676 (GDBusArgInfo **) &_button_method_info_is_on_OUT_ARG_pointers,
22677 NULL
22678 },
22679 "handle-is-on",
22680 FALSE
22681};
22682
22683static const _ExtendedGDBusMethodInfo _button_method_info_sim_button_press =
22684{
22685 {
22686 -1,
22687 (gchar *) "simButtonPress",
22688 NULL,
22689 NULL,
22690 NULL
22691 },
22692 "handle-sim-button-press",
22693 FALSE
22694};
22695
22696static const _ExtendedGDBusMethodInfo _button_method_info_sim_button_long_press =
22697{
22698 {
22699 -1,
22700 (gchar *) "simButtonLongPress",
22701 NULL,
22702 NULL,
22703 NULL
22704 },
22705 "handle-sim-button-long-press",
22706 FALSE
22707};
22708
22709static const _ExtendedGDBusMethodInfo * const _button_method_info_pointers[] =
22710{
22711 &_button_method_info_is_on,
22712 &_button_method_info_sim_button_press,
22713 &_button_method_info_sim_button_long_press,
22714 NULL
22715};
22716
22717static const _ExtendedGDBusSignalInfo _button_signal_info_button_release =
22718{
22719 {
22720 -1,
22721 (gchar *) "ButtonRelease",
22722 NULL,
22723 NULL
22724 },
22725 "button-release"
22726};
22727
22728static const _ExtendedGDBusSignalInfo _button_signal_info_button_pressed =
22729{
22730 {
22731 -1,
22732 (gchar *) "ButtonPressed",
22733 NULL,
22734 NULL
22735 },
22736 "button-pressed"
22737};
22738
22739static const _ExtendedGDBusSignalInfo _button_signal_info_button_pressed_long =
22740{
22741 {
22742 -1,
22743 (gchar *) "ButtonPressedLong",
22744 NULL,
22745 NULL
22746 },
22747 "button-pressed-long"
22748};
22749
22750static const _ExtendedGDBusSignalInfo * const _button_signal_info_pointers[] =
22751{
22752 &_button_signal_info_button_release,
22753 &_button_signal_info_button_pressed,
22754 &_button_signal_info_button_pressed_long,
22755 NULL
22756};
22757
22758static const _ExtendedGDBusPropertyInfo _button_property_info_state =
22759{
22760 {
22761 -1,
22762 (gchar *) "state",
22763 (gchar *) "b",
22764 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
22765 NULL
22766 },
22767 "state",
22768 FALSE
22769};
22770
22771static const _ExtendedGDBusPropertyInfo * const _button_property_info_pointers[] =
22772{
22773 &_button_property_info_state,
22774 NULL
22775};
22776
22777static const _ExtendedGDBusInterfaceInfo _button_interface_info =
22778{
22779 {
22780 -1,
22781 (gchar *) "org.openbmc.Button",
22782 (GDBusMethodInfo **) &_button_method_info_pointers,
22783 (GDBusSignalInfo **) &_button_signal_info_pointers,
22784 (GDBusPropertyInfo **) &_button_property_info_pointers,
22785 NULL
22786 },
22787 "button",
22788};
22789
22790
22791/**
22792 * button_interface_info:
22793 *
22794 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> D-Bus interface.
22795 *
22796 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
22797 */
22798GDBusInterfaceInfo *
22799button_interface_info (void)
22800{
22801 return (GDBusInterfaceInfo *) &_button_interface_info.parent_struct;
22802}
22803
22804/**
22805 * button_override_properties:
22806 * @klass: The class structure for a #GObject<!-- -->-derived class.
22807 * @property_id_begin: The property id to assign to the first overridden property.
22808 *
22809 * Overrides all #GObject properties in the #Button interface for a concrete class.
22810 * The properties are overridden in the order they are defined.
22811 *
22812 * Returns: The last property id.
22813 */
22814guint
22815button_override_properties (GObjectClass *klass, guint property_id_begin)
22816{
22817 g_object_class_override_property (klass, property_id_begin++, "state");
22818 return property_id_begin - 1;
22819}
22820
22821
22822
22823/**
22824 * Button:
22825 *
22826 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
22827 */
22828
22829/**
22830 * ButtonIface:
22831 * @parent_iface: The parent interface.
22832 * @handle_is_on: Handler for the #Button::handle-is-on signal.
22833 * @handle_sim_button_long_press: Handler for the #Button::handle-sim-button-long-press signal.
22834 * @handle_sim_button_press: Handler for the #Button::handle-sim-button-press signal.
22835 * @get_state: Getter for the #Button:state property.
22836 * @button_pressed: Handler for the #Button::button-pressed signal.
22837 * @button_pressed_long: Handler for the #Button::button-pressed-long signal.
22838 * @button_release: Handler for the #Button::button-release signal.
22839 *
22840 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
22841 */
22842
22843typedef ButtonIface ButtonInterface;
22844G_DEFINE_INTERFACE (Button, button, G_TYPE_OBJECT);
22845
22846static void
22847button_default_init (ButtonIface *iface)
22848{
22849 /* GObject signals for incoming D-Bus method calls: */
22850 /**
22851 * Button::handle-is-on:
22852 * @object: A #Button.
22853 * @invocation: A #GDBusMethodInvocation.
22854 *
22855 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method.
22856 *
22857 * 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.
22858 *
22859 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
22860 */
22861 g_signal_new ("handle-is-on",
22862 G_TYPE_FROM_INTERFACE (iface),
22863 G_SIGNAL_RUN_LAST,
22864 G_STRUCT_OFFSET (ButtonIface, handle_is_on),
22865 g_signal_accumulator_true_handled,
22866 NULL,
22867 g_cclosure_marshal_generic,
22868 G_TYPE_BOOLEAN,
22869 1,
22870 G_TYPE_DBUS_METHOD_INVOCATION);
22871
22872 /**
22873 * Button::handle-sim-button-press:
22874 * @object: A #Button.
22875 * @invocation: A #GDBusMethodInvocation.
22876 *
22877 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method.
22878 *
22879 * 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.
22880 *
22881 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
22882 */
22883 g_signal_new ("handle-sim-button-press",
22884 G_TYPE_FROM_INTERFACE (iface),
22885 G_SIGNAL_RUN_LAST,
22886 G_STRUCT_OFFSET (ButtonIface, handle_sim_button_press),
22887 g_signal_accumulator_true_handled,
22888 NULL,
22889 g_cclosure_marshal_generic,
22890 G_TYPE_BOOLEAN,
22891 1,
22892 G_TYPE_DBUS_METHOD_INVOCATION);
22893
22894 /**
22895 * Button::handle-sim-button-long-press:
22896 * @object: A #Button.
22897 * @invocation: A #GDBusMethodInvocation.
22898 *
22899 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method.
22900 *
22901 * 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.
22902 *
22903 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
22904 */
22905 g_signal_new ("handle-sim-button-long-press",
22906 G_TYPE_FROM_INTERFACE (iface),
22907 G_SIGNAL_RUN_LAST,
22908 G_STRUCT_OFFSET (ButtonIface, handle_sim_button_long_press),
22909 g_signal_accumulator_true_handled,
22910 NULL,
22911 g_cclosure_marshal_generic,
22912 G_TYPE_BOOLEAN,
22913 1,
22914 G_TYPE_DBUS_METHOD_INVOCATION);
22915
22916 /* GObject signals for received D-Bus signals: */
22917 /**
22918 * Button::button-release:
22919 * @object: A #Button.
22920 *
22921 * 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.
22922 *
22923 * 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.
22924 */
22925 g_signal_new ("button-release",
22926 G_TYPE_FROM_INTERFACE (iface),
22927 G_SIGNAL_RUN_LAST,
22928 G_STRUCT_OFFSET (ButtonIface, button_release),
22929 NULL,
22930 NULL,
22931 g_cclosure_marshal_generic,
22932 G_TYPE_NONE,
22933 0);
22934
22935 /**
22936 * Button::button-pressed:
22937 * @object: A #Button.
22938 *
22939 * 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.
22940 *
22941 * 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.
22942 */
22943 g_signal_new ("button-pressed",
22944 G_TYPE_FROM_INTERFACE (iface),
22945 G_SIGNAL_RUN_LAST,
22946 G_STRUCT_OFFSET (ButtonIface, button_pressed),
22947 NULL,
22948 NULL,
22949 g_cclosure_marshal_generic,
22950 G_TYPE_NONE,
22951 0);
22952
22953 /**
22954 * Button::button-pressed-long:
22955 * @object: A #Button.
22956 *
22957 * 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.
22958 *
22959 * 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.
22960 */
22961 g_signal_new ("button-pressed-long",
22962 G_TYPE_FROM_INTERFACE (iface),
22963 G_SIGNAL_RUN_LAST,
22964 G_STRUCT_OFFSET (ButtonIface, button_pressed_long),
22965 NULL,
22966 NULL,
22967 g_cclosure_marshal_generic,
22968 G_TYPE_NONE,
22969 0);
22970
22971 /* GObject properties for D-Bus properties: */
22972 /**
22973 * Button:state:
22974 *
22975 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link>.
22976 *
22977 * 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.
22978 */
22979 g_object_interface_install_property (iface,
22980 g_param_spec_boolean ("state", "state", "state", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
22981}
22982
22983/**
22984 * button_get_state: (skip)
22985 * @object: A #Button.
22986 *
22987 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property.
22988 *
22989 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22990 *
22991 * Returns: The property value.
22992 */
22993gboolean
22994button_get_state (Button *object)
22995{
22996 return BUTTON_GET_IFACE (object)->get_state (object);
22997}
22998
22999/**
23000 * button_set_state: (skip)
23001 * @object: A #Button.
23002 * @value: The value to set.
23003 *
23004 * Sets the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property to @value.
23005 *
23006 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
23007 */
23008void
23009button_set_state (Button *object, gboolean value)
23010{
23011 g_object_set (G_OBJECT (object), "state", value, NULL);
23012}
23013
23014/**
23015 * button_emit_button_release:
23016 * @object: A #Button.
23017 *
23018 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonRelease">"ButtonRelease"</link> D-Bus signal.
23019 */
23020void
23021button_emit_button_release (
23022 Button *object)
23023{
23024 g_signal_emit_by_name (object, "button-release");
23025}
23026
23027/**
23028 * button_emit_button_pressed:
23029 * @object: A #Button.
23030 *
23031 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressed">"ButtonPressed"</link> D-Bus signal.
23032 */
23033void
23034button_emit_button_pressed (
23035 Button *object)
23036{
23037 g_signal_emit_by_name (object, "button-pressed");
23038}
23039
23040/**
23041 * button_emit_button_pressed_long:
23042 * @object: A #Button.
23043 *
23044 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressedLong">"ButtonPressedLong"</link> D-Bus signal.
23045 */
23046void
23047button_emit_button_pressed_long (
23048 Button *object)
23049{
23050 g_signal_emit_by_name (object, "button-pressed-long");
23051}
23052
23053/**
23054 * button_call_is_on:
23055 * @proxy: A #ButtonProxy.
23056 * @cancellable: (allow-none): A #GCancellable or %NULL.
23057 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
23058 * @user_data: User data to pass to @callback.
23059 *
23060 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method on @proxy.
23061 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
23062 * You can then call button_call_is_on_finish() to get the result of the operation.
23063 *
23064 * See button_call_is_on_sync() for the synchronous, blocking version of this method.
23065 */
23066void
23067button_call_is_on (
23068 Button *proxy,
23069 GCancellable *cancellable,
23070 GAsyncReadyCallback callback,
23071 gpointer user_data)
23072{
23073 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
23074 "isOn",
23075 g_variant_new ("()"),
23076 G_DBUS_CALL_FLAGS_NONE,
23077 -1,
23078 cancellable,
23079 callback,
23080 user_data);
23081}
23082
23083/**
23084 * button_call_is_on_finish:
23085 * @proxy: A #ButtonProxy.
23086 * @out_state: (out): Return location for return parameter or %NULL to ignore.
23087 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_is_on().
23088 * @error: Return location for error or %NULL.
23089 *
23090 * Finishes an operation started with button_call_is_on().
23091 *
23092 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23093 */
23094gboolean
23095button_call_is_on_finish (
23096 Button *proxy,
23097 gboolean *out_state,
23098 GAsyncResult *res,
23099 GError **error)
23100{
23101 GVariant *_ret;
23102 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
23103 if (_ret == NULL)
23104 goto _out;
23105 g_variant_get (_ret,
23106 "(b)",
23107 out_state);
23108 g_variant_unref (_ret);
23109_out:
23110 return _ret != NULL;
23111}
23112
23113/**
23114 * button_call_is_on_sync:
23115 * @proxy: A #ButtonProxy.
23116 * @out_state: (out): Return location for return parameter or %NULL to ignore.
23117 * @cancellable: (allow-none): A #GCancellable or %NULL.
23118 * @error: Return location for error or %NULL.
23119 *
23120 * 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.
23121 *
23122 * See button_call_is_on() for the asynchronous version of this method.
23123 *
23124 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23125 */
23126gboolean
23127button_call_is_on_sync (
23128 Button *proxy,
23129 gboolean *out_state,
23130 GCancellable *cancellable,
23131 GError **error)
23132{
23133 GVariant *_ret;
23134 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
23135 "isOn",
23136 g_variant_new ("()"),
23137 G_DBUS_CALL_FLAGS_NONE,
23138 -1,
23139 cancellable,
23140 error);
23141 if (_ret == NULL)
23142 goto _out;
23143 g_variant_get (_ret,
23144 "(b)",
23145 out_state);
23146 g_variant_unref (_ret);
23147_out:
23148 return _ret != NULL;
23149}
23150
23151/**
23152 * button_call_sim_button_press:
23153 * @proxy: A #ButtonProxy.
23154 * @cancellable: (allow-none): A #GCancellable or %NULL.
23155 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
23156 * @user_data: User data to pass to @callback.
23157 *
23158 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method on @proxy.
23159 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
23160 * You can then call button_call_sim_button_press_finish() to get the result of the operation.
23161 *
23162 * See button_call_sim_button_press_sync() for the synchronous, blocking version of this method.
23163 */
23164void
23165button_call_sim_button_press (
23166 Button *proxy,
23167 GCancellable *cancellable,
23168 GAsyncReadyCallback callback,
23169 gpointer user_data)
23170{
23171 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
23172 "simButtonPress",
23173 g_variant_new ("()"),
23174 G_DBUS_CALL_FLAGS_NONE,
23175 -1,
23176 cancellable,
23177 callback,
23178 user_data);
23179}
23180
23181/**
23182 * button_call_sim_button_press_finish:
23183 * @proxy: A #ButtonProxy.
23184 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_button_press().
23185 * @error: Return location for error or %NULL.
23186 *
23187 * Finishes an operation started with button_call_sim_button_press().
23188 *
23189 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23190 */
23191gboolean
23192button_call_sim_button_press_finish (
23193 Button *proxy,
23194 GAsyncResult *res,
23195 GError **error)
23196{
23197 GVariant *_ret;
23198 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
23199 if (_ret == NULL)
23200 goto _out;
23201 g_variant_get (_ret,
23202 "()");
23203 g_variant_unref (_ret);
23204_out:
23205 return _ret != NULL;
23206}
23207
23208/**
23209 * button_call_sim_button_press_sync:
23210 * @proxy: A #ButtonProxy.
23211 * @cancellable: (allow-none): A #GCancellable or %NULL.
23212 * @error: Return location for error or %NULL.
23213 *
23214 * 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.
23215 *
23216 * See button_call_sim_button_press() for the asynchronous version of this method.
23217 *
23218 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23219 */
23220gboolean
23221button_call_sim_button_press_sync (
23222 Button *proxy,
23223 GCancellable *cancellable,
23224 GError **error)
23225{
23226 GVariant *_ret;
23227 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
23228 "simButtonPress",
23229 g_variant_new ("()"),
23230 G_DBUS_CALL_FLAGS_NONE,
23231 -1,
23232 cancellable,
23233 error);
23234 if (_ret == NULL)
23235 goto _out;
23236 g_variant_get (_ret,
23237 "()");
23238 g_variant_unref (_ret);
23239_out:
23240 return _ret != NULL;
23241}
23242
23243/**
23244 * button_call_sim_button_long_press:
23245 * @proxy: A #ButtonProxy.
23246 * @cancellable: (allow-none): A #GCancellable or %NULL.
23247 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
23248 * @user_data: User data to pass to @callback.
23249 *
23250 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method on @proxy.
23251 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
23252 * You can then call button_call_sim_button_long_press_finish() to get the result of the operation.
23253 *
23254 * See button_call_sim_button_long_press_sync() for the synchronous, blocking version of this method.
23255 */
23256void
23257button_call_sim_button_long_press (
23258 Button *proxy,
23259 GCancellable *cancellable,
23260 GAsyncReadyCallback callback,
23261 gpointer user_data)
23262{
23263 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
23264 "simButtonLongPress",
23265 g_variant_new ("()"),
23266 G_DBUS_CALL_FLAGS_NONE,
23267 -1,
23268 cancellable,
23269 callback,
23270 user_data);
23271}
23272
23273/**
23274 * button_call_sim_button_long_press_finish:
23275 * @proxy: A #ButtonProxy.
23276 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_button_long_press().
23277 * @error: Return location for error or %NULL.
23278 *
23279 * Finishes an operation started with button_call_sim_button_long_press().
23280 *
23281 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23282 */
23283gboolean
23284button_call_sim_button_long_press_finish (
23285 Button *proxy,
23286 GAsyncResult *res,
23287 GError **error)
23288{
23289 GVariant *_ret;
23290 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
23291 if (_ret == NULL)
23292 goto _out;
23293 g_variant_get (_ret,
23294 "()");
23295 g_variant_unref (_ret);
23296_out:
23297 return _ret != NULL;
23298}
23299
23300/**
23301 * button_call_sim_button_long_press_sync:
23302 * @proxy: A #ButtonProxy.
23303 * @cancellable: (allow-none): A #GCancellable or %NULL.
23304 * @error: Return location for error or %NULL.
23305 *
23306 * 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.
23307 *
23308 * See button_call_sim_button_long_press() for the asynchronous version of this method.
23309 *
23310 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23311 */
23312gboolean
23313button_call_sim_button_long_press_sync (
23314 Button *proxy,
23315 GCancellable *cancellable,
23316 GError **error)
23317{
23318 GVariant *_ret;
23319 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
23320 "simButtonLongPress",
23321 g_variant_new ("()"),
23322 G_DBUS_CALL_FLAGS_NONE,
23323 -1,
23324 cancellable,
23325 error);
23326 if (_ret == NULL)
23327 goto _out;
23328 g_variant_get (_ret,
23329 "()");
23330 g_variant_unref (_ret);
23331_out:
23332 return _ret != NULL;
23333}
23334
23335/**
23336 * button_complete_is_on:
23337 * @object: A #Button.
23338 * @invocation: (transfer full): A #GDBusMethodInvocation.
23339 * @state: Parameter to return.
23340 *
23341 * 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.
23342 *
23343 * This method will free @invocation, you cannot use it afterwards.
23344 */
23345void
23346button_complete_is_on (
23347 Button *object,
23348 GDBusMethodInvocation *invocation,
23349 gboolean state)
23350{
23351 g_dbus_method_invocation_return_value (invocation,
23352 g_variant_new ("(b)",
23353 state));
23354}
23355
23356/**
23357 * button_complete_sim_button_press:
23358 * @object: A #Button.
23359 * @invocation: (transfer full): A #GDBusMethodInvocation.
23360 *
23361 * 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.
23362 *
23363 * This method will free @invocation, you cannot use it afterwards.
23364 */
23365void
23366button_complete_sim_button_press (
23367 Button *object,
23368 GDBusMethodInvocation *invocation)
23369{
23370 g_dbus_method_invocation_return_value (invocation,
23371 g_variant_new ("()"));
23372}
23373
23374/**
23375 * button_complete_sim_button_long_press:
23376 * @object: A #Button.
23377 * @invocation: (transfer full): A #GDBusMethodInvocation.
23378 *
23379 * 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.
23380 *
23381 * This method will free @invocation, you cannot use it afterwards.
23382 */
23383void
23384button_complete_sim_button_long_press (
23385 Button *object,
23386 GDBusMethodInvocation *invocation)
23387{
23388 g_dbus_method_invocation_return_value (invocation,
23389 g_variant_new ("()"));
23390}
23391
23392/* ------------------------------------------------------------------------ */
23393
23394/**
23395 * ButtonProxy:
23396 *
23397 * The #ButtonProxy structure contains only private data and should only be accessed using the provided API.
23398 */
23399
23400/**
23401 * ButtonProxyClass:
23402 * @parent_class: The parent class.
23403 *
23404 * Class structure for #ButtonProxy.
23405 */
23406
23407struct _ButtonProxyPrivate
23408{
23409 GData *qdata;
23410};
23411
23412static void button_proxy_iface_init (ButtonIface *iface);
23413
23414#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23415G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
23416 G_ADD_PRIVATE (ButtonProxy)
23417 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
23418
23419#else
23420G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
23421 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
23422
23423#endif
23424static void
23425button_proxy_finalize (GObject *object)
23426{
23427 ButtonProxy *proxy = BUTTON_PROXY (object);
23428 g_datalist_clear (&proxy->priv->qdata);
23429 G_OBJECT_CLASS (button_proxy_parent_class)->finalize (object);
23430}
23431
23432static void
23433button_proxy_get_property (GObject *object,
23434 guint prop_id,
23435 GValue *value,
23436 GParamSpec *pspec G_GNUC_UNUSED)
23437{
23438 const _ExtendedGDBusPropertyInfo *info;
23439 GVariant *variant;
23440 g_assert (prop_id != 0 && prop_id - 1 < 1);
23441 info = _button_property_info_pointers[prop_id - 1];
23442 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
23443 if (info->use_gvariant)
23444 {
23445 g_value_set_variant (value, variant);
23446 }
23447 else
23448 {
23449 if (variant != NULL)
23450 g_dbus_gvariant_to_gvalue (variant, value);
23451 }
23452 if (variant != NULL)
23453 g_variant_unref (variant);
23454}
23455
23456static void
23457button_proxy_set_property_cb (GDBusProxy *proxy,
23458 GAsyncResult *res,
23459 gpointer user_data)
23460{
23461 const _ExtendedGDBusPropertyInfo *info = user_data;
23462 GError *error;
23463 GVariant *_ret;
23464 error = NULL;
23465 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
23466 if (!_ret)
23467 {
23468 g_warning ("Error setting property '%s' on interface org.openbmc.Button: %s (%s, %d)",
23469 info->parent_struct.name,
23470 error->message, g_quark_to_string (error->domain), error->code);
23471 g_error_free (error);
23472 }
23473 else
23474 {
23475 g_variant_unref (_ret);
23476 }
23477}
23478
23479static void
23480button_proxy_set_property (GObject *object,
23481 guint prop_id,
23482 const GValue *value,
23483 GParamSpec *pspec G_GNUC_UNUSED)
23484{
23485 const _ExtendedGDBusPropertyInfo *info;
23486 GVariant *variant;
23487 g_assert (prop_id != 0 && prop_id - 1 < 1);
23488 info = _button_property_info_pointers[prop_id - 1];
23489 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
23490 g_dbus_proxy_call (G_DBUS_PROXY (object),
23491 "org.freedesktop.DBus.Properties.Set",
23492 g_variant_new ("(ssv)", "org.openbmc.Button", info->parent_struct.name, variant),
23493 G_DBUS_CALL_FLAGS_NONE,
23494 -1,
23495 NULL, (GAsyncReadyCallback) button_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
23496 g_variant_unref (variant);
23497}
23498
23499static void
23500button_proxy_g_signal (GDBusProxy *proxy,
23501 const gchar *sender_name G_GNUC_UNUSED,
23502 const gchar *signal_name,
23503 GVariant *parameters)
23504{
23505 _ExtendedGDBusSignalInfo *info;
23506 GVariantIter iter;
23507 GVariant *child;
23508 GValue *paramv;
23509 guint num_params;
23510 guint n;
23511 guint signal_id;
23512 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, signal_name);
23513 if (info == NULL)
23514 return;
23515 num_params = g_variant_n_children (parameters);
23516 paramv = g_new0 (GValue, num_params + 1);
23517 g_value_init (&paramv[0], TYPE_BUTTON);
23518 g_value_set_object (&paramv[0], proxy);
23519 g_variant_iter_init (&iter, parameters);
23520 n = 1;
23521 while ((child = g_variant_iter_next_value (&iter)) != NULL)
23522 {
23523 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
23524 if (arg_info->use_gvariant)
23525 {
23526 g_value_init (&paramv[n], G_TYPE_VARIANT);
23527 g_value_set_variant (&paramv[n], child);
23528 n++;
23529 }
23530 else
23531 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
23532 g_variant_unref (child);
23533 }
23534 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
23535 g_signal_emitv (paramv, signal_id, 0, NULL);
23536 for (n = 0; n < num_params + 1; n++)
23537 g_value_unset (&paramv[n]);
23538 g_free (paramv);
23539}
23540
23541static void
23542button_proxy_g_properties_changed (GDBusProxy *_proxy,
23543 GVariant *changed_properties,
23544 const gchar *const *invalidated_properties)
23545{
23546 ButtonProxy *proxy = BUTTON_PROXY (_proxy);
23547 guint n;
23548 const gchar *key;
23549 GVariantIter *iter;
23550 _ExtendedGDBusPropertyInfo *info;
23551 g_variant_get (changed_properties, "a{sv}", &iter);
23552 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
23553 {
23554 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, key);
23555 g_datalist_remove_data (&proxy->priv->qdata, key);
23556 if (info != NULL)
23557 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
23558 }
23559 g_variant_iter_free (iter);
23560 for (n = 0; invalidated_properties[n] != NULL; n++)
23561 {
23562 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, invalidated_properties[n]);
23563 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
23564 if (info != NULL)
23565 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
23566 }
23567}
23568
23569static gboolean
23570button_proxy_get_state (Button *object)
23571{
23572 ButtonProxy *proxy = BUTTON_PROXY (object);
23573 GVariant *variant;
23574 gboolean value = 0;
23575 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
23576 if (variant != NULL)
23577 {
23578 value = g_variant_get_boolean (variant);
23579 g_variant_unref (variant);
23580 }
23581 return value;
23582}
23583
23584static void
23585button_proxy_init (ButtonProxy *proxy)
23586{
23587#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23588 proxy->priv = button_proxy_get_instance_private (proxy);
23589#else
23590 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_BUTTON_PROXY, ButtonProxyPrivate);
23591#endif
23592
23593 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), button_interface_info ());
23594}
23595
23596static void
23597button_proxy_class_init (ButtonProxyClass *klass)
23598{
23599 GObjectClass *gobject_class;
23600 GDBusProxyClass *proxy_class;
23601
23602 gobject_class = G_OBJECT_CLASS (klass);
23603 gobject_class->finalize = button_proxy_finalize;
23604 gobject_class->get_property = button_proxy_get_property;
23605 gobject_class->set_property = button_proxy_set_property;
23606
23607 proxy_class = G_DBUS_PROXY_CLASS (klass);
23608 proxy_class->g_signal = button_proxy_g_signal;
23609 proxy_class->g_properties_changed = button_proxy_g_properties_changed;
23610
23611 button_override_properties (gobject_class, 1);
23612
23613#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
23614 g_type_class_add_private (klass, sizeof (ButtonProxyPrivate));
23615#endif
23616}
23617
23618static void
23619button_proxy_iface_init (ButtonIface *iface)
23620{
23621 iface->get_state = button_proxy_get_state;
23622}
23623
23624/**
23625 * button_proxy_new:
23626 * @connection: A #GDBusConnection.
23627 * @flags: Flags from the #GDBusProxyFlags enumeration.
23628 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
23629 * @object_path: An object path.
23630 * @cancellable: (allow-none): A #GCancellable or %NULL.
23631 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
23632 * @user_data: User data to pass to @callback.
23633 *
23634 * 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.
23635 *
23636 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
23637 * You can then call button_proxy_new_finish() to get the result of the operation.
23638 *
23639 * See button_proxy_new_sync() for the synchronous, blocking version of this constructor.
23640 */
23641void
23642button_proxy_new (
23643 GDBusConnection *connection,
23644 GDBusProxyFlags flags,
23645 const gchar *name,
23646 const gchar *object_path,
23647 GCancellable *cancellable,
23648 GAsyncReadyCallback callback,
23649 gpointer user_data)
23650{
23651 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);
23652}
23653
23654/**
23655 * button_proxy_new_finish:
23656 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new().
23657 * @error: Return location for error or %NULL
23658 *
23659 * Finishes an operation started with button_proxy_new().
23660 *
23661 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
23662 */
23663Button *
23664button_proxy_new_finish (
23665 GAsyncResult *res,
23666 GError **error)
23667{
23668 GObject *ret;
23669 GObject *source_object;
23670 source_object = g_async_result_get_source_object (res);
23671 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
23672 g_object_unref (source_object);
23673 if (ret != NULL)
23674 return BUTTON (ret);
23675 else
23676 return NULL;
23677}
23678
23679/**
23680 * button_proxy_new_sync:
23681 * @connection: A #GDBusConnection.
23682 * @flags: Flags from the #GDBusProxyFlags enumeration.
23683 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
23684 * @object_path: An object path.
23685 * @cancellable: (allow-none): A #GCancellable or %NULL.
23686 * @error: Return location for error or %NULL
23687 *
23688 * 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.
23689 *
23690 * The calling thread is blocked until a reply is received.
23691 *
23692 * See button_proxy_new() for the asynchronous version of this constructor.
23693 *
23694 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
23695 */
23696Button *
23697button_proxy_new_sync (
23698 GDBusConnection *connection,
23699 GDBusProxyFlags flags,
23700 const gchar *name,
23701 const gchar *object_path,
23702 GCancellable *cancellable,
23703 GError **error)
23704{
23705 GInitable *ret;
23706 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);
23707 if (ret != NULL)
23708 return BUTTON (ret);
23709 else
23710 return NULL;
23711}
23712
23713
23714/**
23715 * button_proxy_new_for_bus:
23716 * @bus_type: A #GBusType.
23717 * @flags: Flags from the #GDBusProxyFlags enumeration.
23718 * @name: A bus name (well-known or unique).
23719 * @object_path: An object path.
23720 * @cancellable: (allow-none): A #GCancellable or %NULL.
23721 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
23722 * @user_data: User data to pass to @callback.
23723 *
23724 * Like button_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
23725 *
23726 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
23727 * You can then call button_proxy_new_for_bus_finish() to get the result of the operation.
23728 *
23729 * See button_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
23730 */
23731void
23732button_proxy_new_for_bus (
23733 GBusType bus_type,
23734 GDBusProxyFlags flags,
23735 const gchar *name,
23736 const gchar *object_path,
23737 GCancellable *cancellable,
23738 GAsyncReadyCallback callback,
23739 gpointer user_data)
23740{
23741 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);
23742}
23743
23744/**
23745 * button_proxy_new_for_bus_finish:
23746 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new_for_bus().
23747 * @error: Return location for error or %NULL
23748 *
23749 * Finishes an operation started with button_proxy_new_for_bus().
23750 *
23751 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
23752 */
23753Button *
23754button_proxy_new_for_bus_finish (
23755 GAsyncResult *res,
23756 GError **error)
23757{
23758 GObject *ret;
23759 GObject *source_object;
23760 source_object = g_async_result_get_source_object (res);
23761 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
23762 g_object_unref (source_object);
23763 if (ret != NULL)
23764 return BUTTON (ret);
23765 else
23766 return NULL;
23767}
23768
23769/**
23770 * button_proxy_new_for_bus_sync:
23771 * @bus_type: A #GBusType.
23772 * @flags: Flags from the #GDBusProxyFlags enumeration.
23773 * @name: A bus name (well-known or unique).
23774 * @object_path: An object path.
23775 * @cancellable: (allow-none): A #GCancellable or %NULL.
23776 * @error: Return location for error or %NULL
23777 *
23778 * Like button_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
23779 *
23780 * The calling thread is blocked until a reply is received.
23781 *
23782 * See button_proxy_new_for_bus() for the asynchronous version of this constructor.
23783 *
23784 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
23785 */
23786Button *
23787button_proxy_new_for_bus_sync (
23788 GBusType bus_type,
23789 GDBusProxyFlags flags,
23790 const gchar *name,
23791 const gchar *object_path,
23792 GCancellable *cancellable,
23793 GError **error)
23794{
23795 GInitable *ret;
23796 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);
23797 if (ret != NULL)
23798 return BUTTON (ret);
23799 else
23800 return NULL;
23801}
23802
23803
23804/* ------------------------------------------------------------------------ */
23805
23806/**
23807 * ButtonSkeleton:
23808 *
23809 * The #ButtonSkeleton structure contains only private data and should only be accessed using the provided API.
23810 */
23811
23812/**
23813 * ButtonSkeletonClass:
23814 * @parent_class: The parent class.
23815 *
23816 * Class structure for #ButtonSkeleton.
23817 */
23818
23819struct _ButtonSkeletonPrivate
23820{
23821 GValue *properties;
23822 GList *changed_properties;
23823 GSource *changed_properties_idle_source;
23824 GMainContext *context;
23825 GMutex lock;
23826};
23827
23828static void
23829_button_skeleton_handle_method_call (
23830 GDBusConnection *connection G_GNUC_UNUSED,
23831 const gchar *sender G_GNUC_UNUSED,
23832 const gchar *object_path G_GNUC_UNUSED,
23833 const gchar *interface_name,
23834 const gchar *method_name,
23835 GVariant *parameters,
23836 GDBusMethodInvocation *invocation,
23837 gpointer user_data)
23838{
23839 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
23840 _ExtendedGDBusMethodInfo *info;
23841 GVariantIter iter;
23842 GVariant *child;
23843 GValue *paramv;
23844 guint num_params;
23845 guint num_extra;
23846 guint n;
23847 guint signal_id;
23848 GValue return_value = G_VALUE_INIT;
23849 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
23850 g_assert (info != NULL);
23851 num_params = g_variant_n_children (parameters);
23852 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
23853 n = 0;
23854 g_value_init (&paramv[n], TYPE_BUTTON);
23855 g_value_set_object (&paramv[n++], skeleton);
23856 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
23857 g_value_set_object (&paramv[n++], invocation);
23858 if (info->pass_fdlist)
23859 {
23860#ifdef G_OS_UNIX
23861 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
23862 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
23863#else
23864 g_assert_not_reached ();
23865#endif
23866 }
23867 g_variant_iter_init (&iter, parameters);
23868 while ((child = g_variant_iter_next_value (&iter)) != NULL)
23869 {
23870 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
23871 if (arg_info->use_gvariant)
23872 {
23873 g_value_init (&paramv[n], G_TYPE_VARIANT);
23874 g_value_set_variant (&paramv[n], child);
23875 n++;
23876 }
23877 else
23878 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
23879 g_variant_unref (child);
23880 }
23881 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
23882 g_value_init (&return_value, G_TYPE_BOOLEAN);
23883 g_signal_emitv (paramv, signal_id, 0, &return_value);
23884 if (!g_value_get_boolean (&return_value))
23885 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);
23886 g_value_unset (&return_value);
23887 for (n = 0; n < num_params + num_extra; n++)
23888 g_value_unset (&paramv[n]);
23889 g_free (paramv);
23890}
23891
23892static GVariant *
23893_button_skeleton_handle_get_property (
23894 GDBusConnection *connection G_GNUC_UNUSED,
23895 const gchar *sender G_GNUC_UNUSED,
23896 const gchar *object_path G_GNUC_UNUSED,
23897 const gchar *interface_name G_GNUC_UNUSED,
23898 const gchar *property_name,
23899 GError **error,
23900 gpointer user_data)
23901{
23902 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
23903 GValue value = G_VALUE_INIT;
23904 GParamSpec *pspec;
23905 _ExtendedGDBusPropertyInfo *info;
23906 GVariant *ret;
23907 ret = NULL;
23908 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
23909 g_assert (info != NULL);
23910 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
23911 if (pspec == NULL)
23912 {
23913 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
23914 }
23915 else
23916 {
23917 g_value_init (&value, pspec->value_type);
23918 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
23919 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
23920 g_value_unset (&value);
23921 }
23922 return ret;
23923}
23924
23925static gboolean
23926_button_skeleton_handle_set_property (
23927 GDBusConnection *connection G_GNUC_UNUSED,
23928 const gchar *sender G_GNUC_UNUSED,
23929 const gchar *object_path G_GNUC_UNUSED,
23930 const gchar *interface_name G_GNUC_UNUSED,
23931 const gchar *property_name,
23932 GVariant *variant,
23933 GError **error,
23934 gpointer user_data)
23935{
23936 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
23937 GValue value = G_VALUE_INIT;
23938 GParamSpec *pspec;
23939 _ExtendedGDBusPropertyInfo *info;
23940 gboolean ret;
23941 ret = FALSE;
23942 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
23943 g_assert (info != NULL);
23944 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
23945 if (pspec == NULL)
23946 {
23947 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
23948 }
23949 else
23950 {
23951 if (info->use_gvariant)
23952 g_value_set_variant (&value, variant);
23953 else
23954 g_dbus_gvariant_to_gvalue (variant, &value);
23955 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
23956 g_value_unset (&value);
23957 ret = TRUE;
23958 }
23959 return ret;
23960}
23961
23962static const GDBusInterfaceVTable _button_skeleton_vtable =
23963{
23964 _button_skeleton_handle_method_call,
23965 _button_skeleton_handle_get_property,
23966 _button_skeleton_handle_set_property,
23967 {NULL}
23968};
23969
23970static GDBusInterfaceInfo *
23971button_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
23972{
23973 return button_interface_info ();
23974}
23975
23976static GDBusInterfaceVTable *
23977button_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
23978{
23979 return (GDBusInterfaceVTable *) &_button_skeleton_vtable;
23980}
23981
23982static GVariant *
23983button_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
23984{
23985 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
23986
23987 GVariantBuilder builder;
23988 guint n;
23989 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
23990 if (_button_interface_info.parent_struct.properties == NULL)
23991 goto out;
23992 for (n = 0; _button_interface_info.parent_struct.properties[n] != NULL; n++)
23993 {
23994 GDBusPropertyInfo *info = _button_interface_info.parent_struct.properties[n];
23995 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
23996 {
23997 GVariant *value;
23998 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);
23999 if (value != NULL)
24000 {
24001 g_variant_take_ref (value);
24002 g_variant_builder_add (&builder, "{sv}", info->name, value);
24003 g_variant_unref (value);
24004 }
24005 }
24006 }
24007out:
24008 return g_variant_builder_end (&builder);
24009}
24010
24011static gboolean _button_emit_changed (gpointer user_data);
24012
24013static void
24014button_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
24015{
24016 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
24017 gboolean emit_changed = FALSE;
24018
24019 g_mutex_lock (&skeleton->priv->lock);
24020 if (skeleton->priv->changed_properties_idle_source != NULL)
24021 {
24022 g_source_destroy (skeleton->priv->changed_properties_idle_source);
24023 skeleton->priv->changed_properties_idle_source = NULL;
24024 emit_changed = TRUE;
24025 }
24026 g_mutex_unlock (&skeleton->priv->lock);
24027
24028 if (emit_changed)
24029 _button_emit_changed (skeleton);
24030}
24031
24032static void
24033_button_on_signal_button_release (
24034 Button *object)
24035{
24036 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
24037
24038 GList *connections, *l;
24039 GVariant *signal_variant;
24040 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
24041
24042 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
24043 for (l = connections; l != NULL; l = l->next)
24044 {
24045 GDBusConnection *connection = l->data;
24046 g_dbus_connection_emit_signal (connection,
24047 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonRelease",
24048 signal_variant, NULL);
24049 }
24050 g_variant_unref (signal_variant);
24051 g_list_free_full (connections, g_object_unref);
24052}
24053
24054static void
24055_button_on_signal_button_pressed (
24056 Button *object)
24057{
24058 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
24059
24060 GList *connections, *l;
24061 GVariant *signal_variant;
24062 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
24063
24064 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
24065 for (l = connections; l != NULL; l = l->next)
24066 {
24067 GDBusConnection *connection = l->data;
24068 g_dbus_connection_emit_signal (connection,
24069 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonPressed",
24070 signal_variant, NULL);
24071 }
24072 g_variant_unref (signal_variant);
24073 g_list_free_full (connections, g_object_unref);
24074}
24075
24076static void
24077_button_on_signal_button_pressed_long (
24078 Button *object)
24079{
24080 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
24081
24082 GList *connections, *l;
24083 GVariant *signal_variant;
24084 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
24085
24086 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
24087 for (l = connections; l != NULL; l = l->next)
24088 {
24089 GDBusConnection *connection = l->data;
24090 g_dbus_connection_emit_signal (connection,
24091 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonPressedLong",
24092 signal_variant, NULL);
24093 }
24094 g_variant_unref (signal_variant);
24095 g_list_free_full (connections, g_object_unref);
24096}
24097
24098static void button_skeleton_iface_init (ButtonIface *iface);
24099#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
24100G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
24101 G_ADD_PRIVATE (ButtonSkeleton)
24102 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
24103
24104#else
24105G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
24106 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
24107
24108#endif
24109static void
24110button_skeleton_finalize (GObject *object)
24111{
24112 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
24113 guint n;
24114 for (n = 0; n < 1; n++)
24115 g_value_unset (&skeleton->priv->properties[n]);
24116 g_free (skeleton->priv->properties);
24117 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
24118 if (skeleton->priv->changed_properties_idle_source != NULL)
24119 g_source_destroy (skeleton->priv->changed_properties_idle_source);
24120 g_main_context_unref (skeleton->priv->context);
24121 g_mutex_clear (&skeleton->priv->lock);
24122 G_OBJECT_CLASS (button_skeleton_parent_class)->finalize (object);
24123}
24124
24125static void
24126button_skeleton_get_property (GObject *object,
24127 guint prop_id,
24128 GValue *value,
24129 GParamSpec *pspec G_GNUC_UNUSED)
24130{
24131 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
24132 g_assert (prop_id != 0 && prop_id - 1 < 1);
24133 g_mutex_lock (&skeleton->priv->lock);
24134 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
24135 g_mutex_unlock (&skeleton->priv->lock);
24136}
24137
24138static gboolean
24139_button_emit_changed (gpointer user_data)
24140{
24141 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
24142 GList *l;
24143 GVariantBuilder builder;
24144 GVariantBuilder invalidated_builder;
24145 guint num_changes;
24146
24147 g_mutex_lock (&skeleton->priv->lock);
24148 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
24149 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
24150 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
24151 {
24152 ChangedProperty *cp = l->data;
24153 GVariant *variant;
24154 const GValue *cur_value;
24155
24156 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
24157 if (!_g_value_equal (cur_value, &cp->orig_value))
24158 {
24159 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
24160 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
24161 g_variant_unref (variant);
24162 num_changes++;
24163 }
24164 }
24165 if (num_changes > 0)
24166 {
24167 GList *connections, *ll;
24168 GVariant *signal_variant;
24169 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Button",
24170 &builder, &invalidated_builder));
24171 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
24172 for (ll = connections; ll != NULL; ll = ll->next)
24173 {
24174 GDBusConnection *connection = ll->data;
24175
24176 g_dbus_connection_emit_signal (connection,
24177 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
24178 "org.freedesktop.DBus.Properties",
24179 "PropertiesChanged",
24180 signal_variant,
24181 NULL);
24182 }
24183 g_variant_unref (signal_variant);
24184 g_list_free_full (connections, g_object_unref);
24185 }
24186 else
24187 {
24188 g_variant_builder_clear (&builder);
24189 g_variant_builder_clear (&invalidated_builder);
24190 }
24191 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
24192 skeleton->priv->changed_properties = NULL;
24193 skeleton->priv->changed_properties_idle_source = NULL;
24194 g_mutex_unlock (&skeleton->priv->lock);
24195 return FALSE;
24196}
24197
24198static void
24199_button_schedule_emit_changed (ButtonSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
24200{
24201 ChangedProperty *cp;
24202 GList *l;
24203 cp = NULL;
24204 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
24205 {
24206 ChangedProperty *i_cp = l->data;
24207 if (i_cp->info == info)
24208 {
24209 cp = i_cp;
24210 break;
24211 }
24212 }
24213 if (cp == NULL)
24214 {
24215 cp = g_new0 (ChangedProperty, 1);
24216 cp->prop_id = prop_id;
24217 cp->info = info;
24218 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
24219 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
24220 g_value_copy (orig_value, &cp->orig_value);
24221 }
24222}
24223
24224static void
24225button_skeleton_notify (GObject *object,
24226 GParamSpec *pspec G_GNUC_UNUSED)
24227{
24228 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
24229 g_mutex_lock (&skeleton->priv->lock);
24230 if (skeleton->priv->changed_properties != NULL &&
24231 skeleton->priv->changed_properties_idle_source == NULL)
24232 {
24233 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
24234 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
24235 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _button_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
24236 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
24237 g_source_unref (skeleton->priv->changed_properties_idle_source);
24238 }
24239 g_mutex_unlock (&skeleton->priv->lock);
24240}
24241
24242static void
24243button_skeleton_set_property (GObject *object,
24244 guint prop_id,
24245 const GValue *value,
24246 GParamSpec *pspec)
24247{
24248 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
24249 g_assert (prop_id != 0 && prop_id - 1 < 1);
24250 g_mutex_lock (&skeleton->priv->lock);
24251 g_object_freeze_notify (object);
24252 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
24253 {
24254 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
24255 _button_schedule_emit_changed (skeleton, _button_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
24256 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
24257 g_object_notify_by_pspec (object, pspec);
24258 }
24259 g_mutex_unlock (&skeleton->priv->lock);
24260 g_object_thaw_notify (object);
24261}
24262
24263static void
24264button_skeleton_init (ButtonSkeleton *skeleton)
24265{
24266#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
24267 skeleton->priv = button_skeleton_get_instance_private (skeleton);
24268#else
24269 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_BUTTON_SKELETON, ButtonSkeletonPrivate);
24270#endif
24271
24272 g_mutex_init (&skeleton->priv->lock);
24273 skeleton->priv->context = g_main_context_ref_thread_default ();
24274 skeleton->priv->properties = g_new0 (GValue, 1);
24275 g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN);
24276}
24277
24278static gboolean
24279button_skeleton_get_state (Button *object)
24280{
24281 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
24282 gboolean value;
24283 g_mutex_lock (&skeleton->priv->lock);
24284 value = g_value_get_boolean (&(skeleton->priv->properties[0]));
24285 g_mutex_unlock (&skeleton->priv->lock);
24286 return value;
24287}
24288
24289static void
24290button_skeleton_class_init (ButtonSkeletonClass *klass)
24291{
24292 GObjectClass *gobject_class;
24293 GDBusInterfaceSkeletonClass *skeleton_class;
24294
24295 gobject_class = G_OBJECT_CLASS (klass);
24296 gobject_class->finalize = button_skeleton_finalize;
24297 gobject_class->get_property = button_skeleton_get_property;
24298 gobject_class->set_property = button_skeleton_set_property;
24299 gobject_class->notify = button_skeleton_notify;
24300
24301
24302 button_override_properties (gobject_class, 1);
24303
24304 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
24305 skeleton_class->get_info = button_skeleton_dbus_interface_get_info;
24306 skeleton_class->get_properties = button_skeleton_dbus_interface_get_properties;
24307 skeleton_class->flush = button_skeleton_dbus_interface_flush;
24308 skeleton_class->get_vtable = button_skeleton_dbus_interface_get_vtable;
24309
24310#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
24311 g_type_class_add_private (klass, sizeof (ButtonSkeletonPrivate));
24312#endif
24313}
24314
24315static void
24316button_skeleton_iface_init (ButtonIface *iface)
24317{
24318 iface->button_release = _button_on_signal_button_release;
24319 iface->button_pressed = _button_on_signal_button_pressed;
24320 iface->button_pressed_long = _button_on_signal_button_pressed_long;
24321 iface->get_state = button_skeleton_get_state;
24322}
24323
24324/**
24325 * button_skeleton_new:
24326 *
24327 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
24328 *
24329 * Returns: (transfer full) (type ButtonSkeleton): The skeleton object.
24330 */
24331Button *
24332button_skeleton_new (void)
24333{
24334 return BUTTON (g_object_new (TYPE_BUTTON_SKELETON, NULL));
24335}
24336
24337/* ------------------------------------------------------------------------
24338 * Code for interface org.openbmc.Led
24339 * ------------------------------------------------------------------------
24340 */
24341
24342/**
24343 * SECTION:Led
24344 * @title: Led
24345 * @short_description: Generated C code for the org.openbmc.Led D-Bus interface
24346 *
24347 * 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.
24348 */
24349
24350/* ---- Introspection data for org.openbmc.Led ---- */
24351
24352static const _ExtendedGDBusMethodInfo _led_method_info_set_on =
24353{
24354 {
24355 -1,
24356 (gchar *) "setOn",
24357 NULL,
24358 NULL,
24359 NULL
24360 },
24361 "handle-set-on",
24362 FALSE
24363};
24364
24365static const _ExtendedGDBusMethodInfo _led_method_info_set_off =
24366{
24367 {
24368 -1,
24369 (gchar *) "setOff",
24370 NULL,
24371 NULL,
24372 NULL
24373 },
24374 "handle-set-off",
24375 FALSE
24376};
24377
24378static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_slow =
24379{
24380 {
24381 -1,
24382 (gchar *) "setBlinkSlow",
24383 NULL,
24384 NULL,
24385 NULL
24386 },
24387 "handle-set-blink-slow",
24388 FALSE
24389};
24390
24391static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_fast =
24392{
24393 {
24394 -1,
24395 (gchar *) "setBlinkFast",
24396 NULL,
24397 NULL,
24398 NULL
24399 },
24400 "handle-set-blink-fast",
24401 FALSE
24402};
24403
24404static const _ExtendedGDBusMethodInfo * const _led_method_info_pointers[] =
24405{
24406 &_led_method_info_set_on,
24407 &_led_method_info_set_off,
24408 &_led_method_info_set_blink_slow,
24409 &_led_method_info_set_blink_fast,
24410 NULL
24411};
24412
24413static const _ExtendedGDBusPropertyInfo _led_property_info_color =
24414{
24415 {
24416 -1,
24417 (gchar *) "color",
24418 (gchar *) "i",
24419 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
24420 NULL
24421 },
24422 "color",
24423 FALSE
24424};
24425
24426static const _ExtendedGDBusPropertyInfo _led_property_info_function =
24427{
24428 {
24429 -1,
24430 (gchar *) "function",
24431 (gchar *) "s",
24432 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
24433 NULL
24434 },
24435 "function",
24436 FALSE
24437};
24438
24439static const _ExtendedGDBusPropertyInfo * const _led_property_info_pointers[] =
24440{
24441 &_led_property_info_color,
24442 &_led_property_info_function,
24443 NULL
24444};
24445
24446static const _ExtendedGDBusInterfaceInfo _led_interface_info =
24447{
24448 {
24449 -1,
24450 (gchar *) "org.openbmc.Led",
24451 (GDBusMethodInfo **) &_led_method_info_pointers,
24452 NULL,
24453 (GDBusPropertyInfo **) &_led_property_info_pointers,
24454 NULL
24455 },
24456 "led",
24457};
24458
24459
24460/**
24461 * led_interface_info:
24462 *
24463 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> D-Bus interface.
24464 *
24465 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
24466 */
24467GDBusInterfaceInfo *
24468led_interface_info (void)
24469{
24470 return (GDBusInterfaceInfo *) &_led_interface_info.parent_struct;
24471}
24472
24473/**
24474 * led_override_properties:
24475 * @klass: The class structure for a #GObject<!-- -->-derived class.
24476 * @property_id_begin: The property id to assign to the first overridden property.
24477 *
24478 * Overrides all #GObject properties in the #Led interface for a concrete class.
24479 * The properties are overridden in the order they are defined.
24480 *
24481 * Returns: The last property id.
24482 */
24483guint
24484led_override_properties (GObjectClass *klass, guint property_id_begin)
24485{
24486 g_object_class_override_property (klass, property_id_begin++, "color");
24487 g_object_class_override_property (klass, property_id_begin++, "function");
24488 return property_id_begin - 1;
24489}
24490
24491
24492
24493/**
24494 * Led:
24495 *
24496 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
24497 */
24498
24499/**
24500 * LedIface:
24501 * @parent_iface: The parent interface.
24502 * @handle_set_blink_fast: Handler for the #Led::handle-set-blink-fast signal.
24503 * @handle_set_blink_slow: Handler for the #Led::handle-set-blink-slow signal.
24504 * @handle_set_off: Handler for the #Led::handle-set-off signal.
24505 * @handle_set_on: Handler for the #Led::handle-set-on signal.
24506 * @get_color: Getter for the #Led:color property.
24507 * @get_function: Getter for the #Led:function property.
24508 *
24509 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
24510 */
24511
24512typedef LedIface LedInterface;
24513G_DEFINE_INTERFACE (Led, led, G_TYPE_OBJECT);
24514
24515static void
24516led_default_init (LedIface *iface)
24517{
24518 /* GObject signals for incoming D-Bus method calls: */
24519 /**
24520 * Led::handle-set-on:
24521 * @object: A #Led.
24522 * @invocation: A #GDBusMethodInvocation.
24523 *
24524 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method.
24525 *
24526 * 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.
24527 *
24528 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
24529 */
24530 g_signal_new ("handle-set-on",
24531 G_TYPE_FROM_INTERFACE (iface),
24532 G_SIGNAL_RUN_LAST,
24533 G_STRUCT_OFFSET (LedIface, handle_set_on),
24534 g_signal_accumulator_true_handled,
24535 NULL,
24536 g_cclosure_marshal_generic,
24537 G_TYPE_BOOLEAN,
24538 1,
24539 G_TYPE_DBUS_METHOD_INVOCATION);
24540
24541 /**
24542 * Led::handle-set-off:
24543 * @object: A #Led.
24544 * @invocation: A #GDBusMethodInvocation.
24545 *
24546 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method.
24547 *
24548 * 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.
24549 *
24550 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
24551 */
24552 g_signal_new ("handle-set-off",
24553 G_TYPE_FROM_INTERFACE (iface),
24554 G_SIGNAL_RUN_LAST,
24555 G_STRUCT_OFFSET (LedIface, handle_set_off),
24556 g_signal_accumulator_true_handled,
24557 NULL,
24558 g_cclosure_marshal_generic,
24559 G_TYPE_BOOLEAN,
24560 1,
24561 G_TYPE_DBUS_METHOD_INVOCATION);
24562
24563 /**
24564 * Led::handle-set-blink-slow:
24565 * @object: A #Led.
24566 * @invocation: A #GDBusMethodInvocation.
24567 *
24568 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method.
24569 *
24570 * 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.
24571 *
24572 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
24573 */
24574 g_signal_new ("handle-set-blink-slow",
24575 G_TYPE_FROM_INTERFACE (iface),
24576 G_SIGNAL_RUN_LAST,
24577 G_STRUCT_OFFSET (LedIface, handle_set_blink_slow),
24578 g_signal_accumulator_true_handled,
24579 NULL,
24580 g_cclosure_marshal_generic,
24581 G_TYPE_BOOLEAN,
24582 1,
24583 G_TYPE_DBUS_METHOD_INVOCATION);
24584
24585 /**
24586 * Led::handle-set-blink-fast:
24587 * @object: A #Led.
24588 * @invocation: A #GDBusMethodInvocation.
24589 *
24590 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method.
24591 *
24592 * 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.
24593 *
24594 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
24595 */
24596 g_signal_new ("handle-set-blink-fast",
24597 G_TYPE_FROM_INTERFACE (iface),
24598 G_SIGNAL_RUN_LAST,
24599 G_STRUCT_OFFSET (LedIface, handle_set_blink_fast),
24600 g_signal_accumulator_true_handled,
24601 NULL,
24602 g_cclosure_marshal_generic,
24603 G_TYPE_BOOLEAN,
24604 1,
24605 G_TYPE_DBUS_METHOD_INVOCATION);
24606
24607 /* GObject properties for D-Bus properties: */
24608 /**
24609 * Led:color:
24610 *
24611 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link>.
24612 *
24613 * 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.
24614 */
24615 g_object_interface_install_property (iface,
24616 g_param_spec_int ("color", "color", "color", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
24617 /**
24618 * Led:function:
24619 *
24620 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link>.
24621 *
24622 * 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.
24623 */
24624 g_object_interface_install_property (iface,
24625 g_param_spec_string ("function", "function", "function", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
24626}
24627
24628/**
24629 * led_get_color: (skip)
24630 * @object: A #Led.
24631 *
24632 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property.
24633 *
24634 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
24635 *
24636 * Returns: The property value.
24637 */
24638gint
24639led_get_color (Led *object)
24640{
24641 return LED_GET_IFACE (object)->get_color (object);
24642}
24643
24644/**
24645 * led_set_color: (skip)
24646 * @object: A #Led.
24647 * @value: The value to set.
24648 *
24649 * Sets the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property to @value.
24650 *
24651 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
24652 */
24653void
24654led_set_color (Led *object, gint value)
24655{
24656 g_object_set (G_OBJECT (object), "color", value, NULL);
24657}
24658
24659/**
24660 * led_get_function: (skip)
24661 * @object: A #Led.
24662 *
24663 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
24664 *
24665 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
24666 *
24667 * <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>
24668 *
24669 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
24670 */
24671const gchar *
24672led_get_function (Led *object)
24673{
24674 return LED_GET_IFACE (object)->get_function (object);
24675}
24676
24677/**
24678 * led_dup_function: (skip)
24679 * @object: A #Led.
24680 *
24681 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
24682 *
24683 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
24684 *
24685 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
24686 */
24687gchar *
24688led_dup_function (Led *object)
24689{
24690 gchar *value;
24691 g_object_get (G_OBJECT (object), "function", &value, NULL);
24692 return value;
24693}
24694
24695/**
24696 * led_set_function: (skip)
24697 * @object: A #Led.
24698 * @value: The value to set.
24699 *
24700 * Sets the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property to @value.
24701 *
24702 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
24703 */
24704void
24705led_set_function (Led *object, const gchar *value)
24706{
24707 g_object_set (G_OBJECT (object), "function", value, NULL);
24708}
24709
24710/**
24711 * led_call_set_on:
24712 * @proxy: A #LedProxy.
24713 * @cancellable: (allow-none): A #GCancellable or %NULL.
24714 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
24715 * @user_data: User data to pass to @callback.
24716 *
24717 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method on @proxy.
24718 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
24719 * You can then call led_call_set_on_finish() to get the result of the operation.
24720 *
24721 * See led_call_set_on_sync() for the synchronous, blocking version of this method.
24722 */
24723void
24724led_call_set_on (
24725 Led *proxy,
24726 GCancellable *cancellable,
24727 GAsyncReadyCallback callback,
24728 gpointer user_data)
24729{
24730 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
24731 "setOn",
24732 g_variant_new ("()"),
24733 G_DBUS_CALL_FLAGS_NONE,
24734 -1,
24735 cancellable,
24736 callback,
24737 user_data);
24738}
24739
24740/**
24741 * led_call_set_on_finish:
24742 * @proxy: A #LedProxy.
24743 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_on().
24744 * @error: Return location for error or %NULL.
24745 *
24746 * Finishes an operation started with led_call_set_on().
24747 *
24748 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24749 */
24750gboolean
24751led_call_set_on_finish (
24752 Led *proxy,
24753 GAsyncResult *res,
24754 GError **error)
24755{
24756 GVariant *_ret;
24757 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
24758 if (_ret == NULL)
24759 goto _out;
24760 g_variant_get (_ret,
24761 "()");
24762 g_variant_unref (_ret);
24763_out:
24764 return _ret != NULL;
24765}
24766
24767/**
24768 * led_call_set_on_sync:
24769 * @proxy: A #LedProxy.
24770 * @cancellable: (allow-none): A #GCancellable or %NULL.
24771 * @error: Return location for error or %NULL.
24772 *
24773 * 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.
24774 *
24775 * See led_call_set_on() for the asynchronous version of this method.
24776 *
24777 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24778 */
24779gboolean
24780led_call_set_on_sync (
24781 Led *proxy,
24782 GCancellable *cancellable,
24783 GError **error)
24784{
24785 GVariant *_ret;
24786 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
24787 "setOn",
24788 g_variant_new ("()"),
24789 G_DBUS_CALL_FLAGS_NONE,
24790 -1,
24791 cancellable,
24792 error);
24793 if (_ret == NULL)
24794 goto _out;
24795 g_variant_get (_ret,
24796 "()");
24797 g_variant_unref (_ret);
24798_out:
24799 return _ret != NULL;
24800}
24801
24802/**
24803 * led_call_set_off:
24804 * @proxy: A #LedProxy.
24805 * @cancellable: (allow-none): A #GCancellable or %NULL.
24806 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
24807 * @user_data: User data to pass to @callback.
24808 *
24809 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method on @proxy.
24810 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
24811 * You can then call led_call_set_off_finish() to get the result of the operation.
24812 *
24813 * See led_call_set_off_sync() for the synchronous, blocking version of this method.
24814 */
24815void
24816led_call_set_off (
24817 Led *proxy,
24818 GCancellable *cancellable,
24819 GAsyncReadyCallback callback,
24820 gpointer user_data)
24821{
24822 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
24823 "setOff",
24824 g_variant_new ("()"),
24825 G_DBUS_CALL_FLAGS_NONE,
24826 -1,
24827 cancellable,
24828 callback,
24829 user_data);
24830}
24831
24832/**
24833 * led_call_set_off_finish:
24834 * @proxy: A #LedProxy.
24835 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_off().
24836 * @error: Return location for error or %NULL.
24837 *
24838 * Finishes an operation started with led_call_set_off().
24839 *
24840 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24841 */
24842gboolean
24843led_call_set_off_finish (
24844 Led *proxy,
24845 GAsyncResult *res,
24846 GError **error)
24847{
24848 GVariant *_ret;
24849 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
24850 if (_ret == NULL)
24851 goto _out;
24852 g_variant_get (_ret,
24853 "()");
24854 g_variant_unref (_ret);
24855_out:
24856 return _ret != NULL;
24857}
24858
24859/**
24860 * led_call_set_off_sync:
24861 * @proxy: A #LedProxy.
24862 * @cancellable: (allow-none): A #GCancellable or %NULL.
24863 * @error: Return location for error or %NULL.
24864 *
24865 * 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.
24866 *
24867 * See led_call_set_off() for the asynchronous version of this method.
24868 *
24869 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24870 */
24871gboolean
24872led_call_set_off_sync (
24873 Led *proxy,
24874 GCancellable *cancellable,
24875 GError **error)
24876{
24877 GVariant *_ret;
24878 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
24879 "setOff",
24880 g_variant_new ("()"),
24881 G_DBUS_CALL_FLAGS_NONE,
24882 -1,
24883 cancellable,
24884 error);
24885 if (_ret == NULL)
24886 goto _out;
24887 g_variant_get (_ret,
24888 "()");
24889 g_variant_unref (_ret);
24890_out:
24891 return _ret != NULL;
24892}
24893
24894/**
24895 * led_call_set_blink_slow:
24896 * @proxy: A #LedProxy.
24897 * @cancellable: (allow-none): A #GCancellable or %NULL.
24898 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
24899 * @user_data: User data to pass to @callback.
24900 *
24901 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method on @proxy.
24902 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
24903 * You can then call led_call_set_blink_slow_finish() to get the result of the operation.
24904 *
24905 * See led_call_set_blink_slow_sync() for the synchronous, blocking version of this method.
24906 */
24907void
24908led_call_set_blink_slow (
24909 Led *proxy,
24910 GCancellable *cancellable,
24911 GAsyncReadyCallback callback,
24912 gpointer user_data)
24913{
24914 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
24915 "setBlinkSlow",
24916 g_variant_new ("()"),
24917 G_DBUS_CALL_FLAGS_NONE,
24918 -1,
24919 cancellable,
24920 callback,
24921 user_data);
24922}
24923
24924/**
24925 * led_call_set_blink_slow_finish:
24926 * @proxy: A #LedProxy.
24927 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_slow().
24928 * @error: Return location for error or %NULL.
24929 *
24930 * Finishes an operation started with led_call_set_blink_slow().
24931 *
24932 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24933 */
24934gboolean
24935led_call_set_blink_slow_finish (
24936 Led *proxy,
24937 GAsyncResult *res,
24938 GError **error)
24939{
24940 GVariant *_ret;
24941 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
24942 if (_ret == NULL)
24943 goto _out;
24944 g_variant_get (_ret,
24945 "()");
24946 g_variant_unref (_ret);
24947_out:
24948 return _ret != NULL;
24949}
24950
24951/**
24952 * led_call_set_blink_slow_sync:
24953 * @proxy: A #LedProxy.
24954 * @cancellable: (allow-none): A #GCancellable or %NULL.
24955 * @error: Return location for error or %NULL.
24956 *
24957 * 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.
24958 *
24959 * See led_call_set_blink_slow() for the asynchronous version of this method.
24960 *
24961 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24962 */
24963gboolean
24964led_call_set_blink_slow_sync (
24965 Led *proxy,
24966 GCancellable *cancellable,
24967 GError **error)
24968{
24969 GVariant *_ret;
24970 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
24971 "setBlinkSlow",
24972 g_variant_new ("()"),
24973 G_DBUS_CALL_FLAGS_NONE,
24974 -1,
24975 cancellable,
24976 error);
24977 if (_ret == NULL)
24978 goto _out;
24979 g_variant_get (_ret,
24980 "()");
24981 g_variant_unref (_ret);
24982_out:
24983 return _ret != NULL;
24984}
24985
24986/**
24987 * led_call_set_blink_fast:
24988 * @proxy: A #LedProxy.
24989 * @cancellable: (allow-none): A #GCancellable or %NULL.
24990 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
24991 * @user_data: User data to pass to @callback.
24992 *
24993 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method on @proxy.
24994 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
24995 * You can then call led_call_set_blink_fast_finish() to get the result of the operation.
24996 *
24997 * See led_call_set_blink_fast_sync() for the synchronous, blocking version of this method.
24998 */
24999void
25000led_call_set_blink_fast (
25001 Led *proxy,
25002 GCancellable *cancellable,
25003 GAsyncReadyCallback callback,
25004 gpointer user_data)
25005{
25006 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
25007 "setBlinkFast",
25008 g_variant_new ("()"),
25009 G_DBUS_CALL_FLAGS_NONE,
25010 -1,
25011 cancellable,
25012 callback,
25013 user_data);
25014}
25015
25016/**
25017 * led_call_set_blink_fast_finish:
25018 * @proxy: A #LedProxy.
25019 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_fast().
25020 * @error: Return location for error or %NULL.
25021 *
25022 * Finishes an operation started with led_call_set_blink_fast().
25023 *
25024 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
25025 */
25026gboolean
25027led_call_set_blink_fast_finish (
25028 Led *proxy,
25029 GAsyncResult *res,
25030 GError **error)
25031{
25032 GVariant *_ret;
25033 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
25034 if (_ret == NULL)
25035 goto _out;
25036 g_variant_get (_ret,
25037 "()");
25038 g_variant_unref (_ret);
25039_out:
25040 return _ret != NULL;
25041}
25042
25043/**
25044 * led_call_set_blink_fast_sync:
25045 * @proxy: A #LedProxy.
25046 * @cancellable: (allow-none): A #GCancellable or %NULL.
25047 * @error: Return location for error or %NULL.
25048 *
25049 * 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.
25050 *
25051 * See led_call_set_blink_fast() for the asynchronous version of this method.
25052 *
25053 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
25054 */
25055gboolean
25056led_call_set_blink_fast_sync (
25057 Led *proxy,
25058 GCancellable *cancellable,
25059 GError **error)
25060{
25061 GVariant *_ret;
25062 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
25063 "setBlinkFast",
25064 g_variant_new ("()"),
25065 G_DBUS_CALL_FLAGS_NONE,
25066 -1,
25067 cancellable,
25068 error);
25069 if (_ret == NULL)
25070 goto _out;
25071 g_variant_get (_ret,
25072 "()");
25073 g_variant_unref (_ret);
25074_out:
25075 return _ret != NULL;
25076}
25077
25078/**
25079 * led_complete_set_on:
25080 * @object: A #Led.
25081 * @invocation: (transfer full): A #GDBusMethodInvocation.
25082 *
25083 * 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.
25084 *
25085 * This method will free @invocation, you cannot use it afterwards.
25086 */
25087void
25088led_complete_set_on (
25089 Led *object,
25090 GDBusMethodInvocation *invocation)
25091{
25092 g_dbus_method_invocation_return_value (invocation,
25093 g_variant_new ("()"));
25094}
25095
25096/**
25097 * led_complete_set_off:
25098 * @object: A #Led.
25099 * @invocation: (transfer full): A #GDBusMethodInvocation.
25100 *
25101 * 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.
25102 *
25103 * This method will free @invocation, you cannot use it afterwards.
25104 */
25105void
25106led_complete_set_off (
25107 Led *object,
25108 GDBusMethodInvocation *invocation)
25109{
25110 g_dbus_method_invocation_return_value (invocation,
25111 g_variant_new ("()"));
25112}
25113
25114/**
25115 * led_complete_set_blink_slow:
25116 * @object: A #Led.
25117 * @invocation: (transfer full): A #GDBusMethodInvocation.
25118 *
25119 * 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.
25120 *
25121 * This method will free @invocation, you cannot use it afterwards.
25122 */
25123void
25124led_complete_set_blink_slow (
25125 Led *object,
25126 GDBusMethodInvocation *invocation)
25127{
25128 g_dbus_method_invocation_return_value (invocation,
25129 g_variant_new ("()"));
25130}
25131
25132/**
25133 * led_complete_set_blink_fast:
25134 * @object: A #Led.
25135 * @invocation: (transfer full): A #GDBusMethodInvocation.
25136 *
25137 * 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.
25138 *
25139 * This method will free @invocation, you cannot use it afterwards.
25140 */
25141void
25142led_complete_set_blink_fast (
25143 Led *object,
25144 GDBusMethodInvocation *invocation)
25145{
25146 g_dbus_method_invocation_return_value (invocation,
25147 g_variant_new ("()"));
25148}
25149
25150/* ------------------------------------------------------------------------ */
25151
25152/**
25153 * LedProxy:
25154 *
25155 * The #LedProxy structure contains only private data and should only be accessed using the provided API.
25156 */
25157
25158/**
25159 * LedProxyClass:
25160 * @parent_class: The parent class.
25161 *
25162 * Class structure for #LedProxy.
25163 */
25164
25165struct _LedProxyPrivate
25166{
25167 GData *qdata;
25168};
25169
25170static void led_proxy_iface_init (LedIface *iface);
25171
25172#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
25173G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
25174 G_ADD_PRIVATE (LedProxy)
25175 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
25176
25177#else
25178G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
25179 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
25180
25181#endif
25182static void
25183led_proxy_finalize (GObject *object)
25184{
25185 LedProxy *proxy = LED_PROXY (object);
25186 g_datalist_clear (&proxy->priv->qdata);
25187 G_OBJECT_CLASS (led_proxy_parent_class)->finalize (object);
25188}
25189
25190static void
25191led_proxy_get_property (GObject *object,
25192 guint prop_id,
25193 GValue *value,
25194 GParamSpec *pspec G_GNUC_UNUSED)
25195{
25196 const _ExtendedGDBusPropertyInfo *info;
25197 GVariant *variant;
25198 g_assert (prop_id != 0 && prop_id - 1 < 2);
25199 info = _led_property_info_pointers[prop_id - 1];
25200 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
25201 if (info->use_gvariant)
25202 {
25203 g_value_set_variant (value, variant);
25204 }
25205 else
25206 {
25207 if (variant != NULL)
25208 g_dbus_gvariant_to_gvalue (variant, value);
25209 }
25210 if (variant != NULL)
25211 g_variant_unref (variant);
25212}
25213
25214static void
25215led_proxy_set_property_cb (GDBusProxy *proxy,
25216 GAsyncResult *res,
25217 gpointer user_data)
25218{
25219 const _ExtendedGDBusPropertyInfo *info = user_data;
25220 GError *error;
25221 GVariant *_ret;
25222 error = NULL;
25223 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
25224 if (!_ret)
25225 {
25226 g_warning ("Error setting property '%s' on interface org.openbmc.Led: %s (%s, %d)",
25227 info->parent_struct.name,
25228 error->message, g_quark_to_string (error->domain), error->code);
25229 g_error_free (error);
25230 }
25231 else
25232 {
25233 g_variant_unref (_ret);
25234 }
25235}
25236
25237static void
25238led_proxy_set_property (GObject *object,
25239 guint prop_id,
25240 const GValue *value,
25241 GParamSpec *pspec G_GNUC_UNUSED)
25242{
25243 const _ExtendedGDBusPropertyInfo *info;
25244 GVariant *variant;
25245 g_assert (prop_id != 0 && prop_id - 1 < 2);
25246 info = _led_property_info_pointers[prop_id - 1];
25247 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
25248 g_dbus_proxy_call (G_DBUS_PROXY (object),
25249 "org.freedesktop.DBus.Properties.Set",
25250 g_variant_new ("(ssv)", "org.openbmc.Led", info->parent_struct.name, variant),
25251 G_DBUS_CALL_FLAGS_NONE,
25252 -1,
25253 NULL, (GAsyncReadyCallback) led_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
25254 g_variant_unref (variant);
25255}
25256
25257static void
25258led_proxy_g_signal (GDBusProxy *proxy,
25259 const gchar *sender_name G_GNUC_UNUSED,
25260 const gchar *signal_name,
25261 GVariant *parameters)
25262{
25263 _ExtendedGDBusSignalInfo *info;
25264 GVariantIter iter;
25265 GVariant *child;
25266 GValue *paramv;
25267 guint num_params;
25268 guint n;
25269 guint signal_id;
25270 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, signal_name);
25271 if (info == NULL)
25272 return;
25273 num_params = g_variant_n_children (parameters);
25274 paramv = g_new0 (GValue, num_params + 1);
25275 g_value_init (&paramv[0], TYPE_LED);
25276 g_value_set_object (&paramv[0], proxy);
25277 g_variant_iter_init (&iter, parameters);
25278 n = 1;
25279 while ((child = g_variant_iter_next_value (&iter)) != NULL)
25280 {
25281 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
25282 if (arg_info->use_gvariant)
25283 {
25284 g_value_init (&paramv[n], G_TYPE_VARIANT);
25285 g_value_set_variant (&paramv[n], child);
25286 n++;
25287 }
25288 else
25289 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
25290 g_variant_unref (child);
25291 }
25292 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
25293 g_signal_emitv (paramv, signal_id, 0, NULL);
25294 for (n = 0; n < num_params + 1; n++)
25295 g_value_unset (&paramv[n]);
25296 g_free (paramv);
25297}
25298
25299static void
25300led_proxy_g_properties_changed (GDBusProxy *_proxy,
25301 GVariant *changed_properties,
25302 const gchar *const *invalidated_properties)
25303{
25304 LedProxy *proxy = LED_PROXY (_proxy);
25305 guint n;
25306 const gchar *key;
25307 GVariantIter *iter;
25308 _ExtendedGDBusPropertyInfo *info;
25309 g_variant_get (changed_properties, "a{sv}", &iter);
25310 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
25311 {
25312 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, key);
25313 g_datalist_remove_data (&proxy->priv->qdata, key);
25314 if (info != NULL)
25315 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
25316 }
25317 g_variant_iter_free (iter);
25318 for (n = 0; invalidated_properties[n] != NULL; n++)
25319 {
25320 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, invalidated_properties[n]);
25321 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
25322 if (info != NULL)
25323 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
25324 }
25325}
25326
25327static gint
25328led_proxy_get_color (Led *object)
25329{
25330 LedProxy *proxy = LED_PROXY (object);
25331 GVariant *variant;
25332 gint value = 0;
25333 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "color");
25334 if (variant != NULL)
25335 {
25336 value = g_variant_get_int32 (variant);
25337 g_variant_unref (variant);
25338 }
25339 return value;
25340}
25341
25342static const gchar *
25343led_proxy_get_function (Led *object)
25344{
25345 LedProxy *proxy = LED_PROXY (object);
25346 GVariant *variant;
25347 const gchar *value = NULL;
25348 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "function");
25349 if (variant != NULL)
25350 {
25351 value = g_variant_get_string (variant, NULL);
25352 g_variant_unref (variant);
25353 }
25354 return value;
25355}
25356
25357static void
25358led_proxy_init (LedProxy *proxy)
25359{
25360#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
25361 proxy->priv = led_proxy_get_instance_private (proxy);
25362#else
25363 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_LED_PROXY, LedProxyPrivate);
25364#endif
25365
25366 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), led_interface_info ());
25367}
25368
25369static void
25370led_proxy_class_init (LedProxyClass *klass)
25371{
25372 GObjectClass *gobject_class;
25373 GDBusProxyClass *proxy_class;
25374
25375 gobject_class = G_OBJECT_CLASS (klass);
25376 gobject_class->finalize = led_proxy_finalize;
25377 gobject_class->get_property = led_proxy_get_property;
25378 gobject_class->set_property = led_proxy_set_property;
25379
25380 proxy_class = G_DBUS_PROXY_CLASS (klass);
25381 proxy_class->g_signal = led_proxy_g_signal;
25382 proxy_class->g_properties_changed = led_proxy_g_properties_changed;
25383
25384 led_override_properties (gobject_class, 1);
25385
25386#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
25387 g_type_class_add_private (klass, sizeof (LedProxyPrivate));
25388#endif
25389}
25390
25391static void
25392led_proxy_iface_init (LedIface *iface)
25393{
25394 iface->get_color = led_proxy_get_color;
25395 iface->get_function = led_proxy_get_function;
25396}
25397
25398/**
25399 * led_proxy_new:
25400 * @connection: A #GDBusConnection.
25401 * @flags: Flags from the #GDBusProxyFlags enumeration.
25402 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
25403 * @object_path: An object path.
25404 * @cancellable: (allow-none): A #GCancellable or %NULL.
25405 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
25406 * @user_data: User data to pass to @callback.
25407 *
25408 * 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.
25409 *
25410 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
25411 * You can then call led_proxy_new_finish() to get the result of the operation.
25412 *
25413 * See led_proxy_new_sync() for the synchronous, blocking version of this constructor.
25414 */
25415void
25416led_proxy_new (
25417 GDBusConnection *connection,
25418 GDBusProxyFlags flags,
25419 const gchar *name,
25420 const gchar *object_path,
25421 GCancellable *cancellable,
25422 GAsyncReadyCallback callback,
25423 gpointer user_data)
25424{
25425 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);
25426}
25427
25428/**
25429 * led_proxy_new_finish:
25430 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new().
25431 * @error: Return location for error or %NULL
25432 *
25433 * Finishes an operation started with led_proxy_new().
25434 *
25435 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
25436 */
25437Led *
25438led_proxy_new_finish (
25439 GAsyncResult *res,
25440 GError **error)
25441{
25442 GObject *ret;
25443 GObject *source_object;
25444 source_object = g_async_result_get_source_object (res);
25445 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
25446 g_object_unref (source_object);
25447 if (ret != NULL)
25448 return LED (ret);
25449 else
25450 return NULL;
25451}
25452
25453/**
25454 * led_proxy_new_sync:
25455 * @connection: A #GDBusConnection.
25456 * @flags: Flags from the #GDBusProxyFlags enumeration.
25457 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
25458 * @object_path: An object path.
25459 * @cancellable: (allow-none): A #GCancellable or %NULL.
25460 * @error: Return location for error or %NULL
25461 *
25462 * 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.
25463 *
25464 * The calling thread is blocked until a reply is received.
25465 *
25466 * See led_proxy_new() for the asynchronous version of this constructor.
25467 *
25468 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
25469 */
25470Led *
25471led_proxy_new_sync (
25472 GDBusConnection *connection,
25473 GDBusProxyFlags flags,
25474 const gchar *name,
25475 const gchar *object_path,
25476 GCancellable *cancellable,
25477 GError **error)
25478{
25479 GInitable *ret;
25480 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);
25481 if (ret != NULL)
25482 return LED (ret);
25483 else
25484 return NULL;
25485}
25486
25487
25488/**
25489 * led_proxy_new_for_bus:
25490 * @bus_type: A #GBusType.
25491 * @flags: Flags from the #GDBusProxyFlags enumeration.
25492 * @name: A bus name (well-known or unique).
25493 * @object_path: An object path.
25494 * @cancellable: (allow-none): A #GCancellable or %NULL.
25495 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
25496 * @user_data: User data to pass to @callback.
25497 *
25498 * Like led_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
25499 *
25500 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
25501 * You can then call led_proxy_new_for_bus_finish() to get the result of the operation.
25502 *
25503 * See led_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
25504 */
25505void
25506led_proxy_new_for_bus (
25507 GBusType bus_type,
25508 GDBusProxyFlags flags,
25509 const gchar *name,
25510 const gchar *object_path,
25511 GCancellable *cancellable,
25512 GAsyncReadyCallback callback,
25513 gpointer user_data)
25514{
25515 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);
25516}
25517
25518/**
25519 * led_proxy_new_for_bus_finish:
25520 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new_for_bus().
25521 * @error: Return location for error or %NULL
25522 *
25523 * Finishes an operation started with led_proxy_new_for_bus().
25524 *
25525 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
25526 */
25527Led *
25528led_proxy_new_for_bus_finish (
25529 GAsyncResult *res,
25530 GError **error)
25531{
25532 GObject *ret;
25533 GObject *source_object;
25534 source_object = g_async_result_get_source_object (res);
25535 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
25536 g_object_unref (source_object);
25537 if (ret != NULL)
25538 return LED (ret);
25539 else
25540 return NULL;
25541}
25542
25543/**
25544 * led_proxy_new_for_bus_sync:
25545 * @bus_type: A #GBusType.
25546 * @flags: Flags from the #GDBusProxyFlags enumeration.
25547 * @name: A bus name (well-known or unique).
25548 * @object_path: An object path.
25549 * @cancellable: (allow-none): A #GCancellable or %NULL.
25550 * @error: Return location for error or %NULL
25551 *
25552 * Like led_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
25553 *
25554 * The calling thread is blocked until a reply is received.
25555 *
25556 * See led_proxy_new_for_bus() for the asynchronous version of this constructor.
25557 *
25558 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
25559 */
25560Led *
25561led_proxy_new_for_bus_sync (
25562 GBusType bus_type,
25563 GDBusProxyFlags flags,
25564 const gchar *name,
25565 const gchar *object_path,
25566 GCancellable *cancellable,
25567 GError **error)
25568{
25569 GInitable *ret;
25570 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);
25571 if (ret != NULL)
25572 return LED (ret);
25573 else
25574 return NULL;
25575}
25576
25577
25578/* ------------------------------------------------------------------------ */
25579
25580/**
25581 * LedSkeleton:
25582 *
25583 * The #LedSkeleton structure contains only private data and should only be accessed using the provided API.
25584 */
25585
25586/**
25587 * LedSkeletonClass:
25588 * @parent_class: The parent class.
25589 *
25590 * Class structure for #LedSkeleton.
25591 */
25592
25593struct _LedSkeletonPrivate
25594{
25595 GValue *properties;
25596 GList *changed_properties;
25597 GSource *changed_properties_idle_source;
25598 GMainContext *context;
25599 GMutex lock;
25600};
25601
25602static void
25603_led_skeleton_handle_method_call (
25604 GDBusConnection *connection G_GNUC_UNUSED,
25605 const gchar *sender G_GNUC_UNUSED,
25606 const gchar *object_path G_GNUC_UNUSED,
25607 const gchar *interface_name,
25608 const gchar *method_name,
25609 GVariant *parameters,
25610 GDBusMethodInvocation *invocation,
25611 gpointer user_data)
25612{
25613 LedSkeleton *skeleton = LED_SKELETON (user_data);
25614 _ExtendedGDBusMethodInfo *info;
25615 GVariantIter iter;
25616 GVariant *child;
25617 GValue *paramv;
25618 guint num_params;
25619 guint num_extra;
25620 guint n;
25621 guint signal_id;
25622 GValue return_value = G_VALUE_INIT;
25623 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
25624 g_assert (info != NULL);
25625 num_params = g_variant_n_children (parameters);
25626 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
25627 n = 0;
25628 g_value_init (&paramv[n], TYPE_LED);
25629 g_value_set_object (&paramv[n++], skeleton);
25630 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
25631 g_value_set_object (&paramv[n++], invocation);
25632 if (info->pass_fdlist)
25633 {
25634#ifdef G_OS_UNIX
25635 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
25636 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
25637#else
25638 g_assert_not_reached ();
25639#endif
25640 }
25641 g_variant_iter_init (&iter, parameters);
25642 while ((child = g_variant_iter_next_value (&iter)) != NULL)
25643 {
25644 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
25645 if (arg_info->use_gvariant)
25646 {
25647 g_value_init (&paramv[n], G_TYPE_VARIANT);
25648 g_value_set_variant (&paramv[n], child);
25649 n++;
25650 }
25651 else
25652 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
25653 g_variant_unref (child);
25654 }
25655 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
25656 g_value_init (&return_value, G_TYPE_BOOLEAN);
25657 g_signal_emitv (paramv, signal_id, 0, &return_value);
25658 if (!g_value_get_boolean (&return_value))
25659 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);
25660 g_value_unset (&return_value);
25661 for (n = 0; n < num_params + num_extra; n++)
25662 g_value_unset (&paramv[n]);
25663 g_free (paramv);
25664}
25665
25666static GVariant *
25667_led_skeleton_handle_get_property (
25668 GDBusConnection *connection G_GNUC_UNUSED,
25669 const gchar *sender G_GNUC_UNUSED,
25670 const gchar *object_path G_GNUC_UNUSED,
25671 const gchar *interface_name G_GNUC_UNUSED,
25672 const gchar *property_name,
25673 GError **error,
25674 gpointer user_data)
25675{
25676 LedSkeleton *skeleton = LED_SKELETON (user_data);
25677 GValue value = G_VALUE_INIT;
25678 GParamSpec *pspec;
25679 _ExtendedGDBusPropertyInfo *info;
25680 GVariant *ret;
25681 ret = NULL;
25682 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
25683 g_assert (info != NULL);
25684 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
25685 if (pspec == NULL)
25686 {
25687 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
25688 }
25689 else
25690 {
25691 g_value_init (&value, pspec->value_type);
25692 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
25693 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
25694 g_value_unset (&value);
25695 }
25696 return ret;
25697}
25698
25699static gboolean
25700_led_skeleton_handle_set_property (
25701 GDBusConnection *connection G_GNUC_UNUSED,
25702 const gchar *sender G_GNUC_UNUSED,
25703 const gchar *object_path G_GNUC_UNUSED,
25704 const gchar *interface_name G_GNUC_UNUSED,
25705 const gchar *property_name,
25706 GVariant *variant,
25707 GError **error,
25708 gpointer user_data)
25709{
25710 LedSkeleton *skeleton = LED_SKELETON (user_data);
25711 GValue value = G_VALUE_INIT;
25712 GParamSpec *pspec;
25713 _ExtendedGDBusPropertyInfo *info;
25714 gboolean ret;
25715 ret = FALSE;
25716 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
25717 g_assert (info != NULL);
25718 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
25719 if (pspec == NULL)
25720 {
25721 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
25722 }
25723 else
25724 {
25725 if (info->use_gvariant)
25726 g_value_set_variant (&value, variant);
25727 else
25728 g_dbus_gvariant_to_gvalue (variant, &value);
25729 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
25730 g_value_unset (&value);
25731 ret = TRUE;
25732 }
25733 return ret;
25734}
25735
25736static const GDBusInterfaceVTable _led_skeleton_vtable =
25737{
25738 _led_skeleton_handle_method_call,
25739 _led_skeleton_handle_get_property,
25740 _led_skeleton_handle_set_property,
25741 {NULL}
25742};
25743
25744static GDBusInterfaceInfo *
25745led_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
25746{
25747 return led_interface_info ();
25748}
25749
25750static GDBusInterfaceVTable *
25751led_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
25752{
25753 return (GDBusInterfaceVTable *) &_led_skeleton_vtable;
25754}
25755
25756static GVariant *
25757led_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
25758{
25759 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
25760
25761 GVariantBuilder builder;
25762 guint n;
25763 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
25764 if (_led_interface_info.parent_struct.properties == NULL)
25765 goto out;
25766 for (n = 0; _led_interface_info.parent_struct.properties[n] != NULL; n++)
25767 {
25768 GDBusPropertyInfo *info = _led_interface_info.parent_struct.properties[n];
25769 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
25770 {
25771 GVariant *value;
25772 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);
25773 if (value != NULL)
25774 {
25775 g_variant_take_ref (value);
25776 g_variant_builder_add (&builder, "{sv}", info->name, value);
25777 g_variant_unref (value);
25778 }
25779 }
25780 }
25781out:
25782 return g_variant_builder_end (&builder);
25783}
25784
25785static gboolean _led_emit_changed (gpointer user_data);
25786
25787static void
25788led_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
25789{
25790 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
25791 gboolean emit_changed = FALSE;
25792
25793 g_mutex_lock (&skeleton->priv->lock);
25794 if (skeleton->priv->changed_properties_idle_source != NULL)
25795 {
25796 g_source_destroy (skeleton->priv->changed_properties_idle_source);
25797 skeleton->priv->changed_properties_idle_source = NULL;
25798 emit_changed = TRUE;
25799 }
25800 g_mutex_unlock (&skeleton->priv->lock);
25801
25802 if (emit_changed)
25803 _led_emit_changed (skeleton);
25804}
25805
25806static void led_skeleton_iface_init (LedIface *iface);
25807#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
25808G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
25809 G_ADD_PRIVATE (LedSkeleton)
25810 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
25811
25812#else
25813G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
25814 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
25815
25816#endif
25817static void
25818led_skeleton_finalize (GObject *object)
25819{
25820 LedSkeleton *skeleton = LED_SKELETON (object);
25821 guint n;
25822 for (n = 0; n < 2; n++)
25823 g_value_unset (&skeleton->priv->properties[n]);
25824 g_free (skeleton->priv->properties);
25825 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
25826 if (skeleton->priv->changed_properties_idle_source != NULL)
25827 g_source_destroy (skeleton->priv->changed_properties_idle_source);
25828 g_main_context_unref (skeleton->priv->context);
25829 g_mutex_clear (&skeleton->priv->lock);
25830 G_OBJECT_CLASS (led_skeleton_parent_class)->finalize (object);
25831}
25832
25833static void
25834led_skeleton_get_property (GObject *object,
25835 guint prop_id,
25836 GValue *value,
25837 GParamSpec *pspec G_GNUC_UNUSED)
25838{
25839 LedSkeleton *skeleton = LED_SKELETON (object);
25840 g_assert (prop_id != 0 && prop_id - 1 < 2);
25841 g_mutex_lock (&skeleton->priv->lock);
25842 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
25843 g_mutex_unlock (&skeleton->priv->lock);
25844}
25845
25846static gboolean
25847_led_emit_changed (gpointer user_data)
25848{
25849 LedSkeleton *skeleton = LED_SKELETON (user_data);
25850 GList *l;
25851 GVariantBuilder builder;
25852 GVariantBuilder invalidated_builder;
25853 guint num_changes;
25854
25855 g_mutex_lock (&skeleton->priv->lock);
25856 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
25857 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
25858 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
25859 {
25860 ChangedProperty *cp = l->data;
25861 GVariant *variant;
25862 const GValue *cur_value;
25863
25864 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
25865 if (!_g_value_equal (cur_value, &cp->orig_value))
25866 {
25867 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
25868 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
25869 g_variant_unref (variant);
25870 num_changes++;
25871 }
25872 }
25873 if (num_changes > 0)
25874 {
25875 GList *connections, *ll;
25876 GVariant *signal_variant;
25877 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Led",
25878 &builder, &invalidated_builder));
25879 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25880 for (ll = connections; ll != NULL; ll = ll->next)
25881 {
25882 GDBusConnection *connection = ll->data;
25883
25884 g_dbus_connection_emit_signal (connection,
25885 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
25886 "org.freedesktop.DBus.Properties",
25887 "PropertiesChanged",
25888 signal_variant,
25889 NULL);
25890 }
25891 g_variant_unref (signal_variant);
25892 g_list_free_full (connections, g_object_unref);
25893 }
25894 else
25895 {
25896 g_variant_builder_clear (&builder);
25897 g_variant_builder_clear (&invalidated_builder);
25898 }
25899 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
25900 skeleton->priv->changed_properties = NULL;
25901 skeleton->priv->changed_properties_idle_source = NULL;
25902 g_mutex_unlock (&skeleton->priv->lock);
25903 return FALSE;
25904}
25905
25906static void
25907_led_schedule_emit_changed (LedSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
25908{
25909 ChangedProperty *cp;
25910 GList *l;
25911 cp = NULL;
25912 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
25913 {
25914 ChangedProperty *i_cp = l->data;
25915 if (i_cp->info == info)
25916 {
25917 cp = i_cp;
25918 break;
25919 }
25920 }
25921 if (cp == NULL)
25922 {
25923 cp = g_new0 (ChangedProperty, 1);
25924 cp->prop_id = prop_id;
25925 cp->info = info;
25926 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
25927 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
25928 g_value_copy (orig_value, &cp->orig_value);
25929 }
25930}
25931
25932static void
25933led_skeleton_notify (GObject *object,
25934 GParamSpec *pspec G_GNUC_UNUSED)
25935{
25936 LedSkeleton *skeleton = LED_SKELETON (object);
25937 g_mutex_lock (&skeleton->priv->lock);
25938 if (skeleton->priv->changed_properties != NULL &&
25939 skeleton->priv->changed_properties_idle_source == NULL)
25940 {
25941 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
25942 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
25943 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _led_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
25944 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
25945 g_source_unref (skeleton->priv->changed_properties_idle_source);
25946 }
25947 g_mutex_unlock (&skeleton->priv->lock);
25948}
25949
25950static void
25951led_skeleton_set_property (GObject *object,
25952 guint prop_id,
25953 const GValue *value,
25954 GParamSpec *pspec)
25955{
25956 LedSkeleton *skeleton = LED_SKELETON (object);
25957 g_assert (prop_id != 0 && prop_id - 1 < 2);
25958 g_mutex_lock (&skeleton->priv->lock);
25959 g_object_freeze_notify (object);
25960 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
25961 {
25962 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
25963 _led_schedule_emit_changed (skeleton, _led_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
25964 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
25965 g_object_notify_by_pspec (object, pspec);
25966 }
25967 g_mutex_unlock (&skeleton->priv->lock);
25968 g_object_thaw_notify (object);
25969}
25970
25971static void
25972led_skeleton_init (LedSkeleton *skeleton)
25973{
25974#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
25975 skeleton->priv = led_skeleton_get_instance_private (skeleton);
25976#else
25977 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_LED_SKELETON, LedSkeletonPrivate);
25978#endif
25979
25980 g_mutex_init (&skeleton->priv->lock);
25981 skeleton->priv->context = g_main_context_ref_thread_default ();
25982 skeleton->priv->properties = g_new0 (GValue, 2);
25983 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
25984 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
25985}
25986
25987static gint
25988led_skeleton_get_color (Led *object)
25989{
25990 LedSkeleton *skeleton = LED_SKELETON (object);
25991 gint value;
25992 g_mutex_lock (&skeleton->priv->lock);
25993 value = g_value_get_int (&(skeleton->priv->properties[0]));
25994 g_mutex_unlock (&skeleton->priv->lock);
25995 return value;
25996}
25997
25998static const gchar *
25999led_skeleton_get_function (Led *object)
26000{
26001 LedSkeleton *skeleton = LED_SKELETON (object);
26002 const gchar *value;
26003 g_mutex_lock (&skeleton->priv->lock);
26004 value = g_value_get_string (&(skeleton->priv->properties[1]));
26005 g_mutex_unlock (&skeleton->priv->lock);
26006 return value;
26007}
26008
26009static void
26010led_skeleton_class_init (LedSkeletonClass *klass)
26011{
26012 GObjectClass *gobject_class;
26013 GDBusInterfaceSkeletonClass *skeleton_class;
26014
26015 gobject_class = G_OBJECT_CLASS (klass);
26016 gobject_class->finalize = led_skeleton_finalize;
26017 gobject_class->get_property = led_skeleton_get_property;
26018 gobject_class->set_property = led_skeleton_set_property;
26019 gobject_class->notify = led_skeleton_notify;
26020
26021
26022 led_override_properties (gobject_class, 1);
26023
26024 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
26025 skeleton_class->get_info = led_skeleton_dbus_interface_get_info;
26026 skeleton_class->get_properties = led_skeleton_dbus_interface_get_properties;
26027 skeleton_class->flush = led_skeleton_dbus_interface_flush;
26028 skeleton_class->get_vtable = led_skeleton_dbus_interface_get_vtable;
26029
26030#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
26031 g_type_class_add_private (klass, sizeof (LedSkeletonPrivate));
26032#endif
26033}
26034
26035static void
26036led_skeleton_iface_init (LedIface *iface)
26037{
26038 iface->get_color = led_skeleton_get_color;
26039 iface->get_function = led_skeleton_get_function;
26040}
26041
26042/**
26043 * led_skeleton_new:
26044 *
26045 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
26046 *
26047 * Returns: (transfer full) (type LedSkeleton): The skeleton object.
26048 */
26049Led *
26050led_skeleton_new (void)
26051{
26052 return LED (g_object_new (TYPE_LED_SKELETON, NULL));
26053}
26054
26055/* ------------------------------------------------------------------------
Norman Jamesdbcffbd2015-10-06 16:53:06 -050026056 * Code for interface org.openbmc.HostIpmi
26057 * ------------------------------------------------------------------------
26058 */
26059
26060/**
26061 * SECTION:HostIpmi
26062 * @title: HostIpmi
26063 * @short_description: Generated C code for the org.openbmc.HostIpmi D-Bus interface
26064 *
26065 * 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.
26066 */
26067
26068/* ---- Introspection data for org.openbmc.HostIpmi ---- */
26069
26070static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_seq =
26071{
26072 {
26073 -1,
26074 (gchar *) "seq",
26075 (gchar *) "y",
26076 NULL
26077 },
26078 FALSE
26079};
26080
26081static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_netfn =
26082{
26083 {
26084 -1,
26085 (gchar *) "netfn",
26086 (gchar *) "y",
26087 NULL
26088 },
26089 FALSE
26090};
26091
26092static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_cmd =
26093{
26094 {
26095 -1,
26096 (gchar *) "cmd",
26097 (gchar *) "y",
26098 NULL
26099 },
26100 FALSE
26101};
26102
26103static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_data =
26104{
26105 {
26106 -1,
26107 (gchar *) "data",
26108 (gchar *) "ay",
26109 NULL
26110 },
26111 FALSE
26112};
26113
26114static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_IN_ARG_pointers[] =
26115{
26116 &_host_ipmi_method_info_send_message_IN_ARG_seq,
26117 &_host_ipmi_method_info_send_message_IN_ARG_netfn,
26118 &_host_ipmi_method_info_send_message_IN_ARG_cmd,
26119 &_host_ipmi_method_info_send_message_IN_ARG_data,
26120 NULL
26121};
26122
26123static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4 =
26124{
26125 {
26126 -1,
26127 (gchar *) "unnamed_arg4",
26128 (gchar *) "x",
26129 NULL
26130 },
26131 FALSE
26132};
26133
26134static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_OUT_ARG_pointers[] =
26135{
26136 &_host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4,
26137 NULL
26138};
26139
26140static const _ExtendedGDBusMethodInfo _host_ipmi_method_info_send_message =
26141{
26142 {
26143 -1,
26144 (gchar *) "sendMessage",
26145 (GDBusArgInfo **) &_host_ipmi_method_info_send_message_IN_ARG_pointers,
26146 (GDBusArgInfo **) &_host_ipmi_method_info_send_message_OUT_ARG_pointers,
26147 NULL
26148 },
26149 "handle-send-message",
26150 FALSE
26151};
26152
26153static const _ExtendedGDBusMethodInfo * const _host_ipmi_method_info_pointers[] =
26154{
26155 &_host_ipmi_method_info_send_message,
26156 NULL
26157};
26158
26159static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_seq =
26160{
26161 {
26162 -1,
26163 (gchar *) "seq",
26164 (gchar *) "y",
26165 NULL
26166 },
26167 FALSE
26168};
26169
26170static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_netfn =
26171{
26172 {
26173 -1,
26174 (gchar *) "netfn",
26175 (gchar *) "y",
26176 NULL
26177 },
26178 FALSE
26179};
26180
26181static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_cmd =
26182{
26183 {
26184 -1,
26185 (gchar *) "cmd",
26186 (gchar *) "y",
26187 NULL
26188 },
26189 FALSE
26190};
26191
26192static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_data =
26193{
26194 {
26195 -1,
26196 (gchar *) "data",
26197 (gchar *) "ay",
26198 NULL
26199 },
26200 FALSE
26201};
26202
26203static const _ExtendedGDBusArgInfo * const _host_ipmi_signal_info_received_message_ARG_pointers[] =
26204{
26205 &_host_ipmi_signal_info_received_message_ARG_seq,
26206 &_host_ipmi_signal_info_received_message_ARG_netfn,
26207 &_host_ipmi_signal_info_received_message_ARG_cmd,
26208 &_host_ipmi_signal_info_received_message_ARG_data,
26209 NULL
26210};
26211
26212static const _ExtendedGDBusSignalInfo _host_ipmi_signal_info_received_message =
26213{
26214 {
26215 -1,
26216 (gchar *) "ReceivedMessage",
26217 (GDBusArgInfo **) &_host_ipmi_signal_info_received_message_ARG_pointers,
26218 NULL
26219 },
26220 "received-message"
26221};
26222
26223static const _ExtendedGDBusSignalInfo * const _host_ipmi_signal_info_pointers[] =
26224{
26225 &_host_ipmi_signal_info_received_message,
26226 NULL
26227};
26228
26229static const _ExtendedGDBusInterfaceInfo _host_ipmi_interface_info =
26230{
26231 {
26232 -1,
26233 (gchar *) "org.openbmc.HostIpmi",
26234 (GDBusMethodInfo **) &_host_ipmi_method_info_pointers,
26235 (GDBusSignalInfo **) &_host_ipmi_signal_info_pointers,
26236 NULL,
26237 NULL
26238 },
26239 "host-ipmi",
26240};
26241
26242
26243/**
26244 * host_ipmi_interface_info:
26245 *
26246 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> D-Bus interface.
26247 *
26248 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
26249 */
26250GDBusInterfaceInfo *
26251host_ipmi_interface_info (void)
26252{
26253 return (GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct;
26254}
26255
26256/**
26257 * host_ipmi_override_properties:
26258 * @klass: The class structure for a #GObject<!-- -->-derived class.
26259 * @property_id_begin: The property id to assign to the first overridden property.
26260 *
26261 * Overrides all #GObject properties in the #HostIpmi interface for a concrete class.
26262 * The properties are overridden in the order they are defined.
26263 *
26264 * Returns: The last property id.
26265 */
26266guint
26267host_ipmi_override_properties (GObjectClass *klass, guint property_id_begin)
26268{
26269 return property_id_begin - 1;
26270}
26271
26272
26273
26274/**
26275 * HostIpmi:
26276 *
26277 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
26278 */
26279
26280/**
26281 * HostIpmiIface:
26282 * @parent_iface: The parent interface.
26283 * @handle_send_message: Handler for the #HostIpmi::handle-send-message signal.
26284 * @received_message: Handler for the #HostIpmi::received-message signal.
26285 *
26286 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
26287 */
26288
26289typedef HostIpmiIface HostIpmiInterface;
26290G_DEFINE_INTERFACE (HostIpmi, host_ipmi, G_TYPE_OBJECT);
26291
26292static void
26293host_ipmi_default_init (HostIpmiIface *iface)
26294{
26295 /* GObject signals for incoming D-Bus method calls: */
26296 /**
26297 * HostIpmi::handle-send-message:
26298 * @object: A #HostIpmi.
26299 * @invocation: A #GDBusMethodInvocation.
26300 * @arg_seq: Argument passed by remote caller.
26301 * @arg_netfn: Argument passed by remote caller.
26302 * @arg_cmd: Argument passed by remote caller.
26303 * @arg_data: Argument passed by remote caller.
26304 *
26305 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method.
26306 *
26307 * 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.
26308 *
26309 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
26310 */
26311 g_signal_new ("handle-send-message",
26312 G_TYPE_FROM_INTERFACE (iface),
26313 G_SIGNAL_RUN_LAST,
26314 G_STRUCT_OFFSET (HostIpmiIface, handle_send_message),
26315 g_signal_accumulator_true_handled,
26316 NULL,
26317 g_cclosure_marshal_generic,
26318 G_TYPE_BOOLEAN,
26319 5,
26320 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING);
26321
26322 /* GObject signals for received D-Bus signals: */
26323 /**
26324 * HostIpmi::received-message:
26325 * @object: A #HostIpmi.
26326 * @arg_seq: Argument.
26327 * @arg_netfn: Argument.
26328 * @arg_cmd: Argument.
26329 * @arg_data: Argument.
26330 *
26331 * 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.
26332 *
26333 * 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.
26334 */
26335 g_signal_new ("received-message",
26336 G_TYPE_FROM_INTERFACE (iface),
26337 G_SIGNAL_RUN_LAST,
26338 G_STRUCT_OFFSET (HostIpmiIface, received_message),
26339 NULL,
26340 NULL,
26341 g_cclosure_marshal_generic,
26342 G_TYPE_NONE,
26343 4, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING);
26344
26345}
26346
26347/**
26348 * host_ipmi_emit_received_message:
26349 * @object: A #HostIpmi.
26350 * @arg_seq: Argument to pass with the signal.
26351 * @arg_netfn: Argument to pass with the signal.
26352 * @arg_cmd: Argument to pass with the signal.
26353 * @arg_data: Argument to pass with the signal.
26354 *
26355 * Emits the <link linkend="gdbus-signal-org-openbmc-HostIpmi.ReceivedMessage">"ReceivedMessage"</link> D-Bus signal.
26356 */
26357void
26358host_ipmi_emit_received_message (
26359 HostIpmi *object,
26360 guchar arg_seq,
26361 guchar arg_netfn,
26362 guchar arg_cmd,
26363 const gchar *arg_data)
26364{
26365 g_signal_emit_by_name (object, "received-message", arg_seq, arg_netfn, arg_cmd, arg_data);
26366}
26367
26368/**
26369 * host_ipmi_call_send_message:
26370 * @proxy: A #HostIpmiProxy.
26371 * @arg_seq: Argument to pass with the method invocation.
26372 * @arg_netfn: Argument to pass with the method invocation.
26373 * @arg_cmd: Argument to pass with the method invocation.
26374 * @arg_data: Argument to pass with the method invocation.
26375 * @cancellable: (allow-none): A #GCancellable or %NULL.
26376 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
26377 * @user_data: User data to pass to @callback.
26378 *
26379 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method on @proxy.
26380 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
26381 * You can then call host_ipmi_call_send_message_finish() to get the result of the operation.
26382 *
26383 * See host_ipmi_call_send_message_sync() for the synchronous, blocking version of this method.
26384 */
26385void
26386host_ipmi_call_send_message (
26387 HostIpmi *proxy,
26388 guchar arg_seq,
26389 guchar arg_netfn,
26390 guchar arg_cmd,
26391 const gchar *arg_data,
26392 GCancellable *cancellable,
26393 GAsyncReadyCallback callback,
26394 gpointer user_data)
26395{
26396 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
26397 "sendMessage",
26398 g_variant_new ("(yyy^ay)",
26399 arg_seq,
26400 arg_netfn,
26401 arg_cmd,
26402 arg_data),
26403 G_DBUS_CALL_FLAGS_NONE,
26404 -1,
26405 cancellable,
26406 callback,
26407 user_data);
26408}
26409
26410/**
26411 * host_ipmi_call_send_message_finish:
26412 * @proxy: A #HostIpmiProxy.
26413 * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore.
26414 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_call_send_message().
26415 * @error: Return location for error or %NULL.
26416 *
26417 * Finishes an operation started with host_ipmi_call_send_message().
26418 *
26419 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26420 */
26421gboolean
26422host_ipmi_call_send_message_finish (
26423 HostIpmi *proxy,
26424 gint64 *out_unnamed_arg4,
26425 GAsyncResult *res,
26426 GError **error)
26427{
26428 GVariant *_ret;
26429 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
26430 if (_ret == NULL)
26431 goto _out;
26432 g_variant_get (_ret,
26433 "(x)",
26434 out_unnamed_arg4);
26435 g_variant_unref (_ret);
26436_out:
26437 return _ret != NULL;
26438}
26439
26440/**
26441 * host_ipmi_call_send_message_sync:
26442 * @proxy: A #HostIpmiProxy.
26443 * @arg_seq: Argument to pass with the method invocation.
26444 * @arg_netfn: Argument to pass with the method invocation.
26445 * @arg_cmd: Argument to pass with the method invocation.
26446 * @arg_data: Argument to pass with the method invocation.
26447 * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore.
26448 * @cancellable: (allow-none): A #GCancellable or %NULL.
26449 * @error: Return location for error or %NULL.
26450 *
26451 * 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.
26452 *
26453 * See host_ipmi_call_send_message() for the asynchronous version of this method.
26454 *
26455 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26456 */
26457gboolean
26458host_ipmi_call_send_message_sync (
26459 HostIpmi *proxy,
26460 guchar arg_seq,
26461 guchar arg_netfn,
26462 guchar arg_cmd,
26463 const gchar *arg_data,
26464 gint64 *out_unnamed_arg4,
26465 GCancellable *cancellable,
26466 GError **error)
26467{
26468 GVariant *_ret;
26469 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
26470 "sendMessage",
26471 g_variant_new ("(yyy^ay)",
26472 arg_seq,
26473 arg_netfn,
26474 arg_cmd,
26475 arg_data),
26476 G_DBUS_CALL_FLAGS_NONE,
26477 -1,
26478 cancellable,
26479 error);
26480 if (_ret == NULL)
26481 goto _out;
26482 g_variant_get (_ret,
26483 "(x)",
26484 out_unnamed_arg4);
26485 g_variant_unref (_ret);
26486_out:
26487 return _ret != NULL;
26488}
26489
26490/**
26491 * host_ipmi_complete_send_message:
26492 * @object: A #HostIpmi.
26493 * @invocation: (transfer full): A #GDBusMethodInvocation.
26494 * @unnamed_arg4: Parameter to return.
26495 *
26496 * 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.
26497 *
26498 * This method will free @invocation, you cannot use it afterwards.
26499 */
26500void
26501host_ipmi_complete_send_message (
26502 HostIpmi *object,
26503 GDBusMethodInvocation *invocation,
26504 gint64 unnamed_arg4)
26505{
26506 g_dbus_method_invocation_return_value (invocation,
26507 g_variant_new ("(x)",
26508 unnamed_arg4));
26509}
26510
26511/* ------------------------------------------------------------------------ */
26512
26513/**
26514 * HostIpmiProxy:
26515 *
26516 * The #HostIpmiProxy structure contains only private data and should only be accessed using the provided API.
26517 */
26518
26519/**
26520 * HostIpmiProxyClass:
26521 * @parent_class: The parent class.
26522 *
26523 * Class structure for #HostIpmiProxy.
26524 */
26525
26526struct _HostIpmiProxyPrivate
26527{
26528 GData *qdata;
26529};
26530
26531static void host_ipmi_proxy_iface_init (HostIpmiIface *iface);
26532
26533#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
26534G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY,
26535 G_ADD_PRIVATE (HostIpmiProxy)
26536 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init));
26537
26538#else
26539G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY,
26540 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init));
26541
26542#endif
26543static void
26544host_ipmi_proxy_finalize (GObject *object)
26545{
26546 HostIpmiProxy *proxy = HOST_IPMI_PROXY (object);
26547 g_datalist_clear (&proxy->priv->qdata);
26548 G_OBJECT_CLASS (host_ipmi_proxy_parent_class)->finalize (object);
26549}
26550
26551static void
26552host_ipmi_proxy_get_property (GObject *object,
26553 guint prop_id,
26554 GValue *value,
26555 GParamSpec *pspec G_GNUC_UNUSED)
26556{
26557}
26558
26559static void
26560host_ipmi_proxy_set_property (GObject *object,
26561 guint prop_id,
26562 const GValue *value,
26563 GParamSpec *pspec G_GNUC_UNUSED)
26564{
26565}
26566
26567static void
26568host_ipmi_proxy_g_signal (GDBusProxy *proxy,
26569 const gchar *sender_name G_GNUC_UNUSED,
26570 const gchar *signal_name,
26571 GVariant *parameters)
26572{
26573 _ExtendedGDBusSignalInfo *info;
26574 GVariantIter iter;
26575 GVariant *child;
26576 GValue *paramv;
26577 guint num_params;
26578 guint n;
26579 guint signal_id;
26580 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, signal_name);
26581 if (info == NULL)
26582 return;
26583 num_params = g_variant_n_children (parameters);
26584 paramv = g_new0 (GValue, num_params + 1);
26585 g_value_init (&paramv[0], TYPE_HOST_IPMI);
26586 g_value_set_object (&paramv[0], proxy);
26587 g_variant_iter_init (&iter, parameters);
26588 n = 1;
26589 while ((child = g_variant_iter_next_value (&iter)) != NULL)
26590 {
26591 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
26592 if (arg_info->use_gvariant)
26593 {
26594 g_value_init (&paramv[n], G_TYPE_VARIANT);
26595 g_value_set_variant (&paramv[n], child);
26596 n++;
26597 }
26598 else
26599 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
26600 g_variant_unref (child);
26601 }
26602 signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI);
26603 g_signal_emitv (paramv, signal_id, 0, NULL);
26604 for (n = 0; n < num_params + 1; n++)
26605 g_value_unset (&paramv[n]);
26606 g_free (paramv);
26607}
26608
26609static void
26610host_ipmi_proxy_g_properties_changed (GDBusProxy *_proxy,
26611 GVariant *changed_properties,
26612 const gchar *const *invalidated_properties)
26613{
26614 HostIpmiProxy *proxy = HOST_IPMI_PROXY (_proxy);
26615 guint n;
26616 const gchar *key;
26617 GVariantIter *iter;
26618 _ExtendedGDBusPropertyInfo *info;
26619 g_variant_get (changed_properties, "a{sv}", &iter);
26620 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
26621 {
26622 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, key);
26623 g_datalist_remove_data (&proxy->priv->qdata, key);
26624 if (info != NULL)
26625 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
26626 }
26627 g_variant_iter_free (iter);
26628 for (n = 0; invalidated_properties[n] != NULL; n++)
26629 {
26630 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, invalidated_properties[n]);
26631 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
26632 if (info != NULL)
26633 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
26634 }
26635}
26636
26637static void
26638host_ipmi_proxy_init (HostIpmiProxy *proxy)
26639{
26640#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
26641 proxy->priv = host_ipmi_proxy_get_instance_private (proxy);
26642#else
26643 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_HOST_IPMI_PROXY, HostIpmiProxyPrivate);
26644#endif
26645
26646 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), host_ipmi_interface_info ());
26647}
26648
26649static void
26650host_ipmi_proxy_class_init (HostIpmiProxyClass *klass)
26651{
26652 GObjectClass *gobject_class;
26653 GDBusProxyClass *proxy_class;
26654
26655 gobject_class = G_OBJECT_CLASS (klass);
26656 gobject_class->finalize = host_ipmi_proxy_finalize;
26657 gobject_class->get_property = host_ipmi_proxy_get_property;
26658 gobject_class->set_property = host_ipmi_proxy_set_property;
26659
26660 proxy_class = G_DBUS_PROXY_CLASS (klass);
26661 proxy_class->g_signal = host_ipmi_proxy_g_signal;
26662 proxy_class->g_properties_changed = host_ipmi_proxy_g_properties_changed;
26663
26664#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
26665 g_type_class_add_private (klass, sizeof (HostIpmiProxyPrivate));
26666#endif
26667}
26668
26669static void
26670host_ipmi_proxy_iface_init (HostIpmiIface *iface)
26671{
26672}
26673
26674/**
26675 * host_ipmi_proxy_new:
26676 * @connection: A #GDBusConnection.
26677 * @flags: Flags from the #GDBusProxyFlags enumeration.
26678 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
26679 * @object_path: An object path.
26680 * @cancellable: (allow-none): A #GCancellable or %NULL.
26681 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
26682 * @user_data: User data to pass to @callback.
26683 *
26684 * 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.
26685 *
26686 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
26687 * You can then call host_ipmi_proxy_new_finish() to get the result of the operation.
26688 *
26689 * See host_ipmi_proxy_new_sync() for the synchronous, blocking version of this constructor.
26690 */
26691void
26692host_ipmi_proxy_new (
26693 GDBusConnection *connection,
26694 GDBusProxyFlags flags,
26695 const gchar *name,
26696 const gchar *object_path,
26697 GCancellable *cancellable,
26698 GAsyncReadyCallback callback,
26699 gpointer user_data)
26700{
26701 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);
26702}
26703
26704/**
26705 * host_ipmi_proxy_new_finish:
26706 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new().
26707 * @error: Return location for error or %NULL
26708 *
26709 * Finishes an operation started with host_ipmi_proxy_new().
26710 *
26711 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
26712 */
26713HostIpmi *
26714host_ipmi_proxy_new_finish (
26715 GAsyncResult *res,
26716 GError **error)
26717{
26718 GObject *ret;
26719 GObject *source_object;
26720 source_object = g_async_result_get_source_object (res);
26721 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
26722 g_object_unref (source_object);
26723 if (ret != NULL)
26724 return HOST_IPMI (ret);
26725 else
26726 return NULL;
26727}
26728
26729/**
26730 * host_ipmi_proxy_new_sync:
26731 * @connection: A #GDBusConnection.
26732 * @flags: Flags from the #GDBusProxyFlags enumeration.
26733 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
26734 * @object_path: An object path.
26735 * @cancellable: (allow-none): A #GCancellable or %NULL.
26736 * @error: Return location for error or %NULL
26737 *
26738 * 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.
26739 *
26740 * The calling thread is blocked until a reply is received.
26741 *
26742 * See host_ipmi_proxy_new() for the asynchronous version of this constructor.
26743 *
26744 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
26745 */
26746HostIpmi *
26747host_ipmi_proxy_new_sync (
26748 GDBusConnection *connection,
26749 GDBusProxyFlags flags,
26750 const gchar *name,
26751 const gchar *object_path,
26752 GCancellable *cancellable,
26753 GError **error)
26754{
26755 GInitable *ret;
26756 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);
26757 if (ret != NULL)
26758 return HOST_IPMI (ret);
26759 else
26760 return NULL;
26761}
26762
26763
26764/**
26765 * host_ipmi_proxy_new_for_bus:
26766 * @bus_type: A #GBusType.
26767 * @flags: Flags from the #GDBusProxyFlags enumeration.
26768 * @name: A bus name (well-known or unique).
26769 * @object_path: An object path.
26770 * @cancellable: (allow-none): A #GCancellable or %NULL.
26771 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
26772 * @user_data: User data to pass to @callback.
26773 *
26774 * Like host_ipmi_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
26775 *
26776 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
26777 * You can then call host_ipmi_proxy_new_for_bus_finish() to get the result of the operation.
26778 *
26779 * See host_ipmi_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
26780 */
26781void
26782host_ipmi_proxy_new_for_bus (
26783 GBusType bus_type,
26784 GDBusProxyFlags flags,
26785 const gchar *name,
26786 const gchar *object_path,
26787 GCancellable *cancellable,
26788 GAsyncReadyCallback callback,
26789 gpointer user_data)
26790{
26791 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);
26792}
26793
26794/**
26795 * host_ipmi_proxy_new_for_bus_finish:
26796 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new_for_bus().
26797 * @error: Return location for error or %NULL
26798 *
26799 * Finishes an operation started with host_ipmi_proxy_new_for_bus().
26800 *
26801 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
26802 */
26803HostIpmi *
26804host_ipmi_proxy_new_for_bus_finish (
26805 GAsyncResult *res,
26806 GError **error)
26807{
26808 GObject *ret;
26809 GObject *source_object;
26810 source_object = g_async_result_get_source_object (res);
26811 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
26812 g_object_unref (source_object);
26813 if (ret != NULL)
26814 return HOST_IPMI (ret);
26815 else
26816 return NULL;
26817}
26818
26819/**
26820 * host_ipmi_proxy_new_for_bus_sync:
26821 * @bus_type: A #GBusType.
26822 * @flags: Flags from the #GDBusProxyFlags enumeration.
26823 * @name: A bus name (well-known or unique).
26824 * @object_path: An object path.
26825 * @cancellable: (allow-none): A #GCancellable or %NULL.
26826 * @error: Return location for error or %NULL
26827 *
26828 * Like host_ipmi_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
26829 *
26830 * The calling thread is blocked until a reply is received.
26831 *
26832 * See host_ipmi_proxy_new_for_bus() for the asynchronous version of this constructor.
26833 *
26834 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
26835 */
26836HostIpmi *
26837host_ipmi_proxy_new_for_bus_sync (
26838 GBusType bus_type,
26839 GDBusProxyFlags flags,
26840 const gchar *name,
26841 const gchar *object_path,
26842 GCancellable *cancellable,
26843 GError **error)
26844{
26845 GInitable *ret;
26846 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);
26847 if (ret != NULL)
26848 return HOST_IPMI (ret);
26849 else
26850 return NULL;
26851}
26852
26853
26854/* ------------------------------------------------------------------------ */
26855
26856/**
26857 * HostIpmiSkeleton:
26858 *
26859 * The #HostIpmiSkeleton structure contains only private data and should only be accessed using the provided API.
26860 */
26861
26862/**
26863 * HostIpmiSkeletonClass:
26864 * @parent_class: The parent class.
26865 *
26866 * Class structure for #HostIpmiSkeleton.
26867 */
26868
26869struct _HostIpmiSkeletonPrivate
26870{
26871 GValue *properties;
26872 GList *changed_properties;
26873 GSource *changed_properties_idle_source;
26874 GMainContext *context;
26875 GMutex lock;
26876};
26877
26878static void
26879_host_ipmi_skeleton_handle_method_call (
26880 GDBusConnection *connection G_GNUC_UNUSED,
26881 const gchar *sender G_GNUC_UNUSED,
26882 const gchar *object_path G_GNUC_UNUSED,
26883 const gchar *interface_name,
26884 const gchar *method_name,
26885 GVariant *parameters,
26886 GDBusMethodInvocation *invocation,
26887 gpointer user_data)
26888{
26889 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
26890 _ExtendedGDBusMethodInfo *info;
26891 GVariantIter iter;
26892 GVariant *child;
26893 GValue *paramv;
26894 guint num_params;
26895 guint num_extra;
26896 guint n;
26897 guint signal_id;
26898 GValue return_value = G_VALUE_INIT;
26899 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
26900 g_assert (info != NULL);
26901 num_params = g_variant_n_children (parameters);
26902 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
26903 n = 0;
26904 g_value_init (&paramv[n], TYPE_HOST_IPMI);
26905 g_value_set_object (&paramv[n++], skeleton);
26906 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
26907 g_value_set_object (&paramv[n++], invocation);
26908 if (info->pass_fdlist)
26909 {
26910#ifdef G_OS_UNIX
26911 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
26912 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
26913#else
26914 g_assert_not_reached ();
26915#endif
26916 }
26917 g_variant_iter_init (&iter, parameters);
26918 while ((child = g_variant_iter_next_value (&iter)) != NULL)
26919 {
26920 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
26921 if (arg_info->use_gvariant)
26922 {
26923 g_value_init (&paramv[n], G_TYPE_VARIANT);
26924 g_value_set_variant (&paramv[n], child);
26925 n++;
26926 }
26927 else
26928 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
26929 g_variant_unref (child);
26930 }
26931 signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI);
26932 g_value_init (&return_value, G_TYPE_BOOLEAN);
26933 g_signal_emitv (paramv, signal_id, 0, &return_value);
26934 if (!g_value_get_boolean (&return_value))
26935 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);
26936 g_value_unset (&return_value);
26937 for (n = 0; n < num_params + num_extra; n++)
26938 g_value_unset (&paramv[n]);
26939 g_free (paramv);
26940}
26941
26942static GVariant *
26943_host_ipmi_skeleton_handle_get_property (
26944 GDBusConnection *connection G_GNUC_UNUSED,
26945 const gchar *sender G_GNUC_UNUSED,
26946 const gchar *object_path G_GNUC_UNUSED,
26947 const gchar *interface_name G_GNUC_UNUSED,
26948 const gchar *property_name,
26949 GError **error,
26950 gpointer user_data)
26951{
26952 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
26953 GValue value = G_VALUE_INIT;
26954 GParamSpec *pspec;
26955 _ExtendedGDBusPropertyInfo *info;
26956 GVariant *ret;
26957 ret = NULL;
26958 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name);
26959 g_assert (info != NULL);
26960 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
26961 if (pspec == NULL)
26962 {
26963 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
26964 }
26965 else
26966 {
26967 g_value_init (&value, pspec->value_type);
26968 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
26969 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
26970 g_value_unset (&value);
26971 }
26972 return ret;
26973}
26974
26975static gboolean
26976_host_ipmi_skeleton_handle_set_property (
26977 GDBusConnection *connection G_GNUC_UNUSED,
26978 const gchar *sender G_GNUC_UNUSED,
26979 const gchar *object_path G_GNUC_UNUSED,
26980 const gchar *interface_name G_GNUC_UNUSED,
26981 const gchar *property_name,
26982 GVariant *variant,
26983 GError **error,
26984 gpointer user_data)
26985{
26986 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
26987 GValue value = G_VALUE_INIT;
26988 GParamSpec *pspec;
26989 _ExtendedGDBusPropertyInfo *info;
26990 gboolean ret;
26991 ret = FALSE;
26992 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name);
26993 g_assert (info != NULL);
26994 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
26995 if (pspec == NULL)
26996 {
26997 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
26998 }
26999 else
27000 {
27001 if (info->use_gvariant)
27002 g_value_set_variant (&value, variant);
27003 else
27004 g_dbus_gvariant_to_gvalue (variant, &value);
27005 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
27006 g_value_unset (&value);
27007 ret = TRUE;
27008 }
27009 return ret;
27010}
27011
27012static const GDBusInterfaceVTable _host_ipmi_skeleton_vtable =
27013{
27014 _host_ipmi_skeleton_handle_method_call,
27015 _host_ipmi_skeleton_handle_get_property,
27016 _host_ipmi_skeleton_handle_set_property,
27017 {NULL}
27018};
27019
27020static GDBusInterfaceInfo *
27021host_ipmi_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
27022{
27023 return host_ipmi_interface_info ();
27024}
27025
27026static GDBusInterfaceVTable *
27027host_ipmi_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
27028{
27029 return (GDBusInterfaceVTable *) &_host_ipmi_skeleton_vtable;
27030}
27031
27032static GVariant *
27033host_ipmi_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
27034{
27035 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (_skeleton);
27036
27037 GVariantBuilder builder;
27038 guint n;
27039 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
27040 if (_host_ipmi_interface_info.parent_struct.properties == NULL)
27041 goto out;
27042 for (n = 0; _host_ipmi_interface_info.parent_struct.properties[n] != NULL; n++)
27043 {
27044 GDBusPropertyInfo *info = _host_ipmi_interface_info.parent_struct.properties[n];
27045 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
27046 {
27047 GVariant *value;
27048 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);
27049 if (value != NULL)
27050 {
27051 g_variant_take_ref (value);
27052 g_variant_builder_add (&builder, "{sv}", info->name, value);
27053 g_variant_unref (value);
27054 }
27055 }
27056 }
27057out:
27058 return g_variant_builder_end (&builder);
27059}
27060
27061static void
27062host_ipmi_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
27063{
27064}
27065
27066static void
27067_host_ipmi_on_signal_received_message (
27068 HostIpmi *object,
27069 guchar arg_seq,
27070 guchar arg_netfn,
27071 guchar arg_cmd,
27072 const gchar *arg_data)
27073{
27074 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object);
27075
27076 GList *connections, *l;
27077 GVariant *signal_variant;
27078 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
27079
27080 signal_variant = g_variant_ref_sink (g_variant_new ("(yyy^ay)",
27081 arg_seq,
27082 arg_netfn,
27083 arg_cmd,
27084 arg_data));
27085 for (l = connections; l != NULL; l = l->next)
27086 {
27087 GDBusConnection *connection = l->data;
27088 g_dbus_connection_emit_signal (connection,
27089 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.HostIpmi", "ReceivedMessage",
27090 signal_variant, NULL);
27091 }
27092 g_variant_unref (signal_variant);
27093 g_list_free_full (connections, g_object_unref);
27094}
27095
27096static void host_ipmi_skeleton_iface_init (HostIpmiIface *iface);
27097#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
27098G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
27099 G_ADD_PRIVATE (HostIpmiSkeleton)
27100 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init));
27101
27102#else
27103G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
27104 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init));
27105
27106#endif
27107static void
27108host_ipmi_skeleton_finalize (GObject *object)
27109{
27110 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object);
27111 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
27112 if (skeleton->priv->changed_properties_idle_source != NULL)
27113 g_source_destroy (skeleton->priv->changed_properties_idle_source);
27114 g_main_context_unref (skeleton->priv->context);
27115 g_mutex_clear (&skeleton->priv->lock);
27116 G_OBJECT_CLASS (host_ipmi_skeleton_parent_class)->finalize (object);
27117}
27118
27119static void
27120host_ipmi_skeleton_init (HostIpmiSkeleton *skeleton)
27121{
27122#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
27123 skeleton->priv = host_ipmi_skeleton_get_instance_private (skeleton);
27124#else
27125 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_HOST_IPMI_SKELETON, HostIpmiSkeletonPrivate);
27126#endif
27127
27128 g_mutex_init (&skeleton->priv->lock);
27129 skeleton->priv->context = g_main_context_ref_thread_default ();
27130}
27131
27132static void
27133host_ipmi_skeleton_class_init (HostIpmiSkeletonClass *klass)
27134{
27135 GObjectClass *gobject_class;
27136 GDBusInterfaceSkeletonClass *skeleton_class;
27137
27138 gobject_class = G_OBJECT_CLASS (klass);
27139 gobject_class->finalize = host_ipmi_skeleton_finalize;
27140
27141 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
27142 skeleton_class->get_info = host_ipmi_skeleton_dbus_interface_get_info;
27143 skeleton_class->get_properties = host_ipmi_skeleton_dbus_interface_get_properties;
27144 skeleton_class->flush = host_ipmi_skeleton_dbus_interface_flush;
27145 skeleton_class->get_vtable = host_ipmi_skeleton_dbus_interface_get_vtable;
27146
27147#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
27148 g_type_class_add_private (klass, sizeof (HostIpmiSkeletonPrivate));
27149#endif
27150}
27151
27152static void
27153host_ipmi_skeleton_iface_init (HostIpmiIface *iface)
27154{
27155 iface->received_message = _host_ipmi_on_signal_received_message;
27156}
27157
27158/**
27159 * host_ipmi_skeleton_new:
27160 *
27161 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
27162 *
27163 * Returns: (transfer full) (type HostIpmiSkeleton): The skeleton object.
27164 */
27165HostIpmi *
27166host_ipmi_skeleton_new (void)
27167{
27168 return HOST_IPMI (g_object_new (TYPE_HOST_IPMI_SKELETON, NULL));
27169}
27170
27171/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050027172 * Code for Object, ObjectProxy and ObjectSkeleton
27173 * ------------------------------------------------------------------------
27174 */
27175
27176/**
27177 * SECTION:Object
27178 * @title: Object
27179 * @short_description: Specialized GDBusObject types
27180 *
27181 * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
27182 */
27183
27184/**
27185 * Object:
27186 *
27187 * The #Object type is a specialized container of interfaces.
27188 */
27189
27190/**
27191 * ObjectIface:
27192 * @parent_iface: The parent interface.
27193 *
27194 * Virtual table for the #Object interface.
27195 */
27196
27197typedef ObjectIface ObjectInterface;
27198G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));
27199
27200static void
27201object_default_init (ObjectIface *iface)
27202{
27203 /**
Norman James362a80f2015-09-14 14:04:39 -050027204 * Object:fan:
27205 *
27206 * 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.
27207 *
27208 * Connect to the #GObject::notify signal to get informed of property changes.
27209 */
27210 g_object_interface_install_property (iface, g_param_spec_object ("fan", "fan", "fan", TYPE_FAN, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
27211
27212 /**
27213 * Object:sensor-value:
27214 *
27215 * 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.
27216 *
27217 * Connect to the #GObject::notify signal to get informed of property changes.
27218 */
27219 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));
27220
27221 /**
27222 * Object:sensor-threshold:
27223 *
27224 * 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.
27225 *
27226 * Connect to the #GObject::notify signal to get informed of property changes.
27227 */
27228 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));
27229
27230 /**
27231 * Object:sensor-i2c:
27232 *
27233 * 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.
27234 *
27235 * Connect to the #GObject::notify signal to get informed of property changes.
27236 */
27237 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));
27238
27239 /**
27240 * Object:sensor-match:
27241 *
27242 * 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.
27243 *
27244 * Connect to the #GObject::notify signal to get informed of property changes.
27245 */
27246 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));
27247
27248 /**
27249 * Object:process:
27250 *
27251 * 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.
27252 *
27253 * Connect to the #GObject::notify signal to get informed of property changes.
27254 */
27255 g_object_interface_install_property (iface, g_param_spec_object ("process", "process", "process", TYPE_PROCESS, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
27256
27257 /**
Norman James18998182015-10-11 21:54:53 -050027258 * Object:shared-resource:
27259 *
27260 * 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.
27261 *
27262 * Connect to the #GObject::notify signal to get informed of property changes.
27263 */
27264 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));
27265
27266 /**
Norman James362a80f2015-09-14 14:04:39 -050027267 * Object:control:
27268 *
27269 * 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.
27270 *
27271 * Connect to the #GObject::notify signal to get informed of property changes.
27272 */
27273 g_object_interface_install_property (iface, g_param_spec_object ("control", "control", "control", TYPE_CONTROL, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
27274
27275 /**
27276 * Object:control-bmc:
27277 *
27278 * 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.
27279 *
27280 * Connect to the #GObject::notify signal to get informed of property changes.
27281 */
27282 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));
27283
27284 /**
27285 * Object:control-host:
27286 *
27287 * 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.
27288 *
27289 * Connect to the #GObject::notify signal to get informed of property changes.
27290 */
27291 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));
27292
27293 /**
27294 * Object:control-power:
27295 *
27296 * 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.
27297 *
27298 * Connect to the #GObject::notify signal to get informed of property changes.
27299 */
27300 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));
27301
27302 /**
27303 * Object:watchdog:
27304 *
27305 * 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.
27306 *
27307 * Connect to the #GObject::notify signal to get informed of property changes.
27308 */
27309 g_object_interface_install_property (iface, g_param_spec_object ("watchdog", "watchdog", "watchdog", TYPE_WATCHDOG, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
27310
27311 /**
27312 * Object:event-log:
27313 *
27314 * 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.
27315 *
27316 * Connect to the #GObject::notify signal to get informed of property changes.
27317 */
27318 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));
27319
27320 /**
27321 * Object:flash:
27322 *
27323 * 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.
27324 *
27325 * Connect to the #GObject::notify signal to get informed of property changes.
27326 */
27327 g_object_interface_install_property (iface, g_param_spec_object ("flash", "flash", "flash", TYPE_FLASH, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
27328
27329 /**
Norman James18998182015-10-11 21:54:53 -050027330 * Object:flash-control:
27331 *
27332 * 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.
27333 *
27334 * Connect to the #GObject::notify signal to get informed of property changes.
27335 */
27336 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));
27337
27338 /**
Norman James362a80f2015-09-14 14:04:39 -050027339 * Object:button:
27340 *
27341 * 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.
27342 *
27343 * Connect to the #GObject::notify signal to get informed of property changes.
27344 */
27345 g_object_interface_install_property (iface, g_param_spec_object ("button", "button", "button", TYPE_BUTTON, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
27346
27347 /**
27348 * Object:led:
27349 *
27350 * 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.
27351 *
27352 * Connect to the #GObject::notify signal to get informed of property changes.
27353 */
27354 g_object_interface_install_property (iface, g_param_spec_object ("led", "led", "led", TYPE_LED, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
27355
Norman Jamesdbcffbd2015-10-06 16:53:06 -050027356 /**
27357 * Object:host-ipmi:
27358 *
27359 * 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.
27360 *
27361 * Connect to the #GObject::notify signal to get informed of property changes.
27362 */
27363 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));
27364
Norman James362a80f2015-09-14 14:04:39 -050027365}
27366
27367/**
Norman James362a80f2015-09-14 14:04:39 -050027368 * object_get_fan:
27369 * @object: A #Object.
27370 *
27371 * 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.
27372 *
27373 * Returns: (transfer full): A #Fan that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
27374 */
27375Fan *object_get_fan (Object *object)
27376{
27377 GDBusInterface *ret;
27378 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
27379 if (ret == NULL)
27380 return NULL;
27381 return FAN (ret);
27382}
27383
27384/**
27385 * object_get_sensor_value:
27386 * @object: A #Object.
27387 *
27388 * 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.
27389 *
27390 * Returns: (transfer full): A #SensorValue that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
27391 */
27392SensorValue *object_get_sensor_value (Object *object)
27393{
27394 GDBusInterface *ret;
27395 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
27396 if (ret == NULL)
27397 return NULL;
27398 return SENSOR_VALUE (ret);
27399}
27400
27401/**
27402 * object_get_sensor_threshold:
27403 * @object: A #Object.
27404 *
27405 * 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.
27406 *
27407 * Returns: (transfer full): A #SensorThreshold that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
27408 */
27409SensorThreshold *object_get_sensor_threshold (Object *object)
27410{
27411 GDBusInterface *ret;
27412 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
27413 if (ret == NULL)
27414 return NULL;
27415 return SENSOR_THRESHOLD (ret);
27416}
27417
27418/**
27419 * object_get_sensor_i2c:
27420 * @object: A #Object.
27421 *
27422 * 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.
27423 *
27424 * Returns: (transfer full): A #SensorI2c that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
27425 */
27426SensorI2c *object_get_sensor_i2c (Object *object)
27427{
27428 GDBusInterface *ret;
27429 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
27430 if (ret == NULL)
27431 return NULL;
27432 return SENSOR_I2C (ret);
27433}
27434
27435/**
27436 * object_get_sensor_match:
27437 * @object: A #Object.
27438 *
27439 * 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.
27440 *
27441 * Returns: (transfer full): A #SensorMatch that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
27442 */
27443SensorMatch *object_get_sensor_match (Object *object)
27444{
27445 GDBusInterface *ret;
27446 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
27447 if (ret == NULL)
27448 return NULL;
27449 return SENSOR_MATCH (ret);
27450}
27451
27452/**
27453 * object_get_process:
27454 * @object: A #Object.
27455 *
27456 * 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.
27457 *
27458 * Returns: (transfer full): A #Process that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
27459 */
27460Process *object_get_process (Object *object)
27461{
27462 GDBusInterface *ret;
27463 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
27464 if (ret == NULL)
27465 return NULL;
27466 return PROCESS (ret);
27467}
27468
27469/**
Norman James18998182015-10-11 21:54:53 -050027470 * object_get_shared_resource:
27471 * @object: A #Object.
27472 *
27473 * 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.
27474 *
27475 * Returns: (transfer full): A #SharedResource that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
27476 */
27477SharedResource *object_get_shared_resource (Object *object)
27478{
27479 GDBusInterface *ret;
27480 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
27481 if (ret == NULL)
27482 return NULL;
27483 return SHARED_RESOURCE (ret);
27484}
27485
27486/**
Norman James362a80f2015-09-14 14:04:39 -050027487 * object_get_control:
27488 * @object: A #Object.
27489 *
27490 * 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.
27491 *
27492 * Returns: (transfer full): A #Control that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
27493 */
27494Control *object_get_control (Object *object)
27495{
27496 GDBusInterface *ret;
27497 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
27498 if (ret == NULL)
27499 return NULL;
27500 return CONTROL (ret);
27501}
27502
27503/**
27504 * object_get_control_bmc:
27505 * @object: A #Object.
27506 *
27507 * 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.
27508 *
27509 * Returns: (transfer full): A #ControlBmc that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
27510 */
27511ControlBmc *object_get_control_bmc (Object *object)
27512{
27513 GDBusInterface *ret;
27514 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
27515 if (ret == NULL)
27516 return NULL;
27517 return CONTROL_BMC (ret);
27518}
27519
27520/**
27521 * object_get_control_host:
27522 * @object: A #Object.
27523 *
27524 * 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.
27525 *
27526 * Returns: (transfer full): A #ControlHost that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
27527 */
27528ControlHost *object_get_control_host (Object *object)
27529{
27530 GDBusInterface *ret;
27531 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
27532 if (ret == NULL)
27533 return NULL;
27534 return CONTROL_HOST (ret);
27535}
27536
27537/**
27538 * object_get_control_power:
27539 * @object: A #Object.
27540 *
27541 * 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.
27542 *
27543 * Returns: (transfer full): A #ControlPower that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
27544 */
27545ControlPower *object_get_control_power (Object *object)
27546{
27547 GDBusInterface *ret;
27548 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
27549 if (ret == NULL)
27550 return NULL;
27551 return CONTROL_POWER (ret);
27552}
27553
27554/**
27555 * object_get_watchdog:
27556 * @object: A #Object.
27557 *
27558 * 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.
27559 *
27560 * Returns: (transfer full): A #Watchdog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
27561 */
27562Watchdog *object_get_watchdog (Object *object)
27563{
27564 GDBusInterface *ret;
27565 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
27566 if (ret == NULL)
27567 return NULL;
27568 return WATCHDOG (ret);
27569}
27570
27571/**
27572 * object_get_event_log:
27573 * @object: A #Object.
27574 *
27575 * 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.
27576 *
27577 * Returns: (transfer full): A #EventLog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
27578 */
27579EventLog *object_get_event_log (Object *object)
27580{
27581 GDBusInterface *ret;
27582 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
27583 if (ret == NULL)
27584 return NULL;
27585 return EVENT_LOG (ret);
27586}
27587
27588/**
27589 * object_get_flash:
27590 * @object: A #Object.
27591 *
27592 * 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.
27593 *
27594 * Returns: (transfer full): A #Flash that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
27595 */
27596Flash *object_get_flash (Object *object)
27597{
27598 GDBusInterface *ret;
27599 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
27600 if (ret == NULL)
27601 return NULL;
27602 return FLASH (ret);
27603}
27604
27605/**
Norman James18998182015-10-11 21:54:53 -050027606 * object_get_flash_control:
27607 * @object: A #Object.
27608 *
27609 * 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.
27610 *
27611 * Returns: (transfer full): A #FlashControl that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
27612 */
27613FlashControl *object_get_flash_control (Object *object)
27614{
27615 GDBusInterface *ret;
27616 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
27617 if (ret == NULL)
27618 return NULL;
27619 return FLASH_CONTROL (ret);
27620}
27621
27622/**
Norman James362a80f2015-09-14 14:04:39 -050027623 * object_get_button:
27624 * @object: A #Object.
27625 *
27626 * 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.
27627 *
27628 * Returns: (transfer full): A #Button that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
27629 */
27630Button *object_get_button (Object *object)
27631{
27632 GDBusInterface *ret;
27633 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
27634 if (ret == NULL)
27635 return NULL;
27636 return BUTTON (ret);
27637}
27638
27639/**
27640 * object_get_led:
27641 * @object: A #Object.
27642 *
27643 * 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.
27644 *
27645 * Returns: (transfer full): A #Led that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
27646 */
27647Led *object_get_led (Object *object)
27648{
27649 GDBusInterface *ret;
27650 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
27651 if (ret == NULL)
27652 return NULL;
27653 return LED (ret);
27654}
27655
Norman Jamesdbcffbd2015-10-06 16:53:06 -050027656/**
27657 * object_get_host_ipmi:
27658 * @object: A #Object.
27659 *
27660 * 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.
27661 *
27662 * Returns: (transfer full): A #HostIpmi that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
27663 */
27664HostIpmi *object_get_host_ipmi (Object *object)
27665{
27666 GDBusInterface *ret;
27667 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
27668 if (ret == NULL)
27669 return NULL;
27670 return HOST_IPMI (ret);
27671}
27672
Norman James362a80f2015-09-14 14:04:39 -050027673
27674/**
Norman James362a80f2015-09-14 14:04:39 -050027675 * object_peek_fan: (skip)
27676 * @object: A #Object.
27677 *
27678 * Like object_get_fan() but doesn't increase the reference count on the returned object.
27679 *
27680 * <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>
27681 *
27682 * 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.
27683 */
27684Fan *object_peek_fan (Object *object)
27685{
27686 GDBusInterface *ret;
27687 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
27688 if (ret == NULL)
27689 return NULL;
27690 g_object_unref (ret);
27691 return FAN (ret);
27692}
27693
27694/**
27695 * object_peek_sensor_value: (skip)
27696 * @object: A #Object.
27697 *
27698 * Like object_get_sensor_value() but doesn't increase the reference count on the returned object.
27699 *
27700 * <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>
27701 *
27702 * 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.
27703 */
27704SensorValue *object_peek_sensor_value (Object *object)
27705{
27706 GDBusInterface *ret;
27707 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
27708 if (ret == NULL)
27709 return NULL;
27710 g_object_unref (ret);
27711 return SENSOR_VALUE (ret);
27712}
27713
27714/**
27715 * object_peek_sensor_threshold: (skip)
27716 * @object: A #Object.
27717 *
27718 * Like object_get_sensor_threshold() but doesn't increase the reference count on the returned object.
27719 *
27720 * <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>
27721 *
27722 * 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.
27723 */
27724SensorThreshold *object_peek_sensor_threshold (Object *object)
27725{
27726 GDBusInterface *ret;
27727 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
27728 if (ret == NULL)
27729 return NULL;
27730 g_object_unref (ret);
27731 return SENSOR_THRESHOLD (ret);
27732}
27733
27734/**
27735 * object_peek_sensor_i2c: (skip)
27736 * @object: A #Object.
27737 *
27738 * Like object_get_sensor_i2c() but doesn't increase the reference count on the returned object.
27739 *
27740 * <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>
27741 *
27742 * 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.
27743 */
27744SensorI2c *object_peek_sensor_i2c (Object *object)
27745{
27746 GDBusInterface *ret;
27747 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
27748 if (ret == NULL)
27749 return NULL;
27750 g_object_unref (ret);
27751 return SENSOR_I2C (ret);
27752}
27753
27754/**
27755 * object_peek_sensor_match: (skip)
27756 * @object: A #Object.
27757 *
27758 * Like object_get_sensor_match() but doesn't increase the reference count on the returned object.
27759 *
27760 * <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>
27761 *
27762 * 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.
27763 */
27764SensorMatch *object_peek_sensor_match (Object *object)
27765{
27766 GDBusInterface *ret;
27767 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
27768 if (ret == NULL)
27769 return NULL;
27770 g_object_unref (ret);
27771 return SENSOR_MATCH (ret);
27772}
27773
27774/**
27775 * object_peek_process: (skip)
27776 * @object: A #Object.
27777 *
27778 * Like object_get_process() but doesn't increase the reference count on the returned object.
27779 *
27780 * <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>
27781 *
27782 * 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.
27783 */
27784Process *object_peek_process (Object *object)
27785{
27786 GDBusInterface *ret;
27787 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
27788 if (ret == NULL)
27789 return NULL;
27790 g_object_unref (ret);
27791 return PROCESS (ret);
27792}
27793
27794/**
Norman James18998182015-10-11 21:54:53 -050027795 * object_peek_shared_resource: (skip)
27796 * @object: A #Object.
27797 *
27798 * Like object_get_shared_resource() but doesn't increase the reference count on the returned object.
27799 *
27800 * <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>
27801 *
27802 * 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.
27803 */
27804SharedResource *object_peek_shared_resource (Object *object)
27805{
27806 GDBusInterface *ret;
27807 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
27808 if (ret == NULL)
27809 return NULL;
27810 g_object_unref (ret);
27811 return SHARED_RESOURCE (ret);
27812}
27813
27814/**
Norman James362a80f2015-09-14 14:04:39 -050027815 * object_peek_control: (skip)
27816 * @object: A #Object.
27817 *
27818 * Like object_get_control() but doesn't increase the reference count on the returned object.
27819 *
27820 * <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>
27821 *
27822 * 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.
27823 */
27824Control *object_peek_control (Object *object)
27825{
27826 GDBusInterface *ret;
27827 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
27828 if (ret == NULL)
27829 return NULL;
27830 g_object_unref (ret);
27831 return CONTROL (ret);
27832}
27833
27834/**
27835 * object_peek_control_bmc: (skip)
27836 * @object: A #Object.
27837 *
27838 * Like object_get_control_bmc() but doesn't increase the reference count on the returned object.
27839 *
27840 * <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>
27841 *
27842 * 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.
27843 */
27844ControlBmc *object_peek_control_bmc (Object *object)
27845{
27846 GDBusInterface *ret;
27847 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
27848 if (ret == NULL)
27849 return NULL;
27850 g_object_unref (ret);
27851 return CONTROL_BMC (ret);
27852}
27853
27854/**
27855 * object_peek_control_host: (skip)
27856 * @object: A #Object.
27857 *
27858 * Like object_get_control_host() but doesn't increase the reference count on the returned object.
27859 *
27860 * <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>
27861 *
27862 * 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.
27863 */
27864ControlHost *object_peek_control_host (Object *object)
27865{
27866 GDBusInterface *ret;
27867 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
27868 if (ret == NULL)
27869 return NULL;
27870 g_object_unref (ret);
27871 return CONTROL_HOST (ret);
27872}
27873
27874/**
27875 * object_peek_control_power: (skip)
27876 * @object: A #Object.
27877 *
27878 * Like object_get_control_power() but doesn't increase the reference count on the returned object.
27879 *
27880 * <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>
27881 *
27882 * 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.
27883 */
27884ControlPower *object_peek_control_power (Object *object)
27885{
27886 GDBusInterface *ret;
27887 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
27888 if (ret == NULL)
27889 return NULL;
27890 g_object_unref (ret);
27891 return CONTROL_POWER (ret);
27892}
27893
27894/**
27895 * object_peek_watchdog: (skip)
27896 * @object: A #Object.
27897 *
27898 * Like object_get_watchdog() but doesn't increase the reference count on the returned object.
27899 *
27900 * <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>
27901 *
27902 * 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.
27903 */
27904Watchdog *object_peek_watchdog (Object *object)
27905{
27906 GDBusInterface *ret;
27907 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
27908 if (ret == NULL)
27909 return NULL;
27910 g_object_unref (ret);
27911 return WATCHDOG (ret);
27912}
27913
27914/**
27915 * object_peek_event_log: (skip)
27916 * @object: A #Object.
27917 *
27918 * Like object_get_event_log() but doesn't increase the reference count on the returned object.
27919 *
27920 * <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>
27921 *
27922 * 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.
27923 */
27924EventLog *object_peek_event_log (Object *object)
27925{
27926 GDBusInterface *ret;
27927 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
27928 if (ret == NULL)
27929 return NULL;
27930 g_object_unref (ret);
27931 return EVENT_LOG (ret);
27932}
27933
27934/**
27935 * object_peek_flash: (skip)
27936 * @object: A #Object.
27937 *
27938 * Like object_get_flash() but doesn't increase the reference count on the returned object.
27939 *
27940 * <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>
27941 *
27942 * 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.
27943 */
27944Flash *object_peek_flash (Object *object)
27945{
27946 GDBusInterface *ret;
27947 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
27948 if (ret == NULL)
27949 return NULL;
27950 g_object_unref (ret);
27951 return FLASH (ret);
27952}
27953
27954/**
Norman James18998182015-10-11 21:54:53 -050027955 * object_peek_flash_control: (skip)
27956 * @object: A #Object.
27957 *
27958 * Like object_get_flash_control() but doesn't increase the reference count on the returned object.
27959 *
27960 * <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>
27961 *
27962 * 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.
27963 */
27964FlashControl *object_peek_flash_control (Object *object)
27965{
27966 GDBusInterface *ret;
27967 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
27968 if (ret == NULL)
27969 return NULL;
27970 g_object_unref (ret);
27971 return FLASH_CONTROL (ret);
27972}
27973
27974/**
Norman James362a80f2015-09-14 14:04:39 -050027975 * object_peek_button: (skip)
27976 * @object: A #Object.
27977 *
27978 * Like object_get_button() but doesn't increase the reference count on the returned object.
27979 *
27980 * <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>
27981 *
27982 * 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.
27983 */
27984Button *object_peek_button (Object *object)
27985{
27986 GDBusInterface *ret;
27987 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
27988 if (ret == NULL)
27989 return NULL;
27990 g_object_unref (ret);
27991 return BUTTON (ret);
27992}
27993
27994/**
27995 * object_peek_led: (skip)
27996 * @object: A #Object.
27997 *
27998 * Like object_get_led() but doesn't increase the reference count on the returned object.
27999 *
28000 * <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>
28001 *
28002 * 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.
28003 */
28004Led *object_peek_led (Object *object)
28005{
28006 GDBusInterface *ret;
28007 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
28008 if (ret == NULL)
28009 return NULL;
28010 g_object_unref (ret);
28011 return LED (ret);
28012}
28013
Norman Jamesdbcffbd2015-10-06 16:53:06 -050028014/**
28015 * object_peek_host_ipmi: (skip)
28016 * @object: A #Object.
28017 *
28018 * Like object_get_host_ipmi() but doesn't increase the reference count on the returned object.
28019 *
28020 * <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>
28021 *
28022 * 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.
28023 */
28024HostIpmi *object_peek_host_ipmi (Object *object)
28025{
28026 GDBusInterface *ret;
28027 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
28028 if (ret == NULL)
28029 return NULL;
28030 g_object_unref (ret);
28031 return HOST_IPMI (ret);
28032}
28033
Norman James362a80f2015-09-14 14:04:39 -050028034
28035static void
28036object_notify (GDBusObject *object, GDBusInterface *interface)
28037{
28038 _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
28039 /* info can be NULL if the other end is using a D-Bus interface we don't know
28040 * anything about, for example old generated code in this process talking to
28041 * newer generated code in the other process. */
28042 if (info != NULL)
28043 g_object_notify (G_OBJECT (object), info->hyphen_name);
28044}
28045
28046/**
28047 * ObjectProxy:
28048 *
28049 * The #ObjectProxy structure contains only private data and should only be accessed using the provided API.
28050 */
28051
28052/**
28053 * ObjectProxyClass:
28054 * @parent_class: The parent class.
28055 *
28056 * Class structure for #ObjectProxy.
28057 */
28058
28059static void
28060object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
28061{
28062}
28063
28064static void
28065object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
28066{
28067 iface->interface_added = object_notify;
28068 iface->interface_removed = object_notify;
28069}
28070
28071
28072G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
28073 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init)
28074 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init));
28075
28076static void
28077object_proxy_init (ObjectProxy *object G_GNUC_UNUSED)
28078{
28079}
28080
28081static void
28082object_proxy_set_property (GObject *gobject,
28083 guint prop_id,
28084 const GValue *value G_GNUC_UNUSED,
28085 GParamSpec *pspec)
28086{
28087 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
28088}
28089
28090static void
28091object_proxy_get_property (GObject *gobject,
28092 guint prop_id,
28093 GValue *value,
28094 GParamSpec *pspec)
28095{
28096 ObjectProxy *object = OBJECT_PROXY (gobject);
28097 GDBusInterface *interface;
28098
28099 switch (prop_id)
28100 {
28101 case 1:
Norman James362a80f2015-09-14 14:04:39 -050028102 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
28103 g_value_take_object (value, interface);
28104 break;
28105
Norman Jamesa3e47c42015-10-18 14:43:10 -050028106 case 2:
Norman James362a80f2015-09-14 14:04:39 -050028107 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
28108 g_value_take_object (value, interface);
28109 break;
28110
Norman Jamesa3e47c42015-10-18 14:43:10 -050028111 case 3:
Norman Jamesdfdaca92015-09-27 22:11:15 -050028112 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman James362a80f2015-09-14 14:04:39 -050028113 g_value_take_object (value, interface);
28114 break;
28115
Norman Jamesa3e47c42015-10-18 14:43:10 -050028116 case 4:
Norman Jamesdfdaca92015-09-27 22:11:15 -050028117 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman James362a80f2015-09-14 14:04:39 -050028118 g_value_take_object (value, interface);
28119 break;
28120
Norman Jamesa3e47c42015-10-18 14:43:10 -050028121 case 5:
Norman Jamesdfdaca92015-09-27 22:11:15 -050028122 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
Norman James362a80f2015-09-14 14:04:39 -050028123 g_value_take_object (value, interface);
28124 break;
28125
Norman Jamesa3e47c42015-10-18 14:43:10 -050028126 case 6:
Norman Jamesdfdaca92015-09-27 22:11:15 -050028127 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
Norman James362a80f2015-09-14 14:04:39 -050028128 g_value_take_object (value, interface);
28129 break;
28130
Norman Jamesa3e47c42015-10-18 14:43:10 -050028131 case 7:
Norman James18998182015-10-11 21:54:53 -050028132 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
Norman James362a80f2015-09-14 14:04:39 -050028133 g_value_take_object (value, interface);
28134 break;
28135
Norman Jamesa3e47c42015-10-18 14:43:10 -050028136 case 8:
Norman James18998182015-10-11 21:54:53 -050028137 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
Norman James362a80f2015-09-14 14:04:39 -050028138 g_value_take_object (value, interface);
28139 break;
28140
Norman Jamesa3e47c42015-10-18 14:43:10 -050028141 case 9:
Norman James18998182015-10-11 21:54:53 -050028142 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
Norman James362a80f2015-09-14 14:04:39 -050028143 g_value_take_object (value, interface);
28144 break;
28145
Norman Jamesa3e47c42015-10-18 14:43:10 -050028146 case 10:
Norman James18998182015-10-11 21:54:53 -050028147 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
Norman James362a80f2015-09-14 14:04:39 -050028148 g_value_take_object (value, interface);
28149 break;
28150
Norman Jamesa3e47c42015-10-18 14:43:10 -050028151 case 11:
Norman James18998182015-10-11 21:54:53 -050028152 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
Norman James362a80f2015-09-14 14:04:39 -050028153 g_value_take_object (value, interface);
28154 break;
28155
Norman Jamesa3e47c42015-10-18 14:43:10 -050028156 case 12:
Norman James18998182015-10-11 21:54:53 -050028157 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
Norman James362a80f2015-09-14 14:04:39 -050028158 g_value_take_object (value, interface);
28159 break;
28160
Norman Jamesa3e47c42015-10-18 14:43:10 -050028161 case 13:
Norman James18998182015-10-11 21:54:53 -050028162 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
Norman James362a80f2015-09-14 14:04:39 -050028163 g_value_take_object (value, interface);
28164 break;
28165
Norman Jamesa3e47c42015-10-18 14:43:10 -050028166 case 14:
Norman James18998182015-10-11 21:54:53 -050028167 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
Norman Jamesdfdaca92015-09-27 22:11:15 -050028168 g_value_take_object (value, interface);
28169 break;
28170
Norman Jamesa3e47c42015-10-18 14:43:10 -050028171 case 15:
Norman James18998182015-10-11 21:54:53 -050028172 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
Norman James362a80f2015-09-14 14:04:39 -050028173 g_value_take_object (value, interface);
28174 break;
28175
Norman Jamesa3e47c42015-10-18 14:43:10 -050028176 case 16:
Norman James18998182015-10-11 21:54:53 -050028177 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
28178 g_value_take_object (value, interface);
28179 break;
28180
Norman Jamesa3e47c42015-10-18 14:43:10 -050028181 case 17:
Norman James18998182015-10-11 21:54:53 -050028182 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
28183 g_value_take_object (value, interface);
28184 break;
28185
Norman Jamesa3e47c42015-10-18 14:43:10 -050028186 case 18:
Norman Jamesdbcffbd2015-10-06 16:53:06 -050028187 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
28188 g_value_take_object (value, interface);
28189 break;
28190
Norman James362a80f2015-09-14 14:04:39 -050028191 default:
28192 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
28193 break;
28194 }
28195}
28196
28197static void
28198object_proxy_class_init (ObjectProxyClass *klass)
28199{
28200 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
28201
28202 gobject_class->set_property = object_proxy_set_property;
28203 gobject_class->get_property = object_proxy_get_property;
28204
Norman Jamesa3e47c42015-10-18 14:43:10 -050028205 g_object_class_override_property (gobject_class, 1, "fan");
28206 g_object_class_override_property (gobject_class, 2, "sensor-value");
28207 g_object_class_override_property (gobject_class, 3, "sensor-threshold");
28208 g_object_class_override_property (gobject_class, 4, "sensor-i2c");
28209 g_object_class_override_property (gobject_class, 5, "sensor-match");
28210 g_object_class_override_property (gobject_class, 6, "process");
28211 g_object_class_override_property (gobject_class, 7, "shared-resource");
28212 g_object_class_override_property (gobject_class, 8, "control");
28213 g_object_class_override_property (gobject_class, 9, "control-bmc");
28214 g_object_class_override_property (gobject_class, 10, "control-host");
28215 g_object_class_override_property (gobject_class, 11, "control-power");
28216 g_object_class_override_property (gobject_class, 12, "watchdog");
28217 g_object_class_override_property (gobject_class, 13, "event-log");
28218 g_object_class_override_property (gobject_class, 14, "flash");
28219 g_object_class_override_property (gobject_class, 15, "flash-control");
28220 g_object_class_override_property (gobject_class, 16, "button");
28221 g_object_class_override_property (gobject_class, 17, "led");
28222 g_object_class_override_property (gobject_class, 18, "host-ipmi");
Norman James362a80f2015-09-14 14:04:39 -050028223}
28224
28225/**
28226 * object_proxy_new:
28227 * @connection: A #GDBusConnection.
28228 * @object_path: An object path.
28229 *
28230 * Creates a new proxy object.
28231 *
28232 * Returns: (transfer full): The proxy object.
28233 */
28234ObjectProxy *
28235object_proxy_new (GDBusConnection *connection,
28236 const gchar *object_path)
28237{
28238 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
28239 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
28240 return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
28241}
28242
28243/**
28244 * ObjectSkeleton:
28245 *
28246 * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API.
28247 */
28248
28249/**
28250 * ObjectSkeletonClass:
28251 * @parent_class: The parent class.
28252 *
28253 * Class structure for #ObjectSkeleton.
28254 */
28255
28256static void
28257object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
28258{
28259}
28260
28261
28262static void
28263object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
28264{
28265 iface->interface_added = object_notify;
28266 iface->interface_removed = object_notify;
28267}
28268
28269G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
28270 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init)
28271 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init));
28272
28273static void
28274object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED)
28275{
28276}
28277
28278static void
28279object_skeleton_set_property (GObject *gobject,
28280 guint prop_id,
28281 const GValue *value,
28282 GParamSpec *pspec)
28283{
28284 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
28285 GDBusInterfaceSkeleton *interface;
28286
28287 switch (prop_id)
28288 {
28289 case 1:
28290 interface = g_value_get_object (value);
28291 if (interface != NULL)
28292 {
Norman James362a80f2015-09-14 14:04:39 -050028293 g_warn_if_fail (IS_FAN (interface));
28294 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28295 }
28296 else
28297 {
28298 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Fan");
28299 }
28300 break;
28301
Norman Jamesa3e47c42015-10-18 14:43:10 -050028302 case 2:
Norman James362a80f2015-09-14 14:04:39 -050028303 interface = g_value_get_object (value);
28304 if (interface != NULL)
28305 {
28306 g_warn_if_fail (IS_SENSOR_VALUE (interface));
28307 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28308 }
28309 else
28310 {
28311 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorValue");
28312 }
28313 break;
28314
Norman Jamesa3e47c42015-10-18 14:43:10 -050028315 case 3:
Norman James362a80f2015-09-14 14:04:39 -050028316 interface = g_value_get_object (value);
28317 if (interface != NULL)
28318 {
28319 g_warn_if_fail (IS_SENSOR_THRESHOLD (interface));
28320 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28321 }
28322 else
28323 {
28324 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorThreshold");
28325 }
28326 break;
28327
Norman Jamesa3e47c42015-10-18 14:43:10 -050028328 case 4:
Norman James362a80f2015-09-14 14:04:39 -050028329 interface = g_value_get_object (value);
28330 if (interface != NULL)
28331 {
28332 g_warn_if_fail (IS_SENSOR_I2C (interface));
28333 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28334 }
28335 else
28336 {
28337 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorI2c");
28338 }
28339 break;
28340
Norman Jamesa3e47c42015-10-18 14:43:10 -050028341 case 5:
Norman James362a80f2015-09-14 14:04:39 -050028342 interface = g_value_get_object (value);
28343 if (interface != NULL)
28344 {
28345 g_warn_if_fail (IS_SENSOR_MATCH (interface));
28346 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28347 }
28348 else
28349 {
28350 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorMatch");
28351 }
28352 break;
28353
Norman Jamesa3e47c42015-10-18 14:43:10 -050028354 case 6:
Norman James362a80f2015-09-14 14:04:39 -050028355 interface = g_value_get_object (value);
28356 if (interface != NULL)
28357 {
28358 g_warn_if_fail (IS_PROCESS (interface));
28359 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28360 }
28361 else
28362 {
28363 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Process");
28364 }
28365 break;
28366
Norman Jamesa3e47c42015-10-18 14:43:10 -050028367 case 7:
Norman James362a80f2015-09-14 14:04:39 -050028368 interface = g_value_get_object (value);
28369 if (interface != NULL)
28370 {
Norman James18998182015-10-11 21:54:53 -050028371 g_warn_if_fail (IS_SHARED_RESOURCE (interface));
28372 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28373 }
28374 else
28375 {
28376 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SharedResource");
28377 }
28378 break;
28379
Norman Jamesa3e47c42015-10-18 14:43:10 -050028380 case 8:
Norman James18998182015-10-11 21:54:53 -050028381 interface = g_value_get_object (value);
28382 if (interface != NULL)
28383 {
Norman James362a80f2015-09-14 14:04:39 -050028384 g_warn_if_fail (IS_CONTROL (interface));
28385 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28386 }
28387 else
28388 {
28389 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Control");
28390 }
28391 break;
28392
Norman Jamesa3e47c42015-10-18 14:43:10 -050028393 case 9:
Norman James362a80f2015-09-14 14:04:39 -050028394 interface = g_value_get_object (value);
28395 if (interface != NULL)
28396 {
28397 g_warn_if_fail (IS_CONTROL_BMC (interface));
28398 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28399 }
28400 else
28401 {
28402 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Bmc");
28403 }
28404 break;
28405
Norman Jamesa3e47c42015-10-18 14:43:10 -050028406 case 10:
Norman James362a80f2015-09-14 14:04:39 -050028407 interface = g_value_get_object (value);
28408 if (interface != NULL)
28409 {
28410 g_warn_if_fail (IS_CONTROL_HOST (interface));
28411 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28412 }
28413 else
28414 {
28415 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Host");
28416 }
28417 break;
28418
Norman Jamesa3e47c42015-10-18 14:43:10 -050028419 case 11:
Norman James362a80f2015-09-14 14:04:39 -050028420 interface = g_value_get_object (value);
28421 if (interface != NULL)
28422 {
28423 g_warn_if_fail (IS_CONTROL_POWER (interface));
28424 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28425 }
28426 else
28427 {
28428 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Power");
28429 }
28430 break;
28431
Norman Jamesa3e47c42015-10-18 14:43:10 -050028432 case 12:
Norman James362a80f2015-09-14 14:04:39 -050028433 interface = g_value_get_object (value);
28434 if (interface != NULL)
28435 {
28436 g_warn_if_fail (IS_WATCHDOG (interface));
28437 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28438 }
28439 else
28440 {
28441 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Watchdog");
28442 }
28443 break;
28444
Norman Jamesa3e47c42015-10-18 14:43:10 -050028445 case 13:
Norman James362a80f2015-09-14 14:04:39 -050028446 interface = g_value_get_object (value);
28447 if (interface != NULL)
28448 {
28449 g_warn_if_fail (IS_EVENT_LOG (interface));
28450 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28451 }
28452 else
28453 {
28454 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.EventLog");
28455 }
28456 break;
28457
Norman Jamesa3e47c42015-10-18 14:43:10 -050028458 case 14:
Norman James362a80f2015-09-14 14:04:39 -050028459 interface = g_value_get_object (value);
28460 if (interface != NULL)
28461 {
28462 g_warn_if_fail (IS_FLASH (interface));
28463 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28464 }
28465 else
28466 {
28467 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Flash");
28468 }
28469 break;
28470
Norman Jamesa3e47c42015-10-18 14:43:10 -050028471 case 15:
Norman James18998182015-10-11 21:54:53 -050028472 interface = g_value_get_object (value);
28473 if (interface != NULL)
28474 {
28475 g_warn_if_fail (IS_FLASH_CONTROL (interface));
28476 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28477 }
28478 else
28479 {
28480 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.FlashControl");
28481 }
28482 break;
28483
Norman Jamesa3e47c42015-10-18 14:43:10 -050028484 case 16:
Norman James362a80f2015-09-14 14:04:39 -050028485 interface = g_value_get_object (value);
28486 if (interface != NULL)
28487 {
28488 g_warn_if_fail (IS_BUTTON (interface));
28489 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28490 }
28491 else
28492 {
28493 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Button");
28494 }
28495 break;
28496
Norman Jamesa3e47c42015-10-18 14:43:10 -050028497 case 17:
Norman James362a80f2015-09-14 14:04:39 -050028498 interface = g_value_get_object (value);
28499 if (interface != NULL)
28500 {
28501 g_warn_if_fail (IS_LED (interface));
28502 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28503 }
28504 else
28505 {
28506 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Led");
28507 }
28508 break;
28509
Norman Jamesa3e47c42015-10-18 14:43:10 -050028510 case 18:
Norman Jamesdbcffbd2015-10-06 16:53:06 -050028511 interface = g_value_get_object (value);
28512 if (interface != NULL)
28513 {
28514 g_warn_if_fail (IS_HOST_IPMI (interface));
28515 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
28516 }
28517 else
28518 {
28519 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.HostIpmi");
28520 }
28521 break;
28522
Norman James362a80f2015-09-14 14:04:39 -050028523 default:
28524 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
28525 break;
28526 }
28527}
28528
28529static void
28530object_skeleton_get_property (GObject *gobject,
28531 guint prop_id,
28532 GValue *value,
28533 GParamSpec *pspec)
28534{
28535 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
28536 GDBusInterface *interface;
28537
28538 switch (prop_id)
28539 {
28540 case 1:
Norman James362a80f2015-09-14 14:04:39 -050028541 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
28542 g_value_take_object (value, interface);
28543 break;
28544
Norman Jamesa3e47c42015-10-18 14:43:10 -050028545 case 2:
Norman James362a80f2015-09-14 14:04:39 -050028546 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
28547 g_value_take_object (value, interface);
28548 break;
28549
Norman Jamesa3e47c42015-10-18 14:43:10 -050028550 case 3:
Norman Jamesdfdaca92015-09-27 22:11:15 -050028551 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman James362a80f2015-09-14 14:04:39 -050028552 g_value_take_object (value, interface);
28553 break;
28554
Norman Jamesa3e47c42015-10-18 14:43:10 -050028555 case 4:
Norman Jamesdfdaca92015-09-27 22:11:15 -050028556 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman James362a80f2015-09-14 14:04:39 -050028557 g_value_take_object (value, interface);
28558 break;
28559
Norman Jamesa3e47c42015-10-18 14:43:10 -050028560 case 5:
Norman Jamesdfdaca92015-09-27 22:11:15 -050028561 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
Norman James362a80f2015-09-14 14:04:39 -050028562 g_value_take_object (value, interface);
28563 break;
28564
Norman Jamesa3e47c42015-10-18 14:43:10 -050028565 case 6:
Norman Jamesdfdaca92015-09-27 22:11:15 -050028566 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
Norman James362a80f2015-09-14 14:04:39 -050028567 g_value_take_object (value, interface);
28568 break;
28569
Norman Jamesa3e47c42015-10-18 14:43:10 -050028570 case 7:
Norman James18998182015-10-11 21:54:53 -050028571 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
Norman James362a80f2015-09-14 14:04:39 -050028572 g_value_take_object (value, interface);
28573 break;
28574
Norman Jamesa3e47c42015-10-18 14:43:10 -050028575 case 8:
Norman James18998182015-10-11 21:54:53 -050028576 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
Norman James362a80f2015-09-14 14:04:39 -050028577 g_value_take_object (value, interface);
28578 break;
28579
Norman Jamesa3e47c42015-10-18 14:43:10 -050028580 case 9:
Norman James18998182015-10-11 21:54:53 -050028581 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
Norman James362a80f2015-09-14 14:04:39 -050028582 g_value_take_object (value, interface);
28583 break;
28584
Norman Jamesa3e47c42015-10-18 14:43:10 -050028585 case 10:
Norman James18998182015-10-11 21:54:53 -050028586 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
Norman James362a80f2015-09-14 14:04:39 -050028587 g_value_take_object (value, interface);
28588 break;
28589
Norman Jamesa3e47c42015-10-18 14:43:10 -050028590 case 11:
Norman James18998182015-10-11 21:54:53 -050028591 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
Norman James362a80f2015-09-14 14:04:39 -050028592 g_value_take_object (value, interface);
28593 break;
28594
Norman Jamesa3e47c42015-10-18 14:43:10 -050028595 case 12:
Norman James18998182015-10-11 21:54:53 -050028596 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
Norman James362a80f2015-09-14 14:04:39 -050028597 g_value_take_object (value, interface);
28598 break;
28599
Norman Jamesa3e47c42015-10-18 14:43:10 -050028600 case 13:
Norman James18998182015-10-11 21:54:53 -050028601 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
Norman James362a80f2015-09-14 14:04:39 -050028602 g_value_take_object (value, interface);
28603 break;
28604
Norman Jamesa3e47c42015-10-18 14:43:10 -050028605 case 14:
Norman James18998182015-10-11 21:54:53 -050028606 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
Norman Jamesdfdaca92015-09-27 22:11:15 -050028607 g_value_take_object (value, interface);
28608 break;
28609
Norman Jamesa3e47c42015-10-18 14:43:10 -050028610 case 15:
Norman James18998182015-10-11 21:54:53 -050028611 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
Norman James362a80f2015-09-14 14:04:39 -050028612 g_value_take_object (value, interface);
28613 break;
28614
Norman Jamesa3e47c42015-10-18 14:43:10 -050028615 case 16:
Norman James18998182015-10-11 21:54:53 -050028616 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
28617 g_value_take_object (value, interface);
28618 break;
28619
Norman Jamesa3e47c42015-10-18 14:43:10 -050028620 case 17:
Norman James18998182015-10-11 21:54:53 -050028621 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
28622 g_value_take_object (value, interface);
28623 break;
28624
Norman Jamesa3e47c42015-10-18 14:43:10 -050028625 case 18:
Norman Jamesdbcffbd2015-10-06 16:53:06 -050028626 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
28627 g_value_take_object (value, interface);
28628 break;
28629
Norman James362a80f2015-09-14 14:04:39 -050028630 default:
28631 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
28632 break;
28633 }
28634}
28635
28636static void
28637object_skeleton_class_init (ObjectSkeletonClass *klass)
28638{
28639 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
28640
28641 gobject_class->set_property = object_skeleton_set_property;
28642 gobject_class->get_property = object_skeleton_get_property;
28643
Norman Jamesa3e47c42015-10-18 14:43:10 -050028644 g_object_class_override_property (gobject_class, 1, "fan");
28645 g_object_class_override_property (gobject_class, 2, "sensor-value");
28646 g_object_class_override_property (gobject_class, 3, "sensor-threshold");
28647 g_object_class_override_property (gobject_class, 4, "sensor-i2c");
28648 g_object_class_override_property (gobject_class, 5, "sensor-match");
28649 g_object_class_override_property (gobject_class, 6, "process");
28650 g_object_class_override_property (gobject_class, 7, "shared-resource");
28651 g_object_class_override_property (gobject_class, 8, "control");
28652 g_object_class_override_property (gobject_class, 9, "control-bmc");
28653 g_object_class_override_property (gobject_class, 10, "control-host");
28654 g_object_class_override_property (gobject_class, 11, "control-power");
28655 g_object_class_override_property (gobject_class, 12, "watchdog");
28656 g_object_class_override_property (gobject_class, 13, "event-log");
28657 g_object_class_override_property (gobject_class, 14, "flash");
28658 g_object_class_override_property (gobject_class, 15, "flash-control");
28659 g_object_class_override_property (gobject_class, 16, "button");
28660 g_object_class_override_property (gobject_class, 17, "led");
28661 g_object_class_override_property (gobject_class, 18, "host-ipmi");
Norman James362a80f2015-09-14 14:04:39 -050028662}
28663
28664/**
28665 * object_skeleton_new:
28666 * @object_path: An object path.
28667 *
28668 * Creates a new skeleton object.
28669 *
28670 * Returns: (transfer full): The skeleton object.
28671 */
28672ObjectSkeleton *
28673object_skeleton_new (const gchar *object_path)
28674{
28675 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
28676 return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
28677}
28678
28679/**
Norman James362a80f2015-09-14 14:04:39 -050028680 * object_skeleton_set_fan:
28681 * @object: A #ObjectSkeleton.
28682 * @interface_: (allow-none): A #Fan or %NULL to clear the interface.
28683 *
28684 * 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.
28685 */
28686void object_skeleton_set_fan (ObjectSkeleton *object, Fan *interface_)
28687{
28688 g_object_set (G_OBJECT (object), "fan", interface_, NULL);
28689}
28690
28691/**
28692 * object_skeleton_set_sensor_value:
28693 * @object: A #ObjectSkeleton.
28694 * @interface_: (allow-none): A #SensorValue or %NULL to clear the interface.
28695 *
28696 * 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.
28697 */
28698void object_skeleton_set_sensor_value (ObjectSkeleton *object, SensorValue *interface_)
28699{
28700 g_object_set (G_OBJECT (object), "sensor-value", interface_, NULL);
28701}
28702
28703/**
28704 * object_skeleton_set_sensor_threshold:
28705 * @object: A #ObjectSkeleton.
28706 * @interface_: (allow-none): A #SensorThreshold or %NULL to clear the interface.
28707 *
28708 * 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.
28709 */
28710void object_skeleton_set_sensor_threshold (ObjectSkeleton *object, SensorThreshold *interface_)
28711{
28712 g_object_set (G_OBJECT (object), "sensor-threshold", interface_, NULL);
28713}
28714
28715/**
28716 * object_skeleton_set_sensor_i2c:
28717 * @object: A #ObjectSkeleton.
28718 * @interface_: (allow-none): A #SensorI2c or %NULL to clear the interface.
28719 *
28720 * 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.
28721 */
28722void object_skeleton_set_sensor_i2c (ObjectSkeleton *object, SensorI2c *interface_)
28723{
28724 g_object_set (G_OBJECT (object), "sensor-i2c", interface_, NULL);
28725}
28726
28727/**
28728 * object_skeleton_set_sensor_match:
28729 * @object: A #ObjectSkeleton.
28730 * @interface_: (allow-none): A #SensorMatch or %NULL to clear the interface.
28731 *
28732 * 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.
28733 */
28734void object_skeleton_set_sensor_match (ObjectSkeleton *object, SensorMatch *interface_)
28735{
28736 g_object_set (G_OBJECT (object), "sensor-match", interface_, NULL);
28737}
28738
28739/**
28740 * object_skeleton_set_process:
28741 * @object: A #ObjectSkeleton.
28742 * @interface_: (allow-none): A #Process or %NULL to clear the interface.
28743 *
28744 * 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.
28745 */
28746void object_skeleton_set_process (ObjectSkeleton *object, Process *interface_)
28747{
28748 g_object_set (G_OBJECT (object), "process", interface_, NULL);
28749}
28750
28751/**
Norman James18998182015-10-11 21:54:53 -050028752 * object_skeleton_set_shared_resource:
28753 * @object: A #ObjectSkeleton.
28754 * @interface_: (allow-none): A #SharedResource or %NULL to clear the interface.
28755 *
28756 * 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.
28757 */
28758void object_skeleton_set_shared_resource (ObjectSkeleton *object, SharedResource *interface_)
28759{
28760 g_object_set (G_OBJECT (object), "shared-resource", interface_, NULL);
28761}
28762
28763/**
Norman James362a80f2015-09-14 14:04:39 -050028764 * object_skeleton_set_control:
28765 * @object: A #ObjectSkeleton.
28766 * @interface_: (allow-none): A #Control or %NULL to clear the interface.
28767 *
28768 * 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.
28769 */
28770void object_skeleton_set_control (ObjectSkeleton *object, Control *interface_)
28771{
28772 g_object_set (G_OBJECT (object), "control", interface_, NULL);
28773}
28774
28775/**
28776 * object_skeleton_set_control_bmc:
28777 * @object: A #ObjectSkeleton.
28778 * @interface_: (allow-none): A #ControlBmc or %NULL to clear the interface.
28779 *
28780 * 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.
28781 */
28782void object_skeleton_set_control_bmc (ObjectSkeleton *object, ControlBmc *interface_)
28783{
28784 g_object_set (G_OBJECT (object), "control-bmc", interface_, NULL);
28785}
28786
28787/**
28788 * object_skeleton_set_control_host:
28789 * @object: A #ObjectSkeleton.
28790 * @interface_: (allow-none): A #ControlHost or %NULL to clear the interface.
28791 *
28792 * 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.
28793 */
28794void object_skeleton_set_control_host (ObjectSkeleton *object, ControlHost *interface_)
28795{
28796 g_object_set (G_OBJECT (object), "control-host", interface_, NULL);
28797}
28798
28799/**
28800 * object_skeleton_set_control_power:
28801 * @object: A #ObjectSkeleton.
28802 * @interface_: (allow-none): A #ControlPower or %NULL to clear the interface.
28803 *
28804 * 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.
28805 */
28806void object_skeleton_set_control_power (ObjectSkeleton *object, ControlPower *interface_)
28807{
28808 g_object_set (G_OBJECT (object), "control-power", interface_, NULL);
28809}
28810
28811/**
28812 * object_skeleton_set_watchdog:
28813 * @object: A #ObjectSkeleton.
28814 * @interface_: (allow-none): A #Watchdog or %NULL to clear the interface.
28815 *
28816 * 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.
28817 */
28818void object_skeleton_set_watchdog (ObjectSkeleton *object, Watchdog *interface_)
28819{
28820 g_object_set (G_OBJECT (object), "watchdog", interface_, NULL);
28821}
28822
28823/**
28824 * object_skeleton_set_event_log:
28825 * @object: A #ObjectSkeleton.
28826 * @interface_: (allow-none): A #EventLog or %NULL to clear the interface.
28827 *
28828 * 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.
28829 */
28830void object_skeleton_set_event_log (ObjectSkeleton *object, EventLog *interface_)
28831{
28832 g_object_set (G_OBJECT (object), "event-log", interface_, NULL);
28833}
28834
28835/**
28836 * object_skeleton_set_flash:
28837 * @object: A #ObjectSkeleton.
28838 * @interface_: (allow-none): A #Flash or %NULL to clear the interface.
28839 *
28840 * 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.
28841 */
28842void object_skeleton_set_flash (ObjectSkeleton *object, Flash *interface_)
28843{
28844 g_object_set (G_OBJECT (object), "flash", interface_, NULL);
28845}
28846
28847/**
Norman James18998182015-10-11 21:54:53 -050028848 * object_skeleton_set_flash_control:
28849 * @object: A #ObjectSkeleton.
28850 * @interface_: (allow-none): A #FlashControl or %NULL to clear the interface.
28851 *
28852 * 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.
28853 */
28854void object_skeleton_set_flash_control (ObjectSkeleton *object, FlashControl *interface_)
28855{
28856 g_object_set (G_OBJECT (object), "flash-control", interface_, NULL);
28857}
28858
28859/**
Norman James362a80f2015-09-14 14:04:39 -050028860 * object_skeleton_set_button:
28861 * @object: A #ObjectSkeleton.
28862 * @interface_: (allow-none): A #Button or %NULL to clear the interface.
28863 *
28864 * 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.
28865 */
28866void object_skeleton_set_button (ObjectSkeleton *object, Button *interface_)
28867{
28868 g_object_set (G_OBJECT (object), "button", interface_, NULL);
28869}
28870
28871/**
28872 * object_skeleton_set_led:
28873 * @object: A #ObjectSkeleton.
28874 * @interface_: (allow-none): A #Led or %NULL to clear the interface.
28875 *
28876 * 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.
28877 */
28878void object_skeleton_set_led (ObjectSkeleton *object, Led *interface_)
28879{
28880 g_object_set (G_OBJECT (object), "led", interface_, NULL);
28881}
28882
Norman Jamesdbcffbd2015-10-06 16:53:06 -050028883/**
28884 * object_skeleton_set_host_ipmi:
28885 * @object: A #ObjectSkeleton.
28886 * @interface_: (allow-none): A #HostIpmi or %NULL to clear the interface.
28887 *
28888 * 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.
28889 */
28890void object_skeleton_set_host_ipmi (ObjectSkeleton *object, HostIpmi *interface_)
28891{
28892 g_object_set (G_OBJECT (object), "host-ipmi", interface_, NULL);
28893}
28894
Norman James362a80f2015-09-14 14:04:39 -050028895
28896/* ------------------------------------------------------------------------
28897 * Code for ObjectManager client
28898 * ------------------------------------------------------------------------
28899 */
28900
28901/**
28902 * SECTION:ObjectManagerClient
28903 * @title: ObjectManagerClient
28904 * @short_description: Generated GDBusObjectManagerClient type
28905 *
28906 * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
28907 */
28908
28909/**
28910 * ObjectManagerClient:
28911 *
28912 * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API.
28913 */
28914
28915/**
28916 * ObjectManagerClientClass:
28917 * @parent_class: The parent class.
28918 *
28919 * Class structure for #ObjectManagerClient.
28920 */
28921
28922G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT);
28923
28924static void
28925object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED)
28926{
28927}
28928
28929static void
28930object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED)
28931{
28932}
28933
28934/**
28935 * object_manager_client_get_proxy_type:
28936 * @manager: A #GDBusObjectManagerClient.
28937 * @object_path: The object path of the remote object (unused).
28938 * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType.
28939 * @user_data: User data (unused).
28940 *
28941 * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types.
28942 *
28943 * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy.
28944 */
28945GType
28946object_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)
28947{
28948 static gsize once_init_value = 0;
28949 static GHashTable *lookup_hash;
28950 GType ret;
28951
28952 if (interface_name == NULL)
28953 return TYPE_OBJECT_PROXY;
28954 if (g_once_init_enter (&once_init_value))
28955 {
28956 lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
Norman James362a80f2015-09-14 14:04:39 -050028957 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Fan", GSIZE_TO_POINTER (TYPE_FAN_PROXY));
28958 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorValue", GSIZE_TO_POINTER (TYPE_SENSOR_VALUE_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050028959 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_THRESHOLD_PROXY));
28960 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorI2c", GSIZE_TO_POINTER (TYPE_SENSOR_I2C_PROXY));
28961 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorMatch", GSIZE_TO_POINTER (TYPE_SENSOR_MATCH_PROXY));
28962 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Process", GSIZE_TO_POINTER (TYPE_PROCESS_PROXY));
Norman James18998182015-10-11 21:54:53 -050028963 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SharedResource", GSIZE_TO_POINTER (TYPE_SHARED_RESOURCE_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050028964 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Control", GSIZE_TO_POINTER (TYPE_CONTROL_PROXY));
28965 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Bmc", GSIZE_TO_POINTER (TYPE_CONTROL_BMC_PROXY));
28966 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Host", GSIZE_TO_POINTER (TYPE_CONTROL_HOST_PROXY));
28967 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Power", GSIZE_TO_POINTER (TYPE_CONTROL_POWER_PROXY));
28968 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Watchdog", GSIZE_TO_POINTER (TYPE_WATCHDOG_PROXY));
28969 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.EventLog", GSIZE_TO_POINTER (TYPE_EVENT_LOG_PROXY));
28970 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Flash", GSIZE_TO_POINTER (TYPE_FLASH_PROXY));
Norman James18998182015-10-11 21:54:53 -050028971 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.FlashControl", GSIZE_TO_POINTER (TYPE_FLASH_CONTROL_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050028972 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Button", GSIZE_TO_POINTER (TYPE_BUTTON_PROXY));
28973 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Led", GSIZE_TO_POINTER (TYPE_LED_PROXY));
Norman Jamesdbcffbd2015-10-06 16:53:06 -050028974 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.HostIpmi", GSIZE_TO_POINTER (TYPE_HOST_IPMI_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050028975 g_once_init_leave (&once_init_value, 1);
28976 }
28977 ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
28978 if (ret == (GType) 0)
28979 ret = G_TYPE_DBUS_PROXY;
28980 return ret;
28981}
28982
28983/**
28984 * object_manager_client_new:
28985 * @connection: A #GDBusConnection.
28986 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
28987 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
28988 * @object_path: An object path.
28989 * @cancellable: (allow-none): A #GCancellable or %NULL.
28990 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
28991 * @user_data: User data to pass to @callback.
28992 *
28993 * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
28994 *
28995 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
28996 * You can then call object_manager_client_new_finish() to get the result of the operation.
28997 *
28998 * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
28999 */
29000void
29001object_manager_client_new (
29002 GDBusConnection *connection,
29003 GDBusObjectManagerClientFlags flags,
29004 const gchar *name,
29005 const gchar *object_path,
29006 GCancellable *cancellable,
29007 GAsyncReadyCallback callback,
29008 gpointer user_data)
29009{
29010 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);
29011}
29012
29013/**
29014 * object_manager_client_new_finish:
29015 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new().
29016 * @error: Return location for error or %NULL
29017 *
29018 * Finishes an operation started with object_manager_client_new().
29019 *
29020 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
29021 */
29022GDBusObjectManager *
29023object_manager_client_new_finish (
29024 GAsyncResult *res,
29025 GError **error)
29026{
29027 GObject *ret;
29028 GObject *source_object;
29029 source_object = g_async_result_get_source_object (res);
29030 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
29031 g_object_unref (source_object);
29032 if (ret != NULL)
29033 return G_DBUS_OBJECT_MANAGER (ret);
29034 else
29035 return NULL;
29036}
29037
29038/**
29039 * object_manager_client_new_sync:
29040 * @connection: A #GDBusConnection.
29041 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
29042 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
29043 * @object_path: An object path.
29044 * @cancellable: (allow-none): A #GCancellable or %NULL.
29045 * @error: Return location for error or %NULL
29046 *
29047 * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
29048 *
29049 * The calling thread is blocked until a reply is received.
29050 *
29051 * See object_manager_client_new() for the asynchronous version of this constructor.
29052 *
29053 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
29054 */
29055GDBusObjectManager *
29056object_manager_client_new_sync (
29057 GDBusConnection *connection,
29058 GDBusObjectManagerClientFlags flags,
29059 const gchar *name,
29060 const gchar *object_path,
29061 GCancellable *cancellable,
29062 GError **error)
29063{
29064 GInitable *ret;
29065 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);
29066 if (ret != NULL)
29067 return G_DBUS_OBJECT_MANAGER (ret);
29068 else
29069 return NULL;
29070}
29071
29072
29073/**
29074 * object_manager_client_new_for_bus:
29075 * @bus_type: A #GBusType.
29076 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
29077 * @name: A bus name (well-known or unique).
29078 * @object_path: An object path.
29079 * @cancellable: (allow-none): A #GCancellable or %NULL.
29080 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
29081 * @user_data: User data to pass to @callback.
29082 *
29083 * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
29084 *
29085 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
29086 * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation.
29087 *
29088 * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
29089 */
29090void
29091object_manager_client_new_for_bus (
29092 GBusType bus_type,
29093 GDBusObjectManagerClientFlags flags,
29094 const gchar *name,
29095 const gchar *object_path,
29096 GCancellable *cancellable,
29097 GAsyncReadyCallback callback,
29098 gpointer user_data)
29099{
29100 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);
29101}
29102
29103/**
29104 * object_manager_client_new_for_bus_finish:
29105 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus().
29106 * @error: Return location for error or %NULL
29107 *
29108 * Finishes an operation started with object_manager_client_new_for_bus().
29109 *
29110 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
29111 */
29112GDBusObjectManager *
29113object_manager_client_new_for_bus_finish (
29114 GAsyncResult *res,
29115 GError **error)
29116{
29117 GObject *ret;
29118 GObject *source_object;
29119 source_object = g_async_result_get_source_object (res);
29120 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
29121 g_object_unref (source_object);
29122 if (ret != NULL)
29123 return G_DBUS_OBJECT_MANAGER (ret);
29124 else
29125 return NULL;
29126}
29127
29128/**
29129 * object_manager_client_new_for_bus_sync:
29130 * @bus_type: A #GBusType.
29131 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
29132 * @name: A bus name (well-known or unique).
29133 * @object_path: An object path.
29134 * @cancellable: (allow-none): A #GCancellable or %NULL.
29135 * @error: Return location for error or %NULL
29136 *
29137 * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
29138 *
29139 * The calling thread is blocked until a reply is received.
29140 *
29141 * See object_manager_client_new_for_bus() for the asynchronous version of this constructor.
29142 *
29143 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
29144 */
29145GDBusObjectManager *
29146object_manager_client_new_for_bus_sync (
29147 GBusType bus_type,
29148 GDBusObjectManagerClientFlags flags,
29149 const gchar *name,
29150 const gchar *object_path,
29151 GCancellable *cancellable,
29152 GError **error)
29153{
29154 GInitable *ret;
29155 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);
29156 if (ret != NULL)
29157 return G_DBUS_OBJECT_MANAGER (ret);
29158 else
29159 return NULL;
29160}
29161
29162