blob: db2f1aa2fe75e9b6a7b08d6b005cb6fdac965ec8 [file] [log] [blame]
Norman Jamesce46e3e2015-08-30 22:25:55 -05001/*
2 * Generated by gdbus-codegen 2.40.2. DO NOT EDIT.
3 *
4 * The license of this code is the same as for the source it was derived from.
5 */
6
7#ifdef HAVE_CONFIG_H
8# include "config.h"
9#endif
10
11#include "interfaces/fru.h"
12
13#include <string.h>
14#ifdef G_OS_UNIX
15# include <gio/gunixfdlist.h>
16#endif
17
18typedef struct
19{
20 GDBusArgInfo parent_struct;
21 gboolean use_gvariant;
22} _ExtendedGDBusArgInfo;
23
24typedef struct
25{
26 GDBusMethodInfo parent_struct;
27 const gchar *signal_name;
28 gboolean pass_fdlist;
29} _ExtendedGDBusMethodInfo;
30
31typedef struct
32{
33 GDBusSignalInfo parent_struct;
34 const gchar *signal_name;
35} _ExtendedGDBusSignalInfo;
36
37typedef struct
38{
39 GDBusPropertyInfo parent_struct;
40 const gchar *hyphen_name;
41 gboolean use_gvariant;
42} _ExtendedGDBusPropertyInfo;
43
44typedef struct
45{
46 GDBusInterfaceInfo parent_struct;
47 const gchar *hyphen_name;
48} _ExtendedGDBusInterfaceInfo;
49
50typedef struct
51{
52 const _ExtendedGDBusPropertyInfo *info;
53 guint prop_id;
54 GValue orig_value; /* the value before the change */
55} ChangedProperty;
56
57static void
58_changed_property_free (ChangedProperty *data)
59{
60 g_value_unset (&data->orig_value);
61 g_free (data);
62}
63
64static gboolean
65_g_strv_equal0 (gchar **a, gchar **b)
66{
67 gboolean ret = FALSE;
68 guint n;
69 if (a == NULL && b == NULL)
70 {
71 ret = TRUE;
72 goto out;
73 }
74 if (a == NULL || b == NULL)
75 goto out;
76 if (g_strv_length (a) != g_strv_length (b))
77 goto out;
78 for (n = 0; a[n] != NULL; n++)
79 if (g_strcmp0 (a[n], b[n]) != 0)
80 goto out;
81 ret = TRUE;
82out:
83 return ret;
84}
85
86static gboolean
87_g_variant_equal0 (GVariant *a, GVariant *b)
88{
89 gboolean ret = FALSE;
90 if (a == NULL && b == NULL)
91 {
92 ret = TRUE;
93 goto out;
94 }
95 if (a == NULL || b == NULL)
96 goto out;
97 ret = g_variant_equal (a, b);
98out:
99 return ret;
100}
101
102G_GNUC_UNUSED static gboolean
103_g_value_equal (const GValue *a, const GValue *b)
104{
105 gboolean ret = FALSE;
106 g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b));
107 switch (G_VALUE_TYPE (a))
108 {
109 case G_TYPE_BOOLEAN:
110 ret = (g_value_get_boolean (a) == g_value_get_boolean (b));
111 break;
112 case G_TYPE_UCHAR:
113 ret = (g_value_get_uchar (a) == g_value_get_uchar (b));
114 break;
115 case G_TYPE_INT:
116 ret = (g_value_get_int (a) == g_value_get_int (b));
117 break;
118 case G_TYPE_UINT:
119 ret = (g_value_get_uint (a) == g_value_get_uint (b));
120 break;
121 case G_TYPE_INT64:
122 ret = (g_value_get_int64 (a) == g_value_get_int64 (b));
123 break;
124 case G_TYPE_UINT64:
125 ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b));
126 break;
127 case G_TYPE_DOUBLE:
128 {
129 /* Avoid -Wfloat-equal warnings by doing a direct bit compare */
130 gdouble da = g_value_get_double (a);
131 gdouble db = g_value_get_double (b);
132 ret = memcmp (&da, &db, sizeof (gdouble)) == 0;
133 }
134 break;
135 case G_TYPE_STRING:
136 ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0);
137 break;
138 case G_TYPE_VARIANT:
139 ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b));
140 break;
141 default:
142 if (G_VALUE_TYPE (a) == G_TYPE_STRV)
143 ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b));
144 else
145 g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a)));
146 break;
147 }
148 return ret;
149}
150
151/* ------------------------------------------------------------------------
152 * Code for interface org.openbmc.Fru
153 * ------------------------------------------------------------------------
154 */
155
156/**
157 * SECTION:Fru
158 * @title: Fru
159 * @short_description: Generated C code for the org.openbmc.Fru D-Bus interface
160 *
161 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Fru.top_of_page">org.openbmc.Fru</link> D-Bus interface in C.
162 */
163
164/* ---- Introspection data for org.openbmc.Fru ---- */
165
166static const _ExtendedGDBusSignalInfo _fru_signal_info_state_changed =
167{
168 {
169 -1,
170 (gchar *) "StateChanged",
171 NULL,
172 NULL
173 },
174 "state-changed"
175};
176
177static const _ExtendedGDBusSignalInfo _fru_signal_info_unrecoverable_error =
178{
179 {
180 -1,
181 (gchar *) "UnrecoverableError",
182 NULL,
183 NULL
184 },
185 "unrecoverable-error"
186};
187
188static const _ExtendedGDBusSignalInfo _fru_signal_info_recoverable_error =
189{
190 {
191 -1,
192 (gchar *) "RecoverableError",
193 NULL,
194 NULL
195 },
196 "recoverable-error"
197};
198
199static const _ExtendedGDBusSignalInfo * const _fru_signal_info_pointers[] =
200{
201 &_fru_signal_info_state_changed,
202 &_fru_signal_info_unrecoverable_error,
203 &_fru_signal_info_recoverable_error,
204 NULL
205};
206
207static const _ExtendedGDBusPropertyInfo _fru_property_info_label =
208{
209 {
210 -1,
211 (gchar *) "label",
212 (gchar *) "s",
213 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
214 NULL
215 },
216 "label",
217 FALSE
218};
219
220static const _ExtendedGDBusPropertyInfo _fru_property_info_location =
221{
222 {
223 -1,
224 (gchar *) "location",
225 (gchar *) "s",
226 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
227 NULL
228 },
229 "location",
230 FALSE
231};
232
233static const _ExtendedGDBusPropertyInfo _fru_property_info_state =
234{
235 {
236 -1,
237 (gchar *) "state",
238 (gchar *) "y",
239 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
240 NULL
241 },
242 "state",
243 FALSE
244};
245
246static const _ExtendedGDBusPropertyInfo _fru_property_info_manufacturer =
247{
248 {
249 -1,
250 (gchar *) "manufacturer",
251 (gchar *) "s",
252 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
253 NULL
254 },
255 "manufacturer",
256 FALSE
257};
258
259static const _ExtendedGDBusPropertyInfo _fru_property_info_part_num =
260{
261 {
262 -1,
263 (gchar *) "part_num",
264 (gchar *) "s",
265 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
266 NULL
267 },
268 "part-num",
269 FALSE
270};
271
272static const _ExtendedGDBusPropertyInfo _fru_property_info_serial_num =
273{
274 {
275 -1,
276 (gchar *) "serial_num",
277 (gchar *) "s",
278 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
279 NULL
280 },
281 "serial-num",
282 FALSE
283};
284
285static const _ExtendedGDBusPropertyInfo _fru_property_info_date_code =
286{
287 {
288 -1,
289 (gchar *) "date_code",
290 (gchar *) "u",
291 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
292 NULL
293 },
294 "date-code",
295 FALSE
296};
297
298static const _ExtendedGDBusPropertyInfo _fru_property_info_version =
299{
300 {
301 -1,
302 (gchar *) "version",
303 (gchar *) "s",
304 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
305 NULL
306 },
307 "version",
308 FALSE
309};
310
311static const _ExtendedGDBusPropertyInfo _fru_property_info_type_ =
312{
313 {
314 -1,
315 (gchar *) "type",
316 (gchar *) "y",
317 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
318 NULL
319 },
320 "type",
321 FALSE
322};
323
324static const _ExtendedGDBusPropertyInfo _fru_property_info_subtype =
325{
326 {
327 -1,
328 (gchar *) "subtype",
329 (gchar *) "y",
330 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
331 NULL
332 },
333 "subtype",
334 FALSE
335};
336
337static const _ExtendedGDBusPropertyInfo _fru_property_info_instance_num =
338{
339 {
340 -1,
341 (gchar *) "instance_num",
342 (gchar *) "y",
343 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
344 NULL
345 },
346 "instance-num",
347 FALSE
348};
349
350static const _ExtendedGDBusPropertyInfo * const _fru_property_info_pointers[] =
351{
352 &_fru_property_info_label,
353 &_fru_property_info_location,
354 &_fru_property_info_state,
355 &_fru_property_info_manufacturer,
356 &_fru_property_info_part_num,
357 &_fru_property_info_serial_num,
358 &_fru_property_info_date_code,
359 &_fru_property_info_version,
360 &_fru_property_info_type_,
361 &_fru_property_info_subtype,
362 &_fru_property_info_instance_num,
363 NULL
364};
365
366static const _ExtendedGDBusInterfaceInfo _fru_interface_info =
367{
368 {
369 -1,
370 (gchar *) "org.openbmc.Fru",
371 NULL,
372 (GDBusSignalInfo **) &_fru_signal_info_pointers,
373 (GDBusPropertyInfo **) &_fru_property_info_pointers,
374 NULL
375 },
376 "fru",
377};
378
379
380/**
381 * fru_interface_info:
382 *
383 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Fru.top_of_page">org.openbmc.Fru</link> D-Bus interface.
384 *
385 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
386 */
387GDBusInterfaceInfo *
388fru_interface_info (void)
389{
390 return (GDBusInterfaceInfo *) &_fru_interface_info.parent_struct;
391}
392
393/**
394 * fru_override_properties:
395 * @klass: The class structure for a #GObject<!-- -->-derived class.
396 * @property_id_begin: The property id to assign to the first overridden property.
397 *
398 * Overrides all #GObject properties in the #Fru interface for a concrete class.
399 * The properties are overridden in the order they are defined.
400 *
401 * Returns: The last property id.
402 */
403guint
404fru_override_properties (GObjectClass *klass, guint property_id_begin)
405{
406 g_object_class_override_property (klass, property_id_begin++, "label");
407 g_object_class_override_property (klass, property_id_begin++, "location");
408 g_object_class_override_property (klass, property_id_begin++, "state");
409 g_object_class_override_property (klass, property_id_begin++, "manufacturer");
410 g_object_class_override_property (klass, property_id_begin++, "part-num");
411 g_object_class_override_property (klass, property_id_begin++, "serial-num");
412 g_object_class_override_property (klass, property_id_begin++, "date-code");
413 g_object_class_override_property (klass, property_id_begin++, "version");
414 g_object_class_override_property (klass, property_id_begin++, "type");
415 g_object_class_override_property (klass, property_id_begin++, "subtype");
416 g_object_class_override_property (klass, property_id_begin++, "instance-num");
417 return property_id_begin - 1;
418}
419
420
421
422/**
423 * Fru:
424 *
425 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fru.top_of_page">org.openbmc.Fru</link>.
426 */
427
428/**
429 * FruIface:
430 * @parent_iface: The parent interface.
431 * @get_date_code: Getter for the #Fru:date-code property.
432 * @get_instance_num: Getter for the #Fru:instance-num property.
433 * @get_label: Getter for the #Fru:label property.
434 * @get_location: Getter for the #Fru:location property.
435 * @get_manufacturer: Getter for the #Fru:manufacturer property.
436 * @get_part_num: Getter for the #Fru:part-num property.
437 * @get_serial_num: Getter for the #Fru:serial-num property.
438 * @get_state: Getter for the #Fru:state property.
439 * @get_subtype: Getter for the #Fru:subtype property.
440 * @get_type_: Getter for the #Fru:type property.
441 * @get_version: Getter for the #Fru:version property.
442 * @recoverable_error: Handler for the #Fru::recoverable-error signal.
443 * @state_changed: Handler for the #Fru::state-changed signal.
444 * @unrecoverable_error: Handler for the #Fru::unrecoverable-error signal.
445 *
446 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fru.top_of_page">org.openbmc.Fru</link>.
447 */
448
449typedef FruIface FruInterface;
450G_DEFINE_INTERFACE (Fru, fru, G_TYPE_OBJECT);
451
452static void
453fru_default_init (FruIface *iface)
454{
455 /* GObject signals for received D-Bus signals: */
456 /**
457 * Fru::state-changed:
458 * @object: A #Fru.
459 *
460 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Fru.StateChanged">"StateChanged"</link> is received.
461 *
462 * 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.
463 */
464 g_signal_new ("state-changed",
465 G_TYPE_FROM_INTERFACE (iface),
466 G_SIGNAL_RUN_LAST,
467 G_STRUCT_OFFSET (FruIface, state_changed),
468 NULL,
469 NULL,
470 g_cclosure_marshal_generic,
471 G_TYPE_NONE,
472 0);
473
474 /**
475 * Fru::unrecoverable-error:
476 * @object: A #Fru.
477 *
478 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Fru.UnrecoverableError">"UnrecoverableError"</link> is received.
479 *
480 * 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.
481 */
482 g_signal_new ("unrecoverable-error",
483 G_TYPE_FROM_INTERFACE (iface),
484 G_SIGNAL_RUN_LAST,
485 G_STRUCT_OFFSET (FruIface, unrecoverable_error),
486 NULL,
487 NULL,
488 g_cclosure_marshal_generic,
489 G_TYPE_NONE,
490 0);
491
492 /**
493 * Fru::recoverable-error:
494 * @object: A #Fru.
495 *
496 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Fru.RecoverableError">"RecoverableError"</link> is received.
497 *
498 * 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.
499 */
500 g_signal_new ("recoverable-error",
501 G_TYPE_FROM_INTERFACE (iface),
502 G_SIGNAL_RUN_LAST,
503 G_STRUCT_OFFSET (FruIface, recoverable_error),
504 NULL,
505 NULL,
506 g_cclosure_marshal_generic,
507 G_TYPE_NONE,
508 0);
509
510 /* GObject properties for D-Bus properties: */
511 /**
512 * Fru:label:
513 *
514 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fru.label">"label"</link>.
515 *
516 * 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.
517 */
518 g_object_interface_install_property (iface,
519 g_param_spec_string ("label", "label", "label", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
520 /**
521 * Fru:location:
522 *
523 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fru.location">"location"</link>.
524 *
525 * 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.
526 */
527 g_object_interface_install_property (iface,
528 g_param_spec_string ("location", "location", "location", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
529 /**
530 * Fru:state:
531 *
532 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fru.state">"state"</link>.
533 *
534 * 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.
535 */
536 g_object_interface_install_property (iface,
537 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
538 /**
539 * Fru:manufacturer:
540 *
541 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fru.manufacturer">"manufacturer"</link>.
542 *
543 * 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.
544 */
545 g_object_interface_install_property (iface,
546 g_param_spec_string ("manufacturer", "manufacturer", "manufacturer", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
547 /**
548 * Fru:part-num:
549 *
550 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fru.part_num">"part_num"</link>.
551 *
552 * 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.
553 */
554 g_object_interface_install_property (iface,
555 g_param_spec_string ("part-num", "part_num", "part_num", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
556 /**
557 * Fru:serial-num:
558 *
559 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fru.serial_num">"serial_num"</link>.
560 *
561 * 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.
562 */
563 g_object_interface_install_property (iface,
564 g_param_spec_string ("serial-num", "serial_num", "serial_num", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
565 /**
566 * Fru:date-code:
567 *
568 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fru.date_code">"date_code"</link>.
569 *
570 * 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.
571 */
572 g_object_interface_install_property (iface,
573 g_param_spec_uint ("date-code", "date_code", "date_code", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
574 /**
575 * Fru:version:
576 *
577 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fru.version">"version"</link>.
578 *
579 * 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.
580 */
581 g_object_interface_install_property (iface,
582 g_param_spec_string ("version", "version", "version", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
583 /**
584 * Fru:type:
585 *
586 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fru.type">"type"</link>.
587 *
588 * 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.
589 */
590 g_object_interface_install_property (iface,
591 g_param_spec_uchar ("type", "type", "type", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
592 /**
593 * Fru:subtype:
594 *
595 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fru.subtype">"subtype"</link>.
596 *
597 * 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.
598 */
599 g_object_interface_install_property (iface,
600 g_param_spec_uchar ("subtype", "subtype", "subtype", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
601 /**
602 * Fru:instance-num:
603 *
604 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fru.instance_num">"instance_num"</link>.
605 *
606 * 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.
607 */
608 g_object_interface_install_property (iface,
609 g_param_spec_uchar ("instance-num", "instance_num", "instance_num", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
610}
611
612/**
613 * fru_get_label: (skip)
614 * @object: A #Fru.
615 *
616 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fru.label">"label"</link> D-Bus property.
617 *
618 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
619 *
620 * <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 fru_dup_label() if on another thread.</warning>
621 *
622 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
623 */
624const gchar *
625fru_get_label (Fru *object)
626{
627 return FRU_GET_IFACE (object)->get_label (object);
628}
629
630/**
631 * fru_dup_label: (skip)
632 * @object: A #Fru.
633 *
634 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Fru.label">"label"</link> D-Bus property.
635 *
636 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
637 *
638 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
639 */
640gchar *
641fru_dup_label (Fru *object)
642{
643 gchar *value;
644 g_object_get (G_OBJECT (object), "label", &value, NULL);
645 return value;
646}
647
648/**
649 * fru_set_label: (skip)
650 * @object: A #Fru.
651 * @value: The value to set.
652 *
653 * Sets the <link linkend="gdbus-property-org-openbmc-Fru.label">"label"</link> D-Bus property to @value.
654 *
655 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
656 */
657void
658fru_set_label (Fru *object, const gchar *value)
659{
660 g_object_set (G_OBJECT (object), "label", value, NULL);
661}
662
663/**
664 * fru_get_location: (skip)
665 * @object: A #Fru.
666 *
667 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fru.location">"location"</link> D-Bus property.
668 *
669 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
670 *
671 * <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 fru_dup_location() if on another thread.</warning>
672 *
673 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
674 */
675const gchar *
676fru_get_location (Fru *object)
677{
678 return FRU_GET_IFACE (object)->get_location (object);
679}
680
681/**
682 * fru_dup_location: (skip)
683 * @object: A #Fru.
684 *
685 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Fru.location">"location"</link> D-Bus property.
686 *
687 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
688 *
689 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
690 */
691gchar *
692fru_dup_location (Fru *object)
693{
694 gchar *value;
695 g_object_get (G_OBJECT (object), "location", &value, NULL);
696 return value;
697}
698
699/**
700 * fru_set_location: (skip)
701 * @object: A #Fru.
702 * @value: The value to set.
703 *
704 * Sets the <link linkend="gdbus-property-org-openbmc-Fru.location">"location"</link> D-Bus property to @value.
705 *
706 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
707 */
708void
709fru_set_location (Fru *object, const gchar *value)
710{
711 g_object_set (G_OBJECT (object), "location", value, NULL);
712}
713
714/**
715 * fru_get_state: (skip)
716 * @object: A #Fru.
717 *
718 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fru.state">"state"</link> D-Bus property.
719 *
720 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
721 *
722 * Returns: The property value.
723 */
724guchar
725fru_get_state (Fru *object)
726{
727 return FRU_GET_IFACE (object)->get_state (object);
728}
729
730/**
731 * fru_set_state: (skip)
732 * @object: A #Fru.
733 * @value: The value to set.
734 *
735 * Sets the <link linkend="gdbus-property-org-openbmc-Fru.state">"state"</link> D-Bus property to @value.
736 *
737 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
738 */
739void
740fru_set_state (Fru *object, guchar value)
741{
742 g_object_set (G_OBJECT (object), "state", value, NULL);
743}
744
745/**
746 * fru_get_manufacturer: (skip)
747 * @object: A #Fru.
748 *
749 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fru.manufacturer">"manufacturer"</link> D-Bus property.
750 *
751 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
752 *
753 * <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 fru_dup_manufacturer() if on another thread.</warning>
754 *
755 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
756 */
757const gchar *
758fru_get_manufacturer (Fru *object)
759{
760 return FRU_GET_IFACE (object)->get_manufacturer (object);
761}
762
763/**
764 * fru_dup_manufacturer: (skip)
765 * @object: A #Fru.
766 *
767 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Fru.manufacturer">"manufacturer"</link> D-Bus property.
768 *
769 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
770 *
771 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
772 */
773gchar *
774fru_dup_manufacturer (Fru *object)
775{
776 gchar *value;
777 g_object_get (G_OBJECT (object), "manufacturer", &value, NULL);
778 return value;
779}
780
781/**
782 * fru_set_manufacturer: (skip)
783 * @object: A #Fru.
784 * @value: The value to set.
785 *
786 * Sets the <link linkend="gdbus-property-org-openbmc-Fru.manufacturer">"manufacturer"</link> D-Bus property to @value.
787 *
788 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
789 */
790void
791fru_set_manufacturer (Fru *object, const gchar *value)
792{
793 g_object_set (G_OBJECT (object), "manufacturer", value, NULL);
794}
795
796/**
797 * fru_get_part_num: (skip)
798 * @object: A #Fru.
799 *
800 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fru.part_num">"part_num"</link> D-Bus property.
801 *
802 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
803 *
804 * <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 fru_dup_part_num() if on another thread.</warning>
805 *
806 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
807 */
808const gchar *
809fru_get_part_num (Fru *object)
810{
811 return FRU_GET_IFACE (object)->get_part_num (object);
812}
813
814/**
815 * fru_dup_part_num: (skip)
816 * @object: A #Fru.
817 *
818 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Fru.part_num">"part_num"</link> D-Bus property.
819 *
820 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
821 *
822 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
823 */
824gchar *
825fru_dup_part_num (Fru *object)
826{
827 gchar *value;
828 g_object_get (G_OBJECT (object), "part-num", &value, NULL);
829 return value;
830}
831
832/**
833 * fru_set_part_num: (skip)
834 * @object: A #Fru.
835 * @value: The value to set.
836 *
837 * Sets the <link linkend="gdbus-property-org-openbmc-Fru.part_num">"part_num"</link> D-Bus property to @value.
838 *
839 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
840 */
841void
842fru_set_part_num (Fru *object, const gchar *value)
843{
844 g_object_set (G_OBJECT (object), "part-num", value, NULL);
845}
846
847/**
848 * fru_get_serial_num: (skip)
849 * @object: A #Fru.
850 *
851 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fru.serial_num">"serial_num"</link> D-Bus property.
852 *
853 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
854 *
855 * <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 fru_dup_serial_num() if on another thread.</warning>
856 *
857 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
858 */
859const gchar *
860fru_get_serial_num (Fru *object)
861{
862 return FRU_GET_IFACE (object)->get_serial_num (object);
863}
864
865/**
866 * fru_dup_serial_num: (skip)
867 * @object: A #Fru.
868 *
869 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Fru.serial_num">"serial_num"</link> D-Bus property.
870 *
871 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
872 *
873 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
874 */
875gchar *
876fru_dup_serial_num (Fru *object)
877{
878 gchar *value;
879 g_object_get (G_OBJECT (object), "serial-num", &value, NULL);
880 return value;
881}
882
883/**
884 * fru_set_serial_num: (skip)
885 * @object: A #Fru.
886 * @value: The value to set.
887 *
888 * Sets the <link linkend="gdbus-property-org-openbmc-Fru.serial_num">"serial_num"</link> D-Bus property to @value.
889 *
890 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
891 */
892void
893fru_set_serial_num (Fru *object, const gchar *value)
894{
895 g_object_set (G_OBJECT (object), "serial-num", value, NULL);
896}
897
898/**
899 * fru_get_date_code: (skip)
900 * @object: A #Fru.
901 *
902 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fru.date_code">"date_code"</link> D-Bus property.
903 *
904 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
905 *
906 * Returns: The property value.
907 */
908guint
909fru_get_date_code (Fru *object)
910{
911 return FRU_GET_IFACE (object)->get_date_code (object);
912}
913
914/**
915 * fru_set_date_code: (skip)
916 * @object: A #Fru.
917 * @value: The value to set.
918 *
919 * Sets the <link linkend="gdbus-property-org-openbmc-Fru.date_code">"date_code"</link> D-Bus property to @value.
920 *
921 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
922 */
923void
924fru_set_date_code (Fru *object, guint value)
925{
926 g_object_set (G_OBJECT (object), "date-code", value, NULL);
927}
928
929/**
930 * fru_get_version: (skip)
931 * @object: A #Fru.
932 *
933 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fru.version">"version"</link> D-Bus property.
934 *
935 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
936 *
937 * <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 fru_dup_version() if on another thread.</warning>
938 *
939 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
940 */
941const gchar *
942fru_get_version (Fru *object)
943{
944 return FRU_GET_IFACE (object)->get_version (object);
945}
946
947/**
948 * fru_dup_version: (skip)
949 * @object: A #Fru.
950 *
951 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Fru.version">"version"</link> D-Bus property.
952 *
953 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
954 *
955 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
956 */
957gchar *
958fru_dup_version (Fru *object)
959{
960 gchar *value;
961 g_object_get (G_OBJECT (object), "version", &value, NULL);
962 return value;
963}
964
965/**
966 * fru_set_version: (skip)
967 * @object: A #Fru.
968 * @value: The value to set.
969 *
970 * Sets the <link linkend="gdbus-property-org-openbmc-Fru.version">"version"</link> D-Bus property to @value.
971 *
972 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
973 */
974void
975fru_set_version (Fru *object, const gchar *value)
976{
977 g_object_set (G_OBJECT (object), "version", value, NULL);
978}
979
980/**
981 * fru_get_type_: (skip)
982 * @object: A #Fru.
983 *
984 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fru.type">"type"</link> D-Bus property.
985 *
986 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
987 *
988 * Returns: The property value.
989 */
990guchar
991fru_get_type_ (Fru *object)
992{
993 return FRU_GET_IFACE (object)->get_type_ (object);
994}
995
996/**
997 * fru_set_type_: (skip)
998 * @object: A #Fru.
999 * @value: The value to set.
1000 *
1001 * Sets the <link linkend="gdbus-property-org-openbmc-Fru.type">"type"</link> D-Bus property to @value.
1002 *
1003 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
1004 */
1005void
1006fru_set_type_ (Fru *object, guchar value)
1007{
1008 g_object_set (G_OBJECT (object), "type", value, NULL);
1009}
1010
1011/**
1012 * fru_get_subtype: (skip)
1013 * @object: A #Fru.
1014 *
1015 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fru.subtype">"subtype"</link> D-Bus property.
1016 *
1017 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
1018 *
1019 * Returns: The property value.
1020 */
1021guchar
1022fru_get_subtype (Fru *object)
1023{
1024 return FRU_GET_IFACE (object)->get_subtype (object);
1025}
1026
1027/**
1028 * fru_set_subtype: (skip)
1029 * @object: A #Fru.
1030 * @value: The value to set.
1031 *
1032 * Sets the <link linkend="gdbus-property-org-openbmc-Fru.subtype">"subtype"</link> D-Bus property to @value.
1033 *
1034 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
1035 */
1036void
1037fru_set_subtype (Fru *object, guchar value)
1038{
1039 g_object_set (G_OBJECT (object), "subtype", value, NULL);
1040}
1041
1042/**
1043 * fru_get_instance_num: (skip)
1044 * @object: A #Fru.
1045 *
1046 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fru.instance_num">"instance_num"</link> D-Bus property.
1047 *
1048 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
1049 *
1050 * Returns: The property value.
1051 */
1052guchar
1053fru_get_instance_num (Fru *object)
1054{
1055 return FRU_GET_IFACE (object)->get_instance_num (object);
1056}
1057
1058/**
1059 * fru_set_instance_num: (skip)
1060 * @object: A #Fru.
1061 * @value: The value to set.
1062 *
1063 * Sets the <link linkend="gdbus-property-org-openbmc-Fru.instance_num">"instance_num"</link> D-Bus property to @value.
1064 *
1065 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
1066 */
1067void
1068fru_set_instance_num (Fru *object, guchar value)
1069{
1070 g_object_set (G_OBJECT (object), "instance-num", value, NULL);
1071}
1072
1073/**
1074 * fru_emit_state_changed:
1075 * @object: A #Fru.
1076 *
1077 * Emits the <link linkend="gdbus-signal-org-openbmc-Fru.StateChanged">"StateChanged"</link> D-Bus signal.
1078 */
1079void
1080fru_emit_state_changed (
1081 Fru *object)
1082{
1083 g_signal_emit_by_name (object, "state-changed");
1084}
1085
1086/**
1087 * fru_emit_unrecoverable_error:
1088 * @object: A #Fru.
1089 *
1090 * Emits the <link linkend="gdbus-signal-org-openbmc-Fru.UnrecoverableError">"UnrecoverableError"</link> D-Bus signal.
1091 */
1092void
1093fru_emit_unrecoverable_error (
1094 Fru *object)
1095{
1096 g_signal_emit_by_name (object, "unrecoverable-error");
1097}
1098
1099/**
1100 * fru_emit_recoverable_error:
1101 * @object: A #Fru.
1102 *
1103 * Emits the <link linkend="gdbus-signal-org-openbmc-Fru.RecoverableError">"RecoverableError"</link> D-Bus signal.
1104 */
1105void
1106fru_emit_recoverable_error (
1107 Fru *object)
1108{
1109 g_signal_emit_by_name (object, "recoverable-error");
1110}
1111
1112/* ------------------------------------------------------------------------ */
1113
1114/**
1115 * FruProxy:
1116 *
1117 * The #FruProxy structure contains only private data and should only be accessed using the provided API.
1118 */
1119
1120/**
1121 * FruProxyClass:
1122 * @parent_class: The parent class.
1123 *
1124 * Class structure for #FruProxy.
1125 */
1126
1127struct _FruProxyPrivate
1128{
1129 GData *qdata;
1130};
1131
1132static void fru_proxy_iface_init (FruIface *iface);
1133
1134#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1135G_DEFINE_TYPE_WITH_CODE (FruProxy, fru_proxy, G_TYPE_DBUS_PROXY,
1136 G_ADD_PRIVATE (FruProxy)
1137 G_IMPLEMENT_INTERFACE (TYPE_FRU, fru_proxy_iface_init));
1138
1139#else
1140G_DEFINE_TYPE_WITH_CODE (FruProxy, fru_proxy, G_TYPE_DBUS_PROXY,
1141 G_IMPLEMENT_INTERFACE (TYPE_FRU, fru_proxy_iface_init));
1142
1143#endif
1144static void
1145fru_proxy_finalize (GObject *object)
1146{
1147 FruProxy *proxy = FRU_PROXY (object);
1148 g_datalist_clear (&proxy->priv->qdata);
1149 G_OBJECT_CLASS (fru_proxy_parent_class)->finalize (object);
1150}
1151
1152static void
1153fru_proxy_get_property (GObject *object,
1154 guint prop_id,
1155 GValue *value,
1156 GParamSpec *pspec G_GNUC_UNUSED)
1157{
1158 const _ExtendedGDBusPropertyInfo *info;
1159 GVariant *variant;
1160 g_assert (prop_id != 0 && prop_id - 1 < 11);
1161 info = _fru_property_info_pointers[prop_id - 1];
1162 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
1163 if (info->use_gvariant)
1164 {
1165 g_value_set_variant (value, variant);
1166 }
1167 else
1168 {
1169 if (variant != NULL)
1170 g_dbus_gvariant_to_gvalue (variant, value);
1171 }
1172 if (variant != NULL)
1173 g_variant_unref (variant);
1174}
1175
1176static void
1177fru_proxy_set_property_cb (GDBusProxy *proxy,
1178 GAsyncResult *res,
1179 gpointer user_data)
1180{
1181 const _ExtendedGDBusPropertyInfo *info = user_data;
1182 GError *error;
1183 GVariant *_ret;
1184 error = NULL;
1185 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
1186 if (!_ret)
1187 {
1188 g_warning ("Error setting property '%s' on interface org.openbmc.Fru: %s (%s, %d)",
1189 info->parent_struct.name,
1190 error->message, g_quark_to_string (error->domain), error->code);
1191 g_error_free (error);
1192 }
1193 else
1194 {
1195 g_variant_unref (_ret);
1196 }
1197}
1198
1199static void
1200fru_proxy_set_property (GObject *object,
1201 guint prop_id,
1202 const GValue *value,
1203 GParamSpec *pspec G_GNUC_UNUSED)
1204{
1205 const _ExtendedGDBusPropertyInfo *info;
1206 GVariant *variant;
1207 g_assert (prop_id != 0 && prop_id - 1 < 11);
1208 info = _fru_property_info_pointers[prop_id - 1];
1209 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
1210 g_dbus_proxy_call (G_DBUS_PROXY (object),
1211 "org.freedesktop.DBus.Properties.Set",
1212 g_variant_new ("(ssv)", "org.openbmc.Fru", info->parent_struct.name, variant),
1213 G_DBUS_CALL_FLAGS_NONE,
1214 -1,
1215 NULL, (GAsyncReadyCallback) fru_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
1216 g_variant_unref (variant);
1217}
1218
1219static void
1220fru_proxy_g_signal (GDBusProxy *proxy,
1221 const gchar *sender_name G_GNUC_UNUSED,
1222 const gchar *signal_name,
1223 GVariant *parameters)
1224{
1225 _ExtendedGDBusSignalInfo *info;
1226 GVariantIter iter;
1227 GVariant *child;
1228 GValue *paramv;
1229 guint num_params;
1230 guint n;
1231 guint signal_id;
1232 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_fru_interface_info.parent_struct, signal_name);
1233 if (info == NULL)
1234 return;
1235 num_params = g_variant_n_children (parameters);
1236 paramv = g_new0 (GValue, num_params + 1);
1237 g_value_init (&paramv[0], TYPE_FRU);
1238 g_value_set_object (&paramv[0], proxy);
1239 g_variant_iter_init (&iter, parameters);
1240 n = 1;
1241 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1242 {
1243 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
1244 if (arg_info->use_gvariant)
1245 {
1246 g_value_init (&paramv[n], G_TYPE_VARIANT);
1247 g_value_set_variant (&paramv[n], child);
1248 n++;
1249 }
1250 else
1251 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
1252 g_variant_unref (child);
1253 }
1254 signal_id = g_signal_lookup (info->signal_name, TYPE_FRU);
1255 g_signal_emitv (paramv, signal_id, 0, NULL);
1256 for (n = 0; n < num_params + 1; n++)
1257 g_value_unset (&paramv[n]);
1258 g_free (paramv);
1259}
1260
1261static void
1262fru_proxy_g_properties_changed (GDBusProxy *_proxy,
1263 GVariant *changed_properties,
1264 const gchar *const *invalidated_properties)
1265{
1266 FruProxy *proxy = FRU_PROXY (_proxy);
1267 guint n;
1268 const gchar *key;
1269 GVariantIter *iter;
1270 _ExtendedGDBusPropertyInfo *info;
1271 g_variant_get (changed_properties, "a{sv}", &iter);
1272 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
1273 {
1274 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fru_interface_info.parent_struct, key);
1275 g_datalist_remove_data (&proxy->priv->qdata, key);
1276 if (info != NULL)
1277 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
1278 }
1279 g_variant_iter_free (iter);
1280 for (n = 0; invalidated_properties[n] != NULL; n++)
1281 {
1282 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fru_interface_info.parent_struct, invalidated_properties[n]);
1283 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
1284 if (info != NULL)
1285 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
1286 }
1287}
1288
1289static const gchar *
1290fru_proxy_get_label (Fru *object)
1291{
1292 FruProxy *proxy = FRU_PROXY (object);
1293 GVariant *variant;
1294 const gchar *value = NULL;
1295 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "label");
1296 if (variant != NULL)
1297 {
1298 value = g_variant_get_string (variant, NULL);
1299 g_variant_unref (variant);
1300 }
1301 return value;
1302}
1303
1304static const gchar *
1305fru_proxy_get_location (Fru *object)
1306{
1307 FruProxy *proxy = FRU_PROXY (object);
1308 GVariant *variant;
1309 const gchar *value = NULL;
1310 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "location");
1311 if (variant != NULL)
1312 {
1313 value = g_variant_get_string (variant, NULL);
1314 g_variant_unref (variant);
1315 }
1316 return value;
1317}
1318
1319static guchar
1320fru_proxy_get_state (Fru *object)
1321{
1322 FruProxy *proxy = FRU_PROXY (object);
1323 GVariant *variant;
1324 guchar value = 0;
1325 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
1326 if (variant != NULL)
1327 {
1328 value = g_variant_get_byte (variant);
1329 g_variant_unref (variant);
1330 }
1331 return value;
1332}
1333
1334static const gchar *
1335fru_proxy_get_manufacturer (Fru *object)
1336{
1337 FruProxy *proxy = FRU_PROXY (object);
1338 GVariant *variant;
1339 const gchar *value = NULL;
1340 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "manufacturer");
1341 if (variant != NULL)
1342 {
1343 value = g_variant_get_string (variant, NULL);
1344 g_variant_unref (variant);
1345 }
1346 return value;
1347}
1348
1349static const gchar *
1350fru_proxy_get_part_num (Fru *object)
1351{
1352 FruProxy *proxy = FRU_PROXY (object);
1353 GVariant *variant;
1354 const gchar *value = NULL;
1355 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "part_num");
1356 if (variant != NULL)
1357 {
1358 value = g_variant_get_string (variant, NULL);
1359 g_variant_unref (variant);
1360 }
1361 return value;
1362}
1363
1364static const gchar *
1365fru_proxy_get_serial_num (Fru *object)
1366{
1367 FruProxy *proxy = FRU_PROXY (object);
1368 GVariant *variant;
1369 const gchar *value = NULL;
1370 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "serial_num");
1371 if (variant != NULL)
1372 {
1373 value = g_variant_get_string (variant, NULL);
1374 g_variant_unref (variant);
1375 }
1376 return value;
1377}
1378
1379static guint
1380fru_proxy_get_date_code (Fru *object)
1381{
1382 FruProxy *proxy = FRU_PROXY (object);
1383 GVariant *variant;
1384 guint value = 0;
1385 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "date_code");
1386 if (variant != NULL)
1387 {
1388 value = g_variant_get_uint32 (variant);
1389 g_variant_unref (variant);
1390 }
1391 return value;
1392}
1393
1394static const gchar *
1395fru_proxy_get_version (Fru *object)
1396{
1397 FruProxy *proxy = FRU_PROXY (object);
1398 GVariant *variant;
1399 const gchar *value = NULL;
1400 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "version");
1401 if (variant != NULL)
1402 {
1403 value = g_variant_get_string (variant, NULL);
1404 g_variant_unref (variant);
1405 }
1406 return value;
1407}
1408
1409static guchar
1410fru_proxy_get_type_ (Fru *object)
1411{
1412 FruProxy *proxy = FRU_PROXY (object);
1413 GVariant *variant;
1414 guchar value = 0;
1415 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "type");
1416 if (variant != NULL)
1417 {
1418 value = g_variant_get_byte (variant);
1419 g_variant_unref (variant);
1420 }
1421 return value;
1422}
1423
1424static guchar
1425fru_proxy_get_subtype (Fru *object)
1426{
1427 FruProxy *proxy = FRU_PROXY (object);
1428 GVariant *variant;
1429 guchar value = 0;
1430 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "subtype");
1431 if (variant != NULL)
1432 {
1433 value = g_variant_get_byte (variant);
1434 g_variant_unref (variant);
1435 }
1436 return value;
1437}
1438
1439static guchar
1440fru_proxy_get_instance_num (Fru *object)
1441{
1442 FruProxy *proxy = FRU_PROXY (object);
1443 GVariant *variant;
1444 guchar value = 0;
1445 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "instance_num");
1446 if (variant != NULL)
1447 {
1448 value = g_variant_get_byte (variant);
1449 g_variant_unref (variant);
1450 }
1451 return value;
1452}
1453
1454static void
1455fru_proxy_init (FruProxy *proxy)
1456{
1457#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1458 proxy->priv = fru_proxy_get_instance_private (proxy);
1459#else
1460 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FRU_PROXY, FruProxyPrivate);
1461#endif
1462
1463 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), fru_interface_info ());
1464}
1465
1466static void
1467fru_proxy_class_init (FruProxyClass *klass)
1468{
1469 GObjectClass *gobject_class;
1470 GDBusProxyClass *proxy_class;
1471
1472 gobject_class = G_OBJECT_CLASS (klass);
1473 gobject_class->finalize = fru_proxy_finalize;
1474 gobject_class->get_property = fru_proxy_get_property;
1475 gobject_class->set_property = fru_proxy_set_property;
1476
1477 proxy_class = G_DBUS_PROXY_CLASS (klass);
1478 proxy_class->g_signal = fru_proxy_g_signal;
1479 proxy_class->g_properties_changed = fru_proxy_g_properties_changed;
1480
1481 fru_override_properties (gobject_class, 1);
1482
1483#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1484 g_type_class_add_private (klass, sizeof (FruProxyPrivate));
1485#endif
1486}
1487
1488static void
1489fru_proxy_iface_init (FruIface *iface)
1490{
1491 iface->get_label = fru_proxy_get_label;
1492 iface->get_location = fru_proxy_get_location;
1493 iface->get_state = fru_proxy_get_state;
1494 iface->get_manufacturer = fru_proxy_get_manufacturer;
1495 iface->get_part_num = fru_proxy_get_part_num;
1496 iface->get_serial_num = fru_proxy_get_serial_num;
1497 iface->get_date_code = fru_proxy_get_date_code;
1498 iface->get_version = fru_proxy_get_version;
1499 iface->get_type_ = fru_proxy_get_type_;
1500 iface->get_subtype = fru_proxy_get_subtype;
1501 iface->get_instance_num = fru_proxy_get_instance_num;
1502}
1503
1504/**
1505 * fru_proxy_new:
1506 * @connection: A #GDBusConnection.
1507 * @flags: Flags from the #GDBusProxyFlags enumeration.
1508 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1509 * @object_path: An object path.
1510 * @cancellable: (allow-none): A #GCancellable or %NULL.
1511 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1512 * @user_data: User data to pass to @callback.
1513 *
1514 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fru.top_of_page">org.openbmc.Fru</link>. See g_dbus_proxy_new() for more details.
1515 *
1516 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
1517 * You can then call fru_proxy_new_finish() to get the result of the operation.
1518 *
1519 * See fru_proxy_new_sync() for the synchronous, blocking version of this constructor.
1520 */
1521void
1522fru_proxy_new (
1523 GDBusConnection *connection,
1524 GDBusProxyFlags flags,
1525 const gchar *name,
1526 const gchar *object_path,
1527 GCancellable *cancellable,
1528 GAsyncReadyCallback callback,
1529 gpointer user_data)
1530{
1531 g_async_initable_new_async (TYPE_FRU_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.Fru", NULL);
1532}
1533
1534/**
1535 * fru_proxy_new_finish:
1536 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fru_proxy_new().
1537 * @error: Return location for error or %NULL
1538 *
1539 * Finishes an operation started with fru_proxy_new().
1540 *
1541 * Returns: (transfer full) (type FruProxy): The constructed proxy object or %NULL if @error is set.
1542 */
1543Fru *
1544fru_proxy_new_finish (
1545 GAsyncResult *res,
1546 GError **error)
1547{
1548 GObject *ret;
1549 GObject *source_object;
1550 source_object = g_async_result_get_source_object (res);
1551 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1552 g_object_unref (source_object);
1553 if (ret != NULL)
1554 return FRU (ret);
1555 else
1556 return NULL;
1557}
1558
1559/**
1560 * fru_proxy_new_sync:
1561 * @connection: A #GDBusConnection.
1562 * @flags: Flags from the #GDBusProxyFlags enumeration.
1563 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1564 * @object_path: An object path.
1565 * @cancellable: (allow-none): A #GCancellable or %NULL.
1566 * @error: Return location for error or %NULL
1567 *
1568 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fru.top_of_page">org.openbmc.Fru</link>. See g_dbus_proxy_new_sync() for more details.
1569 *
1570 * The calling thread is blocked until a reply is received.
1571 *
1572 * See fru_proxy_new() for the asynchronous version of this constructor.
1573 *
1574 * Returns: (transfer full) (type FruProxy): The constructed proxy object or %NULL if @error is set.
1575 */
1576Fru *
1577fru_proxy_new_sync (
1578 GDBusConnection *connection,
1579 GDBusProxyFlags flags,
1580 const gchar *name,
1581 const gchar *object_path,
1582 GCancellable *cancellable,
1583 GError **error)
1584{
1585 GInitable *ret;
1586 ret = g_initable_new (TYPE_FRU_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Fru", NULL);
1587 if (ret != NULL)
1588 return FRU (ret);
1589 else
1590 return NULL;
1591}
1592
1593
1594/**
1595 * fru_proxy_new_for_bus:
1596 * @bus_type: A #GBusType.
1597 * @flags: Flags from the #GDBusProxyFlags enumeration.
1598 * @name: A bus name (well-known or unique).
1599 * @object_path: An object path.
1600 * @cancellable: (allow-none): A #GCancellable or %NULL.
1601 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1602 * @user_data: User data to pass to @callback.
1603 *
1604 * Like fru_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
1605 *
1606 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
1607 * You can then call fru_proxy_new_for_bus_finish() to get the result of the operation.
1608 *
1609 * See fru_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
1610 */
1611void
1612fru_proxy_new_for_bus (
1613 GBusType bus_type,
1614 GDBusProxyFlags flags,
1615 const gchar *name,
1616 const gchar *object_path,
1617 GCancellable *cancellable,
1618 GAsyncReadyCallback callback,
1619 gpointer user_data)
1620{
1621 g_async_initable_new_async (TYPE_FRU_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.Fru", NULL);
1622}
1623
1624/**
1625 * fru_proxy_new_for_bus_finish:
1626 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fru_proxy_new_for_bus().
1627 * @error: Return location for error or %NULL
1628 *
1629 * Finishes an operation started with fru_proxy_new_for_bus().
1630 *
1631 * Returns: (transfer full) (type FruProxy): The constructed proxy object or %NULL if @error is set.
1632 */
1633Fru *
1634fru_proxy_new_for_bus_finish (
1635 GAsyncResult *res,
1636 GError **error)
1637{
1638 GObject *ret;
1639 GObject *source_object;
1640 source_object = g_async_result_get_source_object (res);
1641 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1642 g_object_unref (source_object);
1643 if (ret != NULL)
1644 return FRU (ret);
1645 else
1646 return NULL;
1647}
1648
1649/**
1650 * fru_proxy_new_for_bus_sync:
1651 * @bus_type: A #GBusType.
1652 * @flags: Flags from the #GDBusProxyFlags enumeration.
1653 * @name: A bus name (well-known or unique).
1654 * @object_path: An object path.
1655 * @cancellable: (allow-none): A #GCancellable or %NULL.
1656 * @error: Return location for error or %NULL
1657 *
1658 * Like fru_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
1659 *
1660 * The calling thread is blocked until a reply is received.
1661 *
1662 * See fru_proxy_new_for_bus() for the asynchronous version of this constructor.
1663 *
1664 * Returns: (transfer full) (type FruProxy): The constructed proxy object or %NULL if @error is set.
1665 */
1666Fru *
1667fru_proxy_new_for_bus_sync (
1668 GBusType bus_type,
1669 GDBusProxyFlags flags,
1670 const gchar *name,
1671 const gchar *object_path,
1672 GCancellable *cancellable,
1673 GError **error)
1674{
1675 GInitable *ret;
1676 ret = g_initable_new (TYPE_FRU_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Fru", NULL);
1677 if (ret != NULL)
1678 return FRU (ret);
1679 else
1680 return NULL;
1681}
1682
1683
1684/* ------------------------------------------------------------------------ */
1685
1686/**
1687 * FruSkeleton:
1688 *
1689 * The #FruSkeleton structure contains only private data and should only be accessed using the provided API.
1690 */
1691
1692/**
1693 * FruSkeletonClass:
1694 * @parent_class: The parent class.
1695 *
1696 * Class structure for #FruSkeleton.
1697 */
1698
1699struct _FruSkeletonPrivate
1700{
1701 GValue *properties;
1702 GList *changed_properties;
1703 GSource *changed_properties_idle_source;
1704 GMainContext *context;
1705 GMutex lock;
1706};
1707
1708static void
1709_fru_skeleton_handle_method_call (
1710 GDBusConnection *connection G_GNUC_UNUSED,
1711 const gchar *sender G_GNUC_UNUSED,
1712 const gchar *object_path G_GNUC_UNUSED,
1713 const gchar *interface_name,
1714 const gchar *method_name,
1715 GVariant *parameters,
1716 GDBusMethodInvocation *invocation,
1717 gpointer user_data)
1718{
1719 FruSkeleton *skeleton = FRU_SKELETON (user_data);
1720 _ExtendedGDBusMethodInfo *info;
1721 GVariantIter iter;
1722 GVariant *child;
1723 GValue *paramv;
1724 guint num_params;
1725 guint num_extra;
1726 guint n;
1727 guint signal_id;
1728 GValue return_value = G_VALUE_INIT;
1729 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
1730 g_assert (info != NULL);
1731 num_params = g_variant_n_children (parameters);
1732 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
1733 n = 0;
1734 g_value_init (&paramv[n], TYPE_FRU);
1735 g_value_set_object (&paramv[n++], skeleton);
1736 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
1737 g_value_set_object (&paramv[n++], invocation);
1738 if (info->pass_fdlist)
1739 {
1740#ifdef G_OS_UNIX
1741 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
1742 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
1743#else
1744 g_assert_not_reached ();
1745#endif
1746 }
1747 g_variant_iter_init (&iter, parameters);
1748 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1749 {
1750 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
1751 if (arg_info->use_gvariant)
1752 {
1753 g_value_init (&paramv[n], G_TYPE_VARIANT);
1754 g_value_set_variant (&paramv[n], child);
1755 n++;
1756 }
1757 else
1758 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
1759 g_variant_unref (child);
1760 }
1761 signal_id = g_signal_lookup (info->signal_name, TYPE_FRU);
1762 g_value_init (&return_value, G_TYPE_BOOLEAN);
1763 g_signal_emitv (paramv, signal_id, 0, &return_value);
1764 if (!g_value_get_boolean (&return_value))
1765 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);
1766 g_value_unset (&return_value);
1767 for (n = 0; n < num_params + num_extra; n++)
1768 g_value_unset (&paramv[n]);
1769 g_free (paramv);
1770}
1771
1772static GVariant *
1773_fru_skeleton_handle_get_property (
1774 GDBusConnection *connection G_GNUC_UNUSED,
1775 const gchar *sender G_GNUC_UNUSED,
1776 const gchar *object_path G_GNUC_UNUSED,
1777 const gchar *interface_name G_GNUC_UNUSED,
1778 const gchar *property_name,
1779 GError **error,
1780 gpointer user_data)
1781{
1782 FruSkeleton *skeleton = FRU_SKELETON (user_data);
1783 GValue value = G_VALUE_INIT;
1784 GParamSpec *pspec;
1785 _ExtendedGDBusPropertyInfo *info;
1786 GVariant *ret;
1787 ret = NULL;
1788 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fru_interface_info.parent_struct, property_name);
1789 g_assert (info != NULL);
1790 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1791 if (pspec == NULL)
1792 {
1793 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1794 }
1795 else
1796 {
1797 g_value_init (&value, pspec->value_type);
1798 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1799 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
1800 g_value_unset (&value);
1801 }
1802 return ret;
1803}
1804
1805static gboolean
1806_fru_skeleton_handle_set_property (
1807 GDBusConnection *connection G_GNUC_UNUSED,
1808 const gchar *sender G_GNUC_UNUSED,
1809 const gchar *object_path G_GNUC_UNUSED,
1810 const gchar *interface_name G_GNUC_UNUSED,
1811 const gchar *property_name,
1812 GVariant *variant,
1813 GError **error,
1814 gpointer user_data)
1815{
1816 FruSkeleton *skeleton = FRU_SKELETON (user_data);
1817 GValue value = G_VALUE_INIT;
1818 GParamSpec *pspec;
1819 _ExtendedGDBusPropertyInfo *info;
1820 gboolean ret;
1821 ret = FALSE;
1822 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fru_interface_info.parent_struct, property_name);
1823 g_assert (info != NULL);
1824 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1825 if (pspec == NULL)
1826 {
1827 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1828 }
1829 else
1830 {
1831 if (info->use_gvariant)
1832 g_value_set_variant (&value, variant);
1833 else
1834 g_dbus_gvariant_to_gvalue (variant, &value);
1835 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1836 g_value_unset (&value);
1837 ret = TRUE;
1838 }
1839 return ret;
1840}
1841
1842static const GDBusInterfaceVTable _fru_skeleton_vtable =
1843{
1844 _fru_skeleton_handle_method_call,
1845 _fru_skeleton_handle_get_property,
1846 _fru_skeleton_handle_set_property,
1847 {NULL}
1848};
1849
1850static GDBusInterfaceInfo *
1851fru_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1852{
1853 return fru_interface_info ();
1854}
1855
1856static GDBusInterfaceVTable *
1857fru_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1858{
1859 return (GDBusInterfaceVTable *) &_fru_skeleton_vtable;
1860}
1861
1862static GVariant *
1863fru_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
1864{
1865 FruSkeleton *skeleton = FRU_SKELETON (_skeleton);
1866
1867 GVariantBuilder builder;
1868 guint n;
1869 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1870 if (_fru_interface_info.parent_struct.properties == NULL)
1871 goto out;
1872 for (n = 0; _fru_interface_info.parent_struct.properties[n] != NULL; n++)
1873 {
1874 GDBusPropertyInfo *info = _fru_interface_info.parent_struct.properties[n];
1875 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
1876 {
1877 GVariant *value;
1878 value = _fru_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.Fru", info->name, NULL, skeleton);
1879 if (value != NULL)
1880 {
1881 g_variant_take_ref (value);
1882 g_variant_builder_add (&builder, "{sv}", info->name, value);
1883 g_variant_unref (value);
1884 }
1885 }
1886 }
1887out:
1888 return g_variant_builder_end (&builder);
1889}
1890
1891static gboolean _fru_emit_changed (gpointer user_data);
1892
1893static void
1894fru_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
1895{
1896 FruSkeleton *skeleton = FRU_SKELETON (_skeleton);
1897 gboolean emit_changed = FALSE;
1898
1899 g_mutex_lock (&skeleton->priv->lock);
1900 if (skeleton->priv->changed_properties_idle_source != NULL)
1901 {
1902 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1903 skeleton->priv->changed_properties_idle_source = NULL;
1904 emit_changed = TRUE;
1905 }
1906 g_mutex_unlock (&skeleton->priv->lock);
1907
1908 if (emit_changed)
1909 _fru_emit_changed (skeleton);
1910}
1911
1912static void
1913_fru_on_signal_state_changed (
1914 Fru *object)
1915{
1916 FruSkeleton *skeleton = FRU_SKELETON (object);
1917
1918 GList *connections, *l;
1919 GVariant *signal_variant;
1920 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
1921
1922 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
1923 for (l = connections; l != NULL; l = l->next)
1924 {
1925 GDBusConnection *connection = l->data;
1926 g_dbus_connection_emit_signal (connection,
1927 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fru", "StateChanged",
1928 signal_variant, NULL);
1929 }
1930 g_variant_unref (signal_variant);
1931 g_list_free_full (connections, g_object_unref);
1932}
1933
1934static void
1935_fru_on_signal_unrecoverable_error (
1936 Fru *object)
1937{
1938 FruSkeleton *skeleton = FRU_SKELETON (object);
1939
1940 GList *connections, *l;
1941 GVariant *signal_variant;
1942 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
1943
1944 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
1945 for (l = connections; l != NULL; l = l->next)
1946 {
1947 GDBusConnection *connection = l->data;
1948 g_dbus_connection_emit_signal (connection,
1949 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fru", "UnrecoverableError",
1950 signal_variant, NULL);
1951 }
1952 g_variant_unref (signal_variant);
1953 g_list_free_full (connections, g_object_unref);
1954}
1955
1956static void
1957_fru_on_signal_recoverable_error (
1958 Fru *object)
1959{
1960 FruSkeleton *skeleton = FRU_SKELETON (object);
1961
1962 GList *connections, *l;
1963 GVariant *signal_variant;
1964 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
1965
1966 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
1967 for (l = connections; l != NULL; l = l->next)
1968 {
1969 GDBusConnection *connection = l->data;
1970 g_dbus_connection_emit_signal (connection,
1971 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fru", "RecoverableError",
1972 signal_variant, NULL);
1973 }
1974 g_variant_unref (signal_variant);
1975 g_list_free_full (connections, g_object_unref);
1976}
1977
1978static void fru_skeleton_iface_init (FruIface *iface);
1979#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1980G_DEFINE_TYPE_WITH_CODE (FruSkeleton, fru_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1981 G_ADD_PRIVATE (FruSkeleton)
1982 G_IMPLEMENT_INTERFACE (TYPE_FRU, fru_skeleton_iface_init));
1983
1984#else
1985G_DEFINE_TYPE_WITH_CODE (FruSkeleton, fru_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1986 G_IMPLEMENT_INTERFACE (TYPE_FRU, fru_skeleton_iface_init));
1987
1988#endif
1989static void
1990fru_skeleton_finalize (GObject *object)
1991{
1992 FruSkeleton *skeleton = FRU_SKELETON (object);
1993 guint n;
1994 for (n = 0; n < 11; n++)
1995 g_value_unset (&skeleton->priv->properties[n]);
1996 g_free (skeleton->priv->properties);
1997 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1998 if (skeleton->priv->changed_properties_idle_source != NULL)
1999 g_source_destroy (skeleton->priv->changed_properties_idle_source);
2000 g_main_context_unref (skeleton->priv->context);
2001 g_mutex_clear (&skeleton->priv->lock);
2002 G_OBJECT_CLASS (fru_skeleton_parent_class)->finalize (object);
2003}
2004
2005static void
2006fru_skeleton_get_property (GObject *object,
2007 guint prop_id,
2008 GValue *value,
2009 GParamSpec *pspec G_GNUC_UNUSED)
2010{
2011 FruSkeleton *skeleton = FRU_SKELETON (object);
2012 g_assert (prop_id != 0 && prop_id - 1 < 11);
2013 g_mutex_lock (&skeleton->priv->lock);
2014 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
2015 g_mutex_unlock (&skeleton->priv->lock);
2016}
2017
2018static gboolean
2019_fru_emit_changed (gpointer user_data)
2020{
2021 FruSkeleton *skeleton = FRU_SKELETON (user_data);
2022 GList *l;
2023 GVariantBuilder builder;
2024 GVariantBuilder invalidated_builder;
2025 guint num_changes;
2026
2027 g_mutex_lock (&skeleton->priv->lock);
2028 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
2029 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
2030 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
2031 {
2032 ChangedProperty *cp = l->data;
2033 GVariant *variant;
2034 const GValue *cur_value;
2035
2036 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
2037 if (!_g_value_equal (cur_value, &cp->orig_value))
2038 {
2039 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
2040 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
2041 g_variant_unref (variant);
2042 num_changes++;
2043 }
2044 }
2045 if (num_changes > 0)
2046 {
2047 GList *connections, *ll;
2048 GVariant *signal_variant;
2049 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Fru",
2050 &builder, &invalidated_builder));
2051 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
2052 for (ll = connections; ll != NULL; ll = ll->next)
2053 {
2054 GDBusConnection *connection = ll->data;
2055
2056 g_dbus_connection_emit_signal (connection,
2057 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
2058 "org.freedesktop.DBus.Properties",
2059 "PropertiesChanged",
2060 signal_variant,
2061 NULL);
2062 }
2063 g_variant_unref (signal_variant);
2064 g_list_free_full (connections, g_object_unref);
2065 }
2066 else
2067 {
2068 g_variant_builder_clear (&builder);
2069 g_variant_builder_clear (&invalidated_builder);
2070 }
2071 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
2072 skeleton->priv->changed_properties = NULL;
2073 skeleton->priv->changed_properties_idle_source = NULL;
2074 g_mutex_unlock (&skeleton->priv->lock);
2075 return FALSE;
2076}
2077
2078static void
2079_fru_schedule_emit_changed (FruSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
2080{
2081 ChangedProperty *cp;
2082 GList *l;
2083 cp = NULL;
2084 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
2085 {
2086 ChangedProperty *i_cp = l->data;
2087 if (i_cp->info == info)
2088 {
2089 cp = i_cp;
2090 break;
2091 }
2092 }
2093 if (cp == NULL)
2094 {
2095 cp = g_new0 (ChangedProperty, 1);
2096 cp->prop_id = prop_id;
2097 cp->info = info;
2098 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
2099 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
2100 g_value_copy (orig_value, &cp->orig_value);
2101 }
2102}
2103
2104static void
2105fru_skeleton_notify (GObject *object,
2106 GParamSpec *pspec G_GNUC_UNUSED)
2107{
2108 FruSkeleton *skeleton = FRU_SKELETON (object);
2109 g_mutex_lock (&skeleton->priv->lock);
2110 if (skeleton->priv->changed_properties != NULL &&
2111 skeleton->priv->changed_properties_idle_source == NULL)
2112 {
2113 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
2114 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
2115 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _fru_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
2116 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
2117 g_source_unref (skeleton->priv->changed_properties_idle_source);
2118 }
2119 g_mutex_unlock (&skeleton->priv->lock);
2120}
2121
2122static void
2123fru_skeleton_set_property (GObject *object,
2124 guint prop_id,
2125 const GValue *value,
2126 GParamSpec *pspec)
2127{
2128 FruSkeleton *skeleton = FRU_SKELETON (object);
2129 g_assert (prop_id != 0 && prop_id - 1 < 11);
2130 g_mutex_lock (&skeleton->priv->lock);
2131 g_object_freeze_notify (object);
2132 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
2133 {
2134 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
2135 _fru_schedule_emit_changed (skeleton, _fru_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
2136 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
2137 g_object_notify_by_pspec (object, pspec);
2138 }
2139 g_mutex_unlock (&skeleton->priv->lock);
2140 g_object_thaw_notify (object);
2141}
2142
2143static void
2144fru_skeleton_init (FruSkeleton *skeleton)
2145{
2146#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2147 skeleton->priv = fru_skeleton_get_instance_private (skeleton);
2148#else
2149 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FRU_SKELETON, FruSkeletonPrivate);
2150#endif
2151
2152 g_mutex_init (&skeleton->priv->lock);
2153 skeleton->priv->context = g_main_context_ref_thread_default ();
2154 skeleton->priv->properties = g_new0 (GValue, 11);
2155 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
2156 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
2157 g_value_init (&skeleton->priv->properties[2], G_TYPE_UCHAR);
2158 g_value_init (&skeleton->priv->properties[3], G_TYPE_STRING);
2159 g_value_init (&skeleton->priv->properties[4], G_TYPE_STRING);
2160 g_value_init (&skeleton->priv->properties[5], G_TYPE_STRING);
2161 g_value_init (&skeleton->priv->properties[6], G_TYPE_UINT);
2162 g_value_init (&skeleton->priv->properties[7], G_TYPE_STRING);
2163 g_value_init (&skeleton->priv->properties[8], G_TYPE_UCHAR);
2164 g_value_init (&skeleton->priv->properties[9], G_TYPE_UCHAR);
2165 g_value_init (&skeleton->priv->properties[10], G_TYPE_UCHAR);
2166}
2167
2168static const gchar *
2169fru_skeleton_get_label (Fru *object)
2170{
2171 FruSkeleton *skeleton = FRU_SKELETON (object);
2172 const gchar *value;
2173 g_mutex_lock (&skeleton->priv->lock);
2174 value = g_value_get_string (&(skeleton->priv->properties[0]));
2175 g_mutex_unlock (&skeleton->priv->lock);
2176 return value;
2177}
2178
2179static const gchar *
2180fru_skeleton_get_location (Fru *object)
2181{
2182 FruSkeleton *skeleton = FRU_SKELETON (object);
2183 const gchar *value;
2184 g_mutex_lock (&skeleton->priv->lock);
2185 value = g_value_get_string (&(skeleton->priv->properties[1]));
2186 g_mutex_unlock (&skeleton->priv->lock);
2187 return value;
2188}
2189
2190static guchar
2191fru_skeleton_get_state (Fru *object)
2192{
2193 FruSkeleton *skeleton = FRU_SKELETON (object);
2194 guchar value;
2195 g_mutex_lock (&skeleton->priv->lock);
2196 value = g_value_get_uchar (&(skeleton->priv->properties[2]));
2197 g_mutex_unlock (&skeleton->priv->lock);
2198 return value;
2199}
2200
2201static const gchar *
2202fru_skeleton_get_manufacturer (Fru *object)
2203{
2204 FruSkeleton *skeleton = FRU_SKELETON (object);
2205 const gchar *value;
2206 g_mutex_lock (&skeleton->priv->lock);
2207 value = g_value_get_string (&(skeleton->priv->properties[3]));
2208 g_mutex_unlock (&skeleton->priv->lock);
2209 return value;
2210}
2211
2212static const gchar *
2213fru_skeleton_get_part_num (Fru *object)
2214{
2215 FruSkeleton *skeleton = FRU_SKELETON (object);
2216 const gchar *value;
2217 g_mutex_lock (&skeleton->priv->lock);
2218 value = g_value_get_string (&(skeleton->priv->properties[4]));
2219 g_mutex_unlock (&skeleton->priv->lock);
2220 return value;
2221}
2222
2223static const gchar *
2224fru_skeleton_get_serial_num (Fru *object)
2225{
2226 FruSkeleton *skeleton = FRU_SKELETON (object);
2227 const gchar *value;
2228 g_mutex_lock (&skeleton->priv->lock);
2229 value = g_value_get_string (&(skeleton->priv->properties[5]));
2230 g_mutex_unlock (&skeleton->priv->lock);
2231 return value;
2232}
2233
2234static guint
2235fru_skeleton_get_date_code (Fru *object)
2236{
2237 FruSkeleton *skeleton = FRU_SKELETON (object);
2238 guint value;
2239 g_mutex_lock (&skeleton->priv->lock);
2240 value = g_value_get_uint (&(skeleton->priv->properties[6]));
2241 g_mutex_unlock (&skeleton->priv->lock);
2242 return value;
2243}
2244
2245static const gchar *
2246fru_skeleton_get_version (Fru *object)
2247{
2248 FruSkeleton *skeleton = FRU_SKELETON (object);
2249 const gchar *value;
2250 g_mutex_lock (&skeleton->priv->lock);
2251 value = g_value_get_string (&(skeleton->priv->properties[7]));
2252 g_mutex_unlock (&skeleton->priv->lock);
2253 return value;
2254}
2255
2256static guchar
2257fru_skeleton_get_type_ (Fru *object)
2258{
2259 FruSkeleton *skeleton = FRU_SKELETON (object);
2260 guchar value;
2261 g_mutex_lock (&skeleton->priv->lock);
2262 value = g_value_get_uchar (&(skeleton->priv->properties[8]));
2263 g_mutex_unlock (&skeleton->priv->lock);
2264 return value;
2265}
2266
2267static guchar
2268fru_skeleton_get_subtype (Fru *object)
2269{
2270 FruSkeleton *skeleton = FRU_SKELETON (object);
2271 guchar value;
2272 g_mutex_lock (&skeleton->priv->lock);
2273 value = g_value_get_uchar (&(skeleton->priv->properties[9]));
2274 g_mutex_unlock (&skeleton->priv->lock);
2275 return value;
2276}
2277
2278static guchar
2279fru_skeleton_get_instance_num (Fru *object)
2280{
2281 FruSkeleton *skeleton = FRU_SKELETON (object);
2282 guchar value;
2283 g_mutex_lock (&skeleton->priv->lock);
2284 value = g_value_get_uchar (&(skeleton->priv->properties[10]));
2285 g_mutex_unlock (&skeleton->priv->lock);
2286 return value;
2287}
2288
2289static void
2290fru_skeleton_class_init (FruSkeletonClass *klass)
2291{
2292 GObjectClass *gobject_class;
2293 GDBusInterfaceSkeletonClass *skeleton_class;
2294
2295 gobject_class = G_OBJECT_CLASS (klass);
2296 gobject_class->finalize = fru_skeleton_finalize;
2297 gobject_class->get_property = fru_skeleton_get_property;
2298 gobject_class->set_property = fru_skeleton_set_property;
2299 gobject_class->notify = fru_skeleton_notify;
2300
2301
2302 fru_override_properties (gobject_class, 1);
2303
2304 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
2305 skeleton_class->get_info = fru_skeleton_dbus_interface_get_info;
2306 skeleton_class->get_properties = fru_skeleton_dbus_interface_get_properties;
2307 skeleton_class->flush = fru_skeleton_dbus_interface_flush;
2308 skeleton_class->get_vtable = fru_skeleton_dbus_interface_get_vtable;
2309
2310#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
2311 g_type_class_add_private (klass, sizeof (FruSkeletonPrivate));
2312#endif
2313}
2314
2315static void
2316fru_skeleton_iface_init (FruIface *iface)
2317{
2318 iface->state_changed = _fru_on_signal_state_changed;
2319 iface->unrecoverable_error = _fru_on_signal_unrecoverable_error;
2320 iface->recoverable_error = _fru_on_signal_recoverable_error;
2321 iface->get_label = fru_skeleton_get_label;
2322 iface->get_location = fru_skeleton_get_location;
2323 iface->get_state = fru_skeleton_get_state;
2324 iface->get_manufacturer = fru_skeleton_get_manufacturer;
2325 iface->get_part_num = fru_skeleton_get_part_num;
2326 iface->get_serial_num = fru_skeleton_get_serial_num;
2327 iface->get_date_code = fru_skeleton_get_date_code;
2328 iface->get_version = fru_skeleton_get_version;
2329 iface->get_type_ = fru_skeleton_get_type_;
2330 iface->get_subtype = fru_skeleton_get_subtype;
2331 iface->get_instance_num = fru_skeleton_get_instance_num;
2332}
2333
2334/**
2335 * fru_skeleton_new:
2336 *
2337 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fru.top_of_page">org.openbmc.Fru</link>.
2338 *
2339 * Returns: (transfer full) (type FruSkeleton): The skeleton object.
2340 */
2341Fru *
2342fru_skeleton_new (void)
2343{
2344 return FRU (g_object_new (TYPE_FRU_SKELETON, NULL));
2345}
2346
2347/* ------------------------------------------------------------------------
2348 * Code for interface org.openbmc.Fru.Fan
2349 * ------------------------------------------------------------------------
2350 */
2351
2352/**
2353 * SECTION:FruFan
2354 * @title: FruFan
2355 * @short_description: Generated C code for the org.openbmc.Fru.Fan D-Bus interface
2356 *
2357 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Fru-Fan.top_of_page">org.openbmc.Fru.Fan</link> D-Bus interface in C.
2358 */
2359
2360/* ---- Introspection data for org.openbmc.Fru.Fan ---- */
2361
2362static const _ExtendedGDBusArgInfo _fru_fan_method_info_set_cooling_zone_IN_ARG_cooling_zone =
2363{
2364 {
2365 -1,
2366 (gchar *) "cooling_zone",
2367 (gchar *) "i",
2368 NULL
2369 },
2370 FALSE
2371};
2372
2373static const _ExtendedGDBusArgInfo * const _fru_fan_method_info_set_cooling_zone_IN_ARG_pointers[] =
2374{
2375 &_fru_fan_method_info_set_cooling_zone_IN_ARG_cooling_zone,
2376 NULL
2377};
2378
2379static const _ExtendedGDBusMethodInfo _fru_fan_method_info_set_cooling_zone =
2380{
2381 {
2382 -1,
2383 (gchar *) "setCoolingZone",
2384 (GDBusArgInfo **) &_fru_fan_method_info_set_cooling_zone_IN_ARG_pointers,
2385 NULL,
2386 NULL
2387 },
2388 "handle-set-cooling-zone",
2389 FALSE
2390};
2391
2392static const _ExtendedGDBusArgInfo _fru_fan_method_info_get_speed_OUT_ARG_speed =
2393{
2394 {
2395 -1,
2396 (gchar *) "speed",
2397 (gchar *) "i",
2398 NULL
2399 },
2400 FALSE
2401};
2402
2403static const _ExtendedGDBusArgInfo * const _fru_fan_method_info_get_speed_OUT_ARG_pointers[] =
2404{
2405 &_fru_fan_method_info_get_speed_OUT_ARG_speed,
2406 NULL
2407};
2408
2409static const _ExtendedGDBusMethodInfo _fru_fan_method_info_get_speed =
2410{
2411 {
2412 -1,
2413 (gchar *) "getSpeed",
2414 NULL,
2415 (GDBusArgInfo **) &_fru_fan_method_info_get_speed_OUT_ARG_pointers,
2416 NULL
2417 },
2418 "handle-get-speed",
2419 FALSE
2420};
2421
2422static const _ExtendedGDBusArgInfo _fru_fan_method_info_set_speed_IN_ARG_speed =
2423{
2424 {
2425 -1,
2426 (gchar *) "speed",
2427 (gchar *) "i",
2428 NULL
2429 },
2430 FALSE
2431};
2432
2433static const _ExtendedGDBusArgInfo * const _fru_fan_method_info_set_speed_IN_ARG_pointers[] =
2434{
2435 &_fru_fan_method_info_set_speed_IN_ARG_speed,
2436 NULL
2437};
2438
2439static const _ExtendedGDBusMethodInfo _fru_fan_method_info_set_speed =
2440{
2441 {
2442 -1,
2443 (gchar *) "setSpeed",
2444 (GDBusArgInfo **) &_fru_fan_method_info_set_speed_IN_ARG_pointers,
2445 NULL,
2446 NULL
2447 },
2448 "handle-set-speed",
2449 FALSE
2450};
2451
2452static const _ExtendedGDBusArgInfo _fru_fan_method_info_set_config_data_IN_ARG_pwm_num =
2453{
2454 {
2455 -1,
2456 (gchar *) "pwm_num",
2457 (gchar *) "i",
2458 NULL
2459 },
2460 FALSE
2461};
2462
2463static const _ExtendedGDBusArgInfo * const _fru_fan_method_info_set_config_data_IN_ARG_pointers[] =
2464{
2465 &_fru_fan_method_info_set_config_data_IN_ARG_pwm_num,
2466 NULL
2467};
2468
2469static const _ExtendedGDBusMethodInfo _fru_fan_method_info_set_config_data =
2470{
2471 {
2472 -1,
2473 (gchar *) "setConfigData",
2474 (GDBusArgInfo **) &_fru_fan_method_info_set_config_data_IN_ARG_pointers,
2475 NULL,
2476 NULL
2477 },
2478 "handle-set-config-data",
2479 FALSE
2480};
2481
2482static const _ExtendedGDBusMethodInfo * const _fru_fan_method_info_pointers[] =
2483{
2484 &_fru_fan_method_info_set_cooling_zone,
2485 &_fru_fan_method_info_get_speed,
2486 &_fru_fan_method_info_set_speed,
2487 &_fru_fan_method_info_set_config_data,
2488 NULL
2489};
2490
2491static const _ExtendedGDBusArgInfo _fru_fan_signal_info_speed_changed_ARG_speed =
2492{
2493 {
2494 -1,
2495 (gchar *) "speed",
2496 (gchar *) "i",
2497 NULL
2498 },
2499 FALSE
2500};
2501
2502static const _ExtendedGDBusArgInfo * const _fru_fan_signal_info_speed_changed_ARG_pointers[] =
2503{
2504 &_fru_fan_signal_info_speed_changed_ARG_speed,
2505 NULL
2506};
2507
2508static const _ExtendedGDBusSignalInfo _fru_fan_signal_info_speed_changed =
2509{
2510 {
2511 -1,
2512 (gchar *) "SpeedChanged",
2513 (GDBusArgInfo **) &_fru_fan_signal_info_speed_changed_ARG_pointers,
2514 NULL
2515 },
2516 "speed-changed"
2517};
2518
2519static const _ExtendedGDBusSignalInfo _fru_fan_signal_info_tach_error =
2520{
2521 {
2522 -1,
2523 (gchar *) "TachError",
2524 NULL,
2525 NULL
2526 },
2527 "tach-error"
2528};
2529
2530static const _ExtendedGDBusSignalInfo * const _fru_fan_signal_info_pointers[] =
2531{
2532 &_fru_fan_signal_info_speed_changed,
2533 &_fru_fan_signal_info_tach_error,
2534 NULL
2535};
2536
2537static const _ExtendedGDBusPropertyInfo _fru_fan_property_info_speed =
2538{
2539 {
2540 -1,
2541 (gchar *) "speed",
2542 (gchar *) "i",
2543 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
2544 NULL
2545 },
2546 "speed",
2547 FALSE
2548};
2549
2550static const _ExtendedGDBusPropertyInfo _fru_fan_property_info_cooling_zone =
2551{
2552 {
2553 -1,
2554 (gchar *) "cooling_zone",
2555 (gchar *) "i",
2556 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
2557 NULL
2558 },
2559 "cooling-zone",
2560 FALSE
2561};
2562
2563static const _ExtendedGDBusPropertyInfo * const _fru_fan_property_info_pointers[] =
2564{
2565 &_fru_fan_property_info_speed,
2566 &_fru_fan_property_info_cooling_zone,
2567 NULL
2568};
2569
2570static const _ExtendedGDBusInterfaceInfo _fru_fan_interface_info =
2571{
2572 {
2573 -1,
2574 (gchar *) "org.openbmc.Fru.Fan",
2575 (GDBusMethodInfo **) &_fru_fan_method_info_pointers,
2576 (GDBusSignalInfo **) &_fru_fan_signal_info_pointers,
2577 (GDBusPropertyInfo **) &_fru_fan_property_info_pointers,
2578 NULL
2579 },
2580 "fru-fan",
2581};
2582
2583
2584/**
2585 * fru_fan_interface_info:
2586 *
2587 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Fru-Fan.top_of_page">org.openbmc.Fru.Fan</link> D-Bus interface.
2588 *
2589 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
2590 */
2591GDBusInterfaceInfo *
2592fru_fan_interface_info (void)
2593{
2594 return (GDBusInterfaceInfo *) &_fru_fan_interface_info.parent_struct;
2595}
2596
2597/**
2598 * fru_fan_override_properties:
2599 * @klass: The class structure for a #GObject<!-- -->-derived class.
2600 * @property_id_begin: The property id to assign to the first overridden property.
2601 *
2602 * Overrides all #GObject properties in the #FruFan interface for a concrete class.
2603 * The properties are overridden in the order they are defined.
2604 *
2605 * Returns: The last property id.
2606 */
2607guint
2608fru_fan_override_properties (GObjectClass *klass, guint property_id_begin)
2609{
2610 g_object_class_override_property (klass, property_id_begin++, "speed");
2611 g_object_class_override_property (klass, property_id_begin++, "cooling-zone");
2612 return property_id_begin - 1;
2613}
2614
2615
2616
2617/**
2618 * FruFan:
2619 *
2620 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fru-Fan.top_of_page">org.openbmc.Fru.Fan</link>.
2621 */
2622
2623/**
2624 * FruFanIface:
2625 * @parent_iface: The parent interface.
2626 * @handle_get_speed: Handler for the #FruFan::handle-get-speed signal.
2627 * @handle_set_config_data: Handler for the #FruFan::handle-set-config-data signal.
2628 * @handle_set_cooling_zone: Handler for the #FruFan::handle-set-cooling-zone signal.
2629 * @handle_set_speed: Handler for the #FruFan::handle-set-speed signal.
2630 * @get_cooling_zone: Getter for the #FruFan:cooling-zone property.
2631 * @get_speed: Getter for the #FruFan:speed property.
2632 * @speed_changed: Handler for the #FruFan::speed-changed signal.
2633 * @tach_error: Handler for the #FruFan::tach-error signal.
2634 *
2635 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fru-Fan.top_of_page">org.openbmc.Fru.Fan</link>.
2636 */
2637
2638typedef FruFanIface FruFanInterface;
2639G_DEFINE_INTERFACE (FruFan, fru_fan, G_TYPE_OBJECT);
2640
2641static void
2642fru_fan_default_init (FruFanIface *iface)
2643{
2644 /* GObject signals for incoming D-Bus method calls: */
2645 /**
2646 * FruFan::handle-set-cooling-zone:
2647 * @object: A #FruFan.
2648 * @invocation: A #GDBusMethodInvocation.
2649 * @arg_cooling_zone: Argument passed by remote caller.
2650 *
2651 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fru-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method.
2652 *
2653 * 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 fru_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.
2654 *
2655 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
2656 */
2657 g_signal_new ("handle-set-cooling-zone",
2658 G_TYPE_FROM_INTERFACE (iface),
2659 G_SIGNAL_RUN_LAST,
2660 G_STRUCT_OFFSET (FruFanIface, handle_set_cooling_zone),
2661 g_signal_accumulator_true_handled,
2662 NULL,
2663 g_cclosure_marshal_generic,
2664 G_TYPE_BOOLEAN,
2665 2,
2666 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
2667
2668 /**
2669 * FruFan::handle-get-speed:
2670 * @object: A #FruFan.
2671 * @invocation: A #GDBusMethodInvocation.
2672 *
2673 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fru-Fan.getSpeed">getSpeed()</link> D-Bus method.
2674 *
2675 * 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 fru_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.
2676 *
2677 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
2678 */
2679 g_signal_new ("handle-get-speed",
2680 G_TYPE_FROM_INTERFACE (iface),
2681 G_SIGNAL_RUN_LAST,
2682 G_STRUCT_OFFSET (FruFanIface, handle_get_speed),
2683 g_signal_accumulator_true_handled,
2684 NULL,
2685 g_cclosure_marshal_generic,
2686 G_TYPE_BOOLEAN,
2687 1,
2688 G_TYPE_DBUS_METHOD_INVOCATION);
2689
2690 /**
2691 * FruFan::handle-set-speed:
2692 * @object: A #FruFan.
2693 * @invocation: A #GDBusMethodInvocation.
2694 * @arg_speed: Argument passed by remote caller.
2695 *
2696 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fru-Fan.setSpeed">setSpeed()</link> D-Bus method.
2697 *
2698 * 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 fru_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.
2699 *
2700 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
2701 */
2702 g_signal_new ("handle-set-speed",
2703 G_TYPE_FROM_INTERFACE (iface),
2704 G_SIGNAL_RUN_LAST,
2705 G_STRUCT_OFFSET (FruFanIface, handle_set_speed),
2706 g_signal_accumulator_true_handled,
2707 NULL,
2708 g_cclosure_marshal_generic,
2709 G_TYPE_BOOLEAN,
2710 2,
2711 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
2712
2713 /**
2714 * FruFan::handle-set-config-data:
2715 * @object: A #FruFan.
2716 * @invocation: A #GDBusMethodInvocation.
2717 * @arg_pwm_num: Argument passed by remote caller.
2718 *
2719 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fru-Fan.setConfigData">setConfigData()</link> D-Bus method.
2720 *
2721 * 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 fru_fan_complete_set_config_data() 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.
2722 *
2723 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
2724 */
2725 g_signal_new ("handle-set-config-data",
2726 G_TYPE_FROM_INTERFACE (iface),
2727 G_SIGNAL_RUN_LAST,
2728 G_STRUCT_OFFSET (FruFanIface, handle_set_config_data),
2729 g_signal_accumulator_true_handled,
2730 NULL,
2731 g_cclosure_marshal_generic,
2732 G_TYPE_BOOLEAN,
2733 2,
2734 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
2735
2736 /* GObject signals for received D-Bus signals: */
2737 /**
2738 * FruFan::speed-changed:
2739 * @object: A #FruFan.
2740 * @arg_speed: Argument.
2741 *
2742 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Fru-Fan.SpeedChanged">"SpeedChanged"</link> is received.
2743 *
2744 * 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.
2745 */
2746 g_signal_new ("speed-changed",
2747 G_TYPE_FROM_INTERFACE (iface),
2748 G_SIGNAL_RUN_LAST,
2749 G_STRUCT_OFFSET (FruFanIface, speed_changed),
2750 NULL,
2751 NULL,
2752 g_cclosure_marshal_generic,
2753 G_TYPE_NONE,
2754 1, G_TYPE_INT);
2755
2756 /**
2757 * FruFan::tach-error:
2758 * @object: A #FruFan.
2759 *
2760 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Fru-Fan.TachError">"TachError"</link> is received.
2761 *
2762 * 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.
2763 */
2764 g_signal_new ("tach-error",
2765 G_TYPE_FROM_INTERFACE (iface),
2766 G_SIGNAL_RUN_LAST,
2767 G_STRUCT_OFFSET (FruFanIface, tach_error),
2768 NULL,
2769 NULL,
2770 g_cclosure_marshal_generic,
2771 G_TYPE_NONE,
2772 0);
2773
2774 /* GObject properties for D-Bus properties: */
2775 /**
2776 * FruFan:speed:
2777 *
2778 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fru-Fan.speed">"speed"</link>.
2779 *
2780 * 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.
2781 */
2782 g_object_interface_install_property (iface,
2783 g_param_spec_int ("speed", "speed", "speed", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2784 /**
2785 * FruFan:cooling-zone:
2786 *
2787 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fru-Fan.cooling_zone">"cooling_zone"</link>.
2788 *
2789 * 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.
2790 */
2791 g_object_interface_install_property (iface,
2792 g_param_spec_int ("cooling-zone", "cooling_zone", "cooling_zone", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2793}
2794
2795/**
2796 * fru_fan_get_speed: (skip)
2797 * @object: A #FruFan.
2798 *
2799 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fru-Fan.speed">"speed"</link> D-Bus property.
2800 *
2801 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
2802 *
2803 * Returns: The property value.
2804 */
2805gint
2806fru_fan_get_speed (FruFan *object)
2807{
2808 return FRU_FAN_GET_IFACE (object)->get_speed (object);
2809}
2810
2811/**
2812 * fru_fan_set_speed: (skip)
2813 * @object: A #FruFan.
2814 * @value: The value to set.
2815 *
2816 * Sets the <link linkend="gdbus-property-org-openbmc-Fru-Fan.speed">"speed"</link> D-Bus property to @value.
2817 *
2818 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
2819 */
2820void
2821fru_fan_set_speed (FruFan *object, gint value)
2822{
2823 g_object_set (G_OBJECT (object), "speed", value, NULL);
2824}
2825
2826/**
2827 * fru_fan_get_cooling_zone: (skip)
2828 * @object: A #FruFan.
2829 *
2830 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fru-Fan.cooling_zone">"cooling_zone"</link> D-Bus property.
2831 *
2832 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
2833 *
2834 * Returns: The property value.
2835 */
2836gint
2837fru_fan_get_cooling_zone (FruFan *object)
2838{
2839 return FRU_FAN_GET_IFACE (object)->get_cooling_zone (object);
2840}
2841
2842/**
2843 * fru_fan_set_cooling_zone: (skip)
2844 * @object: A #FruFan.
2845 * @value: The value to set.
2846 *
2847 * Sets the <link linkend="gdbus-property-org-openbmc-Fru-Fan.cooling_zone">"cooling_zone"</link> D-Bus property to @value.
2848 *
2849 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
2850 */
2851void
2852fru_fan_set_cooling_zone (FruFan *object, gint value)
2853{
2854 g_object_set (G_OBJECT (object), "cooling-zone", value, NULL);
2855}
2856
2857/**
2858 * fru_fan_emit_speed_changed:
2859 * @object: A #FruFan.
2860 * @arg_speed: Argument to pass with the signal.
2861 *
2862 * Emits the <link linkend="gdbus-signal-org-openbmc-Fru-Fan.SpeedChanged">"SpeedChanged"</link> D-Bus signal.
2863 */
2864void
2865fru_fan_emit_speed_changed (
2866 FruFan *object,
2867 gint arg_speed)
2868{
2869 g_signal_emit_by_name (object, "speed-changed", arg_speed);
2870}
2871
2872/**
2873 * fru_fan_emit_tach_error:
2874 * @object: A #FruFan.
2875 *
2876 * Emits the <link linkend="gdbus-signal-org-openbmc-Fru-Fan.TachError">"TachError"</link> D-Bus signal.
2877 */
2878void
2879fru_fan_emit_tach_error (
2880 FruFan *object)
2881{
2882 g_signal_emit_by_name (object, "tach-error");
2883}
2884
2885/**
2886 * fru_fan_call_set_cooling_zone:
2887 * @proxy: A #FruFanProxy.
2888 * @arg_cooling_zone: Argument to pass with the method invocation.
2889 * @cancellable: (allow-none): A #GCancellable or %NULL.
2890 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2891 * @user_data: User data to pass to @callback.
2892 *
2893 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fru-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method on @proxy.
2894 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
2895 * You can then call fru_fan_call_set_cooling_zone_finish() to get the result of the operation.
2896 *
2897 * See fru_fan_call_set_cooling_zone_sync() for the synchronous, blocking version of this method.
2898 */
2899void
2900fru_fan_call_set_cooling_zone (
2901 FruFan *proxy,
2902 gint arg_cooling_zone,
2903 GCancellable *cancellable,
2904 GAsyncReadyCallback callback,
2905 gpointer user_data)
2906{
2907 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2908 "setCoolingZone",
2909 g_variant_new ("(i)",
2910 arg_cooling_zone),
2911 G_DBUS_CALL_FLAGS_NONE,
2912 -1,
2913 cancellable,
2914 callback,
2915 user_data);
2916}
2917
2918/**
2919 * fru_fan_call_set_cooling_zone_finish:
2920 * @proxy: A #FruFanProxy.
2921 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fru_fan_call_set_cooling_zone().
2922 * @error: Return location for error or %NULL.
2923 *
2924 * Finishes an operation started with fru_fan_call_set_cooling_zone().
2925 *
2926 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2927 */
2928gboolean
2929fru_fan_call_set_cooling_zone_finish (
2930 FruFan *proxy,
2931 GAsyncResult *res,
2932 GError **error)
2933{
2934 GVariant *_ret;
2935 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2936 if (_ret == NULL)
2937 goto _out;
2938 g_variant_get (_ret,
2939 "()");
2940 g_variant_unref (_ret);
2941_out:
2942 return _ret != NULL;
2943}
2944
2945/**
2946 * fru_fan_call_set_cooling_zone_sync:
2947 * @proxy: A #FruFanProxy.
2948 * @arg_cooling_zone: Argument to pass with the method invocation.
2949 * @cancellable: (allow-none): A #GCancellable or %NULL.
2950 * @error: Return location for error or %NULL.
2951 *
2952 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Fru-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
2953 *
2954 * See fru_fan_call_set_cooling_zone() for the asynchronous version of this method.
2955 *
2956 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2957 */
2958gboolean
2959fru_fan_call_set_cooling_zone_sync (
2960 FruFan *proxy,
2961 gint arg_cooling_zone,
2962 GCancellable *cancellable,
2963 GError **error)
2964{
2965 GVariant *_ret;
2966 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2967 "setCoolingZone",
2968 g_variant_new ("(i)",
2969 arg_cooling_zone),
2970 G_DBUS_CALL_FLAGS_NONE,
2971 -1,
2972 cancellable,
2973 error);
2974 if (_ret == NULL)
2975 goto _out;
2976 g_variant_get (_ret,
2977 "()");
2978 g_variant_unref (_ret);
2979_out:
2980 return _ret != NULL;
2981}
2982
2983/**
2984 * fru_fan_call_get_speed:
2985 * @proxy: A #FruFanProxy.
2986 * @cancellable: (allow-none): A #GCancellable or %NULL.
2987 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2988 * @user_data: User data to pass to @callback.
2989 *
2990 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fru-Fan.getSpeed">getSpeed()</link> D-Bus method on @proxy.
2991 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
2992 * You can then call fru_fan_call_get_speed_finish() to get the result of the operation.
2993 *
2994 * See fru_fan_call_get_speed_sync() for the synchronous, blocking version of this method.
2995 */
2996void
2997fru_fan_call_get_speed (
2998 FruFan *proxy,
2999 GCancellable *cancellable,
3000 GAsyncReadyCallback callback,
3001 gpointer user_data)
3002{
3003 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
3004 "getSpeed",
3005 g_variant_new ("()"),
3006 G_DBUS_CALL_FLAGS_NONE,
3007 -1,
3008 cancellable,
3009 callback,
3010 user_data);
3011}
3012
3013/**
3014 * fru_fan_call_get_speed_finish:
3015 * @proxy: A #FruFanProxy.
3016 * @out_speed: (out): Return location for return parameter or %NULL to ignore.
3017 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fru_fan_call_get_speed().
3018 * @error: Return location for error or %NULL.
3019 *
3020 * Finishes an operation started with fru_fan_call_get_speed().
3021 *
3022 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
3023 */
3024gboolean
3025fru_fan_call_get_speed_finish (
3026 FruFan *proxy,
3027 gint *out_speed,
3028 GAsyncResult *res,
3029 GError **error)
3030{
3031 GVariant *_ret;
3032 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
3033 if (_ret == NULL)
3034 goto _out;
3035 g_variant_get (_ret,
3036 "(i)",
3037 out_speed);
3038 g_variant_unref (_ret);
3039_out:
3040 return _ret != NULL;
3041}
3042
3043/**
3044 * fru_fan_call_get_speed_sync:
3045 * @proxy: A #FruFanProxy.
3046 * @out_speed: (out): Return location for return parameter or %NULL to ignore.
3047 * @cancellable: (allow-none): A #GCancellable or %NULL.
3048 * @error: Return location for error or %NULL.
3049 *
3050 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Fru-Fan.getSpeed">getSpeed()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
3051 *
3052 * See fru_fan_call_get_speed() for the asynchronous version of this method.
3053 *
3054 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
3055 */
3056gboolean
3057fru_fan_call_get_speed_sync (
3058 FruFan *proxy,
3059 gint *out_speed,
3060 GCancellable *cancellable,
3061 GError **error)
3062{
3063 GVariant *_ret;
3064 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
3065 "getSpeed",
3066 g_variant_new ("()"),
3067 G_DBUS_CALL_FLAGS_NONE,
3068 -1,
3069 cancellable,
3070 error);
3071 if (_ret == NULL)
3072 goto _out;
3073 g_variant_get (_ret,
3074 "(i)",
3075 out_speed);
3076 g_variant_unref (_ret);
3077_out:
3078 return _ret != NULL;
3079}
3080
3081/**
3082 * fru_fan_call_set_speed:
3083 * @proxy: A #FruFanProxy.
3084 * @arg_speed: Argument to pass with the method invocation.
3085 * @cancellable: (allow-none): A #GCancellable or %NULL.
3086 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
3087 * @user_data: User data to pass to @callback.
3088 *
3089 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fru-Fan.setSpeed">setSpeed()</link> D-Bus method on @proxy.
3090 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
3091 * You can then call fru_fan_call_set_speed_finish() to get the result of the operation.
3092 *
3093 * See fru_fan_call_set_speed_sync() for the synchronous, blocking version of this method.
3094 */
3095void
3096fru_fan_call_set_speed (
3097 FruFan *proxy,
3098 gint arg_speed,
3099 GCancellable *cancellable,
3100 GAsyncReadyCallback callback,
3101 gpointer user_data)
3102{
3103 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
3104 "setSpeed",
3105 g_variant_new ("(i)",
3106 arg_speed),
3107 G_DBUS_CALL_FLAGS_NONE,
3108 -1,
3109 cancellable,
3110 callback,
3111 user_data);
3112}
3113
3114/**
3115 * fru_fan_call_set_speed_finish:
3116 * @proxy: A #FruFanProxy.
3117 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fru_fan_call_set_speed().
3118 * @error: Return location for error or %NULL.
3119 *
3120 * Finishes an operation started with fru_fan_call_set_speed().
3121 *
3122 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
3123 */
3124gboolean
3125fru_fan_call_set_speed_finish (
3126 FruFan *proxy,
3127 GAsyncResult *res,
3128 GError **error)
3129{
3130 GVariant *_ret;
3131 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
3132 if (_ret == NULL)
3133 goto _out;
3134 g_variant_get (_ret,
3135 "()");
3136 g_variant_unref (_ret);
3137_out:
3138 return _ret != NULL;
3139}
3140
3141/**
3142 * fru_fan_call_set_speed_sync:
3143 * @proxy: A #FruFanProxy.
3144 * @arg_speed: Argument to pass with the method invocation.
3145 * @cancellable: (allow-none): A #GCancellable or %NULL.
3146 * @error: Return location for error or %NULL.
3147 *
3148 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Fru-Fan.setSpeed">setSpeed()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
3149 *
3150 * See fru_fan_call_set_speed() for the asynchronous version of this method.
3151 *
3152 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
3153 */
3154gboolean
3155fru_fan_call_set_speed_sync (
3156 FruFan *proxy,
3157 gint arg_speed,
3158 GCancellable *cancellable,
3159 GError **error)
3160{
3161 GVariant *_ret;
3162 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
3163 "setSpeed",
3164 g_variant_new ("(i)",
3165 arg_speed),
3166 G_DBUS_CALL_FLAGS_NONE,
3167 -1,
3168 cancellable,
3169 error);
3170 if (_ret == NULL)
3171 goto _out;
3172 g_variant_get (_ret,
3173 "()");
3174 g_variant_unref (_ret);
3175_out:
3176 return _ret != NULL;
3177}
3178
3179/**
3180 * fru_fan_call_set_config_data:
3181 * @proxy: A #FruFanProxy.
3182 * @arg_pwm_num: Argument to pass with the method invocation.
3183 * @cancellable: (allow-none): A #GCancellable or %NULL.
3184 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
3185 * @user_data: User data to pass to @callback.
3186 *
3187 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fru-Fan.setConfigData">setConfigData()</link> D-Bus method on @proxy.
3188 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
3189 * You can then call fru_fan_call_set_config_data_finish() to get the result of the operation.
3190 *
3191 * See fru_fan_call_set_config_data_sync() for the synchronous, blocking version of this method.
3192 */
3193void
3194fru_fan_call_set_config_data (
3195 FruFan *proxy,
3196 gint arg_pwm_num,
3197 GCancellable *cancellable,
3198 GAsyncReadyCallback callback,
3199 gpointer user_data)
3200{
3201 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
3202 "setConfigData",
3203 g_variant_new ("(i)",
3204 arg_pwm_num),
3205 G_DBUS_CALL_FLAGS_NONE,
3206 -1,
3207 cancellable,
3208 callback,
3209 user_data);
3210}
3211
3212/**
3213 * fru_fan_call_set_config_data_finish:
3214 * @proxy: A #FruFanProxy.
3215 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fru_fan_call_set_config_data().
3216 * @error: Return location for error or %NULL.
3217 *
3218 * Finishes an operation started with fru_fan_call_set_config_data().
3219 *
3220 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
3221 */
3222gboolean
3223fru_fan_call_set_config_data_finish (
3224 FruFan *proxy,
3225 GAsyncResult *res,
3226 GError **error)
3227{
3228 GVariant *_ret;
3229 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
3230 if (_ret == NULL)
3231 goto _out;
3232 g_variant_get (_ret,
3233 "()");
3234 g_variant_unref (_ret);
3235_out:
3236 return _ret != NULL;
3237}
3238
3239/**
3240 * fru_fan_call_set_config_data_sync:
3241 * @proxy: A #FruFanProxy.
3242 * @arg_pwm_num: Argument to pass with the method invocation.
3243 * @cancellable: (allow-none): A #GCancellable or %NULL.
3244 * @error: Return location for error or %NULL.
3245 *
3246 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Fru-Fan.setConfigData">setConfigData()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
3247 *
3248 * See fru_fan_call_set_config_data() for the asynchronous version of this method.
3249 *
3250 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
3251 */
3252gboolean
3253fru_fan_call_set_config_data_sync (
3254 FruFan *proxy,
3255 gint arg_pwm_num,
3256 GCancellable *cancellable,
3257 GError **error)
3258{
3259 GVariant *_ret;
3260 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
3261 "setConfigData",
3262 g_variant_new ("(i)",
3263 arg_pwm_num),
3264 G_DBUS_CALL_FLAGS_NONE,
3265 -1,
3266 cancellable,
3267 error);
3268 if (_ret == NULL)
3269 goto _out;
3270 g_variant_get (_ret,
3271 "()");
3272 g_variant_unref (_ret);
3273_out:
3274 return _ret != NULL;
3275}
3276
3277/**
3278 * fru_fan_complete_set_cooling_zone:
3279 * @object: A #FruFan.
3280 * @invocation: (transfer full): A #GDBusMethodInvocation.
3281 *
3282 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Fru-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.
3283 *
3284 * This method will free @invocation, you cannot use it afterwards.
3285 */
3286void
3287fru_fan_complete_set_cooling_zone (
3288 FruFan *object,
3289 GDBusMethodInvocation *invocation)
3290{
3291 g_dbus_method_invocation_return_value (invocation,
3292 g_variant_new ("()"));
3293}
3294
3295/**
3296 * fru_fan_complete_get_speed:
3297 * @object: A #FruFan.
3298 * @invocation: (transfer full): A #GDBusMethodInvocation.
3299 * @speed: Parameter to return.
3300 *
3301 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Fru-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.
3302 *
3303 * This method will free @invocation, you cannot use it afterwards.
3304 */
3305void
3306fru_fan_complete_get_speed (
3307 FruFan *object,
3308 GDBusMethodInvocation *invocation,
3309 gint speed)
3310{
3311 g_dbus_method_invocation_return_value (invocation,
3312 g_variant_new ("(i)",
3313 speed));
3314}
3315
3316/**
3317 * fru_fan_complete_set_speed:
3318 * @object: A #FruFan.
3319 * @invocation: (transfer full): A #GDBusMethodInvocation.
3320 *
3321 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Fru-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.
3322 *
3323 * This method will free @invocation, you cannot use it afterwards.
3324 */
3325void
3326fru_fan_complete_set_speed (
3327 FruFan *object,
3328 GDBusMethodInvocation *invocation)
3329{
3330 g_dbus_method_invocation_return_value (invocation,
3331 g_variant_new ("()"));
3332}
3333
3334/**
3335 * fru_fan_complete_set_config_data:
3336 * @object: A #FruFan.
3337 * @invocation: (transfer full): A #GDBusMethodInvocation.
3338 *
3339 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Fru-Fan.setConfigData">setConfigData()</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.
3340 *
3341 * This method will free @invocation, you cannot use it afterwards.
3342 */
3343void
3344fru_fan_complete_set_config_data (
3345 FruFan *object,
3346 GDBusMethodInvocation *invocation)
3347{
3348 g_dbus_method_invocation_return_value (invocation,
3349 g_variant_new ("()"));
3350}
3351
3352/* ------------------------------------------------------------------------ */
3353
3354/**
3355 * FruFanProxy:
3356 *
3357 * The #FruFanProxy structure contains only private data and should only be accessed using the provided API.
3358 */
3359
3360/**
3361 * FruFanProxyClass:
3362 * @parent_class: The parent class.
3363 *
3364 * Class structure for #FruFanProxy.
3365 */
3366
3367struct _FruFanProxyPrivate
3368{
3369 GData *qdata;
3370};
3371
3372static void fru_fan_proxy_iface_init (FruFanIface *iface);
3373
3374#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3375G_DEFINE_TYPE_WITH_CODE (FruFanProxy, fru_fan_proxy, G_TYPE_DBUS_PROXY,
3376 G_ADD_PRIVATE (FruFanProxy)
3377 G_IMPLEMENT_INTERFACE (TYPE_FRU_FAN, fru_fan_proxy_iface_init));
3378
3379#else
3380G_DEFINE_TYPE_WITH_CODE (FruFanProxy, fru_fan_proxy, G_TYPE_DBUS_PROXY,
3381 G_IMPLEMENT_INTERFACE (TYPE_FRU_FAN, fru_fan_proxy_iface_init));
3382
3383#endif
3384static void
3385fru_fan_proxy_finalize (GObject *object)
3386{
3387 FruFanProxy *proxy = FRU_FAN_PROXY (object);
3388 g_datalist_clear (&proxy->priv->qdata);
3389 G_OBJECT_CLASS (fru_fan_proxy_parent_class)->finalize (object);
3390}
3391
3392static void
3393fru_fan_proxy_get_property (GObject *object,
3394 guint prop_id,
3395 GValue *value,
3396 GParamSpec *pspec G_GNUC_UNUSED)
3397{
3398 const _ExtendedGDBusPropertyInfo *info;
3399 GVariant *variant;
3400 g_assert (prop_id != 0 && prop_id - 1 < 2);
3401 info = _fru_fan_property_info_pointers[prop_id - 1];
3402 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
3403 if (info->use_gvariant)
3404 {
3405 g_value_set_variant (value, variant);
3406 }
3407 else
3408 {
3409 if (variant != NULL)
3410 g_dbus_gvariant_to_gvalue (variant, value);
3411 }
3412 if (variant != NULL)
3413 g_variant_unref (variant);
3414}
3415
3416static void
3417fru_fan_proxy_set_property_cb (GDBusProxy *proxy,
3418 GAsyncResult *res,
3419 gpointer user_data)
3420{
3421 const _ExtendedGDBusPropertyInfo *info = user_data;
3422 GError *error;
3423 GVariant *_ret;
3424 error = NULL;
3425 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
3426 if (!_ret)
3427 {
3428 g_warning ("Error setting property '%s' on interface org.openbmc.Fru.Fan: %s (%s, %d)",
3429 info->parent_struct.name,
3430 error->message, g_quark_to_string (error->domain), error->code);
3431 g_error_free (error);
3432 }
3433 else
3434 {
3435 g_variant_unref (_ret);
3436 }
3437}
3438
3439static void
3440fru_fan_proxy_set_property (GObject *object,
3441 guint prop_id,
3442 const GValue *value,
3443 GParamSpec *pspec G_GNUC_UNUSED)
3444{
3445 const _ExtendedGDBusPropertyInfo *info;
3446 GVariant *variant;
3447 g_assert (prop_id != 0 && prop_id - 1 < 2);
3448 info = _fru_fan_property_info_pointers[prop_id - 1];
3449 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
3450 g_dbus_proxy_call (G_DBUS_PROXY (object),
3451 "org.freedesktop.DBus.Properties.Set",
3452 g_variant_new ("(ssv)", "org.openbmc.Fru.Fan", info->parent_struct.name, variant),
3453 G_DBUS_CALL_FLAGS_NONE,
3454 -1,
3455 NULL, (GAsyncReadyCallback) fru_fan_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
3456 g_variant_unref (variant);
3457}
3458
3459static void
3460fru_fan_proxy_g_signal (GDBusProxy *proxy,
3461 const gchar *sender_name G_GNUC_UNUSED,
3462 const gchar *signal_name,
3463 GVariant *parameters)
3464{
3465 _ExtendedGDBusSignalInfo *info;
3466 GVariantIter iter;
3467 GVariant *child;
3468 GValue *paramv;
3469 guint num_params;
3470 guint n;
3471 guint signal_id;
3472 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_fru_fan_interface_info.parent_struct, signal_name);
3473 if (info == NULL)
3474 return;
3475 num_params = g_variant_n_children (parameters);
3476 paramv = g_new0 (GValue, num_params + 1);
3477 g_value_init (&paramv[0], TYPE_FRU_FAN);
3478 g_value_set_object (&paramv[0], proxy);
3479 g_variant_iter_init (&iter, parameters);
3480 n = 1;
3481 while ((child = g_variant_iter_next_value (&iter)) != NULL)
3482 {
3483 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
3484 if (arg_info->use_gvariant)
3485 {
3486 g_value_init (&paramv[n], G_TYPE_VARIANT);
3487 g_value_set_variant (&paramv[n], child);
3488 n++;
3489 }
3490 else
3491 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
3492 g_variant_unref (child);
3493 }
3494 signal_id = g_signal_lookup (info->signal_name, TYPE_FRU_FAN);
3495 g_signal_emitv (paramv, signal_id, 0, NULL);
3496 for (n = 0; n < num_params + 1; n++)
3497 g_value_unset (&paramv[n]);
3498 g_free (paramv);
3499}
3500
3501static void
3502fru_fan_proxy_g_properties_changed (GDBusProxy *_proxy,
3503 GVariant *changed_properties,
3504 const gchar *const *invalidated_properties)
3505{
3506 FruFanProxy *proxy = FRU_FAN_PROXY (_proxy);
3507 guint n;
3508 const gchar *key;
3509 GVariantIter *iter;
3510 _ExtendedGDBusPropertyInfo *info;
3511 g_variant_get (changed_properties, "a{sv}", &iter);
3512 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
3513 {
3514 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fru_fan_interface_info.parent_struct, key);
3515 g_datalist_remove_data (&proxy->priv->qdata, key);
3516 if (info != NULL)
3517 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
3518 }
3519 g_variant_iter_free (iter);
3520 for (n = 0; invalidated_properties[n] != NULL; n++)
3521 {
3522 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fru_fan_interface_info.parent_struct, invalidated_properties[n]);
3523 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
3524 if (info != NULL)
3525 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
3526 }
3527}
3528
3529static gint
3530fru_fan_proxy_get_speed (FruFan *object)
3531{
3532 FruFanProxy *proxy = FRU_FAN_PROXY (object);
3533 GVariant *variant;
3534 gint value = 0;
3535 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "speed");
3536 if (variant != NULL)
3537 {
3538 value = g_variant_get_int32 (variant);
3539 g_variant_unref (variant);
3540 }
3541 return value;
3542}
3543
3544static gint
3545fru_fan_proxy_get_cooling_zone (FruFan *object)
3546{
3547 FruFanProxy *proxy = FRU_FAN_PROXY (object);
3548 GVariant *variant;
3549 gint value = 0;
3550 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "cooling_zone");
3551 if (variant != NULL)
3552 {
3553 value = g_variant_get_int32 (variant);
3554 g_variant_unref (variant);
3555 }
3556 return value;
3557}
3558
3559static void
3560fru_fan_proxy_init (FruFanProxy *proxy)
3561{
3562#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3563 proxy->priv = fru_fan_proxy_get_instance_private (proxy);
3564#else
3565 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FRU_FAN_PROXY, FruFanProxyPrivate);
3566#endif
3567
3568 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), fru_fan_interface_info ());
3569}
3570
3571static void
3572fru_fan_proxy_class_init (FruFanProxyClass *klass)
3573{
3574 GObjectClass *gobject_class;
3575 GDBusProxyClass *proxy_class;
3576
3577 gobject_class = G_OBJECT_CLASS (klass);
3578 gobject_class->finalize = fru_fan_proxy_finalize;
3579 gobject_class->get_property = fru_fan_proxy_get_property;
3580 gobject_class->set_property = fru_fan_proxy_set_property;
3581
3582 proxy_class = G_DBUS_PROXY_CLASS (klass);
3583 proxy_class->g_signal = fru_fan_proxy_g_signal;
3584 proxy_class->g_properties_changed = fru_fan_proxy_g_properties_changed;
3585
3586 fru_fan_override_properties (gobject_class, 1);
3587
3588#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
3589 g_type_class_add_private (klass, sizeof (FruFanProxyPrivate));
3590#endif
3591}
3592
3593static void
3594fru_fan_proxy_iface_init (FruFanIface *iface)
3595{
3596 iface->get_speed = fru_fan_proxy_get_speed;
3597 iface->get_cooling_zone = fru_fan_proxy_get_cooling_zone;
3598}
3599
3600/**
3601 * fru_fan_proxy_new:
3602 * @connection: A #GDBusConnection.
3603 * @flags: Flags from the #GDBusProxyFlags enumeration.
3604 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
3605 * @object_path: An object path.
3606 * @cancellable: (allow-none): A #GCancellable or %NULL.
3607 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
3608 * @user_data: User data to pass to @callback.
3609 *
3610 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fru-Fan.top_of_page">org.openbmc.Fru.Fan</link>. See g_dbus_proxy_new() for more details.
3611 *
3612 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
3613 * You can then call fru_fan_proxy_new_finish() to get the result of the operation.
3614 *
3615 * See fru_fan_proxy_new_sync() for the synchronous, blocking version of this constructor.
3616 */
3617void
3618fru_fan_proxy_new (
3619 GDBusConnection *connection,
3620 GDBusProxyFlags flags,
3621 const gchar *name,
3622 const gchar *object_path,
3623 GCancellable *cancellable,
3624 GAsyncReadyCallback callback,
3625 gpointer user_data)
3626{
3627 g_async_initable_new_async (TYPE_FRU_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.Fru.Fan", NULL);
3628}
3629
3630/**
3631 * fru_fan_proxy_new_finish:
3632 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fru_fan_proxy_new().
3633 * @error: Return location for error or %NULL
3634 *
3635 * Finishes an operation started with fru_fan_proxy_new().
3636 *
3637 * Returns: (transfer full) (type FruFanProxy): The constructed proxy object or %NULL if @error is set.
3638 */
3639FruFan *
3640fru_fan_proxy_new_finish (
3641 GAsyncResult *res,
3642 GError **error)
3643{
3644 GObject *ret;
3645 GObject *source_object;
3646 source_object = g_async_result_get_source_object (res);
3647 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
3648 g_object_unref (source_object);
3649 if (ret != NULL)
3650 return FRU_FAN (ret);
3651 else
3652 return NULL;
3653}
3654
3655/**
3656 * fru_fan_proxy_new_sync:
3657 * @connection: A #GDBusConnection.
3658 * @flags: Flags from the #GDBusProxyFlags enumeration.
3659 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
3660 * @object_path: An object path.
3661 * @cancellable: (allow-none): A #GCancellable or %NULL.
3662 * @error: Return location for error or %NULL
3663 *
3664 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fru-Fan.top_of_page">org.openbmc.Fru.Fan</link>. See g_dbus_proxy_new_sync() for more details.
3665 *
3666 * The calling thread is blocked until a reply is received.
3667 *
3668 * See fru_fan_proxy_new() for the asynchronous version of this constructor.
3669 *
3670 * Returns: (transfer full) (type FruFanProxy): The constructed proxy object or %NULL if @error is set.
3671 */
3672FruFan *
3673fru_fan_proxy_new_sync (
3674 GDBusConnection *connection,
3675 GDBusProxyFlags flags,
3676 const gchar *name,
3677 const gchar *object_path,
3678 GCancellable *cancellable,
3679 GError **error)
3680{
3681 GInitable *ret;
3682 ret = g_initable_new (TYPE_FRU_FAN_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Fru.Fan", NULL);
3683 if (ret != NULL)
3684 return FRU_FAN (ret);
3685 else
3686 return NULL;
3687}
3688
3689
3690/**
3691 * fru_fan_proxy_new_for_bus:
3692 * @bus_type: A #GBusType.
3693 * @flags: Flags from the #GDBusProxyFlags enumeration.
3694 * @name: A bus name (well-known or unique).
3695 * @object_path: An object path.
3696 * @cancellable: (allow-none): A #GCancellable or %NULL.
3697 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
3698 * @user_data: User data to pass to @callback.
3699 *
3700 * Like fru_fan_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
3701 *
3702 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
3703 * You can then call fru_fan_proxy_new_for_bus_finish() to get the result of the operation.
3704 *
3705 * See fru_fan_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
3706 */
3707void
3708fru_fan_proxy_new_for_bus (
3709 GBusType bus_type,
3710 GDBusProxyFlags flags,
3711 const gchar *name,
3712 const gchar *object_path,
3713 GCancellable *cancellable,
3714 GAsyncReadyCallback callback,
3715 gpointer user_data)
3716{
3717 g_async_initable_new_async (TYPE_FRU_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.Fru.Fan", NULL);
3718}
3719
3720/**
3721 * fru_fan_proxy_new_for_bus_finish:
3722 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fru_fan_proxy_new_for_bus().
3723 * @error: Return location for error or %NULL
3724 *
3725 * Finishes an operation started with fru_fan_proxy_new_for_bus().
3726 *
3727 * Returns: (transfer full) (type FruFanProxy): The constructed proxy object or %NULL if @error is set.
3728 */
3729FruFan *
3730fru_fan_proxy_new_for_bus_finish (
3731 GAsyncResult *res,
3732 GError **error)
3733{
3734 GObject *ret;
3735 GObject *source_object;
3736 source_object = g_async_result_get_source_object (res);
3737 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
3738 g_object_unref (source_object);
3739 if (ret != NULL)
3740 return FRU_FAN (ret);
3741 else
3742 return NULL;
3743}
3744
3745/**
3746 * fru_fan_proxy_new_for_bus_sync:
3747 * @bus_type: A #GBusType.
3748 * @flags: Flags from the #GDBusProxyFlags enumeration.
3749 * @name: A bus name (well-known or unique).
3750 * @object_path: An object path.
3751 * @cancellable: (allow-none): A #GCancellable or %NULL.
3752 * @error: Return location for error or %NULL
3753 *
3754 * Like fru_fan_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
3755 *
3756 * The calling thread is blocked until a reply is received.
3757 *
3758 * See fru_fan_proxy_new_for_bus() for the asynchronous version of this constructor.
3759 *
3760 * Returns: (transfer full) (type FruFanProxy): The constructed proxy object or %NULL if @error is set.
3761 */
3762FruFan *
3763fru_fan_proxy_new_for_bus_sync (
3764 GBusType bus_type,
3765 GDBusProxyFlags flags,
3766 const gchar *name,
3767 const gchar *object_path,
3768 GCancellable *cancellable,
3769 GError **error)
3770{
3771 GInitable *ret;
3772 ret = g_initable_new (TYPE_FRU_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.Fru.Fan", NULL);
3773 if (ret != NULL)
3774 return FRU_FAN (ret);
3775 else
3776 return NULL;
3777}
3778
3779
3780/* ------------------------------------------------------------------------ */
3781
3782/**
3783 * FruFanSkeleton:
3784 *
3785 * The #FruFanSkeleton structure contains only private data and should only be accessed using the provided API.
3786 */
3787
3788/**
3789 * FruFanSkeletonClass:
3790 * @parent_class: The parent class.
3791 *
3792 * Class structure for #FruFanSkeleton.
3793 */
3794
3795struct _FruFanSkeletonPrivate
3796{
3797 GValue *properties;
3798 GList *changed_properties;
3799 GSource *changed_properties_idle_source;
3800 GMainContext *context;
3801 GMutex lock;
3802};
3803
3804static void
3805_fru_fan_skeleton_handle_method_call (
3806 GDBusConnection *connection G_GNUC_UNUSED,
3807 const gchar *sender G_GNUC_UNUSED,
3808 const gchar *object_path G_GNUC_UNUSED,
3809 const gchar *interface_name,
3810 const gchar *method_name,
3811 GVariant *parameters,
3812 GDBusMethodInvocation *invocation,
3813 gpointer user_data)
3814{
3815 FruFanSkeleton *skeleton = FRU_FAN_SKELETON (user_data);
3816 _ExtendedGDBusMethodInfo *info;
3817 GVariantIter iter;
3818 GVariant *child;
3819 GValue *paramv;
3820 guint num_params;
3821 guint num_extra;
3822 guint n;
3823 guint signal_id;
3824 GValue return_value = G_VALUE_INIT;
3825 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
3826 g_assert (info != NULL);
3827 num_params = g_variant_n_children (parameters);
3828 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
3829 n = 0;
3830 g_value_init (&paramv[n], TYPE_FRU_FAN);
3831 g_value_set_object (&paramv[n++], skeleton);
3832 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
3833 g_value_set_object (&paramv[n++], invocation);
3834 if (info->pass_fdlist)
3835 {
3836#ifdef G_OS_UNIX
3837 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
3838 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
3839#else
3840 g_assert_not_reached ();
3841#endif
3842 }
3843 g_variant_iter_init (&iter, parameters);
3844 while ((child = g_variant_iter_next_value (&iter)) != NULL)
3845 {
3846 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
3847 if (arg_info->use_gvariant)
3848 {
3849 g_value_init (&paramv[n], G_TYPE_VARIANT);
3850 g_value_set_variant (&paramv[n], child);
3851 n++;
3852 }
3853 else
3854 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
3855 g_variant_unref (child);
3856 }
3857 signal_id = g_signal_lookup (info->signal_name, TYPE_FRU_FAN);
3858 g_value_init (&return_value, G_TYPE_BOOLEAN);
3859 g_signal_emitv (paramv, signal_id, 0, &return_value);
3860 if (!g_value_get_boolean (&return_value))
3861 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);
3862 g_value_unset (&return_value);
3863 for (n = 0; n < num_params + num_extra; n++)
3864 g_value_unset (&paramv[n]);
3865 g_free (paramv);
3866}
3867
3868static GVariant *
3869_fru_fan_skeleton_handle_get_property (
3870 GDBusConnection *connection G_GNUC_UNUSED,
3871 const gchar *sender G_GNUC_UNUSED,
3872 const gchar *object_path G_GNUC_UNUSED,
3873 const gchar *interface_name G_GNUC_UNUSED,
3874 const gchar *property_name,
3875 GError **error,
3876 gpointer user_data)
3877{
3878 FruFanSkeleton *skeleton = FRU_FAN_SKELETON (user_data);
3879 GValue value = G_VALUE_INIT;
3880 GParamSpec *pspec;
3881 _ExtendedGDBusPropertyInfo *info;
3882 GVariant *ret;
3883 ret = NULL;
3884 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fru_fan_interface_info.parent_struct, property_name);
3885 g_assert (info != NULL);
3886 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3887 if (pspec == NULL)
3888 {
3889 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3890 }
3891 else
3892 {
3893 g_value_init (&value, pspec->value_type);
3894 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3895 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
3896 g_value_unset (&value);
3897 }
3898 return ret;
3899}
3900
3901static gboolean
3902_fru_fan_skeleton_handle_set_property (
3903 GDBusConnection *connection G_GNUC_UNUSED,
3904 const gchar *sender G_GNUC_UNUSED,
3905 const gchar *object_path G_GNUC_UNUSED,
3906 const gchar *interface_name G_GNUC_UNUSED,
3907 const gchar *property_name,
3908 GVariant *variant,
3909 GError **error,
3910 gpointer user_data)
3911{
3912 FruFanSkeleton *skeleton = FRU_FAN_SKELETON (user_data);
3913 GValue value = G_VALUE_INIT;
3914 GParamSpec *pspec;
3915 _ExtendedGDBusPropertyInfo *info;
3916 gboolean ret;
3917 ret = FALSE;
3918 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fru_fan_interface_info.parent_struct, property_name);
3919 g_assert (info != NULL);
3920 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3921 if (pspec == NULL)
3922 {
3923 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3924 }
3925 else
3926 {
3927 if (info->use_gvariant)
3928 g_value_set_variant (&value, variant);
3929 else
3930 g_dbus_gvariant_to_gvalue (variant, &value);
3931 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3932 g_value_unset (&value);
3933 ret = TRUE;
3934 }
3935 return ret;
3936}
3937
3938static const GDBusInterfaceVTable _fru_fan_skeleton_vtable =
3939{
3940 _fru_fan_skeleton_handle_method_call,
3941 _fru_fan_skeleton_handle_get_property,
3942 _fru_fan_skeleton_handle_set_property,
3943 {NULL}
3944};
3945
3946static GDBusInterfaceInfo *
3947fru_fan_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3948{
3949 return fru_fan_interface_info ();
3950}
3951
3952static GDBusInterfaceVTable *
3953fru_fan_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3954{
3955 return (GDBusInterfaceVTable *) &_fru_fan_skeleton_vtable;
3956}
3957
3958static GVariant *
3959fru_fan_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
3960{
3961 FruFanSkeleton *skeleton = FRU_FAN_SKELETON (_skeleton);
3962
3963 GVariantBuilder builder;
3964 guint n;
3965 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3966 if (_fru_fan_interface_info.parent_struct.properties == NULL)
3967 goto out;
3968 for (n = 0; _fru_fan_interface_info.parent_struct.properties[n] != NULL; n++)
3969 {
3970 GDBusPropertyInfo *info = _fru_fan_interface_info.parent_struct.properties[n];
3971 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
3972 {
3973 GVariant *value;
3974 value = _fru_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.Fru.Fan", info->name, NULL, skeleton);
3975 if (value != NULL)
3976 {
3977 g_variant_take_ref (value);
3978 g_variant_builder_add (&builder, "{sv}", info->name, value);
3979 g_variant_unref (value);
3980 }
3981 }
3982 }
3983out:
3984 return g_variant_builder_end (&builder);
3985}
3986
3987static gboolean _fru_fan_emit_changed (gpointer user_data);
3988
3989static void
3990fru_fan_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
3991{
3992 FruFanSkeleton *skeleton = FRU_FAN_SKELETON (_skeleton);
3993 gboolean emit_changed = FALSE;
3994
3995 g_mutex_lock (&skeleton->priv->lock);
3996 if (skeleton->priv->changed_properties_idle_source != NULL)
3997 {
3998 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3999 skeleton->priv->changed_properties_idle_source = NULL;
4000 emit_changed = TRUE;
4001 }
4002 g_mutex_unlock (&skeleton->priv->lock);
4003
4004 if (emit_changed)
4005 _fru_fan_emit_changed (skeleton);
4006}
4007
4008static void
4009_fru_fan_on_signal_speed_changed (
4010 FruFan *object,
4011 gint arg_speed)
4012{
4013 FruFanSkeleton *skeleton = FRU_FAN_SKELETON (object);
4014
4015 GList *connections, *l;
4016 GVariant *signal_variant;
4017 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
4018
4019 signal_variant = g_variant_ref_sink (g_variant_new ("(i)",
4020 arg_speed));
4021 for (l = connections; l != NULL; l = l->next)
4022 {
4023 GDBusConnection *connection = l->data;
4024 g_dbus_connection_emit_signal (connection,
4025 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fru.Fan", "SpeedChanged",
4026 signal_variant, NULL);
4027 }
4028 g_variant_unref (signal_variant);
4029 g_list_free_full (connections, g_object_unref);
4030}
4031
4032static void
4033_fru_fan_on_signal_tach_error (
4034 FruFan *object)
4035{
4036 FruFanSkeleton *skeleton = FRU_FAN_SKELETON (object);
4037
4038 GList *connections, *l;
4039 GVariant *signal_variant;
4040 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
4041
4042 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
4043 for (l = connections; l != NULL; l = l->next)
4044 {
4045 GDBusConnection *connection = l->data;
4046 g_dbus_connection_emit_signal (connection,
4047 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fru.Fan", "TachError",
4048 signal_variant, NULL);
4049 }
4050 g_variant_unref (signal_variant);
4051 g_list_free_full (connections, g_object_unref);
4052}
4053
4054static void fru_fan_skeleton_iface_init (FruFanIface *iface);
4055#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4056G_DEFINE_TYPE_WITH_CODE (FruFanSkeleton, fru_fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
4057 G_ADD_PRIVATE (FruFanSkeleton)
4058 G_IMPLEMENT_INTERFACE (TYPE_FRU_FAN, fru_fan_skeleton_iface_init));
4059
4060#else
4061G_DEFINE_TYPE_WITH_CODE (FruFanSkeleton, fru_fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
4062 G_IMPLEMENT_INTERFACE (TYPE_FRU_FAN, fru_fan_skeleton_iface_init));
4063
4064#endif
4065static void
4066fru_fan_skeleton_finalize (GObject *object)
4067{
4068 FruFanSkeleton *skeleton = FRU_FAN_SKELETON (object);
4069 guint n;
4070 for (n = 0; n < 2; n++)
4071 g_value_unset (&skeleton->priv->properties[n]);
4072 g_free (skeleton->priv->properties);
4073 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
4074 if (skeleton->priv->changed_properties_idle_source != NULL)
4075 g_source_destroy (skeleton->priv->changed_properties_idle_source);
4076 g_main_context_unref (skeleton->priv->context);
4077 g_mutex_clear (&skeleton->priv->lock);
4078 G_OBJECT_CLASS (fru_fan_skeleton_parent_class)->finalize (object);
4079}
4080
4081static void
4082fru_fan_skeleton_get_property (GObject *object,
4083 guint prop_id,
4084 GValue *value,
4085 GParamSpec *pspec G_GNUC_UNUSED)
4086{
4087 FruFanSkeleton *skeleton = FRU_FAN_SKELETON (object);
4088 g_assert (prop_id != 0 && prop_id - 1 < 2);
4089 g_mutex_lock (&skeleton->priv->lock);
4090 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
4091 g_mutex_unlock (&skeleton->priv->lock);
4092}
4093
4094static gboolean
4095_fru_fan_emit_changed (gpointer user_data)
4096{
4097 FruFanSkeleton *skeleton = FRU_FAN_SKELETON (user_data);
4098 GList *l;
4099 GVariantBuilder builder;
4100 GVariantBuilder invalidated_builder;
4101 guint num_changes;
4102
4103 g_mutex_lock (&skeleton->priv->lock);
4104 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
4105 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
4106 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
4107 {
4108 ChangedProperty *cp = l->data;
4109 GVariant *variant;
4110 const GValue *cur_value;
4111
4112 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
4113 if (!_g_value_equal (cur_value, &cp->orig_value))
4114 {
4115 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
4116 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
4117 g_variant_unref (variant);
4118 num_changes++;
4119 }
4120 }
4121 if (num_changes > 0)
4122 {
4123 GList *connections, *ll;
4124 GVariant *signal_variant;
4125 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Fru.Fan",
4126 &builder, &invalidated_builder));
4127 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
4128 for (ll = connections; ll != NULL; ll = ll->next)
4129 {
4130 GDBusConnection *connection = ll->data;
4131
4132 g_dbus_connection_emit_signal (connection,
4133 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
4134 "org.freedesktop.DBus.Properties",
4135 "PropertiesChanged",
4136 signal_variant,
4137 NULL);
4138 }
4139 g_variant_unref (signal_variant);
4140 g_list_free_full (connections, g_object_unref);
4141 }
4142 else
4143 {
4144 g_variant_builder_clear (&builder);
4145 g_variant_builder_clear (&invalidated_builder);
4146 }
4147 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
4148 skeleton->priv->changed_properties = NULL;
4149 skeleton->priv->changed_properties_idle_source = NULL;
4150 g_mutex_unlock (&skeleton->priv->lock);
4151 return FALSE;
4152}
4153
4154static void
4155_fru_fan_schedule_emit_changed (FruFanSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
4156{
4157 ChangedProperty *cp;
4158 GList *l;
4159 cp = NULL;
4160 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
4161 {
4162 ChangedProperty *i_cp = l->data;
4163 if (i_cp->info == info)
4164 {
4165 cp = i_cp;
4166 break;
4167 }
4168 }
4169 if (cp == NULL)
4170 {
4171 cp = g_new0 (ChangedProperty, 1);
4172 cp->prop_id = prop_id;
4173 cp->info = info;
4174 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
4175 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
4176 g_value_copy (orig_value, &cp->orig_value);
4177 }
4178}
4179
4180static void
4181fru_fan_skeleton_notify (GObject *object,
4182 GParamSpec *pspec G_GNUC_UNUSED)
4183{
4184 FruFanSkeleton *skeleton = FRU_FAN_SKELETON (object);
4185 g_mutex_lock (&skeleton->priv->lock);
4186 if (skeleton->priv->changed_properties != NULL &&
4187 skeleton->priv->changed_properties_idle_source == NULL)
4188 {
4189 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
4190 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
4191 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _fru_fan_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
4192 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
4193 g_source_unref (skeleton->priv->changed_properties_idle_source);
4194 }
4195 g_mutex_unlock (&skeleton->priv->lock);
4196}
4197
4198static void
4199fru_fan_skeleton_set_property (GObject *object,
4200 guint prop_id,
4201 const GValue *value,
4202 GParamSpec *pspec)
4203{
4204 FruFanSkeleton *skeleton = FRU_FAN_SKELETON (object);
4205 g_assert (prop_id != 0 && prop_id - 1 < 2);
4206 g_mutex_lock (&skeleton->priv->lock);
4207 g_object_freeze_notify (object);
4208 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
4209 {
4210 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
4211 _fru_fan_schedule_emit_changed (skeleton, _fru_fan_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
4212 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
4213 g_object_notify_by_pspec (object, pspec);
4214 }
4215 g_mutex_unlock (&skeleton->priv->lock);
4216 g_object_thaw_notify (object);
4217}
4218
4219static void
4220fru_fan_skeleton_init (FruFanSkeleton *skeleton)
4221{
4222#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4223 skeleton->priv = fru_fan_skeleton_get_instance_private (skeleton);
4224#else
4225 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FRU_FAN_SKELETON, FruFanSkeletonPrivate);
4226#endif
4227
4228 g_mutex_init (&skeleton->priv->lock);
4229 skeleton->priv->context = g_main_context_ref_thread_default ();
4230 skeleton->priv->properties = g_new0 (GValue, 2);
4231 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
4232 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
4233}
4234
4235static gint
4236fru_fan_skeleton_get_speed (FruFan *object)
4237{
4238 FruFanSkeleton *skeleton = FRU_FAN_SKELETON (object);
4239 gint value;
4240 g_mutex_lock (&skeleton->priv->lock);
4241 value = g_value_get_int (&(skeleton->priv->properties[0]));
4242 g_mutex_unlock (&skeleton->priv->lock);
4243 return value;
4244}
4245
4246static gint
4247fru_fan_skeleton_get_cooling_zone (FruFan *object)
4248{
4249 FruFanSkeleton *skeleton = FRU_FAN_SKELETON (object);
4250 gint value;
4251 g_mutex_lock (&skeleton->priv->lock);
4252 value = g_value_get_int (&(skeleton->priv->properties[1]));
4253 g_mutex_unlock (&skeleton->priv->lock);
4254 return value;
4255}
4256
4257static void
4258fru_fan_skeleton_class_init (FruFanSkeletonClass *klass)
4259{
4260 GObjectClass *gobject_class;
4261 GDBusInterfaceSkeletonClass *skeleton_class;
4262
4263 gobject_class = G_OBJECT_CLASS (klass);
4264 gobject_class->finalize = fru_fan_skeleton_finalize;
4265 gobject_class->get_property = fru_fan_skeleton_get_property;
4266 gobject_class->set_property = fru_fan_skeleton_set_property;
4267 gobject_class->notify = fru_fan_skeleton_notify;
4268
4269
4270 fru_fan_override_properties (gobject_class, 1);
4271
4272 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
4273 skeleton_class->get_info = fru_fan_skeleton_dbus_interface_get_info;
4274 skeleton_class->get_properties = fru_fan_skeleton_dbus_interface_get_properties;
4275 skeleton_class->flush = fru_fan_skeleton_dbus_interface_flush;
4276 skeleton_class->get_vtable = fru_fan_skeleton_dbus_interface_get_vtable;
4277
4278#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
4279 g_type_class_add_private (klass, sizeof (FruFanSkeletonPrivate));
4280#endif
4281}
4282
4283static void
4284fru_fan_skeleton_iface_init (FruFanIface *iface)
4285{
4286 iface->speed_changed = _fru_fan_on_signal_speed_changed;
4287 iface->tach_error = _fru_fan_on_signal_tach_error;
4288 iface->get_speed = fru_fan_skeleton_get_speed;
4289 iface->get_cooling_zone = fru_fan_skeleton_get_cooling_zone;
4290}
4291
4292/**
4293 * fru_fan_skeleton_new:
4294 *
4295 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fru-Fan.top_of_page">org.openbmc.Fru.Fan</link>.
4296 *
4297 * Returns: (transfer full) (type FruFanSkeleton): The skeleton object.
4298 */
4299FruFan *
4300fru_fan_skeleton_new (void)
4301{
4302 return FRU_FAN (g_object_new (TYPE_FRU_FAN_SKELETON, NULL));
4303}
4304
4305/* ------------------------------------------------------------------------
4306 * Code for Object, ObjectProxy and ObjectSkeleton
4307 * ------------------------------------------------------------------------
4308 */
4309
4310/**
4311 * SECTION:Object
4312 * @title: Object
4313 * @short_description: Specialized GDBusObject types
4314 *
4315 * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
4316 */
4317
4318/**
4319 * Object:
4320 *
4321 * The #Object type is a specialized container of interfaces.
4322 */
4323
4324/**
4325 * ObjectIface:
4326 * @parent_iface: The parent interface.
4327 *
4328 * Virtual table for the #Object interface.
4329 */
4330
4331typedef ObjectIface ObjectInterface;
4332G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));
4333
4334static void
4335object_default_init (ObjectIface *iface)
4336{
4337 /**
4338 * Object:fru:
4339 *
4340 * The #Fru instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fru.top_of_page">org.openbmc.Fru</link>, if any.
4341 *
4342 * Connect to the #GObject::notify signal to get informed of property changes.
4343 */
4344 g_object_interface_install_property (iface, g_param_spec_object ("fru", "fru", "fru", TYPE_FRU, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
4345
4346 /**
4347 * Object:fru-fan:
4348 *
4349 * The #FruFan instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fru-Fan.top_of_page">org.openbmc.Fru.Fan</link>, if any.
4350 *
4351 * Connect to the #GObject::notify signal to get informed of property changes.
4352 */
4353 g_object_interface_install_property (iface, g_param_spec_object ("fru-fan", "fru-fan", "fru-fan", TYPE_FRU_FAN, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
4354
4355}
4356
4357/**
4358 * object_get_fru:
4359 * @object: A #Object.
4360 *
4361 * Gets the #Fru instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fru.top_of_page">org.openbmc.Fru</link> on @object, if any.
4362 *
4363 * Returns: (transfer full): A #Fru that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
4364 */
4365Fru *object_get_fru (Object *object)
4366{
4367 GDBusInterface *ret;
4368 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fru");
4369 if (ret == NULL)
4370 return NULL;
4371 return FRU (ret);
4372}
4373
4374/**
4375 * object_get_fru_fan:
4376 * @object: A #Object.
4377 *
4378 * Gets the #FruFan instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fru-Fan.top_of_page">org.openbmc.Fru.Fan</link> on @object, if any.
4379 *
4380 * Returns: (transfer full): A #FruFan that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
4381 */
4382FruFan *object_get_fru_fan (Object *object)
4383{
4384 GDBusInterface *ret;
4385 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fru.Fan");
4386 if (ret == NULL)
4387 return NULL;
4388 return FRU_FAN (ret);
4389}
4390
4391
4392/**
4393 * object_peek_fru: (skip)
4394 * @object: A #Object.
4395 *
4396 * Like object_get_fru() but doesn't increase the reference count on the returned object.
4397 *
4398 * <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>
4399 *
4400 * Returns: (transfer none): A #Fru or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
4401 */
4402Fru *object_peek_fru (Object *object)
4403{
4404 GDBusInterface *ret;
4405 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fru");
4406 if (ret == NULL)
4407 return NULL;
4408 g_object_unref (ret);
4409 return FRU (ret);
4410}
4411
4412/**
4413 * object_peek_fru_fan: (skip)
4414 * @object: A #Object.
4415 *
4416 * Like object_get_fru_fan() but doesn't increase the reference count on the returned object.
4417 *
4418 * <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>
4419 *
4420 * Returns: (transfer none): A #FruFan or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
4421 */
4422FruFan *object_peek_fru_fan (Object *object)
4423{
4424 GDBusInterface *ret;
4425 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fru.Fan");
4426 if (ret == NULL)
4427 return NULL;
4428 g_object_unref (ret);
4429 return FRU_FAN (ret);
4430}
4431
4432
4433static void
4434object_notify (GDBusObject *object, GDBusInterface *interface)
4435{
4436 _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
4437 /* info can be NULL if the other end is using a D-Bus interface we don't know
4438 * anything about, for example old generated code in this process talking to
4439 * newer generated code in the other process. */
4440 if (info != NULL)
4441 g_object_notify (G_OBJECT (object), info->hyphen_name);
4442}
4443
4444/**
4445 * ObjectProxy:
4446 *
4447 * The #ObjectProxy structure contains only private data and should only be accessed using the provided API.
4448 */
4449
4450/**
4451 * ObjectProxyClass:
4452 * @parent_class: The parent class.
4453 *
4454 * Class structure for #ObjectProxy.
4455 */
4456
4457static void
4458object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
4459{
4460}
4461
4462static void
4463object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
4464{
4465 iface->interface_added = object_notify;
4466 iface->interface_removed = object_notify;
4467}
4468
4469
4470G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
4471 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init)
4472 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init));
4473
4474static void
4475object_proxy_init (ObjectProxy *object G_GNUC_UNUSED)
4476{
4477}
4478
4479static void
4480object_proxy_set_property (GObject *gobject,
4481 guint prop_id,
4482 const GValue *value G_GNUC_UNUSED,
4483 GParamSpec *pspec)
4484{
4485 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
4486}
4487
4488static void
4489object_proxy_get_property (GObject *gobject,
4490 guint prop_id,
4491 GValue *value,
4492 GParamSpec *pspec)
4493{
4494 ObjectProxy *object = OBJECT_PROXY (gobject);
4495 GDBusInterface *interface;
4496
4497 switch (prop_id)
4498 {
4499 case 1:
4500 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fru");
4501 g_value_take_object (value, interface);
4502 break;
4503
4504 case 2:
4505 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fru.Fan");
4506 g_value_take_object (value, interface);
4507 break;
4508
4509 default:
4510 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
4511 break;
4512 }
4513}
4514
4515static void
4516object_proxy_class_init (ObjectProxyClass *klass)
4517{
4518 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
4519
4520 gobject_class->set_property = object_proxy_set_property;
4521 gobject_class->get_property = object_proxy_get_property;
4522
4523 g_object_class_override_property (gobject_class, 1, "fru");
4524 g_object_class_override_property (gobject_class, 2, "fru-fan");
4525}
4526
4527/**
4528 * object_proxy_new:
4529 * @connection: A #GDBusConnection.
4530 * @object_path: An object path.
4531 *
4532 * Creates a new proxy object.
4533 *
4534 * Returns: (transfer full): The proxy object.
4535 */
4536ObjectProxy *
4537object_proxy_new (GDBusConnection *connection,
4538 const gchar *object_path)
4539{
4540 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
4541 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
4542 return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
4543}
4544
4545/**
4546 * ObjectSkeleton:
4547 *
4548 * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API.
4549 */
4550
4551/**
4552 * ObjectSkeletonClass:
4553 * @parent_class: The parent class.
4554 *
4555 * Class structure for #ObjectSkeleton.
4556 */
4557
4558static void
4559object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
4560{
4561}
4562
4563
4564static void
4565object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
4566{
4567 iface->interface_added = object_notify;
4568 iface->interface_removed = object_notify;
4569}
4570
4571G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
4572 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init)
4573 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init));
4574
4575static void
4576object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED)
4577{
4578}
4579
4580static void
4581object_skeleton_set_property (GObject *gobject,
4582 guint prop_id,
4583 const GValue *value,
4584 GParamSpec *pspec)
4585{
4586 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
4587 GDBusInterfaceSkeleton *interface;
4588
4589 switch (prop_id)
4590 {
4591 case 1:
4592 interface = g_value_get_object (value);
4593 if (interface != NULL)
4594 {
4595 g_warn_if_fail (IS_FRU (interface));
4596 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
4597 }
4598 else
4599 {
4600 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Fru");
4601 }
4602 break;
4603
4604 case 2:
4605 interface = g_value_get_object (value);
4606 if (interface != NULL)
4607 {
4608 g_warn_if_fail (IS_FRU_FAN (interface));
4609 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
4610 }
4611 else
4612 {
4613 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Fru.Fan");
4614 }
4615 break;
4616
4617 default:
4618 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
4619 break;
4620 }
4621}
4622
4623static void
4624object_skeleton_get_property (GObject *gobject,
4625 guint prop_id,
4626 GValue *value,
4627 GParamSpec *pspec)
4628{
4629 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
4630 GDBusInterface *interface;
4631
4632 switch (prop_id)
4633 {
4634 case 1:
4635 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fru");
4636 g_value_take_object (value, interface);
4637 break;
4638
4639 case 2:
4640 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fru.Fan");
4641 g_value_take_object (value, interface);
4642 break;
4643
4644 default:
4645 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
4646 break;
4647 }
4648}
4649
4650static void
4651object_skeleton_class_init (ObjectSkeletonClass *klass)
4652{
4653 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
4654
4655 gobject_class->set_property = object_skeleton_set_property;
4656 gobject_class->get_property = object_skeleton_get_property;
4657
4658 g_object_class_override_property (gobject_class, 1, "fru");
4659 g_object_class_override_property (gobject_class, 2, "fru-fan");
4660}
4661
4662/**
4663 * object_skeleton_new:
4664 * @object_path: An object path.
4665 *
4666 * Creates a new skeleton object.
4667 *
4668 * Returns: (transfer full): The skeleton object.
4669 */
4670ObjectSkeleton *
4671object_skeleton_new (const gchar *object_path)
4672{
4673 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
4674 return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
4675}
4676
4677/**
4678 * object_skeleton_set_fru:
4679 * @object: A #ObjectSkeleton.
4680 * @interface_: (allow-none): A #Fru or %NULL to clear the interface.
4681 *
4682 * Sets the #Fru instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fru.top_of_page">org.openbmc.Fru</link> on @object.
4683 */
4684void object_skeleton_set_fru (ObjectSkeleton *object, Fru *interface_)
4685{
4686 g_object_set (G_OBJECT (object), "fru", interface_, NULL);
4687}
4688
4689/**
4690 * object_skeleton_set_fru_fan:
4691 * @object: A #ObjectSkeleton.
4692 * @interface_: (allow-none): A #FruFan or %NULL to clear the interface.
4693 *
4694 * Sets the #FruFan instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fru-Fan.top_of_page">org.openbmc.Fru.Fan</link> on @object.
4695 */
4696void object_skeleton_set_fru_fan (ObjectSkeleton *object, FruFan *interface_)
4697{
4698 g_object_set (G_OBJECT (object), "fru-fan", interface_, NULL);
4699}
4700
4701
4702/* ------------------------------------------------------------------------
4703 * Code for ObjectManager client
4704 * ------------------------------------------------------------------------
4705 */
4706
4707/**
4708 * SECTION:ObjectManagerClient
4709 * @title: ObjectManagerClient
4710 * @short_description: Generated GDBusObjectManagerClient type
4711 *
4712 * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
4713 */
4714
4715/**
4716 * ObjectManagerClient:
4717 *
4718 * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API.
4719 */
4720
4721/**
4722 * ObjectManagerClientClass:
4723 * @parent_class: The parent class.
4724 *
4725 * Class structure for #ObjectManagerClient.
4726 */
4727
4728G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT);
4729
4730static void
4731object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED)
4732{
4733}
4734
4735static void
4736object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED)
4737{
4738}
4739
4740/**
4741 * object_manager_client_get_proxy_type:
4742 * @manager: A #GDBusObjectManagerClient.
4743 * @object_path: The object path of the remote object (unused).
4744 * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType.
4745 * @user_data: User data (unused).
4746 *
4747 * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types.
4748 *
4749 * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy.
4750 */
4751GType
4752object_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)
4753{
4754 static gsize once_init_value = 0;
4755 static GHashTable *lookup_hash;
4756 GType ret;
4757
4758 if (interface_name == NULL)
4759 return TYPE_OBJECT_PROXY;
4760 if (g_once_init_enter (&once_init_value))
4761 {
4762 lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
4763 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Fru", GSIZE_TO_POINTER (TYPE_FRU_PROXY));
4764 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Fru.Fan", GSIZE_TO_POINTER (TYPE_FRU_FAN_PROXY));
4765 g_once_init_leave (&once_init_value, 1);
4766 }
4767 ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
4768 if (ret == (GType) 0)
4769 ret = G_TYPE_DBUS_PROXY;
4770 return ret;
4771}
4772
4773/**
4774 * object_manager_client_new:
4775 * @connection: A #GDBusConnection.
4776 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
4777 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
4778 * @object_path: An object path.
4779 * @cancellable: (allow-none): A #GCancellable or %NULL.
4780 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
4781 * @user_data: User data to pass to @callback.
4782 *
4783 * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
4784 *
4785 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
4786 * You can then call object_manager_client_new_finish() to get the result of the operation.
4787 *
4788 * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
4789 */
4790void
4791object_manager_client_new (
4792 GDBusConnection *connection,
4793 GDBusObjectManagerClientFlags flags,
4794 const gchar *name,
4795 const gchar *object_path,
4796 GCancellable *cancellable,
4797 GAsyncReadyCallback callback,
4798 gpointer user_data)
4799{
4800 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);
4801}
4802
4803/**
4804 * object_manager_client_new_finish:
4805 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new().
4806 * @error: Return location for error or %NULL
4807 *
4808 * Finishes an operation started with object_manager_client_new().
4809 *
4810 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
4811 */
4812GDBusObjectManager *
4813object_manager_client_new_finish (
4814 GAsyncResult *res,
4815 GError **error)
4816{
4817 GObject *ret;
4818 GObject *source_object;
4819 source_object = g_async_result_get_source_object (res);
4820 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
4821 g_object_unref (source_object);
4822 if (ret != NULL)
4823 return G_DBUS_OBJECT_MANAGER (ret);
4824 else
4825 return NULL;
4826}
4827
4828/**
4829 * object_manager_client_new_sync:
4830 * @connection: A #GDBusConnection.
4831 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
4832 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
4833 * @object_path: An object path.
4834 * @cancellable: (allow-none): A #GCancellable or %NULL.
4835 * @error: Return location for error or %NULL
4836 *
4837 * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
4838 *
4839 * The calling thread is blocked until a reply is received.
4840 *
4841 * See object_manager_client_new() for the asynchronous version of this constructor.
4842 *
4843 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
4844 */
4845GDBusObjectManager *
4846object_manager_client_new_sync (
4847 GDBusConnection *connection,
4848 GDBusObjectManagerClientFlags flags,
4849 const gchar *name,
4850 const gchar *object_path,
4851 GCancellable *cancellable,
4852 GError **error)
4853{
4854 GInitable *ret;
4855 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);
4856 if (ret != NULL)
4857 return G_DBUS_OBJECT_MANAGER (ret);
4858 else
4859 return NULL;
4860}
4861
4862
4863/**
4864 * object_manager_client_new_for_bus:
4865 * @bus_type: A #GBusType.
4866 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
4867 * @name: A bus name (well-known or unique).
4868 * @object_path: An object path.
4869 * @cancellable: (allow-none): A #GCancellable or %NULL.
4870 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
4871 * @user_data: User data to pass to @callback.
4872 *
4873 * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
4874 *
4875 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
4876 * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation.
4877 *
4878 * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
4879 */
4880void
4881object_manager_client_new_for_bus (
4882 GBusType bus_type,
4883 GDBusObjectManagerClientFlags flags,
4884 const gchar *name,
4885 const gchar *object_path,
4886 GCancellable *cancellable,
4887 GAsyncReadyCallback callback,
4888 gpointer user_data)
4889{
4890 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);
4891}
4892
4893/**
4894 * object_manager_client_new_for_bus_finish:
4895 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus().
4896 * @error: Return location for error or %NULL
4897 *
4898 * Finishes an operation started with object_manager_client_new_for_bus().
4899 *
4900 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
4901 */
4902GDBusObjectManager *
4903object_manager_client_new_for_bus_finish (
4904 GAsyncResult *res,
4905 GError **error)
4906{
4907 GObject *ret;
4908 GObject *source_object;
4909 source_object = g_async_result_get_source_object (res);
4910 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
4911 g_object_unref (source_object);
4912 if (ret != NULL)
4913 return G_DBUS_OBJECT_MANAGER (ret);
4914 else
4915 return NULL;
4916}
4917
4918/**
4919 * object_manager_client_new_for_bus_sync:
4920 * @bus_type: A #GBusType.
4921 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
4922 * @name: A bus name (well-known or unique).
4923 * @object_path: An object path.
4924 * @cancellable: (allow-none): A #GCancellable or %NULL.
4925 * @error: Return location for error or %NULL
4926 *
4927 * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
4928 *
4929 * The calling thread is blocked until a reply is received.
4930 *
4931 * See object_manager_client_new_for_bus() for the asynchronous version of this constructor.
4932 *
4933 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
4934 */
4935GDBusObjectManager *
4936object_manager_client_new_for_bus_sync (
4937 GBusType bus_type,
4938 GDBusObjectManagerClientFlags flags,
4939 const gchar *name,
4940 const gchar *object_path,
4941 GCancellable *cancellable,
4942 GError **error)
4943{
4944 GInitable *ret;
4945 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);
4946 if (ret != NULL)
4947 return G_DBUS_OBJECT_MANAGER (ret);
4948 else
4949 return NULL;
4950}
4951
4952