blob: 492c1d5de7abff877b449c12f1a4ed80e462430c [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
Norman James90baede2015-09-02 20:32:49 -0500166static const _ExtendedGDBusMethodInfo _fru_method_info_init =
167{
168 {
169 -1,
170 (gchar *) "init",
171 NULL,
172 NULL,
173 NULL
174 },
175 "handle-init",
176 FALSE
177};
178
179static const _ExtendedGDBusMethodInfo * const _fru_method_info_pointers[] =
180{
181 &_fru_method_info_init,
182 NULL
183};
184
Norman Jamesce46e3e2015-08-30 22:25:55 -0500185static const _ExtendedGDBusSignalInfo _fru_signal_info_state_changed =
186{
187 {
188 -1,
189 (gchar *) "StateChanged",
190 NULL,
191 NULL
192 },
193 "state-changed"
194};
195
196static const _ExtendedGDBusSignalInfo _fru_signal_info_unrecoverable_error =
197{
198 {
199 -1,
200 (gchar *) "UnrecoverableError",
201 NULL,
202 NULL
203 },
204 "unrecoverable-error"
205};
206
207static const _ExtendedGDBusSignalInfo _fru_signal_info_recoverable_error =
208{
209 {
210 -1,
211 (gchar *) "RecoverableError",
212 NULL,
213 NULL
214 },
215 "recoverable-error"
216};
217
Norman James90baede2015-09-02 20:32:49 -0500218static const _ExtendedGDBusArgInfo _fru_signal_info_cache_me_ARG_busname =
219{
220 {
221 -1,
222 (gchar *) "busname",
223 (gchar *) "s",
224 NULL
225 },
226 FALSE
227};
228
229static const _ExtendedGDBusArgInfo * const _fru_signal_info_cache_me_ARG_pointers[] =
230{
231 &_fru_signal_info_cache_me_ARG_busname,
232 NULL
233};
234
235static const _ExtendedGDBusSignalInfo _fru_signal_info_cache_me =
236{
237 {
238 -1,
239 (gchar *) "CacheMe",
240 (GDBusArgInfo **) &_fru_signal_info_cache_me_ARG_pointers,
241 NULL
242 },
243 "cache-me"
244};
245
Norman Jamesce46e3e2015-08-30 22:25:55 -0500246static const _ExtendedGDBusSignalInfo * const _fru_signal_info_pointers[] =
247{
248 &_fru_signal_info_state_changed,
249 &_fru_signal_info_unrecoverable_error,
250 &_fru_signal_info_recoverable_error,
Norman James90baede2015-09-02 20:32:49 -0500251 &_fru_signal_info_cache_me,
Norman Jamesce46e3e2015-08-30 22:25:55 -0500252 NULL
253};
254
255static const _ExtendedGDBusPropertyInfo _fru_property_info_label =
256{
257 {
258 -1,
259 (gchar *) "label",
260 (gchar *) "s",
261 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
262 NULL
263 },
264 "label",
265 FALSE
266};
267
268static const _ExtendedGDBusPropertyInfo _fru_property_info_location =
269{
270 {
271 -1,
272 (gchar *) "location",
273 (gchar *) "s",
274 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
275 NULL
276 },
277 "location",
278 FALSE
279};
280
281static const _ExtendedGDBusPropertyInfo _fru_property_info_state =
282{
283 {
284 -1,
285 (gchar *) "state",
286 (gchar *) "y",
287 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
288 NULL
289 },
290 "state",
291 FALSE
292};
293
294static const _ExtendedGDBusPropertyInfo _fru_property_info_manufacturer =
295{
296 {
297 -1,
298 (gchar *) "manufacturer",
299 (gchar *) "s",
300 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
301 NULL
302 },
303 "manufacturer",
304 FALSE
305};
306
307static const _ExtendedGDBusPropertyInfo _fru_property_info_part_num =
308{
309 {
310 -1,
311 (gchar *) "part_num",
312 (gchar *) "s",
313 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
314 NULL
315 },
316 "part-num",
317 FALSE
318};
319
320static const _ExtendedGDBusPropertyInfo _fru_property_info_serial_num =
321{
322 {
323 -1,
324 (gchar *) "serial_num",
325 (gchar *) "s",
326 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
327 NULL
328 },
329 "serial-num",
330 FALSE
331};
332
333static const _ExtendedGDBusPropertyInfo _fru_property_info_date_code =
334{
335 {
336 -1,
337 (gchar *) "date_code",
338 (gchar *) "u",
339 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
340 NULL
341 },
342 "date-code",
343 FALSE
344};
345
346static const _ExtendedGDBusPropertyInfo _fru_property_info_version =
347{
348 {
349 -1,
350 (gchar *) "version",
351 (gchar *) "s",
352 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
353 NULL
354 },
355 "version",
356 FALSE
357};
358
359static const _ExtendedGDBusPropertyInfo _fru_property_info_type_ =
360{
361 {
362 -1,
363 (gchar *) "type",
364 (gchar *) "y",
365 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
366 NULL
367 },
368 "type",
369 FALSE
370};
371
372static const _ExtendedGDBusPropertyInfo _fru_property_info_subtype =
373{
374 {
375 -1,
376 (gchar *) "subtype",
377 (gchar *) "y",
378 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
379 NULL
380 },
381 "subtype",
382 FALSE
383};
384
385static const _ExtendedGDBusPropertyInfo _fru_property_info_instance_num =
386{
387 {
388 -1,
389 (gchar *) "instance_num",
390 (gchar *) "y",
391 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
392 NULL
393 },
394 "instance-num",
395 FALSE
396};
397
398static const _ExtendedGDBusPropertyInfo * const _fru_property_info_pointers[] =
399{
400 &_fru_property_info_label,
401 &_fru_property_info_location,
402 &_fru_property_info_state,
403 &_fru_property_info_manufacturer,
404 &_fru_property_info_part_num,
405 &_fru_property_info_serial_num,
406 &_fru_property_info_date_code,
407 &_fru_property_info_version,
408 &_fru_property_info_type_,
409 &_fru_property_info_subtype,
410 &_fru_property_info_instance_num,
411 NULL
412};
413
414static const _ExtendedGDBusInterfaceInfo _fru_interface_info =
415{
416 {
417 -1,
418 (gchar *) "org.openbmc.Fru",
Norman James90baede2015-09-02 20:32:49 -0500419 (GDBusMethodInfo **) &_fru_method_info_pointers,
Norman Jamesce46e3e2015-08-30 22:25:55 -0500420 (GDBusSignalInfo **) &_fru_signal_info_pointers,
421 (GDBusPropertyInfo **) &_fru_property_info_pointers,
422 NULL
423 },
424 "fru",
425};
426
427
428/**
429 * fru_interface_info:
430 *
431 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Fru.top_of_page">org.openbmc.Fru</link> D-Bus interface.
432 *
433 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
434 */
435GDBusInterfaceInfo *
436fru_interface_info (void)
437{
438 return (GDBusInterfaceInfo *) &_fru_interface_info.parent_struct;
439}
440
441/**
442 * fru_override_properties:
443 * @klass: The class structure for a #GObject<!-- -->-derived class.
444 * @property_id_begin: The property id to assign to the first overridden property.
445 *
446 * Overrides all #GObject properties in the #Fru interface for a concrete class.
447 * The properties are overridden in the order they are defined.
448 *
449 * Returns: The last property id.
450 */
451guint
452fru_override_properties (GObjectClass *klass, guint property_id_begin)
453{
454 g_object_class_override_property (klass, property_id_begin++, "label");
455 g_object_class_override_property (klass, property_id_begin++, "location");
456 g_object_class_override_property (klass, property_id_begin++, "state");
457 g_object_class_override_property (klass, property_id_begin++, "manufacturer");
458 g_object_class_override_property (klass, property_id_begin++, "part-num");
459 g_object_class_override_property (klass, property_id_begin++, "serial-num");
460 g_object_class_override_property (klass, property_id_begin++, "date-code");
461 g_object_class_override_property (klass, property_id_begin++, "version");
462 g_object_class_override_property (klass, property_id_begin++, "type");
463 g_object_class_override_property (klass, property_id_begin++, "subtype");
464 g_object_class_override_property (klass, property_id_begin++, "instance-num");
465 return property_id_begin - 1;
466}
467
468
469
470/**
471 * Fru:
472 *
473 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fru.top_of_page">org.openbmc.Fru</link>.
474 */
475
476/**
477 * FruIface:
478 * @parent_iface: The parent interface.
Norman James90baede2015-09-02 20:32:49 -0500479 * @handle_init: Handler for the #Fru::handle-init signal.
Norman Jamesce46e3e2015-08-30 22:25:55 -0500480 * @get_date_code: Getter for the #Fru:date-code property.
481 * @get_instance_num: Getter for the #Fru:instance-num property.
482 * @get_label: Getter for the #Fru:label property.
483 * @get_location: Getter for the #Fru:location property.
484 * @get_manufacturer: Getter for the #Fru:manufacturer property.
485 * @get_part_num: Getter for the #Fru:part-num property.
486 * @get_serial_num: Getter for the #Fru:serial-num property.
487 * @get_state: Getter for the #Fru:state property.
488 * @get_subtype: Getter for the #Fru:subtype property.
489 * @get_type_: Getter for the #Fru:type property.
490 * @get_version: Getter for the #Fru:version property.
Norman James90baede2015-09-02 20:32:49 -0500491 * @cache_me: Handler for the #Fru::cache-me signal.
Norman Jamesce46e3e2015-08-30 22:25:55 -0500492 * @recoverable_error: Handler for the #Fru::recoverable-error signal.
493 * @state_changed: Handler for the #Fru::state-changed signal.
494 * @unrecoverable_error: Handler for the #Fru::unrecoverable-error signal.
495 *
496 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fru.top_of_page">org.openbmc.Fru</link>.
497 */
498
499typedef FruIface FruInterface;
500G_DEFINE_INTERFACE (Fru, fru, G_TYPE_OBJECT);
501
502static void
503fru_default_init (FruIface *iface)
504{
Norman James90baede2015-09-02 20:32:49 -0500505 /* GObject signals for incoming D-Bus method calls: */
506 /**
507 * Fru::handle-init:
508 * @object: A #Fru.
509 * @invocation: A #GDBusMethodInvocation.
510 *
511 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fru.init">init()</link> D-Bus method.
512 *
513 * 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_complete_init() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
514 *
515 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
516 */
517 g_signal_new ("handle-init",
518 G_TYPE_FROM_INTERFACE (iface),
519 G_SIGNAL_RUN_LAST,
520 G_STRUCT_OFFSET (FruIface, handle_init),
521 g_signal_accumulator_true_handled,
522 NULL,
523 g_cclosure_marshal_generic,
524 G_TYPE_BOOLEAN,
525 1,
526 G_TYPE_DBUS_METHOD_INVOCATION);
527
Norman Jamesce46e3e2015-08-30 22:25:55 -0500528 /* GObject signals for received D-Bus signals: */
529 /**
530 * Fru::state-changed:
531 * @object: A #Fru.
532 *
533 * 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.
534 *
535 * 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.
536 */
537 g_signal_new ("state-changed",
538 G_TYPE_FROM_INTERFACE (iface),
539 G_SIGNAL_RUN_LAST,
540 G_STRUCT_OFFSET (FruIface, state_changed),
541 NULL,
542 NULL,
543 g_cclosure_marshal_generic,
544 G_TYPE_NONE,
545 0);
546
547 /**
548 * Fru::unrecoverable-error:
549 * @object: A #Fru.
550 *
551 * 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.
552 *
553 * 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.
554 */
555 g_signal_new ("unrecoverable-error",
556 G_TYPE_FROM_INTERFACE (iface),
557 G_SIGNAL_RUN_LAST,
558 G_STRUCT_OFFSET (FruIface, unrecoverable_error),
559 NULL,
560 NULL,
561 g_cclosure_marshal_generic,
562 G_TYPE_NONE,
563 0);
564
565 /**
566 * Fru::recoverable-error:
567 * @object: A #Fru.
568 *
569 * 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.
570 *
571 * 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.
572 */
573 g_signal_new ("recoverable-error",
574 G_TYPE_FROM_INTERFACE (iface),
575 G_SIGNAL_RUN_LAST,
576 G_STRUCT_OFFSET (FruIface, recoverable_error),
577 NULL,
578 NULL,
579 g_cclosure_marshal_generic,
580 G_TYPE_NONE,
581 0);
582
Norman James90baede2015-09-02 20:32:49 -0500583 /**
584 * Fru::cache-me:
585 * @object: A #Fru.
586 * @arg_busname: Argument.
587 *
588 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Fru.CacheMe">"CacheMe"</link> is received.
589 *
590 * 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.
591 */
592 g_signal_new ("cache-me",
593 G_TYPE_FROM_INTERFACE (iface),
594 G_SIGNAL_RUN_LAST,
595 G_STRUCT_OFFSET (FruIface, cache_me),
596 NULL,
597 NULL,
598 g_cclosure_marshal_generic,
599 G_TYPE_NONE,
600 1, G_TYPE_STRING);
601
Norman Jamesce46e3e2015-08-30 22:25:55 -0500602 /* GObject properties for D-Bus properties: */
603 /**
604 * Fru:label:
605 *
606 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fru.label">"label"</link>.
607 *
608 * 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.
609 */
610 g_object_interface_install_property (iface,
611 g_param_spec_string ("label", "label", "label", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
612 /**
613 * Fru:location:
614 *
615 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fru.location">"location"</link>.
616 *
617 * 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.
618 */
619 g_object_interface_install_property (iface,
620 g_param_spec_string ("location", "location", "location", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
621 /**
622 * Fru:state:
623 *
624 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fru.state">"state"</link>.
625 *
626 * 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.
627 */
628 g_object_interface_install_property (iface,
629 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
630 /**
631 * Fru:manufacturer:
632 *
633 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fru.manufacturer">"manufacturer"</link>.
634 *
635 * 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.
636 */
637 g_object_interface_install_property (iface,
638 g_param_spec_string ("manufacturer", "manufacturer", "manufacturer", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
639 /**
640 * Fru:part-num:
641 *
642 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fru.part_num">"part_num"</link>.
643 *
644 * 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.
645 */
646 g_object_interface_install_property (iface,
647 g_param_spec_string ("part-num", "part_num", "part_num", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
648 /**
649 * Fru:serial-num:
650 *
651 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fru.serial_num">"serial_num"</link>.
652 *
653 * 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.
654 */
655 g_object_interface_install_property (iface,
656 g_param_spec_string ("serial-num", "serial_num", "serial_num", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
657 /**
658 * Fru:date-code:
659 *
660 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fru.date_code">"date_code"</link>.
661 *
662 * 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.
663 */
664 g_object_interface_install_property (iface,
665 g_param_spec_uint ("date-code", "date_code", "date_code", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
666 /**
667 * Fru:version:
668 *
669 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fru.version">"version"</link>.
670 *
671 * 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.
672 */
673 g_object_interface_install_property (iface,
674 g_param_spec_string ("version", "version", "version", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
675 /**
676 * Fru:type:
677 *
678 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fru.type">"type"</link>.
679 *
680 * 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.
681 */
682 g_object_interface_install_property (iface,
683 g_param_spec_uchar ("type", "type", "type", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
684 /**
685 * Fru:subtype:
686 *
687 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fru.subtype">"subtype"</link>.
688 *
689 * 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.
690 */
691 g_object_interface_install_property (iface,
692 g_param_spec_uchar ("subtype", "subtype", "subtype", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
693 /**
694 * Fru:instance-num:
695 *
696 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fru.instance_num">"instance_num"</link>.
697 *
698 * 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.
699 */
700 g_object_interface_install_property (iface,
701 g_param_spec_uchar ("instance-num", "instance_num", "instance_num", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
702}
703
704/**
705 * fru_get_label: (skip)
706 * @object: A #Fru.
707 *
708 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fru.label">"label"</link> D-Bus property.
709 *
710 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
711 *
712 * <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>
713 *
714 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
715 */
716const gchar *
717fru_get_label (Fru *object)
718{
719 return FRU_GET_IFACE (object)->get_label (object);
720}
721
722/**
723 * fru_dup_label: (skip)
724 * @object: A #Fru.
725 *
726 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Fru.label">"label"</link> D-Bus property.
727 *
728 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
729 *
730 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
731 */
732gchar *
733fru_dup_label (Fru *object)
734{
735 gchar *value;
736 g_object_get (G_OBJECT (object), "label", &value, NULL);
737 return value;
738}
739
740/**
741 * fru_set_label: (skip)
742 * @object: A #Fru.
743 * @value: The value to set.
744 *
745 * Sets the <link linkend="gdbus-property-org-openbmc-Fru.label">"label"</link> D-Bus property to @value.
746 *
747 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
748 */
749void
750fru_set_label (Fru *object, const gchar *value)
751{
752 g_object_set (G_OBJECT (object), "label", value, NULL);
753}
754
755/**
756 * fru_get_location: (skip)
757 * @object: A #Fru.
758 *
759 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fru.location">"location"</link> D-Bus property.
760 *
761 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
762 *
763 * <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>
764 *
765 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
766 */
767const gchar *
768fru_get_location (Fru *object)
769{
770 return FRU_GET_IFACE (object)->get_location (object);
771}
772
773/**
774 * fru_dup_location: (skip)
775 * @object: A #Fru.
776 *
777 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Fru.location">"location"</link> D-Bus property.
778 *
779 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
780 *
781 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
782 */
783gchar *
784fru_dup_location (Fru *object)
785{
786 gchar *value;
787 g_object_get (G_OBJECT (object), "location", &value, NULL);
788 return value;
789}
790
791/**
792 * fru_set_location: (skip)
793 * @object: A #Fru.
794 * @value: The value to set.
795 *
796 * Sets the <link linkend="gdbus-property-org-openbmc-Fru.location">"location"</link> D-Bus property to @value.
797 *
798 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
799 */
800void
801fru_set_location (Fru *object, const gchar *value)
802{
803 g_object_set (G_OBJECT (object), "location", value, NULL);
804}
805
806/**
807 * fru_get_state: (skip)
808 * @object: A #Fru.
809 *
810 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fru.state">"state"</link> D-Bus property.
811 *
812 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
813 *
814 * Returns: The property value.
815 */
816guchar
817fru_get_state (Fru *object)
818{
819 return FRU_GET_IFACE (object)->get_state (object);
820}
821
822/**
823 * fru_set_state: (skip)
824 * @object: A #Fru.
825 * @value: The value to set.
826 *
827 * Sets the <link linkend="gdbus-property-org-openbmc-Fru.state">"state"</link> D-Bus property to @value.
828 *
829 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
830 */
831void
832fru_set_state (Fru *object, guchar value)
833{
834 g_object_set (G_OBJECT (object), "state", value, NULL);
835}
836
837/**
838 * fru_get_manufacturer: (skip)
839 * @object: A #Fru.
840 *
841 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fru.manufacturer">"manufacturer"</link> D-Bus property.
842 *
843 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
844 *
845 * <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>
846 *
847 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
848 */
849const gchar *
850fru_get_manufacturer (Fru *object)
851{
852 return FRU_GET_IFACE (object)->get_manufacturer (object);
853}
854
855/**
856 * fru_dup_manufacturer: (skip)
857 * @object: A #Fru.
858 *
859 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Fru.manufacturer">"manufacturer"</link> D-Bus property.
860 *
861 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
862 *
863 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
864 */
865gchar *
866fru_dup_manufacturer (Fru *object)
867{
868 gchar *value;
869 g_object_get (G_OBJECT (object), "manufacturer", &value, NULL);
870 return value;
871}
872
873/**
874 * fru_set_manufacturer: (skip)
875 * @object: A #Fru.
876 * @value: The value to set.
877 *
878 * Sets the <link linkend="gdbus-property-org-openbmc-Fru.manufacturer">"manufacturer"</link> D-Bus property to @value.
879 *
880 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
881 */
882void
883fru_set_manufacturer (Fru *object, const gchar *value)
884{
885 g_object_set (G_OBJECT (object), "manufacturer", value, NULL);
886}
887
888/**
889 * fru_get_part_num: (skip)
890 * @object: A #Fru.
891 *
892 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fru.part_num">"part_num"</link> D-Bus property.
893 *
894 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
895 *
896 * <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>
897 *
898 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
899 */
900const gchar *
901fru_get_part_num (Fru *object)
902{
903 return FRU_GET_IFACE (object)->get_part_num (object);
904}
905
906/**
907 * fru_dup_part_num: (skip)
908 * @object: A #Fru.
909 *
910 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Fru.part_num">"part_num"</link> D-Bus property.
911 *
912 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
913 *
914 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
915 */
916gchar *
917fru_dup_part_num (Fru *object)
918{
919 gchar *value;
920 g_object_get (G_OBJECT (object), "part-num", &value, NULL);
921 return value;
922}
923
924/**
925 * fru_set_part_num: (skip)
926 * @object: A #Fru.
927 * @value: The value to set.
928 *
929 * Sets the <link linkend="gdbus-property-org-openbmc-Fru.part_num">"part_num"</link> D-Bus property to @value.
930 *
931 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
932 */
933void
934fru_set_part_num (Fru *object, const gchar *value)
935{
936 g_object_set (G_OBJECT (object), "part-num", value, NULL);
937}
938
939/**
940 * fru_get_serial_num: (skip)
941 * @object: A #Fru.
942 *
943 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fru.serial_num">"serial_num"</link> D-Bus property.
944 *
945 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
946 *
947 * <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>
948 *
949 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
950 */
951const gchar *
952fru_get_serial_num (Fru *object)
953{
954 return FRU_GET_IFACE (object)->get_serial_num (object);
955}
956
957/**
958 * fru_dup_serial_num: (skip)
959 * @object: A #Fru.
960 *
961 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Fru.serial_num">"serial_num"</link> D-Bus property.
962 *
963 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
964 *
965 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
966 */
967gchar *
968fru_dup_serial_num (Fru *object)
969{
970 gchar *value;
971 g_object_get (G_OBJECT (object), "serial-num", &value, NULL);
972 return value;
973}
974
975/**
976 * fru_set_serial_num: (skip)
977 * @object: A #Fru.
978 * @value: The value to set.
979 *
980 * Sets the <link linkend="gdbus-property-org-openbmc-Fru.serial_num">"serial_num"</link> D-Bus property to @value.
981 *
982 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
983 */
984void
985fru_set_serial_num (Fru *object, const gchar *value)
986{
987 g_object_set (G_OBJECT (object), "serial-num", value, NULL);
988}
989
990/**
991 * fru_get_date_code: (skip)
992 * @object: A #Fru.
993 *
994 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fru.date_code">"date_code"</link> D-Bus property.
995 *
996 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
997 *
998 * Returns: The property value.
999 */
1000guint
1001fru_get_date_code (Fru *object)
1002{
1003 return FRU_GET_IFACE (object)->get_date_code (object);
1004}
1005
1006/**
1007 * fru_set_date_code: (skip)
1008 * @object: A #Fru.
1009 * @value: The value to set.
1010 *
1011 * Sets the <link linkend="gdbus-property-org-openbmc-Fru.date_code">"date_code"</link> D-Bus property to @value.
1012 *
1013 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
1014 */
1015void
1016fru_set_date_code (Fru *object, guint value)
1017{
1018 g_object_set (G_OBJECT (object), "date-code", value, NULL);
1019}
1020
1021/**
1022 * fru_get_version: (skip)
1023 * @object: A #Fru.
1024 *
1025 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fru.version">"version"</link> D-Bus property.
1026 *
1027 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
1028 *
1029 * <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>
1030 *
1031 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
1032 */
1033const gchar *
1034fru_get_version (Fru *object)
1035{
1036 return FRU_GET_IFACE (object)->get_version (object);
1037}
1038
1039/**
1040 * fru_dup_version: (skip)
1041 * @object: A #Fru.
1042 *
1043 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Fru.version">"version"</link> D-Bus property.
1044 *
1045 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
1046 *
1047 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
1048 */
1049gchar *
1050fru_dup_version (Fru *object)
1051{
1052 gchar *value;
1053 g_object_get (G_OBJECT (object), "version", &value, NULL);
1054 return value;
1055}
1056
1057/**
1058 * fru_set_version: (skip)
1059 * @object: A #Fru.
1060 * @value: The value to set.
1061 *
1062 * Sets the <link linkend="gdbus-property-org-openbmc-Fru.version">"version"</link> D-Bus property to @value.
1063 *
1064 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
1065 */
1066void
1067fru_set_version (Fru *object, const gchar *value)
1068{
1069 g_object_set (G_OBJECT (object), "version", value, NULL);
1070}
1071
1072/**
1073 * fru_get_type_: (skip)
1074 * @object: A #Fru.
1075 *
1076 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fru.type">"type"</link> D-Bus property.
1077 *
1078 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
1079 *
1080 * Returns: The property value.
1081 */
1082guchar
1083fru_get_type_ (Fru *object)
1084{
1085 return FRU_GET_IFACE (object)->get_type_ (object);
1086}
1087
1088/**
1089 * fru_set_type_: (skip)
1090 * @object: A #Fru.
1091 * @value: The value to set.
1092 *
1093 * Sets the <link linkend="gdbus-property-org-openbmc-Fru.type">"type"</link> D-Bus property to @value.
1094 *
1095 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
1096 */
1097void
1098fru_set_type_ (Fru *object, guchar value)
1099{
1100 g_object_set (G_OBJECT (object), "type", value, NULL);
1101}
1102
1103/**
1104 * fru_get_subtype: (skip)
1105 * @object: A #Fru.
1106 *
1107 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fru.subtype">"subtype"</link> D-Bus property.
1108 *
1109 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
1110 *
1111 * Returns: The property value.
1112 */
1113guchar
1114fru_get_subtype (Fru *object)
1115{
1116 return FRU_GET_IFACE (object)->get_subtype (object);
1117}
1118
1119/**
1120 * fru_set_subtype: (skip)
1121 * @object: A #Fru.
1122 * @value: The value to set.
1123 *
1124 * Sets the <link linkend="gdbus-property-org-openbmc-Fru.subtype">"subtype"</link> D-Bus property to @value.
1125 *
1126 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
1127 */
1128void
1129fru_set_subtype (Fru *object, guchar value)
1130{
1131 g_object_set (G_OBJECT (object), "subtype", value, NULL);
1132}
1133
1134/**
1135 * fru_get_instance_num: (skip)
1136 * @object: A #Fru.
1137 *
1138 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fru.instance_num">"instance_num"</link> D-Bus property.
1139 *
1140 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
1141 *
1142 * Returns: The property value.
1143 */
1144guchar
1145fru_get_instance_num (Fru *object)
1146{
1147 return FRU_GET_IFACE (object)->get_instance_num (object);
1148}
1149
1150/**
1151 * fru_set_instance_num: (skip)
1152 * @object: A #Fru.
1153 * @value: The value to set.
1154 *
1155 * Sets the <link linkend="gdbus-property-org-openbmc-Fru.instance_num">"instance_num"</link> D-Bus property to @value.
1156 *
1157 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
1158 */
1159void
1160fru_set_instance_num (Fru *object, guchar value)
1161{
1162 g_object_set (G_OBJECT (object), "instance-num", value, NULL);
1163}
1164
1165/**
1166 * fru_emit_state_changed:
1167 * @object: A #Fru.
1168 *
1169 * Emits the <link linkend="gdbus-signal-org-openbmc-Fru.StateChanged">"StateChanged"</link> D-Bus signal.
1170 */
1171void
1172fru_emit_state_changed (
1173 Fru *object)
1174{
1175 g_signal_emit_by_name (object, "state-changed");
1176}
1177
1178/**
1179 * fru_emit_unrecoverable_error:
1180 * @object: A #Fru.
1181 *
1182 * Emits the <link linkend="gdbus-signal-org-openbmc-Fru.UnrecoverableError">"UnrecoverableError"</link> D-Bus signal.
1183 */
1184void
1185fru_emit_unrecoverable_error (
1186 Fru *object)
1187{
1188 g_signal_emit_by_name (object, "unrecoverable-error");
1189}
1190
1191/**
1192 * fru_emit_recoverable_error:
1193 * @object: A #Fru.
1194 *
1195 * Emits the <link linkend="gdbus-signal-org-openbmc-Fru.RecoverableError">"RecoverableError"</link> D-Bus signal.
1196 */
1197void
1198fru_emit_recoverable_error (
1199 Fru *object)
1200{
1201 g_signal_emit_by_name (object, "recoverable-error");
1202}
1203
Norman James90baede2015-09-02 20:32:49 -05001204/**
1205 * fru_emit_cache_me:
1206 * @object: A #Fru.
1207 * @arg_busname: Argument to pass with the signal.
1208 *
1209 * Emits the <link linkend="gdbus-signal-org-openbmc-Fru.CacheMe">"CacheMe"</link> D-Bus signal.
1210 */
1211void
1212fru_emit_cache_me (
1213 Fru *object,
1214 const gchar *arg_busname)
1215{
1216 g_signal_emit_by_name (object, "cache-me", arg_busname);
1217}
1218
1219/**
1220 * fru_call_init:
1221 * @proxy: A #FruProxy.
1222 * @cancellable: (allow-none): A #GCancellable or %NULL.
1223 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1224 * @user_data: User data to pass to @callback.
1225 *
1226 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fru.init">init()</link> D-Bus method on @proxy.
1227 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
1228 * You can then call fru_call_init_finish() to get the result of the operation.
1229 *
1230 * See fru_call_init_sync() for the synchronous, blocking version of this method.
1231 */
1232void
1233fru_call_init (
1234 Fru *proxy,
1235 GCancellable *cancellable,
1236 GAsyncReadyCallback callback,
1237 gpointer user_data)
1238{
1239 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1240 "init",
1241 g_variant_new ("()"),
1242 G_DBUS_CALL_FLAGS_NONE,
1243 -1,
1244 cancellable,
1245 callback,
1246 user_data);
1247}
1248
1249/**
1250 * fru_call_init_finish:
1251 * @proxy: A #FruProxy.
1252 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fru_call_init().
1253 * @error: Return location for error or %NULL.
1254 *
1255 * Finishes an operation started with fru_call_init().
1256 *
1257 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1258 */
1259gboolean
1260fru_call_init_finish (
1261 Fru *proxy,
1262 GAsyncResult *res,
1263 GError **error)
1264{
1265 GVariant *_ret;
1266 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1267 if (_ret == NULL)
1268 goto _out;
1269 g_variant_get (_ret,
1270 "()");
1271 g_variant_unref (_ret);
1272_out:
1273 return _ret != NULL;
1274}
1275
1276/**
1277 * fru_call_init_sync:
1278 * @proxy: A #FruProxy.
1279 * @cancellable: (allow-none): A #GCancellable or %NULL.
1280 * @error: Return location for error or %NULL.
1281 *
1282 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Fru.init">init()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1283 *
1284 * See fru_call_init() for the asynchronous version of this method.
1285 *
1286 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1287 */
1288gboolean
1289fru_call_init_sync (
1290 Fru *proxy,
1291 GCancellable *cancellable,
1292 GError **error)
1293{
1294 GVariant *_ret;
1295 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1296 "init",
1297 g_variant_new ("()"),
1298 G_DBUS_CALL_FLAGS_NONE,
1299 -1,
1300 cancellable,
1301 error);
1302 if (_ret == NULL)
1303 goto _out;
1304 g_variant_get (_ret,
1305 "()");
1306 g_variant_unref (_ret);
1307_out:
1308 return _ret != NULL;
1309}
1310
1311/**
1312 * fru_complete_init:
1313 * @object: A #Fru.
1314 * @invocation: (transfer full): A #GDBusMethodInvocation.
1315 *
1316 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Fru.init">init()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
1317 *
1318 * This method will free @invocation, you cannot use it afterwards.
1319 */
1320void
1321fru_complete_init (
1322 Fru *object,
1323 GDBusMethodInvocation *invocation)
1324{
1325 g_dbus_method_invocation_return_value (invocation,
1326 g_variant_new ("()"));
1327}
1328
Norman Jamesce46e3e2015-08-30 22:25:55 -05001329/* ------------------------------------------------------------------------ */
1330
1331/**
1332 * FruProxy:
1333 *
1334 * The #FruProxy structure contains only private data and should only be accessed using the provided API.
1335 */
1336
1337/**
1338 * FruProxyClass:
1339 * @parent_class: The parent class.
1340 *
1341 * Class structure for #FruProxy.
1342 */
1343
1344struct _FruProxyPrivate
1345{
1346 GData *qdata;
1347};
1348
1349static void fru_proxy_iface_init (FruIface *iface);
1350
1351#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1352G_DEFINE_TYPE_WITH_CODE (FruProxy, fru_proxy, G_TYPE_DBUS_PROXY,
1353 G_ADD_PRIVATE (FruProxy)
1354 G_IMPLEMENT_INTERFACE (TYPE_FRU, fru_proxy_iface_init));
1355
1356#else
1357G_DEFINE_TYPE_WITH_CODE (FruProxy, fru_proxy, G_TYPE_DBUS_PROXY,
1358 G_IMPLEMENT_INTERFACE (TYPE_FRU, fru_proxy_iface_init));
1359
1360#endif
1361static void
1362fru_proxy_finalize (GObject *object)
1363{
1364 FruProxy *proxy = FRU_PROXY (object);
1365 g_datalist_clear (&proxy->priv->qdata);
1366 G_OBJECT_CLASS (fru_proxy_parent_class)->finalize (object);
1367}
1368
1369static void
1370fru_proxy_get_property (GObject *object,
1371 guint prop_id,
1372 GValue *value,
1373 GParamSpec *pspec G_GNUC_UNUSED)
1374{
1375 const _ExtendedGDBusPropertyInfo *info;
1376 GVariant *variant;
1377 g_assert (prop_id != 0 && prop_id - 1 < 11);
1378 info = _fru_property_info_pointers[prop_id - 1];
1379 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
1380 if (info->use_gvariant)
1381 {
1382 g_value_set_variant (value, variant);
1383 }
1384 else
1385 {
1386 if (variant != NULL)
1387 g_dbus_gvariant_to_gvalue (variant, value);
1388 }
1389 if (variant != NULL)
1390 g_variant_unref (variant);
1391}
1392
1393static void
1394fru_proxy_set_property_cb (GDBusProxy *proxy,
1395 GAsyncResult *res,
1396 gpointer user_data)
1397{
1398 const _ExtendedGDBusPropertyInfo *info = user_data;
1399 GError *error;
1400 GVariant *_ret;
1401 error = NULL;
1402 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
1403 if (!_ret)
1404 {
1405 g_warning ("Error setting property '%s' on interface org.openbmc.Fru: %s (%s, %d)",
1406 info->parent_struct.name,
1407 error->message, g_quark_to_string (error->domain), error->code);
1408 g_error_free (error);
1409 }
1410 else
1411 {
1412 g_variant_unref (_ret);
1413 }
1414}
1415
1416static void
1417fru_proxy_set_property (GObject *object,
1418 guint prop_id,
1419 const GValue *value,
1420 GParamSpec *pspec G_GNUC_UNUSED)
1421{
1422 const _ExtendedGDBusPropertyInfo *info;
1423 GVariant *variant;
1424 g_assert (prop_id != 0 && prop_id - 1 < 11);
1425 info = _fru_property_info_pointers[prop_id - 1];
1426 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
1427 g_dbus_proxy_call (G_DBUS_PROXY (object),
1428 "org.freedesktop.DBus.Properties.Set",
1429 g_variant_new ("(ssv)", "org.openbmc.Fru", info->parent_struct.name, variant),
1430 G_DBUS_CALL_FLAGS_NONE,
1431 -1,
1432 NULL, (GAsyncReadyCallback) fru_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
1433 g_variant_unref (variant);
1434}
1435
1436static void
1437fru_proxy_g_signal (GDBusProxy *proxy,
1438 const gchar *sender_name G_GNUC_UNUSED,
1439 const gchar *signal_name,
1440 GVariant *parameters)
1441{
1442 _ExtendedGDBusSignalInfo *info;
1443 GVariantIter iter;
1444 GVariant *child;
1445 GValue *paramv;
1446 guint num_params;
1447 guint n;
1448 guint signal_id;
1449 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_fru_interface_info.parent_struct, signal_name);
1450 if (info == NULL)
1451 return;
1452 num_params = g_variant_n_children (parameters);
1453 paramv = g_new0 (GValue, num_params + 1);
1454 g_value_init (&paramv[0], TYPE_FRU);
1455 g_value_set_object (&paramv[0], proxy);
1456 g_variant_iter_init (&iter, parameters);
1457 n = 1;
1458 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1459 {
1460 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
1461 if (arg_info->use_gvariant)
1462 {
1463 g_value_init (&paramv[n], G_TYPE_VARIANT);
1464 g_value_set_variant (&paramv[n], child);
1465 n++;
1466 }
1467 else
1468 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
1469 g_variant_unref (child);
1470 }
1471 signal_id = g_signal_lookup (info->signal_name, TYPE_FRU);
1472 g_signal_emitv (paramv, signal_id, 0, NULL);
1473 for (n = 0; n < num_params + 1; n++)
1474 g_value_unset (&paramv[n]);
1475 g_free (paramv);
1476}
1477
1478static void
1479fru_proxy_g_properties_changed (GDBusProxy *_proxy,
1480 GVariant *changed_properties,
1481 const gchar *const *invalidated_properties)
1482{
1483 FruProxy *proxy = FRU_PROXY (_proxy);
1484 guint n;
1485 const gchar *key;
1486 GVariantIter *iter;
1487 _ExtendedGDBusPropertyInfo *info;
1488 g_variant_get (changed_properties, "a{sv}", &iter);
1489 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
1490 {
1491 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fru_interface_info.parent_struct, key);
1492 g_datalist_remove_data (&proxy->priv->qdata, key);
1493 if (info != NULL)
1494 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
1495 }
1496 g_variant_iter_free (iter);
1497 for (n = 0; invalidated_properties[n] != NULL; n++)
1498 {
1499 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fru_interface_info.parent_struct, invalidated_properties[n]);
1500 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
1501 if (info != NULL)
1502 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
1503 }
1504}
1505
1506static const gchar *
1507fru_proxy_get_label (Fru *object)
1508{
1509 FruProxy *proxy = FRU_PROXY (object);
1510 GVariant *variant;
1511 const gchar *value = NULL;
1512 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "label");
1513 if (variant != NULL)
1514 {
1515 value = g_variant_get_string (variant, NULL);
1516 g_variant_unref (variant);
1517 }
1518 return value;
1519}
1520
1521static const gchar *
1522fru_proxy_get_location (Fru *object)
1523{
1524 FruProxy *proxy = FRU_PROXY (object);
1525 GVariant *variant;
1526 const gchar *value = NULL;
1527 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "location");
1528 if (variant != NULL)
1529 {
1530 value = g_variant_get_string (variant, NULL);
1531 g_variant_unref (variant);
1532 }
1533 return value;
1534}
1535
1536static guchar
1537fru_proxy_get_state (Fru *object)
1538{
1539 FruProxy *proxy = FRU_PROXY (object);
1540 GVariant *variant;
1541 guchar value = 0;
1542 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
1543 if (variant != NULL)
1544 {
1545 value = g_variant_get_byte (variant);
1546 g_variant_unref (variant);
1547 }
1548 return value;
1549}
1550
1551static const gchar *
1552fru_proxy_get_manufacturer (Fru *object)
1553{
1554 FruProxy *proxy = FRU_PROXY (object);
1555 GVariant *variant;
1556 const gchar *value = NULL;
1557 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "manufacturer");
1558 if (variant != NULL)
1559 {
1560 value = g_variant_get_string (variant, NULL);
1561 g_variant_unref (variant);
1562 }
1563 return value;
1564}
1565
1566static const gchar *
1567fru_proxy_get_part_num (Fru *object)
1568{
1569 FruProxy *proxy = FRU_PROXY (object);
1570 GVariant *variant;
1571 const gchar *value = NULL;
1572 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "part_num");
1573 if (variant != NULL)
1574 {
1575 value = g_variant_get_string (variant, NULL);
1576 g_variant_unref (variant);
1577 }
1578 return value;
1579}
1580
1581static const gchar *
1582fru_proxy_get_serial_num (Fru *object)
1583{
1584 FruProxy *proxy = FRU_PROXY (object);
1585 GVariant *variant;
1586 const gchar *value = NULL;
1587 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "serial_num");
1588 if (variant != NULL)
1589 {
1590 value = g_variant_get_string (variant, NULL);
1591 g_variant_unref (variant);
1592 }
1593 return value;
1594}
1595
1596static guint
1597fru_proxy_get_date_code (Fru *object)
1598{
1599 FruProxy *proxy = FRU_PROXY (object);
1600 GVariant *variant;
1601 guint value = 0;
1602 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "date_code");
1603 if (variant != NULL)
1604 {
1605 value = g_variant_get_uint32 (variant);
1606 g_variant_unref (variant);
1607 }
1608 return value;
1609}
1610
1611static const gchar *
1612fru_proxy_get_version (Fru *object)
1613{
1614 FruProxy *proxy = FRU_PROXY (object);
1615 GVariant *variant;
1616 const gchar *value = NULL;
1617 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "version");
1618 if (variant != NULL)
1619 {
1620 value = g_variant_get_string (variant, NULL);
1621 g_variant_unref (variant);
1622 }
1623 return value;
1624}
1625
1626static guchar
1627fru_proxy_get_type_ (Fru *object)
1628{
1629 FruProxy *proxy = FRU_PROXY (object);
1630 GVariant *variant;
1631 guchar value = 0;
1632 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "type");
1633 if (variant != NULL)
1634 {
1635 value = g_variant_get_byte (variant);
1636 g_variant_unref (variant);
1637 }
1638 return value;
1639}
1640
1641static guchar
1642fru_proxy_get_subtype (Fru *object)
1643{
1644 FruProxy *proxy = FRU_PROXY (object);
1645 GVariant *variant;
1646 guchar value = 0;
1647 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "subtype");
1648 if (variant != NULL)
1649 {
1650 value = g_variant_get_byte (variant);
1651 g_variant_unref (variant);
1652 }
1653 return value;
1654}
1655
1656static guchar
1657fru_proxy_get_instance_num (Fru *object)
1658{
1659 FruProxy *proxy = FRU_PROXY (object);
1660 GVariant *variant;
1661 guchar value = 0;
1662 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "instance_num");
1663 if (variant != NULL)
1664 {
1665 value = g_variant_get_byte (variant);
1666 g_variant_unref (variant);
1667 }
1668 return value;
1669}
1670
1671static void
1672fru_proxy_init (FruProxy *proxy)
1673{
1674#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1675 proxy->priv = fru_proxy_get_instance_private (proxy);
1676#else
1677 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FRU_PROXY, FruProxyPrivate);
1678#endif
1679
1680 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), fru_interface_info ());
1681}
1682
1683static void
1684fru_proxy_class_init (FruProxyClass *klass)
1685{
1686 GObjectClass *gobject_class;
1687 GDBusProxyClass *proxy_class;
1688
1689 gobject_class = G_OBJECT_CLASS (klass);
1690 gobject_class->finalize = fru_proxy_finalize;
1691 gobject_class->get_property = fru_proxy_get_property;
1692 gobject_class->set_property = fru_proxy_set_property;
1693
1694 proxy_class = G_DBUS_PROXY_CLASS (klass);
1695 proxy_class->g_signal = fru_proxy_g_signal;
1696 proxy_class->g_properties_changed = fru_proxy_g_properties_changed;
1697
1698 fru_override_properties (gobject_class, 1);
1699
1700#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1701 g_type_class_add_private (klass, sizeof (FruProxyPrivate));
1702#endif
1703}
1704
1705static void
1706fru_proxy_iface_init (FruIface *iface)
1707{
1708 iface->get_label = fru_proxy_get_label;
1709 iface->get_location = fru_proxy_get_location;
1710 iface->get_state = fru_proxy_get_state;
1711 iface->get_manufacturer = fru_proxy_get_manufacturer;
1712 iface->get_part_num = fru_proxy_get_part_num;
1713 iface->get_serial_num = fru_proxy_get_serial_num;
1714 iface->get_date_code = fru_proxy_get_date_code;
1715 iface->get_version = fru_proxy_get_version;
1716 iface->get_type_ = fru_proxy_get_type_;
1717 iface->get_subtype = fru_proxy_get_subtype;
1718 iface->get_instance_num = fru_proxy_get_instance_num;
1719}
1720
1721/**
1722 * fru_proxy_new:
1723 * @connection: A #GDBusConnection.
1724 * @flags: Flags from the #GDBusProxyFlags enumeration.
1725 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1726 * @object_path: An object path.
1727 * @cancellable: (allow-none): A #GCancellable or %NULL.
1728 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1729 * @user_data: User data to pass to @callback.
1730 *
1731 * 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.
1732 *
1733 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
1734 * You can then call fru_proxy_new_finish() to get the result of the operation.
1735 *
1736 * See fru_proxy_new_sync() for the synchronous, blocking version of this constructor.
1737 */
1738void
1739fru_proxy_new (
1740 GDBusConnection *connection,
1741 GDBusProxyFlags flags,
1742 const gchar *name,
1743 const gchar *object_path,
1744 GCancellable *cancellable,
1745 GAsyncReadyCallback callback,
1746 gpointer user_data)
1747{
1748 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);
1749}
1750
1751/**
1752 * fru_proxy_new_finish:
1753 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fru_proxy_new().
1754 * @error: Return location for error or %NULL
1755 *
1756 * Finishes an operation started with fru_proxy_new().
1757 *
1758 * Returns: (transfer full) (type FruProxy): The constructed proxy object or %NULL if @error is set.
1759 */
1760Fru *
1761fru_proxy_new_finish (
1762 GAsyncResult *res,
1763 GError **error)
1764{
1765 GObject *ret;
1766 GObject *source_object;
1767 source_object = g_async_result_get_source_object (res);
1768 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1769 g_object_unref (source_object);
1770 if (ret != NULL)
1771 return FRU (ret);
1772 else
1773 return NULL;
1774}
1775
1776/**
1777 * fru_proxy_new_sync:
1778 * @connection: A #GDBusConnection.
1779 * @flags: Flags from the #GDBusProxyFlags enumeration.
1780 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1781 * @object_path: An object path.
1782 * @cancellable: (allow-none): A #GCancellable or %NULL.
1783 * @error: Return location for error or %NULL
1784 *
1785 * 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.
1786 *
1787 * The calling thread is blocked until a reply is received.
1788 *
1789 * See fru_proxy_new() for the asynchronous version of this constructor.
1790 *
1791 * Returns: (transfer full) (type FruProxy): The constructed proxy object or %NULL if @error is set.
1792 */
1793Fru *
1794fru_proxy_new_sync (
1795 GDBusConnection *connection,
1796 GDBusProxyFlags flags,
1797 const gchar *name,
1798 const gchar *object_path,
1799 GCancellable *cancellable,
1800 GError **error)
1801{
1802 GInitable *ret;
1803 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);
1804 if (ret != NULL)
1805 return FRU (ret);
1806 else
1807 return NULL;
1808}
1809
1810
1811/**
1812 * fru_proxy_new_for_bus:
1813 * @bus_type: A #GBusType.
1814 * @flags: Flags from the #GDBusProxyFlags enumeration.
1815 * @name: A bus name (well-known or unique).
1816 * @object_path: An object path.
1817 * @cancellable: (allow-none): A #GCancellable or %NULL.
1818 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1819 * @user_data: User data to pass to @callback.
1820 *
1821 * Like fru_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
1822 *
1823 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
1824 * You can then call fru_proxy_new_for_bus_finish() to get the result of the operation.
1825 *
1826 * See fru_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
1827 */
1828void
1829fru_proxy_new_for_bus (
1830 GBusType bus_type,
1831 GDBusProxyFlags flags,
1832 const gchar *name,
1833 const gchar *object_path,
1834 GCancellable *cancellable,
1835 GAsyncReadyCallback callback,
1836 gpointer user_data)
1837{
1838 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);
1839}
1840
1841/**
1842 * fru_proxy_new_for_bus_finish:
1843 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fru_proxy_new_for_bus().
1844 * @error: Return location for error or %NULL
1845 *
1846 * Finishes an operation started with fru_proxy_new_for_bus().
1847 *
1848 * Returns: (transfer full) (type FruProxy): The constructed proxy object or %NULL if @error is set.
1849 */
1850Fru *
1851fru_proxy_new_for_bus_finish (
1852 GAsyncResult *res,
1853 GError **error)
1854{
1855 GObject *ret;
1856 GObject *source_object;
1857 source_object = g_async_result_get_source_object (res);
1858 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1859 g_object_unref (source_object);
1860 if (ret != NULL)
1861 return FRU (ret);
1862 else
1863 return NULL;
1864}
1865
1866/**
1867 * fru_proxy_new_for_bus_sync:
1868 * @bus_type: A #GBusType.
1869 * @flags: Flags from the #GDBusProxyFlags enumeration.
1870 * @name: A bus name (well-known or unique).
1871 * @object_path: An object path.
1872 * @cancellable: (allow-none): A #GCancellable or %NULL.
1873 * @error: Return location for error or %NULL
1874 *
1875 * Like fru_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
1876 *
1877 * The calling thread is blocked until a reply is received.
1878 *
1879 * See fru_proxy_new_for_bus() for the asynchronous version of this constructor.
1880 *
1881 * Returns: (transfer full) (type FruProxy): The constructed proxy object or %NULL if @error is set.
1882 */
1883Fru *
1884fru_proxy_new_for_bus_sync (
1885 GBusType bus_type,
1886 GDBusProxyFlags flags,
1887 const gchar *name,
1888 const gchar *object_path,
1889 GCancellable *cancellable,
1890 GError **error)
1891{
1892 GInitable *ret;
1893 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);
1894 if (ret != NULL)
1895 return FRU (ret);
1896 else
1897 return NULL;
1898}
1899
1900
1901/* ------------------------------------------------------------------------ */
1902
1903/**
1904 * FruSkeleton:
1905 *
1906 * The #FruSkeleton structure contains only private data and should only be accessed using the provided API.
1907 */
1908
1909/**
1910 * FruSkeletonClass:
1911 * @parent_class: The parent class.
1912 *
1913 * Class structure for #FruSkeleton.
1914 */
1915
1916struct _FruSkeletonPrivate
1917{
1918 GValue *properties;
1919 GList *changed_properties;
1920 GSource *changed_properties_idle_source;
1921 GMainContext *context;
1922 GMutex lock;
1923};
1924
1925static void
1926_fru_skeleton_handle_method_call (
1927 GDBusConnection *connection G_GNUC_UNUSED,
1928 const gchar *sender G_GNUC_UNUSED,
1929 const gchar *object_path G_GNUC_UNUSED,
1930 const gchar *interface_name,
1931 const gchar *method_name,
1932 GVariant *parameters,
1933 GDBusMethodInvocation *invocation,
1934 gpointer user_data)
1935{
1936 FruSkeleton *skeleton = FRU_SKELETON (user_data);
1937 _ExtendedGDBusMethodInfo *info;
1938 GVariantIter iter;
1939 GVariant *child;
1940 GValue *paramv;
1941 guint num_params;
1942 guint num_extra;
1943 guint n;
1944 guint signal_id;
1945 GValue return_value = G_VALUE_INIT;
1946 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
1947 g_assert (info != NULL);
1948 num_params = g_variant_n_children (parameters);
1949 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
1950 n = 0;
1951 g_value_init (&paramv[n], TYPE_FRU);
1952 g_value_set_object (&paramv[n++], skeleton);
1953 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
1954 g_value_set_object (&paramv[n++], invocation);
1955 if (info->pass_fdlist)
1956 {
1957#ifdef G_OS_UNIX
1958 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
1959 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
1960#else
1961 g_assert_not_reached ();
1962#endif
1963 }
1964 g_variant_iter_init (&iter, parameters);
1965 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1966 {
1967 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
1968 if (arg_info->use_gvariant)
1969 {
1970 g_value_init (&paramv[n], G_TYPE_VARIANT);
1971 g_value_set_variant (&paramv[n], child);
1972 n++;
1973 }
1974 else
1975 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
1976 g_variant_unref (child);
1977 }
1978 signal_id = g_signal_lookup (info->signal_name, TYPE_FRU);
1979 g_value_init (&return_value, G_TYPE_BOOLEAN);
1980 g_signal_emitv (paramv, signal_id, 0, &return_value);
1981 if (!g_value_get_boolean (&return_value))
1982 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);
1983 g_value_unset (&return_value);
1984 for (n = 0; n < num_params + num_extra; n++)
1985 g_value_unset (&paramv[n]);
1986 g_free (paramv);
1987}
1988
1989static GVariant *
1990_fru_skeleton_handle_get_property (
1991 GDBusConnection *connection G_GNUC_UNUSED,
1992 const gchar *sender G_GNUC_UNUSED,
1993 const gchar *object_path G_GNUC_UNUSED,
1994 const gchar *interface_name G_GNUC_UNUSED,
1995 const gchar *property_name,
1996 GError **error,
1997 gpointer user_data)
1998{
1999 FruSkeleton *skeleton = FRU_SKELETON (user_data);
2000 GValue value = G_VALUE_INIT;
2001 GParamSpec *pspec;
2002 _ExtendedGDBusPropertyInfo *info;
2003 GVariant *ret;
2004 ret = NULL;
2005 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fru_interface_info.parent_struct, property_name);
2006 g_assert (info != NULL);
2007 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
2008 if (pspec == NULL)
2009 {
2010 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
2011 }
2012 else
2013 {
2014 g_value_init (&value, pspec->value_type);
2015 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
2016 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
2017 g_value_unset (&value);
2018 }
2019 return ret;
2020}
2021
2022static gboolean
2023_fru_skeleton_handle_set_property (
2024 GDBusConnection *connection G_GNUC_UNUSED,
2025 const gchar *sender G_GNUC_UNUSED,
2026 const gchar *object_path G_GNUC_UNUSED,
2027 const gchar *interface_name G_GNUC_UNUSED,
2028 const gchar *property_name,
2029 GVariant *variant,
2030 GError **error,
2031 gpointer user_data)
2032{
2033 FruSkeleton *skeleton = FRU_SKELETON (user_data);
2034 GValue value = G_VALUE_INIT;
2035 GParamSpec *pspec;
2036 _ExtendedGDBusPropertyInfo *info;
2037 gboolean ret;
2038 ret = FALSE;
2039 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fru_interface_info.parent_struct, property_name);
2040 g_assert (info != NULL);
2041 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
2042 if (pspec == NULL)
2043 {
2044 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
2045 }
2046 else
2047 {
2048 if (info->use_gvariant)
2049 g_value_set_variant (&value, variant);
2050 else
2051 g_dbus_gvariant_to_gvalue (variant, &value);
2052 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
2053 g_value_unset (&value);
2054 ret = TRUE;
2055 }
2056 return ret;
2057}
2058
2059static const GDBusInterfaceVTable _fru_skeleton_vtable =
2060{
2061 _fru_skeleton_handle_method_call,
2062 _fru_skeleton_handle_get_property,
2063 _fru_skeleton_handle_set_property,
2064 {NULL}
2065};
2066
2067static GDBusInterfaceInfo *
2068fru_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
2069{
2070 return fru_interface_info ();
2071}
2072
2073static GDBusInterfaceVTable *
2074fru_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
2075{
2076 return (GDBusInterfaceVTable *) &_fru_skeleton_vtable;
2077}
2078
2079static GVariant *
2080fru_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
2081{
2082 FruSkeleton *skeleton = FRU_SKELETON (_skeleton);
2083
2084 GVariantBuilder builder;
2085 guint n;
2086 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
2087 if (_fru_interface_info.parent_struct.properties == NULL)
2088 goto out;
2089 for (n = 0; _fru_interface_info.parent_struct.properties[n] != NULL; n++)
2090 {
2091 GDBusPropertyInfo *info = _fru_interface_info.parent_struct.properties[n];
2092 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
2093 {
2094 GVariant *value;
2095 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);
2096 if (value != NULL)
2097 {
2098 g_variant_take_ref (value);
2099 g_variant_builder_add (&builder, "{sv}", info->name, value);
2100 g_variant_unref (value);
2101 }
2102 }
2103 }
2104out:
2105 return g_variant_builder_end (&builder);
2106}
2107
2108static gboolean _fru_emit_changed (gpointer user_data);
2109
2110static void
2111fru_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
2112{
2113 FruSkeleton *skeleton = FRU_SKELETON (_skeleton);
2114 gboolean emit_changed = FALSE;
2115
2116 g_mutex_lock (&skeleton->priv->lock);
2117 if (skeleton->priv->changed_properties_idle_source != NULL)
2118 {
2119 g_source_destroy (skeleton->priv->changed_properties_idle_source);
2120 skeleton->priv->changed_properties_idle_source = NULL;
2121 emit_changed = TRUE;
2122 }
2123 g_mutex_unlock (&skeleton->priv->lock);
2124
2125 if (emit_changed)
2126 _fru_emit_changed (skeleton);
2127}
2128
2129static void
2130_fru_on_signal_state_changed (
2131 Fru *object)
2132{
2133 FruSkeleton *skeleton = FRU_SKELETON (object);
2134
2135 GList *connections, *l;
2136 GVariant *signal_variant;
2137 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
2138
2139 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
2140 for (l = connections; l != NULL; l = l->next)
2141 {
2142 GDBusConnection *connection = l->data;
2143 g_dbus_connection_emit_signal (connection,
2144 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fru", "StateChanged",
2145 signal_variant, NULL);
2146 }
2147 g_variant_unref (signal_variant);
2148 g_list_free_full (connections, g_object_unref);
2149}
2150
2151static void
2152_fru_on_signal_unrecoverable_error (
2153 Fru *object)
2154{
2155 FruSkeleton *skeleton = FRU_SKELETON (object);
2156
2157 GList *connections, *l;
2158 GVariant *signal_variant;
2159 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
2160
2161 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
2162 for (l = connections; l != NULL; l = l->next)
2163 {
2164 GDBusConnection *connection = l->data;
2165 g_dbus_connection_emit_signal (connection,
2166 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fru", "UnrecoverableError",
2167 signal_variant, NULL);
2168 }
2169 g_variant_unref (signal_variant);
2170 g_list_free_full (connections, g_object_unref);
2171}
2172
2173static void
2174_fru_on_signal_recoverable_error (
2175 Fru *object)
2176{
2177 FruSkeleton *skeleton = FRU_SKELETON (object);
2178
2179 GList *connections, *l;
2180 GVariant *signal_variant;
2181 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
2182
2183 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
2184 for (l = connections; l != NULL; l = l->next)
2185 {
2186 GDBusConnection *connection = l->data;
2187 g_dbus_connection_emit_signal (connection,
2188 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fru", "RecoverableError",
2189 signal_variant, NULL);
2190 }
2191 g_variant_unref (signal_variant);
2192 g_list_free_full (connections, g_object_unref);
2193}
2194
Norman James90baede2015-09-02 20:32:49 -05002195static void
2196_fru_on_signal_cache_me (
2197 Fru *object,
2198 const gchar *arg_busname)
2199{
2200 FruSkeleton *skeleton = FRU_SKELETON (object);
2201
2202 GList *connections, *l;
2203 GVariant *signal_variant;
2204 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
2205
2206 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
2207 arg_busname));
2208 for (l = connections; l != NULL; l = l->next)
2209 {
2210 GDBusConnection *connection = l->data;
2211 g_dbus_connection_emit_signal (connection,
2212 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fru", "CacheMe",
2213 signal_variant, NULL);
2214 }
2215 g_variant_unref (signal_variant);
2216 g_list_free_full (connections, g_object_unref);
2217}
2218
Norman Jamesce46e3e2015-08-30 22:25:55 -05002219static void fru_skeleton_iface_init (FruIface *iface);
2220#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2221G_DEFINE_TYPE_WITH_CODE (FruSkeleton, fru_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
2222 G_ADD_PRIVATE (FruSkeleton)
2223 G_IMPLEMENT_INTERFACE (TYPE_FRU, fru_skeleton_iface_init));
2224
2225#else
2226G_DEFINE_TYPE_WITH_CODE (FruSkeleton, fru_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
2227 G_IMPLEMENT_INTERFACE (TYPE_FRU, fru_skeleton_iface_init));
2228
2229#endif
2230static void
2231fru_skeleton_finalize (GObject *object)
2232{
2233 FruSkeleton *skeleton = FRU_SKELETON (object);
2234 guint n;
2235 for (n = 0; n < 11; n++)
2236 g_value_unset (&skeleton->priv->properties[n]);
2237 g_free (skeleton->priv->properties);
2238 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
2239 if (skeleton->priv->changed_properties_idle_source != NULL)
2240 g_source_destroy (skeleton->priv->changed_properties_idle_source);
2241 g_main_context_unref (skeleton->priv->context);
2242 g_mutex_clear (&skeleton->priv->lock);
2243 G_OBJECT_CLASS (fru_skeleton_parent_class)->finalize (object);
2244}
2245
2246static void
2247fru_skeleton_get_property (GObject *object,
2248 guint prop_id,
2249 GValue *value,
2250 GParamSpec *pspec G_GNUC_UNUSED)
2251{
2252 FruSkeleton *skeleton = FRU_SKELETON (object);
2253 g_assert (prop_id != 0 && prop_id - 1 < 11);
2254 g_mutex_lock (&skeleton->priv->lock);
2255 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
2256 g_mutex_unlock (&skeleton->priv->lock);
2257}
2258
2259static gboolean
2260_fru_emit_changed (gpointer user_data)
2261{
2262 FruSkeleton *skeleton = FRU_SKELETON (user_data);
2263 GList *l;
2264 GVariantBuilder builder;
2265 GVariantBuilder invalidated_builder;
2266 guint num_changes;
2267
2268 g_mutex_lock (&skeleton->priv->lock);
2269 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
2270 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
2271 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
2272 {
2273 ChangedProperty *cp = l->data;
2274 GVariant *variant;
2275 const GValue *cur_value;
2276
2277 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
2278 if (!_g_value_equal (cur_value, &cp->orig_value))
2279 {
2280 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
2281 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
2282 g_variant_unref (variant);
2283 num_changes++;
2284 }
2285 }
2286 if (num_changes > 0)
2287 {
2288 GList *connections, *ll;
2289 GVariant *signal_variant;
2290 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Fru",
2291 &builder, &invalidated_builder));
2292 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
2293 for (ll = connections; ll != NULL; ll = ll->next)
2294 {
2295 GDBusConnection *connection = ll->data;
2296
2297 g_dbus_connection_emit_signal (connection,
2298 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
2299 "org.freedesktop.DBus.Properties",
2300 "PropertiesChanged",
2301 signal_variant,
2302 NULL);
2303 }
2304 g_variant_unref (signal_variant);
2305 g_list_free_full (connections, g_object_unref);
2306 }
2307 else
2308 {
2309 g_variant_builder_clear (&builder);
2310 g_variant_builder_clear (&invalidated_builder);
2311 }
2312 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
2313 skeleton->priv->changed_properties = NULL;
2314 skeleton->priv->changed_properties_idle_source = NULL;
2315 g_mutex_unlock (&skeleton->priv->lock);
2316 return FALSE;
2317}
2318
2319static void
2320_fru_schedule_emit_changed (FruSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
2321{
2322 ChangedProperty *cp;
2323 GList *l;
2324 cp = NULL;
2325 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
2326 {
2327 ChangedProperty *i_cp = l->data;
2328 if (i_cp->info == info)
2329 {
2330 cp = i_cp;
2331 break;
2332 }
2333 }
2334 if (cp == NULL)
2335 {
2336 cp = g_new0 (ChangedProperty, 1);
2337 cp->prop_id = prop_id;
2338 cp->info = info;
2339 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
2340 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
2341 g_value_copy (orig_value, &cp->orig_value);
2342 }
2343}
2344
2345static void
2346fru_skeleton_notify (GObject *object,
2347 GParamSpec *pspec G_GNUC_UNUSED)
2348{
2349 FruSkeleton *skeleton = FRU_SKELETON (object);
2350 g_mutex_lock (&skeleton->priv->lock);
2351 if (skeleton->priv->changed_properties != NULL &&
2352 skeleton->priv->changed_properties_idle_source == NULL)
2353 {
2354 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
2355 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
2356 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _fru_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
2357 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
2358 g_source_unref (skeleton->priv->changed_properties_idle_source);
2359 }
2360 g_mutex_unlock (&skeleton->priv->lock);
2361}
2362
2363static void
2364fru_skeleton_set_property (GObject *object,
2365 guint prop_id,
2366 const GValue *value,
2367 GParamSpec *pspec)
2368{
2369 FruSkeleton *skeleton = FRU_SKELETON (object);
2370 g_assert (prop_id != 0 && prop_id - 1 < 11);
2371 g_mutex_lock (&skeleton->priv->lock);
2372 g_object_freeze_notify (object);
2373 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
2374 {
2375 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
2376 _fru_schedule_emit_changed (skeleton, _fru_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
2377 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
2378 g_object_notify_by_pspec (object, pspec);
2379 }
2380 g_mutex_unlock (&skeleton->priv->lock);
2381 g_object_thaw_notify (object);
2382}
2383
2384static void
2385fru_skeleton_init (FruSkeleton *skeleton)
2386{
2387#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2388 skeleton->priv = fru_skeleton_get_instance_private (skeleton);
2389#else
2390 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FRU_SKELETON, FruSkeletonPrivate);
2391#endif
2392
2393 g_mutex_init (&skeleton->priv->lock);
2394 skeleton->priv->context = g_main_context_ref_thread_default ();
2395 skeleton->priv->properties = g_new0 (GValue, 11);
2396 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
2397 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
2398 g_value_init (&skeleton->priv->properties[2], G_TYPE_UCHAR);
2399 g_value_init (&skeleton->priv->properties[3], G_TYPE_STRING);
2400 g_value_init (&skeleton->priv->properties[4], G_TYPE_STRING);
2401 g_value_init (&skeleton->priv->properties[5], G_TYPE_STRING);
2402 g_value_init (&skeleton->priv->properties[6], G_TYPE_UINT);
2403 g_value_init (&skeleton->priv->properties[7], G_TYPE_STRING);
2404 g_value_init (&skeleton->priv->properties[8], G_TYPE_UCHAR);
2405 g_value_init (&skeleton->priv->properties[9], G_TYPE_UCHAR);
2406 g_value_init (&skeleton->priv->properties[10], G_TYPE_UCHAR);
2407}
2408
2409static const gchar *
2410fru_skeleton_get_label (Fru *object)
2411{
2412 FruSkeleton *skeleton = FRU_SKELETON (object);
2413 const gchar *value;
2414 g_mutex_lock (&skeleton->priv->lock);
2415 value = g_value_get_string (&(skeleton->priv->properties[0]));
2416 g_mutex_unlock (&skeleton->priv->lock);
2417 return value;
2418}
2419
2420static const gchar *
2421fru_skeleton_get_location (Fru *object)
2422{
2423 FruSkeleton *skeleton = FRU_SKELETON (object);
2424 const gchar *value;
2425 g_mutex_lock (&skeleton->priv->lock);
2426 value = g_value_get_string (&(skeleton->priv->properties[1]));
2427 g_mutex_unlock (&skeleton->priv->lock);
2428 return value;
2429}
2430
2431static guchar
2432fru_skeleton_get_state (Fru *object)
2433{
2434 FruSkeleton *skeleton = FRU_SKELETON (object);
2435 guchar value;
2436 g_mutex_lock (&skeleton->priv->lock);
2437 value = g_value_get_uchar (&(skeleton->priv->properties[2]));
2438 g_mutex_unlock (&skeleton->priv->lock);
2439 return value;
2440}
2441
2442static const gchar *
2443fru_skeleton_get_manufacturer (Fru *object)
2444{
2445 FruSkeleton *skeleton = FRU_SKELETON (object);
2446 const gchar *value;
2447 g_mutex_lock (&skeleton->priv->lock);
2448 value = g_value_get_string (&(skeleton->priv->properties[3]));
2449 g_mutex_unlock (&skeleton->priv->lock);
2450 return value;
2451}
2452
2453static const gchar *
2454fru_skeleton_get_part_num (Fru *object)
2455{
2456 FruSkeleton *skeleton = FRU_SKELETON (object);
2457 const gchar *value;
2458 g_mutex_lock (&skeleton->priv->lock);
2459 value = g_value_get_string (&(skeleton->priv->properties[4]));
2460 g_mutex_unlock (&skeleton->priv->lock);
2461 return value;
2462}
2463
2464static const gchar *
2465fru_skeleton_get_serial_num (Fru *object)
2466{
2467 FruSkeleton *skeleton = FRU_SKELETON (object);
2468 const gchar *value;
2469 g_mutex_lock (&skeleton->priv->lock);
2470 value = g_value_get_string (&(skeleton->priv->properties[5]));
2471 g_mutex_unlock (&skeleton->priv->lock);
2472 return value;
2473}
2474
2475static guint
2476fru_skeleton_get_date_code (Fru *object)
2477{
2478 FruSkeleton *skeleton = FRU_SKELETON (object);
2479 guint value;
2480 g_mutex_lock (&skeleton->priv->lock);
2481 value = g_value_get_uint (&(skeleton->priv->properties[6]));
2482 g_mutex_unlock (&skeleton->priv->lock);
2483 return value;
2484}
2485
2486static const gchar *
2487fru_skeleton_get_version (Fru *object)
2488{
2489 FruSkeleton *skeleton = FRU_SKELETON (object);
2490 const gchar *value;
2491 g_mutex_lock (&skeleton->priv->lock);
2492 value = g_value_get_string (&(skeleton->priv->properties[7]));
2493 g_mutex_unlock (&skeleton->priv->lock);
2494 return value;
2495}
2496
2497static guchar
2498fru_skeleton_get_type_ (Fru *object)
2499{
2500 FruSkeleton *skeleton = FRU_SKELETON (object);
2501 guchar value;
2502 g_mutex_lock (&skeleton->priv->lock);
2503 value = g_value_get_uchar (&(skeleton->priv->properties[8]));
2504 g_mutex_unlock (&skeleton->priv->lock);
2505 return value;
2506}
2507
2508static guchar
2509fru_skeleton_get_subtype (Fru *object)
2510{
2511 FruSkeleton *skeleton = FRU_SKELETON (object);
2512 guchar value;
2513 g_mutex_lock (&skeleton->priv->lock);
2514 value = g_value_get_uchar (&(skeleton->priv->properties[9]));
2515 g_mutex_unlock (&skeleton->priv->lock);
2516 return value;
2517}
2518
2519static guchar
2520fru_skeleton_get_instance_num (Fru *object)
2521{
2522 FruSkeleton *skeleton = FRU_SKELETON (object);
2523 guchar value;
2524 g_mutex_lock (&skeleton->priv->lock);
2525 value = g_value_get_uchar (&(skeleton->priv->properties[10]));
2526 g_mutex_unlock (&skeleton->priv->lock);
2527 return value;
2528}
2529
2530static void
2531fru_skeleton_class_init (FruSkeletonClass *klass)
2532{
2533 GObjectClass *gobject_class;
2534 GDBusInterfaceSkeletonClass *skeleton_class;
2535
2536 gobject_class = G_OBJECT_CLASS (klass);
2537 gobject_class->finalize = fru_skeleton_finalize;
2538 gobject_class->get_property = fru_skeleton_get_property;
2539 gobject_class->set_property = fru_skeleton_set_property;
2540 gobject_class->notify = fru_skeleton_notify;
2541
2542
2543 fru_override_properties (gobject_class, 1);
2544
2545 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
2546 skeleton_class->get_info = fru_skeleton_dbus_interface_get_info;
2547 skeleton_class->get_properties = fru_skeleton_dbus_interface_get_properties;
2548 skeleton_class->flush = fru_skeleton_dbus_interface_flush;
2549 skeleton_class->get_vtable = fru_skeleton_dbus_interface_get_vtable;
2550
2551#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
2552 g_type_class_add_private (klass, sizeof (FruSkeletonPrivate));
2553#endif
2554}
2555
2556static void
2557fru_skeleton_iface_init (FruIface *iface)
2558{
2559 iface->state_changed = _fru_on_signal_state_changed;
2560 iface->unrecoverable_error = _fru_on_signal_unrecoverable_error;
2561 iface->recoverable_error = _fru_on_signal_recoverable_error;
Norman James90baede2015-09-02 20:32:49 -05002562 iface->cache_me = _fru_on_signal_cache_me;
Norman Jamesce46e3e2015-08-30 22:25:55 -05002563 iface->get_label = fru_skeleton_get_label;
2564 iface->get_location = fru_skeleton_get_location;
2565 iface->get_state = fru_skeleton_get_state;
2566 iface->get_manufacturer = fru_skeleton_get_manufacturer;
2567 iface->get_part_num = fru_skeleton_get_part_num;
2568 iface->get_serial_num = fru_skeleton_get_serial_num;
2569 iface->get_date_code = fru_skeleton_get_date_code;
2570 iface->get_version = fru_skeleton_get_version;
2571 iface->get_type_ = fru_skeleton_get_type_;
2572 iface->get_subtype = fru_skeleton_get_subtype;
2573 iface->get_instance_num = fru_skeleton_get_instance_num;
2574}
2575
2576/**
2577 * fru_skeleton_new:
2578 *
2579 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fru.top_of_page">org.openbmc.Fru</link>.
2580 *
2581 * Returns: (transfer full) (type FruSkeleton): The skeleton object.
2582 */
2583Fru *
2584fru_skeleton_new (void)
2585{
2586 return FRU (g_object_new (TYPE_FRU_SKELETON, NULL));
2587}
2588
2589/* ------------------------------------------------------------------------
2590 * Code for interface org.openbmc.Fru.Fan
2591 * ------------------------------------------------------------------------
2592 */
2593
2594/**
2595 * SECTION:FruFan
2596 * @title: FruFan
2597 * @short_description: Generated C code for the org.openbmc.Fru.Fan D-Bus interface
2598 *
2599 * 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.
2600 */
2601
2602/* ---- Introspection data for org.openbmc.Fru.Fan ---- */
2603
2604static const _ExtendedGDBusArgInfo _fru_fan_method_info_set_cooling_zone_IN_ARG_cooling_zone =
2605{
2606 {
2607 -1,
2608 (gchar *) "cooling_zone",
2609 (gchar *) "i",
2610 NULL
2611 },
2612 FALSE
2613};
2614
2615static const _ExtendedGDBusArgInfo * const _fru_fan_method_info_set_cooling_zone_IN_ARG_pointers[] =
2616{
2617 &_fru_fan_method_info_set_cooling_zone_IN_ARG_cooling_zone,
2618 NULL
2619};
2620
2621static const _ExtendedGDBusMethodInfo _fru_fan_method_info_set_cooling_zone =
2622{
2623 {
2624 -1,
2625 (gchar *) "setCoolingZone",
2626 (GDBusArgInfo **) &_fru_fan_method_info_set_cooling_zone_IN_ARG_pointers,
2627 NULL,
2628 NULL
2629 },
2630 "handle-set-cooling-zone",
2631 FALSE
2632};
2633
2634static const _ExtendedGDBusArgInfo _fru_fan_method_info_get_speed_OUT_ARG_speed =
2635{
2636 {
2637 -1,
2638 (gchar *) "speed",
2639 (gchar *) "i",
2640 NULL
2641 },
2642 FALSE
2643};
2644
2645static const _ExtendedGDBusArgInfo * const _fru_fan_method_info_get_speed_OUT_ARG_pointers[] =
2646{
2647 &_fru_fan_method_info_get_speed_OUT_ARG_speed,
2648 NULL
2649};
2650
2651static const _ExtendedGDBusMethodInfo _fru_fan_method_info_get_speed =
2652{
2653 {
2654 -1,
2655 (gchar *) "getSpeed",
2656 NULL,
2657 (GDBusArgInfo **) &_fru_fan_method_info_get_speed_OUT_ARG_pointers,
2658 NULL
2659 },
2660 "handle-get-speed",
2661 FALSE
2662};
2663
2664static const _ExtendedGDBusArgInfo _fru_fan_method_info_set_speed_IN_ARG_speed =
2665{
2666 {
2667 -1,
2668 (gchar *) "speed",
2669 (gchar *) "i",
2670 NULL
2671 },
2672 FALSE
2673};
2674
2675static const _ExtendedGDBusArgInfo * const _fru_fan_method_info_set_speed_IN_ARG_pointers[] =
2676{
2677 &_fru_fan_method_info_set_speed_IN_ARG_speed,
2678 NULL
2679};
2680
2681static const _ExtendedGDBusMethodInfo _fru_fan_method_info_set_speed =
2682{
2683 {
2684 -1,
2685 (gchar *) "setSpeed",
2686 (GDBusArgInfo **) &_fru_fan_method_info_set_speed_IN_ARG_pointers,
2687 NULL,
2688 NULL
2689 },
2690 "handle-set-speed",
2691 FALSE
2692};
2693
Norman Jamesce46e3e2015-08-30 22:25:55 -05002694static const _ExtendedGDBusMethodInfo * const _fru_fan_method_info_pointers[] =
2695{
2696 &_fru_fan_method_info_set_cooling_zone,
2697 &_fru_fan_method_info_get_speed,
2698 &_fru_fan_method_info_set_speed,
Norman Jamesce46e3e2015-08-30 22:25:55 -05002699 NULL
2700};
2701
2702static const _ExtendedGDBusArgInfo _fru_fan_signal_info_speed_changed_ARG_speed =
2703{
2704 {
2705 -1,
2706 (gchar *) "speed",
2707 (gchar *) "i",
2708 NULL
2709 },
2710 FALSE
2711};
2712
2713static const _ExtendedGDBusArgInfo * const _fru_fan_signal_info_speed_changed_ARG_pointers[] =
2714{
2715 &_fru_fan_signal_info_speed_changed_ARG_speed,
2716 NULL
2717};
2718
2719static const _ExtendedGDBusSignalInfo _fru_fan_signal_info_speed_changed =
2720{
2721 {
2722 -1,
2723 (gchar *) "SpeedChanged",
2724 (GDBusArgInfo **) &_fru_fan_signal_info_speed_changed_ARG_pointers,
2725 NULL
2726 },
2727 "speed-changed"
2728};
2729
2730static const _ExtendedGDBusSignalInfo _fru_fan_signal_info_tach_error =
2731{
2732 {
2733 -1,
2734 (gchar *) "TachError",
2735 NULL,
2736 NULL
2737 },
2738 "tach-error"
2739};
2740
2741static const _ExtendedGDBusSignalInfo * const _fru_fan_signal_info_pointers[] =
2742{
2743 &_fru_fan_signal_info_speed_changed,
2744 &_fru_fan_signal_info_tach_error,
2745 NULL
2746};
2747
2748static const _ExtendedGDBusPropertyInfo _fru_fan_property_info_speed =
2749{
2750 {
2751 -1,
2752 (gchar *) "speed",
2753 (gchar *) "i",
Norman James90baede2015-09-02 20:32:49 -05002754 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
Norman Jamesce46e3e2015-08-30 22:25:55 -05002755 NULL
2756 },
2757 "speed",
2758 FALSE
2759};
2760
2761static const _ExtendedGDBusPropertyInfo _fru_fan_property_info_cooling_zone =
2762{
2763 {
2764 -1,
2765 (gchar *) "cooling_zone",
2766 (gchar *) "i",
Norman James90baede2015-09-02 20:32:49 -05002767 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
Norman Jamesce46e3e2015-08-30 22:25:55 -05002768 NULL
2769 },
2770 "cooling-zone",
2771 FALSE
2772};
2773
Norman James90baede2015-09-02 20:32:49 -05002774static const _ExtendedGDBusPropertyInfo _fru_fan_property_info_pwm_num =
2775{
2776 {
2777 -1,
2778 (gchar *) "pwm_num",
2779 (gchar *) "i",
2780 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
2781 NULL
2782 },
2783 "pwm-num",
2784 FALSE
2785};
2786
Norman Jamesce46e3e2015-08-30 22:25:55 -05002787static const _ExtendedGDBusPropertyInfo * const _fru_fan_property_info_pointers[] =
2788{
2789 &_fru_fan_property_info_speed,
2790 &_fru_fan_property_info_cooling_zone,
Norman James90baede2015-09-02 20:32:49 -05002791 &_fru_fan_property_info_pwm_num,
Norman Jamesce46e3e2015-08-30 22:25:55 -05002792 NULL
2793};
2794
2795static const _ExtendedGDBusInterfaceInfo _fru_fan_interface_info =
2796{
2797 {
2798 -1,
2799 (gchar *) "org.openbmc.Fru.Fan",
2800 (GDBusMethodInfo **) &_fru_fan_method_info_pointers,
2801 (GDBusSignalInfo **) &_fru_fan_signal_info_pointers,
2802 (GDBusPropertyInfo **) &_fru_fan_property_info_pointers,
2803 NULL
2804 },
2805 "fru-fan",
2806};
2807
2808
2809/**
2810 * fru_fan_interface_info:
2811 *
2812 * 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.
2813 *
2814 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
2815 */
2816GDBusInterfaceInfo *
2817fru_fan_interface_info (void)
2818{
2819 return (GDBusInterfaceInfo *) &_fru_fan_interface_info.parent_struct;
2820}
2821
2822/**
2823 * fru_fan_override_properties:
2824 * @klass: The class structure for a #GObject<!-- -->-derived class.
2825 * @property_id_begin: The property id to assign to the first overridden property.
2826 *
2827 * Overrides all #GObject properties in the #FruFan interface for a concrete class.
2828 * The properties are overridden in the order they are defined.
2829 *
2830 * Returns: The last property id.
2831 */
2832guint
2833fru_fan_override_properties (GObjectClass *klass, guint property_id_begin)
2834{
2835 g_object_class_override_property (klass, property_id_begin++, "speed");
2836 g_object_class_override_property (klass, property_id_begin++, "cooling-zone");
Norman James90baede2015-09-02 20:32:49 -05002837 g_object_class_override_property (klass, property_id_begin++, "pwm-num");
Norman Jamesce46e3e2015-08-30 22:25:55 -05002838 return property_id_begin - 1;
2839}
2840
2841
2842
2843/**
2844 * FruFan:
2845 *
2846 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fru-Fan.top_of_page">org.openbmc.Fru.Fan</link>.
2847 */
2848
2849/**
2850 * FruFanIface:
2851 * @parent_iface: The parent interface.
2852 * @handle_get_speed: Handler for the #FruFan::handle-get-speed signal.
Norman Jamesce46e3e2015-08-30 22:25:55 -05002853 * @handle_set_cooling_zone: Handler for the #FruFan::handle-set-cooling-zone signal.
2854 * @handle_set_speed: Handler for the #FruFan::handle-set-speed signal.
2855 * @get_cooling_zone: Getter for the #FruFan:cooling-zone property.
Norman James90baede2015-09-02 20:32:49 -05002856 * @get_pwm_num: Getter for the #FruFan:pwm-num property.
Norman Jamesce46e3e2015-08-30 22:25:55 -05002857 * @get_speed: Getter for the #FruFan:speed property.
2858 * @speed_changed: Handler for the #FruFan::speed-changed signal.
2859 * @tach_error: Handler for the #FruFan::tach-error signal.
2860 *
2861 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fru-Fan.top_of_page">org.openbmc.Fru.Fan</link>.
2862 */
2863
2864typedef FruFanIface FruFanInterface;
2865G_DEFINE_INTERFACE (FruFan, fru_fan, G_TYPE_OBJECT);
2866
2867static void
2868fru_fan_default_init (FruFanIface *iface)
2869{
2870 /* GObject signals for incoming D-Bus method calls: */
2871 /**
2872 * FruFan::handle-set-cooling-zone:
2873 * @object: A #FruFan.
2874 * @invocation: A #GDBusMethodInvocation.
2875 * @arg_cooling_zone: Argument passed by remote caller.
2876 *
2877 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fru-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method.
2878 *
2879 * 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.
2880 *
2881 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
2882 */
2883 g_signal_new ("handle-set-cooling-zone",
2884 G_TYPE_FROM_INTERFACE (iface),
2885 G_SIGNAL_RUN_LAST,
2886 G_STRUCT_OFFSET (FruFanIface, handle_set_cooling_zone),
2887 g_signal_accumulator_true_handled,
2888 NULL,
2889 g_cclosure_marshal_generic,
2890 G_TYPE_BOOLEAN,
2891 2,
2892 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
2893
2894 /**
2895 * FruFan::handle-get-speed:
2896 * @object: A #FruFan.
2897 * @invocation: A #GDBusMethodInvocation.
2898 *
2899 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fru-Fan.getSpeed">getSpeed()</link> D-Bus method.
2900 *
2901 * 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.
2902 *
2903 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
2904 */
2905 g_signal_new ("handle-get-speed",
2906 G_TYPE_FROM_INTERFACE (iface),
2907 G_SIGNAL_RUN_LAST,
2908 G_STRUCT_OFFSET (FruFanIface, handle_get_speed),
2909 g_signal_accumulator_true_handled,
2910 NULL,
2911 g_cclosure_marshal_generic,
2912 G_TYPE_BOOLEAN,
2913 1,
2914 G_TYPE_DBUS_METHOD_INVOCATION);
2915
2916 /**
2917 * FruFan::handle-set-speed:
2918 * @object: A #FruFan.
2919 * @invocation: A #GDBusMethodInvocation.
2920 * @arg_speed: Argument passed by remote caller.
2921 *
2922 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fru-Fan.setSpeed">setSpeed()</link> D-Bus method.
2923 *
2924 * 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.
2925 *
2926 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
2927 */
2928 g_signal_new ("handle-set-speed",
2929 G_TYPE_FROM_INTERFACE (iface),
2930 G_SIGNAL_RUN_LAST,
2931 G_STRUCT_OFFSET (FruFanIface, handle_set_speed),
2932 g_signal_accumulator_true_handled,
2933 NULL,
2934 g_cclosure_marshal_generic,
2935 G_TYPE_BOOLEAN,
2936 2,
2937 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
2938
Norman Jamesce46e3e2015-08-30 22:25:55 -05002939 /* GObject signals for received D-Bus signals: */
2940 /**
2941 * FruFan::speed-changed:
2942 * @object: A #FruFan.
2943 * @arg_speed: Argument.
2944 *
2945 * 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.
2946 *
2947 * 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.
2948 */
2949 g_signal_new ("speed-changed",
2950 G_TYPE_FROM_INTERFACE (iface),
2951 G_SIGNAL_RUN_LAST,
2952 G_STRUCT_OFFSET (FruFanIface, speed_changed),
2953 NULL,
2954 NULL,
2955 g_cclosure_marshal_generic,
2956 G_TYPE_NONE,
2957 1, G_TYPE_INT);
2958
2959 /**
2960 * FruFan::tach-error:
2961 * @object: A #FruFan.
2962 *
2963 * 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.
2964 *
2965 * 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.
2966 */
2967 g_signal_new ("tach-error",
2968 G_TYPE_FROM_INTERFACE (iface),
2969 G_SIGNAL_RUN_LAST,
2970 G_STRUCT_OFFSET (FruFanIface, tach_error),
2971 NULL,
2972 NULL,
2973 g_cclosure_marshal_generic,
2974 G_TYPE_NONE,
2975 0);
2976
2977 /* GObject properties for D-Bus properties: */
2978 /**
2979 * FruFan:speed:
2980 *
2981 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fru-Fan.speed">"speed"</link>.
2982 *
Norman James90baede2015-09-02 20:32:49 -05002983 * 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.
Norman Jamesce46e3e2015-08-30 22:25:55 -05002984 */
2985 g_object_interface_install_property (iface,
2986 g_param_spec_int ("speed", "speed", "speed", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2987 /**
2988 * FruFan:cooling-zone:
2989 *
2990 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fru-Fan.cooling_zone">"cooling_zone"</link>.
2991 *
Norman James90baede2015-09-02 20:32:49 -05002992 * 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.
Norman Jamesce46e3e2015-08-30 22:25:55 -05002993 */
2994 g_object_interface_install_property (iface,
2995 g_param_spec_int ("cooling-zone", "cooling_zone", "cooling_zone", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James90baede2015-09-02 20:32:49 -05002996 /**
2997 * FruFan:pwm-num:
2998 *
2999 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fru-Fan.pwm_num">"pwm_num"</link>.
3000 *
3001 * 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.
3002 */
3003 g_object_interface_install_property (iface,
3004 g_param_spec_int ("pwm-num", "pwm_num", "pwm_num", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman Jamesce46e3e2015-08-30 22:25:55 -05003005}
3006
3007/**
3008 * fru_fan_get_speed: (skip)
3009 * @object: A #FruFan.
3010 *
3011 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fru-Fan.speed">"speed"</link> D-Bus property.
3012 *
Norman James90baede2015-09-02 20:32:49 -05003013 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
Norman Jamesce46e3e2015-08-30 22:25:55 -05003014 *
3015 * Returns: The property value.
3016 */
3017gint
3018fru_fan_get_speed (FruFan *object)
3019{
3020 return FRU_FAN_GET_IFACE (object)->get_speed (object);
3021}
3022
3023/**
3024 * fru_fan_set_speed: (skip)
3025 * @object: A #FruFan.
3026 * @value: The value to set.
3027 *
3028 * Sets the <link linkend="gdbus-property-org-openbmc-Fru-Fan.speed">"speed"</link> D-Bus property to @value.
3029 *
Norman James90baede2015-09-02 20:32:49 -05003030 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
Norman Jamesce46e3e2015-08-30 22:25:55 -05003031 */
3032void
3033fru_fan_set_speed (FruFan *object, gint value)
3034{
3035 g_object_set (G_OBJECT (object), "speed", value, NULL);
3036}
3037
3038/**
3039 * fru_fan_get_cooling_zone: (skip)
3040 * @object: A #FruFan.
3041 *
3042 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fru-Fan.cooling_zone">"cooling_zone"</link> D-Bus property.
3043 *
Norman James90baede2015-09-02 20:32:49 -05003044 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
Norman Jamesce46e3e2015-08-30 22:25:55 -05003045 *
3046 * Returns: The property value.
3047 */
3048gint
3049fru_fan_get_cooling_zone (FruFan *object)
3050{
3051 return FRU_FAN_GET_IFACE (object)->get_cooling_zone (object);
3052}
3053
3054/**
3055 * fru_fan_set_cooling_zone: (skip)
3056 * @object: A #FruFan.
3057 * @value: The value to set.
3058 *
3059 * Sets the <link linkend="gdbus-property-org-openbmc-Fru-Fan.cooling_zone">"cooling_zone"</link> D-Bus property to @value.
3060 *
Norman James90baede2015-09-02 20:32:49 -05003061 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
Norman Jamesce46e3e2015-08-30 22:25:55 -05003062 */
3063void
3064fru_fan_set_cooling_zone (FruFan *object, gint value)
3065{
3066 g_object_set (G_OBJECT (object), "cooling-zone", value, NULL);
3067}
3068
3069/**
Norman James90baede2015-09-02 20:32:49 -05003070 * fru_fan_get_pwm_num: (skip)
3071 * @object: A #FruFan.
3072 *
3073 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fru-Fan.pwm_num">"pwm_num"</link> D-Bus property.
3074 *
3075 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
3076 *
3077 * Returns: The property value.
3078 */
3079gint
3080fru_fan_get_pwm_num (FruFan *object)
3081{
3082 return FRU_FAN_GET_IFACE (object)->get_pwm_num (object);
3083}
3084
3085/**
3086 * fru_fan_set_pwm_num: (skip)
3087 * @object: A #FruFan.
3088 * @value: The value to set.
3089 *
3090 * Sets the <link linkend="gdbus-property-org-openbmc-Fru-Fan.pwm_num">"pwm_num"</link> D-Bus property to @value.
3091 *
3092 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
3093 */
3094void
3095fru_fan_set_pwm_num (FruFan *object, gint value)
3096{
3097 g_object_set (G_OBJECT (object), "pwm-num", value, NULL);
3098}
3099
3100/**
Norman Jamesce46e3e2015-08-30 22:25:55 -05003101 * fru_fan_emit_speed_changed:
3102 * @object: A #FruFan.
3103 * @arg_speed: Argument to pass with the signal.
3104 *
3105 * Emits the <link linkend="gdbus-signal-org-openbmc-Fru-Fan.SpeedChanged">"SpeedChanged"</link> D-Bus signal.
3106 */
3107void
3108fru_fan_emit_speed_changed (
3109 FruFan *object,
3110 gint arg_speed)
3111{
3112 g_signal_emit_by_name (object, "speed-changed", arg_speed);
3113}
3114
3115/**
3116 * fru_fan_emit_tach_error:
3117 * @object: A #FruFan.
3118 *
3119 * Emits the <link linkend="gdbus-signal-org-openbmc-Fru-Fan.TachError">"TachError"</link> D-Bus signal.
3120 */
3121void
3122fru_fan_emit_tach_error (
3123 FruFan *object)
3124{
3125 g_signal_emit_by_name (object, "tach-error");
3126}
3127
3128/**
3129 * fru_fan_call_set_cooling_zone:
3130 * @proxy: A #FruFanProxy.
3131 * @arg_cooling_zone: Argument to pass with the method invocation.
3132 * @cancellable: (allow-none): A #GCancellable or %NULL.
3133 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
3134 * @user_data: User data to pass to @callback.
3135 *
3136 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fru-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method on @proxy.
3137 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
3138 * You can then call fru_fan_call_set_cooling_zone_finish() to get the result of the operation.
3139 *
3140 * See fru_fan_call_set_cooling_zone_sync() for the synchronous, blocking version of this method.
3141 */
3142void
3143fru_fan_call_set_cooling_zone (
3144 FruFan *proxy,
3145 gint arg_cooling_zone,
3146 GCancellable *cancellable,
3147 GAsyncReadyCallback callback,
3148 gpointer user_data)
3149{
3150 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
3151 "setCoolingZone",
3152 g_variant_new ("(i)",
3153 arg_cooling_zone),
3154 G_DBUS_CALL_FLAGS_NONE,
3155 -1,
3156 cancellable,
3157 callback,
3158 user_data);
3159}
3160
3161/**
3162 * fru_fan_call_set_cooling_zone_finish:
3163 * @proxy: A #FruFanProxy.
3164 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fru_fan_call_set_cooling_zone().
3165 * @error: Return location for error or %NULL.
3166 *
3167 * Finishes an operation started with fru_fan_call_set_cooling_zone().
3168 *
3169 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
3170 */
3171gboolean
3172fru_fan_call_set_cooling_zone_finish (
3173 FruFan *proxy,
3174 GAsyncResult *res,
3175 GError **error)
3176{
3177 GVariant *_ret;
3178 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
3179 if (_ret == NULL)
3180 goto _out;
3181 g_variant_get (_ret,
3182 "()");
3183 g_variant_unref (_ret);
3184_out:
3185 return _ret != NULL;
3186}
3187
3188/**
3189 * fru_fan_call_set_cooling_zone_sync:
3190 * @proxy: A #FruFanProxy.
3191 * @arg_cooling_zone: Argument to pass with the method invocation.
3192 * @cancellable: (allow-none): A #GCancellable or %NULL.
3193 * @error: Return location for error or %NULL.
3194 *
3195 * 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.
3196 *
3197 * See fru_fan_call_set_cooling_zone() for the asynchronous version of this method.
3198 *
3199 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
3200 */
3201gboolean
3202fru_fan_call_set_cooling_zone_sync (
3203 FruFan *proxy,
3204 gint arg_cooling_zone,
3205 GCancellable *cancellable,
3206 GError **error)
3207{
3208 GVariant *_ret;
3209 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
3210 "setCoolingZone",
3211 g_variant_new ("(i)",
3212 arg_cooling_zone),
3213 G_DBUS_CALL_FLAGS_NONE,
3214 -1,
3215 cancellable,
3216 error);
3217 if (_ret == NULL)
3218 goto _out;
3219 g_variant_get (_ret,
3220 "()");
3221 g_variant_unref (_ret);
3222_out:
3223 return _ret != NULL;
3224}
3225
3226/**
3227 * fru_fan_call_get_speed:
3228 * @proxy: A #FruFanProxy.
3229 * @cancellable: (allow-none): A #GCancellable or %NULL.
3230 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
3231 * @user_data: User data to pass to @callback.
3232 *
3233 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fru-Fan.getSpeed">getSpeed()</link> D-Bus method on @proxy.
3234 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
3235 * You can then call fru_fan_call_get_speed_finish() to get the result of the operation.
3236 *
3237 * See fru_fan_call_get_speed_sync() for the synchronous, blocking version of this method.
3238 */
3239void
3240fru_fan_call_get_speed (
3241 FruFan *proxy,
3242 GCancellable *cancellable,
3243 GAsyncReadyCallback callback,
3244 gpointer user_data)
3245{
3246 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
3247 "getSpeed",
3248 g_variant_new ("()"),
3249 G_DBUS_CALL_FLAGS_NONE,
3250 -1,
3251 cancellable,
3252 callback,
3253 user_data);
3254}
3255
3256/**
3257 * fru_fan_call_get_speed_finish:
3258 * @proxy: A #FruFanProxy.
3259 * @out_speed: (out): Return location for return parameter or %NULL to ignore.
3260 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fru_fan_call_get_speed().
3261 * @error: Return location for error or %NULL.
3262 *
3263 * Finishes an operation started with fru_fan_call_get_speed().
3264 *
3265 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
3266 */
3267gboolean
3268fru_fan_call_get_speed_finish (
3269 FruFan *proxy,
3270 gint *out_speed,
3271 GAsyncResult *res,
3272 GError **error)
3273{
3274 GVariant *_ret;
3275 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
3276 if (_ret == NULL)
3277 goto _out;
3278 g_variant_get (_ret,
3279 "(i)",
3280 out_speed);
3281 g_variant_unref (_ret);
3282_out:
3283 return _ret != NULL;
3284}
3285
3286/**
3287 * fru_fan_call_get_speed_sync:
3288 * @proxy: A #FruFanProxy.
3289 * @out_speed: (out): Return location for return parameter or %NULL to ignore.
3290 * @cancellable: (allow-none): A #GCancellable or %NULL.
3291 * @error: Return location for error or %NULL.
3292 *
3293 * 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.
3294 *
3295 * See fru_fan_call_get_speed() for the asynchronous version of this method.
3296 *
3297 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
3298 */
3299gboolean
3300fru_fan_call_get_speed_sync (
3301 FruFan *proxy,
3302 gint *out_speed,
3303 GCancellable *cancellable,
3304 GError **error)
3305{
3306 GVariant *_ret;
3307 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
3308 "getSpeed",
3309 g_variant_new ("()"),
3310 G_DBUS_CALL_FLAGS_NONE,
3311 -1,
3312 cancellable,
3313 error);
3314 if (_ret == NULL)
3315 goto _out;
3316 g_variant_get (_ret,
3317 "(i)",
3318 out_speed);
3319 g_variant_unref (_ret);
3320_out:
3321 return _ret != NULL;
3322}
3323
3324/**
3325 * fru_fan_call_set_speed:
3326 * @proxy: A #FruFanProxy.
3327 * @arg_speed: Argument to pass with the method invocation.
3328 * @cancellable: (allow-none): A #GCancellable or %NULL.
3329 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
3330 * @user_data: User data to pass to @callback.
3331 *
3332 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fru-Fan.setSpeed">setSpeed()</link> D-Bus method on @proxy.
3333 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
3334 * You can then call fru_fan_call_set_speed_finish() to get the result of the operation.
3335 *
3336 * See fru_fan_call_set_speed_sync() for the synchronous, blocking version of this method.
3337 */
3338void
3339fru_fan_call_set_speed (
3340 FruFan *proxy,
3341 gint arg_speed,
3342 GCancellable *cancellable,
3343 GAsyncReadyCallback callback,
3344 gpointer user_data)
3345{
3346 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
3347 "setSpeed",
3348 g_variant_new ("(i)",
3349 arg_speed),
3350 G_DBUS_CALL_FLAGS_NONE,
3351 -1,
3352 cancellable,
3353 callback,
3354 user_data);
3355}
3356
3357/**
3358 * fru_fan_call_set_speed_finish:
3359 * @proxy: A #FruFanProxy.
3360 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fru_fan_call_set_speed().
3361 * @error: Return location for error or %NULL.
3362 *
3363 * Finishes an operation started with fru_fan_call_set_speed().
3364 *
3365 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
3366 */
3367gboolean
3368fru_fan_call_set_speed_finish (
3369 FruFan *proxy,
3370 GAsyncResult *res,
3371 GError **error)
3372{
3373 GVariant *_ret;
3374 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
3375 if (_ret == NULL)
3376 goto _out;
3377 g_variant_get (_ret,
3378 "()");
3379 g_variant_unref (_ret);
3380_out:
3381 return _ret != NULL;
3382}
3383
3384/**
3385 * fru_fan_call_set_speed_sync:
3386 * @proxy: A #FruFanProxy.
3387 * @arg_speed: Argument to pass with the method invocation.
3388 * @cancellable: (allow-none): A #GCancellable or %NULL.
3389 * @error: Return location for error or %NULL.
3390 *
3391 * 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.
3392 *
3393 * See fru_fan_call_set_speed() for the asynchronous version of this method.
3394 *
3395 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
3396 */
3397gboolean
3398fru_fan_call_set_speed_sync (
3399 FruFan *proxy,
3400 gint arg_speed,
3401 GCancellable *cancellable,
3402 GError **error)
3403{
3404 GVariant *_ret;
3405 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
3406 "setSpeed",
3407 g_variant_new ("(i)",
3408 arg_speed),
3409 G_DBUS_CALL_FLAGS_NONE,
3410 -1,
3411 cancellable,
3412 error);
3413 if (_ret == NULL)
3414 goto _out;
3415 g_variant_get (_ret,
3416 "()");
3417 g_variant_unref (_ret);
3418_out:
3419 return _ret != NULL;
3420}
3421
3422/**
Norman Jamesce46e3e2015-08-30 22:25:55 -05003423 * fru_fan_complete_set_cooling_zone:
3424 * @object: A #FruFan.
3425 * @invocation: (transfer full): A #GDBusMethodInvocation.
3426 *
3427 * 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.
3428 *
3429 * This method will free @invocation, you cannot use it afterwards.
3430 */
3431void
3432fru_fan_complete_set_cooling_zone (
3433 FruFan *object,
3434 GDBusMethodInvocation *invocation)
3435{
3436 g_dbus_method_invocation_return_value (invocation,
3437 g_variant_new ("()"));
3438}
3439
3440/**
3441 * fru_fan_complete_get_speed:
3442 * @object: A #FruFan.
3443 * @invocation: (transfer full): A #GDBusMethodInvocation.
3444 * @speed: Parameter to return.
3445 *
3446 * 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.
3447 *
3448 * This method will free @invocation, you cannot use it afterwards.
3449 */
3450void
3451fru_fan_complete_get_speed (
3452 FruFan *object,
3453 GDBusMethodInvocation *invocation,
3454 gint speed)
3455{
3456 g_dbus_method_invocation_return_value (invocation,
3457 g_variant_new ("(i)",
3458 speed));
3459}
3460
3461/**
3462 * fru_fan_complete_set_speed:
3463 * @object: A #FruFan.
3464 * @invocation: (transfer full): A #GDBusMethodInvocation.
3465 *
3466 * 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.
3467 *
3468 * This method will free @invocation, you cannot use it afterwards.
3469 */
3470void
3471fru_fan_complete_set_speed (
3472 FruFan *object,
3473 GDBusMethodInvocation *invocation)
3474{
3475 g_dbus_method_invocation_return_value (invocation,
3476 g_variant_new ("()"));
3477}
3478
Norman Jamesce46e3e2015-08-30 22:25:55 -05003479/* ------------------------------------------------------------------------ */
3480
3481/**
3482 * FruFanProxy:
3483 *
3484 * The #FruFanProxy structure contains only private data and should only be accessed using the provided API.
3485 */
3486
3487/**
3488 * FruFanProxyClass:
3489 * @parent_class: The parent class.
3490 *
3491 * Class structure for #FruFanProxy.
3492 */
3493
3494struct _FruFanProxyPrivate
3495{
3496 GData *qdata;
3497};
3498
3499static void fru_fan_proxy_iface_init (FruFanIface *iface);
3500
3501#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3502G_DEFINE_TYPE_WITH_CODE (FruFanProxy, fru_fan_proxy, G_TYPE_DBUS_PROXY,
3503 G_ADD_PRIVATE (FruFanProxy)
3504 G_IMPLEMENT_INTERFACE (TYPE_FRU_FAN, fru_fan_proxy_iface_init));
3505
3506#else
3507G_DEFINE_TYPE_WITH_CODE (FruFanProxy, fru_fan_proxy, G_TYPE_DBUS_PROXY,
3508 G_IMPLEMENT_INTERFACE (TYPE_FRU_FAN, fru_fan_proxy_iface_init));
3509
3510#endif
3511static void
3512fru_fan_proxy_finalize (GObject *object)
3513{
3514 FruFanProxy *proxy = FRU_FAN_PROXY (object);
3515 g_datalist_clear (&proxy->priv->qdata);
3516 G_OBJECT_CLASS (fru_fan_proxy_parent_class)->finalize (object);
3517}
3518
3519static void
3520fru_fan_proxy_get_property (GObject *object,
3521 guint prop_id,
3522 GValue *value,
3523 GParamSpec *pspec G_GNUC_UNUSED)
3524{
3525 const _ExtendedGDBusPropertyInfo *info;
3526 GVariant *variant;
Norman James90baede2015-09-02 20:32:49 -05003527 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman Jamesce46e3e2015-08-30 22:25:55 -05003528 info = _fru_fan_property_info_pointers[prop_id - 1];
3529 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
3530 if (info->use_gvariant)
3531 {
3532 g_value_set_variant (value, variant);
3533 }
3534 else
3535 {
3536 if (variant != NULL)
3537 g_dbus_gvariant_to_gvalue (variant, value);
3538 }
3539 if (variant != NULL)
3540 g_variant_unref (variant);
3541}
3542
3543static void
3544fru_fan_proxy_set_property_cb (GDBusProxy *proxy,
3545 GAsyncResult *res,
3546 gpointer user_data)
3547{
3548 const _ExtendedGDBusPropertyInfo *info = user_data;
3549 GError *error;
3550 GVariant *_ret;
3551 error = NULL;
3552 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
3553 if (!_ret)
3554 {
3555 g_warning ("Error setting property '%s' on interface org.openbmc.Fru.Fan: %s (%s, %d)",
3556 info->parent_struct.name,
3557 error->message, g_quark_to_string (error->domain), error->code);
3558 g_error_free (error);
3559 }
3560 else
3561 {
3562 g_variant_unref (_ret);
3563 }
3564}
3565
3566static void
3567fru_fan_proxy_set_property (GObject *object,
3568 guint prop_id,
3569 const GValue *value,
3570 GParamSpec *pspec G_GNUC_UNUSED)
3571{
3572 const _ExtendedGDBusPropertyInfo *info;
3573 GVariant *variant;
Norman James90baede2015-09-02 20:32:49 -05003574 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman Jamesce46e3e2015-08-30 22:25:55 -05003575 info = _fru_fan_property_info_pointers[prop_id - 1];
3576 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
3577 g_dbus_proxy_call (G_DBUS_PROXY (object),
3578 "org.freedesktop.DBus.Properties.Set",
3579 g_variant_new ("(ssv)", "org.openbmc.Fru.Fan", info->parent_struct.name, variant),
3580 G_DBUS_CALL_FLAGS_NONE,
3581 -1,
3582 NULL, (GAsyncReadyCallback) fru_fan_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
3583 g_variant_unref (variant);
3584}
3585
3586static void
3587fru_fan_proxy_g_signal (GDBusProxy *proxy,
3588 const gchar *sender_name G_GNUC_UNUSED,
3589 const gchar *signal_name,
3590 GVariant *parameters)
3591{
3592 _ExtendedGDBusSignalInfo *info;
3593 GVariantIter iter;
3594 GVariant *child;
3595 GValue *paramv;
3596 guint num_params;
3597 guint n;
3598 guint signal_id;
3599 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_fru_fan_interface_info.parent_struct, signal_name);
3600 if (info == NULL)
3601 return;
3602 num_params = g_variant_n_children (parameters);
3603 paramv = g_new0 (GValue, num_params + 1);
3604 g_value_init (&paramv[0], TYPE_FRU_FAN);
3605 g_value_set_object (&paramv[0], proxy);
3606 g_variant_iter_init (&iter, parameters);
3607 n = 1;
3608 while ((child = g_variant_iter_next_value (&iter)) != NULL)
3609 {
3610 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
3611 if (arg_info->use_gvariant)
3612 {
3613 g_value_init (&paramv[n], G_TYPE_VARIANT);
3614 g_value_set_variant (&paramv[n], child);
3615 n++;
3616 }
3617 else
3618 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
3619 g_variant_unref (child);
3620 }
3621 signal_id = g_signal_lookup (info->signal_name, TYPE_FRU_FAN);
3622 g_signal_emitv (paramv, signal_id, 0, NULL);
3623 for (n = 0; n < num_params + 1; n++)
3624 g_value_unset (&paramv[n]);
3625 g_free (paramv);
3626}
3627
3628static void
3629fru_fan_proxy_g_properties_changed (GDBusProxy *_proxy,
3630 GVariant *changed_properties,
3631 const gchar *const *invalidated_properties)
3632{
3633 FruFanProxy *proxy = FRU_FAN_PROXY (_proxy);
3634 guint n;
3635 const gchar *key;
3636 GVariantIter *iter;
3637 _ExtendedGDBusPropertyInfo *info;
3638 g_variant_get (changed_properties, "a{sv}", &iter);
3639 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
3640 {
3641 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fru_fan_interface_info.parent_struct, key);
3642 g_datalist_remove_data (&proxy->priv->qdata, key);
3643 if (info != NULL)
3644 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
3645 }
3646 g_variant_iter_free (iter);
3647 for (n = 0; invalidated_properties[n] != NULL; n++)
3648 {
3649 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fru_fan_interface_info.parent_struct, invalidated_properties[n]);
3650 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
3651 if (info != NULL)
3652 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
3653 }
3654}
3655
3656static gint
3657fru_fan_proxy_get_speed (FruFan *object)
3658{
3659 FruFanProxy *proxy = FRU_FAN_PROXY (object);
3660 GVariant *variant;
3661 gint value = 0;
3662 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "speed");
3663 if (variant != NULL)
3664 {
3665 value = g_variant_get_int32 (variant);
3666 g_variant_unref (variant);
3667 }
3668 return value;
3669}
3670
3671static gint
3672fru_fan_proxy_get_cooling_zone (FruFan *object)
3673{
3674 FruFanProxy *proxy = FRU_FAN_PROXY (object);
3675 GVariant *variant;
3676 gint value = 0;
3677 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "cooling_zone");
3678 if (variant != NULL)
3679 {
3680 value = g_variant_get_int32 (variant);
3681 g_variant_unref (variant);
3682 }
3683 return value;
3684}
3685
Norman James90baede2015-09-02 20:32:49 -05003686static gint
3687fru_fan_proxy_get_pwm_num (FruFan *object)
3688{
3689 FruFanProxy *proxy = FRU_FAN_PROXY (object);
3690 GVariant *variant;
3691 gint value = 0;
3692 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pwm_num");
3693 if (variant != NULL)
3694 {
3695 value = g_variant_get_int32 (variant);
3696 g_variant_unref (variant);
3697 }
3698 return value;
3699}
3700
Norman Jamesce46e3e2015-08-30 22:25:55 -05003701static void
3702fru_fan_proxy_init (FruFanProxy *proxy)
3703{
3704#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3705 proxy->priv = fru_fan_proxy_get_instance_private (proxy);
3706#else
3707 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FRU_FAN_PROXY, FruFanProxyPrivate);
3708#endif
3709
3710 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), fru_fan_interface_info ());
3711}
3712
3713static void
3714fru_fan_proxy_class_init (FruFanProxyClass *klass)
3715{
3716 GObjectClass *gobject_class;
3717 GDBusProxyClass *proxy_class;
3718
3719 gobject_class = G_OBJECT_CLASS (klass);
3720 gobject_class->finalize = fru_fan_proxy_finalize;
3721 gobject_class->get_property = fru_fan_proxy_get_property;
3722 gobject_class->set_property = fru_fan_proxy_set_property;
3723
3724 proxy_class = G_DBUS_PROXY_CLASS (klass);
3725 proxy_class->g_signal = fru_fan_proxy_g_signal;
3726 proxy_class->g_properties_changed = fru_fan_proxy_g_properties_changed;
3727
3728 fru_fan_override_properties (gobject_class, 1);
3729
3730#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
3731 g_type_class_add_private (klass, sizeof (FruFanProxyPrivate));
3732#endif
3733}
3734
3735static void
3736fru_fan_proxy_iface_init (FruFanIface *iface)
3737{
3738 iface->get_speed = fru_fan_proxy_get_speed;
3739 iface->get_cooling_zone = fru_fan_proxy_get_cooling_zone;
Norman James90baede2015-09-02 20:32:49 -05003740 iface->get_pwm_num = fru_fan_proxy_get_pwm_num;
Norman Jamesce46e3e2015-08-30 22:25:55 -05003741}
3742
3743/**
3744 * fru_fan_proxy_new:
3745 * @connection: A #GDBusConnection.
3746 * @flags: Flags from the #GDBusProxyFlags enumeration.
3747 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
3748 * @object_path: An object path.
3749 * @cancellable: (allow-none): A #GCancellable or %NULL.
3750 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
3751 * @user_data: User data to pass to @callback.
3752 *
3753 * 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.
3754 *
3755 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
3756 * You can then call fru_fan_proxy_new_finish() to get the result of the operation.
3757 *
3758 * See fru_fan_proxy_new_sync() for the synchronous, blocking version of this constructor.
3759 */
3760void
3761fru_fan_proxy_new (
3762 GDBusConnection *connection,
3763 GDBusProxyFlags flags,
3764 const gchar *name,
3765 const gchar *object_path,
3766 GCancellable *cancellable,
3767 GAsyncReadyCallback callback,
3768 gpointer user_data)
3769{
3770 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);
3771}
3772
3773/**
3774 * fru_fan_proxy_new_finish:
3775 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fru_fan_proxy_new().
3776 * @error: Return location for error or %NULL
3777 *
3778 * Finishes an operation started with fru_fan_proxy_new().
3779 *
3780 * Returns: (transfer full) (type FruFanProxy): The constructed proxy object or %NULL if @error is set.
3781 */
3782FruFan *
3783fru_fan_proxy_new_finish (
3784 GAsyncResult *res,
3785 GError **error)
3786{
3787 GObject *ret;
3788 GObject *source_object;
3789 source_object = g_async_result_get_source_object (res);
3790 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
3791 g_object_unref (source_object);
3792 if (ret != NULL)
3793 return FRU_FAN (ret);
3794 else
3795 return NULL;
3796}
3797
3798/**
3799 * fru_fan_proxy_new_sync:
3800 * @connection: A #GDBusConnection.
3801 * @flags: Flags from the #GDBusProxyFlags enumeration.
3802 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
3803 * @object_path: An object path.
3804 * @cancellable: (allow-none): A #GCancellable or %NULL.
3805 * @error: Return location for error or %NULL
3806 *
3807 * 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.
3808 *
3809 * The calling thread is blocked until a reply is received.
3810 *
3811 * See fru_fan_proxy_new() for the asynchronous version of this constructor.
3812 *
3813 * Returns: (transfer full) (type FruFanProxy): The constructed proxy object or %NULL if @error is set.
3814 */
3815FruFan *
3816fru_fan_proxy_new_sync (
3817 GDBusConnection *connection,
3818 GDBusProxyFlags flags,
3819 const gchar *name,
3820 const gchar *object_path,
3821 GCancellable *cancellable,
3822 GError **error)
3823{
3824 GInitable *ret;
3825 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);
3826 if (ret != NULL)
3827 return FRU_FAN (ret);
3828 else
3829 return NULL;
3830}
3831
3832
3833/**
3834 * fru_fan_proxy_new_for_bus:
3835 * @bus_type: A #GBusType.
3836 * @flags: Flags from the #GDBusProxyFlags enumeration.
3837 * @name: A bus name (well-known or unique).
3838 * @object_path: An object path.
3839 * @cancellable: (allow-none): A #GCancellable or %NULL.
3840 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
3841 * @user_data: User data to pass to @callback.
3842 *
3843 * Like fru_fan_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
3844 *
3845 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
3846 * You can then call fru_fan_proxy_new_for_bus_finish() to get the result of the operation.
3847 *
3848 * See fru_fan_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
3849 */
3850void
3851fru_fan_proxy_new_for_bus (
3852 GBusType bus_type,
3853 GDBusProxyFlags flags,
3854 const gchar *name,
3855 const gchar *object_path,
3856 GCancellable *cancellable,
3857 GAsyncReadyCallback callback,
3858 gpointer user_data)
3859{
3860 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);
3861}
3862
3863/**
3864 * fru_fan_proxy_new_for_bus_finish:
3865 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fru_fan_proxy_new_for_bus().
3866 * @error: Return location for error or %NULL
3867 *
3868 * Finishes an operation started with fru_fan_proxy_new_for_bus().
3869 *
3870 * Returns: (transfer full) (type FruFanProxy): The constructed proxy object or %NULL if @error is set.
3871 */
3872FruFan *
3873fru_fan_proxy_new_for_bus_finish (
3874 GAsyncResult *res,
3875 GError **error)
3876{
3877 GObject *ret;
3878 GObject *source_object;
3879 source_object = g_async_result_get_source_object (res);
3880 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
3881 g_object_unref (source_object);
3882 if (ret != NULL)
3883 return FRU_FAN (ret);
3884 else
3885 return NULL;
3886}
3887
3888/**
3889 * fru_fan_proxy_new_for_bus_sync:
3890 * @bus_type: A #GBusType.
3891 * @flags: Flags from the #GDBusProxyFlags enumeration.
3892 * @name: A bus name (well-known or unique).
3893 * @object_path: An object path.
3894 * @cancellable: (allow-none): A #GCancellable or %NULL.
3895 * @error: Return location for error or %NULL
3896 *
3897 * Like fru_fan_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
3898 *
3899 * The calling thread is blocked until a reply is received.
3900 *
3901 * See fru_fan_proxy_new_for_bus() for the asynchronous version of this constructor.
3902 *
3903 * Returns: (transfer full) (type FruFanProxy): The constructed proxy object or %NULL if @error is set.
3904 */
3905FruFan *
3906fru_fan_proxy_new_for_bus_sync (
3907 GBusType bus_type,
3908 GDBusProxyFlags flags,
3909 const gchar *name,
3910 const gchar *object_path,
3911 GCancellable *cancellable,
3912 GError **error)
3913{
3914 GInitable *ret;
3915 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);
3916 if (ret != NULL)
3917 return FRU_FAN (ret);
3918 else
3919 return NULL;
3920}
3921
3922
3923/* ------------------------------------------------------------------------ */
3924
3925/**
3926 * FruFanSkeleton:
3927 *
3928 * The #FruFanSkeleton structure contains only private data and should only be accessed using the provided API.
3929 */
3930
3931/**
3932 * FruFanSkeletonClass:
3933 * @parent_class: The parent class.
3934 *
3935 * Class structure for #FruFanSkeleton.
3936 */
3937
3938struct _FruFanSkeletonPrivate
3939{
3940 GValue *properties;
3941 GList *changed_properties;
3942 GSource *changed_properties_idle_source;
3943 GMainContext *context;
3944 GMutex lock;
3945};
3946
3947static void
3948_fru_fan_skeleton_handle_method_call (
3949 GDBusConnection *connection G_GNUC_UNUSED,
3950 const gchar *sender G_GNUC_UNUSED,
3951 const gchar *object_path G_GNUC_UNUSED,
3952 const gchar *interface_name,
3953 const gchar *method_name,
3954 GVariant *parameters,
3955 GDBusMethodInvocation *invocation,
3956 gpointer user_data)
3957{
3958 FruFanSkeleton *skeleton = FRU_FAN_SKELETON (user_data);
3959 _ExtendedGDBusMethodInfo *info;
3960 GVariantIter iter;
3961 GVariant *child;
3962 GValue *paramv;
3963 guint num_params;
3964 guint num_extra;
3965 guint n;
3966 guint signal_id;
3967 GValue return_value = G_VALUE_INIT;
3968 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
3969 g_assert (info != NULL);
3970 num_params = g_variant_n_children (parameters);
3971 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
3972 n = 0;
3973 g_value_init (&paramv[n], TYPE_FRU_FAN);
3974 g_value_set_object (&paramv[n++], skeleton);
3975 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
3976 g_value_set_object (&paramv[n++], invocation);
3977 if (info->pass_fdlist)
3978 {
3979#ifdef G_OS_UNIX
3980 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
3981 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
3982#else
3983 g_assert_not_reached ();
3984#endif
3985 }
3986 g_variant_iter_init (&iter, parameters);
3987 while ((child = g_variant_iter_next_value (&iter)) != NULL)
3988 {
3989 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
3990 if (arg_info->use_gvariant)
3991 {
3992 g_value_init (&paramv[n], G_TYPE_VARIANT);
3993 g_value_set_variant (&paramv[n], child);
3994 n++;
3995 }
3996 else
3997 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
3998 g_variant_unref (child);
3999 }
4000 signal_id = g_signal_lookup (info->signal_name, TYPE_FRU_FAN);
4001 g_value_init (&return_value, G_TYPE_BOOLEAN);
4002 g_signal_emitv (paramv, signal_id, 0, &return_value);
4003 if (!g_value_get_boolean (&return_value))
4004 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);
4005 g_value_unset (&return_value);
4006 for (n = 0; n < num_params + num_extra; n++)
4007 g_value_unset (&paramv[n]);
4008 g_free (paramv);
4009}
4010
4011static GVariant *
4012_fru_fan_skeleton_handle_get_property (
4013 GDBusConnection *connection G_GNUC_UNUSED,
4014 const gchar *sender G_GNUC_UNUSED,
4015 const gchar *object_path G_GNUC_UNUSED,
4016 const gchar *interface_name G_GNUC_UNUSED,
4017 const gchar *property_name,
4018 GError **error,
4019 gpointer user_data)
4020{
4021 FruFanSkeleton *skeleton = FRU_FAN_SKELETON (user_data);
4022 GValue value = G_VALUE_INIT;
4023 GParamSpec *pspec;
4024 _ExtendedGDBusPropertyInfo *info;
4025 GVariant *ret;
4026 ret = NULL;
4027 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fru_fan_interface_info.parent_struct, property_name);
4028 g_assert (info != NULL);
4029 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
4030 if (pspec == NULL)
4031 {
4032 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
4033 }
4034 else
4035 {
4036 g_value_init (&value, pspec->value_type);
4037 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
4038 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
4039 g_value_unset (&value);
4040 }
4041 return ret;
4042}
4043
4044static gboolean
4045_fru_fan_skeleton_handle_set_property (
4046 GDBusConnection *connection G_GNUC_UNUSED,
4047 const gchar *sender G_GNUC_UNUSED,
4048 const gchar *object_path G_GNUC_UNUSED,
4049 const gchar *interface_name G_GNUC_UNUSED,
4050 const gchar *property_name,
4051 GVariant *variant,
4052 GError **error,
4053 gpointer user_data)
4054{
4055 FruFanSkeleton *skeleton = FRU_FAN_SKELETON (user_data);
4056 GValue value = G_VALUE_INIT;
4057 GParamSpec *pspec;
4058 _ExtendedGDBusPropertyInfo *info;
4059 gboolean ret;
4060 ret = FALSE;
4061 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fru_fan_interface_info.parent_struct, property_name);
4062 g_assert (info != NULL);
4063 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
4064 if (pspec == NULL)
4065 {
4066 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
4067 }
4068 else
4069 {
4070 if (info->use_gvariant)
4071 g_value_set_variant (&value, variant);
4072 else
4073 g_dbus_gvariant_to_gvalue (variant, &value);
4074 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
4075 g_value_unset (&value);
4076 ret = TRUE;
4077 }
4078 return ret;
4079}
4080
4081static const GDBusInterfaceVTable _fru_fan_skeleton_vtable =
4082{
4083 _fru_fan_skeleton_handle_method_call,
4084 _fru_fan_skeleton_handle_get_property,
4085 _fru_fan_skeleton_handle_set_property,
4086 {NULL}
4087};
4088
4089static GDBusInterfaceInfo *
4090fru_fan_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
4091{
4092 return fru_fan_interface_info ();
4093}
4094
4095static GDBusInterfaceVTable *
4096fru_fan_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
4097{
4098 return (GDBusInterfaceVTable *) &_fru_fan_skeleton_vtable;
4099}
4100
4101static GVariant *
4102fru_fan_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
4103{
4104 FruFanSkeleton *skeleton = FRU_FAN_SKELETON (_skeleton);
4105
4106 GVariantBuilder builder;
4107 guint n;
4108 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
4109 if (_fru_fan_interface_info.parent_struct.properties == NULL)
4110 goto out;
4111 for (n = 0; _fru_fan_interface_info.parent_struct.properties[n] != NULL; n++)
4112 {
4113 GDBusPropertyInfo *info = _fru_fan_interface_info.parent_struct.properties[n];
4114 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
4115 {
4116 GVariant *value;
4117 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);
4118 if (value != NULL)
4119 {
4120 g_variant_take_ref (value);
4121 g_variant_builder_add (&builder, "{sv}", info->name, value);
4122 g_variant_unref (value);
4123 }
4124 }
4125 }
4126out:
4127 return g_variant_builder_end (&builder);
4128}
4129
4130static gboolean _fru_fan_emit_changed (gpointer user_data);
4131
4132static void
4133fru_fan_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
4134{
4135 FruFanSkeleton *skeleton = FRU_FAN_SKELETON (_skeleton);
4136 gboolean emit_changed = FALSE;
4137
4138 g_mutex_lock (&skeleton->priv->lock);
4139 if (skeleton->priv->changed_properties_idle_source != NULL)
4140 {
4141 g_source_destroy (skeleton->priv->changed_properties_idle_source);
4142 skeleton->priv->changed_properties_idle_source = NULL;
4143 emit_changed = TRUE;
4144 }
4145 g_mutex_unlock (&skeleton->priv->lock);
4146
4147 if (emit_changed)
4148 _fru_fan_emit_changed (skeleton);
4149}
4150
4151static void
4152_fru_fan_on_signal_speed_changed (
4153 FruFan *object,
4154 gint arg_speed)
4155{
4156 FruFanSkeleton *skeleton = FRU_FAN_SKELETON (object);
4157
4158 GList *connections, *l;
4159 GVariant *signal_variant;
4160 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
4161
4162 signal_variant = g_variant_ref_sink (g_variant_new ("(i)",
4163 arg_speed));
4164 for (l = connections; l != NULL; l = l->next)
4165 {
4166 GDBusConnection *connection = l->data;
4167 g_dbus_connection_emit_signal (connection,
4168 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fru.Fan", "SpeedChanged",
4169 signal_variant, NULL);
4170 }
4171 g_variant_unref (signal_variant);
4172 g_list_free_full (connections, g_object_unref);
4173}
4174
4175static void
4176_fru_fan_on_signal_tach_error (
4177 FruFan *object)
4178{
4179 FruFanSkeleton *skeleton = FRU_FAN_SKELETON (object);
4180
4181 GList *connections, *l;
4182 GVariant *signal_variant;
4183 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
4184
4185 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
4186 for (l = connections; l != NULL; l = l->next)
4187 {
4188 GDBusConnection *connection = l->data;
4189 g_dbus_connection_emit_signal (connection,
4190 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fru.Fan", "TachError",
4191 signal_variant, NULL);
4192 }
4193 g_variant_unref (signal_variant);
4194 g_list_free_full (connections, g_object_unref);
4195}
4196
4197static void fru_fan_skeleton_iface_init (FruFanIface *iface);
4198#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4199G_DEFINE_TYPE_WITH_CODE (FruFanSkeleton, fru_fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
4200 G_ADD_PRIVATE (FruFanSkeleton)
4201 G_IMPLEMENT_INTERFACE (TYPE_FRU_FAN, fru_fan_skeleton_iface_init));
4202
4203#else
4204G_DEFINE_TYPE_WITH_CODE (FruFanSkeleton, fru_fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
4205 G_IMPLEMENT_INTERFACE (TYPE_FRU_FAN, fru_fan_skeleton_iface_init));
4206
4207#endif
4208static void
4209fru_fan_skeleton_finalize (GObject *object)
4210{
4211 FruFanSkeleton *skeleton = FRU_FAN_SKELETON (object);
4212 guint n;
Norman James90baede2015-09-02 20:32:49 -05004213 for (n = 0; n < 3; n++)
Norman Jamesce46e3e2015-08-30 22:25:55 -05004214 g_value_unset (&skeleton->priv->properties[n]);
4215 g_free (skeleton->priv->properties);
4216 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
4217 if (skeleton->priv->changed_properties_idle_source != NULL)
4218 g_source_destroy (skeleton->priv->changed_properties_idle_source);
4219 g_main_context_unref (skeleton->priv->context);
4220 g_mutex_clear (&skeleton->priv->lock);
4221 G_OBJECT_CLASS (fru_fan_skeleton_parent_class)->finalize (object);
4222}
4223
4224static void
4225fru_fan_skeleton_get_property (GObject *object,
4226 guint prop_id,
4227 GValue *value,
4228 GParamSpec *pspec G_GNUC_UNUSED)
4229{
4230 FruFanSkeleton *skeleton = FRU_FAN_SKELETON (object);
Norman James90baede2015-09-02 20:32:49 -05004231 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman Jamesce46e3e2015-08-30 22:25:55 -05004232 g_mutex_lock (&skeleton->priv->lock);
4233 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
4234 g_mutex_unlock (&skeleton->priv->lock);
4235}
4236
4237static gboolean
4238_fru_fan_emit_changed (gpointer user_data)
4239{
4240 FruFanSkeleton *skeleton = FRU_FAN_SKELETON (user_data);
4241 GList *l;
4242 GVariantBuilder builder;
4243 GVariantBuilder invalidated_builder;
4244 guint num_changes;
4245
4246 g_mutex_lock (&skeleton->priv->lock);
4247 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
4248 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
4249 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
4250 {
4251 ChangedProperty *cp = l->data;
4252 GVariant *variant;
4253 const GValue *cur_value;
4254
4255 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
4256 if (!_g_value_equal (cur_value, &cp->orig_value))
4257 {
4258 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
4259 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
4260 g_variant_unref (variant);
4261 num_changes++;
4262 }
4263 }
4264 if (num_changes > 0)
4265 {
4266 GList *connections, *ll;
4267 GVariant *signal_variant;
4268 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Fru.Fan",
4269 &builder, &invalidated_builder));
4270 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
4271 for (ll = connections; ll != NULL; ll = ll->next)
4272 {
4273 GDBusConnection *connection = ll->data;
4274
4275 g_dbus_connection_emit_signal (connection,
4276 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
4277 "org.freedesktop.DBus.Properties",
4278 "PropertiesChanged",
4279 signal_variant,
4280 NULL);
4281 }
4282 g_variant_unref (signal_variant);
4283 g_list_free_full (connections, g_object_unref);
4284 }
4285 else
4286 {
4287 g_variant_builder_clear (&builder);
4288 g_variant_builder_clear (&invalidated_builder);
4289 }
4290 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
4291 skeleton->priv->changed_properties = NULL;
4292 skeleton->priv->changed_properties_idle_source = NULL;
4293 g_mutex_unlock (&skeleton->priv->lock);
4294 return FALSE;
4295}
4296
4297static void
4298_fru_fan_schedule_emit_changed (FruFanSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
4299{
4300 ChangedProperty *cp;
4301 GList *l;
4302 cp = NULL;
4303 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
4304 {
4305 ChangedProperty *i_cp = l->data;
4306 if (i_cp->info == info)
4307 {
4308 cp = i_cp;
4309 break;
4310 }
4311 }
4312 if (cp == NULL)
4313 {
4314 cp = g_new0 (ChangedProperty, 1);
4315 cp->prop_id = prop_id;
4316 cp->info = info;
4317 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
4318 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
4319 g_value_copy (orig_value, &cp->orig_value);
4320 }
4321}
4322
4323static void
4324fru_fan_skeleton_notify (GObject *object,
4325 GParamSpec *pspec G_GNUC_UNUSED)
4326{
4327 FruFanSkeleton *skeleton = FRU_FAN_SKELETON (object);
4328 g_mutex_lock (&skeleton->priv->lock);
4329 if (skeleton->priv->changed_properties != NULL &&
4330 skeleton->priv->changed_properties_idle_source == NULL)
4331 {
4332 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
4333 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
4334 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _fru_fan_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
4335 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
4336 g_source_unref (skeleton->priv->changed_properties_idle_source);
4337 }
4338 g_mutex_unlock (&skeleton->priv->lock);
4339}
4340
4341static void
4342fru_fan_skeleton_set_property (GObject *object,
4343 guint prop_id,
4344 const GValue *value,
4345 GParamSpec *pspec)
4346{
4347 FruFanSkeleton *skeleton = FRU_FAN_SKELETON (object);
Norman James90baede2015-09-02 20:32:49 -05004348 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman Jamesce46e3e2015-08-30 22:25:55 -05004349 g_mutex_lock (&skeleton->priv->lock);
4350 g_object_freeze_notify (object);
4351 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
4352 {
4353 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
4354 _fru_fan_schedule_emit_changed (skeleton, _fru_fan_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
4355 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
4356 g_object_notify_by_pspec (object, pspec);
4357 }
4358 g_mutex_unlock (&skeleton->priv->lock);
4359 g_object_thaw_notify (object);
4360}
4361
4362static void
4363fru_fan_skeleton_init (FruFanSkeleton *skeleton)
4364{
4365#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4366 skeleton->priv = fru_fan_skeleton_get_instance_private (skeleton);
4367#else
4368 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FRU_FAN_SKELETON, FruFanSkeletonPrivate);
4369#endif
4370
4371 g_mutex_init (&skeleton->priv->lock);
4372 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James90baede2015-09-02 20:32:49 -05004373 skeleton->priv->properties = g_new0 (GValue, 3);
Norman Jamesce46e3e2015-08-30 22:25:55 -05004374 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
4375 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
Norman James90baede2015-09-02 20:32:49 -05004376 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
Norman Jamesce46e3e2015-08-30 22:25:55 -05004377}
4378
4379static gint
4380fru_fan_skeleton_get_speed (FruFan *object)
4381{
4382 FruFanSkeleton *skeleton = FRU_FAN_SKELETON (object);
4383 gint value;
4384 g_mutex_lock (&skeleton->priv->lock);
4385 value = g_value_get_int (&(skeleton->priv->properties[0]));
4386 g_mutex_unlock (&skeleton->priv->lock);
4387 return value;
4388}
4389
4390static gint
4391fru_fan_skeleton_get_cooling_zone (FruFan *object)
4392{
4393 FruFanSkeleton *skeleton = FRU_FAN_SKELETON (object);
4394 gint value;
4395 g_mutex_lock (&skeleton->priv->lock);
4396 value = g_value_get_int (&(skeleton->priv->properties[1]));
4397 g_mutex_unlock (&skeleton->priv->lock);
4398 return value;
4399}
4400
Norman James90baede2015-09-02 20:32:49 -05004401static gint
4402fru_fan_skeleton_get_pwm_num (FruFan *object)
4403{
4404 FruFanSkeleton *skeleton = FRU_FAN_SKELETON (object);
4405 gint value;
4406 g_mutex_lock (&skeleton->priv->lock);
4407 value = g_value_get_int (&(skeleton->priv->properties[2]));
4408 g_mutex_unlock (&skeleton->priv->lock);
4409 return value;
4410}
4411
Norman Jamesce46e3e2015-08-30 22:25:55 -05004412static void
4413fru_fan_skeleton_class_init (FruFanSkeletonClass *klass)
4414{
4415 GObjectClass *gobject_class;
4416 GDBusInterfaceSkeletonClass *skeleton_class;
4417
4418 gobject_class = G_OBJECT_CLASS (klass);
4419 gobject_class->finalize = fru_fan_skeleton_finalize;
4420 gobject_class->get_property = fru_fan_skeleton_get_property;
4421 gobject_class->set_property = fru_fan_skeleton_set_property;
4422 gobject_class->notify = fru_fan_skeleton_notify;
4423
4424
4425 fru_fan_override_properties (gobject_class, 1);
4426
4427 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
4428 skeleton_class->get_info = fru_fan_skeleton_dbus_interface_get_info;
4429 skeleton_class->get_properties = fru_fan_skeleton_dbus_interface_get_properties;
4430 skeleton_class->flush = fru_fan_skeleton_dbus_interface_flush;
4431 skeleton_class->get_vtable = fru_fan_skeleton_dbus_interface_get_vtable;
4432
4433#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
4434 g_type_class_add_private (klass, sizeof (FruFanSkeletonPrivate));
4435#endif
4436}
4437
4438static void
4439fru_fan_skeleton_iface_init (FruFanIface *iface)
4440{
4441 iface->speed_changed = _fru_fan_on_signal_speed_changed;
4442 iface->tach_error = _fru_fan_on_signal_tach_error;
4443 iface->get_speed = fru_fan_skeleton_get_speed;
4444 iface->get_cooling_zone = fru_fan_skeleton_get_cooling_zone;
Norman James90baede2015-09-02 20:32:49 -05004445 iface->get_pwm_num = fru_fan_skeleton_get_pwm_num;
Norman Jamesce46e3e2015-08-30 22:25:55 -05004446}
4447
4448/**
4449 * fru_fan_skeleton_new:
4450 *
4451 * 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>.
4452 *
4453 * Returns: (transfer full) (type FruFanSkeleton): The skeleton object.
4454 */
4455FruFan *
4456fru_fan_skeleton_new (void)
4457{
4458 return FRU_FAN (g_object_new (TYPE_FRU_FAN_SKELETON, NULL));
4459}
4460
4461/* ------------------------------------------------------------------------
Norman James90baede2015-09-02 20:32:49 -05004462 * Code for interface org.openbmc.Fru.Eeprom
4463 * ------------------------------------------------------------------------
4464 */
4465
4466/**
4467 * SECTION:FruEeprom
4468 * @title: FruEeprom
4469 * @short_description: Generated C code for the org.openbmc.Fru.Eeprom D-Bus interface
4470 *
4471 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Fru-Eeprom.top_of_page">org.openbmc.Fru.Eeprom</link> D-Bus interface in C.
4472 */
4473
4474/* ---- Introspection data for org.openbmc.Fru.Eeprom ---- */
4475
4476static const _ExtendedGDBusSignalInfo _fru_eeprom_signal_info_read_done =
4477{
4478 {
4479 -1,
4480 (gchar *) "ReadDone",
4481 NULL,
4482 NULL
4483 },
4484 "read-done"
4485};
4486
4487static const _ExtendedGDBusSignalInfo * const _fru_eeprom_signal_info_pointers[] =
4488{
4489 &_fru_eeprom_signal_info_read_done,
4490 NULL
4491};
4492
4493static const _ExtendedGDBusPropertyInfo _fru_eeprom_property_info_i2c_dev_path =
4494{
4495 {
4496 -1,
4497 (gchar *) "i2c_dev_path",
4498 (gchar *) "s",
4499 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
4500 NULL
4501 },
4502 "i2c-dev-path",
4503 FALSE
4504};
4505
4506static const _ExtendedGDBusPropertyInfo _fru_eeprom_property_info_i2c_address =
4507{
4508 {
4509 -1,
4510 (gchar *) "i2c_address",
4511 (gchar *) "s",
4512 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
4513 NULL
4514 },
4515 "i2c-address",
4516 FALSE
4517};
4518
4519static const _ExtendedGDBusPropertyInfo * const _fru_eeprom_property_info_pointers[] =
4520{
4521 &_fru_eeprom_property_info_i2c_dev_path,
4522 &_fru_eeprom_property_info_i2c_address,
4523 NULL
4524};
4525
4526static const _ExtendedGDBusInterfaceInfo _fru_eeprom_interface_info =
4527{
4528 {
4529 -1,
4530 (gchar *) "org.openbmc.Fru.Eeprom",
4531 NULL,
4532 (GDBusSignalInfo **) &_fru_eeprom_signal_info_pointers,
4533 (GDBusPropertyInfo **) &_fru_eeprom_property_info_pointers,
4534 NULL
4535 },
4536 "fru-eeprom",
4537};
4538
4539
4540/**
4541 * fru_eeprom_interface_info:
4542 *
4543 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Fru-Eeprom.top_of_page">org.openbmc.Fru.Eeprom</link> D-Bus interface.
4544 *
4545 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
4546 */
4547GDBusInterfaceInfo *
4548fru_eeprom_interface_info (void)
4549{
4550 return (GDBusInterfaceInfo *) &_fru_eeprom_interface_info.parent_struct;
4551}
4552
4553/**
4554 * fru_eeprom_override_properties:
4555 * @klass: The class structure for a #GObject<!-- -->-derived class.
4556 * @property_id_begin: The property id to assign to the first overridden property.
4557 *
4558 * Overrides all #GObject properties in the #FruEeprom interface for a concrete class.
4559 * The properties are overridden in the order they are defined.
4560 *
4561 * Returns: The last property id.
4562 */
4563guint
4564fru_eeprom_override_properties (GObjectClass *klass, guint property_id_begin)
4565{
4566 g_object_class_override_property (klass, property_id_begin++, "i2c-dev-path");
4567 g_object_class_override_property (klass, property_id_begin++, "i2c-address");
4568 return property_id_begin - 1;
4569}
4570
4571
4572
4573/**
4574 * FruEeprom:
4575 *
4576 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fru-Eeprom.top_of_page">org.openbmc.Fru.Eeprom</link>.
4577 */
4578
4579/**
4580 * FruEepromIface:
4581 * @parent_iface: The parent interface.
4582 * @get_i2c_address: Getter for the #FruEeprom:i2c-address property.
4583 * @get_i2c_dev_path: Getter for the #FruEeprom:i2c-dev-path property.
4584 * @read_done: Handler for the #FruEeprom::read-done signal.
4585 *
4586 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fru-Eeprom.top_of_page">org.openbmc.Fru.Eeprom</link>.
4587 */
4588
4589typedef FruEepromIface FruEepromInterface;
4590G_DEFINE_INTERFACE (FruEeprom, fru_eeprom, G_TYPE_OBJECT);
4591
4592static void
4593fru_eeprom_default_init (FruEepromIface *iface)
4594{
4595 /* GObject signals for received D-Bus signals: */
4596 /**
4597 * FruEeprom::read-done:
4598 * @object: A #FruEeprom.
4599 *
4600 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Fru-Eeprom.ReadDone">"ReadDone"</link> is received.
4601 *
4602 * 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.
4603 */
4604 g_signal_new ("read-done",
4605 G_TYPE_FROM_INTERFACE (iface),
4606 G_SIGNAL_RUN_LAST,
4607 G_STRUCT_OFFSET (FruEepromIface, read_done),
4608 NULL,
4609 NULL,
4610 g_cclosure_marshal_generic,
4611 G_TYPE_NONE,
4612 0);
4613
4614 /* GObject properties for D-Bus properties: */
4615 /**
4616 * FruEeprom:i2c-dev-path:
4617 *
4618 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fru-Eeprom.i2c_dev_path">"i2c_dev_path"</link>.
4619 *
4620 * 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.
4621 */
4622 g_object_interface_install_property (iface,
4623 g_param_spec_string ("i2c-dev-path", "i2c_dev_path", "i2c_dev_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4624 /**
4625 * FruEeprom:i2c-address:
4626 *
4627 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fru-Eeprom.i2c_address">"i2c_address"</link>.
4628 *
4629 * 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.
4630 */
4631 g_object_interface_install_property (iface,
4632 g_param_spec_string ("i2c-address", "i2c_address", "i2c_address", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4633}
4634
4635/**
4636 * fru_eeprom_get_i2c_dev_path: (skip)
4637 * @object: A #FruEeprom.
4638 *
4639 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fru-Eeprom.i2c_dev_path">"i2c_dev_path"</link> D-Bus property.
4640 *
4641 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4642 *
4643 * <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_eeprom_dup_i2c_dev_path() if on another thread.</warning>
4644 *
4645 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
4646 */
4647const gchar *
4648fru_eeprom_get_i2c_dev_path (FruEeprom *object)
4649{
4650 return FRU_EEPROM_GET_IFACE (object)->get_i2c_dev_path (object);
4651}
4652
4653/**
4654 * fru_eeprom_dup_i2c_dev_path: (skip)
4655 * @object: A #FruEeprom.
4656 *
4657 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Fru-Eeprom.i2c_dev_path">"i2c_dev_path"</link> D-Bus property.
4658 *
4659 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4660 *
4661 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
4662 */
4663gchar *
4664fru_eeprom_dup_i2c_dev_path (FruEeprom *object)
4665{
4666 gchar *value;
4667 g_object_get (G_OBJECT (object), "i2c-dev-path", &value, NULL);
4668 return value;
4669}
4670
4671/**
4672 * fru_eeprom_set_i2c_dev_path: (skip)
4673 * @object: A #FruEeprom.
4674 * @value: The value to set.
4675 *
4676 * Sets the <link linkend="gdbus-property-org-openbmc-Fru-Eeprom.i2c_dev_path">"i2c_dev_path"</link> D-Bus property to @value.
4677 *
4678 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4679 */
4680void
4681fru_eeprom_set_i2c_dev_path (FruEeprom *object, const gchar *value)
4682{
4683 g_object_set (G_OBJECT (object), "i2c-dev-path", value, NULL);
4684}
4685
4686/**
4687 * fru_eeprom_get_i2c_address: (skip)
4688 * @object: A #FruEeprom.
4689 *
4690 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fru-Eeprom.i2c_address">"i2c_address"</link> D-Bus property.
4691 *
4692 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4693 *
4694 * <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_eeprom_dup_i2c_address() if on another thread.</warning>
4695 *
4696 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
4697 */
4698const gchar *
4699fru_eeprom_get_i2c_address (FruEeprom *object)
4700{
4701 return FRU_EEPROM_GET_IFACE (object)->get_i2c_address (object);
4702}
4703
4704/**
4705 * fru_eeprom_dup_i2c_address: (skip)
4706 * @object: A #FruEeprom.
4707 *
4708 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Fru-Eeprom.i2c_address">"i2c_address"</link> D-Bus property.
4709 *
4710 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4711 *
4712 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
4713 */
4714gchar *
4715fru_eeprom_dup_i2c_address (FruEeprom *object)
4716{
4717 gchar *value;
4718 g_object_get (G_OBJECT (object), "i2c-address", &value, NULL);
4719 return value;
4720}
4721
4722/**
4723 * fru_eeprom_set_i2c_address: (skip)
4724 * @object: A #FruEeprom.
4725 * @value: The value to set.
4726 *
4727 * Sets the <link linkend="gdbus-property-org-openbmc-Fru-Eeprom.i2c_address">"i2c_address"</link> D-Bus property to @value.
4728 *
4729 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4730 */
4731void
4732fru_eeprom_set_i2c_address (FruEeprom *object, const gchar *value)
4733{
4734 g_object_set (G_OBJECT (object), "i2c-address", value, NULL);
4735}
4736
4737/**
4738 * fru_eeprom_emit_read_done:
4739 * @object: A #FruEeprom.
4740 *
4741 * Emits the <link linkend="gdbus-signal-org-openbmc-Fru-Eeprom.ReadDone">"ReadDone"</link> D-Bus signal.
4742 */
4743void
4744fru_eeprom_emit_read_done (
4745 FruEeprom *object)
4746{
4747 g_signal_emit_by_name (object, "read-done");
4748}
4749
4750/* ------------------------------------------------------------------------ */
4751
4752/**
4753 * FruEepromProxy:
4754 *
4755 * The #FruEepromProxy structure contains only private data and should only be accessed using the provided API.
4756 */
4757
4758/**
4759 * FruEepromProxyClass:
4760 * @parent_class: The parent class.
4761 *
4762 * Class structure for #FruEepromProxy.
4763 */
4764
4765struct _FruEepromProxyPrivate
4766{
4767 GData *qdata;
4768};
4769
4770static void fru_eeprom_proxy_iface_init (FruEepromIface *iface);
4771
4772#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4773G_DEFINE_TYPE_WITH_CODE (FruEepromProxy, fru_eeprom_proxy, G_TYPE_DBUS_PROXY,
4774 G_ADD_PRIVATE (FruEepromProxy)
4775 G_IMPLEMENT_INTERFACE (TYPE_FRU_EEPROM, fru_eeprom_proxy_iface_init));
4776
4777#else
4778G_DEFINE_TYPE_WITH_CODE (FruEepromProxy, fru_eeprom_proxy, G_TYPE_DBUS_PROXY,
4779 G_IMPLEMENT_INTERFACE (TYPE_FRU_EEPROM, fru_eeprom_proxy_iface_init));
4780
4781#endif
4782static void
4783fru_eeprom_proxy_finalize (GObject *object)
4784{
4785 FruEepromProxy *proxy = FRU_EEPROM_PROXY (object);
4786 g_datalist_clear (&proxy->priv->qdata);
4787 G_OBJECT_CLASS (fru_eeprom_proxy_parent_class)->finalize (object);
4788}
4789
4790static void
4791fru_eeprom_proxy_get_property (GObject *object,
4792 guint prop_id,
4793 GValue *value,
4794 GParamSpec *pspec G_GNUC_UNUSED)
4795{
4796 const _ExtendedGDBusPropertyInfo *info;
4797 GVariant *variant;
4798 g_assert (prop_id != 0 && prop_id - 1 < 2);
4799 info = _fru_eeprom_property_info_pointers[prop_id - 1];
4800 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
4801 if (info->use_gvariant)
4802 {
4803 g_value_set_variant (value, variant);
4804 }
4805 else
4806 {
4807 if (variant != NULL)
4808 g_dbus_gvariant_to_gvalue (variant, value);
4809 }
4810 if (variant != NULL)
4811 g_variant_unref (variant);
4812}
4813
4814static void
4815fru_eeprom_proxy_set_property_cb (GDBusProxy *proxy,
4816 GAsyncResult *res,
4817 gpointer user_data)
4818{
4819 const _ExtendedGDBusPropertyInfo *info = user_data;
4820 GError *error;
4821 GVariant *_ret;
4822 error = NULL;
4823 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
4824 if (!_ret)
4825 {
4826 g_warning ("Error setting property '%s' on interface org.openbmc.Fru.Eeprom: %s (%s, %d)",
4827 info->parent_struct.name,
4828 error->message, g_quark_to_string (error->domain), error->code);
4829 g_error_free (error);
4830 }
4831 else
4832 {
4833 g_variant_unref (_ret);
4834 }
4835}
4836
4837static void
4838fru_eeprom_proxy_set_property (GObject *object,
4839 guint prop_id,
4840 const GValue *value,
4841 GParamSpec *pspec G_GNUC_UNUSED)
4842{
4843 const _ExtendedGDBusPropertyInfo *info;
4844 GVariant *variant;
4845 g_assert (prop_id != 0 && prop_id - 1 < 2);
4846 info = _fru_eeprom_property_info_pointers[prop_id - 1];
4847 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
4848 g_dbus_proxy_call (G_DBUS_PROXY (object),
4849 "org.freedesktop.DBus.Properties.Set",
4850 g_variant_new ("(ssv)", "org.openbmc.Fru.Eeprom", info->parent_struct.name, variant),
4851 G_DBUS_CALL_FLAGS_NONE,
4852 -1,
4853 NULL, (GAsyncReadyCallback) fru_eeprom_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
4854 g_variant_unref (variant);
4855}
4856
4857static void
4858fru_eeprom_proxy_g_signal (GDBusProxy *proxy,
4859 const gchar *sender_name G_GNUC_UNUSED,
4860 const gchar *signal_name,
4861 GVariant *parameters)
4862{
4863 _ExtendedGDBusSignalInfo *info;
4864 GVariantIter iter;
4865 GVariant *child;
4866 GValue *paramv;
4867 guint num_params;
4868 guint n;
4869 guint signal_id;
4870 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_fru_eeprom_interface_info.parent_struct, signal_name);
4871 if (info == NULL)
4872 return;
4873 num_params = g_variant_n_children (parameters);
4874 paramv = g_new0 (GValue, num_params + 1);
4875 g_value_init (&paramv[0], TYPE_FRU_EEPROM);
4876 g_value_set_object (&paramv[0], proxy);
4877 g_variant_iter_init (&iter, parameters);
4878 n = 1;
4879 while ((child = g_variant_iter_next_value (&iter)) != NULL)
4880 {
4881 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
4882 if (arg_info->use_gvariant)
4883 {
4884 g_value_init (&paramv[n], G_TYPE_VARIANT);
4885 g_value_set_variant (&paramv[n], child);
4886 n++;
4887 }
4888 else
4889 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
4890 g_variant_unref (child);
4891 }
4892 signal_id = g_signal_lookup (info->signal_name, TYPE_FRU_EEPROM);
4893 g_signal_emitv (paramv, signal_id, 0, NULL);
4894 for (n = 0; n < num_params + 1; n++)
4895 g_value_unset (&paramv[n]);
4896 g_free (paramv);
4897}
4898
4899static void
4900fru_eeprom_proxy_g_properties_changed (GDBusProxy *_proxy,
4901 GVariant *changed_properties,
4902 const gchar *const *invalidated_properties)
4903{
4904 FruEepromProxy *proxy = FRU_EEPROM_PROXY (_proxy);
4905 guint n;
4906 const gchar *key;
4907 GVariantIter *iter;
4908 _ExtendedGDBusPropertyInfo *info;
4909 g_variant_get (changed_properties, "a{sv}", &iter);
4910 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
4911 {
4912 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fru_eeprom_interface_info.parent_struct, key);
4913 g_datalist_remove_data (&proxy->priv->qdata, key);
4914 if (info != NULL)
4915 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4916 }
4917 g_variant_iter_free (iter);
4918 for (n = 0; invalidated_properties[n] != NULL; n++)
4919 {
4920 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fru_eeprom_interface_info.parent_struct, invalidated_properties[n]);
4921 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
4922 if (info != NULL)
4923 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4924 }
4925}
4926
4927static const gchar *
4928fru_eeprom_proxy_get_i2c_dev_path (FruEeprom *object)
4929{
4930 FruEepromProxy *proxy = FRU_EEPROM_PROXY (object);
4931 GVariant *variant;
4932 const gchar *value = NULL;
4933 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "i2c_dev_path");
4934 if (variant != NULL)
4935 {
4936 value = g_variant_get_string (variant, NULL);
4937 g_variant_unref (variant);
4938 }
4939 return value;
4940}
4941
4942static const gchar *
4943fru_eeprom_proxy_get_i2c_address (FruEeprom *object)
4944{
4945 FruEepromProxy *proxy = FRU_EEPROM_PROXY (object);
4946 GVariant *variant;
4947 const gchar *value = NULL;
4948 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "i2c_address");
4949 if (variant != NULL)
4950 {
4951 value = g_variant_get_string (variant, NULL);
4952 g_variant_unref (variant);
4953 }
4954 return value;
4955}
4956
4957static void
4958fru_eeprom_proxy_init (FruEepromProxy *proxy)
4959{
4960#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4961 proxy->priv = fru_eeprom_proxy_get_instance_private (proxy);
4962#else
4963 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FRU_EEPROM_PROXY, FruEepromProxyPrivate);
4964#endif
4965
4966 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), fru_eeprom_interface_info ());
4967}
4968
4969static void
4970fru_eeprom_proxy_class_init (FruEepromProxyClass *klass)
4971{
4972 GObjectClass *gobject_class;
4973 GDBusProxyClass *proxy_class;
4974
4975 gobject_class = G_OBJECT_CLASS (klass);
4976 gobject_class->finalize = fru_eeprom_proxy_finalize;
4977 gobject_class->get_property = fru_eeprom_proxy_get_property;
4978 gobject_class->set_property = fru_eeprom_proxy_set_property;
4979
4980 proxy_class = G_DBUS_PROXY_CLASS (klass);
4981 proxy_class->g_signal = fru_eeprom_proxy_g_signal;
4982 proxy_class->g_properties_changed = fru_eeprom_proxy_g_properties_changed;
4983
4984 fru_eeprom_override_properties (gobject_class, 1);
4985
4986#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
4987 g_type_class_add_private (klass, sizeof (FruEepromProxyPrivate));
4988#endif
4989}
4990
4991static void
4992fru_eeprom_proxy_iface_init (FruEepromIface *iface)
4993{
4994 iface->get_i2c_dev_path = fru_eeprom_proxy_get_i2c_dev_path;
4995 iface->get_i2c_address = fru_eeprom_proxy_get_i2c_address;
4996}
4997
4998/**
4999 * fru_eeprom_proxy_new:
5000 * @connection: A #GDBusConnection.
5001 * @flags: Flags from the #GDBusProxyFlags enumeration.
5002 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
5003 * @object_path: An object path.
5004 * @cancellable: (allow-none): A #GCancellable or %NULL.
5005 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
5006 * @user_data: User data to pass to @callback.
5007 *
5008 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fru-Eeprom.top_of_page">org.openbmc.Fru.Eeprom</link>. See g_dbus_proxy_new() for more details.
5009 *
5010 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
5011 * You can then call fru_eeprom_proxy_new_finish() to get the result of the operation.
5012 *
5013 * See fru_eeprom_proxy_new_sync() for the synchronous, blocking version of this constructor.
5014 */
5015void
5016fru_eeprom_proxy_new (
5017 GDBusConnection *connection,
5018 GDBusProxyFlags flags,
5019 const gchar *name,
5020 const gchar *object_path,
5021 GCancellable *cancellable,
5022 GAsyncReadyCallback callback,
5023 gpointer user_data)
5024{
5025 g_async_initable_new_async (TYPE_FRU_EEPROM_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.Eeprom", NULL);
5026}
5027
5028/**
5029 * fru_eeprom_proxy_new_finish:
5030 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fru_eeprom_proxy_new().
5031 * @error: Return location for error or %NULL
5032 *
5033 * Finishes an operation started with fru_eeprom_proxy_new().
5034 *
5035 * Returns: (transfer full) (type FruEepromProxy): The constructed proxy object or %NULL if @error is set.
5036 */
5037FruEeprom *
5038fru_eeprom_proxy_new_finish (
5039 GAsyncResult *res,
5040 GError **error)
5041{
5042 GObject *ret;
5043 GObject *source_object;
5044 source_object = g_async_result_get_source_object (res);
5045 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
5046 g_object_unref (source_object);
5047 if (ret != NULL)
5048 return FRU_EEPROM (ret);
5049 else
5050 return NULL;
5051}
5052
5053/**
5054 * fru_eeprom_proxy_new_sync:
5055 * @connection: A #GDBusConnection.
5056 * @flags: Flags from the #GDBusProxyFlags enumeration.
5057 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
5058 * @object_path: An object path.
5059 * @cancellable: (allow-none): A #GCancellable or %NULL.
5060 * @error: Return location for error or %NULL
5061 *
5062 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fru-Eeprom.top_of_page">org.openbmc.Fru.Eeprom</link>. See g_dbus_proxy_new_sync() for more details.
5063 *
5064 * The calling thread is blocked until a reply is received.
5065 *
5066 * See fru_eeprom_proxy_new() for the asynchronous version of this constructor.
5067 *
5068 * Returns: (transfer full) (type FruEepromProxy): The constructed proxy object or %NULL if @error is set.
5069 */
5070FruEeprom *
5071fru_eeprom_proxy_new_sync (
5072 GDBusConnection *connection,
5073 GDBusProxyFlags flags,
5074 const gchar *name,
5075 const gchar *object_path,
5076 GCancellable *cancellable,
5077 GError **error)
5078{
5079 GInitable *ret;
5080 ret = g_initable_new (TYPE_FRU_EEPROM_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Fru.Eeprom", NULL);
5081 if (ret != NULL)
5082 return FRU_EEPROM (ret);
5083 else
5084 return NULL;
5085}
5086
5087
5088/**
5089 * fru_eeprom_proxy_new_for_bus:
5090 * @bus_type: A #GBusType.
5091 * @flags: Flags from the #GDBusProxyFlags enumeration.
5092 * @name: A bus name (well-known or unique).
5093 * @object_path: An object path.
5094 * @cancellable: (allow-none): A #GCancellable or %NULL.
5095 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
5096 * @user_data: User data to pass to @callback.
5097 *
5098 * Like fru_eeprom_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
5099 *
5100 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
5101 * You can then call fru_eeprom_proxy_new_for_bus_finish() to get the result of the operation.
5102 *
5103 * See fru_eeprom_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
5104 */
5105void
5106fru_eeprom_proxy_new_for_bus (
5107 GBusType bus_type,
5108 GDBusProxyFlags flags,
5109 const gchar *name,
5110 const gchar *object_path,
5111 GCancellable *cancellable,
5112 GAsyncReadyCallback callback,
5113 gpointer user_data)
5114{
5115 g_async_initable_new_async (TYPE_FRU_EEPROM_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.Eeprom", NULL);
5116}
5117
5118/**
5119 * fru_eeprom_proxy_new_for_bus_finish:
5120 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fru_eeprom_proxy_new_for_bus().
5121 * @error: Return location for error or %NULL
5122 *
5123 * Finishes an operation started with fru_eeprom_proxy_new_for_bus().
5124 *
5125 * Returns: (transfer full) (type FruEepromProxy): The constructed proxy object or %NULL if @error is set.
5126 */
5127FruEeprom *
5128fru_eeprom_proxy_new_for_bus_finish (
5129 GAsyncResult *res,
5130 GError **error)
5131{
5132 GObject *ret;
5133 GObject *source_object;
5134 source_object = g_async_result_get_source_object (res);
5135 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
5136 g_object_unref (source_object);
5137 if (ret != NULL)
5138 return FRU_EEPROM (ret);
5139 else
5140 return NULL;
5141}
5142
5143/**
5144 * fru_eeprom_proxy_new_for_bus_sync:
5145 * @bus_type: A #GBusType.
5146 * @flags: Flags from the #GDBusProxyFlags enumeration.
5147 * @name: A bus name (well-known or unique).
5148 * @object_path: An object path.
5149 * @cancellable: (allow-none): A #GCancellable or %NULL.
5150 * @error: Return location for error or %NULL
5151 *
5152 * Like fru_eeprom_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
5153 *
5154 * The calling thread is blocked until a reply is received.
5155 *
5156 * See fru_eeprom_proxy_new_for_bus() for the asynchronous version of this constructor.
5157 *
5158 * Returns: (transfer full) (type FruEepromProxy): The constructed proxy object or %NULL if @error is set.
5159 */
5160FruEeprom *
5161fru_eeprom_proxy_new_for_bus_sync (
5162 GBusType bus_type,
5163 GDBusProxyFlags flags,
5164 const gchar *name,
5165 const gchar *object_path,
5166 GCancellable *cancellable,
5167 GError **error)
5168{
5169 GInitable *ret;
5170 ret = g_initable_new (TYPE_FRU_EEPROM_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.Eeprom", NULL);
5171 if (ret != NULL)
5172 return FRU_EEPROM (ret);
5173 else
5174 return NULL;
5175}
5176
5177
5178/* ------------------------------------------------------------------------ */
5179
5180/**
5181 * FruEepromSkeleton:
5182 *
5183 * The #FruEepromSkeleton structure contains only private data and should only be accessed using the provided API.
5184 */
5185
5186/**
5187 * FruEepromSkeletonClass:
5188 * @parent_class: The parent class.
5189 *
5190 * Class structure for #FruEepromSkeleton.
5191 */
5192
5193struct _FruEepromSkeletonPrivate
5194{
5195 GValue *properties;
5196 GList *changed_properties;
5197 GSource *changed_properties_idle_source;
5198 GMainContext *context;
5199 GMutex lock;
5200};
5201
5202static void
5203_fru_eeprom_skeleton_handle_method_call (
5204 GDBusConnection *connection G_GNUC_UNUSED,
5205 const gchar *sender G_GNUC_UNUSED,
5206 const gchar *object_path G_GNUC_UNUSED,
5207 const gchar *interface_name,
5208 const gchar *method_name,
5209 GVariant *parameters,
5210 GDBusMethodInvocation *invocation,
5211 gpointer user_data)
5212{
5213 FruEepromSkeleton *skeleton = FRU_EEPROM_SKELETON (user_data);
5214 _ExtendedGDBusMethodInfo *info;
5215 GVariantIter iter;
5216 GVariant *child;
5217 GValue *paramv;
5218 guint num_params;
5219 guint num_extra;
5220 guint n;
5221 guint signal_id;
5222 GValue return_value = G_VALUE_INIT;
5223 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
5224 g_assert (info != NULL);
5225 num_params = g_variant_n_children (parameters);
5226 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
5227 n = 0;
5228 g_value_init (&paramv[n], TYPE_FRU_EEPROM);
5229 g_value_set_object (&paramv[n++], skeleton);
5230 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
5231 g_value_set_object (&paramv[n++], invocation);
5232 if (info->pass_fdlist)
5233 {
5234#ifdef G_OS_UNIX
5235 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
5236 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
5237#else
5238 g_assert_not_reached ();
5239#endif
5240 }
5241 g_variant_iter_init (&iter, parameters);
5242 while ((child = g_variant_iter_next_value (&iter)) != NULL)
5243 {
5244 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
5245 if (arg_info->use_gvariant)
5246 {
5247 g_value_init (&paramv[n], G_TYPE_VARIANT);
5248 g_value_set_variant (&paramv[n], child);
5249 n++;
5250 }
5251 else
5252 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
5253 g_variant_unref (child);
5254 }
5255 signal_id = g_signal_lookup (info->signal_name, TYPE_FRU_EEPROM);
5256 g_value_init (&return_value, G_TYPE_BOOLEAN);
5257 g_signal_emitv (paramv, signal_id, 0, &return_value);
5258 if (!g_value_get_boolean (&return_value))
5259 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);
5260 g_value_unset (&return_value);
5261 for (n = 0; n < num_params + num_extra; n++)
5262 g_value_unset (&paramv[n]);
5263 g_free (paramv);
5264}
5265
5266static GVariant *
5267_fru_eeprom_skeleton_handle_get_property (
5268 GDBusConnection *connection G_GNUC_UNUSED,
5269 const gchar *sender G_GNUC_UNUSED,
5270 const gchar *object_path G_GNUC_UNUSED,
5271 const gchar *interface_name G_GNUC_UNUSED,
5272 const gchar *property_name,
5273 GError **error,
5274 gpointer user_data)
5275{
5276 FruEepromSkeleton *skeleton = FRU_EEPROM_SKELETON (user_data);
5277 GValue value = G_VALUE_INIT;
5278 GParamSpec *pspec;
5279 _ExtendedGDBusPropertyInfo *info;
5280 GVariant *ret;
5281 ret = NULL;
5282 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fru_eeprom_interface_info.parent_struct, property_name);
5283 g_assert (info != NULL);
5284 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5285 if (pspec == NULL)
5286 {
5287 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5288 }
5289 else
5290 {
5291 g_value_init (&value, pspec->value_type);
5292 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5293 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
5294 g_value_unset (&value);
5295 }
5296 return ret;
5297}
5298
5299static gboolean
5300_fru_eeprom_skeleton_handle_set_property (
5301 GDBusConnection *connection G_GNUC_UNUSED,
5302 const gchar *sender G_GNUC_UNUSED,
5303 const gchar *object_path G_GNUC_UNUSED,
5304 const gchar *interface_name G_GNUC_UNUSED,
5305 const gchar *property_name,
5306 GVariant *variant,
5307 GError **error,
5308 gpointer user_data)
5309{
5310 FruEepromSkeleton *skeleton = FRU_EEPROM_SKELETON (user_data);
5311 GValue value = G_VALUE_INIT;
5312 GParamSpec *pspec;
5313 _ExtendedGDBusPropertyInfo *info;
5314 gboolean ret;
5315 ret = FALSE;
5316 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fru_eeprom_interface_info.parent_struct, property_name);
5317 g_assert (info != NULL);
5318 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5319 if (pspec == NULL)
5320 {
5321 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5322 }
5323 else
5324 {
5325 if (info->use_gvariant)
5326 g_value_set_variant (&value, variant);
5327 else
5328 g_dbus_gvariant_to_gvalue (variant, &value);
5329 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5330 g_value_unset (&value);
5331 ret = TRUE;
5332 }
5333 return ret;
5334}
5335
5336static const GDBusInterfaceVTable _fru_eeprom_skeleton_vtable =
5337{
5338 _fru_eeprom_skeleton_handle_method_call,
5339 _fru_eeprom_skeleton_handle_get_property,
5340 _fru_eeprom_skeleton_handle_set_property,
5341 {NULL}
5342};
5343
5344static GDBusInterfaceInfo *
5345fru_eeprom_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5346{
5347 return fru_eeprom_interface_info ();
5348}
5349
5350static GDBusInterfaceVTable *
5351fru_eeprom_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5352{
5353 return (GDBusInterfaceVTable *) &_fru_eeprom_skeleton_vtable;
5354}
5355
5356static GVariant *
5357fru_eeprom_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
5358{
5359 FruEepromSkeleton *skeleton = FRU_EEPROM_SKELETON (_skeleton);
5360
5361 GVariantBuilder builder;
5362 guint n;
5363 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5364 if (_fru_eeprom_interface_info.parent_struct.properties == NULL)
5365 goto out;
5366 for (n = 0; _fru_eeprom_interface_info.parent_struct.properties[n] != NULL; n++)
5367 {
5368 GDBusPropertyInfo *info = _fru_eeprom_interface_info.parent_struct.properties[n];
5369 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
5370 {
5371 GVariant *value;
5372 value = _fru_eeprom_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.Eeprom", info->name, NULL, skeleton);
5373 if (value != NULL)
5374 {
5375 g_variant_take_ref (value);
5376 g_variant_builder_add (&builder, "{sv}", info->name, value);
5377 g_variant_unref (value);
5378 }
5379 }
5380 }
5381out:
5382 return g_variant_builder_end (&builder);
5383}
5384
5385static gboolean _fru_eeprom_emit_changed (gpointer user_data);
5386
5387static void
5388fru_eeprom_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
5389{
5390 FruEepromSkeleton *skeleton = FRU_EEPROM_SKELETON (_skeleton);
5391 gboolean emit_changed = FALSE;
5392
5393 g_mutex_lock (&skeleton->priv->lock);
5394 if (skeleton->priv->changed_properties_idle_source != NULL)
5395 {
5396 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5397 skeleton->priv->changed_properties_idle_source = NULL;
5398 emit_changed = TRUE;
5399 }
5400 g_mutex_unlock (&skeleton->priv->lock);
5401
5402 if (emit_changed)
5403 _fru_eeprom_emit_changed (skeleton);
5404}
5405
5406static void
5407_fru_eeprom_on_signal_read_done (
5408 FruEeprom *object)
5409{
5410 FruEepromSkeleton *skeleton = FRU_EEPROM_SKELETON (object);
5411
5412 GList *connections, *l;
5413 GVariant *signal_variant;
5414 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5415
5416 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
5417 for (l = connections; l != NULL; l = l->next)
5418 {
5419 GDBusConnection *connection = l->data;
5420 g_dbus_connection_emit_signal (connection,
5421 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fru.Eeprom", "ReadDone",
5422 signal_variant, NULL);
5423 }
5424 g_variant_unref (signal_variant);
5425 g_list_free_full (connections, g_object_unref);
5426}
5427
5428static void fru_eeprom_skeleton_iface_init (FruEepromIface *iface);
5429#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5430G_DEFINE_TYPE_WITH_CODE (FruEepromSkeleton, fru_eeprom_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5431 G_ADD_PRIVATE (FruEepromSkeleton)
5432 G_IMPLEMENT_INTERFACE (TYPE_FRU_EEPROM, fru_eeprom_skeleton_iface_init));
5433
5434#else
5435G_DEFINE_TYPE_WITH_CODE (FruEepromSkeleton, fru_eeprom_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5436 G_IMPLEMENT_INTERFACE (TYPE_FRU_EEPROM, fru_eeprom_skeleton_iface_init));
5437
5438#endif
5439static void
5440fru_eeprom_skeleton_finalize (GObject *object)
5441{
5442 FruEepromSkeleton *skeleton = FRU_EEPROM_SKELETON (object);
5443 guint n;
5444 for (n = 0; n < 2; n++)
5445 g_value_unset (&skeleton->priv->properties[n]);
5446 g_free (skeleton->priv->properties);
5447 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5448 if (skeleton->priv->changed_properties_idle_source != NULL)
5449 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5450 g_main_context_unref (skeleton->priv->context);
5451 g_mutex_clear (&skeleton->priv->lock);
5452 G_OBJECT_CLASS (fru_eeprom_skeleton_parent_class)->finalize (object);
5453}
5454
5455static void
5456fru_eeprom_skeleton_get_property (GObject *object,
5457 guint prop_id,
5458 GValue *value,
5459 GParamSpec *pspec G_GNUC_UNUSED)
5460{
5461 FruEepromSkeleton *skeleton = FRU_EEPROM_SKELETON (object);
5462 g_assert (prop_id != 0 && prop_id - 1 < 2);
5463 g_mutex_lock (&skeleton->priv->lock);
5464 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
5465 g_mutex_unlock (&skeleton->priv->lock);
5466}
5467
5468static gboolean
5469_fru_eeprom_emit_changed (gpointer user_data)
5470{
5471 FruEepromSkeleton *skeleton = FRU_EEPROM_SKELETON (user_data);
5472 GList *l;
5473 GVariantBuilder builder;
5474 GVariantBuilder invalidated_builder;
5475 guint num_changes;
5476
5477 g_mutex_lock (&skeleton->priv->lock);
5478 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5479 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
5480 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
5481 {
5482 ChangedProperty *cp = l->data;
5483 GVariant *variant;
5484 const GValue *cur_value;
5485
5486 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
5487 if (!_g_value_equal (cur_value, &cp->orig_value))
5488 {
5489 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
5490 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
5491 g_variant_unref (variant);
5492 num_changes++;
5493 }
5494 }
5495 if (num_changes > 0)
5496 {
5497 GList *connections, *ll;
5498 GVariant *signal_variant;
5499 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Fru.Eeprom",
5500 &builder, &invalidated_builder));
5501 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5502 for (ll = connections; ll != NULL; ll = ll->next)
5503 {
5504 GDBusConnection *connection = ll->data;
5505
5506 g_dbus_connection_emit_signal (connection,
5507 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
5508 "org.freedesktop.DBus.Properties",
5509 "PropertiesChanged",
5510 signal_variant,
5511 NULL);
5512 }
5513 g_variant_unref (signal_variant);
5514 g_list_free_full (connections, g_object_unref);
5515 }
5516 else
5517 {
5518 g_variant_builder_clear (&builder);
5519 g_variant_builder_clear (&invalidated_builder);
5520 }
5521 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5522 skeleton->priv->changed_properties = NULL;
5523 skeleton->priv->changed_properties_idle_source = NULL;
5524 g_mutex_unlock (&skeleton->priv->lock);
5525 return FALSE;
5526}
5527
5528static void
5529_fru_eeprom_schedule_emit_changed (FruEepromSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
5530{
5531 ChangedProperty *cp;
5532 GList *l;
5533 cp = NULL;
5534 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
5535 {
5536 ChangedProperty *i_cp = l->data;
5537 if (i_cp->info == info)
5538 {
5539 cp = i_cp;
5540 break;
5541 }
5542 }
5543 if (cp == NULL)
5544 {
5545 cp = g_new0 (ChangedProperty, 1);
5546 cp->prop_id = prop_id;
5547 cp->info = info;
5548 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
5549 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
5550 g_value_copy (orig_value, &cp->orig_value);
5551 }
5552}
5553
5554static void
5555fru_eeprom_skeleton_notify (GObject *object,
5556 GParamSpec *pspec G_GNUC_UNUSED)
5557{
5558 FruEepromSkeleton *skeleton = FRU_EEPROM_SKELETON (object);
5559 g_mutex_lock (&skeleton->priv->lock);
5560 if (skeleton->priv->changed_properties != NULL &&
5561 skeleton->priv->changed_properties_idle_source == NULL)
5562 {
5563 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
5564 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
5565 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _fru_eeprom_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
5566 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
5567 g_source_unref (skeleton->priv->changed_properties_idle_source);
5568 }
5569 g_mutex_unlock (&skeleton->priv->lock);
5570}
5571
5572static void
5573fru_eeprom_skeleton_set_property (GObject *object,
5574 guint prop_id,
5575 const GValue *value,
5576 GParamSpec *pspec)
5577{
5578 FruEepromSkeleton *skeleton = FRU_EEPROM_SKELETON (object);
5579 g_assert (prop_id != 0 && prop_id - 1 < 2);
5580 g_mutex_lock (&skeleton->priv->lock);
5581 g_object_freeze_notify (object);
5582 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
5583 {
5584 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
5585 _fru_eeprom_schedule_emit_changed (skeleton, _fru_eeprom_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
5586 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
5587 g_object_notify_by_pspec (object, pspec);
5588 }
5589 g_mutex_unlock (&skeleton->priv->lock);
5590 g_object_thaw_notify (object);
5591}
5592
5593static void
5594fru_eeprom_skeleton_init (FruEepromSkeleton *skeleton)
5595{
5596#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5597 skeleton->priv = fru_eeprom_skeleton_get_instance_private (skeleton);
5598#else
5599 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FRU_EEPROM_SKELETON, FruEepromSkeletonPrivate);
5600#endif
5601
5602 g_mutex_init (&skeleton->priv->lock);
5603 skeleton->priv->context = g_main_context_ref_thread_default ();
5604 skeleton->priv->properties = g_new0 (GValue, 2);
5605 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
5606 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
5607}
5608
5609static const gchar *
5610fru_eeprom_skeleton_get_i2c_dev_path (FruEeprom *object)
5611{
5612 FruEepromSkeleton *skeleton = FRU_EEPROM_SKELETON (object);
5613 const gchar *value;
5614 g_mutex_lock (&skeleton->priv->lock);
5615 value = g_value_get_string (&(skeleton->priv->properties[0]));
5616 g_mutex_unlock (&skeleton->priv->lock);
5617 return value;
5618}
5619
5620static const gchar *
5621fru_eeprom_skeleton_get_i2c_address (FruEeprom *object)
5622{
5623 FruEepromSkeleton *skeleton = FRU_EEPROM_SKELETON (object);
5624 const gchar *value;
5625 g_mutex_lock (&skeleton->priv->lock);
5626 value = g_value_get_string (&(skeleton->priv->properties[1]));
5627 g_mutex_unlock (&skeleton->priv->lock);
5628 return value;
5629}
5630
5631static void
5632fru_eeprom_skeleton_class_init (FruEepromSkeletonClass *klass)
5633{
5634 GObjectClass *gobject_class;
5635 GDBusInterfaceSkeletonClass *skeleton_class;
5636
5637 gobject_class = G_OBJECT_CLASS (klass);
5638 gobject_class->finalize = fru_eeprom_skeleton_finalize;
5639 gobject_class->get_property = fru_eeprom_skeleton_get_property;
5640 gobject_class->set_property = fru_eeprom_skeleton_set_property;
5641 gobject_class->notify = fru_eeprom_skeleton_notify;
5642
5643
5644 fru_eeprom_override_properties (gobject_class, 1);
5645
5646 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
5647 skeleton_class->get_info = fru_eeprom_skeleton_dbus_interface_get_info;
5648 skeleton_class->get_properties = fru_eeprom_skeleton_dbus_interface_get_properties;
5649 skeleton_class->flush = fru_eeprom_skeleton_dbus_interface_flush;
5650 skeleton_class->get_vtable = fru_eeprom_skeleton_dbus_interface_get_vtable;
5651
5652#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
5653 g_type_class_add_private (klass, sizeof (FruEepromSkeletonPrivate));
5654#endif
5655}
5656
5657static void
5658fru_eeprom_skeleton_iface_init (FruEepromIface *iface)
5659{
5660 iface->read_done = _fru_eeprom_on_signal_read_done;
5661 iface->get_i2c_dev_path = fru_eeprom_skeleton_get_i2c_dev_path;
5662 iface->get_i2c_address = fru_eeprom_skeleton_get_i2c_address;
5663}
5664
5665/**
5666 * fru_eeprom_skeleton_new:
5667 *
5668 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fru-Eeprom.top_of_page">org.openbmc.Fru.Eeprom</link>.
5669 *
5670 * Returns: (transfer full) (type FruEepromSkeleton): The skeleton object.
5671 */
5672FruEeprom *
5673fru_eeprom_skeleton_new (void)
5674{
5675 return FRU_EEPROM (g_object_new (TYPE_FRU_EEPROM_SKELETON, NULL));
5676}
5677
5678/* ------------------------------------------------------------------------
Norman Jamesce46e3e2015-08-30 22:25:55 -05005679 * Code for Object, ObjectProxy and ObjectSkeleton
5680 * ------------------------------------------------------------------------
5681 */
5682
5683/**
5684 * SECTION:Object
5685 * @title: Object
5686 * @short_description: Specialized GDBusObject types
5687 *
5688 * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
5689 */
5690
5691/**
5692 * Object:
5693 *
5694 * The #Object type is a specialized container of interfaces.
5695 */
5696
5697/**
5698 * ObjectIface:
5699 * @parent_iface: The parent interface.
5700 *
5701 * Virtual table for the #Object interface.
5702 */
5703
5704typedef ObjectIface ObjectInterface;
5705G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));
5706
5707static void
5708object_default_init (ObjectIface *iface)
5709{
5710 /**
5711 * Object:fru:
5712 *
5713 * 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.
5714 *
5715 * Connect to the #GObject::notify signal to get informed of property changes.
5716 */
5717 g_object_interface_install_property (iface, g_param_spec_object ("fru", "fru", "fru", TYPE_FRU, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
5718
5719 /**
5720 * Object:fru-fan:
5721 *
5722 * 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.
5723 *
5724 * Connect to the #GObject::notify signal to get informed of property changes.
5725 */
5726 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));
5727
Norman James90baede2015-09-02 20:32:49 -05005728 /**
5729 * Object:fru-eeprom:
5730 *
5731 * The #FruEeprom instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fru-Eeprom.top_of_page">org.openbmc.Fru.Eeprom</link>, if any.
5732 *
5733 * Connect to the #GObject::notify signal to get informed of property changes.
5734 */
5735 g_object_interface_install_property (iface, g_param_spec_object ("fru-eeprom", "fru-eeprom", "fru-eeprom", TYPE_FRU_EEPROM, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
5736
Norman Jamesce46e3e2015-08-30 22:25:55 -05005737}
5738
5739/**
5740 * object_get_fru:
5741 * @object: A #Object.
5742 *
5743 * 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.
5744 *
5745 * Returns: (transfer full): A #Fru that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
5746 */
5747Fru *object_get_fru (Object *object)
5748{
5749 GDBusInterface *ret;
5750 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fru");
5751 if (ret == NULL)
5752 return NULL;
5753 return FRU (ret);
5754}
5755
5756/**
5757 * object_get_fru_fan:
5758 * @object: A #Object.
5759 *
5760 * 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.
5761 *
5762 * Returns: (transfer full): A #FruFan that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
5763 */
5764FruFan *object_get_fru_fan (Object *object)
5765{
5766 GDBusInterface *ret;
5767 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fru.Fan");
5768 if (ret == NULL)
5769 return NULL;
5770 return FRU_FAN (ret);
5771}
5772
Norman James90baede2015-09-02 20:32:49 -05005773/**
5774 * object_get_fru_eeprom:
5775 * @object: A #Object.
5776 *
5777 * Gets the #FruEeprom instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fru-Eeprom.top_of_page">org.openbmc.Fru.Eeprom</link> on @object, if any.
5778 *
5779 * Returns: (transfer full): A #FruEeprom that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
5780 */
5781FruEeprom *object_get_fru_eeprom (Object *object)
5782{
5783 GDBusInterface *ret;
5784 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fru.Eeprom");
5785 if (ret == NULL)
5786 return NULL;
5787 return FRU_EEPROM (ret);
5788}
5789
Norman Jamesce46e3e2015-08-30 22:25:55 -05005790
5791/**
5792 * object_peek_fru: (skip)
5793 * @object: A #Object.
5794 *
5795 * Like object_get_fru() but doesn't increase the reference count on the returned object.
5796 *
5797 * <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>
5798 *
5799 * 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.
5800 */
5801Fru *object_peek_fru (Object *object)
5802{
5803 GDBusInterface *ret;
5804 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fru");
5805 if (ret == NULL)
5806 return NULL;
5807 g_object_unref (ret);
5808 return FRU (ret);
5809}
5810
5811/**
5812 * object_peek_fru_fan: (skip)
5813 * @object: A #Object.
5814 *
5815 * Like object_get_fru_fan() but doesn't increase the reference count on the returned object.
5816 *
5817 * <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>
5818 *
5819 * 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.
5820 */
5821FruFan *object_peek_fru_fan (Object *object)
5822{
5823 GDBusInterface *ret;
5824 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fru.Fan");
5825 if (ret == NULL)
5826 return NULL;
5827 g_object_unref (ret);
5828 return FRU_FAN (ret);
5829}
5830
Norman James90baede2015-09-02 20:32:49 -05005831/**
5832 * object_peek_fru_eeprom: (skip)
5833 * @object: A #Object.
5834 *
5835 * Like object_get_fru_eeprom() but doesn't increase the reference count on the returned object.
5836 *
5837 * <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>
5838 *
5839 * Returns: (transfer none): A #FruEeprom or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
5840 */
5841FruEeprom *object_peek_fru_eeprom (Object *object)
5842{
5843 GDBusInterface *ret;
5844 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fru.Eeprom");
5845 if (ret == NULL)
5846 return NULL;
5847 g_object_unref (ret);
5848 return FRU_EEPROM (ret);
5849}
5850
Norman Jamesce46e3e2015-08-30 22:25:55 -05005851
5852static void
5853object_notify (GDBusObject *object, GDBusInterface *interface)
5854{
5855 _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
5856 /* info can be NULL if the other end is using a D-Bus interface we don't know
5857 * anything about, for example old generated code in this process talking to
5858 * newer generated code in the other process. */
5859 if (info != NULL)
5860 g_object_notify (G_OBJECT (object), info->hyphen_name);
5861}
5862
5863/**
5864 * ObjectProxy:
5865 *
5866 * The #ObjectProxy structure contains only private data and should only be accessed using the provided API.
5867 */
5868
5869/**
5870 * ObjectProxyClass:
5871 * @parent_class: The parent class.
5872 *
5873 * Class structure for #ObjectProxy.
5874 */
5875
5876static void
5877object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
5878{
5879}
5880
5881static void
5882object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
5883{
5884 iface->interface_added = object_notify;
5885 iface->interface_removed = object_notify;
5886}
5887
5888
5889G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
5890 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init)
5891 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init));
5892
5893static void
5894object_proxy_init (ObjectProxy *object G_GNUC_UNUSED)
5895{
5896}
5897
5898static void
5899object_proxy_set_property (GObject *gobject,
5900 guint prop_id,
5901 const GValue *value G_GNUC_UNUSED,
5902 GParamSpec *pspec)
5903{
5904 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
5905}
5906
5907static void
5908object_proxy_get_property (GObject *gobject,
5909 guint prop_id,
5910 GValue *value,
5911 GParamSpec *pspec)
5912{
5913 ObjectProxy *object = OBJECT_PROXY (gobject);
5914 GDBusInterface *interface;
5915
5916 switch (prop_id)
5917 {
5918 case 1:
5919 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fru");
5920 g_value_take_object (value, interface);
5921 break;
5922
5923 case 2:
5924 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fru.Fan");
5925 g_value_take_object (value, interface);
5926 break;
5927
Norman James90baede2015-09-02 20:32:49 -05005928 case 3:
5929 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fru.Eeprom");
5930 g_value_take_object (value, interface);
5931 break;
5932
Norman Jamesce46e3e2015-08-30 22:25:55 -05005933 default:
5934 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
5935 break;
5936 }
5937}
5938
5939static void
5940object_proxy_class_init (ObjectProxyClass *klass)
5941{
5942 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
5943
5944 gobject_class->set_property = object_proxy_set_property;
5945 gobject_class->get_property = object_proxy_get_property;
5946
5947 g_object_class_override_property (gobject_class, 1, "fru");
5948 g_object_class_override_property (gobject_class, 2, "fru-fan");
Norman James90baede2015-09-02 20:32:49 -05005949 g_object_class_override_property (gobject_class, 3, "fru-eeprom");
Norman Jamesce46e3e2015-08-30 22:25:55 -05005950}
5951
5952/**
5953 * object_proxy_new:
5954 * @connection: A #GDBusConnection.
5955 * @object_path: An object path.
5956 *
5957 * Creates a new proxy object.
5958 *
5959 * Returns: (transfer full): The proxy object.
5960 */
5961ObjectProxy *
5962object_proxy_new (GDBusConnection *connection,
5963 const gchar *object_path)
5964{
5965 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
5966 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
5967 return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
5968}
5969
5970/**
5971 * ObjectSkeleton:
5972 *
5973 * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API.
5974 */
5975
5976/**
5977 * ObjectSkeletonClass:
5978 * @parent_class: The parent class.
5979 *
5980 * Class structure for #ObjectSkeleton.
5981 */
5982
5983static void
5984object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
5985{
5986}
5987
5988
5989static void
5990object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
5991{
5992 iface->interface_added = object_notify;
5993 iface->interface_removed = object_notify;
5994}
5995
5996G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
5997 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init)
5998 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init));
5999
6000static void
6001object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED)
6002{
6003}
6004
6005static void
6006object_skeleton_set_property (GObject *gobject,
6007 guint prop_id,
6008 const GValue *value,
6009 GParamSpec *pspec)
6010{
6011 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
6012 GDBusInterfaceSkeleton *interface;
6013
6014 switch (prop_id)
6015 {
6016 case 1:
6017 interface = g_value_get_object (value);
6018 if (interface != NULL)
6019 {
6020 g_warn_if_fail (IS_FRU (interface));
6021 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
6022 }
6023 else
6024 {
6025 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Fru");
6026 }
6027 break;
6028
6029 case 2:
6030 interface = g_value_get_object (value);
6031 if (interface != NULL)
6032 {
6033 g_warn_if_fail (IS_FRU_FAN (interface));
6034 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
6035 }
6036 else
6037 {
6038 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Fru.Fan");
6039 }
6040 break;
6041
Norman James90baede2015-09-02 20:32:49 -05006042 case 3:
6043 interface = g_value_get_object (value);
6044 if (interface != NULL)
6045 {
6046 g_warn_if_fail (IS_FRU_EEPROM (interface));
6047 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
6048 }
6049 else
6050 {
6051 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Fru.Eeprom");
6052 }
6053 break;
6054
Norman Jamesce46e3e2015-08-30 22:25:55 -05006055 default:
6056 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
6057 break;
6058 }
6059}
6060
6061static void
6062object_skeleton_get_property (GObject *gobject,
6063 guint prop_id,
6064 GValue *value,
6065 GParamSpec *pspec)
6066{
6067 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
6068 GDBusInterface *interface;
6069
6070 switch (prop_id)
6071 {
6072 case 1:
6073 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fru");
6074 g_value_take_object (value, interface);
6075 break;
6076
6077 case 2:
6078 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fru.Fan");
6079 g_value_take_object (value, interface);
6080 break;
6081
Norman James90baede2015-09-02 20:32:49 -05006082 case 3:
6083 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fru.Eeprom");
6084 g_value_take_object (value, interface);
6085 break;
6086
Norman Jamesce46e3e2015-08-30 22:25:55 -05006087 default:
6088 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
6089 break;
6090 }
6091}
6092
6093static void
6094object_skeleton_class_init (ObjectSkeletonClass *klass)
6095{
6096 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
6097
6098 gobject_class->set_property = object_skeleton_set_property;
6099 gobject_class->get_property = object_skeleton_get_property;
6100
6101 g_object_class_override_property (gobject_class, 1, "fru");
6102 g_object_class_override_property (gobject_class, 2, "fru-fan");
Norman James90baede2015-09-02 20:32:49 -05006103 g_object_class_override_property (gobject_class, 3, "fru-eeprom");
Norman Jamesce46e3e2015-08-30 22:25:55 -05006104}
6105
6106/**
6107 * object_skeleton_new:
6108 * @object_path: An object path.
6109 *
6110 * Creates a new skeleton object.
6111 *
6112 * Returns: (transfer full): The skeleton object.
6113 */
6114ObjectSkeleton *
6115object_skeleton_new (const gchar *object_path)
6116{
6117 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
6118 return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
6119}
6120
6121/**
6122 * object_skeleton_set_fru:
6123 * @object: A #ObjectSkeleton.
6124 * @interface_: (allow-none): A #Fru or %NULL to clear the interface.
6125 *
6126 * 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.
6127 */
6128void object_skeleton_set_fru (ObjectSkeleton *object, Fru *interface_)
6129{
6130 g_object_set (G_OBJECT (object), "fru", interface_, NULL);
6131}
6132
6133/**
6134 * object_skeleton_set_fru_fan:
6135 * @object: A #ObjectSkeleton.
6136 * @interface_: (allow-none): A #FruFan or %NULL to clear the interface.
6137 *
6138 * 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.
6139 */
6140void object_skeleton_set_fru_fan (ObjectSkeleton *object, FruFan *interface_)
6141{
6142 g_object_set (G_OBJECT (object), "fru-fan", interface_, NULL);
6143}
6144
Norman James90baede2015-09-02 20:32:49 -05006145/**
6146 * object_skeleton_set_fru_eeprom:
6147 * @object: A #ObjectSkeleton.
6148 * @interface_: (allow-none): A #FruEeprom or %NULL to clear the interface.
6149 *
6150 * Sets the #FruEeprom instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fru-Eeprom.top_of_page">org.openbmc.Fru.Eeprom</link> on @object.
6151 */
6152void object_skeleton_set_fru_eeprom (ObjectSkeleton *object, FruEeprom *interface_)
6153{
6154 g_object_set (G_OBJECT (object), "fru-eeprom", interface_, NULL);
6155}
6156
Norman Jamesce46e3e2015-08-30 22:25:55 -05006157
6158/* ------------------------------------------------------------------------
6159 * Code for ObjectManager client
6160 * ------------------------------------------------------------------------
6161 */
6162
6163/**
6164 * SECTION:ObjectManagerClient
6165 * @title: ObjectManagerClient
6166 * @short_description: Generated GDBusObjectManagerClient type
6167 *
6168 * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
6169 */
6170
6171/**
6172 * ObjectManagerClient:
6173 *
6174 * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API.
6175 */
6176
6177/**
6178 * ObjectManagerClientClass:
6179 * @parent_class: The parent class.
6180 *
6181 * Class structure for #ObjectManagerClient.
6182 */
6183
6184G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT);
6185
6186static void
6187object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED)
6188{
6189}
6190
6191static void
6192object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED)
6193{
6194}
6195
6196/**
6197 * object_manager_client_get_proxy_type:
6198 * @manager: A #GDBusObjectManagerClient.
6199 * @object_path: The object path of the remote object (unused).
6200 * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType.
6201 * @user_data: User data (unused).
6202 *
6203 * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types.
6204 *
6205 * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy.
6206 */
6207GType
6208object_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)
6209{
6210 static gsize once_init_value = 0;
6211 static GHashTable *lookup_hash;
6212 GType ret;
6213
6214 if (interface_name == NULL)
6215 return TYPE_OBJECT_PROXY;
6216 if (g_once_init_enter (&once_init_value))
6217 {
6218 lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
6219 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Fru", GSIZE_TO_POINTER (TYPE_FRU_PROXY));
6220 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Fru.Fan", GSIZE_TO_POINTER (TYPE_FRU_FAN_PROXY));
Norman James90baede2015-09-02 20:32:49 -05006221 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Fru.Eeprom", GSIZE_TO_POINTER (TYPE_FRU_EEPROM_PROXY));
Norman Jamesce46e3e2015-08-30 22:25:55 -05006222 g_once_init_leave (&once_init_value, 1);
6223 }
6224 ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
6225 if (ret == (GType) 0)
6226 ret = G_TYPE_DBUS_PROXY;
6227 return ret;
6228}
6229
6230/**
6231 * object_manager_client_new:
6232 * @connection: A #GDBusConnection.
6233 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
6234 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6235 * @object_path: An object path.
6236 * @cancellable: (allow-none): A #GCancellable or %NULL.
6237 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6238 * @user_data: User data to pass to @callback.
6239 *
6240 * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
6241 *
6242 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
6243 * You can then call object_manager_client_new_finish() to get the result of the operation.
6244 *
6245 * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
6246 */
6247void
6248object_manager_client_new (
6249 GDBusConnection *connection,
6250 GDBusObjectManagerClientFlags flags,
6251 const gchar *name,
6252 const gchar *object_path,
6253 GCancellable *cancellable,
6254 GAsyncReadyCallback callback,
6255 gpointer user_data)
6256{
6257 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);
6258}
6259
6260/**
6261 * object_manager_client_new_finish:
6262 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new().
6263 * @error: Return location for error or %NULL
6264 *
6265 * Finishes an operation started with object_manager_client_new().
6266 *
6267 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
6268 */
6269GDBusObjectManager *
6270object_manager_client_new_finish (
6271 GAsyncResult *res,
6272 GError **error)
6273{
6274 GObject *ret;
6275 GObject *source_object;
6276 source_object = g_async_result_get_source_object (res);
6277 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6278 g_object_unref (source_object);
6279 if (ret != NULL)
6280 return G_DBUS_OBJECT_MANAGER (ret);
6281 else
6282 return NULL;
6283}
6284
6285/**
6286 * object_manager_client_new_sync:
6287 * @connection: A #GDBusConnection.
6288 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
6289 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6290 * @object_path: An object path.
6291 * @cancellable: (allow-none): A #GCancellable or %NULL.
6292 * @error: Return location for error or %NULL
6293 *
6294 * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
6295 *
6296 * The calling thread is blocked until a reply is received.
6297 *
6298 * See object_manager_client_new() for the asynchronous version of this constructor.
6299 *
6300 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
6301 */
6302GDBusObjectManager *
6303object_manager_client_new_sync (
6304 GDBusConnection *connection,
6305 GDBusObjectManagerClientFlags flags,
6306 const gchar *name,
6307 const gchar *object_path,
6308 GCancellable *cancellable,
6309 GError **error)
6310{
6311 GInitable *ret;
6312 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);
6313 if (ret != NULL)
6314 return G_DBUS_OBJECT_MANAGER (ret);
6315 else
6316 return NULL;
6317}
6318
6319
6320/**
6321 * object_manager_client_new_for_bus:
6322 * @bus_type: A #GBusType.
6323 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
6324 * @name: A bus name (well-known or unique).
6325 * @object_path: An object path.
6326 * @cancellable: (allow-none): A #GCancellable or %NULL.
6327 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6328 * @user_data: User data to pass to @callback.
6329 *
6330 * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
6331 *
6332 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
6333 * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation.
6334 *
6335 * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
6336 */
6337void
6338object_manager_client_new_for_bus (
6339 GBusType bus_type,
6340 GDBusObjectManagerClientFlags flags,
6341 const gchar *name,
6342 const gchar *object_path,
6343 GCancellable *cancellable,
6344 GAsyncReadyCallback callback,
6345 gpointer user_data)
6346{
6347 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);
6348}
6349
6350/**
6351 * object_manager_client_new_for_bus_finish:
6352 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus().
6353 * @error: Return location for error or %NULL
6354 *
6355 * Finishes an operation started with object_manager_client_new_for_bus().
6356 *
6357 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
6358 */
6359GDBusObjectManager *
6360object_manager_client_new_for_bus_finish (
6361 GAsyncResult *res,
6362 GError **error)
6363{
6364 GObject *ret;
6365 GObject *source_object;
6366 source_object = g_async_result_get_source_object (res);
6367 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6368 g_object_unref (source_object);
6369 if (ret != NULL)
6370 return G_DBUS_OBJECT_MANAGER (ret);
6371 else
6372 return NULL;
6373}
6374
6375/**
6376 * object_manager_client_new_for_bus_sync:
6377 * @bus_type: A #GBusType.
6378 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
6379 * @name: A bus name (well-known or unique).
6380 * @object_path: An object path.
6381 * @cancellable: (allow-none): A #GCancellable or %NULL.
6382 * @error: Return location for error or %NULL
6383 *
6384 * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
6385 *
6386 * The calling thread is blocked until a reply is received.
6387 *
6388 * See object_manager_client_new_for_bus() for the asynchronous version of this constructor.
6389 *
6390 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
6391 */
6392GDBusObjectManager *
6393object_manager_client_new_for_bus_sync (
6394 GBusType bus_type,
6395 GDBusObjectManagerClientFlags flags,
6396 const gchar *name,
6397 const gchar *object_path,
6398 GCancellable *cancellable,
6399 GError **error)
6400{
6401 GInitable *ret;
6402 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);
6403 if (ret != NULL)
6404 return G_DBUS_OBJECT_MANAGER (ret);
6405 else
6406 return NULL;
6407}
6408
6409